diff --git a/.checkov.yml b/.checkov.yml new file mode 100644 index 00000000000..12f0d8b3841 --- /dev/null +++ b/.checkov.yml @@ -0,0 +1,6 @@ +--- +# You can see all available properties here: https://github.com/bridgecrewio/checkov#configuration-using-a-config-file +quiet: true +skip-check: + - CKV_DOCKER_2 + - CKV_GHA_7 diff --git a/.github/labeler.yml b/.github/labeler.yml index 14e9bcefdba..b58bc4a81db 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -9,7 +9,23 @@ common: infrastructure: - changed-files: - - any-glob-to-any-file: ['.github/**', 'cmake/**', 'dependencies/**', 'packaging/**'] + - any-glob-to-any-file: + - '.clang-format' + - '.clang-tidy' + - '.flake8' + - '.github/**' + - '.checkov.yml' + - '.mega-linter.yml' + - 'cmake/**' + - 'CODEOWNERS' + - 'CPPLINT.cfg' + - 'dependencies/**' + - 'packaging/**' + - 'pyproject.toml' + +datamodel: + - changed-files: + - any-glob-to-any-file: ['DataModel/**', '*/DataModel/**'] dpg: - changed-files: diff --git a/.github/workflows/clean-test.yml b/.github/workflows/clean-test.yml new file mode 100644 index 00000000000..c6c9bc12067 --- /dev/null +++ b/.github/workflows/clean-test.yml @@ -0,0 +1,51 @@ +--- +name: Clean PR checks + +'on': + workflow_dispatch: + inputs: + pr: + description: PR number in this repo to be cleaned + type: string # can't use number here + required: true + message: + description: Human-readable message displayed on the new pending status + type: string + required: false + default: '' + + # Warning: GitHub limits the total number of inputs to 10, so a maximum of + # 8 checks is allowed here! + # Warning: the check_* keys are magic and must consist of the string + # "check_" followed by the applicable check name exactly. The + # "description" field is only the human-readable label for the input. + 'check_build/O2Physics/o2/macOS-arm': + description: build/O2Physics/o2/macOS-arm + type: boolean + default: true + + 'check_build/O2Physics/o2/macOS': + description: build/O2Physics/o2/macOS + type: boolean + default: true + + 'check_build/O2Physics/o2': + description: build/O2Physics/o2 + type: boolean + default: true + +permissions: {} + +jobs: + clean: + name: Clean PR checks + uses: alisw/ali-bot/.github/workflows/clean-pr-checks.yml@master + with: + owner: ${{ github.event.repository.owner.login }} + repo: ${{ github.event.repository.name }} + pr: ${{ github.event.inputs.pr }} + message: ${{ github.event.inputs.message }} + checks: ${{ toJSON(github.event.inputs) }} + permissions: + pull-requests: read # to get last commit for pr (octokit/graphql-action) + statuses: write # for set-github-status diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 061c0208452..3f8fa9bc1b6 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,7 +1,8 @@ --- name: "Pull Request Labeler" -on: - - pull_request_target +'on': + pull_request_target: + types: [opened, synchronize, reopened, edited] permissions: read-all jobs: @@ -10,8 +11,112 @@ jobs: permissions: contents: read pull-requests: write + outputs: + labels: ${{ steps.labeler.outputs.all-labels }} steps: - - uses: actions/labeler@v5 + - name: Label the PR + id: labeler + uses: actions/labeler@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} sync-labels: true + title-prefix-checker: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + needs: labeler + steps: + - name: Check the PR title prefix + id: check-prefix + env: + title: ${{ github.event.pull_request.title }} + labels: ${{ needs.labeler.outputs.labels }} + shell: python + run: | + import os + import re + import sys + title = os.environ['title'] + labels = os.environ['labels'] + tags = { + "infrastructure": "Infrastructure", + "common": "Common", + "alice3": "ALICE3", + "pwgcf": "PWGCF", + "pwgdq": "PWGDQ", + "pwgem": "PWGEM", + "pwghf": "PWGHF", + "pwgje": "PWGJE", + "pwglf": "PWGLF", + "pwgud": "PWGUD", + "dpg": "DPG", + "trigger": "Trigger", + "tutorial": "Tutorial", + } + print(f'PR title: "{title}"') + print(f'PR labels: "{labels}"') + tags_relevant = [tags[label] for label in tags if label in labels.split(",")] + print("Relevant title tags:", ",".join(tags_relevant)) + passed = True + prefix_good = ",".join(tags_relevant) + prefix_good = f"[{prefix_good}] " + print(f"Generated prefix: {prefix_good}") + replace_title = 0 + title_new = title + # If there is a prefix which contains a known tag, check it for correct tags, and reformat it if needed. + # If there is a prefix which does not contain any known tag, add the tag prefix. + # If there is no prefix, add the tag prefix. + if match := re.match(r"\[?(\w[\w, /\+-]+)[\]:]+ ", title): + prefix_title = match.group(1) + words_prefix_title = prefix_title.replace(",", " ").replace("/", " ").split() + title_stripped = title[len(match.group()) :] + print(f'PR title prefix: "{prefix_title}" -> tags: {words_prefix_title}') + print(f'Stripped PR title: "{title_stripped}"') + if any(tag in words_prefix_title for tag in tags.values()): + for tag in tags.values(): + if tag in tags_relevant and tag not in words_prefix_title: + print(f'::error::Relevant tag "{tag}" not found in the prefix of the PR title.') + passed = False + if tag not in tags_relevant and tag in words_prefix_title: + print(f'::error::Irrelevant tag "{tag}" found in the prefix of the PR title.') + passed = False + # Format a valid prefix. + if passed: + prefix_good = ",".join(w for w in prefix_title.replace(",", " ").split() if w) + prefix_good = f"[{prefix_good}] " + print(f"::notice::Reformatted prefix: {prefix_good}") + if match.group() != prefix_good: + replace_title = 1 + title_new = prefix_good + title_stripped + else: + print("::warning::No known tags found in the prefix.") + if tags_relevant: + replace_title = 1 + title_new = prefix_good + title + else: + print("::warning::No valid prefix found in the PR title.") + if tags_relevant: + replace_title = 1 + title_new = prefix_good + title + if not passed: + print("::error::Problems were found in the PR title prefix.") + print('::notice::Use the form "tags: title" or "[tags] title".') + sys.exit(1) + if replace_title: + print("::warning::The PR title prefix with tags needs to be added or adjusted.") + print(f'::warning::New title: "{title_new}".') + else: + print("::notice::The PR title prefix is fine.") + with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as fh: + print(f"replace={replace_title}", file=fh) + print(f"title={title_new}", file=fh) + - name: Fix the PR title prefix + if: ${{ steps.check-prefix.outputs.replace == 1 }} + uses: the-wright-jamie/Update-PR-Info-Action@v1.1.0 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + base-branch-regex: master + error-on-fail: false + title-template: "${{ steps.check-prefix.outputs.title }}" + title-update-action: replace diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 4f71b741dcf..28bb7877865 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -38,7 +38,7 @@ jobs: id: ml # You can override MegaLinter flavor used to have faster performances # More info at https://megalinter.io/flavors/ - uses: oxsecurity/megalinter@v8 + uses: oxsecurity/megalinter@v8.1.0 env: # All available variables are described in documentation: # https://megalinter.io/configuration/ diff --git a/.github/workflows/o2-linter.yml b/.github/workflows/o2-linter.yml new file mode 100644 index 00000000000..8e150e970fd --- /dev/null +++ b/.github/workflows/o2-linter.yml @@ -0,0 +1,34 @@ +--- +# Find issues in O2 code +name: O2 linter + +'on': [pull_request, push] +permissions: {} +env: + MAIN_BRANCH: master + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +jobs: + o2-linter: + name: O2 linter + runs-on: ubuntu-24.04 + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # needed to get the full history + - name: Run tests + run: | + # Diff against the common ancestor of the source branch and the main branch. + readarray -t files < <(git diff --diff-filter d --name-only origin/${{ env.MAIN_BRANCH }}...) + if [ ${#files[@]} -eq 0 ]; then + echo "::notice::No files to lint." + exit 0 + fi + [ ${{ github.event_name }} == 'pull_request' ] && options="-g" + # shellcheck disable=SC2086 # Ignore unquoted options. + python3 Scripts/o2_linter.py $options "${files[@]}" + echo "Tip: If you allow actions in your fork repository, O2 linter will run when you push commits." diff --git a/ALICE3/TableProducer/OTF/onTheFlyTOFPID.cxx b/ALICE3/TableProducer/OTF/onTheFlyTOFPID.cxx index 39ace42c926..3a907d47342 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTOFPID.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTOFPID.cxx @@ -81,6 +81,8 @@ struct OnTheFlyTOFPID { Configurable nBinsTrackDeltaLength{"nBinsTrackDeltaLength", 100, "number of bins in delta track length"}; Configurable nBinsNsigmaCorrectSpecies{"nBinsNsigmaCorrectSpecies", 200, "number of bins in Nsigma plot (correct speies)"}; Configurable nBinsNsigmaWrongSpecies{"nBinsNsigmaWrongSpecies", 200, "number of bins in Nsigma plot (wrong species)"}; + Configurable minNsigmaRange{"minNsigmaRange", -10, "lower limit for the nsigma axis"}; + Configurable maxNsigmaRange{"maxNsigmaRange", +10, "upper limit for the nsigma axis"}; Configurable nBinsTimeRes{"nBinsTimeRes", 400, "number of bins plots time resolution"}; Configurable nBinsRelativeEtaPt{"nBinsRelativeEtaPt", 400, "number of bins plots pt and eta relative errors"}; Configurable nBinsEta{"nBinsEta", 400, "number of bins plot relative eta error"}; @@ -138,7 +140,7 @@ struct OnTheFlyTOFPID { } if (doQAplots) { - const AxisSpec axisMomentum{static_cast(nBinsP), 0.0f, +4.0f, "#it{p} (GeV/#it{c})"}; + const AxisSpec axisMomentum{static_cast(nBinsP), 0.0f, +10.0f, "#it{p} (GeV/#it{c})"}; const AxisSpec axisMomentumSmall{static_cast(nBinsP), 0.0f, +1.0f, "#it{p} (GeV/#it{c})"}; const AxisSpec axisVelocity{static_cast(nBinsBeta), 0.0f, +1.1f, "Measured #beta"}; const AxisSpec axisTrackLengthInner{static_cast(nBinsTrackLengthInner), 0.0f, 60.0f, "Track length (cm)"}; @@ -182,11 +184,11 @@ struct OnTheFlyTOFPID { std::string name_title_inner = "h2dInnerNsigmaTrue" + particle_names2[i_true] + "Vs" + particle_names2[i_hyp] + "Hypothesis"; std::string name_title_outer = "h2dOuterNsigmaTrue" + particle_names2[i_true] + "Vs" + particle_names2[i_hyp] + "Hypothesis"; if (i_true == i_hyp) { - const AxisSpec axisNsigmaCorrect{static_cast(nBinsNsigmaCorrectSpecies), -10.0f, +10.0f, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"}; + const AxisSpec axisNsigmaCorrect{static_cast(nBinsNsigmaCorrectSpecies), minNsigmaRange, maxNsigmaRange, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"}; histos.add(name_title_inner.c_str(), name_title_inner.c_str(), kTH2F, {axisMomentum, axisNsigmaCorrect}); histos.add(name_title_outer.c_str(), name_title_outer.c_str(), kTH2F, {axisMomentum, axisNsigmaCorrect}); } else { - const AxisSpec axisNsigmaWrong{static_cast(nBinsNsigmaWrongSpecies), -10.0f, +10.0f, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"}; + const AxisSpec axisNsigmaWrong{static_cast(nBinsNsigmaWrongSpecies), minNsigmaRange, maxNsigmaRange, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"}; histos.add(name_title_inner.c_str(), name_title_inner.c_str(), kTH2F, {axisMomentum, axisNsigmaWrong}); histos.add(name_title_outer.c_str(), name_title_outer.c_str(), kTH2F, {axisMomentum, axisNsigmaWrong}); } diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 9f0578cd97e..9a77c9e682a 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -81,7 +81,7 @@ struct OnTheFlyTracker { Produces upgradeCascades; // optionally produced, empty (to be tuned later) - Produces tracksExtra; // base table, extend later + Produces tracksExtra; // base table, extend later Produces trackSelection; Produces trackSelectionExtension; diff --git a/ALICE3/TableProducer/alice3-multicharm.cxx b/ALICE3/TableProducer/alice3-multicharm.cxx index f695224b7c5..71be5256362 100644 --- a/ALICE3/TableProducer/alice3-multicharm.cxx +++ b/ALICE3/TableProducer/alice3-multicharm.cxx @@ -499,7 +499,7 @@ struct alice3multicharm { continue; // do not take if radius too small, likely a primary combination o2::dataformats::DCA dcaInfo; - float xicdcaXY = 1e+10, xicdcaZ = 1e+10; + float xicdcaXY = 1e+10; o2::track::TrackParCov xicTrackCopy(xicTrack); // paranoia o2::vertexing::PVertex primaryVertex; @@ -507,7 +507,6 @@ struct alice3multicharm { if (xicTrackCopy.propagateToDCA(primaryVertex, magneticField, &dcaInfo)) { xicdcaXY = dcaInfo.getY(); - xicdcaZ = dcaInfo.getZ(); } histos.fill(HIST("hMassXiC"), thisXiCcandidate.mass); @@ -543,10 +542,9 @@ struct alice3multicharm { o2::track::TrackParCov xiccTrack(thisXiCCcandidate.xyz, momentumCC, thisXiCCcandidate.parentTrackCovMatrix, +2); - float xiccdcaXY = 1e+10, xiccdcaZ = 1e+10; + float xiccdcaXY = 1e+10; if (xiccTrack.propagateToDCA(primaryVertex, magneticField, &dcaInfo)) { xiccdcaXY = dcaInfo.getY(); - xiccdcaZ = dcaInfo.getZ(); } // produce multi-charm table for posterior analysis diff --git a/CODEOWNERS b/CODEOWNERS index e47ee41332d..5974be54430 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -15,7 +15,7 @@ /Common/CCDB @alibuild @jgrosseo @iarsene @ekryshen @ddobrigk /Common/Tools/Multiplicity @alibuild @ddobrigk @victor-gonzalez /ALICE3 @alibuild @njacazio @hscheid -/DPG @alibuild @chiarazampolli @noferini +/DPG @alibuild @chiarazampolli @alcaliva @catalinristea /DPG/Tasks/AOTEvent @alibuild @ekryshen @strogolo @altsybee /DPG/Tasks/AOTTrack @alibuild @mfaggin @iouribelikov @njacazio /DPG/Tasks/TOF @alibuild @noferini @njacazio @@ -33,7 +33,7 @@ /PWGCF/TableProducer @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye /PWGCF/Tasks @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye /PWGDQ @alibuild @iarsene @dsekihat @feisenhu @lucamicheletti93 -/PWGEM @alibuild @mikesas @rbailhac @feisenhu +/PWGEM @alibuild @feisenhu @dsekihat @ivorobye /PWGEM/Dilepton @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu /PWGEM/PhotonMeson @alibuild @mikesas @rbailhac @m-c-danisch @novitzky @mhemmer-cern @dsekihat /PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano @@ -43,8 +43,8 @@ /PWGLF/TableProducer/GlobalEventProperties @alibuild @njacazio @skundu692 @gbencedi @omvazque /PWGLF/Tasks/Nuspex @alibuild @njacazio @skundu692 @fmazzasc @chiarapinto @maciacco /PWGLF/TableProducer/Nuspex @alibuild @njacazio @skundu692 @fmazzasc @chiarapinto @maciacco -/PWGLF/Tasks/Resonances @alibuild @njacazio @skundu692 @BongHwi @smaff92 -/PWGLF/TableProducer/Resonances @alibuild @njacazio @skundu692 @BongHwi @smaff92 +/PWGLF/Tasks/Resonances @alibuild @njacazio @skundu692 @dmallick2 @smaff92 +/PWGLF/TableProducer/Resonances @alibuild @njacazio @skundu692 @dmallick2 @smaff92 /PWGLF/Tasks/Strangeness @alibuild @njacazio @skundu692 @ercolessi @ChiaraDeMartin95 /PWGLF/TableProducer/Strangeness @alibuild @njacazio @skundu692 @ercolessi @ChiaraDeMartin95 @@ -55,7 +55,7 @@ /PWGMM/UE @alibuild @aalkin @aortizve /PWGUD @alibuild @pbuehler @abylinkin @rolavick -/PWGJE @alibuild @lhavener @maoyx @nzardosh @ddobrigk @mfasDa +/PWGJE @alibuild @lhavener @maoyx @nzardosh @fjonasALICE @mfasDa @mhemmer-cern /Tools/PIDML @alibuild @saganatt /Tools/ML @alibuild @fcatalan92 @fmazzasc /Tutorials/PWGCF @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul diff --git a/CPPLINT.cfg b/CPPLINT.cfg index e050d1df67c..7f7d3c357c3 100644 --- a/CPPLINT.cfg +++ b/CPPLINT.cfg @@ -1 +1 @@ -filter=-build/c++11,-build/namespaces,-readability/fn_size,-readability/todo,-runtime/references,-whitespace/blank_line,-whitespace/braces,-whitespace/comments,-whitespace/line_length,-whitespace/semicolon,-whitespace/todo +filter=-build/c++11,-build/namespaces,-readability/fn_size,-readability/todo,-runtime/references,-whitespace/blank_line,-whitespace/braces,-whitespace/comments,-whitespace/indent_namespace,-whitespace/line_length,-whitespace/semicolon,-whitespace/todo diff --git a/Common/CCDB/EventSelectionParams.cxx b/Common/CCDB/EventSelectionParams.cxx index 86bf76a6419..43eb6d00b72 100644 --- a/Common/CCDB/EventSelectionParams.cxx +++ b/Common/CCDB/EventSelectionParams.cxx @@ -60,7 +60,8 @@ const char* selectionLabels[kNsel] = { "kNoCollInTimeRangeStandard", "kNoCollInTimeRangeVzDependent", "kNoCollInRofStrict", - "kNoCollInRofStandard"}; + "kNoCollInRofStandard", + "kNoHighMultCollInPrevRof"}; } // namespace o2::aod::evsel using namespace o2::aod::evsel; diff --git a/Common/CCDB/EventSelectionParams.h b/Common/CCDB/EventSelectionParams.h index 143de878bc5..b5e1f44b91c 100644 --- a/Common/CCDB/EventSelectionParams.h +++ b/Common/CCDB/EventSelectionParams.h @@ -66,6 +66,7 @@ enum EventSelectionFlags { kNoCollInTimeRangeVzDependent, // no other collisions in vZ-dependent time range near a given collision kNoCollInRofStrict, // no other collisions in this Readout Frame kNoCollInRofStandard, // no other collisions in this Readout Frame with per-collision multiplicity above threshold + kNoHighMultCollInPrevRof, // veto an event if FT0C amplitude in previous ITS ROF is above threshold kNsel // counter }; diff --git a/Common/Core/FFitWeights.cxx b/Common/Core/FFitWeights.cxx index 747664fd8e4..9c98479627d 100644 --- a/Common/Core/FFitWeights.cxx +++ b/Common/Core/FFitWeights.cxx @@ -10,42 +10,37 @@ // or submit itself to any jurisdiction. /// \file FFitWeights.cxx -/// \brief Implementation file for FFitWeights.h, see the header fore more information +/// \brief Implementation file for FFitWeights.h, see the header for more information /// -/// \author Joachim C. K. B. Hansen, Lund University +/// \author Joachim C. K. B. Hansen #include "FFitWeights.h" -// using std::complex; -// using std::pair; -// using std::string; -// using std::vector; +#include ClassImp(FFitWeights) FFitWeights::FFitWeights() : TNamed("", ""), fW_data{nullptr}, - vGain{0}, CentBin{100}, - ChIDBin{220}, - sAmpl{nullptr}, - sqVec{nullptr}, - sqCorVec{nullptr} + qAxis{nullptr}, + nResolution{3000}, + qnTYPE{0} { } FFitWeights::FFitWeights(const char* name) : TNamed(name, name), fW_data{nullptr}, - vGain{0}, CentBin{100}, - ChIDBin{220}, - sAmpl{nullptr}, - sqVec{nullptr}, - sqCorVec{nullptr} {} + qAxis{nullptr}, + nResolution{3000}, + qnTYPE{0} {} FFitWeights::~FFitWeights() { delete fW_data; + if (qAxis) + delete qAxis; }; void FFitWeights::Init() @@ -54,31 +49,14 @@ void FFitWeights::Init() fW_data->SetName("FFitWeights_Data"); fW_data->SetOwner(kTRUE); - this->SetBinAxis(1000, 0, 5000, 0); - this->SetBinAxis(250, -3500, 3500, 1); - this->SetBinAxis(250, -250, 250, 2); - - const char* tnd = "FT0Ampl"; - fW_data->Add(new TH2F(tnd, ";channel;amplitude", ChIDBin, 0, ChIDBin, sAmpl->GetNbins(), sAmpl->GetXmin(), sAmpl->GetXmax())); - fW_data->Add(new TH2F(Form("%sCorr", tnd), ";channel;amplitude", ChIDBin, 0, ChIDBin, sAmpl->GetNbins(), sAmpl->GetXmin(), sAmpl->GetXmax())); - - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C", "x", 2), ";Centrality;Qx_{2}", CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C", "y", 2), ";Centrality;Qy_{2}", CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C", "x", 3), ";Centrality;Qx_{3}", CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C", "y", 3), ";Centrality;Qy_{3}", CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C_Rec", "x", 2), ";Centrality;Qx_{2}", CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C_Rec", "y", 2), ";Centrality;Qy_{2}", CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C_Rec", "x", 3), ";Centrality;Qx_{3}", CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C_Rec", "y", 3), ";Centrality;Qy_{3}", CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C_RecTot", "x", 2), ";Centrality;Qx_{2}", CentBin, 0, CentBin, sqCorVec->GetNbins(), sqCorVec->GetXmin(), sqCorVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C_RecTot", "y", 2), ";Centrality;Qy_{2}", CentBin, 0, CentBin, sqCorVec->GetNbins(), sqCorVec->GetXmin(), sqCorVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C_RecTot", "x", 3), ";Centrality;Qx_{3}", CentBin, 0, CentBin, sqCorVec->GetNbins(), sqCorVec->GetXmin(), sqCorVec->GetXmax())); - fW_data->Add(new TH2F(Form("hQ%s%i_FT0C_RecTot", "y", 3), ";Centrality;Qy_{3}", CentBin, 0, CentBin, sqCorVec->GetNbins(), sqCorVec->GetXmin(), sqCorVec->GetXmax())); + if (!qAxis) + this->SetBinAxis(500, 0, 25); + for (const auto& qn : qnTYPE) { + fW_data->Add(new TH2D(this->GetQName(qn.first, qn.second.c_str()), this->GetAxisName(qn.first, qn.second.c_str()), CentBin, 0, CentBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax())); + } }; -void FFitWeights::FillFT0(std::size_t iCh, float amplitude, float GainCst) +void FFitWeights::Fill(float centrality, float qn, int nh, const char* pf) { TObjArray* tar{nullptr}; @@ -86,209 +64,107 @@ void FFitWeights::FillFT0(std::size_t iCh, float amplitude, float GainCst) if (!tar) return; - TH2F* th2 = reinterpret_cast(tar->FindObject("FT0Ampl")); + TH2D* th2 = reinterpret_cast(tar->FindObject(this->GetQName(nh, pf))); if (!th2) { - tar->Add(new TH2F("FT0Ampl", ";channel;amplitude", ChIDBin, 0, ChIDBin, sAmpl->GetNbins(), sAmpl->GetXmin(), sAmpl->GetXmax())); - th2 = reinterpret_cast(tar->At(tar->GetEntries() - 1)); + tar->Add(new TH2D(this->GetQName(nh, pf), this->GetAxisName(nh, pf), CentBin, 0, CentBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax())); + th2 = reinterpret_cast(tar->At(tar->GetEntries() - 1)); } - th2->Fill(iCh, amplitude); - - TH2F* th2Cor = reinterpret_cast(tar->FindObject("FT0AmplCorr")); - if (!th2Cor) { - tar->Add(new TH2F("FT0AmplCorr", ";channel;amplitude", ChIDBin, 0, ChIDBin, sAmpl->GetNbins(), sAmpl->GetXmin(), sAmpl->GetXmax())); - th2Cor = reinterpret_cast(tar->At(tar->GetEntries() - 1)); - } - th2Cor->Fill(iCh, amplitude / GainCst); + th2->Fill(centrality, qn); }; -void FFitWeights::FillQ(float mult, float vec, int nHarm, const char* coord, const char* qType) +Long64_t FFitWeights::Merge(TCollection* collist) { - TObjArray* tar{nullptr}; - - tar = fW_data; - if (!tar) - return; - - TH2F* th2 = reinterpret_cast(tar->FindObject(Form("hQ%s%i_FT0C%s", coord, nHarm, qType))); - if (!th2) { - tar->Add(new TH2F(Form("hQ%s%i_FT0C%s", coord, nHarm, qType), Form(";Centrality;Q%s_{%i}", coord, nHarm), CentBin, 0, CentBin, sqVec->GetNbins(), sqVec->GetXmin(), sqVec->GetXmax())); - th2 = reinterpret_cast(tar->At(tar->GetEntries() - 1)); + Long64_t nmerged = 0; + if (!fW_data) { + fW_data = new TObjArray(); + fW_data->SetName("FFitWeights_Data"); + fW_data->SetOwner(kTRUE); + } + FFitWeights* l_w = 0; + TIter all_w(collist); + while ((l_w = (reinterpret_cast(all_w())))) { + AddArray(fW_data, l_w->GetDataArray()); + nmerged++; } - th2->Fill(mult, vec); + return nmerged; }; - -void FFitWeights::CreateGain() +void FFitWeights::AddArray(TObjArray* targ, TObjArray* sour) { - vGain.clear(); - - TH1D* h1; - if (fW_data->GetEntries() < 1) + if (!sour) { + printf("Source array does not exist!\n"); return; - - TH2F* hGain = reinterpret_cast(fW_data->At(0)->Clone("FT0Ampl")); - double vMean{0}; // = hGain->GetMean(2); - // c-side first bin ich: 97 (last 208)' - // gain split for c-side 144 - hGain->GetXaxis()->SetRangeUser(96, 144); - float vMeanC_inner = hGain->GetMean(2); - - hGain->GetXaxis()->SetRangeUser(144, 208); - float vMeanC_outer = hGain->GetMean(2); - - hGain->GetXaxis()->SetRangeUser(0, -1); - - for (int iCh{0}; iCh < hGain->GetNbinsX(); iCh++) { - h1 = static_cast(hGain->ProjectionY(Form("proj%i", iCh), iCh, iCh)); - double mean = h1->GetMean(); - double meanErr = h1->GetMeanError(); - - if (iCh > 95 && iCh < 144) - vMean = vMeanC_inner; - else if (iCh > 144) - vMean = vMeanC_outer; - double fWeight = mean / vMean; - - if (fWeight > 0) { - vGain.push_back(fWeight); + } + for (int i = 0; i < sour->GetEntries(); i++) { + TH2D* sourh = reinterpret_cast(sour->At(i)); + TH2D* targh = reinterpret_cast(targ->FindObject(sourh->GetName())); + if (!targh) { + targh = reinterpret_cast(sourh->Clone(sourh->GetName())); + targh->SetDirectory(0); + targ->Add(targh); } else { - vGain.push_back(1.0); + targh->Add(sourh); } - - TObjArray* tar = fW_data; - if (!tar) - return; - - fW_data->Add(new TH1F("FT0MultCorr", ";channel", ChIDBin, 0, ChIDBin)); - TH1F* htmp = reinterpret_cast(tar->FindObject("FT0MultCorr")); - if (!htmp) - return; - - htmp->SetBinContent(iCh, mean); - htmp->SetBinError(iCh, meanErr); } - - // note to self if FT0A is implemented this has to be done differently -}; - -std::vector FFitWeights::GetGain() -{ - return vGain; }; -void FFitWeights::CreateRecenter(const char* xy) +void FFitWeights::qSelectionSpline(std::vector nhv, std::vector stv) /* only execute OFFLINE */ { - if (fW_data->GetEntries() < 1) - return; - TObjArray* tar{nullptr}; tar = fW_data; if (!tar) return; - for (int nHarm{2}; nHarm <= 3; nHarm++) { - fW_data->Add(new TH1F(Form("havgQ%s%i_FT0C", xy, nHarm), "", CentBin, 0, CentBin)); - TH1F* hRec = reinterpret_cast(tar->FindObject(Form("havgQ%s%i_FT0C", xy, nHarm))); - if (!hRec) - return; - - TH2F* hQ = reinterpret_cast(fW_data->At(0)->Clone(Form("hQ%s%i_FT0C", xy, nHarm))); - TH1D* h1; - - for (int i{1}; i < hQ->GetXaxis()->GetNbins() + 1; i++) { - h1 = static_cast(hQ->ProjectionY(Form("proj%i_Q%s%is", i, xy, nHarm), i, i)); - - double mean = h1->GetMean(); - double meanErr = h1->GetMeanError(); - int binc = hRec->GetXaxis()->GetBinCenter(i); - - hRec->SetBinContent(binc, mean); - hRec->SetBinError(binc, meanErr); + for (const auto& pf : stv) { + for (const auto& nh : nhv) { + TH2D* th2 = reinterpret_cast(tar->FindObject(this->GetQName(nh, pf.c_str()))); + if (!th2) { + printf("qh not found!\n"); + return; + } + + TH1D* tmp = nullptr; + TGraph* tmpgr = nullptr; + TSpline3* spline = nullptr; + for (int iSP{0}; iSP < 90; iSP++) { + tmp = th2->ProjectionY(Form("q%i_%i_%i", nh, iSP, iSP + 1), iSP + 1, iSP + 1); + std::vector xq(nResolution); + std::vector yq(nResolution); + for (int i{0}; i < nResolution; i++) + xq[i] = static_cast(i + 1) / static_cast(nResolution); + tmp->GetQuantiles(nResolution, yq.data(), xq.data()); + tmpgr = new TGraph(nResolution, yq.data(), xq.data()); + spline = new TSpline3(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP), tmpgr); + spline->SetName(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP)); + fW_data->Add(spline); + } } } }; -void FFitWeights::CreateRMS(const char* xy) +float FFitWeights::EvalSplines(float centr, const float& dqn, const int nh, const char* pf) { - if (fW_data->GetEntries() < 1) - return; - TObjArray* tar{nullptr}; tar = fW_data; if (!tar) - return; + return -1; - for (int nHarm{2}; nHarm <= 3; nHarm++) { - fW_data->Add(new TH1F(Form("hrmsQ%s%i_FT0C", xy, nHarm), "", CentBin, 0, CentBin)); - TH1F* hRec = reinterpret_cast(tar->FindObject(Form("hrmsQ%s%i_FT0C", xy, nHarm))); - if (!hRec) - return; - - TH2F* hQ = reinterpret_cast(fW_data->At(0)->Clone(Form("hQ%s%i_FT0C", xy, nHarm))); - TH1D* h1; - - for (int i{1}; i < hQ->GetXaxis()->GetNbins() + 1; i++) { - h1 = static_cast(hQ->ProjectionY(Form("proj%i_Q%s%is", i, xy, nHarm), i, i)); - - double mean = h1->GetRMS(); - double meanErr = h1->GetRMSError(); - int binc = hRec->GetXaxis()->GetBinCenter(i); - - hRec->SetBinContent(binc, mean); - hRec->SetBinError(binc, meanErr); - } + int isp = static_cast(centr); + if (isp < 0 || isp > 90) { + return -1; } -}; - -float FFitWeights::GetRecVal(int cent, const char* xy, const int nHarm) -{ - TObjArray* tar{nullptr}; - - tar = fW_data; - if (!tar) - return -999; - - TH1F* htmp = reinterpret_cast(tar->FindObject(Form("havgQ%s%i_FT0C", xy, nHarm))); - - return htmp->GetBinContent(cent); -}; -float FFitWeights::GetRMSVal(int cent, const char* xy, const int nHarm) -{ - TObjArray* tar{nullptr}; - - tar = fW_data; - if (!tar) - return -999; - - TH1F* htmp = reinterpret_cast(tar->FindObject(Form("hrmsQ%s%i_FT0C", xy, nHarm))); - - return htmp->GetBinContent(cent); -}; - -TH1F* FFitWeights::GetRecHist(const char* xy, const int nHarm) -{ - TObjArray* tar{nullptr}; - - tar = fW_data; - if (!tar) - return nullptr; - - return reinterpret_cast(tar->FindObject(Form("havgQ%s%i_FT0C", xy, nHarm))); -}; - -TH1F* FFitWeights::GetRmsHist(const char* xy, const int nHarm) -{ - TObjArray* tar{nullptr}; + TSpline3* spline = nullptr; + spline = reinterpret_cast(tar->FindObject(Form("sp_q%i%s_%i", nh, pf, isp))); + if (!spline) { + return -1; + } - tar = fW_data; - if (!tar) - return nullptr; + float qn_val = 100. * spline->Eval(dqn); + if (qn_val < 0) { + return -1; + } - return reinterpret_cast(tar->FindObject(Form("hrmsQ%s%i_FT0C", xy, nHarm))); + return qn_val; }; - -// float FFitWeights::EventPlane(const float& x, const float& y, const float& nHarm) { -// return 1/nHarm * TMath::ATan2(y, x); -// }; diff --git a/Common/Core/FFitWeights.h b/Common/Core/FFitWeights.h index 2b374a94a88..0a3d285176e 100644 --- a/Common/Core/FFitWeights.h +++ b/Common/Core/FFitWeights.h @@ -10,9 +10,9 @@ // or submit itself to any jurisdiction. /// \file FFitWeights.h -/// \brief Class for handling fit weights. Right now holds FT0, will hold methods for loading and calculating all ESE splines in the future. +/// \brief Class for handling fit weights for ESE framework. Hold methods for loading and calculating all ESE splines. Supports FT0C, in the future it will support FT0A, FV0A and TPC. /// -/// \author Joachim C. K. B. Hansen, Lund University +/// \author Joachim C. K. B. Hansen #ifndef COMMON_CORE_FFITWEIGHTS_H_ #define COMMON_CORE_FFITWEIGHTS_H_ @@ -42,59 +42,41 @@ class FFitWeights : public TNamed ~FFitWeights(); void Init(); - void FillFT0(std::size_t iCh, float amplitude, float GainCst); - void FillQ(float mult, float vec, int nHarm, const char* coord, const char* qType); + void Fill(float centrality, float qn, int nh, const char* pf = ""); TObjArray* GetDataArray() { return fW_data; } - // double GetGain(double phi, double eta, double vz); - void CreateGain(); - std::vector GetGain(); - void SetChIdBin(int bin) { ChIDBin = bin; } - void SetCentBin(int bin) { CentBin = bin; } - void SetBinAxis(int bin, float min, float max, int axisLevel) + void SetCentBin(int bin) { CentBin = bin; } + void SetBinAxis(int bin, float min, float max) { - if (axisLevel == 0) - sAmpl = std::shared_ptr(new TAxis(bin, min, max)); - else if (axisLevel == 1) - sqVec = std::shared_ptr(new TAxis(bin, min, max)); - else if (axisLevel == 2) - sqCorVec = std::shared_ptr(new TAxis(bin, min, max)); - else - printf("something went wrong assigning axes"); + qAxis = new TAxis(bin, min, max); } - std::shared_ptr GetAmplAx() { return sAmpl; } - std::shared_ptr GetqVecAx() { return sqVec; } - std::shared_ptr GetqCorVecAx() { return sqCorVec; } + TAxis* GetqVecAx() { return qAxis; } - void CreateRecenter(const char* xy); - float GetRecVal(int cent, const char* xy, const int nHarm); - TH1F* GetRecHist(const char* xy, const int nHarm); - void CreateRMS(const char* xy); - float GetRMSVal(int cent, const char* xy, const int nHarm); - TH1F* GetRmsHist(const char* xy, const int nHarm); - - template - static float EventPlane(const CollType& coll, float nHarm) - { - auto x = coll.qFT0CRe(); - auto y = coll.qFT0CIm(); - return 1 / nHarm * TMath::ATan2(y[nHarm - 2], x[nHarm - 2]); - } - // static float EventPlane(const float& x, const float& y, const float& nHarm); + Long64_t Merge(TCollection* collist); + void qSelectionSpline(std::vector nhv, std::vector stv); + float EvalSplines(float centr, const float& dqn, const int nh, const char* pf = ""); + void SetResolution(int res) { nResolution = res; } + void SetQnType(std::vector> qninp) { qnTYPE = qninp; } private: TObjArray* fW_data; - std::vector vGain; int CentBin; - int ChIDBin; + TAxis* qAxis; //! + int nResolution; - std::shared_ptr sAmpl; //! - std::shared_ptr sqVec; //! - std::shared_ptr sqCorVec; //! + std::vector> qnTYPE; - // TH2F *FT0Ampl; + const char* GetQName(const int nh, const char* pf = "") + { + return Form("q%i%s", nh, pf); + }; + const char* GetAxisName(const int nh, const char* pf = "") + { + return Form(";Centrality;q_{%i}^{%s}", nh, pf); + }; + void AddArray(TObjArray* targ, TObjArray* sour); - ClassDef(FFitWeights, 2); // calibration class + ClassDef(FFitWeights, 1); // calibration class }; #endif // COMMON_CORE_FFITWEIGHTS_H_ diff --git a/Common/Core/PID/PIDTOF.h b/Common/Core/PID/PIDTOF.h index 5ecd32cbbd0..f0165c65400 100644 --- a/Common/Core/PID/PIDTOF.h +++ b/Common/Core/PID/PIDTOF.h @@ -28,23 +28,24 @@ #include "TMath.h" #include "TGraph.h" #include "TFile.h" +#include "TF2.h" // O2 includes #include "DataFormatsTOF/ParameterContainers.h" #include "Framework/Logger.h" #include "ReconstructionDataFormats/PID.h" #include "Framework/DataTypes.h" +#include "CommonConstants/PhysicsConstants.h" namespace o2::pid::tof { -// Utility values +// Utility values (to remove!) static constexpr float kCSPEED = TMath::C() * 1.0e2f * 1.0e-12f; /// Speed of light in TOF units (cm/ps) static constexpr float kCSPEDDInv = 1.f / kCSPEED; /// Inverse of the Speed of light in TOF units (ps/cm) static constexpr float defaultReturnValue = -999.f; /// Default return value in case TOF measurement is not available /// \brief Class to handle the the TOF detector response for the TOF beta measurement -template class Beta { public: @@ -55,16 +56,24 @@ class Beta /// \param length Length in cm of the track /// \param tofSignal TOF signal in ps for the track /// \param collisionTime collision time in ps for the event of the track - static float GetBeta(const float length, const float tofSignal, const float collisionTime) { return length / (tofSignal - collisionTime) * kCSPEDDInv; } + static float GetBeta(const float length, const float tofSignal, const float collisionTime) { return length / (tofSignal - collisionTime) * o2::constants::physics::invLightSpeedCm2PS; } /// Gets the beta for the track of interest /// \param track Track of interest /// \param collisionTime Collision time - static float GetBeta(const TrackType& track, const float collisionTime) { return track.hasTOF() ? GetBeta(track.length(), track.tofSignal(), collisionTime) : defaultReturnValue; } + template + static float GetBeta(const TrackType& track, const float collisionTime) + { + return track.hasTOF() ? GetBeta(track.length(), track.tofSignal(), collisionTime) : defaultReturnValue; + } /// Gets the beta for the track of interest /// \param track Track of interest - static float GetBeta(const TrackType& track) { return GetBeta(track, track.tofEvTime()); } + template + static float GetBeta(const TrackType& track) + { + return GetBeta(track, track.tofEvTime()); + } /// Computes the expected uncertainty on the beta measurement /// \param length Length in cm of the track @@ -75,7 +84,11 @@ class Beta /// Gets the expected uncertainty on the beta measurement of the track of interest /// \param track Track of interest - float GetExpectedSigma(const TrackType& track) const { return GetExpectedSigma(track.length(), track.tofSignal(), track.tofEvTime(), mExpectedResolution); } + template + float GetExpectedSigma(const TrackType& track) const + { + return GetExpectedSigma(track.length(), track.tofSignal(), track.tofEvTime(), mExpectedResolution); + } /// Gets the expected beta for a given mass hypothesis (no energy loss taken into account) /// \param momentum momentum in GeV/c of the track @@ -84,7 +97,7 @@ class Beta /// Gets the expected beta given the particle index (no energy loss taken into account) of the track of interest /// \param track Track of interest - template + template float GetExpectedBeta(const TrackType& track) const { return GetExpectedBeta(track.p(), o2::track::PID::getMass2Z(id)); @@ -92,7 +105,7 @@ class Beta /// Gets the number of sigmas with respect the approximate beta (no energy loss taken into account) of the track of interest /// \param track Track of interest - template + template float GetSeparation(const TrackType& track) const { return (GetBeta(track) - GetExpectedBeta(track)) / GetExpectedSigma(track); @@ -102,7 +115,6 @@ class Beta }; /// \brief Class to handle the the TOF detector response for the TOF mass measurement -template class TOFMass { public: @@ -116,11 +128,19 @@ class TOFMass /// Gets the TOF mass for the track of interest /// \param track Track of interest - static float GetTOFMass(const TrackType& track, const float beta) { return track.hasTOF() ? GetTOFMass(track.p(), beta) : defaultReturnValue; } + template + static float GetTOFMass(const TrackType& track, const float beta) + { + return track.hasTOF() ? GetTOFMass(track.p(), beta) : defaultReturnValue; + } /// Gets the TOF mass for the track of interest /// \param track Track of interest - static float GetTOFMass(const TrackType& track) { return track.hasTOF() ? GetTOFMass(track.p(), Beta::GetBeta(track)) : defaultReturnValue; } + template + static float GetTOFMass(const TrackType& track) + { + return track.hasTOF() ? GetTOFMass(track.p(), Beta::GetBeta(track)) : defaultReturnValue; + } }; /// \brief Next implementation class to store TOF response parameters for exp. times @@ -139,6 +159,11 @@ class TOFResoParamsV2 : public o2::tof::Parameters<13> ~TOFResoParamsV2() = default; + template + float getResolution(const float, const float) const + { + return -1.f; + } // Momentum shift for charge calibration void setMomentumChargeShiftParameters(std::unordered_map const& pars) { @@ -212,7 +237,7 @@ class TOFResoParamsV2 : public o2::tof::Parameters<13> } f.Close(); } - LOG(info) << "Set the Time Shift parameters from file " << filename << " and object " << objname << " for " << (positive ? "positive" : "negative"); + LOG(info) << "Set the Time Shift parameters from file " << filename << " and object " << objname << " for " << (positive ? "positive" : "negative") << " example of shift at eta 0: " << getTimeShift(0, positive); } void setTimeShiftParameters(TGraph* g, bool positive) { @@ -254,14 +279,12 @@ class TOFResoParamsV2 : public o2::tof::Parameters<13> class TOFResoParamsV3 : public o2::tof::Parameters<13> { public: - TOFResoParamsV3() : Parameters(std::array{"TrkRes.Pi.P0", "TrkRes.Pi.P1", "TrkRes.Pi.P2", "TrkRes.Pi.P3", "time_resolution", - "TrkRes.Ka.P0", "TrkRes.Ka.P1", "TrkRes.Ka.P2", "TrkRes.Ka.P3", - "TrkRes.Pr.P0", "TrkRes.Pr.P1", "TrkRes.Pr.P2", "TrkRes.Pr.P3"}, + TOFResoParamsV3() : Parameters(std::array{"time_resolution", "time_resolution", "time_resolution", "time_resolution", "time_resolution", + "time_resolution", "time_resolution", "time_resolution", "time_resolution", + "time_resolution", "time_resolution", "time_resolution", "time_resolution"}, "TOFResoParamsV3") { - setParameters(std::array{0.008, 0.008, 0.002, 40.0, 60.0, - 0.008, 0.008, 0.002, 40.0, - 0.008, 0.008, 0.002, 40.0}); + setParameters(std::array{60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0}); } // Default constructor with default parameters ~TOFResoParamsV3() = default; @@ -313,7 +336,7 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13> } } - // Time shift for post calibration + // Time shift for post calibration to realign as a function of eta void setTimeShiftParameters(std::unordered_map const& pars, bool positive) { std::string baseOpt = positive ? "TimeShift.Pos." : "TimeShift.Neg."; @@ -367,6 +390,75 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13> return gNegEtaTimeCorr->Eval(eta); } + void printTimeShiftParameters() const + { + if (gPosEtaTimeCorr) { + LOG(info) << "Using a time shift for Pos " << gPosEtaTimeCorr->GetName() << " " << gPosEtaTimeCorr->GetTitle() << " value at 0: " << gPosEtaTimeCorr->Eval(0) << " vs correction " << getTimeShift(0, 1); + } else { + LOG(info) << "Using no time shift for Pos vs correction " << getTimeShift(0, 1); + } + if (gNegEtaTimeCorr) { + LOG(info) << "Using a time shift for Neg " << gNegEtaTimeCorr->GetName() << " " << gNegEtaTimeCorr->GetTitle() << " value at 0: " << gNegEtaTimeCorr->Eval(0) << " vs correction " << getTimeShift(0, -1); + } else { + LOG(info) << "Using no time shift for Neg vs correction " << getTimeShift(0, -1); + } + } + + void setResolutionParametrization(std::unordered_map const& pars) + { + static constexpr std::array particleNames = {"El", "Mu", "Pi", "Ka", "Pr", "De", "Tr", "He", "Al"}; + for (int i = 0; i < 9; ++i) { + const std::string baseOpt = Form("tofResTrack.%s_", particleNames[i]); + // Check if a key begins with a string + for (const auto& [key, value] : pars) { + if (key.find(baseOpt) == 0) { + // Remove from the key the baseOpt + const std::string fun = key.substr(baseOpt.size()); + if (mResolution[i]) { + delete mResolution[i]; + } + mResolution[i] = new TF2(baseOpt.c_str(), fun.c_str(), 0., 20, -1, 1.); + LOG(info) << "Set the resolution function for " << particleNames[i] << " with formula " << mResolution[i]->GetFormula()->GetExpFormula(); + break; + } + } + } + // Print a summary + for (int i = 0; i < 9; ++i) { + if (!mResolution[i]) { + LOG(info) << "Resolution function for " << particleNames[i] << " not provided, using default " << mDefaultResoParams[i]; + mResolution[i] = new TF2(Form("tofResTrack.%s_Default", particleNames[i]), mDefaultResoParams[i], 0., 20, -1, 1.); + } + LOG(info) << "Resolution function for " << particleNames[i] << " is " << mResolution[i]->GetName() << " with formula " << mResolution[i]->GetFormula()->GetExpFormula(); + } + } + + template + float getResolution(const float p, const float eta) const + { + return mResolution[pid]->Eval(p, eta); + } + + void printResolution() const + { + static constexpr std::array particleNames = {"El", "Mu", "Pi", "Ka", "Pr", "De", "Tr", "He", "Al"}; + // Print a summary + for (int i = 0; i < 9; ++i) { + if (!mResolution[i]) { + LOG(info) << "Resolution function for " << particleNames[i] << " is not defined yet"; + continue; + } + LOG(info) << "Resolution function for " << particleNames[i] << " is " << mResolution[i]->GetName() << " with formula " << mResolution[i]->GetFormula()->GetExpFormula(); + } + } + void printFullConfig() const + { + print(); + printMomentumChargeShiftParameters(); + printTimeShiftParameters(); + printResolution(); + } + private: // Charge calibration int mEtaN = 0; // Number of eta bins, 0 means no correction @@ -374,6 +466,16 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13> float mEtaStop = 0.f; float mInvEtaWidth = 9999.f; std::vector mContent; + std::array mResolution{nullptr}; + static constexpr std::array mDefaultResoParams{"14.3*TMath::Power((TMath::Max(x-0.319,0.1))*(1-0.4235*y*y),-0.8467)", + "14.3*TMath::Power((TMath::Max(x-0.319,0.1))*(1-0.4235*y*y),-0.8467)", + "14.3*TMath::Power((TMath::Max(x-0.319,0.1))*(1-0.4235*y*y),-0.8467)", + "42.66*TMath::Power((TMath::Max(x-0.417,0.1))*(1-0.4235*y*y),-0.7145)", + "99.46*TMath::Power((TMath::Max(x-0.447,0.1))*(1-0.4235*y*y),-0.8094)", + "216*TMath::Power((TMath::Max(x-0.647,0.1))*(1-0.4235*y*y),-0.76)", + "315*TMath::Power((TMath::Max(x-0.811,0.1))*(1-0.4235*y*y),-0.783)", + "157*TMath::Power((TMath::Max(x-0.556,0.1))*(1-0.4235*y*y),-0.783)", + "216*TMath::Power((TMath::Max(x-0.647,0.1))*(1-0.4235*y*y),-0.76)"}; // Time shift for post calibration TGraph* gPosEtaTimeCorr = nullptr; /// Time shift correction for positive tracks @@ -391,7 +493,7 @@ class ExpTimes static constexpr float mMassZSqared = mMassZ * mMassZ; /// (M/z)^2 /// Computes the expected time of a track, given it TOF expected momentum - static float ComputeExpectedTime(const float tofExpMom, const float length) { return length * sqrt((mMassZSqared) + (tofExpMom * tofExpMom)) / (kCSPEED * tofExpMom); } + static float ComputeExpectedTime(const float tofExpMom, const float length) { return length * sqrt((mMassZSqared) + (tofExpMom * tofExpMom)) / (o2::constants::physics::LightSpeedCm2PS * tofExpMom); } /// Gets the expected signal of the track of interest under the PID assumption /// \param track Track of interest @@ -401,7 +503,7 @@ class ExpTimes return defaultReturnValue; } if (track.trackType() == o2::aod::track::Run2Track) { - return ComputeExpectedTime(track.tofExpMom() * kCSPEDDInv, track.length()); + return ComputeExpectedTime(track.tofExpMom() * o2::constants::physics::invLightSpeedCm2PS, track.length()); } return ComputeExpectedTime(track.tofExpMom(), track.length()); } @@ -416,7 +518,7 @@ class ExpTimes return defaultReturnValue; } if (track.trackType() == o2::aod::track::Run2Track) { - return ComputeExpectedTime(track.tofExpMom() * kCSPEDDInv / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())), track.length()); + return ComputeExpectedTime(track.tofExpMom() * o2::constants::physics::invLightSpeedCm2PS / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())), track.length()); } LOG(debug) << "TOF exp. mom. " << track.tofExpMom() << " shifted = " << track.tofExpMom() / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())); return ComputeExpectedTime(track.tofExpMom() / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())), track.length()) + parameters.getTimeShift(track.eta(), track.sign()); @@ -432,9 +534,14 @@ class ExpTimes static float GetExpectedSigma(const ParamType& parameters, const TrackType& track, const float tofSignal, const float collisionTimeRes) { const float& mom = track.p(); + const float& eta = track.eta(); if (mom <= 0) { return -999.f; } + const float reso = parameters.template getResolution(mom, eta); + if (reso > 0) { + return std::sqrt(reso * reso + parameters[4] * parameters[4] + collisionTimeRes * collisionTimeRes); + } if constexpr (id <= o2::track::PID::Pion) { LOG(debug) << "Using parameters for the pion hypothesis and ID " << id; const float dpp = parameters[0] + parameters[1] * mom + parameters[2] * mMassZ / mom; // mean relative pt resolution; diff --git a/Common/Core/RecoDecay.h b/Common/Core/RecoDecay.h index 9fc810a17f7..94ff6f12664 100644 --- a/Common/Core/RecoDecay.h +++ b/Common/Core/RecoDecay.h @@ -20,10 +20,12 @@ #include // std::find #include // std::array #include // std::abs, std::sqrt +#include #include // std::move #include // std::vector #include "TMCProcess.h" // for VMC Particle Production Process +#include "TPDGCode.h" // for PDG codes #include "CommonConstants/MathConstants.h" /// Base class for calculating properties of reconstructed decays @@ -206,18 +208,23 @@ struct RecoDecay { /// Constrains angle to be within a range. /// \note Inspired by TVector2::Phi_0_2pi in ROOT. /// \param angle angle - /// \param min minimum of the range - /// \return value within [min, min + 2π). + /// \param minimum minimum of the range + /// \param harmonic harmonic number + /// \return value of angle within [minimum, minimum + 2π / harmonic). template - static T constrainAngle(T angle, U min = 0.) + static T constrainAngle(T angle, U minimum = 0.0F, unsigned int harmonic = 1U) { - while (angle < min) { - angle += o2::constants::math::TwoPI; + auto period = o2::constants::math::TwoPI; + if (harmonic != 1U) { + period /= harmonic; } - while (angle >= min + o2::constants::math::TwoPI) { - angle -= o2::constants::math::TwoPI; + while (angle < minimum) { + angle += period; } - return (T)angle; + while (angle >= minimum + period) { + angle -= period; + } + return angle; } /// Calculates cosine of pointing angle. @@ -663,6 +670,7 @@ struct RecoDecay { /// Checks whether the reconstructed decay candidate is the expected decay. /// \param checkProcess switch to accept only decay daughters by checking the production process of MC particles /// \param acceptIncompleteReco switch to accept candidates with only part of the daughters reconstructed + /// \tparam acceptTrackDecay switch to accept candidates with daughter tracks of pions and kaons which decayed /// \param particlesMC table with MC particles /// \param arrDaughters array of candidate daughters /// \param PDGMother expected mother PDG code @@ -670,19 +678,25 @@ struct RecoDecay { /// \param acceptAntiParticles switch to accept the antiparticle version of the expected decay /// \param sign antiparticle indicator of the found mother w.r.t. PDGMother; 1 if particle, -1 if antiparticle, 0 if mother not found /// \param depthMax maximum decay tree level to check; Daughters up to this level will be considered. If -1, all levels are considered. + /// \param nPiToMu number of pion prongs decayed to a muon + /// \param nKaToPi number of kaon prongs decayed to a pion /// \return index of the mother particle if the mother and daughters are correct, -1 otherwise - template + template static int getMatchedMCRec(const T& particlesMC, const std::array& arrDaughters, int PDGMother, std::array arrPDGDaughters, bool acceptAntiParticles = false, int8_t* sign = nullptr, - int depthMax = 1) + int depthMax = 1, + int8_t* nPiToMu = nullptr, + int8_t* nKaToPi = nullptr) { // Printf("MC Rec: Expected mother PDG: %d", PDGMother); int8_t coefFlavourOscillation = 1; // 1 if no B0(s) flavour oscillation occured, -1 else int8_t sgn = 0; // 1 if the expected mother is particle, -1 if antiparticle (w.r.t. PDGMother) + int8_t nPiToMuLocal = 0; // number of pion prongs decayed to a muon + int8_t nKaToPiLocal = 0; // number of kaon prongs decayed to a pion int indexMother = -1; // index of the mother particle std::vector arrAllDaughtersIndex; // vector of indices of all daughters of the mother of the first provided daughter std::array arrDaughtersIndex; // array of indices of provided daughters @@ -708,6 +722,21 @@ struct RecoDecay { return -1; } auto particleI = arrDaughters[iProng].mcParticle(); // ith daughter particle + if constexpr (acceptTrackDecay) { + // Replace the MC particle associated with the prong by its mother for π → μ and K → π. + auto motherI = particleI.template mothers_first_as(); + auto pdgI = std::abs(particleI.pdgCode()); + auto pdgMotherI = std::abs(motherI.pdgCode()); + if (pdgI == kMuonMinus && pdgMotherI == kPiPlus) { + // π → μ + nPiToMuLocal++; + particleI = motherI; + } else if (pdgI == kPiPlus && pdgMotherI == kKPlus) { + // K → π + nKaToPiLocal++; + particleI = motherI; + } + } arrDaughtersIndex[iProng] = particleI.globalIndex(); // Get the list of daughter indices from the mother of the first prong. if (iProng == 0) { @@ -780,6 +809,14 @@ struct RecoDecay { if (sign) { *sign = sgn; } + if constexpr (acceptTrackDecay) { + if (nPiToMu) { + *nPiToMu = nPiToMuLocal; + } + if (nKaToPi) { + *nKaToPi = nKaToPiLocal; + } + } return indexMother; } @@ -1003,6 +1040,119 @@ struct RecoDecay { } return OriginType::None; } + + /// based on getCharmHardronOrigin in order to extend general particle + /// Finding the origin (from charm hadronisation or beauty-hadron decay) of paritcle (b, c and others) + /// \param particlesMC table with MC particles + /// \param particle MC particle + /// \param searchUpToQuark if true tag origin based on charm/beauty quark otherwise on the presence of a b-hadron or c-hadron + /// \param idxBhadMothers optional vector of b-hadron indices (might be more than one in case of searchUpToQuark in case of beauty resonances) + /// \return an integer corresponding to the origin (0: none(others), 1: charm, 2: beauty) as in OriginType + template + static int getParticleOrigin(const T& particlesMC, + const typename T::iterator& particle, + const bool searchUpToQuark = false, + std::vector* idxBhadMothers = nullptr) + { + int stage = 0; // mother tree level (just for debugging) + + // vector of vectors with mother indices; each line corresponds to a "stage" + std::vector> arrayIds{}; + std::vector initVec{particle.globalIndex()}; + arrayIds.push_back(initVec); // the first vector contains the index of the original particle + auto PDGParticle = std::abs(particle.pdgCode()); + bool couldBeCharm = false; + if (PDGParticle / 100 == 4 || PDGParticle / 1000 == 4) { + couldBeCharm = true; + } + while (arrayIds[-stage].size() > 0) { + // vector of mother indices for the current stage + std::vector arrayIdsStage{}; + for (auto& iPart : arrayIds[-stage]) { // check all the particles that were the mothers at the previous stage + auto particleMother = particlesMC.rawIteratorAt(iPart - particlesMC.offset()); + if (particleMother.has_mothers()) { + + // we break immediately if searchUpToQuark is false and the first mother is a parton (an hadron should never be the mother of a parton) + if (!searchUpToQuark) { + auto mother = particlesMC.rawIteratorAt(particleMother.mothersIds().front() - particlesMC.offset()); + auto PDGParticleIMother = std::abs(mother.pdgCode()); // PDG code of the mother + if (PDGParticleIMother < 9 || (PDGParticleIMother > 20 && PDGParticleIMother < 38)) { + // auto PDGPaticle = std::abs(particleMother.pdgCode()); + if ( + (PDGParticleIMother / 100 == 5 || // b mesons + PDGParticleIMother / 1000 == 5) // b baryons + ) { + return OriginType::NonPrompt; // beauty + } + if ( + (PDGParticleIMother / 100 == 4 || // c mesons + PDGParticleIMother / 1000 == 4) // c baryons + ) { + return OriginType::Prompt; // charm + } + break; + } + } + + for (auto iMother = particleMother.mothersIds().front(); iMother <= particleMother.mothersIds().back(); ++iMother) { // loop over the mother particles of the analysed particle + if (std::find(arrayIdsStage.begin(), arrayIdsStage.end(), iMother) != arrayIdsStage.end()) { // if a mother is still present in the vector, do not check it again + continue; + } + auto mother = particlesMC.rawIteratorAt(iMother - particlesMC.offset()); + // Check status code + // auto motherStatusCode = std::abs(mother.getGenStatusCode()); + auto PDGParticleIMother = std::abs(mother.pdgCode()); // PDG code of the mother + // Check mother's PDG code. + // printf("getMother: "); + // for (int i = stage; i < 0; i++) // Indent to make the tree look nice. + // printf(" "); + // printf("Stage %d: Mother PDG: %d, status: %d, Index: %d\n", stage, PDGParticleIMother, motherStatusCode, iMother); + + if (searchUpToQuark) { + if (idxBhadMothers) { + if (PDGParticleIMother / 100 == 5 || // b mesons + PDGParticleIMother / 1000 == 5) // b baryons + { + idxBhadMothers->push_back(iMother); + } + } + if (PDGParticleIMother == 5) { // b quark + return OriginType::NonPrompt; // beauty + } + if (PDGParticleIMother == 4) { // c quark + return OriginType::Prompt; // charm + } + } else { + if ( + (PDGParticleIMother / 100 == 5 || // b mesons + PDGParticleIMother / 1000 == 5) // b baryons + ) { + if (idxBhadMothers) { + idxBhadMothers->push_back(iMother); + } + return OriginType::NonPrompt; // beauty + } + if ( + (PDGParticleIMother / 100 == 4 || // c mesons + PDGParticleIMother / 1000 == 4) // c baryons + ) { + couldBeCharm = true; + } + } + // add mother index in the vector for the current stage + arrayIdsStage.push_back(iMother); + } + } + } + // add vector of mother indices for the current stage + arrayIds.push_back(arrayIdsStage); + stage--; + } + if (couldBeCharm) { + return OriginType::Prompt; // charm + } + return OriginType::None; + } }; /// Calculations using (pT, η, φ) coordinates, aka (transverse momentum, pseudorapidity, azimuth) diff --git a/Common/Core/TPCVDriftManager.h b/Common/Core/TPCVDriftManager.h index 8fbecfc4bad..5d35db5ea99 100644 --- a/Common/Core/TPCVDriftManager.h +++ b/Common/Core/TPCVDriftManager.h @@ -116,8 +116,8 @@ class TPCVDriftManager if (dDriftErr < 0.f || dDrift > 250.f) { // we cannot move a track outside the drift volume if (mOutside < mWarningLimit) { LOGP(warn, "Skipping correction outside of tpc volume with dDrift={} +- {}", dDrift, dDriftErr); - const auto& trackBC = trackExtra.template collision_as().template foundBC_as().globalBC(); - const auto& colBC = col.template foundBC_as().globalBC(); + const auto trackBC = trackExtra.template collision_as().template foundBC_as().globalBC(); + const auto colBC = col.template foundBC_as().globalBC(); int diffBC = colBC - trackBC; LOGP(info, "ct={}; ctr={}; tTB={}; t0={}; dTime={}; dDrift={}; tgl={}: colBC={} trackBC={} diffBC={}", col.collisionTime(), col.collisionTimeRes(), tTB, trackExtra.trackTime(), dTime, dDrift, track.getTgl(), colBC, trackBC, diffBC); if (mOutside == mWarningLimit - 1) { diff --git a/Common/DataModel/EseTable.h b/Common/DataModel/EseTable.h index d359a4bdcb7..ca9bd41357e 100644 --- a/Common/DataModel/EseTable.h +++ b/Common/DataModel/EseTable.h @@ -26,20 +26,22 @@ namespace o2::aod { namespace q_vector { -DECLARE_SOA_COLUMN(QFV0ARe, qFV0ARe, float); -DECLARE_SOA_COLUMN(QFV0AIm, qFV0AIm, float); -DECLARE_SOA_COLUMN(QFT0CRe, qFT0CRe, std::vector); -DECLARE_SOA_COLUMN(QFT0CIm, qFT0CIm, std::vector); DECLARE_SOA_COLUMN(QPERCFT0C, qPERCFT0C, std::vector); +DECLARE_SOA_COLUMN(QPERCFT0A, qPERCFT0A, std::vector); +DECLARE_SOA_COLUMN(QPERCFV0A, qPERCFV0A, std::vector); +DECLARE_SOA_COLUMN(QPERCTPC, qPERCTPC, std::vector); DECLARE_SOA_COLUMN(FESECOL, fESECOL, std::vector); } // namespace q_vector -DECLARE_SOA_TABLE(QVecFV0As, "AOD", "QVECFV0A", q_vector::QFV0ARe, q_vector::QFV0AIm); -DECLARE_SOA_TABLE(QVecFT0Cs, "AOD", "QVECFT0C", q_vector::QFT0CRe, q_vector::QFT0CIm); DECLARE_SOA_TABLE(QPercentileFT0Cs, "AOD", "QPERCENTILEFT0C", q_vector::QPERCFT0C); +DECLARE_SOA_TABLE(QPercentileFT0As, "AOD", "QPERCENTILEFT0A", q_vector::QPERCFT0A); +DECLARE_SOA_TABLE(QPercentileFV0As, "AOD", "QPERCENTILEFV0A", q_vector::QPERCFV0A); +DECLARE_SOA_TABLE(QPercentileTPCs, "AOD", "QPERCENTILETPC", q_vector::QPERCTPC); DECLARE_SOA_TABLE(FEseCols, "AOD", "FEVENTSHAPE", q_vector::FESECOL); -using QVecFV0A = QVecFV0As::iterator; -using QVecFT0C = QVecFT0Cs::iterator; + using QPercentileFT0C = QPercentileFT0Cs::iterator; +using QPercentileFT0A = QPercentileFT0As::iterator; +using QPercentileFV0A = QPercentileFV0As::iterator; +using QPercentileTPC = QPercentileTPCs::iterator; using FEseCol = FEseCols::iterator; } // namespace o2::aod diff --git a/Common/DataModel/Multiplicity.h b/Common/DataModel/Multiplicity.h index 3583095ee67..40175ded7a4 100644 --- a/Common/DataModel/Multiplicity.h +++ b/Common/DataModel/Multiplicity.h @@ -45,9 +45,16 @@ DECLARE_SOA_DYNAMIC_COLUMN(IsInelGt0, isInelGt0, //! is INEL > 0 [](int multPveta1) -> bool { return multPveta1 > 0; }); DECLARE_SOA_DYNAMIC_COLUMN(IsInelGt1, isInelGt1, //! is INEL > 1 [](int multPveta1) -> bool { return multPveta1 > 1; }); + +// forward track counters +DECLARE_SOA_COLUMN(MFTNtracks, mftNtracks, int); //! + // MC DECLARE_SOA_COLUMN(MultMCFT0A, multMCFT0A, int); //! DECLARE_SOA_COLUMN(MultMCFT0C, multMCFT0C, int); //! +DECLARE_SOA_COLUMN(MultMCFV0A, multMCFV0A, int); //! +DECLARE_SOA_COLUMN(MultMCFDDA, multMCFDDA, int); //! +DECLARE_SOA_COLUMN(MultMCFDDC, multMCFDDC, int); //! DECLARE_SOA_COLUMN(MultMCNParticlesEta10, multMCNParticlesEta10, int); //! DECLARE_SOA_COLUMN(MultMCNParticlesEta08, multMCNParticlesEta08, int); //! DECLARE_SOA_COLUMN(MultMCNParticlesEta05, multMCNParticlesEta05, int); //! @@ -105,9 +112,12 @@ DECLARE_SOA_TABLE(PVMults, "AOD", "PVMULT", //! Multiplicity from the PV contrib mult::MultNTracksPVetaHalf, mult::IsInelGt0, mult::IsInelGt1); +DECLARE_SOA_TABLE(MFTMults, "AOD", "MFTMULT", //! Multiplicity with MFT + mult::MFTNtracks); using BarrelMults = soa::Join; using Mults = soa::Join; using FT0Mult = FT0Mults::iterator; +using MFTMult = MFTMults::iterator; using Mult = Mults::iterator; DECLARE_SOA_TABLE(MultsExtra_000, "AOD", "MULTEXTRA", //! @@ -144,7 +154,7 @@ DECLARE_SOA_TABLE(MultSelections, "AOD", "MULTSELECTIONS", //! using MultExtra = MultsExtra::iterator; // mc collisions table - indexed to Mult -DECLARE_SOA_TABLE(MultMCExtras, "AOD", "MULTMCEXTRA", //! Table for the MC information +DECLARE_SOA_TABLE(MultMCExtras_000, "AOD", "MULTMCEXTRA", //! Table for MC information mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, @@ -154,6 +164,23 @@ DECLARE_SOA_TABLE(MultMCExtras, "AOD", "MULTMCEXTRA", //! Table for the MC infor mult::IsInelGt0, mult::IsInelGt1, o2::soa::Marker<1>); + +// mc collisions table - indexed to Mult +DECLARE_SOA_TABLE_VERSIONED(MultMCExtras_001, "AOD", "MULTMCEXTRA", 1, //! Table for MC information + mult::MultMCFT0A, + mult::MultMCFT0C, + mult::MultMCFV0A, + mult::MultMCFDDA, + mult::MultMCFDDC, + mult::MultMCNParticlesEta05, + mult::MultMCNParticlesEta08, + mult::MultMCNParticlesEta10, + mult::MultMCPVz, + mult::IsInelGt0, + mult::IsInelGt1, + o2::soa::Marker<1>); + +using MultMCExtras = MultMCExtras_001; using MultMCExtra = MultMCExtras::iterator; using MultsExtraMC = MultMCExtras; // for backwards compatibility with previous naming scheme @@ -186,54 +213,42 @@ DECLARE_SOA_TABLE(PVMultZeqs, "AOD", "PVMULTZEQ", //! Multiplicity equalized for using MultZeqs = soa::Join; using MultZeq = MultZeqs::iterator; -namespace multBC +namespace mult { -DECLARE_SOA_COLUMN(MultBCFT0A, multBCFT0A, float); //! -DECLARE_SOA_COLUMN(MultBCFT0C, multBCFT0C, float); //! -DECLARE_SOA_COLUMN(MultBCFV0A, multBCFV0A, float); //! -DECLARE_SOA_COLUMN(MultBCFDDA, multBCFDDA, float); //! -DECLARE_SOA_COLUMN(MultBCFDDC, multBCFDDC, float); //! - -DECLARE_SOA_COLUMN(MultBCZNA, multBCZNA, float); //! -DECLARE_SOA_COLUMN(MultBCZNC, multBCZNC, float); //! -DECLARE_SOA_COLUMN(MultBCZEM1, multBCZEM1, float); //! -DECLARE_SOA_COLUMN(MultBCZEM2, multBCZEM2, float); //! -DECLARE_SOA_COLUMN(MultBCZPA, multBCZPA, float); //! -DECLARE_SOA_COLUMN(MultBCZPC, multBCZPC, float); //! - -DECLARE_SOA_COLUMN(MultBCTVX, multBCTVX, bool); //! -DECLARE_SOA_COLUMN(MultBCFV0OrA, multBCFV0OrA, bool); //! -DECLARE_SOA_COLUMN(MultBCV0triggerBits, multBCV0triggerBits, uint8_t); //! -DECLARE_SOA_COLUMN(MultBCT0triggerBits, multBCT0triggerBits, uint8_t); //! -DECLARE_SOA_COLUMN(MultBCFDDtriggerBits, multBCFDDtriggerBits, uint8_t); //! -DECLARE_SOA_COLUMN(MultBCTriggerMask, multBCTriggerMask, uint64_t); //! CTP trigger mask -DECLARE_SOA_COLUMN(MultBCColliding, multBCColliding, bool); //! CTP trigger mask +// extra BC information +DECLARE_SOA_COLUMN(MultTVX, multTVX, bool); //! +DECLARE_SOA_COLUMN(MultFV0OrA, multFV0OrA, bool); //! +DECLARE_SOA_COLUMN(MultV0triggerBits, multV0triggerBits, uint8_t); //! +DECLARE_SOA_COLUMN(MultT0triggerBits, multT0triggerBits, uint8_t); //! +DECLARE_SOA_COLUMN(MultFDDtriggerBits, multFDDtriggerBits, uint8_t); //! +DECLARE_SOA_COLUMN(MultTriggerMask, multTriggerMask, uint64_t); //! CTP trigger mask +DECLARE_SOA_COLUMN(MultCollidingBC, multCollidingBC, bool); //! CTP trigger mask -DECLARE_SOA_COLUMN(MultBCFT0PosZ, multBCFT0PosZ, float); //! Position along Z computed with the FT0 information within the BC -DECLARE_SOA_COLUMN(MultBCFT0PosZValid, multBCFT0PosZValid, bool); //! Validity of the position along Z computed with the FT0 information within the BC - -} // namespace multBC +DECLARE_SOA_COLUMN(MultFT0PosZ, multFT0PosZ, float); //! Position along Z computed with the FT0 information within the BC +DECLARE_SOA_COLUMN(MultFT0PosZValid, multFT0PosZValid, bool); //! Validity of the position along Z computed with the FT0 information +} // namespace mult DECLARE_SOA_TABLE(MultBCs, "AOD", "MULTBC", //! - multBC::MultBCFT0A, - multBC::MultBCFT0C, - multBC::MultBCFT0PosZ, - multBC::MultBCFT0PosZValid, - multBC::MultBCFV0A, - multBC::MultBCFDDA, - multBC::MultBCFDDC, - multBC::MultBCZNA, - multBC::MultBCZNC, - multBC::MultBCZEM1, - multBC::MultBCZEM2, - multBC::MultBCZPA, - multBC::MultBCZPC, - multBC::MultBCTVX, - multBC::MultBCFV0OrA, - multBC::MultBCV0triggerBits, - multBC::MultBCT0triggerBits, - multBC::MultBCFDDtriggerBits, - multBC::MultBCTriggerMask, - multBC::MultBCColliding, + mult::MultFT0A, + mult::MultFT0C, + mult::MultFT0PosZ, + mult::MultFT0PosZValid, + mult::MultFV0A, + mult::MultFDDA, + mult::MultFDDC, + mult::MultZNA, + mult::MultZNC, + mult::MultZEM1, + mult::MultZEM2, + mult::MultZPA, + mult::MultZPC, + mult::MultTVX, + mult::MultFV0OrA, + mult::MultV0triggerBits, + mult::MultT0triggerBits, + mult::MultFDDtriggerBits, + mult::MultTriggerMask, + mult::MultCollidingBC, + timestamp::Timestamp, bc::Flags); using MultBC = MultBCs::iterator; diff --git a/Common/DataModel/PIDResponseITS.h b/Common/DataModel/PIDResponseITS.h new file mode 100644 index 00000000000..3b5e13d94fd --- /dev/null +++ b/Common/DataModel/PIDResponseITS.h @@ -0,0 +1,181 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// +/// \file PIDResponseITS.h +/// \since 2024-11-12 +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \author Francesco Mazzaschi francesco.mazzaschi@cern.ch +/// \author Giorgio Alberto Lucia giorgio.alberto.lucia@cern.ch +/// \brief Set of tables, tasks and utilities to provide the interface between +/// the analysis data model and the PID response of the ITS +/// + +#ifndef COMMON_DATAMODEL_PIDRESPONSEITS_H_ +#define COMMON_DATAMODEL_PIDRESPONSEITS_H_ + +// O2 includes +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "ReconstructionDataFormats/PID.h" +#include "Framework/Logger.h" + +namespace o2::aod +{ + +struct ITSResponse { + static float averageClusterSize(uint32_t itsClusterSizes) + { + float average = 0; + int nclusters = 0; + + for (int layer = 0; layer < 7; layer++) { + if ((itsClusterSizes >> (layer * 4)) & 0xf) { + nclusters++; + average += (itsClusterSizes >> (layer * 4)) & 0xf; + } + } + if (nclusters == 0) { + return 0; + } + return average / nclusters; + }; + + template + static float expSignal(const float momentum) + { + static constexpr float inverseMass = 1. / o2::track::pid_constants::sMasses[id]; + // static constexpr float charge = static_cast(o2::track::pid_constants::sCharges[id]); + const float bg = momentum * inverseMass; + if (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) { + return (mITSRespParamsZ2[0] / (std::pow(bg, mITSRespParamsZ2[1])) + mITSRespParamsZ2[2]); + } + return (mITSRespParams[0] / (std::pow(bg, mITSRespParams[1])) + mITSRespParams[2]); + } + + template + static float expResolution(const float momentum) + { + static constexpr float inverseMass = 1. / o2::track::pid_constants::sMasses[id]; + // static constexpr float charge = static_cast(o2::track::pid_constants::sCharges[id]); + const float bg = momentum * inverseMass; + float relRes = mResolutionParams[0] * std::erf((bg - mResolutionParams[1]) / mResolutionParams[2]); + return relRes; + } + + template + static float nSigmaITS(uint32_t itsClusterSizes, float momentum, float eta) + { + const float exp = expSignal(momentum); + const float average = averageClusterSize(itsClusterSizes); + const float coslInv = 1. / std::cosh(eta); + const float resolution = expResolution(momentum) * exp; + return (average * coslInv - exp) / resolution; + }; + + template + static float nSigmaITS(const T& track) + { + return nSigmaITS(track.itsClusterSizes(), track.p(), track.eta()); + } + + static void setParameters(float p0, float p1, float p2, float p0_Z2, float p1_Z2, float p2_Z2, float p0_res, float p1_res, float p2_res) + { + if (mIsInitialized) { + LOG(fatal) << "ITSResponse parameters already initialized"; + } + mIsInitialized = true; + mITSRespParams[0] = p0; + mITSRespParams[1] = p1; + mITSRespParams[2] = p2; + mITSRespParamsZ2[0] = p0_Z2; + mITSRespParamsZ2[1] = p1_Z2; + mITSRespParamsZ2[2] = p2_Z2; + mResolutionParams[0] = p0_res; + mResolutionParams[1] = p1_res; + mResolutionParams[2] = p2_res; + } + + private: + static std::array mITSRespParams; + static std::array mITSRespParamsZ2; + static std::array mResolutionParams; + static bool mIsInitialized; +}; + +std::array ITSResponse::mITSRespParams = {1.1576, 1.684, 1.9453}; +std::array ITSResponse::mITSRespParamsZ2 = {2.8752, 1.1246, 5.0259}; +// relative resolution is modelled with an erf function: [0]*TMath::Erf((x-[1])/[2]) +std::array ITSResponse::mResolutionParams = {0.2431, -0.3293, 1.533}; +bool ITSResponse::mIsInitialized = false; + +namespace pidits +{ +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaElImp, itsNSigmaEl, //! Nsigma separation with the ITS detector for electrons + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaMuImp, itsNSigmaMu, //! Nsigma separation with the ITS detector for muons + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaPiImp, itsNSigmaPi, //! Nsigma separation with the ITS detector for pions + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaKaImp, itsNSigmaKa, //! Nsigma separation with the ITS detector for kaons + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaPrImp, itsNSigmaPr, //! Nsigma separation with the ITS detector for protons + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaDeImp, itsNSigmaDe, //! Nsigma separation with the ITS detector for deuterons + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaTrImp, itsNSigmaTr, //! Nsigma separation with the ITS detector for tritons + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaHeImp, itsNSigmaHe, //! Nsigma separation with the ITS detector for helium3 + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaAlImp, itsNSigmaAl, //! Nsigma separation with the ITS detector for alphas + [](uint32_t itsClusterSizes, float momentum, float eta) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum, eta); + }); + +// Define user friendly names for the columns to join with the tracks +using ITSNSigmaEl = ITSNSigmaElImp; +using ITSNSigmaMu = ITSNSigmaMuImp; +using ITSNSigmaPi = ITSNSigmaPiImp; +using ITSNSigmaKa = ITSNSigmaKaImp; +using ITSNSigmaPr = ITSNSigmaPrImp; +using ITSNSigmaDe = ITSNSigmaDeImp; +using ITSNSigmaTr = ITSNSigmaTrImp; +using ITSNSigmaHe = ITSNSigmaHeImp; +using ITSNSigmaAl = ITSNSigmaAlImp; + +} // namespace pidits +} // namespace o2::aod + +#endif // COMMON_DATAMODEL_PIDRESPONSEITS_H_ diff --git a/Common/DataModel/TrackSelectionTables.h b/Common/DataModel/TrackSelectionTables.h index cc27e06bfe7..46ebf03868f 100644 --- a/Common/DataModel/TrackSelectionTables.h +++ b/Common/DataModel/TrackSelectionTables.h @@ -60,6 +60,7 @@ struct TrackSelectionFlags { static constexpr flagtype kGlobalTrackWoTPCCluster = kQualityTracksWoTPCCluster | kPrimaryTracks | kInAcceptanceTracks; static constexpr flagtype kGlobalTrackWoPtEta = kQualityTracks | kPrimaryTracks; static constexpr flagtype kGlobalTrackWoDCA = kQualityTracks | kInAcceptanceTracks; + static constexpr flagtype kGlobalTrackWoDCAxy = kQualityTracks | kInAcceptanceTracks | kDCAz; static constexpr flagtype kGlobalTrackWoDCATPCCluster = kQualityTracksWoTPCCluster | kInAcceptanceTracks; /// @brief Function to check flag content diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index 7e9ca8dea40..91513029f73 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -129,3 +129,8 @@ o2physics_add_dpl_workflow(ese-table-producer SOURCES eseTableProducer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(mftmch-matching-data + SOURCES match-mft-mch-data.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2Physics::AnalysisCCDB O2Physics::PWGDQCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) diff --git a/Common/TableProducer/Converters/CMakeLists.txt b/Common/TableProducer/Converters/CMakeLists.txt index aedc7257229..0bf0ff823d4 100644 --- a/Common/TableProducer/Converters/CMakeLists.txt +++ b/Common/TableProducer/Converters/CMakeLists.txt @@ -24,6 +24,11 @@ o2physics_add_dpl_workflow(tracks-extra-converter PUBLIC_LINK_LIBRARIES COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(tracks-extra-v002-converter + SOURCES tracksExtraV002Converter.cxx + PUBLIC_LINK_LIBRARIES + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(mft-tracks-converter SOURCES mftTracksConverter.cxx PUBLIC_LINK_LIBRARIES @@ -74,3 +79,12 @@ o2physics_add_dpl_workflow(multsextra-converter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(multmcextras-converter + SOURCES multMCExtrasConverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(trackqa-converter + SOURCES trackQAConverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/Common/TableProducer/Converters/bcFlagsCreator.cxx b/Common/TableProducer/Converters/bcFlagsCreator.cxx index 11f30d18bb6..972832716b5 100644 --- a/Common/TableProducer/Converters/bcFlagsCreator.cxx +++ b/Common/TableProducer/Converters/bcFlagsCreator.cxx @@ -22,7 +22,7 @@ struct bcFlagsCreator { void process(aod::BCs const& bcTable) { - for (auto& _ : bcTable) { + for (int64_t i = 0; i < bcTable.size(); ++i) { bcFlags(0); } } diff --git a/Common/TableProducer/Converters/multMCExtrasConverter.cxx b/Common/TableProducer/Converters/multMCExtrasConverter.cxx new file mode 100644 index 00000000000..ac2c074ba1b --- /dev/null +++ b/Common/TableProducer/Converters/multMCExtrasConverter.cxx @@ -0,0 +1,38 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/Multiplicity.h" + +using namespace o2; +using namespace o2::framework; + +struct MultMCExtrasConverter { + Produces multMCExtras_001; + void process(aod::MultMCExtras_000 const& multMCExtras_000) + { + for (const auto& r : multMCExtras_000) { + multMCExtras_001(r.multMCFT0A(), r.multMCFT0C(), 0, 0, 0, + r.multMCNParticlesEta05(), + r.multMCNParticlesEta08(), + r.multMCNParticlesEta10(), + r.multMCPVz()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Common/TableProducer/Converters/trackQAConverter.cxx b/Common/TableProducer/Converters/trackQAConverter.cxx new file mode 100644 index 00000000000..bdfecbca8d0 --- /dev/null +++ b/Common/TableProducer/Converters/trackQAConverter.cxx @@ -0,0 +1,60 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" + +using namespace o2; +using namespace o2::framework; + +struct trackQAConverter { + Produces tracksQA_001; + + void process(aod::TracksQA_000 const& tracksQA_000) + { + for (const auto& trackQA : tracksQA_000) { + tracksQA_001( + trackQA.trackId(), + trackQA.tpcTime0(), + trackQA.tpcdcaR(), + trackQA.tpcdcaZ(), + trackQA.tpcClusterByteMask(), + trackQA.tpcdEdxMax0R(), + trackQA.tpcdEdxMax1R(), + trackQA.tpcdEdxMax2R(), + trackQA.tpcdEdxMax3R(), + trackQA.tpcdEdxTot0R(), + trackQA.tpcdEdxTot1R(), + trackQA.tpcdEdxTot2R(), + trackQA.tpcdEdxTot3R(), + // dummy values, not available in _000 + std::numeric_limits::min(), // deltaRefContParamY + std::numeric_limits::min(), // deltaRefContParamZ + std::numeric_limits::min(), // deltaRefContParamSnp + std::numeric_limits::min(), // deltaRefContParamTgl + std::numeric_limits::min(), // deltaRefContParamQ2Pt + std::numeric_limits::min(), // deltaRefGloParamY + std::numeric_limits::min(), // deltaRefGloParamZ + std::numeric_limits::min(), // deltaRefGloParamSnp + std::numeric_limits::min(), // deltaRefGloParamTgl + std::numeric_limits::min()); // deltaRefGloParamQ2Pt + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/Common/TableProducer/Converters/tracksExtraV002Converter.cxx b/Common/TableProducer/Converters/tracksExtraV002Converter.cxx new file mode 100644 index 00000000000..51d06085809 --- /dev/null +++ b/Common/TableProducer/Converters/tracksExtraV002Converter.cxx @@ -0,0 +1,105 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" + +using namespace o2; +using namespace o2::framework; + +struct TracksExtraV002Converter { + Produces tracksExtra_002; + + void processV000ToV002(aod::TracksExtra_000 const& tracksExtra_000) + { + + for (const auto& track0 : tracksExtra_000) { + + uint32_t itsClusterSizes = 0; + for (int layer = 0; layer < 7; layer++) { + if (track0.itsClusterMap() & (1 << layer)) { + itsClusterSizes |= (0xf << (layer * 4)); + } + } + + int8_t TPCNClsFindableMinusPID = 0; + + tracksExtra_002(track0.tpcInnerParam(), + track0.flags(), + itsClusterSizes, + track0.tpcNClsFindable(), + track0.tpcNClsFindableMinusFound(), + TPCNClsFindableMinusPID, + track0.tpcNClsFindableMinusCrossedRows(), + track0.tpcNClsShared(), + track0.trdPattern(), + track0.itsChi2NCl(), + track0.tpcChi2NCl(), + track0.trdChi2(), + track0.tofChi2(), + track0.tpcSignal(), + track0.trdSignal(), + track0.length(), + track0.tofExpMom(), + track0.trackEtaEmcal(), + track0.trackPhiEmcal(), + track0.trackTime(), + track0.trackTimeRes()); + } + } + PROCESS_SWITCH(TracksExtraV002Converter, processV000ToV002, "process v000-to-v002 conversion", false); + + void processV001ToV002(aod::TracksExtra_001 const& tracksExtra_001) + { + + for (const auto& track1 : tracksExtra_001) { + + int8_t TPCNClsFindableMinusPID = 0; + + tracksExtra_002(track1.tpcInnerParam(), + track1.flags(), + track1.itsClusterSizes(), + track1.tpcNClsFindable(), + track1.tpcNClsFindableMinusFound(), + TPCNClsFindableMinusPID, + track1.tpcNClsFindableMinusCrossedRows(), + track1.tpcNClsShared(), + track1.trdPattern(), + track1.itsChi2NCl(), + track1.tpcChi2NCl(), + track1.trdChi2(), + track1.tofChi2(), + track1.tpcSignal(), + track1.trdSignal(), + track1.length(), + track1.tofExpMom(), + track1.trackEtaEmcal(), + track1.trackPhiEmcal(), + track1.trackTime(), + track1.trackTimeRes()); + } + } + PROCESS_SWITCH(TracksExtraV002Converter, processV001ToV002, "process v001-to-v002 conversion", false); +}; + +/// Spawn the extended table for TracksExtra002 to avoid the call to the internal spawner and a consequent circular dependency +struct TracksExtraSpawner { + Spawns tracksExtra_002; +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), + }; +} diff --git a/Common/TableProducer/PID/CMakeLists.txt b/Common/TableProducer/PID/CMakeLists.txt index dc8a89337d4..d28a3268954 100644 --- a/Common/TableProducer/PID/CMakeLists.txt +++ b/Common/TableProducer/PID/CMakeLists.txt @@ -9,8 +9,13 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -# TOF +# ITS +o2physics_add_dpl_workflow(pid-its + SOURCES pidITS.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) +# TOF o2physics_add_dpl_workflow(pid-tof-base SOURCES pidTOFBase.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::TOFBase diff --git a/Common/TableProducer/PID/pidITS.cxx b/Common/TableProducer/PID/pidITS.cxx new file mode 100644 index 00000000000..58ac57984fe --- /dev/null +++ b/Common/TableProducer/PID/pidITS.cxx @@ -0,0 +1,122 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// +/// \file pidITS.cxx +/// \since 2024-11-12 +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \author Francesco Mazzaschi francesco.mazzaschi@cern.ch +/// \author Giorgio Alberto Lucia giorgio.alberto.lucia@cern.ch +/// \brief Task to produce PID tables for ITS split for each particle. +/// Only the tables for the mass hypotheses requested are filled, the others are sent empty. +/// + +#include +#include +#include + +// O2 includes +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/Track.h" +#include "CCDB/BasicCCDBManager.h" +#include "TOFBase/EventTimeMaker.h" + +// O2Physics includes +#include "Common/DataModel/PIDResponseITS.h" +#include "MetadataHelper.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::track; + +MetadataHelper metadataInfo; + +static constexpr int nCases = 2; +static constexpr int nParameters = 9; +static const std::vector casesNames{"Data", "MC"}; +static const std::vector parameterNames{"RespITSPar1", "RespITSPar2", "RespITSPar3", + "RespITSPar1_Z2", "RespITSPar2_Z2", "RespITSPar3_Z2", + "ResolutionPar1", "ResolutionPar2", "ResolutionPar3"}; +static constexpr float defaultParameters[nCases][nParameters]{{0.903, 2.014, 2.440, + 2.8752, 1.1246, 5.0259, + 0.2431, -0.3293, 1.533}, + {0.903, 2.014, 2.440, + 2.8752, 1.1246, 5.0259, + 0.2431, -0.3293, 1.533}}; + +/// Task to produce the ITS PID information for each particle species +/// The parametrization is: [p0/(bg)**p1 + p2] being bg = p/m. Different parametrizations are used for He3 and Alpha particles. +/// The resolution depends on the bg and is modelled with an erf function: p0*TMath::Erf((bg-p1)/p2) +struct itsPid { + + Configurable> itsParams{"itsParams", + {defaultParameters[0], nCases, nParameters, casesNames, parameterNames}, + "Response parameters"}; + Configurable getFromCCDB{"getFromCCDB", false, "Get the parameters from CCDB"}; + + Service ccdb; + Configurable paramfile{"param-file", "", "Path to the parametrization object, if empty the parametrization is not taken from file"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbPath{"ccdbPath", "Analysis/PID/TPC/Response", "Path of the TPC parametrization on the CCDB"}; + Configurable recoPass{"recoPass", "", "Reconstruction pass name for CCDB query (automatically takes latest object for timestamp if blank)"}; + Configurable ccdbTimestamp{"ccdb-timestamp", 0, "timestamp of the object used to query in CCDB the detector response. Exceptions: -1 gets the latest object, 0 gets the run dependent timestamp"}; + + void init(o2::framework::InitContext&) + { + if (getFromCCDB) { + ccdb->setURL(url.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + LOG(fatal) << "Not implemented yet"; + } else { + const char* key = metadataInfo.isMC() ? "MC" : "Data"; + o2::aod::ITSResponse::setParameters(itsParams->get(key, "RespITSPar1"), + itsParams->get(key, "RespITSPar2"), + itsParams->get(key, "RespITSPar3"), + itsParams->get(key, "RespITSPar1_Z2"), + itsParams->get(key, "RespITSPar2_Z2"), + itsParams->get(key, "RespITSPar3_Z2"), + itsParams->get(key, "ResolutionPar1"), + itsParams->get(key, "ResolutionPar2"), + itsParams->get(key, "ResolutionPar3")); + } + } + + /// Dummy process function for BCs, needed in case both Run2 and Run3 process functions are disabled + void process(aod::Timestamps const&) {} + + void processTest(o2::soa::Join const& tracks) + { + auto tracksWithPid = soa::Attach, + aod::pidits::ITSNSigmaEl, aod::pidits::ITSNSigmaMu, aod::pidits::ITSNSigmaPi, + aod::pidits::ITSNSigmaKa, aod::pidits::ITSNSigmaPr, aod::pidits::ITSNSigmaDe, + aod::pidits::ITSNSigmaTr, aod::pidits::ITSNSigmaHe, aod::pidits::ITSNSigmaAl>(tracks); + + for (const auto& track : tracksWithPid) { + LOG(info) << track.itsNSigmaEl(); + LOG(info) << track.itsNSigmaPi(); + LOG(info) << track.itsNSigmaPr(); + } + } + PROCESS_SWITCH(itsPid, processTest, "Produce a test", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + // Parse the metadata + metadataInfo.initMetadata(cfgc); + auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc)}; + return workflow; +} diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index cfd3c566c2b..e2c5489ab65 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -19,6 +19,8 @@ #include #include #include +#include +#include // O2 includes #include "Framework/runDataProcessing.h" @@ -68,10 +70,12 @@ struct TOFCalibConfig { mTimestamp = opt.cfgTimestamp.value; mTimeShiftCCDBPathPos = opt.cfgTimeShiftCCDBPathPos.value; mTimeShiftCCDBPathNeg = opt.cfgTimeShiftCCDBPathNeg.value; + mTimeShiftCCDBPathPosMC = opt.cfgTimeShiftCCDBPathPosMC.value; + mTimeShiftCCDBPathNegMC = opt.cfgTimeShiftCCDBPathNegMC.value; mParamFileName = opt.cfgParamFileName.value; mParametrizationPath = opt.cfgParametrizationPath.value; mReconstructionPass = opt.cfgReconstructionPass.value; - mLoadResponseFromCCDB = opt.cfgLoadResponseFromCCDB.value; + mReconstructionPassDefault = opt.cfgReconstructionPassDefault.value; mFatalOnPassNotAvailable = opt.cfgFatalOnPassNotAvailable.value; mEnableTimeDependentResponse = opt.cfgEnableTimeDependentResponse.value; mCollisionSystem = opt.cfgCollisionSystem.value; @@ -81,7 +85,7 @@ struct TOFCalibConfig { template void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) { - if (!getTaskOptionValue(initContext, task, name, v, true)) { + if (!getTaskOptionValue(initContext, task, name, v, false)) { LOG(fatal) << "Could not get " << name << " from " << task << " task"; } } @@ -93,11 +97,13 @@ struct TOFCalibConfig { getCfg(initContext, "ccdb-path-grplhcif", mPathGrpLhcIf, task); getCfg(initContext, "ccdb-timestamp", mTimestamp, task); getCfg(initContext, "timeShiftCCDBPathPos", mTimeShiftCCDBPathPos, task); - getCfg(initContext, "timeShiftCCDBPathNeg", mTimeShiftCCDBPathPos, task); + getCfg(initContext, "timeShiftCCDBPathNeg", mTimeShiftCCDBPathNeg, task); + getCfg(initContext, "timeShiftCCDBPathPosMC", mTimeShiftCCDBPathPosMC, task); + getCfg(initContext, "timeShiftCCDBPathNegMC", mTimeShiftCCDBPathNegMC, task); getCfg(initContext, "paramFileName", mParamFileName, task); getCfg(initContext, "parametrizationPath", mParametrizationPath, task); getCfg(initContext, "reconstructionPass", mReconstructionPass, task); - getCfg(initContext, "loadResponseFromCCDB", mLoadResponseFromCCDB, task); + getCfg(initContext, "reconstructionPassDefault", mReconstructionPassDefault, task); getCfg(initContext, "fatalOnPassNotAvailable", mFatalOnPassNotAvailable, task); getCfg(initContext, "enableTimeDependentResponse", mEnableTimeDependentResponse, task); getCfg(initContext, "collisionSystem", mCollisionSystem, task); @@ -129,71 +135,82 @@ struct TOFCalibConfig { } LOG(info) << "Using parameter collection, starting from pass '" << mReconstructionPass << "'"; - const std::string fname = mParamFileName; - if (!fname.empty()) { // Loading the parametrization from file - LOG(info) << "Loading exp. sigma parametrization from file " << fname << ", using param: " << mParametrizationPath; - if (1) { - o2::tof::ParameterCollection paramCollection; - paramCollection.loadParamFromFile(fname, mParametrizationPath); - LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV3, mReconstructionPass)) { - if (mFatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + if (!mParamFileName.empty()) { // Loading the parametrization from file + LOG(info) << "Loading exp. sigma parametrization from file " << mParamFileName << ", using param: " << mParametrizationPath << " and pass " << mReconstructionPass; + o2::tof::ParameterCollection paramCollection; + paramCollection.loadParamFromFile(mParamFileName, mParametrizationPath); + LOG(info) << "+++ Loaded parameter collection from file +++"; + if (!paramCollection.retrieveParameters(mRespParamsV3, mReconstructionPass)) { + if (mFatalOnPassNotAvailable) { + LOG(fatal) << "Pass '" << mReconstructionPass << "' not available in the retrieved object from file"; + } else { + LOG(warning) << "Pass '" << mReconstructionPass << "' not available in the retrieved object from file, fetching '" << mReconstructionPassDefault << "'"; + if (!paramCollection.retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection.print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + mRespParamsV3.setResolutionParametrization(paramCollection.getPars(mReconstructionPassDefault)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPassDefault)); } - } else { - mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPass)); - mRespParamsV3.printMomentumChargeShiftParameters(); } - } else { - mRespParamsV3.loadParamFromFile(fname.data(), mParametrizationPath); + } else { // Pass is available, load non standard parameters + mRespParamsV3.setResolutionParametrization(paramCollection.getPars(mReconstructionPass)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPass)); } - } else if (mLoadResponseFromCCDB) { // Loading it from CCDB - LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << mParametrizationPath << " for timestamp " << mTimestamp; - o2::tof::ParameterCollection* paramCollection = ccdb->template getForTimeStamp(mParametrizationPath, mTimestamp); - paramCollection->print(); + } else if (!mEnableTimeDependentResponse) { // Loading it from CCDB + LOG(info) << "Loading initial exp. sigma parametrization from CCDB, using path: " << mParametrizationPath << " for timestamp " << mTimestamp; + o2::tof::ParameterCollection* paramCollection = ccdb->template getSpecific(mParametrizationPath, mTimestamp); if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPass)) { // Attempt at loading the parameters with the pass defined if (mFatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + LOG(fatal) << "Pass '" << mReconstructionPass << "' not available in the retrieved CCDB object"; } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + LOG(warning) << "Pass '" << mReconstructionPass << "' not available in the retrieved CCDB object, fetching '" << mReconstructionPassDefault << "'"; + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection->print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPassDefault)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPassDefault)); + } } } else { // Pass is available, load non standard parameters + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPass)); mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPass)); - mRespParamsV3.printMomentumChargeShiftParameters(); } } - // Calibration object is defined - mRespParamsV3.print(); // Loading additional calibration objects - if (mTimeShiftCCDBPathPos != "") { - if (mTimeShiftCCDBPathPos.find(".root") != std::string::npos) { - mRespParamsV3.setTimeShiftParameters(mTimeShiftCCDBPathPos, "ccdb_object", true); - } else { - if (mReconstructionPass == "") { - mRespParamsV3.setTimeShiftParameters(ccdb->template getForTimeStamp(mTimeShiftCCDBPathPos, mTimestamp), true); - } else { - std::map metadata; - metadata["RecoPassName"] = mReconstructionPass; - mRespParamsV3.setTimeShiftParameters(ccdb->template getSpecific(mTimeShiftCCDBPathPos, mTimestamp, metadata), true); - } - } + std::map metadata; + if (!mReconstructionPass.empty()) { + metadata["RecoPassName"] = mReconstructionPass; } - if (mTimeShiftCCDBPathNeg != "") { - if (mTimeShiftCCDBPathNeg.find(".root") != std::string::npos) { - mRespParamsV3.setTimeShiftParameters(mTimeShiftCCDBPathNeg, "ccdb_object", false); - } else { - if (mReconstructionPass == "") { - mRespParamsV3.setTimeShiftParameters(ccdb->template getForTimeStamp(mTimeShiftCCDBPathNeg, mTimestamp), false); - } else { - std::map metadata; - metadata["RecoPassName"] = mReconstructionPass; - mRespParamsV3.setTimeShiftParameters(ccdb->template getSpecific(mTimeShiftCCDBPathNeg, mTimestamp, metadata), false); - } + + auto updateTimeShift = [&](const std::string& nameShift, bool isPositive) { + if (nameShift.empty()) { + return; } - } + const bool isFromFile = nameShift.find(".root") != std::string::npos; + if (isFromFile) { + LOG(info) << "Initializing the time shift for " << (isPositive ? "positive" : "negative") << " from file '" << nameShift << "'"; + mRespParamsV3.setTimeShiftParameters(nameShift, "ccdb_object", isPositive); + } else if (!mEnableTimeDependentResponse) { // If the response is fixed fetch it at the init time + LOG(info) << "Initializing the time shift for " << (isPositive ? "positive" : "negative") + << " from ccdb '" << nameShift << "' and timestamp " << mTimestamp + << " and pass '" << mReconstructionPass << "'"; + mRespParamsV3.setTimeShiftParameters(ccdb->template getSpecific(nameShift, mTimestamp, metadata), isPositive); + } + LOG(info) << " test getTimeShift at 0 " << (isPositive ? "pos" : "neg") << ": " + << mRespParamsV3.getTimeShift(0, isPositive); + }; + + const std::string nameShiftPos = metadataInfo.isMC() ? mTimeShiftCCDBPathPosMC : mTimeShiftCCDBPathPos; + updateTimeShift(nameShiftPos, true); + const std::string nameShiftNeg = metadataInfo.isMC() ? mTimeShiftCCDBPathNegMC : mTimeShiftCCDBPathNeg; + updateTimeShift(nameShiftNeg, false); + + // Calibration object is defined + LOG(info) << "Parametrization at init time:"; + mRespParamsV3.printFullConfig(); } template @@ -206,13 +223,14 @@ struct TOFCalibConfig { if (mLastRunNumber == bc.runNumber()) { return; } + LOG(info) << "Updating the parametrization from last run " << mLastRunNumber << " to " << bc.runNumber() << " and timestamp from " << mTimestamp << " " << bc.timestamp(); mLastRunNumber = bc.runNumber(); mTimestamp = bc.timestamp(); // Check the beam type if (mCollisionSystem == -1) { - o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(mPathGrpLhcIf, - mTimestamp); + o2::parameters::GRPLHCIFData* grpo = ccdb->template getSpecific(mPathGrpLhcIf, + mTimestamp); mCollisionSystem = CollisionSystemType::getCollisionTypeFromGrp(grpo); } else { LOG(debug) << "Not setting collisions system as already set to " << mCollisionSystem << " " << CollisionSystemType::getCollisionSystemName(mCollisionSystem); @@ -221,15 +239,56 @@ struct TOFCalibConfig { if (!mEnableTimeDependentResponse) { return; } - LOG(debug) << "Updating parametrization from path '" << mParametrizationPath << "' and timestamp " << mTimestamp; - if (!ccdb->template getForTimeStamp(mParametrizationPath, mTimestamp)->retrieveParameters(mRespParamsV3, mReconstructionPass)) { - if (mFatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + LOG(info) << "Updating parametrization from path '" << mParametrizationPath << "' and timestamp " << mTimestamp << " and reconstruction pass '" << mReconstructionPass << "' for run number " << bc.runNumber(); + if (mParamFileName.empty()) { // Not loading if parametrization was taken from file + LOG(info) << "Updating parametrization from ccdb"; + const o2::tof::ParameterCollection* paramCollection = ccdb->template getSpecific(mParametrizationPath, mTimestamp); + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPass)) { + if (mFatalOnPassNotAvailable) { + LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + } else { + LOGF(warning, "Pass '%s' not available in the retrieved CCDB object, fetching '%s'", mReconstructionPass.data(), mReconstructionPassDefault.data()); + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection->print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { // Found the default case + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPassDefault)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPassDefault)); + } + } + } else { // Found the non default case + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPass)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPass)); } } - return; + + // Loading additional calibration objects + std::map metadata; + if (!mReconstructionPass.empty()) { + metadata["RecoPassName"] = mReconstructionPass; + } + + auto updateTimeShift = [&](const std::string& nameShift, bool isPositive) { + if (nameShift.empty()) { + return; + } + const bool isFromFile = nameShift.find(".root") != std::string::npos; + if (isFromFile) { + return; + } + LOG(info) << "Updating the time shift for " << (isPositive ? "positive" : "negative") + << " from ccdb '" << nameShift << "' and timestamp " << mTimestamp + << " and pass '" << mReconstructionPass << "'"; + mRespParamsV3.setTimeShiftParameters(ccdb->template getSpecific(nameShift, mTimestamp, metadata), isPositive); + LOG(info) << " test getTimeShift at 0 " << (isPositive ? "pos" : "neg") << ": " + << mRespParamsV3.getTimeShift(0, isPositive); + }; + + updateTimeShift(metadataInfo.isMC() ? mTimeShiftCCDBPathPosMC : mTimeShiftCCDBPathPos, true); + updateTimeShift(metadataInfo.isMC() ? mTimeShiftCCDBPathNegMC : mTimeShiftCCDBPathNeg, false); + + LOG(info) << "Parametrization at setup time:"; + mRespParamsV3.printFullConfig(); } bool autoSetProcessFunctions() const { return mAutoSetProcessFunctions; } @@ -245,10 +304,12 @@ struct TOFCalibConfig { int64_t mTimestamp; std::string mTimeShiftCCDBPathPos; std::string mTimeShiftCCDBPathNeg; + std::string mTimeShiftCCDBPathPosMC; + std::string mTimeShiftCCDBPathNegMC; std::string mParamFileName; std::string mParametrizationPath; std::string mReconstructionPass; - bool mLoadResponseFromCCDB; + std::string mReconstructionPassDefault; bool mFatalOnPassNotAvailable; bool mEnableTimeDependentResponse; int mCollisionSystem; @@ -286,10 +347,12 @@ struct tofSignal { Configurable cfgTimestamp{"ccdb-timestamp", -1, "timestamp of the object"}; Configurable cfgTimeShiftCCDBPathPos{"timeShiftCCDBPathPos", "", "Path of the TOF time shift vs eta for pos. tracks. If empty none is taken"}; Configurable cfgTimeShiftCCDBPathNeg{"timeShiftCCDBPathNeg", "", "Path of the TOF time shift vs eta for neg. tracks. If empty none is taken"}; + Configurable cfgTimeShiftCCDBPathPosMC{"timeShiftCCDBPathPosMC", "", "Path of the TOF time shift for MC vs eta for pos. tracks. If empty none is taken"}; + Configurable cfgTimeShiftCCDBPathNegMC{"timeShiftCCDBPathNegMC", "", "Path of the TOF time shift for MC vs eta for neg. tracks. If empty none is taken"}; Configurable cfgParamFileName{"paramFileName", "", "Path to the parametrization object. If empty the parametrization is not taken from file"}; Configurable cfgParametrizationPath{"parametrizationPath", "TOF/Calib/Params", "Path of the TOF parametrization on the CCDB or in the file, if the paramFileName is not empty"}; Configurable cfgReconstructionPass{"reconstructionPass", "", {"Apass to use when fetching the calibration tables. Empty (default) does not check for any pass. Use `metadata` to fetch it from the AO2D metadata. Otherwise it will override the metadata."}}; - Configurable cfgLoadResponseFromCCDB{"loadResponseFromCCDB", false, "Flag to load the response from the CCDB"}; + Configurable cfgReconstructionPassDefault{"reconstructionPassDefault", "unanchored", {"Default pass to get if the standard one is not found"}}; Configurable cfgFatalOnPassNotAvailable{"fatalOnPassNotAvailable", true, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; Configurable cfgEnableTimeDependentResponse{"enableTimeDependentResponse", false, "Flag to use the collision timestamp to fetch the PID Response"}; Configurable cfgCollisionSystem{"collisionSystem", -1, "Collision system: -1 (autoset), 0 (pp), 1 (PbPb), 2 (XeXe), 3 (pPb)"}; @@ -551,7 +614,7 @@ struct tofEventTime { void processRun3(Run3TrksWtof& tracks, aod::FT0s const&, EvTimeCollisionsFT0 const&, - aod::BCsWithTimestamps const&) + aod::BCsWithTimestamps const& bcs) { if (!enableTableTOFEvTime) { return; @@ -563,39 +626,24 @@ struct tofEventTime { if (enableTableEvTimeTOFOnly) { tableEvTimeTOFOnly.reserve(tracks.size()); } - bool calibUpdated = false; - for (auto const& track : tracks) { // Loop on all tracks - if (!track.has_collision()) { // Skipping tracks without collisions - continue; - } - const auto& coll = track.collision_as(); - if (!coll.has_bc()) { - continue; - } - mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, coll.bc_as()); // Update the calibration parameters - calibUpdated = true; - break; - } + + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters // Autoset the processing mode for the event time computation - if (calibUpdated) { - if (mComputeEvTimeWithTOF == -1 || mComputeEvTimeWithFT0 == -1) { - switch (mTOFCalibConfig.collisionSystem()) { - case CollisionSystemType::kCollSyspp: // pp - mComputeEvTimeWithTOF.value = ((mComputeEvTimeWithTOF == -1) ? 0 : mComputeEvTimeWithTOF.value); - mComputeEvTimeWithFT0.value = ((mComputeEvTimeWithFT0 == -1) ? 1 : mComputeEvTimeWithFT0.value); - break; - case CollisionSystemType::kCollSysPbPb: // PbPb - mComputeEvTimeWithTOF.value = ((mComputeEvTimeWithTOF == -1) ? 1 : mComputeEvTimeWithTOF.value); - mComputeEvTimeWithFT0.value = ((mComputeEvTimeWithFT0 == -1) ? 0 : mComputeEvTimeWithFT0.value); - break; - default: - LOG(fatal) << "Collision system " << mTOFCalibConfig.collisionSystem() << " " << CollisionSystemType::getCollisionSystemName(mTOFCalibConfig.collisionSystem()) << " not supported for TOF event time computation"; - break; - } + if (mComputeEvTimeWithTOF == -1 || mComputeEvTimeWithFT0 == -1) { + switch (mTOFCalibConfig.collisionSystem()) { + case CollisionSystemType::kCollSyspp: // pp + mComputeEvTimeWithTOF.value = ((mComputeEvTimeWithTOF == -1) ? 0 : mComputeEvTimeWithTOF.value); + mComputeEvTimeWithFT0.value = ((mComputeEvTimeWithFT0 == -1) ? 1 : mComputeEvTimeWithFT0.value); + break; + case CollisionSystemType::kCollSysPbPb: // PbPb + mComputeEvTimeWithTOF.value = ((mComputeEvTimeWithTOF == -1) ? 1 : mComputeEvTimeWithTOF.value); + mComputeEvTimeWithFT0.value = ((mComputeEvTimeWithFT0 == -1) ? 0 : mComputeEvTimeWithFT0.value); + break; + default: + LOG(fatal) << "Collision system " << mTOFCalibConfig.collisionSystem() << " " << CollisionSystemType::getCollisionSystemName(mTOFCalibConfig.collisionSystem()) << " not supported for TOF event time computation"; + break; } - } else { - LOG(warning) << "Calibration not updated on " << tracks.size() << " tracks !!"; } LOG(debug) << "Running on " << CollisionSystemType::getCollisionSystemName(mTOFCalibConfig.collisionSystem()) << " mComputeEvTimeWithTOF " << mComputeEvTimeWithTOF.value << " mComputeEvTimeWithFT0 " << mComputeEvTimeWithFT0.value; @@ -642,7 +690,7 @@ struct tofEventTime { if constexpr (removeTOFEvTimeBias) { evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); } - if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || abs(t0TOF[0]) < maxEvTimeTOF)) { + if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; weight = 1.f / (t0TOF[1] * t0TOF[1]); @@ -706,7 +754,7 @@ struct tofEventTime { evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, et, erret, 2); } uint8_t flags = 0; - if (erret < errDiamond && (maxEvTimeTOF <= 0.f || abs(et) < maxEvTimeTOF)) { + if (erret < errDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; } else { et = 0.f; @@ -1047,7 +1095,7 @@ struct tofPidMerge { using ResponseImplementation = o2::pid::tof::ExpTimes; void processRun3(Run3TrksWtofWevTime const& tracks, Run3Cols const&, - aod::BCsWithTimestamps const&) + aod::BCsWithTimestamps const& bcs) { constexpr auto responseEl = ResponseImplementation(); constexpr auto responseMu = ResponseImplementation(); @@ -1059,17 +1107,7 @@ struct tofPidMerge { constexpr auto responseHe = ResponseImplementation(); constexpr auto responseAl = ResponseImplementation(); - for (auto const& track : tracks) { // Loop on all tracks - if (!track.has_collision()) { // Skipping tracks without collisions - continue; - } - const auto& coll = track.collision(); - if (!coll.has_bc()) { - continue; - } - mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, coll.bc_as()); // Update the calibration parameters - break; - } + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters for (auto const& pidId : mEnabledParticles) { reserveTable(pidId, tracks.size(), false); @@ -1219,7 +1257,7 @@ struct tofPidMerge { using ResponseImplementationRun2 = o2::pid::tof::ExpTimes; void processRun2(Run2TrksWtofWevTime const& tracks, Run3Cols const&, - aod::BCsWithTimestamps const&) + aod::BCsWithTimestamps const& bcs) { constexpr auto responseEl = ResponseImplementationRun2(); constexpr auto responseMu = ResponseImplementationRun2(); @@ -1231,17 +1269,7 @@ struct tofPidMerge { constexpr auto responseHe = ResponseImplementationRun2(); constexpr auto responseAl = ResponseImplementationRun2(); - for (auto const& track : tracks) { // Loop on all tracks - if (!track.has_collision()) { // Skipping tracks without collisions - continue; - } - const auto& coll = track.collision(); - if (!coll.has_bc()) { - continue; - } - mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, coll.bc_as()); // Update the calibration parameters - break; - } + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters for (auto const& pidId : mEnabledParticles) { reserveTable(pidId, tracks.size(), false); @@ -1432,7 +1460,7 @@ struct tofPidBeta { void process(aod::BCs const&) {} - o2::pid::tof::Beta responseBetaRun2; + o2::pid::tof::Beta responseBetaRun2; void processRun2(Run2TrksWtofWevTime const& tracks) { if (!enableTableBeta && !enableTableMass) { @@ -1447,16 +1475,16 @@ struct tofPidBeta { } if (enableTableMass) { if (enableTOFParams) { - tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV3.getMomentumChargeShift(trk.eta())), beta)); + tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV3.getMomentumChargeShift(trk.eta())), beta)); } else { - tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk, beta)); + tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk, beta)); } } } } PROCESS_SWITCH(tofPidBeta, processRun2, "Process Run3 data i.e. input is TrackIU. If false, taken from metadata automatically", true); - o2::pid::tof::Beta responseBeta; + o2::pid::tof::Beta responseBeta; void processRun3(Run3TrksWtofWevTime const& tracks) { if (!enableTableBeta && !enableTableMass) { @@ -1472,9 +1500,9 @@ struct tofPidBeta { } if (enableTableMass) { if (enableTOFParams) { - tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV3.getMomentumChargeShift(trk.eta())), beta)); + tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV3.getMomentumChargeShift(trk.eta())), beta)); } else { - tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk, beta)); + tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk, beta)); } } } diff --git a/Common/TableProducer/PID/pidTOFbeta.cxx b/Common/TableProducer/PID/pidTOFbeta.cxx index dc4888bce55..d76d631bc4d 100644 --- a/Common/TableProducer/PID/pidTOFbeta.cxx +++ b/Common/TableProducer/PID/pidTOFbeta.cxx @@ -124,7 +124,7 @@ struct tofPidBeta { } using Trks = soa::Join; - o2::pid::tof::Beta responseBeta; + o2::pid::tof::Beta responseBeta; template using ResponseImplementation = o2::pid::tof::ExpTimes; void process(Trks const& tracks) @@ -142,16 +142,13 @@ struct tofPidBeta { } if (enableTableMass) { if (enableTOFParams) { - tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV2.getShift(trk.eta())), beta)); + tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV2.getShift(trk.eta())), beta)); } else { - tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk, beta)); + tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk, beta)); } } } } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index 967225b5ca1..1fe071f2717 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -18,24 +18,32 @@ /// \brief Task to produce PID tables for TPC split for each particle. /// Only the tables for the mass hypotheses requested are filled, and only for the requested table size ("Full" or "Tiny"). The others are sent empty. /// - +#include +#include +#include +#include +#include // ROOT includes #include "TFile.h" #include "TRandom.h" #include "TSystem.h" // O2 includes -#include +#include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "Framework/ASoAHelpers.h" #include "ReconstructionDataFormats/Track.h" #include "CCDB/CcdbApi.h" #include "Common/DataModel/PIDResponse.h" #include "Common/Core/PID/TPCPIDResponse.h" #include "Framework/AnalysisDataModel.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" #include "TableHelper.h" #include "Tools/ML/model.h" #include "pidTPCBase.h" +#include "MetadataHelper.h" using namespace o2; using namespace o2::framework; @@ -45,21 +53,21 @@ using namespace o2::framework::expressions; using namespace o2::track; using namespace o2::ml; +MetadataHelper metadataInfo; // Metadata helper + void customize(std::vector& workflowOptions) { std::vector options{{"add-qa", VariantType::Int, 0, {"Legacy. No effect."}}}; std::swap(workflowOptions, options); } -#include "Framework/runDataProcessing.h" - /// Task to produce the response table struct tpcPid { using Trks = soa::Join; - using Coll = soa::Join; + using Coll = soa::Join; using TrksMC = soa::Join; - using CollMC = soa::Join; + using CollMC = soa::Join; // Tables to produce Produces tablePIDFullEl; @@ -90,8 +98,10 @@ struct tpcPid { OnnxModel network; o2::ccdb::CcdbApi ccdbApi; std::map metadata; + std::map nullmetadata; std::map headers; std::vector speciesNetworkFlags = std::vector(9); + std::string networkVersion; // Input parameters Service ccdb; @@ -187,11 +197,14 @@ struct tpcPid { speciesNetworkFlags[7] = useNetworkHe; speciesNetworkFlags[8] = useNetworkAl; - // Initialise metadata object for CCDB calls + // Initialise metadata object for CCDB calls from AO2D metadata if (recoPass.value == "") { - LOGP(info, "Reco pass not specified; CCDB will take latest available object"); + if (metadataInfo.isFullyDefined()) { + metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); + LOGP(info, "Automatically setting reco pass for TPC Response to {} from AO2D", metadata["RecoPassName"]); + } } else { - LOGP(info, "CCDB object will be requested for reconstruction pass {}", recoPass.value); + LOGP(info, "Setting reco pass for TPC response to user-defined name {}", recoPass.value); metadata["RecoPassName"] = recoPass.value; } @@ -215,17 +228,23 @@ struct tpcPid { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + ccdbApi.init(url); if (time != 0) { LOGP(info, "Initialising TPC PID response for fixed timestamp {} and reco pass {}:", time, recoPass.value); ccdb->setTimestamp(time); response = ccdb->getSpecific(path, time, metadata); + headers = ccdbApi.retrieveHeaders(path, metadata, time); if (!response) { LOGF(warning, "Unable to find TPC parametrisation for specified pass name - falling back to latest object"); response = ccdb->getForTimeStamp(path, time); + headers = ccdbApi.retrieveHeaders(path, metadata, time); + networkVersion = headers["NN-Version"]; if (!response) { LOGF(fatal, "Unable to find any TPC object corresponding to timestamp {}!", time); } } + LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << time << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; + metadata["RecoPassName"] = headers["RecoPassName"]; // Force pass number for NN request to match retrieved BB response->PrintAll(); } } @@ -236,19 +255,21 @@ struct tpcPid { return; } else { /// CCDB and auto-fetching - ccdbApi.init(url); + if (!autofetchNetworks) { if (ccdbTimestamp > 0) { /// Fetching network for specific timestamp LOG(info) << "Fetching network for timestamp: " << ccdbTimestamp.value; bool retrieveSuccess = ccdbApi.retrieveBlob(networkPathCCDB.value, ".", metadata, ccdbTimestamp.value, false, networkPathLocally.value); headers = ccdbApi.retrieveHeaders(networkPathCCDB.value, metadata, ccdbTimestamp.value); + networkVersion = headers["NN-Version"]; if (retrieveSuccess) { network.initModel(networkPathLocally.value, enableNetworkOptimizations.value, networkSetNumThreads.value, strtoul(headers["Valid-From"].c_str(), NULL, 0), strtoul(headers["Valid-Until"].c_str(), NULL, 0)); std::vector dummyInput(network.getNumInputNodes(), 1.); network.evalModel(dummyInput); /// Init the model evaluations + LOGP(info, "Retrieved NN corrections for production tag {}, pass number {}, and NN-Version {}", headers["LPMProductionTag"], headers["RecoPassName"], headers["NN-Version"]); } else { - LOG(fatal) << "Error encountered while fetching/loading the network from CCDB! Maybe the network doesn't exist yet for this runnumber/timestamp?"; + LOG(fatal) << "No valid NN object found matching retrieved Bethe-Bloch parametrisation for pass " << metadata["RecoPassName"] << ". Please ensure that the requested pass has dedicated NN corrections available"; } } else { /// Taking the network from local file @@ -266,7 +287,7 @@ struct tpcPid { } } - Partition notTPCStandaloneTracks = (aod::track::tpcNClsFindable > (uint8_t)0) && ((aod::track::itsClusterSizes > (uint32_t)0) || (aod::track::trdPattern > (uint8_t)0) || (aod::track::tofExpMom > 0.f && aod::track::tofChi2 > 0.f)); // To count number of tracks for use in NN array + Partition notTPCStandaloneTracks = (aod::track::tpcNClsFindable > static_cast(0)) && ((aod::track::itsClusterSizes > static_cast(0)) || (aod::track::trdPattern > static_cast(0)) || (aod::track::tofExpMom > 0.f && aod::track::tofChi2 > 0.f)); // To count number of tracks for use in NN array Partition tracksWithTPC = (aod::track::tpcNClsFindable > (uint8_t)0); template @@ -286,13 +307,18 @@ struct tpcPid { LOGP(info, "Retrieving TPC Response for timestamp {} and recoPass {}:", bc.timestamp(), recoPass.value); } response = ccdb->getSpecific(ccdbPath.value, bc.timestamp(), metadata); + headers = ccdbApi.retrieveHeaders(ccdbPath.value, metadata, bc.timestamp()); + networkVersion = headers["NN-Version"]; if (!response) { - LOGP(warning, "!! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object.", recoPass.value); + LOGP(warning, "!! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object.", metadata["RecoPassName"]); + headers = ccdbApi.retrieveHeaders(ccdbPath.value, nullmetadata, bc.timestamp()); response = ccdb->getForTimeStamp(ccdbPath.value, bc.timestamp()); if (!response) { LOGP(fatal, "Could not find ANY TPC response object for the timestamp {}!", bc.timestamp()); } } + LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << bc.timestamp() << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; + metadata["RecoPassName"] = headers["RecoPassName"]; // Force pass number for NN request to match retrieved BB response->PrintAll(); } @@ -300,12 +326,14 @@ struct tpcPid { LOG(info) << "Fetching network for timestamp: " << bc.timestamp(); bool retrieveSuccess = ccdbApi.retrieveBlob(networkPathCCDB.value, ".", metadata, bc.timestamp(), false, networkPathLocally.value); headers = ccdbApi.retrieveHeaders(networkPathCCDB.value, metadata, bc.timestamp()); + networkVersion = headers["NN-Version"]; if (retrieveSuccess) { network.initModel(networkPathLocally.value, enableNetworkOptimizations.value, networkSetNumThreads.value, strtoul(headers["Valid-From"].c_str(), NULL, 0), strtoul(headers["Valid-Until"].c_str(), NULL, 0)); std::vector dummyInput(network.getNumInputNodes(), 1.); network.evalModel(dummyInput); + LOGP(info, "Retrieved NN corrections for production tag {}, pass number {}, NN-Version number{}", headers["LPMProductionTag"], headers["RecoPassName"], headers["NN-Version"]); } else { - LOG(fatal) << "Error encountered while fetching/loading the network from CCDB! Maybe the network doesn't exist yet for this runnumber/timestamp?"; + LOG(fatal) << "No valid NN object found matching retrieved Bethe-Bloch parametrisation for pass " << metadata["RecoPassName"] << ". Please ensure that the requested pass has dedicated NN corrections available"; } } } @@ -342,6 +370,9 @@ struct tpcPid { track_properties[counter_track_props + 3] = o2::track::pid_constants::sMasses[i]; track_properties[counter_track_props + 4] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).multTPC() / 11000. : 1.; track_properties[counter_track_props + 5] = std::sqrt(nNclNormalization / trk.tpcNClsFound()); + if (input_dimensions == 7 && networkVersion == "2") { + track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; + } counter_track_props += input_dimensions; } @@ -483,13 +514,16 @@ struct tpcPid { LOGP(info, "Retrieving TPC Response for timestamp {} and recoPass {}:", bc.timestamp(), recoPass.value); } response = ccdb->getSpecific(ccdbPath.value, bc.timestamp(), metadata); + headers = ccdbApi.retrieveHeaders(ccdbPath.value, metadata, bc.timestamp()); if (!response) { - LOGP(warning, "!! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object.", recoPass.value); + LOGP(warning, "!! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object.", metadata["RecoPassName"]); response = ccdb->getForTimeStamp(ccdbPath.value, bc.timestamp()); + headers = ccdbApi.retrieveHeaders(ccdbPath.value, nullmetadata, bc.timestamp()); if (!response) { LOGP(fatal, "Could not find ANY TPC response object for the timestamp {}!", bc.timestamp()); } } + LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << bc.timestamp() << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; response->PrintAll(); } @@ -515,7 +549,7 @@ struct tpcPid { PROCESS_SWITCH(tpcPid, processStandard, "Creating PID tables without MC TuneOnData", true); - Partition mcnotTPCStandaloneTracks = (aod::track::tpcNClsFindable > (uint8_t)0) && ((aod::track::itsClusterSizes > (uint32_t)0) || (aod::track::trdPattern > (uint8_t)0) || (aod::track::tofExpMom > 0.f && aod::track::tofChi2 > 0.f)); // To count number of tracks for use in NN array + Partition mcnotTPCStandaloneTracks = (aod::track::tpcNClsFindable > static_cast(0)) && ((aod::track::itsClusterSizes > static_cast(0)) || (aod::track::trdPattern > static_cast(0)) || (aod::track::tofExpMom > 0.f && aod::track::tofChi2 > 0.f)); // To count number of tracks for use in NN array Partition mctracksWithTPC = (aod::track::tpcNClsFindable > (uint8_t)0); void processMcTuneOnData(CollMC const& collisionsMc, TrksMC const& tracksMc, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) @@ -573,7 +607,7 @@ struct tpcPid { } response = ccdb->getSpecific(ccdbPath.value, bc.timestamp(), metadata); if (!response) { - LOGP(warning, "!! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object.", recoPass.value); + LOGP(warning, "!! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object.", metadata["RecoPassName"]); response = ccdb->getForTimeStamp(ccdbPath.value, bc.timestamp()); if (!response) { LOGP(fatal, "Could not find ANY TPC response object for the timestamp {}!", bc.timestamp()); @@ -641,4 +675,8 @@ struct tpcPid { PROCESS_SWITCH(tpcPid, processMcTuneOnData, "Creating PID tables with MC TuneOnData", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + metadataInfo.initMetadata(cfgc); // Parse AO2D metadata + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/Common/TableProducer/eseTableProducer.cxx b/Common/TableProducer/eseTableProducer.cxx index 32f5d522b7d..34f534dc700 100644 --- a/Common/TableProducer/eseTableProducer.cxx +++ b/Common/TableProducer/eseTableProducer.cxx @@ -9,17 +9,15 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// q vector framework with ESE (20/08/2024) -// -/// \author Joachim Hansen -// +/// \file eseTableProducer.cxx +/// \brief Producer for the ESE table +/// +/// \author Joachim C. K. B. Hansen + #include -#include -#include #include #include -#include #include #include #include @@ -27,70 +25,48 @@ #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" #include "Framework/HistogramRegistry.h" #include "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/FT0Corrected.h" -#include "DetectorsCommonDataFormats/AlignParam.h" -#include "FT0Base/Geometry.h" #include "Common/DataModel/EseTable.h" +#include "Common/DataModel/Qvectors.h" #include "FFitWeights.h" -#include - using namespace o2; using namespace o2::framework; -// using namespace o2::framework::expressions; -// using CollWithMults = soa::Join; -using CollWithMults = soa::Join; +using CollWithMults = soa::Join; struct EseTableProducer { - Produces qVectorFV0A; - Produces qVectorFT0C; - Produces qPercs; + Produces qPercsFT0C; + Produces qPercsFT0A; + Produces qPercsFV0A; + Produces qPercsTPC; Produces fEseCol; OutputObj FFitObj{FFitWeights("weights")}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - Configurable cfgCorrLevel{"cfgCorrLevel", 2, "calibration step: 0 = no corr, 1 = gain corr, 2 = rectr, 3 = 1/sigma, 4 = full"}; - Configurable cfgESE{"cfgESE", 1, "ese actovation step: false = no ese, true = evaluate splines and fill table"}; + Configurable cfgESE{"cfgESE", 1, "ese activation step: false = no ese, true = evaluate splines and fill table"}; + Configurable cfgEsePath{"cfgEsePath", "Users/j/joachiha/ESE/local/ffitsplines", "CCDB path for ese splines"}; + Configurable cfgFT0C{"cfgFT0C", 1, "FT0C flag"}; + Configurable cfgFT0A{"cfgFT0A", 0, "FT0A flag"}; + Configurable cfgFV0A{"cfgFV0A", 0, "FV0A flag"}; + Configurable cfgTPC{"cfgTPC", 0, "TPC flag"}; + Configurable> cfgLoopHarmonics{"cfgLoopHarmonics", {2, 3}, "Harmonics to loop over when filling and evaluating splines"}; + Configurable cfgCentEst{"cfgCentEst", "FT0C", "centrality estimator"}; - Configurable cfgCalibrationPath{"cfgCalibrationPath", "Users/j/joachiha/Calibration/local/LHC23zzh", "CCDB path for gain equalization constants"}; - Configurable cfgEsePath{"cfgEsePath", "Users/j/joachiha/ESE/local/splines", "CCDB path for ese splines"}; + Configurable> cfgaxisqn{"cfgaxisqn", {500, 0, 25}, "q_n amplitude range"}; + Configurable cfgnResolution{"cfgnResolution", 3000, "resolution of splines"}; - ConfigurableAxis cfgaxisFITamp{"cfgaxisFITamp", {1000, 0, 5000}, "Fit amplitude range"}; - ConfigurableAxis cfgaxisq2FT0C{"cfgaxisq2FT0C", {200, 0, 25}, "q2 amplitude range"}; - ConfigurableAxis cfgaxisQFT0C{"cfgaxisQFT0C", {250, -3500, 3500}, "q2 amplitude range"}; - - AxisSpec axisFITamp{cfgaxisFITamp, "FIT amp"}; - AxisSpec axisq2FT0C{cfgaxisq2FT0C, "q2 FIT amp"}; - AxisSpec axisQFT0C{cfgaxisQFT0C, "Q xy Range"}; - - AxisSpec axisCentralityR = {100, 0, 100}; - AxisSpec axisChID = {220, 0, 220}; - std::vector FV0RelGainConst{}; - std::vector FT0RelGainConst{}; int runNumber{-1}; - o2::ft0::Geometry ft0geom; - double mOffsetFT0AX = 0.; // X-coordinate of the offset of FT0-A. - double mOffsetFT0AY = 0.; // Y-coordinate of the offset of FT0-A. - double mOffsetFT0CX = 0.; // X-coordinate of the offset of FT0-C. - double mOffsetFT0CY = 0.; // Y-coordinate of the offset of FT0-C. - - FFitWeights* weights{nullptr}; - TList* eselist{nullptr}; - std::vector> spl{2, std::vector(90)}; // 90x2 + FFitWeights* splines{nullptr}; Service ccdb; @@ -99,23 +75,8 @@ struct EseTableProducer { LOGF(info, "ESETable::init()"); - registry.add("h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); - - registry.add("h_qx2VecFT0C", "qxVecFT0C;qxVecFT0C;entries", {HistType::kTH1F, {{1000, 0, 1000}}}); - registry.add("h_qy2VecFT0C", "qyVecFT0C;qyVecFT0C;entries", {HistType::kTH1F, {{1000, 0, 1000}}}); - registry.add("h_qx3VecFT0C", "qxVecFT0C;qxVecFT0C;entries", {HistType::kTH1F, {{1000, 0, 1000}}}); - registry.add("h_qy3VecFT0C", "qyVecFT0C;qyVecFT0C;entries", {HistType::kTH1F, {{1000, 0, 1000}}}); - - registry.add("h_Q2XvsQ2YFT0C", "Q_{2,y}^{FT0C};Q_{2,x}^{FT0C};", {HistType::kTH2F, {{350, -3500, 3500}, {350, -3500, 3500}}}); - registry.add("h_Q2XvsQ2YFT0C_Rec", "Q_{2,y}^{FT0C};Q_{2,x}^{FT0C};", {HistType::kTH2F, {{350, -350, 350}, {350, -350, 350}}}); - - registry.add("h_Cent_q2FT0C", "q^{FT0C}_{2};Centrality (FT0A);", {HistType::kTH2F, {axisCentralityR, axisq2FT0C}}); - registry.add("h_Cent_q3FT0C", "q^{FT0C}_{3};Centrality (FT0A);", {HistType::kTH2F, {axisCentralityR, axisq2FT0C}}); - - registry.add("h_Psi2", "#Psi_{2}^{FT0C};Centrality;", {HistType::kTH2F, {axisCentralityR, {100, -5, 5}}}); - registry.add("h_Psi3", "#Psi_{3}^{FT0C};Centrality;", {HistType::kTH2F, {axisCentralityR, {100, -5, 5}}}); - - registry.add("h_ESE_status", "ese status;ese status;entries", {HistType::kTH1F, {{2, 0.0, 2.0}}}); + registry.add("hEventCounter", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.add("hESEstat", "ese status;ese status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -124,105 +85,41 @@ struct EseTableProducer { int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); ccdb->setCreatedNotAfter(now); + std::vector vecStr{}; + if (cfgFT0C) + vecStr.push_back("FT0C"); + if (cfgFT0A) + vecStr.push_back("FT0A"); + if (cfgFV0A) + vecStr.push_back("FV0A"); + if (cfgTPC) + vecStr.push_back("TPC"); + + std::vector> veccfg; + for (std::size_t i{0}; i < cfgLoopHarmonics->size(); i++) { + for (const auto& j : vecStr) { + veccfg.push_back({cfgLoopHarmonics->at(i), j}); + } + } + FFitObj->SetBinAxis(cfgaxisqn->at(0), cfgaxisqn->at(1), cfgaxisqn->at(2)); + FFitObj->SetResolution(cfgnResolution); + FFitObj->SetQnType(veccfg); FFitObj->Init(); } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) { - FV0RelGainConst.clear(); - FT0RelGainConst.clear(); - FV0RelGainConst = {}; - FT0RelGainConst = {}; auto timestamp = bc.timestamp(); - // auto offsetFT0 = ccdb->getForTimeStamp>("FT0/Calib/Align", timestamp); - // auto offsetFV0 = ccdb->getForTimeStamp>("FV0/Calib/Align", timestamp); - - // if (!objfv0Gain || cfgCorrLevel == 0) { - // for (auto i{0u}; i < 48; i++) { - // FV0RelGainConst.push_back(1.); - // } - // } else { - // FV0RelGainConst = *(objfv0Gain); - // } - for (auto i{0u}; i < 48; i++) { - FV0RelGainConst.push_back(1.); - } - - std::string fullPath = cfgCalibrationPath; - - weights = ccdb->getForTimeStamp(fullPath, timestamp); - if (!weights || cfgCorrLevel == 0) { - for (auto i{0u}; i < 208; i++) { - FT0RelGainConst.push_back(1.); - } - } else { - weights->CreateGain(); - FT0RelGainConst = weights->GetGain(); - } - if (cfgCorrLevel > 1) { - weights->CreateRecenter("x"); - weights->CreateRMS("x"); - weights->CreateRecenter("y"); - weights->CreateRMS("y"); - } - if (cfgESE) { - eselist = ccdb->getForTimeStamp(cfgEsePath, timestamp); - if (!LoadSplines()) + splines = ccdb->getForTimeStamp(cfgEsePath, timestamp); + if (!splines) LOGF(fatal, "failed loading splines with ese flag"); LOGF(info, "successfully loaded splines"); } } - // void processQVecFV0 (CollWithFV0 const& collision, aod::BCsWithTimestamps const&) { - // template - // void QVecFV0 (CollType const& collision) { - // TComplex Qvec(0); - // float qVecFV0A[2] = {0.}; - // float sumAmplFV0A{0.0f}; - - // if (collision.has_foundFV0()){ - // auto fv0 = collision.foundFV0(); - - // for (std::size_t iCh = 0; iCh < fv0.channel().size(); iCh++) { - // float ampl = fv0.amplitude()[iCh]; - // int FV0AchId = fv0.channel()[iCh]; - // registry.fill(HIST("FV0Amplitude"), ampl, FV0AchId); - // registry.fill(HIST("FV0AmplitudeCorr"), ampl / FV0RelGainConst[FV0AchId], FV0AchId); - - // // helperEP.SumQvectors(1, FV0AchId, ampl / FV0RelGainConst[FV0AchId], nmode, QvecDet, sumAmplFV0A, ft0geom, fv0geom); - // } - - // if (sumAmplFV0A > 1e-8) { - // Qvec /= sumAmplFV0A; - // qVecFV0A[0] = Qvec.Re(); - // qVecFV0A[1] = Qvec.Im(); - // } else { - // qVecFV0A[0] = 999.; - // qVecFV0A[1] = 999.; - // } - // } - // else { - // qVecFV0A[0] = -999.; - // qVecFV0A[1] = -999.; - // } - - // //// qVector(Qvec.Re(),Qvec.Im()); - // registry.fill(HIST("h_collisions"), 1.5); - // qVectorFV0A(1,-2); - // } - bool LoadSplines() - { - for (int i{0}; i < 90; i++) { - for (int j{0}; j < 2; j++) { - spl[j][i] = static_cast(eselist->FindObject(Form("sp_q%iFT0C_%i", j + 2, i))); - } - } - return true; - } - float Calcqn(const float& Qx, const float& Qy, const float& Mult) { float dqn{0.0f}; @@ -233,161 +130,89 @@ struct EseTableProducer { return qn; } - double GetPhiFT0(const int& chno, o2::ft0::Geometry ft0geom) + bool validQvec(const float& qVec) { - /* Calculate the azimuthal angle in FT0 for the channel number 'chno'. The offset - of FT0-A is taken into account if chno is between 0 and 95. */ - - float offsetX = 0.; - float offsetY = 0.; // No offset for FT0-C (default case). - - if (chno < 96) { // Channel in FT0-A, non-zero offset must be applied. // LOKI: make general. - offsetX = mOffsetFT0AX; - offsetY = mOffsetFT0AY; + if (qVec == 999. || qVec == -999) { + return false; + } else { + return true; } + }; - ft0geom.calculateChannelCenter(); - auto chPos = ft0geom.getChannelCenter(chno); - /// printf("Channel id: %d X: %.3f Y: %.3f\n", chno, chPos.X(), chPos.Y()); - - return TMath::ATan2(chPos.Y() + offsetY, chPos.X() + offsetX); - } - - float EventPlane(const float& x, const float& y, const float& nHarm) + void doSpline(float& splineVal, int& eseval, const float& centr, const float& nHarm, const char* pf, const auto& QX, const auto& QY, const auto& Ampl) { - return 1 / nHarm * TMath::ATan2(y, x); - } - - void SumQvectors(const int& chno, const float& ampl, const int& nHarm, TComplex& Qvec, float& sum, o2::ft0::Geometry ft0geom) - { - /* Calculate the complex Q-vector for the provided detector and channel number, - before adding it to the total Q-vector given as argument. */ - double phi = -999.; - - phi = GetPhiFT0(chno, ft0geom); // already be given in the right range. - - if (phi < -900) { - printf("Error on phi. Skip\n"); - return; + if (validQvec(QX[nHarm - 2]) && validQvec(QY[nHarm - 2]) && Ampl > 1e-8) { + float qnval = Calcqn(QX[nHarm - 2] * Ampl, QY[nHarm - 2] * Ampl, Ampl); + FFitObj->Fill(centr, qnval, nHarm, pf); + if (cfgESE) { + splineVal = splines->EvalSplines(centr, qnval, nHarm, pf); + eseval = cfgFT0C ? 1 : 0; + } } - Qvec += TComplex(ampl * TMath::Cos(phi * nHarm), ampl * TMath::Sin(phi * nHarm)); - sum += ampl; } - template - void QVecFT0C(CollType const& collision, const int& nHarm, std::vector& qx, std::vector& qy, std::vector& qnP, std::vector& fIsEseAvailable) + template + void calculateESE(T const& collision, + std::vector& qnpFT0C, + std::vector& qnpFT0A, + std::vector& qnpFV0A, + std::vector& qnpTPC, + std::vector& fIsEseAvailable) { - TComplex Qvec(0); - float qVecFT0C[2] = {0.}; - float sumAmplFT0C{0.0f}; - float qn{0.0f}; - bool fCalc{0}; - if (collision.has_foundFT0()) { - const auto& ft0 = collision.foundFT0(); - // auto ft0 = collision.foundFT0(); - for (std::size_t iChC = 0; iChC < ft0.channelC().size(); iChC++) { - float ampl = ft0.amplitudeC()[iChC]; - int FT0CchId = ft0.channelC()[iChC] + 96; - - // registry.fill(HIST("FT0Amplitude"), FT0CchId, ampl); - // registry.fill(HIST("FT0AmplitudeCorr"), FT0CchId, ampl / FT0RelGainConst[FT0CchId]); - if (nHarm == 2) - FFitObj->FillFT0(FT0CchId, ampl, FT0RelGainConst[FT0CchId]); - - SumQvectors(FT0CchId, ampl / FT0RelGainConst[FT0CchId], nHarm, Qvec, sumAmplFT0C, ft0geom); + const float centrality = collision.centFT0C(); + registry.fill(HIST("hESEstat"), 0.5); + for (std::size_t i{0}; i < cfgLoopHarmonics->size(); i++) { + float splineValFT0C{-1.0}; + float splineValFT0A{-1.0}; + float splineValFV0A{-1.0}; + qnpTPC.push_back(-1.0); /* not implemented yet */ + int eseAvailable{0}; + + int nHarm = cfgLoopHarmonics->at(i); + if (cfgFT0C) { + const auto QxFT0C_Qvec = collision.qvecFT0CReVec(); + const auto QyFT0C_Qvec = collision.qvecFT0CImVec(); + const auto SumAmplFT0C = collision.sumAmplFT0C(); + doSpline(splineValFT0C, eseAvailable, centrality, nHarm, "FT0C", QxFT0C_Qvec, QyFT0C_Qvec, SumAmplFT0C); + if (i == 0) + registry.fill(HIST("hESEstat"), 1.5); } - - if (sumAmplFT0C > 1e-8) { - // Qvec /= sumAmplFT0C; - qVecFT0C[0] = Qvec.Re(); - qVecFT0C[1] = Qvec.Im(); - fCalc = true; - } else { - qVecFT0C[0] = 9999.; - qVecFT0C[1] = 9999.; - fCalc = false; + qnpFT0C.push_back(splineValFT0C); + fIsEseAvailable.push_back(eseAvailable); + + if (cfgFT0A) { + const auto QxFT0A_Qvec = collision.qvecFT0AReVec(); + const auto QyFT0A_Qvec = collision.qvecFT0AImVec(); + const auto SumAmplFT0A = collision.sumAmplFT0A(); + doSpline(splineValFT0A, eseAvailable, centrality, nHarm, "FT0A", QxFT0A_Qvec, QyFT0A_Qvec, SumAmplFT0A); + if (i == 0) + registry.fill(HIST("hESEstat"), 2.5); } - } else { - qVecFT0C[0] = 9999.; - qVecFT0C[1] = 9999.; - } - - if (fCalc) { - if (cfgCorrLevel == 0) { - qn = Calcqn(qVecFT0C[0], qVecFT0C[1], sumAmplFT0C); - } - - FFitObj->FillQ(collision.centFT0C(), qVecFT0C[0], nHarm, "x", ""); - FFitObj->FillQ(collision.centFT0C(), qVecFT0C[1], nHarm, "y", ""); - - if (cfgCorrLevel > 1) { - int centr = static_cast(collision.centFT0C()); - - registry.fill(HIST("h_Q2XvsQ2YFT0C"), qVecFT0C[0], qVecFT0C[1]); - qVecFT0C[0] = qVecFT0C[0] - weights->GetRecVal(centr, "x", nHarm); - qVecFT0C[1] = qVecFT0C[1] - weights->GetRecVal(centr, "y", nHarm); - FFitObj->FillQ(collision.centFT0C(), qVecFT0C[0], nHarm, "x", "_Rec"); - FFitObj->FillQ(collision.centFT0C(), qVecFT0C[1], nHarm, "y", "_Rec"); - if (centr < 89) { - registry.fill(HIST("h_Q2XvsQ2YFT0C_Rec"), qVecFT0C[0], qVecFT0C[1]); - } - - qn = Calcqn(qVecFT0C[0], qVecFT0C[1], sumAmplFT0C); - - if (cfgCorrLevel > 2) { - qVecFT0C[0] = qVecFT0C[0] / weights->GetRMSVal(centr, "x", nHarm); - qVecFT0C[1] = qVecFT0C[1] / weights->GetRMSVal(centr, "y", nHarm); - FFitObj->FillQ(collision.centFT0C(), qVecFT0C[0], nHarm, "x", "_RecTot"); - FFitObj->FillQ(collision.centFT0C(), qVecFT0C[1], nHarm, "y", "_RecTot"); - } - } - float Psi = EventPlane(qVecFT0C[0], qVecFT0C[1], nHarm); - - if (nHarm == 2) { - registry.fill(HIST("h_qx2VecFT0C"), qVecFT0C[0]); - registry.fill(HIST("h_qy2VecFT0C"), qVecFT0C[1]); - registry.fill(HIST("h_Cent_q2FT0C"), collision.centFT0C(), qn); - registry.fill(HIST("h_Psi2"), collision.centFT0C(), Psi); - } else if (nHarm == 3) { - registry.fill(HIST("h_qx3VecFT0C"), qVecFT0C[0]); - registry.fill(HIST("h_qy3VecFT0C"), qVecFT0C[1]); - registry.fill(HIST("h_Cent_q3FT0C"), collision.centFT0C(), qn); - registry.fill(HIST("h_Psi3"), collision.centFT0C(), Psi); - } - - if (cfgESE) { - int qSpCent = static_cast(collision.centFT0C()); - float qnCent{-1}; - if (qSpCent > 0 && qSpCent < 90) - qnCent = 100. * spl[nHarm - 2][qSpCent]->Eval(qn); - - qnP.push_back(qnCent); - fIsEseAvailable.push_back(1); - registry.fill(HIST("h_ESE_status"), 1.5); - } else { - qnP.push_back(-1); - fIsEseAvailable.push_back(0); - registry.fill(HIST("h_ESE_status"), .5); + qnpFT0A.push_back(splineValFT0A); + + if (cfgFV0A) { + const auto QxFV0A_Qvec = collision.qvecFV0AReVec(); + const auto QyFV0A_Qvec = collision.qvecFV0AImVec(); + const auto SumAmplFV0A = collision.sumAmplFV0A(); + doSpline(splineValFV0A, eseAvailable, centrality, nHarm, "FV0A", QxFV0A_Qvec, QyFV0A_Qvec, SumAmplFV0A); + if (i == 0) + registry.fill(HIST("hESEstat"), 3.5); } - } else { - qn = 0; - qnP.push_back(qn); - fIsEseAvailable.push_back(0); - registry.fill(HIST("h_ESE_status"), .5); + qnpFV0A.push_back(splineValFV0A); } + }; - qx.push_back(qVecFT0C[0]); - qy.push_back(qVecFT0C[1]); - registry.fill(HIST("h_collisions"), 1.5); - } - - void processQVecs(CollWithMults::iterator const& collision, aod::BCsWithTimestamps const&, aod::FV0As const&, aod::FT0s const&) + void processESE(CollWithMults::iterator const& collision, aod::BCsWithTimestamps const&, aod::FV0As const&, aod::FT0s const&) { + float counter{0.5}; + registry.fill(HIST("hEventCounter"), counter++); + + std::vector qnpFT0C{}; + std::vector qnpFT0A{}; + std::vector qnpFV0A{}; + std::vector qnpTPC{}; - std::vector qvecRe{}; - std::vector qvecIm{}; - std::vector qnp{}; std::vector fIsEseAvailable{}; auto bc = collision.bc_as(); @@ -396,16 +221,16 @@ struct EseTableProducer { runNumber = currentRun; initCCDB(bc); } - registry.fill(HIST("h_collisions"), 0.5); - - // QVecFV0(collision); - QVecFT0C(collision, 2, qvecRe, qvecIm, qnp, fIsEseAvailable); - QVecFT0C(collision, 3, qvecRe, qvecIm, qnp, fIsEseAvailable); + registry.fill(HIST("hEventCounter"), counter++); + calculateESE(collision, qnpFT0C, qnpFT0A, qnpFV0A, qnpTPC, fIsEseAvailable); - qVectorFT0C(qvecRe, qvecIm); - qPercs(qnp); + qPercsFT0C(qnpFT0C); + qPercsFT0A(qnpFT0A); + qPercsFV0A(qnpFV0A); + qPercsTPC(qnpTPC); fEseCol(fIsEseAvailable); + registry.fill(HIST("hEventCounter"), counter++); } - PROCESS_SWITCH(EseTableProducer, processQVecs, "procc q vectors ", true); + PROCESS_SWITCH(EseTableProducer, processESE, "proccess q vectors to calculate reduced q-vector", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index ff55f0e4299..bc9cf1d0fe2 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -8,6 +8,8 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include +#include #include "Framework/ConfigParamSpec.h" #include "Framework/runDataProcessing.h" @@ -624,7 +626,7 @@ struct EventSelectionTask { } PROCESS_SWITCH(EventSelectionTask, processRun2, "Process Run2 event selection", true); - Partition pvTracks = ((aod::track::flags & (uint32_t)o2::aod::track::PVContributor) == (uint32_t)o2::aod::track::PVContributor); + Partition pvTracks = ((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)); void processRun3(aod::Collisions const& cols, FullTracksIU const&, BCsWithBcSelsRun3 const& bcs, aod::FT0s const&) { int run = bcs.iteratorAt(0).runNumber(); @@ -821,8 +823,9 @@ struct EventSelectionTask { } // save indices of collisions for occupancy calculation (both in ROF and in time range) - std::vector> vCollsInTimeWin; std::vector> vCollsInSameITSROF; + std::vector> vCollsInPrevITSROF; + std::vector> vCollsInTimeWin; std::vector> vTimeDeltaForColls; // delta time wrt a given collision for (auto& col : cols) { int32_t colIndex = col.globalIndex(); @@ -835,7 +838,7 @@ struct EventSelectionTask { int64_t rofId = (foundGlobalBC + 3564 - rofOffset) / rofLength; // ### for in-ROF occupancy - std::vector vAssocToSameROF; + std::vector vAssocCollInSameROF; // find all collisions in the same ROF before a given collision int32_t minColIndex = colIndex - 1; while (minColIndex >= 0) { @@ -850,7 +853,7 @@ struct EventSelectionTask { // check if we are within the same ROF if (thisRofId != rofId) break; - vAssocToSameROF.push_back(minColIndex); + vAssocCollInSameROF.push_back(minColIndex); minColIndex--; } // find all collisions in the same ROF after the current one @@ -860,14 +863,31 @@ struct EventSelectionTask { int64_t thisTFid = (thisBC - bcSOR) / nBCsPerTF; if (thisTFid != TFid) break; - // int thisRofIdInTF = (thisBC - rofOffset) / rofLength; int64_t thisRofId = (thisBC + 3564 - rofOffset) / rofLength; if (thisRofId != rofId) break; - vAssocToSameROF.push_back(maxColIndex); + vAssocCollInSameROF.push_back(maxColIndex); maxColIndex++; } - vCollsInSameITSROF.push_back(vAssocToSameROF); + vCollsInSameITSROF.push_back(vAssocCollInSameROF); + + // ### bookkeep collisions in previous ROF + std::vector vAssocCollInPrevROF; + minColIndex = colIndex - 1; + while (minColIndex >= 0) { + int64_t thisBC = vFoundGlobalBC[minColIndex]; + // check if this is still the same TF + int64_t thisTFid = (thisBC - bcSOR) / nBCsPerTF; + if (thisTFid != TFid) + break; + int64_t thisRofId = (thisBC + 3564 - rofOffset) / rofLength; + if (thisRofId == rofId - 1) + vAssocCollInPrevROF.push_back(minColIndex); + else if (thisRofId < rofId - 1) + break; + minColIndex--; + } + vCollsInPrevITSROF.push_back(vAssocCollInPrevROF); // ### for occupancy in time windows std::vector vAssocToThisCol; @@ -924,29 +944,40 @@ struct EventSelectionTask { std::vector vNoCollInSameRofStrict(cols.size(), 0); // to veto events with other collisions in the same ITS ROF std::vector vNoCollInSameRofStandard(cols.size(), 0); // to veto events with other collisions in the same ITS ROF, with per-collision multiplicity above threshold std::vector vNoCollInSameRofWithCloseVz(cols.size(), 0); // to veto events with nearby collisions with close vZ + std::vector vNoHighMultCollInPrevRof(cols.size(), 0); // veto events if FT0C amplitude in previous ITS ROF is above threshold for (auto& col : cols) { int32_t colIndex = col.globalIndex(); float vZ = col.posZ(); // ### in-ROF occupancy - std::vector vAssocToSameROF = vCollsInSameITSROF[colIndex]; - int nITS567tracksForRofVetoStrict = 0; // to veto events with other collisions in the same ITS ROF + std::vector vAssocCollInSameROF = vCollsInSameITSROF[colIndex]; + int nITS567tracksForSameRofVetoStrict = 0; // to veto events with other collisions in the same ITS ROF int nCollsInRofWithFT0CAboveVetoStandard = 0; // to veto events with other collisions in the same ITS ROF, with per-collision multiplicity above threshold int nITS567tracksForRofVetoOnCloseVz = 0; // to veto events with nearby collisions with close vZ - for (uint32_t iCol = 0; iCol < vAssocToSameROF.size(); iCol++) { - int thisColIndex = vAssocToSameROF[iCol]; - nITS567tracksForRofVetoStrict += vTracksITS567perColl[thisColIndex]; + for (uint32_t iCol = 0; iCol < vAssocCollInSameROF.size(); iCol++) { + int thisColIndex = vAssocCollInSameROF[iCol]; + nITS567tracksForSameRofVetoStrict += vTracksITS567perColl[thisColIndex]; if (vAmpFT0CperColl[thisColIndex] > confFT0CamplCutVetoOnCollInROF) nCollsInRofWithFT0CAboveVetoStandard++; if (fabs(vCollVz[thisColIndex] - vZ) < confEpsilonVzDiffVetoInROF) nITS567tracksForRofVetoOnCloseVz += vTracksITS567perColl[thisColIndex]; } // in-ROF occupancy flags - vNoCollInSameRofStrict[colIndex] = (nITS567tracksForRofVetoStrict == 0); + vNoCollInSameRofStrict[colIndex] = (nITS567tracksForSameRofVetoStrict == 0); vNoCollInSameRofStandard[colIndex] = (nCollsInRofWithFT0CAboveVetoStandard == 0); vNoCollInSameRofWithCloseVz[colIndex] = (nITS567tracksForRofVetoOnCloseVz == 0); + // ### occupancy in previous ROF + std::vector vAssocCollInPrevROF = vCollsInPrevITSROF[colIndex]; + float totalFT0amplInPrevROF = 0; + for (uint32_t iCol = 0; iCol < vAssocCollInPrevROF.size(); iCol++) { + int thisColIndex = vAssocCollInPrevROF[iCol]; + totalFT0amplInPrevROF += vAmpFT0CperColl[thisColIndex]; + } + // veto events if FT0C amplitude in previous ITS ROF is above threshold + vNoHighMultCollInPrevRof[colIndex] = (totalFT0amplInPrevROF < confFT0CamplCutVetoOnCollInROF); + // ### occupancy in time windows // protection against TF borders if (!vIsFullInfoForOccupancy[colIndex]) { // occupancy in undefined (too close to TF borders) @@ -1058,6 +1089,7 @@ struct EventSelectionTask { // selection bits based on ITS in-ROF occupancy selection |= vNoCollInSameRofStrict[colIndex] ? BIT(kNoCollInRofStrict) : 0; selection |= (vNoCollInSameRofStandard[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) ? BIT(kNoCollInRofStandard) : 0; + selection |= vNoHighMultCollInPrevRof[colIndex] ? BIT(kNoHighMultCollInPrevRof) : 0; // apply int7-like selections bool sel7 = 0; diff --git a/Common/TableProducer/ft0CorrectedTable.cxx b/Common/TableProducer/ft0CorrectedTable.cxx index 49e6e8bea1c..bf99be86c45 100644 --- a/Common/TableProducer/ft0CorrectedTable.cxx +++ b/Common/TableProducer/ft0CorrectedTable.cxx @@ -10,38 +10,95 @@ // or submit itself to any jurisdiction. #include -#include "Common/DataModel/FT0Corrected.h" +#include #include "Framework/ConfigParamSpec.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" -#include "Common/DataModel/EventSelection.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/EventSelection.h" #include "CommonConstants/LHCConstants.h" #include "CommonConstants/PhysicsConstants.h" #include "DataFormatsFT0/Digit.h" +#include "CCDB/BasicCCDBManager.h" +#include "CollisionTypeHelper.h" +#include "TRandom3.h" using namespace o2; using namespace o2::framework; - using namespace o2::aod; -struct FT0CorrectedTable { + +struct ft0CorrectedTable { + // Configurables + Configurable resoFT0A{"resoFT0A", 20.f, "FT0A resolution in ps for the MC override"}; + Configurable resoFT0C{"resoFT0C", 20.f, "FT0C resolution in ps for the MC override"}; + Configurable addHistograms{"addHistograms", false, "Add QA histograms"}; + Configurable cfgCollisionSystem{"collisionSystem", -2, "Collision system: -2 (use cfg values), -1 (autoset), 0 (pp), 1 (PbPb), 2 (XeXe), 3 (pPb)"}; + Configurable cfgUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable cfgPathGrpLhcIf{"ccdb-path-grplhcif", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"}; + Configurable cfgTimestamp{"ccdb-timestamp", -1, "timestamp of the object"}; + Service ccdb; + + // Producer Produces table; using BCsWithMatchings = soa::Join; using CollisionEvSel = soa::Join::iterator; + static constexpr float invLightSpeedCm2NS = 1.f / o2::constants::physics::LightSpeedCm2NS; + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + void init(o2::framework::InitContext&) + { + if (doprocessStandard && doprocessWithBypassFT0timeInMC) { + LOG(fatal) << "Both processStandard and processWithBypassFT0timeInMC are enabled. Pick one of the two"; + } + if (!doprocessStandard && !doprocessWithBypassFT0timeInMC) { + LOG(fatal) << "No process is enabled. Pick one"; + } + ccdb->setURL(cfgUrl); + ccdb->setTimestamp(cfgTimestamp); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + // Not later than now objects + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + + if (doprocessWithBypassFT0timeInMC) { + // From ps to ns + resoFT0A.value = resoFT0A.value / 1000.f; + resoFT0C.value = resoFT0C.value / 1000.f; + } + if (!addHistograms) { + return; + } + histos.add("t0A", "t0A", kTH1D, {{1000, -1, 1, "t0A (ns)"}}); + histos.add("t0C", "t0C", kTH1D, {{1000, -1, 1, "t0C (ns)"}}); + histos.add("t0AC", "t0AC", kTH1D, {{1000, -1000, 1000, "t0AC (ns)"}}); + histos.add("deltat0AC", "deltat0AC", kTH1D, {{1000, -10, 10, "#Deltat0AC (ns)"}}); + if (doprocessWithBypassFT0timeInMC) { + histos.add("MC/deltat0A", "t0A", kTH1D, {{1000, -50, 50, "t0A (ps)"}}); + histos.add("MC/deltat0C", "t0C", kTH1D, {{1000, -50, 50, "t0C (ps)"}}); + histos.add("MC/deltat0AC", "t0AC", kTH1D, {{1000, -50, 50, "t0AC (ps)"}}); + } + } - void process(BCsWithMatchings const&, soa::Join const& collisions, aod::FT0s const&) + void processStandard(soa::Join const& collisions, + BCsWithMatchings const&, + aod::FT0s const&) { + table.reserve(collisions.size()); + float t0A = 1e10f; + float t0C = 1e10f; for (auto& collision : collisions) { - float vertexPV = collision.posZ(); - float vertex_corr = vertexPV / o2::constants::physics::LightSpeedCm2NS; - float t0A = 1e10; - float t0C = 1e10; + t0A = 1e10f; + t0C = 1e10f; + const float vertexPV = collision.posZ(); + const float vertex_corr = vertexPV * invLightSpeedCm2NS; constexpr float dummyTime = 30.; // Due to HW limitations time can be only within range (-25,25) ns, dummy time is around 32 ns if (collision.has_foundFT0()) { - auto ft0 = collision.foundFT0(); - std::bitset<8> triggers = ft0.triggerMask(); - bool ora = triggers[o2::ft0::Triggers::bitA]; - bool orc = triggers[o2::ft0::Triggers::bitC]; + const auto& ft0 = collision.foundFT0(); + const std::bitset<8>& triggers = ft0.triggerMask(); + const bool ora = triggers[o2::ft0::Triggers::bitA]; + const bool orc = triggers[o2::ft0::Triggers::bitC]; LOGF(debug, "triggers OrA %i OrC %i ", ora, orc); LOGF(debug, " T0A = %f, T0C %f, vertex_corr %f", ft0.timeA(), ft0.timeC(), vertex_corr); if (ora && ft0.timeA() < dummyTime) { @@ -52,11 +109,103 @@ struct FT0CorrectedTable { } } LOGF(debug, " T0 collision time T0A = %f, T0C = %f", t0A, t0C); + if (addHistograms) { + histos.fill(HIST("t0A"), t0A); + histos.fill(HIST("t0C"), t0C); + histos.fill(HIST("t0AC"), (t0A + t0C) * 0.5f); + histos.fill(HIST("deltat0AC"), t0A - t0C); + } table(t0A, t0C); } } + PROCESS_SWITCH(ft0CorrectedTable, processStandard, "Process standard table (default)", true); + + void processWithBypassFT0timeInMC(soa::Join const& collisions, + soa::Join const& bcs, + aod::FT0s const&, + aod::McCollisions const&) + { + if (cfgCollisionSystem.value == -1) { + o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(cfgPathGrpLhcIf, + bcs.iteratorAt(0).timestamp()); + cfgCollisionSystem.value = CollisionSystemType::getCollisionTypeFromGrp(grpo); + switch (cfgCollisionSystem.value) { + case CollisionSystemType::kCollSyspp: + resoFT0A.value = 24.f; + resoFT0C.value = 24.f; + break; + case CollisionSystemType::kCollSysPbPb: + resoFT0A.value = 5.65f; + resoFT0C.value = 5.65f; + break; + default: + break; + } + // Resolution is given in ps + resoFT0A.value = resoFT0A.value / 1000.f; + resoFT0C.value = resoFT0C.value / 1000.f; + } + table.reserve(collisions.size()); + float t0A = 1e10f; + float t0C = 1e10f; + float eventtimeMC = 1e10f; + float posZMC = 0; + bool hasMCcoll = false; + + for (auto& collision : collisions) { + hasMCcoll = false; + eventtimeMC = 1e10f; + t0A = 1e10f; + t0C = 1e10f; + posZMC = 0; + const float vertexPV = collision.posZ(); + const float vertex_corr = vertexPV * invLightSpeedCm2NS; + constexpr float dummyTime = 30.; // Due to HW limitations time can be only within range (-25,25) ns, dummy time is around 32 ns + if (collision.has_mcCollision()) { + hasMCcoll = true; + const auto& collisionMC = collision.mcCollision(); + eventtimeMC = collisionMC.t(); + posZMC = collisionMC.posZ(); + } + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + const std::bitset<8>& triggers = ft0.triggerMask(); + const bool ora = triggers[o2::ft0::Triggers::bitA]; + const bool orc = triggers[o2::ft0::Triggers::bitC]; + + if (ora && ft0.timeA() < dummyTime) { + t0A = ft0.timeA(); + if (hasMCcoll) { + const float diff = eventtimeMC - posZMC * invLightSpeedCm2NS + gRandom->Gaus(0.f, resoFT0A); + t0A = diff; + } + t0A += vertex_corr; + } + if (orc && ft0.timeC() < dummyTime) { + t0C = ft0.timeC(); + if (hasMCcoll) { + const float diff = eventtimeMC + posZMC * invLightSpeedCm2NS + gRandom->Gaus(0.f, resoFT0C); + t0C = diff; + } + t0C -= vertex_corr; + } + } + LOGF(debug, " T0 collision time T0A = %f, T0C = %f", t0A, t0C); + if (addHistograms) { + histos.fill(HIST("t0A"), t0A); + histos.fill(HIST("t0C"), t0C); + histos.fill(HIST("t0AC"), (t0A + t0C) * 0.5f); + histos.fill(HIST("deltat0AC"), t0A - t0C); + if (hasMCcoll) { + histos.fill(HIST("MC/deltat0A"), (t0A - eventtimeMC) * 1000.f); + histos.fill(HIST("MC/deltat0C"), (t0C - eventtimeMC) * 1000.f); + histos.fill(HIST("MC/deltat0AC"), ((t0A + t0C) * 0.5f - eventtimeMC) * 1000.f); + } + } + table(t0A, t0C); + } + } + PROCESS_SWITCH(ft0CorrectedTable, processWithBypassFT0timeInMC, "Process MC with bypass of the AO2D information. Use with care!", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"ft0-corrected-table"})}; -} + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/Common/TableProducer/match-mft-mch-data.cxx b/Common/TableProducer/match-mft-mch-data.cxx new file mode 100644 index 00000000000..c151c74ba4d --- /dev/null +++ b/Common/TableProducer/match-mft-mch-data.cxx @@ -0,0 +1,870 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +#include +#include +#include +#include +#include + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/DataTypes.h" +#include "Framework/runDataProcessing.h" +#include "CCDB/BasicCCDBManager.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/MftmchMatchingML.h" +#include "Common/Core/trackUtilities.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/CutsLibrary.h" +#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h" +#include "DetectorsVertexing/VertexTrackMatcher.h" +#include "ReconstructionDataFormats/PrimaryVertex.h" +#include "ReconstructionDataFormats/VtxTrackIndex.h" +#include "ReconstructionDataFormats/VtxTrackRef.h" +#include "DataFormatsITSMFT/ROFRecord.h" +#include "CommonDataFormat/InteractionRecord.h" +#include "DetectorsVertexing/PVertexerParams.h" +#include "MathUtils/Primitive2D.h" +#include "DataFormatsGlobalTracking/RecoContainer.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/MatchMFTFT0.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Field/MagneticField.h" +#include "TGeoGlobalMagField.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "EventFiltering/Zorro.h" +#include "ReconstructionDataFormats/TrackFwd.h" +#include "Math/MatrixFunctions.h" +#include "Math/SMatrix.h" +#include "MFTTracking/Tracker.h" +#include "MCHTracking/TrackParam.h" +#include "MCHTracking/TrackExtrap.h" +#include "GlobalTracking/MatchGlobalFwd.h" +#include +#include +#include "TDatabasePDG.h" + +using namespace o2; +using namespace o2::soa; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using SMatrix55 = ROOT::Math::SMatrix>; +using SMatrix5 = ROOT::Math::SVector; + +// using MyEvents = soa::Join; +// using MyEventsWithMults = soa::Join; +// using MyEventsWithFilter = soa::Join; +// using MyEventsWithMultsAndFilter = soa::Join; +// using MyEventsWithCent = soa::Join; +// using MyEventsWithCentAndMults = soa::Join; +using MyMuons = soa::Join; +using MyMFTs = aod::MFTTracks; +// using MyMuonsWithCov = soa::Join; +// using MyMuonsColl = soa::Join; +// using MyMuonsCollWithCov = soa::Join; +using MyBCs = soa::Join; +using ExtBCs = soa::Join; + +float mMu = TDatabasePDG::Instance()->GetParticle(13)->Mass(); + +TRandom* rnd = new TRandom(); + +TLorentzVector muon1LV; +TLorentzVector muon2LV; +TLorentzVector dimuonLV; + +TVector3 V1; +TVector3 V2; + +namespace o2::aod +{ + +namespace muon_params +{ +DECLARE_SOA_COLUMN(TRACKCHI2, trackChi2, float); +DECLARE_SOA_COLUMN(RABS, rabs, float); +DECLARE_SOA_COLUMN(Q, q, int16_t); +DECLARE_SOA_COLUMN(PT, pt, float); +DECLARE_SOA_COLUMN(ETA, eta, float); +DECLARE_SOA_COLUMN(PHI, phi, float); +DECLARE_SOA_COLUMN(HASMFT, has_mft, bool); +} // namespace muon_params + +DECLARE_SOA_TABLE(MUONParams, "AOD", "MUON", + muon_params::TRACKCHI2, + muon_params::RABS, + muon_params::Q, + muon_params::PT, + muon_params::ETA, + muon_params::PHI, + muon_params::HASMFT); + +namespace mft_params +{ +DECLARE_SOA_COLUMN(NCLUST, nclust, int); +DECLARE_SOA_COLUMN(ISCA, isCA, bool); +DECLARE_SOA_COLUMN(TRACKCHI2, trackChi2, float); +DECLARE_SOA_COLUMN(Q, q, int16_t); +DECLARE_SOA_COLUMN(PT_AT_DCA, pt_dca, float); +DECLARE_SOA_COLUMN(ETA_AT_DCA, eta_dca, float); +DECLARE_SOA_COLUMN(PHI_AT_DCA, phi_dca, float); +DECLARE_SOA_COLUMN(DCAx, dcax, float); +DECLARE_SOA_COLUMN(DCAy, dcay, float); +} // namespace mft_params + +DECLARE_SOA_TABLE(MFTParams, "AOD", "MFT", + mft_params::NCLUST, + mft_params::ISCA, + mft_params::TRACKCHI2, + mft_params::Q, + mft_params::PT_AT_DCA, + mft_params::ETA_AT_DCA, + mft_params::PHI_AT_DCA, + mft_params::DCAx, + mft_params::DCAy); + +namespace matching_params +{ +// matching parameters +DECLARE_SOA_COLUMN(NClustMFTTracks, nClustMFT, int); +DECLARE_SOA_COLUMN(Chi2MFTTracks, chi2MFT, float); + +DECLARE_SOA_COLUMN(DeltaP, dp_mchplane, float); +DECLARE_SOA_COLUMN(DeltaPt, dpt_mchplane, float); +DECLARE_SOA_COLUMN(DeltaEta, deta_mchplane, float); +DECLARE_SOA_COLUMN(DeltaPhi, dphi_mchplane, float); +DECLARE_SOA_COLUMN(DeltaX, dx_mchplane, float); +DECLARE_SOA_COLUMN(DeltaY, dy_mchplane, float); + +DECLARE_SOA_COLUMN(MchPt, mchpt, float); +DECLARE_SOA_COLUMN(MchEta, mcheta, float); +DECLARE_SOA_COLUMN(MchPhi, mchphi, float); +DECLARE_SOA_COLUMN(MchQ, mchq, float); + +DECLARE_SOA_COLUMN(MftPt, mftpt, float); +DECLARE_SOA_COLUMN(MftEta, mfteta, float); +DECLARE_SOA_COLUMN(MftPhi, mftphi, float); +DECLARE_SOA_COLUMN(MftQ, mftq, float); + +DECLARE_SOA_COLUMN(MftDCA, mftdca, float); + +} // namespace matching_params + +DECLARE_SOA_TABLE(MatchParams, "AOD", "MATCHING", + matching_params::DeltaPt, + matching_params::DeltaEta, + matching_params::DeltaPhi, + matching_params::DeltaX, + matching_params::DeltaY, + matching_params::MchPt, + matching_params::MchEta, + matching_params::MchQ, + matching_params::MftEta, + matching_params::MftQ); + +namespace mix_matching_params +{ +// matching parameters +DECLARE_SOA_COLUMN(NClustMFTTracks, nClustMFT, int); +DECLARE_SOA_COLUMN(Chi2MFTTracks, chi2MFT, float); + +DECLARE_SOA_COLUMN(DeltaP, dp_mchplane, float); +DECLARE_SOA_COLUMN(DeltaPt, dpt_mchplane, float); +DECLARE_SOA_COLUMN(DeltaEta, deta_mchplane, float); +DECLARE_SOA_COLUMN(DeltaPhi, dphi_mchplane, float); +DECLARE_SOA_COLUMN(DeltaX, dx_mchplane, float); +DECLARE_SOA_COLUMN(DeltaY, dy_mchplane, float); + +DECLARE_SOA_COLUMN(MchPt, mchpt, float); +DECLARE_SOA_COLUMN(MchEta, mcheta, float); +DECLARE_SOA_COLUMN(MchPhi, mchphi, float); +DECLARE_SOA_COLUMN(MchQ, mchq, float); + +DECLARE_SOA_COLUMN(MftPt, mftpt, float); +DECLARE_SOA_COLUMN(MftEta, mfteta, float); +DECLARE_SOA_COLUMN(MftPhi, mftphi, float); +DECLARE_SOA_COLUMN(MftQ, mftq, float); +DECLARE_SOA_COLUMN(MftDCA, mftdca, float); +} // namespace mix_matching_params + +DECLARE_SOA_TABLE(MixMatchParams, "AOD", "MIXMATCHING", + mix_matching_params::DeltaPt, + mix_matching_params::DeltaEta, + mix_matching_params::DeltaPhi, + mix_matching_params::DeltaX, + mix_matching_params::DeltaY, + mix_matching_params::MchPt, + mix_matching_params::MchEta, + mix_matching_params::MchQ, + mix_matching_params::MftEta, + mix_matching_params::MftQ); + +namespace tag_matching_params +{ +// matching parameters +DECLARE_SOA_COLUMN(DeltaPt, dpt_mchplane, float); +DECLARE_SOA_COLUMN(DeltaEta, deta_mchplane, float); +DECLARE_SOA_COLUMN(DeltaPhi, dphi_mchplane, float); +DECLARE_SOA_COLUMN(DeltaX, dx_mchplane, float); +DECLARE_SOA_COLUMN(DeltaY, dy_mchplane, float); + +DECLARE_SOA_COLUMN(MchPt, mchpt, float); +DECLARE_SOA_COLUMN(MchEta, mcheta, float); +DECLARE_SOA_COLUMN(MchQ, mchq, float); + +DECLARE_SOA_COLUMN(MftEta, mfteta, float); +DECLARE_SOA_COLUMN(MftQ, mftq, float); +DECLARE_SOA_COLUMN(IsTaged, isTaged, bool); +} // namespace tag_matching_params + +DECLARE_SOA_TABLE(TagMatchParams, "AOD", "TAGMATCHING", + tag_matching_params::DeltaPt, + tag_matching_params::DeltaEta, + tag_matching_params::DeltaPhi, + tag_matching_params::DeltaX, + tag_matching_params::DeltaY, + tag_matching_params::MchPt, + tag_matching_params::MchEta, + tag_matching_params::MchQ, + tag_matching_params::MftEta, + tag_matching_params::MftQ, + tag_matching_params::IsTaged); + +namespace probe_matching_params +{ +// matching parameters +DECLARE_SOA_COLUMN(NMFTCandTagMuon, nTagMFT, int); +DECLARE_SOA_COLUMN(NMFTCandProbeMuon, nProbeMFT, int); +DECLARE_SOA_COLUMN(TagMuonP, tagmuonp, float); + +DECLARE_SOA_COLUMN(NClustMFTTracks, nClustMFT, int); +DECLARE_SOA_COLUMN(Chi2MFTTracks, chi2MFT, float); + +DECLARE_SOA_COLUMN(DeltaP, dp_mchplane, float); +DECLARE_SOA_COLUMN(DeltaPt, dpt_mchplane, float); +DECLARE_SOA_COLUMN(DeltaEta, deta_mchplane, float); +DECLARE_SOA_COLUMN(DeltaPhi, dphi_mchplane, float); +DECLARE_SOA_COLUMN(DeltaX, dx_mchplane, float); +DECLARE_SOA_COLUMN(DeltaY, dy_mchplane, float); + +DECLARE_SOA_COLUMN(MchPt, mchpt, float); +DECLARE_SOA_COLUMN(MchEta, mcheta, float); +DECLARE_SOA_COLUMN(MchPhi, mchphi, float); +DECLARE_SOA_COLUMN(MchQ, mchq, float); + +DECLARE_SOA_COLUMN(MftPt, mftpt, float); +DECLARE_SOA_COLUMN(MftEta, mfteta, float); +DECLARE_SOA_COLUMN(MftPhi, mftphi, float); +DECLARE_SOA_COLUMN(MftQ, mftq, float); +DECLARE_SOA_COLUMN(MftDCA, mftdca, float); +} // namespace probe_matching_params + +DECLARE_SOA_TABLE(ProbeMatchParams, "AOD", "PROBEMATCHING", + probe_matching_params::NMFTCandTagMuon, + probe_matching_params::NMFTCandProbeMuon, + probe_matching_params::TagMuonP, + probe_matching_params::DeltaPt, + probe_matching_params::DeltaEta, + probe_matching_params::DeltaPhi, + probe_matching_params::DeltaX, + probe_matching_params::DeltaY, + probe_matching_params::MchPt, + probe_matching_params::MchEta, + probe_matching_params::MchQ, + probe_matching_params::MftEta, + probe_matching_params::MftQ); + +namespace muon_pair +{ +DECLARE_SOA_COLUMN(NMFT, nMft, int); +DECLARE_SOA_COLUMN(Q, q, int16_t); +DECLARE_SOA_COLUMN(M, m, float); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Rap, rap, float); +} // namespace muon_pair + +DECLARE_SOA_TABLE(MuonPair, "AOD", "DIMUON", muon_pair::NMFT, muon_pair::Q, muon_pair::M, muon_pair::Pt, muon_pair::Rap); + +namespace tag_muon_pair +{ +DECLARE_SOA_COLUMN(NMFT, nMft, int); +DECLARE_SOA_COLUMN(Q, q, int16_t); +DECLARE_SOA_COLUMN(M, m, float); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Rap, rap, float); +} // namespace tag_muon_pair + +DECLARE_SOA_TABLE(TagMuonPair, "AOD", "TAGDIMUON", tag_muon_pair::NMFT, tag_muon_pair::Q, tag_muon_pair::M, tag_muon_pair::Pt, tag_muon_pair::Rap); +} // namespace o2::aod + +struct match_mft_mch_data { + + Produces matchingParams; + Produces tagmatchingParams; + Produces probematchingParams; + Produces mixmatchingParams; + Produces muonPairs; + Produces tagmuonPairs; + Produces muonParams; + Produces mftParams; + + HistogramRegistry registry{ + "registry", + {{"hMchP", "MCH track total momentum (at the first station); p [GeV/c]; Counts", {HistType::kTH1F, {{2000, 0, 200}}}}, + {"hMchCorrP", "MCH track total momentum (propagated to PV); p [GeV/c]; Counts", {HistType::kTH1F, {{2000, 0, 200}}}}, + {"hMassCorrMchPair", "Corrected MCH track pair mass (propagated to PV); m [GeV/c^{2}]; Counts", {HistType::kTH1F, {{1000, 0, 10}}}}}}; + + //// Variables for selecting muon tracks + Configurable fEtaMchLow{"cfgEtaMchLow", -4.0f, ""}; + Configurable fEtaMchUp{"cfgEtaMchUp", -2.5f, ""}; + Configurable fRabsLow1{"cfgRabsLow1", 17.6f, ""}; + Configurable fRabsUp1{"cfgRabsUp1", 26.5f, ""}; + Configurable fRabsLow2{"cfgRabsLow2", 26.5f, ""}; + Configurable fRabsUp2{"cfgRabsUp2", 89.5f, ""}; + Configurable fPdcaUp1{"cfgPdcaUp1", 594.f, ""}; + Configurable fPdcaUp2{"cfgPdcaUp2", 324.f, ""}; + Configurable fTrackChi2MchUp{"cfgTrackChi2MchUp", 5.f, ""}; + Configurable fMatchingChi2MchMidUp{"cfgMatchingChi2MchMidUp", 999.f, ""}; + + //// Variables for selecting mft tracks + Configurable fEtaMftLow{"cfgEtaMftlow", -3.6f, ""}; + Configurable fEtaMftUp{"cfgEtaMftup", -2.5f, ""}; + Configurable fTrackNClustMftLow{"cfgTrackNClustMftLow", 7, ""}; + Configurable fTrackChi2MftUp{"cfgTrackChi2MftUp", 999.f, ""}; + + /// Variables to add preselection for the matching table + Configurable fPreselectMatchingX{"cfgPreselectMatchingX", 999.f, ""}; + Configurable fPreselectMatchingY{"cfgPreselectMatchingY", 999.f, ""}; + + /// Variables to event mixing criteria + Configurable fSaveMixedMatchingParamsRate{"cfgSaveMixedMatchingParamsRate", 0.002f, ""}; + Configurable fEventMaxDeltaNMFT{"cfgEventMaxDeltaNMFT", 1, ""}; + Configurable fEventMaxDeltaVtxZ{"cfgEventMaxDeltaVtxZ", 1.f, ""}; + + //// Variables for selecting tag muon + Configurable fTagMassWindowMin{"cfgTagMassWindowMin", 2.8f, ""}; + Configurable fTagMassWindowMax{"cfgTagMassWindowMax", 3.3f, ""}; + Configurable fTagXWindowLow{"cfgTagXWindowLow", -0.80f, ""}; + Configurable fTagXWindowUp{"cfgTagXWindowUp", 0.84f, ""}; + Configurable fTagYWindowLow{"cfgTagYWindowLow", -0.64f, ""}; + Configurable fTagYWindowUp{"cfgTagYWindowUp", 0.95f, ""}; + Configurable fTagPhiWindowLow{"cfgTagPhiWindowLow", -0.041f, ""}; + Configurable fTagPhiWindowUp{"cfgTagPhiWindowUp", 0.039f, ""}; + Configurable fTagEtaWindowLow{"cfgTagEtaWindowLow", -0.045f, ""}; + Configurable fTagEtaWindowUp{"cfgTagEtaWindowUp", 0.033f, ""}; + + //// Variables for selecting probe muon + Configurable fProbeXWindowLow{"cfgProbeXWindowLow", -10.f, ""}; + Configurable fProbeXWindowUp{"cfgProbeXWindowUp", 10.f, ""}; + Configurable fProbeYWindowLow{"cfgProbeYWindowLow", -10.f, ""}; + Configurable fProbeYWindowUp{"cfgProbeYWindowUp", 10.f, ""}; + Configurable fProbePhiWindowLow{"cfgProbePhiWindowLow", -1.0f, ""}; + Configurable fProbePhiWindowUp{"cfgProbePhiWindowUp", 1.0f, ""}; + Configurable fProbeEtaWindowLow{"cfgProbeEtaWindowLow", -1.0f, ""}; + Configurable fProbeEtaWindowUp{"cfgProbeEtaWindowUp", 1.0f, ""}; + + Service ccdb; + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + + // o2::parameters::GRPMagField* grpmag = nullptr; + o2::globaltracking::MatchGlobalFwd mMatching; + o2::field::MagneticField* fieldB; + + o2::ccdb::CcdbApi ccdbApi; + int mRunNumber; + + void init(o2::framework::InitContext&) + { + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + ccdbApi.init(ccdburl); + mRunNumber = 0; + } + + void initCCDB(ExtBCs::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + mRunNumber = bc.runNumber(); + std::map metadata; + auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, mRunNumber); + auto ts = soreor.first; + auto grpmag = ccdbApi.retrieveFromTFileAny(grpmagPath, metadata, ts); + o2::base::Propagator::initFieldFromGRP(grpmag); + if (!o2::base::GeometryManager::isGeometryLoaded()) { + ccdb->get(geoPath); + } + o2::mch::TrackExtrap::setField(); + fieldB = static_cast(TGeoGlobalMagField::Instance()->GetField()); + } + + enum ProagationPoint { ToVtx, + ToDCA }; + + template + o2::dataformats::GlobalFwdTrack PropagateMUONTrack(T const& muon, int PropType) + { + + auto collision = muon.collision(); + + o2::dataformats::GlobalFwdTrack propmuon; + + double chi2 = muon.chi2(); + + SMatrix5 tpars(muon.x(), muon.y(), muon.phi(), muon.tgl(), muon.signed1Pt()); + std::vector v1{muon.cXX(), muon.cXY(), muon.cYY(), muon.cPhiX(), muon.cPhiY(), + muon.cPhiPhi(), muon.cTglX(), muon.cTglY(), muon.cTglPhi(), muon.cTglTgl(), + muon.c1PtX(), muon.c1PtY(), muon.c1PtPhi(), muon.c1PtTgl(), muon.c1Pt21Pt2()}; + if (isGoodMUONTrack(muon)) { + SMatrix55 tcovs(v1.begin(), v1.end()); + o2::track::TrackParCovFwd fwdtrack{muon.z(), tpars, tcovs, chi2}; + + o2::dataformats::GlobalFwdTrack track; + track.setParameters(tpars); + track.setZ(fwdtrack.getZ()); + track.setCovariances(tcovs); + auto mchTrack = mMatching.FwdtoMCH(track); + if (PropType == ProagationPoint::ToVtx) + o2::mch::TrackExtrap::extrapToVertex(mchTrack, collision.posX(), collision.posY(), collision.posZ(), collision.covXX(), collision.covYY()); + else if (PropType == ProagationPoint::ToDCA) + o2::mch::TrackExtrap::extrapToVertexWithoutBranson(mchTrack, collision.posZ()); + + auto proptrack = mMatching.MCHtoFwd(mchTrack); + propmuon.setParameters(proptrack.getParameters()); + propmuon.setZ(proptrack.getZ()); + propmuon.setCovariances(proptrack.getCovariances()); + } + + v1.clear(); + v1.shrink_to_fit(); + + return propmuon; + } + + template + o2::track::TrackParCovFwd PropagateMFT(T const& mfttrack, int PropType) + { + std::vector mftv1; + SMatrix55 mftcovs{mftv1.begin(), mftv1.end()}; + SMatrix5 mftpars = {mfttrack.x(), mfttrack.y(), mfttrack.phi(), mfttrack.tgl(), mfttrack.signed1Pt()}; + o2::track::TrackParCovFwd mftpartrack = {mfttrack.z(), mftpars, mftcovs, mfttrack.chi2()}; + if (PropType == ProagationPoint::ToDCA) { + auto collision = mfttrack.collision(); + double propVec[3] = {fabs(mfttrack.x() - collision.posX()), fabs(mfttrack.y() - collision.posY()), fabs(mfttrack.z() - collision.posZ())}; + double centerZ[3] = {mfttrack.x() - propVec[0] / 2., mfttrack.y() - propVec[1] / 2., mfttrack.z() - propVec[2] / 2.}; + float Bz = fieldB->getBz(centerZ); + mftpartrack.propagateToZ(collision.posZ(), Bz); + } + return mftpartrack; + } + + template + o2::track::TrackParCovFwd PropagateMFTtoMatchingPlane(MFT const& mfttrack, FWD const& fwdtrack) + { + std::vector v1; // Temporary null vector for the computation of the covariance matrix + double propVec[3] = {fwdtrack.x() - mfttrack.x(), fwdtrack.y() - mfttrack.y(), fwdtrack.z() - mfttrack.z()}; + double centerZ[3] = {mfttrack.x() + propVec[0] / 2., mfttrack.y() + propVec[1] / 2., mfttrack.z() + propVec[2] / 2.}; + float Bz = fieldB->getBz(centerZ); // gives error if the propagator is not initFielded + SMatrix55 tmftcovs(v1.begin(), v1.end()); + SMatrix5 tmftpars(mfttrack.x(), mfttrack.y(), mfttrack.phi(), mfttrack.tgl(), mfttrack.signed1Pt()); + o2::track::TrackParCovFwd extrap_mfttrack{mfttrack.z(), tmftpars, tmftcovs, mfttrack.chi2()}; + extrap_mfttrack.propagateToZ(fwdtrack.z(), Bz); // z in cm + return extrap_mfttrack; + } + + template + bool isGoodMUONTrack(T track) + { + if (!track.has_collision()) + return false; + if (track.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) + return false; + if (track.chi2() > fTrackChi2MchUp) + return false; + if (fRabsLow1 > track.rAtAbsorberEnd() || track.rAtAbsorberEnd() > fRabsUp2) + return false; + if (track.rAtAbsorberEnd() < fRabsUp1 && fPdcaUp1 < track.pDca()) + return false; + if (track.rAtAbsorberEnd() > fRabsLow2 && fPdcaUp2 < track.pDca()) + return false; + return true; + } + + template + int selectTagMUON(T track1, T track2) + { + if (track1.pt() > track2.pt()) { + return track1.globalIndex(); + } else { + return track2.globalIndex(); + } + } + + template + int selectProbeMUONTrack(T track1, T track2) + { + if (track1.pt() < track2.pt()) { + return track1.globalIndex(); + } else { + return track2.globalIndex(); + } + } + + bool isGoodKenematicMUONTrack(o2::dataformats::GlobalFwdTrack track) + { + if (fEtaMchLow > track.getEta() || track.getEta() > fEtaMchUp) + return false; + return true; + } + + template + bool isGoodMFTTrack(T track) + { + if (!track.has_collision()) + return false; + if (track.chi2() > fTrackChi2MftUp) + return false; + if (track.nClusters() < fTrackNClustMftLow) + return false; + return true; + } + + bool isGoodKenematicMFTTrack(o2::track::TrackParCovFwd track) + { + if (fEtaMftLow > track.getEta() || track.getEta() > fEtaMftUp) { + return false; + } + return true; + } + + void process(aod::Collisions const&, ExtBCs const& ebcs, + MyMuons const& fwdtracks, MyMFTs const& mfttracks) + { + initCCDB(ebcs.begin()); + + std::unordered_set bcs_mfttrack; + std::unordered_map map_vtxZ; + std::unordered_map nmfttracks; + std::unordered_map> map_mfttraks; + + for (const auto& mfttrack : mfttracks) { + + if (!isGoodMFTTrack(mfttrack)) { + continue; + } + + bcs_mfttrack.insert(mfttrack.collisionId()); + std::vector& tracks = map_mfttraks[mfttrack.collisionId()]; + tracks.push_back(mfttrack.globalIndex()); + + o2::track::TrackParCovFwd mftpartrack = PropagateMFT(mfttrack, ProagationPoint::ToDCA); + + if (!isGoodKenematicMFTTrack(mftpartrack)) { + continue; + } + + auto collision = mfttrack.collision(); + + map_vtxZ[mfttrack.collisionId()] = collision.posZ(); + + float dx = mftpartrack.getX() - collision.posX(); + float dy = mftpartrack.getY() - collision.posY(); + + mftParams(mfttrack.nClusters(), mfttrack.isCA(), mfttrack.chi2(), mfttrack.sign(), mftpartrack.getPt(), mftpartrack.getEta(), mftpartrack.getPhi(), dx, dy); + nmfttracks[mfttrack.collisionId()]++; + } + + std::unordered_map nfwdtracks; + std::unordered_map> map_fwdtraks; + + for (auto fwdtrack : fwdtracks) { + + if (!isGoodMUONTrack(fwdtrack)) { + continue; + } + + o2::dataformats::GlobalFwdTrack propmuonAtPV = PropagateMUONTrack(fwdtrack, ProagationPoint::ToVtx); + if (!isGoodKenematicMUONTrack(propmuonAtPV)) { + continue; + } + + std::vector& tracks = map_fwdtraks[fwdtrack.collisionId()]; + tracks.push_back(fwdtrack.globalIndex()); + + bool hasMFT = false; + + std::vector& mfttracks = map_mfttraks[fwdtrack.collisionId()]; + + if (mfttracks.size() > 0) { + hasMFT = true; + } + + muonParams(fwdtrack.chi2(), fwdtrack.rAtAbsorberEnd(), fwdtrack.sign(), propmuonAtPV.getPt(), propmuonAtPV.getEta(), propmuonAtPV.getPhi(), hasMFT); + nfwdtracks[fwdtrack.collisionId()]++; + } + + for (auto fwdtrack1 : fwdtracks) { + + if (!isGoodMUONTrack(fwdtrack1)) { + continue; + } + + int ibc = fwdtrack1.collisionId(); + auto collision = fwdtrack1.collision(); + + o2::dataformats::GlobalFwdTrack fwdtrackAtPV1 = PropagateMUONTrack(fwdtrack1, ProagationPoint::ToVtx); + if (!isGoodKenematicMUONTrack(fwdtrackAtPV1)) { + continue; + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////// MIXED EVENT /////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + for (auto bc_mfttrack : bcs_mfttrack) { + + if (ibc == bc_mfttrack) + continue; + if (fabs(nmfttracks[ibc] - nmfttracks[bc_mfttrack]) > fEventMaxDeltaNMFT) { + continue; + } + if (fabs(map_vtxZ[bc_mfttrack] - collision.posZ()) > fEventMaxDeltaVtxZ) { + continue; + } + + std::vector& mfttrackGlobalIndex = map_mfttraks[bc_mfttrack]; + + for (int idmfttrack1 = 0; idmfttrack1 < static_cast(mfttrackGlobalIndex.size()); ++idmfttrack1) { + + auto mfttrack1 = mfttracks.rawIteratorAt(mfttrackGlobalIndex[idmfttrack1]); + o2::track::TrackParCovFwd mfttrack_at_matching = PropagateMFTtoMatchingPlane(mfttrack1, fwdtrack1); + + V1.SetPtEtaPhi(mfttrack_at_matching.getPt(), mfttrack_at_matching.getEta(), mfttrack_at_matching.getPhi()); + V2.SetPtEtaPhi(fwdtrack1.pt(), fwdtrack1.eta(), fwdtrack1.phi()); + + double deltaPt = mfttrack_at_matching.getPt() - fwdtrack1.pt(); + double deltaX = mfttrack_at_matching.getX() - fwdtrack1.x(); + double deltaY = mfttrack_at_matching.getY() - fwdtrack1.y(); + double deltaPhi = V1.DeltaPhi(V2); + double deltaEta = mfttrack_at_matching.getEta() - fwdtrack1.eta(); + + if (fabs(deltaX) > fPreselectMatchingX) { + continue; + } + if (fabs(deltaY) > fPreselectMatchingY) { + continue; + } + + o2::track::TrackParCovFwd mfttrack_at_dca = PropagateMFT(mfttrack1, ProagationPoint::ToDCA); + + mixmatchingParams(deltaPt, deltaEta, deltaPhi, deltaX, deltaY, fwdtrackAtPV1.getPt(), fwdtrackAtPV1.getEta(), fwdtrack1.sign(), mfttrack_at_dca.getEta(), mfttrack1.sign()); + } + } // end of loop bc_mfttrack + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////// SAME EVENT /////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + std::vector& mfttrackGlobalIndex = map_mfttraks[ibc]; + + for (int idmfttrack1 = 0; idmfttrack1 < static_cast(mfttrackGlobalIndex.size()); ++idmfttrack1) { + + auto mfttrack1 = mfttracks.rawIteratorAt(mfttrackGlobalIndex[idmfttrack1]); + o2::track::TrackParCovFwd mfttrack_at_matching = PropagateMFTtoMatchingPlane(mfttrack1, fwdtrack1); + V1.SetPtEtaPhi(mfttrack_at_matching.getPt(), mfttrack_at_matching.getEta(), mfttrack_at_matching.getPhi()); + V2.SetPtEtaPhi(fwdtrack1.pt(), fwdtrack1.eta(), fwdtrack1.phi()); + + double deltaPt = mfttrack_at_matching.getPt() - fwdtrack1.pt(); + double deltaX = mfttrack_at_matching.getX() - fwdtrack1.x(); + double deltaY = mfttrack_at_matching.getY() - fwdtrack1.y(); + double deltaPhi = V1.DeltaPhi(V2); + double deltaEta = mfttrack_at_matching.getEta() - fwdtrack1.eta(); + + if (fabs(deltaX) > fPreselectMatchingX) { + continue; + } + if (fabs(deltaY) > fPreselectMatchingY) { + continue; + } + + o2::track::TrackParCovFwd mfttrack_at_dca = PropagateMFT(mfttrack1, ProagationPoint::ToDCA); + + matchingParams(deltaPt, deltaEta, deltaPhi, deltaX, deltaY, + fwdtrackAtPV1.getPt(), fwdtrackAtPV1.getEta(), fwdtrack1.sign(), + mfttrack_at_dca.getEta(), mfttrack1.sign()); + + } // end of loop idmfttrack1 + + std::vector& fwdtrackGlobalIndex = map_fwdtraks[ibc]; + + for (int idfwdtrack2 = 0; idfwdtrack2 < static_cast(fwdtrackGlobalIndex.size()); ++idfwdtrack2) { + + if (fwdtrack1.globalIndex() == fwdtrackGlobalIndex[idfwdtrack2]) { + continue; + } + + auto fwdtrack2 = fwdtracks.rawIteratorAt(fwdtrackGlobalIndex[idfwdtrack2]); + + if (!isGoodMUONTrack(fwdtrack2)) { + continue; + } + + o2::dataformats::GlobalFwdTrack fwdtrackAtPV2 = PropagateMUONTrack(fwdtrack2, ProagationPoint::ToVtx); + if (!isGoodKenematicMUONTrack(fwdtrackAtPV2)) { + continue; + } + + muon1LV.SetPtEtaPhiM(fwdtrackAtPV1.getPt(), fwdtrackAtPV1.getEta(), fwdtrackAtPV1.getPhi(), mMu); + muon2LV.SetPtEtaPhiM(fwdtrackAtPV2.getPt(), fwdtrackAtPV2.getEta(), fwdtrackAtPV2.getPhi(), mMu); + dimuonLV = muon1LV + muon2LV; + + muonPairs(nmfttracks[ibc], fwdtrack1.sign() + fwdtrack2.sign(), dimuonLV.M(), dimuonLV.Pt(), dimuonLV.Rapidity()); + + if (fabs(fwdtrack1.sign() + fwdtrack2.sign()) > 0) { + continue; + } + if (fTagMassWindowMin > dimuonLV.M() || dimuonLV.M() > fTagMassWindowMax) { + continue; + } + if (nmfttracks[ibc] < 1) { + continue; + } + + tagmuonPairs(nmfttracks[ibc], fwdtrack1.sign() + fwdtrack2.sign(), dimuonLV.M(), dimuonLV.Pt(), dimuonLV.Rapidity()); + + bool isGoodTag = false; + int nMFTCandsTagMUON = 0; + + auto tagfwdtrack = fwdtracks.rawIteratorAt(selectTagMUON(fwdtrack1, fwdtrack2)); + o2::dataformats::GlobalFwdTrack tagfwdtrackAtPV = PropagateMUONTrack(tagfwdtrack, ProagationPoint::ToVtx); + + for (int idmfttrack1 = 0; idmfttrack1 < static_cast(mfttrackGlobalIndex.size()); ++idmfttrack1) { + + auto mfttrack1 = mfttracks.rawIteratorAt(mfttrackGlobalIndex[idmfttrack1]); + o2::track::TrackParCovFwd mfttrack_at_matching = PropagateMFTtoMatchingPlane(mfttrack1, tagfwdtrack); + + V1.SetPtEtaPhi(mfttrack_at_matching.getPt(), mfttrack_at_matching.getEta(), mfttrack_at_matching.getPhi()); + V2.SetPtEtaPhi(tagfwdtrack.pt(), tagfwdtrack.eta(), tagfwdtrack.phi()); + + double deltaPt = mfttrack_at_matching.getPt() - tagfwdtrack.pt(); + double deltaX = mfttrack_at_matching.getX() - tagfwdtrack.x(); + double deltaY = mfttrack_at_matching.getY() - tagfwdtrack.y(); + double deltaPhi = V1.DeltaPhi(V2); + double deltaEta = mfttrack_at_matching.getEta() - tagfwdtrack.eta(); + + if (fabs(deltaX) > fPreselectMatchingX) { + continue; + } + if (fabs(deltaY) > fPreselectMatchingY) { + continue; + } + + o2::track::TrackParCovFwd mfttrack_at_dca = PropagateMFT(mfttrack1, ProagationPoint::ToDCA); + + bool dummyTag = false; + + if (fTagXWindowLow < deltaX && deltaX < fTagXWindowUp && + fTagXWindowLow < deltaY && deltaY < fTagXWindowUp && + fTagPhiWindowLow < deltaPhi && deltaPhi < fTagPhiWindowUp && + fTagEtaWindowLow < deltaEta && deltaEta < fTagEtaWindowUp) { + isGoodTag = true; + dummyTag = true; + nMFTCandsTagMUON++; + } + + tagmatchingParams(deltaPt, deltaEta, deltaPhi, deltaX, deltaY, + tagfwdtrackAtPV.getPt(), tagfwdtrackAtPV.getEta(), tagfwdtrack.sign(), mfttrack_at_dca.getEta(), mfttrack1.sign(), dummyTag); + } + + if (!isGoodTag) { + continue; + } + + auto probefwdtrack = fwdtracks.rawIteratorAt(selectProbeMUONTrack(fwdtrack1, fwdtrack2)); + o2::dataformats::GlobalFwdTrack probefwdtrackAtPV = PropagateMUONTrack(probefwdtrack, ProagationPoint::ToVtx); + + int nMFTCandsProbeMUON = 0; + /// Counting the number of MFT tracks in a probe muon track + for (int idmfttrack1 = 0; idmfttrack1 < static_cast(mfttrackGlobalIndex.size()); ++idmfttrack1) { + + auto mfttrack1 = mfttracks.rawIteratorAt(mfttrackGlobalIndex[idmfttrack1]); + o2::track::TrackParCovFwd mfttrack_at_matching = PropagateMFTtoMatchingPlane(mfttrack1, probefwdtrack); + V1.SetPtEtaPhi(mfttrack_at_matching.getPt(), mfttrack_at_matching.getEta(), mfttrack_at_matching.getPhi()); + V2.SetPtEtaPhi(probefwdtrack.pt(), probefwdtrack.eta(), probefwdtrack.phi()); + + double deltaX = mfttrack_at_matching.getX() - probefwdtrack.x(); + double deltaY = mfttrack_at_matching.getY() - probefwdtrack.y(); + double deltaPhi = V1.DeltaPhi(V2); + double deltaEta = mfttrack_at_matching.getEta() - probefwdtrack.eta(); + + if (fProbeXWindowLow < deltaX && deltaX < fProbeXWindowUp && + fProbeXWindowLow < deltaY && deltaY < fProbeXWindowUp && + fProbePhiWindowLow < deltaPhi && deltaPhi < fProbePhiWindowUp && + fProbeEtaWindowLow < deltaEta && deltaEta < fProbeEtaWindowUp) { + nMFTCandsProbeMUON++; + } + } + + for (int idmfttrack1 = 0; idmfttrack1 < static_cast(mfttrackGlobalIndex.size()); ++idmfttrack1) { + + auto mfttrack1 = mfttracks.rawIteratorAt(mfttrackGlobalIndex[idmfttrack1]); + o2::track::TrackParCovFwd mfttrack_at_matching = PropagateMFTtoMatchingPlane(mfttrack1, probefwdtrack); + + V1.SetPtEtaPhi(mfttrack_at_matching.getPt(), mfttrack_at_matching.getEta(), mfttrack_at_matching.getPhi()); + V2.SetPtEtaPhi(probefwdtrack.pt(), probefwdtrack.eta(), probefwdtrack.phi()); + + double deltaPt = mfttrack_at_matching.getPt() - probefwdtrack.pt(); + double deltaX = mfttrack_at_matching.getX() - probefwdtrack.x(); + double deltaY = mfttrack_at_matching.getY() - probefwdtrack.y(); + double deltaPhi = V1.DeltaPhi(V2); + double deltaEta = mfttrack_at_matching.getEta() - probefwdtrack.eta(); + + if (fabs(deltaX) > fPreselectMatchingX) { + continue; + } + if (fabs(deltaY) > fPreselectMatchingY) { + continue; + } + + o2::track::TrackParCovFwd mfttrack_at_dca = PropagateMFT(mfttrack1, ProagationPoint::ToDCA); + + probematchingParams(nMFTCandsTagMUON, nMFTCandsProbeMUON, tagfwdtrack.p(), deltaPt, deltaEta, deltaPhi, deltaX, deltaY, probefwdtrackAtPV.getPt(), probefwdtrackAtPV.getEta(), probefwdtrack.sign(), mfttrack_at_dca.getEta(), mfttrack1.sign()); + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Common/TableProducer/mcCollsExtra.cxx b/Common/TableProducer/mcCollsExtra.cxx index 3ad7a143acd..c085969c5af 100644 --- a/Common/TableProducer/mcCollsExtra.cxx +++ b/Common/TableProducer/mcCollsExtra.cxx @@ -12,9 +12,10 @@ // Quick and dirty task to correlate MC <-> data // -#include #include +#include #include +#include #include "Math/Vector4D.h" #include @@ -135,8 +136,8 @@ struct mcCollisionExtra { auto iter = std::find(sortedIndices.begin(), sortedIndices.end(), mcCollision.index()); if (iter != sortedIndices.end()) { auto index = std::distance(iter, sortedIndices.begin()); - for (size_t iMcColl = index + 1; iMcColl < index + 17; iMcColl++) { - if (iMcColl >= sortedIndices.size()) + for (auto iMcColl = index + 1; iMcColl < index + 17; iMcColl++) { + if (iMcColl >= std::ssize(sortedIndices)) continue; if (mcCollisionHasPoI[sortedIndices[iMcColl]]) bitset(forwardHistory, iMcColl - index - 1); diff --git a/Common/TableProducer/multiplicityExtraTable.cxx b/Common/TableProducer/multiplicityExtraTable.cxx index 216a1b7acc6..001e75e6adb 100644 --- a/Common/TableProducer/multiplicityExtraTable.cxx +++ b/Common/TableProducer/multiplicityExtraTable.cxx @@ -245,6 +245,7 @@ struct MultiplicityExtraTable { tru(multFDDA), tru(multFDDC), tru(multZNA), tru(multZNC), tru(multZEM1), tru(multZEM2), tru(multZPA), tru(multZPC), Tvx, isFV0OrA, multFV0TriggerBits, multFT0TriggerBits, multFDDTriggerBits, multBCTriggerMask, collidingBC, + bc.timestamp(), bc.flags()); } } diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index 30ae0c226fd..2f9040b569c 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -9,6 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include +#include +#include +#include + #include "Framework/ConfigParamSpec.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -44,7 +49,8 @@ static constexpr int kFT0MultZeqs = 10; static constexpr int kFDDMultZeqs = 11; static constexpr int kPVMultZeqs = 12; static constexpr int kMultMCExtras = 13; -static constexpr int nTables = 14; +static constexpr int kMFTMults = 14; +static constexpr int nTables = 15; // Checking that the Zeq tables are after the normal ones static_assert(kFV0Mults < kFV0MultZeqs); @@ -66,9 +72,10 @@ static const std::vector tableNames{"FV0Mults", // 0 "FT0MultZeqs", // 10 "FDDMultZeqs", // 11 "PVMultZeqs", // 12 - "MultMCExtras"}; // 13 + "MultMCExtras", // 13 + "MFTMults"}; // 14 static const std::vector parameterNames{"Enable"}; -static const int defaultParameters[nTables][nParameters]{{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}}; +static const int defaultParameters[nTables][nParameters]{{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}}; struct MultiplicityTable { SliceCache cache; @@ -87,6 +94,7 @@ struct MultiplicityTable { Produces tablePVZeqs; // 12 Produces tableExtraMc; // 13 Produces tableExtraMult2MCExtras; + Produces mftMults; // 14 Produces multsGlobal; // Not accounted for, produced based on process function processGlobalTrackingCounters // For vertex-Z corrections in calibration @@ -100,6 +108,7 @@ struct MultiplicityTable { Partition pvContribTracksEta1 = (nabs(aod::track::eta) < 1.0f) && ((aod::track::flags & (uint32_t)o2::aod::track::PVContributor) == (uint32_t)o2::aod::track::PVContributor); Preslice perCol = aod::track::collisionId; Preslice perColIU = aod::track::collisionId; + Preslice perCollisionMFT = o2::aod::fwdtrack::collisionId; using BCsWithRun3Matchings = soa::Join; @@ -292,7 +301,8 @@ struct MultiplicityTable { aod::Zdcs const&, aod::FV0As const&, aod::FT0s const&, - aod::FDDs const&) + aod::FDDs const&, + aod::MFTTracks const& mftTracks) { // reserve memory for (auto i : mEnabledTables) { @@ -338,6 +348,9 @@ struct MultiplicityTable { break; case kMultMCExtras: // MC extra information (nothing to do in the data) break; + case kMFTMults: // Equalized multiplicity for PV + mftMults.reserve(collisions.size()); + break; default: LOG(fatal) << "Unknown table requested: " << i; break; @@ -616,6 +629,19 @@ struct MultiplicityTable { case kMultMCExtras: // MC only (nothing to do) { } break; + case kMFTMults: { + // for centrality estimation with the MFT if desired + // step 1: produce proper grouping + const uint64_t collIdx = collision.globalIndex(); + auto mftTracksGrouped = mftTracks.sliceBy(perCollisionMFT, collIdx); + int nTracks = 0; + for (auto& track : mftTracksGrouped) { + if (track.nClusters() >= 5) { // hardcoded on purpose to avoid trouble + nTracks++; + } + } + mftMults(nTracks); + } break; default: // Default { LOG(fatal) << "Unknown table requested: " << i; @@ -628,13 +654,16 @@ struct MultiplicityTable { // one loop better than multiple sliceby calls // FIT FT0C: -3.3 < η < -2.1 // FOT FT0A: 3.5 < η < 4.9 - Filter mcParticleFilter = (aod::mcparticle::eta < 4.9f) && (aod::mcparticle::eta > -3.3f); + Filter mcParticleFilter = (aod::mcparticle::eta < 7.0f) && (aod::mcparticle::eta > -7.0f); using mcParticlesFiltered = soa::Filtered; void processMC(aod::McCollision const& mcCollision, mcParticlesFiltered const& mcParticles) { int multFT0A = 0; + int multFV0A = 0; int multFT0C = 0; + int multFDDA = 0; + int multFDDC = 0; int multBarrelEta05 = 0; int multBarrelEta08 = 0; int multBarrelEta10 = 0; @@ -665,8 +694,14 @@ struct MultiplicityTable { multFT0C++; if (3.5 < mcPart.eta() && mcPart.eta() < 4.9) multFT0A++; + if (2.2 < mcPart.eta() && mcPart.eta() < 5.0) + multFV0A++; + if (-6.9 < mcPart.eta() && mcPart.eta() < -4.9) + multFDDC++; + if (4.7 < mcPart.eta() && mcPart.eta() < 6.3) + multFDDA++; } - tableExtraMc(multFT0A, multFT0C, multBarrelEta05, multBarrelEta08, multBarrelEta10, mcCollision.posZ()); + tableExtraMc(multFT0A, multFT0C, multFV0A, multFDDA, multFDDC, multBarrelEta05, multBarrelEta08, multBarrelEta10, mcCollision.posZ()); } void processMC2Mults(soa::Join::iterator const& collision) diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index ab8e3bf33fb..378a2ac06a2 100644 --- a/Common/TableProducer/trackPropagation.cxx +++ b/Common/TableProducer/trackPropagation.cxx @@ -62,6 +62,7 @@ struct TrackPropagation { // for TrackTuner only (MC smearing) Configurable useTrackTuner{"useTrackTuner", false, "Apply track tuner corrections to MC"}; Configurable fillTrackTunerTable{"fillTrackTunerTable", false, "flag to fill track tuner table"}; + Configurable trackTunerConfigSource{"trackTunerConfigSource", aod::track_tuner::InputString, "1: input string; 2: TrackTuner Configurables"}; Configurable trackTunerParams{"trackTunerParams", "debugInfo=0|updateTrackDCAs=1|updateTrackCovMat=1|updateCurvature=0|updateCurvatureIU=0|updatePulls=0|isInputFileFromCCDB=1|pathInputFile=Users/m/mfaggin/test/inputsTrackTuner/PbPb2022|nameInputFile=trackTuner_DataLHC22sPass5_McLHC22l1b2_run529397.root|pathFileQoverPt=Users/h/hsharma/qOverPtGraphs|nameFileQoverPt=D0sigma_Data_removal_itstps_MC_LHC22b1b.root|usePvRefitCorrections=0|qOverPtMC=-1.|qOverPtData=-1.", "TrackTuner parameter initialization (format: =|=)"}; ConfigurableAxis axisPtQA{"axisPtQA", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; OutputObj trackTunedTracks{TH1D("trackTunedTracks", "", 1, 0.5, 1.5), OutputObjHandlingPolicy::AnalysisObject}; @@ -119,7 +120,20 @@ struct TrackPropagation { /// TrackTuner initialization if (useTrackTuner) { - std::string outputStringParams = trackTunerObj.configParams(trackTunerParams); + std::string outputStringParams = ""; + switch (trackTunerConfigSource) { + case aod::track_tuner::InputString: + outputStringParams = trackTunerObj.configParams(trackTunerParams); + break; + case aod::track_tuner::Configurables: + outputStringParams = trackTunerObj.configParams(); + break; + + default: + LOG(fatal) << "TrackTuner configuration source not defined. Fix it! (Supported options: input string (1); Configurables (2))"; + break; + } + trackTunerObj.getDcaGraphs(); trackTunedTracks->SetTitle(outputStringParams.c_str()); trackTunedTracks->GetXaxis()->SetBinLabel(1, "all tracks"); diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 1ba72958a37..f9774f0963e 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -35,6 +35,11 @@ struct centralityStudy { // Configurables Configurable do2DPlots{"do2DPlots", true, "0 - no, 1 - yes"}; + Configurable doOccupancyStudyVsCentrality2d{"doOccupancyStudyVsCentrality2d", true, "0 - no, 1 - yes"}; + Configurable doOccupancyStudyVsRawValues2d{"doOccupancyStudyVsRawValues2d", true, "0 - no, 1 - yes"}; + Configurable doOccupancyStudyVsCentrality3d{"doOccupancyStudyVsCentrality3d", false, "0 - no, 1 - yes"}; + Configurable doOccupancyStudyVsRawValues3d{"doOccupancyStudyVsRawValues3d", false, "0 - no, 1 - yes"}; + Configurable doNGlobalTracksVsRawSignals{"doNGlobalTracksVsRawSignals", true, "0 - no, 1 - yes"}; Configurable applySel8{"applySel8", true, "0 - no, 1 - yes"}; Configurable applyVtxZ{"applyVtxZ", true, "0 - no, 1 - yes"}; @@ -46,15 +51,57 @@ struct centralityStudy { Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", true, "require events with at least one of vertex contributors matched to TOF"}; Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", true, "require events with at least one of vertex contributors matched to TRD"}; Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; - Configurable minTimeDelta{"minTimeDelta", -1.0f, "reject collision if another collision is this close or less in time"}; - // Configurable Axes - ConfigurableAxis axisMultFT0C{"axisMultFT0C", {2000, 0, 100000}, "FT0C amplitude"}; + Configurable rejectITSinROFpileupStandard{"rejectITSinROFpileupStandard", false, "reject collisions in case of in-ROF ITS pileup (standard)"}; + Configurable rejectITSinROFpileupStrict{"rejectITSinROFpileupStrict", false, "reject collisions in case of in-ROF ITS pileup (strict)"}; + Configurable rejectCollInTimeRangeNarrow{"rejectCollInTimeRangeNarrow", false, "reject if extra colls in time range (narrow)"}; + + Configurable selectUPCcollisions{"selectUPCcollisions", false, "select collisions tagged with UPC flag"}; + + Configurable selectCollidingBCs{"selectCollidingBCs", true, "BC analysis: select colliding BCs"}; + Configurable selectTVX{"selectTVX", true, "BC analysis: select TVX"}; + Configurable selectFV0OrA{"selectFV0OrA", true, "BC analysis: select FV0OrA"}; + Configurable vertexZwithT0{"vertexZwithT0", 1000.0f, "require a certain vertex-Z in BC analysis"}; + + Configurable minTimeDelta{"minTimeDelta", -1.0f, "reject collision if another collision is this close or less in time"}; + Configurable minFT0CforVertexZ{"minFT0CforVertexZ", 250, "minimum FT0C for vertex-Z profile calculation"}; + + Configurable scaleSignalFT0C{"scaleSignalFT0C", 1.00f, "scale FT0C signal for convenience"}; + Configurable scaleSignalFT0M{"scaleSignalFT0M", 1.00f, "scale FT0M signal for convenience"}; + Configurable scaleSignalFV0A{"scaleSignalFV0A", 1.00f, "scale FV0A signal for convenience"}; + + // _______________________________________ + // upc rejection criteria + // reject low zna/c + struct : ConfigurableGroup { + Configurable minZNACsignal{"minZNACsignal", -999999.0f, "min zna/c signal"}; + Configurable maxFT0CforZNACselection{"maxFT0CforZNACselection", -99999.0f, "max ft0c signal for minZNACsignal to work"}; + + Configurable minFV0Asignal{"minFV0Asignal", -999999.0f, "min fv0a signal"}; + Configurable maxFT0CforFV0Aselection{"maxFT0CforFV0Aselection", -99999.0f, "max ft0c signal for minFV0Asignal to work"}; + + Configurable minFDDAsignal{"minFDDAsignal", -999999.0f, "min fdda signal"}; + Configurable maxFT0CforFDDAselection{"maxFT0CforFDDAselection", -99999.0f, "max ft0c signal for minFDDAsignal to work"}; + } upcRejection; + + // Configurable Axes for 2d plots, etc + ConfigurableAxis axisMultFV0A{"axisMultFV0A", {1000, 0, 100000}, "FV0A amplitude"}; + ConfigurableAxis axisMultFT0A{"axisMultFT0A", {1000, 0, 100000}, "FT0A amplitude"}; + ConfigurableAxis axisMultFT0C{"axisMultFT0C", {1000, 0, 100000}, "FT0C amplitude"}; + ConfigurableAxis axisMultFDDA{"axisMultFDDA", {1000, 0, 100000}, "FDDA amplitude"}; + ConfigurableAxis axisMultFDDC{"axisMultFDDC", {1000, 0, 100000}, "FDDC amplitude"}; ConfigurableAxis axisMultPVContributors{"axisMultPVContributors", {200, 0, 6000}, "Number of PV Contributors"}; + ConfigurableAxis axisMultGlobalTracks{"axisMultGlobalTracks", {500, 0, 5000}, "Number of global tracks"}; + + ConfigurableAxis axisTrackOccupancy{"axisTrackOccupancy", {50, 0, 5000}, "Track occupancy"}; + ConfigurableAxis axisFT0COccupancy{"axisFT0COccupancy", {50, 0, 80000}, "FT0C occupancy"}; // For one-dimensional plots, where binning is no issue + ConfigurableAxis axisMultUltraFineFV0A{"axisMultUltraFineFV0A", {60000, 0, 60000}, "FV0A amplitude"}; + ConfigurableAxis axisMultUltraFineFT0M{"axisMultUltraFineFT0M", {50000, 0, 200000}, "FT0M amplitude"}; ConfigurableAxis axisMultUltraFineFT0C{"axisMultUltraFineFT0C", {60000, 0, 60000}, "FT0C amplitude"}; ConfigurableAxis axisMultUltraFinePVContributors{"axisMultUltraFinePVContributors", {10000, 0, 10000}, "Number of PV Contributors"}; + ConfigurableAxis axisMultUltraFineGlobalTracks{"axisMultUltraFineGlobalTracks", {5000, 0, 5000}, "Number of global tracks"}; ConfigurableAxis axisMultITSOnly{"axisMultITSOnly", {200, 0, 6000}, "Number of ITS only tracks"}; ConfigurableAxis axisMultITSTPC{"axisMultITSTPC", {200, 0, 6000}, "Number of ITSTPC matched tracks"}; @@ -64,6 +111,11 @@ struct centralityStudy { ConfigurableAxis axisPVChi2{"axisPVChi2", {300, 0, 30}, "FT0C percentile"}; ConfigurableAxis axisDeltaTime{"axisDeltaTime", {300, 0, 300}, "#Delta time"}; + // For profile Z + ConfigurableAxis axisPVz{"axisPVz", {400, -20.0f, +20.0f}, "PVz (cm)"}; + + ConfigurableAxis axisZN{"axisZN", {1100, -50.0f, +500.0f}, "ZN"}; + void init(InitContext&) { if (doprocessCollisions || doprocessCollisionsWithCentrality) { @@ -80,29 +132,92 @@ struct centralityStudy { histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(11, "Neighbour rejection"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(12, "no ITS in-ROF pileup (standard)"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(13, "no ITS in-ROF pileup (strict)"); histos.add("hFT0C_Collisions", "hFT0C_Collisions", kTH1D, {axisMultUltraFineFT0C}); + histos.add("hFT0M_Collisions", "hFT0M_Collisions", kTH1D, {axisMultUltraFineFT0M}); + histos.add("hFV0A_Collisions", "hFV0A_Collisions", kTH1D, {axisMultUltraFineFV0A}); + histos.add("hNGlobalTracks", "hNGlobalTracks", kTH1D, {axisMultUltraFineGlobalTracks}); histos.add("hNPVContributors", "hNPVContributors", kTH1D, {axisMultUltraFinePVContributors}); + + histos.add("hFT0CvsPVz_Collisions_All", "hFT0CvsPVz_Collisions_All", kTProfile, {axisPVz}); + histos.add("hFT0CvsPVz_Collisions", "hFT0CvsPVz_Collisions", kTProfile, {axisPVz}); + histos.add("hFV0AvsPVz_Collisions", "hFV0AvsPVz_Collisions", kTProfile, {axisPVz}); + histos.add("hNGlobalTracksvsPVz_Collisions", "hNGlobalTracksvsPVz_Collisions", kTProfile, {axisPVz}); } if (doprocessBCs) { - histos.add("hBCSelection", "hBCSelection", kTH1D, {{10, -0.5, 9.5f}}); + histos.add("hBCSelection", "hBCSelection", kTH1D, {{20, -0.5, 19.5f}}); histos.add("hFT0C_BCs", "hFT0C_BCs", kTH1D, {axisMultUltraFineFT0C}); + histos.add("hFT0M_BCs", "hFT0M_BCs", kTH1D, {axisMultUltraFineFT0M}); + histos.add("hFV0A_BCs", "hFV0A_BCs", kTH1D, {axisMultUltraFineFV0A}); + histos.add("hFT0CvsPVz_BCs_All", "hFT0CvsPVz_BCs_All", kTProfile, {axisPVz}); + histos.add("hFT0CvsPVz_BCs", "hFT0CvsPVz_BCs", kTProfile, {axisPVz}); + histos.add("hVertexZ_BCvsCO", "hVertexZ_BCvsCO", kTH2D, {axisPVz, axisPVz}); + histos.add("hZNAvsFT0C_BCs", "hZNAvsFT0C_BCs", kTH2D, {axisMultFT0C, axisZN}); + histos.add("hZNCvsFT0C_BCs", "hZNCvsFT0C_BCs", kTH2D, {axisMultFT0C, axisZN}); } if (do2DPlots) { - histos.add("hFT0CvsNContribs", "hFT0CvsNContribs", kTH2F, {axisMultPVContributors, axisMultFT0C}); + histos.add("hNContribsVsFT0C", "hNContribsVsFT0C", kTH2F, {axisMultFT0C, axisMultPVContributors}); + histos.add("hNContribsVsFV0A", "hNContribsVsFV0A", kTH2F, {axisMultFV0A, axisMultPVContributors}); histos.add("hMatchedVsITSOnly", "hMatchedVsITSOnly", kTH2F, {axisMultITSOnly, axisMultITSTPC}); + + // 2d correlation of fit signals + histos.add("hFT0AVsFT0C", "hFT0AVsFT0C", kTH2F, {axisMultFT0C, axisMultFT0A}); + histos.add("hFV0AVsFT0C", "hFV0AVsFT0C", kTH2F, {axisMultFT0C, axisMultFV0A}); + histos.add("hFDDAVsFT0C", "hFDDAVsFT0C", kTH2F, {axisMultFT0C, axisMultFDDA}); + histos.add("hFDDCVsFT0C", "hFDDCVsFT0C", kTH2F, {axisMultFT0C, axisMultFDDC}); + } + + if (doNGlobalTracksVsRawSignals) { + histos.add("hNGlobalTracksVsFT0A", "hNGlobalTracksVsFT0A", kTH2F, {axisMultFT0A, axisMultGlobalTracks}); + histos.add("hNGlobalTracksVsFT0C", "hNGlobalTracksVsFT0C", kTH2F, {axisMultFT0C, axisMultGlobalTracks}); + histos.add("hNGlobalTracksVsFV0A", "hNGlobalTracksVsFV0A", kTH2F, {axisMultFV0A, axisMultGlobalTracks}); + histos.add("hNGlobalTracksVsFDDA", "hNGlobalTracksVsFDDA", kTH2F, {axisMultFDDA, axisMultGlobalTracks}); + histos.add("hNGlobalTracksVsFDDC", "hNGlobalTracksVsFDDC", kTH2F, {axisMultFDDC, axisMultGlobalTracks}); + histos.add("hNGlobalTracksVsZNA", "hNGlobalTracksVsZNA", kTH2F, {axisZN, axisMultGlobalTracks}); + histos.add("hNGlobalTracksVsZNC", "hNGlobalTracksVsZNC", kTH2F, {axisZN, axisMultGlobalTracks}); + } + + if (doOccupancyStudyVsRawValues2d) { + histos.add("hNcontribsProfileVsTrackOccupancyVsFT0C", "hNcontribsProfileVsTrackOccupancyVsFT0C", kTProfile2D, {axisTrackOccupancy, axisMultFT0C}); + histos.add("hNGlobalTracksProfileVsTrackOccupancyVsFT0C", "hNGlobalTracksProfileVsTrackOccupancyVsFT0C", kTProfile2D, {axisTrackOccupancy, axisMultFT0C}); + histos.add("hNcontribsProfileVsFT0COccupancyVsFT0C", "hNcontribsProfileVsFT0COccupancyVsFT0C", kTProfile2D, {axisFT0COccupancy, axisMultFT0C}); + histos.add("hNGlobalTracksProfileVsFT0COccupancyVsFT0C", "hNGlobalTracksProfileVsFT0COccupancyVsFT0C", kTProfile2D, {axisFT0COccupancy, axisMultFT0C}); + } + + if (doOccupancyStudyVsRawValues3d) { + histos.add("hTrackOccupancyVsNContribsVsFT0C", "hTrackOccupancyVsNContribsVsFT0C", kTH3F, {axisTrackOccupancy, axisMultPVContributors, axisMultFT0C}); + histos.add("hTrackOccupancyVsNGlobalTracksVsFT0C", "hTrackOccupancyVsNGlobalTracksVsFT0C", kTH3F, {axisTrackOccupancy, axisMultGlobalTracks, axisMultFT0C}); + histos.add("hFT0COccupancyVsNContribsVsFT0C", "hFT0COccupancyVsNContribsVsFT0C", kTH3F, {axisFT0COccupancy, axisMultPVContributors, axisMultFT0C}); + histos.add("hFT0COccupancyVsNGlobalTracksVsFT0C", "hFT0COccupancyVsNGlobalTracksVsFT0C", kTH3F, {axisFT0COccupancy, axisMultGlobalTracks, axisMultFT0C}); } if (doprocessCollisionsWithCentrality) { // in case requested: do vs centrality debugging + histos.add("hCentrality", "hCentrality", kTH1F, {axisCentrality}); histos.add("hNContribsVsCentrality", "hNContribsVsCentrality", kTH2F, {axisCentrality, axisMultPVContributors}); histos.add("hNITSTPCTracksVsCentrality", "hNITSTPCTracksVsCentrality", kTH2F, {axisCentrality, axisMultPVContributors}); histos.add("hNITSOnlyTracksVsCentrality", "hNITSOnlyTracksVsCentrality", kTH2F, {axisCentrality, axisMultPVContributors}); histos.add("hNGlobalTracksVsCentrality", "hNGlobalTracksVsCentrality", kTH2F, {axisCentrality, axisMultPVContributors}); histos.add("hPVChi2VsCentrality", "hPVChi2VsCentrality", kTH2F, {axisCentrality, axisPVChi2}); histos.add("hDeltaTimeVsCentrality", "hDeltaTimeVsCentrality", kTH2F, {axisCentrality, axisDeltaTime}); + + if (doOccupancyStudyVsCentrality2d) { + histos.add("hNcontribsProfileVsTrackOccupancyVsCentrality", "hNcontribsProfileVsTrackOccupancyVsCentrality", kTProfile2D, {axisTrackOccupancy, axisCentrality}); + histos.add("hNGlobalTracksProfileVsTrackOccupancyVsCentrality", "hNGlobalTracksProfileVsTrackOccupancyVsCentrality", kTProfile2D, {axisTrackOccupancy, axisCentrality}); + histos.add("hNcontribsProfileVsFT0COccupancyVsCentrality", "hNcontribsProfileVsFT0COccupancyVsCentrality", kTProfile2D, {axisFT0COccupancy, axisCentrality}); + histos.add("hNGlobalTracksProfileVsFT0COccupancyVsCentrality", "hNGlobalTracksProfileVsFT0COccupancyVsCentrality", kTProfile2D, {axisFT0COccupancy, axisCentrality}); + } + + if (doOccupancyStudyVsCentrality3d) { + histos.add("hTrackOccupancyVsNContribsVsCentrality", "hTrackOccupancyVsNContribsVsCentrality", kTH3F, {axisTrackOccupancy, axisMultPVContributors, axisCentrality}); + histos.add("hTrackOccupancyVsNGlobalTracksVsCentrality", "hTrackOccupancyVsNGlobalTracksVsCentrality", kTH3F, {axisTrackOccupancy, axisMultGlobalTracks, axisCentrality}); + histos.add("hFT0COccupancyVsNContribsVsCentrality", "hFT0COccupancyVsNContribsVsCentrality", kTH3F, {axisFT0COccupancy, axisMultPVContributors, axisCentrality}); + histos.add("hFT0COccupancyVsNGlobalTracksVsCentrality", "hFT0COccupancyVsNGlobalTracksVsCentrality", kTH3F, {axisFT0COccupancy, axisMultGlobalTracks, axisCentrality}); + } } } @@ -168,27 +283,116 @@ struct centralityStudy { histos.fill(HIST("hCollisionSelection"), 10 /* has suspicious neighbour */); } + if (rejectITSinROFpileupStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 11 /* Not ITS ROF pileup (standard) */); + + if (rejectITSinROFpileupStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 12 /* Not ITS ROF pileup (strict) */); + + if (selectUPCcollisions && collision.flags() < 1) { // if zero then NOT upc, otherwise UPC + return; + } + histos.fill(HIST("hCollisionSelection"), 13 /* is UPC event */); + + if (rejectCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 14 /* Not ITS ROF pileup (strict) */); + + if (collision.multFT0C() < upcRejection.maxFT0CforZNACselection && + collision.multZNA() < upcRejection.minZNACsignal && + collision.multZNC() < upcRejection.minZNACsignal) { + return; + } + if (collision.multFT0C() < upcRejection.maxFT0CforFV0Aselection && + collision.multFV0A() < upcRejection.minFV0Asignal) { + return; + } + if (collision.multFT0C() < upcRejection.maxFT0CforFDDAselection && + collision.multFDDA() < upcRejection.minFDDAsignal) { + return; + } + histos.fill(HIST("hCollisionSelection"), 15 /* pass em/upc rejection */); + // if we got here, we also finally fill the FT0C histogram, please histos.fill(HIST("hNPVContributors"), collision.multPVTotalContributors()); - histos.fill(HIST("hFT0C_Collisions"), collision.multFT0C()); - + histos.fill(HIST("hFT0C_Collisions"), collision.multFT0C() * scaleSignalFT0C); + histos.fill(HIST("hFT0M_Collisions"), (collision.multFT0A() + collision.multFT0C()) * scaleSignalFT0M); + histos.fill(HIST("hFV0A_Collisions"), collision.multFV0A() * scaleSignalFV0A); + histos.fill(HIST("hNGlobalTracks"), collision.multNTracksGlobal()); + histos.fill(HIST("hFT0CvsPVz_Collisions_All"), collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); + histos.fill(HIST("hFV0AvsPVz_Collisions"), collision.multPVz(), collision.multFV0A() * scaleSignalFV0A); + histos.fill(HIST("hNGlobalTracksvsPVz_Collisions"), collision.multPVz(), collision.multNTracksGlobal()); + if (collision.multFT0C() > minFT0CforVertexZ) { + histos.fill(HIST("hFT0CvsPVz_Collisions"), collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); + } if (do2DPlots) { - histos.fill(HIST("hFT0CvsNContribs"), collision.multNTracksPV(), collision.multFT0C()); + histos.fill(HIST("hNContribsVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multPVTotalContributors()); + histos.fill(HIST("hNContribsVsFV0A"), collision.multFV0A() * scaleSignalFV0A, collision.multPVTotalContributors()); histos.fill(HIST("hMatchedVsITSOnly"), collision.multNTracksITSOnly(), collision.multNTracksITSTPC()); + + // correlate also FIT detector signals + histos.fill(HIST("hFT0AVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multFT0A()); + histos.fill(HIST("hFV0AVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multFV0A()); + histos.fill(HIST("hFDDAVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multFDDA()); + histos.fill(HIST("hFDDCVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multFDDC()); + } + + if (doOccupancyStudyVsCentrality2d) { + histos.fill(HIST("hNcontribsProfileVsTrackOccupancyVsFT0C"), collision.trackOccupancyInTimeRange(), collision.multFT0C(), collision.multPVTotalContributors()); + histos.fill(HIST("hNGlobalTracksProfileVsTrackOccupancyVsFT0C"), collision.trackOccupancyInTimeRange(), collision.multFT0C(), collision.multNTracksGlobal()); + histos.fill(HIST("hNcontribsProfileVsFT0COccupancyVsFT0C"), collision.ft0cOccupancyInTimeRange(), collision.multFT0C(), collision.multPVTotalContributors()); + histos.fill(HIST("hNGlobalTracksProfileVsFT0COccupancyVsFT0C"), collision.ft0cOccupancyInTimeRange(), collision.multFT0C(), collision.multNTracksGlobal()); + } + + if (doOccupancyStudyVsRawValues3d) { + histos.fill(HIST("hTrackOccupancyVsNContribsVsFT0C"), collision.trackOccupancyInTimeRange(), collision.multPVTotalContributors(), collision.multFT0C()); + histos.fill(HIST("hTrackOccupancyVsNGlobalTracksVsFT0C"), collision.trackOccupancyInTimeRange(), collision.multNTracksGlobal(), collision.multFT0C()); + histos.fill(HIST("hFT0COccupancyVsNContribsVsFT0C"), collision.ft0cOccupancyInTimeRange(), collision.multPVTotalContributors(), collision.multFT0C()); + histos.fill(HIST("hFT0COccupancyVsNGlobalTracksVsFT0C"), collision.ft0cOccupancyInTimeRange(), collision.multNTracksGlobal(), collision.multFT0C()); + } + + if (doNGlobalTracksVsRawSignals) { + histos.fill(HIST("hNGlobalTracksVsFT0A"), collision.multFT0A(), collision.multNTracksGlobal()); + histos.fill(HIST("hNGlobalTracksVsFT0C"), collision.multFT0C(), collision.multNTracksGlobal()); + histos.fill(HIST("hNGlobalTracksVsFV0A"), collision.multFV0A(), collision.multNTracksGlobal()); + histos.fill(HIST("hNGlobalTracksVsFDDA"), collision.multFDDA(), collision.multNTracksGlobal()); + histos.fill(HIST("hNGlobalTracksVsFDDC"), collision.multFDDC(), collision.multNTracksGlobal()); + histos.fill(HIST("hNGlobalTracksVsZNA"), collision.multZNA(), collision.multNTracksGlobal()); + histos.fill(HIST("hNGlobalTracksVsZNC"), collision.multZNC(), collision.multNTracksGlobal()); } // if the table has centrality information if constexpr (requires { collision.centFT0C(); }) { // process FT0C centrality plots + histos.fill(HIST("hCentrality"), collision.centFT0C()); histos.fill(HIST("hNContribsVsCentrality"), collision.centFT0C(), collision.multPVTotalContributors()); histos.fill(HIST("hNITSTPCTracksVsCentrality"), collision.centFT0C(), collision.multNTracksITSTPC()); histos.fill(HIST("hNITSOnlyTracksVsCentrality"), collision.centFT0C(), collision.multNTracksITSOnly()); histos.fill(HIST("hNGlobalTracksVsCentrality"), collision.centFT0C(), collision.multNTracksGlobal()); histos.fill(HIST("hPVChi2VsCentrality"), collision.centFT0C(), collision.multPVChi2()); + + if (doOccupancyStudyVsCentrality2d) { + histos.fill(HIST("hNcontribsProfileVsTrackOccupancyVsCentrality"), collision.trackOccupancyInTimeRange(), collision.centFT0C(), collision.multPVTotalContributors()); + histos.fill(HIST("hNGlobalTracksProfileVsTrackOccupancyVsCentrality"), collision.trackOccupancyInTimeRange(), collision.centFT0C(), collision.multNTracksGlobal()); + histos.fill(HIST("hNcontribsProfileVsFT0COccupancyVsCentrality"), collision.ft0cOccupancyInTimeRange(), collision.centFT0C(), collision.multPVTotalContributors()); + histos.fill(HIST("hNGlobalTracksProfileVsFT0COccupancyVsCentrality"), collision.ft0cOccupancyInTimeRange(), collision.centFT0C(), collision.multNTracksGlobal()); + } + + if (doOccupancyStudyVsCentrality3d) { + histos.fill(HIST("hTrackOccupancyVsNContribsVsCentrality"), collision.trackOccupancyInTimeRange(), collision.multPVTotalContributors(), collision.centFT0C()); + histos.fill(HIST("hTrackOccupancyVsNGlobalTracksVsCentrality"), collision.trackOccupancyInTimeRange(), collision.multNTracksGlobal(), collision.centFT0C()); + histos.fill(HIST("hFT0COccupancyVsNContribsVsCentrality"), collision.ft0cOccupancyInTimeRange(), collision.multPVTotalContributors(), collision.centFT0C()); + histos.fill(HIST("hFT0COccupancyVsNGlobalTracksVsCentrality"), collision.ft0cOccupancyInTimeRange(), collision.multNTracksGlobal(), collision.centFT0C()); + } } } - void processCollisions(soa::Join::iterator const& collision) + void processCollisions(soa::Join::iterator const& collision) { genericProcessCollision(collision); } @@ -203,23 +407,66 @@ struct centralityStudy { genericProcessCollision(collision); } - void processBCs(aod::MultBCs::iterator const& multbc) + void processBCs(soa::Join::iterator const& multbc, soa::Join const&) { // process BCs, calculate FT0C distribution // conditionals suggested by FIT team (Jacek O. et al) histos.fill(HIST("hBCSelection"), 0); // all BCs - if (!multbc.multBCColliding()) + if (selectCollidingBCs && !multbc.multCollidingBC()) return; histos.fill(HIST("hBCSelection"), 1); // colliding - if (!multbc.multBCTVX()) + if (selectTVX && !multbc.multTVX()) return; histos.fill(HIST("hBCSelection"), 2); // TVX - if (!multbc.multBCFV0OrA()) + if (selectFV0OrA && !multbc.multFV0OrA()) return; histos.fill(HIST("hBCSelection"), 3); // FV0OrA + if (vertexZwithT0 < 100.0f) { + if (!multbc.multFT0PosZValid()) + return; + if (TMath::Abs(multbc.multFT0PosZ()) > vertexZwithT0) + return; + } + histos.fill(HIST("hBCSelection"), 4); // FV0OrA + + if (multbc.multFT0C() < upcRejection.maxFT0CforZNACselection && + multbc.multZNA() < upcRejection.minZNACsignal && + multbc.multZNC() < upcRejection.minZNACsignal) { + return; + } + if (multbc.multFT0C() < upcRejection.maxFT0CforFV0Aselection && + multbc.multFV0A() < upcRejection.minFV0Asignal) { + return; + } + if (multbc.multFT0C() < upcRejection.maxFT0CforFDDAselection && + multbc.multFDDA() < upcRejection.minFDDAsignal) { + return; + } + + histos.fill(HIST("hBCSelection"), 5); // znac // if we got here, we also finally fill the FT0C histogram, please - histos.fill(HIST("hFT0C_BCs"), multbc.multBCFT0C()); + histos.fill(HIST("hFT0C_BCs"), multbc.multFT0C() * scaleSignalFT0C); + + // ZN signals + histos.fill(HIST("hZNAvsFT0C_BCs"), multbc.multFT0C() * scaleSignalFT0C, multbc.multZNA()); + histos.fill(HIST("hZNCvsFT0C_BCs"), multbc.multFT0C() * scaleSignalFT0C, multbc.multZNC()); + + histos.fill(HIST("hFT0M_BCs"), (multbc.multFT0A() + multbc.multFT0C()) * scaleSignalFT0M); + histos.fill(HIST("hFV0A_BCs"), multbc.multFV0A() * scaleSignalFV0A); + if (multbc.multFT0PosZValid()) { + histos.fill(HIST("hFT0CvsPVz_BCs_All"), multbc.multFT0PosZ(), multbc.multFT0C() * scaleSignalFT0C); + if (multbc.multFT0C() > minFT0CforVertexZ) { + histos.fill(HIST("hFT0CvsPVz_BCs"), multbc.multFT0PosZ(), multbc.multFT0C() * scaleSignalFT0C); + } + } + + if (multbc.has_ft0Mult()) { + auto multco = multbc.ft0Mult_as>(); + if (multbc.multFT0PosZValid()) { + histos.fill(HIST("hVertexZ_BCvsCO"), multco.multPVz(), multbc.multFT0PosZ()); + } + } } PROCESS_SWITCH(centralityStudy, processCollisions, "per-collision analysis", false); diff --git a/Common/Tasks/multiplicityQa.cxx b/Common/Tasks/multiplicityQa.cxx index 3bf0f769b79..3fc2374c2cc 100644 --- a/Common/Tasks/multiplicityQa.cxx +++ b/Common/Tasks/multiplicityQa.cxx @@ -405,9 +405,9 @@ struct MultiplicityQa { void processFIT(aod::MultBCs const& multsdebug) { for (auto& mult : multsdebug) { - histos.fill(HIST("multiplicityQa/hIsolatedFT0A"), mult.multBCFT0A()); - histos.fill(HIST("multiplicityQa/hIsolatedFT0C"), mult.multBCFT0C()); - histos.fill(HIST("multiplicityQa/hIsolatedFT0M"), mult.multBCFT0A() + mult.multBCFT0C()); + histos.fill(HIST("multiplicityQa/hIsolatedFT0A"), mult.multFT0A()); + histos.fill(HIST("multiplicityQa/hIsolatedFT0C"), mult.multFT0C()); + histos.fill(HIST("multiplicityQa/hIsolatedFT0M"), mult.multFT0A() + mult.multFT0C()); } } diff --git a/Common/Tools/CMakeLists.txt b/Common/Tools/CMakeLists.txt index 5140596629d..29950466a85 100644 --- a/Common/Tools/CMakeLists.txt +++ b/Common/Tools/CMakeLists.txt @@ -12,9 +12,9 @@ add_subdirectory(Multiplicity) add_subdirectory(PID) -o2physics_add_executable(aod-data-model-graph - SOURCES aodDataModelGraph.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore) +#o2physics_add_executable(aod-data-model-graph +# SOURCES aodDataModelGraph.cxx +# PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore) o2physics_add_library(trackSelectionRequest SOURCES trackSelectionRequest.cxx diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index 617c2602c97..4d6876eaf39 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -37,6 +37,7 @@ #include "DetectorsBase/GeometryManager.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" @@ -49,13 +50,34 @@ namespace o2::aod namespace track_tuner { DECLARE_SOA_COLUMN(TunedQOverPt, tunedQOverPt, float); + +/// configuration source +enum configSource : int { InputString = 1, + Configurables }; } // namespace track_tuner DECLARE_SOA_TABLE(TrackTunerTable, "AOD", "TRACKTUNERTABLE", //! track_tuner::TunedQOverPt); } // namespace o2::aod -struct TrackTuner { +struct TrackTuner : o2::framework::ConfigurableGroup { + + std::string prefix = "trackTuner"; // JSON group name + o2::framework::Configurable cfgDebugInfo{"debugInfo", false, "Flag to switch on the debug printout"}; + o2::framework::Configurable cfgUpdateTrackDCAs{"updateTrackDCAs", false, "Flag to enable the DCA smearing"}; + o2::framework::Configurable cfgUpdateTrackCovMat{"updateTrackCovMat", false, "Flag to enable the DCA covariance-matrix smearing"}; + o2::framework::Configurable cfgUpdateCurvature{"updateCurvature", false, "Flag to enable the Q/Pt smearing after the propagation to the production point"}; + o2::framework::Configurable cfgUpdateCurvatureIU{"updateCurvatureIU", false, "Flag to enable the Q/Pt smearing before the propagation to the production point"}; + o2::framework::Configurable cfgUpdatePulls{"updatePulls", false, "Flag to enable the pulls smearing"}; + o2::framework::Configurable cfgIsInputFileFromCCDB{"isInputFileFromCCDB", false, "True: files from CCDB; False: fils from local path (debug)"}; + o2::framework::Configurable cfgPathInputFile{"pathInputFile", "", "Path to file containing DCAxy, DCAz graphs from data and MC"}; + o2::framework::Configurable cfgNameInputFile{"nameInputFile", "", "Name of the file containing DCAxy, DCAz graphs from data and MC"}; + o2::framework::Configurable cfgPathFileQoverPt{"pathFileQoverPt", "", "Path to file containing Q/Pt correction graphs from data and MC"}; + o2::framework::Configurable cfgNameFileQoverPt{"nameFileQoverPt", "", "Name of file containing Q/Pt correction graphs from data and MC"}; + o2::framework::Configurable cfgUsePvRefitCorrections{"usePvRefitCorrections", false, "Flag to establish whether to use corrections obtained with or w/o PV refit"}; + o2::framework::Configurable cfgQOverPtMC{"qOverPtMC", -1., "Scaling factor on q/pt of MC"}; + o2::framework::Configurable cfgQOverPtData{"qOverPtData", -1., "Scaling factor on q/pt of data"}; + /////////////////////////////// /// parameters to be configured bool debugInfo = false; @@ -66,13 +88,15 @@ struct TrackTuner { bool updatePulls = false; bool isInputFileFromCCDB = false; // query input file from CCDB or local folder std::string pathInputFile = ""; // Path to file containing DCAxy, DCAz graphs from data and MC - std::string nameInputFile = ""; // Common Name of different files containing graphs, found in the above paths - std::string pathFileQoverPt = ""; // Path to file containing D0 sigma graphs from data and MC + std::string nameInputFile = ""; // Name of the file containing DCAxy, DCAz graphs from data and MC + std::string pathFileQoverPt = ""; // Path to file containing Q/Pt correction graphs from data and MC (only one proxy provided, i.e. D0 sigma graphs from data and MC) std::string nameFileQoverPt = ""; // file name containing Q/Pt correction graphs from data and MC bool usePvRefitCorrections = false; // establish whether to use corrections obtained with or w/o PV refit - float qOverPtMC = -1.; // 1/pt old - float qOverPtData = -1.; // 1/pt new + float qOverPtMC = -1.; // 1/pt MC + float qOverPtData = -1.; // 1/pt data /////////////////////////////// + bool isConfigFromString = false; + bool isConfigFromConfigurables = false; o2::ccdb::CcdbApi ccdbApi; std::map metadata; @@ -98,11 +122,31 @@ struct TrackTuner { std::unique_ptr grDcaZPullVsPtPionMC; std::unique_ptr grDcaZPullVsPtPionData; - /// @brief Function to configure the TrackTuner parameters + /// @brief Function doing a few sanity-checks on the configurations + void checkConfig() + { + /// check configuration source + if (isConfigFromString && isConfigFromConfigurables) { + LOG(fatal) << " [ isConfigFromString==kTRUE and isConfigFromConfigurables==kTRUE ] Configuration done both via string and via configurables -> Only one of them can be set to kTRUE at once! Please refer to the trackTuner documentation."; + } + /// check Q/pt update + if ((updateCurvatureIU) && (updateCurvature)) { + LOG(fatal) << " [ updateCurvatureIU==kTRUE and updateCurvature==kTRUE ] -> Only one of them can be set to kTRUE at once! Please refer to the trackTuner documentation."; + } + } + + /// @brief Function to configure the TrackTuner parameters with an input string /// @param inputString Input string with all parameter configuration. Format: =|= /// @return String with the values of all parameters after configurations are listed, to cross check that everything worked well std::string configParams(std::string inputString) { + + LOG(info) << "[TrackTuner] /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/"; + LOG(info) << "[TrackTuner] /*/*/ /*/*/"; + LOG(info) << "[TrackTuner] /*/*/ Configuring the TrackTuner via a string /*/*/"; + LOG(info) << "[TrackTuner] /*/*/ /*/*/"; + LOG(info) << "[TrackTuner] /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/"; + std::string delimiter = "|"; std::string assignmentSymbol = "="; @@ -167,7 +211,7 @@ struct TrackTuner { LOG(info) << "[TrackTuner]"; LOG(info) << "[TrackTuner] >>> Parameters before the custom settings"; LOG(info) << "[TrackTuner] debugInfo = " << debugInfo; - LOG(info) << "[TrackTuner] updateTrackDCAs = " << UpdateTrackDCAs; + LOG(info) << "[TrackTuner] updateTrackDCAs = " << updateTrackDCAs; LOG(info) << "[TrackTuner] updateTrackCovMat = " << updateTrackCovMat; LOG(info) << "[TrackTuner] updateCurvature = " << updateCurvature; LOG(info) << "[TrackTuner] updateCurvatureIU = " << updateCurvatureIU; @@ -294,9 +338,91 @@ struct TrackTuner { outputString += ", qOverPtData=" + std::to_string(qOverPtData); LOG(info) << "[TrackTuner] qOverPtData = " << qOverPtData; - if ((updateCurvatureIU) && (updateCurvature)) { - LOG(fatal) << " [ updateCurvatureIU==kTRUE and updateCurvature==kTRUE ] -> Only one of them can be set to kTRUE at once! Please refer to the trackTuner documentation."; - } + /// declare that the configuration is done via an input string + isConfigFromString = true; + + /// sanity-checks on the configurations + checkConfig(); + + return outputString; + } + + /// @brief Function to configure the TrackTuner parameters with an input string + /// @return String with the values of all parameters after configurations are listed, to cross check that everything worked well + std::string configParams() + { + + LOG(info) << "[TrackTuner] /=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#"; + LOG(info) << "[TrackTuner] /=/#/ /=/#/"; + LOG(info) << "[TrackTuner] /=/#/ Configuring the TrackTuner using the input Configurables /=/#/"; + LOG(info) << "[TrackTuner] /=/#/ /=/#/"; + LOG(info) << "[TrackTuner] /=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/"; + + std::string outputString = ""; + LOG(info) << "[TrackTuner] "; + LOG(info) << "[TrackTuner] >>> Parameters after the custom settings"; + // Configure debugInfo + debugInfo = cfgDebugInfo; + LOG(info) << "[TrackTuner] debugInfo = " << debugInfo; + outputString += "debugInfo=" + std::to_string(debugInfo); + // Configure updateTrackDCAs + updateTrackDCAs = cfgUpdateTrackDCAs; + LOG(info) << "[TrackTuner] updateTrackDCAs = " << updateTrackDCAs; + outputString += ", updateTrackDCAs=" + std::to_string(updateTrackDCAs); + // Configure updateTrackCovMat + updateTrackCovMat = cfgUpdateTrackCovMat; + LOG(info) << "[TrackTuner] updateTrackCovMat = " << updateTrackCovMat; + outputString += ", updateTrackCovMat=" + std::to_string(updateTrackCovMat); + // Configure updateCurvature + updateCurvature = cfgUpdateCurvature; + LOG(info) << "[TrackTuner] updateCurvature = " << updateCurvature; + outputString += ", updateCurvature=" + std::to_string(updateCurvature); + // Configure updateCurvatureIU + updateCurvatureIU = cfgUpdateCurvatureIU; + LOG(info) << "[TrackTuner] updateCurvatureIU = " << updateCurvatureIU; + outputString += ", updateCurvatureIU=" + std::to_string(updateCurvatureIU); + // Configure updatePulls + updatePulls = cfgUpdatePulls; + LOG(info) << "[TrackTuner] updatePulls = " << updatePulls; + outputString += ", updatePulls=" + std::to_string(updatePulls); + // Configure isInputFileFromCCDB + isInputFileFromCCDB = cfgIsInputFileFromCCDB; + LOG(info) << "[TrackTuner] isInputFileFromCCDB = " << isInputFileFromCCDB; + outputString += ", isInputFileFromCCDB=" + std::to_string(isInputFileFromCCDB); + // Configure pathInputFile + pathInputFile = cfgPathInputFile; + outputString += ", pathInputFile=" + pathInputFile; + LOG(info) << "[TrackTuner] pathInputFile = " << pathInputFile; + // Configure pathInputFile + pathFileQoverPt = cfgPathFileQoverPt; + outputString += ", pathFileQoverPt=" + pathFileQoverPt; + LOG(info) << "[TrackTuner] pathFileQoverPt = " << pathFileQoverPt; + // Configure nameInputFile + nameInputFile = cfgNameInputFile; + outputString += ", nameInputFile=" + nameInputFile; + LOG(info) << "[TrackTuner] nameInputFile = " << nameInputFile; + // Configure nameFileQoverPt + nameFileQoverPt = cfgNameFileQoverPt; + outputString += ", nameFileQoverPt=" + nameFileQoverPt; + LOG(info) << "[TrackTuner] nameFileQoverPt = " << nameFileQoverPt; + // Configure usePvRefitCorrections + usePvRefitCorrections = cfgUsePvRefitCorrections; + outputString += ", usePvRefitCorrections=" + std::to_string(usePvRefitCorrections); + LOG(info) << "[TrackTuner] usePvRefitCorrections = " << usePvRefitCorrections; + // Configure qOverPtMC + qOverPtMC = cfgQOverPtMC; + outputString += ", qOverPtMC=" + std::to_string(qOverPtMC); + LOG(info) << "[TrackTuner] qOverPtMC = " << qOverPtMC; + // Configure qOverPtData + qOverPtData = cfgQOverPtData; + outputString += ", qOverPtData=" + std::to_string(qOverPtData); + LOG(info) << "[TrackTuner] qOverPtData = " << qOverPtData; + + /// declare that the configuration is done via the Configurables + isConfigFromConfigurables = true; + + /// sanity-checks on the configurations + checkConfig(); return outputString; } @@ -431,7 +557,7 @@ struct TrackTuner { qOverPtMC = std::max(0.0, evalGraph(ptMC, grOneOverPtPionMC.get())); qOverPtData = std::max(0.0, evalGraph(ptMC, grOneOverPtPionData.get())); } // qOverPtMC, qOverPtData block ends here - } // updateCurvature, updateCurvatureIU block ends here + } // updateCurvature, updateCurvatureIU block ends here if (updateTrackDCAs) { dcaXYMeanMC = evalGraph(ptMC, grDcaXYMeanVsPtPionMC.get()); @@ -720,7 +846,7 @@ struct TrackTuner { trackParCov.setCov(sigma1Pt2, 14); } } // ---> track cov matrix elements for 1/Pt ends here - } // ---> updateTrackCovMat block ends here + } // ---> updateTrackCovMat block ends here if (updatePulls) { double ratioDCAxyPulls = 1.0; diff --git a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx index 5f206137819..81bf34ae73c 100644 --- a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx +++ b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx @@ -9,6 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include #include "map" #include "Framework/runDataProcessing.h" @@ -26,6 +27,7 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" #include "TH1F.h" #include "TH2F.h" @@ -217,8 +219,15 @@ struct DetectorOccupancyQaTask { histos.add("hNumITSTPCtracks_vs_ITS567tracks_ThisEvent", ";n ITS tracks with 5,6,7 hits;n ITS-TPC tracks", kTH2D, {{nBins2D, 0, kMaxThisEv * 8000}, {nBins2D, 0, kMaxThisEv * 8000}}); // 3D - histos.add("hNumITSTPC_vs_ITS567tracksThisCol_vs_FT0CamplInTimeWindow", ";n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;FT0C ampl. sum in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 8000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 250000}}); + histos.add("hNumITSTPC_vs_ITS567tracksThisCol_vs_ITS567tracksInTimeWindow_BEFORE_sel", ";n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 8000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 25000}}); + histos.add("hNumITSTPC_vs_ITS567tracksThisCol_vs_FT0CamplInTimeWindow_BEFORE_sel", ";n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;FT0C ampl. sum in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 8000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 250000}}); + histos.add("hNumITSTPC_vs_ITS567tracksThisCol_vs_ITS567tracksInTimeWindow", ";n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 8000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 25000}}); + histos.add("hNumITSTPC_vs_ITS567tracksThisCol_vs_FT0CamplInTimeWindow", ";n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;FT0C ampl. sum in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 8000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 250000}}); + histos.add("hNumITSTPC_vs_ITS567tracksThisCol_vs_FT0CamplInTimeWindow_kNoCollInTimeRangeNarrow", ";n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;FT0C ampl. sum in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 8000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 250000}}); + + histos.add("hNumITSTPC_vs_FT0CthisCol_vs_FT0CamplInTimeWindow_kNoCollInTimeRangeNarrow", ";FT0C this collision;n ITS-TPC tracks, this collision;FT0C ampl. sum in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 80000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 250000}}); + histos.add("hNumITS567_vs_FT0CthisCol_vs_FT0CamplInTimeWindow_kNoCollInTimeRangeNarrow", ";FT0C this collision;n ITS567cls tracks, this collision;FT0C ampl. sum in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 80000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 250000}}); } // nD, time bins to cover the range -confTimeIntervalForSmallBins... +confTimeIntervalForSmallBins (us) double timeBinSize = 2 * confTimeIntervalForSmallBins / confNumberOfSmallTimeBins; @@ -226,9 +235,25 @@ struct DetectorOccupancyQaTask { for (int i = 0; i < confNumberOfSmallTimeBins + 1; i++) arrTimeBins.push_back(-confTimeIntervalForSmallBins + i * timeBinSize); const AxisSpec axisTimeBins{arrTimeBins, "#Delta t, #mus"}; - histos.add("occupancyInTimeBins", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + int nBinsX = 20; + int nBinsY = 40; + histos.add("occupancyInTimeBins_BEFORE_sel", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_occupByFT0_BEFORE_sel", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + + histos.add("occupancyInTimeBins", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_occupByFT0", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + histos.add("occupancyInTimeBins_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + + histos.add("occupancyInTimeBins_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + + histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow_NoCollInRofStrict", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + histos.add("thisEventITStracksInTimeBins", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); histos.add("thisEventITSTPCtracksInTimeBins", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); + histos.add("thisEventFT0CInTimeBins", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); histos.add("qaForHighOccupITStracksInTimeBinPast", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); histos.add("qaForHighOccupITStracksInTimeBinFuture1", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); @@ -300,6 +325,9 @@ struct DetectorOccupancyQaTask { histos.add("nTracksGlobal_vs_nPV_QA_onlyVzCut_noTFROFborderCuts", "nTracksGlobal_vs_nPV_QA_onlyVzCut_noTFROFborderCuts", kTH2F, {axisNtracks, axisNtracksGlobal}); histos.add("nTracksGlobal_vs_nPV_QA_after_TFborderCut", "nTracksGlobal_vs_nPV_QA_after_TFborderCut", kTH2F, {axisNtracks, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_nPV_occupByFT0C_0_2500", "nTracksGlobal_vs_nPV_occupByFT0C_0_2500", kTH2F, {axisNtracks, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_nPV_occupByFT0C_0_20000", "nTracksGlobal_vs_nPV_occupByFT0C_0_20000", kTH2F, {axisNtracks, axisNtracksGlobal}); + // 3D histograms with occupancy axis histos.add("nTracksGlobal_vs_nPV_vs_occup_pure", "nTracksGlobal_vs_nPV_vs_occup_pure", kTH3F, {axisNtracks, axisNtracksGlobal, axisOccupancyTracks}); histos.add("nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeStandard", "nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeStandard", kTH3F, {axisNtracks, axisNtracksGlobal, axisOccupancyTracks}); @@ -333,38 +361,15 @@ struct DetectorOccupancyQaTask { int runNumber = bcs.iteratorAt(0).runNumber(); if (runNumber != lastRunNumber) { lastRunNumber = runNumber; // do it only once - int64_t tsSOR = 0; - int64_t tsEOR = 1; - uint32_t nOrbitsPerTF = 128; // 128 in 2022, 32 in 2023 - - if (runNumber >= 500000) { // access CCDB for data or anchored MC only - int64_t ts = bcs.iteratorAt(0).timestamp(); - - EventSelectionParams* par = ccdb->getForTimeStamp("EventSelection/EventSelectionParams", ts); - // access orbit-reset timestamp - auto ctpx = ccdb->getForTimeStamp>("CTP/Calib/OrbitReset", ts); - int64_t tsOrbitReset = (*ctpx)[0]; // us - // access TF duration, start-of-run and end-of-run timestamps from ECS GRP - std::map metadata; - metadata["runNumber"] = Form("%d", runNumber); - auto grpecs = ccdb->getSpecific("GLO/Config/GRPECS", ts, metadata); - nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF; nOrbitsPerTF=128 in 2022, 32 in 2023 - tsSOR = grpecs->getTimeStart(); // ms - tsEOR = grpecs->getTimeEnd(); // ms - // calculate SOR and EOR orbits - int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; - int64_t orbitEOR = (tsEOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; - // adjust to the nearest TF edge - orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; - orbitEOR = orbitEOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; - // set nOrbits and minOrbit used for orbit-axis binning - nOrbits = orbitEOR - orbitSOR; - minOrbit = orbitSOR; - // first bc of the first orbit (should coincide with TF start) - bcSOR = orbitSOR * o2::constants::lhc::LHCMaxBunches; + + if (runNumber >= 500000) { + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), runNumber); + // first bc of the first orbit + bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches; // duration of TF in bcs - nBCsPerTF = nOrbitsPerTF * o2::constants::lhc::LHCMaxBunches; - LOGP(info, "tsOrbitReset={} us, SOR = {} ms, EOR = {} ms, orbitSOR = {}, nBCsPerTF = {}", tsOrbitReset, tsSOR, tsEOR, orbitSOR, nBCsPerTF); + nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches; + + LOGP(info, "bcSOR = {}, nBCsPerTF = {}", bcSOR, nBCsPerTF); } } @@ -377,6 +382,8 @@ struct DetectorOccupancyQaTask { std::vector vTracksGlobalPerCollPtEtaCuts(cols.size(), 0); // counter of tracks per found bc for occupancy studies std::vector vTracksITSTPCperColl(cols.size(), 0); // counter of tracks per found bc for occupancy studies std::vector vTracksITSTPCperCollPtEtaCuts(cols.size(), 0); // counter of tracks per found bc for occupancy studies + std::vector vAmpFT0CperColl(cols.size(), 0); // amplitude FT0C per collision + std::vector vTFids(cols.size(), 0); std::vector vIsFullInfoForOccupancy(cols.size(), 0); std::vector vIsMarkedCollForAnalysis(cols.size(), 0); // cut on the max bcId in the time frame @@ -430,6 +437,9 @@ struct DetectorOccupancyQaTask { vFoundBCindex[colIndex] = foundBC; vFoundGlobalBC[colIndex] = bc.globalBC(); + if (bc.has_foundFT0()) + vAmpFT0CperColl[colIndex] = bc.foundFT0().sumAmpC(); + vIsVertexTOFmatched[colIndex] = nTOFtracks > 0; vTracksITS567perColl[colIndex] += nITS567cls; @@ -574,6 +584,7 @@ struct DetectorOccupancyQaTask { if (thisColIndex != colIndex && fabs(thisColTimeDiff) < confTimeIntervalForSmallBins) { LOGP(debug, " iCol={}/{}, thisColIndex={}, colIndex={}, thisColTimeDiff={} nITS={}", iCol, vCollsAssocToGivenColl.size(), thisColIndex, colIndex, thisColTimeDiff, vTracksITS567perColl[thisColIndex]); histos.fill(HIST("thisEventITStracksInTimeBins"), thisColTimeDiff, vTracksITS567perColl[thisColIndex]); + histos.fill(HIST("thisEventFT0CInTimeBins"), thisColTimeDiff, vAmpFT0CperColl[thisColIndex]); // histos.fill(HIST("thisEventITSTPCtracksInTimeBins"), thisColTimeDiff, vTracksITSTPCperColl[thisColIndex]); } nCollInTimeWindow++; @@ -608,50 +619,60 @@ struct DetectorOccupancyQaTask { LOGP(debug, " --> ### summary: colIndex={}/{} BC={} orbit={} nCollInTimeWindow={} nCollInTimeWindowSel={} nITSTPCtracksInTimeWindow={} ", colIndex, cols.size(), foundGlobalBC, orbit - orbitAtCollIndexZero, nCollInTimeWindow, nCollInTimeWindowSel, nITSTPCtracksInTimeWindow); if (confAddBasicQAhistos) { - histos.get(HIST("hNumITS567tracksInTimeWindow"))->Fill(nITS567tracksInTimeWindow); - histos.get(HIST("hNumITSTPCtracksInTimeWindow"))->Fill(nITSTPCtracksInTimeWindow); + histos.fill(HIST("hNumITS567tracksInTimeWindow"), nITS567tracksInTimeWindow); + histos.fill(HIST("hNumITSTPCtracksInTimeWindow"), nITSTPCtracksInTimeWindow); - histos.get(HIST("hNumITSTPCtracksPerCollision"))->Fill(vTracksITSTPCperColl[colIndex]); - histos.get(HIST("hNumITS567tracksPerCollision"))->Fill(vTracksITS567perColl[colIndex]); + histos.fill(HIST("hNumITSTPCtracksPerCollision"), vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hNumITS567tracksPerCollision"), vTracksITS567perColl[colIndex]); - histos.get(HIST("hNumITSTPCtracksInTimeWindow_vs_TracksPerColl"))->Fill(vTracksITSTPCperColl[colIndex], nITSTPCtracksInTimeWindow); - histos.get(HIST("hNumITSTPCtracksInTimeWindow_vs_TracksPerColl_withoutThisCol"))->Fill(vTracksITSTPCperColl[colIndex], nITSTPCtracksInTimeWindow - vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hNumITSTPCtracksInTimeWindow_vs_TracksPerColl"), vTracksITSTPCperColl[colIndex], nITSTPCtracksInTimeWindow); + histos.fill(HIST("hNumITSTPCtracksInTimeWindow_vs_TracksPerColl_withoutThisCol"), vTracksITSTPCperColl[colIndex], nITSTPCtracksInTimeWindow - vTracksITSTPCperColl[colIndex]); - histos.get(HIST("hNumITS567tracksInTimeWindow_vs_TracksPerColl"))->Fill(vTracksITS567perColl[colIndex], nITS567tracksInTimeWindow); - histos.get(HIST("hNumITS567tracksInTimeWindow_vs_TracksPerColl_withoutThisCol"))->Fill(vTracksITS567perColl[colIndex], nITS567tracksInTimeWindow - vTracksITS567perColl[colIndex]); + histos.fill(HIST("hNumITS567tracksInTimeWindow_vs_TracksPerColl"), vTracksITS567perColl[colIndex], nITS567tracksInTimeWindow); + histos.fill(HIST("hNumITS567tracksInTimeWindow_vs_TracksPerColl_withoutThisCol"), vTracksITS567perColl[colIndex], nITS567tracksInTimeWindow - vTracksITS567perColl[colIndex]); - histos.get(HIST("hNumCollInTimeWindow"))->Fill(nCollInTimeWindow); + histos.fill(HIST("hNumCollInTimeWindow"), nCollInTimeWindow); int64_t bcInTF = (vFoundGlobalBC[colIndex] - bcSOR) % nBCsPerTF; int orbitId = bcInTF / o2::constants::lhc::LHCMaxBunches; histos.fill(HIST("hNumCollInTimeWindowVsOrbit"), orbitId, nCollInTimeWindow); - histos.get(HIST("hNumUniqueBCInTimeWindow"))->Fill(mUniqueBC.size()); + histos.fill(HIST("hNumUniqueBCInTimeWindow"), mUniqueBC.size()); + + // 3D before ev quality cut: + histos.fill(HIST("hNumITSTPC_vs_ITS567tracksThisCol_vs_ITS567tracksInTimeWindow_BEFORE_sel"), vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex], nITS567tracksInTimeWindow - vTracksITS567perColl[colIndex]); + histos.fill(HIST("hNumITSTPC_vs_ITS567tracksThisCol_vs_FT0CamplInTimeWindow_BEFORE_sel"), vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex], multFT0CInTimeWindow - multFT0CmainCollision); - if (sel) { - histos.get(HIST("hNumITS567tracksInTimeWindowSel"))->Fill(nITS567tracksInTimeWindowSel); - histos.get(HIST("hNumITSTPCtracksInTimeWindowSel"))->Fill(nITSTPCtracksInTimeWindowSel); + if (sel && fabs(col.posZ()) < 10) { + histos.fill(HIST("hNumITS567tracksInTimeWindowSel"), nITS567tracksInTimeWindowSel); + histos.fill(HIST("hNumITSTPCtracksInTimeWindowSel"), nITSTPCtracksInTimeWindowSel); - histos.get(HIST("hNumITS567tracksPerCollisionSel"))->Fill(vTracksITS567perColl[colIndex]); - histos.get(HIST("hNumITSTPCtracksPerCollisionSel"))->Fill(vTracksITSTPCperCollPtEtaCuts[colIndex]); + histos.fill(HIST("hNumITS567tracksPerCollisionSel"), vTracksITS567perColl[colIndex]); + histos.fill(HIST("hNumITSTPCtracksPerCollisionSel"), vTracksITSTPCperCollPtEtaCuts[colIndex]); - histos.get(HIST("hNumCollInTimeWindowSel"))->Fill(nCollInTimeWindowSel); - histos.get(HIST("hNumCollInTimeWindowSelITSTPC"))->Fill(nCollInTimeWindowSelITSTPC); - histos.get(HIST("hNumCollInTimeWindowSelIfTOF"))->Fill(nCollInTimeWindowSelIfTOF); + histos.fill(HIST("hNumCollInTimeWindowSel"), nCollInTimeWindowSel); + histos.fill(HIST("hNumCollInTimeWindowSelITSTPC"), nCollInTimeWindowSelITSTPC); + histos.fill(HIST("hNumCollInTimeWindowSelIfTOF"), nCollInTimeWindowSelIfTOF); + + // 3D histograms: ITS vs ITSTPC in this event vs occupancy from other events + histos.fill(HIST("hNumITSTPC_vs_ITS567tracksThisCol_vs_ITS567tracksInTimeWindow"), vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex], nITS567tracksInTimeWindow - vTracksITS567perColl[colIndex]); + histos.fill(HIST("hNumITSTPC_vs_ITS567tracksThisCol_vs_FT0CamplInTimeWindow"), vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex], multFT0CInTimeWindow - multFT0CmainCollision); + if (col.selection_bit(kNoCollInTimeRangeNarrow)) { + histos.fill(HIST("hNumITSTPC_vs_ITS567tracksThisCol_vs_FT0CamplInTimeWindow_kNoCollInTimeRangeNarrow"), vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex], multFT0CInTimeWindow - multFT0CmainCollision); + + histos.fill(HIST("hNumITSTPC_vs_FT0CthisCol_vs_FT0CamplInTimeWindow_kNoCollInTimeRangeNarrow"), multFT0CmainCollision, vTracksITSTPCperCollPtEtaCuts[colIndex], multFT0CInTimeWindow - multFT0CmainCollision); + histos.fill(HIST("hNumITS567_vs_FT0CthisCol_vs_FT0CamplInTimeWindow_kNoCollInTimeRangeNarrow"), multFT0CmainCollision, vTracksITS567perCollPtEtaCuts[colIndex], multFT0CInTimeWindow - multFT0CmainCollision); + } } // 2D histograms - histos.get(HIST("hNumITS567tracksInTimeWindow_vs_FT0Campl"))->Fill(multFT0CInTimeWindow, nITS567tracksInTimeWindow); - histos.get(HIST("hNumITSTPCtracksInTimeWindow_vs_FT0Campl"))->Fill(multFT0CInTimeWindow, nITSTPCtracksInTimeWindow); - histos.get(HIST("hNumITSTPCtracksInTimeWindow_vs_ITS567tracks"))->Fill(nITS567tracksInTimeWindow, nITSTPCtracksInTimeWindow); - - histos.get(HIST("hNumITS567tracks_vs_FT0Campl_ThisEvent"))->Fill(multFT0CmainCollision, vTracksITS567perCollPtEtaCuts[colIndex]); - histos.get(HIST("hNumITSTPCtracks_vs_FT0Campl_ThisEvent"))->Fill(multFT0CmainCollision, vTracksITSTPCperCollPtEtaCuts[colIndex]); - histos.get(HIST("hNumITSTPCtracks_vs_ITS567tracks_ThisEvent"))->Fill(vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex]); + histos.fill(HIST("hNumITS567tracksInTimeWindow_vs_FT0Campl"), multFT0CInTimeWindow, nITS567tracksInTimeWindow); + histos.fill(HIST("hNumITSTPCtracksInTimeWindow_vs_FT0Campl"), multFT0CInTimeWindow, nITSTPCtracksInTimeWindow); + histos.fill(HIST("hNumITSTPCtracksInTimeWindow_vs_ITS567tracks"), nITS567tracksInTimeWindow, nITSTPCtracksInTimeWindow); - // 3D histograms: ITS vs ITSTPC in this event vs occupancy from other events - histos.get(HIST("hNumITSTPC_vs_ITS567tracksThisCol_vs_FT0CamplInTimeWindow"))->Fill(vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex], multFT0CInTimeWindow - multFT0CmainCollision); - histos.get(HIST("hNumITSTPC_vs_ITS567tracksThisCol_vs_ITS567tracksInTimeWindow"))->Fill(vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex], nITS567tracksInTimeWindow - vTracksITS567perColl[colIndex]); + histos.fill(HIST("hNumITS567tracks_vs_FT0Campl_ThisEvent"), multFT0CmainCollision, vTracksITS567perCollPtEtaCuts[colIndex]); + histos.fill(HIST("hNumITSTPCtracks_vs_FT0Campl_ThisEvent"), multFT0CmainCollision, vTracksITSTPCperCollPtEtaCuts[colIndex]); + histos.fill(HIST("hNumITSTPCtracks_vs_ITS567tracks_ThisEvent"), vTracksITS567perCollPtEtaCuts[colIndex], vTracksITSTPCperCollPtEtaCuts[colIndex]); } // counters of occupancy in specified delta-time ranges, to monitor eta, phi, pt distributions later @@ -693,7 +714,29 @@ struct DetectorOccupancyQaTask { // int nITSTPCtInTimeBin = histos.get(HIST("thisEventITSTPCtracksInTimeBins"))->GetBinContent(iT + 1); float dt = histos.get(HIST("thisEventITStracksInTimeBins"))->GetBinCenter(iT + 1); - histos.get(HIST("occupancyInTimeBins"))->Fill(dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); + + int nFT0CInTimeBin = histos.get(HIST("thisEventFT0CInTimeBins"))->GetBinContent(iT + 1); + + histos.fill(HIST("occupancyInTimeBins_BEFORE_sel"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); + histos.fill(HIST("occupancyInTimeBins_occupByFT0_BEFORE_sel"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); + + if (sel && fabs(col.posZ()) < 10) { + histos.fill(HIST("occupancyInTimeBins"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); + histos.fill(HIST("occupancyInTimeBins_occupByFT0"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); + + if (col.selection_bit(kNoCollInTimeRangeNarrow)) { + histos.fill(HIST("occupancyInTimeBins_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); + histos.fill(HIST("occupancyInTimeBins_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); + histos.fill(HIST("occupancyInTimeBins_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); + + histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nITStrInTimeBin); + histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nFT0CInTimeBin); + if (col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow_NoCollInRofStrict"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nFT0CInTimeBin); + } + } + + // if (counterQAtimeOccupHistos < nCollisionsForTimeBinQA) histos.fill(HIST("histOccupInTimeBinsQA"), dt, counterQAtimeOccupHistos + 1, nITStrInTimeBin); @@ -712,6 +755,7 @@ struct DetectorOccupancyQaTask { // reset delta time hist for this event histos.get(HIST("thisEventITStracksInTimeBins"))->Reset(); // histos.get(HIST("thisEventITSTPCtracksInTimeBins"))->Reset(); + histos.get(HIST("thisEventFT0CInTimeBins"))->Reset(); counterQAtimeOccupHistos++; } // end of occupancy calculation @@ -966,6 +1010,15 @@ struct DetectorOccupancyQaTask { if (occupancy >= 0 && occupancy < 2000) { histos.fill(HIST("nTracksGlobal_vs_nPV_occup_0_2000"), nPV, nGlobalTracks); } + // ### now vs FT0C occupancy: + float occupByFT0C = col.ft0cOccupancyInTimeRange(); + if (occupByFT0C >= 0 && occupByFT0C < 2500) { + histos.fill(HIST("nTracksGlobal_vs_nPV_occupByFT0C_0_2500"), nPV, nGlobalTracks); + } + if (occupByFT0C >= 0 && occupByFT0C < 20000) { + histos.fill(HIST("nTracksGlobal_vs_nPV_occupByFT0C_0_20000"), nPV, nGlobalTracks); + } + // if (occupancy >= 0 && occupancy < 500 && col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { histos.fill(HIST("nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard"), multV0A, nPV); histos.fill(HIST("nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard"), multV0A, nGlobalTracks); diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index 9946e871840..f378cb2acd2 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -9,7 +9,15 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "map" +/// \file eventSelectionQa.cxx +/// \brief Event selection QA task +/// +/// \author Evgeny Kryshen + +#include +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -21,6 +29,10 @@ #include "CommonDataFormat/BunchFilling.h" #include "DataFormatsParameters/GRPLHCIFData.h" #include "DataFormatsParameters/GRPECSObject.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" +#include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h +#include "DataFormatsITSMFT/TimeDeadMap.h" +#include "ITSMFTReconstruction/ChipMappingITS.h" #include "TH1F.h" #include "TH2F.h" @@ -32,30 +44,27 @@ using BCsRun2 = soa::Join; using ColEvSels = soa::Join; using FullTracksIU = soa::Join; +using FullTracksIUwithLabels = soa::Join; struct EventSelectionQaTask { Configurable isMC{"isMC", 0, "0 - data, 1 - MC"}; - Configurable nGlobalBCs{"nGlobalBCs", 100000, "number of global bcs"}; - Configurable minOrbitConf{"minOrbit", 0, "minimum orbit"}; - Configurable nOrbitsConf{"nOrbits", 10000, "number of orbits"}; + Configurable nGlobalBCs{"nGlobalBCs", 100000, "number of global bcs for detailed monitoring"}; Configurable isLowFlux{"isLowFlux", 1, "1 - low flux (pp, pPb), 0 - high flux (PbPb)"}; - uint64_t minGlobalBC = 0; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - bool* applySelection = NULL; - int nBCsPerOrbit = 3564; - int lastRunNumber = -1; - int nOrbits = nOrbitsConf; - double minOrbit = minOrbitConf; - int64_t bcSOR = 0; // global bc of the start of the first orbit, setting 0 by default for unanchored MC - int64_t nBCsPerTF = 128 * nBCsPerOrbit; // duration of TF in bcs, should be 128*3564 or 32*3564, setting 128 orbits by default sfor unanchored MC - std::bitset beamPatternA; - std::bitset beamPatternC; - std::bitset bcPatternA; - std::bitset bcPatternC; - std::bitset bcPatternB; + static const int32_t nBCsPerOrbit = o2::constants::lhc::LHCMaxBunches; + int32_t lastRun = -1; + int64_t nOrbits = 1; // number of orbits, setting 1 for unanchored MC + int64_t orbitSOR = 0; // first orbit, setting 0 for unanchored MC + int64_t bcSOR = 0; // global bc of the start of the first orbit, setting 0 for unanchored MC + int32_t nOrbitsPerTF = 128; // 128 in 2022, 32 in 2023, setting 128 for unanchored MC + int64_t nBCsPerTF = nOrbitsPerTF * nBCsPerOrbit; // duration of TF in bcs + + std::bitset bcPatternA; + std::bitset bcPatternC; + std::bitset bcPatternB; SliceCache cache; Partition tracklets = (aod::track::trackType == static_cast(o2::aod::track::TrackTypeEnum::Run2Tracklet)); @@ -75,9 +84,6 @@ struct EventSelectionQaTask { void init(InitContext&) { - minGlobalBC = uint64_t(minOrbit) * nBCsPerOrbit; - - // ccdb->setURL("http://ccdb-test.cern.ch:8080"); ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -303,6 +309,11 @@ struct EventSelectionQaTask { histos.add("hVertexXMC", "", kTH1F, {axisVtxXY}); histos.add("hVertexYMC", "", kTH1F, {axisVtxXY}); histos.add("hVertexZMC", "", kTH1F, {axisVtxZ}); + histos.add("hNcontribColFromMC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAccFromMC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribMisFromMC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColFromData", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAccFromData", "", kTH1F, {axisNcontrib}); for (int i = 0; i < kNsel; i++) { histos.get(HIST("hSelCounter"))->GetXaxis()->SetBinLabel(i + 1, selectionLabels[i]); @@ -325,25 +336,28 @@ struct EventSelectionQaTask { aod::FDDs const&) { bool isINT1period = 0; - if (!applySelection) { - auto first_bc = bcs.iteratorAt(0); - EventSelectionParams* par = ccdb->getForTimeStamp("EventSelection/EventSelectionParams", first_bc.timestamp()); - applySelection = par->GetSelection(0); + + int run = bcs.iteratorAt(0).runNumber(); + if (run != lastRun) { + lastRun = run; + auto firstBC = bcs.iteratorAt(0); + EventSelectionParams* par = ccdb->getForTimeStamp("EventSelection/EventSelectionParams", firstBC.timestamp()); + bool* applySelection = par->GetSelection(0); for (int i = 0; i < kNsel; i++) { histos.get(HIST("hSelMask"))->SetBinContent(i + 1, applySelection[i]); } - isINT1period = first_bc.runNumber() <= 136377 || (first_bc.runNumber() >= 144871 && first_bc.runNumber() <= 159582); + isINT1period = run <= 136377 || (run >= 144871 && run <= 159582); } // bc-based event selection qa - for (auto& bc : bcs) { + for (const auto& bc : bcs) { for (int iAlias = 0; iAlias < kNaliases; iAlias++) { histos.fill(HIST("hBcCounterAll"), iAlias, bc.alias_bit(iAlias)); } } // collision-based event selection qa - for (auto& col : cols) { + for (const auto& col : cols) { bool sel1 = col.selection_bit(kIsINT1) && col.selection_bit(kNoBGV0A) && col.selection_bit(kNoBGV0C) && col.selection_bit(kNoTPCLaserWarmUp) && col.selection_bit(kNoTPCHVdip); for (int iAlias = 0; iAlias < kNaliases; iAlias++) { @@ -367,26 +381,26 @@ struct EventSelectionQaTask { histos.fill(HIST("hSelCounter"), i, col.selection_bit(i)); } - auto bc = col.bc_as(); + const auto& bc = col.bc_as(); uint64_t globalBC = bc.globalBC(); // uint64_t orbit = globalBC / nBCsPerOrbit; int localBC = globalBC % nBCsPerOrbit; - histos.fill(HIST("hGlobalBcAll"), globalBC - minGlobalBC); - // histos.fill(HIST("hOrbitAll"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcAll"), globalBC - bcSOR); + // histos.fill(HIST("hOrbitAll"), orbit - orbitSOR); histos.fill(HIST("hBcAll"), localBC); if (col.selection_bit(kIsBBV0A) || col.selection_bit(kIsBBV0C)) { - histos.fill(HIST("hGlobalBcFV0"), globalBC - minGlobalBC); - // histos.fill(HIST("hOrbitFV0"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcFV0"), globalBC - bcSOR); + // histos.fill(HIST("hOrbitFV0"), orbit - orbitSOR); histos.fill(HIST("hBcFV0"), localBC); } if (col.selection_bit(kIsBBT0A) || col.selection_bit(kIsBBT0C)) { - histos.fill(HIST("hGlobalBcFT0"), globalBC - minGlobalBC); - // histos.fill(HIST("hOrbitFT0"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcFT0"), globalBC - bcSOR); + // histos.fill(HIST("hOrbitFT0"), orbit - orbitSOR); histos.fill(HIST("hBcFT0"), localBC); } if (col.selection_bit(kIsBBFDA) || col.selection_bit(kIsBBFDC)) { - histos.fill(HIST("hGlobalBcFDD"), globalBC - minGlobalBC); - // histos.fill(HIST("hOrbitFDD"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcFDD"), globalBC - bcSOR); + // histos.fill(HIST("hOrbitFDD"), orbit - orbitSOR); histos.fill(HIST("hBcFDD"), localBC); } @@ -439,10 +453,11 @@ struct EventSelectionQaTask { float multT0C = bc.has_ft0() ? bc.ft0().sumAmpC() : -999.f; if (bc.has_fdd()) { - for (auto amplitude : bc.fdd().chargeA()) { + auto fdd = bc.fdd(); + for (const auto& amplitude : fdd.chargeA()) { multFDA += amplitude; } - for (auto amplitude : bc.fdd().chargeC()) { + for (const auto& amplitude : fdd.chargeC()) { multFDC += amplitude; } } @@ -523,65 +538,123 @@ struct EventSelectionQaTask { aod::FT0s const&, aod::FDDs const&) { - int runNumber = bcs.iteratorAt(0).runNumber(); - uint32_t nOrbitsPerTF = 128; // 128 in 2022, 32 in 2023 - if (runNumber != lastRunNumber) { - lastRunNumber = runNumber; // do it only once - int64_t tsSOR = 0; - int64_t tsEOR = 1; - - if (runNumber >= 500000) { // access CCDB for data or anchored MC only - int64_t ts = bcs.iteratorAt(0).timestamp(); - - // access colliding and beam-gas bc patterns - auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", ts); - beamPatternA = grplhcif->getBunchFilling().getBeamPattern(0); - beamPatternC = grplhcif->getBunchFilling().getBeamPattern(1); + int run = bcs.iteratorAt(0).runNumber(); + + if (run != lastRun) { + lastRun = run; + int64_t tsSOR = 0; // dummy start-of-run timestamp for unanchored MC + int64_t tsEOR = 1; // dummy end-of-run timestamp for unanchored MC + if (run >= 500000) { + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); + // first bc of the first orbit + bcSOR = runInfo.orbitSOR * nBCsPerOrbit; + // duration of TF in bcs + nBCsPerTF = runInfo.orbitsPerTF * nBCsPerOrbit; + // number of orbits per TF + nOrbitsPerTF = runInfo.orbitsPerTF; + // first orbit + orbitSOR = runInfo.orbitSOR; + // total number of orbits + nOrbits = runInfo.orbitEOR - runInfo.orbitSOR; + // start-of-run timestamp + tsSOR = runInfo.sor; + // end-of-run timestamp + tsEOR = runInfo.eor; + + // bc patterns + auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", (tsSOR + tsEOR) / 2); + auto beamPatternA = grplhcif->getBunchFilling().getBeamPattern(0); + auto beamPatternC = grplhcif->getBunchFilling().getBeamPattern(1); bcPatternA = beamPatternA & ~beamPatternC; bcPatternC = ~beamPatternA & beamPatternC; bcPatternB = beamPatternA & beamPatternC; + // fill once for (int i = 0; i < nBCsPerOrbit; i++) { - if (bcPatternA[i]) { - histos.fill(HIST("hBcA"), i); - } - if (bcPatternC[i]) { - histos.fill(HIST("hBcC"), i); + histos.fill(HIST("hBcA"), i, bcPatternA[i] ? 1. : 0.); + histos.fill(HIST("hBcB"), i, bcPatternB[i] ? 1. : 0.); + histos.fill(HIST("hBcC"), i, bcPatternC[i] ? 1. : 0.); + } + + // fill ITS dead maps + std::map metadata; + metadata["runNumber"] = Form("%d", run); + o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getSpecific("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2, metadata); + + auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits + std::vector itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end()); + const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble}; + + for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) { + int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l); + double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l); + // int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l); + // double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l); + histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}}); + histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits}); + } + + std::vector vClosest; + std::bitset alwaysDeadChips; + std::bitset deadChips; + alwaysDeadChips.set(); + for (const auto& orbit : itsDeadMapOrbits) { + itsDeadMap->getMapAtOrbit(orbit, vClosest); + deadChips.reset(); + for (size_t iel = 0; iel < vClosest.size(); iel++) { + uint16_t w1 = vClosest[iel]; + bool isLastInSequence = (w1 & 0x8000) == 0; + uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; + uint16_t chipId1 = w1 & 0x7FFF; + uint16_t chipId2 = w2 & 0x7FFF; + // dead chips are stored as ranges + // vClosest contains first and last chip ids in the range + // last chip id in the range is marked with 0x8000 bit set to 1 + for (int chipId = chipId1; chipId < chipId2; chipId++) { + histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1); + deadChips.set(chipId); + } } - if (bcPatternB[i]) { - histos.fill(HIST("hBcB"), i); + alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0 + } + // std::cout << alwaysDeadChips << std::endl; + + // filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive) + for (const auto& orbit : itsDeadMapOrbits) { + itsDeadMap->getMapAtOrbit(orbit, vClosest); + std::vector nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0); + for (size_t iel = 0; iel < vClosest.size(); iel++) { + uint16_t w1 = vClosest[iel]; + bool isLastInSequence = (w1 & 0x8000) == 0; + uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; + uint16_t chipId1 = w1 & 0x7FFF; + uint16_t chipId2 = w2 & 0x7FFF; + for (int chipId = chipId1; chipId < chipId2; chipId++) { + if (alwaysDeadChips[chipId]) // skip always inactive chips + continue; + int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId); + nInactiveChips[layer]++; + } } + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]); } - EventSelectionParams* par = ccdb->getForTimeStamp("EventSelection/EventSelectionParams", ts); - // access orbit-reset timestamp - auto ctpx = ccdb->getForTimeStamp>("CTP/Calib/OrbitReset", ts); - int64_t tsOrbitReset = (*ctpx)[0]; // us - // access TF duration, start-of-run and end-of-run timestamps from ECS GRP - std::map metadata; - metadata["runNumber"] = Form("%d", runNumber); - auto grpecs = ccdb->getSpecific("GLO/Config/GRPECS", ts, metadata); - nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF; nOrbitsPerTF=128 in 2022, 32 in 2023 - tsSOR = grpecs->getTimeStart(); // ms - tsEOR = grpecs->getTimeEnd(); // ms - // calculate SOR and EOR orbits - int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; - int64_t orbitEOR = (tsEOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; - // adjust to the nearest TF edge - orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; - orbitEOR = orbitEOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; - // set nOrbits and minOrbit used for orbit-axis binning - nOrbits = orbitEOR - orbitSOR; - minOrbit = orbitSOR; - // first bc of the first orbit (should coincide with TF start) - bcSOR = orbitSOR * o2::constants::lhc::LHCMaxBunches; - // duration of TF in bcs - nBCsPerTF = nOrbitsPerTF * o2::constants::lhc::LHCMaxBunches; - LOGP(info, "tsOrbitReset={} us, SOR = {} ms, EOR = {} ms, orbitSOR = {}, nBCsPerTF = {}", tsOrbitReset, tsSOR, tsEOR, orbitSOR, nBCsPerTF); - } + } // run >= 500000 // create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available - // otherwise default minOrbit and nOrbits will be used + // otherwise default orbitSOR and nOrbits will be used const AxisSpec axisOrbits{static_cast(nOrbits / nOrbitsPerTF), 0., static_cast(nOrbits), ""}; histos.add("hOrbitAll", "", kTH1F, {axisOrbits}); histos.add("hOrbitCol", "", kTH1F, {axisOrbits}); @@ -623,12 +696,12 @@ struct EventSelectionQaTask { break; } deltaIndex++; - const auto& bc_past = bcs.iteratorAt(bc.globalIndex() - deltaIndex); - deltaBC = globalBC - bc_past.globalBC(); + const auto& bcPast = bcs.iteratorAt(bc.globalIndex() - deltaIndex); + deltaBC = globalBC - bcPast.globalBC(); if (deltaBC < maxDeltaBC) { - pastActivityFT0 |= bc_past.has_ft0(); - pastActivityFV0 |= bc_past.has_fv0a(); - pastActivityFDD |= bc_past.has_fdd(); + pastActivityFT0 |= bcPast.has_ft0(); + pastActivityFV0 |= bcPast.has_fv0a(); + pastActivityFDD |= bcPast.has_fdd(); } } @@ -665,7 +738,7 @@ struct EventSelectionQaTask { std::vector vGlobalBCs(nBCs, 0); // bc-based event selection qa - for (auto& bc : bcs) { + for (const auto& bc : bcs) { if (!bc.has_ft0()) continue; float multT0A = bc.ft0().sumAmpA(); @@ -684,7 +757,7 @@ struct EventSelectionQaTask { } // bc-based event selection qa - for (auto& bc : bcs) { + for (const auto& bc : bcs) { for (int iAlias = 0; iAlias < kNaliases; iAlias++) { histos.fill(HIST("hBcCounterAll"), iAlias, bc.alias_bit(iAlias)); } @@ -715,22 +788,22 @@ struct EventSelectionQaTask { histos.fill(HIST("hTimeFDCref"), timeFDC); } - histos.fill(HIST("hGlobalBcAll"), globalBC - minGlobalBC); - histos.fill(HIST("hOrbitAll"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcAll"), globalBC - bcSOR); + histos.fill(HIST("hOrbitAll"), orbit - orbitSOR); histos.fill(HIST("hBcAll"), localBC); if (bc.selection_bit(kIsTriggerTVX)) { - histos.fill(HIST("hOrbitTVX"), orbit - minOrbit); + histos.fill(HIST("hOrbitTVX"), orbit - orbitSOR); histos.fill(HIST("hBcTVX"), localBC); } // FV0 if (bc.has_fv0a()) { - histos.fill(HIST("hGlobalBcFV0"), globalBC - minGlobalBC); - histos.fill(HIST("hOrbitFV0"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcFV0"), globalBC - bcSOR); + histos.fill(HIST("hOrbitFV0"), orbit - orbitSOR); histos.fill(HIST("hBcFV0"), localBC); float multV0A = 0; - for (auto amplitude : bc.fv0a().amplitude()) { + for (const auto& amplitude : bc.fv0a().amplitude()) { multV0A += amplitude; } histos.fill(HIST("hMultV0Aall"), multV0A); @@ -741,8 +814,8 @@ struct EventSelectionQaTask { // FT0 if (bc.has_ft0()) { - histos.fill(HIST("hGlobalBcFT0"), globalBC - minGlobalBC); - histos.fill(HIST("hOrbitFT0"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcFT0"), globalBC - bcSOR); + histos.fill(HIST("hOrbitFT0"), orbit - orbitSOR); histos.fill(HIST("hBcFT0"), localBC); float multT0A = bc.ft0().sumAmpA(); float multT0C = bc.ft0().sumAmpC(); @@ -768,15 +841,17 @@ struct EventSelectionQaTask { // FDD if (bc.has_fdd()) { - histos.fill(HIST("hGlobalBcFDD"), globalBC - minGlobalBC); - histos.fill(HIST("hOrbitFDD"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcFDD"), globalBC - bcSOR); + histos.fill(HIST("hOrbitFDD"), orbit - orbitSOR); histos.fill(HIST("hBcFDD"), localBC); + + auto fdd = bc.fdd(); float multFDA = 0; - for (auto amplitude : bc.fdd().chargeA()) { + for (const auto& amplitude : fdd.chargeA()) { multFDA += amplitude; } float multFDC = 0; - for (auto amplitude : bc.fdd().chargeC()) { + for (const auto& amplitude : fdd.chargeC()) { multFDC += amplitude; } histos.fill(HIST("hMultFDAall"), multFDA); @@ -789,8 +864,8 @@ struct EventSelectionQaTask { // ZDC if (bc.has_zdc()) { - histos.fill(HIST("hGlobalBcZDC"), globalBC - minGlobalBC); - histos.fill(HIST("hOrbitZDC"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcZDC"), globalBC - bcSOR); + histos.fill(HIST("hOrbitZDC"), orbit - orbitSOR); histos.fill(HIST("hBcZDC"), localBC); float multZNA = bc.zdc().energyCommonZNA(); float multZNC = bc.zdc().energyCommonZNC(); @@ -810,7 +885,7 @@ struct EventSelectionQaTask { // map for pileup checks std::vector vCollisionsPerBc(bcs.size(), 0); - for (auto& col : cols) { + for (const auto& col : cols) { if (col.foundBCId() < 0 || col.foundBCId() >= bcs.size()) continue; vCollisionsPerBc[col.foundBCId()]++; @@ -826,10 +901,10 @@ struct EventSelectionQaTask { // to be used for closest TVX (FT0-OR) searches std::map mapGlobalBcWithTVX; std::map mapGlobalBcWithTOR; - for (auto& bc : bcs) { + for (const auto& bc : bcs) { int64_t globalBC = bc.globalBC(); // skip non-colliding bcs for data and anchored runs - if (runNumber >= 500000 && bcPatternB[globalBC % o2::constants::lhc::LHCMaxBunches] == 0) { + if (run >= 500000 && bcPatternB[globalBC % nBCsPerOrbit] == 0) { continue; } if (bc.selection_bit(kIsBBT0A) || bc.selection_bit(kIsBBT0C)) { @@ -859,7 +934,7 @@ struct EventSelectionQaTask { } // collision-based event selection qa - for (auto& col : cols) { + for (const auto& col : cols) { for (int iAlias = 0; iAlias < kNaliases; iAlias++) { if (!col.alias_bit(iAlias)) { continue; @@ -879,11 +954,11 @@ struct EventSelectionQaTask { uint64_t globalBC = bc.globalBC(); uint64_t orbit = globalBC / nBCsPerOrbit; int localBC = globalBC % nBCsPerOrbit; - histos.fill(HIST("hGlobalBcCol"), globalBC - minGlobalBC); - histos.fill(HIST("hOrbitCol"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcCol"), globalBC - bcSOR); + histos.fill(HIST("hOrbitCol"), orbit - orbitSOR); histos.fill(HIST("hBcCol"), localBC); if (col.sel8()) { - histos.fill(HIST("hOrbitAcc"), orbit - minOrbit); + histos.fill(HIST("hOrbitAcc"), orbit - orbitSOR); } // search for nearest ft0a&ft0c entry @@ -893,11 +968,11 @@ struct EventSelectionQaTask { // count tracks of different types auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex()); int nContributorsAfterEtaTPCCuts = 0; - for (auto& track : tracksGrouped) { + for (const auto& track : tracksGrouped) { int trackBcDiff = bcDiff + track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS; if (!track.isPVContributor()) continue; - if (fabs(track.eta()) < 0.8 && track.tpcNClsFound() > 80 && track.tpcNClsCrossedRows() > 100) + if (std::fabs(track.eta()) < 0.8 && track.tpcNClsFound() > 80 && track.tpcNClsCrossedRows() > 100) nContributorsAfterEtaTPCCuts++; if (!track.hasTPC()) histos.fill(HIST("hITStrackBcDiff"), trackBcDiff); @@ -974,7 +1049,7 @@ struct EventSelectionQaTask { // FV0 float multV0A = 0; if (foundBC.has_fv0a()) { - for (auto amplitude : foundBC.fv0a().amplitude()) { + for (const auto& amplitude : foundBC.fv0a().amplitude()) { multV0A += amplitude; } } @@ -982,10 +1057,11 @@ struct EventSelectionQaTask { float multFDA = 0; float multFDC = 0; if (foundBC.has_fdd()) { - for (auto amplitude : foundBC.fdd().chargeA()) { + auto fdd = foundBC.fdd(); + for (const auto& amplitude : fdd.chargeA()) { multFDA += amplitude; } - for (auto amplitude : foundBC.fdd().chargeC()) { + for (const auto& amplitude : fdd.chargeC()) { multFDC += amplitude; } } @@ -1073,19 +1149,33 @@ struct EventSelectionQaTask { histos.fill(HIST("hNcontribAcc"), nContributors); } // collisions + + // TVX efficiency after TF and ITS ROF border cuts + for (const auto& col : cols) { + if (!col.selection_bit(kNoTimeFrameBorder) || !col.selection_bit(kNoITSROFrameBorder)) + continue; + + uint32_t nContrib = col.numContrib(); + histos.fill(HIST("hNcontribColFromData"), nContrib); + if (!col.selection_bit(kIsTriggerTVX)) + continue; + + histos.fill(HIST("hNcontribAccFromData"), nContrib); + } } PROCESS_SWITCH(EventSelectionQaTask, processRun3, "Process Run3 event selection QA", false); - void processMCRun3(aod::McCollisions const& mcCols, soa::Join const& cols, BCsRun3 const&, aod::FT0s const&) + Partition pvTracks = ((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)); + void processMCRun3(aod::McCollisions const& mcCols, soa::Join const& cols, FullTracksIUwithLabels const&, BCsRun3 const&, aod::FT0s const&, aod::McParticles const& mcParts) { - for (auto& mcCol : mcCols) { + for (const auto& mcCol : mcCols) { auto bc = mcCol.bc_as(); uint64_t globalBC = bc.globalBC(); uint64_t orbit = globalBC / nBCsPerOrbit; int localBC = globalBC % nBCsPerOrbit; int64_t bcInTF = (globalBC - bcSOR) % nBCsPerTF; - histos.fill(HIST("hGlobalBcColMC"), globalBC - minGlobalBC); - histos.fill(HIST("hOrbitColMC"), orbit - minOrbit); + histos.fill(HIST("hGlobalBcColMC"), globalBC - bcSOR); + histos.fill(HIST("hOrbitColMC"), orbit - orbitSOR); histos.fill(HIST("hBcColMC"), localBC); histos.fill(HIST("hVertexXMC"), mcCol.posX()); histos.fill(HIST("hVertexYMC"), mcCol.posY()); @@ -1093,19 +1183,40 @@ struct EventSelectionQaTask { histos.fill(HIST("hNcolMCVsBcInTF"), bcInTF); } - // check fraction of collisions matched to wrong bcs - for (auto& col : cols) { - if (!col.has_mcCollision()) { - continue; + for (const auto& col : cols) { + int32_t mcColIdFromCollision = col.mcCollisionId(); + // check if collision is built from tracks originating from different MC collisions + bool isCollisionAmbiguous = 0; + const auto& colPvTracks = pvTracks.sliceByCached(aod::track::collisionId, col.globalIndex(), cache); + for (const auto& track : colPvTracks) { + int32_t mcPartId = track.mcParticleId(); + int32_t mcColId = mcPartId >= 0 ? mcParts.iteratorAt(mcPartId).mcCollisionId() : -1; + if (mcColId < 0 || mcColIdFromCollision != mcColId) { + isCollisionAmbiguous = 1; + break; + } } - uint64_t mcBC = col.mcCollision().bc_as().globalBC(); - uint64_t rcBC = col.foundBC_as().globalBC(); + + // skip ambiguous collisions + if (isCollisionAmbiguous) + continue; + + // skip collisions at the borders of TF and ITS ROF + if (!col.selection_bit(kNoTimeFrameBorder) || !col.selection_bit(kNoITSROFrameBorder)) + continue; + + uint32_t nContrib = col.numContrib(); + histos.fill(HIST("hNcontribColFromMC"), nContrib); + if (!col.selection_bit(kIsTriggerTVX)) + continue; + + histos.fill(HIST("hNcontribAccFromMC"), nContrib); + + int64_t rcBC = col.foundBC_as().globalBC(); + int64_t mcBC = col.mcCollision().bc_as().globalBC(); + if (mcBC != rcBC) { - histos.fill(HIST("hNcontribMis"), col.numContrib()); - if (col.collisionTimeRes() < 12) { - // ~ wrong bcs for collisions with T0F-matched tracks - histos.fill(HIST("hNcontribMisTOF"), col.numContrib()); - } + histos.fill(HIST("hNcontribMisFromMC"), nContrib); } } } diff --git a/DPG/Tasks/AOTEvent/rofOccupancyQa.cxx b/DPG/Tasks/AOTEvent/rofOccupancyQa.cxx index d89059361e8..76bf7e87741 100644 --- a/DPG/Tasks/AOTEvent/rofOccupancyQa.cxx +++ b/DPG/Tasks/AOTEvent/rofOccupancyQa.cxx @@ -8,6 +8,7 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include #include "Framework/ConfigParamSpec.h" #include "Framework/runDataProcessing.h" @@ -15,40 +16,22 @@ #include "Framework/AnalysisDataModel.h" #include "Common/DataModel/EventSelection.h" #include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/TriggerAliases.h" #include "CCDB/BasicCCDBManager.h" #include "CommonConstants/LHCConstants.h" #include "Framework/HistogramRegistry.h" -#include "DataFormatsFT0/Digit.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "DataFormatsParameters/GRPECSObject.h" +// #include "DataFormatsParameters/GRPLHCIFData.h" #include "ITSMFTBase/DPLAlpideParam.h" -#include "MetadataHelper.h" #include "DataFormatsParameters/AggregatedRunInfo.h" -#include "TH1D.h" - using namespace o2; using namespace o2::framework; using namespace o2::aod::evsel; -MetadataHelper metadataInfo; // Metadata helper - -using BCsWithRun2InfosTimestampsAndMatches = soa::Join; -using BCsWithRun3Matchings = soa::Join; -using BCsWithBcSelsRun2 = soa::Join; using BCsWithBcSelsRun3 = soa::Join; using FullTracksIU = soa::Join; const double bcNS = o2::constants::lhc::LHCBunchSpacingNS; struct RofOccupancyQaTask { - SliceCache cache; - // Produces evsel; - Configurable muonSelection{"muonSelection", 0, "0 - barrel, 1 - muon selection with pileup cuts, 2 - muon selection without pileup cuts"}; - Configurable maxDiffZvtxFT0vsPV{"maxDiffZvtxFT0vsPV", 1., "maximum difference (in cm) between z-vertex from FT0 and PV"}; - Configurable isMC{"isMC", 0, "-1 - autoset, 0 - data, 1 - MC"}; - Configurable confSigmaBCforHighPtTracks{"confSigmaBCforHighPtTracks", 4, "Custom sigma (in bcs) for collisions with high-pt tracks"}; - // configurables for occupancy-based event selection Configurable confTimeIntervalForOccupancyCalculationMin{"TimeIntervalForOccupancyCalculationMin", -40, "Min time diff window for TPC occupancy calculation, us"}; Configurable confTimeIntervalForOccupancyCalculationMax{"TimeIntervalForOccupancyCalculationMax", 100, "Max time diff window for TPC occupancy calculation, us"}; @@ -63,98 +46,31 @@ struct RofOccupancyQaTask { Configurable confFactorForHistRange{"kFactorForHistRange", 1.0, "To change axes b/n pp and Pb-Pb"}; - Partition tracklets = (aod::track::trackType == static_cast(o2::aod::track::TrackTypeEnum::Run2Tracklet)); - Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - int lastRun = -1; // last run number (needed to access ccdb only if run!=lastRun) - std::bitset bcPatternB; // bc pattern of colliding bunches + int lastRun = -1; // last run number (needed to access ccdb only if run!=lastRun) + // std::bitset bcPatternB; // bc pattern of colliding bunches int64_t bcSOR = -1; // global bc of the start of the first orbit int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564 int rofOffset = -1; // ITS ROF offset, in bc int rofLength = -1; // ITS ROF length, in bc - int32_t findClosest(int64_t globalBC, std::map& bcs) - { - auto it = bcs.lower_bound(globalBC); - int64_t bc1 = it->first; - int32_t index1 = it->second; - if (it != bcs.begin()) - --it; - int64_t bc2 = it->first; - int32_t index2 = it->second; - int64_t dbc1 = std::abs(bc1 - globalBC); - int64_t dbc2 = std::abs(bc2 - globalBC); - return (dbc1 <= dbc2) ? index1 : index2; - } - - // helper function to find median time in the vector of TOF or TRD-track times - float getMedian(std::vector v) - { - int medianIndex = v.size() / 2; - std::nth_element(v.begin(), v.begin() + medianIndex, v.end()); - return v[medianIndex]; - } - - // helper function to find closest TVX signal in time and in zVtx - int64_t findBestGlobalBC(int64_t meanBC, int64_t sigmaBC, int32_t nContrib, float zVtxCol, std::map& mapGlobalBcVtxZ) - { - int64_t minBC = meanBC - 3 * sigmaBC; - int64_t maxBC = meanBC + 3 * sigmaBC; - // TODO: use ITS ROF bounds to reduce the search range? - - float zVtxSigma = 2.7 * pow(nContrib, -0.466) + 0.024; - zVtxSigma += 1.0; // additional uncertainty due to imperfectections of FT0 time calibration - - auto itMin = mapGlobalBcVtxZ.lower_bound(minBC); - auto itMax = mapGlobalBcVtxZ.upper_bound(maxBC); - - float bestChi2 = 1e+10; - int64_t bestGlobalBC = 0; - for (std::map::iterator it = itMin; it != itMax; ++it) { - float chi2 = pow((it->second - zVtxCol) / zVtxSigma, 2) + pow((it->first - meanBC) / sigmaBC, 2.); - if (chi2 < bestChi2) { - bestChi2 = chi2; - bestGlobalBC = it->first; - } - } - - return bestGlobalBC; - } - void init(InitContext&) { - if (metadataInfo.isFullyDefined()) { // Check if the metadata is initialized (only if not forced from the workflow configuration) - // if (!doprocessRun2 && !doprocessRun3) { - // if (!doprocessRun3) { - LOG(info) << "Autosetting the processing mode (Run2 or Run3) based on metadata"; - if (metadataInfo.isRun3()) { - doprocessRun3.value = true; - } else { - // doprocessRun2.value = false; - } - // } - if (isMC == -1) { - LOG(info) << "Autosetting the MC mode based on metadata"; - if (metadataInfo.isMC()) { - isMC.value = 1; - } else { - isMC.value = 0; - } - } - } - ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - histos.add("hColCounterAll", "", kTH1D, {{1, 0., 1.}}); - histos.add("hColCounterTVX", "", kTH1D, {{1, 0., 1.}}); - histos.add("hColCounterAcc", "", kTH1D, {{1, 0., 1.}}); - float k = confFactorForHistRange; + histos.add("hDeltaTime", "", kTH1D, {{1500, -50, 100}}); + histos.add("hDeltaTimeAboveNtracksCut", "", kTH1D, {{1500, -50, 100}}); + histos.add("hDeltaTime_vZ10cm", "", kTH1D, {{1500, -50, 100}}); + histos.add("hDeltaTime_sel8", "", kTH1D, {{1500, -50, 100}}); + histos.add("hDeltaTime_sel8_vZ10cm", "", kTH1D, {{1500, -50, 100}}); + histos.add("hDeltaTimeAboveNtracksCut_sel8_vZ10cm", "", kTH1D, {{1500, -50, 100}}); + histos.add("hOccupancyWeights", "", kTH1D, {{150, -50, 100}}); histos.add("hOccupancyByTracks", "", kTH1D, {{250, 0., 25000 * k}}); histos.add("hOccupancyByFT0C", "", kTH1D, {{250, 0., 2.5e5 * k}}); @@ -170,51 +86,51 @@ struct RofOccupancyQaTask { histos.add("hOccupancyByFT0C_CROSSCHECK", "", kTH1D, {{250, 0., 2.5e5 * k}}); // this ev nITStr vs FT0C - histos.add("hThisEvITSTr_vs_ThisEvFT0C", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_vZ_TF_ROF_border_cuts", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_afterNarrowDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_afterStrictDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_afterStandardDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_afterVzDependentDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/all", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/vZ_TF_ROF_border_cuts", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/afterNarrowDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/afterStrictDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/afterStandardDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/afterVzDependentDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_kNoCollInRofStrict", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_kNoCollInRofStandard", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_kNoCollInRofWithCloseVz", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofStrict", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofStandard", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofWithCloseVz", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_NarrowDeltaCut_StdTimeAndRofCuts", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/NarrowDeltaCut_StdTimeAndRofCuts", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_occupBelow2000", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvFT0C_occupBelow2000", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_NarrowDeltaCut_StdTimeAndRofCuts_occupBelow2000", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvFT0C_NarrowDeltaCut_StdTimeAndRofCuts_occupBelow2000", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/occupBelow2000", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/hThisEvITSTPCTr_vs_ThisEvFT0C_occupBelow2000", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/NarrowDeltaCut_StdTimeAndRofCuts_occupBelow2000", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/hThisEvITSTPCTr_vs_ThisEvFT0C_NarrowDeltaCut_StdTimeAndRofCuts_occupBelow2000", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); // CROSS-CHECK SEL BITS: - histos.add("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_afterNarrowDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_afterStrictDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_afterStandardDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_afterVzDependentDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_afterNarrowDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_afterStrictDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_afterStandardDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_afterVzDependentDeltaTimeCut", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_kNoCollInRofStrict", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - histos.add("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_kNoCollInRofStandard", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); - // histos.add("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_kNoCollInRofWithCloseVz", "", kTH2D, {{250, 0., 1e5*k}, {250, 0., 10000*k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_kNoCollInRofStrict", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + histos.add("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_kNoCollInRofStandard", "", kTH2D, {{250, 0., 1e5 * k}, {250, 0., 10000 * k}}); + // histos.add("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_kNoCollInRofWithCloseVz", "", kTH2D, {{250, 0., 1e5*k}, {250, 0., 10000*k}}); // this ev nITSTPCtr vs nITStr - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_vZ_TF_ROF_border_cuts", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_afterNarrowDeltaTimeCut", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_afterStrictDeltaTimeCut", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_afterStandardDeltaTimeCut", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_afterVzDependentDeltaTimeCut", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/all", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/vZ_TF_ROF_border_cuts", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/afterNarrowDeltaTimeCut", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/afterStrictDeltaTimeCut", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/afterStandardDeltaTimeCut", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/afterVzDependentDeltaTimeCut", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_kNoCollInRofStrict", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_kNoCollInRofStandard", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_kNoCollInRofWithCloseVz", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofStrict", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofStandard", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofWithCloseVz", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_NarrowDeltaCut_StdTimeAndRofCuts", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/NarrowDeltaCut_StdTimeAndRofCuts", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_occupBelow2000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_occupBelow2000_NarrowDeltaCut_StdTimeAndRofCuts", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); - histos.add("hThisEvITSTPCTr_vs_ThisEvITStr_occupBelow2000_StrictDeltaTimeCutAndRofCuts", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/occupBelow2000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/occupBelow2000_NarrowDeltaCut_StdTimeAndRofCuts", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); + histos.add("hThisEvITSTPCTr_vs_ThisEvITStr/occupBelow2000_StrictDeltaTimeCutAndRofCuts", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 5000 * k}}); histos.add("hThisEvITStr_vs_vZcut", "", kTH2D, {{200, 0., 10.}, {200, 0., 8000 * k}}); histos.add("hThisEvITSTPCtr_vs_vZcut", "", kTH2D, {{200, 0., 10.}, {200, 0., 5000 * k}}); @@ -222,6 +138,7 @@ struct RofOccupancyQaTask { histos.add("hThisEvITStr_vs_vZ", "", kTH2D, {{400, -20, 20.}, {200, 0., 8000 * k}}); histos.add("hThisEvITSTPCtr_vs_vZ", "", kTH2D, {{400, -20, 20.}, {200, 0., 5000 * k}}); + histos.add("hVz", "", kTH1D, {{1600, -40, 40.}}); histos.add("hDeltaVz", "", kTH1D, {{1600, -40, 40.}}); histos.add("hDeltaVzAfterCuts", "", kTH1D, {{1600, -40, 40.}}); histos.add("hDeltaVzAfterTFandROFborderCuts", "", kTH1D, {{1600, -40, 40.}}); @@ -240,6 +157,9 @@ struct RofOccupancyQaTask { histos.add("hEtaVzMinus10", "", kTH1D, {{500, -2.5, 2.5}}); histos.add("hEtaVzPlus15", "", kTH1D, {{500, -2.5, 2.5}}); histos.add("hEtaVzMinus15", "", kTH1D, {{500, -2.5, 2.5}}); + histos.add("hEtaVsVz", "", kTH2D, {{250, -25, 25}, {250, -2.5, 2.5}}); + histos.add("hNPVcontribVsVz", "", kTH2D, {{250, -25, 25}, {500, 0., 8000}}); + histos.add("hNPVcontribVsVz_eta08", "", kTH2D, {{250, -25, 25}, {500, 0., 8000}}); // histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); @@ -316,6 +236,8 @@ struct RofOccupancyQaTask { histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPrevPrevROF_1collPerROF", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + // coll on x axis always has more tracks: histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); @@ -323,6 +245,26 @@ struct RofOccupancyQaTask { histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + // 2,3,4 colls in ROF + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_noVzCutOnOtherVertices", "", kTH2D, {{500, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_3coll_noVzCutOnOtherVertices", "", kTH2D, {{500, 0., 20000 * k}, {250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_4coll_noVzCutOnOtherVertices", "", kTH2D, {{500, 0., 20000 * k}, {250, 0., 8000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_1coll_in_ROF", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_2coll_in_ROF", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_3coll_in_ROF", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_4coll_in_ROF", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_5collOrMore_in_ROF", "", kTH1D, {{250, 0., 8000 * k}}); + + // 1D + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_allOccup_2coll_inROF", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_lowOccup_2coll_inROF", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_highOccup_2coll_inROF", "", kTH1D, {{250, 0., 8000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_allOccup_1collPerROF", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_lowOccup_1collPerROF", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_highOccup_1collPerROF", "", kTH1D, {{250, 0., 8000 * k}}); + // now with the ratio on y-axis: histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1", "", kTH2D, {{250, 0., 8000 * k}, {220, 0., 1.1}}); histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1", "", kTH2D, {{250, 0., 8000 * k}, {220, 0., 1.1}}); @@ -330,15 +272,108 @@ struct RofOccupancyQaTask { histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1", "", kTH2D, {{250, 0., 8000 * k}, {220, 0., 1.1}}); histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1", "", kTH2D, {{250, 0., 8000 * k}, {220, 0., 1.1}}); + histos.add("afterNarrowDeltaTimeCut/hSum_2coll_withFT0above4000_inROF", "", kTH1D, {{500, 0., 15000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hSum_2coll_withFT0above4000_thisROFprevROF", "", kTH1D, {{500, 0., 15000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hSum_2coll_withFT0above4000_thisROFprevPrevROF", "", kTH1D, {{500, 0., 15000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hSum_2coll_withFT0above4000_thisROFearlierThanPrevPrevROF", "", kTH1D, {{500, 0., 15000 * k}}); + // histos.add("hNcollPerROF", "", kTH1D, {{16, -0.5, 15.5}}); + + // ROF-by-ROF study: + histos.add("ROFbyROF/nPV_vs_ROFid", "", kTH2D, {{800, 0., 8000 * k}, {10, -0.5, 9.5}}); + histos.add("ROFbyROF/nPV_vs_subROFid", "", kTH2D, {{800, 0., 8000 * k}, {20, -0.5, 19.5}}); + + histos.add("ROFbyROF/FT0C_vs_ROFid", "", kTH2D, {{800, 0., 80000 * k}, {10, -0.5, 9.5}}); + histos.add("ROFbyROF/FT0C_vs_subROFid", "", kTH2D, {{800, 0., 80000 * k}, {20, -0.5, 19.5}}); + + histos.add("ROFbyROF/nPV_00x00", "", kTH1D, {{250, 0., 8000 * k}}); + + histos.add("ROFbyROF/nPV_10x00", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_01x00", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_00x10", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_00x01", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + histos.add("ROFbyROF/nPV_11x00", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_01x10", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_00x11", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + histos.add("ROFbyROF/nPV_10x00_nearbyByFT0C", "", kTH2D, {{250, 0., 80000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_01x00_nearbyByFT0C", "", kTH2D, {{250, 0., 80000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_00x10_nearbyByFT0C", "", kTH2D, {{250, 0., 80000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_00x01_nearbyByFT0C", "", kTH2D, {{250, 0., 80000 * k}, {250, 0., 8000 * k}}); + + histos.add("ROFbyROF/nPV_10x00_thisFT0C", "", kTH2D, {{250, 0., 80000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_01x00_thisFT0C", "", kTH2D, {{250, 0., 80000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_00x10_thisFT0C", "", kTH2D, {{250, 0., 80000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_00x01_thisFT0C", "", kTH2D, {{250, 0., 80000 * k}, {250, 0., 8000 * k}}); + + // histos.add("ROFbyROF/nPV_11x11", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + // ### sub-ROFs: + histos.add("ROFbyROF/nPV_0_x00_0", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_0_0x0_0", "", kTH1D, {{250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_0_00x_0", "", kTH1D, {{250, 0., 8000 * k}}); + + // corr with prev subROFs: + histos.add("ROFbyROF/nPV_0_00x_y00_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_0_0x0_y00_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_0_x00_y00_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + histos.add("ROFbyROF/nPV_0_00x_0y0_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_0_0x0_0y0_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_0_x00_0y0_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + histos.add("ROFbyROF/nPV_0_00x_00y_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_0_0x0_00y_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_0_x00_00y_000", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + // corr with next subROFs: + histos.add("ROFbyROF/nPV_000_y00_00x_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_000_y00_0x0_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_000_y00_x00_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + histos.add("ROFbyROF/nPV_000_0y0_00x_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_000_0y0_0x0_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_000_0y0_x00_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + histos.add("ROFbyROF/nPV_000_00y_00x_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_000_00y_0x0_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("ROFbyROF/nPV_000_00y_x00_0", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + // #### new occupancy studies + histos.add("nPV_vs_occupancyByTracks/sel8", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeRangeNarrow", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeRangeStrict", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeRangeStandard", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeRangeVzDependent", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInRofStrict", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInRofStandard", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStandard", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStrict", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStrict_vZ_5cm", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/kNoHighMultCollInPrevRof", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/kNoHighMultCollInPrevRofAndRofStrict", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 25000 * k}}); + + histos.add("nPV_vs_occupancyByFT0C/sel8", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeRangeNarrow", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeRangeStrict", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeRangeStandard", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeRangeVzDependent", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInRofStrict", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInRofStandard", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStandard", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStrict", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStrict_vZ_5cm", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/kNoHighMultCollInPrevRof", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/kNoHighMultCollInPrevRofAndRofStrict", "", kTH2D, {{125, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); } - Partition pvTracks = ((aod::track::flags & (uint32_t)o2::aod::track::PVContributor) == (uint32_t)o2::aod::track::PVContributor); + Partition pvTracks = ((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)); + // Partition pvTracks = ((aod::track::flags & (uint32_t)o2::aod::track::PVContributor) == (uint32_t)o2::aod::track::PVContributor); Preslice perCollision = aod::track::collisionId; using ColEvSels = soa::Join; //, aod::Mults, aod::CentFT0Cs>; - // void processRun3(aod::Collisions const& cols, FullTracksIU const&, BCsWithBcSelsRun3 const& bcs, aod::FT0s const&) void processRun3(ColEvSels const& cols, FullTracksIU const&, BCsWithBcSelsRun3 const& bcs, aod::FT0s const&) { int run = bcs.iteratorAt(0).runNumber(); @@ -350,57 +385,19 @@ struct RofOccupancyQaTask { bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches; // duration of TF in bcs nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches; - // colliding bc pattern - int64_t ts = bcs.iteratorAt(0).timestamp(); - auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", ts); - bcPatternB = grplhcif->getBunchFilling().getBCPattern(); // extract ITS ROF parameters - // auto timestamps = ccdb->getRunDuration(run, true); /// fatalise if timestamps are not found - // int64_t sorTimestamp = timestamps.first; // timestamp of the SOR/SOX/STF in ms - // int64_t eorTimestamp = timestamps.second; // timestamp of the EOR/EOX/ETF in ms - // int64_t ts = eorTimestamp / 2 + sorTimestamp / 2; // timestamp of the middle of the run + int64_t ts = bcs.iteratorAt(0).timestamp(); auto alppar = ccdb->getForTimeStamp>("ITS/Config/AlpideParam", ts); rofOffset = alppar->roFrameBiasInBC; rofLength = alppar->roFrameLengthInBC; LOGP(info, "rofOffset={} rofLength={}", rofOffset, rofLength); } - // create maps from globalBC to bc index for TVX-fired bcs - // to be used for closest TVX searches - std::map mapGlobalBcWithTVX; - std::map mapGlobalBcVtxZ; - for (auto& bc : bcs) { - int64_t globalBC = bc.globalBC(); - // skip non-colliding bcs for data and anchored runs - if (run >= 500000 && bcPatternB[globalBC % o2::constants::lhc::LHCMaxBunches] == 0) { - continue; - } - if (bc.selection_bit(kIsTriggerTVX)) { - mapGlobalBcWithTVX[globalBC] = bc.globalIndex(); - mapGlobalBcVtxZ[globalBC] = bc.has_ft0() ? bc.ft0().posZ() : 0; - } - } - - // protection against empty FT0 maps - if (mapGlobalBcWithTVX.size() == 0) { - LOGP(error, "FT0 table is empty or corrupted."); - // for (auto& col : cols) { - // auto bc = col.bc_as(); - // int32_t foundBC = bc.globalIndex(); - // int32_t foundFT0 = bc.foundFT0Id(); - // int32_t foundFV0 = bc.foundFV0Id(); - // int32_t foundFDD = bc.foundFDDId(); - // int32_t foundZDC = bc.foundZDCId(); - // int bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF; - // // evsel(bc.alias_raw(), bc.selection_raw(), kFALSE, kFALSE, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, bcInTF, -1, -1, -1); - // } - return; - } std::vector vTracksITS567perColl(cols.size(), 0); // counter of tracks per collision for occupancy studies std::vector vTracksITSTPCperColl(cols.size(), 0); // counter of tracks per collision for occupancy studies + std::vector vTracksITS567eta08perColl(cols.size(), 0); // counter of tracks per collision for occupancy studies std::vector vAmpFT0CperColl(cols.size(), 0); // amplitude FT0C per collision - std::vector vCollVz(cols.size(), 0); // vector with vZ positions for each collision std::vector vIsFullInfoForOccupancy(cols.size(), 0); // info for occupancy in +/- windows is available (i.e. a given coll is not too close to the TF borders) const float timeWinOccupancyCalcMinNS = confTimeIntervalForOccupancyCalculationMin * 1e3; // ns const float timeWinOccupancyCalcMaxNS = confTimeIntervalForOccupancyCalculationMax * 1e3; // ns @@ -408,150 +405,214 @@ struct RofOccupancyQaTask { std::vector vIsVertexTOFmatched(cols.size(), 0); // at least one of vertex contributors is matched to TOF std::vector vIsVertexTRDmatched(cols.size(), 0); // at least one of vertex contributors is matched to TRD - std::vector vCollisionsPerBc(bcs.size(), 0); // counter of collisions per found bc for pileup checks + // std::vector vCollisionsPerBc(bcs.size(), 0); // counter of collisions per found bc for pileup checks std::vector vFoundBCindex(cols.size(), -1); // indices of found bcs std::vector vFoundGlobalBC(cols.size(), 0); // global BCs for collisions - std::vector vIsVertexTOF(cols.size(), 0); - std::vector vIsVertexTRD(cols.size(), 0); - std::vector vIsVertexTPC(cols.size(), 0); - std::vector vIsVertexHighPtTPC(cols.size(), 0); - std::vector vNcontributors(cols.size(), 0); - std::vector vWeightedTimesTPCnoTOFnoTRD(cols.size(), 0); - std::vector vWeightedSigmaTPCnoTOFnoTRD(cols.size(), 0); + std::vector vCollVz(cols.size(), 0); // vector with vZ positions for each collision + std::vector vIsSel8(cols.size(), 0); + std::vector vCombCond(cols.size(), 0); - // temporary vectors to find tracks with median time - std::vector vTrackTimesTOF; - std::vector vTrackTimesTRDnoTOF; + std::vector vCollRofId(cols.size(), 0); // rof Id for each collision + std::vector vCollRofIdPerOrbit(cols.size(), 0); // rof Id for each collision, per orbit + std::vector vCollRofSubId(cols.size(), 0); // rof sub-Id for each collision + std::vector vCollRofSubIdPerOrbit(cols.size(), 0); // rof sub-Id for each collision, per orbit - // first loop to match collisions to TVX, also extract other per-collision information for further use + // first loop over collisions - collecting info for (auto& col : cols) { int32_t colIndex = col.globalIndex(); - auto bc = col.bc_as(); + // auto bc = col.bc_as(); + const auto& bc = col.foundBC_as(); + int64_t globalBC = bc.globalBC(); + + int32_t foundBC = bc.globalIndex(); + vFoundBCindex[colIndex] = foundBC; + vFoundGlobalBC[colIndex] = globalBC; // bc.globalBC(); + + if (bc.has_foundFT0()) + vAmpFT0CperColl[colIndex] = bc.foundFT0().sumAmpC(); vCollVz[colIndex] = col.posZ(); + vIsSel8[colIndex] = col.sel8(); + vCombCond[colIndex] = vIsSel8[colIndex] && (fabs(vCollVz[colIndex]) < 8) && (vAmpFT0CperColl[colIndex] > 500 /* a.u.*/); - int64_t globalBC = bc.globalBC(); - int bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF; + int bcInTF = col.bcInTF(); //(bc.globalBC() - bcSOR) % nBCsPerTF; vIsFullInfoForOccupancy[colIndex] = ((bcInTF - 300) * bcNS > -timeWinOccupancyCalcMinNS) && ((nBCsPerTF - 4000 - bcInTF) * bcNS > timeWinOccupancyCalcMaxNS) ? true : false; - // const auto& colPvTracks = pvTracks.sliceByCached(aod::track::collisionId, col.globalIndex(), cache); - // const auto& colPvTracks = pvTracks.sliceBy(aod::track::collisionId, col.globalIndex(), cache); + // int64_t rofId = (globalBC + 3564 - rofOffset) / rofLength; + int rofId = (bcInTF - rofOffset) / rofLength; + vCollRofId[colIndex] = rofId; + + int rofIdPerOrbit = rofId % (3564 / rofLength); + vCollRofIdPerOrbit[colIndex] = rofIdPerOrbit; + + int bcInITSROF = (globalBC + 3564 - rofOffset) % rofLength; + int subRofId = bcInITSROF / (rofLength / 3); + vCollRofSubId[colIndex] = subRofId; + vCollRofSubIdPerOrbit[colIndex] = 3 * rofIdPerOrbit + subRofId; + // LOGP(info, ">> rofId={} rofIdPerOrbit={} subRofId={} vCollRofSubId={}", rofId, rofIdPerOrbit, subRofId, vCollRofSubId[colIndex]); + auto colPvTracks = pvTracks.sliceBy(perCollision, col.globalIndex()); - vTrackTimesTOF.clear(); - vTrackTimesTRDnoTOF.clear(); - int nPvTracksTPCnoTOFnoTRD = 0; - int nPvTracksHighPtTPCnoTOFnoTRD = 0; - float sumTime = 0, sumW = 0, sumHighPtTime = 0, sumHighPtW = 0; for (auto& track : colPvTracks) { - float trackTime = track.trackTime(); if (track.itsNCls() >= 5) { vTracksITS567perColl[colIndex]++; + if (fabs(track.eta()) < 0.8) + vTracksITS567eta08perColl[colIndex]++; if (track.tpcNClsFound() > 70) vTracksITSTPCperColl[colIndex]++; if (fabs(col.posZ()) < 1) - histos.get(HIST("hEtaVz02"))->Fill(track.eta()); - else if (col.posZ() > 8 && col.posZ() < 10) - histos.get(HIST("hEtaVzPlus10"))->Fill(track.eta()); - else if (col.posZ() > -10 && col.posZ() < -8) - histos.get(HIST("hEtaVzMinus10"))->Fill(track.eta()); - else if (col.posZ() > 14 && col.posZ() < 16) - histos.get(HIST("hEtaVzPlus15"))->Fill(track.eta()); - else if (col.posZ() > -16 && col.posZ() < -14) - histos.get(HIST("hEtaVzMinus15"))->Fill(track.eta()); + histos.fill(HIST("hEtaVz02"), track.eta()); + else if (col.posZ() > 9.5 && col.posZ() < 10.5) + histos.fill(HIST("hEtaVzPlus10"), track.eta()); + else if (col.posZ() > -10.5 && col.posZ() < -9.5) + histos.fill(HIST("hEtaVzMinus10"), track.eta()); + else if (col.posZ() > 14.5 && col.posZ() < 15.5) + histos.fill(HIST("hEtaVzPlus15"), track.eta()); + else if (col.posZ() > -15.5 && col.posZ() < -14.5) + histos.fill(HIST("hEtaVzMinus15"), track.eta()); + + histos.fill(HIST("hEtaVsVz"), col.posZ(), track.eta()); } if (track.hasTRD()) vIsVertexTRDmatched[colIndex] = 1; if (track.hasTPC()) vIsVertexITSTPC[colIndex] = 1; if (track.hasTOF()) { - vTrackTimesTOF.push_back(trackTime); vIsVertexTOFmatched[colIndex] = 1; - } else if (track.hasTRD()) { - vTrackTimesTRDnoTOF.push_back(trackTime); - } else if (track.hasTPC()) { - float trackTimeRes = track.trackTimeRes(); - float trackPt = track.pt(); - float w = 1. / (trackTimeRes * trackTimeRes); - sumTime += trackTime * w; - sumW += w; - nPvTracksTPCnoTOFnoTRD++; - if (trackPt > 1) { - sumHighPtTime += trackTime * w; - sumHighPtW += w; - nPvTracksHighPtTPCnoTOFnoTRD++; - } } } - vWeightedTimesTPCnoTOFnoTRD[colIndex] = sumW > 0 ? sumTime / sumW : 0; - vWeightedSigmaTPCnoTOFnoTRD[colIndex] = sumW > 0 ? sqrt(1. / sumW) : 0; - vNcontributors[colIndex] = colPvTracks.size(); - int nPvTracksTOF = vTrackTimesTOF.size(); - int nPvTracksTRDnoTOF = vTrackTimesTRDnoTOF.size(); - // collision type - vIsVertexTOF[colIndex] = nPvTracksTOF > 0; - vIsVertexTRD[colIndex] = nPvTracksTRDnoTOF > 0; - vIsVertexTPC[colIndex] = nPvTracksTPCnoTOFnoTRD > 0; - vIsVertexHighPtTPC[colIndex] = nPvTracksHighPtTPCnoTOFnoTRD > 0; - - int64_t foundGlobalBC = 0; - int32_t foundBCindex = -1; - - if (nPvTracksTOF > 0) { - // for collisions with TOF tracks: - // take bc corresponding to TOF track with median time - int64_t tofGlobalBC = globalBC + TMath::Nint(getMedian(vTrackTimesTOF) / bcNS); - std::map::iterator it = mapGlobalBcWithTVX.find(tofGlobalBC); - if (it != mapGlobalBcWithTVX.end()) { - foundGlobalBC = it->first; - foundBCindex = it->second; + + if (col.sel8()) { + histos.fill(HIST("hNPVcontribVsVz"), col.posZ(), vTracksITS567perColl[colIndex]); + histos.fill(HIST("hNPVcontribVsVz_eta08"), col.posZ(), vTracksITS567eta08perColl[colIndex]); + } + } + + // ROF-by-ROF study: + int nColls = vCombCond.size(); + for (auto& col : cols) { + int32_t k = col.globalIndex(); + + if (k - 2 < 0 || k + 2 > nColls - 1) + continue; + + // the "purest case" + if (vCombCond[k]) { + if (vCollRofId[k - 1] < vCollRofId[k] - 2 && /* next coll is far */ vCollRofId[k + 1] > vCollRofId[k] + 2) // 00x00 + histos.fill(HIST("ROFbyROF/nPV_00x00"), vTracksITS567perColl[k]); + + if (vCollRofId[k - 1] < vCollRofId[k] - 1 && /* next coll is far */ vCollRofId[k + 1] > vCollRofId[k] + 1) // 0x0 + { + if (vCollRofSubId[k] == 0) + histos.fill(HIST("ROFbyROF/nPV_0_x00_0"), vTracksITS567perColl[k]); + if (vCollRofSubId[k] == 1) + histos.fill(HIST("ROFbyROF/nPV_0_0x0_0"), vTracksITS567perColl[k]); + if (vCollRofSubId[k] == 2) + histos.fill(HIST("ROFbyROF/nPV_0_00x_0"), vTracksITS567perColl[k]); } - } else if (nPvTracksTPCnoTOFnoTRD == 0 && nPvTracksTRDnoTOF > 0) { - // for collisions with TRD tracks but without TOF or ITSTPC-only tracks: - // take bc corresponding to TRD track with median time - int64_t trdGlobalBC = globalBC + TMath::Nint(getMedian(vTrackTimesTRDnoTOF) / bcNS); - std::map::iterator it = mapGlobalBcWithTVX.find(trdGlobalBC); - if (it != mapGlobalBcWithTVX.end()) { - foundGlobalBC = it->first; - foundBCindex = it->second; + } + + // prev 1 coll + if (vCombCond[k] && vCombCond[k - 1]) { + if (vCollRofId[k - 2] < vCollRofId[k] - 2 && vCollRofId[k - 1] == vCollRofId[k] - 2 && /* next coll is far */ vCollRofId[k + 1] > vCollRofId[k] + 2) // 10x00 + { + histos.fill(HIST("ROFbyROF/nPV_10x00"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + histos.fill(HIST("ROFbyROF/nPV_10x00_nearbyByFT0C"), vAmpFT0CperColl[k - 1], vTracksITS567perColl[k]); + histos.fill(HIST("ROFbyROF/nPV_10x00_thisFT0C"), vAmpFT0CperColl[k], vTracksITS567perColl[k]); } - } else if (nPvTracksHighPtTPCnoTOFnoTRD > 0) { - // for collisions with high-pt ITSTPC-nonTOF-nonTRD tracks - // search in 3*confSigmaBCforHighPtTracks range (3*4 bcs by default) - int64_t meanBC = globalBC + TMath::Nint(sumHighPtTime / sumHighPtW / bcNS); - int64_t bestGlobalBC = findBestGlobalBC(meanBC, confSigmaBCforHighPtTracks, vNcontributors[colIndex], col.posZ(), mapGlobalBcVtxZ); - if (bestGlobalBC > 0) { - foundGlobalBC = bestGlobalBC; - foundBCindex = mapGlobalBcWithTVX[bestGlobalBC]; + if (vCollRofId[k - 2] < vCollRofId[k] - 2 && vCollRofId[k - 1] == vCollRofId[k] - 1 && /* next coll is far */ vCollRofId[k + 1] > vCollRofId[k] + 2) // 01x00 + { + histos.fill(HIST("ROFbyROF/nPV_01x00"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + histos.fill(HIST("ROFbyROF/nPV_01x00_nearbyByFT0C"), vAmpFT0CperColl[k - 1], vTracksITS567perColl[k]); + histos.fill(HIST("ROFbyROF/nPV_01x00_thisFT0C"), vAmpFT0CperColl[k], vTracksITS567perColl[k]); + } + + if (vCollRofId[k - 2] < vCollRofId[k] - 2 && vCollRofId[k - 1] == vCollRofId[k] - 1 && /* next coll is far */ vCollRofId[k + 1] > vCollRofId[k] + 1) // 01x0 + { + // sub-ROFs: + if (vCollRofSubId[k - 1] == 2 && vCollRofSubId[k] == 0) + histos.fill(HIST("ROFbyROF/nPV_0_00x_y00_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k - 1] == 1 && vCollRofSubId[k] == 0) + histos.fill(HIST("ROFbyROF/nPV_0_0x0_y00_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k - 1] == 0 && vCollRofSubId[k] == 0) + histos.fill(HIST("ROFbyROF/nPV_0_x00_y00_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + + if (vCollRofSubId[k - 1] == 2 && vCollRofSubId[k] == 1) + histos.fill(HIST("ROFbyROF/nPV_0_00x_0y0_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k - 1] == 1 && vCollRofSubId[k] == 1) + histos.fill(HIST("ROFbyROF/nPV_0_0x0_0y0_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k - 1] == 0 && vCollRofSubId[k] == 1) + histos.fill(HIST("ROFbyROF/nPV_0_x00_0y0_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + + if (vCollRofSubId[k - 1] == 2 && vCollRofSubId[k] == 2) + histos.fill(HIST("ROFbyROF/nPV_0_00x_00y_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k - 1] == 1 && vCollRofSubId[k] == 2) + histos.fill(HIST("ROFbyROF/nPV_0_0x0_00y_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k - 1] == 0 && vCollRofSubId[k] == 2) + histos.fill(HIST("ROFbyROF/nPV_0_x00_00y_000"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); } } + // next 1 coll + if (vCombCond[k] && vCombCond[k + 1]) { + if (vCollRofId[k - 1] < vCollRofId[k] - 2 /* prev coll is far */ && vCollRofId[k + 1] == vCollRofId[k] + 1 && vCollRofId[k + 2] > vCollRofId[k] + 2) // 00x10 + { + histos.fill(HIST("ROFbyROF/nPV_00x10"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + histos.fill(HIST("ROFbyROF/nPV_00x10_nearbyByFT0C"), vAmpFT0CperColl[k + 1], vTracksITS567perColl[k]); + histos.fill(HIST("ROFbyROF/nPV_00x10_thisFT0C"), vAmpFT0CperColl[k], vTracksITS567perColl[k]); + } - // fill foundBC indices and global BCs - // keep current bc if TVX matching failed at this step - vFoundBCindex[colIndex] = foundBCindex >= 0 ? foundBCindex : bc.globalIndex(); - vFoundGlobalBC[colIndex] = foundGlobalBC > 0 ? foundGlobalBC : globalBC; + if (vCollRofId[k - 1] < vCollRofId[k] - 1 /* prev coll is far */ && vCollRofId[k + 1] == vCollRofId[k] + 1 && vCollRofId[k + 2] > vCollRofId[k] + 2) // 0x10 + { + // sub-ROFs: + if (vCollRofSubId[k + 1] == 2 && vCollRofSubId[k] == 0) + histos.fill(HIST("ROFbyROF/nPV_000_y00_00x_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k + 1] == 1 && vCollRofSubId[k] == 0) + histos.fill(HIST("ROFbyROF/nPV_000_y00_0x0_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k + 1] == 0 && vCollRofSubId[k] == 0) + histos.fill(HIST("ROFbyROF/nPV_000_y00_x00_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + + if (vCollRofSubId[k + 1] == 2 && vCollRofSubId[k] == 1) + histos.fill(HIST("ROFbyROF/nPV_000_0y0_00x_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k + 1] == 1 && vCollRofSubId[k] == 1) + histos.fill(HIST("ROFbyROF/nPV_000_0y0_0x0_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k + 1] == 0 && vCollRofSubId[k] == 1) + histos.fill(HIST("ROFbyROF/nPV_000_0y0_x00_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + + if (vCollRofSubId[k + 1] == 2 && vCollRofSubId[k] == 2) + histos.fill(HIST("ROFbyROF/nPV_000_00y_00x_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k + 1] == 1 && vCollRofSubId[k] == 2) + histos.fill(HIST("ROFbyROF/nPV_000_00y_0x0_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + if (vCollRofSubId[k + 1] == 0 && vCollRofSubId[k] == 2) + histos.fill(HIST("ROFbyROF/nPV_000_00y_x00_0"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + } - // erase found global BC with TVX from the pool of bcs for the next loop over low-pt TPCnoTOFnoTRD collisions - if (foundBCindex >= 0) - mapGlobalBcVtxZ.erase(foundGlobalBC); - } + if (vCollRofId[k - 1] < vCollRofId[k] - 2 /* prev coll is far */ && vCollRofId[k + 1] == vCollRofId[k] + 2 && vCollRofId[k + 2] > vCollRofId[k] + 2) // 00x01 + { + histos.fill(HIST("ROFbyROF/nPV_00x01"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + histos.fill(HIST("ROFbyROF/nPV_00x01_nearbyByFT0C"), vAmpFT0CperColl[k + 1], vTracksITS567perColl[k]); + histos.fill(HIST("ROFbyROF/nPV_00x01_thisFT0C"), vAmpFT0CperColl[k], vTracksITS567perColl[k]); + } + } - // second loop to match remaining low-pt TPCnoTOFnoTRD collisions - for (auto& col : cols) { - int32_t colIndex = col.globalIndex(); - if (vIsVertexTPC[colIndex] > 0 && vIsVertexTOF[colIndex] == 0 && vIsVertexHighPtTPC[colIndex] == 0) { - float weightedTime = vWeightedTimesTPCnoTOFnoTRD[colIndex]; - float weightedSigma = vWeightedSigmaTPCnoTOFnoTRD[colIndex]; - auto bc = col.bc_as(); - int64_t globalBC = bc.globalBC(); - int64_t meanBC = globalBC + TMath::Nint(weightedTime / bcNS); - int64_t bestGlobalBC = findBestGlobalBC(meanBC, weightedSigma / bcNS, vNcontributors[colIndex], col.posZ(), mapGlobalBcVtxZ); - vFoundGlobalBC[colIndex] = bestGlobalBC > 0 ? bestGlobalBC : globalBC; - vFoundBCindex[colIndex] = bestGlobalBC > 0 ? mapGlobalBcWithTVX[bestGlobalBC] : bc.globalIndex(); + // 2 colls + if (vCombCond[k] && vCombCond[k - 1] && vCombCond[k - 2]) { + if (vCollRofId[k - 2] == vCollRofId[k] - 2 && vCollRofId[k - 1] == vCollRofId[k] - 1 && vCollRofId[k + 1] > vCollRofId[k] + 2) // 11x00 + histos.fill(HIST("ROFbyROF/nPV_11x00"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); + } + + if (vCombCond[k] && vCombCond[k - 1] && vCombCond[k + 1]) { + if (vCollRofId[k - 2] < vCollRofId[k] - 2 && vCollRofId[k - 1] == vCollRofId[k] - 1 && vCollRofId[k + 1] == vCollRofId[k] + 1 && vCollRofId[k + 2] > vCollRofId[k] + 2) // 01x10 + histos.fill(HIST("ROFbyROF/nPV_01x10"), vTracksITS567perColl[k - 1], vTracksITS567perColl[k]); } - // fill pileup counter - vCollisionsPerBc[vFoundBCindex[colIndex]]++; + + if (vCombCond[k] && vCombCond[k + 1] && vCombCond[k + 2]) { + if (vCollRofId[k - 1] < vCollRofId[k] - 2 && vCollRofId[k + 1] == vCollRofId[k] + 1 && vCollRofId[k + 2] == vCollRofId[k] + 2) // 00x11 + histos.fill(HIST("ROFbyROF/nPV_00x11"), vTracksITS567perColl[k + 1], vTracksITS567perColl[k]); + } + + // many colls around + // histos.add("ROFbyROF/nPV_11x11", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); } // save indices of collisions in time range for occupancy calculation @@ -562,10 +623,6 @@ struct RofOccupancyQaTask { int32_t colIndex = col.globalIndex(); int64_t foundGlobalBC = vFoundGlobalBC[colIndex]; - auto bc = bcs.iteratorAt(vFoundBCindex[colIndex]); - if (bc.has_foundFT0()) - vAmpFT0CperColl[colIndex] = bc.foundFT0().sumAmpC(); - // int bcInTF = (foundGlobalBC - bcSOR) % nBCsPerTF; // int bcInITSROF = (foundGlobalBC + 3564 - rofOffset) % rofLength; int64_t TFid = (foundGlobalBC - bcSOR) / nBCsPerTF; @@ -676,8 +733,8 @@ struct RofOccupancyQaTask { // QA: if (vAmpFT0CperColl[colIndex] > 5000) { - histos.get(HIST("hThisEvITStr_vs_vZ"))->Fill(vZ, vTracksITS567perColl[colIndex]); - histos.get(HIST("hThisEvITSTPCtr_vs_vZ"))->Fill(vZ, vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITStr_vs_vZ"), vZ, vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCtr_vs_vZ"), vZ, vTracksITSTPCperColl[colIndex]); } // ### in-ROF occupancy @@ -685,7 +742,7 @@ struct RofOccupancyQaTask { // int bcInTF = (vFoundGlobalBC[colIndex] - bcSOR) % nBCsPerTF; int bcInITSROF = (vFoundGlobalBC[colIndex] + 3564 - rofOffset) % rofLength; int rofIdInTF = (vFoundGlobalBC[colIndex] + 3564 - rofOffset) / rofLength; - auto bc = bcs.iteratorAt(vFoundBCindex[colIndex]); + // auto bc = bcs.iteratorAt(vFoundBCindex[colIndex]); // LOGP(info, "#### starting new coll: bc={} bcInTF={} bcInITSROF={} rofId={}; noROFborder={}; rofOffset={} rofLength={}", vFoundGlobalBC[colIndex], bcInTF, bcInITSROF, rofId, bc.selection_bit(kNoITSROFrameBorder), rofOffset, rofLength); // LOGP(info, "#### starting new coll: bcInTF={} bcInITSROF={} rofIdInTF={}; noROFborder={}, vZ={} mult={}; rofOffset={} rofLength={}", bcInTF, bcInITSROF, rofIdInTF, bc.selection_bit(kNoITSROFrameBorder), vZ, vTracksITS567perColl[colIndex], rofOffset, rofLength); @@ -701,7 +758,7 @@ struct RofOccupancyQaTask { vROFidThisColl[colIndex] = rofIdInTF; if (fabs(vZ) < 10) - vNumCollinROFinVz10[colIndex]++; + vNumCollinROFinVz10[colIndex] = 1; for (uint32_t iCol = 0; iCol < vAssocToSameROF.size(); iCol++) { int thisColIndex = vAssocToSameROF[iCol]; // int64_t thisRofId = (vFoundGlobalBC[thisColIndex] + 3564 - rofOffset) / rofLength; @@ -716,9 +773,9 @@ struct RofOccupancyQaTask { nITS567tracksForRofVetoStrict += vTracksITS567perColl[thisColIndex]; nSumAmplFT0CforRofVetoStrict += vAmpFT0CperColl[thisColIndex]; vNumCollinROF[colIndex]++; - vInROFcollIndex[colIndex] = thisBcInITSROF > bcInITSROF ? 0 : 1; // if colIndex is for the first coll in ROF => inROFindex=0, otherwise =1 if (fabs(vCollVz[thisColIndex]) < 10) vNumCollinROFinVz10[colIndex]++; + vInROFcollIndex[colIndex] = thisBcInITSROF > bcInITSROF ? 0 : 1; // if colIndex is for the first coll in ROF => inROFindex=0, otherwise =1 // if (vTracksITS567perColl[thisColIndex] > confNtracksCutVetoOnCollInROF) // nITS567tracksForRofVetoStandard += vTracksITS567perColl[thisColIndex]; @@ -737,18 +794,18 @@ struct RofOccupancyQaTask { nArrITS567tracksForRofVetoOnCloseVz[i]++; } - if (fabs(vZ) < 8.) { - histos.get(HIST("hDeltaVz"))->Fill(vCollVz[thisColIndex] - vZ); + if (fabs(vZ) < 10) { + histos.fill(HIST("hDeltaVz"), vCollVz[thisColIndex] - vZ); if (vTracksITS567perColl[colIndex] >= 100 && vTracksITS567perColl[thisColIndex] < 100) - histos.get(HIST("hDeltaVzGivenCollAbove100NearbyBelow100"))->Fill(vCollVz[thisColIndex] - vZ); + histos.fill(HIST("hDeltaVzGivenCollAbove100NearbyBelow100"), vCollVz[thisColIndex] - vZ); if (vTracksITS567perColl[colIndex] <= 100 && vTracksITS567perColl[thisColIndex] > 100) - histos.get(HIST("hDeltaVzGivenCollBelow100NearbyAbove100"))->Fill(vCollVz[thisColIndex] - vZ); + histos.fill(HIST("hDeltaVzGivenCollBelow100NearbyAbove100"), vCollVz[thisColIndex] - vZ); if (vTracksITS567perColl[colIndex] > 20 && vTracksITS567perColl[thisColIndex] > 20) - histos.get(HIST("hDeltaVzAfterCuts"))->Fill(vCollVz[thisColIndex] - vZ); - if (bc.selection_bit(kIsTriggerTVX) && bc.selection_bit(kNoTimeFrameBorder) && bc.selection_bit(kNoITSROFrameBorder)) - histos.get(HIST("hDeltaVzAfterTFandROFborderCuts"))->Fill(vCollVz[thisColIndex] - vZ); - if (vTracksITS567perColl[colIndex] > 20 && vTracksITS567perColl[thisColIndex] > 20 && bc.selection_bit(kIsTriggerTVX) && bc.selection_bit(kNoTimeFrameBorder) && bc.selection_bit(kNoITSROFrameBorder)) - histos.get(HIST("hDeltaVzAfterAllCuts"))->Fill(vCollVz[thisColIndex] - vZ); + histos.fill(HIST("hDeltaVzAfterCuts"), vCollVz[thisColIndex] - vZ); + if (col.sel8()) // bc.selection_bit(kIsTriggerTVX) && bc.selection_bit(kNoTimeFrameBorder) && bc.selection_bit(kNoITSROFrameBorder)) + histos.fill(HIST("hDeltaVzAfterTFandROFborderCuts"), vCollVz[thisColIndex] - vZ); + if (vTracksITS567perColl[colIndex] > 20 && vTracksITS567perColl[thisColIndex] > 20 && col.sel8()) // bc.selection_bit(kIsTriggerTVX) && bc.selection_bit(kNoTimeFrameBorder) && bc.selection_bit(kNoITSROFrameBorder)) + histos.fill(HIST("hDeltaVzAfterAllCuts"), vCollVz[thisColIndex] - vZ); } } vNumTracksITS567inROF[colIndex] = nITS567tracksForRofVetoStrict; // occupancy in ROF (excluding a given collision) @@ -782,6 +839,22 @@ struct RofOccupancyQaTask { for (uint32_t iCol = 0; iCol < vAssocToThisCol.size(); iCol++) { int thisColIndex = vAssocToThisCol[iCol]; float dt = vCollsTimeDeltaWrtGivenColl[iCol] / 1e3; // ns -> us + histos.fill(HIST("hDeltaTime"), dt); + if (vTracksITS567perColl[colIndex] > 50 && vTracksITS567perColl[thisColIndex] > 50) + histos.fill(HIST("hDeltaTimeAboveNtracksCut"), dt); + + if (fabs(vCollVz[colIndex]) < 10 && fabs(vCollVz[thisColIndex]) < 10) + histos.fill(HIST("hDeltaTime_vZ10cm"), dt); + + if (vIsSel8[colIndex] && vIsSel8[thisColIndex]) + histos.fill(HIST("hDeltaTime_sel8"), dt); + + if (fabs(vCollVz[colIndex]) < 10 && vIsSel8[colIndex] && fabs(vCollVz[thisColIndex]) < 10 && vIsSel8[thisColIndex]) { + histos.fill(HIST("hDeltaTime_sel8_vZ10cm"), dt); + if (vTracksITS567perColl[colIndex] > 50 && vTracksITS567perColl[thisColIndex] > 50) + histos.fill(HIST("hDeltaTimeAboveNtracksCut_sel8_vZ10cm"), dt); + } + float wOccup = 1.; if (confUseWeightsForOccupancyVariable) { // weighted occupancy @@ -797,7 +870,7 @@ struct RofOccupancyQaTask { else if (dt >= 40 && dt < 100) // collisions from the distant future wOccup = -0.4 / 60 * dt + 0.6 + 0.8 / 3; if (wOccup > 0) - histos.get(HIST("hOccupancyWeights"))->Fill(dt, wOccup); + histos.fill(HIST("hOccupancyWeights"), dt, wOccup); } nITS567tracksInFullTimeWindow += wOccup * vTracksITS567perColl[thisColIndex]; sumAmpFT0CInFullTimeWindow += wOccup * vAmpFT0CperColl[thisColIndex]; @@ -831,9 +904,9 @@ struct RofOccupancyQaTask { // FOR QA: if (fabs(vCollVz[thisColIndex] - fabs(dt) * driftV - vZ) < confEpsilonDistanceForVzDependentVetoTPC) - histos.get(HIST("hDeltaVzVsDeltaTime1"))->Fill(vCollVz[thisColIndex] - fabs(dt) * driftV - vZ, dt); + histos.fill(HIST("hDeltaVzVsDeltaTime1"), vCollVz[thisColIndex] - fabs(dt) * driftV - vZ, dt); if (fabs(vCollVz[thisColIndex] + fabs(dt) * driftV - vZ) < confEpsilonDistanceForVzDependentVetoTPC) - histos.get(HIST("hDeltaVzVsDeltaTime2"))->Fill(vCollVz[thisColIndex] + fabs(dt) * driftV - vZ, dt); + histos.fill(HIST("hDeltaVzVsDeltaTime2"), vCollVz[thisColIndex] + fabs(dt) * driftV - vZ, dt); } else { // dt>0 // check distance between drifted vZ of given collision (in two directions) and vZ of future collisions @@ -843,9 +916,9 @@ struct RofOccupancyQaTask { // FOR QA: if (fabs(vZ - dt * driftV - vCollVz[thisColIndex]) < confEpsilonDistanceForVzDependentVetoTPC) - histos.get(HIST("hDeltaVzVsDeltaTime3"))->Fill(vZ - dt * driftV - vCollVz[thisColIndex], dt); + histos.fill(HIST("hDeltaVzVsDeltaTime3"), vZ - dt * driftV - vCollVz[thisColIndex], dt); if (fabs(vZ + dt * driftV - vCollVz[thisColIndex]) < confEpsilonDistanceForVzDependentVetoTPC) - histos.get(HIST("hDeltaVzVsDeltaTime4"))->Fill(vZ + dt * driftV - vCollVz[thisColIndex], dt); + histos.fill(HIST("hDeltaVzVsDeltaTime4"), vZ + dt * driftV - vCollVz[thisColIndex], dt); } } } @@ -864,121 +937,185 @@ struct RofOccupancyQaTask { for (auto& col : cols) { int32_t colIndex = col.globalIndex(); - int32_t foundBC = vFoundBCindex[colIndex]; - auto bc = bcs.iteratorAt(foundBC); - // int32_t foundFT0 = bc.foundFT0Id(); - // int32_t foundFV0 = bc.foundFV0Id(); - // int32_t foundFDD = bc.foundFDDId(); - // int32_t foundZDC = bc.foundZDCId(); - - // // compare zVtx from FT0 and from PV - // bool isGoodZvtxFT0vsPV = bc.has_foundFT0() ? fabs(bc.foundFT0().posZ() - col.posZ()) < maxDiffZvtxFT0vsPV : 0; - - // // copy alias decisions from bcsel table - // uint32_t alias = bc.alias_raw(); - - // // copy selection decisions from bcsel table - // uint64_t selection = bc.selection_raw(); - // selection |= vCollisionsPerBc[foundBC] <= 1 ? BIT(kNoSameBunchPileup) : 0; - // selection |= vIsVertexITSTPC[colIndex] ? BIT(kIsVertexITSTPC) : 0; - // selection |= vIsVertexTOFmatched[colIndex] ? BIT(kIsVertexTOFmatched) : 0; - // selection |= vIsVertexTRDmatched[colIndex] ? BIT(kIsVertexTRDmatched) : 0; - // selection |= isGoodZvtxFT0vsPV ? BIT(kIsGoodZvtxFT0vsPV) : 0; - - // // selection bits based on occupancy time pattern - // selection |= vNoCollInTimeRangeNarrow[colIndex] ? BIT(kNoCollInTimeRangeNarrow) : 0; - // selection |= vNoCollInTimeRangeStrict[colIndex] ? BIT(kNoCollInTimeRangeStrict) : 0; - // selection |= vNoHighMultCollInTimeRange[colIndex] ? BIT(kNoCollInTimeRangeStandard) : 0; - // selection |= vNoCollInVzDependentTimeRange[colIndex] ? BIT(kNoCollInTimeRangeVzDependent) : 0; - - // selection |= vNoCollInSameRofStrict[colIndex] ? BIT(kNoCollInRofStrict) : 0; - // selection |= (vNoCollInSameRofStandard[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) ? BIT(kNoCollInRofStandard) : 0; - // selection |= vNoCollInSameRofWithCloseVz[colIndex] ? BIT(kNoCollInRofWithCloseVz) : 0; - - // apply int7-like selections - // bool sel7 = 0; - - // TODO apply other cuts for sel8 - // TODO introduce sel1 etc? - // TODO introduce array of sel[0]... sel[8] or similar? - bool sel8 = bc.selection_bit(kIsTriggerTVX) && bc.selection_bit(kNoTimeFrameBorder) && bc.selection_bit(kNoITSROFrameBorder); - - // fill counters - histos.get(HIST("hColCounterAll"))->Fill(Form("%d", bc.runNumber()), 1); - if (bc.selection_bit(kIsTriggerTVX)) { - histos.get(HIST("hColCounterTVX"))->Fill(Form("%d", bc.runNumber()), 1); - } + bool sel8 = col.sel8(); // bc.selection_bit(kIsTriggerTVX) && bc.selection_bit(kNoTimeFrameBorder) && bc.selection_bit(kNoITSROFrameBorder); + + float vZ = vCollVz[colIndex]; + int occTracks = col.trackOccupancyInTimeRange(); + float occFT0C = col.ft0cOccupancyInTimeRange(); + if (sel8) { - histos.get(HIST("hColCounterAcc"))->Fill(Form("%d", bc.runNumber()), 1); + // histos.fill(HIST("hColCounterAcc"),Form("%d", bc.runNumber()), 1); if (vInROFcollIndex[colIndex] == 0) - histos.get(HIST("hNcollPerROF"))->Fill(vNumCollinROF[colIndex]); + histos.fill(HIST("hNcollPerROF"), vNumCollinROF[colIndex]); + + histos.fill(HIST("hVz"), vZ); + + int nPV = vTracksITS567perColl[colIndex]; + float ft0C = vAmpFT0CperColl[colIndex]; + + // ROF-by-ROF + if (fabs(vZ) < 8) { + histos.fill(HIST("ROFbyROF/nPV_vs_ROFid"), nPV, vCollRofIdPerOrbit[colIndex]); + histos.fill(HIST("ROFbyROF/nPV_vs_subROFid"), nPV, vCollRofSubIdPerOrbit[colIndex]); + + histos.fill(HIST("ROFbyROF/FT0C_vs_ROFid"), ft0C, vCollRofIdPerOrbit[colIndex]); + histos.fill(HIST("ROFbyROF/FT0C_vs_subROFid"), ft0C, vCollRofSubIdPerOrbit[colIndex]); + } + // vs occupancy + if (occTracks >= 0 && fabs(vZ) < 8) { + histos.fill(HIST("nPV_vs_occupancyByTracks/sel8"), nPV, occTracks); + if (col.selection_bit(kNoCollInTimeRangeNarrow)) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInTimeRangeNarrow"), nPV, occTracks); + if (col.selection_bit(kNoCollInTimeRangeStrict)) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInTimeRangeStrict"), nPV, occTracks); + if (col.selection_bit(kNoCollInTimeRangeStandard)) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInTimeRangeStandard"), nPV, occTracks); + if (col.selection_bit(kNoCollInTimeRangeVzDependent)) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInTimeRangeVzDependent"), nPV, occTracks); + if (col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInRofStrict"), nPV, occTracks); + if (col.selection_bit(kNoCollInRofStandard)) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInRofStandard"), nPV, occTracks); + if (col.selection_bit(kNoCollInTimeRangeStandard) && col.selection_bit(kNoCollInRofStandard)) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStandard"), nPV, occTracks); + if (col.selection_bit(kNoCollInTimeRangeStrict) && col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStrict"), nPV, occTracks); + if (col.selection_bit(kNoCollInTimeRangeStrict) && col.selection_bit(kNoCollInRofStrict) && fabs(vZ) < 5) + histos.fill(HIST("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStrict_vZ_5cm"), nPV, occTracks); + if (col.selection_bit(kNoHighMultCollInPrevRof)) + histos.fill(HIST("nPV_vs_occupancyByTracks/kNoHighMultCollInPrevRof"), nPV, occTracks); + if (col.selection_bit(kNoHighMultCollInPrevRof) && col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("nPV_vs_occupancyByTracks/kNoHighMultCollInPrevRofAndRofStrict"), nPV, occTracks); + } + if (occFT0C >= 0 && fabs(vZ) < 8) { + histos.fill(HIST("nPV_vs_occupancyByFT0C/sel8"), nPV, occFT0C); + if (col.selection_bit(kNoCollInTimeRangeNarrow)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInTimeRangeNarrow"), nPV, occFT0C); + if (col.selection_bit(kNoCollInTimeRangeStrict)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInTimeRangeStrict"), nPV, occFT0C); + if (col.selection_bit(kNoCollInTimeRangeStandard)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInTimeRangeStandard"), nPV, occFT0C); + if (col.selection_bit(kNoCollInTimeRangeVzDependent)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInTimeRangeVzDependent"), nPV, occFT0C); + if (col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInRofStrict"), nPV, occFT0C); + if (col.selection_bit(kNoCollInRofStandard)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInRofStandard"), nPV, occFT0C); + if (col.selection_bit(kNoCollInTimeRangeStandard) && col.selection_bit(kNoCollInRofStandard)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStandard"), nPV, occFT0C); + if (col.selection_bit(kNoCollInTimeRangeStrict) && col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStrict"), nPV, occFT0C); + if (col.selection_bit(kNoCollInTimeRangeStrict) && col.selection_bit(kNoCollInRofStrict) && fabs(vZ) < 5) + histos.fill(HIST("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStrict_vZ_5cm"), nPV, occFT0C); + if (col.selection_bit(kNoHighMultCollInPrevRof)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/kNoHighMultCollInPrevRof"), nPV, occFT0C); + if (col.selection_bit(kNoHighMultCollInPrevRof) && col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("nPV_vs_occupancyByFT0C/kNoHighMultCollInPrevRofAndRofStrict"), nPV, occFT0C); + } } - if (col.trackOccupancyInTimeRange() >= 0) - histos.get(HIST("hOccupancyByTracks_CROSSCHECK"))->Fill(col.trackOccupancyInTimeRange()); - if (col.ft0cOccupancyInTimeRange() >= 0) - histos.get(HIST("hOccupancyByFT0C_CROSSCHECK"))->Fill(col.ft0cOccupancyInTimeRange()); + if (occTracks >= 0) + histos.fill(HIST("hOccupancyByTracks_CROSSCHECK"), occTracks); + if (occFT0C >= 0) + histos.fill(HIST("hOccupancyByFT0C_CROSSCHECK"), occFT0C); if (vNumTracksITS567inFullTimeWin[colIndex] >= 0) { - histos.get(HIST("hOccupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex]); - histos.get(HIST("hOccupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex]); + histos.fill(HIST("hOccupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex]); + histos.fill(HIST("hOccupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex]); - histos.get(HIST("hOccupancyByTrInROF"))->Fill(vNumTracksITS567inROF[colIndex]); - histos.get(HIST("hOccupancyByFT0C_vs_ByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hOccupancyByTrInROF"), vNumTracksITS567inROF[colIndex]); + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/all"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/all"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); - if (sel8 && fabs(col.posZ()) < 10) { - histos.get(HIST("hOccupancyByFT0C_vs_ByTracks_vZ_TF_ROF_border_cuts"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + if (sel8 && fabs(col.posZ()) < 8) { + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_vZ_TF_ROF_border_cuts"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); // if (vAmpFT0CperColl[colIndex] > 5000 && vAmpFT0CperColl[colIndex] < 10000) { // if (vAmpFT0CperColl[colIndex] > 500) { if (vAmpFT0CperColl[colIndex] > 0) { // 50) { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyInROF"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyInROF"), vNumTracksITS567inROF[colIndex], vTracksITSTPCperColl[colIndex]); if (vNumTracksITS567inROF[colIndex] > 0) { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_HasNeighbours"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours"))->Fill(vSumAmpFT0CinROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_HasNeighbours"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours"))->Fill(vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); } + // two collisions in one ROF (both with |vZ|<10 cm) if (vNumCollinROF[colIndex] == 2 && vNumCollinROFinVz10[colIndex] == 2 && vInROFcollIndex[colIndex] == 1) { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvFT0C_vs_occupancyFT0CInROF_2coll"))->Fill(vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvFT0C_vs_occupancyFT0CInROF_2coll"), vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); if (vNumTracksITS567inROF[colIndex] > vTracksITS567perColl[colIndex]) { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); if (vNumTracksITS567inROF[colIndex] > 0) - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"))->Fill(vNumTracksITS567inROF[colIndex], 1.0 * vTracksITS567perColl[colIndex] / vNumTracksITS567inROF[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"), vNumTracksITS567inROF[colIndex], 1.0 * vTracksITS567perColl[colIndex] / vNumTracksITS567inROF[colIndex]); + } else { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"))->Fill(vTracksITS567perColl[colIndex], vNumTracksITS567inROF[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"), vTracksITS567perColl[colIndex], vNumTracksITS567inROF[colIndex]); + + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_allOccup_2coll_inROF"), vTracksITS567perColl[colIndex]); + if (occTracks < 500) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_lowOccup_2coll_inROF"), vTracksITS567perColl[colIndex]); + else if (occTracks > 1000) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_highOccup_2coll_inROF"), vTracksITS567perColl[colIndex]); + if (vTracksITS567perColl[colIndex] > 0) - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"))->Fill(vTracksITS567perColl[colIndex], 1.0 * vNumTracksITS567inROF[colIndex] / vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"), vTracksITS567perColl[colIndex], 1.0 * vNumTracksITS567inROF[colIndex] / vTracksITS567perColl[colIndex]); } } + + // 3 or 4 collisions in one ROF + if (vNumCollinROF[colIndex] == 2 && vInROFcollIndex[colIndex] == 1) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_noVzCutOnOtherVertices"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + if (vNumCollinROF[colIndex] == 3 && vInROFcollIndex[colIndex] == 1) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_3coll_noVzCutOnOtherVertices"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + if (vNumCollinROF[colIndex] == 4 && vInROFcollIndex[colIndex] == 1) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_4coll_noVzCutOnOtherVertices"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + + // now 1D histograms vs nCollInROF + if (vNumCollinROF[colIndex] == 1) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_1coll_in_ROF"), vTracksITS567perColl[colIndex]); + if (vNumCollinROF[colIndex] == 2) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_2coll_in_ROF"), vTracksITS567perColl[colIndex]); + if (vNumCollinROF[colIndex] == 3) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_3coll_in_ROF"), vTracksITS567perColl[colIndex]); + if (vNumCollinROF[colIndex] == 4) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_4coll_in_ROF"), vTracksITS567perColl[colIndex]); + if (vNumCollinROF[colIndex] >= 5) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_5collOrMore_in_ROF"), vTracksITS567perColl[colIndex]); + // compare with previous ROF if (colIndex - 1 >= 0) { if (vNumCollinROF[colIndex] == 1 && vNumCollinROFinVz10[colIndex] == 1 && vInROFcollIndex[colIndex] == 0 && vNumCollinROF[colIndex - 1] == 1 && vNumCollinROFinVz10[colIndex - 1] == 1 && vInROFcollIndex[colIndex - 1] == 0) { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInAnotherEarlierROF_1collPerROF"))->Fill(vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInAnotherEarlierROF_1collPerROF"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); if (vROFidThisColl[colIndex] == vROFidThisColl[colIndex - 1] + 1) // one ROF right after the previous { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF"))->Fill(vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); if (vTracksITS567perColl[colIndex - 1] > vTracksITS567perColl[colIndex]) { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"))->Fill(vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); if (vTracksITS567perColl[colIndex - 1] > 0) - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"))->Fill(vTracksITS567perColl[colIndex - 1], 1.0 * vTracksITS567perColl[colIndex] / vTracksITS567perColl[colIndex - 1]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"), vTracksITS567perColl[colIndex - 1], 1.0 * vTracksITS567perColl[colIndex] / vTracksITS567perColl[colIndex - 1]); } else { - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"))->Fill(vTracksITS567perColl[colIndex], vTracksITS567perColl[colIndex - 1]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"), vTracksITS567perColl[colIndex], vTracksITS567perColl[colIndex - 1]); + + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_allOccup_1collPerROF"), vTracksITS567perColl[colIndex]); + if (occTracks < 500) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_lowOccup_1collPerROF"), vTracksITS567perColl[colIndex]); + else if (occTracks > 1000) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_highOccup_1collPerROF"), vTracksITS567perColl[colIndex]); + if (vTracksITS567perColl[colIndex] > 0) - histos.get(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"))->Fill(vTracksITS567perColl[colIndex], 1.0 * vTracksITS567perColl[colIndex - 1] / vTracksITS567perColl[colIndex]); + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"), vTracksITS567perColl[colIndex], 1.0 * vTracksITS567perColl[colIndex - 1] / vTracksITS567perColl[colIndex]); } } } @@ -986,93 +1123,93 @@ struct RofOccupancyQaTask { } if (vNoCollInTimeRangeNarrow[colIndex]) - histos.get(HIST("hOccupancyByFT0C_vs_ByTracks_afterNarrowDeltaTimeCut"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_afterNarrowDeltaTimeCut"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); if (vNoCollInTimeRangeStrict[colIndex]) - histos.get(HIST("hOccupancyByFT0C_vs_ByTracks_afterStrictDeltaTimeCut"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_afterStrictDeltaTimeCut"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); if (vNoHighMultCollInTimeRange[colIndex]) - histos.get(HIST("hOccupancyByFT0C_vs_ByTracks_afterStandardDeltaTimeCut"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_afterStandardDeltaTimeCut"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); if (vNoCollInVzDependentTimeRange[colIndex]) - histos.get(HIST("hOccupancyByFT0C_vs_ByTracks_afterVzDependentDeltaTimeCut"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_afterVzDependentDeltaTimeCut"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); // same-event 2D correlations: - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_vZ_TF_ROF_border_cuts"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/vZ_TF_ROF_border_cuts"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNoCollInTimeRangeNarrow[colIndex]) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_afterNarrowDeltaTimeCut"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/afterNarrowDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNoCollInTimeRangeStrict[colIndex]) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_afterStrictDeltaTimeCut"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/afterStrictDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNoHighMultCollInTimeRange[colIndex]) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_afterStandardDeltaTimeCut"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/afterStandardDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNoCollInVzDependentTimeRange[colIndex]) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_afterVzDependentDeltaTimeCut"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/afterVzDependentDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNoCollInSameRofStrict[colIndex]) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_kNoCollInRofStrict"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofStrict"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNoCollInSameRofStandard[colIndex]) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_kNoCollInRofStandard"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofStandard"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNoCollInSameRofWithCloseVz[colIndex]) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_kNoCollInRofWithCloseVz"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofWithCloseVz"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); // CROSS CHECK WITH SEL BITS: - if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_afterNarrowDeltaTimeCut"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); - if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_afterStrictDeltaTimeCut"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); - if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_afterStandardDeltaTimeCut"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); - if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_afterVzDependentDeltaTimeCut"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); - - if (col.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_kNoCollInRofStrict"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); - if (col.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_CROSSCHECK_kNoCollInRofStandard"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (col.selection_bit(kNoCollInTimeRangeNarrow)) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_afterNarrowDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (col.selection_bit(kNoCollInTimeRangeStrict)) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_afterStrictDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (col.selection_bit(kNoCollInTimeRangeStandard)) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_afterStandardDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (col.selection_bit(kNoCollInTimeRangeVzDependent)) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_afterVzDependentDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + + if (col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_kNoCollInRofStrict"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (col.selection_bit(kNoCollInRofStandard)) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/CROSSCHECK_kNoCollInRofStandard"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNumTracksITS567inFullTimeWin[colIndex] < 2000) { - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_occupBelow2000"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvFT0C_occupBelow2000"))->Fill(vAmpFT0CperColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/occupBelow2000"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/hThisEvITSTPCTr_vs_ThisEvFT0C_occupBelow2000"), vAmpFT0CperColl[colIndex], vTracksITSTPCperColl[colIndex]); } if (vNoCollInTimeRangeNarrow[colIndex] && vNoHighMultCollInTimeRange[colIndex] && vNoCollInSameRofStandard[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) { - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_NarrowDeltaCut_StdTimeAndRofCuts"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/NarrowDeltaCut_StdTimeAndRofCuts"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); if (vNumTracksITS567inFullTimeWin[colIndex] < 2000) { - histos.get(HIST("hThisEvITSTr_vs_ThisEvFT0C_NarrowDeltaCut_StdTimeAndRofCuts_occupBelow2000"))->Fill(vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvFT0C_NarrowDeltaCut_StdTimeAndRofCuts_occupBelow2000"))->Fill(vAmpFT0CperColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/NarrowDeltaCut_StdTimeAndRofCuts_occupBelow2000"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/hThisEvITSTPCTr_vs_ThisEvFT0C_NarrowDeltaCut_StdTimeAndRofCuts_occupBelow2000"), vAmpFT0CperColl[colIndex], vTracksITSTPCperColl[colIndex]); } } // now ITSTPC vs ITS tr (this event) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_vZ_TF_ROF_border_cuts"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/vZ_TF_ROF_border_cuts"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNoCollInTimeRangeNarrow[colIndex]) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_afterNarrowDeltaTimeCut"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/afterNarrowDeltaTimeCut"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNoCollInTimeRangeStrict[colIndex]) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_afterStrictDeltaTimeCut"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/afterStrictDeltaTimeCut"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNoHighMultCollInTimeRange[colIndex]) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_afterStandardDeltaTimeCut"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/afterStandardDeltaTimeCut"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNoCollInVzDependentTimeRange[colIndex]) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_afterVzDependentDeltaTimeCut"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/afterVzDependentDeltaTimeCut"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNoCollInSameRofStrict[colIndex]) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_kNoCollInRofStrict"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofStrict"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNoCollInSameRofStandard[colIndex]) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_kNoCollInRofStandard"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofStandard"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNoCollInSameRofWithCloseVz[colIndex]) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_kNoCollInRofWithCloseVz"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofWithCloseVz"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNumTracksITS567inFullTimeWin[colIndex] < 2000) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_occupBelow2000"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/occupBelow2000"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNoCollInTimeRangeNarrow[colIndex] && vNoHighMultCollInTimeRange[colIndex] && vNoCollInSameRofStandard[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) { - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_NarrowDeltaCut_StdTimeAndRofCuts"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/NarrowDeltaCut_StdTimeAndRofCuts"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); if (vNumTracksITS567inFullTimeWin[colIndex] < 2000) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_occupBelow2000_NarrowDeltaCut_StdTimeAndRofCuts"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/occupBelow2000_NarrowDeltaCut_StdTimeAndRofCuts"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); } if (vNoCollInTimeRangeStrict[colIndex] && vNoCollInSameRofStrict[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) { if (vNumTracksITS567inFullTimeWin[colIndex] < 2000) - histos.get(HIST("hThisEvITSTPCTr_vs_ThisEvITStr_occupBelow2000_StrictDeltaTimeCutAndRofCuts"))->Fill(vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/occupBelow2000_StrictDeltaTimeCutAndRofCuts"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); } // vZ bins to tune vZthresh cut @@ -1080,8 +1217,8 @@ struct RofOccupancyQaTask { for (int i = 0; i < 200; i++) { if (fabs(col.posZ()) < 8 && !vArrNoCollInSameRofWithCloseVz[colIndex][i]) { - histos.get(HIST("hThisEvITStr_vs_vZcut"))->Fill(0.025 + 0.05 * i, vTracksITS567perColl[colIndex]); - histos.get(HIST("hThisEvITSTPCtr_vs_vZcut"))->Fill(0.025 + 0.05 * i, vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hThisEvITStr_vs_vZcut"), 0.025 + 0.05 * i, vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCtr_vs_vZcut"), 0.025 + 0.05 * i, vTracksITSTPCperColl[colIndex]); } } } @@ -1092,134 +1229,143 @@ struct RofOccupancyQaTask { if (vAmpFT0CperColl[colIndex] > 0) { // 100) { if (vNoCollInTimeRangeNarrow[colIndex]) { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyInROF"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyInROF"), vNumTracksITS567inROF[colIndex], vTracksITSTPCperColl[colIndex]); if (vNumTracksITS567inROF[colIndex] > 0) { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_HasNeighbours"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours"))->Fill(vSumAmpFT0CinROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_HasNeighbours"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours"))->Fill(vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); } if (vNumCollinROF[colIndex] == 2 && vNumCollinROFinVz10[colIndex] == 2 && vInROFcollIndex[colIndex] == 1) { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvFT0C_vs_occupancyFT0CInROF_2coll"))->Fill(vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvFT0C_vs_occupancyFT0CInROF_2coll"), vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); if (vNumTracksITS567inROF[colIndex] > vTracksITS567perColl[colIndex]) { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); if (vNumTracksITS567inROF[colIndex] > 0) - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"))->Fill(vNumTracksITS567inROF[colIndex], 1.0 * vTracksITS567perColl[colIndex] / vNumTracksITS567inROF[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"), vNumTracksITS567inROF[colIndex], 1.0 * vTracksITS567perColl[colIndex] / vNumTracksITS567inROF[colIndex]); } else { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"))->Fill(vTracksITS567perColl[colIndex], vNumTracksITS567inROF[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"), vTracksITS567perColl[colIndex], vNumTracksITS567inROF[colIndex]); if (vTracksITS567perColl[colIndex] > 0) - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"))->Fill(vTracksITS567perColl[colIndex], 1.0 * vNumTracksITS567inROF[colIndex] / vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"), vTracksITS567perColl[colIndex], 1.0 * vNumTracksITS567inROF[colIndex] / vTracksITS567perColl[colIndex]); } + + // the sum of v1 and v2: + if (vSumAmpFT0CinROF[colIndex] > 4000 && vAmpFT0CperColl[colIndex] > 4000) + histos.fill(HIST("afterNarrowDeltaTimeCut/hSum_2coll_withFT0above4000_inROF"), vTracksITS567perColl[colIndex] + vNumTracksITS567inROF[colIndex]); } // compare with previous ROF if (colIndex - 1 >= 0) { if (vNumCollinROF[colIndex] == 1 && vNumCollinROFinVz10[colIndex] == 1 && vInROFcollIndex[colIndex] == 0 && vNumCollinROF[colIndex - 1] == 1 && vNumCollinROFinVz10[colIndex - 1] == 1 && vInROFcollIndex[colIndex - 1] == 0) { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInAnotherEarlierROF_1collPerROF"))->Fill(vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInAnotherEarlierROF_1collPerROF"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); if (vROFidThisColl[colIndex] == vROFidThisColl[colIndex - 1] + 1) // one ROF right after the previous { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF"))->Fill(vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); if (vTracksITS567perColl[colIndex - 1] > vTracksITS567perColl[colIndex]) { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"))->Fill(vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); if (vTracksITS567perColl[colIndex - 1] > 0) - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"))->Fill(vTracksITS567perColl[colIndex - 1], 1.0 * vTracksITS567perColl[colIndex] / vTracksITS567perColl[colIndex - 1]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"), vTracksITS567perColl[colIndex - 1], 1.0 * vTracksITS567perColl[colIndex] / vTracksITS567perColl[colIndex - 1]); } else { - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"))->Fill(vTracksITS567perColl[colIndex], vTracksITS567perColl[colIndex - 1]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"), vTracksITS567perColl[colIndex], vTracksITS567perColl[colIndex - 1]); if (vTracksITS567perColl[colIndex] > 0) - histos.get(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"))->Fill(vTracksITS567perColl[colIndex], 1.0 * vTracksITS567perColl[colIndex - 1] / vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"), vTracksITS567perColl[colIndex], 1.0 * vTracksITS567perColl[colIndex - 1] / vTracksITS567perColl[colIndex]); } + // the sum of v1 and v2: + if (vAmpFT0CperColl[colIndex] > 4000 && vAmpFT0CperColl[colIndex - 1] > 4000) + histos.fill(HIST("afterNarrowDeltaTimeCut/hSum_2coll_withFT0above4000_thisROFprevROF"), vTracksITS567perColl[colIndex] + vTracksITS567perColl[colIndex - 1]); + } else if (vROFidThisColl[colIndex] == vROFidThisColl[colIndex - 1] + 2) { + // ROF vs ROF-2 + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPrevPrevROF_1collPerROF"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + if (vAmpFT0CperColl[colIndex] > 4000 && vAmpFT0CperColl[colIndex - 1] > 4000) + histos.fill(HIST("afterNarrowDeltaTimeCut/hSum_2coll_withFT0above4000_thisROFprevPrevROF"), vTracksITS567perColl[colIndex] + vTracksITS567perColl[colIndex - 1]); + } else { + // ROF is earlier than previous + // the sum of v1 and v2: + if (vAmpFT0CperColl[colIndex] > 4000 && vAmpFT0CperColl[colIndex - 1] > 4000) + histos.fill(HIST("afterNarrowDeltaTimeCut/hSum_2coll_withFT0above4000_thisROFearlierThanPrevPrevROF"), vTracksITS567perColl[colIndex] + vTracksITS567perColl[colIndex - 1]); } } } } if (vNoCollInTimeRangeStrict[colIndex]) { - histos.get(HIST("afterStrictDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterStrictDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("afterStrictDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterStrictDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterStrictDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterStrictDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterStrictDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterStrictDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); } if (vNoHighMultCollInTimeRange[colIndex]) { - histos.get(HIST("afterStandardDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterStandardDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("afterStandardDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterStandardDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterStandardDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterStandardDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterStandardDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterStandardDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); } if (vNoCollInVzDependentTimeRange[colIndex]) { - histos.get(HIST("afterVzDependentDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterVzDependentDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("afterVzDependentDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("afterVzDependentDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterVzDependentDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterVzDependentDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("afterVzDependentDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterVzDependentDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); } if (vNoCollInSameRofStrict[colIndex]) { - histos.get(HIST("kNoCollInRofStrict/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofStrict/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("kNoCollInRofStrict/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofStrict/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("kNoCollInRofStrict/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofStrict/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("kNoCollInRofStrict/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofStrict/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); } if (vNoCollInSameRofStandard[colIndex]) { - histos.get(HIST("kNoCollInRofStandard/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofStandard/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("kNoCollInRofStandard/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofStandard/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("kNoCollInRofStandard/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofStandard/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("kNoCollInRofStandard/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofStandard/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); } if (vNoCollInSameRofWithCloseVz[colIndex]) { - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); if (vNumTracksITS567inROF[colIndex] > 0) { - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyInROF_HasNeighbours"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours"))->Fill(vSumAmpFT0CinROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyInROF_HasNeighbours"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours"))->Fill(vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); } if (vNumCollinROF[colIndex] == 2 && vNumCollinROFinVz10[colIndex] == 2 && vInROFcollIndex[colIndex] == 1) { - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyInROF_2coll"))->Fill(vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("kNoCollInRofWithCloseVz/hThisEvFT0C_vs_occupancyFT0CInROF_2coll"))->Fill(vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyInROF_2coll"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvFT0C_vs_occupancyFT0CInROF_2coll"), vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); } } if (vNoCollInTimeRangeNarrow[colIndex] && vNoHighMultCollInTimeRange[colIndex] && vNoCollInSameRofStandard[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) { - histos.get(HIST("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTPCTr_vs_occupancyByFT0C"))->Fill(vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); - histos.get(HIST("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); - histos.get(HIST("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTPCTr_vs_occupancyByTracks"))->Fill(vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTPCTr_vs_occupancyByFT0C"), vSumAmpFT0CinFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTPCTr_vs_occupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex], vTracksITSTPCperColl[colIndex]); } } } } - - // int bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF; - - // evsel(alias, selection, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, bcInTF, - // vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex], vNumTracksITS567inROF[colIndex]); } } - PROCESS_SWITCH(RofOccupancyQaTask, processRun3, "Process Run3 event selection", true); + PROCESS_SWITCH(RofOccupancyQaTask, processRun3, "Process Run3 ROF occupancy QA", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - // Parse the metadata - metadataInfo.initMetadata(cfgc); - return WorkflowSpec{ adaptAnalysisTask(cfgc)}; } diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx index 00423aff287..c5a6b9d0597 100644 --- a/DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx +++ b/DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx @@ -52,7 +52,7 @@ DECLARE_SOA_COLUMN(Nphotons, nphotons, float); DECLARE_SOA_COLUMN(ChargeMIP, chargeMIP, float); DECLARE_SOA_COLUMN(ClusterSize, clustersize, float); DECLARE_SOA_COLUMN(Chamber, chamber, float); -DECLARE_SOA_COLUMN(Photons_charge, photons_charge, float); +DECLARE_SOA_COLUMN(Photons_charge, photons_charge, float[10]); DECLARE_SOA_COLUMN(EtaTrack, etatrack, float); DECLARE_SOA_COLUMN(PhiTrack, phitrack, float); @@ -116,11 +116,17 @@ struct pidHmpidAnalysis { continue; } + float hmpidPhotsCharge2[10]; + + for (int i = 0; i < 10; i++) { + hmpidPhotsCharge2[i] = t.hmpidPhotsCharge()[i]; + } + /////FILL TABLE HMPID_analysis(t.hmpidSignal(), t.track_as().phi(), t.track_as().eta(), t.hmpidMom(), track.p(), t.hmpidXTrack(), t.hmpidYTrack(), t.hmpidXMip(), t.hmpidYMip(), t.hmpidNPhotons(), t.hmpidQMip(), (t.hmpidClusSize() % 1000000) / 1000, t.hmpidClusSize() / 1000000, - *t.hmpidPhotsCharge(), track.eta(), track.phi(), track.itsNCls(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), + hmpidPhotsCharge2, track.eta(), track.phi(), track.itsNCls(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), track.tpcChi2NCl(), track.itsChi2NCl(), track.dcaXY(), track.dcaZ(), track.tpcNSigmaPi(), track.tofNSigmaPi(), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.tpcNSigmaPr(), track.tofNSigmaPr(), track.tpcNSigmaDe(), track.tofNSigmaDe()); diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx index e4a7b370f55..78aeb2be252 100644 --- a/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx +++ b/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx @@ -52,7 +52,7 @@ DECLARE_SOA_COLUMN(Nphotons, nphotons, float); DECLARE_SOA_COLUMN(ChargeMIP, chargeMIP, float); DECLARE_SOA_COLUMN(ClusterSize, clustersize, float); DECLARE_SOA_COLUMN(Chamber, chamber, float); -DECLARE_SOA_COLUMN(Photons_charge, photons_charge, float); +DECLARE_SOA_COLUMN(Photons_charge, photons_charge, float[10]); DECLARE_SOA_COLUMN(EtaTrack, etatrack, float); DECLARE_SOA_COLUMN(PhiTrack, phitrack, float); @@ -145,10 +145,16 @@ struct pidHmpidQa { continue; } + float hmpidPhotsCharge2[10]; + + for (int i = 0; i < 10; i++) { + hmpidPhotsCharge2[i] = t.hmpidPhotsCharge()[i]; + } + HMPID_analysis(t.hmpidSignal(), t.track_as().phi(), t.track_as().eta(), t.hmpidMom(), track.px(), track.py(), track.pz(), t.hmpidXTrack(), t.hmpidYTrack(), t.hmpidXMip(), t.hmpidYMip(), t.hmpidNPhotons(), t.hmpidQMip(), (t.hmpidClusSize() % 1000000) / 1000, t.hmpidClusSize() / 1000000, - *t.hmpidPhotsCharge(), track.eta(), track.phi(), track.itsNCls(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), + hmpidPhotsCharge2, track.eta(), track.phi(), track.itsNCls(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), track.tpcChi2NCl(), track.itsChi2NCl(), track.dcaXY(), track.dcaZ()); histos.fill(HIST("hmpidSignal"), t.hmpidSignal()); diff --git a/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOF.cxx b/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOF.cxx index 8c1aeca6483..24e5a09a21a 100644 --- a/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOF.cxx +++ b/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOF.cxx @@ -137,6 +137,8 @@ struct tofPidQa { Configurable splitSignalPerCharge{"splitSignalPerCharge", true, "Split the signal per charge (reduces memory footprint if off)"}; Configurable enableVsMomentumHistograms{"enableVsMomentumHistograms", false, "Enables plots vs momentum instead of just pT (reduces memory footprint if off)"}; Configurable requireGoodMatchTracks{"requireGoodMatchTracks", false, "Require good match tracks"}; + Configurable pvContributorsMin{"pvContributorsMin", -10, "Minimum pvContributors"}; + Configurable pvContributorsMax{"pvContributorsMax", 10000, "Maximum pvContributors"}; template void initPerParticle(const AxisSpec& pAxis, @@ -260,6 +262,7 @@ struct tofPidQa { { const AxisSpec multAxis{100, 0, 100, "TOF multiplicity"}; const AxisSpec vtxZAxis{100, -20, 20, "Vtx_{z} (cm)"}; + const AxisSpec contributorsAxis{100, 0, 1000, "PV contributors"}; const AxisSpec etaAxis{etaBins, "#it{#eta}"}; const AxisSpec phiAxis{phiBins, "#it{#phi}"}; const AxisSpec colTimeAxis{100, -2000, 2000, "Collision time (ps)"}; @@ -282,6 +285,8 @@ struct tofPidQa { h->GetXaxis()->SetBinLabel(1, "Events read"); h->GetXaxis()->SetBinLabel(2, "Passed ev. sel."); h->GetXaxis()->SetBinLabel(3, "Passed vtx Z"); + h->GetXaxis()->SetBinLabel(4, Form("Passed pvContributorsMin %f", pvContributorsMin.value)); + h->GetXaxis()->SetBinLabel(5, Form("Passed pvContributorsMax %f", pvContributorsMax.value)); h = histos.add("event/trackselection", "", kTH1D, {{10, 0.5, 10.5, "Selection passed"}}); h->GetXaxis()->SetBinLabel(1, "Tracks read"); @@ -291,6 +296,7 @@ struct tofPidQa { h->GetXaxis()->SetBinLabel(5, "hasTOF"); h->GetXaxis()->SetBinLabel(6, "goodTOFMatch"); + histos.add("event/pvcontributors", "", kTH1D, {contributorsAxis}); histos.add("event/vertexz", "", kTH1D, {vtxZAxis}); h = histos.add("event/particlehypo", "", kTH1D, {{10, 0, 10, "PID in tracking"}}); for (int i = 0; i < 9; i++) { @@ -375,11 +381,31 @@ struct tofPidQa { } } } - if (abs(collision.posZ()) > 10.f) { + if (std::abs(collision.posZ()) > 10.f) { return false; } + // Count the number of contributors + int pvContributors = 0; + for (const auto& trk : tracks) { + if (trk.isPVContributor()) { + pvContributors++; + } + } + histos.fill(HIST("event/pvcontributors"), pvContributors); + if (pvContributors < pvContributorsMin) { + return false; + } + if constexpr (fillHistograms) { + histos.fill(HIST("event/evsel"), 4); + } + if (pvContributors > pvContributorsMax) { + return false; + } + if constexpr (fillHistograms) { + histos.fill(HIST("event/evsel"), 5); + } if constexpr (fillHistograms) { - histos.fill(HIST("event/evsel"), 3); + histos.fill(HIST("event/evsel"), 6); histos.fill(HIST("event/vertexz"), collision.posZ()); histos.fill(HIST("event/evtime/colltime"), collision.collisionTime() * 1000.f); @@ -505,7 +531,7 @@ struct tofPidQa { } if (applyRapidityCut) { - if (abs(t.rapidity(PID::getMass(id))) > 0.5) { + if (std::abs(t.rapidity(PID::getMass(id))) > 0.5) { continue; } } diff --git a/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx b/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx index e5ca7df21cc..204bff837fb 100644 --- a/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx +++ b/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx @@ -335,17 +335,17 @@ struct tofPidCollisionTimeQa { histos.fill(HIST("trackSelection"), 4.5f); // Recompute quantities with event times - const float& betaTOF = trk.evTimeTOFMult() > 1 ? o2::pid::tof::Beta::GetBeta(trk, trk.evTimeTOF()) : 999.f; - const float& betaT0A = collision.t0ACorrectedValid() ? o2::pid::tof::Beta::GetBeta(trk, collision.t0ACorrected() * 1000.f) : 999.f; - const float& betaT0C = collision.t0CCorrectedValid() ? o2::pid::tof::Beta::GetBeta(trk, collision.t0CCorrected() * 1000.f) : 999.f; - const float& betaT0AC = collision.t0ACValid() ? o2::pid::tof::Beta::GetBeta(trk, collision.t0AC() * 1000.f) : 999.f; + const float& betaTOF = trk.evTimeTOFMult() > 1 ? o2::pid::tof::Beta::GetBeta(trk, trk.evTimeTOF()) : 999.f; + const float& betaT0A = collision.t0ACorrectedValid() ? o2::pid::tof::Beta::GetBeta(trk, collision.t0ACorrected() * 1000.f) : 999.f; + const float& betaT0C = collision.t0CCorrectedValid() ? o2::pid::tof::Beta::GetBeta(trk, collision.t0CCorrected() * 1000.f) : 999.f; + const float& betaT0AC = collision.t0ACValid() ? o2::pid::tof::Beta::GetBeta(trk, collision.t0AC() * 1000.f) : 999.f; - const float& massTOF = trk.evTimeTOFMult() > 1 ? o2::pid::tof::TOFMass::GetTOFMass(trk, betaTOF) : 999.f; - const float& massT0A = collision.t0ACorrectedValid() ? o2::pid::tof::TOFMass::GetTOFMass(trk, betaT0A) : 999.f; - const float& massT0C = collision.t0CCorrectedValid() ? o2::pid::tof::TOFMass::GetTOFMass(trk, betaT0C) : 999.f; - const float& massT0AC = collision.t0ACValid() ? o2::pid::tof::TOFMass::GetTOFMass(trk, betaT0AC) : 999.f; + const float& massTOF = trk.evTimeTOFMult() > 1 ? o2::pid::tof::TOFMass::GetTOFMass(trk, betaTOF) : 999.f; + const float& massT0A = collision.t0ACorrectedValid() ? o2::pid::tof::TOFMass::GetTOFMass(trk, betaT0A) : 999.f; + const float& massT0C = collision.t0CCorrectedValid() ? o2::pid::tof::TOFMass::GetTOFMass(trk, betaT0C) : 999.f; + const float& massT0AC = collision.t0ACValid() ? o2::pid::tof::TOFMass::GetTOFMass(trk, betaT0AC) : 999.f; - const float& deltaPi = trk.tofSignal() - trk.tofEvTime() - o2::pid::tof::ExpTimes::GetExpectedSignal(trk); + const float& deltaPi = trk.tofSignal() - trk.tofEvTime() - trk.tofExpTimePi(); histos.fill(HIST("tofbeta/inclusive"), trk.p(), trk.beta()); histos.fill(HIST("tofmass/inclusive"), trk.p(), trk.mass()); @@ -367,6 +367,10 @@ struct tofPidCollisionTimeQa { histos.fill(HIST("tofmass/EvTimeT0COnly"), trk.p(), massT0C); histos.fill(HIST("tofmass/EvTimeT0ACOnly"), trk.p(), massT0AC); + if (trk.p() > minPReso && trk.p() < maxPReso) { + histos.fill(HIST("deltaVsMult/pi"), trk.evTimeTOFMult(), deltaPi); + histos.fill(HIST("deltaVsReso/pi"), trk.evTimeTOFMult(), deltaPi); + } if (enableDebug) { histos.fill(HIST("withtof/p"), trk.p()); @@ -375,10 +379,6 @@ struct tofPidCollisionTimeQa { histos.fill(HIST("withtof/tofSignal"), trk.tofSignal()); histos.fill(HIST("withtof/beta"), trk.p(), trk.beta()); histos.fill(HIST("withtof/delta"), trk.p(), deltaPi); - if (trk.p() > minPReso && trk.p() < maxPReso) { - histos.fill(HIST("deltaVsMult/pi"), trk.evTimeTOFMult(), deltaPi); - histos.fill(HIST("deltaVsReso/pi"), trk.evTimeTOFMult(), deltaPi); - } histos.fill(HIST("withtof/expP"), trk.p(), trk.tofExpMom()); histos.fill(HIST("withtof/mass"), trk.mass()); diff --git a/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCSignal.cxx b/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCSignal.cxx index bc80df4b71a..837435a038e 100644 --- a/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCSignal.cxx +++ b/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCSignal.cxx @@ -171,7 +171,7 @@ struct tpcPidQaSignal { return false; } histos.fill(HIST("trksel"), 6); - if (pidInTracking != -1 && (track.pidForTracking() != std::abs(pidInTracking))) { + if (pidInTracking != -1 && (track.pidForTracking() != static_cast(std::abs(pidInTracking)))) { return false; } histos.fill(HIST("trksel"), 7); diff --git a/DPG/Tasks/AOTTrack/qaEfficiency.cxx b/DPG/Tasks/AOTTrack/qaEfficiency.cxx index 0e1c023fc6e..991266fe14b 100644 --- a/DPG/Tasks/AOTTrack/qaEfficiency.cxx +++ b/DPG/Tasks/AOTTrack/qaEfficiency.cxx @@ -17,6 +17,9 @@ /// // O2 includes +#include +#include + #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" @@ -24,6 +27,7 @@ #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/Track.h" #include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -35,6 +39,7 @@ #include "TEfficiency.h" #include "THashList.h" +using namespace o2; using namespace o2::framework; // Indices for the track cut histogram @@ -72,6 +77,7 @@ static constexpr int PDGs[nParticles] = {11, 13, 211, 321, 2212, 1000010020, 100 -11, -13, -211, -321, -2212, -1000010020, -1000010030, -1000020030, -1000020040}; // Histograms +std::shared_ptr hPtmotherGenerated; // histogram to store pT of Xi and Lambda // Pt std::array, nParticles> hPtIts; @@ -100,6 +106,7 @@ std::array, nParticles> hPtItsTpcStr; std::array, nParticles> hPtTrkItsTpcStr; std::array, nParticles> hPtItsTpcTofStr; std::array, nParticles> hPtGeneratedStr; +std::array, nParticles> hdecaylengthmother; // histogram to store decaylength of mother // Pt for secondaries from material std::array, nParticles> hPtItsTpcMat; @@ -213,6 +220,8 @@ struct QaEfficiency { ConfigurableAxis etaBins{"etaBins", {200, -3.f, 3.f}, "Eta binning"}; ConfigurableAxis phiBins{"phiBins", {200, 0.f, 6.284f}, "Phi binning"}; ConfigurableAxis yBins{"yBins", {200, -0.5f, 0.5f}, "Y binning"}; + ConfigurableAxis occBins{"occBins", {100, 0.f, 14000.f}, "Occupancy binning"}; + ConfigurableAxis centBins{"centBins", {110, 0.f, 110.f}, "Centrality binning"}; ConfigurableAxis radiusBins{"radiusBins", {200, 0.f, 100.f}, "Radius binning"}; // Task configuration Configurable makeEff{"make-eff", false, "Flag to produce the efficiency with TEfficiency"}; @@ -241,11 +250,14 @@ struct QaEfficiency { Configurable minDcaZ{"minDcaZ", -2.f, "Additional cut on the minimum abs value of the DCA z"}; Configurable minDcaXY{"minDcaXY", -1.f, "Additional cut on the minimum abs value of the DCA xy"}; + Configurable doOccupancy{"doOccupancyStudy", false, "Flag to store Occupancy-related information"}; + Configurable useFT0OccEstimator{"useFT0OccEstimator", false, "Flag to adopt FT0c to estimate occupancy instead of ITS"}; + // Output objects for TEfficiency OutputObj listEfficiencyMC{"EfficiencyMC"}; OutputObj listEfficiencyData{"EfficiencyData"}; - using CollisionCandidates = o2::soa::Join; + using CollisionCandidates = o2::soa::Join; using CollisionCandidatesMC = o2::soa::Join; using TrackCandidates = o2::soa::Join; using TrackCandidatesMC = o2::soa::Join; @@ -281,6 +293,7 @@ struct QaEfficiency { LOG(fatal) << "Can't interpret pdgSign " << pdgSign; } + AxisSpec axisDecayLength{100, 0.0, 10.0, "Decay Length (cm)"}; AxisSpec axisPt{ptBins, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec axisP{ptBins, "#it{p} (GeV/#it{c})"}; if (logPt) { @@ -291,6 +304,7 @@ struct QaEfficiency { const AxisSpec axisY{yBins, "#it{y}"}; const AxisSpec axisPhi{phiBins, "#it{#varphi} (rad)"}; const AxisSpec axisRadius{radiusBins, "Radius (cm)"}; + const AxisSpec axisOcc{occBins, "Occupancy"}; const char* partName = particleName(pdgSign, id); LOG(info) << "Preparing histograms for particle: " << partName << " pdgSign " << pdgSign; @@ -352,6 +366,7 @@ struct QaEfficiency { hPtTrkItsTpcStr[histogramIndex] = histos.add(Form("MC/pdg%i/pt/str/trk/its_tpc", PDGs[histogramIndex]), "ITS-TPC tracks (reco from weak decays) " + tagPt, kTH1D, {axisPt}); hPtItsTpcTofStr[histogramIndex] = histos.add(Form("MC/pdg%i/pt/str/its_tpc_tof", PDGs[histogramIndex]), "ITS-TPC-TOF tracks (from weak decays) " + tagPt, kTH1D, {axisPt}); hPtGeneratedStr[histogramIndex] = histos.add(Form("MC/pdg%i/pt/str/generated", PDGs[histogramIndex]), "Generated (from weak decays) " + tagPt, kTH1D, {axisPt}); + hdecaylengthmother[histogramIndex] = histos.add(Form("MC/pdg%i/pt/str/decayLength", PDGs[histogramIndex]), "Decay Length of mother particle" + tagPt, kTH1D, {axisPt}); // Ter hPtItsTpcTer[histogramIndex] = histos.add(Form("MC/pdg%i/pt/ter/its_tpc", PDGs[histogramIndex]), "ITS-TPC tracks (from secondary weak decays) " + tagPt, kTH1D, {axisPt}); @@ -630,6 +645,27 @@ struct QaEfficiency { listEfficiencyMC.setObject(new THashList); + if (doOccupancy) { + const AxisSpec axisPt{ptBins, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisOcc{occBins, "Occupancy"}; + const AxisSpec axisCent{centBins, "Centrality"}; + + histos.add("MC/occ_cent/gen/pos", "Generated Positive ", kTH3D, {axisOcc, axisCent, axisPt}); + histos.add("MC/occ_cent/gen/neg", "Generated Negative ", kTH3D, {axisOcc, axisCent, axisPt}); + + histos.add("MC/occ_cent/reco/pos/its_tpc_tof", "ITS-TPC-TOF Positive ", kTH3D, {axisOcc, axisCent, axisPt}); + histos.add("MC/occ_cent/reco/neg/its_tpc_tof", "ITS-TPC-TOF Negative ", kTH3D, {axisOcc, axisCent, axisPt}); + + histos.add("MC/occ_cent/reco/pos/its_tpc", "ITS-TPC Positive ", kTH3D, {axisOcc, axisCent, axisPt}); + histos.add("MC/occ_cent/reco/neg/its_tpc", "ITS-TPC Negative ", kTH3D, {axisOcc, axisCent, axisPt}); + + histos.add("MC/occ_cent/reco/pos/its", "ITS Positive ", kTH3D, {axisOcc, axisCent, axisPt}); + histos.add("MC/occ_cent/reco/neg/its", "ITS Negative ", kTH3D, {axisOcc, axisCent, axisPt}); + } + + AxisSpec axisPtMother{ptBins, "#it{p}_{T} (GeV/#it{c})"}; + hPtmotherGenerated = histos.add("MC/mother/pt/generated", "Generated pT of mother Lambda or Xi", kTH1D, {axisPtMother}); + static_for<0, 1>([&](auto pdgSign) { makeMCHistograms(doEl); makeMCHistograms(doMu); @@ -734,6 +770,8 @@ struct QaEfficiency { ptMin, ptMax, phiMin, phiMax); const AxisSpec axisEta{etaBins, "#it{#eta}"}; + const AxisSpec axisOcc{occBins, "Occupancy"}; + const AxisSpec axisCent{centBins, "Centrality"}; const TString tagPhi = Form("#it{#eta} [%.2f,%.2f] #it{p}_{T} [%.2f,%.2f]", etaMin, etaMax, @@ -745,6 +783,20 @@ struct QaEfficiency { histos.add("Data/trackLength", "Track length;Track length (cm)", kTH1D, {{2000, -1000, 1000}}); + if (doOccupancy) { + histos.add("Data/occ_cent/pos/its_tpc_tof", "ITS-TPC-TOF Positive ", kTH3D, {axisOcc, axisCent, axisPt}); + histos.add("Data/occ_cent/neg/its_tpc_tof", "ITS-TPC-TOF Negative ", kTH3D, {axisOcc, axisCent, axisPt}); + + histos.add("Data/occ_cent/pos/its_tpc", "ITS-TPC Positive ", kTH3D, {axisOcc, axisCent, axisPt}); + histos.add("Data/occ_cent/neg/its_tpc", "ITS-TPC Negative ", kTH3D, {axisOcc, axisCent, axisPt}); + + histos.add("Data/occ_cent/pos/tpc", "TPC Positive ", kTH3D, {axisOcc, axisCent, axisPt}); + histos.add("Data/occ_cent/neg/tpc", "TPC Negative ", kTH3D, {axisOcc, axisCent, axisPt}); + + histos.add("Data/occ_cent/pos/its", "ITS Positive ", kTH3D, {axisOcc, axisCent, axisPt}); + histos.add("Data/occ_cent/neg/its", "ITS Negative ", kTH3D, {axisOcc, axisCent, axisPt}); + } + // ITS-TPC-TOF histos.add("Data/pos/pt/its_tpc_tof", "ITS-TPC-TOF Positive " + tagPt, kTH1D, {axisPt}); histos.add("Data/neg/pt/its_tpc_tof", "ITS-TPC-TOF Negative " + tagPt, kTH1D, {axisPt}); @@ -1111,7 +1163,9 @@ struct QaEfficiency { break; } if (motherIsAccepted) { - break; + // Calculate the decay length + double decayLength = std::sqrt(std::pow(mother.vx() - mother.mcCollision().posX(), 2) + std::pow(mother.vy() - mother.mcCollision().posY(), 2) + std::pow(mother.vz() - mother.mcCollision().posZ(), 2)); + hdecaylengthmother[histogramIndex]->Fill(decayLength); } } } @@ -1200,19 +1254,20 @@ struct QaEfficiency { } } else { if (mcParticle.getProcess() == 4) { // Particle decay - // Checking mothers bool motherIsAccepted = true; + // Check for mothers if needed if (checkForMothers.value && mothersPDGs.value.size() > 0 && mcParticle.has_mothers()) { motherIsAccepted = false; auto mothers = mcParticle.mothers_as(); + // Loop over mother particles for (const auto& mother : mothers) { for (const auto& pdgToCheck : mothersPDGs.value) { if (mother.pdgCode() == pdgToCheck) { - motherIsAccepted = true; + motherIsAccepted = true; // Mother matches the list of specified PDGs break; } if (motherIsAccepted) { - break; + hPtmotherGenerated->Fill(mother.pt()); // Fill generated pT for Lambda } } } @@ -1627,6 +1682,54 @@ struct QaEfficiency { return true; } + /// \brief Function to get MC collision occupancy + /// \param collSlice collection of reconstructed collisions + /// \return collision occupancy + template + int getOccupancyColl(CCs const& collSlice) + { + float multiplicity{0.f}; + int occupancy = 0; + for (const auto& collision : collSlice) { + float collMult{0.f}; + collMult = collision.numContrib(); + + if (collMult > multiplicity) { + if (useFT0OccEstimator) { + /// occupancy estimator (FT0c signal amplitudes in +-10us from current collision) + occupancy = collision.ft0cOccupancyInTimeRange(); + } else { + /// occupancy estimator (ITS tracks with at least 5 clusters in +-10us from current collision) + occupancy = static_cast(collision.trackOccupancyInTimeRange()); + } + multiplicity = collMult; + } + } // end loop over collisions + + return occupancy; + } + + /// \brief Function to get MC collision centrality + /// \param collSlice collection of reconstructed collisions + /// \return collision centrality + template + int getCentralityColl(CCs const& collSlice) + { + float multiplicity{0.f}; + int centrality = 0; + for (const auto& collision : collSlice) { + float collMult{0.f}; + collMult = collision.numContrib(); + + if (collMult > multiplicity) { + centrality = collision.centFT0C(); + multiplicity = collMult; + } + } // end loop over collisions + + return centrality; + } + // MC process // Single-track efficiency calculated only for MC collisions with at least 1 reco. collision SliceCache cache; @@ -1652,6 +1755,12 @@ struct QaEfficiency { if (groupedCollisions.size() < 1) { // Skipping MC events that have no reconstructed collisions continue; } + float centrality = -1.; + float occupancy = -1.; + if (doOccupancy) { + centrality = getCentralityColl(groupedCollisions); + occupancy = getOccupancyColl(groupedCollisions); + } histos.fill(HIST("MC/generatedCollisions"), 2); if (skipEventsWithoutTPCTracks) { int nTPCTracks = 0; @@ -1678,6 +1787,14 @@ struct QaEfficiency { continue; } histos.fill(HIST("MC/generatedCollisions"), 5); + if (useFT0OccEstimator) { + /// occupancy estimator (FT0c signal amplitudes in +-10us from current collision) + occupancy = collision.ft0cOccupancyInTimeRange(); + } else { + /// occupancy estimator (ITS tracks with at least 5 clusters in +-10us from current collision) + occupancy = static_cast(collision.trackOccupancyInTimeRange()); + } + centrality = collision.centFT0C(); const auto groupedTracks = tracks.sliceBy(perCollision, collision.globalIndex()); @@ -1694,6 +1811,33 @@ struct QaEfficiency { continue; } + if (doOccupancy) { + float trackPt = track.pt(); + float trackSign = track.sign(); + if (trackSign > 0) { + if (passedTOF && passedTPC && passedITS) { + histos.fill(HIST("MC/occ_cent/reco/pos/its_tpc_tof"), occupancy, centrality, trackPt); + } + if (passedTPC && passedITS) { + histos.fill(HIST("MC/occ_cent/reco/pos/its_tpc"), occupancy, centrality, trackPt); + } + if (passedITS) { + histos.fill(HIST("MC/occ_cent/reco/pos/its"), occupancy, centrality, trackPt); + } + } + if (trackSign < 0) { + if (passedTOF && passedTPC && passedITS) { + histos.fill(HIST("MC/occ_cent/reco/neg/its_tpc_tof"), occupancy, centrality, trackPt); + } + if (passedTPC && passedITS) { + histos.fill(HIST("MC/occ_cent/reco/neg/its_tpc"), occupancy, centrality, trackPt); + } + if (passedITS) { + histos.fill(HIST("MC/occ_cent/reco/neg/its"), occupancy, centrality, trackPt); + } + } + } + // Filling variable histograms histos.fill(HIST("MC/trackLength"), track.length()); static_for<0, 1>([&](auto pdgSign) { @@ -1737,6 +1881,17 @@ struct QaEfficiency { continue; } + if (doOccupancy) { + float partSign = particle.pdgCode(); + float mcPartPt = particle.pt(); + if (partSign > 0) { + histos.fill(HIST("MC/occ_cent/gen/pos"), occupancy, centrality, mcPartPt); + } + if (partSign < 0) { + histos.fill(HIST("MC/occ_cent/gen/neg"), occupancy, centrality, mcPartPt); + } + } + static_for<0, 1>([&](auto pdgSign) { fillMCParticleHistograms(particle, doEl); fillMCParticleHistograms(particle, doMu); @@ -1914,76 +2069,124 @@ struct QaEfficiency { histos.fill(HIST("Data/trackLength"), track.length()); + float trackPt = track.pt(); + float trackEta = track.eta(); + float trackPhi = track.phi(); + float trackSign = track.sign(); + float occupancy{}; + float centrality{}; + if (doOccupancy) { + centrality = collision.centFT0C(); + if (useFT0OccEstimator) { + /// occupancy estimator (FT0c signal amplitudes in +-10us from current collision) + occupancy = collision.ft0cOccupancyInTimeRange(); + } else { + /// occupancy estimator (ITS tracks with at least 5 clusters in +-10us from current collision) + occupancy = static_cast(collision.trackOccupancyInTimeRange()); + } + } if (passedITS) { - if (track.sign() > 0) { - histos.fill(HIST("Data/pos/pt/its"), track.pt()); - histos.fill(HIST("Data/pos/eta/its"), track.eta()); - histos.fill(HIST("Data/pos/phi/its"), track.phi()); - histos.fill(HIST("Data/pos/etaphi/its"), track.eta(), track.phi()); + if (trackSign > 0) { + histos.fill(HIST("Data/pos/pt/its"), trackPt); + histos.fill(HIST("Data/pos/eta/its"), trackEta); + histos.fill(HIST("Data/pos/phi/its"), trackPhi); + histos.fill(HIST("Data/pos/etaphi/its"), trackEta, trackPhi); + + if (doOccupancy) { + histos.fill(HIST("Data/occ_cent/pos/its"), occupancy, centrality, trackPt); + } } else { - histos.fill(HIST("Data/neg/pt/its"), track.pt()); - histos.fill(HIST("Data/neg/eta/its"), track.eta()); - histos.fill(HIST("Data/neg/phi/its"), track.phi()); - histos.fill(HIST("Data/neg/etaphi/its"), track.eta(), track.phi()); + histos.fill(HIST("Data/neg/pt/its"), trackPt); + histos.fill(HIST("Data/neg/eta/its"), trackEta); + histos.fill(HIST("Data/neg/phi/its"), trackPhi); + histos.fill(HIST("Data/neg/etaphi/its"), trackEta, trackPhi); + + if (doOccupancy) { + histos.fill(HIST("Data/occ_cent/neg/its"), occupancy, centrality, trackPt); + } } } if (passedTPC) { - if (track.sign() > 0) { - histos.fill(HIST("Data/pos/pt/tpc"), track.pt()); - histos.fill(HIST("Data/pos/eta/tpc"), track.eta()); - histos.fill(HIST("Data/pos/phi/tpc"), track.phi()); - histos.fill(HIST("Data/pos/etaphi/tpc"), track.eta(), track.phi()); + if (trackSign > 0) { + histos.fill(HIST("Data/pos/pt/tpc"), trackPt); + histos.fill(HIST("Data/pos/eta/tpc"), trackEta); + histos.fill(HIST("Data/pos/phi/tpc"), trackPhi); + histos.fill(HIST("Data/pos/etaphi/tpc"), trackEta, trackPhi); + + if (doOccupancy) { + histos.fill(HIST("Data/occ_cent/pos/tpc"), occupancy, centrality, trackPt); + } } else { - histos.fill(HIST("Data/neg/pt/tpc"), track.pt()); - histos.fill(HIST("Data/neg/eta/tpc"), track.eta()); - histos.fill(HIST("Data/neg/phi/tpc"), track.phi()); - histos.fill(HIST("Data/neg/etaphi/tpc"), track.eta(), track.phi()); + histos.fill(HIST("Data/neg/pt/tpc"), trackPt); + histos.fill(HIST("Data/neg/eta/tpc"), trackEta); + histos.fill(HIST("Data/neg/phi/tpc"), trackPhi); + histos.fill(HIST("Data/neg/etaphi/tpc"), trackEta, trackPhi); + + if (doOccupancy) { + histos.fill(HIST("Data/occ_cent/neg/tpc"), occupancy, centrality, trackPt); + } } } if (passedITS && passedTPC) { - if (track.sign() > 0) { - histos.fill(HIST("Data/pos/pt/its_tpc"), track.pt()); - histos.fill(HIST("Data/pos/eta/its_tpc"), track.eta()); - histos.fill(HIST("Data/pos/phi/its_tpc"), track.phi()); - histos.fill(HIST("Data/pos/etaphi/its_tpc"), track.eta(), track.phi()); + if (trackSign > 0) { + histos.fill(HIST("Data/pos/pt/its_tpc"), trackPt); + histos.fill(HIST("Data/pos/eta/its_tpc"), trackEta); + histos.fill(HIST("Data/pos/phi/its_tpc"), trackPhi); + histos.fill(HIST("Data/pos/etaphi/its_tpc"), trackEta, trackPhi); + + if (doOccupancy) { + histos.fill(HIST("Data/occ_cent/pos/its_tpc"), occupancy, centrality, trackPt); + } } else { - histos.fill(HIST("Data/neg/pt/its_tpc"), track.pt()); - histos.fill(HIST("Data/neg/eta/its_tpc"), track.eta()); - histos.fill(HIST("Data/neg/phi/its_tpc"), track.phi()); - histos.fill(HIST("Data/neg/etaphi/its_tpc"), track.eta(), track.phi()); + histos.fill(HIST("Data/neg/pt/its_tpc"), trackPt); + histos.fill(HIST("Data/neg/eta/its_tpc"), trackEta); + histos.fill(HIST("Data/neg/phi/its_tpc"), trackPhi); + histos.fill(HIST("Data/neg/etaphi/its_tpc"), trackEta, trackPhi); + + if (doOccupancy) { + histos.fill(HIST("Data/occ_cent/neg/its_tpc"), occupancy, centrality, trackPt); + } } } if (passedITS && passedTPC && passedTOF) { - if (track.sign() > 0) { - histos.fill(HIST("Data/pos/pt/its_tpc_tof"), track.pt()); - histos.fill(HIST("Data/pos/eta/its_tpc_tof"), track.eta()); - histos.fill(HIST("Data/pos/phi/its_tpc_tof"), track.phi()); - histos.fill(HIST("Data/pos/etaphi/its_tpc_tof"), track.eta(), track.phi()); + if (trackSign > 0) { + histos.fill(HIST("Data/pos/pt/its_tpc_tof"), trackPt); + histos.fill(HIST("Data/pos/eta/its_tpc_tof"), trackEta); + histos.fill(HIST("Data/pos/phi/its_tpc_tof"), trackPhi); + histos.fill(HIST("Data/pos/etaphi/its_tpc_tof"), trackEta, trackPhi); + + if (doOccupancy) { + histos.fill(HIST("Data/occ_cent/pos/its_tpc_tof"), occupancy, centrality, trackPt); + } } else { - histos.fill(HIST("Data/neg/pt/its_tpc_tof"), track.pt()); - histos.fill(HIST("Data/neg/eta/its_tpc_tof"), track.eta()); - histos.fill(HIST("Data/neg/phi/its_tpc_tof"), track.phi()); - histos.fill(HIST("Data/neg/etaphi/its_tpc_tof"), track.eta(), track.phi()); + histos.fill(HIST("Data/neg/pt/its_tpc_tof"), trackPt); + histos.fill(HIST("Data/neg/eta/its_tpc_tof"), trackEta); + histos.fill(HIST("Data/neg/phi/its_tpc_tof"), trackPhi); + histos.fill(HIST("Data/neg/etaphi/its_tpc_tof"), trackEta, trackPhi); + + if (doOccupancy) { + histos.fill(HIST("Data/occ_cent/neg/its"), occupancy, centrality, trackPt); + } } } if (makeEff) { if (passedITS) { - effITSTPCMatchingVsPt->Fill(passedTPC, track.pt()); + effITSTPCMatchingVsPt->Fill(passedTPC, trackPt); } if (passedTPC) { - effTPCITSMatchingVsPt->Fill(passedITS, track.pt()); + effTPCITSMatchingVsPt->Fill(passedITS, trackPt); } if (passedITS && passedTPC) { - effTPCTOFMatchingVsPt->Fill(passedTOF, track.pt()); + effTPCTOFMatchingVsPt->Fill(passedTOF, trackPt); effTPCTOFMatchingVsP->Fill(passedTOF, track.p()); - effTPCTOFMatchingVsEta->Fill(passedTOF, track.eta()); - effTPCTOFMatchingVsPhi->Fill(passedTOF, track.phi()); - effTPCTOFMatchingVsPtVsEta->Fill(passedTOF, track.pt(), track.eta()); - effTPCTOFMatchingVsPtVsPhi->Fill(passedTOF, track.pt(), track.phi()); + effTPCTOFMatchingVsEta->Fill(passedTOF, trackEta); + effTPCTOFMatchingVsPhi->Fill(passedTOF, trackPhi); + effTPCTOFMatchingVsPtVsEta->Fill(passedTOF, trackPt, trackEta); + effTPCTOFMatchingVsPtVsPhi->Fill(passedTOF, trackPt, trackPhi); } } } diff --git a/DPG/Tasks/AOTTrack/qaEventTrack.cxx b/DPG/Tasks/AOTTrack/qaEventTrack.cxx index bfd106f4b8b..ffb64e1f9c2 100644 --- a/DPG/Tasks/AOTTrack/qaEventTrack.cxx +++ b/DPG/Tasks/AOTTrack/qaEventTrack.cxx @@ -1618,7 +1618,7 @@ void qaEventTrack::fillRecoHistogramsGroupedTracks(const C& collision, const T& sign = pdgInfo->Charge() / abs(pdgInfo->Charge()); } // resolution plots - if (doExtraPIDqa && track.pidForTracking() != std::abs(PartIdentifier)) { + if (doExtraPIDqa && track.pidForTracking() != static_cast(std::abs(PartIdentifier))) { // full eta range histos.fill(HIST("Tracks/Kine/resoPtVsptmcWrongPIDinTrk"), track.pt() - particle.pt(), particle.pt()); histos.fill(HIST("Tracks/Kine/resoPtVsptmcScaledWrongPIDinTrk"), (track.pt() - particle.pt()) / particle.pt(), particle.pt()); @@ -1651,7 +1651,7 @@ void qaEventTrack::fillRecoHistogramsGroupedTracks(const C& collision, const T& } // optionally check for PID in tracking: select tracks with correct PID in tracking - if (checkPIDforTracking && track.pidForTracking() != std::abs(PartIdentifier)) { + if (checkPIDforTracking && track.pidForTracking() != static_cast(std::abs(PartIdentifier))) { continue; } diff --git a/DPG/Tasks/AOTTrack/qaImpPar.cxx b/DPG/Tasks/AOTTrack/qaImpPar.cxx index 338f1e1c06c..fd5737ebbe8 100644 --- a/DPG/Tasks/AOTTrack/qaImpPar.cxx +++ b/DPG/Tasks/AOTTrack/qaImpPar.cxx @@ -130,7 +130,8 @@ struct QaImpactPar { ((trackSelection.node() == 2) && requireGlobalTrackWoPtEtaInFilter()) || ((trackSelection.node() == 3) && requireGlobalTrackWoDCAInFilter()) || ((trackSelection.node() == 4) && requireQualityTracksInFilter()) || - ((trackSelection.node() == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); + ((trackSelection.node() == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)) || + ((trackSelection.node() == 6) && requireTrackCutInFilter(TrackSelectionFlags::kGlobalTrackWoDCAxy)); // Pt selection Filter ptMinFilter = o2::aod::track::pt > ptMin; diff --git a/DPG/Tasks/AOTTrack/qaMatchEff.cxx b/DPG/Tasks/AOTTrack/qaMatchEff.cxx index 086b1818364..ddcdf65766e 100644 --- a/DPG/Tasks/AOTTrack/qaMatchEff.cxx +++ b/DPG/Tasks/AOTTrack/qaMatchEff.cxx @@ -31,7 +31,10 @@ #include "Framework/AnalysisTask.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" - +// +#include "string" +#include "vector" +#include "set" // namespace extConfPar { @@ -139,6 +142,7 @@ struct qaMatchEff { // Other track settings // TRD presence Configurable isTRDThere{"isTRDThere", 2, "Integer to turn the presence of TRD off, on, don't care (0,1,anything else)"}; + Configurable isTOFThere{"isTOFThere", 2, "Integer to turn the presence of TOF off, on, don't care (0,1,anything else)"}; // Configurable isitMC{"isitMC", false, "Reading MC files, data if false"}; Configurable doDebug{"doDebug", false, "Flag of debug information"}; @@ -1504,6 +1508,11 @@ struct qaMatchEff { continue; if ((isTRDThere == 0) && track.hasTRD()) continue; + // choose if we keep the track according to the TOF presence requirement + if ((isTOFThere == 1) && !track.hasTOF()) + continue; + if ((isTOFThere == 0) && track.hasTOF()) + continue; // kinematic track seletions for all tracks if (!isTrackSelectedKineCuts(track)) @@ -2363,7 +2372,7 @@ struct qaMatchEff { histos.get(HIST("data/PID/etahist_tpc_noidminus"))->Fill(track.eta()); } } // not pions, nor kaons, nor protons - } // end if DATA + } // end if DATA // if (trkWITS && isTrackSelectedITSCuts(track)) { //////////////////////////////////////////// ITS tag inside TPC tagged if constexpr (IS_MC) { //////////////////////// MC @@ -2703,7 +2712,7 @@ struct qaMatchEff { // } } } // end if ITS - } // end if TPC + } // end if TPC // // // if (trkWITS) { @@ -2830,9 +2839,9 @@ struct qaMatchEff { histos.get(HIST("data/etahist_tpcits_pos"))->Fill(track.eta()); } } // end if ITS - } // end if TPC - // - } // end positive + } // end if TPC + // + } // end positive // // negative only if (track.signed1Pt() < 0) { @@ -2857,9 +2866,9 @@ struct qaMatchEff { histos.get(HIST("data/etahist_tpcits_neg"))->Fill(track.eta()); } } // end if ITS - } // end if TPC - // - } // end negative + } // end if TPC + // + } // end negative if constexpr (IS_MC) { // MC auto mcpart = track.mcParticle(); @@ -2883,7 +2892,7 @@ struct qaMatchEff { histos.get(HIST("MC/primsec/phihist_tpcits_prim"))->Fill(track.phi()); histos.get(HIST("MC/primsec/etahist_tpcits_prim"))->Fill(track.eta()); } // end if ITS - } // end if TPC + } // end if TPC // end if primaries } else if (mcpart.getProcess() == 4) { // @@ -2905,7 +2914,7 @@ struct qaMatchEff { histos.get(HIST("MC/primsec/phihist_tpcits_secd"))->Fill(track.phi()); histos.get(HIST("MC/primsec/etahist_tpcits_secd"))->Fill(track.eta()); } // end if ITS - } // end if TPC + } // end if TPC // end if secondaries from decay } else { // @@ -2927,8 +2936,8 @@ struct qaMatchEff { histos.get(HIST("MC/primsec/phihist_tpcits_secm"))->Fill(track.phi()); histos.get(HIST("MC/primsec/etahist_tpcits_secm"))->Fill(track.eta()); } // end if ITS - } // end if TPC - } // end if secondaries from material + } // end if TPC + } // end if secondaries from material // // protons only if (tpPDGCode == 2212) { @@ -2995,7 +3004,7 @@ struct qaMatchEff { histos.get(HIST("MC/PID/etahist_tpcits_prminus"))->Fill(track.eta()); } } // end if ITS - } // end if TPC + } // end if TPC } // // pions only @@ -3063,7 +3072,7 @@ struct qaMatchEff { histos.get(HIST("MC/PID/etahist_tpcits_piminus"))->Fill(track.eta()); } } // end if ITS - } // end if TPC + } // end if TPC // // only primary pions if (mcpart.isPhysicalPrimary()) { @@ -3076,7 +3085,7 @@ struct qaMatchEff { histos.get(HIST("MC/PID/phihist_tpcits_pi_prim"))->Fill(track.phi()); histos.get(HIST("MC/PID/etahist_tpcits_pi_prim"))->Fill(track.eta()); } // end if ITS - } // end if TPC + } // end if TPC // end if primaries } else if (mcpart.getProcess() == 4) { // @@ -3090,7 +3099,7 @@ struct qaMatchEff { histos.get(HIST("MC/PID/phihist_tpcits_pi_secd"))->Fill(track.phi()); histos.get(HIST("MC/PID/etahist_tpcits_pi_secd"))->Fill(track.eta()); } // end if ITS - } // end if TPC + } // end if TPC // end if secondaries from decay } else { // @@ -3104,9 +3113,9 @@ struct qaMatchEff { histos.get(HIST("MC/PID/phihist_tpcits_pi_secm"))->Fill(track.phi()); histos.get(HIST("MC/PID/etahist_tpcits_pi_secm"))->Fill(track.eta()); } // end if ITS - } // end if TPC - } // end if secondaries from material // - } // end pions only + } // end if TPC + } // end if secondaries from material // + } // end pions only // // no primary/sec-d pions if (!((tpPDGCode == 211) && (mcpart.isPhysicalPrimary()))) { @@ -3130,8 +3139,8 @@ struct qaMatchEff { histos.get(HIST("MC/PID/etahist_tpcits_nopi"))->Fill(track.eta()); histos.get(HIST("MC/PID/pdghist_num"))->Fill(pdg_fill); } // end if ITS - } // end if TPC - } // end if not prim/sec-d pi + } // end if TPC + } // end if not prim/sec-d pi // // kaons only if (tpPDGCode == 321) { @@ -3198,7 +3207,7 @@ struct qaMatchEff { histos.get(HIST("MC/PID/etahist_tpcits_kaminus"))->Fill(track.eta()); } } // end if ITS - } // end if TPC + } // end if TPC } // // pions and kaons together @@ -3212,7 +3221,7 @@ struct qaMatchEff { histos.get(HIST("MC/PID/phihist_tpcits_piK"))->Fill(track.phi()); histos.get(HIST("MC/PID/etahist_tpcits_piK"))->Fill(track.eta()); } // end if ITS - } // end if TPC + } // end if TPC } } // diff --git a/DPG/Tasks/FV0/qaFV0.cxx b/DPG/Tasks/FV0/qaFV0.cxx index 29a5b763211..295f981b0b7 100644 --- a/DPG/Tasks/FV0/qaFV0.cxx +++ b/DPG/Tasks/FV0/qaFV0.cxx @@ -394,7 +394,7 @@ struct fv0Qa { FillConditionHistograms("FV0BC", localCollisionBCFV0); - for (int i = 0; i < fv0.amplitude().size(); i++) { + for (std::size_t i = 0; i < fv0.amplitude().size(); i++) { FillConditionHistograms("FV0ChannelAmplitude", fv0.amplitude()[i]); FillConditionHistograms("FV0AmplitudePerChannel", fv0.channel()[i], fv0.amplitude()[i]); sum(totalAmplitudes, fv0.amplitude()[i]); diff --git a/DPG/Tasks/TPC/CMakeLists.txt b/DPG/Tasks/TPC/CMakeLists.txt index 65482991a4b..b8c68ba36fc 100644 --- a/DPG/Tasks/TPC/CMakeLists.txt +++ b/DPG/Tasks/TPC/CMakeLists.txt @@ -11,7 +11,7 @@ o2physics_add_dpl_workflow(pid-tpc-skimscreation SOURCES tpcSkimsTableCreator.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(pid-tpc-tree-creator-light diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx index 6dd7f5ab79b..5f1a85e607f 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx @@ -23,6 +23,8 @@ #include "TRandom3.h" /// O2 #include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" /// O2Physics @@ -33,6 +35,7 @@ #include "PWGDQ/DataModel/ReducedInfoTables.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/EventSelection.h" +#include "Common/CCDB/ctpRateFetcher.h" using namespace o2; using namespace o2::framework; @@ -42,6 +45,8 @@ using namespace o2::dataformats; struct TreeWriterTpcV0 { + Service ccdb; + using Trks = soa::Join; using Coll = soa::Join; @@ -49,7 +54,7 @@ struct TreeWriterTpcV0 { Produces rowTPCTree; /// Configurables - Configurable nSigmaTOFdautrack{"nSigmaTOFdautrack", 5., "n-sigma TOF cut on the daughter tracks. Set 0 to switch it off."}; + Configurable nSigmaTOFdautrack{"nSigmaTOFdautrack", 999., "n-sigma TOF cut on the proton daughter tracks. Set 999 to switch it off."}; Configurable nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"}; Configurable applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"}; Configurable trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; @@ -61,6 +66,9 @@ struct TreeWriterTpcV0 { Configurable downsamplingTsalisPions{"downsamplingTsalisPions", -1., "Downsampling factor to reduce the number of pions"}; Configurable downsamplingTsalisProtons{"downsamplingTsalisProtons", -1., "Downsampling factor to reduce the number of protons"}; Configurable downsamplingTsalisElectrons{"downsamplingTsalisElectrons", -1., "Downsampling factor to reduce the number of electrons"}; + Configurable maxPt4dwnsmplTsalisPions{"maxPt4dwnsmplTsalisPions", 100., "Maximum Pt for applying downsampling factor of pions"}; + Configurable maxPt4dwnsmplTsalisProtons{"maxPt4dwnsmplTsalisProtons", 100., "Maximum Pt for applying downsampling factor of protons"}; + Configurable maxPt4dwnsmplTsalisElectrons{"maxPt4dwnsmplTsalisElectrons", 100., "Maximum Pt for applying downsampling factor of electrons"}; Filter trackFilter = (trackSelection.node() == 0) || ((trackSelection.node() == 1) && requireGlobalTrackInFilter()) || @@ -69,9 +77,11 @@ struct TreeWriterTpcV0 { ((trackSelection.node() == 4) && requireQualityTracksInFilter()) || ((trackSelection.node() == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); + ctpRateFetcher mRateFetcher; + /// Funktion to fill skimmed tables template - void fillSkimmedV0Table(V0 const& v0, T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor) + void fillSkimmedV0Table(V0 const& v0, T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate) { const double ncl = track.tpcNClsFound(); @@ -79,6 +89,8 @@ struct TreeWriterTpcV0 { const double mass = o2::track::pid_constants::sMasses[id]; const double bg = p / mass; const int multTPC = collision.multTPC(); + auto trackocc = collision.trackOccupancyInTimeRange(); + auto ft0occ = collision.ft0cOccupancyInTimeRange(); const float alpha = v0.alpha(); const float qt = v0.qtarm(); @@ -87,7 +99,7 @@ struct TreeWriterTpcV0 { const float v0radius = v0.v0radius(); const float gammapsipair = v0.psipair(); - const double pseudoRndm = track.pt() * 1000. - (int64_t)(track.pt() * 1000); + const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { rowTPCTree(track.tpcSignal(), 1. / dEdxExp, @@ -110,7 +122,10 @@ struct TreeWriterTpcV0 { pT, v0radius, gammapsipair, - runnumber); + runnumber, + trackocc, + ft0occ, + hadronicRate); } }; @@ -129,11 +144,14 @@ struct TreeWriterTpcV0 { /// Random downsampling trigger function using Tsalis/Hagedorn spectra fit (sqrt(s) = 62.4 GeV to 13 TeV) /// as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf TRandom3* fRndm = new TRandom3(0); - bool downsampleTsalisCharged(double pt, double factor1Pt, double sqrts, double mass) + bool downsampleTsalisCharged(double pt, double factor1Pt, double sqrts, double mass, double maxPt) { if (factor1Pt < 0.) { return true; } + if (pt > maxPt) { + return true; + } const double prob = tsalisCharged(pt, mass, sqrts) * pt; const double probNorm = tsalisCharged(1., mass, sqrts); if ((fRndm->Rndm() * ((prob / probNorm) * pt * pt)) > factor1Pt) { @@ -161,6 +179,9 @@ struct TreeWriterTpcV0 { void init(o2::framework::InitContext&) { + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setFatalWhenNull(false); } /// Apply a track quality selection with a filter! @@ -172,6 +193,7 @@ struct TreeWriterTpcV0 { } auto bc = collision.bc_as(); const int runnumber = bc.runNumber(); + float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3; rowTPCTree.reserve(tracks.size()); @@ -181,38 +203,42 @@ struct TreeWriterTpcV0 { auto negTrack = v0.negTrack_as>(); // gamma if (static_cast(posTrack.pidbit() & (1 << 0)) && static_cast(negTrack.pidbit() & (1 << 0))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron])) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(posTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El); + if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { + fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(posTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron])) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(negTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El); + if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { + fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(negTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); } } // Ks0 if (static_cast(posTrack.pidbit() & (1 << 1)) && static_cast(negTrack.pidbit() & (1 << 1))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi); + if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { + fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi); + if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { + fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); } } // Lambda if (static_cast(posTrack.pidbit() & (1 << 2)) && static_cast(negTrack.pidbit() & (1 << 2))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr); + if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { + if (TMath::Abs(posTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { + fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); + } } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi); + if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { + fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); } } // Antilambda if (static_cast(posTrack.pidbit() & (1 << 3)) && static_cast(negTrack.pidbit() & (1 << 3))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi); + if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { + fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr); + if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { + if (TMath::Abs(negTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { + fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); + } } } } @@ -220,6 +246,9 @@ struct TreeWriterTpcV0 { }; /// struct TreeWriterTpcV0 struct TreeWriterTPCTOF { + + Service ccdb; + using Trks = soa::Join; using Coll = soa::Join; @@ -279,6 +308,8 @@ struct TreeWriterTPCTOF { ((trackSelection.node() == 4) && requireQualityTracksInFilter()) || ((trackSelection.node() == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); + ctpRateFetcher mRateFetcher; + double tsalisCharged(double pt, double mass, double sqrts) { const double a = 6.81, b = 59.24; @@ -310,7 +341,7 @@ struct TreeWriterTPCTOF { /// Function to fill trees template - void fillSkimmedTPCTOFTable(T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor) + void fillSkimmedTPCTOFTable(T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, double hadronicRate) { const double ncl = track.tpcNClsFound(); @@ -318,8 +349,10 @@ struct TreeWriterTPCTOF { const double mass = o2::track::pid_constants::sMasses[id]; const double bg = p / mass; const int multTPC = collision.multTPC(); + auto trackocc = collision.trackOccupancyInTimeRange(); + auto ft0occ = collision.ft0cOccupancyInTimeRange(); - const double pseudoRndm = track.pt() * 1000. - (int64_t)(track.pt() * 1000); + const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { rowTPCTOFTree(track.tpcSignal(), 1. / dEdxExp, @@ -336,7 +369,10 @@ struct TreeWriterTPCTOF { id, nSigmaTPC, nSigmaTOF, - runnumber); + runnumber, + trackocc, + ft0occ, + hadronicRate); } }; @@ -358,6 +394,9 @@ struct TreeWriterTPCTOF { void init(o2::framework::InitContext&) { + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setFatalWhenNull(false); } void process(Coll::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) @@ -369,37 +408,39 @@ struct TreeWriterTPCTOF { auto bc = collision.bc_as(); const int runnumber = bc.runNumber(); + float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3; + rowTPCTOFTree.reserve(tracks.size()); for (auto const& trk : tracks) { /// Fill tree for tritons if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() <= maxMomTPCOnlyTr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPCOnlyTr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); } else if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() > maxMomTPCOnlyTr && std::abs(trk.tofNSigmaTr()) < nSigmaTOF_TPCTOF_Tr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPC_TPCTOF_Tr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); } /// Fill tree for deuterons if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() <= maxMomTPCOnlyDe && std::abs(trk.tpcNSigmaDe()) < nSigmaTPCOnlyDe && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); } else if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() > maxMomTPCOnlyDe && std::abs(trk.tofNSigmaDe()) < nSigmaTOF_TPCTOF_De && std::abs(trk.tpcNSigmaDe()) < nSigmaTPC_TPCTOF_De && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); } /// Fill tree for protons if (trk.tpcInnerParam() <= maxMomTPCOnlyPr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPCOnlyPr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); } else if (trk.tpcInnerParam() > maxMomTPCOnlyPr && std::abs(trk.tofNSigmaPr()) < nSigmaTOF_TPCTOF_Pr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPC_TPCTOF_Pr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); } /// Fill tree for kaons if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() <= maxMomTPCOnlyKa && std::abs(trk.tpcNSigmaKa()) < nSigmaTPCOnlyKa && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); } else if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() > maxMomTPCOnlyKa && std::abs(trk.tofNSigmaKa()) < nSigmaTOF_TPCTOF_Ka && std::abs(trk.tpcNSigmaKa()) < nSigmaTPC_TPCTOF_Ka && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); } /// Fill tree pions if (trk.tpcInnerParam() <= maxMomTPCOnlyPi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPCOnlyPi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); } else if (trk.tpcInnerParam() > maxMomTPCOnlyPi && std::abs(trk.tofNSigmaPi()) < nSigmaTOF_TPCTOF_Pi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPC_TPCTOF_Pi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi); + fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); } } /// Loop tracks } /// process diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.h b/DPG/Tasks/TPC/tpcSkimsTableCreator.h index c8cce4750de..7c770602efd 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.h +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.h @@ -41,6 +41,9 @@ DECLARE_SOA_COLUMN(PtV0, ptV0, float); DECLARE_SOA_COLUMN(RadiusV0, radiusV0, float); DECLARE_SOA_COLUMN(GammaPsiPair, gammaPsiPair, float); DECLARE_SOA_COLUMN(RunNumber, runNumber, int); +DECLARE_SOA_COLUMN(TrackOcc, trackOcc, float); +DECLARE_SOA_COLUMN(Ft0Occ, ft0Occ, float); +DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, float); } // namespace tpcskims DECLARE_SOA_TABLE(SkimmedTPCV0Tree, "AOD", "TPCSKIMV0TREE", o2::aod::track::TPCSignal, @@ -64,7 +67,10 @@ DECLARE_SOA_TABLE(SkimmedTPCV0Tree, "AOD", "TPCSKIMV0TREE", tpcskims::PtV0, tpcskims::RadiusV0, tpcskims::GammaPsiPair, - tpcskims::RunNumber); + tpcskims::RunNumber, + tpcskims::TrackOcc, + tpcskims::Ft0Occ, + tpcskims::HadronicRate); DECLARE_SOA_TABLE(SkimmedTPCTOFTree, "AOD", "TPCTOFSKIMTREE", o2::aod::track::TPCSignal, @@ -82,6 +88,9 @@ DECLARE_SOA_TABLE(SkimmedTPCTOFTree, "AOD", "TPCTOFSKIMTREE", tpcskims::PidIndex, tpcskims::NSigTPC, tpcskims::NSigTOF, - tpcskims::RunNumber); + tpcskims::RunNumber, + tpcskims::TrackOcc, + tpcskims::Ft0Occ, + tpcskims::HadronicRate); } // namespace o2::aod #endif // DPG_TASKS_TPC_TPCSKIMSTABLECREATOR_H_ diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index 070851ce4eb..3abef8e28a9 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -428,7 +428,7 @@ struct HfFilter { // Main struct for HF triggers if (!keepEvent[kBeauty3P] && isBeautyTagged) { auto isTrackSelected = helper.isSelectedTrackForSoftPionOrBeauty(track, trackParThird, dcaThird, kBeauty3P); - if (isTrackSelected && ((TESTBIT(selD0, 0) && track.sign() > 0) || (TESTBIT(selD0, 1) && track.sign() < 0))) { + if (TESTBIT(isTrackSelected, kForBeauty) && ((TESTBIT(selD0, 0) && track.sign() < 0) || (TESTBIT(selD0, 1) && track.sign() > 0))) { // D0 pi- and D0bar pi+ auto massCand = RecoDecay::m(std::array{pVec2Prong, pVecThird}, std::array{massD0, massPi}); auto pVecBeauty3Prong = RecoDecay::pVec(pVec2Prong, pVecThird); auto ptCand = RecoDecay::pt(pVecBeauty3Prong); @@ -441,47 +441,50 @@ struct HfFilter { // Main struct for HF triggers if (activateQA) { hMassVsPtB[kBplus]->Fill(ptCand, massCand); } - } else if (TESTBIT(isTrackSelected, kSoftPionForBeauty)) { - std::array massDausD0{massPi, massKa}; - auto massD0dau = massD0Cand; - if (track.sign() < 0) { - massDausD0[0] = massKa; - massDausD0[1] = massPi; - massD0dau = massD0BarCand; + } + } + if (!keepEvent[kBeauty3P] && TESTBIT(isTrackSelected, kSoftPionForBeauty) && ((TESTBIT(selD0, 0) && track.sign() > 0) || (TESTBIT(selD0, 1) && track.sign() < 0))) { // D0 pi+ and D0bar pi- + auto pVecBeauty3Prong = RecoDecay::pVec(pVec2Prong, pVecThird); + auto ptCand = RecoDecay::pt(pVecBeauty3Prong); + std::array massDausD0{massPi, massKa}; + auto massD0dau = massD0Cand; + if (track.sign() < 0) { + massDausD0[0] = massKa; + massDausD0[1] = massPi; + massD0dau = massD0BarCand; + } + auto massDstarCand = RecoDecay::m(std::array{pVecPos, pVecNeg, pVecThird}, std::array{massDausD0[0], massDausD0[1], massPi}); + auto massDiffDstar = massDstarCand - massD0dau; + if (cutsPtDeltaMassCharmReso->get(0u, 0u) <= massDiffDstar && massDiffDstar <= cutsPtDeltaMassCharmReso->get(1u, 0u) && ptCand > cutsPtDeltaMassCharmReso->get(2u, 0u)) { // additional check for B0->D*pi polarization studies + if (activateQA) { + hMassVsPtC[kNCharmParticles]->Fill(ptCand, massDiffDstar); } - auto massDstarCand = RecoDecay::m(std::array{pVecPos, pVecNeg, pVecThird}, std::array{massDausD0[0], massDausD0[1], massPi}); - auto massDiffDstar = massDstarCand - massD0dau; - if (cutsPtDeltaMassCharmReso->get(0u, 0u) <= massDiffDstar && massDiffDstar <= cutsPtDeltaMassCharmReso->get(1u, 0u) && ptCand > cutsPtDeltaMassCharmReso->get(2u, 0u)) { // additional check for B0->D*pi polarization studies - if (activateQA) { - hMassVsPtC[kNCharmParticles]->Fill(ptCand, massDiffDstar); + for (const auto& trackIdB : trackIdsThisCollision) { // start loop over tracks + auto trackB = trackIdB.track_as(); + if (track.globalIndex() == trackB.globalIndex()) { + continue; + } + auto trackParFourth = getTrackPar(trackB); + o2::gpu::gpustd::array dcaFourth{trackB.dcaXY(), trackB.dcaZ()}; + std::array pVecFourth = trackB.pVector(); + if (trackB.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParFourth, 2.f, noMatCorr, &dcaFourth); + getPxPyPz(trackParFourth, pVecFourth); } - for (const auto& trackIdB : trackIdsThisCollision) { // start loop over tracks - auto trackB = trackIdB.track_as(); - if (track.globalIndex() == trackB.globalIndex()) { - continue; - } - auto trackParFourth = getTrackPar(trackB); - o2::gpu::gpustd::array dcaFourth{trackB.dcaXY(), trackB.dcaZ()}; - std::array pVecFourth = trackB.pVector(); - if (trackB.collisionId() != thisCollId) { - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParFourth, 2.f, noMatCorr, &dcaFourth); - getPxPyPz(trackParFourth, pVecFourth); - } - auto isTrackFourthSelected = helper.isSelectedTrackForSoftPionOrBeauty(trackB, trackParFourth, dcaFourth, kBeauty3P); - if (track.sign() * trackB.sign() < 0 && TESTBIT(isTrackFourthSelected, kForBeauty)) { - auto massCandB0 = RecoDecay::m(std::array{pVecBeauty3Prong, pVecFourth}, std::array{massDStar, massPi}); - if (std::fabs(massCandB0 - massB0) <= deltaMassBeauty->get(0u, 2u)) { - keepEvent[kBeauty3P] = true; - // fill optimisation tree for D0 - if (applyOptimisation) { - optimisationTreeBeauty(thisCollId, 413, pt2Prong, scores[0], scores[1], scores[2], dcaFourth[0]); // pdgCode of D*(2010)+: 413 - } - if (activateQA) { - auto pVecBeauty4Prong = RecoDecay::pVec(pVec2Prong, pVecThird, pVecFourth); - auto ptCandBeauty4Prong = RecoDecay::pt(pVecBeauty4Prong); - hMassVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, massCandB0); - } + auto isTrackFourthSelected = helper.isSelectedTrackForSoftPionOrBeauty(trackB, trackParFourth, dcaFourth, kBeauty3P); + if (track.sign() * trackB.sign() < 0 && TESTBIT(isTrackFourthSelected, kForBeauty)) { + auto massCandB0 = RecoDecay::m(std::array{pVecBeauty3Prong, pVecFourth}, std::array{massDStar, massPi}); + if (std::fabs(massCandB0 - massB0) <= deltaMassBeauty->get(0u, 2u)) { + keepEvent[kBeauty3P] = true; + // fill optimisation tree for D0 + if (applyOptimisation) { + optimisationTreeBeauty(thisCollId, 413, pt2Prong, scores[0], scores[1], scores[2], dcaFourth[0]); // pdgCode of D*(2010)+: 413 + } + if (activateQA) { + auto pVecBeauty4Prong = RecoDecay::pVec(pVec2Prong, pVecThird, pVecFourth); + auto ptCandBeauty4Prong = RecoDecay::pt(pVecBeauty4Prong); + hMassVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, massCandB0); } } } diff --git a/EventFiltering/PWGHF/HFFilterHelpers.h b/EventFiltering/PWGHF/HFFilterHelpers.h index 4ab3a884952..921bb98103e 100644 --- a/EventFiltering/PWGHF/HFFilterHelpers.h +++ b/EventFiltering/PWGHF/HFFilterHelpers.h @@ -410,6 +410,8 @@ class HfFilterHelper int8_t isBDTSelected(const T& scores, const U& thresholdBDTScores); template bool isSelectedKaonFromXicResoToSigmaC(const T& track); + template + inline bool isCharmHadronMassInSbRegions(T1 const& massHypo1, T1 const& massHypo2, const float& lowLimitSB, const float& upLimitSB); // helpers template @@ -1615,6 +1617,23 @@ inline bool HfFilterHelper::isSelectedKaon4Charm3Prong(const T& track) return true; } +/// Method to check if charm candidates has mass between sideband limits +/// \param massHypo1 is the array for the candidate D daughter momentum after reconstruction of secondary vertex +/// \param massHypo2 is the array for the candidate bachelor pion momentum after reconstruction of secondary vertex +/// \param lowLimitSB is the dca of the D daughter track +/// \param upLimitSB is the dca of the pion daughter track +/// \return true if the candidate passes the mass selection. +template +inline bool isCharmHadronMassInSbRegions(T1 const& massHypo1, T1 const& massHypo2, const float& lowLimitSB, const float& upLimitSB) +{ + + if ((massHypo1 < lowLimitSB || massHypo1 > upLimitSB) && (massHypo2 < lowLimitSB || massHypo2 > upLimitSB)) { + return false; + } + + return true; +} + /// Update the TPC PID baesd on the spline of particles /// \param track is a track parameter /// \param pidSpecies is the particle species to be considered diff --git a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx index 1441782031e..5e62416a75d 100644 --- a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx +++ b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx @@ -17,7 +17,9 @@ /// \author Marcel Lesch , TUM /// \author Alexandre Bigot , Strasbourg University /// \author Biao Zhang , CCNU +/// \author Antonio Palasciano , INFN Bari +#include #if __has_include() #include // needed for HFFilterHelpers, to be fixed #else @@ -54,8 +56,12 @@ struct HfFilterPrepareMlSamples { // Main struct // parameters for production of training samples Configurable fillSignal{"fillSignal", true, "Flag to fill derived tables with signal for ML trainings"}; - Configurable fillBackground{"fillBackground", true, "Flag to fill derived tables with background for ML trainings"}; + Configurable fillOnlyBackground{"fillOnlyBackground", true, "Flag to fill derived tables with background for ML trainings"}; Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; + Configurable massSbLeftMin{"massSbLeftMin", 1.72, "Left Sideband Lower Minv limit 2 Prong"}; + Configurable massSbLeftMax{"massSbLeftMax", 1.78, "Left Sideband Upper Minv limit 2 Prong"}; + Configurable massSbRightMin{"massSbRightMin", 1.94, "Right Sideband Lower Minv limit 2 Prong"}; + Configurable massSbRightMax{"massSbRightMax", 1.98, "Right Sideband Upper Minv limit 2 Prong"}; // CCDB configuration o2::ccdb::CcdbApi ccdbApi; @@ -67,6 +73,9 @@ struct HfFilterPrepareMlSamples { // Main struct o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; int currentRun = 0; // needed to detect if the run changed and trigger update of calibrations etc. + // helper object + HfFilterHelper helper; + void init(InitContext&) { ccdb->setURL(url.value); @@ -76,14 +85,147 @@ struct HfFilterPrepareMlSamples { // Main struct ccdbApi.init(url); } + using BigTracksPID = soa::Join; using BigTracksMCPID = soa::Join; - void process(aod::Hf2Prongs const& cand2Prongs, - aod::Hf3Prongs const& cand3Prongs, - aod::McParticles const& mcParticles, - soa::Join const& collisions, - BigTracksMCPID const&, - aod::BCsWithTimestamps const&) + void processData2Prong(aod::Hf2Prongs const& cand2Prongs, + aod::Collisions const& collisions, + BigTracksPID const&, + aod::BCsWithTimestamps const&) + { + for (const auto& cand2Prong : cand2Prongs) { // start loop over 2 prongs + + auto thisCollId = cand2Prong.collisionId(); + auto collision = collisions.rawIteratorAt(thisCollId); + auto bc = collision.bc_as(); + + if (currentRun != bc.runNumber()) { + o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); + o2::base::Propagator::initFieldFromGRP(grpo); + currentRun = bc.runNumber(); + } + + auto trackPos = cand2Prong.prong0_as(); // positive daughter + auto trackNeg = cand2Prong.prong1_as(); // negative daughter + + auto trackParPos = getTrackPar(trackPos); + auto trackParNeg = getTrackPar(trackNeg); + o2::gpu::gpustd::array dcaPos{trackPos.dcaXY(), trackPos.dcaZ()}; + o2::gpu::gpustd::array dcaNeg{trackNeg.dcaXY(), trackNeg.dcaZ()}; + std::array pVecPos{trackPos.pVector()}; + std::array pVecNeg{trackNeg.pVector()}; + if (trackPos.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParPos, 2.f, noMatCorr, &dcaPos); + getPxPyPz(trackParPos, pVecPos); + } + if (trackNeg.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParNeg, 2.f, noMatCorr, &dcaNeg); + getPxPyPz(trackParNeg, pVecNeg); + } + + auto pVec2Prong = RecoDecay::pVec(pVecPos, pVecNeg); + auto pt2Prong = RecoDecay::pt(pVec2Prong); + + auto invMassD0 = RecoDecay::m(std::array{pVecPos, pVecNeg}, std::array{massPi, massKa}); + auto invMassD0bar = RecoDecay::m(std::array{pVecPos, pVecNeg}, std::array{massKa, massPi}); + + auto flag = RecoDecay::OriginType::None; + + if (fillOnlyBackground && !(isCharmHadronMassInSbRegions(invMassD0, invMassD0bar, massSbLeftMin, massSbLeftMax) || (isCharmHadronMassInSbRegions(invMassD0, invMassD0bar, massSbRightMin, massSbRightMax)))) + continue; + float pseudoRndm = trackPos.pt() * 1000. - static_cast(trackPos.pt() * 1000); + if (pseudoRndm < downSampleBkgFactor) { + train2P(invMassD0, invMassD0bar, pt2Prong, trackParPos.getPt(), dcaPos[0], dcaPos[1], trackPos.tpcNSigmaPi(), trackPos.tpcNSigmaKa(), trackPos.tofNSigmaPi(), trackPos.tofNSigmaKa(), + trackParNeg.getPt(), dcaNeg[0], dcaNeg[1], trackNeg.tpcNSigmaPi(), trackNeg.tpcNSigmaKa(), trackNeg.tofNSigmaPi(), trackNeg.tofNSigmaKa(), flag, true); + } + } // end loop over 2-prong candidates + } + PROCESS_SWITCH(HfFilterPrepareMlSamples, processData2Prong, "Store 2prong(D0) data tables", true); + + void processData3Prong(aod::Hf3Prongs const& cand3Prongs, + aod::Collisions const& collisions, + BigTracksPID const&, + aod::BCsWithTimestamps const&) + { + for (const auto& cand3Prong : cand3Prongs) { // start loop over 2 prongs + + auto thisCollId = cand3Prong.collisionId(); + auto collision = collisions.rawIteratorAt(thisCollId); + auto bc = collision.bc_as(); + + if (currentRun != bc.runNumber()) { + o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); + o2::base::Propagator::initFieldFromGRP(grpo); + currentRun = bc.runNumber(); + } + + auto trackFirst = cand3Prong.prong0_as(); // first daughter + auto trackSecond = cand3Prong.prong1_as(); // second daughter + auto trackThird = cand3Prong.prong2_as(); // third daughter + // auto arrayDaughters = std::array{trackFirst, trackSecond, trackThird}; + + auto trackParFirst = getTrackPar(trackFirst); + auto trackParSecond = getTrackPar(trackSecond); + auto trackParThird = getTrackPar(trackThird); + o2::gpu::gpustd::array dcaFirst{trackFirst.dcaXY(), trackFirst.dcaZ()}; + o2::gpu::gpustd::array dcaSecond{trackSecond.dcaXY(), trackSecond.dcaZ()}; + o2::gpu::gpustd::array dcaThird{trackThird.dcaXY(), trackThird.dcaZ()}; + std::array pVecFirst{trackFirst.pVector()}; + std::array pVecSecond{trackSecond.pVector()}; + std::array pVecThird{trackThird.pVector()}; + if (trackFirst.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParFirst, 2.f, noMatCorr, &dcaFirst); + getPxPyPz(trackParFirst, pVecFirst); + } + if (trackSecond.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParSecond, 2.f, noMatCorr, &dcaSecond); + getPxPyPz(trackParSecond, pVecSecond); + } + if (trackThird.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParThird, 2.f, noMatCorr, &dcaThird); + getPxPyPz(trackParThird, pVecThird); + } + + auto pVec3Prong = RecoDecay::pVec(pVecFirst, pVecSecond, pVecThird); + auto pt3Prong = RecoDecay::pt(pVec3Prong); + + auto invMassDplus = RecoDecay::m(std::array{pVecFirst, pVecSecond, pVecThird}, std::array{massPi, massKa, massPi}); + + auto invMassDsToKKPi = RecoDecay::m(std::array{pVecFirst, pVecSecond, pVecThird}, std::array{massKa, massKa, massPi}); + auto invMassDsToPiKK = RecoDecay::m(std::array{pVecFirst, pVecSecond, pVecThird}, std::array{massPi, massKa, massKa}); + + auto invMassLcToPKPi = RecoDecay::m(std::array{pVecFirst, pVecSecond, pVecThird}, std::array{massProton, massKa, massPi}); + auto invMassLcToPiKP = RecoDecay::m(std::array{pVecFirst, pVecSecond, pVecThird}, std::array{massPi, massKa, massProton}); + + auto invMassXicToPKPi = RecoDecay::m(std::array{pVecFirst, pVecSecond, pVecThird}, std::array{massProton, massKa, massPi}); + auto invMassXicToPiKP = RecoDecay::m(std::array{pVecFirst, pVecSecond, pVecThird}, std::array{massPi, massKa, massProton}); + + float deltaMassKKFirst = -1.f; + float deltaMassKKSecond = -1.f; + if (TESTBIT(cand3Prong.hfflag(), o2::aod::hf_cand_3prong::DecayType::DsToKKPi)) { + deltaMassKKFirst = std::abs(RecoDecay::m(std::array{pVecFirst, pVecSecond}, std::array{massKa, massKa}) - massPhi); + deltaMassKKSecond = std::abs(RecoDecay::m(std::array{pVecThird, pVecSecond}, std::array{massKa, massKa}) - massPhi); + } + // int8_t sign = 0; + auto flag = RecoDecay::OriginType::None; + + float pseudoRndm = trackFirst.pt() * 1000. - static_cast(trackFirst.pt() * 1000); + if (pseudoRndm < downSampleBkgFactor) { + train3P(invMassDplus, invMassDsToKKPi, invMassDsToPiKK, invMassLcToPKPi, invMassLcToPiKP, invMassXicToPKPi, invMassXicToPiKP, pt3Prong, deltaMassKKFirst, deltaMassKKSecond, + trackParFirst.getPt(), dcaFirst[0], dcaFirst[1], trackFirst.tpcNSigmaPi(), trackFirst.tpcNSigmaKa(), trackFirst.tpcNSigmaPr(), trackFirst.tofNSigmaPi(), trackFirst.tofNSigmaKa(), trackFirst.tofNSigmaPr(), + trackParSecond.getPt(), dcaSecond[0], dcaSecond[1], trackSecond.tpcNSigmaPi(), trackSecond.tpcNSigmaKa(), trackSecond.tpcNSigmaPr(), trackSecond.tofNSigmaPi(), trackSecond.tofNSigmaKa(), trackSecond.tofNSigmaPr(), + trackParThird.getPt(), dcaThird[0], dcaThird[1], trackThird.tpcNSigmaPi(), trackThird.tpcNSigmaKa(), trackThird.tpcNSigmaPr(), trackThird.tofNSigmaPi(), trackThird.tofNSigmaKa(), trackThird.tofNSigmaPr(), + flag, 0, cand3Prong.hfflag(), 0); + } + } // end loop over 3-prong candidates + } + PROCESS_SWITCH(HfFilterPrepareMlSamples, processData3Prong, "Store 3prong(D0)-data tables", true); + + void processMC2Prong(aod::Hf2Prongs const& cand2Prongs, + aod::McParticles const& mcParticles, + soa::Join const& collisions, + BigTracksMCPID const&, + aod::BCsWithTimestamps const&) { for (const auto& cand2Prong : cand2Prongs) { // start loop over 2 prongs @@ -136,13 +278,19 @@ struct HfFilterPrepareMlSamples { // Main struct } } - float pseudoRndm = trackPos.pt() * 1000. - (int64_t)(trackPos.pt() * 1000); - if ((fillSignal && indexRec > -1) || (fillBackground && indexRec < 0 && pseudoRndm < downSampleBkgFactor)) { - train2P(invMassD0, invMassD0bar, pt2Prong, trackParPos.getPt(), dcaPos[0], dcaPos[1], trackPos.tpcNSigmaPi(), trackPos.tpcNSigmaKa(), trackPos.tofNSigmaPi(), trackPos.tofNSigmaKa(), - trackParNeg.getPt(), dcaNeg[0], dcaNeg[1], trackNeg.tpcNSigmaPi(), trackNeg.tpcNSigmaKa(), trackNeg.tofNSigmaPi(), trackNeg.tofNSigmaKa(), flag, isInCorrectColl); - } + train2P(invMassD0, invMassD0bar, pt2Prong, trackParPos.getPt(), dcaPos[0], dcaPos[1], trackPos.tpcNSigmaPi(), trackPos.tpcNSigmaKa(), trackPos.tofNSigmaPi(), trackPos.tofNSigmaKa(), + trackParNeg.getPt(), dcaNeg[0], dcaNeg[1], trackNeg.tpcNSigmaPi(), trackNeg.tpcNSigmaKa(), trackNeg.tofNSigmaPi(), trackNeg.tofNSigmaKa(), flag, isInCorrectColl); + } // end loop over 2-prong candidates + } + PROCESS_SWITCH(HfFilterPrepareMlSamples, processMC2Prong, "Store 2 prong(D0) MC tables", false); + void processMC3Prong(aod::Hf3Prongs const& cand3Prongs, + aod::McParticles const& mcParticles, + soa::Join const& collisions, + BigTracksMCPID const&, + aod::BCsWithTimestamps const&) + { for (const auto& cand3Prong : cand3Prongs) { // start loop over 3 prongs auto thisCollId = cand3Prong.collisionId(); @@ -243,16 +391,15 @@ struct HfFilterPrepareMlSamples { // Main struct } } - float pseudoRndm = trackFirst.pt() * 1000. - (int64_t)(trackFirst.pt() * 1000); - if ((fillSignal && indexRec > -1) || (fillBackground && indexRec < 0 && pseudoRndm < downSampleBkgFactor)) { - train3P(invMassDplus, invMassDsToKKPi, invMassDsToPiKK, invMassLcToPKPi, invMassLcToPiKP, invMassXicToPKPi, invMassXicToPiKP, pt3Prong, deltaMassKKFirst, deltaMassKKSecond, - trackParFirst.getPt(), dcaFirst[0], dcaFirst[1], trackFirst.tpcNSigmaPi(), trackFirst.tpcNSigmaKa(), trackFirst.tpcNSigmaPr(), trackFirst.tofNSigmaPi(), trackFirst.tofNSigmaKa(), trackFirst.tofNSigmaPr(), - trackParSecond.getPt(), dcaSecond[0], dcaSecond[1], trackSecond.tpcNSigmaPi(), trackSecond.tpcNSigmaKa(), trackSecond.tpcNSigmaPr(), trackSecond.tofNSigmaPi(), trackSecond.tofNSigmaKa(), trackSecond.tofNSigmaPr(), - trackParThird.getPt(), dcaThird[0], dcaThird[1], trackThird.tpcNSigmaPi(), trackThird.tpcNSigmaKa(), trackThird.tpcNSigmaPr(), trackThird.tofNSigmaPi(), trackThird.tofNSigmaKa(), trackThird.tofNSigmaPr(), - flag, channel, cand3Prong.hfflag(), isInCorrectColl); - } + train3P(invMassDplus, invMassDsToKKPi, invMassDsToPiKK, invMassLcToPKPi, invMassLcToPiKP, invMassXicToPKPi, invMassXicToPiKP, pt3Prong, deltaMassKKFirst, deltaMassKKSecond, + trackParFirst.getPt(), dcaFirst[0], dcaFirst[1], trackFirst.tpcNSigmaPi(), trackFirst.tpcNSigmaKa(), trackFirst.tpcNSigmaPr(), trackFirst.tofNSigmaPi(), trackFirst.tofNSigmaKa(), trackFirst.tofNSigmaPr(), + trackParSecond.getPt(), dcaSecond[0], dcaSecond[1], trackSecond.tpcNSigmaPi(), trackSecond.tpcNSigmaKa(), trackSecond.tpcNSigmaPr(), trackSecond.tofNSigmaPi(), trackSecond.tofNSigmaKa(), trackSecond.tofNSigmaPr(), + trackParThird.getPt(), dcaThird[0], dcaThird[1], trackThird.tpcNSigmaPi(), trackThird.tpcNSigmaKa(), trackThird.tpcNSigmaPr(), trackThird.tofNSigmaPi(), trackThird.tofNSigmaKa(), trackThird.tofNSigmaPr(), + flag, channel, cand3Prong.hfflag(), isInCorrectColl); + } // end loop over 3-prong candidates } + PROCESS_SWITCH(HfFilterPrepareMlSamples, processMC3Prong, "Store 3 prong MC tables", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfg) diff --git a/EventFiltering/Zorro.cxx b/EventFiltering/Zorro.cxx index 480ee75bfba..ec661548d09 100644 --- a/EventFiltering/Zorro.cxx +++ b/EventFiltering/Zorro.cxx @@ -92,6 +92,68 @@ void Zorro::populateHistRegistry(o2::framework::HistogramRegistry& histRegistry, mRunNumberHistos.push_back(runNumber); } +void Zorro::populateExternalHists(int runNumber, TH2* ZorroHisto, TH2* ToiHisto) +{ + // x-axis is run number, y-axis is same as ZorroSummary + int runId{-1}; + for (size_t i{0}; i < mRunNumberHistos.size(); ++i) { + if (mRunNumberHistos[i] == runNumber) { + runId = i; + break; + } + } + if (runId > -1) { + return; + } + // if the summary histogram is not set, create a new one + if (!ZorroHisto) { + LOGF(info, "Summary histogram not set, creating a new one"); + ZorroHisto = new TH2D("Zorro", "Zorro", 1, -0.5, 0.5, 1 + mTOIs.size() * 2, -0.5, mTOIs.size() * 2 - 0.5); + ZorroHisto->SetBit(TH1::kIsAverage); + } + if (!ToiHisto) { + LOGF(info, "TOI histogram not set, creating a new one"); + ToiHisto = new TH2D("TOI", "TOI", 1, -0.5, 0.5, mTOIs.size(), -0.5, mTOIs.size() - 0.5); + } + // if it is the first run, initialize the histogram + if (mRunNumberHistos.size() == 0) { + ZorroHisto->SetBins(1, -0.5, 0.5, 1 + mTOIs.size() * 2, -0.5, mTOIs.size() * 2 - 0.5); + ZorroHisto->SetBit(TH1::kIsAverage); + ZorroHisto->GetXaxis()->SetBinLabel(1, Form("%d", runNumber)); + ZorroHisto->GetYaxis()->SetBinLabel(1, "inspected TVX"); + for (size_t i{0}; i < mTOIs.size(); ++i) { + ZorroHisto->GetYaxis()->SetBinLabel(i + 2, Form("%s selections", mTOIs[i].data())); + ZorroHisto->GetYaxis()->SetBinLabel(i + 2 + mTOIs.size(), Form("%s scalers", mTOIs[i].data())); + } + // TOI histogram + ToiHisto->SetBins(1, -0.5, 0.5, mTOIs.size(), -0.5, mTOIs.size() - 0.5); + ToiHisto->GetXaxis()->SetBinLabel(1, Form("%d", runNumber)); + for (size_t i{0}; i < mTOIs.size(); ++i) { + ToiHisto->GetYaxis()->SetBinLabel(i + 1, mTOIs[i].data()); + } + } + if (mInspectedTVX) { + ZorroHisto->Fill(Form("%d", runNumber), "inspected TVX", mInspectedTVX->GetBinContent(1)); + ZorroHisto->SetBinError(mRunNumberHistos.size() + 1, 1, mInspectedTVX->GetBinError(1)); + } + if (mSelections) { + for (size_t i{0}; i < mTOIs.size(); ++i) { + int bin = findBin(mSelections, mTOIs[i]); + ZorroHisto->Fill(Form("%d", runNumber), Form("%s selections", mTOIs[i].data()), mSelections->GetBinContent(bin)); + ZorroHisto->SetBinError(mRunNumberHistos.size() + 1, i + 2, mSelections->GetBinError(bin)); + } + } + if (mScalers) { + for (size_t i{0}; i < mTOIs.size(); ++i) { + int bin = findBin(mScalers, mTOIs[i]); + ZorroHisto->Fill(Form("%d", runNumber), Form("%s scalers", mTOIs[i].data()), mScalers->GetBinContent(bin)); + ZorroHisto->SetBinError(mRunNumberHistos.size() + 1, i + 2 + mTOIs.size(), mScalers->GetBinError(bin)); + } + } + + mRunNumberHistos.push_back(runNumber); +} + std::vector Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber, uint64_t timestamp, std::string tois, int bcRange) { if (mRunNumber == runNumber) { @@ -177,7 +239,7 @@ std::bitset<128> Zorro::fetch(uint64_t bcGlobalId, uint64_t tolerance) return mLastResult; } -bool Zorro::isSelected(uint64_t bcGlobalId, uint64_t tolerance) +bool Zorro::isSelected(uint64_t bcGlobalId, uint64_t tolerance, TH2* ToiHisto) { uint64_t lastSelectedIdx = mLastSelectedIdx; fetch(bcGlobalId, tolerance); @@ -191,6 +253,9 @@ bool Zorro::isSelected(uint64_t bcGlobalId, uint64_t tolerance) mAnalysedTriggersOfInterest->Fill(i); mZorroSummary.increaseTOIcounter(mRunNumber, i); } + if (ToiHisto && lastSelectedIdx != mLastSelectedIdx) { + ToiHisto->Fill(Form("%d", mRunNumber), Form("%s", mTOIs[i].data()), 1); + } retVal = true; } } diff --git a/EventFiltering/Zorro.h b/EventFiltering/Zorro.h index fb4b4f260f7..c818e45ce48 100644 --- a/EventFiltering/Zorro.h +++ b/EventFiltering/Zorro.h @@ -21,6 +21,7 @@ #include #include "TH1D.h" +#include "TH2D.h" #include "CommonDataFormat/IRFrame.h" #include "Framework/HistogramRegistry.h" #include "ZorroHelper.h" @@ -40,10 +41,11 @@ class Zorro Zorro() = default; std::vector initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber, uint64_t timestamp, std::string tois, int bcTolerance = 500); std::bitset<128> fetch(uint64_t bcGlobalId, uint64_t tolerance = 100); - bool isSelected(uint64_t bcGlobalId, uint64_t tolerance = 100); + bool isSelected(uint64_t bcGlobalId, uint64_t tolerance = 100, TH2* toiHisto = nullptr); bool isNotSelectedByAny(uint64_t bcGlobalId, uint64_t tolerance = 100); void populateHistRegistry(o2::framework::HistogramRegistry& histRegistry, int runNumber, std::string folderName = "Zorro"); + void populateExternalHists(int runNumber, TH2* zorroHisto = nullptr, TH2* toiHisto = nullptr); TH1D* getScalers() const { return mScalers; } TH1D* getSelections() const { return mSelections; } diff --git a/EventFiltering/cefpTask.cxx b/EventFiltering/cefpTask.cxx index 92d0ed8f6bc..b5cfa90449a 100644 --- a/EventFiltering/cefpTask.cxx +++ b/EventFiltering/cefpTask.cxx @@ -14,12 +14,13 @@ #include #include -#include #include #include #include #include #include +#include +#include #include "filterTables.h" @@ -200,12 +201,11 @@ static const float defaultDownscaling[128][1]{ {1.f}, {1.f}}; /// Max number of columns for triggers is 128 (extendible) -#define FILTER_CONFIGURABLE(_TYPE_) \ - Configurable> cfg##_TYPE_ \ - { \ -#_TYPE_, {defaultDownscaling[0], NumberOfColumns(typename _TYPE_::table_t::columns{}), 1, ColumnsNames(typename _TYPE_::table_t::columns{}), downscalingName }, #_TYPE_ " downscalings" \ +#define FILTER_CONFIGURABLE(_TYPE_) \ + Configurable> cfg##_TYPE_ \ + { \ + #_TYPE_, {defaultDownscaling[0], NumberOfColumns(typename _TYPE_::table_t::persistent_columns_t{}), 1, ColumnsNames(typename _TYPE_::table_t::persistent_columns_t{}), downscalingName}, #_TYPE_ " downscalings" \ } - } // namespace struct centralEventFilterTask { @@ -214,6 +214,7 @@ struct centralEventFilterTask { Produces tags; Configurable cfgDisableDownscalings{"cfgDisableDownscalings", false, "Disable downscalings"}; + Configurable cfgSkipUntriggeredEvents{"cfgSkipUntriggeredEvents", false, "Skip untriggered events"}; FILTER_CONFIGURABLE(F1ProtonFilters); FILTER_CONFIGURABLE(NucleiFilters); @@ -272,11 +273,11 @@ struct centralEventFilterTask { { // Filling output table - auto bcTabConsumer = pc.inputs().get(aod::MetadataTrait>::metadata::tableLabel()); + auto bcTabConsumer = pc.inputs().get(o2::soa::getTableLabel()); auto bcTabPtr{bcTabConsumer->asArrowTable()}; - auto collTabConsumer = pc.inputs().get(aod::MetadataTrait>::metadata::tableLabel()); + auto collTabConsumer = pc.inputs().get(o2::soa::getTableLabel()); auto collTabPtr{collTabConsumer->asArrowTable()}; - auto evSelConsumer = pc.inputs().get(aod::MetadataTrait>::metadata::tableLabel()); + auto evSelConsumer = pc.inputs().get(o2::soa::getTableLabel()); auto evSelTabPtr{evSelConsumer->asArrowTable()}; auto columnGloBCId{bcTabPtr->GetColumnByName(aod::BC::GlobalBC::mLabel)}; @@ -390,6 +391,9 @@ struct centralEventFilterTask { } for (uint64_t iD{0}; iD < outDecision.size(); ++iD) { uint64_t foundBC = FoundBCArray->Value(iD) >= 0 && FoundBCArray->Value(iD) < GloBCArray->length() ? GloBCArray->Value(FoundBCArray->Value(iD)) : -1; + if (cfgSkipUntriggeredEvents.value && !outDecision[iD][0] && !outDecision[iD][1]) { + continue; + } tags(CollBCIdArray->Value(iD), GloBCArray->Value(CollBCIdArray->Value(iD)), foundBC, CollTimeArray->Value(iD), CollTimeResArray->Value(iD), outTrigger[iD][0], outTrigger[iD][1], outDecision[iD][0], outDecision[iD][1]); } } diff --git a/EventFiltering/filterTables.h b/EventFiltering/filterTables.h index 6020a9521b5..7283dec82de 100644 --- a/EventFiltering/filterTables.h +++ b/EventFiltering/filterTables.h @@ -15,7 +15,32 @@ #include #include #include -#include "Framework/AnalysisDataModel.h" +#include + +namespace o2::aod +{ +template +struct Hash; +} + +#include "Framework/ASoA.h" + +namespace o2::soa +{ +template + requires(!std::same_as>::metadata, void>) +const char* getTableLabel() +{ + return o2::aod::MetadataTrait>::metadata::tableLabel(); +} + +template + requires requires { T::ref.label_hash; } +const char* getTableLabel() +{ + return o2::aod::Hash::str; +} +} // namespace o2::soa namespace o2::aod { @@ -280,7 +305,7 @@ static_assert(o2::framework::pack_size(FiltersPack) == NumberOfFilters); template void addColumnToMap(std::unordered_map>& map) { - map[MetadataTrait::metadata::tableLabel()][C::columnLabel()] = 1.f; + map[o2::soa::getTableLabel()][C::columnLabel()] = 1.f; } template @@ -297,7 +322,7 @@ void addColumnsToMap(o2::framework::pack, std::unordered_map void FillFiltersMap(o2::framework::pack, std::unordered_map>& map) { - (addColumnsToMap(typename T::table_t::columns{}, map), ...); + (addColumnsToMap(typename T::table_t::persistent_columns_t{}, map), ...); } template diff --git a/EventFiltering/macros/checkBCrangesSkimming.C b/EventFiltering/macros/checkBCrangesSkimming.C index bd6d39b41fb..f71212238c3 100644 --- a/EventFiltering/macros/checkBCrangesSkimming.C +++ b/EventFiltering/macros/checkBCrangesSkimming.C @@ -44,8 +44,8 @@ struct selectedFrames : public IRFrame { ULong64_t triMask[2]{0ull}, selMask[2]{0ull}, bcAO2D, bcEvSel; int numSameTriggerInNearbyBCs = 0; // related to bcDiffTolerance bool isSingle() { return numSameTriggerInNearbyBCs == 0; } - void SetNum(int n) { numSameTriggerInNearbyBCs = n; } - int GetNum() { return numSameTriggerInNearbyBCs; } + void SetNInNearbyBC(int n) { numSameTriggerInNearbyBCs = n; } + int GetNInNearbyBC() { return numSameTriggerInNearbyBCs; } }; int DoBCSubraction(ULong64_t bc1, ULong64_t bc2) @@ -137,34 +137,39 @@ std::vector getSelectedFrames(std::unique_ptr& file, int } // Check how many other triggers are in a compatible BC window with the current one -// Ideally, most of triggers are singles (num = 1), which means none of others is in the same window +// Ideally, most of triggers are singles (num = 1) +// which means for most triggered events, none of others is in a nearby time window void checkNearbyBCs(std::vector& frames, ULong64_t bcDiffTolerance) { std::sort(frames.begin(), frames.end(), [](const selectedFrames& a, const selectedFrames& b) { - return a.getMin() < b.getMin(); + if (a.getMin() != b.getMin()) { + return a.getMin() < b.getMin(); + } else { + return a.getMax() < b.getMax(); + } }); - int firstID = 0; + int firstTrg = 0; for (auto& currentFrame : frames) { int num = 0; - bool isFirst = true; - for (int i = firstID; i < frames.size(); i++) { + bool shouldUpdate = true; // true if the maxBC of event in loop is smaller than the evaluating one -> update firstTrg + for (int i = firstTrg; i < frames.size(); i++) { auto& frame = frames[i]; if (frame.getMin() > currentFrame.getMax() + bcDiffTolerance) { break; } if (isClose(currentFrame, frame, bcDiffTolerance)) { - isFirst = false; + shouldUpdate = false; bool found = currentFrame.selMask[0] & frame.selMask[0] || currentFrame.selMask[1] & frame.selMask[1]; if (found) { num++; } } else { - if (isFirst) { - firstID = i; + if (shouldUpdate) { + firstTrg = i; } } } - currentFrame.SetNum(num); + currentFrame.SetNInNearbyBC(num); } } @@ -181,7 +186,7 @@ std::string getRunNumber(std::string fileName) return runNumber; } -// Detailed checks for specific trigger +// Detailed checks for specific trigger, not enabled by default void checkBCForSelectedTrg(std::vector& originalFrames, std::vector& skimmedFrames, string runNumber, string triggerLabel) { @@ -202,14 +207,15 @@ void checkBCForSelectedTrg(std::vector& originalFrames, std::vec hBCSkimmed.GetXaxis()->SetBinLabel(3, "Same EvSel BC"); hBCSkimmed.GetXaxis()->SetBinLabel(4, "Same Both BC"); - TH1D hPairedNumCounter("hPairedNumCounter", (runNumber + " " + triggerLabel + ";;Number of matched triggers in skimmed data").data(), 10, -0.5, 9.5); + TH1D hMatchedNumCounter("hMatchedNumCounter", (runNumber + " " + triggerLabel + ";;Number of matched triggers in skimmed data").data(), 10, -0.5, 9.5); checkNearbyBCs(originalFrames, bcDiffTolerance); checkNearbyBCs(skimmedFrames, bcDiffTolerance); std::vector bcSet; - int firstID = 0; - for (auto frame : originalFrames) { + int firstTrg = 0; + for (int i = 0; i < originalFrames.size(); i++) { + auto& frame = originalFrames[i]; hTriggerCounter.Fill(0); hBCOriginal.Fill(0); //------------------------------ Check if there are triggers which have same BC, time-consuming! ------------------------------------------------------- @@ -230,29 +236,37 @@ void checkBCForSelectedTrg(std::vector& originalFrames, std::vec } //------------------------------------------------------------------------------------- - if (frame.GetNum() != 1) { + if (frame.GetNInNearbyBC() != 1) { continue; // Only check singles } std::vector skimmedbcs; int n = 0; - bool isFirst = true; - for (int i = firstID; i < skimmedFrames.size(); i++) { - auto& skimmedFrame = skimmedFrames[i]; + bool shouldUpdate = true; + for (int j = firstTrg; j < skimmedFrames.size(); j++) { + auto& skimmedFrame = skimmedFrames[j]; if (skimmedFrame.getMin() > frame.getMax()) { break; } - if (skimmedFrame.GetNum() != 1) { + if (skimmedFrame.GetNInNearbyBC() != 1) { continue; // Only check singles } if (isClose(frame, skimmedFrame, bcDiffTolerance)) { + shouldUpdate = false; bool found = frame.selMask[0] & skimmedFrame.selMask[0] || frame.selMask[1] & skimmedFrame.selMask[1]; if (found) { + // Additional check to avoid match of skimmed singles and original multiplies + if (i != 0 && isClose(originalFrames[i - 1], skimmedFrame, bcDiffTolerance)) { + continue; + } + if (i != originalFrames.size() && isClose(originalFrames[i + 1], skimmedFrame, bcDiffTolerance)) { + continue; + } skimmedbcs.push_back({skimmedFrame.bcAO2D, skimmedFrame.bcEvSel}); n++; } } else { - if (isFirst) { - firstID = i; + if (shouldUpdate) { + firstTrg = j; } } } @@ -262,7 +276,7 @@ void checkBCForSelectedTrg(std::vector& originalFrames, std::vec hBCDiffAO2D.Fill(DoBCSubraction(frame.bcAO2D, skimmedbcs[0].bcAO2D)); hBCDiffEvSel.Fill(DoBCSubraction(frame.bcEvSel, skimmedbcs[0].bcEvSel)); } - hPairedNumCounter.Fill(n); + hMatchedNumCounter.Fill(n); } //------------------------------ Check if there are triggers which have same BC, time-consuming! ------------------------------------------------------- @@ -306,7 +320,7 @@ void checkBCForSelectedTrg(std::vector& originalFrames, std::vec hBCSkimmed.Write(); hBCDiffAO2D.Write(); hBCDiffEvSel.Write(); - hPairedNumCounter.Write(); + hMatchedNumCounter.Write(); fout.Close(); } @@ -347,7 +361,7 @@ void checkBCForSelectedTrg(std::string AnaFileName = "AnalysisResults.root", std checkBCForSelectedTrg(originalFrames, skimmedFrames, runNumber, triggerLabel); } -// Calulate the ratio of duplicate triggers +// Check the BCId compatibility of triggers on original and skimmmed data void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std::string originalFileName = "bcRanges_fullrun.root", std::string skimmedFileName = "bcRanges_fullrun_skimmed.root", bool useAlien = true) { @@ -399,11 +413,11 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std checkNearbyBCs(originalFrames, bcDiffTolerance); // include sorting noriginal = originalFrames.size(); for (auto originalFrame : originalFrames) { - if (originalFrame.GetNum() == 0) { + if (originalFrame.GetNInNearbyBC() == 0) { std::cerr << "Unexpected trigger!!! " << std::endl; - } else if (originalFrame.GetNum() == 1) { + } else if (originalFrame.GetNInNearbyBC() == 1) { noriginalsingle++; - } else if (originalFrame.GetNum() == 2) { + } else if (originalFrame.GetNInNearbyBC() == 2) { noriginaldouble++; } else { noriginalmultiple++; @@ -414,11 +428,11 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std checkNearbyBCs(skimmedFrames, bcDiffTolerance); // include sorting nskimmed = skimmedFrames.size(); for (auto& skimmedFrame : skimmedFrames) { - if (skimmedFrame.GetNum() == 0) { + if (skimmedFrame.GetNInNearbyBC() == 0) { std::cerr << "Unexpected trigger!!! " << std::endl; - } else if (skimmedFrame.GetNum() == 1) { + } else if (skimmedFrame.GetNInNearbyBC() == 1) { nskimmedsingle++; - } else if (skimmedFrame.GetNum() == 2) { + } else if (skimmedFrame.GetNInNearbyBC() == 2) { nskimmeddouble++; } else { nskimmedmultiple++; @@ -427,26 +441,35 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std // Check BC differences int npair{0}, npairedBCAO2D{0}, npairedBCEvSel{0}, ncloseskimmed{0}, maxdeltaBCAO2D{0}, maxdeltaBCEvSel{0}; - int firstID = 0; - for (auto frame : originalFrames) { - if (frame.GetNum() != 1) { + int firstTrg = 0; + for (int i = 0; i < originalFrames.size(); i++) { + auto& frame = originalFrames[i]; + if (frame.GetNInNearbyBC() != 1) { continue; // Only check singles } std::vector skimmedbcs; int n = 0; - bool isFirst = true; - for (int i = firstID; i < skimmedFrames.size(); i++) { - auto& skimmedFrame = skimmedFrames[i]; + bool shouldUpdate = true; + for (int j = firstTrg; j < skimmedFrames.size(); j++) { + auto& skimmedFrame = skimmedFrames[j]; if (skimmedFrame.getMin() > frame.getMax()) { break; } - if (skimmedFrame.GetNum() != 1) { + if (skimmedFrame.GetNInNearbyBC() != 1) { continue; // Only check singles } if (isClose(frame, skimmedFrame, bcDiffTolerance)) { - isFirst = false; + shouldUpdate = false; bool found = frame.selMask[0] & skimmedFrame.selMask[0] || frame.selMask[1] & skimmedFrame.selMask[1]; if (found) { + // Additional check to avoid match of skimmed singles and original multiplies + if (i != 0 && isClose(originalFrames[i - 1], skimmedFrame, bcDiffTolerance)) { + continue; + } + if (i != originalFrames.size() && isClose(originalFrames[i + 1], skimmedFrame, bcDiffTolerance)) { + continue; + } + InteractionRecord irstart, irend; irstart.setFromLong(std::min(skimmedFrame.bcAO2D, skimmedFrame.bcEvSel)); irend.setFromLong(std::max(skimmedFrame.bcAO2D, skimmedFrame.bcEvSel)); @@ -455,8 +478,8 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std n++; } } else { - if (isFirst) { - firstID = i; + if (shouldUpdate) { + firstTrg = j; } } } @@ -518,14 +541,14 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std TH1D hSkimmedDoubles("hSkimmedDoubles", (runNumber + " Skimmed;;Number of doubles").data(), sel_labels.size(), 0, sel_labels.size()); TH1D hSkimmedMultiples("hSkimmedMultiples", (runNumber + " Skimmed;;Number of multiples").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hTriggerPairsRatio("hTriggerPairsRatio", (runNumber + " Skimmed Efficiency;; Matched skimmed triggers / Original singles").data(), sel_labels.size(), 0, sel_labels.size()); // the ratio of triggers in skimmed dataset whose BC is compatible with original triggers to the number of original triggers, might be duplicate since we check it based on every trigger in unskimmed data - TH1D hTriggerSinglePairsRatio("hTriggerSinglePairsRatio", (runNumber + " Skimmed Efficiency;; One-to-one pairs / Original singles").data(), sel_labels.size(), 0, sel_labels.size()); // the ratio of 1-1 paired triggers to the number of original triggers - TH1D hPairsSameBCAO2DRatio("hPairsSameBCAO2DRatio", (runNumber + " One-to-one pairs;; Pairs with same BC_{AO2D} / Total").data(), sel_labels.size(), 0, sel_labels.size()); // In 1-1 pairs, the ratio of pairs who have same BCAO2D - TH1D hPairsSameBCEvSelRatio("hPairsSameBCEvSelRatio", (runNumber + " One-to-one pairs;; Pairs with same BC_{EvSel} / Total").data(), sel_labels.size(), 0, sel_labels.size()); // In 1-1 pairs, the ratio of pairs who have same BCEvSel - TH1D hDiffBCAO2D("hDiffBCAO2D", (runNumber + " One-to-one pairs;;#DeltaBC_{AO2D}").data(), sel_labels.size(), 0, sel_labels.size()); // difference in BCAO2D of 1-1 pairs - TH1D hDiffBCEvSel("hDiffBCEvSel", (runNumber + " One-to-one pairs;;#DeltaBC_{EvSel}").data(), sel_labels.size(), 0, sel_labels.size()); // difference in BCEvSel of 1-1 pairs - TH1D hDiffBC("hDiffBC", (runNumber + " One-to-one pairs;;#DeltaBC").data(), sel_labels.size(), 0, sel_labels.size()); // difference between the BC tuple, expected to be 0 if bcDiffTolerance = 0 - TH1D hNumPairsInSkimmed("hNumPairsInSkimmed", (runNumber + " number of matched triggers in skimmed data;;Matched trigger count").data(), sel_labels.size(), 0, sel_labels.size()); // number of triggers in skimmed data which are compatible in the BC ranges of singles in original selection + TH1D hTriggerMatchesRatio("hTriggerMatchesRatio", (runNumber + " Skimmed Efficiency;; Matched skimmed triggers / Original singles").data(), sel_labels.size(), 0, sel_labels.size()); // the ratio of triggers in skimmed dataset whose BC is compatible with original triggers to the number of original triggers, might be duplicate since we check it based on every trigger in unskimmed data + TH1D hTriggerSingleMatchesRatio("hTriggerSingleMatchesRatio", (runNumber + " Skimmed Efficiency;; One-to-one matches / Original singles").data(), sel_labels.size(), 0, sel_labels.size()); // the ratio of 1-1 paired triggers to the number of original triggers + TH1D hMatchesSameBCAO2DRatio("hMatchesSameBCAO2DRatio", (runNumber + " One-to-one matches;; Matchess with same BC_{AO2D} / Total").data(), sel_labels.size(), 0, sel_labels.size()); // In 1-1 matches, the ratio of matches who have same BCAO2D + TH1D hMatchesSameBCEvSelRatio("hMatchesSameBCEvSelRatio", (runNumber + " One-to-one matches;; Matches with same BC_{EvSel} / Total").data(), sel_labels.size(), 0, sel_labels.size()); // In 1-1 matches, the ratio of matches who have same BCEvSel + TH1D hDiffBCAO2D("hDiffBCAO2D", (runNumber + " One-to-one matches;;|#DeltaBC_{AO2D}|").data(), sel_labels.size(), 0, sel_labels.size()); // difference in BCAO2D of 1-1 matches + TH1D hDiffBCEvSel("hDiffBCEvSel", (runNumber + " One-to-one matches;;|#DeltaBC_{EvSel}|").data(), sel_labels.size(), 0, sel_labels.size()); // difference in BCEvSel of 1-1 matches + TH1D hDiffBC("hDiffBC", (runNumber + " One-to-one matches;;|#DeltaBC|").data(), sel_labels.size(), 0, sel_labels.size()); // difference between the BC tuple, expected to be 0 if bcDiffTolerance = 0 + TH1D hNumMatchesInSkimmed("hNumMatchesInSkimmed", (runNumber + " number of matched triggers in skimmed data;;Matched trigger count").data(), sel_labels.size(), 0, sel_labels.size()); // number of triggers in skimmed data which are compatible in the BC ranges of singles in original selection for (int i = 0; i < sel_labels.size(); i++) { // Original data @@ -558,60 +581,60 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std hSkimmedMultiples.SetBinContent(i + 1, numSkimmedMultiple[i]); hSkimmedMultiples.SetBinError(i + 1, std::sqrt(numSkimmedMultiple[i])); - // Pairs QA - hTriggerPairsRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hTriggerSinglePairsRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hPairsSameBCAO2DRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hPairsSameBCEvSelRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); + // Matches QA + hTriggerMatchesRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); + hTriggerSingleMatchesRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); + hMatchesSameBCAO2DRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); + hMatchesSameBCEvSelRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hDiffBCAO2D.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hDiffBCEvSel.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hDiffBC.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hNumPairsInSkimmed.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); + hNumMatchesInSkimmed.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); if (numpair[i] > 0) { - hPairsSameBCAO2DRatio.SetBinContent(i + 1, static_cast(numpairedBCAO2D[i]) / numpair[i]); - hPairsSameBCEvSelRatio.SetBinContent(i + 1, static_cast(numpairedBCEvSel[i]) / numpair[i]); + hMatchesSameBCAO2DRatio.SetBinContent(i + 1, static_cast(numpairedBCAO2D[i]) / numpair[i]); + hMatchesSameBCEvSelRatio.SetBinContent(i + 1, static_cast(numpairedBCEvSel[i]) / numpair[i]); } - hTriggerPairsRatio.SetBinContent(i + 1, numCloseSkimmed[i]); - hTriggerPairsRatio.SetBinError(i + 1, std::sqrt(numCloseSkimmed[i])); - hTriggerSinglePairsRatio.SetBinContent(i + 1, numpair[i]); - hTriggerSinglePairsRatio.SetBinError(i + 1, std::sqrt(numpair[i])); + hTriggerMatchesRatio.SetBinContent(i + 1, numCloseSkimmed[i]); + hTriggerMatchesRatio.SetBinError(i + 1, std::sqrt(numCloseSkimmed[i])); + hTriggerSingleMatchesRatio.SetBinContent(i + 1, numpair[i]); + hTriggerSingleMatchesRatio.SetBinError(i + 1, std::sqrt(numpair[i])); hDiffBCAO2D.SetBinContent(i + 1, avgDeltaBCAO2D[i]); hDiffBCAO2D.SetBinError(i + 1, rmsDeltaBCAO2D[i]); hDiffBCEvSel.SetBinContent(i + 1, avgDeltaBCEvSel[i]); hDiffBCEvSel.SetBinError(i + 1, rmsDeltaBCEvSel[i]); hDiffBC.SetBinContent(i + 1, avgDeltaBC[i]); hDiffBC.SetBinError(i + 1, rmsDeltaBC[i]); - hNumPairsInSkimmed.SetBinContent(i + 1, avgNumPairedTrigger[i]); - hNumPairsInSkimmed.SetBinError(i + 1, rmsNumPairedTrigger[i]); + hNumMatchesInSkimmed.SetBinContent(i + 1, avgNumPairedTrigger[i]); + hNumMatchesInSkimmed.SetBinError(i + 1, rmsNumPairedTrigger[i]); } - TH1D* hTriggerEff; // Ratio of the total number of triggers in skimmed data to that in original data + TH1D* hTriggerEff; // Ratio of the total number of triggers in skimmed data to that in original data (not the real efficiency since the downscalings are removed in skimmed for this QA) TH1D *hOriginalSinglesRatio, *hOriginalDoublesRatio, *hOriginalMultiplesRatio; TH1D *hSkimmedSinglesRatio, *hSkimmedDoublesRatio, *hSkimmedMultiplesRatio; - hTriggerEff = (TH1D*)hSkimmedTotal.Clone("hTriggerEff"); + hTriggerEff = reinterpret_cast(hSkimmedTotal.Clone("hTriggerEff")); hTriggerEff->SetTitle((runNumber + " skimmed efficiency;; Skimmed / Original").data()); hTriggerEff->Divide(&hOriginalTotal); - hTriggerPairsRatio.Divide(&hOriginalSingles); - hTriggerSinglePairsRatio.Divide(&hOriginalSingles); - hOriginalSinglesRatio = (TH1D*)hOriginalSingles.Clone("hOriginalSinglesRatio"); + hTriggerMatchesRatio.Divide(&hOriginalSingles); + hTriggerSingleMatchesRatio.Divide(&hOriginalSingles); + hOriginalSinglesRatio = reinterpret_cast(hOriginalSingles.Clone("hOriginalSinglesRatio")); hOriginalSinglesRatio->SetTitle((runNumber + " Original;;Singles / Total").data()); hOriginalSinglesRatio->Divide(&hOriginalTotal); - hOriginalDoublesRatio = (TH1D*)hOriginalDoubles.Clone("hOriginalDoublesRatio"); + hOriginalDoublesRatio = reinterpret_cast(hOriginalDoubles.Clone("hOriginalDoublesRatio")); hOriginalDoublesRatio->SetTitle((runNumber + " Original;;Doubles / Total").data()); hOriginalDoublesRatio->Divide(&hOriginalTotal); - hOriginalMultiplesRatio = (TH1D*)hOriginalMultiples.Clone("hOriginalMultiplesRatio"); + hOriginalMultiplesRatio = reinterpret_cast(hOriginalMultiples.Clone("hOriginalMultiplesRatio")); hOriginalMultiplesRatio->SetTitle((runNumber + " Original;;Multiples / Total").data()); hOriginalMultiplesRatio->Divide(&hOriginalTotal); - hSkimmedSinglesRatio = (TH1D*)hSkimmedSingles.Clone("hSkimmedSinglesRatio"); + hSkimmedSinglesRatio = reinterpret_cast(hSkimmedSingles.Clone("hSkimmedSinglesRatio")); hSkimmedSinglesRatio->SetTitle((runNumber + " Skimmed;;Singles / Total").data()); hSkimmedSinglesRatio->Divide(&hSkimmedTotal); - hSkimmedDoublesRatio = (TH1D*)hSkimmedDoubles.Clone("hSkimmedDoublesRatio"); + hSkimmedDoublesRatio = reinterpret_cast(hSkimmedDoubles.Clone("hSkimmedDoublesRatio")); hSkimmedDoublesRatio->SetTitle((runNumber + " Skimmed;;Doubles / Total").data()); hSkimmedDoublesRatio->Divide(&hSkimmedTotal); - hSkimmedMultiplesRatio = (TH1D*)hSkimmedMultiples.Clone("hSkimmedMultiplesRatio"); + hSkimmedMultiplesRatio = reinterpret_cast(hSkimmedMultiples.Clone("hSkimmedMultiplesRatio")); hSkimmedMultiplesRatio->SetTitle((runNumber + " Skimmed;;Multiples / Total").data()); hSkimmedMultiplesRatio->Divide(&hSkimmedTotal); @@ -620,11 +643,11 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std TDirectory* dir = fout.mkdir(runNumber.data()); dir->cd(); hTriggerEff->Write(); - hTriggerPairsRatio.Write(); - hTriggerSinglePairsRatio.Write(); + hTriggerMatchesRatio.Write(); + hTriggerSingleMatchesRatio.Write(); hDiffBCAO2D.Write(); hDiffBCEvSel.Write(); - hNumPairsInSkimmed.Write(); + hNumMatchesInSkimmed.Write(); if (bcDiffTolerance > 0) { hDiffBC.Write(); } @@ -644,14 +667,14 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std hSkimmedSinglesRatio->Write(); hSkimmedDoublesRatio->Write(); hSkimmedMultiplesRatio->Write(); - hPairsSameBCAO2DRatio.Write(); - hPairsSameBCEvSelRatio.Write(); + hMatchesSameBCAO2DRatio.Write(); + hMatchesSameBCEvSelRatio.Write(); fout.Close(); // Do checks for trigger for (int trgID = 0; trgID < labels.size(); trgID++) { - if (trgID == 77 || trgID == 78 || trgID == 79) { - // checkBCForSelectedTrg(originalAllFrames[trgID], skimmedAllFrames[trgID], runNumber, labels[trgID]); - } + // if (trgID == 77 || trgID == 78 || trgID == 79) { + // checkBCForSelectedTrg(originalAllFrames[trgID], skimmedAllFrames[trgID], runNumber, labels[trgID]); + //} } } diff --git a/EventFiltering/selectBCRange.cxx b/EventFiltering/selectBCRange.cxx index eabdb3db004..8a2d200e8e6 100644 --- a/EventFiltering/selectBCRange.cxx +++ b/EventFiltering/selectBCRange.cxx @@ -49,13 +49,13 @@ struct BCRangeSelector { void run(ProcessingContext& pc) { - auto bcConsumer = pc.inputs().get(aod::MetadataTrait>::metadata::tableLabel()); + auto bcConsumer = pc.inputs().get(o2::soa::getTableLabel()); auto bcTable{bcConsumer->asArrowTable()}; - auto collConsumer = pc.inputs().get(aod::MetadataTrait>::metadata::tableLabel()); + auto collConsumer = pc.inputs().get(o2::soa::getTableLabel()); auto collTable{collConsumer->asArrowTable()}; - auto evSelConsumer = pc.inputs().get(aod::MetadataTrait>::metadata::tableLabel()); + auto evSelConsumer = pc.inputs().get(o2::soa::getTableLabel()); auto evSelTable{evSelConsumer->asArrowTable()}; - auto cefpConsumer = pc.inputs().get(aod::MetadataTrait>::metadata::tableLabel()); + auto cefpConsumer = pc.inputs().get(o2::soa::getTableLabel()); auto cefpTable{cefpConsumer->asArrowTable()}; auto bcs = aod::BCs({bcTable}); diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index fb8fdaba809..3e6ca985c1f 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -52,13 +52,13 @@ DECLARE_SOA_COLUMN(BitMaskTrackThree, bitmaskTrackThree, BitMaskType); //! Bit f DECLARE_SOA_COLUMN(Downsample, downsample, bool); //! Flag for downsampling } // namespace femtodreamcollision -DECLARE_SOA_TABLE(FDCollisions, "AOD", "FDCOLLISION", - o2::soa::Index<>, - o2::aod::collision::PosZ, - femtodreamcollision::MultV0M, - femtodreamcollision::MultNtr, - femtodreamcollision::Sphericity, - femtodreamcollision::MagField); +DECLARE_SOA_TABLE_STAGED(FDCollisions, "FDCOLLISION", + o2::soa::Index<>, + o2::aod::collision::PosZ, + femtodreamcollision::MultV0M, + femtodreamcollision::MultNtr, + femtodreamcollision::Sphericity, + femtodreamcollision::MagField); using FDCollision = FDCollisions::iterator; DECLARE_SOA_TABLE(FDColMasks, "AOD", "FDCOLMASK", @@ -74,16 +74,16 @@ namespace femtodreamMCcollision DECLARE_SOA_COLUMN(MultMCgenPartEta08, multMCgenPartEta08, int); //! Multiplicity of the event as given by the generator in |eta|<0.8 } -DECLARE_SOA_TABLE(FDMCCollisions, "AOD", "FDMCCOLLISION", - o2::soa::Index<>, - femtodreamMCcollision::MultMCgenPartEta08); +DECLARE_SOA_TABLE_STAGED(FDMCCollisions, "FDMCCOLLISION", + o2::soa::Index<>, + femtodreamMCcollision::MultMCgenPartEta08); using FDMCCollision = FDMCCollisions::iterator; namespace mcfdcolllabel { DECLARE_SOA_INDEX_COLUMN(FDMCCollision, fdMCCollision); //! MC collision for femtodreamcollision } -DECLARE_SOA_TABLE(FDMCCollLabels, "AOD", "FDMCCollLabel", mcfdcolllabel::FDMCCollisionId); +DECLARE_SOA_TABLE_STAGED(FDMCCollLabels, "FDMCCollLabel", mcfdcolllabel::FDMCCollisionId); /// FemtoDreamTrack namespace femtodreamparticle @@ -166,11 +166,15 @@ DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, float); //! Nsigma separation with DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNSigmaKa, float); //! Nsigma separation with the TPC detector for kaon DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNSigmaPr, float); //! Nsigma separation with the TPC detector for proton DECLARE_SOA_COLUMN(TPCNSigmaDe, tpcNSigmaDe, float); //! Nsigma separation with the TPC detector for deuteron -DECLARE_SOA_COLUMN(TOFNSigmaEl, tofNSigmaEl, float); //! Nsigma separation with the TPC detector for electron -DECLARE_SOA_COLUMN(TOFNSigmaPi, tofNSigmaPi, float); //! Nsigma separation with the TPC detector for pion -DECLARE_SOA_COLUMN(TOFNSigmaKa, tofNSigmaKa, float); //! Nsigma separation with the TPC detector for kaon -DECLARE_SOA_COLUMN(TOFNSigmaPr, tofNSigmaPr, float); //! Nsigma separation with the TPC detector for proton -DECLARE_SOA_COLUMN(TOFNSigmaDe, tofNSigmaDe, float); //! Nsigma separation with the TPC detector for deuteron +DECLARE_SOA_COLUMN(TPCNSigmaTr, tpcNSigmaTr, float); //! Nsigma separation with the TPC detector for triton +DECLARE_SOA_COLUMN(TPCNSigmaHe, tpcNSigmaHe, float); //! Nsigma separation with the TPC detector for helium3 +DECLARE_SOA_COLUMN(TOFNSigmaEl, tofNSigmaEl, float); //! Nsigma separation with the TOF detector for electron +DECLARE_SOA_COLUMN(TOFNSigmaPi, tofNSigmaPi, float); //! Nsigma separation with the TOF detector for pion +DECLARE_SOA_COLUMN(TOFNSigmaKa, tofNSigmaKa, float); //! Nsigma separation with the TOF detector for kaon +DECLARE_SOA_COLUMN(TOFNSigmaPr, tofNSigmaPr, float); //! Nsigma separation with the TOF detector for proton +DECLARE_SOA_COLUMN(TOFNSigmaDe, tofNSigmaDe, float); //! Nsigma separation with the TOF detector for deuteron +DECLARE_SOA_COLUMN(TOFNSigmaTr, tofNSigmaTr, float); //! Nsigma separation with the TOF detector for triton +DECLARE_SOA_COLUMN(TOFNSigmaHe, tofNSigmaHe, float); //! Nsigma separation with the TOF detector for helium3 DECLARE_SOA_COLUMN(DaughDCA, daughDCA, float); //! DCA between daughters DECLARE_SOA_COLUMN(TransRadius, transRadius, float); //! Transverse radius of the decay vertex DECLARE_SOA_COLUMN(DecayVtxX, decayVtxX, float); //! X position of the decay vertex @@ -309,55 +313,59 @@ DECLARE_SOA_TABLE(FDParticlesIndex, "AOD", "FDPARTICLEINDEX", //! Table track in o2::soa::Index<>, fdhf::TrackId); -DECLARE_SOA_TABLE(FDParticles, "AOD", "FDPARTICLE", - o2::soa::Index<>, - femtodreamparticle::FDCollisionId, - femtodreamparticle::Pt, - femtodreamparticle::Eta, - femtodreamparticle::Phi, - femtodreamparticle::PartType, - femtodreamparticle::Cut, - femtodreamparticle::PIDCut, - femtodreamparticle::TempFitVar, - femtodreamparticle::ChildrenIds, - femtodreamparticle::MLambda, - femtodreamparticle::MAntiLambda, - femtodreamparticle::Theta, - femtodreamparticle::Px, - femtodreamparticle::Py, - femtodreamparticle::Pz, - femtodreamparticle::P); +DECLARE_SOA_TABLE_STAGED(FDParticles, "FDPARTICLE", + o2::soa::Index<>, + femtodreamparticle::FDCollisionId, + femtodreamparticle::Pt, + femtodreamparticle::Eta, + femtodreamparticle::Phi, + femtodreamparticle::PartType, + femtodreamparticle::Cut, + femtodreamparticle::PIDCut, + femtodreamparticle::TempFitVar, + femtodreamparticle::ChildrenIds, + femtodreamparticle::MLambda, + femtodreamparticle::MAntiLambda, + femtodreamparticle::Theta, + femtodreamparticle::Px, + femtodreamparticle::Py, + femtodreamparticle::Pz, + femtodreamparticle::P); using FDParticle = FDParticles::iterator; -DECLARE_SOA_TABLE(FDExtParticles, "AOD", "FDEXTPARTICLE", - femtodreamparticle::Sign, - femtodreamparticle::TPCNClsFound, - track::TPCNClsFindable, - femtodreamparticle::TPCNClsCrossedRows, - track::TPCNClsShared, - track::TPCInnerParam, - femtodreamparticle::ITSNCls, - femtodreamparticle::ITSNClsInnerBarrel, - track::DcaXY, - track::DcaZ, - track::TPCSignal, - femtodreamparticle::TPCNSigmaEl, - femtodreamparticle::TPCNSigmaPi, - femtodreamparticle::TPCNSigmaKa, - femtodreamparticle::TPCNSigmaPr, - femtodreamparticle::TPCNSigmaDe, - femtodreamparticle::TOFNSigmaEl, - femtodreamparticle::TOFNSigmaPi, - femtodreamparticle::TOFNSigmaKa, - femtodreamparticle::TOFNSigmaPr, - femtodreamparticle::TOFNSigmaDe, - femtodreamparticle::DaughDCA, - femtodreamparticle::TransRadius, - femtodreamparticle::DecayVtxX, - femtodreamparticle::DecayVtxY, - femtodreamparticle::DecayVtxZ, - femtodreamparticle::MKaon, - femtodreamparticle::TPCCrossedRowsOverFindableCls) +DECLARE_SOA_TABLE_STAGED(FDExtParticles, "FDEXTPARTICLE", + femtodreamparticle::Sign, + femtodreamparticle::TPCNClsFound, + track::TPCNClsFindable, + femtodreamparticle::TPCNClsCrossedRows, + track::TPCNClsShared, + track::TPCInnerParam, + femtodreamparticle::ITSNCls, + femtodreamparticle::ITSNClsInnerBarrel, + track::DcaXY, + track::DcaZ, + track::TPCSignal, + femtodreamparticle::TPCNSigmaEl, + femtodreamparticle::TPCNSigmaPi, + femtodreamparticle::TPCNSigmaKa, + femtodreamparticle::TPCNSigmaPr, + femtodreamparticle::TPCNSigmaDe, + femtodreamparticle::TPCNSigmaTr, + femtodreamparticle::TPCNSigmaHe, + femtodreamparticle::TOFNSigmaEl, + femtodreamparticle::TOFNSigmaPi, + femtodreamparticle::TOFNSigmaKa, + femtodreamparticle::TOFNSigmaPr, + femtodreamparticle::TOFNSigmaDe, + femtodreamparticle::TOFNSigmaTr, + femtodreamparticle::TOFNSigmaHe, + femtodreamparticle::DaughDCA, + femtodreamparticle::TransRadius, + femtodreamparticle::DecayVtxX, + femtodreamparticle::DecayVtxY, + femtodreamparticle::DecayVtxZ, + femtodreamparticle::MKaon, + femtodreamparticle::TPCCrossedRowsOverFindableCls) using FDFullParticle = FDExtParticles::iterator; /// FemtoDreamTrackMC @@ -403,25 +411,25 @@ DECLARE_SOA_COLUMN(PDGMCTruth, pdgMCTruth, int); //! Particle DECLARE_SOA_COLUMN(MotherPDG, motherPDG, int); //! Checks mother PDG, where mother is the primary particle for that decay chain } // namespace femtodreamMCparticle -DECLARE_SOA_TABLE(FDMCParticles, "AOD", "FDMCPARTICLE", - o2::soa::Index<>, - femtodreamMCparticle::PartOriginMCTruth, - femtodreamMCparticle::PDGMCTruth, - femtodreamparticle::Pt, - femtodreamparticle::Eta, - femtodreamparticle::Phi); +DECLARE_SOA_TABLE_STAGED(FDMCParticles, "FDMCPARTICLE", + o2::soa::Index<>, + femtodreamMCparticle::PartOriginMCTruth, + femtodreamMCparticle::PDGMCTruth, + femtodreamparticle::Pt, + femtodreamparticle::Eta, + femtodreamparticle::Phi); using FDMCParticle = FDMCParticles::iterator; -DECLARE_SOA_TABLE(FDExtMCParticles, "AOD", "FDEXTMCPARTICLE", - femtodreamMCparticle::MotherPDG); +DECLARE_SOA_TABLE_STAGED(FDExtMCParticles, "FDEXTMCPARTICLE", + femtodreamMCparticle::MotherPDG); using FDExtMCParticle = FDExtMCParticles::iterator; namespace mcfdlabel { DECLARE_SOA_INDEX_COLUMN(FDMCParticle, fdMCParticle); //! MC particle for femtodreamparticle } // namespace mcfdlabel -DECLARE_SOA_TABLE(FDMCLabels, "AOD", "FDMCLabel", //! Table joinable to FemtoDreamParticle containing the MC labels - mcfdlabel::FDMCParticleId); +DECLARE_SOA_TABLE_STAGED(FDMCLabels, "FDMCLabel", //! Table joinable to FemtoDreamParticle containing the MC labels + mcfdlabel::FDMCParticleId); namespace mcfdextlabel { DECLARE_SOA_INDEX_COLUMN(FDExtMCParticle, fdExtMCParticle); //! MC particle for femtodreamparticle @@ -443,8 +451,8 @@ namespace hash { DECLARE_SOA_COLUMN(Bin, bin, int); //! Hash for the event mixing } // namespace hash -DECLARE_SOA_TABLE(Hashes, "AOD", "HASH", hash::Bin); -using Hash = Hashes::iterator; +DECLARE_SOA_TABLE(MixingHashes, "AOD", "HASH", hash::Bin); +using MixingHash = MixingHashes::iterator; } // namespace o2::aod diff --git a/PWGCF/DataModel/SPTableZDC.h b/PWGCF/DataModel/SPTableZDC.h new file mode 100644 index 00000000000..fcafff23c90 --- /dev/null +++ b/PWGCF/DataModel/SPTableZDC.h @@ -0,0 +1,57 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file SPTableZDC.h + +#ifndef PWGCF_DATAMODEL_SPTABLEZDC_H_ +#define PWGCF_DATAMODEL_SPTABLEZDC_H_ + +#include + +#include "Common/DataModel/PIDResponse.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace sptablezdc +{ +DECLARE_SOA_COLUMN(Runnumber, runnumber, int); +DECLARE_SOA_COLUMN(Cent, cent, float); +DECLARE_SOA_COLUMN(Vx, vx, float); +DECLARE_SOA_COLUMN(Vy, vy, float); +DECLARE_SOA_COLUMN(Vz, vz, float); +DECLARE_SOA_COLUMN(QXA, qxA, float); +DECLARE_SOA_COLUMN(QYA, qyA, float); +DECLARE_SOA_COLUMN(QXC, qxC, float); +DECLARE_SOA_COLUMN(QYC, qyC, float); +DECLARE_SOA_COLUMN(IsSelected, isSelected, bool); +DECLARE_SOA_COLUMN(Iteration, iteration, int); +DECLARE_SOA_COLUMN(Step, step, int); + +} // namespace sptablezdc + +DECLARE_SOA_TABLE(SPTableZDC, "AOD", "SPZDC", + sptablezdc::Runnumber, + sptablezdc::Cent, + sptablezdc::Vx, + sptablezdc::Vy, + sptablezdc::Vz, + sptablezdc::QXA, + sptablezdc::QYA, + sptablezdc::QXC, + sptablezdc::QYC, + sptablezdc::IsSelected, + sptablezdc::Iteration, + sptablezdc::Step); +} // namespace o2::aod +#endif // PWGCF_DATAMODEL_SPTABLEZDC_H_ diff --git a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt index 1332c9ef1dd..d22d2af4dd7 100644 --- a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt +++ b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt @@ -15,7 +15,7 @@ o2physics_add_dpl_workflow(meanpt-fluctuations COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(mean-pt-fluc-id - SOURCES MeanPtFlucIdentified.cxx + SOURCES meanPtFlucId.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx deleted file mode 100644 index 5d0ed29cc60..00000000000 --- a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx +++ /dev/null @@ -1,1086 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file MeanPtFlucIdentified.cxx -/// \brief Calculate EbyE fluctuations with cumulant method. -/// For charged particles and identified particles. -/// For RUN-3 -/// -/// \author Tanu Gahlaut - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/HistogramSpec.h" -#include "Framework/O2DatabasePDGPlugin.h" - -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/Core/RecoDecay.h" - -#include - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::constants::physics; -using namespace std; - -struct meanPtFlucId { - Configurable nPtBins{"nPtBins", 300, ""}; - Configurable nPartBins{"nPartBins", 250, ""}; - Configurable nCentBins{"nCentBins", 101, ""}; - Configurable nEtaBins{"nEtaBins", 100, ""}; - Configurable nPhiBins{"nPhiBins", 100, ""}; - Configurable cfgCutPtMax{"cfgCutPtMax", 3.0, "maximum pT"}; - Configurable cfgCutPtMin{"cfgCutPtMin", 0.15, "minimum pT"}; - Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut"}; - Configurable cfgCutRap{"cfgCutRap", 0.5, "Rapidity Cut"}; - Configurable cfgCutDcaXY{"cfgCutDcaXY", 0.12, "DCAxy cut"}; - Configurable cfgCutDcaZ{"cfgCutDcaZ", 0.3, "DCAz cut"}; - Configurable cfgCutPosZ{"cfgCutPosZ", 10.0, "cut for vertex Z"}; - Configurable cfgGammaCut{"cfgGammaCut", 0.003, "Gamma inv Mass Cut for electron-positron rejection"}; - Configurable cfgCutNSigTpcEl{"cfgCutNSigTpcEl", 1.5, "TPC nSigma Electron veto cut"}; - Configurable cfgCutNSigTofEl{"cfgCutNSigTofEl", 1.5, "TOF nSigma Electron veto cut"}; - Configurable cfgCutNSig2{"cfgCutNSig2", 2.0, "nSigma cut (2)"}; - Configurable cfgCutNSig3{"cfgCutNSig3", 3.0, "nSigma cut (3)"}; - Configurable cfgCutPiPtMin{"cfgCutPiPtMin", 0.2, "Minimum pion p_{T} cut"}; - Configurable cfgCutKaPtMin{"cfgCutKaPtMin", 0.3, "Minimum kaon p_{T} cut"}; - Configurable cfgCutPrPtMin{"cfgCutPrPtMin", 0.5, "Minimum proton p_{T} cut"}; - Configurable cfgCutPiThrsldP{"cfgCutPiThrsldP", 0.6, "Threshold p cut pion"}; - Configurable cfgCutKaThrsldP{"cfgCutKaThrsldP", 0.6, "Threshold p cut kaon"}; - Configurable cfgCutPrThrsldP{"cfgCutPrThrsldP", 1.0, "Threshold p cut proton "}; - Configurable cfgCutPiP1{"cfgCutPiP1", 0.5, "pion p cut-1"}; - Configurable cfgCutPiP2{"cfgCutPiP2", 0.6, "pion p cut-2"}; - Configurable cfgCutKaP1{"cfgCutKaP1", 0.4, "kaon p cut-1"}; - Configurable cfgCutKaP2{"cfgCutKaP2", 0.6, "kaon p cut-2"}; - Configurable cfgCutKaP3{"cfgCutKaP3", 1.2, "kaon p cut-3"}; - Configurable cfgCutPrP1{"cfgCutPrP1", 0.9, "proton p cut-1"}; - Configurable cfgCutPrP2{"cfgCutPrP2", 1.0, "proton p cut-2"}; - Configurable cfgMcTpcShiftEl{"cfgMcTpcShiftEl", 0., "Electron Shift in TPC (MC data) "}; - Configurable cfgMcTpcShiftPi{"cfgMcTpcShiftPi", 0., "Pion Shift in TPC (MC data) "}; - Configurable cfgMcTpcShiftKa{"cfgMcTpcShiftKa", 0., "Kaon Shift in TPC (MC data) "}; - Configurable cfgMcTpcShiftPr{"cfgMcTpcShiftPr", 0., "Proton Shift in TPC (MC data) "}; - Configurable cfgInvMass{"cfgInvMass", true, "electron Inv Mass cut selection"}; - Configurable cfgSelORPi{"cfgSelORPi", true, "Low OR High momentum for Pions"}; - Configurable cfgSelORKa{"cfgSelORKa", true, "Low OR High momentum for Kaons"}; - Configurable cfgSelORPr{"cfgSelORPr", true, "Low OR High momentum for Protons"}; - Configurable cfgSelANDPi{"cfgSelANDPi", false, "Low AND High momentum for Pions"}; - Configurable cfgSelANDKa{"cfgSelANDKa", false, "Low AND High momentum for Kaons"}; - Configurable cfgSelANDPr{"cfgSelANDPr", false, "Low AND High momentum for Protons"}; - Configurable cfgSelLowPi{"cfgSelLowPi", true, "PID selection cut for Low momentum Pions"}; - Configurable cfgSelLowKa{"cfgSelLowKa", true, "PID selection cut for Low momentum Kaons"}; - Configurable cfgSelLowPr{"cfgSelLowPr", true, "PID selection cut for Low momentum Protons"}; - Configurable cfgSelHighPi{"cfgSelHighPi", true, "PID selection cut for High momentum Pions"}; - Configurable cfgSelHighKa{"cfgSelHighKa", true, "PID selection cut for High momentum Kaons"}; - Configurable cfgSelHighPr{"cfgSelHighPr", true, "PID selection cut for High momentum Protons"}; - ConfigurableAxis multTPCBins{"multTPCBins", {150, 0, 150}, "TPC Multiplicity bins"}; - ConfigurableAxis multFT0CBins{"multFT0CBins", {200, 0, 2000}, "Forward Multiplicity bins"}; - ConfigurableAxis multFT0CMCBins{"multFT0CMCBins", {250, 0, 250}, "Forward Multiplicity bins"}; - ConfigurableAxis dcaXYBins{"dcaXYBins", {100, -0.15, 0.15}, "dcaXY bins"}; - ConfigurableAxis dcaZBins{"dcaZBins", {100, -1.2, 1.2}, "dcaZ bins"}; - ConfigurableAxis QnBins{"QnBins", {1000, 0., 100.}, "nth moments bins"}; - ConfigurableAxis TpNBins{"TpNBins", {300, 0., 3000.}, ""}; - ConfigurableAxis TpDBins{"TpDBins", {100, 0., 2000.}, ""}; - - using MyAllTracks = soa::Join; - using MyCollisions = soa::Join; - using MyMCCollisions = soa::Join; - using MyMCTracks = soa::Join; - - Service pdg; - - HistogramRegistry hist{"hist", {}, OutputObjHandlingPolicy::AnalysisObject}; - void init(InitContext const&) - { - const AxisSpec axisEvents{6, 0, 6, "Counts"}; - const AxisSpec axisEta{nEtaBins, -1., +1., "#eta"}; - const AxisSpec axisPhi{nPhiBins, 0., +7., "#phi (rad)"}; - const AxisSpec axisY{nEtaBins, -1., +1., "y"}; - const AxisSpec axisPt{nPtBins, 0., 3., "p_{T} (GeV/c)"}; - const AxisSpec axisP{nPtBins, 0., 3., "p (GeV/c)"}; - const AxisSpec axisInnerParam{nPtBins, 0., 3., "p_{InnerParam } (GeV/c)"}; - const AxisSpec axisPart{nPartBins, 0., 18., " "}; - const AxisSpec axisQn{QnBins, ""}; - const AxisSpec axisTpN{TpNBins, "(Q_{1}^{2} - Q_{2})"}; - const AxisSpec axisTpD{TpDBins, "N_{pairs}"}; - const AxisSpec axisDeno{100, 1., 2.0, "#frac{1}{#sqrt{1 - #frac{1}{N}}}"}; - const AxisSpec axisMeanPt{100, 0., 3., "M(p_{T}) (GeV/c)"}; - const AxisSpec axisMult{100, 0, 100, "N_{ch}"}; - const AxisSpec axisMultTPC{multTPCBins, "N_{TPC} "}; - const AxisSpec axisMultFT0C{multFT0CBins, "N_{FT0C}"}; - const AxisSpec axisMultFT0CMC{multFT0CMCBins, "N_{FT0C}"}; - const AxisSpec axisCentFT0C{nCentBins, 0, 101, "FT0C (%)"}; - const AxisSpec axisVtxZ{80, -20., 20., "V_{Z} (cm)"}; - const AxisSpec axisDCAz{dcaZBins, "DCA_{Z} (cm)"}; - const AxisSpec axisDCAxy{dcaXYBins, "DCA_{XY} (cm)"}; - const AxisSpec axisTPCNsigma{500, -5., 5., "n #sigma_{TPC}"}; - const AxisSpec axisTOFNsigma{500, -5., 5., "n #sigma_{TOF}"}; - const AxisSpec axisTPCSignal{100, 20., 500., "#frac{dE}{dx}"}; - const AxisSpec axisTOFSignal{200, 0.2, 1.2, "TOF #beta"}; - const AxisSpec axisChi2{40, 0., 40., "Chi2"}; - const AxisSpec axisCrossedTPC{300, 0, 300, "Crossed TPC"}; - const AxisSpec axisM2{100, 0., 1.4, "#it{m}^{2} (GeV/#it{c}^{2})^{2}"}; - const AxisSpec axisMass{3000, 0., 0.3, "M_{inv} (GeV/#it{c}^2)"}; - - HistogramConfigSpec QnHist({HistType::kTHnSparseD, {axisMultTPC, axisQn, axisMultFT0C}}); - HistogramConfigSpec PartHist({HistType::kTHnSparseD, {axisMultTPC, axisPart, axisMultFT0C}}); - HistogramConfigSpec DenoHist({HistType::kTHnSparseD, {axisMultTPC, axisDeno, axisMultFT0C}}); - HistogramConfigSpec QnMCHist({HistType::kTHnSparseD, {axisMultTPC, axisQn, axisMultFT0CMC}}); - HistogramConfigSpec PartMCHist({HistType::kTHnSparseD, {axisMultTPC, axisPart, axisMultFT0CMC}}); - HistogramConfigSpec DenoMCHist({HistType::kTHnSparseD, {axisMultTPC, axisDeno, axisMultFT0CMC}}); - HistogramConfigSpec TOFnSigmaHist({HistType::kTH2D, {axisP, axisTOFNsigma}}); - HistogramConfigSpec TOFSignalHist({HistType::kTH2D, {axisP, axisTOFSignal}}); - HistogramConfigSpec TPCnSigmaHist({HistType::kTH2D, {axisP, axisTPCNsigma}}); - HistogramConfigSpec TPCSignalHist({HistType::kTH2D, {axisP, axisTPCSignal}}); - HistogramConfigSpec TPCTOFHist({HistType::kTH2D, {axisTPCNsigma, axisTOFNsigma}}); - HistogramConfigSpec PvsM2Hist({HistType::kTH2D, {axisM2, axisP}}); - - HistogramConfigSpec TOFnSigmaHist1({HistType::kTH2D, {axisInnerParam, axisTOFNsigma}}); - HistogramConfigSpec TOFSignalHist1({HistType::kTH2D, {axisInnerParam, axisTOFSignal}}); - HistogramConfigSpec TPCnSigmaHist1({HistType::kTH2D, {axisInnerParam, axisTPCNsigma}}); - HistogramConfigSpec TPCSignalHist1({HistType::kTH2D, {axisInnerParam, axisTPCSignal}}); - HistogramConfigSpec TPCTOFHist1({HistType::kTH2D, {axisTPCNsigma, axisTOFNsigma}}); - HistogramConfigSpec PvsM2Hist1({HistType::kTH2D, {axisM2, axisInnerParam}}); - - // QA Plots: - hist.add("QA/before/h_Counts", "Counts", kTH1D, {axisEvents}); - hist.add("QA/before/h_VtxZ", "V_{Z}", kTH1D, {axisVtxZ}); - hist.add("QA/before/h_TPCChi2perCluster", "TPC #Chi^{2}/Cluster", kTH1D, {axisChi2}); - hist.add("QA/before/h_ITSChi2perCluster", "ITS #Chi^{2}/Cluster", kTH1D, {axisChi2}); - hist.add("QA/before/h_crossedTPC", "Crossed TPC", kTH1D, {axisCrossedTPC}); - hist.add("QA/before/h_Pt", "p_{T}", kTH1D, {axisPt}); - hist.add("QA/before/h2_PvsPinner", "p_{InnerParam} vs p", kTH2D, {{axisP}, {axisInnerParam}}); - hist.add("QA/before/h2_PtofvsPinner", "p_{InnerParam} vs p_{TOF}", kTH2D, {{axisP}, {axisInnerParam}}); - hist.add("QA/before/h_Eta", "#eta ", kTH1D, {axisEta}); - hist.add("QA/before/h_Phi", "#phi ", kTH1D, {axisPhi}); - hist.add("QA/before/h2_Pt_Eta", "p_{T} vs #eta ", kTH2D, {{axisEta}, {axisPt}}); - hist.add("QA/before/h_DcaZ", "DCA_{Z}", kTH1D, {axisDCAz}); - hist.add("QA/before/h_DcaXY", "DCA_{XY}", kTH1D, {axisDCAxy}); - hist.add("QA/before/h2_DcaZ", "DCA_{Z}", kTH2D, {{axisPt}, {axisDCAz}}); - hist.add("QA/before/h2_DcaXY", "DCA_{XY}", kTH2D, {{axisPt}, {axisDCAxy}}); - hist.add("QA/before/h_NTPC", "N_{TPC}", kTH1D, {axisMultTPC}); - hist.add("QA/before/h_NFT0C", "FT0C Multiplicity", kTH1D, {axisMultFT0C}); - hist.add("QA/before/h_Cent", "FT0C (%)", kTH1D, {axisCentFT0C}); - hist.add("QA/before/h2_NTPC_Cent", "N_{TPC} vs FT0C(%)", kTH2D, {{axisCentFT0C}, {axisMultTPC}}); - hist.add("QA/before/h2_NTPC_NFT0C", "N_{TPC} vs N_{FT0C}", kTH2D, {{axisMultFT0C}, {axisMultTPC}}); - - hist.add("QA/before/h2_TPCSignal", "TPC Signal", TPCSignalHist); - hist.add("QA/before/h2_TOFSignal", "TOF Signal", TOFSignalHist); - hist.add("QA/before/h2_pvsm2", "p vs m^{2}", PvsM2Hist); - - hist.add("QA/before/innerParam/h2_TPCSignal", "TPC Signal", TPCSignalHist1); - hist.add("QA/before/innerParam/h2_TOFSignal", "TOF Signal", TOFSignalHist1); - hist.add("QA/before/innerParam/h2_pvsm2", "p vs m^{2}", PvsM2Hist1); - - hist.addClone("QA/before/", "QA/after/"); - - hist.add("QA/after/p_NTPC_NFT0C", "N_{TPC} vs N_{FT0C} (Profile)", kTProfile, {axisMultFT0C}); - hist.add("QA/after/p_NTPC_Cent", "N_{TPC} vs FT0C(%) (Profile)", kTProfile, {axisCentFT0C}); - hist.add("QA/after/h2_NTPC_Nch", "N_{ch} vs N_{TPC}", kTH2D, {{axisMultTPC}, {axisMult}}); - hist.add("QA/after/h_invMass_gamma", "Inv Mass of #gamma", kTH1D, {axisMass}); - hist.add("QA/after/counts_evSelCuts", "Event selection cuts", kTH1D, {axisEvents}); - - hist.add("QA/Pion/h_Pt", "p_{T} ", kTH1D, {axisPt}); - hist.add("QA/Pion/h_allPt", "p_{T} ", kTH1D, {axisPt}); - hist.add("QA/Pion/h_PtPos", "p_{T} (positive) ", kTH1D, {axisPt}); - hist.add("QA/Pion/h_allPtPos", "p_{T} (positive) ", kTH1D, {axisPt}); - hist.add("QA/Pion/h_allPtNeg", "p_{T} (negative) ", kTH1D, {axisPt}); - hist.add("QA/Pion/h_PtNeg", "p_{T} (negative) ", kTH1D, {axisPt}); - hist.add("QA/Pion/h_rap", "y ", kTH1D, {axisY}); - hist.add("QA/Pion/h_Eta", "Pseudorapidity ", kTH1D, {axisEta}); - hist.add("QA/Pion/h_Phi", "Azimuthal Distribution ", kTH1D, {axisPhi}); - hist.add("QA/Pion/h2_Pt_rap", "p_{T} vs y", kTH2D, {{axisY}, {axisPt}}); - hist.add("QA/Pion/h_DcaZ", "DCA_{z}", kTH1D, {axisDCAz}); - hist.add("QA/Pion/h_DcaXY", "DCA_{xy}", kTH1D, {axisDCAxy}); - hist.add("QA/Pion/h2_DcaZ", "DCA_{z}", kTH2D, {{axisPt}, {axisDCAz}}); - hist.add("QA/Pion/h2_DcaXY", "DCA_{xy}", kTH2D, {{axisPt}, {axisDCAxy}}); - hist.add("QA/Pion/h2_P_Pinner", "p_{TPCinner} vs p", kTH2D, {{axisP}, {axisInnerParam}}); - hist.add("QA/Pion/h2_Pt_Pinner", "p_{TPCinner} vs p_{T}", kTH2D, {{axisPt}, {axisInnerParam}}); - - hist.add("QA/Pion/before/h2_TPCNsigma", "n #sigma_{TPC}", TPCnSigmaHist); - hist.add("QA/Pion/before/h2_TOFNsigma", "n #sigma_{TOF}", TOFnSigmaHist); - hist.add("QA/Pion/before/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", TPCTOFHist); - hist.add("QA/Pion/h2_TPCNsigma", "n #sigma_{TPC}", TPCnSigmaHist); - hist.add("QA/Pion/h2_TPCNsigma_El", "n #sigma_{TPC, El}", TPCnSigmaHist); - hist.add("QA/Pion/h2_TOFNsigma_El", "n #sigma_{TOF, El}", TOFnSigmaHist); - hist.add("QA/Pion/h2_TOFNsigma", "n #sigma_{TOF}", TOFnSigmaHist); - hist.add("QA/Pion/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", TPCTOFHist); - hist.add("QA/Pion/h2_TPCSignal", "TPC Signal ", TPCSignalHist); - hist.add("QA/Pion/h2_TOFSignal", "TOF Signal", TOFSignalHist); - hist.add("QA/Pion/h2_pvsm2", "p vs m^{2}", PvsM2Hist); - - hist.add("QA/Pion/innerParam/before/h2_TPCNsigma", "n #sigma_{TPC}", TPCnSigmaHist1); - hist.add("QA/Pion/innerParam/before/h2_TOFNsigma", "n #sigma_{TOF}", TOFnSigmaHist1); - hist.add("QA/Pion/innerParam/before/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", TPCTOFHist1); - hist.add("QA/Pion/innerParam/h2_TPCNsigma", "n #sigma_{TPC}", TPCnSigmaHist1); - hist.add("QA/Pion/innerParam/h2_TPCNsigma_El", "n #sigma_{TPC, El}", TPCnSigmaHist1); - hist.add("QA/Pion/innerParam/h2_TOFNsigma_El", "n #sigma_{TOF, El}", TOFnSigmaHist1); - hist.add("QA/Pion/innerParam/h2_TOFNsigma", "n #sigma_{TOF}", TOFnSigmaHist1); - hist.add("QA/Pion/innerParam/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", TPCTOFHist1); - hist.add("QA/Pion/innerParam/h2_TPCSignal", "TPC Signal ", TPCSignalHist1); - hist.add("QA/Pion/innerParam/h2_TOFSignal", "TOF Signal", TOFSignalHist1); - hist.add("QA/Pion/innerParam/h2_pvsm2", "p vs m^{2}", PvsM2Hist1); - - hist.addClone("QA/Pion/", "QA/Kaon/"); - hist.addClone("QA/Pion/", "QA/Proton/"); - - // Analysis Plots: - hist.add("Analysis/Charged/h_Mult", "Multiplicity", kTH1D, {axisMult}); - hist.add("Analysis/Charged/h_Q1", "Q1", QnHist); - hist.add("Analysis/Charged/h_Q2", "Q2", QnHist); - hist.add("Analysis/Charged/h_Q3", "Q3", QnHist); - hist.add("Analysis/Charged/h_Q4", "Q4", QnHist); - hist.add("Analysis/Charged/h_mean_pT", " ", kTH1D, {axisMeanPt}); - hist.add("Analysis/Charged/p_mean_pT_Mult_var", " ", kTProfile, {axisMultTPC}); - hist.add("Analysis/Charged/p_CheckNCH", " 1/denominator vs N_{TPC} ", kTProfile, {axisMultTPC}); - hist.add("Analysis/Charged/h_CheckNCH", " 1/denominator vs N_{TPC} ", DenoHist); - hist.add("Analysis/Charged/h_Q1_var", "Q1 vs N_{TPC}", QnHist); - hist.add("Analysis/Charged/h_N_var", "N vs N_{TPC}", kTHnSparseD, {axisMultTPC, axisMult, axisMultFT0C}); - hist.add("Analysis/Charged/h_twopart_nume_Mult_var", "twopart numerator", kTHnSparseD, {axisMultTPC, axisTpN, axisMultFT0C}); - hist.add("Analysis/Charged/h_twopart_deno_Mult_var", "twopart denominator", kTHnSparseD, {axisMultTPC, axisTpD, axisMultFT0C}); - hist.add("Analysis/Charged/h_mean_pT_Mult_var", " vs N_{TPC} ", PartHist); - hist.add("Analysis/Charged/h_mean_pT_Mult_skew", " vs N_{TPC} ", PartHist); - hist.add("Analysis/Charged/h_mean_pT_Mult_kurto", " vs N_{TPC} ", PartHist); - hist.add("Analysis/Charged/h_twopart_Mult_var", "Twopart vs N_{TPC} ", PartHist); - hist.add("Analysis/Charged/h_twopart_Mult_skew", "Twopart vs N_{TPC} ", PartHist); - hist.add("Analysis/Charged/h_twopart_Mult_kurto", "Twopart vs N_{TPC} ", PartHist); - hist.add("Analysis/Charged/h_threepart_Mult_skew", "Threepart vs N_{TPC} ", PartHist); - hist.add("Analysis/Charged/h_threepart_Mult_kurto", "Threepart vs N_{TPC} ", PartHist); - hist.add("Analysis/Charged/h_fourpart_Mult_kurto", "Fourpart vs N_{TPC} ", PartHist); - - hist.addClone("Analysis/Charged/", "Analysis/Pion/"); - hist.addClone("Analysis/Charged/", "Analysis/Kaon/"); - hist.addClone("Analysis/Charged/", "Analysis/Proton/"); - - // MC Generated - hist.add("Gen/Counts", "Counts", kTH1D, {axisEvents}); - hist.add("Gen/vtxZ", "Vertex Z ", kTH1D, {axisVtxZ}); - hist.add("Gen/NTPC", "Mid rapidity Multiplicity", kTH1D, {axisMultTPC}); - hist.add("Gen/NFT0C", "Forward Multiplicity", kTH1D, {axisMultFT0C}); - hist.add("Gen/h2_NTPC_NFT0C", "N_{TPC} vs N_{FT0C}", kTH2D, {{axisMultFT0CMC}, {axisMultTPC}}); - hist.add("Gen/Charged/h_Pt", "p_{T} ", kTH1D, {axisPt}); - hist.add("Gen/Charged/h_PtPos", "p_{T} (Positive)", kTH1D, {axisPt}); - hist.add("Gen/Charged/h_PtNeg", "p_{T} (negative)", kTH1D, {axisPt}); - - hist.add("Gen/Charged/h_Mult", "Multiplicity", kTH1D, {axisMult}); - hist.add("Gen/Charged/h_mean_pT", " ", kTH1D, {axisMeanPt}); - - hist.add("Gen/Charged/h_Q1", "Q1", QnMCHist); - hist.add("Gen/Charged/h_Q2", "Q2", QnMCHist); - hist.add("Gen/Charged/h_Q3", "Q3", QnMCHist); - hist.add("Gen/Charged/h_Q4", "Q4", QnMCHist); - hist.add("Gen/Charged/h_Q1_var", "Q1 vs N_{TPC}", QnMCHist); - hist.add("Gen/Charged/h_N_var", "N vs N_{TPC}", kTHnSparseD, {axisMultTPC, axisMult, axisMultFT0CMC}); - hist.add("Gen/Charged/h_twopart_nume_Mult_var", "twopart numerator", kTHnSparseD, {axisMultTPC, axisTpN, axisMultFT0CMC}); - hist.add("Gen/Charged/h_twopart_deno_Mult_var", "twopart denominator", kTHnSparseD, {axisMultTPC, axisTpD, axisMultFT0CMC}); - - hist.add("Gen/Charged/p_mean_pT_Mult_var", " ", kTProfile, {axisMultTPC}); - hist.add("Gen/Charged/p_CheckNCH", " 1/denominator vs N_{TPC} ", kTProfile, {axisMultTPC}); - hist.add("Gen/Charged/h_CheckNCH", " 1/denominator vs N_{TPC} ", DenoMCHist); - hist.add("Gen/Charged/h_mean_pT_Mult_var", " vs N_{TPC} ", PartMCHist); - hist.add("Gen/Charged/h_mean_pT_Mult_skew", " vs N_{TPC} ", PartMCHist); - hist.add("Gen/Charged/h_mean_pT_Mult_kurto", " vs N_{TPC} ", PartMCHist); - hist.add("Gen/Charged/h_twopart_Mult_var", "Twopart vs N_{TPC} ", PartMCHist); - hist.add("Gen/Charged/h_twopart_Mult_skew", "Twopart vs N_{TPC} ", PartMCHist); - hist.add("Gen/Charged/h_twopart_Mult_kurto", "Twopart vs N_{TPC} ", PartMCHist); - hist.add("Gen/Charged/h_threepart_Mult_skew", "Threepart vs N_{TPC} ", PartMCHist); - hist.add("Gen/Charged/h_threepart_Mult_kurto", "Threepart vs N_{TPC} ", PartMCHist); - hist.add("Gen/Charged/h_fourpart_Mult_kurto", "Fourpart vs N_{TPC} ", PartMCHist); - - hist.addClone("Gen/Charged/", "Gen/Pion/"); - hist.addClone("Gen/Charged/", "Gen/Kaon/"); - hist.addClone("Gen/Charged/", "Gen/Proton/"); - } - - enum mode { - QA_Pion = 0, - QA_Kaon, - QA_Proton, - Analysis_Charged, - Analysis_Pion, - Analysis_Kaon, - Analysis_Proton, - Gen_Charged, - Gen_Pion, - Gen_Kaon, - Gen_Proton - }; - - static constexpr std::string_view dire[] = { - "QA/Pion/", - "QA/Kaon/", - "QA/Proton/", - "Analysis/Charged/", - "Analysis/Pion/", - "Analysis/Kaon/", - "Analysis/Proton/", - "Gen/Charged/", - "Gen/Pion/", - "Gen/Kaon/", - "Gen/Proton/"}; - - // Event selection cuts: - template - bool selRun3Col(T const& col) - { - if (std::abs(col.posZ()) > cfgCutPosZ) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 1); - - if (!col.sel8()) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 2); - - if (!col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 3); - - if (!col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 4); - - if (!col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 5); - - return true; - } - - // Track selection cuts: - template - bool selTrack(T const& track) - { - if (!track.isGlobalTrackWoPtEta()) - return false; - - if (track.pt() < cfgCutPtMin) - return false; - - if (track.pt() > cfgCutPtMax) - return false; - - if (track.sign() == 0) - return false; - - if (std::fabs(track.dcaZ()) > cfgCutDcaZ) - return false; - - if (std::fabs(track.dcaXY()) > cfgCutDcaXY) - return false; - - return true; - } - - // Cuts to reject the tracks - template - bool rejectTracks(T const& track) - { - if ((track.tpcNSigmaEl() + cfgMcTpcShiftEl) > -3. && (track.tpcNSigmaEl() + cfgMcTpcShiftEl) < 5. && std::fabs(track.tpcNSigmaPi() + cfgMcTpcShiftPi) > 3 && std::fabs(track.tpcNSigmaKa() + cfgMcTpcShiftKa) > 3 && std::fabs(track.tpcNSigmaPr() + cfgMcTpcShiftPr) > 3) { - return true; - } - - return false; - } - - template - bool selElectrons(T const& track) - { - if (std::fabs(track.tpcNSigmaEl() + cfgMcTpcShiftEl) < cfgCutNSig3) { - return true; - } - - return false; - } - - // PID selction cuts for Low momentum Pions - template - bool selLowPi(T const& track, double p) - { - if (track.pt() >= cfgCutPiPtMin && std::fabs(track.tpcNSigmaKa() + cfgMcTpcShiftKa) > 3 && std::fabs(track.tpcNSigmaPr() + cfgMcTpcShiftPr) > 3 && track.p() <= cfgCutPiThrsldP && - ((std::fabs(track.tpcNSigmaPi() + cfgMcTpcShiftPi) < cfgCutNSig3 && p <= cfgCutPiP1) || - (std::fabs(track.tpcNSigmaPi() + cfgMcTpcShiftPi) < cfgCutNSig2 && p > cfgCutPiP1 && p <= cfgCutPiP2))) { - if (std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { - return true; - } - } - return false; - } - - // PID selction cuts for Low momentum Kaons - template - bool selLowKa(T const& track, double p) - { - if (track.pt() >= cfgCutKaPtMin && std::fabs(track.tpcNSigmaPi() + cfgMcTpcShiftPi) > 3 && std::fabs(track.tpcNSigmaPr() + cfgMcTpcShiftPr) > 3 && track.p() <= cfgCutKaThrsldP && - ((std::fabs(track.tpcNSigmaKa() + cfgMcTpcShiftKa) < cfgCutNSig3 && p <= cfgCutKaP1) || - (std::fabs(track.tpcNSigmaKa() + cfgMcTpcShiftKa) < cfgCutNSig2 && p > cfgCutKaP1 && p <= cfgCutKaP2))) { - if (std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { - return true; - } - } - - return false; - } - - // PID selction cuts for Low momentum Protons - template - bool selLowPr(T const& track, double p) - { - if (track.pt() >= cfgCutPrPtMin && std::fabs(track.tpcNSigmaKa() + cfgMcTpcShiftKa) > 3 && std::fabs(track.tpcNSigmaPi() + cfgMcTpcShiftPi) > 3 && track.p() <= cfgCutPrThrsldP && - ((std::fabs(track.tpcNSigmaPr() + cfgMcTpcShiftPr) < cfgCutNSig3 && p <= cfgCutPrP1) || - (std::fabs(track.tpcNSigmaPr() + cfgMcTpcShiftPr) < cfgCutNSig2 && p > cfgCutPrP1 && p <= cfgCutPrP2))) { - if (std::abs(track.rapidity(MassProton)) < cfgCutRap) { - return true; - } - } - - return false; - } - - // PID selction cuts for High momentum Protons - template - bool selHighPi(T const& track) - { - if (track.p() > cfgCutPiThrsldP && (track.hasTOF() && std::fabs(track.tpcNSigmaPi() + cfgMcTpcShiftPi) < cfgCutNSig3 && (std::fabs(track.tofNSigmaPi()) < cfgCutNSig3))) { - if (std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { - return true; - } - } - - return false; - } - - // PID selction cuts for High momentum Kaons - template - bool selHighKa(T const& track) - { - if (track.p() > cfgCutKaThrsldP && (track.hasTOF() && std::fabs(track.tpcNSigmaKa() + cfgMcTpcShiftKa) < cfgCutNSig3 && - ((std::fabs(track.tofNSigmaKa()) < cfgCutNSig3 && track.p() <= cfgCutKaP3) || - (std::fabs(track.tofNSigmaKa()) < cfgCutNSig2 && track.p() > cfgCutKaP3)))) { - if (std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { - return true; - } - } - - return false; - } - - // PID selction cuts for High momentum Protons - template - bool selHighPr(T const& track) - { - if (track.p() > cfgCutPrThrsldP && (track.hasTOF() && std::fabs(track.tpcNSigmaPr() + cfgMcTpcShiftPr) < cfgCutNSig3 && std::fabs(track.tofNSigmaPr()) < cfgCutNSig3)) { - if (std::abs(track.rapidity(MassProton)) < cfgCutRap) { - return true; - } - } - - return false; - } - - // Fill hist before selection cuts: - template - void FillBeforeQAHistos(T const& col, U const& tracks) - { - for (auto& track : tracks) { - hist.fill(HIST("QA/before/h_Eta"), track.eta()); - hist.fill(HIST("QA/before/h_Phi"), track.phi()); - hist.fill(HIST("QA/before/h_Pt"), track.pt()); - hist.fill(HIST("QA/before/h2_PvsPinner"), track.p(), track.tpcInnerParam()); - hist.fill(HIST("QA/before/h2_Pt_Eta"), track.eta(), track.pt()); - hist.fill(HIST("QA/before/h_TPCChi2perCluster"), track.tpcChi2NCl()); - hist.fill(HIST("QA/before/h_ITSChi2perCluster"), track.itsChi2NCl()); - hist.fill(HIST("QA/before/h_crossedTPC"), track.tpcNClsCrossedRows()); - hist.fill(HIST("QA/before/h_DcaXY"), track.dcaXY()); - hist.fill(HIST("QA/before/h_DcaZ"), track.dcaZ()); - hist.fill(HIST("QA/before/h2_DcaXY"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/before/h2_DcaZ"), track.pt(), track.dcaZ()); - - if (track.hasTOF()) - hist.fill(HIST("QA/before/h2_PtofvsPinner"), track.p(), track.tpcInnerParam()); - } - hist.fill(HIST("QA/before/h_VtxZ"), col.posZ()); - hist.fill(HIST("QA/before/h_Counts"), 2); - - int NTPC = col.multNTracksHasTPC(); - int N_FT0C = col.multFT0C(); - double cent_FT0C = col.centFT0C(); - - if (NTPC != 0 && N_FT0C != 0) { - hist.fill(HIST("QA/before/h_NTPC"), NTPC); - hist.fill(HIST("QA/before/h_Cent"), cent_FT0C); - hist.fill(HIST("QA/before/h_NFT0C"), N_FT0C); - hist.fill(HIST("QA/before/h2_NTPC_NFT0C"), N_FT0C, NTPC); - hist.fill(HIST("QA/before/h2_NTPC_Cent"), cent_FT0C, NTPC); - } - } - - // Fill hist after selection cuts: - template - void FillAfterQAHistos(T const& col) - { - int NTPC = col.multNTracksHasTPC(); - int N_FT0C = col.multFT0C(); - double cent_FT0C = col.centFT0C(); - - hist.fill(HIST("QA/after/h_VtxZ"), col.posZ()); - hist.fill(HIST("QA/after/h_Counts"), 2); - if (NTPC != 0 && N_FT0C != 0) { - hist.fill(HIST("QA/after/h_NTPC"), NTPC); - hist.fill(HIST("QA/after/h_Cent"), cent_FT0C); - hist.fill(HIST("QA/after/h_NFT0C"), N_FT0C); - hist.fill(HIST("QA/after/h2_NTPC_NFT0C"), N_FT0C, NTPC); - hist.fill(HIST("QA/after/h2_NTPC_Cent"), cent_FT0C, NTPC); - hist.fill(HIST("QA/after/p_NTPC_Cent"), cent_FT0C, NTPC); - hist.fill(HIST("QA/after/p_NTPC_NFT0C"), N_FT0C, NTPC); - } - } - - // Fill Charged particles QA: - template - void FillChargedQAHistos(T const& track) - { - hist.fill(HIST("QA/after/h_Eta"), track.eta()); - hist.fill(HIST("QA/after/h_Phi"), track.phi()); - hist.fill(HIST("QA/after/h_Pt"), track.pt()); - hist.fill(HIST("QA/after/h2_PvsPinner"), track.p(), track.tpcInnerParam()); - hist.fill(HIST("QA/after/h2_Pt_Eta"), track.eta(), track.pt()); - hist.fill(HIST("QA/after/h_DcaZ"), track.dcaZ()); - hist.fill(HIST("QA/after/h_DcaXY"), track.dcaXY()); - hist.fill(HIST("QA/after/h2_DcaXY"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/after/h2_DcaZ"), track.pt(), track.dcaZ()); - - hist.fill(HIST("QA/after/h_TPCChi2perCluster"), track.tpcChi2NCl()); - hist.fill(HIST("QA/after/h_ITSChi2perCluster"), track.itsChi2NCl()); - hist.fill(HIST("QA/after/h_crossedTPC"), track.tpcNClsCrossedRows()); - - if (track.hasTOF()) - hist.fill(HIST("QA/after/h2_PtofvsPinner"), track.p(), track.tpcInnerParam()); - } - - // Fill before PID cut QA hist: - template - void FillBeforePIDQAHistos(T const& track) - { - hist.fill(HIST("QA/before/h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST("QA/before/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/before/h2_pvsm2"), track.mass() * track.mass(), track.p()); - - hist.fill(HIST("QA/Pion/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPi()); - hist.fill(HIST("QA/Pion/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPi()); - hist.fill(HIST("QA/Pion/before/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - hist.fill(HIST("QA/Proton/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPr()); - hist.fill(HIST("QA/Proton/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPr()); - hist.fill(HIST("QA/Proton/before/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - hist.fill(HIST("QA/Kaon/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaKa()); - hist.fill(HIST("QA/Kaon/before/h2_TOFNsigma"), track.p(), track.tofNSigmaKa()); - hist.fill(HIST("QA/Kaon/before/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - - hist.fill(HIST("QA/before/innerParam/h2_TOFSignal"), track.tpcInnerParam(), track.beta()); - hist.fill(HIST("QA/before/innerParam/h2_TPCSignal"), track.tpcInnerParam(), track.tpcSignal()); - hist.fill(HIST("QA/before/innerParam/h2_pvsm2"), track.mass() * track.mass(), track.tpcInnerParam()); - - hist.fill(HIST("QA/Pion/innerParam/before/h2_TPCNsigma"), track.tpcInnerParam(), track.tpcNSigmaPi()); - hist.fill(HIST("QA/Pion/innerParam/before/h2_TOFNsigma"), track.tpcInnerParam(), track.tofNSigmaPi()); - hist.fill(HIST("QA/Pion/innerParam/before/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - hist.fill(HIST("QA/Proton/innerParam/before/h2_TPCNsigma"), track.tpcInnerParam(), track.tpcNSigmaPr()); - hist.fill(HIST("QA/Proton/innerParam/before/h2_TOFNsigma"), track.tpcInnerParam(), track.tofNSigmaPr()); - hist.fill(HIST("QA/Proton/innerParam/before/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - hist.fill(HIST("QA/Kaon/innerParam/before/h2_TPCNsigma"), track.tpcInnerParam(), track.tpcNSigmaKa()); - hist.fill(HIST("QA/Kaon/innerParam/before/h2_TOFNsigma"), track.tpcInnerParam(), track.tofNSigmaKa()); - hist.fill(HIST("QA/Kaon/innerParam/before/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - } - - // Fill after PID cut QA hist: - template - void FillIdParticleQAHistos(T const& track, double rap, double nSigmaTPC, double nSigmaTOF) - { - - hist.fill(HIST(dire[mode]) + HIST("h_Eta"), track.eta()); - hist.fill(HIST(dire[mode]) + HIST("h_Phi"), track.phi()); - hist.fill(HIST(dire[mode]) + HIST("h_rap"), rap); - hist.fill(HIST(dire[mode]) + HIST("h2_Pt_rap"), rap, track.pt()); - hist.fill(HIST(dire[mode]) + HIST("h_DcaZ"), track.dcaZ()); - hist.fill(HIST(dire[mode]) + HIST("h_DcaXY"), track.dcaXY()); - hist.fill(HIST(dire[mode]) + HIST("h2_DcaZ"), track.pt(), track.dcaZ()); - hist.fill(HIST(dire[mode]) + HIST("h2_DcaXY"), track.pt(), track.dcaXY()); - hist.fill(HIST(dire[mode]) + HIST("h2_Pt_Pinner"), track.tpcInnerParam(), track.pt()); - hist.fill(HIST(dire[mode]) + HIST("h2_P_Pinner"), track.tpcInnerParam(), track.p()); - - hist.fill(HIST(dire[mode]) + HIST("h2_TPCNsigma_El"), track.p(), track.tpcNSigmaEl()); - hist.fill(HIST(dire[mode]) + HIST("h2_TOFNsigma_El"), track.p(), track.tofNSigmaEl()); - hist.fill(HIST(dire[mode]) + HIST("h2_TPCNsigma"), track.p(), nSigmaTPC); - hist.fill(HIST(dire[mode]) + HIST("h2_TOFNsigma"), track.p(), nSigmaTOF); - hist.fill(HIST(dire[mode]) + HIST("h2_TpcTofNsigma"), nSigmaTPC, nSigmaTOF); - hist.fill(HIST(dire[mode]) + HIST("h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST(dire[mode]) + HIST("h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST(dire[mode]) + HIST("h2_pvsm2"), track.mass() * track.mass(), track.p()); - hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST("QA/after/h2_pvsm2"), track.mass() * track.mass(), track.p()); - - hist.fill(HIST(dire[mode]) + HIST("innerParam/h2_TPCNsigma_El"), track.tpcInnerParam(), track.tpcNSigmaEl()); - hist.fill(HIST(dire[mode]) + HIST("innerParam/h2_TOFNsigma_El"), track.tpcInnerParam(), track.tofNSigmaEl()); - hist.fill(HIST(dire[mode]) + HIST("innerParam/h2_TPCNsigma"), track.tpcInnerParam(), nSigmaTPC); - hist.fill(HIST(dire[mode]) + HIST("innerParam/h2_TOFNsigma"), track.tpcInnerParam(), nSigmaTOF); - hist.fill(HIST(dire[mode]) + HIST("innerParam/h2_TpcTofNsigma"), nSigmaTPC, nSigmaTOF); - hist.fill(HIST(dire[mode]) + HIST("innerParam/h2_TPCSignal"), track.tpcInnerParam(), track.tpcSignal()); - hist.fill(HIST(dire[mode]) + HIST("innerParam/h2_TOFSignal"), track.tpcInnerParam(), track.beta()); - hist.fill(HIST(dire[mode]) + HIST("innerParam/h2_pvsm2"), track.mass() * track.mass(), track.tpcInnerParam()); - hist.fill(HIST("QA/after/innerParam/h2_TPCSignal"), track.tpcInnerParam(), track.tpcSignal()); - hist.fill(HIST("QA/after/innerParam/h2_TOFSignal"), track.tpcInnerParam(), track.beta()); - hist.fill(HIST("QA/after/innerParam/h2_pvsm2"), track.mass() * track.mass(), track.tpcInnerParam()); - } - - template - void FillMCPIDHist(T const& track, int PID, int pdgCodePos, int pdgCodeNeg, int& N, double& Q1, double& Q2, double& Q3, double& Q4) - { - N++; - double pt = track.pt(); - moments(pt, Q1, Q2, Q3, Q4); - hist.fill(HIST(dire[mode]) + HIST("h_Pt"), track.pt()); - if (PID == pdgCodePos) { - hist.fill(HIST(dire[mode]) + HIST("h_PtPos"), track.pt()); - } - if (PID == pdgCodeNeg) { - hist.fill(HIST(dire[mode]) + HIST("h_PtNeg"), track.pt()); - } - } - - // Moments Calculation: - void moments(double pt, double& Q1, double& Q2, double& Q3, double& Q4) - { - Q1 += pt; - Q2 += pt * pt; - Q3 += pt * pt * pt; - Q4 += pt * pt * pt * pt; - } - - template - void FillAnalysisHistos(int NTPC, int N_FT0C, int N, double Q1, double Q2, double Q3, double Q4) - { - double twopart1 = ((Q1 * Q1) - Q2); - double threepart1 = ((Q1 * Q1 * Q1) - (3 * Q2 * Q1) + 2 * Q3); - double fourpart1 = ((Q1 * Q1 * Q1 * Q1) - (6 * Q2 * Q1 * Q1) + (3 * Q2 * Q2) + (8 * Q3 * Q1) - 6 * Q4); - - hist.fill(HIST(dire[mode]) + HIST("h_Mult"), N); - hist.fill(HIST(dire[mode]) + HIST("h_Q1"), NTPC, Q1, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_Q2"), NTPC, Q2, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_Q3"), NTPC, Q3, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_Q4"), NTPC, Q4, N_FT0C); - - if (N > 0) { - double mean_pT = Q1 / static_cast(N); - hist.fill(HIST(dire[mode]) + HIST("h_mean_pT"), mean_pT); - hist.fill(HIST(dire[mode]) + HIST("p_mean_pT_Mult_var"), NTPC, mean_pT); - - if (N > 1) { - double N_pair = (static_cast(N) * (static_cast(N) - 1)); - double twopart = twopart1 / N_pair; - double checkN_deno_var = (1 / std::sqrt(1 - (1 / static_cast(N)))); - hist.fill(HIST(dire[mode]) + HIST("h_Q1_var"), NTPC, Q1, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_N_var"), NTPC, N, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_twopart_nume_Mult_var"), NTPC, twopart1, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_twopart_deno_Mult_var"), NTPC, N_pair, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_mean_pT_Mult_var"), NTPC, mean_pT, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_twopart_Mult_var"), NTPC, twopart, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("p_CheckNCH"), NTPC, checkN_deno_var); - hist.fill(HIST(dire[mode]) + HIST("h_CheckNCH"), NTPC, checkN_deno_var, N_FT0C); - - if (N > 2) { - double N_triplet = (static_cast(N) * (static_cast(N) - 1) * (static_cast(N) - 2)); - double threepart = threepart1 / N_triplet; - hist.fill(HIST(dire[mode]) + HIST("h_mean_pT_Mult_skew"), NTPC, mean_pT, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_twopart_Mult_skew"), NTPC, twopart, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_threepart_Mult_skew"), NTPC, threepart, N_FT0C); - - if (N > 3) { - double N_quad = (static_cast(N) * (static_cast(N) - 1) * (static_cast(N) - 2) * (static_cast(N) - 3)); - double fourpart = fourpart1 / N_quad; - hist.fill(HIST(dire[mode]) + HIST("h_mean_pT_Mult_kurto"), NTPC, mean_pT, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_twopart_Mult_kurto"), NTPC, twopart, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_threepart_Mult_kurto"), NTPC, threepart, N_FT0C); - hist.fill(HIST(dire[mode]) + HIST("h_fourpart_Mult_kurto"), NTPC, fourpart, N_FT0C); - } - } - } - } - } - - template - void FillHistos(T const& col, U const& tracks) - { - int N_Pi = 0, N_Ka = 0, N_Pr = 0; - int Nch = 0, NTPC = 0, N_FT0C = 0; - double pt_ch = 0, Q1_ch = 0, Q2_ch = 0, Q3_ch = 0, Q4_ch = 0; - double pt_Pi = 0, Q1_Pi = 0, Q2_Pi = 0, Q3_Pi = 0, Q4_Pi = 0; - double pt_Pr = 0, Q1_Pr = 0, Q2_Pr = 0, Q3_Pr = 0, Q4_Pr = 0; - double pt_Ka = 0, Q1_Ka = 0, Q2_Ka = 0, Q3_Ka = 0, Q4_Ka = 0; - - array p1, p2; - double invMassGamma = 0.0; - - for (auto const& [trkEl, trkPos] : soa::combinations(soa::CombinationsFullIndexPolicy(tracks, tracks))) { - if (trkEl.index() == trkPos.index()) - continue; - - if (!selTrack(trkEl) || !selTrack(trkPos)) - continue; - - if (!selElectrons(trkEl) || !selElectrons(trkPos)) - continue; - - p1 = array{trkEl.px(), trkEl.py(), trkEl.pz()}; - p2 = array{trkPos.px(), trkPos.py(), trkPos.pz()}; - - invMassGamma = RecoDecay::m(array{p1, p2}, array{MassElectron, MassElectron}); - hist.fill(HIST("QA/after/h_invMass_gamma"), invMassGamma); - } - - for (auto& track : tracks) { - if (!selTrack(track)) { - continue; - } - - double nSigmaTPCPi = track.tpcNSigmaPi(); - double nSigmaTPCKa = track.tpcNSigmaKa(); - double nSigmaTPCPr = track.tpcNSigmaPr(); - double nSigmaTOFPi = track.tofNSigmaPi(); - double nSigmaTOFKa = track.tofNSigmaKa(); - double nSigmaTOFPr = track.tofNSigmaPr(); - double rapPi = track.rapidity(MassPiPlus); - double rapKa = track.rapidity(MassKPlus); - double rapPr = track.rapidity(MassProton); - double innerParam = track.tpcInnerParam(); - - if constexpr (DataFlag) { - if (std::fabs(track.eta()) < 0.8) { - Nch++; - pt_ch = track.pt(); - moments(pt_ch, Q1_ch, Q2_ch, Q3_ch, Q4_ch); - FillChargedQAHistos(track); - } - - FillBeforePIDQAHistos(track); - - if (rejectTracks(track)) { - return; - } - - if (cfgInvMass == true && invMassGamma < cfgGammaCut) { - continue; - } - - if (cfgSelORPi == true && cfgSelANDPi == false) { - if (selLowPi(track, innerParam) == cfgSelLowPi || selHighPi(track) == cfgSelHighPi) { - N_Pi++; - pt_Pi = track.pt(); - moments(pt_Pi, Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi); - FillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi); - } - } else if (cfgSelORPi == false && cfgSelANDPi == true) { - if (selLowPi(track, innerParam) == cfgSelLowPi && selHighPi(track) == cfgSelHighPi) { - N_Pi++; - pt_Pi = track.pt(); - moments(pt_Pi, Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi); - FillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi); - } - } - - if (cfgSelORKa == true && cfgSelANDKa == false) { - if (selLowKa(track, innerParam) == cfgSelLowKa || selHighKa(track) == cfgSelHighKa) { - N_Ka++; - pt_Ka = track.pt(); - moments(pt_Ka, Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka); - FillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa); - } - } else if (cfgSelORKa == false && cfgSelANDKa == true) { - if (selLowKa(track, innerParam) == cfgSelLowKa && selHighKa(track) == cfgSelHighKa) { - N_Ka++; - pt_Ka = track.pt(); - moments(pt_Ka, Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka); - FillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa); - } - } - - if (cfgSelORPr == true && cfgSelANDPr == false) { - if (selLowPr(track, innerParam) == cfgSelLowPr || selHighPr(track) == cfgSelHighPr) { - N_Pr++; - pt_Pr = track.pt(); - moments(pt_Pr, Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr); - FillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr); - } - } else if (cfgSelORPr == false && cfgSelANDPr == true) { - if (selLowPr(track, innerParam) == cfgSelLowPr && selHighPr(track) == cfgSelHighPr) { - N_Pr++; - pt_Pr = track.pt(); - moments(pt_Pr, Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr); - FillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr); - } - } - - } else if constexpr (RecoFlag) { - if (track.has_mcParticle() && track.mcParticle().isPhysicalPrimary()) { - if (std::fabs(track.eta()) < 0.8) { - Nch++; - pt_ch = track.pt(); - moments(pt_ch, Q1_ch, Q2_ch, Q3_ch, Q4_ch); - FillChargedQAHistos(track); - } - FillBeforePIDQAHistos(track); - - if (rejectTracks(track)) { - return; - } - - if (cfgInvMass == true && invMassGamma < cfgGammaCut) { - continue; - } - - int PID = track.mcParticle().pdgCode(); - - if (cfgSelORPi == true && cfgSelANDPi == false) { - if (selLowPi(track, innerParam) == cfgSelLowPi || selHighPi(track) == cfgSelHighPi) { - hist.fill(HIST("QA/Pion/h_allPt"), track.pt()); - if (track.sign() > 0) - hist.fill(HIST("QA/Pion/h_allPtPos"), track.pt()); - - if (track.sign() < 0) - hist.fill(HIST("QA/Pion/h_allPtNeg"), track.pt()); - - if (std::abs(PID) == kPiPlus) { - FillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi); - FillMCPIDHist(track, PID, kPiPlus, kPiMinus, N_Pi, Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi); - } - } - } else if (cfgSelORPi == false && cfgSelANDPi == true) { - if (selLowPi(track, innerParam) == cfgSelLowPi && selHighPi(track) == cfgSelHighPi) { - hist.fill(HIST("QA/Pion/h_allPt"), track.pt()); - if (track.sign() > 0) - hist.fill(HIST("QA/Pion/h_allPtPos"), track.pt()); - - if (track.sign() < 0) - hist.fill(HIST("QA/Pion/h_allPtNeg"), track.pt()); - - if (std::abs(PID) == kPiPlus) { - - FillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi); - FillMCPIDHist(track, PID, kPiPlus, kPiMinus, N_Pi, Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi); - } - } - } - - if (cfgSelORKa == true && cfgSelANDKa == false) { - if (selLowKa(track, innerParam) == cfgSelLowKa || selHighKa(track) == cfgSelHighKa) { - hist.fill(HIST("QA/Kaon/h_allPt"), track.pt()); - if (track.sign() > 0) - hist.fill(HIST("QA/Kaon/h_allPtPos"), track.pt()); - - if (track.sign() < 0) - hist.fill(HIST("QA/Kaon/h_allPtNeg"), track.pt()); - - if (std::abs(PID) == kKPlus) { - FillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa); - FillMCPIDHist(track, PID, kKPlus, kKMinus, N_Ka, Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka); - } - } - } else if (cfgSelORKa == false && cfgSelANDKa == true) { - if (selLowKa(track, innerParam) == cfgSelLowKa && selHighKa(track) == cfgSelHighKa) { - hist.fill(HIST("QA/Kaon/h_allPt"), track.pt()); - if (track.sign() > 0) - hist.fill(HIST("QA/Kaon/h_allPtPos"), track.pt()); - - if (track.sign() < 0) - hist.fill(HIST("QA/Kaon/h_allPtNeg"), track.pt()); - - if (std::abs(PID) == kKPlus) { - FillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa); - FillMCPIDHist(track, PID, kKPlus, kKMinus, N_Ka, Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka); - } - } - } - - if (cfgSelORPr == true && cfgSelANDPr == false) { - if (selLowPr(track, innerParam) == cfgSelLowPr && selHighPr(track) == cfgSelHighPr) { - hist.fill(HIST("QA/Proton/h_allPt"), track.pt()); - if (track.sign() > 0) - hist.fill(HIST("QA/Proton/h_allPtPos"), track.pt()); - - if (track.sign() < 0) - hist.fill(HIST("QA/Proton/h_allPtNeg"), track.pt()); - - if (std::abs(PID) == kProton) { - FillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr); - FillMCPIDHist(track, PID, kProton, kProtonBar, N_Pr, Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr); - } - } - } else if (cfgSelORPr == false && cfgSelANDPr == true) { - if (selLowPr(track, innerParam) == cfgSelLowPr && selHighPr(track) == cfgSelHighPr) { - hist.fill(HIST("QA/Proton/h_allPt"), track.pt()); - if (track.sign() > 0) - hist.fill(HIST("QA/Proton/h_allPtPos"), track.pt()); - - if (track.sign() < 0) - hist.fill(HIST("QA/Proton/h_allPtNeg"), track.pt()); - - if (std::abs(PID) == kProton) { - FillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr); - FillMCPIDHist(track, PID, kProton, kProtonBar, N_Pr, Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr); - } - } - } - } - } - } - - N_FT0C = col.multFT0C(); - NTPC = col.multNTracksHasTPC(); - - FillAfterQAHistos(col); - if (NTPC != 0 && Nch != 0) - hist.fill(HIST("QA/after/h2_NTPC_Nch"), NTPC, Nch); - - FillAnalysisHistos(NTPC, N_FT0C, Nch, Q1_ch, Q2_ch, Q3_ch, Q4_ch); - FillAnalysisHistos(NTPC, N_FT0C, N_Pi, Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi); - FillAnalysisHistos(NTPC, N_FT0C, N_Ka, Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka); - FillAnalysisHistos(NTPC, N_FT0C, N_Pr, Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr); - } - - void process_Run3(MyCollisions::iterator const& col, MyAllTracks const& tracks) - { - // Before Collision and Track Cuts: - FillBeforeQAHistos(col, tracks); - - // After Collision and Track Cuts: - if (selRun3Col(col)) { - FillHistos(col, tracks); - } - } - PROCESS_SWITCH(meanPtFlucId, process_Run3, "Process for Run3", true); - - void process_MCRecoRun3(MyMCCollisions::iterator const& col, aod::McCollisions const&, MyMCTracks const& tracks, aod::McParticles const&) - { - // Before Collision and Track Cuts: - FillBeforeQAHistos(col, tracks); - - // After Collision and Track Cuts: - if (selRun3Col(col)) { - if (!col.has_mcCollision()) { - return; - } - FillHistos(col, tracks); - } - } - PROCESS_SWITCH(meanPtFlucId, process_MCRecoRun3, "process MC Reconstructed Run-3", false); - - void process_MCGen(soa::Join::iterator const& mccol, aod::McParticles const& McParticles) - { - int N_Pi = 0, N_Ka = 0, N_Pr = 0; - int Nch = 0, NTPC = 0, N_FT0C = 0; - double pt_ch = 0, Q1_ch = 0, Q2_ch = 0, Q3_ch = 0, Q4_ch = 0; - double Q1_Pi = 0, Q2_Pi = 0, Q3_Pi = 0, Q4_Pi = 0; - double Q1_Pr = 0, Q2_Pr = 0, Q3_Pr = 0, Q4_Pr = 0; - double Q1_Ka = 0, Q2_Ka = 0, Q3_Ka = 0, Q4_Ka = 0; - - if (std::abs(mccol.posZ()) > cfgCutPosZ) - return; - - for (auto& mcParticle : McParticles) { - if (!mcParticle.isPhysicalPrimary()) - continue; - - auto charge = 0.; - int PID = mcParticle.pdgCode(); - auto* pd = pdg->GetParticle(PID); - if (pd != nullptr) { - charge = pd->Charge(); - } - if (std::fabs(charge) < 1e-3) { - continue; - } - - if (mcParticle.pt() > cfgCutPtMin && mcParticle.pt() < cfgCutPtMax && std::abs(mcParticle.y()) < cfgCutRap) { - Nch++; - pt_ch = mcParticle.pt(); - moments(pt_ch, Q1_ch, Q2_ch, Q3_ch, Q4_ch); - hist.fill(HIST("Gen/Charged/h_Pt"), mcParticle.pt()); - - if (std::abs(PID) == kPiPlus && mcParticle.pt() >= cfgCutPiPtMin) { - if (cfgSelORPi == true && cfgSelANDPi == false) { - if (mcParticle.p() <= cfgCutPiThrsldP || mcParticle.p() > cfgCutPiThrsldP) { - FillMCPIDHist(mcParticle, PID, kPiPlus, kPiMinus, N_Pi, Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi); - } - } else if (cfgSelORPi == false && cfgSelANDPi == true) { - if ((cfgSelLowPi == true && mcParticle.p() <= cfgCutPiThrsldP) && (cfgSelHighPi == true && mcParticle.p() > cfgCutPiThrsldP)) { - FillMCPIDHist(mcParticle, PID, kPiPlus, kPiMinus, N_Pi, Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi); - } - } - } - - if (std::abs(PID) == kKPlus && mcParticle.pt() >= cfgCutKaPtMin) { - if (cfgSelORPi == true && cfgSelANDPi == false) { - if ((cfgSelLowKa == true && mcParticle.p() <= cfgCutPiThrsldP) || (cfgSelHighKa == true && mcParticle.p() > cfgCutPiThrsldP)) { - FillMCPIDHist(mcParticle, PID, kKPlus, kKMinus, N_Ka, Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka); - } - } else if (cfgSelORKa == false && cfgSelANDKa == true) { - if ((cfgSelLowKa == true && mcParticle.p() <= cfgCutKaThrsldP) && (cfgSelHighKa == true && mcParticle.p() > cfgCutKaThrsldP)) { - FillMCPIDHist(mcParticle, PID, kKPlus, kKMinus, N_Ka, Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka); - } - } - } - - if (std::abs(PID) == kProton && mcParticle.pt() >= cfgCutPrPtMin) { - if (cfgSelORPr == true && cfgSelANDPr == false) { - if ((cfgSelLowPr == true && mcParticle.p() <= cfgCutPrThrsldP) || (cfgSelHighPr == true && mcParticle.p() > cfgCutPrThrsldP)) { - FillMCPIDHist(mcParticle, PID, kProton, kProtonBar, N_Pr, Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr); - } - } else if (cfgSelORPr == false && cfgSelANDPr == true) { - if ((cfgSelLowPr == true && mcParticle.p() <= cfgCutPrThrsldP) && (cfgSelHighPr == true && mcParticle.p() > cfgCutPrThrsldP)) { - FillMCPIDHist(mcParticle, PID, kProton, kProtonBar, N_Pr, Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr); - } - } - } - } - } - NTPC = mccol.multMCNParticlesEta08(); - N_FT0C = mccol.multMCFT0C(); - hist.fill(HIST("Gen/Counts"), 2); - hist.fill(HIST("Gen/vtxZ"), mccol.posZ()); - if (NTPC != 0) - hist.fill(HIST("Gen/NTPC"), NTPC); - if (N_FT0C != 0) - hist.fill(HIST("Gen/NFT0C"), N_FT0C); - if (NTPC != 0 && N_FT0C != 0) - hist.fill(HIST("Gen/h2_NTPC_NFT0C"), N_FT0C, NTPC); - - FillAnalysisHistos(NTPC, N_FT0C, Nch, Q1_ch, Q2_ch, Q3_ch, Q4_ch); - FillAnalysisHistos(NTPC, N_FT0C, N_Pi, Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi); - FillAnalysisHistos(NTPC, N_FT0C, N_Ka, Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka); - FillAnalysisHistos(NTPC, N_FT0C, N_Pr, Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr); - } - PROCESS_SWITCH(meanPtFlucId, process_MCGen, "process MC Generated", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} diff --git a/PWGCF/EbyEFluctuations/Tasks/RobustFluctuationObservables.cxx b/PWGCF/EbyEFluctuations/Tasks/RobustFluctuationObservables.cxx index 191158c7ba0..f4d50ac9c7a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/RobustFluctuationObservables.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/RobustFluctuationObservables.cxx @@ -14,6 +14,9 @@ #include #include +#include +#include +#include #include "TF1.h" #include "TGraphErrors.h" @@ -82,7 +85,7 @@ struct RobustFluctuationObservables { // for vertex vs time: bool flagShowInfo = false; int lastRunNumber = -1; - int nBCsPerOrbit = 3564; + uint64_t nBCsPerOrbit = 3564; // bc position correlations int64_t prevOrbit = -1; @@ -101,7 +104,7 @@ struct RobustFluctuationObservables { int64_t orbitSOR = -1; // int64_t bcSORbis = -1; // global bc of the start of the first orbit - try alternative int64_t nBCsPerTF = 1; // 128*3564; // duration of TF in bcs - int64_t TFid = -1; // count time frames in a given run + uint64_t TFid = 0; // count time frames in a given run bool flagWaitForNewTF = false; uint32_t nOrbitsPerTF = 0; @@ -154,7 +157,7 @@ struct RobustFluctuationObservables { // hand-made ITS ROF cut Configurable nITSROF{"nITSROF", 6, "nITSROF"}; Configurable nITSROF_BC_offset{"nITSROF_BC_offset", 65, "nITSROF_BC_offset"}; - Configurable nITSROF_BC_cutWidth{"nITSROF_BC_cutWidth", 40, "nITSROF_BC_cutWidth"}; + Configurable nITSROF_BC_cutWidth{"nITSROF_BC_cutWidth", 40, "nITSROF_BC_cutWidth"}; // Configurable nITSROF_middle_cut_forITSonlyVert{"nITSROF_middle_cut_forITSonlyVert", 198/2 /*ROF=198 in pp*/, "nITSROF_middle_cut_forITSonlyVert"}; // Configurable nNoITSonlyVertices{"nNoITSonlyVertices", false, "nITSROF_middle_cut_forITSonlyVert"}; @@ -163,7 +166,7 @@ struct RobustFluctuationObservables { Configurable cutVzTrackT0diffUpper{"cutVzTrackT0diffUpper", 1., "cutVzTrackT0diffUpper, cm"}; // splitting of the orbit into several BC ranges - Configurable> vSplitBCpointsOfTheOrbit{"SplitBCpointsOfTheOrbit", {1200, 2000, 3000}, "BC split points of the orbit"}; + Configurable> vSplitBCpointsOfTheOrbit{"SplitBCpointsOfTheOrbit", {1200, 2000, 3000}, "BC split points of the orbit"}; // orbit QA uint32_t orbitAtCollIndexZero = 0; @@ -968,7 +971,7 @@ struct RobustFluctuationObservables { } if (myDF_ID >= 0 && myDF_ID < nHistQAplotsDF) { - int diffOrbits = (int32_t)orbit - (int32_t)orbitAtCollIndexZero; + int diffOrbits = static_cast(orbit) - static_cast(orbitAtCollIndexZero); TString strDF = Form("DF_%d", static_cast(DF_ID_raw)); fV_h1D_Orbit_vs_CollIndex[myDF_ID]->Fill(collision.index(), diffOrbits); fV_h1D_Orbit_vs_CollIndex[myDF_ID]->SetTitle(strDF); @@ -1474,23 +1477,23 @@ struct RobustFluctuationObservables { // ##### check how often we analyze collision in the same BC (and also the vZ difference) if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { if (prevBC != 9999) { - int32_t diff = (int32_t)collBC - (int32_t)prevBC; + int32_t diff = static_cast(collBC) - static_cast(prevBC); histosEvent.fill(HIST("hBC_DIFF_to_previous"), diff); if (diff == 0) histosEvent.fill(HIST("hBC_DIFF_to_previous_vZvZ_2D"), vZ, prev_vZ); } if (prevBcInTF >= 0) { - int32_t diffBcInTF = (int32_t)bcInTF - (int32_t)prevBcInTF; + int32_t diffBcInTF = static_cast(bcInTF) - static_cast(prevBcInTF); histosEvent.fill(HIST("hBCinTF_DIFF_to_previous"), diffBcInTF); } if (prevFoundBcInTF >= 0) { - int32_t diffGlobalBcInTF = (int32_t)foundBcInTF - (int32_t)prevFoundBcInTF; + int32_t diffGlobalBcInTF = static_cast(foundBcInTF) - static_cast(prevFoundBcInTF); histosEvent.fill(HIST("hBCinTF_DIFF_to_previous_FOUND_BC"), diffGlobalBcInTF); } // global found BC: if (prevGlobalFoundBC != 9999) { - int32_t diff = (int32_t)globalFoundBC - (int32_t)prevGlobalFoundBC; + int32_t diff = static_cast(globalFoundBC) - static_cast(prevGlobalFoundBC); histosEvent.fill(HIST("hBC_DIFF_to_previous_FOUND_BC"), diff); if (counterPVcontributorsAfterTPCcuts > 0) { @@ -1620,8 +1623,8 @@ struct RobustFluctuationObservables { histosEventBcInTF.fill(HIST("hGlobalTracks_vs_bcInTF"), bcInTF, nTracksGlobalAccepted); } - histosEvent.fill(HIST("hOrbitStartFromCollIndexZeroAft"), (int32_t)orbit - (int32_t)orbitAtCollIndexZero); - histosEvent.fill(HIST("h2D_Orbit_vs_CollIndex_Aft"), collision.index(), (int32_t)orbit - (int32_t)orbitAtCollIndexZero); + histosEvent.fill(HIST("hOrbitStartFromCollIndexZeroAft"), static_cast(orbit) - static_cast(orbitAtCollIndexZero)); + histosEvent.fill(HIST("h2D_Orbit_vs_CollIndex_Aft"), collision.index(), static_cast(orbit) - static_cast(orbitAtCollIndexZero)); histosEvent.fill(HIST("hMF"), magneticField); int MFsign = magneticField > 0 ? +1 : -1; @@ -1680,11 +1683,11 @@ struct RobustFluctuationObservables { histosEvent.fill(HIST("hBCFound_Aft"), globalFoundBC); histosEvent.fill(HIST("h2D_numContrib_vs_BC"), collBC, collision.numContrib()); - int64_t diffFoundBC_vs_BC = (int64_t)globalFoundBC - (int64_t)collBC; + int64_t diffFoundBC_vs_BC = static_cast(globalFoundBC) - static_cast(collBC); histosEvent.fill(HIST("h2D_diffFoundBC_vs_BC"), collBC, diffFoundBC_vs_BC); if (collision.has_foundBC()) - histosEvent.fill(HIST("h2D_diffFoundBC_vs_BC_inTF"), collBC, (int64_t)foundBcInTF - (int64_t)bcInTF); + histosEvent.fill(HIST("h2D_diffFoundBC_vs_BC_inTF"), collBC, static_cast(foundBcInTF) - static_cast(bcInTF)); // with FT0 conditions if (isFT0) { diff --git a/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx b/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx new file mode 100644 index 00000000000..60207675815 --- /dev/null +++ b/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx @@ -0,0 +1,1105 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file meanPtFlucId.cxx +/// \brief Calculate EbyE fluctuations with cumulant method. +/// For charged particles and identified particles. +/// For RUN-3 +/// +/// \author Tanu Gahlaut + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" +#include "Framework/O2DatabasePDGPlugin.h" + +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/Core/RecoDecay.h" + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; +using namespace std; + +struct MeanPtFlucId { + Configurable nPtBins{"nPtBins", 300, ""}; + Configurable nPartBins{"nPartBins", 250, ""}; + Configurable nCentBins{"nCentBins", 101, ""}; + Configurable nEtaBins{"nEtaBins", 100, ""}; + Configurable nPhiBins{"nPhiBins", 100, ""}; + Configurable cfgCutPtMax{"cfgCutPtMax", 3.0, "maximum pT"}; + Configurable cfgCutPtMin{"cfgCutPtMin", 0.15, "minimum pT"}; + Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut"}; + Configurable cfgCutRap{"cfgCutRap", 0.5, "Rapidity Cut"}; + Configurable cfgCutDcaXY{"cfgCutDcaXY", 0.12, "DCAxy cut"}; + Configurable cfgCutDcaZ{"cfgCutDcaZ", 0.3, "DCAz cut"}; + Configurable cfgCutPosZ{"cfgCutPosZ", 10.0, "cut for vertex Z"}; + Configurable cfgGammaCut{"cfgGammaCut", 0.003, "Gamma inv Mass Cut for electron-positron rejection"}; + Configurable cfgCutNSig2{"cfgCutNSig2", 2.0, "nSigma cut (2)"}; + Configurable cfgCutNSig3{"cfgCutNSig3", 3.0, "nSigma cut (3)"}; + Configurable cfgCutPiPtMin{"cfgCutPiPtMin", 0.2, "Minimum pion p_{T} cut"}; + Configurable cfgCutKaPtMin{"cfgCutKaPtMin", 0.3, "Minimum kaon p_{T} cut"}; + Configurable cfgCutPrPtMin{"cfgCutPrPtMin", 0.5, "Minimum proton p_{T} cut"}; + Configurable cfgCutPiThrsldP{"cfgCutPiThrsldP", 0.6, "Threshold p cut pion"}; + Configurable cfgCutKaThrsldP{"cfgCutKaThrsldP", 0.6, "Threshold p cut kaon"}; + Configurable cfgCutPrThrsldP{"cfgCutPrThrsldP", 1.0, "Threshold p cut proton "}; + Configurable cfgCutPiP1{"cfgCutPiP1", 0.5, "pion p cut-1"}; + Configurable cfgCutPiP2{"cfgCutPiP2", 0.6, "pion p cut-2"}; + Configurable cfgCutKaP1{"cfgCutKaP1", 0.4, "kaon p cut-1"}; + Configurable cfgCutKaP2{"cfgCutKaP2", 0.6, "kaon p cut-2"}; + Configurable cfgCutKaP3{"cfgCutKaP3", 1.2, "kaon p cut-3"}; + Configurable cfgCutPrP1{"cfgCutPrP1", 0.9, "proton p cut-1"}; + Configurable cfgCutPrP2{"cfgCutPrP2", 1.0, "proton p cut-2"}; + Configurable cfgMcTpcShiftEl{"cfgMcTpcShiftEl", 0., "Electron Shift in TPC (MC data) "}; + Configurable cfgMcTpcShiftPi{"cfgMcTpcShiftPi", 0., "Pion Shift in TPC (MC data) "}; + Configurable cfgMcTpcShiftKa{"cfgMcTpcShiftKa", 0., "Kaon Shift in TPC (MC data) "}; + Configurable cfgMcTpcShiftPr{"cfgMcTpcShiftPr", 0., "Proton Shift in TPC (MC data) "}; + Configurable cfgMcTofShiftPi{"cfgMcTofShiftPi", 0., "Pion Shift in TOF (MC data) "}; + Configurable cfgMcTofShiftKa{"cfgMcTofShiftKa", 0., "Kaon Shift in TOF (MC data) "}; + Configurable cfgMcTofShiftPr{"cfgMcTofShiftPr", 0., "Proton Shift in TOF (MC data) "}; + Configurable cfgMCReco{"cfgMCReco", false, ""}; + Configurable cfgMCTruth{"cfgMCTruth", false, ""}; + Configurable cfgPosZ{"cfgPosZ", true, "Position Z"}; + Configurable cfgSel8{"cfgSel8", true, "Sel8 trigger"}; + Configurable cfgEvSel1{"cfgEvSel1", true, "kNoSameBunchPileup"}; + Configurable cfgEvSel2{"cfgEvSel2", true, "kIsGoodZvtxFT0vsPV"}; + Configurable cfgEvSel3{"cfgEvSel3", true, "kIsVertexITSTPC"}; + Configurable cfgInvMass{"cfgInvMass", true, "electron Inv Mass cut selection"}; + Configurable cfgSelOR{"cfgSelOR", true, "Low OR High momentum "}; + Configurable cfgSelAND{"cfgSelAND", false, "Low AND High momentum"}; + Configurable cfgSelLow{"cfgSelLow", true, "PID selection cut for Low momentum"}; + Configurable cfgSelHigh{"cfgSelHigh", true, "PID selection cut for High momentum"}; + ConfigurableAxis multTPCBins{"multTPCBins", {150, 0, 150}, "TPC Multiplicity bins"}; + ConfigurableAxis multFT0MBins{"multFT0MBins", {400, 0, 4000}, "Forward Multiplicity bins"}; + ConfigurableAxis multFT0MMCBins{"multFT0MMCBins", {250, 0, 250}, "Forward Multiplicity bins"}; + ConfigurableAxis dcaXYBins{"dcaXYBins", {100, -0.15, 0.15}, "dcaXY bins"}; + ConfigurableAxis dcaZBins{"dcaZBins", {100, -1.2, 1.2}, "dcaZ bins"}; + ConfigurableAxis qNBins{"qNBins", {1000, 0., 100.}, "nth moments bins"}; + ConfigurableAxis tpNBins{"tpNBins", {300, 0., 3000.}, ""}; + ConfigurableAxis tpDBins{"tpDBins", {100, 0., 2000.}, ""}; + + using MyAllTracks = soa::Join; + using MyCollisions = soa::Join; + using MyMCCollisions = soa::Join; + using MyMCTracks = soa::Join; + + Service pdg; + + HistogramRegistry hist{"hist", {}, OutputObjHandlingPolicy::AnalysisObject}; + void init(InitContext const&) + { + const AxisSpec axisEvents{6, 0, 6, "Counts"}; + const AxisSpec axisEta{nEtaBins, -1., +1., "#eta"}; + const AxisSpec axisPhi{nPhiBins, 0., +7., "#phi (rad)"}; + const AxisSpec axisY{nEtaBins, -1., +1., "y"}; + const AxisSpec axisPt{nPtBins, 0., 3., "p_{T} (GeV/c)"}; + const AxisSpec axisP{nPtBins, 0., 3., "p (GeV/c)"}; + const AxisSpec axisInnerParam{nPtBins, 0., 3., "p_{InnerParam } (GeV/c)"}; + const AxisSpec axisPart{nPartBins, 0., 18., " "}; + const AxisSpec axisQn{qNBins, ""}; + const AxisSpec axisTpN{tpNBins, "(Q_{1}^{2} - Q_{2})"}; + const AxisSpec axisTpD{tpDBins, "N_{pairs}"}; + const AxisSpec axisDeno{100, 1., 2.0, "#frac{1}{#sqrt{1 - #frac{1}{N}}}"}; + const AxisSpec axisMeanPt{100, 0., 3., "M(p_{T}) (GeV/c)"}; + const AxisSpec axisMult{100, 0, 100, "N_{ch}"}; + const AxisSpec axisMultTPC{multTPCBins, "N_{TPC} "}; + const AxisSpec axisMultFT0M{multFT0MBins, "N_{FT0M}"}; + const AxisSpec axisMultFT0MMC{multFT0MMCBins, "N_{FT0M}"}; + const AxisSpec axisCentFT0C{nCentBins, 0, 101, "FT0C (%)"}; + const AxisSpec axisVtxZ{80, -20., 20., "V_{Z} (cm)"}; + const AxisSpec axisDCAz{dcaZBins, "DCA_{Z} (cm)"}; + const AxisSpec axisDCAxy{dcaXYBins, "DCA_{XY} (cm)"}; + const AxisSpec axisTPCNsigma{500, -5., 5., "n #sigma_{TPC}"}; + const AxisSpec axisTOFNsigma{500, -5., 5., "n #sigma_{TOF}"}; + const AxisSpec axisTPCSignal{100, 20., 500., "#frac{dE}{dx}"}; + const AxisSpec axisTOFSignal{200, 0.2, 1.2, "TOF #beta"}; + const AxisSpec axisChi2{40, 0., 40., "Chi2"}; + const AxisSpec axisCrossedTPC{300, 0, 300, "Crossed TPC"}; + const AxisSpec axisM2{100, 0., 1.4, "#it{m}^{2} (GeV/#it{c}^{2})^{2}"}; + const AxisSpec axisMass{1000, 0., 0.1, "M_{inv} (GeV/#it{c}^2)"}; + + HistogramConfigSpec qNHist({HistType::kTHnSparseD, {axisMultTPC, axisQn, axisMultFT0M}}); + HistogramConfigSpec partHist({HistType::kTHnSparseD, {axisMultTPC, axisPart, axisMultFT0M}}); + HistogramConfigSpec denoHist({HistType::kTHnSparseD, {axisMultTPC, axisDeno, axisMultFT0M}}); + HistogramConfigSpec qNMCHist({HistType::kTHnSparseD, {axisMultTPC, axisQn, axisMultFT0MMC}}); + HistogramConfigSpec partMCHist({HistType::kTHnSparseD, {axisMultTPC, axisPart, axisMultFT0MMC}}); + HistogramConfigSpec denoMCHist({HistType::kTHnSparseD, {axisMultTPC, axisDeno, axisMultFT0MMC}}); + HistogramConfigSpec tofNSigmaHist({HistType::kTH2D, {axisP, axisTOFNsigma}}); + HistogramConfigSpec tofSignalHist({HistType::kTH2D, {axisP, axisTOFSignal}}); + HistogramConfigSpec tpcNSigmaHist({HistType::kTH2D, {axisP, axisTPCNsigma}}); + HistogramConfigSpec tpcSignalHist({HistType::kTH2D, {axisP, axisTPCSignal}}); + HistogramConfigSpec tpcTofHist({HistType::kTH2D, {axisTPCNsigma, axisTOFNsigma}}); + HistogramConfigSpec pvsM2Hist({HistType::kTH2D, {axisM2, axisP}}); + + HistogramConfigSpec tofNSigmaHist1({HistType::kTH2D, {axisInnerParam, axisTOFNsigma}}); + HistogramConfigSpec tofSignalHist1({HistType::kTH2D, {axisInnerParam, axisTOFSignal}}); + HistogramConfigSpec tpcNSigmaHist1({HistType::kTH2D, {axisInnerParam, axisTPCNsigma}}); + HistogramConfigSpec tpcSignalHist1({HistType::kTH2D, {axisInnerParam, axisTPCSignal}}); + HistogramConfigSpec tpcTofHist1({HistType::kTH2D, {axisTPCNsigma, axisTOFNsigma}}); + HistogramConfigSpec pvsM2Hist1({HistType::kTH2D, {axisM2, axisInnerParam}}); + + // QA Plots: + hist.add("QA/before/h_Counts", "Counts", kTH1D, {axisEvents}); + hist.add("QA/before/h_VtxZ", "V_{Z}", kTH1D, {axisVtxZ}); + hist.add("QA/before/h_TPCChi2perCluster", "TPC #Chi^{2}/Cluster", kTH1D, {axisChi2}); + hist.add("QA/before/h_ITSChi2perCluster", "ITS #Chi^{2}/Cluster", kTH1D, {axisChi2}); + hist.add("QA/before/h_crossedTPC", "Crossed TPC", kTH1D, {axisCrossedTPC}); + hist.add("QA/before/h_Pt", "p_{T}", kTH1D, {axisPt}); + hist.add("QA/before/h2_PvsPinner", "p_{InnerParam} vs p", kTH2D, {{axisP}, {axisInnerParam}}); + hist.add("QA/before/h2_PtofvsPinner", "p_{InnerParam} vs p_{TOF}", kTH2D, {{axisP}, {axisInnerParam}}); + hist.add("QA/before/h_Eta", "#eta ", kTH1D, {axisEta}); + hist.add("QA/before/h_Phi", "#phi ", kTH1D, {axisPhi}); + hist.add("QA/before/h2_Pt_Eta", "p_{T} vs #eta ", kTH2D, {{axisEta}, {axisPt}}); + hist.add("QA/before/h_DcaZ", "DCA_{Z}", kTH1D, {axisDCAz}); + hist.add("QA/before/h_DcaXY", "DCA_{XY}", kTH1D, {axisDCAxy}); + hist.add("QA/before/h2_DcaZ", "DCA_{Z}", kTH2D, {{axisPt}, {axisDCAz}}); + hist.add("QA/before/h2_DcaXY", "DCA_{XY}", kTH2D, {{axisPt}, {axisDCAxy}}); + hist.add("QA/before/h_NTPC", "N_{TPC}", kTH1D, {axisMultTPC}); + hist.add("QA/before/h_NFT0M", "FT0M Multiplicity", kTH1D, {axisMultFT0M}); + hist.add("QA/before/h_NFT0C", "FT0C Multiplicity", kTH1D, {axisMultFT0M}); + hist.add("QA/before/h_Cent", "FT0C (%)", kTH1D, {axisCentFT0C}); + hist.add("QA/before/h2_NTPC_Cent", "N_{TPC} vs FT0C(%)", kTH2D, {{axisCentFT0C}, {axisMultTPC}}); + hist.add("QA/before/h2_NTPC_NFT0M", "N_{TPC} vs N_{FT0M}", kTH2D, {{axisMultFT0M}, {axisMultTPC}}); + hist.add("QA/before/h2_NTPC_NFT0C", "N_{TPC} vs N_{FT0C}", kTH2D, {{axisMultFT0M}, {axisMultTPC}}); + + hist.add("QA/before/h2_TPCSignal", "TPC Signal", tpcSignalHist); + hist.add("QA/before/h2_TOFSignal", "TOF Signal", tofSignalHist); + hist.add("QA/before/h2_pvsm2", "p vs m^{2}", pvsM2Hist); + + hist.add("QA/before/innerParam/h2_TPCSignal", "TPC Signal", tpcSignalHist1); + hist.add("QA/before/innerParam/h2_TOFSignal", "TOF Signal", tofSignalHist1); + hist.add("QA/before/innerParam/h2_pvsm2", "p vs m^{2}", pvsM2Hist1); + + hist.addClone("QA/before/", "QA/after/"); + + hist.add("QA/after/p_NTPC_NFT0M", "N_{TPC} vs N_{FT0M} (Profile)", kTProfile, {axisMultFT0M}); + hist.add("QA/after/p_NTPC_NFT0C", "N_{TPC} vs N_{FT0C} (Profile)", kTProfile, {axisMultFT0M}); + hist.add("QA/after/p_NTPC_Cent", "N_{TPC} vs FT0C(%) (Profile)", kTProfile, {axisCentFT0C}); + hist.add("QA/after/h2_NTPC_NCh", "N_{ch} vs N_{TPC}", kTH2D, {{axisMultTPC}, {axisMult}}); + hist.add("QA/after/h_invMass_gamma", "Inv Mass of #gamma", kTH1D, {axisMass}); + hist.add("QA/after/counts_evSelCuts", "Event selection cuts", kTH1D, {axisEvents}); + hist.add("QA/after/h_vtxZSim", "Simulated Vertex Z", kTH1D, {axisVtxZ}); + hist.add("QA/after/h_NSim", "Truth Multiplicity TPC", kTH1D, {axisMultTPC}); + hist.add("QA/after/h2_NTPC_NSim", "Reco vs Truth Multiplicty TPC", kTH2D, {{axisMultTPC}, {axisMultTPC}}); + hist.add("QA/after/h2_NChSim_NSim", "Truth Multiplicty NCh vs NTPC", kTH2D, {{axisMultTPC}, {axisMultTPC}}); + hist.add("QA/after/h2_NFT0C_NFT0CSim", "Reco vs Truth Multplicity FT0C", kTH2D, {{axisMultFT0MMC}, {axisMultFT0M}}); + + hist.add("QA/Pion/h_Pt", "p_{T} ", kTH1D, {axisPt}); + hist.add("QA/Pion/h_PtPos", "p_{T} (positive) ", kTH1D, {axisPt}); + hist.add("QA/Pion/h_PtNeg", "p_{T} (negative) ", kTH1D, {axisPt}); + hist.add("QA/Pion/h_PtTruth", "p_{T} ", kTH1D, {axisPt}); + hist.add("QA/Pion/h_PtPosTruth", "p_{T} (positive) ", kTH1D, {axisPt}); + hist.add("QA/Pion/h_PtNegTruth", "p_{T} (negative) ", kTH1D, {axisPt}); + hist.add("QA/Pion/h_rap", "y ", kTH1D, {axisY}); + hist.add("QA/Pion/h_Eta", "Pseudorapidity ", kTH1D, {axisEta}); + hist.add("QA/Pion/h_Phi", "Azimuthal Distribution ", kTH1D, {axisPhi}); + hist.add("QA/Pion/h2_Pt_rap", "p_{T} vs y", kTH2D, {{axisY}, {axisPt}}); + hist.add("QA/Pion/h_DcaZ", "DCA_{z}", kTH1D, {axisDCAz}); + hist.add("QA/Pion/h_DcaXY", "DCA_{xy}", kTH1D, {axisDCAxy}); + hist.add("QA/Pion/h2_DcaZ", "DCA_{z}", kTH2D, {{axisPt}, {axisDCAz}}); + hist.add("QA/Pion/h2_DcaXY", "DCA_{xy}", kTH2D, {{axisPt}, {axisDCAxy}}); + hist.add("QA/Pion/h2_P_Pinner", "p_{TPCinner} vs p", kTH2D, {{axisP}, {axisInnerParam}}); + hist.add("QA/Pion/h2_Pt_Pinner", "p_{TPCinner} vs p_{T}", kTH2D, {{axisPt}, {axisInnerParam}}); + + hist.add("QA/Pion/before/h2_TPCNsigma", "n #sigma_{TPC}", tpcNSigmaHist); + hist.add("QA/Pion/before/h2_TOFNsigma", "n #sigma_{TOF}", tofNSigmaHist); + hist.add("QA/Pion/before/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", tpcTofHist); + hist.add("QA/Pion/h2_TPCNsigma", "n #sigma_{TPC}", tpcNSigmaHist); + hist.add("QA/Pion/h2_TPCNsigma_El", "n #sigma_{TPC, El}", tpcNSigmaHist); + hist.add("QA/Pion/h2_TOFNsigma_El", "n #sigma_{TOF, El}", tofNSigmaHist); + hist.add("QA/Pion/h2_TOFNsigma", "n #sigma_{TOF}", tofNSigmaHist); + hist.add("QA/Pion/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", tpcTofHist); + hist.add("QA/Pion/h2_TPCSignal", "TPC Signal ", tpcSignalHist); + hist.add("QA/Pion/h2_TOFSignal", "TOF Signal", tofSignalHist); + hist.add("QA/Pion/h2_pvsm2", "p vs m^{2}", pvsM2Hist); + + hist.add("QA/Pion/innerParam/before/h2_TPCNsigma", "n #sigma_{TPC}", tpcNSigmaHist1); + hist.add("QA/Pion/innerParam/before/h2_TOFNsigma", "n #sigma_{TOF}", tofNSigmaHist1); + hist.add("QA/Pion/innerParam/before/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", tpcTofHist1); + hist.add("QA/Pion/innerParam/h2_TPCNsigma", "n #sigma_{TPC}", tpcNSigmaHist1); + hist.add("QA/Pion/innerParam/h2_TPCNsigma_El", "n #sigma_{TPC, El}", tpcNSigmaHist1); + hist.add("QA/Pion/innerParam/h2_TOFNsigma_El", "n #sigma_{TOF, El}", tofNSigmaHist1); + hist.add("QA/Pion/innerParam/h2_TOFNsigma", "n #sigma_{TOF}", tofNSigmaHist1); + hist.add("QA/Pion/innerParam/h2_TpcTofNsigma", "n #sigma_{TPC} vs n #sigma_{TOF}", tpcTofHist1); + hist.add("QA/Pion/innerParam/h2_TPCSignal", "TPC Signal ", tpcSignalHist1); + hist.add("QA/Pion/innerParam/h2_TOFSignal", "TOF Signal", tofSignalHist1); + hist.add("QA/Pion/innerParam/h2_pvsm2", "p vs m^{2}", pvsM2Hist1); + + hist.addClone("QA/Pion/", "QA/Kaon/"); + hist.addClone("QA/Pion/", "QA/Proton/"); + + // Analysis Plots: + hist.add("Analysis/Charged/h_Mult", "Multiplicity", kTH1D, {axisMult}); + hist.add("Analysis/Charged/h_Q1", "Q1", qNHist); + hist.add("Analysis/Charged/h_Q2", "Q2", qNHist); + hist.add("Analysis/Charged/h_Q3", "Q3", qNHist); + hist.add("Analysis/Charged/h_Q4", "Q4", qNHist); + hist.add("Analysis/Charged/h_mean_pT", " ", kTH1D, {axisMeanPt}); + hist.add("Analysis/Charged/p_mean_pT_Mult_var", " ", kTProfile, {axisMultTPC}); + hist.add("Analysis/Charged/p_CheckNCh", " 1/denominator vs N_{TPC} ", kTProfile, {axisMultTPC}); + hist.add("Analysis/Charged/h_CheckNCh", " 1/denominator vs N_{TPC} ", denoHist); + hist.add("Analysis/Charged/h_Q1_var", "Q1 vs N_{TPC}", qNHist); + hist.add("Analysis/Charged/h_N_var", "N vs N_{TPC}", kTHnSparseD, {axisMultTPC, axisMult, axisMultFT0M}); + hist.add("Analysis/Charged/h_twopart_nume_Mult_var", "twopart numerator", kTHnSparseD, {axisMultTPC, axisTpN, axisMultFT0M}); + hist.add("Analysis/Charged/h_twopart_deno_Mult_var", "twopart denominator", kTHnSparseD, {axisMultTPC, axisTpD, axisMultFT0M}); + hist.add("Analysis/Charged/h_mean_pT_Mult_var", " vs N_{TPC} ", partHist); + hist.add("Analysis/Charged/h_mean_pT_Mult_skew", " vs N_{TPC} ", partHist); + hist.add("Analysis/Charged/h_mean_pT_Mult_kurto", " vs N_{TPC} ", partHist); + hist.add("Analysis/Charged/h_twopart_Mult_var", "Twopart vs N_{TPC} ", partHist); + hist.add("Analysis/Charged/h_twopart_Mult_skew", "Twopart vs N_{TPC} ", partHist); + hist.add("Analysis/Charged/h_twopart_Mult_kurto", "Twopart vs N_{TPC} ", partHist); + hist.add("Analysis/Charged/h_threepart_Mult_skew", "Threepart vs N_{TPC} ", partHist); + hist.add("Analysis/Charged/h_threepart_Mult_kurto", "Threepart vs N_{TPC} ", partHist); + hist.add("Analysis/Charged/h_fourpart_Mult_kurto", "Fourpart vs N_{TPC} ", partHist); + + hist.addClone("Analysis/Charged/", "Analysis/Pion/"); + hist.addClone("Analysis/Charged/", "Analysis/Kaon/"); + hist.addClone("Analysis/Charged/", "Analysis/Proton/"); + + // MC Generated + hist.add("Gen/Counts", "Counts", kTH1D, {axisEvents}); + hist.add("Gen/vtxZ", "Vertex Z ", kTH1D, {axisVtxZ}); + hist.add("Gen/NTPC", "Mid rapidity Multiplicity", kTH1D, {axisMultTPC}); + hist.add("Gen/NFT0C", "Forward Multiplicity", kTH1D, {axisMultFT0MMC}); + hist.add("Gen/h2_NTPC_NFT0C", "N_{TPC} vs N_{FT0C}", kTH2D, {{axisMultFT0MMC}, {axisMultTPC}}); + hist.add("Gen/Charged/h_PtTruth", "p_{T} ", kTH1D, {axisPt}); + hist.add("Gen/Charged/h_PtPosTruth", "p_{T} (Positive)", kTH1D, {axisPt}); + hist.add("Gen/Charged/h_PtNegTruth", "p_{T} (negative)", kTH1D, {axisPt}); + + hist.add("Gen/Charged/h_Mult", "Multiplicity", kTH1D, {axisMult}); + hist.add("Gen/Charged/h_mean_pT", " ", kTH1D, {axisMeanPt}); + + hist.add("Gen/Charged/h_Q1", "Q1", qNMCHist); + hist.add("Gen/Charged/h_Q2", "Q2", qNMCHist); + hist.add("Gen/Charged/h_Q3", "Q3", qNMCHist); + hist.add("Gen/Charged/h_Q4", "Q4", qNMCHist); + hist.add("Gen/Charged/h_Q1_var", "Q1 vs N_{TPC}", qNMCHist); + hist.add("Gen/Charged/h_N_var", "N vs N_{TPC}", kTHnSparseD, {axisMultTPC, axisMult, axisMultFT0MMC}); + hist.add("Gen/Charged/h_twopart_nume_Mult_var", "twopart numerator", kTHnSparseD, {axisMultTPC, axisTpN, axisMultFT0MMC}); + hist.add("Gen/Charged/h_twopart_deno_Mult_var", "twopart denominator", kTHnSparseD, {axisMultTPC, axisTpD, axisMultFT0MMC}); + + hist.add("Gen/Charged/p_mean_pT_Mult_var", " ", kTProfile, {axisMultTPC}); + hist.add("Gen/Charged/p_CheckNCh", " 1/denominator vs N_{TPC} ", kTProfile, {axisMultTPC}); + hist.add("Gen/Charged/h_CheckNCh", " 1/denominator vs N_{TPC} ", denoMCHist); + hist.add("Gen/Charged/h_mean_pT_Mult_var", " vs N_{TPC} ", partMCHist); + hist.add("Gen/Charged/h_mean_pT_Mult_skew", " vs N_{TPC} ", partMCHist); + hist.add("Gen/Charged/h_mean_pT_Mult_kurto", " vs N_{TPC} ", partMCHist); + hist.add("Gen/Charged/h_twopart_Mult_var", "Twopart vs N_{TPC} ", partMCHist); + hist.add("Gen/Charged/h_twopart_Mult_skew", "Twopart vs N_{TPC} ", partMCHist); + hist.add("Gen/Charged/h_twopart_Mult_kurto", "Twopart vs N_{TPC} ", partMCHist); + hist.add("Gen/Charged/h_threepart_Mult_skew", "Threepart vs N_{TPC} ", partMCHist); + hist.add("Gen/Charged/h_threepart_Mult_kurto", "Threepart vs N_{TPC} ", partMCHist); + hist.add("Gen/Charged/h_fourpart_Mult_kurto", "Fourpart vs N_{TPC} ", partMCHist); + + hist.addClone("Gen/Charged/", "Gen/Pion/"); + hist.addClone("Gen/Charged/", "Gen/Kaon/"); + hist.addClone("Gen/Charged/", "Gen/Proton/"); + } + + enum Mode { + QA_Pion = 0, + QA_Kaon, + QA_Proton, + Analysis_Charged, + Analysis_Pion, + Analysis_Kaon, + Analysis_Proton, + Gen_Charged, + Gen_Pion, + Gen_Kaon, + Gen_Proton + }; + + static constexpr std::string_view Dire[] = { + "QA/Pion/", + "QA/Kaon/", + "QA/Proton/", + "Analysis/Charged/", + "Analysis/Pion/", + "Analysis/Kaon/", + "Analysis/Proton/", + "Gen/Charged/", + "Gen/Pion/", + "Gen/Kaon/", + "Gen/Proton/"}; + + // Event selection cuts: + template + bool selRun3Col(T const& col) + { + hist.fill(HIST("QA/after/counts_evSelCuts"), 0); + + if (cfgPosZ && std::abs(col.posZ()) > cfgCutPosZ) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 1); + + if (cfgSel8 && !col.sel8()) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 2); + + if (cfgEvSel1 && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 3); + + if (cfgEvSel2 && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 4); + + if (cfgEvSel3 && !col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 5); + + return true; + } + + // Track selection cuts: + template + bool selTrack(T const& track) + { + if (!track.isGlobalTrackWoPtEta()) + return false; + + if (track.pt() < cfgCutPtMin) + return false; + + if (track.pt() > cfgCutPtMax) + return false; + + if (track.sign() == 0) + return false; + + if (std::fabs(track.dcaZ()) > cfgCutDcaZ) + return false; + + if (std::fabs(track.dcaXY()) > cfgCutDcaXY) + return false; + + return true; + } + + // Cuts to reject the tracks + template + bool rejectTracks(T const& track) + { + if (((track.tpcNSigmaEl() - cfgMcTpcShiftEl) > -3. && + (track.tpcNSigmaEl() - cfgMcTpcShiftEl) < 5.) && + (std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) > 3 && + std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) > 3 && + std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) > 3)) { + return true; + } + + return false; + } + + template + bool selElectrons(T const& track) + { + if (std::fabs(track.tpcNSigmaEl() - cfgMcTpcShiftEl) < cfgCutNSig3) { + return true; + } + + return false; + } + + // PID selction cuts for Low momentum Pions + template + bool selLowPi(T const& track, double p) + { + if (track.pt() >= cfgCutPiPtMin && + track.p() <= cfgCutPiThrsldP && + ((!track.hasTOF() && + ((std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig3 && p <= cfgCutPiP1) || + (std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig2 && p > cfgCutPiP1 && p <= cfgCutPiP2))) || + (track.hasTOF() && + std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPi() - cfgMcTofShiftPi) < cfgCutNSig3))) { + + if (std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { + return true; + } + } + return false; + } + + // PID selction cuts for Low momentum Kaons + template + bool selLowKa(T const& track, double p) + { + if (track.pt() >= cfgCutKaPtMin && + track.p() <= cfgCutKaThrsldP && + ((!track.hasTOF() && + ((std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig3 && p <= cfgCutKaP1) || + (std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig2 && p > cfgCutKaP1 && p <= cfgCutKaP2))) || + (track.hasTOF() && + std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig3 && + std::fabs(track.tofNSigmaKa() - cfgMcTofShiftKa) < cfgCutNSig3))) { + + if (std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { + return true; + } + } + + return false; + } + + // PID selction cuts for Low momentum Protons + template + bool selLowPr(T const& track, double p) + { + if (track.pt() >= cfgCutPrPtMin && + track.p() <= cfgCutPrThrsldP && + ((!track.hasTOF() && + ((std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig3 && p <= cfgCutPrP1) || + (std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig2 && p > cfgCutPrP1 && p <= cfgCutPrP2))) || + (track.hasTOF() && + std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPr() - cfgMcTofShiftPr) < cfgCutNSig3))) { + + if (std::abs(track.rapidity(MassProton)) < cfgCutRap) { + return true; + } + } + + return false; + } + + // PID selction cuts for High momentum Protons + template + bool selHighPi(T const& track) + { + if (track.hasTOF() && + track.p() > cfgCutPiThrsldP && + std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPi() - cfgMcTofShiftPi) < cfgCutNSig3) { + + if (std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { + return true; + } + } + + return false; + } + + // PID selction cuts for High momentum Kaons + template + bool selHighKa(T const& track) + { + if (track.hasTOF() && + track.p() > cfgCutKaThrsldP && + std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig3 && + ((std::fabs(track.tofNSigmaKa() - cfgMcTofShiftKa) < cfgCutNSig3 && track.p() <= cfgCutKaP3) || + (std::fabs(track.tofNSigmaKa() - cfgMcTofShiftKa) < cfgCutNSig2 && track.p() > cfgCutKaP3))) { + + if (std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { + return true; + } + } + + return false; + } + + // PID selction cuts for High momentum Protons + template + bool selHighPr(T const& track) + { + if (track.hasTOF() && + track.p() > cfgCutPrThrsldP && + std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPr() - cfgMcTofShiftPr) < cfgCutNSig3) { + + if (std::abs(track.rapidity(MassProton)) < cfgCutRap) { + return true; + } + } + + return false; + } + + // Fill hist before selection cuts: + template + void fillBeforeQAHistos(T const& col, U const& tracks) + { + for (const auto& track : tracks) { + hist.fill(HIST("QA/before/h_Eta"), track.eta()); + hist.fill(HIST("QA/before/h_Phi"), track.phi()); + hist.fill(HIST("QA/before/h_Pt"), track.pt()); + hist.fill(HIST("QA/before/h2_PvsPinner"), track.p(), track.tpcInnerParam()); + hist.fill(HIST("QA/before/h2_Pt_Eta"), track.eta(), track.pt()); + hist.fill(HIST("QA/before/h_TPCChi2perCluster"), track.tpcChi2NCl()); + hist.fill(HIST("QA/before/h_ITSChi2perCluster"), track.itsChi2NCl()); + hist.fill(HIST("QA/before/h_crossedTPC"), track.tpcNClsCrossedRows()); + hist.fill(HIST("QA/before/h_DcaXY"), track.dcaXY()); + hist.fill(HIST("QA/before/h_DcaZ"), track.dcaZ()); + hist.fill(HIST("QA/before/h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST("QA/before/h2_DcaZ"), track.pt(), track.dcaZ()); + + if (track.hasTOF()) + hist.fill(HIST("QA/before/h2_PtofvsPinner"), track.p(), track.tpcInnerParam()); + } + hist.fill(HIST("QA/before/h_VtxZ"), col.posZ()); + hist.fill(HIST("QA/before/h_Counts"), 2); + + int nTPC = col.multNTracksHasTPC(); + int nFT0M = col.multFT0M(); + int nFT0C = col.multFT0C(); + double centFT0C = col.centFT0C(); + + if (nTPC != 0 && nFT0M != 0) { + hist.fill(HIST("QA/before/h_NTPC"), nTPC); + hist.fill(HIST("QA/before/h_Cent"), centFT0C); + hist.fill(HIST("QA/before/h_NFT0M"), nFT0M); + hist.fill(HIST("QA/before/h_NFT0C"), nFT0M); + hist.fill(HIST("QA/before/h2_NTPC_NFT0M"), nFT0M, nTPC); + hist.fill(HIST("QA/before/h2_NTPC_NFT0C"), nFT0C, nTPC); + hist.fill(HIST("QA/before/h2_NTPC_Cent"), centFT0C, nTPC); + } + } + + // Fill hist after selection cuts: + template + void fillAfterQAHistos(T const& col) + { + int nTPC = col.multNTracksHasTPC(); + int nFT0M = col.multFT0M(); + int nFT0C = col.multFT0C(); + double centFT0C = col.centFT0C(); + + hist.fill(HIST("QA/after/h_VtxZ"), col.posZ()); + hist.fill(HIST("QA/after/h_Counts"), 2); + if (nTPC != 0 && nFT0M != 0) { + hist.fill(HIST("QA/after/h_NTPC"), nTPC); + hist.fill(HIST("QA/after/h_Cent"), centFT0C); + hist.fill(HIST("QA/after/h_NFT0M"), nFT0M); + hist.fill(HIST("QA/after/h_NFT0C"), nFT0C); + hist.fill(HIST("QA/after/h2_NTPC_NFT0M"), nFT0M, nTPC); + hist.fill(HIST("QA/after/h2_NTPC_NFT0C"), nFT0C, nTPC); + hist.fill(HIST("QA/after/h2_NTPC_Cent"), centFT0C, nTPC); + hist.fill(HIST("QA/after/p_NTPC_Cent"), centFT0C, nTPC); + hist.fill(HIST("QA/after/p_NTPC_NFT0M"), nFT0M, nTPC); + hist.fill(HIST("QA/after/p_NTPC_NFT0C"), nFT0C, nTPC); + } + } + + // Fill Charged particles QA: + template + void fillChargedQAHistos(T const& track) + { + hist.fill(HIST("QA/after/h_Eta"), track.eta()); + hist.fill(HIST("QA/after/h_Phi"), track.phi()); + hist.fill(HIST("QA/after/h_Pt"), track.pt()); + hist.fill(HIST("QA/after/h2_PvsPinner"), track.p(), track.tpcInnerParam()); + hist.fill(HIST("QA/after/h2_Pt_Eta"), track.eta(), track.pt()); + hist.fill(HIST("QA/after/h_DcaZ"), track.dcaZ()); + hist.fill(HIST("QA/after/h_DcaXY"), track.dcaXY()); + hist.fill(HIST("QA/after/h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST("QA/after/h2_DcaZ"), track.pt(), track.dcaZ()); + + hist.fill(HIST("QA/after/h_TPCChi2perCluster"), track.tpcChi2NCl()); + hist.fill(HIST("QA/after/h_ITSChi2perCluster"), track.itsChi2NCl()); + hist.fill(HIST("QA/after/h_crossedTPC"), track.tpcNClsCrossedRows()); + + if (track.hasTOF()) + hist.fill(HIST("QA/after/h2_PtofvsPinner"), track.p(), track.tpcInnerParam()); + } + + // Fill before PID cut QA hist: + template + void fillBeforePIDQAHistos(T const& track) + { + hist.fill(HIST("QA/before/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/before/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/before/h2_pvsm2"), track.mass() * track.mass(), track.p()); + + hist.fill(HIST("QA/Pion/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPi()); + hist.fill(HIST("QA/Pion/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Pion/before/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Proton/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPr()); + hist.fill(HIST("QA/Proton/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Proton/before/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Kaon/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaKa()); + hist.fill(HIST("QA/Kaon/before/h2_TOFNsigma"), track.p(), track.tofNSigmaKa()); + hist.fill(HIST("QA/Kaon/before/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + + hist.fill(HIST("QA/before/innerParam/h2_TOFSignal"), track.tpcInnerParam(), track.beta()); + hist.fill(HIST("QA/before/innerParam/h2_TPCSignal"), track.tpcInnerParam(), track.tpcSignal()); + hist.fill(HIST("QA/before/innerParam/h2_pvsm2"), track.mass() * track.mass(), track.tpcInnerParam()); + + hist.fill(HIST("QA/Pion/innerParam/before/h2_TPCNsigma"), track.tpcInnerParam(), track.tpcNSigmaPi()); + hist.fill(HIST("QA/Pion/innerParam/before/h2_TOFNsigma"), track.tpcInnerParam(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Pion/innerParam/before/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Proton/innerParam/before/h2_TPCNsigma"), track.tpcInnerParam(), track.tpcNSigmaPr()); + hist.fill(HIST("QA/Proton/innerParam/before/h2_TOFNsigma"), track.tpcInnerParam(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Proton/innerParam/before/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Kaon/innerParam/before/h2_TPCNsigma"), track.tpcInnerParam(), track.tpcNSigmaKa()); + hist.fill(HIST("QA/Kaon/innerParam/before/h2_TOFNsigma"), track.tpcInnerParam(), track.tofNSigmaKa()); + hist.fill(HIST("QA/Kaon/innerParam/before/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + } + + // Moments Calculation: + void moments(double pt, double& Q1, double& Q2, double& Q3, double& Q4) + { + Q1 += pt; + Q2 += pt * pt; + Q3 += pt * pt * pt; + Q4 += pt * pt * pt * pt; + } + + // Fill after PID cut QA hist: + template + void fillIdParticleQAHistos(T const& track, double rap, double nSigmaTPC, double nSigmaTOF, int& N, double& Q1, double& Q2, double& Q3, double& Q4) + { + N++; + moments(track.pt(), Q1, Q2, Q3, Q4); + + hist.fill(HIST(Dire[Mode]) + HIST("h_Pt"), track.pt()); + if (track.sign() > 0) + hist.fill(HIST(Dire[Mode]) + HIST("h_PtPos"), track.pt()); + + if (track.sign() < 0) + hist.fill(HIST(Dire[Mode]) + HIST("h_PtNeg"), track.pt()); + + hist.fill(HIST(Dire[Mode]) + HIST("h_Eta"), track.eta()); + hist.fill(HIST(Dire[Mode]) + HIST("h_Phi"), track.phi()); + hist.fill(HIST(Dire[Mode]) + HIST("h_rap"), rap); + hist.fill(HIST(Dire[Mode]) + HIST("h2_Pt_rap"), rap, track.pt()); + hist.fill(HIST(Dire[Mode]) + HIST("h_DcaZ"), track.dcaZ()); + hist.fill(HIST(Dire[Mode]) + HIST("h_DcaXY"), track.dcaXY()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_DcaZ"), track.pt(), track.dcaZ()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_Pt_Pinner"), track.tpcInnerParam(), track.pt()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_P_Pinner"), track.tpcInnerParam(), track.p()); + + hist.fill(HIST(Dire[Mode]) + HIST("h2_TPCNsigma_El"), track.p(), track.tpcNSigmaEl()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_TOFNsigma_El"), track.p(), track.tofNSigmaEl()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_TPCNsigma"), track.p(), nSigmaTPC); + hist.fill(HIST(Dire[Mode]) + HIST("h2_TOFNsigma"), track.p(), nSigmaTOF); + hist.fill(HIST(Dire[Mode]) + HIST("h2_TpcTofNsigma"), nSigmaTPC, nSigmaTOF); + hist.fill(HIST(Dire[Mode]) + HIST("h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_pvsm2"), track.mass() * track.mass(), track.p()); + hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/after/h2_pvsm2"), track.mass() * track.mass(), track.p()); + + hist.fill(HIST(Dire[Mode]) + HIST("innerParam/h2_TPCNsigma_El"), track.tpcInnerParam(), track.tpcNSigmaEl()); + hist.fill(HIST(Dire[Mode]) + HIST("innerParam/h2_TOFNsigma_El"), track.tpcInnerParam(), track.tofNSigmaEl()); + hist.fill(HIST(Dire[Mode]) + HIST("innerParam/h2_TPCNsigma"), track.tpcInnerParam(), nSigmaTPC); + hist.fill(HIST(Dire[Mode]) + HIST("innerParam/h2_TOFNsigma"), track.tpcInnerParam(), nSigmaTOF); + hist.fill(HIST(Dire[Mode]) + HIST("innerParam/h2_TpcTofNsigma"), nSigmaTPC, nSigmaTOF); + hist.fill(HIST(Dire[Mode]) + HIST("innerParam/h2_TPCSignal"), track.tpcInnerParam(), track.tpcSignal()); + hist.fill(HIST(Dire[Mode]) + HIST("innerParam/h2_TOFSignal"), track.tpcInnerParam(), track.beta()); + hist.fill(HIST(Dire[Mode]) + HIST("innerParam/h2_pvsm2"), track.mass() * track.mass(), track.tpcInnerParam()); + hist.fill(HIST("QA/after/innerParam/h2_TPCSignal"), track.tpcInnerParam(), track.tpcSignal()); + hist.fill(HIST("QA/after/innerParam/h2_TOFSignal"), track.tpcInnerParam(), track.beta()); + hist.fill(HIST("QA/after/innerParam/h2_pvsm2"), track.mass() * track.mass(), track.tpcInnerParam()); + } + + template + void fillPtMCHist(double pt, int pid, int pdgCodePos, int pdgCodeNeg) + { + hist.fill(HIST(Dire[Mode]) + HIST("h_PtTruth"), pt); + if (pid == pdgCodePos) { + hist.fill(HIST(Dire[Mode]) + HIST("h_PtPosTruth"), pt); + } + if (pid == pdgCodeNeg) { + hist.fill(HIST(Dire[Mode]) + HIST("h_PtNegTruth"), pt); + } + } + + template + void fillAnalysisHistos(int nTPC, int nFT0M, int N, double Q1, double Q2, double Q3, double Q4) + { + if (N == 0) { + return; + } + double twopart1 = ((Q1 * Q1) - Q2); + double threepart1 = ((Q1 * Q1 * Q1) - (3 * Q2 * Q1) + 2 * Q3); + double fourpart1 = ((Q1 * Q1 * Q1 * Q1) - (6 * Q2 * Q1 * Q1) + (3 * Q2 * Q2) + (8 * Q3 * Q1) - 6 * Q4); + + hist.fill(HIST(Dire[Mode]) + HIST("h_Mult"), N); + hist.fill(HIST(Dire[Mode]) + HIST("h_Q1"), nTPC, Q1, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_Q2"), nTPC, Q2, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_Q3"), nTPC, Q3, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_Q4"), nTPC, Q4, nFT0M); + + if (N > 1) { + double meanPt = Q1 / static_cast(N); + double nPair = (static_cast(N) * (static_cast(N) - 1)); + double twopart = twopart1 / nPair; + double checkNDenoVar = (1 / std::sqrt(1 - (1 / static_cast(N)))); + hist.fill(HIST(Dire[Mode]) + HIST("h_mean_pT"), meanPt); + hist.fill(HIST(Dire[Mode]) + HIST("p_mean_pT_Mult_var"), nTPC, meanPt); + + hist.fill(HIST(Dire[Mode]) + HIST("h_Q1_var"), nTPC, Q1, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_N_var"), nTPC, N, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_twopart_nume_Mult_var"), nTPC, twopart1, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_twopart_deno_Mult_var"), nTPC, nPair, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_mean_pT_Mult_var"), nTPC, meanPt, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_twopart_Mult_var"), nTPC, twopart, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("p_CheckNCh"), nTPC, checkNDenoVar); + hist.fill(HIST(Dire[Mode]) + HIST("h_CheckNCh"), nTPC, checkNDenoVar, nFT0M); + + if (N > 2) { + double nTriplet = (static_cast(N) * (static_cast(N) - 1) * (static_cast(N) - 2)); + double threepart = threepart1 / nTriplet; + hist.fill(HIST(Dire[Mode]) + HIST("h_mean_pT_Mult_skew"), nTPC, meanPt, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_twopart_Mult_skew"), nTPC, twopart, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_threepart_Mult_skew"), nTPC, threepart, nFT0M); + + if (N > 3) { + double nQuad = (static_cast(N) * (static_cast(N) - 1) * (static_cast(N) - 2) * (static_cast(N) - 3)); + double fourpart = fourpart1 / nQuad; + hist.fill(HIST(Dire[Mode]) + HIST("h_mean_pT_Mult_kurto"), nTPC, meanPt, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_twopart_Mult_kurto"), nTPC, twopart, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_threepart_Mult_kurto"), nTPC, threepart, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h_fourpart_Mult_kurto"), nTPC, fourpart, nFT0M); + } + } + } + } + + template + void fillHistos(T const& col, U const& tracks) + { + int nCh = 0, nTPC = 0, nFT0M = 0; + int nPi = 0, nKa = 0, nPr = 0; + double ptCh = 0, q1Ch = 0, q2Ch = 0, q3Ch = 0, q4Ch = 0; + double ptPi = 0, q1Pi = 0, q2Pi = 0, q3Pi = 0, q4Pi = 0; + double ptPr = 0, q1Pr = 0, q2Pr = 0, q3Pr = 0, q4Pr = 0; + double ptKa = 0, q1Ka = 0, q2Ka = 0, q3Ka = 0, q4Ka = 0; + + int nChSim = 0, nSim = 0, NFT0CSim = 0; + int nPiSim = 0, nKaSim = 0, nPrSim = 0; + double ptChSim = 0, q1ChSim = 0, q2ChSim = 0, q3ChSim = 0, q4ChSim = 0; + double ptPiSim = 0, q1PiSim = 0, q2PiSim = 0, q3PiSim = 0, q4PiSim = 0; + double ptPrSim = 0, q1PrSim = 0, q2PrSim = 0, q3PrSim = 0, q4PrSim = 0; + double ptKaSim = 0, q1KaSim = 0, q2KaSim = 0, q3KaSim = 0, q4KaSim = 0; + + array p1, p2; + double invMassGamma = 0.0; + + for (const auto& [trkEl, trkPos] : soa::combinations(soa::CombinationsFullIndexPolicy(tracks, tracks))) { + if (trkEl.index() == trkPos.index()) + continue; + + if (!selTrack(trkEl) || !selTrack(trkPos)) + continue; + + if (!selElectrons(trkEl) || !selElectrons(trkPos)) + continue; + + p1 = std::array{trkEl.px(), trkEl.py(), trkEl.pz()}; + p2 = std::array{trkPos.px(), trkPos.py(), trkPos.pz()}; + + invMassGamma = RecoDecay::m(std::array{p1, p2}, std::array{MassElectron, MassElectron}); + hist.fill(HIST("QA/after/h_invMass_gamma"), invMassGamma); + } + + if constexpr (DataFlag) { + for (const auto& track : tracks) { + if (!selTrack(track)) { + continue; + } + + double nSigmaTPCPi = track.tpcNSigmaPi(); + double nSigmaTPCKa = track.tpcNSigmaKa(); + double nSigmaTPCPr = track.tpcNSigmaPr(); + double nSigmaTOFPi = track.tofNSigmaPi(); + double nSigmaTOFKa = track.tofNSigmaKa(); + double nSigmaTOFPr = track.tofNSigmaPr(); + double rapPi = track.rapidity(MassPiPlus); + double rapKa = track.rapidity(MassKPlus); + double rapPr = track.rapidity(MassProton); + double innerParam = track.tpcInnerParam(); + + if (std::fabs(track.eta()) < 0.8) { + nCh++; + ptCh = track.pt(); + moments(ptCh, q1Ch, q2Ch, q3Ch, q4Ch); + fillChargedQAHistos(track); + } + + fillBeforePIDQAHistos(track); + + if (rejectTracks(track)) { + return; + } + + if (cfgInvMass == true && invMassGamma < cfgGammaCut) { + continue; + } + + if (cfgSelOR == true && cfgSelAND == false) { + if (selLowPi(track, innerParam) == cfgSelLow || selHighPi(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + } + } else if (cfgSelOR == false && cfgSelAND == true) { + if (selLowPi(track, innerParam) == cfgSelLow && selHighPi(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + } + } + + if (cfgSelOR == true && cfgSelAND == false) { + if (selLowKa(track, innerParam) == cfgSelLow || selHighKa(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + } + } else if (cfgSelOR == false && cfgSelAND == true) { + if (selLowKa(track, innerParam) == cfgSelLow && selHighKa(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + } + } + + if (cfgSelOR == true && cfgSelAND == false) { + if (selLowPr(track, innerParam) == cfgSelLow && selHighPr(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + } + } else if (cfgSelOR == false && cfgSelAND == true) { + if (selLowPr(track, innerParam) == cfgSelLow && selHighPr(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + } + } + } + } else if constexpr (RecoFlag) { + if (!col.has_mcCollision()) { + LOGF(warning, "No MC collision for this collision, skip..."); + return; + } + + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + LOGF(warning, "No MC Particle for this track, skip..."); + continue; + } + auto mcPart = track.mcParticle(); + int pid = mcPart.pdgCode(); + if (!mcPart.isPhysicalPrimary()) { + continue; + } + + //___________________________________Truth Level____________________________________________________// + auto charge = 0.; + auto* pd = pdg->GetParticle(pid); + if (pd != nullptr) { + charge = pd->Charge(); + } + if (std::fabs(charge) < 1e-3) { + continue; + } + if (std::abs(mcPart.eta()) < 0.8) { + nSim++; + } + if (-3.3 < mcPart.eta() && mcPart.eta() < -2.1) { + NFT0CSim++; + } + + if (mcPart.pt() > cfgCutPtMin && mcPart.pt() < cfgCutPtMax) { + if (std::abs(mcPart.y()) > cfgCutRap) { + continue; + } + + nChSim++; + ptChSim = mcPart.pt(); + moments(ptChSim, q1ChSim, q2ChSim, q3ChSim, q4ChSim); + hist.fill(HIST("Gen/Charged/h_PtTruth"), mcPart.pt()); + + if (std::abs(pid) == kPiPlus && mcPart.pt() >= cfgCutPiPtMin) { + if (cfgSelOR == true && cfgSelAND == false) { + if (mcPart.p() <= cfgCutPiThrsldP || mcPart.p() > cfgCutPiThrsldP) { + nPiSim++; + ptPiSim = mcPart.pt(); + moments(ptPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); + fillPtMCHist(ptPiSim, pid, kPiPlus, kPiMinus); + } + } else if (cfgSelOR == false && cfgSelAND == true) { + if ((cfgSelLow == true && mcPart.p() <= cfgCutPiThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutPiThrsldP)) { + nPiSim++; + ptPiSim = mcPart.pt(); + moments(ptPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); + fillPtMCHist(ptPiSim, pid, kPiPlus, kPiMinus); + } + } + } + + if (std::abs(pid) == kKPlus && mcPart.pt() >= cfgCutKaPtMin) { + if (cfgSelOR == true && cfgSelAND == false) { + if ((cfgSelLow == true && mcPart.p() <= cfgCutPiThrsldP) || (cfgSelHigh == true && mcPart.p() > cfgCutPiThrsldP)) { + nKaSim++; + ptKaSim = mcPart.pt(); + moments(ptKaSim, q1KaSim, q2KaSim, q3KaSim, q4KaSim); + fillPtMCHist(ptKaSim, pid, kKPlus, kKMinus); + } + } else if (cfgSelOR == false && cfgSelAND == true) { + if ((cfgSelLow == true && mcPart.p() <= cfgCutKaThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutKaThrsldP)) { + nKaSim++; + ptKaSim = mcPart.pt(); + moments(ptKaSim, q1KaSim, q2KaSim, q3KaSim, q4KaSim); + fillPtMCHist(ptKaSim, pid, kKPlus, kKMinus); + } + } + } + + if (std::abs(pid) == kProton && mcPart.pt() >= cfgCutPrPtMin) { + if (cfgSelOR == true && cfgSelAND == false) { + if ((cfgSelLow == true && mcPart.p() <= cfgCutPrThrsldP) || (cfgSelHigh == true && mcPart.p() > cfgCutPrThrsldP)) { + nPrSim++; + ptPrSim = mcPart.pt(); + moments(ptPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); + fillPtMCHist(ptPrSim, pid, kProton, kProtonBar); + } + } else if (cfgSelOR == false && cfgSelAND == true) { + if ((cfgSelLow == true && mcPart.p() <= cfgCutPrThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutPrThrsldP)) { + nPrSim++; + ptPrSim = mcPart.pt(); + moments(ptPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); + fillPtMCHist(ptPrSim, pid, kProton, kProtonBar); + } + } + } + } + + //______________________________Reconstructed Level____________________________________________________// + + if (!selTrack(track)) { + continue; + } + + double nSigmaTPCPi = track.tpcNSigmaPi(); + double nSigmaTPCKa = track.tpcNSigmaKa(); + double nSigmaTPCPr = track.tpcNSigmaPr(); + double nSigmaTOFPi = track.tofNSigmaPi(); + double nSigmaTOFKa = track.tofNSigmaKa(); + double nSigmaTOFPr = track.tofNSigmaPr(); + double rapPi = track.rapidity(MassPiPlus); + double rapKa = track.rapidity(MassKPlus); + double rapPr = track.rapidity(MassProton); + + if (std::fabs(track.eta()) < 0.8) { + nCh++; + ptCh = track.pt(); + moments(ptCh, q1Ch, q2Ch, q3Ch, q4Ch); + fillChargedQAHistos(track); + } + fillBeforePIDQAHistos(track); + + if (rejectTracks(track)) { + return; + } + + if (cfgInvMass == true && invMassGamma < cfgGammaCut) { + continue; + } + + if (std::abs(pid) == kPiPlus && track.pt() >= cfgCutPiPtMin) { + ptPi = track.pt(); + fillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + fillPtMCHist(ptPi, pid, kPiPlus, kPiMinus); + } + + if (std::abs(pid) == kKPlus && track.pt() >= cfgCutKaPtMin) { + ptKa = track.pt(); + fillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + fillPtMCHist(ptKa, pid, kKPlus, kKMinus); + } + + if (std::abs(pid) == kProton && track.pt() >= cfgCutPrPtMin) { + ptPr = track.pt(); + fillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + fillPtMCHist(ptPr, pid, kProton, kProtonBar); + } + } + hist.fill(HIST("QA/after/h_vtxZSim"), col.mcCollision().posZ()); + } + + nTPC = col.multNTracksHasTPC(); + nFT0M = col.multFT0M(); + + if (cfgMCTruth) { + if (nSim != 0) + hist.fill(HIST("QA/after/h_NSim"), nSim); + + if (nSim != 0 && nCh != 0) + hist.fill(HIST("QA/after/h2_NChSim_NSim"), nSim, nChSim); + + if (nSim != 0 && nTPC != 0) + hist.fill(HIST("QA/after/h2_NTPC_NSim"), nSim, nTPC); + + int nFT0C = col.multFT0C(); + if (nFT0C != 0 && NFT0CSim != 0) + hist.fill(HIST("QA/after/h2_NFT0C_NFT0CSim"), NFT0CSim, nFT0C); + + nTPC = nSim; + + hist.fill(HIST("Gen/NTPC"), nTPC); + hist.fill(HIST("Gen/NFT0C"), NFT0CSim); + hist.fill(HIST("Gen/h2_NTPC_NFT0C"), NFT0CSim, nTPC); + + fillAnalysisHistos(nTPC, nFT0M, nChSim, q1ChSim, q2ChSim, q3ChSim, q4ChSim); + fillAnalysisHistos(nTPC, nFT0M, nPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); + fillAnalysisHistos(nTPC, nFT0M, nKaSim, q1KaSim, q2KaSim, q3KaSim, q4KaSim); + fillAnalysisHistos(nTPC, nFT0M, nPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); + } + + fillAfterQAHistos(col); + if (nTPC != 0 && nCh != 0) + hist.fill(HIST("QA/after/h2_NTPC_NCh"), nTPC, nCh); + + fillAnalysisHistos(nTPC, nFT0M, nCh, q1Ch, q2Ch, q3Ch, q4Ch); + fillAnalysisHistos(nTPC, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + fillAnalysisHistos(nTPC, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + fillAnalysisHistos(nTPC, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + } + + void processRun3(MyCollisions::iterator const& col, MyAllTracks const& tracks) + { + // Before Collision and Track Cuts: + fillBeforeQAHistos(col, tracks); + + // After Collision and Track Cuts: + if (selRun3Col(col)) { + fillHistos(col, tracks); + } + } + PROCESS_SWITCH(MeanPtFlucId, processRun3, "Process for Run3", false); + + void processMCRecoSimRun3(MyMCCollisions::iterator const& col, aod::McCollisions const&, MyMCTracks const& tracks, aod::McParticles const&) + { + // Before Collision and Track Cuts: + fillBeforeQAHistos(col, tracks); + + // After Collision and Track Cuts: + if (selRun3Col(col)) { + fillHistos(col, tracks); + } + } + PROCESS_SWITCH(MeanPtFlucId, processMCRecoSimRun3, "process MC Reconstructed & Truth Run-3", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/Femto3D/DataModel/singletrackselector.h b/PWGCF/Femto3D/DataModel/singletrackselector.h index c4d32c3c4c7..a49293f1b7a 100644 --- a/PWGCF/Femto3D/DataModel/singletrackselector.h +++ b/PWGCF/Femto3D/DataModel/singletrackselector.h @@ -208,15 +208,35 @@ DECLARE_SOA_COLUMN(StoredTPCNSigmaHe, storedTpcNSigmaHe, binning::nsigma::binned DECLARE_SOA_COLUMN(StoredTOFNSigmaPi_v1, storedTofNSigmaPi_v1, binning::nsigma::binned_t); // (v1) DECLARE_SOA_COLUMN(StoredTPCNSigmaPi_v1, storedTpcNSigmaPi_v1, binning::nsigma::binned_t); // (v1) + DECLARE_SOA_COLUMN(StoredTOFNSigmaKa_v1, storedTofNSigmaKa_v1, binning::nsigma::binned_t); // (v1) DECLARE_SOA_COLUMN(StoredTPCNSigmaKa_v1, storedTpcNSigmaKa_v1, binning::nsigma::binned_t); // (v1) + DECLARE_SOA_COLUMN(StoredTOFNSigmaPr_v1, storedTofNSigmaPr_v1, binning::nsigma::binned_t); // (v1) DECLARE_SOA_COLUMN(StoredTPCNSigmaPr_v1, storedTpcNSigmaPr_v1, binning::nsigma::binned_t); // (v1) + DECLARE_SOA_COLUMN(StoredTOFNSigmaDe_v1, storedTofNSigmaDe_v1, binning::nsigma::binned_t); // (v1) DECLARE_SOA_COLUMN(StoredTPCNSigmaDe_v1, storedTpcNSigmaDe_v1, binning::nsigma::binned_t); // (v1) + DECLARE_SOA_COLUMN(StoredTOFNSigmaHe_v1, storedTofNSigmaHe_v1, binning::nsigma::binned_t); // (v1) DECLARE_SOA_COLUMN(StoredTPCNSigmaHe_v1, storedTpcNSigmaHe_v1, binning::nsigma::binned_t); // (v1) +DECLARE_SOA_COLUMN(StoredITSNSigmaPi_v1, storedItsNSigmaPi_v1, binning::nsigma::binned_t); // (v1) +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaPi_v1, itsNSigmaPi, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_COLUMN(StoredITSNSigmaKa_v1, storedItsNSigmaKa_v1, binning::nsigma::binned_t); // (v1) +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaKa_v1, itsNSigmaKa, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_COLUMN(StoredITSNSigmaPr_v1, storedItsNSigmaPr_v1, binning::nsigma::binned_t); // (v1) +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaPr_v1, itsNSigmaPr, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_COLUMN(StoredITSNSigmaDe_v1, storedItsNSigmaDe_v1, binning::nsigma::binned_t); // (v1) +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaDe_v1, itsNSigmaDe, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_COLUMN(StoredITSNSigmaHe_v1, storedItsNSigmaHe_v1, binning::nsigma::binned_t); // (v1) +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaHe_v1, itsNSigmaHe, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); + DECLARE_SOA_DYNAMIC_COLUMN(Energy, energy, [](float p, float mass) -> float { return sqrt(p * p + mass * mass); }); DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float p, float eta) -> float { return p / std::cosh(eta); }); DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float p, float eta, float phi) -> float { return (p / std::cosh(eta)) * std::sin(phi); }); @@ -315,166 +335,166 @@ DECLARE_SOA_DYNAMIC_COLUMN(Rapidity, rapidity, //! Track rapidity, computed unde } // namespace singletrackselector -DECLARE_SOA_TABLE_FULL(SingleTrackSels_v0, "SelTracks", "AOD", "SINGLETRACKSEL", // Table of the variables for single track selection. - o2::soa::Index<>, - singletrackselector::SingleCollSelId, - singletrackselector::P, - singletrackselector::Eta, - singletrackselector::Phi, - singletrackselector::Sign, - singletrackselector::TPCNClsFound, - singletrackselector::TPCNClsShared, - singletrackselector::ITSNCls, - singletrackselector::StoredDcaXY, - singletrackselector::StoredDcaZ, - singletrackselector::StoredTPCChi2NCl, - singletrackselector::StoredITSChi2NCl, - singletrackselector::StoredTPCCrossedRowsOverFindableCls, - - singletrackselector::StoredTOFNSigmaPi, - singletrackselector::StoredTPCNSigmaPi, - singletrackselector::StoredTOFNSigmaKa, - singletrackselector::StoredTPCNSigmaKa, - singletrackselector::StoredTOFNSigmaPr, - singletrackselector::StoredTPCNSigmaPr, - singletrackselector::StoredTOFNSigmaDe, - singletrackselector::StoredTPCNSigmaDe, - - singletrackselector::DcaXY_v0, - singletrackselector::DcaZ_v0, - singletrackselector::TPCChi2NCl, - singletrackselector::ITSChi2NCl, - singletrackselector::TPCCrossedRowsOverFindableCls, - singletrackselector::TPCFractionSharedCls, - - singletrackselector::TOFNSigmaPi_v0, - singletrackselector::TPCNSigmaPi_v0, - singletrackselector::TOFNSigmaKa_v0, - singletrackselector::TPCNSigmaKa_v0, - singletrackselector::TOFNSigmaPr_v0, - singletrackselector::TPCNSigmaPr_v0, - singletrackselector::TOFNSigmaDe_v0, - singletrackselector::TPCNSigmaDe_v0, - - singletrackselector::Rapidity, - singletrackselector::Energy, - singletrackselector::Pt, - singletrackselector::Px, - singletrackselector::Py, - singletrackselector::Pz, - singletrackselector::PhiStar); - -DECLARE_SOA_TABLE_FULL(SingleTrackSels_v1, "SelTracks", "AOD", "SINGLETRACKSEL1", // Table of the variables for single track selection. - o2::soa::Index<>, - singletrackselector::SingleCollSelId, - singletrackselector::P, - singletrackselector::Eta, - singletrackselector::Phi, - singletrackselector::Sign, - singletrackselector::TPCNClsFound, - singletrackselector::TPCNClsShared, - singletrackselector::ITSclsMap, - singletrackselector::ITSclusterSizes, - singletrackselector::StoredDcaXY_v1, - singletrackselector::StoredDcaZ_v1, - singletrackselector::StoredTPCChi2NCl, - singletrackselector::StoredITSChi2NCl, - singletrackselector::StoredTPCCrossedRowsOverFindableCls, - - singletrackselector::StoredTOFNSigmaPi, - singletrackselector::StoredTPCNSigmaPi, - singletrackselector::StoredTOFNSigmaKa, - singletrackselector::StoredTPCNSigmaKa, - singletrackselector::StoredTOFNSigmaPr, - singletrackselector::StoredTPCNSigmaPr, - singletrackselector::StoredTOFNSigmaDe, - singletrackselector::StoredTPCNSigmaDe, - singletrackselector::StoredTOFNSigmaHe, - singletrackselector::StoredTPCNSigmaHe, - - singletrackselector::ITSNClsDyn, - track::v001::ITSClsSizeInLayer, - singletrackselector::DcaXY_v1, - singletrackselector::DcaZ_v1, - singletrackselector::TPCChi2NCl, - singletrackselector::ITSChi2NCl, - singletrackselector::TPCCrossedRowsOverFindableCls, - singletrackselector::TPCFractionSharedCls, - - singletrackselector::TOFNSigmaPi_v0, - singletrackselector::TPCNSigmaPi_v0, - singletrackselector::TOFNSigmaKa_v0, - singletrackselector::TPCNSigmaKa_v0, - singletrackselector::TOFNSigmaPr_v0, - singletrackselector::TPCNSigmaPr_v0, - singletrackselector::TOFNSigmaDe_v0, - singletrackselector::TPCNSigmaDe_v0, - singletrackselector::TOFNSigmaHe_v0, - singletrackselector::TPCNSigmaHe_v0, - - singletrackselector::Rapidity, - singletrackselector::Energy, - singletrackselector::Pt, - singletrackselector::Px, - singletrackselector::Py, - singletrackselector::Pz, - singletrackselector::PhiStar); - -DECLARE_SOA_TABLE_FULL(SingleTrackSels_v2, "SelTracks", "AOD", "SINGLETRACKSEL2", // Table of the variables for single track selection. - o2::soa::Index<>, - singletrackselector::SingleCollSelId, - singletrackselector::P, - singletrackselector::Eta, - singletrackselector::Phi, - singletrackselector::Sign, - singletrackselector::TPCNClsFound, - singletrackselector::TPCNClsShared, - singletrackselector::ITSclsMap, - singletrackselector::ITSclusterSizes, - singletrackselector::StoredDcaXY_v2, - singletrackselector::StoredDcaZ_v2, - singletrackselector::StoredTPCChi2NCl, - singletrackselector::StoredITSChi2NCl, - singletrackselector::StoredTPCCrossedRowsOverFindableCls, - - singletrackselector::StoredTOFNSigmaPi_v1, - singletrackselector::StoredTPCNSigmaPi_v1, - singletrackselector::StoredTOFNSigmaKa_v1, - singletrackselector::StoredTPCNSigmaKa_v1, - singletrackselector::StoredTOFNSigmaPr_v1, - singletrackselector::StoredTPCNSigmaPr_v1, - singletrackselector::StoredTOFNSigmaDe_v1, - singletrackselector::StoredTPCNSigmaDe_v1, - singletrackselector::StoredTOFNSigmaHe_v1, - singletrackselector::StoredTPCNSigmaHe_v1, - - singletrackselector::ITSNClsDyn, - track::v001::ITSClsSizeInLayer, - singletrackselector::DcaXY_v2, - singletrackselector::DcaZ_v2, - singletrackselector::TPCChi2NCl, - singletrackselector::ITSChi2NCl, - singletrackselector::TPCCrossedRowsOverFindableCls, - singletrackselector::TPCFractionSharedCls, - - singletrackselector::TOFNSigmaPi_v1, - singletrackselector::TPCNSigmaPi_v1, - singletrackselector::TOFNSigmaKa_v1, - singletrackselector::TPCNSigmaKa_v1, - singletrackselector::TOFNSigmaPr_v1, - singletrackselector::TPCNSigmaPr_v1, - singletrackselector::TOFNSigmaDe_v1, - singletrackselector::TPCNSigmaDe_v1, - singletrackselector::TOFNSigmaHe_v1, - singletrackselector::TPCNSigmaHe_v1, - - singletrackselector::Rapidity, - singletrackselector::Energy, - singletrackselector::Pt, - singletrackselector::Px, - singletrackselector::Py, - singletrackselector::Pz, - singletrackselector::PhiStar); +DECLARE_SOA_TABLE(SingleTrackSels_v0, "AOD", "SINGLETRACKSEL", // Table of the variables for single track selection. + o2::soa::Index<>, + singletrackselector::SingleCollSelId, + singletrackselector::P, + singletrackselector::Eta, + singletrackselector::Phi, + singletrackselector::Sign, + singletrackselector::TPCNClsFound, + singletrackselector::TPCNClsShared, + singletrackselector::ITSNCls, + singletrackselector::StoredDcaXY, + singletrackselector::StoredDcaZ, + singletrackselector::StoredTPCChi2NCl, + singletrackselector::StoredITSChi2NCl, + singletrackselector::StoredTPCCrossedRowsOverFindableCls, + + singletrackselector::StoredTOFNSigmaPi, + singletrackselector::StoredTPCNSigmaPi, + singletrackselector::StoredTOFNSigmaKa, + singletrackselector::StoredTPCNSigmaKa, + singletrackselector::StoredTOFNSigmaPr, + singletrackselector::StoredTPCNSigmaPr, + singletrackselector::StoredTOFNSigmaDe, + singletrackselector::StoredTPCNSigmaDe, + + singletrackselector::DcaXY_v0, + singletrackselector::DcaZ_v0, + singletrackselector::TPCChi2NCl, + singletrackselector::ITSChi2NCl, + singletrackselector::TPCCrossedRowsOverFindableCls, + singletrackselector::TPCFractionSharedCls, + + singletrackselector::TOFNSigmaPi_v0, + singletrackselector::TPCNSigmaPi_v0, + singletrackselector::TOFNSigmaKa_v0, + singletrackselector::TPCNSigmaKa_v0, + singletrackselector::TOFNSigmaPr_v0, + singletrackselector::TPCNSigmaPr_v0, + singletrackselector::TOFNSigmaDe_v0, + singletrackselector::TPCNSigmaDe_v0, + + singletrackselector::Rapidity, + singletrackselector::Energy, + singletrackselector::Pt, + singletrackselector::Px, + singletrackselector::Py, + singletrackselector::Pz, + singletrackselector::PhiStar); + +DECLARE_SOA_TABLE_VERSIONED(SingleTrackSels_v1, "AOD", "SINGLETRACKSEL1", 1, // Table of the variables for single track selection. + o2::soa::Index<>, + singletrackselector::SingleCollSelId, + singletrackselector::P, + singletrackselector::Eta, + singletrackselector::Phi, + singletrackselector::Sign, + singletrackselector::TPCNClsFound, + singletrackselector::TPCNClsShared, + singletrackselector::ITSclsMap, + singletrackselector::ITSclusterSizes, + singletrackselector::StoredDcaXY_v1, + singletrackselector::StoredDcaZ_v1, + singletrackselector::StoredTPCChi2NCl, + singletrackselector::StoredITSChi2NCl, + singletrackselector::StoredTPCCrossedRowsOverFindableCls, + + singletrackselector::StoredTOFNSigmaPi, + singletrackselector::StoredTPCNSigmaPi, + singletrackselector::StoredTOFNSigmaKa, + singletrackselector::StoredTPCNSigmaKa, + singletrackselector::StoredTOFNSigmaPr, + singletrackselector::StoredTPCNSigmaPr, + singletrackselector::StoredTOFNSigmaDe, + singletrackselector::StoredTPCNSigmaDe, + singletrackselector::StoredTOFNSigmaHe, + singletrackselector::StoredTPCNSigmaHe, + + singletrackselector::ITSNClsDyn, + track::v001::ITSClsSizeInLayer, + singletrackselector::DcaXY_v1, + singletrackselector::DcaZ_v1, + singletrackselector::TPCChi2NCl, + singletrackselector::ITSChi2NCl, + singletrackselector::TPCCrossedRowsOverFindableCls, + singletrackselector::TPCFractionSharedCls, + + singletrackselector::TOFNSigmaPi_v0, + singletrackselector::TPCNSigmaPi_v0, + singletrackselector::TOFNSigmaKa_v0, + singletrackselector::TPCNSigmaKa_v0, + singletrackselector::TOFNSigmaPr_v0, + singletrackselector::TPCNSigmaPr_v0, + singletrackselector::TOFNSigmaDe_v0, + singletrackselector::TPCNSigmaDe_v0, + singletrackselector::TOFNSigmaHe_v0, + singletrackselector::TPCNSigmaHe_v0, + + singletrackselector::Rapidity, + singletrackselector::Energy, + singletrackselector::Pt, + singletrackselector::Px, + singletrackselector::Py, + singletrackselector::Pz, + singletrackselector::PhiStar); + +DECLARE_SOA_TABLE_VERSIONED(SingleTrackSels_v2, "AOD", "SINGLETRACKSEL2", 2, // Table of the variables for single track selection. + o2::soa::Index<>, + singletrackselector::SingleCollSelId, + singletrackselector::P, + singletrackselector::Eta, + singletrackselector::Phi, + singletrackselector::Sign, + singletrackselector::TPCNClsFound, + singletrackselector::TPCNClsShared, + singletrackselector::ITSclsMap, + singletrackselector::ITSclusterSizes, + singletrackselector::StoredDcaXY_v2, + singletrackselector::StoredDcaZ_v2, + singletrackselector::StoredTPCChi2NCl, + singletrackselector::StoredITSChi2NCl, + singletrackselector::StoredTPCCrossedRowsOverFindableCls, + + singletrackselector::StoredTOFNSigmaPi_v1, + singletrackselector::StoredTPCNSigmaPi_v1, + singletrackselector::StoredTOFNSigmaKa_v1, + singletrackselector::StoredTPCNSigmaKa_v1, + singletrackselector::StoredTOFNSigmaPr_v1, + singletrackselector::StoredTPCNSigmaPr_v1, + singletrackselector::StoredTOFNSigmaDe_v1, + singletrackselector::StoredTPCNSigmaDe_v1, + singletrackselector::StoredTOFNSigmaHe_v1, + singletrackselector::StoredTPCNSigmaHe_v1, + + singletrackselector::ITSNClsDyn, + track::v001::ITSClsSizeInLayer, + singletrackselector::DcaXY_v2, + singletrackselector::DcaZ_v2, + singletrackselector::TPCChi2NCl, + singletrackselector::ITSChi2NCl, + singletrackselector::TPCCrossedRowsOverFindableCls, + singletrackselector::TPCFractionSharedCls, + + singletrackselector::TOFNSigmaPi_v1, + singletrackselector::TPCNSigmaPi_v1, + singletrackselector::TOFNSigmaKa_v1, + singletrackselector::TPCNSigmaKa_v1, + singletrackselector::TOFNSigmaPr_v1, + singletrackselector::TPCNSigmaPr_v1, + singletrackselector::TOFNSigmaDe_v1, + singletrackselector::TPCNSigmaDe_v1, + singletrackselector::TOFNSigmaHe_v1, + singletrackselector::TPCNSigmaHe_v1, + + singletrackselector::Rapidity, + singletrackselector::Energy, + singletrackselector::Pt, + singletrackselector::Px, + singletrackselector::Py, + singletrackselector::Pz, + singletrackselector::PhiStar); using SingleTrackSels = SingleTrackSels_v2; @@ -487,6 +507,18 @@ DECLARE_SOA_TABLE(SinglePIDEls, "AOD", "SINGLEPIDEL", singletrackselector::StoredTPCNSigmaEl, singletrackselector::TPCNSigmaEl); +DECLARE_SOA_TABLE(SinglePIDsITSPi, "AOD", "STSPIDITSPI", + singletrackselector::StoredITSNSigmaPi_v1, + singletrackselector::ITSNSigmaPi_v1); + +DECLARE_SOA_TABLE(SinglePIDsITSKa, "AOD", "STSPIDITSKA", + singletrackselector::StoredITSNSigmaKa_v1, + singletrackselector::ITSNSigmaKa_v1); + +DECLARE_SOA_TABLE(SinglePIDsITSPr, "AOD", "STSPIDITSPR", + singletrackselector::StoredITSNSigmaPr_v1, + singletrackselector::ITSNSigmaPr_v1); + namespace singletrackselector { DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); diff --git a/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx b/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx index 0bec4d3cf40..538daf6cbb2 100644 --- a/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx +++ b/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx @@ -17,6 +17,8 @@ #include #include +#include +#include #include "EventFiltering/Zorro.h" #include "EventFiltering/ZorroSummary.h" @@ -30,6 +32,7 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponseITS.h" #include "Common/CCDB/ctpRateFetcher.h" #include "DetectorsBase/Propagator.h" @@ -98,6 +101,9 @@ struct singleTrackSelector { Produces tableRow; Produces tableRowExtra; Produces tableRowPIDEl; + Produces tableRowPIDITSPi; + Produces tableRowPIDITSKa; + Produces tableRowPIDITSPr; Produces tableRowMC; Filter eventFilter = (applyEvSel.node() == 0) || @@ -187,8 +193,8 @@ struct singleTrackSelector { d_bz = 0.1 * d_bz; } - template - inline void fillTrackTables(Trks const& tracks) + template + inline void fillTrackTables(TracksType const& tracks) { bool skip_track = false; // flag used for track rejection @@ -248,6 +254,9 @@ struct singleTrackSelector { track.beta()); tableRowPIDEl(singletrackselector::packSymmetric(track.tpcNSigmaEl())); + tableRowPIDITSPi(singletrackselector::packSymmetric(track.itsNSigmaPi())); + tableRowPIDITSKa(singletrackselector::packSymmetric(track.itsNSigmaKa())); + tableRowPIDITSPr(singletrackselector::packSymmetric(track.itsNSigmaPr())); if constexpr (isMC) { int origin = -1; @@ -274,8 +283,15 @@ struct singleTrackSelector { } } - void processDataRun2(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) + void processDataRun2(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks, + aod::BCsWithTimestamps const&) { + + auto tracksWithITSPid = soa::Attach(tracks); auto bc = collision.bc_as(); initCCDB(bc); @@ -304,13 +320,19 @@ struct singleTrackSelector { collision.posZ(), d_bz); - fillTrackTables(tracks); + fillTrackTables(tracksWithITSPid); } } PROCESS_SWITCH(singleTrackSelector, processDataRun2, "process data Run2", false); - void processDataRun3(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) + void processDataRun3(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks, + aod::BCsWithTimestamps const&) { + auto tracksWithITSPid = soa::Attach(tracks); auto bc = collision.bc_as(); initCCDB(bc); @@ -381,13 +403,20 @@ struct singleTrackSelector { hadronicRate, occupancy); - fillTrackTables(tracks); + fillTrackTables(tracksWithITSPid); } } PROCESS_SWITCH(singleTrackSelector, processDataRun3, "process data Run3", true); - void processMCRun2(soa::Filtered::iterator const& collision, soa::Filtered> const& tracks, aod::McParticles const&, aod::BCsWithTimestamps const&) + void processMCRun2(soa::Filtered::iterator const& collision, + soa::Filtered> const& tracks, + aod::McParticles const&, aod::BCsWithTimestamps const&) { + + auto tracksWithITSPid = soa::Attach, + aod::pidits::ITSNSigmaPi, + aod::pidits::ITSNSigmaKa, + aod::pidits::ITSNSigmaPr>(tracks); auto bc = collision.bc_as(); initCCDB(bc); @@ -415,13 +444,20 @@ struct singleTrackSelector { collision.posZ(), d_bz); - fillTrackTables(tracks); + fillTrackTables(tracksWithITSPid); } } PROCESS_SWITCH(singleTrackSelector, processMCRun2, "process MC Run2", false); - void processMCRun3(soa::Filtered::iterator const& collision, aod::McCollisions const&, soa::Filtered> const& tracks, aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&) + void processMCRun3(soa::Filtered::iterator const& collision, aod::McCollisions const&, + soa::Filtered> const& tracks, + aod::McParticles const& mcParticles, + aod::BCsWithTimestamps const&) { + auto tracksWithITSPid = soa::Attach, + aod::pidits::ITSNSigmaPi, + aod::pidits::ITSNSigmaKa, + aod::pidits::ITSNSigmaPr>(tracks); auto bc = collision.bc_as(); initCCDB(bc); double hadronicRate = 0.; @@ -483,7 +519,7 @@ struct singleTrackSelector { hadronicRate, occupancy); - fillTrackTables(tracks); + fillTrackTables(tracksWithITSPid); if (!enable_gen_info) { return; diff --git a/PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h b/PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h index 42828b1c38b..3cc1834de3f 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h +++ b/PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h @@ -70,7 +70,7 @@ class FemtoDreamPairCleaner } const auto& posChild = particles.iteratorAt(part2.index() - 2); const auto& negChild = particles.iteratorAt(part2.index() - 1); - if (part1.globalIndex() != posChild.globalIndex() || part1.globalIndex() != negChild.globalIndex()) { + if (part1.index() != posChild.childrenIds()[0] && part1.index() != negChild.childrenIds()[1]) { return true; } return false; diff --git a/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h b/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h index 65bc644ea24..30686bcad09 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h +++ b/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h @@ -22,6 +22,7 @@ #include #include "PWGCF/DataModel/FemtoDerived.h" #include "Framework/HistogramRegistry.h" +#include "CommonConstants/PhysicsConstants.h" using namespace o2::framework; @@ -100,16 +101,22 @@ class FemtoDreamParticleHisto mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_K").c_str(), "n#sigma_{TPC}^{K}", kTH2F, {pTAxis, NsigmaTPCAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_p").c_str(), "n#sigma_{TPC}^{p}", kTH2F, {pTAxis, NsigmaTPCAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_d").c_str(), "n#sigma_{TPC}^{d}", kTH2F, {pTAxis, NsigmaTPCAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_tr").c_str(), "n#sigma_{TPC}^{tr}", kTH2F, {pTAxis, NsigmaTPCAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_he3").c_str(), "n#sigma_{TPC}^{he3}", kTH2F, {pTAxis, NsigmaTPCAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_el").c_str(), "n#sigma_{TOF}^{e}", kTH2F, {pTAxis, NsigmaTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_pi").c_str(), "n#sigma_{TOF}^{#pi}", kTH2F, {pTAxis, NsigmaTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_K").c_str(), "n#sigma_{TOF}^{K}", kTH2F, {pTAxis, NsigmaTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_p").c_str(), "n#sigma_{TOF}^{p}", kTH2F, {pTAxis, NsigmaTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_d").c_str(), "n#sigma_{TOF}^{d}", kTH2F, {pTAxis, NsigmaTOFAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_tr").c_str(), "n#sigma_{TOF}^{tr}", kTH2F, {pTAxis, NsigmaTOFAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_he3").c_str(), "n#sigma_{TOF}^{he3}", kTH2F, {pTAxis, NsigmaTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_el").c_str(), "n#sigma_{comb}^{e}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_pi").c_str(), "n#sigma_{comb}^{#pi}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_K").c_str(), "n#sigma_{comb}^{K}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_p").c_str(), "n#sigma_{comb}^{p}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_d").c_str(), "n#sigma_{comb}^{d}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_tr").c_str(), "n#sigma_{comb}^{tr}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_he3").c_str(), "n#sigma_{comb}^{he3}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); if (correlatedPlots) { mHistogramRegistry->add((folderName + folderSuffix + "/HighDcorrelator").c_str(), "", kTHnSparseF, {multAxis, multPercentileAxis, pTAxis, etaAxis, phiAxis, tempFitVarAxis, dcazAxis, NsigmaTPCAxis, NsigmaTOFAxis}); } @@ -327,16 +334,22 @@ class FemtoDreamParticleHisto mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTPC_K"), momentum, part.tpcNSigmaKa()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTPC_p"), momentum, part.tpcNSigmaPr()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTPC_d"), momentum, part.tpcNSigmaDe()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTPC_tr"), momentum, part.tpcNSigmaTr()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTPC_he3"), momentum, part.tpcNSigmaHe()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_el"), momentum, part.tofNSigmaEl()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_pi"), momentum, part.tofNSigmaPi()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_K"), momentum, part.tofNSigmaKa()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_p"), momentum, part.tofNSigmaPr()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_d"), momentum, part.tofNSigmaDe()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_tr"), momentum, part.tofNSigmaTr()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_he3"), momentum, part.tofNSigmaHe()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_el"), momentum, std::sqrt(part.tpcNSigmaEl() * part.tpcNSigmaEl() + part.tofNSigmaEl() * part.tofNSigmaEl())); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_pi"), momentum, std::sqrt(part.tpcNSigmaPi() * part.tpcNSigmaPi() + part.tofNSigmaPi() * part.tofNSigmaPi())); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_K"), momentum, std::sqrt(part.tpcNSigmaKa() * part.tpcNSigmaKa() + part.tofNSigmaKa() * part.tofNSigmaKa())); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_p"), momentum, std::sqrt(part.tpcNSigmaPr() * part.tpcNSigmaPr() + part.tofNSigmaPr() * part.tofNSigmaPr())); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_d"), momentum, std::sqrt(part.tpcNSigmaDe() * part.tpcNSigmaDe() + part.tofNSigmaDe() * part.tofNSigmaDe())); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_tr"), momentum, std::sqrt(part.tpcNSigmaTr() * part.tpcNSigmaTr() + part.tofNSigmaTr() * part.tofNSigmaTr())); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_he3"), momentum, std::sqrt(part.tpcNSigmaHe() * part.tpcNSigmaHe() + part.tofNSigmaHe() * part.tofNSigmaHe())); if (correlatedPlots) { @@ -344,26 +357,34 @@ class FemtoDreamParticleHisto float pidTOF = 0.; switch (abs(mPDG)) { - case 11: + case kElectron: pidTPC = part.tpcNSigmaEl(); pidTOF = part.tofNSigmaEl(); break; - case 211: + case kPiPlus: pidTPC = part.tpcNSigmaPi(); pidTOF = part.tofNSigmaPi(); break; - case 321: + case kKPlus: pidTPC = part.tpcNSigmaKa(); pidTOF = part.tofNSigmaKa(); break; - case 2212: + case kProton: pidTPC = part.tpcNSigmaPr(); pidTOF = part.tofNSigmaPr(); break; - case 1000010020: + case constants::physics::kDeuteron: pidTPC = part.tpcNSigmaDe(); pidTOF = part.tofNSigmaDe(); break; + case constants::physics::kTriton: + pidTPC = part.tpcNSigmaTr(); + pidTOF = part.tofNSigmaTr(); + break; + case constants::physics::kHelium3: + pidTPC = part.tpcNSigmaHe(); + pidTOF = part.tofNSigmaHe(); + break; default: LOG(warn) << "PDG code " << mPDG << " not supported. No PID information will be used."; } diff --git a/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h b/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h index 221988a4d3f..a1c5e0dda05 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h @@ -574,15 +574,14 @@ void FemtoDreamTrackSelection::fillQA(T const& track) mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaComb_pi"), track.p(), std::sqrt(track.tpcNSigmaPi() * track.tpcNSigmaPi() + track.tofNSigmaPi() * track.tofNSigmaPi())); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaComb_K"), track.p(), std::sqrt(track.tpcNSigmaKa() * track.tpcNSigmaKa() + track.tofNSigmaKa() * track.tofNSigmaKa())); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaComb_p"), track.p(), std::sqrt(track.tpcNSigmaPr() * track.tpcNSigmaPr() + track.tofNSigmaPr() * track.tofNSigmaPr())); + mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaTPC_d"), track.p(), track.tpcNSigmaDe()); + mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaComb_d"), track.p(), std::sqrt(track.tpcNSigmaDe() * track.tpcNSigmaDe() + track.tofNSigmaDe() * track.tofNSigmaDe())); + mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaTOF_d"), track.p(), track.tofNSigmaDe()); if constexpr (!isHF) { mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaComb_el"), track.p(), std::sqrt(track.tpcNSigmaEl() * track.tpcNSigmaEl() + track.tofNSigmaEl() * track.tofNSigmaEl())); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaTOF_el"), track.p(), track.tofNSigmaEl()); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaTPC_el"), track.p(), track.tpcNSigmaEl()); - - mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaTPC_d"), track.p(), track.tpcNSigmaDe()); - mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaComb_d"), track.p(), std::sqrt(track.tpcNSigmaDe() * track.tpcNSigmaDe() + track.tofNSigmaDe() * track.tofNSigmaDe())); - mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtodreamparticle::TrackTypeName[tracktype]) + HIST("/nSigmaTOF_d"), track.p(), track.tofNSigmaDe()); } } } diff --git a/PWGCF/FemtoDream/Core/femtoDreamUtils.h b/PWGCF/FemtoDream/Core/femtoDreamUtils.h index 92718a9d176..cf3ba2b1585 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamUtils.h +++ b/PWGCF/FemtoDream/Core/femtoDreamUtils.h @@ -18,87 +18,12 @@ #include #include -#include -#include -#include "Framework/ASoAHelpers.h" #include "CommonConstants/PhysicsConstants.h" #include "PWGCF/DataModel/FemtoDerived.h" namespace o2::analysis::femtoDream { -// TODO: remove all these functions pertaining to PID selection for the next tutorial session they have been removed from femtodream tasks but are still present in tutorial files - -enum kDetector { kTPC, - kTPCTOF, - kNdetectors }; - -/// internal function that returns the kPIDselection element corresponding to a -/// specifica n-sigma value \param nSigma number of sigmas for PID -/// \param vNsigma vector with the number of sigmas of interest -/// \return kPIDselection corresponding to n-sigma -int getPIDselection(float nSigma, std::vector vNsigma) -{ - std::sort(vNsigma.begin(), vNsigma.end(), std::greater<>()); - auto it = std::find(vNsigma.begin(), vNsigma.end(), nSigma); - if (it == vNsigma.end()) { - it = vNsigma.begin() + 1; - LOG(warn) << "Invalid value of nSigma: " << nSigma << ". Return the first value of the vector: " << *(it); - } - return std::distance(vNsigma.begin(), it); -} - -/// function that checks whether the PID selection specified in the vectors is -/// fulfilled -/// \param pidcut Bit-wise container for the PID -/// \param vSpecies vector with ID corresponding to the selected species (output from cutculator) -/// \param nSpecies number of available selected species (output from cutculator) -/// \param nSigma number of sigma selection fo PID -/// \param vNsigma vector with available n-sigma selections for PID -/// \param kDetector enum corresponding to the PID technique -/// \return Whether the PID selection specified in the vectors is fulfilled -bool isPIDSelected(aod::femtodreamparticle::cutContainerType pidcut, - int vSpecies, - int nSpecies, - float nSigma, - std::vector vNsigma, - kDetector iDet) -{ - int iNsigma = getPIDselection(nSigma, vNsigma); - int nDet = static_cast(kDetector::kNdetectors); - int bit_to_check = 1 + (vNsigma.size() - (iNsigma + 1)) * nDet * nSpecies + (nSpecies - (vSpecies + 1)) * nSpecies + (nDet - 1 - iDet); - return ((pidcut >> (bit_to_check)) & 1) == 1; -}; - -/// function that checks whether the PID selection specified in the vectors is fulfilled, depending on the momentum TPC or TPC+TOF PID is conducted -/// \param pidcut Bit-wise container for the PID -/// \param momentum Momentum of the track -/// \param pidThresh Momentum threshold that separates between TPC and TPC+TOF PID -/// \param vSpecies Vector with the species of interest (number returned by the CutCulator) -/// \param nSpecies number of available selected species (output from cutculator) -/// \param nSigmaTPC Number of TPC sigmas for selection -/// \param nSigmaTPCTOF Number of TPC+TOF sigmas for selection (circular selection) -/// \return Whether the PID selection is fulfilled -bool isFullPIDSelected(aod::femtodreamparticle::cutContainerType const& pidCut, - float momentum, - float pidThresh, - int vSpecies, - int nSpecies, - std::vector vNsigma, - float nSigmaTPC, - float nSigmaTPCTOF) -{ - bool pidSelection = true; - if (momentum < pidThresh) { - /// TPC PID only - pidSelection = isPIDSelected(pidCut, vSpecies, nSpecies, nSigmaTPC, vNsigma, kDetector::kTPC); - } else { - /// TPC + TOF PID - pidSelection = isPIDSelected(pidCut, vSpecies, nSpecies, nSigmaTPCTOF, vNsigma, kDetector::kTPCTOF); - } - return pidSelection; -}; - /// function for getting the mass of a particle depending on the pdg code /// \param pdgCode pdg code of the particle /// \return mass of the particle @@ -109,27 +34,33 @@ inline float getMass(int pdgCode) float mass = 0; // add new particles if necessary here switch (std::abs(pdgCode)) { - case kPiPlus: // charged pions, changed magic number as per their pdg name + case kPiPlus: mass = o2::constants::physics::MassPiPlus; break; - case kKPlus: // charged kaon + case kKPlus: mass = o2::constants::physics::MassKPlus; break; - case kProton: // proton + case kProton: mass = o2::constants::physics::MassProton; break; - case kLambda0: // Lambda + case kLambda0: mass = o2::constants::physics::MassLambda; break; - case o2::constants::physics::Pdg::kPhi: // Phi Meson + case o2::constants::physics::Pdg::kPhi: mass = o2::constants::physics::MassPhi; break; - case o2::constants::physics::Pdg::kLambdaCPlus: // Charm Lambda + case o2::constants::physics::Pdg::kLambdaCPlus: mass = o2::constants::physics::MassLambdaCPlus; break; - case o2::constants::physics::Pdg::kDeuteron: // Deuteron + case o2::constants::physics::Pdg::kDeuteron: mass = o2::constants::physics::MassDeuteron; break; + case o2::constants::physics::Pdg::kTriton: + mass = o2::constants::physics::MassTriton; + break; + case o2::constants::physics::Pdg::kHelium3: + mass = o2::constants::physics::MassHelium3; + break; default: LOG(fatal) << "PDG code is not suppored"; } @@ -141,10 +72,10 @@ inline int checkDaughterType(o2::aod::femtodreamparticle::ParticleType partType, int partOrigin = 0; if (partType == o2::aod::femtodreamparticle::ParticleType::kTrack) { switch (abs(motherPDG)) { - case 3122: + case kLambda0: partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterLambda; break; - case 3222: + case kSigmaPlus: partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterSigmaplus; break; default: @@ -156,10 +87,10 @@ inline int checkDaughterType(o2::aod::femtodreamparticle::ParticleType partType, } else if (partType == o2::aod::femtodreamparticle::ParticleType::kV0Child) { switch (abs(motherPDG)) { - case 3122: + case kLambda0: partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterLambda; break; - case 3222: + case kSigmaPlus: partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterSigmaplus; break; default: diff --git a/PWGCF/FemtoDream/TableProducer/CMakeLists.txt b/PWGCF/FemtoDream/TableProducer/CMakeLists.txt index 569a6de54cc..4f48c6bf10a 100644 --- a/PWGCF/FemtoDream/TableProducer/CMakeLists.txt +++ b/PWGCF/FemtoDream/TableProducer/CMakeLists.txt @@ -18,3 +18,9 @@ o2physics_add_dpl_workflow(femtodream-producer-reduced SOURCES femtoDreamProducerReducedTask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femtodream-producer-for-specific-analysis + SOURCES femtoDreamProducerTaskForSpecificAnalysis.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx index 0739c7890e7..f5e72eeda89 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx @@ -50,10 +50,10 @@ using FemtoFullCollisionMC = soa::Join::iterator; using FemtoFullTracks = soa::Join; + aod::pidTPCFullEl, aod::pidTPCFullMu, aod::pidTPCFullPi, aod::pidTPCFullKa, + aod::pidTPCFullPr, aod::pidTPCFullDe, aod::pidTPCFullTr, aod::pidTPCFullHe, + aod::pidTOFFullEl, aod::pidTOFFullMu, aod::pidTOFFullPi, aod::pidTOFFullKa, + aod::pidTOFFullPr, aod::pidTOFFullDe, aod::pidTOFFullTr, aod::pidTOFFullHe>; } // namespace o2::aod struct femtoDreamProducerReducedTask { @@ -298,11 +298,15 @@ struct femtoDreamProducerReducedTask { track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.tpcNSigmaDe(), + track.tpcNSigmaTr(), + track.tpcNSigmaHe(), track.tofNSigmaEl(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), track.tofNSigmaDe(), + track.tofNSigmaTr(), + track.tofNSigmaHe(), -999., -999., -999., -999., -999., -999.); } } diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index 083415af5ec..eacdb3b96b5 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -15,6 +15,8 @@ #include #include +#include +#include #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" @@ -49,15 +51,19 @@ namespace o2::aod using FemtoFullCollision = soa::Join::iterator; using FemtoFullCollision_noCent = soa::Join::iterator; +using FemtoFullCollision_CentPbPb = soa::Join::iterator; using FemtoFullCollisionMC = soa::Join::iterator; using FemtoFullCollision_noCent_MC = soa::Join::iterator; +using FemtoFullCollisionMC_CentPbPb = soa::Join::iterator; using FemtoFullMCgenCollisions = soa::Join; using FemtoFullMCgenCollision = FemtoFullMCgenCollisions::iterator; using FemtoFullTracks = soa::Join; + aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa, + aod::pidTPCFullPr, aod::pidTPCFullDe, aod::pidTPCFullTr, aod::pidTPCFullHe, + aod::pidTOFFullEl, aod::pidTOFFullPi, aod::pidTOFFullKa, + aod::pidTOFFullPr, aod::pidTOFFullDe, aod::pidTOFFullTr, aod::pidTOFFullHe>; } // namespace o2::aod namespace softwareTriggers @@ -98,7 +104,6 @@ struct femtoDreamProducerTask { Configurable ConfIsDebug{"ConfIsDebug", true, "Enable Debug tables"}; Configurable ConfIsRun3{"ConfIsRun3", false, "Running on Run3 or pilot"}; Configurable ConfIsForceGRP{"ConfIsForceGRP", false, "Set true if the magnetic field configuration is not available in the usual CCDB directory (e.g. for Run 2 converted data or unanchorad Monte Carlo)"}; - /// Event cuts FemtoDreamCollisionSelection colCuts; // Event cuts - Triggers @@ -107,6 +112,7 @@ struct femtoDreamProducerTask { "ConfTriggerSwitches", {softwareTriggers::triggerSwitches[0], 1, softwareTriggers::nTriggers, std::vector{"Switch"}, softwareTriggers::triggerNames}, "Turn on which trigger should be checked for recorded events to pass selection"}; + Configurable ConfBaseCCDBPathForTriggers{"ConfBaseCCDBPathForTriggers", "Users/m/mpuccio/EventFiltering/OTS/Chunked/", "Provide ccdb path for trigger table; default - trigger coordination"}; // Event cuts - usual selection criteria Configurable ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; @@ -197,10 +203,10 @@ struct femtoDreamProducerTask { void init(InitContext&) { - if (doprocessData == false && doprocessData_noCentrality == false && doprocessMC == false && doprocessMC_noCentrality == false) { + if (doprocessData == false && doprocessData_noCentrality == false && doprocessData_CentPbPb == false && doprocessMC == false && doprocessMC_noCentrality == false && doprocessMC_CentPbPb == false) { LOGF(fatal, "Neither processData nor processMC enabled. Please choose one."); } - if ((doprocessData == true && doprocessMC == true) || (doprocessData == true && doprocessMC_noCentrality == true) || (doprocessMC == true && doprocessMC_noCentrality == true) || (doprocessData_noCentrality == true && doprocessData == true) || (doprocessData_noCentrality == true && doprocessMC == true) || (doprocessData_noCentrality == true && doprocessMC_noCentrality == true)) { + if ((doprocessData == true && doprocessMC == true) || (doprocessData == true && doprocessMC_noCentrality == true) || (doprocessMC == true && doprocessMC_noCentrality == true) || (doprocessData_noCentrality == true && doprocessData == true) || (doprocessData_noCentrality == true && doprocessMC == true) || (doprocessData_noCentrality == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessData == true) || (doprocessData_CentPbPb == true && doprocessData_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC == true) || (doprocessData_CentPbPb == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC_CentPbPb == true)) { LOGF(fatal, "Cannot enable more than one process switch at the same time. " "Please choose one."); @@ -339,6 +345,7 @@ struct femtoDreamProducerTask { // Init for zorro to get trigger flags if (ConfEnableTriggerSelection) { + zorro.setCCDBpath(ConfBaseCCDBPathForTriggers); zorro.initCCDB(ccdb.service, mRunNumber, timestamp, zorroTriggerNames); } } @@ -363,16 +370,21 @@ struct femtoDreamProducerTask { particle.tpcNSigmaKa(), particle.tpcNSigmaPr(), particle.tpcNSigmaDe(), + particle.tpcNSigmaTr(), + particle.tpcNSigmaHe(), particle.tofNSigmaEl(), particle.tofNSigmaPi(), particle.tofNSigmaKa(), particle.tofNSigmaPr(), particle.tofNSigmaDe(), + particle.tofNSigmaTr(), + particle.tofNSigmaHe(), -999., -999., -999., -999., -999., -999.); } else { - outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., -999., -999., -999., + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., particle.dcaV0daughters(), particle.v0radius(), particle.x(), @@ -451,7 +463,7 @@ struct femtoDreamProducerTask { outputCollsMCLabels(-1); } } - template + template void fillCollisionsAndTracksAndV0(CollisionType const& col, TrackType const& tracks, V0Type const& fullV0s) { // If triggering is enabled, select only events which were triggered wit our triggers @@ -468,7 +480,11 @@ struct femtoDreamProducerTask { int multNtr = 0; if (ConfIsRun3) { if constexpr (useCentrality) { - mult = col.centFT0M(); + if constexpr (analysePbPb) { + mult = col.centFT0C(); + } else { + mult = col.centFT0M(); + } } else { mult = 0; } @@ -647,8 +663,8 @@ struct femtoDreamProducerTask { } if (ConfIsActivateReso.value) { - for (auto iDaug1 = 0; iDaug1 < Daughter1.size(); ++iDaug1) { - for (auto iDaug2 = 0; iDaug2 < Daughter2.size(); ++iDaug2) { + for (std::size_t iDaug1 = 0; iDaug1 < Daughter1.size(); ++iDaug1) { + for (std::size_t iDaug2 = 0; iDaug2 < Daughter2.size(); ++iDaug2) { // MC stuff is still missing, also V0 QA // ALSO: fix indices and other table entries which are now set to 0 as deflaut as not needed for p-p-phi cf ana @@ -703,7 +719,7 @@ struct femtoDreamProducerTask { outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., -999.); // QA for Reso + -999., -999. - 999., -999., -999., -999., -999., -999.); // QA for Reso } } } @@ -720,7 +736,7 @@ struct femtoDreamProducerTask { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0(col, tracks, fullV0s); + fillCollisionsAndTracksAndV0(col, tracks, fullV0s); } PROCESS_SWITCH(femtoDreamProducerTask, processData, "Provide experimental data", true); @@ -734,11 +750,25 @@ struct femtoDreamProducerTask { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0(col, tracks, fullV0s); + fillCollisionsAndTracksAndV0(col, tracks, fullV0s); } PROCESS_SWITCH(femtoDreamProducerTask, processData_noCentrality, "Provide experimental data without centrality information", false); + void + processData_CentPbPb(aod::FemtoFullCollision_CentPbPb const& col, + aod::BCsWithTimestamps const&, + aod::FemtoFullTracks const& tracks, + o2::aod::V0Datas const& fullV0s) + { + // get magnetic field for run + initCCDB_Mag_Trig(col.bc_as()); + // fill the tables + fillCollisionsAndTracksAndV0(col, tracks, fullV0s); + } + PROCESS_SWITCH(femtoDreamProducerTask, processData_CentPbPb, + "Provide experimental data with centrality information for PbPb collisions", false); + void processMC(aod::FemtoFullCollisionMC const& col, aod::BCsWithTimestamps const&, soa::Join const& tracks, @@ -749,7 +779,7 @@ struct femtoDreamProducerTask { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0(col, tracks, fullV0s); + fillCollisionsAndTracksAndV0(col, tracks, fullV0s); } PROCESS_SWITCH(femtoDreamProducerTask, processMC, "Provide MC data", false); @@ -763,11 +793,24 @@ struct femtoDreamProducerTask { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0(col, tracks, fullV0s); + fillCollisionsAndTracksAndV0(col, tracks, fullV0s); } PROCESS_SWITCH(femtoDreamProducerTask, processMC_noCentrality, "Provide MC data without requiring a centrality calibration", false); -}; + void processMC_CentPbPb(aod::FemtoFullCollisionMC_CentPbPb const& col, + aod::BCsWithTimestamps const&, + soa::Join const& tracks, + aod::FemtoFullMCgenCollisions const&, + aod::McParticles const&, + soa::Join const& fullV0s) /// \todo with FilteredFullV0s + { + // get magnetic field for run + initCCDB_Mag_Trig(col.bc_as()); + // fill the tables + fillCollisionsAndTracksAndV0(col, tracks, fullV0s); + } + PROCESS_SWITCH(femtoDreamProducerTask, processMC_CentPbPb, "Provide MC data with centrality information for PbPb collisions", false); +}; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskForSpecificAnalysis.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskForSpecificAnalysis.cxx new file mode 100644 index 00000000000..b6ea6cd5f90 --- /dev/null +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskForSpecificAnalysis.cxx @@ -0,0 +1,211 @@ +// Copyright 2019-2022 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file femtoDreamProducerTaskForSpecificAnalysis.cxx +/// \brief Tasks that reads the track tables and creates track triplets; only three identical particles can be used +/// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de + +#include +#include +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "TDatabasePDG.h" + +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamEventHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h" +#include "PWGCF/FemtoDream/Core/femtoDreamContainerThreeBody.h" +#include "PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" + +using namespace o2; +using namespace o2::analysis::femtoDream; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct femtoDreamProducerTaskForSpecificAnalysis { + + SliceCache cache; + + Produces outputCollision; + Produces outputParts; + + Preslice perCol = aod::femtodreamparticle::fdCollisionId; + float mMassOne = -999, mMassTwo = -999, mMassThree = -999; + int collisions = 0; + + Configurable ConfNumberOfTracks{"ConfNumberOfTracks", 3, "Number of tracks"}; + Configurable ConfNumberOfV0{"ConfNumberOfV0", 0, "Number of V0"}; + + /// Track selection + Configurable ConfPIDthrMom{"ConfPIDthrMom", 1.f, "Momentum threshold from which TPC and TOF are required for PID"}; + Configurable ConfTPCPIDBit{"ConfTPCPIDBit", 16, "PID TPC bit from cutCulator "}; + Configurable ConfTPCTOFPIDBit{"ConfTPCTOFPIDBit", 8, "PID TPCTOF bit from cutCulator"}; + + /// Partition for selected particles + Partition SelectedParts = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && + ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= ConfPIDthrMom, ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCPIDBit), ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCTOFPIDBit)); + + /// V0 selection + Configurable Conf_minInvMass_V0{"Conf_minInvMass_V0", 1.08, "Minimum invariant mass of V0 (particle)"}; + Configurable Conf_maxInvMass_V0{"Conf_maxInvMass_V0", 1.15, "Maximum invariant mass of V0 (particle)"}; + Configurable Conf_minInvMassAnti_V0{"Conf_minInvMassAnti_V0", 1.08, "Minimum invariant mass of V0 (antiparticle)"}; + Configurable Conf_maxInvMassAnti_V0{"Conf_maxInvMassAnti_V0", 1.15, "Maximum invariant mass of V0 (antiparticle)"}; + + // Partition for selected particles + Partition SelectedV0s = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)); + + HistogramRegistry EventRegistry{"EventRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + template + int getRowDaughters(int daughID, T const& vecID) + { + int rowInPrimaryTrackTableDaugh = -1; + for (size_t i = 0; i < vecID.size(); i++) { + if (vecID.at(i) == daughID) { + rowInPrimaryTrackTableDaugh = i; + break; + } + } + return rowInPrimaryTrackTableDaugh; + } + + void init(InitContext&) + { + EventRegistry.add("hStatistiscs", ";bin;Entries", kTH1F, {{3, 0, 3}}); + // get bit for the collision mask + } + /// This function stores accepted collisions in derived data + /// @tparam PartitionType + /// @tparam PartType + /// @tparam isMC: enables Monte Carlo truth specific histograms + /// @param groupSelectedTracks partition for the first particle passed by the process function + /// @param groupSelectedV0s partition for the second particle passed by the process function + /// @param parts femtoDreamParticles table + template + void createSpecifiedDerivedData(o2::aod::FDCollision& col, PartitionType groupSelectedTracks, PartitionType groupSelectedV0s, PartType parts) + { + /// check tracks + int tracksCount = 0; + int antitracksCount = 0; + for (auto& part : groupSelectedTracks) { + if (part.cut() & 1) { + antitracksCount++; + } else { + tracksCount++; + } + } + + /// check V0s + int V0Count = 0; + int antiV0Count = 0; + for (auto& V0 : groupSelectedV0s) { + if ((V0.mLambda() > Conf_minInvMass_V0) && (V0.mLambda() < Conf_maxInvMass_V0)) { + V0Count++; + } else if ((V0.mAntiLambda() > Conf_minInvMassAnti_V0) && (V0.mAntiLambda() < Conf_maxInvMassAnti_V0)) { + antiV0Count++; + } + } + + std::vector tmpIDtrack; + + if ((V0Count >= ConfNumberOfV0 && tracksCount >= ConfNumberOfTracks) || (antiV0Count >= ConfNumberOfV0 && antitracksCount >= ConfNumberOfTracks)) { + EventRegistry.fill(HIST("hStatistiscs"), 1); + outputCollision(col.posZ(), col.multV0M(), col.multNtr(), col.sphericity(), col.magField()); + for (auto& femtoParticle : parts) { + if (aod::femtodreamparticle::ParticleType::kTrack == femtoParticle.partType()) { + std::vector childIDs = {0, 0}; + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + tmpIDtrack.push_back(femtoParticle.index()); + } + if (aod::femtodreamparticle::ParticleType::kV0Child == femtoParticle.partType()) { + std::vector childIDs = {0, 0}; + const auto& children = femtoParticle.childrenIds(); + int childId = (children[0] != 0) ? children[0] : children[1]; + if (childId != -1) { + int rowInPrimaryTrackTable = getRowDaughters(childId, tmpIDtrack); + childIDs = (children[0] != 0) ? std::vector{rowInPrimaryTrackTable, 0} : std::vector{0, rowInPrimaryTrackTable}; + } else { + childIDs = (children[0] != 0) ? std::vector{-1, 0} : std::vector{0, -1}; + } + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + if (aod::femtodreamparticle::ParticleType::kV0 == femtoParticle.partType()) { + // If the order in primary producer is changed of storing first pos, neg daughters and then V0 - this must be updated + const int rowOfLastTrack = outputParts.lastIndex(); + std::vector childIDs = {rowOfLastTrack - 1, rowOfLastTrack}; + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + } + } else { + EventRegistry.fill(HIST("hStatistiscs"), 2); + } + } + + /// process function to create derived data with only collisions containing n tracks + /// \param col subscribe to the collision table (Data) + /// \param parts subscribe to the femtoDreamParticleTable + void processCollisionsWithNTracksAndNV0(o2::aod::FDCollision& col, + o2::aod::FDParticles& parts) + { + EventRegistry.fill(HIST("hStatistiscs"), 0); + auto thegroupSelectedParts = SelectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + auto thegroupSelectedV0s = SelectedV0s->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + + createSpecifiedDerivedData(col, thegroupSelectedParts, thegroupSelectedV0s, parts); + } + PROCESS_SWITCH(femtoDreamProducerTaskForSpecificAnalysis, processCollisionsWithNTracksAndNV0, "Enable producing data with ppp collisions for data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamHashTask.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamHashTask.cxx index cc449887df1..78fe8c1cce4 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamHashTask.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamHashTask.cxx @@ -31,7 +31,7 @@ struct femtoDreamPairHashTask { std::vector CastCfgVtxBins, CastCfgMultBins; - Produces hashes; + Produces hashes; void init(InitContext&) { diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx index 44c1bb69990..371324a96e8 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include "TRandom3.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -231,6 +232,12 @@ struct femtoDreamPairTaskTrackTrack { void init(InitContext& context) { + + // setup columnpolicy for binning + colBinningMult = {{Mixing.VztxMixBins, Mixing.MultMixBins}, true}; + colBinningMultPercentile = {{Mixing.VztxMixBins, Mixing.MultPercentileMixBins}, true}; + colBinningMultMultPercentile = {{Mixing.VztxMixBins, Mixing.MultMixBins, Mixing.MultPercentileMixBins}, true}; + if (Option.RandomizePair.value) { random = new TRandom3(0); } diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackV0.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackV0.cxx index 7b6fe7ec1ab..dbaaacedfe8 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackV0.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackV0.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" @@ -227,6 +228,11 @@ struct femtoDreamPairTaskTrackV0 { void init(InitContext& context) { + // setup binnnig policy for mixing + colBinningMult = {{Mixing.BinVztx, Mixing.BinMult}, true}; + colBinningMultPercentile = {{Mixing.BinVztx, Mixing.BinMultPercentile}, true}; + colBinningMultMultPercentile = {{Mixing.BinVztx, Mixing.BinMult, Mixing.BinMultPercentile}, true}; + eventHisto.init(&Registry, Option.IsMC); trackHistoPartOne.init(&Registry, Binning.multTempFit, Option.Dummy, Binning.pTTrack, Option.Dummy, Option.Dummy, Binning.TempFitVarTrack, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.IsMC, Track1.PDGCode); trackHistoPartTwo.init(&Registry, Binning.multTempFit, Option.Dummy, Binning.pTV0, Option.Dummy, Option.Dummy, Binning.TempFitVarV0, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Binning.InvMass, Option.IsMC, V02.PDGCode); diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackTrack.cxx index 4667ed15972..0dea45463f6 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackTrack.cxx @@ -14,6 +14,7 @@ /// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de #include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" @@ -128,6 +129,9 @@ struct femtoDreamTripletTaskTrackTrackTrack { { eventHisto.init(&qaRegistry, false); + + colBinning = {{ConfVtxBins, ConfMultBins}, true}; + trackHistoSelectedParts.init(&qaRegistry, ConfBinmultTempFit, ConfDummy, ConfTempFitVarpTBins, ConfDummy, ConfDummy, ConfTempFitVarBins, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfIsMC, ConfPDGCodePart); trackHistoALLSelectedParts.init(&qaRegistry, ConfBinmultTempFit, ConfDummy, ConfTempFitVarpTBins, ConfDummy, ConfDummy, ConfTempFitVarBins, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfIsMC, ConfPDGCodePart); @@ -141,7 +145,6 @@ struct femtoDreamTripletTaskTrackTrackTrack { if (ConfIsMC) { ThreeBodyQARegistry.add("TrackMC_QA/hMazzachi", ";gen;(reco-gen)/gen", kTH2F, {{100, ConfMinpT, ConfMaxpT}, {300, -1, 1}}); } - sameEventCont.init(&resultRegistry, ConfQ3Bins, ConfMultBins, ConfIsMC); mixedEventCont.init(&resultRegistry, ConfQ3Bins, ConfMultBins, ConfIsMC); sameEventCont.setPDGCodes(ConfPDGCodePart, ConfPDGCodePart, ConfPDGCodePart); @@ -337,6 +340,7 @@ struct femtoDreamTripletTaskTrackTrackTrack { void doMixedEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartitionType groupPartsThree, PartType parts, float magFieldTesla, int multCol) { for (auto& [p1, p2, p3] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo, groupPartsThree))) { + auto Q3 = FemtoDreamMath::getQ3(p1, mMassOne, p2, mMassTwo, p3, mMassThree); if (ConfIsCPR.value) { if (pairCloseRejectionME.isClosePair(p1, p2, parts, magFieldTesla, Q3)) { @@ -377,7 +381,6 @@ struct femtoDreamTripletTaskTrackTrackTrack { if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { continue; } - // CONSIDER testing different strategies to which events to use doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); } @@ -410,6 +413,7 @@ struct femtoDreamTripletTaskTrackTrackTrack { if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { continue; } + doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); } } diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0.cxx index afeeaa36c9d..05892a71bf1 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0.cxx @@ -15,6 +15,7 @@ #include #include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" @@ -179,6 +180,9 @@ struct femtoDreamTripletTaskTrackTrackV0 { { eventHisto.init(&qaRegistry, false); + + colBinning = {{ConfVtxBins, ConfMultBins}, true}; + trackHistoSelectedParts.init(&qaRegistry, ConfDummy, ConfDummy, ConfTempFitVarpTBins, ConfDummy, ConfDummy, ConfTempFitVarBinsTrack, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfIsMC, ConfPDGCodePart); trackHistoALLSelectedParts.init(&qaRegistry, ConfDummy, ConfDummy, ConfTempFitVarpTBins, ConfDummy, ConfDummy, ConfTempFitVarBinsTrack, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfIsMC, ConfPDGCodePart); particleHistoSelectedV0s.init(&qaRegistry, ConfDummy, ConfDummy, ConfTempFitVarpTV0Bins, ConfDummy, ConfDummy, ConfTempFitVarBinsV0, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfInvMassBins, ConfIsMC, ConfPDGCodeV0); @@ -199,6 +203,9 @@ struct femtoDreamTripletTaskTrackTrackV0 { std::vector tmpVecMult = ConfMultBins; framework::AxisSpec multAxis = {tmpVecMult, "Multiplicity"}; ThreeBodyQARegistry.add("TripletTaskQA/hSEMultVSGoodTracks", ";Mult;GoodT", kTH2F, {multAxis, {100, 0, 100}}); + ThreeBodyQARegistry.add("TripletTaskQA/hTestPairCleaner", ";posDaughtID; negDaughID", kTH2F, {{100, -10000, 10000}, {100, -10000, 10000}}); + ThreeBodyQARegistry.add("TripletTaskQA/hTestPairCleanerPos", ";primaryTrack; posDaughtID", kTH2F, {{100, -200, 200}, {100, -200, 200}}); + ThreeBodyQARegistry.add("TripletTaskQA/hTestPairCleanerNeg", ";primaryTrack; negDaughtID", kTH2F, {{100, -200, 200}, {100, -200, 200}}); sameEventCont.init(&resultRegistry, ConfQ3Bins, ConfMultBins, ConfIsMC); mixedEventCont.init(&resultRegistry, ConfQ3Bins, ConfMultBins, ConfIsMC); @@ -308,6 +315,13 @@ struct femtoDreamTripletTaskTrackTrackV0 { for (auto& V0 : groupSelectedV0s) { const auto& posChild = parts.iteratorAt(V0.index() - 2); const auto& negChild = parts.iteratorAt(V0.index() - 1); + + const auto& childrenPos = posChild.childrenIds(); + const auto& childrenNeg = negChild.childrenIds(); + auto posID = childrenPos[0]; + auto negID = childrenNeg[1]; + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleaner"), posID, negID); + if (!((posChild.cut() & Conf_ChildPos_CutV0) == Conf_ChildPos_CutV0 && (posChild.pidcut() & Conf_ChildPos_TPCBitV0) == Conf_ChildPos_TPCBitV0 && (negChild.cut() & Conf_ChildNeg_CutV0) == Conf_ChildNeg_CutV0 && @@ -316,6 +330,10 @@ struct femtoDreamTripletTaskTrackTrackV0 { } for (auto& [T1, T2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupSelectedTracks, groupSelectedTracks))) { + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerPos"), T1.index(), posID); + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerNeg"), T1.index(), negID); + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerPos"), T2.index(), posID); + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerNeg"), T2.index(), negID); auto Q3 = FemtoDreamMath::getQ3(T1, mMassOne, T2, mMassTwo, V0, mMassThree); // Close pair rejection if (ConfIsCPR.value) { @@ -548,7 +566,6 @@ struct femtoDreamTripletTaskTrackTrackV0 { if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { continue; } - // CONSIDER testing different strategies to which events to use doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); } diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h index 64e9c339b55..83e9a59d9c1 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h @@ -16,6 +16,7 @@ /// \author Luca Barioglio, TU München, luca.barioglio@cern.ch /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch /// \author Barbara Chytla, WUT Warsaw, barbara.chytla@cern.ch +/// \author Shirajum Monira, WUT Warsaw, shirajum.monira@cern.ch #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECASCADESELECTION_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECASCADESELECTION_H_ @@ -87,13 +88,13 @@ class FemtoUniverseCascadeSelection public: FemtoUniverseCascadeSelection() - : nPtCascadeMinSel(0), nPtCascadeMaxSel(0), nEtaCascadeMaxSel(0), nDCAV0DaughMax(0), nCPAV0Min(0), nTranRadV0Min(0), nTranRadV0Max(0), nV0DecVtxMax(0), nDCACascadeDaughMax(0), nCPACascadeMin(0), nTranRadCascadeMin(0), nTranRadCascadeMax(0), nDecVtxMax(0), nDCAPosToPV(0), nDCANegToPV(0), nDCABachToPV(0), nDCAV0ToPV(0), pTCascadeMin(9999999.), pTCascadeMax(-9999999.), etaCascadeMax(-9999999.), DCAV0DaughMax(-9999999.), CPAV0Min(9999999.), TranRadV0Min(9999999.), TranRadV0Max(-9999999.), V0DecVtxMax(-9999999.), DCACascadeDaughMax(-9999999.), CPACascadeMin(9999999.), TranRadCascadeMin(9999999.), TranRadCascadeMax(-9999999.), DecVtxMax(-9999999.), DCAPosToPV(9999999.), DCANegToPV(9999999.), DCABachToPV(9999999.), DCAV0ToPV(9999999.), fV0InvMassLowLimit(1.05), fV0InvMassUpLimit(1.3), fInvMassLowLimit(1.25), fInvMassUpLimit(1.4), fRejectOmega(false), fInvMassOmegaLowLimit(1.5), fInvMassOmegaUpLimit(2.0) /*, nSigmaPIDOffsetTPC(0.)*/ + : nPtCascadeMinSel(0), nPtCascadeMaxSel(0), nEtaCascadeMaxSel(0), nDCAV0DaughMax(0), nCPAV0Min(0), nTranRadV0Min(0), nTranRadV0Max(0), nV0DecVtxMax(0), nDCACascadeDaughMax(0), nCPACascadeMin(0), nTranRadCascadeMin(0), nTranRadCascadeMax(0), nDecVtxMax(0), nDCAPosToPV(0), nDCANegToPV(0), nDCABachToPV(0), nDCAV0ToPV(0), pTCascadeMin(9999999.), pTCascadeMax(-9999999.), etaCascadeMax(-9999999.), DCAV0DaughMax(-9999999.), CPAV0Min(9999999.), TranRadV0Min(9999999.), TranRadV0Max(-9999999.), V0DecVtxMax(-9999999.), DCACascadeDaughMax(-9999999.), CPACascadeMin(9999999.), TranRadCascadeMin(9999999.), TranRadCascadeMax(-9999999.), DecVtxMax(-9999999.), DCAPosToPV(9999999.), DCANegToPV(9999999.), DCABachToPV(9999999.), DCAV0ToPV(9999999.), fV0InvMassLowLimit(1.05), fV0InvMassUpLimit(1.3), fInvMassLowLimit(1.25), fInvMassUpLimit(1.4), fRejectCompetingMass(false), fInvMassCompetingLowLimit(1.5), fInvMassCompetingUpLimit(2.0), isCascOmega(false) /*, nSigmaPIDOffsetTPC(0.)*/ { } /// Initializes histograms for the task template - void init(HistogramRegistry* registry); + void init(HistogramRegistry* registry, bool isSelectCascOmega = false); template bool isSelectedMinimal(Col const& col, Casc const& cascade, Track const& posTrack, Track const& negTrack, Track const& bachTrack); @@ -168,11 +169,11 @@ class FemtoUniverseCascadeSelection /// Set limit for the omega rejection on the invariant mass /// \param lowLimit Lower limit for the invariant mass distribution /// \param upLimit Upper limit for the invariant mass distribution - void setOmegaInvMassLimits(float lowLimit, float upLimit) + void setCompetingInvMassLimits(float lowLimit, float upLimit) { - fRejectOmega = true; - fInvMassOmegaLowLimit = lowLimit; - fInvMassOmegaUpLimit = upLimit; + fRejectCompetingMass = true; + fInvMassCompetingLowLimit = lowLimit; + fInvMassCompetingUpLimit = upLimit; } private: @@ -217,9 +218,11 @@ class FemtoUniverseCascadeSelection float fInvMassLowLimit; float fInvMassUpLimit; - float fRejectOmega; - float fInvMassOmegaLowLimit; - float fInvMassOmegaUpLimit; + float fRejectCompetingMass; + float fInvMassCompetingLowLimit; + float fInvMassCompetingUpLimit; + + bool isCascOmega; // float nSigmaPIDOffsetTPC; @@ -259,8 +262,8 @@ class FemtoUniverseCascadeSelection femtoUniverseSelection::kLowerLimit, // DCA v0 to PV max femtoUniverseSelection::kLowerLimit, // v0 mass min femtoUniverseSelection::kUpperLimit, // v0 mass max - }; ///< Map to match a variable with - ///< its type + }; ///< Map to match a variable with + ///< its type static constexpr std::string_view mSelectionHelper[kNcascadeSelection] = { "Cascade particle sign (+1 or -1)", @@ -288,7 +291,7 @@ class FemtoUniverseCascadeSelection }; // namespace femtoUniverse template -void FemtoUniverseCascadeSelection::init(HistogramRegistry* registry) +void FemtoUniverseCascadeSelection::init(HistogramRegistry* registry, bool isSelectCascOmega) { if (registry) { @@ -297,7 +300,7 @@ void FemtoUniverseCascadeSelection::init(HistogramRegistry* registry) fillSelectionHistogram(); // pos, neg fillSelectionHistogram(); // bach - AxisSpec massAxisCascade = {600, 1.25f, 1.4f, "m_{#Cascade} (GeV/#it{c}^{2})"}; + AxisSpec massAxisCascade = {2200, 1.25f, 1.8f, "m_{#Cascade} (GeV/#it{c}^{2})"}; AxisSpec massAxisV0 = {600, 0.0f, 3.0f, "m_{#V0} (GeV/#it{c}^{2})"}; AxisSpec DCADaughAxis = {1000, 0.0f, 2.0f, "DCA (cm)"}; AxisSpec DCAToPVAxis = {1000, -10.0f, 10.0f, "DCA to PV (cm)"}; @@ -410,6 +413,8 @@ void FemtoUniverseCascadeSelection::init(HistogramRegistry* registry) femtoUniverseSelection::kLowerLimit); fV0InvMassUpLimit = getMinimalSelection(femtoUniverseCascadeSelection::kCascadeV0MassMax, femtoUniverseSelection::kUpperLimit); + + isCascOmega = isSelectCascOmega; } template @@ -429,18 +434,18 @@ bool FemtoUniverseCascadeSelection::isSelectedMinimal(Col const& col, Casc const const float cpaCasc = cascade.casccosPA(col.posX(), col.posY(), col.posZ()); const float dcav0topv = cascade.dcav0topv(col.posX(), col.posY(), col.posZ()); const float invMassLambda = cascade.mLambda(); - const float invMassXi = cascade.mXi(); + const float invMass = isCascOmega ? cascade.mOmega() : cascade.mXi(); if (invMassLambda < fV0InvMassLowLimit || invMassLambda > fV0InvMassUpLimit) { return false; } - if (invMassXi < fInvMassLowLimit || invMassXi > fInvMassUpLimit) { + if (invMass < fInvMassLowLimit || invMass > fInvMassUpLimit) { return false; } - if (fRejectOmega) { - const float invMassOmega = cascade.mOmega(); - if (invMassOmega > fInvMassOmegaLowLimit && - invMassOmega < fInvMassOmegaUpLimit) { + if (fRejectCompetingMass) { + const float invMassCompeting = isCascOmega ? cascade.mXi() : cascade.mOmega(); + if (invMassCompeting > fInvMassCompetingLowLimit && + invMassCompeting < fInvMassCompetingUpLimit) { return false; } } @@ -539,10 +544,10 @@ void FemtoUniverseCascadeSelection::fillCascadeQA(Col const& col, Casc const& ca const float dcav0topv = cascade.dcav0topv(col.posX(), col.posY(), col.posZ()); const float invMassLambda = cascade.mLambda(); - const float invMassXi = cascade.mXi(); + const float invMass = isCascOmega ? cascade.mOmega() : cascade.mXi(); mHistogramRegistry->fill(HIST("CascadeQA/hInvMassV0Cut"), invMassLambda); - mHistogramRegistry->fill(HIST("CascadeQA/hInvMassCascadeCut"), invMassXi); + mHistogramRegistry->fill(HIST("CascadeQA/hInvMassCascadeCut"), invMass); mHistogramRegistry->fill(HIST("CascadeQA/hCascadePt"), cascade.pt()); mHistogramRegistry->fill(HIST("CascadeQA/hCascadeEta"), cascade.eta()); mHistogramRegistry->fill(HIST("CascadeQA/hCascadePhi"), cascade.phi()); diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h index 568bec5e8c7..957fe316eb7 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h @@ -65,6 +65,36 @@ class FemtoUniverseMath return 0.5 * trackRelK.P(); } + /// \tparam T type of tracks + /// \param part1 Particle 1 + /// \param mass1 Mass of particle 1 + /// \param part2 Particle 2 + /// \param mass2 Mass of particle 2 + template + static float getthetastar(const T& part1, const float mass1, const T& part2, const float mass2) + { + const ROOT::Math::PtEtaPhiMVector vecpart1(part1.pt(), part1.eta(), part1.phi(), mass1); + const ROOT::Math::PtEtaPhiMVector vecpart2(part2.pt(), part2.eta(), part2.phi(), mass2); + const ROOT::Math::PtEtaPhiMVector trackSum = vecpart1 + vecpart2; + + const float beta = trackSum.Beta(); + const float betax = beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta()); + const float betay = beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta()); + const float betaz = beta * std::cos(trackSum.Theta()); + + ROOT::Math::PxPyPzMVector PartOneCMS(vecpart1); + ROOT::Math::PxPyPzMVector PartTwoCMS(vecpart2); + + const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz); + PartOneCMS = boostPRF(PartOneCMS); + PartTwoCMS = boostPRF(PartTwoCMS); + + const ROOT::Math::PtEtaPhiMVector PartOneCMSGeo(PartOneCMS); + const ROOT::Math::PtEtaPhiMVector PartTwoCMSGeo(PartTwoCMS); + + return (PartOneCMSGeo.Theta() - PartTwoCMSGeo.Theta()); + } + /// Compute the qij of a pair of particles /// \tparam T type of tracks /// \param vecparti Particle i PxPyPzMVector diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h index a99d569fd65..29b8368f392 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h @@ -100,6 +100,20 @@ class FemtoUniversePairCleaner return false; } return part1.globalIndex() != part2.globalIndex(); + } else if constexpr (mPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && mPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// Track-Cascade combination part1 is hadron and part2 is cascade + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade) { + LOG(fatal) << "FemtoUniversePairCleaner: passed arguments don't agree with FemtoUniversePairCleaner instantiation! Please provide first argument kTrack candidate and second argument kCascade candidate."; + return false; + } + // Getting cascade children for part2 + const auto& posChild = particles.iteratorAt(part2.index() - 3); + const auto& negChild = particles.iteratorAt(part2.index() - 2); + const auto& bachelor = particles.iteratorAt(part2.index() - 1); + if (part1.globalIndex() == posChild.globalIndex() || part1.globalIndex() == negChild.globalIndex() || part1.globalIndex() == bachelor.globalIndex()) { + return false; + } + return part1.globalIndex() != part2.globalIndex(); } else if constexpr (mPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && mPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kD0) { /// Track-D0 combination part1 is hadron and part2 is D0 if (part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kD0) { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h index 1be3d76085e..771b1aed1ab 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h @@ -195,7 +195,7 @@ class PairSHCentMultKt multbinval = 1; } else if (absmultval < CentMultBins[3]) { multbinval = 2; - } else if (ktval < CentMultBins[4]) { + } else if (absmultval < CentMultBins[4]) { multbinval = 3; } else { return; @@ -374,13 +374,13 @@ class PairSHCentMultKt } private: - std::array, 15>, 10>, 10> + std::array, 10>, 4>, 4> fnumsreal{}; - std::array, 15>, 10>, 10> + std::array, 10>, 4>, 4> fnumsimag{}; - std::array, 15>, 10>, 10> + std::array, 10>, 4>, 4> fdensreal{}; - std::array, 15>, 10>, 10> + std::array, 10>, 4>, 4> fdensimag{}; TH1D* fbinctn[10][10]; @@ -389,13 +389,13 @@ class PairSHCentMultKt static constexpr int fMaxL = 2; static constexpr int fMaxJM = (fMaxL + 1) * (fMaxL + 1); - std::array, 10>, 10> + std::array, 4>, 4> fcovmnum{}; ///< Covariance matrix for the numerator - std::array, 10>, 10> + std::array, 4>, 4> fcovmden{}; ///< Covariance matrix for the numerator - std::array, 10>, 10> fcovnum{}; - std::array, 10>, 10> fcovden{}; + std::array, 4>, 4> fcovnum{}; + std::array, 4>, 4> fcovden{}; protected: HistogramRegistry* PairSHCentMultKtRegistry = nullptr; diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h index 01b82ae3b3b..6b52d810d43 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h @@ -105,57 +105,57 @@ class PairWithCentMultKt void fill(t1 kstar_value, t1 cent_mult_value, t1 kt_value) { - if (cent_mult_value > CentMultBins[CentMultBins.size() - 1] || cent_mult_value < CentMultBins[0]) { + if (cent_mult_value >= CentMultBins[CentMultBins.size() - 1] || cent_mult_value < CentMultBins[0]) { PairWithCentMultKtRegistry->fill(HIST("Beyond_Max"), kstar_value); - } else if (cent_mult_value <= CentMultBins[1]) { + } else if (cent_mult_value < CentMultBins[1]) { PairWithCentMultKtRegistry->fill(HIST("mult_0_1/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_0_1/"); fill_kT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[2]) { + } else if (cent_mult_value < CentMultBins[2]) { PairWithCentMultKtRegistry->fill(HIST("mult_1_2/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_1_2/"); fill_kT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[3]) { + } else if (cent_mult_value < CentMultBins[3]) { PairWithCentMultKtRegistry->fill(HIST("mult_2_3/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_2_3/"); fill_kT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[4]) { + } else if (cent_mult_value < CentMultBins[4]) { PairWithCentMultKtRegistry->fill(HIST("mult_3_4/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_3_4/"); fill_kT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[5]) { + } else if (cent_mult_value < CentMultBins[5]) { PairWithCentMultKtRegistry->fill(HIST("mult_4_5/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_4_5/"); fill_kT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[6]) { + } else if (cent_mult_value < CentMultBins[6]) { PairWithCentMultKtRegistry->fill(HIST("mult_5_6/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_5_6/"); fill_kT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[7]) { + } else if (cent_mult_value < CentMultBins[7]) { PairWithCentMultKtRegistry->fill(HIST("mult_6_7/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_6_7/"); fill_kT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[8]) { + } else if (cent_mult_value < CentMultBins[8]) { PairWithCentMultKtRegistry->fill(HIST("mult_7_8/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_7_8/"); fill_kT(kstar_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[9]) { + } else if (cent_mult_value < CentMultBins[9]) { PairWithCentMultKtRegistry->fill(HIST("mult_8_9/kstar"), kstar_value); if (UseKt) { auto histMultFolder = HIST("mult_8_9/"); @@ -173,23 +173,23 @@ class PairWithCentMultKt template void fill_kT(t1 kstar_value, t1 kt_value, t2 folder) { - if (kt_value <= KtBins[1]) { + if (kt_value < KtBins[1]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_0_1"), kstar_value); - } else if (kt_value <= KtBins[2]) { + } else if (kt_value < KtBins[2]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_1_2"), kstar_value); - } else if (kt_value <= KtBins[3]) { + } else if (kt_value < KtBins[3]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_2_3"), kstar_value); - } else if (kt_value <= KtBins[4]) { + } else if (kt_value < KtBins[4]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_3_4"), kstar_value); - } else if (kt_value <= KtBins[5]) { + } else if (kt_value < KtBins[5]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_4_5"), kstar_value); - } else if (kt_value <= KtBins[6]) { + } else if (kt_value < KtBins[6]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_5_6"), kstar_value); - } else if (kt_value <= KtBins[7]) { + } else if (kt_value < KtBins[7]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_6_7"), kstar_value); - } else if (kt_value <= KtBins[8]) { + } else if (kt_value < KtBins[8]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_7_8"), kstar_value); - } else if (kt_value <= KtBins[9]) { + } else if (kt_value < KtBins[9]) { PairWithCentMultKtRegistry->fill(folder + HIST("kstar_kt_8_9"), kstar_value); } } @@ -204,57 +204,57 @@ class PairWithCentMultKt void fill_3D(t1 qout_value, t1 qside_value, t1 qlong_value, t1 cent_mult_value, t1 kt_value) { - if (cent_mult_value > CentMultBins[CentMultBins.size() - 1] || cent_mult_value < CentMultBins[0]) { + if (cent_mult_value >= CentMultBins[CentMultBins.size() - 1] || cent_mult_value < CentMultBins[0]) { PairWithCentMultKtRegistry->fill(HIST("Beyond_Max_3D"), qout_value, qside_value, qlong_value); - } else if (cent_mult_value <= CentMultBins[1]) { + } else if (cent_mult_value < CentMultBins[1]) { PairWithCentMultKtRegistry->fill(HIST("mult_0_1/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_0_1/"); fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[2]) { + } else if (cent_mult_value < CentMultBins[2]) { // PairWithCentMultKtRegistry->fill(HIST("mult_1_2/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_1_2/"); fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[3]) { + } else if (cent_mult_value < CentMultBins[3]) { // PairWithCentMultKtRegistry->fill(HIST("mult_2_3/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_2_3/"); fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[4]) { + } else if (cent_mult_value < CentMultBins[4]) { // PairWithCentMultKtRegistry->fill(HIST("mult_3_4/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_3_4/"); fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[5]) { + } else if (cent_mult_value < CentMultBins[5]) { // PairWithCentMultKtRegistry->fill(HIST("mult_4_5/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_4_5/"); fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[6]) { + } else if (cent_mult_value < CentMultBins[6]) { // PairWithCentMultKtRegistry->fill(HIST("mult_5_6/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_5_6/"); fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[7]) { + } else if (cent_mult_value < CentMultBins[7]) { // PairWithCentMultKtRegistry->fill(HIST("mult_6_7/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_6_7/"); fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[8]) { + } else if (cent_mult_value < CentMultBins[8]) { // PairWithCentMultKtRegistry->fill(HIST("mult_7_8/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_7_8/"); fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); } - } else if (cent_mult_value <= CentMultBins[9]) { + } else if (cent_mult_value < CentMultBins[9]) { // PairWithCentMultKtRegistry->fill(HIST("mult_8_9/q3D"), qout_value, qside_value, qlong_value); if (Use3D) { auto histMultFolder = HIST("mult_8_9/"); @@ -273,11 +273,11 @@ class PairWithCentMultKt template void fill_kT_3d(t1 qout_value, t1 qside_value, t1 qlong_value, t1 kt_value, t2 folder) { - if (kt_value <= KtBins[1]) { + if (kt_value < KtBins[1]) { PairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_0_1"), qout_value, qside_value, qlong_value); - } else if (kt_value <= KtBins[2]) { + } else if (kt_value < KtBins[2]) { PairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_1_2"), qout_value, qside_value, qlong_value); - } else if (kt_value <= KtBins[3]) { + } else if (kt_value < KtBins[3]) { PairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_2_3"), qout_value, qside_value, qlong_value); } } diff --git a/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h b/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h index 0d7871008f1..7f43c675053 100644 --- a/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h +++ b/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h @@ -31,6 +31,8 @@ DECLARE_SOA_COLUMN(MultV0M, multV0M, float); //! V0M multiplicity DECLARE_SOA_COLUMN(MultNtr, multNtr, int); //! multiplicity of charged tracks as defined in the producer DECLARE_SOA_COLUMN(Sphericity, sphericity, float); //! Sphericity of the event DECLARE_SOA_COLUMN(MagField, magField, float); //! Magnetic field of the event +DECLARE_SOA_COLUMN(IRrate, irrate, float); //! Interaction rate +DECLARE_SOA_COLUMN(Occupancy, occupancy, int); //! TPC occupancy } // namespace femtouniversecollision @@ -43,6 +45,11 @@ DECLARE_SOA_TABLE(FDCollisions, "AOD", "FDCOLLISION", femtouniversecollision::MagField); using FDCollision = FDCollisions::iterator; +DECLARE_SOA_TABLE(FDExtCollisions, "AOD", "FDEXTCOLLISION", + femtouniversecollision::IRrate, + femtouniversecollision::Occupancy); +using FDExtCollision = FDExtCollisions::iterator; + /// FemtoUniverseTrack namespace femtouniverseparticle { @@ -126,6 +133,24 @@ DECLARE_SOA_COLUMN(DecayVtxZ, decayVtxZ, float); //! Z position of the decay DECLARE_SOA_COLUMN(MKaon, mKaon, float); //! The invariant mass of V0 candidate, assuming kaon } // namespace femtouniverseparticle + +/// FemtoUniverseCascadeTrack +namespace femtouniversecascparticle +{ + +DECLARE_SOA_COLUMN(DcaV0daughters, dcaV0daughters, float); //! DCA between V0 daughters +DECLARE_SOA_COLUMN(Cpav0, cpav0, float); //! V0 cos of pointing angle +DECLARE_SOA_COLUMN(V0radius, v0radius, float); //! V0 transverse radius +DECLARE_SOA_COLUMN(CpaCasc, cpaCasc, float); //! cascade cosinus of pointing angle +DECLARE_SOA_COLUMN(Dcacascdaughters, dcacascdaughters, float); //! DCA between cascade daughters +DECLARE_SOA_COLUMN(Cascradius, cascradius, float); //! cascade transverse radius +DECLARE_SOA_COLUMN(Dcapostopv, dcapostopv, float); //! DCA of positive daughter to PV +DECLARE_SOA_COLUMN(Dcanegtopv, dcanegtopv, float); //! DCA of negative daughter to PV +DECLARE_SOA_COLUMN(Dcabachtopv, dcabachtopv, float); //! DCA of bachelor track to PV +DECLARE_SOA_COLUMN(Dcav0topv, dcav0topv, float); //! DCA of V0 to PV + +} // namespace femtouniversecascparticle + DECLARE_SOA_TABLE(FDParticles, "AOD", "FDPARTICLE", o2::soa::Index<>, femtouniverseparticle::FDCollisionId, @@ -187,6 +212,36 @@ DECLARE_SOA_TABLE(FDExtParticles, "AOD", "FDEXTPARTICLE", pidtof_tiny::TOFNSigmaDe); using FDFullParticle = FDExtParticles::iterator; +DECLARE_SOA_TABLE(FDCascParticles, "AOD", "FDCASCPARTICLE", + o2::soa::Index<>, + femtouniverseparticle::FDCollisionId, + femtouniverseparticle::Pt, + femtouniverseparticle::Eta, + femtouniverseparticle::Phi, + femtouniverseparticle::PartType, + femtouniverseparticle::Cut, + femtouniverseparticle::PIDCut, + femtouniverseparticle::TempFitVar, + femtouniverseparticle::ChildrenIds, + femtouniverseparticle::MLambda, + femtouniverseparticle::MAntiLambda, + femtouniverseparticle::Theta, + femtouniverseparticle::Px, + femtouniverseparticle::Py, + femtouniverseparticle::Pz, + femtouniverseparticle::P, + femtouniversecascparticle::DcaV0daughters, + femtouniversecascparticle::Cpav0, + femtouniversecascparticle::V0radius, + femtouniversecascparticle::CpaCasc, + femtouniversecascparticle::Dcacascdaughters, + femtouniversecascparticle::Cascradius, + femtouniversecascparticle::Dcapostopv, + femtouniversecascparticle::Dcanegtopv, + femtouniversecascparticle::Dcabachtopv, + femtouniversecascparticle::Dcav0topv); +using FDCascParticle = FDCascParticles::iterator; + /// FemtoUniverseTrackMC namespace femtouniverseMCparticle { @@ -253,8 +308,8 @@ namespace hash { DECLARE_SOA_COLUMN(Bin, bin, int); //! Hash for the event mixing } // namespace hash -DECLARE_SOA_TABLE(Hashes, "AOD", "HASH", hash::Bin); -using Hash = Hashes::iterator; +DECLARE_SOA_TABLE(MixingHashes, "AOD", "HASH", hash::Bin); +using MixingHash = MixingHashes::iterator; } // namespace o2::aod diff --git a/PWGCF/FemtoUniverse/TableProducer/CMakeLists.txt b/PWGCF/FemtoUniverse/TableProducer/CMakeLists.txt index ecbb6e46873..b82a2e6d6f1 100644 --- a/PWGCF/FemtoUniverse/TableProducer/CMakeLists.txt +++ b/PWGCF/FemtoUniverse/TableProducer/CMakeLists.txt @@ -11,7 +11,7 @@ o2physics_add_dpl_workflow(femtouniverse-producer SOURCES femtoUniverseProducerTask.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(femtouniverse-mctruth-producer diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 99f3110af8e..9aa30f2939f 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -14,11 +14,18 @@ /// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch /// \author Malgorzata Janik, WUT Warsaw, majanik@cern.ch - -#include // FIXME +/// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@cern.ch #include +#include +#include +#include +#include + +#include "CommonConstants/PhysicsConstants.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/trackUtilities.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" @@ -52,6 +59,7 @@ using namespace o2; using namespace o2::analysis::femtoUniverse; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants::physics; namespace o2::aod { @@ -97,11 +105,13 @@ int getRowDaughters(int daughID, T const& vecID) struct femtoUniverseProducerTask { Produces outputCollision; + Produces outputCollExtra; Produces outputParts; Produces outputPartsMC; Produces outputDebugParts; Produces outputPartsMCLabels; Produces outputDebugPartsMC; + Produces outputCascParts; Configurable ConfIsDebug{"ConfIsDebug", true, "Enable Debug tables"}; // Choose if filtering or skimming version is run @@ -113,6 +123,7 @@ struct femtoUniverseProducerTask { Configurable ConfIsForceGRP{"ConfIsForceGRP", false, "Set true if the magnetic field configuration is not available in the usual CCDB directory (e.g. for Run 2 converted data or unanchorad Monte Carlo)"}; Configurable ConfDoSpher{"ConfDoSpher", false, "Calculate sphericity. If false sphericity will take value of 2."}; + Configurable ConfFillCollExt{"ConfFillCollExt", false, "Option to fill collision extended table"}; /// Event cuts FemtoUniverseCollisionSelection colCuts; @@ -123,7 +134,8 @@ struct femtoUniverseProducerTask { Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"}; Configurable ConfIsActivateV0{"ConfIsActivateV0", false, "Activate filling of V0 into femtouniverse tables"}; Configurable ConfActivateSecondaries{"ConfActivateSecondaries", false, "Fill secondary MC gen particles that were reconstructed"}; - Configurable ConfIsActivateCascade{"ConfIsActivateCascade", true, "Activate filling of Cascade into femtouniverse tables"}; + Configurable ConfIsActivateCascade{"ConfIsActivateCascade", false, "Activate filling of Cascade into femtouniverse tables"}; + Configurable ConfIsSelectCascOmega{"ConfIsSelectCascOmega", false, "Select Omegas for cascade analysis"}; Configurable ConfIsActivatePhi{"ConfIsActivatePhi", false, "Activate filling of Phi into femtouniverse tables"}; Configurable ConfMCTruthAnalysisWithPID{"ConfMCTruthAnalysisWithPID", true, "1: take only particles with specified PDG, 0: all particles (for MC Truth)"}; Configurable> ConfMCTruthPDGCodes{"ConfMCTruthPDGCodes", std::vector{211, -211, 2212, -2212, 333}, "PDG of particles to be stored"}; @@ -172,6 +184,7 @@ struct femtoUniverseProducerTask { // V0 FemtoUniverseV0Selection v0Cuts; struct : o2::framework::ConfigurableGroup { + Configurable ConfIsFillV0s{"ConfIsFillV0s", false, "Choice to fill V0s"}; Configurable> ConfV0Sign{FemtoUniverseV0Selection::getSelectionName(femtoUniverseV0Selection::kV0Sign, "ConfV0"), std::vector{-1, 1}, FemtoUniverseV0Selection::getSelectionHelper(femtoUniverseV0Selection::kV0Sign, "V0 selection: ")}; Configurable> ConfV0PtMin{FemtoUniverseV0Selection::getSelectionName(femtoUniverseV0Selection::kV0pTMin, "ConfV0"), std::vector{0.3f, 0.4f, 0.5f}, FemtoUniverseV0Selection::getSelectionHelper(femtoUniverseV0Selection::kV0pTMin, "V0 selection: ")}; Configurable> ConfV0PtMax{FemtoUniverseV0Selection::getSelectionName(femtoUniverseV0Selection::kV0pTMax, "ConfV0"), std::vector{3.3f, 3.4f, 3.5f}, FemtoUniverseV0Selection::getSelectionHelper(femtoUniverseV0Selection::kV0pTMax, "V0 selection: ")}; @@ -220,6 +233,7 @@ struct femtoUniverseProducerTask { // CASCADE FemtoUniverseCascadeSelection cascadeCuts; struct : o2::framework::ConfigurableGroup { + Configurable ConfIsFillCascades{"ConfIsFillCascades", false, "Choice to fill cascades"}; Configurable> ConfCascSign{FemtoUniverseCascadeSelection::getSelectionName(femtoUniverseCascadeSelection::kCascadeSign, "ConfCasc"), std::vector{-1, 1}, FemtoUniverseCascadeSelection::getSelectionHelper(femtoUniverseCascadeSelection::kCascadeSign, "Cascade selection: ")}; Configurable> ConfCascPtMin{FemtoUniverseCascadeSelection::getSelectionName(femtoUniverseCascadeSelection::kCascadepTMin, "ConfCasc"), std::vector{0.3f, 0.4f, 0.5f}, FemtoUniverseCascadeSelection::getSelectionHelper(femtoUniverseCascadeSelection::kCascadepTMin, "Cascade selection: ")}; Configurable> ConfCascPtMax{FemtoUniverseCascadeSelection::getSelectionName(femtoUniverseCascadeSelection::kCascadepTMax, "ConfCasc"), std::vector{3.3f, 3.4f, 3.5f}, FemtoUniverseCascadeSelection::getSelectionHelper(femtoUniverseCascadeSelection::kCascadepTMax, "Cascade selection: ")}; @@ -247,14 +261,14 @@ struct femtoUniverseProducerTask { Configurable> ConfCascChildTPCnClsMin{"ConfCascChildTPCnClsMin", std::vector{80.f, 70.f, 60.f}, "Cascade Child sel: Min. nCls TPC"}; // Configurable> ConfCascChildDCAMin{"ConfCascChildDCAMin", std::vector{0.05f, 0.06f}, "Cascade Child sel: Max. DCA Daugh to PV (cm)"}; Configurable> ConfCascChildPIDnSigmaMax{"ConfCascChildPIDnSigmaMax", std::vector{3.f, 4.f}, "Cascade Child sel: Max. PID nSigma TPC"}; - Configurable> ConfCascChildPIDspecies{"ConfCascChildPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Proton}, "V0 Child sel: Particles species for PID"}; + Configurable> ConfCascChildPIDspecies{"ConfCascChildPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Proton}, "Cascade Child sel: particle species for PID"}; - Configurable ConfCascInvMassLowLimit{"ConfCascInvMassLowLimit", 1.25, "Lower limit of the V0 invariant mass"}; - Configurable ConfCascInvMassUpLimit{"ConfCascInvMassUpLimit", 1.40, "Upper limit of the V0 invariant mass"}; + Configurable ConfCascInvMassLowLimit{"ConfCascInvMassLowLimit", 1.25, "Lower limit of the cascade invariant mass"}; + Configurable ConfCascInvMassUpLimit{"ConfCascInvMassUpLimit", 1.40, "Upper limit of the cascade invariant mass"}; - Configurable ConfCascRejectOmegas{"ConfCascRejectOmegas", false, "Switch on to reject Omegas (for Xi) or Xis (for Omega)"}; - Configurable ConfCascInvOmegaMassLowLimit{"ConfCascInvOmegaMassLowLimit", 1.66, "Lower limit of the cascade invariant mass for Omega rejection"}; - Configurable ConfCascInvOmegaMassUpLimit{"ConfCascInvOmegaMassUpLimit", 1.68, "Upper limit of the cascade invariant mass for Omega rejection"}; + Configurable ConfCascRejectCompetingMass{"ConfCascRejectCompetingMass", false, "Switch on to reject Omegas (for Xi) or Xis (for Omegas)"}; + Configurable ConfCascInvCompetingMassLowLimit{"ConfCascInvCompetingMassLowLimit", 1.66, "Lower limit of the cascade invariant mass for competing mass rejection"}; + Configurable ConfCascInvCompetingMassUpLimit{"ConfCascInvCompetingMassUpLimit", 1.68, "Upper limit of the cascade invariant mass for competing mass rejection"}; } ConfCascadeSelection; // PHI @@ -287,25 +301,25 @@ struct femtoUniverseProducerTask { { if (mom < 0.3) { // 0.0-0.3 - if (TMath::Abs(nsigmaTPCK) < 3.0) { + if (std::abs(nsigmaTPCK) < 3.0) { return true; } else { return false; } } else if (mom < 0.45) { // 0.30 - 0.45 - if (TMath::Abs(nsigmaTPCK) < 2.0) { + if (std::abs(nsigmaTPCK) < 2.0) { return true; } else { return false; } } else if (mom < 0.55) { // 0.45-0.55 - if (TMath::Abs(nsigmaTPCK) < 1.0) { + if (std::abs(nsigmaTPCK) < 1.0) { return true; } else { return false; } } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((TMath::Abs(nsigmaTOFK) < 3.0) && (TMath::Abs(nsigmaTPCK) < 3.0)) { + if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) { { return true; } @@ -313,7 +327,7 @@ struct femtoUniverseProducerTask { return false; } } else if (mom > 1.5) { // 1.5 - - if ((TMath::Abs(nsigmaTOFK) < 2.0) && (TMath::Abs(nsigmaTPCK) < 3.0)) { + if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) { return true; } else { return false; @@ -327,31 +341,31 @@ struct femtoUniverseProducerTask { { if (mom < 0.3) { // 0.0-0.3 - if (TMath::Abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value) { + if (std::abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value) { return true; } else { return false; } } else if (mom < 0.45) { // 0.30 - 0.45 - if (TMath::Abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value) { + if (std::abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value) { return true; } else { return false; } } else if (mom < 0.55) { // 0.45-0.55 - if (TMath::Abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value) { + if (std::abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value) { return true; } else { return false; } } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((TMath::Abs(nsigmaTOFK) < 3.0) && (TMath::Abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value)) { + if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value)) { return true; } else { return false; } } else if (mom > 1.5) { // 1.5 - - if ((TMath::Abs(nsigmaTOFK) < 2.0) && (TMath::Abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value)) { + if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value)) { return true; } else { return false; @@ -364,25 +378,25 @@ struct femtoUniverseProducerTask { bool IsKaonNSigmaTOFLoose(float mom, float nsigmaTPCK, float nsigmaTOFK) { if (mom < 0.3) { // 0.0-0.3 - if (TMath::Abs(nsigmaTPCK) < 3.0) { + if (std::abs(nsigmaTPCK) < 3.0) { return true; } else { return false; } } else if (mom < 0.45) { // 0.30 - 0.45 - if (TMath::Abs(nsigmaTPCK) < 2.0) { + if (std::abs(nsigmaTPCK) < 2.0) { return true; } else { return false; } } else if (mom < 0.55) { // 0.45-0.55 - if (TMath::Abs(nsigmaTPCK) < 1.0) { + if (std::abs(nsigmaTPCK) < 1.0) { return true; } else { return false; } } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((TMath::Abs(nsigmaTOFK) < ConfPhiSelection.ConfLooseTOFNSigmaValue.value) && (TMath::Abs(nsigmaTPCK) < 3.0)) { + if ((std::abs(nsigmaTOFK) < ConfPhiSelection.ConfLooseTOFNSigmaValue.value) && (std::abs(nsigmaTPCK) < 3.0)) { { return true; } @@ -390,7 +404,7 @@ struct femtoUniverseProducerTask { return false; } } else if (mom > 1.5) { // 1.5 - - if ((TMath::Abs(nsigmaTOFK) < ConfPhiSelection.ConfLooseTOFNSigmaValue.value) && (TMath::Abs(nsigmaTPCK) < 3.0)) { + if ((std::abs(nsigmaTOFK) < ConfPhiSelection.ConfLooseTOFNSigmaValue.value) && (std::abs(nsigmaTPCK) < 3.0)) { return true; } else { return false; @@ -403,16 +417,16 @@ struct femtoUniverseProducerTask { bool IsKaonRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi) { if (mom < 0.5) { - if (TMath::Abs(nsigmaTPCPi) < ConfPhiSelection.ConfNsigmaRejectPion.value) { + if (std::abs(nsigmaTPCPi) < ConfPhiSelection.ConfNsigmaRejectPion.value) { return true; - } else if (TMath::Abs(nsigmaTPCPr) < ConfPhiSelection.ConfNsigmaRejectProton.value) { + } else if (std::abs(nsigmaTPCPr) < ConfPhiSelection.ConfNsigmaRejectProton.value) { return true; } } if (mom > 0.5) { - if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPhiSelection.ConfNsigmaRejectPion.value) { + if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPhiSelection.ConfNsigmaRejectPion.value) { return true; - } else if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPhiSelection.ConfNsigmaRejectProton.value) { + } else if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPhiSelection.ConfNsigmaRejectProton.value) { return true; } else { return false; @@ -432,16 +446,17 @@ struct femtoUniverseProducerTask { HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::QAObject}; HistogramRegistry cascadeQaRegistry{"CascadeQAHistos", {}, OutputObjHandlingPolicy::QAObject}; - int mRunNumber; + int mRunNumber = 0; float mMagField; Service ccdb; /// Accessing the CCDB + ctpRateFetcher mRateFetcher; // inspired by zdcSP.cxx in PWGLF void init(InitContext&) { - if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackCentRun2Data || doprocessTrackCentRun3Data || doprocessTrackV0CentRun3) == false && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMC || doprocessFullMCCent) == false) { + if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackCentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data) == false && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMC || doprocessFullMCCent) == false) { LOGF(fatal, "Neither processFullData nor processFullMC enabled. Please choose one."); } - if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackCentRun2Data || doprocessTrackCentRun3Data || doprocessTrackV0CentRun3) == true && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMC || doprocessFullMCCent) == true) { + if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackCentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data) == true && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMC || doprocessFullMCCent) == true) { LOGF(fatal, "Cannot enable process Data and process MC at the same time. " "Please choose one."); @@ -555,15 +570,15 @@ struct femtoUniverseProducerTask { // TODO cascadeCuts.setChildPIDSpecies(femtoUniverseCascadeSelection::kPosTrack, ConfV0Selection.ConfChildPIDspecies); cascadeCuts.setChildPIDSpecies(femtoUniverseCascadeSelection::kNegTrack, ConfV0Selection.ConfChildPIDspecies); - cascadeCuts.setChildPIDSpecies(femtoUniverseCascadeSelection::kBachTrack, ConfV0Selection.ConfChildPIDspecies); + cascadeCuts.setChildPIDSpecies(femtoUniverseCascadeSelection::kBachTrack, ConfCascadeSelection.ConfCascChildPIDspecies); // check if works correctly for bachelor track - cascadeCuts.init(&cascadeQaRegistry); + cascadeCuts.init(&cascadeQaRegistry, ConfIsSelectCascOmega); // invmass cuts cascadeCuts.setInvMassLimits(ConfCascadeSelection.ConfCascInvMassLowLimit, ConfCascadeSelection.ConfCascInvMassUpLimit); - if (ConfCascadeSelection.ConfCascRejectOmegas) { - cascadeCuts.setOmegaInvMassLimits(ConfCascadeSelection.ConfCascInvOmegaMassLowLimit, ConfCascadeSelection.ConfCascInvOmegaMassUpLimit); + if (ConfCascadeSelection.ConfCascRejectCompetingMass) { + cascadeCuts.setCompetingInvMassLimits(ConfCascadeSelection.ConfCascInvCompetingMassLowLimit, ConfCascadeSelection.ConfCascInvCompetingMassUpLimit); } } @@ -671,7 +686,7 @@ struct femtoUniverseProducerTask { int particleOrigin = 99; auto motherparticlesMC = particleMC.template mothers_as(); - if (abs(pdgCode) == abs(ConfPDGCodePartOne.value) || abs(pdgCode) == abs(ConfPDGCodePartTwo.value)) { + if (std::abs(pdgCode) == std::abs(ConfPDGCodePartOne.value) || std::abs(pdgCode) == std::abs(ConfPDGCodePartTwo.value)) { if (particleMC.isPhysicalPrimary()) { particleOrigin = aod::femtouniverseMCparticle::ParticleOriginMCTruth::kPrimary; } else if (!motherparticlesMC.empty()) { @@ -706,10 +721,10 @@ struct femtoUniverseProducerTask { auto motherskaon1MC = kaon1MC.template mothers_as(); auto motherskaon2MC = kaon2MC.template mothers_as(); - if (abs(pdgCode1) == abs(321) || abs(pdgCode2) == abs(-321)) { + if (std::abs(pdgCode1) == std::abs(321) || std::abs(pdgCode2) == std::abs(-321)) { if ((kaon1MC.isPhysicalPrimary() && kaon2MC.isPhysicalPrimary()) && (!motherskaon1MC.empty() && !motherskaon2MC.empty())) { - for (auto& particleMotherOfNeg : motherskaon1MC) { - for (auto& particleMotherOfPos : motherskaon2MC) { + for (const auto& particleMotherOfNeg : motherskaon1MC) { + for (const auto& particleMotherOfPos : motherskaon2MC) { if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == 333) { phiOrigin = aod::femtouniverseMCparticle::ParticleOriginMCTruth::kPrimary; } else { @@ -727,8 +742,8 @@ struct femtoUniverseProducerTask { TLorentzVector part1Vec; TLorentzVector part2Vec; - float mMassOne = TDatabasePDG::Instance()->GetParticle(321)->Mass(); // FIXME: Get from the PDG service of the common header - float mMassTwo = TDatabasePDG::Instance()->GetParticle(-321)->Mass(); // FIXME: Get from the PDG service of the common header + const auto mMassOne = o2::constants::physics::MassKPlus; // FIXME: Get from the PDG service of the common header + const auto mMassTwo = o2::constants::physics::MassKMinus; // FIXME: Get from the PDG service of the common header part1Vec.SetPtEtaPhiM(kaon1MC.pt(), kaon1MC.eta(), kaon1MC.phi(), mMassOne); part2Vec.SetPtEtaPhiM(kaon2MC.pt(), kaon2MC.eta(), kaon2MC.phi(), mMassTwo); @@ -748,10 +763,10 @@ struct femtoUniverseProducerTask { } template - void fillCollisions(CollisionType const& col, TrackType const& tracks) + bool fillCollisions(CollisionType const& col, TrackType const& tracks) { const auto vtxZ = col.posZ(); - int mult = 0; + float mult = 0; int multNtr = 0; if (ConfIsRun3) { mult = col.multFV0M(); @@ -771,31 +786,32 @@ struct femtoUniverseProducerTask { // in case of trigger run - store such collisions but don't store any // particle candidates for such collisions if (!colCuts.isSelected(col)) { - return; - } - - if (!ConfIsUsePileUp) { - if (ConfDoSpher) { - outputCollision(vtxZ, mult, multNtr, colCuts.computeSphericity(col, tracks), mMagField); - } else { - outputCollision(vtxZ, mult, multNtr, 2, mMagField); - } + return false; } else { - if (ConfDoSpher && (!ConfEvNoSameBunchPileup || col.selection_bit(aod::evsel::kNoSameBunchPileup)) && (!ConfEvIsGoodZvtxFT0vsPV || col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && (!ConfEvIsVertexITSTPC || col.selection_bit(aod::evsel::kIsVertexITSTPC))) { - outputCollision(vtxZ, mult, multNtr, colCuts.computeSphericity(col, tracks), mMagField); + if (!ConfIsUsePileUp) { + if (ConfDoSpher) { + outputCollision(vtxZ, mult, multNtr, colCuts.computeSphericity(col, tracks), mMagField); + } else { + outputCollision(vtxZ, mult, multNtr, 2, mMagField); + } } else { - outputCollision(vtxZ, mult, multNtr, 2, mMagField); + if (ConfDoSpher && (!ConfEvNoSameBunchPileup || col.selection_bit(aod::evsel::kNoSameBunchPileup)) && (!ConfEvIsGoodZvtxFT0vsPV || col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && (!ConfEvIsVertexITSTPC || col.selection_bit(aod::evsel::kIsVertexITSTPC))) { + outputCollision(vtxZ, mult, multNtr, colCuts.computeSphericity(col, tracks), mMagField); + } else { + outputCollision(vtxZ, mult, multNtr, 2, mMagField); + } } + colCuts.fillQA(col); + return true; } - colCuts.fillQA(col); } template void fillMCTruthCollisions(CollisionType const& col, TrackType const& tracks) { - for (auto& c : col) { + for (const auto& c : col) { const auto vtxZ = c.posZ(); - int mult = 0; + float mult = 0; int multNtr = 0; if (std::abs(vtxZ) > ConfEvtZvtx) { @@ -810,16 +826,12 @@ struct femtoUniverseProducerTask { } } - template - void fillCollisionsCentRun2(CollisionType const& col, TrackType const& tracks) + template + bool fillCollisionsCentRun2(CollisionType const& col) { const auto vtxZ = col.posZ(); - int cent = 0; - int multNtr = 0; - if (!ConfIsRun3) { - cent = col.centRun2V0M(); - multNtr = col.multNTracksPV(); - } + const auto cent = col.centRun2V0M(); + const auto multNtr = col.multNTracksPV(); // check whether the basic event selection criteria are fulfilled // if the basic selection is NOT fulfilled: @@ -827,55 +839,51 @@ struct femtoUniverseProducerTask { // in case of trigger run - store such collisions but don't store any // particle candidates for such collisions if (!colCuts.isSelected(col)) { - return; - } - - // colCuts.fillQA(col); //for now, TODO: create a configurable so in the FemroUniverseCollisionSelection.h there is an option to plot QA just for the posZ - if (ConfDoSpher) { - outputCollision(vtxZ, cent, multNtr, colCuts.computeSphericity(col, tracks), mMagField); + return false; } else { outputCollision(vtxZ, cent, multNtr, 2, mMagField); + return true; } } - template - void fillCollisionsCentRun3(CollisionType const& col, TrackType const& tracks) + template + bool fillCollisionsCentRun3(CollisionType const& col) { const auto vtxZ = col.posZ(); - int cent = 0; - int multNtr = 0; - if (ConfIsRun3) { - multNtr = col.multNTracksPV(); - cent = col.centFT0C(); - } + const auto multNtr = col.multNTracksPV(); + const auto cent = col.centFT0C(); - int occupancy = col.trackOccupancyInTimeRange(); // check whether the basic event selection criteria are fulfilled // if the basic selection is NOT fulfilled: // in case of skimming run - don't store such collisions // in case of trigger run - store such collisions but don't store any // particle candidates for such collisions if (!colCuts.isSelectedRun3(col)) { - return; - } - - // colCuts.fillQA(col); //for now, TODO: create a configurable so in the FemroUniverseCollisionSelection.h there is an option to plot QA just for the posZ - if (occupancy > ConfTPCOccupancyMin && occupancy <= ConfTPCOccupancyMax) { - if (ConfDoSpher) { - outputCollision(vtxZ, cent, multNtr, colCuts.computeSphericity(col, tracks), mMagField); - } else { + return false; + } else { + if ((col.selection_bit(aod::evsel::kNoSameBunchPileup)) && (col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { outputCollision(vtxZ, cent, multNtr, 2, mMagField); + return true; + } else { + return false; } } } + template + void fillCollisionsCentRun3ColExtra(CollisionType const& col, double irrate) + { + const auto occupancy = col.trackOccupancyInTimeRange(); + outputCollExtra(irrate, occupancy); + } + template void fillTracks(TrackType const& tracks) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index - for (auto& track : tracks) { + for (const auto& track : tracks) { /// if the most open selection criteria are not fulfilled there is no /// point looking further at the track if (!trackCuts.isSelectedMinimal(track)) { @@ -894,13 +902,23 @@ struct femtoUniverseProducerTask { auto cutContainer = trackCuts.getCutContainer(track); // now the table is filled - outputParts(outputCollision.lastIndex(), track.pt(), track.eta(), - track.phi(), aod::femtouniverseparticle::ParticleType::kTrack, - cutContainer.at( - femtoUniverseTrackSelection::TrackContainerPosition::kCuts), - cutContainer.at( - femtoUniverseTrackSelection::TrackContainerPosition::kPID), - track.dcaXY(), childIDs, 0, 0); + if (!ConfIsActivateCascade) { + outputParts(outputCollision.lastIndex(), track.pt(), track.eta(), + track.phi(), aod::femtouniverseparticle::ParticleType::kTrack, + cutContainer.at( + femtoUniverseTrackSelection::TrackContainerPosition::kCuts), + cutContainer.at( + femtoUniverseTrackSelection::TrackContainerPosition::kPID), + track.dcaXY(), childIDs, 0, 0); + } else { + outputCascParts(outputCollision.lastIndex(), track.pt(), track.eta(), + track.phi(), aod::femtouniverseparticle::ParticleType::kTrack, + cutContainer.at( + femtoUniverseTrackSelection::TrackContainerPosition::kCuts), + cutContainer.at( + femtoUniverseTrackSelection::TrackContainerPosition::kPID), + track.dcaXY(), childIDs, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } tmpIDtrack.push_back(track.globalIndex()); if (ConfIsDebug) { fillDebugParticle(track); @@ -917,7 +935,7 @@ struct femtoUniverseProducerTask { { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index - for (auto& v0 : fullV0s) { + for (const auto& v0 : fullV0s) { auto postrack = v0.template posTrack_as(); auto negtrack = v0.template negTrack_as(); ///\tocheck funnily enough if we apply the filter the @@ -1027,18 +1045,28 @@ struct femtoUniverseProducerTask { childIDs[0] = rowInPrimaryTrackTablePos; // pos childIDs[1] = 0; // neg childIDs[2] = 0; // bachelor - outputParts(outputCollision.lastIndex(), - casc.positivept(), - casc.positiveeta(), - casc.positivephi(), - aod::femtouniverseparticle::ParticleType::kV0Child, - 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kPosCuts), - 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kPosPID), - 0., - childIDs, - 0, - 0); - const int rowOfPosTrack = outputParts.lastIndex(); + outputCascParts(outputCollision.lastIndex(), + casc.positivept(), + casc.positiveeta(), + casc.positivephi(), + aod::femtouniverseparticle::ParticleType::kV0Child, + 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kPosCuts), + 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kPosPID), + 0., + childIDs, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0); + const int rowOfPosTrack = outputCascParts.lastIndex(); // if constexpr (isMC) { // fillMCParticle(postrack, o2::aod::femtouniverseparticle::ParticleType::kV0Child); // } @@ -1048,18 +1076,28 @@ struct femtoUniverseProducerTask { childIDs[0] = 0; // pos childIDs[1] = rowInPrimaryTrackTableNeg; // neg childIDs[2] = 0; // bachelor - outputParts(outputCollision.lastIndex(), - casc.negativept(), - casc.negativeeta(), - casc.negativephi(), - aod::femtouniverseparticle::ParticleType::kV0Child, - 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kNegCuts), - 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kNegPID), - 0., - childIDs, - 0, - 0); - const int rowOfNegTrack = outputParts.lastIndex(); + outputCascParts(outputCollision.lastIndex(), + casc.negativept(), + casc.negativeeta(), + casc.negativephi(), + aod::femtouniverseparticle::ParticleType::kV0Child, + 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kNegCuts), + 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kNegPID), + 0., + childIDs, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0); + const int rowOfNegTrack = outputCascParts.lastIndex(); // if constexpr (isMC) { // fillMCParticle(negtrack, o2::aod::femtouniverseparticle::ParticleType::kV0Child); // } @@ -1070,31 +1108,51 @@ struct femtoUniverseProducerTask { childIDs[0] = 0; // pos childIDs[1] = 0; // neg childIDs[2] = rowInPrimaryTrackTableBach; // bachelor - outputParts(outputCollision.lastIndex(), - casc.bachelorpt(), - casc.bacheloreta(), - casc.bachelorphi(), - aod::femtouniverseparticle::ParticleType::kCascadeBachelor, - 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kNegCuts), - 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kNegPID), - 0., - childIDs, - 0, - 0); - const int rowOfBachTrack = outputParts.lastIndex(); + outputCascParts(outputCollision.lastIndex(), + casc.bachelorpt(), + casc.bacheloreta(), + casc.bachelorphi(), + aod::femtouniverseparticle::ParticleType::kCascadeBachelor, + 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kNegCuts), + 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kNegPID), + 0., + childIDs, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0); + const int rowOfBachTrack = outputCascParts.lastIndex(); // cascade std::vector indexCascChildID = {rowOfPosTrack, rowOfNegTrack, rowOfBachTrack}; - outputParts(outputCollision.lastIndex(), - casc.pt(), - casc.eta(), - casc.phi(), - aod::femtouniverseparticle::ParticleType::kCascade, - 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kV0), // zmienic - 0, - casc.casccosPA(col.posX(), col.posY(), col.posZ()), - indexCascChildID, - casc.mXi(), - casc.mXi()); + outputCascParts(outputCollision.lastIndex(), + casc.pt(), + casc.eta(), + casc.phi(), + aod::femtouniverseparticle::ParticleType::kCascade, + 0, // cutContainerV0.at(femtoUniverseV0Selection::V0ContainerPosition::kV0), + 0, + 0, + indexCascChildID, + ConfIsSelectCascOmega ? casc.mOmega() : casc.mXi(), + ConfIsSelectCascOmega ? casc.mOmega() : casc.mXi(), + casc.dcaV0daughters(), + casc.v0cosPA(col.posX(), col.posY(), col.posZ()), + casc.v0radius(), + casc.casccosPA(col.posX(), col.posY(), col.posZ()), + casc.dcacascdaughters(), + casc.cascradius(), + casc.dcapostopv(), + casc.dcanegtopv(), + casc.dcabachtopv(), + casc.dcav0topv(col.posX(), col.posY(), col.posZ())); if (ConfIsDebug) { fillDebugParticle(posTrackCasc); // QA for positive daughter fillDebugParticle(negTrackCasc); // QA for negative daughter @@ -1114,7 +1172,7 @@ struct femtoUniverseProducerTask { bool isD0D0bar = false; uint8_t daughFlag = 0; // flag = 0 (daugh of D0 or D0bar), 1 (daug of D0), -1 (daugh of D0bar) - for (auto const& hfCand : hfCands) { + for (const auto& hfCand : hfCands) { if (!(hfCand.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; @@ -1228,7 +1286,7 @@ struct femtoUniverseProducerTask { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index // lorentz vectors and filling the tables - for (auto& [p1, p2] : combinations(soa::CombinationsFullIndexPolicy(tracks, tracks))) { + for (const auto& [p1, p2] : combinations(soa::CombinationsFullIndexPolicy(tracks, tracks))) { if (!trackCuts.isSelectedMinimal(p1) || !trackCuts.isSelectedMinimal(p1)) { continue; } @@ -1270,8 +1328,8 @@ struct femtoUniverseProducerTask { TLorentzVector part1Vec; TLorentzVector part2Vec; - float mMassOne = TDatabasePDG::Instance()->GetParticle(321)->Mass(); // FIXME: Get from the PDG service of the common header - float mMassTwo = TDatabasePDG::Instance()->GetParticle(-321)->Mass(); // FIXME: Get from the PDG service of the common header + const auto mMassOne = o2::constants::physics::MassKPlus; // FIXME: Get from the PDG service of the common header + const auto mMassTwo = o2::constants::physics::MassKMinus; // FIXME: Get from the PDG service of the common header part1Vec.SetPtEtaPhiM(p1.pt(), p1.eta(), p1.phi(), mMassOne); part2Vec.SetPtEtaPhiM(p2.pt(), p2.eta(), p2.phi(), mMassTwo); @@ -1280,7 +1338,7 @@ struct femtoUniverseProducerTask { sumVec += part2Vec; float phiEta = sumVec.Eta(); - if (TMath::Abs(phiEta) > 0.8) { + if (std::abs(phiEta) > 0.8) { continue; } @@ -1289,12 +1347,13 @@ struct femtoUniverseProducerTask { continue; } - float phiPhi = sumVec.Phi(); + /*float phiPhi = sumVec.Phi(); if (sumVec.Phi() < 0) { - phiPhi = sumVec.Phi() + 2 * o2::constants::math::PI; + phiPhi = sumVec.Phi() + o2::constants::math::TwoPI; } else if (sumVec.Phi() >= 0) { phiPhi = sumVec.Phi(); - } + }*/ + float phiPhi = RecoDecay::constrainAngle(sumVec.Phi(), 0); float phiM = sumVec.M(); if (((phiM < ConfPhiSelection.ConfInvMassLowLimitPhi.value) || (phiM > ConfPhiSelection.ConfInvMassUpLimitPhi.value))) { @@ -1373,7 +1432,7 @@ struct femtoUniverseProducerTask { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; - for (auto& particle : tracks) { + for (const auto& particle : tracks) { /// if the most open selection criteria are not fulfilled there is no /// point looking further at the track @@ -1382,14 +1441,14 @@ struct femtoUniverseProducerTask { if (particle.pt() < ConfFilterCuts.ConfPtLowFilterCut || particle.pt() > ConfFilterCuts.ConfPtHighFilterCut) continue; - uint32_t pdgCode = (uint32_t)particle.pdgCode(); + uint32_t pdgCode = static_cast(particle.pdgCode()); if (ConfMCTruthAnalysisWithPID) { bool pass = false; std::vector tmpPDGCodes = ConfMCTruthPDGCodes; // necessary due to some features of the Configurable for (uint32_t pdg : tmpPDGCodes) { if (static_cast(pdg) == static_cast(pdgCode)) { - if ((pdgCode == 333)) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles + if (pdgCode == 333) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles pass = true; } else { if (particle.isPhysicalPrimary() || (ConfActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) @@ -1441,11 +1500,11 @@ struct femtoUniverseProducerTask { if constexpr (resolveDaughs) { childIDs[0] = 0; childIDs[1] = 0; - for (int i = 0; i < tmpIDtrack.size(); i++) { + for (std::size_t i = 0; i < tmpIDtrack.size(); i++) { const auto& particle = tracks.iteratorAt(tmpIDtrack[i] - tracks.begin().globalIndex()); for (int daughIndex = 0, n = std::min(2ul, particle.daughtersIds().size()); daughIndex < n; daughIndex++) { // loop to find the corresponding index of the daughters - for (int j = 0; j < tmpIDtrack.size(); j++) { + for (std::size_t j = 0; j < tmpIDtrack.size(); j++) { if (tmpIDtrack[j] == particle.daughtersIds()[daughIndex]) { childIDs[daughIndex] = i - j; break; @@ -1480,13 +1539,15 @@ struct femtoUniverseProducerTask { typename CollisionType> void fillCollisionsAndTracksAndV0AndPhi(CollisionType const& col, TrackType const& tracks, V0Type const& fullV0s) { - fillCollisions(col, tracks); - fillTracks(tracks); - if (ConfIsActivateV0) { - fillV0(col, fullV0s, tracks); - } - if (ConfIsActivatePhi) { - fillPhi(col, tracks); + const auto colcheck = fillCollisions(col, tracks); + if (colcheck) { + fillTracks(tracks); + if (ConfIsActivateV0) { + fillV0(col, fullV0s, tracks); + } + if (ConfIsActivatePhi) { + fillPhi(col, tracks); + } } // if (ConfIsActivateCascade) { // fillCascade(col, fullCascades, tracks); @@ -1525,13 +1586,15 @@ struct femtoUniverseProducerTask { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); // fill the tables - fillCollisions(col, tracks); - fillTracks(tracks); - fillCascade(col, fullCascades, tracks); + const auto colcheck = fillCollisions(col, tracks); + if (colcheck) { + fillTracks(tracks); + fillCascade(col, fullCascades, tracks); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackCascadeData, "Provide experimental data for track cascades", false); - void processTrackV0CentRun3(aod::FemtoFullCollisionCentRun3 const& col, + /*void processTrackV0CentRun3(aod::FemtoFullCollisionCentRun3 const& col, aod::BCsWithTimestamps const&, soa::Filtered const& tracks, o2::aod::V0Datas const& fullV0s) @@ -1539,11 +1602,11 @@ struct femtoUniverseProducerTask { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); // fill the tables - fillCollisionsCentRun3(col, tracks); + fillCollisionsCentRun3(col, tracks, fullV0s); fillTracks(tracks); fillV0(col, fullV0s, tracks); } - PROCESS_SWITCH(femtoUniverseProducerTask, processTrackV0CentRun3, "Provide experimental data for track v0", false); + PROCESS_SWITCH(femtoUniverseProducerTask, processTrackV0CentRun3, "Provide experimental data for track v0", false);*/ void processFullMC(aod::FemtoFullCollisionMC const& col, aod::BCsWithTimestamps const&, @@ -1568,8 +1631,10 @@ struct femtoUniverseProducerTask { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); // fill the tables - fillCollisions(col, tracks); - fillTracks(tracks); + const auto colcheck = fillCollisions(col, tracks); + if (colcheck) { + fillTracks(tracks); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackMC, "Provide MC data for track analysis", false); @@ -1582,9 +1647,11 @@ struct femtoUniverseProducerTask { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); // fill the tables - fillCollisions(col, tracks); - fillTracks(tracks); - fillPhi(col, tracks); + const auto colcheck = fillCollisions(col, tracks); + if (colcheck) { + fillTracks(tracks); + fillPhi(col, tracks); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackPhiMC, "Provide MC data for track Phi analysis", false); @@ -1597,9 +1664,11 @@ struct femtoUniverseProducerTask { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); // fill the tables - fillCollisions(col, tracks); - fillTracks(tracks); - // fillD0mesons(col, tracks, candidates); + const auto colcheck = fillCollisions(col, tracks); + if (colcheck) { + fillTracks(tracks); + // fillD0mesons(col, tracks, candidates); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackD0MC, "Provide MC data for track D0 analysis", false); @@ -1609,9 +1678,15 @@ struct femtoUniverseProducerTask { { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); + const double ir = 0.0; // fetch IR // fill the tables - fillCollisions(col, tracks); - fillTracks(tracks); + const auto colcheck = fillCollisions(col, tracks); + if (colcheck) { + if (ConfFillCollExt) { + fillCollisionsCentRun3ColExtra(col, ir); + } + fillTracks(tracks); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackData, "Provide experimental data for track track", true); @@ -1624,9 +1699,11 @@ struct femtoUniverseProducerTask { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); // fill the tables - fillCollisions(col, tracks); - fillTracks(tracks); - fillPhi(col, tracks); + const auto colcheck = fillCollisions(col, tracks); + if (colcheck) { + fillTracks(tracks); + fillPhi(col, tracks); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackPhiData, "Provide experimental data for track phi", false); @@ -1639,9 +1716,11 @@ struct femtoUniverseProducerTask { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); // fill the tables - fillCollisions(col, tracks); - fillTracks(tracks); - fillD0mesons(col, tracks, candidates); + const auto colcheck = fillCollisions(col, tracks); + if (colcheck) { + fillTracks(tracks); + fillD0mesons(col, tracks, candidates); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackD0mesonData, "Provide experimental data for track D0 meson", false); @@ -1680,19 +1759,19 @@ struct femtoUniverseProducerTask { { // recos std::set recoMcIds; - for (auto& col : collisions) { + for (const auto& col : collisions) { auto groupedTracks = tracks.sliceBy(perCollisionTracks, col.globalIndex()); auto groupedV0s = fullV0s.sliceBy(perCollisionV0s, col.globalIndex()); getMagneticFieldTesla(col.bc_as()); fillCollisionsAndTracksAndV0AndPhi(col, groupedTracks, groupedV0s); - for (auto& track : groupedTracks) { + for (const auto& track : groupedTracks) { if (trackCuts.isSelectedMinimal(track)) recoMcIds.insert(track.mcParticleId()); } } // truth - for (auto& mccol : mccols) { + for (const auto& mccol : mccols) { auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex()); auto groupedCollisions = collisions.sliceBy(recoCollsPerMCColl, mccol.globalIndex()); fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision @@ -1705,41 +1784,97 @@ struct femtoUniverseProducerTask { aod::BCsWithTimestamps const&, soa::Join const& tracks, aod::McCollisions const&, - aod::McParticles const&, - soa::Join const& fullV0s) + aod::McParticles const&) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + auto bc = col.bc_as(); + getMagneticFieldTesla(bc); + const double ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // fetch IR + // fill the tables - fillCollisionsCentRun3(col, tracks); - fillTracks(tracks); - fillV0(col, fullV0s, tracks); + const auto colcheck = fillCollisionsCentRun3(col); + if (colcheck) { + fillCollisionsCentRun3ColExtra(col, ir); + fillTracks(tracks); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processFullMCCent, "Provide MC data with centrality bins", false); void processTrackCentRun2Data(aod::FemtoFullCollisionCentRun2 const& col, aod::BCsWithTimestamps const&, - aod::FemtoFullTracks const& tracks) + soa::Filtered const& tracks) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + auto bc = col.bc_as(); + getMagneticFieldTesla(bc); + const double ir = 0.0; // fetch IR + // fill the tables - fillCollisionsCentRun2(col, tracks); - fillTracks(tracks); + const auto colcheck = fillCollisionsCentRun2(col); + if (colcheck) { + fillCollisionsCentRun3ColExtra(col, ir); + fillTracks(tracks); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackCentRun2Data, "Provide experimental data for Run 2 with centrality for track track", false); void processTrackCentRun3Data(aod::FemtoFullCollisionCentRun3 const& col, aod::BCsWithTimestamps const&, - aod::FemtoFullTracks const& tracks) + soa::Filtered const& tracks) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + auto bc = col.bc_as(); + getMagneticFieldTesla(bc); + const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // fetch IR + // fill the tables - fillCollisionsCentRun3(col, tracks); - fillTracks(tracks); + const auto colcheck = fillCollisionsCentRun3(col); + if (colcheck) { + fillCollisionsCentRun3ColExtra(col, ir); + fillTracks(tracks); + } } PROCESS_SWITCH(femtoUniverseProducerTask, processTrackCentRun3Data, "Provide experimental data for Run 3 with centrality for track track", false); + + void processV0CentRun3Data(aod::FemtoFullCollisionCentRun3 const& col, + aod::BCsWithTimestamps const&, + soa::Filtered const& tracks, + aod::V0Datas const& fullV0s) + { + // get magnetic field for run + auto bc = col.bc_as(); + getMagneticFieldTesla(bc); + const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // fetch IR + + // fill the tables + const auto colcheck = fillCollisionsCentRun3(col); + if (colcheck) { + fillCollisionsCentRun3ColExtra(col, ir); + fillTracks(tracks); + fillV0(col, fullV0s, tracks); + } + } + PROCESS_SWITCH(femtoUniverseProducerTask, processV0CentRun3Data, "Provide experimental data for Run 3 with centrality for track track", false); + + void processCascadeCentRun3Data(aod::FemtoFullCollisionCentRun3 const& col, + aod::BCsWithTimestamps const&, + soa::Filtered const& tracks, + aod::CascDatas const& fullCascades) + { + // get magnetic field for run + auto bc = col.bc_as(); + getMagneticFieldTesla(bc); + const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // fetch IR + + // fill the tables + const auto colcheck = fillCollisionsCentRun3(col); + if (colcheck) { + fillCollisionsCentRun3ColExtra(col, ir); + fillTracks(tracks); + fillCascade(col, fullCascades, tracks); + } + } + PROCESS_SWITCH(femtoUniverseProducerTask, processCascadeCentRun3Data, "Provide experimental data for Run 3 with centrality for track track", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt b/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt index 7e82d3c4525..0a4682a7f7a 100644 --- a/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt @@ -29,6 +29,11 @@ o2physics_add_dpl_workflow(femtouniverse-pair-track-track-mult-kt-extended PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femtouniverse-pair-track-nucleus + SOURCES femtoUniversePairTaskTrackNucleus.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femtouniverse-pair-track-track-threedrelmom-mult-kt-extended SOURCES femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore @@ -92,4 +97,4 @@ o2physics_add_dpl_workflow(femtouniverse-efficiency-base o2physics_add_executable(femtouniverse-cutculator SOURCES femtoUniverseCutCulator.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx index feb6495e1cd..b071bc71f62 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx @@ -61,16 +61,25 @@ struct femtoUniverseEfficiencyBase { Configurable ConfNsigmaTPCPion{"ConfNsigmaTPCPion", 3.0, "TPC Pion Sigma for momentum < ConfMomPion"}; } ConfBothTracks; - // Lambda cuts + /// Lambda cuts Configurable ConfV0InvMassLowLimit{"ConfV0InvV0MassLowLimit", 1.10, "Lower limit of the V0 invariant mass"}; Configurable ConfV0InvMassUpLimit{"ConfV0InvV0MassUpLimit", 1.13, "Upper limit of the V0 invariant mass"}; - // Kaon configurables + /// Kaon configurable Configurable IsKaonRun2{"IsKaonRun2", false, "Enable kaon selection used in Run2"}; // to check consistency with Run2 results + /// Deuteron configurables + struct : o2::framework::ConfigurableGroup { + Configurable ConfNsigmaTPCDe{"ConfNsigmaTPCDe", 2.0f, "TPC Deuteron Sigma for momentum < ConfTOFpMinDe"}; + Configurable ConfNsigmaTOFDe{"ConfNsigmaTOFDe", 2.0f, "TOF Deuteron Sigma"}; + Configurable ConfTOFpMinDe{"ConfTOFpMinDe", 0.5f, "Min. momentum for deuterons for which TOF is required for PID"}; + Configurable ConfPLowDe{"ConfPLowDe", 0.8f, "Lower limit for momentum for deuterons"}; + Configurable ConfPHighDe{"ConfPHighDe", 1.8f, "Higher limit for momentum for deuterons"}; + } deuteronconfigs; + /// Particle 1 Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 2212, "Particle 1 - PDG code"}; - Configurable ConfParticleTypePartOne{"ConfParticleTypePartOne", aod::femtouniverseparticle::ParticleType::kTrack, "Particle 1 - particle type: 0 - track, 2 - V0, 6 - phi"}; + Configurable ConfParticleTypePartOne{"ConfParticleTypePartOne", aod::femtouniverseparticle::ParticleType::kTrack, "Particle 1 - particle type: 0 - track, 2 - V0, 6 - phi"}; Configurable ConfNoPDGPartOne{"ConfNoPDGPartOne", false, "0: selecting part one by PDG, 1: no PID selection"}; Configurable ConfPtLowPart1{"ConfPtLowPart1", 0.2, "Lower limit for Pt for the first particle"}; Configurable ConfPtHighPart1{"ConfPtHighPart1", 2.5, "Higher limit for Pt for the first particle"}; @@ -91,7 +100,7 @@ struct femtoUniverseEfficiencyBase { /// Particle 2 Configurable ConfIsSame{"ConfIsSame", false, "Pairs of the same particle"}; Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 333, "Particle 2 - PDG code"}; - Configurable ConfParticleTypePartTwo{"ConfParticleTypePartTwo", aod::femtouniverseparticle::ParticleType::kTrack, "Particle 2 - particle type: 0 - track, 2 - V0, 6 - phi"}; + Configurable ConfParticleTypePartTwo{"ConfParticleTypePartTwo", aod::femtouniverseparticle::ParticleType::kTrack, "Particle 2 - particle type: 0 - track, 2 - V0, 6 - phi"}; Configurable ConfNoPDGPartTwo{"ConfNoPDGPartTwo", false, "0: selecting part two by PDG, 1: no PID selection"}; Configurable ConfPtLowPart2{"ConfPtLowPart2", 0.2, "Lower limit for Pt for the second particle"}; Configurable ConfPtHighPart2{"ConfPtHighPart2", 2.5, "Higher limit for Pt for the second particle"}; @@ -239,7 +248,20 @@ struct femtoUniverseEfficiencyBase { return false; } - bool IsParticleNSigma(int pdgCode, float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK) + bool IsDeuteronNSigma(float mom, float nsigmaTPCDe, float nsigmaTOFDe) + { + if (mom > deuteronconfigs.ConfPLowDe && mom < deuteronconfigs.ConfPHighDe) { + if (mom < deuteronconfigs.ConfTOFpMinDe) { + return (TMath::Abs(nsigmaTPCDe) < deuteronconfigs.ConfNsigmaTPCDe); + } else { + return (TMath::Abs(nsigmaTOFDe) < deuteronconfigs.ConfNsigmaTOFDe && (TMath::Abs(nsigmaTPCDe) < deuteronconfigs.ConfNsigmaTPCDe)); + } + } else { + return false; + } + } + + bool IsParticleNSigma(int pdgCode, float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK, float nsigmaTPCDe, float nsigmaTOFDe) { switch (pdgCode) { case 2212: // Proton @@ -254,6 +276,10 @@ struct femtoUniverseEfficiencyBase { case -321: // Kaon- return IsKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); break; + case 1000010020: // Deuteron + case -1000010020: // Antideuteron + return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); + break; default: return false; } @@ -283,7 +309,7 @@ struct femtoUniverseEfficiencyBase { { /// Histogramming same event for (auto& part : grouppartsOneMCGen) { - if (!ConfNoPDGPartOne && part.pidcut() != ConfPDGCodePartOne) { + if (!ConfNoPDGPartOne && part.tempFitVar() != ConfPDGCodePartOne) { continue; } trackHistoPartOneGen.fillQA(part); @@ -291,7 +317,7 @@ struct femtoUniverseEfficiencyBase { if (!ConfIsSame) { for (auto& part : grouppartsTwoMCGen) { - if (!ConfNoPDGPartTwo && part.pidcut() != ConfPDGCodePartTwo) { + if (!ConfNoPDGPartTwo && part.tempFitVar() != ConfPDGCodePartTwo) { continue; } trackHistoPartTwoGen.fillQA(part); @@ -310,7 +336,7 @@ struct femtoUniverseEfficiencyBase { { /// Histogramming same event for (auto& part : grouppartsOneMCRec) { - if (part.partType() != ConfParticleTypePartOne || part.sign() != ConfChargePart1 || !IsParticleNSigma(ConfPDGCodePartOne, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + if (part.partType() != ConfParticleTypePartOne || part.sign() != ConfChargePart1 || !IsParticleNSigma(ConfPDGCodePartOne, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(part, o2::track::PID::Deuteron))) { continue; } trackHistoPartOneRec.fillQA(part); @@ -326,7 +352,7 @@ struct femtoUniverseEfficiencyBase { if (!ConfIsSame) { for (auto& part : grouppartsTwoMCRec) { - if (part.partType() != ConfParticleTypePartTwo || part.sign() != ConfChargePart2 || !IsParticleNSigma(ConfPDGCodePartTwo, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + if (part.partType() != ConfParticleTypePartTwo || part.sign() != ConfChargePart2 || !IsParticleNSigma(ConfPDGCodePartTwo, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(part, o2::track::PID::Deuteron))) { continue; } @@ -354,7 +380,7 @@ struct femtoUniverseEfficiencyBase { { // part1 is track and part2 is Phi for (auto& part : grouppartsOneMCRec) { - if (part.partType() != ConfParticleTypePartOne || part.sign() != ConfChargePart1 || !IsParticleNSigma(ConfPDGCodePartOne, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + if (part.partType() != ConfParticleTypePartOne || part.sign() != ConfChargePart1 || !IsParticleNSigma(ConfPDGCodePartOne, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(part, o2::track::PID::Deuteron))) { continue; } trackHistoPartOneRec.fillQA(part); @@ -482,7 +508,7 @@ struct femtoUniverseEfficiencyBase { /// Histogramming same event for (auto& part : grouppartsOneMCRec) { - if (part.partType() != ConfParticleTypePartOne || part.sign() != ConfChargePart1 || !IsParticleNSigma(ConfPDGCodePartOne, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + if (part.partType() != ConfParticleTypePartOne || part.sign() != ConfChargePart1 || !IsParticleNSigma(ConfPDGCodePartOne, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(part, o2::track::PID::Deuteron))) { continue; } diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniverseHashTask.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniverseHashTask.cxx index 1fef7a97ac2..f33657f0dca 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniverseHashTask.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniverseHashTask.cxx @@ -32,7 +32,7 @@ struct femtoUniversePairHashTask { std::vector CastCfgVtxBins, CastCfgMultBins; - Produces hashes; + Produces hashes; void init(InitContext&) { diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 7c87254f9ea..b049a6589d1 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -11,6 +11,7 @@ /// \brief Task for cascade QA; in the future: for cascade correlations /// \author Barbara Chytla, WUT Warsaw, barbara.chytla@cern.ch +/// \author Shirajum Monira, WUT Warsaw, shirajum.monira@cern.ch #include #include "Framework/AnalysisTask.h" @@ -37,7 +38,7 @@ using namespace o2::aod::pidutils; struct femtoUniversePairTaskTrackCascadeExtended { SliceCache cache; - using FemtoFullParticles = soa::Join; + using FemtoFullParticles = soa::Join; Preslice perCol = aod::femtouniverseparticle::fdCollisionId; Configurable ConfZVertexCut{"ConfZVertexCut", 10.f, "Event sel: Maximum z-Vertex (cm)"}; @@ -55,15 +56,62 @@ struct femtoUniversePairTaskTrackCascadeExtended { Configurable NSigmaTPCPion{"NSigmaTPCPion", 4, "NSigmaTPCPion"}; Configurable NSigmaTPCProton{"NSigmaTPCProton", 4, "NSigmaTPCProton"}; + // configs for correlation part + Configurable ConfTrackChoicePartOne{"ConfTrackChoicePartOne", 0, "0:Proton, 1:Pion, 2:Kaon"}; + Configurable ConfTrkPDGCodePartOne{"ConfTrkPDGCodePartOne", 2212, "Particle 1 (Track) - PDG code"}; + Configurable ConfCascType1{"ConfCascType1", 0, "select one of the V0s (Omega = 0, Xi = 1, anti-Omega = 2, anti-Xi = 3) for track-cascade combination"}; + Configurable ConfChargePart1{"ConfChargePart1", 1, "sign of particle 1"}; + Configurable ConfHPtPart1{"ConfHPtPart1", 4.0f, "higher limit for pt of particle 1"}; + Configurable ConfLPtPart1{"ConfLPtPart1", 0.5f, "lower limit for pt of particle 1"}; + Configurable ConfHPtPart2{"ConfHPtPart2", 4.0f, "higher limit for pt of particle 2"}; + Configurable ConfLPtPart2{"ConfLPtPart2", 0.3f, "lower limit for pt of particle 2"}; + Configurable Confmom{"Confmom", 0.75, "momentum threshold for particle identification using TOF"}; + Configurable ConfNsigmaTPCParticle{"ConfNsigmaTPCParticle", 3.0, "TPC Sigma for particle momentum < Confmom"}; + Configurable ConfNsigmaCombinedParticle{"ConfNsigmaCombinedParticle", 3.0, "TPC and TOF Sigma (combined) for particle momentum > Confmom"}; + + ConfigurableAxis ConfkstarBins{"ConfkstarBins", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis ConfMultBins{"ConfMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; + ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis ConfmTBins{"ConfmTBins", {225, 0., 7.5}, "binning mT"}; + ConfigurableAxis ConfmultBins3D{"ConfMultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; + Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; + Configurable ConfIsMC{"ConfIsMC", false, "Enable additional Histograms in the case of a MonteCarlo Run"}; + Configurable ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; + ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis ConfTrkTempFitVarpTBins{"ConfTrkTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; + ConfigurableAxis ConfTrkTempFitVarBins{"ConfTrkDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + + /// Partition for particle 1 (track) + Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == ConfChargePart1) && (aod::femtouniverseparticle::pt < ConfHPtPart1) && (aod::femtouniverseparticle::pt > ConfLPtPart1); + + /// Partition for particle 2 (cascade) + Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)) && (aod::femtouniverseparticle::pt < ConfHPtPart2) && (aod::femtouniverseparticle::pt > ConfLPtPart2); + /// Partition for cascades Partition cascs = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)); + /// Histogramming for track particle + FemtoUniverseParticleHisto trackHistoPartOnePos; + FemtoUniverseParticleHisto trackHistoPartOneNeg; + + /// Histogramming for cascade FemtoUniverseParticleHisto posChildHistos; FemtoUniverseParticleHisto negChildHistos; FemtoUniverseParticleHisto bachHistos; + FemtoUniverseContainer sameEventCont; + FemtoUniverseContainer mixedEventCont; + FemtoUniversePairCleaner pairCleaner; + HistogramRegistry rXiQA{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Table to select cascade daughters + // Charges: = +--, +--, +-+, +-+ + static constexpr UInt_t CascChildTable[][3] = {{0, 1, 2}, {0, 1, 1}, {1, 0, 2}, {1, 0, 1}}; bool invMCascade(float invMassCascade, float invMassAntiCascade) { @@ -73,6 +121,41 @@ struct femtoUniversePairTaskTrackCascadeExtended { return true; } + bool IsNSigmaTPC(float nsigmaTPCParticle) + { + if (TMath::Abs(nsigmaTPCParticle) < ConfNsigmaTPCParticle) { + return true; + } else { + return false; + } + } + + bool IsNSigmaCombined(float mom, float nsigmaTPCParticle, float nsigmaTOFParticle) + { + if (mom <= Confmom) { + return (TMath::Abs(nsigmaTPCParticle) < ConfNsigmaTPCParticle); + } else { + return (TMath::Hypot(nsigmaTOFParticle, nsigmaTPCParticle) < ConfNsigmaCombinedParticle); + } + } + + template + bool IsParticleTPC(const T& part, int id) + { + const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; + + return IsNSigmaTPC(tpcNSigmas[id]); + } + + template + bool IsParticleCombined(const T& part, int id) + { + const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; + const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; + + return IsNSigmaCombined(part.p(), tpcNSigmas[id], tofNSigmas[id]); + } + void init(InitContext const&) { // Axes @@ -80,21 +163,42 @@ struct femtoUniversePairTaskTrackCascadeExtended { AxisSpec ptAxis = {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec etaAxis = {100, -2.0f, 2.0f, "#it{#eta}"}; AxisSpec phiAxis = {100, 0.0f, 6.0f, "#it{#phi}"}; + AxisSpec DCADaughAxis = {1000, 0.0f, 2.0f, "DCA (cm)"}; + AxisSpec CPAAxis = {1000, 0.95f, 1.0f, "#it{cos #theta_{p}}"}; + AxisSpec tranRadAxis = {1000, 0.0f, 100.0f, "#it{r}_{xy} (cm)"}; + AxisSpec DCAToPVAxis = {1000, -10.0f, 10.0f, "DCA to PV (cm)"}; // Histograms - rXiQA.add("hMassXiMinus", "hMassXiMinus", {HistType::kTH1F, {XiMassAxis}}); - rXiQA.add("hMassXiPlus", "hMassXiPlus", {HistType::kTH1F, {XiMassAxis}}); - rXiQA.add("hMassXiMinusSelected", "hMassXiSelected", {HistType::kTH1F, {XiMassAxis}}); - rXiQA.add("hMassXiPlusSelected", "hMassXiSelected", {HistType::kTH1F, {XiMassAxis}}); + rXiQA.add("hMassXi", "hMassXi", {HistType::kTH1F, {XiMassAxis}}); + rXiQA.add("hMassXiSelected", "hMassXiSelected", {HistType::kTH1F, {XiMassAxis}}); rXiQA.add("hPtXi", "hPtXi", {HistType::kTH1F, {{ptAxis}}}); rXiQA.add("hEtaXi", "hEtaXi", {HistType::kTH1F, {{etaAxis}}}); rXiQA.add("hPhiXi", "hPhiXi", {HistType::kTH1F, {{phiAxis}}}); - rXiQA.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.9f, 1.f}}}); - // rXiQA.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rXiQA.add("hDCAV0Daughters", "hDCAV0Daughters", {HistType::kTH1F, {DCADaughAxis}}); + rXiQA.add("hV0CosPA", "hV0CosPA", {HistType::kTH1F, {CPAAxis}}); + rXiQA.add("hV0TranRad", "hV0TranRad", {HistType::kTH1F, {tranRadAxis}}); + rXiQA.add("hDCACascDaughters", "hDCACascDaughters", {HistType::kTH1F, {DCADaughAxis}}); + rXiQA.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {CPAAxis}}); + rXiQA.add("hCascTranRad", "hCascTranRad", {HistType::kTH1F, {tranRadAxis}}); + rXiQA.add("hDcaPostoPV", "hDcaPostoPV", {HistType::kTH1F, {DCAToPVAxis}}); + rXiQA.add("hDcaNegtoPV", "hDcaNegtoPV", {HistType::kTH1F, {DCAToPVAxis}}); + rXiQA.add("hDcaBachtoPV", "hDcaBachtoPV", {HistType::kTH1F, {DCAToPVAxis}}); + rXiQA.add("hDcaV0toPV", "hDcaV0toPV", {HistType::kTH1F, {DCAToPVAxis}}); + + qaRegistry.add("Tracks_pos/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("Tracks_pos/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("Tracks_neg/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("Tracks_neg/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + trackHistoPartOnePos.init(&qaRegistry, ConfTrkTempFitVarpTBins, ConfTrkTempFitVarBins, ConfIsMC, ConfTrkPDGCodePartOne); + trackHistoPartOneNeg.init(&qaRegistry, ConfTrkTempFitVarpTBins, ConfTrkTempFitVarBins, ConfIsMC, ConfTrkPDGCodePartOne); posChildHistos.init(&qaRegistry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false, 0, true); negChildHistos.init(&qaRegistry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false, 0, true); bachHistos.init(&qaRegistry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false, 0, true, "hBachelor"); + + sameEventCont.init(&resultRegistry, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfEtaBins, ConfPhiBins, ConfIsMC, ConfUse3D); + mixedEventCont.init(&resultRegistry, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfEtaBins, ConfPhiBins, ConfIsMC, ConfUse3D); + pairCleaner.init(&qaRegistry); } void processCascades(FilteredFDCollision& col, FemtoFullParticles& parts) @@ -103,8 +207,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { // const int multCol = col.multNtr(); for (auto& casc : groupCascs) { - rXiQA.fill(HIST("hMassXiMinus"), casc.mLambda()); - rXiQA.fill(HIST("hMassXiPlus"), casc.mAntiLambda()); + rXiQA.fill(HIST("hMassXi"), casc.mLambda()); // if (!invMCascade(casc.mLambda(), casc.mAntiLambda())) // continue; @@ -141,10 +244,17 @@ struct femtoUniversePairTaskTrackCascadeExtended { rXiQA.fill(HIST("hPtXi"), casc.pt()); rXiQA.fill(HIST("hEtaXi"), casc.eta()); rXiQA.fill(HIST("hPhiXi"), casc.phi()); - rXiQA.fill(HIST("hMassXiMinusSelected"), casc.mLambda()); - rXiQA.fill(HIST("hMassXiPlusSelected"), casc.mAntiLambda()); - rXiQA.fill(HIST("hCascCosPA"), casc.tempFitVar()); - // rXiQA.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); // nie ma miejsca na to w FemtoDerived + rXiQA.fill(HIST("hMassXiSelected"), casc.mLambda()); + rXiQA.fill(HIST("hDCAV0Daughters"), casc.dcaV0daughters()); + rXiQA.fill(HIST("hV0CosPA"), casc.cpav0()); + rXiQA.fill(HIST("hV0TranRad"), casc.v0radius()); + rXiQA.fill(HIST("hCascCosPA"), casc.cpaCasc()); + rXiQA.fill(HIST("hDCACascDaughters"), casc.dcacascdaughters()); + rXiQA.fill(HIST("hCascTranRad"), casc.cascradius()); + rXiQA.fill(HIST("hDcaPostoPV"), casc.dcapostopv()); + rXiQA.fill(HIST("hDcaNegtoPV"), casc.dcanegtopv()); + rXiQA.fill(HIST("hDcaBachtoPV"), casc.dcabachtopv()); + rXiQA.fill(HIST("hDcaV0toPV"), casc.dcav0topv()); posChildHistos.fillQA(posChild); negChildHistos.fillQA(negChild); @@ -152,6 +262,108 @@ struct femtoUniversePairTaskTrackCascadeExtended { } } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processCascades, "Enable processing cascades", true); + + void processSameEvent(FilteredFDCollision& col, FemtoFullParticles& parts) + { + auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + + for (auto& part : groupPartsTwo) { + if (!invMCascade(part.mLambda(), part.mAntiLambda())) + continue; + const auto& posChild = parts.iteratorAt(part.index() - 3); + const auto& negChild = parts.iteratorAt(part.index() - 2); + const auto& bachelor = parts.iteratorAt(part.index() - 1); + /// Child particles must pass this condition to be selected + if (!IsParticleTPC(posChild, CascChildTable[ConfCascType1][0]) || !IsParticleTPC(negChild, CascChildTable[ConfCascType1][1]) || !IsParticleTPC(bachelor, CascChildTable[ConfCascType1][2])) + continue; + + posChildHistos.fillQA(posChild); + negChildHistos.fillQA(negChild); + bachHistos.fillQABase(bachelor, HIST("hBachelor")); + } + + for (auto& part : groupPartsOne) { + /// PID plot for track particle + const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; + const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; + + if (!IsNSigmaCombined(part.p(), tpcNSigmas[ConfTrackChoicePartOne], tofNSigmas[ConfTrackChoicePartOne])) + continue; + + if (part.sign() > 0) { + qaRegistry.fill(HIST("Tracks_pos/nSigmaTPC"), part.p(), tpcNSigmas[ConfTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_pos/nSigmaTOF"), part.p(), tofNSigmas[ConfTrackChoicePartOne]); + trackHistoPartOnePos.fillQA(part); + } else if (part.sign() < 0) { + qaRegistry.fill(HIST("Tracks_neg/nSigmaTPC"), part.p(), tpcNSigmas[ConfTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_neg/nSigmaTOF"), part.p(), tofNSigmas[ConfTrackChoicePartOne]); + trackHistoPartOneNeg.fillQA(part); + } + } + + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + // Cascade invariant mass cut + if (!invMCascade(p2.mLambda(), p2.mAntiLambda())) + continue; + // PID + if (!IsParticleCombined(p1, ConfTrackChoicePartOne)) + continue; + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + const auto& posChild = parts.iteratorAt(p2.index() - 3); + const auto& negChild = parts.iteratorAt(p2.index() - 2); + const auto& bachelor = parts.iteratorAt(p2.index() - 1); + /// Child particles must pass this condition to be selected + if (!IsParticleTPC(posChild, CascChildTable[ConfCascType1][0]) || !IsParticleTPC(negChild, CascChildTable[ConfCascType1][1]) || !IsParticleTPC(bachelor, CascChildTable[ConfCascType1][2])) + continue; + + sameEventCont.setPair(p1, p2, col.multNtr(), ConfUse3D, 1.0f); + } + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEvent, "Enable processing same event for track - cascade", true); + + void processMixedEvent(FilteredFDCollisions& cols, FemtoFullParticles& parts) + { + ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; + + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + + auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + continue; + } + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + // Cascade invariant mass cut + if (!invMCascade(p2.mLambda(), p2.mAntiLambda())) + continue; + // PID + if (!IsParticleCombined(p1, ConfTrackChoicePartOne)) + continue; + + const auto& posChild = parts.iteratorAt(p2.index() - 3); + const auto& negChild = parts.iteratorAt(p2.index() - 2); + const auto& bachelor = parts.iteratorAt(p2.index() - 1); + /// Child particles must pass this condition to be selected + if (!IsParticleTPC(posChild, CascChildTable[ConfCascType1][0]) || !IsParticleTPC(negChild, CascChildTable[ConfCascType1][1]) || !IsParticleTPC(bachelor, CascChildTable[ConfCascType1][2])) + continue; + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + + mixedEventCont.setPair(p1, p2, collision1.multNtr(), ConfUse3D, 1.0f); + } + } + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMixedEvent, "Enable processing mixed event for track - cascade", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index 50e29740ce9..a994a047157 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx @@ -18,6 +18,7 @@ /// \author Katarzyna Gwiździel, WUT Warsaw, katarzyna.gwizdziel@cern.ch #include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" @@ -25,7 +26,6 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "TDatabasePDG.h" #include "ReconstructionDataFormats/PID.h" #include "Common/DataModel/PIDResponse.h" @@ -52,13 +52,11 @@ using namespace o2::soa; namespace { -static constexpr int nPart = 2; -static constexpr int nCuts = 5; +static constexpr int kNPart = 2; +static constexpr int kNCuts = 5; static const std::vector partNames{"D0", "Track"}; static const std::vector cutNames{"MaxPt", "PIDthr", "nSigmaTPC", "nSigmaTPCTOF", "MaxP"}; -static const float cutsTable[nPart][nCuts]{ - {4.05f, 1.f, 3.f, 3.f, 100.f}, - {4.05f, 1.f, 3.f, 3.f, 100.f}}; +static const float cutsTable[kNPart][kNCuts]{{4.05f, 1.f, 3.f, 3.f, 100.f}, {4.05f, 1.f, 3.f, 3.f, 100.f}}; } // namespace /// Returns deltaPhi value within the range [-pi/2, 3/2*pi] @@ -74,16 +72,13 @@ double wrapDeltaPhi0PI(double phiD, double phiDbar) { double deltaPhi = 0.0; deltaPhi = RecoDecay::constrainAngle(phiDbar - phiD, 0.0); - if (deltaPhi < 0.) { - deltaPhi = deltaPhi + o2::constants::math::TwoPI; - } if (deltaPhi > o2::constants::math::TwoPI) { deltaPhi = o2::constants::math::TwoPI - deltaPhi; } return deltaPhi; } -struct femtoUniversePairTaskTrackD0 { +struct FemtoUniversePairTaskTrackD0 { using FemtoFullParticles = soa::Join; SliceCache cache; @@ -91,66 +86,66 @@ struct femtoUniversePairTaskTrackD0 { /// Table for both particles struct : o2::framework::ConfigurableGroup { - Configurable ConfNsigmaCombinedProton{"ConfNsigmaCombinedProton", 3.0, "TPC and TOF Proton Sigma (combined) for momentum > 0.5"}; - Configurable ConfNsigmaTPCProton{"ConfNsigmaTPCProton", 3.0, "TPC Proton Sigma for momentum < 0.5"}; - Configurable ConfNsigmaCombinedPion{"ConfNsigmaCombinedPion", 3.0, "TPC and TOF Pion Sigma (combined) for momentum > 0.5"}; - Configurable ConfNsigmaTPCPion{"ConfNsigmaTPCPion", 3.0, "TPC Pion Sigma for momentum < 0.5"}; - - Configurable> ConfCutTable{"ConfCutTable", {cutsTable[0], nPart, nCuts, partNames, cutNames}, "Particle selections"}; - Configurable ConfNspecies{"ConfNspecies", 2, "Number of particle spieces with PID info"}; - Configurable ConfIsMC{"ConfIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; - Configurable> ConfTrkPIDnSigmaMax{"ConfTrkPIDnSigmaMax", std::vector{4.f, 3.f, 2.f}, "This configurable needs to be the same as the one used in the producer task"}; - Configurable ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; - Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; - Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; + Configurable confNsigmaCombinedProton{"confNsigmaCombinedProton", 3.0, "TPC and TOF Proton Sigma (combined) for momentum > 0.5"}; + Configurable confNsigmaTPCProton{"confNsigmaTPCProton", 3.0, "TPC Proton Sigma for momentum < 0.5"}; + Configurable confNsigmaCombinedPion{"confNsigmaCombinedPion", 3.0, "TPC and TOF Pion Sigma (combined) for momentum > 0.5"}; + Configurable confNsigmaTPCPion{"confNsigmaTPCPion", 3.0, "TPC Pion Sigma for momentum < 0.5"}; + + Configurable> confCutTable{"confCutTable", {cutsTable[0], kNPart, kNCuts, partNames, cutNames}, "Particle selections"}; + Configurable confNspecies{"confNspecies", 2, "Number of particle spieces with PID info"}; + Configurable confIsMC{"confIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; + Configurable> confTrkPIDnSigmaMax{"confTrkPIDnSigmaMax", std::vector{4.f, 3.f, 2.f}, "This configurable needs to be the same as the one used in the producer task"}; + Configurable confUse3D{"confUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; + Configurable confPhiBins{"confPhiBins", 29, "Number of phi bins in deta dphi"}; + Configurable confEtaBins{"confEtaBins", 29, "Number of eta bins in deta dphi"}; } ConfBothTracks; /// Particle 1 --- IDENTIFIED TRACK struct : o2::framework::ConfigurableGroup { - Configurable ConfIsSame{"ConfIsSame", false, "Pairs of the same particle"}; - Configurable ConfPDGCodeTrack{"ConfPDGCodeTrack", 2212, "Particle 2 - PDG code"}; - Configurable ConfPIDTrack{"ConfPIDTrack", 2, "Particle 2 - Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> - Configurable ConfTrackSign{"ConfTrackSign", 1, "Track sign"}; - Configurable ConfIsTrackIdentified{"ConfIsTrackIdentified", true, "Enable PID for the track"}; + Configurable confIsSame{"confIsSame", false, "Pairs of the same particle"}; + Configurable confPDGCodeTrack{"confPDGCodeTrack", 2212, "Particle 2 - PDG code"}; + Configurable confPIDTrack{"confPIDTrack", 2, "Particle 2 - Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> + Configurable confTrackSign{"confTrackSign", 1, "Track sign"}; + Configurable confIsTrackIdentified{"confIsTrackIdentified", true, "Enable PID for the track"}; + Configurable confTrackLowPtCut{"confTrackLowPtCut", 0.5, "Low pT cut of the track"}; + Configurable confTrackHighPtCut{"confTrackHighPtCut", 2.5, "High pT cut of the track"}; } ConfTrack; /// Particle 2 --- D0/D0bar meson struct : o2::framework::ConfigurableGroup { - Configurable ConfPDGCodeD0{"ConfPDGCodeD0", 421, "D0 meson - PDG code"}; - Configurable ConfPDGCodeD0bar{"ConfPDGCodeD0bar", -421, "D0bar meson - PDG code"}; - Configurable ConfMinPtD0D0bar{"ConfMinPtD0D0bar", 3.0, "D0/D0bar sel. - min. pT"}; - Configurable ConfMaxPtD0D0bar{"ConfMaxPtD0D0bar", 5.0, "D0/D0bar sel. - max. pT"}; - Configurable ConfMinInvMassD0D0bar{"ConfMinInvMassD0D0bar", 1.65, "D0/D0bar sel. - min. invMass"}; - Configurable ConfMaxInvMassD0D0bar{"ConfMaxInvMassD0D0bar", 2.05, "D0/D0bar sel. - max. invMass"}; + Configurable confPDGCodeD0{"confPDGCodeD0", 421, "D0 meson - PDG code"}; + Configurable confPDGCodeD0bar{"confPDGCodeD0bar", -421, "D0bar meson - PDG code"}; + Configurable confMinPtD0D0bar{"confMinPtD0D0bar", 1.0, "D0/D0bar sel. - min. pT"}; + Configurable confMaxPtD0D0bar{"confMaxPtD0D0bar", 3.0, "D0/D0bar sel. - max. pT"}; + Configurable confMinInvMassD0D0bar{"confMinInvMassD0D0bar", 1.65, "D0/D0bar sel. - min. invMass"}; + Configurable confMaxInvMassD0D0bar{"confMaxInvMassD0D0bar", 2.05, "D0/D0bar sel. - max. invMass"}; } ConfDmesons; struct : o2::framework::ConfigurableGroup { - Configurable ConfSignalRegionMin{"ConfSignalRegionMin", 1.810, "Min. inv. mass for D0/D0bar in the signal region"}; - Configurable ConfSignalRegionMax{"ConfSignalRegionMax", 1.922, "Max. inv. mass for D0/D0bar in the signal region"}; - Configurable ConfMinInvMassLeftSB{"ConfMinInvMassLeftSB", 1.642, "Min. inv. mass for D0/D0bar in the left sideband region"}; - Configurable ConfMaxInvMassLeftSB{"ConfMaxInvMassLeftSB", 1.754, "Max. inv. mass for D0/D0bar in the left sideband region"}; - Configurable ConfMinInvMassRightSB{"ConfMinInvMassRightSB", 1.978, "Min. inv. mass for D0/D0bar in the right sideband region"}; - Configurable ConfMaxInvMassRightSB{"ConfMaxInvMassRightSB", 2.090, "Max. inv. mass for D0/D0bar in the right sideband region"}; + Configurable confSignalRegionMin{"confSignalRegionMin", 1.810, "Min. inv. mass for D0/D0bar in the signal region"}; + Configurable confSignalRegionMax{"confSignalRegionMax", 1.922, "Max. inv. mass for D0/D0bar in the signal region"}; + Configurable confMinInvMassLeftSB{"confMinInvMassLeftSB", 1.642, "Min. inv. mass for D0/D0bar in the left sideband region"}; + Configurable confMaxInvMassLeftSB{"confMaxInvMassLeftSB", 1.754, "Max. inv. mass for D0/D0bar in the left sideband region"}; + Configurable confMinInvMassRightSB{"confMinInvMassRightSB", 1.978, "Min. inv. mass for D0/D0bar in the right sideband region"}; + Configurable confMaxInvMassRightSB{"confMaxInvMassRightSB", 2.090, "Max. inv. mass for D0/D0bar in the right sideband region"}; } ConfD0D0barSideBand; Configurable> binsPt{"binsPt", std::vector{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"}; - Configurable ConfChooseD0trackCorr{"ConfChooseD0trackCorr", 3, "If 0 - only D0s, 1 - only D0bars, 2 - D0/D0bar (one mass hypo.), 3 - all D0/D0bar cand."}; - Configurable ConfUsePtCutForD0D0bar{"ConfUsePtCutForD0D0bar", false, "Include pT cut for D0/D0bar in same and mixed processes."}; - Configurable ConfUseMassCutForD0D0bar{"ConfUseMassCutForD0D0bar", false, "Switch to save D0/D0bar within declared inv. mass range"}; + Configurable confChooseD0trackCorr{"confChooseD0trackCorr", 2, "If 0 - only D0s, 1 - only D0bars, 2 - D0/D0bar (one mass hypo.), 3 - all D0/D0bar cand."}; /// Partitions for particle 1 - Partition partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.ConfTrackSign)); + Partition partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); Partition> partsTrackMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)); /// Partitions for particle 2 - /// Partition with all D0/D0bar mesons (which pass double and one mass hypothesis) - Partition partsAllDmesons = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)); + /// Partition with all D0/D0bar mesons (which pass double mass hypothesis) + Partition partsAllDmesons = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > 0.0f) && (aod::femtouniverseparticle::mAntiLambda > 0.0f); /// Partition with D0/D0bar candidates, which pass only one mass hypothesis Partition partsOnlyD0D0bar = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f); /// Partition with D0 mesons only (one mass hypothesis) - Partition partsD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > 0.0f) && (aod::femtouniverseparticle::mAntiLambda < 0.0f); + Partition partsD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.confMinInvMassD0D0bar) && (aod::femtouniverseparticle::mLambda < ConfDmesons.confMaxInvMassD0D0bar) && (aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition with D0bar mesons only (one mass hypothesis) - Partition partsD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f) && (aod::femtouniverseparticle::mAntiLambda > 0.0f); + Partition partsD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.confMinInvMassD0D0bar) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.confMaxInvMassD0D0bar) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition for D0/D0bar mesons from MC Partition> partsD0D0barMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)); @@ -171,33 +166,33 @@ struct femtoUniversePairTaskTrackD0 { std::vector kNsigma; /// particle part - ConfigurableAxis ConfTempFitVarBins{"ConfDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis ConfTempFitVarInvMassBins{"ConfDTempFitVarInvMassBins", {6000, 0.9, 4.0}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis ConfTempFitVarpTBins{"ConfTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; + ConfigurableAxis confTempFitVarBins{"confTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confTempFitVarInvMassBins{"confTempFitVarInvMassBins", {6000, 0.9, 4.0}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confTempFitVarpTBins{"confTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; /// Correlation part - ConfigurableAxis ConfMultBins{"ConfMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; // \todo to be obtained from the hash task - // ConfigurableAxis ConfMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; - ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - ConfigurableAxis ConfmultBins3D{"ConfmultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - - ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; - - ConfigurableAxis ConfkstarBins{"ConfkstarBins", {1500, 0., 6.}, "binning kstar"}; - ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"}; - ConfigurableAxis ConfmTBins{"ConfmTBins", {225, 0., 7.5}, "binning mT"}; - ConfigurableAxis ConfPtBins{"ConfPtBins", {360, 0., 36.}, "binning pT"}; - ConfigurableAxis ConfInvMassBins{"ConfInvMassBins", {500, 0., 5.0}, "binning inv. mass"}; - ConfigurableAxis ConfInvMassFinerBins{"ConfInvMassFinerBins", {120, 1.5848, 2.1848}, "finer binning of inv. mass"}; - - Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; - Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; - Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; + ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; // \todo to be obtained from the hash task + // ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; + ConfigurableAxis confVtxBins{"confVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis confmTBins3D{"confmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + ConfigurableAxis confmultBins3D{"confmultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + + ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; + + ConfigurableAxis confkstarBins{"confkstarBins", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis confkTBins{"confkTBins", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis confmTBins{"confmTBins", {225, 0., 7.5}, "binning mT"}; + ConfigurableAxis confPtBins{"confPtBins", {360, 0., 36.}, "binning pT"}; + ConfigurableAxis confInvMassBins{"confInvMassBins", {500, 0., 5.0}, "binning inv. mass"}; + ConfigurableAxis confInvMassFinerBins{"confInvMassFinerBins", {120, 1.5848, 2.1848}, "finer binning of inv. mass"}; + + Configurable confIsCPR{"confIsCPR", true, "Close Pair Rejection"}; + Configurable confCPRPlotPerRadii{"confCPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable confCPRdeltaPhiCutMax{"confCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable confCPRdeltaPhiCutMin{"confCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable confCPRdeltaEtaCutMax{"confCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable confCPRdeltaEtaCutMin{"confCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; + Configurable confCPRChosenRadii{"confCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; FemtoUniverseFemtoContainer sameEventFemtoCont; FemtoUniverseFemtoContainer mixedEventFemtoCont; @@ -210,18 +205,18 @@ struct femtoUniversePairTaskTrackD0 { /// Histogram output HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry MixQaRegistry{"MixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry mixQaRegistry{"mixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry registry{"registry", - {{"hInvMassD0", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", {HistType::kTH1F, {ConfInvMassBins}}}, - {"hInvMassD0bar", ";#it{M}(#pi^{-}K^{+}) (GeV/#it{c}^{2});counts", {HistType::kTH1F, {ConfInvMassBins}}}, - {"hPtDmesonCand", "2-prong candidates;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {ConfPtBins}}}, - {"hPtD0", "D^{0} cand.;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {ConfPtBins}}}, - {"hPtD0bar", "#bar{D^{0}};#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {ConfPtBins}}}, - {"hPtD0D0bar", "#bar{D^{0}};#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {ConfPtBins}}}, - {"hPhiDmesonCand", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., 2. * o2::constants::math::PI}}}}, - {"hPhiD0", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., 2. * o2::constants::math::PI}}}}, - {"hPhiD0bar", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., 2. * o2::constants::math::PI}}}}, + {{"hInvMassD0", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", {HistType::kTH1F, {confInvMassBins}}}, + {"hInvMassD0bar", ";#it{M}(#pi^{-}K^{+}) (GeV/#it{c}^{2});counts", {HistType::kTH1F, {confInvMassBins}}}, + {"hPtDmesonCand", "2-prong candidates;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, + {"hPtD0", "D^{0} cand.;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, + {"hPtD0bar", "#bar{D^{0}};#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, + {"hPtD0D0bar", "#bar{D^{0}};#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, + {"hPhiDmesonCand", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, + {"hPhiD0", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, + {"hPhiD0bar", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, {"hEtaDmesonCand", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, {"hEtaD0", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, {"hEtaD0bar", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, @@ -235,16 +230,16 @@ struct femtoUniversePairTaskTrackD0 { {"hDCAzDaughters", "; #it{DCA}_{z} (cm); counts", {HistType::kTH1F, {{140, 0., 0.14}}}}}}; // PID for protons - bool IsProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx + bool isProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx { if (mom < 0.5) { - if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfNsigmaTPCProton) { + if (std::abs(nsigmaTPCPr) < ConfBothTracks.confNsigmaTPCProton) { return true; } else { return false; } } else if (mom > 0.4) { - if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.ConfNsigmaCombinedProton) { + if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.confNsigmaCombinedProton) { return true; } else { return false; @@ -253,28 +248,28 @@ struct femtoUniversePairTaskTrackD0 { return false; } - bool IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) + bool isKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) { if (mom < 0.3) { // 0.0-0.3 - if (TMath::Abs(nsigmaTPCK) < 3.0) { + if (std::abs(nsigmaTPCK) < 3.0) { return true; } else { return false; } } else if (mom < 0.45) { // 0.30 - 0.45 - if (TMath::Abs(nsigmaTPCK) < 2.0) { + if (std::abs(nsigmaTPCK) < 2.0) { return true; } else { return false; } } else if (mom < 0.55) { // 0.45-0.55 - if (TMath::Abs(nsigmaTPCK) < 1.0) { + if (std::abs(nsigmaTPCK) < 1.0) { return true; } else { return false; } } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((TMath::Abs(nsigmaTOFK) < 3.0) && (TMath::Abs(nsigmaTPCK) < 3.0)) { + if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) { { return true; } @@ -282,7 +277,7 @@ struct femtoUniversePairTaskTrackD0 { return false; } } else if (mom > 1.5) { - if ((TMath::Abs(nsigmaTOFK) < 2.0) && (TMath::Abs(nsigmaTPCK) < 3.0)) { + if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) { return true; } else { return false; @@ -292,23 +287,23 @@ struct femtoUniversePairTaskTrackD0 { } } - bool IsPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi) + bool isPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi) { //|nsigma_TPC| < 3 for p < 0.5 GeV/c //|nsigma_combined| < 3 for p > 0.5 // using configurables: - // ConfNsigmaTPCPion -> TPC Kaon Sigma for momentum < 0.5 - // ConfNsigmaCombinedPion -> TPC and TOF Pion Sigma (combined) for momentum > 0.5 + // confNsigmaTPCPion -> TPC Kaon Sigma for momentum < 0.5 + // confNsigmaCombinedPion -> TPC and TOF Pion Sigma (combined) for momentum > 0.5 if (true) { if (mom < 0.5) { - if (TMath::Abs(nsigmaTPCPi) < ConfBothTracks.ConfNsigmaTPCPion) { + if (std::abs(nsigmaTPCPi) < ConfBothTracks.confNsigmaTPCPion) { return true; } else { return false; } } else if (mom > 0.5) { - if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfNsigmaCombinedPion) { + if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.confNsigmaCombinedPion) { return true; } else { return false; @@ -318,20 +313,20 @@ struct femtoUniversePairTaskTrackD0 { return false; } - bool IsParticleNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK) + bool isParticleNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK) { - switch (ConfTrack.ConfPDGCodeTrack) { + switch (ConfTrack.confPDGCodeTrack) { case 2212: // Proton case -2212: // anty Proton - return IsProtonNSigma(mom, nsigmaTPCPr, nsigmaTOFPr); + return isProtonNSigma(mom, nsigmaTPCPr, nsigmaTOFPr); break; case 211: // Pion case -211: // Pion- - return IsPionNSigma(mom, nsigmaTPCPi, nsigmaTOFPi); + return isPionNSigma(mom, nsigmaTPCPi, nsigmaTOFPi); break; case 321: // Kaon+ case -321: // Kaon- - return IsKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + return isKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); break; default: return false; @@ -341,32 +336,36 @@ struct femtoUniversePairTaskTrackD0 { void init(InitContext&) { eventHisto.init(&qaRegistry); + qaRegistry.add("QA_D0D0barSelection/hInvMassD0", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", kTH1F, {confInvMassBins}); + qaRegistry.add("QA_D0D0barSelection/hPtD0", "D^{0} cand.;#it{p}_{T} (GeV/#it{c});counts", kTH1F, {confPtBins}); + qaRegistry.add("QA_D0D0barSelection/hInvMassD0bar", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", kTH1F, {confInvMassBins}); + qaRegistry.add("QA_D0D0barSelection/hPtD0bar", "#bar{D^{0}} cand.;#it{p}_{T} (GeV/#it{c});counts", kTH1F, {confPtBins}); qaRegistry.add("D0_pos_daugh/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("D0_pos_daugh/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("D0_pos_daugh/pt", "; #it{p_T} (GeV/#it{c}); Counts", kTH1F, {{100, 0, 10}}); qaRegistry.add("D0_pos_daugh/eta", "; #it{eta}; Counts", kTH1F, {{200, -1.5, 1.5}}); - qaRegistry.add("D0_pos_daugh/phi", "; #it{varphi}; Counts", kTH1F, {{200, 0, 2. * M_PI}}); + qaRegistry.add("D0_pos_daugh/phi", "; #it{varphi}; Counts", kTH1F, {{200, 0, o2::constants::math::TwoPI}}); qaRegistry.add("D0_pos_daugh/hDCAxy", "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {{100, 0, 10}, {500, -5, 5}}); qaRegistry.add("D0_neg_daugh/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("D0_neg_daugh/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("D0_neg_daugh/pt", "; #it{p_T} (GeV/#it{c}); Counts", kTH1F, {{100, 0, 10}}); qaRegistry.add("D0_neg_daugh/eta", "; #it{eta}; Counts", kTH1F, {{200, -1.5, 1.5}}); - qaRegistry.add("D0_neg_daugh/phi", "; #it{varphi}; Counts", kTH1F, {{200, 0, 2. * M_PI}}); + qaRegistry.add("D0_neg_daugh/phi", "; #it{varphi}; Counts", kTH1F, {{200, 0, o2::constants::math::TwoPI}}); qaRegistry.add("D0_neg_daugh/hDCAxy", "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {{100, 0, 10}, {500, -5, 5}}); qaRegistry.add("D0bar_pos_daugh/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("D0bar_pos_daugh/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("D0bar_pos_daugh/pt", "; #it{p_T} (GeV/#it{c}); Counts", kTH1F, {{100, 0, 10}}); qaRegistry.add("D0bar_pos_daugh/eta", "; #it{eta}; Counts", kTH1F, {{200, -1.5, 1.5}}); - qaRegistry.add("D0bar_pos_daugh/phi", "; #it{varphi}; Counts", kTH1F, {{200, 0, 2. * M_PI}}); + qaRegistry.add("D0bar_pos_daugh/phi", "; #it{varphi}; Counts", kTH1F, {{200, 0, o2::constants::math::TwoPI}}); qaRegistry.add("D0bar_pos_daugh/hDCAxy", "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {{100, 0, 10}, {500, -5, 5}}); qaRegistry.add("D0bar_neg_daugh/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("D0bar_neg_daugh/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("D0bar_neg_daugh/pt", "; #it{p_T} (GeV/#it{c}); Counts", kTH1F, {{100, 0, 10}}); qaRegistry.add("D0bar_neg_daugh/eta", "; #it{eta}; Counts", kTH1F, {{200, -1.5, 1.5}}); - qaRegistry.add("D0bar_neg_daugh/phi", "; #it{varphi}; Counts", kTH1F, {{200, 0, 2. * M_PI}}); + qaRegistry.add("D0bar_neg_daugh/phi", "; #it{varphi}; Counts", kTH1F, {{200, 0, o2::constants::math::TwoPI}}); qaRegistry.add("D0bar_neg_daugh/hDCAxy", "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {{100, 0, 10}, {500, -5, 5}}); qaRegistry.add("Hadron/nSigmaTPCPr", "; #it{p} (GeV/#it{c}); n#sigma_{TPCPr}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); @@ -376,37 +375,36 @@ struct femtoUniversePairTaskTrackD0 { qaRegistry.add("Hadron/nSigmaTPCKa", "; #it{p} (GeV/#it{c}); n#sigma_{TPCKa}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Hadron/nSigmaTOFKa", "; #it{p} (GeV/#it{c}); n#sigma_{TOFKa}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - trackHistoPartD0D0bar.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarInvMassBins, ConfBothTracks.ConfIsMC, ConfDmesons.ConfPDGCodeD0); - if (!ConfTrack.ConfIsSame) { - trackHistoPartTrack.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarBins, ConfBothTracks.ConfIsMC, ConfTrack.ConfPDGCodeTrack); + trackHistoPartD0D0bar.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarInvMassBins, ConfBothTracks.confIsMC, ConfDmesons.confPDGCodeD0); + if (!ConfTrack.confIsSame) { + trackHistoPartTrack.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarBins, ConfBothTracks.confIsMC, ConfTrack.confPDGCodeTrack); } - MixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - MixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + mixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - sameEventFemtoCont.init(&resultRegistry, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfBothTracks.ConfIsMC, ConfBothTracks.ConfUse3D); - mixedEventFemtoCont.init(&resultRegistry, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfBothTracks.ConfIsMC, ConfBothTracks.ConfUse3D); - sameEventAngularCont.init(&resultRegistry, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfBothTracks.ConfEtaBins, ConfBothTracks.ConfPhiBins, ConfBothTracks.ConfIsMC, ConfBothTracks.ConfUse3D); - mixedEventAngularCont.init(&resultRegistry, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfBothTracks.ConfEtaBins, ConfBothTracks.ConfPhiBins, ConfBothTracks.ConfIsMC, ConfBothTracks.ConfUse3D); + sameEventFemtoCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confmultBins3D, confmTBins3D, ConfBothTracks.confIsMC, ConfBothTracks.confUse3D); + mixedEventFemtoCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confmultBins3D, confmTBins3D, ConfBothTracks.confIsMC, ConfBothTracks.confUse3D); + sameEventAngularCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confmultBins3D, confmTBins3D, ConfBothTracks.confEtaBins, ConfBothTracks.confPhiBins, ConfBothTracks.confIsMC, ConfBothTracks.confUse3D); + mixedEventAngularCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confmultBins3D, confmTBins3D, ConfBothTracks.confEtaBins, ConfBothTracks.confPhiBins, ConfBothTracks.confIsMC, ConfBothTracks.confUse3D); - sameEventFemtoCont.setPDGCodes(ConfDmesons.ConfPDGCodeD0, ConfTrack.ConfPDGCodeTrack); - mixedEventFemtoCont.setPDGCodes(ConfDmesons.ConfPDGCodeD0, ConfTrack.ConfPDGCodeTrack); - sameEventAngularCont.setPDGCodes(ConfDmesons.ConfPDGCodeD0, ConfTrack.ConfPDGCodeTrack); - mixedEventAngularCont.setPDGCodes(ConfDmesons.ConfPDGCodeD0, ConfTrack.ConfPDGCodeTrack); + sameEventFemtoCont.setPDGCodes(ConfDmesons.confPDGCodeD0, ConfTrack.confPDGCodeTrack); + mixedEventFemtoCont.setPDGCodes(ConfDmesons.confPDGCodeD0, ConfTrack.confPDGCodeTrack); + sameEventAngularCont.setPDGCodes(ConfDmesons.confPDGCodeD0, ConfTrack.confPDGCodeTrack); + mixedEventAngularCont.setPDGCodes(ConfDmesons.confPDGCodeD0, ConfTrack.confPDGCodeTrack); pairCleaner.init(&qaRegistry); - if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + if (confIsCPR.value) { + pairCloseRejection.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value); } - vPIDTrack = ConfTrack.ConfPIDTrack.value; - kNsigma = ConfBothTracks.ConfTrkPIDnSigmaMax.value; + vPIDTrack = ConfTrack.confPIDTrack.value; + kNsigma = ConfBothTracks.confTrkPIDnSigmaMax.value; // D0/D0bar histograms auto vbins = (std::vector)binsPt; - registry.add("hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {ConfInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassVsPtFinerBinning", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {ConfInvMassFinerBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hInvMassVsPtOnlyD0D0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {ConfInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtFinerBinning", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassFinerBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hDeltaPhiSigSig", "SxS correlation;#Delta#varphi (rad);counts", {HistType::kTH1F, {{10, 0.0, o2::constants::math::PI}}}); registry.add("hDeltaPhiD0BgD0barSig", "B(D0)x S(D0bar) correlation;#Delta#varphi (rad);counts", {HistType::kTH1F, {{10, 0.0, o2::constants::math::PI}}}); registry.add("hDeltaPhiD0SigD0barBg", "S(D0)x B(D0bar) correlation;#Delta#varphi (rad);counts", {HistType::kTH1F, {{10, 0.0, o2::constants::math::PI}}}); @@ -418,11 +416,31 @@ struct femtoUniversePairTaskTrackD0 { template void fillCollision(CollisionType col) { - MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); + mixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); eventHisto.fillQA(col); } - void processD0mesons(o2::aod::FDCollision& col, FemtoFullParticles&) + void processQAD0D0barSel(o2::aod::FDCollision const& col, FemtoFullParticles const&) + { + auto groupPartsD0s = partsD0s->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupPartsD0bars = partsD0bars->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + + // loop over selected D0 candidates + for (auto const& d0cand : groupPartsD0s) { + + qaRegistry.fill(HIST("QA_D0D0barSelection/hInvMassD0"), d0cand.mLambda()); + qaRegistry.fill(HIST("QA_D0D0barSelection/hPtD0"), d0cand.pt()); + } + // loop over selected D0bar candidates + for (auto const& d0barcand : groupPartsD0bars) { + + qaRegistry.fill(HIST("QA_D0D0barSelection/hInvMassD0bar"), d0barcand.mAntiLambda()); + qaRegistry.fill(HIST("QA_D0D0barSelection/hPtD0bar"), d0barcand.pt()); + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processQAD0D0barSel, "Enable filling QA plots for selected D0/D0bar cand.", true); + + void processD0mesons(o2::aod::FDCollision const& col, FemtoFullParticles const&) { auto groupPartsOnlyD0D0bar = partsOnlyD0D0bar->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsAllDmesons = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); @@ -431,16 +449,6 @@ struct femtoUniversePairTaskTrackD0 { // loop over all D mesons for (auto const& dmeson : groupPartsAllDmesons) { - if (dmeson.mLambda() > 0.0f) { - registry.fill(HIST("hMassVsPt"), dmeson.mLambda(), dmeson.pt()); - registry.fill(HIST("hMassVsPtFinerBinning"), dmeson.mLambda(), dmeson.pt()); - } - - if (dmeson.mAntiLambda() > 0.0f) { - registry.fill(HIST("hMassVsPt"), dmeson.mAntiLambda(), dmeson.pt()); - registry.fill(HIST("hMassVsPtFinerBinning"), dmeson.mAntiLambda(), dmeson.pt()); - } - registry.fill(HIST("hPtDmesonCand"), dmeson.pt()); registry.fill(HIST("hPhiDmesonCand"), dmeson.phi()); registry.fill(HIST("hEtaDmesonCand"), dmeson.eta()); @@ -452,19 +460,15 @@ struct femtoUniversePairTaskTrackD0 { registry.fill(HIST("hPtD0D0bar"), d0d0bar.pt()); if (d0d0bar.mLambda() > 0.0f && d0d0bar.mAntiLambda() < 0.0f) { - registry.fill(HIST("hInvMassVsPtOnlyD0D0bar"), d0d0bar.mLambda(), d0d0bar.pt()); - if (d0d0bar.mLambda() > ConfDmesons.ConfMinInvMassD0D0bar && d0d0bar.mLambda() < ConfDmesons.ConfMaxInvMassD0D0bar) { - registry.fill(HIST("hInvMassD0"), d0d0bar.mLambda()); - } + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("hInvMassD0"), d0d0bar.mLambda()); registry.fill(HIST("hPtD0"), d0d0bar.pt()); registry.fill(HIST("hPhiD0"), d0d0bar.phi()); registry.fill(HIST("hEtaD0"), d0d0bar.eta()); } if (d0d0bar.mLambda() < 0.0f && d0d0bar.mAntiLambda() > 0.0f) { - registry.fill(HIST("hInvMassVsPtOnlyD0D0bar"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - if (d0d0bar.mAntiLambda() > ConfDmesons.ConfMinInvMassD0D0bar && d0d0bar.mAntiLambda() < ConfDmesons.ConfMaxInvMassD0D0bar) { - registry.fill(HIST("hInvMassD0bar"), d0d0bar.mAntiLambda()); - } + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mAntiLambda(), d0d0bar.pt()); + registry.fill(HIST("hInvMassD0bar"), d0d0bar.mAntiLambda()); registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); @@ -501,10 +505,10 @@ struct femtoUniversePairTaskTrackD0 { } } } - PROCESS_SWITCH(femtoUniversePairTaskTrackD0, processD0mesons, "Enable processing D0 mesons", true); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processD0mesons, "Enable processing D0 mesons", true); // D0-D0bar pair correlations (side-band methode) - void processSideBand(o2::aod::FDCollision& col, FemtoFullParticles&) + void processSideBand(o2::aod::FDCollision const& col, FemtoFullParticles const&) { auto groupPartsOnlyD0D0bar = partsOnlyD0D0bar->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); @@ -532,33 +536,33 @@ struct femtoUniversePairTaskTrackD0 { registry.fill(HIST("hDeltaEtaDeltaPhi"), deltaEta, deltaPhi); // ----------------------------------- Creating D0-D0bar pairs correlations ------------------------------------------------ - if (cand1.mLambda() > ConfD0D0barSideBand.ConfSignalRegionMin.value && cand1.mLambda() < ConfD0D0barSideBand.ConfSignalRegionMax.value) { + if (cand1.mLambda() > ConfD0D0barSideBand.confSignalRegionMin.value && cand1.mLambda() < ConfD0D0barSideBand.confSignalRegionMax.value) { // S(D0) x S(D0bar) correlation - if (cand2.mAntiLambda() > ConfD0D0barSideBand.ConfSignalRegionMin.value && cand2.mAntiLambda() < ConfD0D0barSideBand.ConfSignalRegionMax.value) { + if (cand2.mAntiLambda() > ConfD0D0barSideBand.confSignalRegionMin.value && cand2.mAntiLambda() < ConfD0D0barSideBand.confSignalRegionMax.value) { registry.fill(HIST("hDeltaPhiSigSig"), deltaPhi); } // S(D0) x B(D0bar) correlation - if ((cand2.mAntiLambda() > ConfD0D0barSideBand.ConfMinInvMassLeftSB.value && cand2.mAntiLambda() < ConfD0D0barSideBand.ConfMaxInvMassLeftSB.value) || - (cand2.mAntiLambda() > ConfD0D0barSideBand.ConfMinInvMassRightSB.value && cand2.mAntiLambda() < ConfD0D0barSideBand.ConfMaxInvMassRightSB.value)) { + if ((cand2.mAntiLambda() > ConfD0D0barSideBand.confMinInvMassLeftSB.value && cand2.mAntiLambda() < ConfD0D0barSideBand.confMaxInvMassLeftSB.value) || + (cand2.mAntiLambda() > ConfD0D0barSideBand.confMinInvMassRightSB.value && cand2.mAntiLambda() < ConfD0D0barSideBand.confMaxInvMassRightSB.value)) { registry.fill(HIST("hDeltaPhiD0SigD0barBg"), deltaPhi); } } - if ((cand1.mLambda() > ConfD0D0barSideBand.ConfMinInvMassLeftSB.value && cand1.mLambda() < ConfD0D0barSideBand.ConfMaxInvMassLeftSB.value) || - (cand1.mLambda() > ConfD0D0barSideBand.ConfMinInvMassRightSB.value && cand1.mLambda() < ConfD0D0barSideBand.ConfMaxInvMassRightSB.value)) { + if ((cand1.mLambda() > ConfD0D0barSideBand.confMinInvMassLeftSB.value && cand1.mLambda() < ConfD0D0barSideBand.confMaxInvMassLeftSB.value) || + (cand1.mLambda() > ConfD0D0barSideBand.confMinInvMassRightSB.value && cand1.mLambda() < ConfD0D0barSideBand.confMaxInvMassRightSB.value)) { // B(D0) x S (D0bar) correlation - if (cand2.mAntiLambda() > ConfD0D0barSideBand.ConfSignalRegionMin.value && cand2.mAntiLambda() < ConfD0D0barSideBand.ConfSignalRegionMax.value) { + if (cand2.mAntiLambda() > ConfD0D0barSideBand.confSignalRegionMin.value && cand2.mAntiLambda() < ConfD0D0barSideBand.confSignalRegionMax.value) { registry.fill(HIST("hDeltaPhiD0BgD0barSig"), deltaPhi); } // B(D0) x B(D0bar) correlation - if ((cand2.mAntiLambda() > ConfD0D0barSideBand.ConfMinInvMassLeftSB.value && cand2.mAntiLambda() < ConfD0D0barSideBand.ConfMaxInvMassLeftSB.value) || - (cand2.mAntiLambda() > ConfD0D0barSideBand.ConfMinInvMassRightSB.value && cand2.mAntiLambda() < ConfD0D0barSideBand.ConfMaxInvMassRightSB.value)) { + if ((cand2.mAntiLambda() > ConfD0D0barSideBand.confMinInvMassLeftSB.value && cand2.mAntiLambda() < ConfD0D0barSideBand.confMaxInvMassLeftSB.value) || + (cand2.mAntiLambda() > ConfD0D0barSideBand.confMinInvMassRightSB.value && cand2.mAntiLambda() < ConfD0D0barSideBand.confMaxInvMassRightSB.value)) { registry.fill(HIST("hDeltaPhiBgBg"), deltaPhi); } } } // It is the end of the for loop over D0bar mesons } // It is the end of the for loop over all candidates } - PROCESS_SWITCH(femtoUniversePairTaskTrackD0, processSideBand, "Enable processing side-band methode", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSideBand, "Enable processing side-band methode", false); /// This function processes the same event and takes care of all the histogramming /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... @@ -575,16 +579,16 @@ struct femtoUniversePairTaskTrackD0 { { /// Histogramming same event - for (auto& d0candidate : groupPartsD0) { + for (auto const& d0candidate : groupPartsD0) { trackHistoPartD0D0bar.fillQA(d0candidate); } float tpcNSigmaPr, tofNSigmaPr, tpcNSigmaPi, tofNSigmaPi, tpcNSigmaKa, tofNSigmaKa; - if (!ConfTrack.ConfIsSame) { - for (auto& track : groupPartsTrack) { - if (ConfTrack.ConfIsTrackIdentified) { - if (!IsParticleNSigma(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) { + if (!ConfTrack.confIsSame) { + for (auto const& track : groupPartsTrack) { + if (ConfTrack.confIsTrackIdentified) { + if (!isParticleNSigma(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) { continue; } } @@ -606,26 +610,14 @@ struct femtoUniversePairTaskTrackD0 { } } /// Now build the combinations - for (auto& [track, d0candidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsD0))) { - if (ConfTrack.ConfIsTrackIdentified) { - if (!IsParticleNSigma(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) { - continue; - } - } - // // Set pT cut for D0/D0bar candidates - if (ConfUsePtCutForD0D0bar) { - if (d0candidate.pt() < ConfDmesons.ConfMinPtD0D0bar && d0candidate.pt() > ConfDmesons.ConfMaxPtD0D0bar) { - continue; - } - } - // // Set inv. mass cut for D0/D0bar candidates - if (ConfUseMassCutForD0D0bar) { - if ((d0candidate.mLambda() < ConfD0D0barSideBand.ConfSignalRegionMin && d0candidate.mLambda() > ConfD0D0barSideBand.ConfSignalRegionMax) || (d0candidate.mAntiLambda() < ConfD0D0barSideBand.ConfSignalRegionMin && d0candidate.mAntiLambda() > ConfD0D0barSideBand.ConfSignalRegionMax)) { + for (auto const& [track, d0candidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsD0))) { + if (ConfTrack.confIsTrackIdentified) { + if (!isParticleNSigma(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) { continue; } } // // Close Pair Rejection - if (ConfIsCPR.value) { + if (confIsCPR.value) { if (pairCloseRejection.isClosePair(track, d0candidate, parts, magFieldTesla, femtoUniverseContainer::EventType::same)) { continue; } @@ -635,16 +627,16 @@ struct femtoUniversePairTaskTrackD0 { if (!pairCleaner.isCleanPair(track, d0candidate, parts)) { continue; } - sameEventFemtoCont.setPair(track, d0candidate, multCol, ConfBothTracks.ConfUse3D); - sameEventAngularCont.setPair(track, d0candidate, multCol, ConfBothTracks.ConfUse3D); + sameEventFemtoCont.setPair(track, d0candidate, multCol, ConfBothTracks.confUse3D); + sameEventAngularCont.setPair(track, d0candidate, multCol, ConfBothTracks.confUse3D); } } /// process function for to call doSameEvent with Data /// \param col subscribe to the collision table (Data) /// \param parts subscribe to the femtoUniverseParticleTable - void processSameEvent(o2::aod::FDCollision& col, - FemtoFullParticles& parts) + void processSameEvent(o2::aod::FDCollision const& col, + FemtoFullParticles const& parts) { fillCollision(col); @@ -654,7 +646,7 @@ struct femtoUniversePairTaskTrackD0 { auto theGroupPartsD0s = partsD0s->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto theGroupPartsD0bars = partsD0bars->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - switch (ConfChooseD0trackCorr) { + switch (confChooseD0trackCorr) { case 0: doSameEvent(thegroupPartsTrack, theGroupPartsD0s, parts, col.magField(), col.multNtr()); break; @@ -666,19 +658,20 @@ struct femtoUniversePairTaskTrackD0 { break; case 3: doSameEvent(thegroupPartsTrack, thegroupPartsAllD0D0bar, parts, col.magField(), col.multNtr()); + break; default: break; } } - PROCESS_SWITCH(femtoUniversePairTaskTrackD0, processSameEvent, "Enable processing same event", true); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSameEvent, "Enable processing same event", true); /// process function for to call doSameEvent with Monte Carlo /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processSameEventMC(o2::aod::FDCollision& col, - soa::Join& parts, - o2::aod::FDMCParticles&) + void processSameEventMC(o2::aod::FDCollision const& col, + soa::Join const& parts, + o2::aod::FDMCParticles const&) { fillCollision(col); @@ -687,7 +680,7 @@ struct femtoUniversePairTaskTrackD0 { doSameEvent(thegroupPartsTrack, thegroupPartsD0, parts, col.magField(), col.multNtr()); } - PROCESS_SWITCH(femtoUniversePairTaskTrackD0, processSameEventMC, "Enable processing same event for Monte Carlo", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSameEventMC, "Enable processing same event for Monte Carlo", false); /// This function processes the mixed event /// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... @@ -703,46 +696,34 @@ struct femtoUniversePairTaskTrackD0 { void doMixedEvent(PartitionType groupPartsTrack, PartitionType groupPartsD0, PartType parts, float magFieldTesla, int multCol) { - for (auto& [track, d0candidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsD0))) { - if (ConfTrack.ConfIsTrackIdentified) { - if (!IsParticleNSigma(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) { - continue; - } - } - // // Set pT cut for D0/D0bar candidates - if (ConfUsePtCutForD0D0bar) { - if (d0candidate.pt() < ConfDmesons.ConfMinPtD0D0bar && d0candidate.pt() > ConfDmesons.ConfMaxPtD0D0bar) { - continue; - } - } - // // Set inv. mass cut for D0/D0bar candidates - if (ConfUseMassCutForD0D0bar) { - if ((d0candidate.mLambda() < ConfD0D0barSideBand.ConfSignalRegionMin && d0candidate.mLambda() > ConfD0D0barSideBand.ConfSignalRegionMax) || (d0candidate.mAntiLambda() < ConfD0D0barSideBand.ConfSignalRegionMin && d0candidate.mAntiLambda() > ConfD0D0barSideBand.ConfSignalRegionMax)) { + for (auto const& [track, d0candidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsD0))) { + if (ConfTrack.confIsTrackIdentified) { + if (!isParticleNSigma(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) { continue; } } // // Close Pair Rejection - if (ConfIsCPR.value) { + if (confIsCPR.value) { if (pairCloseRejection.isClosePair(track, d0candidate, parts, magFieldTesla, femtoUniverseContainer::EventType::mixed)) { continue; } } - mixedEventFemtoCont.setPair(track, d0candidate, multCol, ConfBothTracks.ConfUse3D); - mixedEventAngularCont.setPair(track, d0candidate, multCol, ConfBothTracks.ConfUse3D); + mixedEventFemtoCont.setPair(track, d0candidate, multCol, ConfBothTracks.confUse3D); + mixedEventAngularCont.setPair(track, d0candidate, multCol, ConfBothTracks.confUse3D); } } /// process function for to call doMixedEvent with Data /// @param cols subscribe to the collisions table (Data) /// @param parts subscribe to the femtoUniverseParticleTable - void processMixedEvent(o2::aod::FDCollisions& cols, - FemtoFullParticles& parts) + void processMixedEvent(o2::aod::FDCollisions const& cols, + FemtoFullParticles const& parts) { - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { const int multiplicityCol = collision1.multNtr(); - MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); auto groupPartsTrack = partsTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); auto groupPartsAllD0D0bar = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); @@ -757,9 +738,9 @@ struct femtoUniversePairTaskTrackD0 { continue; } /// \todo before mixing we should check whether both collisions contain a pair of particles! - // if (partsD0.size() == 0 || nPart2Evt1 == 0 || nPart1Evt2 == 0 || partsTrack.size() == 0 ) continue; + // if (partsD0.size() == 0 || kNPart2Evt1 == 0 || kNPart1Evt2 == 0 || partsTrack.size() == 0 ) continue; - switch (ConfChooseD0trackCorr) { + switch (confChooseD0trackCorr) { case 0: doMixedEvent(groupPartsTrack, theGroupPartsD0s, parts, magFieldTesla1, multiplicityCol); break; @@ -771,25 +752,26 @@ struct femtoUniversePairTaskTrackD0 { break; case 3: doMixedEvent(groupPartsTrack, groupPartsAllD0D0bar, parts, magFieldTesla1, multiplicityCol); + break; default: break; } } } - PROCESS_SWITCH(femtoUniversePairTaskTrackD0, processMixedEvent, "Enable processing mixed events", true); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEvent, "Enable processing mixed events", true); /// brief process function for to call doMixedEvent with Monte Carlo /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processMixedEventMC(o2::aod::FDCollisions& cols, - soa::Join& parts, - o2::aod::FDMCParticles&) + void processMixedEventMC(o2::aod::FDCollisions const& cols, + soa::Join const& parts, + o2::aod::FDMCParticles const&) { - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { const int multiplicityCol = collision1.multNtr(); - MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); auto groupPartsTrack = partsTrackMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); auto groupPartsD0 = partsD0D0barMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); @@ -801,18 +783,18 @@ struct femtoUniversePairTaskTrackD0 { continue; } /// \todo before mixing we should check whether both collisions contain a pair of particles! - // if (partsD0.size() == 0 || nPart2Evt1 == 0 || nPart1Evt2 == 0 || partsTrack.size() == 0 ) continue; + // if (partsD0.size() == 0 || kNPart2Evt1 == 0 || kNPart1Evt2 == 0 || partsTrack.size() == 0 ) continue; doMixedEvent(groupPartsTrack, groupPartsD0, parts, magFieldTesla1, multiplicityCol); } } - PROCESS_SWITCH(femtoUniversePairTaskTrackD0, processMixedEventMC, "Enable processing mixed events MC", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventMC, "Enable processing mixed events MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), }; return workflow; } diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackNucleus.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackNucleus.cxx new file mode 100644 index 00000000000..74b265cd766 --- /dev/null +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackNucleus.cxx @@ -0,0 +1,845 @@ +// Copyright 2019-2022 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file femtoUniversePairTaskTrackNucleus.cxx +/// \brief Tasks that reads the track tables used for the pairing and builds pairs of a track and a nucleus +/// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de +/// \author Georgios Mantzaridis, TU München, georgios.mantzaridis@tum.de +/// \author Anton Riedel, TU München, anton.riedel@tum.de +/// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch +/// \author Alicja Płachta, WUT Warsaw, alicja.plachta.stud@pw.edu.pl +/// \author Anna-Mariia Andrushko, WUT Warsaw, anna-mariia.andrushko@cern.ch + +#include +#include +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "ReconstructionDataFormats/PID.h" +#include "Common/DataModel/PIDResponse.h" + +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUtils.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h" + +using namespace o2; +using namespace o2::analysis::femtoUniverse; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +namespace +{ +static constexpr int nPart = 2; +static constexpr int nCuts = 5; +static const std::vector partNames{"Track", "Nucleus"}; +static const std::vector cutNames{"MaxPt", "PIDthr", "nSigmaTPC", "nSigmaTPCTOF", "MaxP"}; +static const float cutsTable[nPart][nCuts]{{4.05f, 1.f, 3.f, 3.f, 100.f}, {4.05f, 1.f, 3.f, 3.f, 100.f}}; +} // namespace + +struct femtoUniversePairTaskTrackNucleus { + + Service pdg; + + /// Selection part + + /// Table for both objects + struct : o2::framework::ConfigurableGroup { + Configurable IsKaonNsigma{"IsKaonNsigma", false, "Enable a strict cut selection for K+ and K-"}; + Configurable ConfNsigmaCombined{"ConfNsigmaCombined", 3.0f, "TPC and TOF Pion Sigma (combined) for momentum > ConfTOFpMin"}; + Configurable ConfNsigmaTPC{"ConfNsigmaTPC", 3.0f, "TPC Pion Sigma for momentum < ConfTOFpMin"}; + Configurable ConfTOFpMin{"ConfTOFpMin", 0.45f, "Min. momentum for which TOF is required for PID."}; + Configurable ConfEtaMax{"ConfEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"}; + + Configurable> ConfCutTable{"ConfCutTable", {cutsTable[0], nPart, nCuts, partNames, cutNames}, "Particle selections"}; + Configurable ConfNspecies{"ConfNspecies", 2, "Number of particle spieces with PID info"}; + Configurable ConfIsMC{"ConfIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; + Configurable> ConfTrkPIDnSigmaMax{"ConfTrkPIDnSigmaMax", std::vector{4.f, 3.f, 2.f}, "This configurable needs to be the same as the one used in the producer task"}; + Configurable ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; + } twoobjectsconfigs; + + /// Table for separate deuteron configurables + struct : o2::framework::ConfigurableGroup { + Configurable ConfNsigmaTPCDe{"ConfNsigmaTPCDe", 2.0f, "TPC Deuteron Sigma for momentum < ConfTOFpMinDe"}; + Configurable ConfNsigmaTOFDe{"ConfNsigmaTOFDe", 2.0f, "TOF Deuteron Sigma"}; + Configurable ConfTOFpMinDe{"ConfTOFpMinDe", 1.0f, "Min. momentum for deuterons for which TOF is required for PID"}; + Configurable ConfPLowDe{"ConfPLowDe", 0.8f, "Lower limit for momentum for deuterons"}; + Configurable ConfPHighDe{"ConfPHighDe", 1.8f, "Higher limit for momentum for deuterons"}; + } deuteronconfigs; + + /// Table for linear cut for TPC Deuteron Sigma + struct : o2::framework::ConfigurableGroup { + Configurable ConfIsLine{"ConfIsLine", false, "Enable a separation line for clearer TPC Deuteron Sigma"}; + Configurable LinCutpLow{"LinCutpLow", 0.0f, "Lower limit of momentum for linear cut of TPC Deuteron Sigma"}; + Configurable LinCutpHigh{"LinCutpHigh", 1.4f, "Higher limit of momentum for linear cut of TPC Deuteron Sigma"}; + Configurable LinCutParA{"LinCutParA", -167.0f, "Parameter 'A' of a linear function 'y = A * x + B'"}; + Configurable LinCutParB{"LinCutParB", 300.0f, "Parameter 'B' of a linear function 'y = A * x + B'"}; + } lincut; + + /// Table for polynomial 3 cut for TPC Deuteron Sigma + struct : o2::framework::ConfigurableGroup { + Configurable ConfIsPol{"ConfIsPol", false, "Enable a separation polynomial 3 curve for clearer TPC Deuteron Sigma"}; + Configurable PolCutParA{"PolCutParA", -52.2f, "Parameter 'A' of a polynomial function 'y = A * x^3 + B * x^2 + C * x + D'"}; + Configurable PolCutParB{"PolCutParB", 357.7f, "Parameter 'B' of a polynomial function 'y = A * x^3 + B * x^2 + C * x + D'"}; + Configurable PolCutParC{"PolCutParC", -834.7f, "Parameter 'C' of a polynomial function 'y = A * x^3 + B * x^2 + C * x + D'"}; + Configurable PolCutParD{"PolCutParD", 705.8f, "Parameter 'D' of a polynomial function 'y = A * x^3 + B * x^2 + C * x + D'"}; + } polcut; + + using FemtoFullParticles = soa::Join; + + // Filters for selection + Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twoobjectsconfigs.ConfEtaMax); // example filtering on configurable + using FilteredFemtoFullParticles = soa::Filtered; + // using FilteredFemtoFullParticles = FemtoFullParticles; //if no filtering is applied uncomment this option + + SliceCache cache; + Preslice perCol = aod::femtouniverseparticle::fdCollisionId; + + /// Track + struct : o2::framework::ConfigurableGroup { + Configurable ConfPDGCodeTrack{"ConfPDGCodeTrack", 321, "Track -- PDG code"}; + // Configurable ConfCutTrack{"ConfCutTrack", 5542474, "Track -- Selection bit from cutCulator"}; + Configurable ConfPIDTrack{"ConfPIDTrack", 3, "Track -- Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector>int>> + Configurable ConfPtLowTrack{"ConfPtLowTrack", 0.14, "Lower pT limit for track"}; + Configurable ConfPtHighTrack{"ConfPtHighTrack", 1.5, "Higher pT limit for track"}; + Configurable ConfChargeTrack{"ConfChargeTrack", 1, "Track sign"}; // -1 means anti-particle + } trackfilter; + + /// Partition for track + Partition partTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackfilter.ConfChargeTrack && aod::femtouniverseparticle::pt < trackfilter.ConfPtHighTrack && aod::femtouniverseparticle::pt > trackfilter.ConfPtLowTrack; + + Partition> partTrackMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackfilter.ConfChargeTrack && aod::femtouniverseparticle::pt < trackfilter.ConfPtHighTrack && aod::femtouniverseparticle::pt > trackfilter.ConfPtLowTrack; + + /// Histogramming for track + FemtoUniverseParticleHisto trackHistoTrack; + + /// Nucleus + struct : o2::framework::ConfigurableGroup { + Configurable ConfPDGCodeNucleus{"ConfPDGCodeNucleus", 1000010020, "Nucleus -- PDG code"}; + // Configurable ConfCutNucleus{"ConfCutNucleus", 5542474, "Nucleus -- Selection bit"}; + Configurable ConfPIDNucleus{"ConfPIDNucleus", 5, "Nucleus -- Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> + Configurable ConfPtLowNucleus{"ConfPtLowNucleus", 0, "Lower pT limit for nucleus"}; + Configurable ConfPtHighNucleus{"ConfPtHighNucleus", 5, "Higher pT limit for nucleus"}; + Configurable ConfChargeNucleus{"ConfChargeNucleus", 1, "Nucleus sign"}; // -1 means anti-nucleus + } nucleusfilter; + + /// Partition for nucleus + Partition partNucleus = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == nucleusfilter.ConfChargeNucleus) && aod::femtouniverseparticle::pt < nucleusfilter.ConfPtHighNucleus && aod::femtouniverseparticle::pt > nucleusfilter.ConfPtLowNucleus; + + Partition> partNucleusMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == nucleusfilter.ConfChargeNucleus) && aod::femtouniverseparticle::pt < nucleusfilter.ConfPtHighNucleus && aod::femtouniverseparticle::pt > nucleusfilter.ConfPtLowNucleus; + + /// Histogramming for nucleus + FemtoUniverseParticleHisto trackHistoNucleus; + + /// Histogramming for Event + FemtoUniverseEventHisto eventHisto; + + /// The configurables need to be passed to an std::vector + int vPIDTrack, vPIDNucleus; + std::vector kNsigma; + + /// Event part + Configurable ConfV0MLow{"ConfV0MLow", 0.0, "Lower limit for V0M multiplicity"}; + Configurable ConfV0MHigh{"ConfV0MHigh", 25000.0, "Upper limit for V0M multiplicity"}; + Configurable ConfSphericityCutMin{"ConfSphericityCutMin", 0, "Min. sphericity"}; + Configurable ConfSphericityCutMax{"ConfSphericityCutMax", 3, "Max. sphericity"}; + + Filter collV0Mfilter = ((o2::aod::femtouniversecollision::multV0M > ConfV0MLow) && (o2::aod::femtouniversecollision::multV0M < ConfV0MHigh)); + Filter colSpherfilter = ((o2::aod::femtouniversecollision::sphericity > ConfSphericityCutMin) && (o2::aod::femtouniversecollision::sphericity < ConfSphericityCutMax)); + // Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twoobjectsconfigs.ConfEtaMax); // example filtering on configurable + + /// Particle part + ConfigurableAxis ConfTempFitVarBins{"ConfDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis ConfTempFitVarpTBins{"ConfTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; + + /// Correlation part + ConfigurableAxis ConfMultBins{"ConfMultBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 99999.f}, "Mixing bins -- multiplicity or centrality"}; // \todo to be obtained from the hash task + ConfigurableAxis ConfMultKstarBins{"ConfMultKstarBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 100.0f, 99999.f}, "Bins for kstar analysis in multiplicity or centrality bins (10 is maximum)"}; + ConfigurableAxis ConfKtKstarBins{"ConfKtKstarBins", {VARIABLE_WIDTH, 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f, 2.0f, 99999.f}, "Bins for kstar analysis in kT bins (10 is maximum)"}; + ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins -- z-vertex"}; + + ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + ConfigurableAxis ConfmultBins3D{"ConfmultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + + ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; + + ConfigurableAxis ConfkstarBins{"ConfkstarBins", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis ConfmTBins{"ConfmTBins", {225, 0., 7.5}, "binning mT"}; + Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; + Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; + Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; + Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; + + Configurable cfgProcessPP{"cfgProcessPP", true, "Process positively charged particles (plus-plus)"}; + Configurable cfgProcessMM{"cfgProcessMM", true, "Process negatively charged particles (minus-minus)"}; + Configurable cfgProcessPM{"cfgProcessPM", false, "Process differently charged particles (plus-minus)"}; + Configurable cfgProcessMP{"cfgProcessMP", false, "Process differently charged particles (minus-plus)"}; + Configurable cfgProcessMultBins{"cfgProcessMultBins", true, "Process kstar histograms (in multiplicity bins)"}; + Configurable cfgProcessKtBins{"cfgProcessKtBins", true, "Process kstar histograms in kT bins (if 'cfgProcessMultBins' is false, it will not be processed regardless of 'cfgProcessKtBins' state)"}; + Configurable cfgProcessKtMt3DCF{"cfgProcessKtMt3DCF", false, "Process 3D histograms in kT and MultBins"}; + + FemtoUniverseFemtoContainer sameEventContPP; + FemtoUniverseFemtoContainer mixedEventContPP; + + FemtoUniverseFemtoContainer sameEventContMM; + FemtoUniverseFemtoContainer mixedEventContMM; + + FemtoUniverseFemtoContainer sameEventContPM; + FemtoUniverseFemtoContainer mixedEventContPM; + + FemtoUniverseFemtoContainer sameEventContMP; + FemtoUniverseFemtoContainer mixedEventContMP; + + FemtoUniversePairCleaner pairCleaner; + FemtoUniverseDetaDphiStar pairCloseRejection; + FemtoUniverseTrackSelection trackCuts; + + PairWithCentMultKt sameEventMultContPP; + PairWithCentMultKt mixedEventMultContPP; + + PairWithCentMultKt sameEventMultContMM; + PairWithCentMultKt mixedEventMultContMM; + + PairWithCentMultKt sameEventMultContPM; + PairWithCentMultKt mixedEventMultContPM; + + PairWithCentMultKt sameEventMultContMP; + PairWithCentMultKt mixedEventMultContMP; + + float mass1 = -1; + float mass2 = -1; + + /// Histogram output + HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistryPP{"CorrelationsPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistryMM{"CorrelationsMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistryPM{"CorrelationsPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistryMP{"CorrelationsMP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry MixQaRegistry{"MixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + HistogramRegistry SameMultRegistryPP{"SameMultRegistryPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry MixedMultRegistryPP{"MixedMultRegistryPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + HistogramRegistry SameMultRegistryMM{"SameMultRegistryMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry MixedMultRegistryMM{"MixedMultRegistryMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + HistogramRegistry SameMultRegistryPM{"SameMultRegistryPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry MixedMultRegistryPM{"MixedMultRegistryPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + HistogramRegistry SameMultRegistryMP{"SameMultRegistryMP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry MixedMultRegistryMP{"MixedMultRegistryMP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + HistogramRegistry sphericityRegistry{"SphericityHisto", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + /// TPC Pion/Kaon/Proton Sigma selection (general) + bool IsNSigma(float mom, float nsigmaTPC, float nsigmaTOF) + { + // |nsigma_TPC| < 3 for p < 0.5 GeV/c + // |nsigma_combined| < 3 for p > 0.5 + + // using configurables: + // ConfTOFpMin -- momentum value when we start using TOF; set to 1000 if TOF not needed + // ConfNsigmaTPC -> TPC Sigma for momentum < ConfTOFpMin + // ConfNsigmaCombined -> TPC and TOF Sigma (combined) for momentum > ConfTOFpMin + + if (mom < twoobjectsconfigs.ConfTOFpMin) { + return TMath::Abs(nsigmaTPC) < twoobjectsconfigs.ConfNsigmaTPC; + } else { + return TMath::Hypot(nsigmaTOF, nsigmaTPC) < twoobjectsconfigs.ConfNsigmaCombined; + } + } + + /// TPC Kaon Sigma selection (stricter cuts for K+ and K-) -- based on Run2 results + bool IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) + { + if (twoobjectsconfigs.IsKaonNsigma == true) { + if (mom < 0.4) { + return TMath::Abs(nsigmaTPCK) < 2; + } else if (mom > 0.4 && mom < 0.45) { + return TMath::Abs(nsigmaTPCK) < 1; + } else if (mom > 0.45 && mom < 0.8) { + return (TMath::Abs(nsigmaTPCK) < 3 && TMath::Abs(nsigmaTOFK) < 2); + } else if (mom > 0.8 && mom < 1.5) { + return (TMath::Abs(nsigmaTPCK) < 3 && TMath::Abs(nsigmaTOFK) < 1.5); + } else { + return false; + } + } else { + return IsNSigma(mom, nsigmaTPCK, nsigmaTOFK); + } + } + + /// TPC Deuteron Sigma selection + bool IsDeuteronNSigma(float mom, float nsigmaTPCDe, float nsigmaTOFDe) + { + if (mom > deuteronconfigs.ConfPLowDe && mom < deuteronconfigs.ConfPHighDe) { + if (mom < deuteronconfigs.ConfTOFpMinDe) { + return (TMath::Abs(nsigmaTPCDe) < deuteronconfigs.ConfNsigmaTPCDe); + } else { + return (TMath::Abs(nsigmaTOFDe) < deuteronconfigs.ConfNsigmaTOFDe && (TMath::Abs(nsigmaTPCDe) < deuteronconfigs.ConfNsigmaTPCDe)); + } + } else { + return false; + } + } + + /// Linear cut for clearer TPC Deuteron Sigma + bool IsDeuteronNSigmaLinearCut(float mom, float nsigmaTPCDe, float nsigmaTOFDe, float tpcSignal) + { + if (lincut.ConfIsLine == true) { + if (mom > lincut.LinCutpLow && mom < lincut.LinCutpHigh) { + if (tpcSignal > lincut.LinCutParA * mom + lincut.LinCutParB) { + return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); + } else { + return false; + } + } else { + return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); + } + } else { + return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); + } + } + + /// Polynomial 3 cut for clearer TPC Deuteron Sigma + bool IsDeuteronNSigmaPolCut(float mom, float nsigmaTPCDe, float nsigmaTOFDe, float tpcSignal) + { + if (polcut.ConfIsPol == true) { + if (tpcSignal > polcut.PolCutParA * TMath::Power(mom, 3) + polcut.PolCutParB * TMath::Power(mom, 2) + polcut.PolCutParC * mom + polcut.PolCutParD) { + return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); + } else { + return false; + } + } else { + return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); + } + } + + bool IsParticleNSigma(int8_t object_number, float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK, float nsigmaTPCDe, float nsigmaTOFDe, float tpcSignal) + { + if (object_number == 1) { + switch (trackfilter.ConfPDGCodeTrack) { + case 2212: // Proton + case -2212: // Anti-proton + return IsNSigma(mom, nsigmaTPCPr, nsigmaTOFPr); + break; + case 211: // Pion+ + case -211: // Pion- + case 111: // Pion 0 + return IsNSigma(mom, nsigmaTPCPi, nsigmaTOFPi); + break; + case 321: // Kaon+ + case -321: // Kaon- + return IsKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + break; + case 130: // Kaon 0 LONG + case 310: // Kaon 0 SHORT + return IsNSigma(mom, nsigmaTPCK, nsigmaTOFK); + break; + case 1000010020: // Deuteron + case -1000010020: // Anti-deuteron + return IsDeuteronNSigmaPolCut(mom, nsigmaTPCDe, nsigmaTOFDe, tpcSignal); + break; + default: + return false; + } + return false; + } else if (object_number == 2) { + switch (nucleusfilter.ConfPDGCodeNucleus) { + case 2212: // Proton + case -2212: // Anti-proton + return IsNSigma(mom, nsigmaTPCPr, nsigmaTOFPr); + break; + case 211: // Pion+ + case -211: // Pion- + case 111: // Pion 0 + return IsNSigma(mom, nsigmaTPCPi, nsigmaTOFPi); + break; + case 321: // Kaon+ + case -321: // Kaon- + return IsKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + break; + case 130: // Kaon 0 LONG + case 310: // Kaon 0 SHORT + return IsNSigma(mom, nsigmaTPCK, nsigmaTOFK); + break; + case 1000010020: // Deuteron + case -1000010020: // Anti-deuteron + return IsDeuteronNSigmaPolCut(mom, nsigmaTPCDe, nsigmaTOFDe, tpcSignal); + break; + default: + return false; + } + return false; + } else { + LOGF(fatal, "Wrong number of objects chosen! It should be 1 or 2. It is -> %d", object_number); + } + return false; + } + + void init(InitContext&) + { + eventHisto.init(&qaRegistry); + sphericityRegistry.add("sphericity", ";Sphericity;Entries", kTH1F, {{150, 0.0, 3, "Sphericity"}}); + + trackHistoTrack.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarBins, twoobjectsconfigs.ConfIsMC, trackfilter.ConfPDGCodeTrack, true); + + trackHistoNucleus.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarBins, twoobjectsconfigs.ConfIsMC, nucleusfilter.ConfPDGCodeNucleus, true); + + MixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + MixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + + mass1 = pdg->Mass(trackfilter.ConfPDGCodeTrack); + mass2 = pdg->Mass(nucleusfilter.ConfPDGCodeNucleus); + + if (cfgProcessPP) { + sameEventContPP.init(&resultRegistryPP, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twoobjectsconfigs.ConfIsMC, twoobjectsconfigs.ConfUse3D); + mixedEventContPP.init(&resultRegistryPP, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twoobjectsconfigs.ConfIsMC, twoobjectsconfigs.ConfUse3D); + sameEventContPP.setPDGCodes(trackfilter.ConfPDGCodeTrack, nucleusfilter.ConfPDGCodeNucleus); + mixedEventContPP.setPDGCodes(trackfilter.ConfPDGCodeTrack, nucleusfilter.ConfPDGCodeNucleus); + + if (cfgProcessMultBins) { + sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + } + } + + if (cfgProcessMM) { + sameEventContMM.init(&resultRegistryMM, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twoobjectsconfigs.ConfIsMC, twoobjectsconfigs.ConfUse3D); + mixedEventContMM.init(&resultRegistryMM, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twoobjectsconfigs.ConfIsMC, twoobjectsconfigs.ConfUse3D); + sameEventContMM.setPDGCodes(trackfilter.ConfPDGCodeTrack, nucleusfilter.ConfPDGCodeNucleus); + mixedEventContMM.setPDGCodes(trackfilter.ConfPDGCodeTrack, nucleusfilter.ConfPDGCodeNucleus); + + if (cfgProcessMultBins) { + sameEventMultContMM.init(&SameMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultContMM.init(&MixedMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + } + } + + if (cfgProcessPM) { + sameEventContPM.init(&resultRegistryPM, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twoobjectsconfigs.ConfIsMC, twoobjectsconfigs.ConfUse3D); + mixedEventContPM.init(&resultRegistryPM, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twoobjectsconfigs.ConfIsMC, twoobjectsconfigs.ConfUse3D); + + sameEventContPM.setPDGCodes(trackfilter.ConfPDGCodeTrack, nucleusfilter.ConfPDGCodeNucleus); + mixedEventContPM.setPDGCodes(trackfilter.ConfPDGCodeTrack, nucleusfilter.ConfPDGCodeNucleus); + + if (cfgProcessMultBins) { + sameEventMultContPM.init(&SameMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultContPM.init(&MixedMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + } + } + + if (cfgProcessMP) { + sameEventContMP.init(&resultRegistryMP, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twoobjectsconfigs.ConfIsMC, twoobjectsconfigs.ConfUse3D); + mixedEventContMP.init(&resultRegistryMP, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twoobjectsconfigs.ConfIsMC, twoobjectsconfigs.ConfUse3D); + + sameEventContMP.setPDGCodes(trackfilter.ConfPDGCodeTrack, nucleusfilter.ConfPDGCodeNucleus); + mixedEventContMP.setPDGCodes(trackfilter.ConfPDGCodeTrack, nucleusfilter.ConfPDGCodeNucleus); + + if (cfgProcessMultBins) { + sameEventMultContMP.init(&SameMultRegistryMP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultContMP.init(&MixedMultRegistryMP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + } + } + + pairCleaner.init(&qaRegistry); + if (ConfIsCPR.value) { + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + } + + vPIDTrack = trackfilter.ConfPIDTrack.value; + vPIDNucleus = nucleusfilter.ConfPIDNucleus.value; + kNsigma = twoobjectsconfigs.ConfTrkPIDnSigmaMax.value; + } + + template + void fillCollision(CollisionType col) + { + MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multV0M()})); + eventHisto.fillQA(col); + } + + /// This function processes 'same event' and takes care of all the histogramming + /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... + /// \tparam PartitionType + /// \tparam PartType + /// \tparam isMC: enables Monte Carlo truth specific histograms + /// \param groupTrack partition for track passed by the process function + /// \param groupNucleus partition for nucleus passed by the process function + /// \param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels) + /// \param magFieldTesla magnetic field of the collision + /// \param multCol multiplicity of the collision + /// \param pairType describes charge of correlation pair (plus-plus (1), minus-minus (2), plus-minus (3), minus-plus (4)) + /// \param fillQA enables filling of QA histograms + template + void doSameEvent(PartitionType groupTrack, PartitionType groupNucleus, PartType parts, float magFieldTesla, int multCol, int pairType, bool /*fillQA*/) + { + for (auto& part : groupTrack) { + if (!IsParticleNSigma((int8_t)1, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(part, o2::track::PID::Deuteron), part.tpcSignal())) { + continue; + } + trackHistoTrack.fillQA(part); + } + + for (auto& part : groupNucleus) { + if (!IsParticleNSigma((int8_t)2, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(part, o2::track::PID::Deuteron), part.tpcSignal())) { + continue; + } + trackHistoNucleus.fillQA(part); + } + + /// Combinations for identical pairs + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupTrack, groupTrack))) { + + if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p1, o2::track::PID::Deuteron), p1.tpcSignal())) { + continue; + } + + if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p2, o2::track::PID::Deuteron), p2.tpcSignal())) { + continue; + } + + if (ConfIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla, femtoUniverseContainer::EventType::same)) { + continue; + } + } + + // Cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + + switch (pairType) { + case 1: { + float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + + sameEventContPP.setPair(p1, p2, multCol, twoobjectsconfigs.ConfUse3D); + + if (cfgProcessMultBins) + sameEventMultContPP.fill(kstar, multCol, kT); + + break; + } + + case 2: { + float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + + sameEventContMM.setPair(p1, p2, multCol, twoobjectsconfigs.ConfUse3D); + + if (cfgProcessMultBins) + sameEventMultContMM.fill(kstar, multCol, kT); + + break; + } + + case 3: { + float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + + sameEventContPM.setPair(p1, p2, multCol, twoobjectsconfigs.ConfUse3D); + + if (cfgProcessMultBins) + sameEventMultContPM.fill(kstar, multCol, kT); + + break; + } + + case 4: { + float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + + sameEventContMP.setPair(p1, p2, multCol, twoobjectsconfigs.ConfUse3D); + + if (cfgProcessMultBins) + sameEventMultContMP.fill(kstar, multCol, kT); + + break; + } + + default: + break; + } + } + } + + /// Process function to call doSameEvent with Data + /// \param col subscribe to the collision table (Data) + /// \param parts subscribe to the femtoUniverseParticleTable + void processSameEvent(soa::Filtered::iterator& col, + FilteredFemtoFullParticles& parts) + { + fillCollision(col); + sphericityRegistry.fill(HIST("sphericity"), col.sphericity()); + + auto thegroupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto thegroupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + + bool fillQA = true; + + if (cfgProcessPP) + doSameEvent(thegroupTrack, thegroupNucleus, parts, col.magField(), col.multV0M(), 1, fillQA); + + if (cfgProcessMM) + doSameEvent(thegroupTrack, thegroupNucleus, parts, col.magField(), col.multV0M(), 2, fillQA); + + if (cfgProcessPM) { + doSameEvent(thegroupTrack, thegroupNucleus, parts, col.magField(), col.multV0M(), 3, fillQA); + fillQA = false; + } + + if (cfgProcessMP) { + doSameEvent(thegroupTrack, thegroupNucleus, parts, col.magField(), col.multV0M(), 4, fillQA); + fillQA = false; + } + } + PROCESS_SWITCH(femtoUniversePairTaskTrackNucleus, processSameEvent, "Enable processing same event", true); + + /// Process function to call doSameEvent with Monte Carlo + /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) + /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth + /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo Truth table + void processSameEventMC(o2::aod::FDCollision& col, + soa::Join& parts, + o2::aod::FDMCParticles&) + { + fillCollision(col); + + auto thegroupTrack = partTrackMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto thegroupNucleus = partNucleusMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + + bool fillQA = true; + + if (cfgProcessPP) + doSameEvent(thegroupTrack, thegroupNucleus, parts, col.magField(), col.multV0M(), 1, fillQA); + + if (cfgProcessMM) + doSameEvent(thegroupTrack, thegroupNucleus, parts, col.magField(), col.multV0M(), 2, fillQA); + + if (cfgProcessPM) { + doSameEvent(thegroupTrack, thegroupNucleus, parts, col.magField(), col.multV0M(), 3, fillQA); + fillQA = false; + } + + if (cfgProcessMP) { + doSameEvent(thegroupTrack, thegroupNucleus, parts, col.magField(), col.multV0M(), 4, fillQA); + fillQA = false; + } + } + PROCESS_SWITCH(femtoUniversePairTaskTrackNucleus, processSameEventMC, "Enable processing same event for Monte Carlo", false); + + /// This function processes 'mixed event' + /// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... + /// \tparam PartitionType + /// \tparam PartType + /// \tparam isMC: enables Monte Carlo truth specific histograms + /// \param groupTrack partition for track passed by the process function + /// \param groupNucleus partition for nucleus passed by the process function + /// \param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels) + /// \param magFieldTesla magnetic field of the collision + /// \param multCol multiplicity of the collision + /// \param pairType describes charge of correlation pair (plus-minus (1), plus-plus (2), minus-minus (3)) + template + void doMixedEvent(PartitionType groupTrack, PartitionType groupNucleus, PartType parts, float magFieldTesla, int multCol, int pairType) + { + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupTrack, groupNucleus))) { + + if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p1, o2::track::PID::Deuteron), p1.tpcSignal())) { + continue; + } + + if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p2, o2::track::PID::Deuteron), p2.tpcSignal())) { + continue; + } + + if (ConfIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla, femtoUniverseContainer::EventType::mixed)) { + continue; + } + } + + switch (pairType) { + case 1: { + float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + + mixedEventContPP.setPair(p1, p2, multCol, twoobjectsconfigs.ConfUse3D); + + if (cfgProcessMultBins) + mixedEventMultContPP.fill(kstar, multCol, kT); + + break; + } + + case 2: { + float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + + mixedEventContMM.setPair(p1, p2, multCol, twoobjectsconfigs.ConfUse3D); + + if (cfgProcessMultBins) + mixedEventMultContMM.fill(kstar, multCol, kT); + + break; + } + + case 3: { + float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + + mixedEventContPM.setPair(p1, p2, multCol, twoobjectsconfigs.ConfUse3D); + + if (cfgProcessMultBins) + mixedEventMultContPM.fill(kstar, multCol, kT); + + break; + } + + case 4: { + float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + + mixedEventContMP.setPair(p1, p2, multCol, twoobjectsconfigs.ConfUse3D); + + if (cfgProcessMultBins) + mixedEventMultContMP.fill(kstar, multCol, kT); + + break; + } + + default: + break; + } + } + } + + /// Process function to call doMixedEvent with Data + /// \param cols subscribe to the collisions table (Data) + /// \param parts subscribe to the femtoUniverseParticleTable + void processMixedEvent(soa::Filtered& cols, + FilteredFemtoFullParticles& parts) + { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + + const int multiplicityCol = collision1.multV0M(); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + continue; + } + + if (cfgProcessPP) { + auto groupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEvent(groupTrack, groupNucleus, parts, magFieldTesla1, multiplicityCol, 1); + } + + if (cfgProcessMM) { + auto groupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEvent(groupTrack, groupNucleus, parts, magFieldTesla1, multiplicityCol, 2); + } + + if (cfgProcessPM) { + auto groupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEvent(groupTrack, groupNucleus, parts, magFieldTesla1, multiplicityCol, 3); + } + + if (cfgProcessMP) { + auto groupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEvent(groupTrack, groupNucleus, parts, magFieldTesla1, multiplicityCol, 4); + } + } + } + PROCESS_SWITCH(femtoUniversePairTaskTrackNucleus, processMixedEvent, "Enable processing mixed events", true); + + /// Process function to call doMixedEvent with Monte Carlo + /// \param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) + /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth + /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table + void processMixedEventMC(o2::aod::FDCollisions& cols, + soa::Join& parts, + o2::aod::FDMCParticles&) + { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + + const int multiplicityCol = collision1.multV0M(); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + continue; + } + /// \todo before mixing we should check whether both collisions contain a pair of particles! + // if partTrack.size() == 0 || nPart2Evt1 == 0 || nPart1Evt2 == 0 || partNucleus.size() == 0 ) continue; + + if (cfgProcessPP) { + auto groupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEvent(groupTrack, groupNucleus, parts, magFieldTesla1, multiplicityCol, 1); + } + + if (cfgProcessMM) { + auto groupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEvent(groupTrack, groupNucleus, parts, magFieldTesla1, multiplicityCol, 2); + } + + if (cfgProcessPM) { + auto groupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEvent(groupTrack, groupNucleus, parts, magFieldTesla1, multiplicityCol, 3); + } + + if (cfgProcessMP) { + auto groupTrack = partTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupNucleus = partNucleus->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEvent(groupTrack, groupNucleus, parts, magFieldTesla1, multiplicityCol, 4); + } + } + } + PROCESS_SWITCH(femtoUniversePairTaskTrackNucleus, processMixedEventMC, "Enable processing mixed events MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + + return workflow; +} diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx index b5b1aeb6296..15aea7eee19 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx @@ -17,6 +17,7 @@ /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch #include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" @@ -72,8 +73,8 @@ struct femtoUniversePairTaskTrackPhi { struct : o2::framework::ConfigurableGroup { Configurable ConfEfficiencyTrackPath{"ConfEfficiencyTrackPath", "", "Local path to proton efficiency TH2F file"}; Configurable ConfEfficiencyPhiPath{"ConfEfficiencyPhiPath", "", "Local path to Phi efficiency TH2F file"}; - Configurable ConfEfficiencyTrackTimestamp{"ConfEfficiencyTrackTimestamp", 0, "(long int) Timestamp for hadron"}; - Configurable ConfEfficiencyPhiTimestamp{"ConfEfficiencyPhiTimestamp", 0, "(long int) Timestamp for phi"}; + Configurable ConfEfficiencyTrackTimestamp{"ConfEfficiencyTrackTimestamp", 0, "(int64_t) Timestamp for hadron"}; + Configurable ConfEfficiencyPhiTimestamp{"ConfEfficiencyPhiTimestamp", 0, "(int64_t) Timestamp for phi"}; } ConfEff; struct : o2::framework::ConfigurableGroup { @@ -438,7 +439,7 @@ struct femtoUniversePairTaskTrackPhi { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - long now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); ccdb->setCreatedNotAfter(now); if (!ConfEff.ConfEfficiencyTrackPath.value.empty()) { @@ -584,10 +585,11 @@ struct femtoUniversePairTaskTrackPhi { float mMassTwo = TDatabasePDG::Instance()->GetParticle(-321)->Mass(); // FIXME: Get from the PDG service of the common header for (auto& [kaon1, kaon2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsKaons, groupPartsKaons))) { - if (!IsKaonNSigma(kaon1.p(), trackCuts.getNsigmaTPC(kaon1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(kaon1, o2::track::PID::Kaon))) { - } - if (!IsKaonNSigma(kaon2.p(), trackCuts.getNsigmaTPC(kaon2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(kaon2, o2::track::PID::Kaon))) { - } + // empty if statements commented out on 20241114 to get rid of MegaLinter errors + // if (!IsKaonNSigma(kaon1.p(), trackCuts.getNsigmaTPC(kaon1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(kaon1, o2::track::PID::Kaon))) { + // } + // if (!IsKaonNSigma(kaon2.p(), trackCuts.getNsigmaTPC(kaon2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(kaon2, o2::track::PID::Kaon))) { + // } if ((kaon1.mAntiLambda() == 1) && (kaon2.mAntiLambda() == 1)) { part1Vec.SetPtEtaPhiM(kaon1.pt(), kaon1.eta(), kaon1.phi(), mMassOne); part2Vec.SetPtEtaPhiM(kaon2.pt(), kaon2.eta(), kaon2.phi(), mMassOne); @@ -765,7 +767,7 @@ struct femtoUniversePairTaskTrackPhi { registryMCtruth.fill(HIST("MCtruthKp"), part.pt(), part.eta()); registryMCtruth.fill(HIST("MCtruthKpPt"), part.pt()); } - if ((pdgCode == 333)) { + if (pdgCode == 333) { registryMCtruth.fill(HIST("MCtruthPhi"), part.pt(), part.eta()); continue; } diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx index d5b7c010acc..cdccc3bd327 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx @@ -15,6 +15,7 @@ /// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@pw.edu.pl #include +#include #include "TRandom2.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -132,9 +133,13 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { /// Event part Configurable ConfV0MLow{"ConfV0MLow", 0.0, "Lower limit for V0M multiplicity"}; Configurable ConfV0MHigh{"ConfV0MHigh", 25000.0, "Upper limit for V0M multiplicity"}; + Configurable ConfTPCOccupancyLow{"ConfTPCOccupancyLow", 0, "Lower limit for TPC occupancy"}; + Configurable ConfTPCOccupancyHigh{"ConfTPCOccupancyHigh", 500, "Higher limit for TPC occupancy"}; - Filter collV0Mfilter = ((o2::aod::femtouniversecollision::multV0M > ConfV0MLow) && (o2::aod::femtouniversecollision::multV0M < ConfV0MHigh)); - // Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable + Filter collfilter = (o2::aod::femtouniversecollision::multV0M > ConfV0MLow) && (o2::aod::femtouniversecollision::multV0M < ConfV0MHigh) && + (o2::aod::femtouniversecollision::occupancy > ConfTPCOccupancyLow) && (o2::aod::femtouniversecollision::occupancy < ConfTPCOccupancyHigh); + using FilteredFDCollisions = soa::Filtered>; + using FilteredFDCollision = FilteredFDCollisions::iterator; /// Particle part ConfigurableAxis ConfTempFitVarBins{"ConfDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; @@ -149,7 +154,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; ConfigurableAxis ConfmultBins3D{"ConfmultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; + ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; ConfigurableAxis ConfkstarBins{"ConfkstarBins", {300, -1.5, 1.5}, "binning kstar"}; ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"}; @@ -213,6 +218,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { HistogramRegistry SameMultRegistryMM{"SameMultRegistryMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry MixedMultRegistryMM{"MixedMultRegistryMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + TRandom2* randgen; + // PID for protons bool IsProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx { @@ -412,7 +419,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { template void fillCollision(CollisionType col) { - MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); + MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multV0M()})); eventHisto.fillQA(col); } @@ -484,7 +491,6 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { } } else { /// Now build the combinations for identical particles pairs - TRandom2* randgen = new TRandom2(0); double rand; for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) { @@ -563,7 +569,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { /// process function for to call doSameEvent with Data /// \param col subscribe to the collision table (Data) /// \param parts subscribe to the femtoUniverseParticleTable - void processSameEvent(soa::Filtered::iterator& col, + void processSameEvent(FilteredFDCollision& col, FilteredFemtoFullParticles& parts) { fillCollision(col); @@ -572,18 +578,20 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { auto thegroupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); bool fillQA = true; + randgen = new TRandom2(0); if (cfgProcessPM) { - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA); } if (cfgProcessPP) { - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA); } if (cfgProcessMM) { - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA); + doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); } + delete randgen; } PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processSameEvent, "Enable processing same event", true); @@ -603,15 +611,15 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { bool fillQA = true; if (cfgProcessPM) { - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA); } if (cfgProcessPP) { - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA); } if (cfgProcessMM) { - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA); + doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); } } PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processSameEventMC, "Enable processing same event for Monte Carlo", false); @@ -646,38 +654,72 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { } } + double rand; + rand = randgen->Rndm(); + switch (ContType) { case 1: { float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - if (!cfgProcessMultBins) { - mixedEventCont.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + + if (rand > 0.5) { + if (!cfgProcessMultBins) { + mixedEventCont.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + } else { + std::vector k3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + mixedEventMultCont.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + } } else { - std::vector k3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); - mixedEventMultCont.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + if (!cfgProcessMultBins) { + mixedEventCont.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + } else { + std::vector k3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + mixedEventMultCont.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + } } break; } case 2: { float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass1); - if (!cfgProcessMultBins) { - mixedEventContPP.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + + if (rand > 0.5) { + if (!cfgProcessMultBins) { + mixedEventContPP.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + } else { + std::vector k3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + mixedEventMultContPP.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + } } else { - std::vector k3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); - mixedEventMultContPP.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + if (!cfgProcessMultBins) { + mixedEventContPP.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + } else { + std::vector k3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + mixedEventMultContPP.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + } } break; } case 3: { float kT = FemtoUniverseMath::getkT(p1, mass2, p2, mass2); - if (!cfgProcessMultBins) { - mixedEventContMM.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + + if (rand > 0.5) { + if (!cfgProcessMultBins) { + mixedEventContMM.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + } else { + std::vector k3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + mixedEventMultContMM.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + } } else { - std::vector k3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); - mixedEventMultContMM.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + if (!cfgProcessMultBins) { + mixedEventContMM.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden); + } else { + std::vector k3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + mixedEventMultContMM.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); + } } break; } + default: break; } @@ -687,12 +729,14 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { /// process function for to call doMixedEvent with Data /// @param cols subscribe to the collisions table (Data) /// @param parts subscribe to the femtoUniverseParticleTable - void processMixedEvent(soa::Filtered& cols, + void processMixedEvent(FilteredFDCollisions& cols, FilteredFemtoFullParticles& parts) { - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + randgen = new TRandom2(0); + + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, ConfNEventsMix, -1, cols, cols)) { - const int multiplicityCol = collision1.multNtr(); + const int multiplicityCol = collision1.multV0M(); MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); const auto& magFieldTesla1 = collision1.magField(); @@ -718,6 +762,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { doMixedEvent(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 3); } } + delete randgen; } PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEvent, "Enable processing mixed events", true); @@ -729,9 +774,9 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { soa::Join& parts, o2::aod::FDMCParticles&) { - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, ConfNEventsMix, -1, cols, cols)) { - const int multiplicityCol = collision1.multNtr(); + const int multiplicityCol = collision1.multV0M(); MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); const auto& magFieldTesla1 = collision1.magField(); diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx index b570dd1d3b7..0ae10b8c65a 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx @@ -161,7 +161,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { /// Histogramming same event for (auto& part : groupPartsOne) { - if (!ConfNoPDGPartOne && part.pidcut() != ConfPDGCodePartOne) { + if (!ConfNoPDGPartOne && part.tempFitVar() != ConfPDGCodePartOne) { continue; } trackHistoPartOne.fillQA(part); @@ -169,7 +169,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { if (!ConfIsSame) { for (auto& part : groupPartsTwo) { - if (!ConfNoPDGPartTwo && part.pidcut() != ConfPDGCodePartTwo) { + if (!ConfNoPDGPartTwo && part.tempFitVar() != ConfPDGCodePartTwo) { continue; } trackHistoPartTwo.fillQA(part); @@ -183,7 +183,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } - if ((!ConfNoPDGPartOne && p2.pidcut() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.pidcut() != ConfPDGCodePartTwo)) { + if ((!ConfNoPDGPartOne && p2.tempFitVar() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.tempFitVar() != ConfPDGCodePartTwo)) { continue; } if (swpart) @@ -200,7 +200,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } - if ((!ConfNoPDGPartOne && p2.pidcut() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.pidcut() != ConfPDGCodePartTwo)) { + if ((!ConfNoPDGPartOne && p2.tempFitVar() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.tempFitVar() != ConfPDGCodePartTwo)) { continue; } if (swpart) @@ -244,7 +244,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { fNeventsProcessed++; for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if ((!ConfNoPDGPartOne && p2.pidcut() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.pidcut() != ConfPDGCodePartTwo)) { + if ((!ConfNoPDGPartOne && p2.tempFitVar() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.tempFitVar() != ConfPDGCodePartTwo)) { continue; } if (swpart) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx index c762393af6d..41bbc51b54e 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx @@ -18,6 +18,7 @@ /// \author Alicja Płachta, WUT Warsaw, alicja.plachta.stud@pw.edu.pl #include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" @@ -52,9 +53,7 @@ static constexpr int nPart = 2; static constexpr int nCuts = 5; static const std::vector partNames{"PartOne", "PartTwo"}; static const std::vector cutNames{"MaxPt", "PIDthr", "nSigmaTPC", "nSigmaTPCTOF", "MaxP"}; -static const float cutsTable[nPart][nCuts]{ - {4.05f, 1.f, 3.f, 3.f, 100.f}, - {4.05f, 1.f, 3.f, 3.f, 100.f}}; +static const float cutsTable[nPart][nCuts]{{4.05f, 1.f, 3.f, 3.f, 100.f}, {4.05f, 1.f, 3.f, 3.f, 100.f}}; } // namespace struct femtoUniversePairTaskTrackTrackMultKtExtended { @@ -78,33 +77,6 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { Configurable ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; } twotracksconfigs; - /// Table for separate deuteron configurables - struct : o2::framework::ConfigurableGroup { - Configurable ConfNsigmaTPCDe{"ConfNsigmaTPCDe", 2.0f, "TPC Deuteron Sigma for momentum < ConfTOFpMinDe"}; - Configurable ConfNsigmaTOFDe{"ConfNsigmaTOFDe", 2.0f, "TOF Deuteron Sigma"}; - Configurable ConfTOFpMinDe{"ConfTOFpMinDe", 0.5f, "Min. momentum for deuterons for which TOF is required for PID"}; - Configurable ConfPLowDe{"ConfPLowDe", 0.8f, "Lower limit for momentum for deuterons"}; - Configurable ConfPHighDe{"ConfPHighDe", 1.8f, "Higher limit for momentum for deuterons"}; - } deuteronconfigs; - - /// Table for linear cut for TPC Deuteron Sigma - struct : o2::framework::ConfigurableGroup { - Configurable ConfIsLine{"ConfIsLine", false, "Enable a separation line for clearer TPC Deuteron Sigma"}; - Configurable pLow{"pLow", 0.0f, "Lower limit of momentum for linear cut of TPC Deuteron Sigma"}; - Configurable pHigh{"pHigh", 1.4f, "Higher limit of momentum for linear cut of TPC Deuteron Sigma"}; - Configurable a{"a", -167.0f, "Parameter 'a' of a linear function 'y = a * x + b'"}; - Configurable b{"b", 300.0f, "Parameter 'b' of a linear function 'y = a * x + b'"}; - } lincut; - - /// Table for polynomial 3 cut for TPC Deuteron Sigma - struct : o2::framework::ConfigurableGroup { - Configurable ConfIsPol{"ConfIsPol", false, "Enable a separation polynomial 3 curve for clearer TPC Deuteron Sigma"}; - Configurable A{"A", -52.2f, "Parameter 'A' of a polynomial function 'y = A * x^3 + B * x^2 + C * x + D'"}; - Configurable B{"B", 357.7f, "Parameter 'B' of a polynomial function 'y = A * x^3 + B * x^2 + C * x + D'"}; - Configurable C{"C", -834.7f, "Parameter 'C' of a polynomial function 'y = A * x^3 + B * x^2 + C * x + D'"}; - Configurable D{"D", 705.8f, "Parameter 'D' of a polynomial function 'y = A * x^3 + B * x^2 + C * x + D'"}; - } polcut; - using FemtoFullParticles = soa::Join; // Filters for selecting particles (both p1 and p2) Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable @@ -180,7 +152,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; ConfigurableAxis ConfmultBins3D{"ConfmultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; + ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; ConfigurableAxis ConfkstarBins{"ConfkstarBins", {1500, 0., 6.}, "binning kstar"}; ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"}; @@ -284,53 +256,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { } } - /// TPC Deuteron Sigma selection - bool IsDeuteronNSigma(float mom, float nsigmaTPCDe, float nsigmaTOFDe) - { - if (mom > deuteronconfigs.ConfPLowDe && mom < deuteronconfigs.ConfPHighDe) { - if (mom < deuteronconfigs.ConfTOFpMinDe) { - return TMath::Abs(nsigmaTPCDe) < deuteronconfigs.ConfNsigmaTPCDe; - } else { - return (TMath::Abs(nsigmaTOFDe) < deuteronconfigs.ConfNsigmaTOFDe && (TMath::Abs(nsigmaTPCDe) < deuteronconfigs.ConfNsigmaTPCDe)); - } - } else { - return false; - } - } - - /// Linear cut for clearer TPC Deuteron Sigma - bool IsDeuteronNSigmaLinearCut(float mom, float nsigmaTPCDe, float nsigmaTOFDe, float tpcSignal) - { - if (lincut.ConfIsLine == true) { - if (mom > lincut.pLow && mom < lincut.pHigh) { - if (tpcSignal > lincut.a * mom + lincut.b) { - return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); - } else { - return false; - } - } else { - return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); - } - } else { - return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); - } - } - - /// Polynomial 3 cut for clearer TPC Deuteron Sigma - bool IsDeuteronNSigmaPolCut(float mom, float nsigmaTPCDe, float nsigmaTOFDe, float tpcSignal) - { - if (polcut.ConfIsPol == true) { - if (tpcSignal > polcut.A * TMath::Power(mom, 3) + polcut.B * TMath::Power(mom, 2) + polcut.C * mom + polcut.D) { - return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); - } else { - return false; - } - } else { - return IsDeuteronNSigma(mom, nsigmaTPCDe, nsigmaTOFDe); - } - } - - bool IsParticleNSigma(int8_t particle_number, float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK, float nsigmaTPCDe, float nsigmaTOFDe, float tpcSignal) + bool IsParticleNSigma(int8_t particle_number, float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK) { if (particle_number == 1) { switch (trackonefilter.ConfPDGCodePartOne) { @@ -351,10 +277,6 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { case 310: // Kaon 0 SHORT return IsNSigma(mom, nsigmaTPCK, nsigmaTOFK); break; - case 1000010020: // Deuteron+ - case -1000010020: // Deuteron- - return IsDeuteronNSigmaPolCut(mom, nsigmaTPCDe, nsigmaTOFDe, tpcSignal); - break; default: return false; } @@ -378,11 +300,6 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { case 310: // Kaon 0 SHORT return IsNSigma(mom, nsigmaTPCK, nsigmaTOFK); break; - case 1000010020: // Deuteron+ - case -1000010020: // Deuteron- - return IsDeuteronNSigmaPolCut(mom, nsigmaTPCDe, nsigmaTOFDe, tpcSignal); - break; - default: return false; } return false; @@ -457,7 +374,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { template void fillCollision(CollisionType col) { - MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); + MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multV0M()})); eventHisto.fillQA(col); } @@ -480,7 +397,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { /// Histogramming same event if ((pairType == 1 || pairType == 2) && fillQA) { for (auto& part : groupPartsOne) { - if (!IsParticleNSigma((int8_t)1, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(part, o2::track::PID::Deuteron), part.tpcSignal())) { + if (!IsParticleNSigma((int8_t)1, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { continue; } trackHistoPartOne.fillQA(part); @@ -489,7 +406,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { if ((pairType == 1 || pairType == 3) && fillQA) { for (auto& part : groupPartsTwo) { - if (!IsParticleNSigma((int8_t)2, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(part, o2::track::PID::Deuteron), part.tpcSignal())) { + if (!IsParticleNSigma((int8_t)2, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { continue; } trackHistoPartTwo.fillQA(part); @@ -501,11 +418,11 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { /// Now build the combinations for non-identical particle pairs for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (!IsParticleNSigma((int8_t)1, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p1, o2::track::PID::Deuteron), p1.tpcSignal())) { + if (!IsParticleNSigma((int8_t)1, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) { continue; } - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p2, o2::track::PID::Deuteron), p2.tpcSignal())) { + if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon))) { continue; } @@ -531,11 +448,11 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { /// Now build the combinations for identical particles pairs for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) { - if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p1, o2::track::PID::Deuteron), p1.tpcSignal())) { + if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) { continue; } - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p2, o2::track::PID::Deuteron), p2.tpcSignal())) { + if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon))) { continue; } @@ -612,13 +529,13 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { bool fillQA = true; if (cfgProcessPM) { - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA); fillQA = false; } if (cfgProcessPP) - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA); if (cfgProcessMM) - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA); + doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); } PROCESS_SWITCH(femtoUniversePairTaskTrackTrackMultKtExtended, processSameEvent, "Enable processing same event", true); @@ -637,13 +554,13 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { bool fillQA = true; if (cfgProcessPM) { - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA); fillQA = false; } if (cfgProcessPP) - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA); if (cfgProcessMM) - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA); + doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); } PROCESS_SWITCH(femtoUniversePairTaskTrackTrackMultKtExtended, processSameEventMC, "Enable processing same event for Monte Carlo", false); @@ -664,11 +581,11 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p1, o2::track::PID::Deuteron), p1.tpcSignal())) { + if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) { continue; } - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Deuteron), trackCuts.getNsigmaTOF(p2, o2::track::PID::Deuteron), p2.tpcSignal())) { + if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon))) { continue; } @@ -742,7 +659,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { { for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { - const int multiplicityCol = collision1.multNtr(); + const int multiplicityCol = collision1.multV0M(); MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); const auto& magFieldTesla1 = collision1.magField(); @@ -781,7 +698,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { { for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { - const int multiplicityCol = collision1.multNtr(); + const int multiplicityCol = collision1.multV0M(); MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); const auto& magFieldTesla1 = collision1.magField(); diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 8dc39769732..2f1e8ee4712 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -15,6 +15,7 @@ /// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@pw.edu.pl #include +#include #include "TRandom2.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -132,9 +133,16 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// Event part Configurable ConfV0MLow{"ConfV0MLow", 0.0, "Lower limit for V0M multiplicity"}; Configurable ConfV0MHigh{"ConfV0MHigh", 25000.0, "Upper limit for V0M multiplicity"}; - Filter collV0Mfilter = ((o2::aod::femtouniversecollision::multV0M > ConfV0MLow) && (o2::aod::femtouniversecollision::multV0M < ConfV0MHigh)); - using FilteredFDCollisions = soa::Filtered; - using FilteredFDCollision = soa::Filtered::iterator; + Configurable ConfTPCOccupancyLow{"ConfTPCOccupancyLow", 0, "Lower limit for TPC occupancy"}; + Configurable ConfTPCOccupancyHigh{"ConfTPCOccupancyHigh", 500, "Higher limit for TPC occupancy"}; + Configurable ConfIntRateLow{"ConfIntRateLow", 0.0, "Lower limit for interaction rate"}; + Configurable ConfIntRateHigh{"ConfIntRateHigh", 10000.0, "Higher limit for interaction rate"}; + + Filter collfilterFDtable = (o2::aod::femtouniversecollision::multV0M > ConfV0MLow) && (o2::aod::femtouniversecollision::multV0M < ConfV0MHigh); + Filter collfilterFDExttable = (o2::aod::femtouniversecollision::irrate > ConfIntRateLow) && (o2::aod::femtouniversecollision::irrate < ConfIntRateHigh) && + (o2::aod::femtouniversecollision::occupancy > ConfTPCOccupancyLow) && (o2::aod::femtouniversecollision::occupancy < ConfTPCOccupancyHigh); + using FilteredFDCollisions = soa::Filtered>; + using FilteredFDCollision = FilteredFDCollisions::iterator; // Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable /// Particle part @@ -215,6 +223,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { HistogramRegistry SameMultRegistryMM{"SameMultRegistryMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry MixedMultRegistryMM{"MixedMultRegistryMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + TRandom2* randgen; + // PID for protons bool IsProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx { @@ -500,12 +510,11 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - TRandom2* randgen = new TRandom2(0); double rand; + rand = randgen->Rndm(); switch (ContType) { case 2: { - rand = randgen->Rndm(); if (rand > 0.5) { sameEventMultContPP.fill_mult_NumDen(p1, p2, femtoUniverseSHContainer::EventType::same, 2, multCol, kT, ConfIsIden); } else if (rand <= 0.5) { @@ -515,7 +524,6 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } case 3: { - rand = randgen->Rndm(); if (rand > 0.5) { sameEventMultContMM.fill_mult_NumDen(p1, p2, femtoUniverseSHContainer::EventType::same, 2, multCol, kT, ConfIsIden); } else if (rand <= 0.5) { @@ -526,7 +534,6 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { default: break; } - delete randgen; } } } @@ -543,6 +550,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { auto thegroupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); bool fillQA = true; + randgen = new TRandom2(0); if (cfgProcessPM) { doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA); @@ -555,6 +563,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { if (cfgProcessMM) { doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); } + delete randgen; } PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEvent, "Enable processing same event", true); @@ -604,19 +613,37 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + double rand; + rand = randgen->Rndm(); + switch (ContType) { case 1: { - mixedEventMultCont.fill_mult_NumDen(p1, p2, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + if (rand > 0.5) { + mixedEventMultCont.fill_mult_NumDen(p1, p2, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + mixedEventMultCont.fill_mult_NumDen(p2, p1, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + } break; } + case 2: { - mixedEventMultContPP.fill_mult_NumDen(p1, p2, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + if (rand > 0.5) { + mixedEventMultContPP.fill_mult_NumDen(p1, p2, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + mixedEventMultContPP.fill_mult_NumDen(p2, p1, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + } break; } + case 3: { - mixedEventMultContMM.fill_mult_NumDen(p1, p2, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + if (rand > 0.5) { + mixedEventMultContMM.fill_mult_NumDen(p1, p2, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + mixedEventMultContMM.fill_mult_NumDen(p2, p1, femtoUniverseSHContainer::EventType::mixed, 2, multCol, kT, ConfIsIden); + } break; } + default: break; } @@ -629,6 +656,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { void processMixedEvent(FilteredFDCollisions& cols, FilteredFemtoFullParticles& parts) { + randgen = new TRandom2(0); + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, ConfNEventsMix, -1, cols, cols)) { const int multiplicityCol = collision1.multV0M(); @@ -657,6 +686,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { doMixedEvent(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 3); } } + delete randgen; } /// process function for to fill covariance histograms diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx index 3b1dcce4d73..4810c79298d 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx @@ -15,6 +15,8 @@ /// \author Shirajum Monira, WUT Warsaw, shirajum.monira.dokt@pw.edu.pl #include +#include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" @@ -152,6 +154,8 @@ struct femtoUniversePairTaskTrackV0Extended { HistogramRegistry registryMCtruth{"MCtruthHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry registryMCreco{"MCrecoHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry MixQaRegistry{"MixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::unique_ptr plocalEffFile; std::unique_ptr plocalEffp1; std::unique_ptr plocalEffp2; @@ -220,6 +224,8 @@ struct femtoUniversePairTaskTrackV0Extended { posChildV0Type2.init(&qaRegistry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false, 0, true, "posChildV0Type2"); negChildV0Type2.init(&qaRegistry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false, 0, true, "negChildV0Type2"); + MixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + // MC truth registryMCtruth.add("plus/MCtruthLambda", "MC truth Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); registryMCtruth.add("minus/MCtruthLambda", "MC truth Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); @@ -511,7 +517,7 @@ struct femtoUniversePairTaskTrackV0Extended { PROCESS_SWITCH(femtoUniversePairTaskTrackV0Extended, processMCSameEvent, "Enable processing same event for MC truth track - V0", false); /// This function processes MC same events for V0 - V0 - void processMCSameEventV0(FilteredFDCollision& col, FemtoFullParticles& parts) + void processMCSameEventV0(FilteredFDCollision& col, FemtoFullParticles& /*parts*/) { auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); const int multCol = ConfUseCent ? col.multV0M() : col.multNtr(); @@ -555,10 +561,10 @@ struct femtoUniversePairTaskTrackV0Extended { template void doMixedEvent(FilteredFDCollisions& cols, PartType& parts, PartitionType& partitionOne, PartitionType& partitionTwo, [[maybe_unused]] MCParticles mcParts = nullptr) { - ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; - - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + ColumnBinningPolicy colBinningMult{{ConfVtxBins, ConfMultBins}, true}; + ColumnBinningPolicy colBinningCent{{ConfVtxBins, ConfMultBins}, true}; + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { const int multCol = ConfUseCent ? collision1.multV0M() : collision1.multNtr(); auto groupPartsOne = partitionOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); @@ -568,7 +574,7 @@ struct femtoUniversePairTaskTrackV0Extended { const auto& magFieldTesla2 = collision2.magField(); if (magFieldTesla1 != magFieldTesla2) { - continue; + return; } for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { @@ -603,6 +609,18 @@ struct femtoUniversePairTaskTrackV0Extended { else mixedEventCont.setPair(p1, p2, multCol, ConfUse3D, weight); } + }; + + if (ConfUseCent) { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, 5, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()})); + } + } else { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, 5, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()})); + } } } @@ -621,10 +639,10 @@ struct femtoUniversePairTaskTrackV0Extended { /// This function processes the mixed event for V0 - V0 void processMixedEventV0(FilteredFDCollisions& cols, FemtoFullParticles& parts) { - ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; - - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + ColumnBinningPolicy colBinningMult{{ConfVtxBins, ConfMultBins}, true}; + ColumnBinningPolicy colBinningCent{{ConfVtxBins, ConfMultBins}, true}; + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { const int multCol = ConfUseCent ? collision1.multV0M() : collision1.multNtr(); auto groupPartsOne = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); @@ -634,16 +652,18 @@ struct femtoUniversePairTaskTrackV0Extended { const auto& magFieldTesla2 = collision2.magField(); if (magFieldTesla1 != magFieldTesla2) { - continue; + return; } for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { // Lambda invariant mass cut for p1 - if (!invMLambda(p1.mLambda(), p1.mAntiLambda())) + if (!invMLambda(p1.mLambda(), p1.mAntiLambda())) { continue; + } // Lambda invariant mass cut for p2 - if (!invMLambda(p2.mLambda(), p2.mAntiLambda())) + if (!invMLambda(p2.mLambda(), p2.mAntiLambda())) { continue; + } const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 2); const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 1); @@ -668,6 +688,18 @@ struct femtoUniversePairTaskTrackV0Extended { } mixedEventCont.setPair(p1, p2, multCol, ConfUse3D); } + }; + + if (ConfUseCent) { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, 5, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()})); + } + } else { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, 5, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()})); + } } } PROCESS_SWITCH(femtoUniversePairTaskTrackV0Extended, processMixedEventV0, "Enable processing mixed events for V0 - V0", false); @@ -675,10 +707,10 @@ struct femtoUniversePairTaskTrackV0Extended { /// This function processes MC mixed events for Track - V0 void processMCMixedEvent(FilteredFDCollisions& cols, FemtoFullParticles& parts) { - ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; - - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + ColumnBinningPolicy colBinningMult{{ConfVtxBins, ConfMultBins}, true}; + ColumnBinningPolicy colBinningCent{{ConfVtxBins, ConfMultBins}, true}; + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { const int multCol = ConfUseCent ? collision1.multV0M() : collision1.multNtr(); auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); @@ -688,7 +720,7 @@ struct femtoUniversePairTaskTrackV0Extended { const auto& magFieldTesla2 = collision2.magField(); if (magFieldTesla1 != magFieldTesla2) { - continue; + return; } for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { if (static_cast(p1.pidcut()) != ConfTrkPDGCodePartOne) @@ -703,18 +735,30 @@ struct femtoUniversePairTaskTrackV0Extended { } mixedEventCont.setPair(p1, p2, multCol, ConfUse3D); } + }; + + if (ConfUseCent) { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, 5, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()})); + } + } else { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, 5, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()})); + } } } PROCESS_SWITCH(femtoUniversePairTaskTrackV0Extended, processMCMixedEvent, "Enable processing mixed events for MC truth track - V0", false); /// This function processes MC mixed events for V0 - V0 - void processMCMixedEventV0(FilteredFDCollisions& cols, FemtoFullParticles& parts) + void processMCMixedEventV0(FilteredFDCollisions& cols, FemtoFullParticles& /*parts*/) { - ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; - - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + ColumnBinningPolicy colBinningMult{{ConfVtxBins, ConfMultBins}, true}; + ColumnBinningPolicy colBinningCent{{ConfVtxBins, ConfMultBins}, true}; + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { const int multCol = ConfUseCent ? collision1.multV0M() : collision1.multNtr(); auto groupPartsOne = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); @@ -729,6 +773,18 @@ struct femtoUniversePairTaskTrackV0Extended { continue; mixedEventCont.setPair(p1, p2, multCol, ConfUse3D); } + }; + + if (ConfUseCent) { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, 5, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()})); + } + } else { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, 5, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()})); + } } } diff --git a/PWGCF/FemtoWorld/Tasks/femtoWorldHashTask.cxx b/PWGCF/FemtoWorld/Tasks/femtoWorldHashTask.cxx index a9c678bc2e5..4a6bdac3a2b 100644 --- a/PWGCF/FemtoWorld/Tasks/femtoWorldHashTask.cxx +++ b/PWGCF/FemtoWorld/Tasks/femtoWorldHashTask.cxx @@ -33,7 +33,7 @@ struct femtoWorldPairHashTask { std::vector CastCfgVtxBins, CastCfgMultBins; - Produces hashes; + Produces hashes; void init(InitContext&) { diff --git a/PWGCF/Flow/TableProducer/CMakeLists.txt b/PWGCF/Flow/TableProducer/CMakeLists.txt index bbfd7adac2b..8774e589414 100644 --- a/PWGCF/Flow/TableProducer/CMakeLists.txt +++ b/PWGCF/Flow/TableProducer/CMakeLists.txt @@ -8,3 +8,9 @@ # In applying this license CERN does not waive the privileges and immunities # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. + + +o2physics_add_dpl_workflow(zdc-q-vectors + SOURCES zdcQVectors.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx new file mode 100644 index 00000000000..c4873eb1246 --- /dev/null +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -0,0 +1,739 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file zdcQVectors.cxx +/// \author Noor Koster +/// \since 11/2024 +/// \brief In this task the energy calibration and recentring of Q-vectors constructed in the ZDCs will be done + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CCDB/BasicCCDBManager.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StaticFor.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "ReconstructionDataFormats/GlobalTrackID.h" +#include "ReconstructionDataFormats/Track.h" +#include "PWGCF/DataModel/SPTableZDC.h" + +#include "TH1F.h" +#include "TH2F.h" +#include "TProfile.h" +#include "TObjArray.h" +#include "TF1.h" +#include "TFitResult.h" +#include "TCanvas.h" +#include "TSystem.h" +#include "TROOT.h" + +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::track; +using namespace o2::aod::evsel; + +// define my..... +using UsedCollisions = soa::Join; +using BCsRun3 = soa::Join; + +namespace o2::analysis::qvectortask +{ + +int counter = 0; + +// step0 -> Energy calib +std::shared_ptr energyZN[10] = {{nullptr}}; +std::shared_ptr hQxvsQy[6] = {{nullptr}}; + +// and +std::shared_ptr hCOORDcorrelations[6][4] = {{nullptr}}; + +// Define histogrm names here to use same names for creating and later uploading and retrieving data from ccdb +// Energy calibration: +std::vector namesEcal(10, ""); +std::vector> names(5, std::vector()); //(1x 4d 4x 1d) +std::vector vnames = {"hvertex_vx", "hvertex_vy"}; + +// https://alice-notes.web.cern.ch/system/files/notes/analysis/620/017-May-31-analysis_note-ALICE_analysis_note_v2.pdf +std::vector pxZDC = {-1.75, 1.75, -1.75, 1.75}; +std::vector pyZDC = {-1.75, -1.75, 1.75, 1.75}; +double alphaZDC = 0.395; + +// step 0 tm 5 A&C +std::vector>> q(6, std::vector>(7, std::vector(4, 0.0))); // 5 iterations with 5 steps, each with 4 values + +// for energy calibration +std::vector eZN(8); // uncalibrated energy for the 2x4 towers (a1, a2, a3, a4, c1, c2, c3, c4) +std::vector meanEZN(10); // mean energies from calibration histos (common A, t1-4 A,common C, t1-4C) +std::vector e(8, 0.); // calibrated energies (a1, a2, a3, a4, c1, c2, c3, c4)) + +// Define variables needed to do the recentring steps. +double centrality = 0; +int runnumber = 0; +std::vector v(3, 0); // vx, vy, vz +bool isSelected = true; + +} // namespace o2::analysis::qvectortask + +using namespace o2::analysis::qvectortask; + +struct ZdcQVectors { + + Produces spTableZDC; + + ConfigurableAxis axisCent{"axisCent", {90, 0, 90}, "Centrality axis in 1% bins"}; + ConfigurableAxis axisCent10{"axisCent10", {9, 0, 90}, "Centrality axis in 10% bins"}; + ConfigurableAxis axisQ{"axisQ", {100, -2, 2}, "Q vector (xy) in ZDC"}; + ConfigurableAxis axisVxBig{"axisVxBig", {3, -0.01, 0.01}, "for Pos X of collision"}; + ConfigurableAxis axisVyBig{"axisVyBig", {3, -0.01, 0.01}, "for Pos Y of collision"}; + ConfigurableAxis axisVzBig{"axisVzBig", {3, -10, 10}, "for Pos Z of collision"}; + ConfigurableAxis axisVx{"axisVx", {10, -0.01, 0.01}, "for Pos X of collision"}; + ConfigurableAxis axisVy{"axisVy", {10, -0.01, 0.01}, "for Pos Y of collision"}; + ConfigurableAxis axisVz{"axisVz", {10, -10, 1}, "for vz of collision"}; + + O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") + O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMin, float, 0.2f, "Minimal.q pT for poi tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMax, float, 10.0f, "Maximal pT for poi tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "Minimal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 3.0f, "Maximal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field; default CCDB will be queried") + O2_DEFINE_CONFIGURABLE(cfgEnergyCal, std::string, "Users/c/ckoster/ZDC/LHC23_zzh_pass4/Energy", "ccdb path for energy calibration histos") + O2_DEFINE_CONFIGURABLE(cfgMeanv, std::string, "Users/c/ckoster/ZDC/LHC23_zzh_pass4/vmean", "ccdb path for mean v histos") + O2_DEFINE_CONFIGURABLE(cfgMinEntriesSparseBin, int, 100, "Minimal number of entries allowed in 4D recentering histogram to use for recentering.") + + Configurable> cfgRec1{"cfgRec1", {"Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step1", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step2", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step3", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step4", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step5"}, "ccdb paths for recentering calibration histos iteration 1"}; + Configurable> cfgRec2{"cfgRec2", {"Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step1", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step2", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step3", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step4", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step5"}, "ccdb paths for recentering calibration histos iteration 2"}; + Configurable> cfgRec3{"cfgRec3", {"Users/c/ckoster/ZDC/LHC23_zzh_pass4/it3_step1", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it3_step2", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it3_step3", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it3_step4", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it3_step5"}, "ccdb paths for recentering calibration histos iteration 3"}; + Configurable> cfgRec4{"cfgRec4", {"Users/c/ckoster/ZDC/LHC23_zzh_pass4/it4_step1", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it4_step2", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it4_step3", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it4_step4", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it4_step5"}, "ccdb paths for recentering calibration histos iteration 4"}; + Configurable> cfgRec5{"cfgRec5", {"Users/c/ckoster/ZDC/LHC23_zzh_pass4/it5_step1", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it5_step2", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it5_step3", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it5_step4", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it5_step5"}, "ccdb paths for recentering calibration histos iteration 5"}; + + // Define output + HistogramRegistry registry{"Registry"}; + + Service ccdb; + + // keep track of calibration histos for each given step and iteration + struct Calib { + std::vector> calibList = std::vector>(7, std::vector(8, nullptr)); + std::vector> calibfilesLoaded = std::vector>(7, std::vector(8, false)); + int atStep = 0; + int atIteration = 0; + } cal; + + void init(InitContext const&) + { + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + + std::vector sides = {"A", "C"}; + std::vector capCOORDS = {"X", "Y"}; + + // Tower mean energies vs. centrality used for tower gain equalisation + for (int tower = 0; tower < 10; tower++) { + namesEcal[tower] = TString::Format("hZN%s_mean_t%i_cent", sides[(tower < 5) ? 0 : 1], tower % 5); + energyZN[tower] = registry.add(Form("Energy/%s", namesEcal[tower].Data()), Form("%s", namesEcal[tower].Data()), kTProfile2D, {{1, 0, 1}, axisCent}); + } + + // Qx_vs_Qy for each step for ZNA and ZNC + for (int step = 0; step < 6; step++) { + registry.add(Form("step%i/QA/hSPplaneA", step), "hSPplaneA", kTH2D, {{100, -4, 4}, axisCent10}); + registry.add(Form("step%i/QA/hSPplaneC", step), "hSPplaneC", kTH2D, {{100, -4, 4}, axisCent10}); + for (const auto& side : sides) { + hQxvsQy[step] = registry.add(Form("step%i/hZN%s_Qx_vs_Qy", step, side), Form("hZN%s_Qx_vs_Qy", side), kTH2F, {axisQ, axisQ}); + } + int i = 0; + for (const auto& COORD1 : capCOORDS) { + for (const auto& COORD2 : capCOORDS) { + // Now we get: & vs. Centrality + hCOORDcorrelations[step][i] = registry.add(Form("step%i/QA/hQ%sA_Q%sC_vs_cent", step, COORD1, COORD2), Form("hQ%sA_Q%sC_vs_cent", COORD1, COORD2), kTProfile, {axisCent10}); + i++; + } + } + + // Add histograms for each step in the calibration process. + // Sides is {A,C} and capcoords is {X,Y} + for (const auto& side : sides) { + for (const auto& coord : capCOORDS) { + registry.add(Form("step%i/QA/hQ%s%s_vs_cent", step, coord, side), Form("hQ%s%s_vs_cent", coord, side), {HistType::kTProfile, {axisCent10}}); + registry.add(Form("step%i/QA/hQ%s%s_vs_vx", step, coord, side), Form("hQ%s%s_vs_vx", coord, side), {HistType::kTProfile, {axisVx}}); + registry.add(Form("step%i/QA/hQ%s%s_vs_vy", step, coord, side), Form("hQ%s%s_vs_vy", coord, side), {HistType::kTProfile, {axisVy}}); + registry.add(Form("step%i/QA/hQ%s%s_vs_vz", step, coord, side), Form("hQ%s%s_vs_vz", coord, side), {HistType::kTProfile, {axisVz}}); + + if (step == 1 || step == 5) { + TString name = TString::Format("hQ%s%s_mean_Cent_V_run", coord, side); + registry.add(Form("step%i/%s", step, name.Data()), Form("hQ%s%s_mean_Cent_V_run", coord, side), {HistType::kTHnSparseD, {axisCent10, axisVxBig, axisVyBig, axisVzBig, axisQ}}); + if (step == 1) + names[step - 1].push_back(name); + } + if (step == 2) { + TString name = TString::Format("hQ%s%s_mean_cent_run", coord, side); + registry.add(Form("step%i/%s", step, name.Data()), Form("hQ%s%s_mean_cent_run", coord, side), kTProfile, {axisCent}); + names[step - 1].push_back(name); + } + if (step == 3) { + TString name = TString::Format("hQ%s%s_mean_vx_run", coord, side); + registry.add(Form("step%i/%s", step, name.Data()), Form("hQ%s%s_mean_vx_run", coord, side), kTProfile, {axisVx}); + names[step - 1].push_back(name); + } + if (step == 4) { + TString name = TString::Format("hQ%s%s_mean_vy_run", coord, side); + registry.add(Form("step%i/%s", step, name.Data()), Form("hQ%s%s_mean_vy_run", coord, side), kTProfile, {axisVy}); + names[step - 1].push_back(name); + } + if (step == 5) { + TString name = TString::Format("hQ%s%s_mean_vz_run", coord, side); + registry.add(Form("step%i/%s", step, name.Data()), Form("hQ%s%s_mean_vz_run", coord, side), kTProfile, {axisVz}); + names[step - 1].push_back(name); + } + } // end of capCOORDS + } // end of sides + } // end of sum over steps + + // recentered q-vectors (to check what steps are finished in the end) + registry.add("hStep", "hStep", {HistType::kTH1D, {{10, 0., 10.}}}); + registry.add("hIteration", "hIteration", {HistType::kTH1D, {{10, 0., 10.}}}); + + registry.add("vmean/hvertex_vx", "hvertex_vx", kTProfile, {{1, 0., 1.}}); + registry.add("vmean/hvertex_vy", "hvertex_vy", kTProfile, {{1, 0., 1.}}); + registry.add("vmean/hvertex_vz", "hvertex_vz", kTProfile, {{1, 0., 1.}}); + + registry.add("QA/centrality_before", "centrality_before", kTH1D, {{200, 0, 100}}); + registry.add("QA/centrality_after", "centrality_after", kTH1D, {{200, 0, 100}}); + + registry.add("QA/ZNA_Energy", "ZNA_Energy", kTProfile, {{8, 0, 8}}); + registry.add("QA/ZNC_Energy", "ZNC_Energy", kTProfile, {{8, 0, 8}}); + } + + inline void fillRegistry(int iteration, int step) + { + if (step == 0 && iteration == 1) { + registry.fill(HIST("hIteration"), iteration, 1); + + registry.fill(HIST("step1/hQXA_mean_Cent_V_run"), runnumber, centrality, v[0], v[1], v[2], q[0][step][0]); + registry.fill(HIST("step1/hQYA_mean_Cent_V_run"), runnumber, centrality, v[0], v[1], v[2], q[0][step][1]); + registry.fill(HIST("step1/hQXC_mean_Cent_V_run"), runnumber, centrality, v[0], v[1], v[2], q[0][step][2]); + registry.fill(HIST("step1/hQYC_mean_Cent_V_run"), runnumber, centrality, v[0], v[1], v[2], q[0][step][3]); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 1) { + registry.get(HIST("step2/hQXA_mean_cent_run"))->Fill(centrality, q[iteration][step][0]); + registry.get(HIST("step2/hQYA_mean_cent_run"))->Fill(centrality, q[iteration][step][1]); + registry.get(HIST("step2/hQXC_mean_cent_run"))->Fill(centrality, q[iteration][step][2]); + registry.get(HIST("step2/hQYC_mean_cent_run"))->Fill(centrality, q[iteration][step][3]); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 2) { + registry.get(HIST("step3/hQXA_mean_vx_run"))->Fill(v[0], q[iteration][step][0]); + registry.get(HIST("step3/hQYA_mean_vx_run"))->Fill(v[0], q[iteration][step][1]); + registry.get(HIST("step3/hQXC_mean_vx_run"))->Fill(v[0], q[iteration][step][2]); + registry.get(HIST("step3/hQYC_mean_vx_run"))->Fill(v[0], q[iteration][step][3]); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 3) { + registry.get(HIST("step4/hQXA_mean_vy_run"))->Fill(v[1], q[iteration][step][0]); + registry.get(HIST("step4/hQYA_mean_vy_run"))->Fill(v[1], q[iteration][step][1]); + registry.get(HIST("step4/hQXC_mean_vy_run"))->Fill(v[1], q[iteration][step][2]); + registry.get(HIST("step4/hQYC_mean_vy_run"))->Fill(v[1], q[iteration][step][3]); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 4) { + registry.get(HIST("step5/hQXA_mean_vz_run"))->Fill(v[2], q[iteration][step][0]); + registry.get(HIST("step5/hQYA_mean_vz_run"))->Fill(v[2], q[iteration][step][1]); + registry.get(HIST("step5/hQXC_mean_vz_run"))->Fill(v[2], q[iteration][step][2]); + registry.get(HIST("step5/hQYC_mean_vz_run"))->Fill(v[2], q[iteration][step][3]); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 5) { + registry.fill(HIST("step5/hQXA_mean_Cent_V_run"), centrality, v[0], v[1], v[2], q[iteration][step][0]); + registry.fill(HIST("step5/hQYA_mean_Cent_V_run"), centrality, v[0], v[1], v[2], q[iteration][step][1]); + registry.fill(HIST("step5/hQXC_mean_Cent_V_run"), centrality, v[0], v[1], v[2], q[iteration][step][2]); + registry.fill(HIST("step5/hQYC_mean_Cent_V_run"), centrality, v[0], v[1], v[2], q[iteration][step][3]); + registry.fill(HIST("hStep"), step, 1); + } + } + + inline void fillCommonRegistry(int iteration) + { + // loop for filling multiple histograms with different naming patterns + // Always fill the uncentered "raw" Q-vector histos! + + registry.fill(HIST("step0/hZNA_Qx_vs_Qy"), q[0][0][0], q[0][0][1]); + registry.fill(HIST("step0/hZNC_Qx_vs_Qy"), q[0][0][2], q[0][0][3]); + + registry.fill(HIST("step0/QA/hQXA_QXC_vs_cent"), centrality, q[0][0][0] * q[0][0][2]); + registry.fill(HIST("step0/QA/hQYA_QYC_vs_cent"), centrality, q[0][0][1] * q[0][0][3]); + registry.fill(HIST("step0/QA/hQYA_QXC_vs_cent"), centrality, q[0][0][1] * q[0][0][2]); + registry.fill(HIST("step0/QA/hQXA_QYC_vs_cent"), centrality, q[0][0][0] * q[0][0][3]); + + registry.fill(HIST("step0/QA/hQXA_vs_cent"), centrality, q[0][0][0]); + registry.fill(HIST("step0/QA/hQYA_vs_cent"), centrality, q[0][0][1]); + registry.fill(HIST("step0/QA/hQXC_vs_cent"), centrality, q[0][0][2]); + registry.fill(HIST("step0/QA/hQYC_vs_cent"), centrality, q[0][0][3]); + + registry.fill(HIST("step0/QA/hQXA_vs_vx"), v[0], q[0][0][0]); + registry.fill(HIST("step0/QA/hQYA_vs_vx"), v[0], q[0][0][1]); + registry.fill(HIST("step0/QA/hQXC_vs_vx"), v[0], q[0][0][2]); + registry.fill(HIST("step0/QA/hQYC_vs_vx"), v[0], q[0][0][3]); + + registry.fill(HIST("step0/QA/hQXA_vs_vy"), v[1], q[0][0][0]); + registry.fill(HIST("step0/QA/hQYA_vs_vy"), v[1], q[0][0][1]); + registry.fill(HIST("step0/QA/hQXC_vs_vy"), v[1], q[0][0][2]); + registry.fill(HIST("step0/QA/hQYC_vs_vy"), v[1], q[0][0][3]); + + registry.fill(HIST("step0/QA/hQXA_vs_vz"), v[2], q[0][0][0]); + registry.fill(HIST("step0/QA/hQYA_vs_vz"), v[2], q[0][0][1]); + registry.fill(HIST("step0/QA/hQXC_vs_vz"), v[2], q[0][0][2]); + registry.fill(HIST("step0/QA/hQYC_vs_vz"), v[2], q[0][0][3]); + + static constexpr std::string_view SubDir[] = {"step1/", "step2/", "step3/", "step4/", "step5/"}; + static_for<0, 4>([&](auto Ind) { + constexpr int Index = Ind.value; + int indexRt = Index + 1; + + registry.fill(HIST(SubDir[Index]) + HIST("hZNA_Qx_vs_Qy"), q[iteration][indexRt][0], q[iteration][indexRt][1]); + registry.fill(HIST(SubDir[Index]) + HIST("hZNC_Qx_vs_Qy"), q[iteration][indexRt][2], q[iteration][indexRt][3]); + + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXA_QXC_vs_cent"), centrality, q[iteration][indexRt][0] * q[iteration][indexRt][2]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYA_QYC_vs_cent"), centrality, q[iteration][indexRt][1] * q[iteration][indexRt][3]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYA_QXC_vs_cent"), centrality, q[iteration][indexRt][1] * q[iteration][indexRt][2]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXA_QYC_vs_cent"), centrality, q[iteration][indexRt][0] * q[iteration][indexRt][3]); + + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXA_vs_cent"), centrality, q[iteration][indexRt][0]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYA_vs_cent"), centrality, q[iteration][indexRt][1]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXC_vs_cent"), centrality, q[iteration][indexRt][2]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYC_vs_cent"), centrality, q[iteration][indexRt][3]); + + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXA_vs_vx"), v[0], q[iteration][indexRt][0]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYA_vs_vx"), v[0], q[iteration][indexRt][1]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXC_vs_vx"), v[0], q[iteration][indexRt][2]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYC_vs_vx"), v[0], q[iteration][indexRt][3]); + + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXA_vs_vy"), v[1], q[iteration][indexRt][0]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYA_vs_vy"), v[1], q[iteration][indexRt][1]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXC_vs_vy"), v[1], q[iteration][indexRt][2]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYC_vs_vy"), v[1], q[iteration][indexRt][3]); + + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXA_vs_vz"), v[2], q[iteration][indexRt][0]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYA_vs_vz"), v[2], q[iteration][indexRt][1]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXC_vs_vz"), v[2], q[iteration][indexRt][2]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYC_vs_vz"), v[2], q[iteration][indexRt][3]); + + // add psi!! + double psiA = 1.0 * std::atan2(q[iteration][indexRt][2], q[iteration][indexRt][0]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hSPplaneA"), psiA, centrality, 1); + double psiC = 1.0 * std::atan2(q[iteration][indexRt][3], q[iteration][indexRt][1]); + registry.fill(HIST(SubDir[Index]) + HIST("QA/hSPplaneC"), psiC, centrality, 1); + }); + } + + void loadCalibrations(int iteration, int step, uint64_t timestamp, std::string ccdb_dir, std::vector names) + { + // iteration = 0 (Energy calibration) -> step 0 only + // iteration 1,2,3,4,5 = recentering -> 5 steps per iteration (1x 4D + 4x 1D) + if (ccdb_dir.empty() == false) { + + cal.calibList[iteration][step] = ccdb->getForTimeStamp(ccdb_dir, timestamp); + + if (cal.calibList[iteration][step]) { + for (std::size_t i = 0; i < names.size(); i++) { + TObject* obj = reinterpret_cast(cal.calibList[iteration][step]->FindObject(Form("%s", names[i].Data()))); + if (!obj) { + if (counter < 1) { + LOGF(error, "Object %s not found!!", names[i].Data()); + return; + } + } + // Try to cast to TProfile + if (TProfile* profile2D = dynamic_cast(obj)) { + if (profile2D->GetEntries() < 1) { + if (counter < 1) + LOGF(info, "%s (TProfile) is empty! Produce calibration file at given step", names[i].Data()); + cal.calibfilesLoaded[iteration][step] = false; + return; + } + if (counter < 1) + LOGF(info, "Loaded TProfile: %s", names[i].Data()); + } else if (TProfile2D* profile2D = dynamic_cast(obj)) { + if (profile2D->GetEntries() < 1) { + if (counter < 1) + LOGF(info, "%s (TProfile2D) is empty! Produce calibration file at given step", names[i].Data()); + cal.calibfilesLoaded[iteration][step] = false; + return; + } + if (counter < 1) + LOGF(info, "Loaded TProfile2D: %s", names[i].Data()); + } else if (THnSparse* sparse = dynamic_cast(obj)) { + if (sparse->GetEntries() < 1) { + if (counter < 1) + LOGF(info, "%s (THnSparse) is empty! Produce calibration file at given step", names[i].Data()); + cal.calibfilesLoaded[iteration][step] = false; + return; + } + if (counter < 1) + LOGF(info, "Loaded THnSparse: %s", names[i].Data()); + } + } // end of for loop + } else { + // when (cal.calib[iteration][step])=false! + if (counter < 1) + LOGF(warning, "Could not load TList with calibration histos from %s", ccdb_dir.c_str()); + cal.calibfilesLoaded[iteration][step] = false; + return; + } + if (counter < 1) + LOGF(info, "<--------OK----------> Calibrations loaded for cal.calibfilesLoaded[%i][%i]", iteration, step); + cal.calibfilesLoaded[iteration][step] = true; + cal.atIteration = iteration; + cal.atStep = step; + return; + } else { + if (counter < 1) + LOGF(info, "<--------X-----------> Calibrations not loaded for iteration %i and step %i cfg = empty!", iteration, step); + } + } + + template + double getCorrection(int iteration, int step, const char* objName) + { + T* hist = nullptr; + double calibConstant{0}; + + hist = reinterpret_cast(cal.calibList[iteration][step]->FindObject(Form("%s", objName))); + if (!hist) { + LOGF(fatal, "%s not available.. Abort..", objName); + } + + if (hist->InheritsFrom("TProfile2D")) { + // needed for energy calibration! + TProfile2D* h = reinterpret_cast(hist); + TString name = h->GetName(); + int binrunnumber = h->GetXaxis()->FindBin(TString::Format("%d", runnumber)); + int bin = h->GetYaxis()->FindBin(centrality); + calibConstant = h->GetBinContent(binrunnumber, bin); + } else if (hist->InheritsFrom("TProfile")) { + TProfile* h = reinterpret_cast(hist); + TString name = h->GetName(); + int bin{}; + if (name.Contains("mean_vx")) + bin = h->GetXaxis()->FindBin(v[0]); + if (name.Contains("mean_vy")) + bin = h->GetXaxis()->FindBin(v[1]); + if (name.Contains("mean_vz")) + bin = h->GetXaxis()->FindBin(v[2]); + if (name.Contains("mean_cent")) + bin = h->GetXaxis()->FindBin(centrality); + if (name.Contains("vertex")) + bin = h->GetXaxis()->FindBin(TString::Format("%i", runnumber)); + calibConstant = h->GetBinContent(bin); + } else if (hist->InheritsFrom("THnSparse")) { + std::vector sparsePars; + THnSparseD* h = reinterpret_cast(hist); + if (step == 0 && iteration > 0) { + // Axis(0) is runnuber, but we don't need this + sparsePars.push_back(h->GetAxis(1)->FindBin(centrality)); + sparsePars.push_back(h->GetAxis(2)->FindBin(v[0])); + sparsePars.push_back(h->GetAxis(3)->FindBin(v[1])); + sparsePars.push_back(h->GetAxis(4)->FindBin(v[2])); + } + + for (std::size_t i = 0; i < sparsePars.size() + 1; i++) { + h->GetAxis(i + 1)->SetRange(sparsePars[i], sparsePars[i]); + } + calibConstant = h->Projection(5)->GetMean(); + + if (h->Projection(sparsePars.size())->GetEntries() < cfgMinEntriesSparseBin) { + LOGF(debug, "1 entry in sparse bin! Not used... (increase binsize)"); + calibConstant = 0; + isSelected = false; + } + } + return calibConstant; + } + + void fillAllRegistries(int iteration, int step) + { + for (int s = 0; s <= step; s++) + fillRegistry(iteration, s); + fillCommonRegistry(iteration); + } + + void process(UsedCollisions::iterator const& collision, + BCsRun3 const& /*bcs*/, + aod::Zdcs const& /*zdcs*/) + { + // for Q-vector calculation + // A[0] & C[1] + std::vector sumZN(2, 0.); + std::vector xEnZN(2, 0.); + std::vector yEnZN(2, 0.); + + isSelected = true; + + auto cent = collision.centFT0C(); + + if (cent < 0 || cent > 90) { + isSelected = false; + spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); + return; + } + + registry.fill(HIST("QA/centrality_before"), cent); + + const auto& foundBC = collision.foundBC_as(); + + if (!foundBC.has_zdc()) { + isSelected = false; + spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); + return; + } + + v[0] = collision.posX(); + v[1] = collision.posY(); + v[2] = collision.posZ(); + centrality = cent; + runnumber = foundBC.runNumber(); + + const auto& zdcCol = foundBC.zdc(); + + // Get the raw energies eZN[8] (not the common A,C) + for (int tower = 0; tower < 8; tower++) { + eZN[tower] = (tower < 4) ? zdcCol.energySectorZNA()[tower] : zdcCol.energySectorZNC()[tower % 4]; + } + + // load the calibration histos for iteration 0 step 0 (Energy Calibration) + loadCalibrations(0, 0, foundBC.timestamp(), cfgEnergyCal.value, namesEcal); + + if (!cal.calibfilesLoaded[0][0]) { + if (counter < 1) { + LOGF(info, " --> No Energy calibration files found.. -> Only Energy calibration will be done. "); + } + } + // load the calibrations for the mean v + loadCalibrations(0, 1, foundBC.timestamp(), cfgMeanv.value, vnames); + + if (!cal.calibfilesLoaded[0][1]) { + if (counter < 1) + LOGF(warning, " --> No mean V found.. -> THis wil lead to wrong axis for vx, vy (will be created in vmean/)"); + registry.get(HIST("vmean/hvertex_vx"))->Fill(Form("%d", runnumber), v[0]); + registry.get(HIST("vmean/hvertex_vy"))->Fill(Form("%d", runnumber), v[1]); + registry.get(HIST("vmean/hvertex_vz"))->Fill(Form("%d", runnumber), v[2]); + } + + if (counter < 1) + LOGF(info, "=====================> .....Start Energy Calibration..... <====================="); + + bool isZNAhit = true; + bool isZNChit = true; + + for (int i = 0; i < 8; ++i) { + if (i < 4 && eZN[i] <= 0) + isZNAhit = false; + if (i > 3 && eZN[i] <= 0) + isZNChit = false; + } + + if (zdcCol.energyCommonZNA() <= 0) + isZNAhit = false; + if (zdcCol.energyCommonZNC() <= 0) + isZNChit = false; + + // Fill to get mean energy per tower in 1% centrality bins + for (int tower = 0; tower < 5; tower++) { + if (tower == 0) { + if (isZNAhit) + energyZN[tower]->Fill(Form("%d", runnumber), cent, zdcCol.energyCommonZNA(), 1); + if (isZNChit) + energyZN[tower + 5]->Fill(Form("%d", runnumber), cent, zdcCol.energyCommonZNC(), 1); + LOGF(debug, "Common A tower filled with: %i, %.2f, %.2f", runnumber, cent, zdcCol.energyCommonZNA()); + } else { + if (isZNAhit) + energyZN[tower]->Fill(Form("%d", runnumber), cent, eZN[tower - 1], 1); + if (isZNChit) + energyZN[tower + 5]->Fill(Form("%d", runnumber), cent, eZN[tower - 1 + 4], 1); + LOGF(debug, "Tower ZNC[%i] filled with: %i, %.2f, %.2f", tower, runnumber, cent, eZN[tower - 1 + 4]); + } + } + + // if ZNA or ZNC not hit correctly.. do not use event in q-vector calculation + if (!isZNAhit || !isZNChit) { + counter++; + isSelected = false; + spTableZDC(runnumber, centrality, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); + return; + } + + if (!cal.calibfilesLoaded[0][0]) { + counter++; + isSelected = false; + spTableZDC(runnumber, centrality, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); + return; + } + + if (counter < 1) + LOGF(info, "files for step 0 (energy Calibraton) are open!"); + + if (counter < 1) { + LOGF(info, "=====================> .....Start Calculating Q-Vectors..... <====================="); + } + + // Now start gain equalisation! + // Fill the list with calibration constants. + for (int tower = 0; tower < 10; tower++) { + meanEZN[tower] = getCorrection(0, 0, namesEcal[tower].Data()); + } + + // Use the calibration constants but now only loop over towers 1-4 + int calibtower = 0; + std::vector towersNocom = {1, 2, 3, 4, 6, 7, 8, 9}; + + for (const auto& tower : towersNocom) { + if (meanEZN[tower] > 0) { + double ecommon = (tower > 4) ? meanEZN[5] : meanEZN[0]; + e[calibtower] = eZN[calibtower] * (0.25 * ecommon) / meanEZN[tower]; + } + calibtower++; + } + + for (int i = 0; i < 4; i++) { + float bincenter = i + .5; + registry.fill(HIST("QA/ZNA_Energy"), bincenter, eZN[i]); + registry.fill(HIST("QA/ZNA_Energy"), bincenter + 4, e[i]); + registry.fill(HIST("QA/ZNC_Energy"), bincenter, eZN[i + 4]); + registry.fill(HIST("QA/ZNC_Energy"), bincenter + 4, e[i + 4]); + } + + // Now calculate Q-vector + for (int tower = 0; tower < 8; tower++) { + int side = (tower > 3) ? 1 : 0; + int sector = tower % 4; + double energy = std::pow(e[tower], alphaZDC); + sumZN[side] += energy; + xEnZN[side] += (side == 0) ? pxZDC[sector] * energy : -1.0 * pxZDC[sector] * energy; + yEnZN[side] += pyZDC[sector] * energy; + } + + // "QXA", "QYA", "QXC", "QYC" + for (int i = 0; i < 2; ++i) { + if (sumZN[i] > 0) { + q[0][0][i * 2] = xEnZN[i] / sumZN[i]; // for QXA[0] and QXC[2] + q[0][0][i * 2 + 1] = yEnZN[i] / sumZN[i]; // for QYA[1] and QYC[3] + } + } + + if (cal.calibfilesLoaded[0][1]) { + if (counter < 1) + LOGF(info, "=====================> Setting v to vmean!"); + v[0] = v[0] - getCorrection(0, 1, vnames[0].Data()); + v[1] = v[1] - getCorrection(0, 1, vnames[1].Data()); + } + + for (int iteration = 1; iteration < 6; iteration++) { + std::vector ccdbDirs; + if (iteration == 1) + ccdbDirs = cfgRec1.value; + if (iteration == 2) + ccdbDirs = cfgRec2.value; + if (iteration == 3) + ccdbDirs = cfgRec3.value; + if (iteration == 4) + ccdbDirs = cfgRec4.value; + if (iteration == 5) + ccdbDirs = cfgRec5.value; + + for (int step = 0; step < 5; step++) { + loadCalibrations(iteration, step, foundBC.timestamp(), (ccdbDirs)[step], names[step]); + } + } + + if (counter < 1) + LOGF(info, "We evaluate cal.atIteration=%i and cal.atStep=%i ", cal.atIteration, cal.atStep); + + if (cal.atIteration == 0) { + if (counter < 1) + LOGF(warning, "Calibation files missing!!! Output created with q-vectors right after energy gain eq. !!"); + fillAllRegistries(0, 0); + spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[0][0][0], q[0][0][1], q[0][0][2], q[0][0][3], isSelected, 0, 0); + counter++; + return; + } else { + for (int iteration = 1; iteration <= cal.atIteration; iteration++) { + for (int step = 0; step < cal.atStep + 1; step++) { + if (cal.calibfilesLoaded[iteration][step]) { + for (int i = 0; i < 4; i++) { + if (step == 0) { + if (iteration == 1) { + q[iteration][step + 1][i] = q[0][0][i] - getCorrection(iteration, step, names[step][i].Data()); + } else { + q[iteration][step + 1][i] = q[iteration - 1][5][i] - getCorrection(iteration, step, names[step][i].Data()); + } + } else { + q[iteration][step + 1][i] = q[iteration][step][i] - getCorrection(iteration, step, names[step][i].Data()); + } + } + } else { + if (counter < 1) + LOGF(warning, "Something went wrong in calibration loop! File not loaded but bool set to tue"); + } // end of (cal.calibLoaded) + } // end of step + } // end of iteration + + if (counter < 1) + LOGF(info, "Output created with q-vectors at iteration %i and step %i!!!!", cal.atIteration, cal.atStep + 1); + fillAllRegistries(cal.atIteration, cal.atStep + 1); + registry.fill(HIST("QA/centrality_after"), centrality); + spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[cal.atIteration][cal.atStep][0], q[cal.atIteration][cal.atStep][1], q[cal.atIteration][cal.atStep][2], q[cal.atIteration][cal.atStep][3], isSelected, cal.atIteration, cal.atStep); + counter++; + return; + } + LOGF(warning, "We return without saving table... -> THis is a problem"); + } // end of process +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index 6185363ce56..d6e288a4594 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -19,6 +19,11 @@ o2physics_add_dpl_workflow(flow-task PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::GFWCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(flow-runbyrun + SOURCES FlowRunbyRun.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::GFWCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(flow-gfw-pbpb SOURCES FlowGFWPbPb.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore @@ -34,8 +39,8 @@ o2physics_add_dpl_workflow(flow-gf PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(flow-pbpb-pikp-task - SOURCES FlowPbPbpikp.cxx +o2physics_add_dpl_workflow(flow-pbpb-pikp + SOURCES flowPbpbPikp.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) @@ -43,3 +48,13 @@ o2physics_add_dpl_workflow(flow-gfw-omegaxi SOURCES flowGFWOmegaXi.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(flow-pid-cme + SOURCES pidcme.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(flow-sp + SOURCES flowSP.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx b/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx index 5cc9f01ae28..39cddafbd2a 100644 --- a/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx +++ b/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" @@ -44,18 +46,6 @@ using namespace o2::aod::evsel; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; -static constexpr TrackSelectionFlags::flagtype trackSelectionITS = - TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | - TrackSelectionFlags::kITSHits; -static constexpr TrackSelectionFlags::flagtype trackSelectionTPC = - TrackSelectionFlags::kTPCNCls | - TrackSelectionFlags::kTPCCrossedRowsOverNCls | - TrackSelectionFlags::kTPCChi2NDF; -static constexpr TrackSelectionFlags::flagtype trackSelectionDCA = - TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy; -static constexpr TrackSelectionFlags::flagtype trackSelectionDCAXYonly = - TrackSelectionFlags::kDCAxy; - struct FlowGFWPbPb { O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") @@ -74,10 +64,18 @@ struct FlowGFWPbPb { O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object") O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy") O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") - O2_DEFINE_CONFIGURABLE(dcaZ, float, 0.2f, "Custom DCA Z cut (ignored if negative)") - O2_DEFINE_CONFIGURABLE(GlobalplusITS, bool, false, "Global and ITS tracks") - O2_DEFINE_CONFIGURABLE(Globalonly, bool, false, "Global only tracks") + O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2, "Custom DCA Z cut") + O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 0.2f, "Custom DCA XY cut") + O2_DEFINE_CONFIGURABLE(cfgTVXinTRD, bool, false, "Use kTVXinTRD (reject TRD triggered events)"); + O2_DEFINE_CONFIGURABLE(cfgNoTimeFrameBorder, bool, false, "kNoTimeFrameBorder"); + O2_DEFINE_CONFIGURABLE(cfgNoITSROFrameBorder, bool, false, "kNoITSROFrameBorder"); + O2_DEFINE_CONFIGURABLE(cfgNoSameBunchPileup, bool, false, "kNoSameBunchPileup"); + O2_DEFINE_CONFIGURABLE(cfgIsGoodZvtxFT0vsPV, bool, false, "kIsGoodZvtxFT0vsPV"); + O2_DEFINE_CONFIGURABLE(cfgNoCollInTimeRangeStandard, bool, false, "kNoCollInTimeRangeStandard"); + O2_DEFINE_CONFIGURABLE(cfgOccupancy, bool, false, "Bool for event selection on detector occupancy"); + O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, false, "Use additional event cut on mult correlations"); O2_DEFINE_CONFIGURABLE(ITSonly, bool, false, "ITS only tracks") + O2_DEFINE_CONFIGURABLE(Global, bool, false, "Global tracks") ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; @@ -124,11 +122,28 @@ struct FlowGFWPbPb { kc26, kc28, kc22etagap, + kc32etagap, + kc34, // Count the total number of enum kCount_ExtraProfile }; + enum eventprogress { + kFILTERED, + kSEL8, + kOCCUPANCY, + kTVXINTRD, + kNOTIMEFRAMEBORDER, + kNOITSROFRAMEBORDER, + kNOPSAMEBUNCHPILEUP, + kISGOODZVTXFT0VSPV, + kNOCOLLINTIMERANGESTANDART, + kAFTERMULTCUTS, + kCENTRALITY, + kNOOFEVENTSTEPS + }; + // Additional Event selection cuts - Copy from flowGenericFramework.cxx TF1* fPhiCutLow = nullptr; TF1* fPhiCutHigh = nullptr; @@ -147,11 +162,18 @@ struct FlowGFWPbPb { ccdb->setCreatedNotAfter(nolaterthan.value); // Add some output objects to the histogram registry - registry.add("hEventCount", "Number of Events;; No. of Events", {HistType::kTH1D, {{4, 0, 4}}}); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered Events"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "After sel8"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "After additional event cut"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "After correction loads"); + registry.add("hEventCount", "Number of Events;; No. of Events", {HistType::kTH1D, {{kNOOFEVENTSTEPS, -0.5, +kNOOFEVENTSTEPS - 0.5}}}); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kFILTERED + 1, "Filtered events"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kSEL8 + 1, "Sel8"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kOCCUPANCY + 1, "Occupancy"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kTVXINTRD + 1, "kTVXinTRD"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kNOTIMEFRAMEBORDER + 1, "kNoTimeFrameBorder"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kNOITSROFRAMEBORDER + 1, "kNoITSROFrameBorder"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kNOPSAMEBUNCHPILEUP + 1, "kNoSameBunchPileup"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kISGOODZVTXFT0VSPV + 1, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kNOCOLLINTIMERANGESTANDART + 1, "kNoCollInTimeRangeStandard"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kAFTERMULTCUTS + 1, "After Mult cuts"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kCENTRALITY + 1, "Centrality"); registry.add("hPhi", "#phi distribution", {HistType::kTH1D, {axisPhi}}); registry.add("hPhiWeighted", "corrected #phi distribution", {HistType::kTH1D, {axisPhi}}); registry.add("hEta", "", {HistType::kTH1D, {axisEta}}); @@ -179,13 +201,11 @@ struct FlowGFWPbPb { registry.add("multT0C_centT0C_Aft", "after cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}}); // Track types - registry.add("GlobalplusITS", "Global plus ITS;Centrality FT0C;No. of Events", kTH1F, {axisCentrality}); - registry.add("Globalonly", "Global only;Centrality FT0C;No. of Events", kTH1F, {axisCentrality}); - registry.add("ITSonly", "ITS only;Centrality FT0C;No. of Events", kTH1F, {axisCentrality}); + registry.add("Global_Tracks", "Global Tracks;Centrality FT0C;No. of Events", kTH1F, {axisCentrality}); registry.add("Events_per_Centrality_Bin", "Events_per_Centrality_Bin;Centrality FT0C;No. of Events", kTH1F, {axisCentrality}); - registry.add("GlobalplusITS_Nch_vs_Cent", "Global plus ITS;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}}); - registry.add("Globalonly_Nch_vs_Cent", "Global only;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}}); - registry.add("ITSonly_Nch_vs_Cent", "ITS only;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}}); + registry.add("Global_Tracks_Nch_vs_Cent", "Global Tracks;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}}); + registry.add("ITSonly", "ITS only;Centrality FT0C;Nch", kTH1F, {axisCentrality}); + registry.add("ITSOnly_Tracks_Nch_vs_Cent", "ITSOnly Tracks;Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}}); // Track QA registry.add("hPt", "p_{T} distribution before cut", {HistType::kTH1D, {axisPtHist}}); @@ -204,6 +224,8 @@ struct FlowGFWPbPb { registry.add("c26", ";Centrality (%) ; C_{2}{6}", {HistType::kTProfile, {axisCentrality}}); registry.add("c28", ";Centrality (%) ; C_{2}{8}", {HistType::kTProfile, {axisCentrality}}); registry.add("c22etagap", ";Centrality (%) ; C_{2}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisCentrality}}); + registry.add("c32etagap", ";Centrality (%) ; C_{3}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisCentrality}}); + registry.add("c34", ";Centrality (%) ; C_{3}{4} ", {HistType::kTProfile, {axisCentrality}}); // initial array BootstrapArray.resize(cfgNbootstrap); @@ -217,6 +239,8 @@ struct FlowGFWPbPb { BootstrapArray[i][kc26] = registry.add(Form("BootstrapContainer_%d/c26", i), ";Centrality (%) ; C_{2}{6}", {HistType::kTProfile, {axisCentrality}}); BootstrapArray[i][kc28] = registry.add(Form("BootstrapContainer_%d/c28", i), ";Centrality (%) ; C_{2}{8}", {HistType::kTProfile, {axisCentrality}}); BootstrapArray[i][kc22etagap] = registry.add(Form("BootstrapContainer_%d/c22etagap", i), ";Centrality (%) ; C_{2}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc32etagap] = registry.add(Form("BootstrapContainer_%d/c32etagap", i), ";Centrality (%) ; C_{3}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc34] = registry.add(Form("BootstrapContainer_%d/c34", i), ";Centrality (%) ; C_{3}{4}", {HistType::kTProfile, {axisCentrality}}); } o2::framework::AxisSpec axis = axisPt; @@ -245,6 +269,8 @@ struct FlowGFWPbPb { corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 2 2 -2 -2 -2}", "ChFull26", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 2 2 2 -2 -2 -2 -2}", "ChFull28", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {2} refP10 {-2}", "Ch10Gap22", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {3} refP10 {-3}", "Ch10Gap32", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {3 3 -3 -3}", "ChFull34", kFALSE)); fGFW->CreateRegions(); // finalize the initialization if (cfgUseAdditionalEventCut) { @@ -367,30 +393,53 @@ struct FlowGFWPbPb { template bool eventSelected(o2::aod::mult::MultNTracksPV, TCollision collision, const int multTrk, const float centrality) { - if (collision.alias_bit(kTVXinTRD)) { - // TRD triggered - return false; + if (cfgTVXinTRD) { + if (collision.alias_bit(kTVXinTRD)) { + // TRD triggered + return false; + } + registry.fill(HIST("hEventCount"), kTVXINTRD); } - if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - // reject collisions close to Time Frame borders - // https://its.cern.ch/jira/browse/O2-4623 - return false; + if (cfgNoTimeFrameBorder) { + if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + // reject collisions close to Time Frame borders + // https://its.cern.ch/jira/browse/O2-4623 + return false; + } + registry.fill(HIST("hEventCount"), kNOTIMEFRAMEBORDER); } - if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - // reject events affected by the ITS ROF border - // https://its.cern.ch/jira/browse/O2-4309 - return false; + if (cfgNoITSROFrameBorder) { + if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + // reject events affected by the ITS ROF border + // https://its.cern.ch/jira/browse/O2-4309 + return false; + } + registry.fill(HIST("hEventCount"), kNOITSROFRAMEBORDER); } - if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - // rejects collisions which are associated with the same "found-by-T0" bunch crossing - // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof - return false; + if (cfgNoSameBunchPileup) { + if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return false; + } + registry.fill(HIST("hEventCount"), kNOPSAMEBUNCHPILEUP); } - if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference - // use this cut at low multiplicities with caution - return false; + if (cfgIsGoodZvtxFT0vsPV) { + if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return false; + } + registry.fill(HIST("hEventCount"), kISGOODZVTXFT0VSPV); + } + if (cfgNoCollInTimeRangeStandard) { + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + // no collisions in specified time range + return false; + } + registry.fill(HIST("hEventCount"), kNOCOLLINTIMERANGESTANDART); } + float vtxz = -999; if (collision.numContrib() > 1) { vtxz = collision.posZ(); @@ -400,22 +449,21 @@ struct FlowGFWPbPb { } auto multNTracksPV = collision.multNTracksPV(); - auto occupancy = collision.trackOccupancyInTimeRange(); - if (centrality >= 70. || centrality < 0) - return false; if (abs(vtxz) > cfgCutVertex) return false; - if (multNTracksPV < fMultPVCutLow->Eval(centrality)) - return false; - if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) - return false; - if (multTrk < fMultCutLow->Eval(centrality)) - return false; - if (multTrk > fMultCutHigh->Eval(centrality)) - return false; - if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh) - return false; + + if (cfgMultCut) { + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + return false; + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + return false; + if (multTrk < fMultCutLow->Eval(centrality)) + return false; + if (multTrk > fMultCutHigh->Eval(centrality)) + return false; + registry.fill(HIST("hEventCount"), kAFTERMULTCUTS); + } // V0A T0A 5 sigma cut if (abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A())) @@ -460,20 +508,14 @@ struct FlowGFWPbPb { // Apply process filters Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; - Filter trackFilter = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && - ncheckbit(aod::track::trackCutFlag, trackSelectionITS) && - ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), - ncheckbit(aod::track::trackCutFlag, trackSelectionTPC), true) && - ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, trackSelectionDCAXYonly), - ncheckbit(aod::track::trackCutFlag, trackSelectionDCA)) && - (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax); - - using Colls = soa::Filtered>; // collisions filter + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy); + + using Colls = soa::Filtered>; // collisions filter using aodTracks = soa::Filtered>; // tracks filter void process(Colls::iterator const& collision, aod::BCsWithTimestamps const&, aodTracks const& tracks) { - registry.fill(HIST("hEventCount"), 0.5); + registry.fill(HIST("hEventCount"), kFILTERED); if (!collision.sel8()) return; @@ -489,27 +531,35 @@ struct FlowGFWPbPb { registry.fill(HIST("BeforeCut_globalTracks_multV0A"), collision.multFV0A(), tracks.size()); registry.fill(HIST("BeforeCut_multV0A_multT0A"), collision.multFT0A(), collision.multFV0A()); registry.fill(HIST("BeforeCut_multT0C_centT0C"), collision.centFT0C(), collision.multFT0C()); - registry.fill(HIST("hEventCount"), 1.5); + registry.fill(HIST("hEventCount"), kSEL8); - const auto cent = collision.centFT0C(); + const auto centrality = collision.centFT0C(); + + if (cfgOccupancy) { + int occupancy = collision.trackOccupancyInTimeRange(); + if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh) + return; + registry.fill(HIST("hEventCount"), kOCCUPANCY); + } - if (cfgUseAdditionalEventCut && !eventSelected(o2::aod::mult::MultNTracksPV(), collision, tracks.size(), cent)) { + if (cfgUseAdditionalEventCut && !eventSelected(o2::aod::mult::MultNTracksPV(), collision, tracks.size(), centrality)) { return; } - registry.fill(HIST("hEventCount"), 2.5); + if (centrality < 0 || centrality >= 70.) + return; float vtxz = collision.posZ(); float l_Random = fRndm->Rndm(); registry.fill(HIST("hVtxZ"), vtxz); registry.fill(HIST("hMult"), Ntot); - registry.fill(HIST("hCent"), cent); - registry.fill(HIST("cent_vs_Nch"), cent, Ntot); + registry.fill(HIST("hCent"), centrality); + registry.fill(HIST("cent_vs_Nch"), centrality, Ntot); fGFW->Clear(); auto bc = collision.bc_as(); loadCorrections(bc.timestamp()); - registry.fill(HIST("hEventCount"), 3.5); + registry.fill(HIST("hEventCount"), kCENTRALITY); // fill event QA after cuts registry.fill(HIST("globalTracks_centT0C_Aft"), collision.centFT0C(), tracks.size()); @@ -530,16 +580,17 @@ struct FlowGFWPbPb { } // track loop - int globalplusits_nch{0}; - int gloabalonly_nch{0}; - int itsonly_nch{0}; + int globaltracks_nch{0}; + int itstracks_nch{0}; for (auto& track : tracks) { + if (track.tpcNClsFound() < cfgCutTPCclu) + continue; if (cfgUseAdditionalTrackCut && !trackSelected(track, Magnetfield)) continue; if (cfgOutputNUAWeights) - fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), centrality, 0); if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) continue; @@ -558,54 +609,48 @@ struct FlowGFWPbPb { registry.fill(HIST("hDCAxy"), track.dcaXY(), track.pt()); } - globalplusits_nch++; - registry.fill(HIST("GlobalplusITS"), collision.centFT0C()); - if (GlobalplusITS) { + globaltracks_nch++; + itstracks_nch++; + if (Global == true) { + registry.fill(HIST("Global_Tracks"), collision.centFT0C()); if (WithinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); + fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 1); } - if (track.hasTPC()) { - gloabalonly_nch++; - registry.fill(HIST("Globalonly"), collision.centFT0C()); - if (Globalonly) { - if (WithinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); - } - } else { - itsonly_nch++; + if (track.hasITS() && ITSonly == true) { registry.fill(HIST("ITSonly"), collision.centFT0C()); - if (ITSonly) { - if (WithinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); - } + if (WithinPtRef) + fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 1); } } // End of track loop - registry.fill(HIST("Events_per_Centrality_Bin"), cent); - registry.fill(HIST("GlobalplusITS_Nch_vs_Cent"), cent, globalplusits_nch); - registry.fill(HIST("Globalonly_Nch_vs_Cent"), cent, gloabalonly_nch); - registry.fill(HIST("ITSonly_Nch_vs_Cent"), cent, itsonly_nch); + registry.fill(HIST("Events_per_Centrality_Bin"), centrality); + registry.fill(HIST("Global_Tracks_Nch_vs_Cent"), centrality, globaltracks_nch); + registry.fill(HIST("ITSOnly_Tracks_Nch_vs_Cent"), centrality, itstracks_nch); // Filling c22 with ROOT TProfile - FillProfile(corrconfigs.at(0), HIST("c22"), cent); - FillProfile(corrconfigs.at(1), HIST("c24"), cent); - FillProfile(corrconfigs.at(2), HIST("c26"), cent); - FillProfile(corrconfigs.at(3), HIST("c28"), cent); - FillProfile(corrconfigs.at(4), HIST("c22etagap"), cent); + FillProfile(corrconfigs.at(0), HIST("c22"), centrality); + FillProfile(corrconfigs.at(1), HIST("c24"), centrality); + FillProfile(corrconfigs.at(2), HIST("c26"), centrality); + FillProfile(corrconfigs.at(3), HIST("c28"), centrality); + FillProfile(corrconfigs.at(4), HIST("c22etagap"), centrality); + FillProfile(corrconfigs.at(5), HIST("c32etagap"), centrality); + FillProfile(corrconfigs.at(6), HIST("c34"), centrality); // Filling Bootstrap Samples int SampleIndex = static_cast(cfgNbootstrap * l_Random); - FillProfile(corrconfigs.at(0), BootstrapArray[SampleIndex][kc22], cent); - FillProfile(corrconfigs.at(1), BootstrapArray[SampleIndex][kc24], cent); - FillProfile(corrconfigs.at(2), BootstrapArray[SampleIndex][kc26], cent); - FillProfile(corrconfigs.at(3), BootstrapArray[SampleIndex][kc28], cent); - FillProfile(corrconfigs.at(4), BootstrapArray[SampleIndex][kc22etagap], cent); + FillProfile(corrconfigs.at(0), BootstrapArray[SampleIndex][kc22], centrality); + FillProfile(corrconfigs.at(1), BootstrapArray[SampleIndex][kc24], centrality); + FillProfile(corrconfigs.at(2), BootstrapArray[SampleIndex][kc26], centrality); + FillProfile(corrconfigs.at(3), BootstrapArray[SampleIndex][kc28], centrality); + FillProfile(corrconfigs.at(4), BootstrapArray[SampleIndex][kc22etagap], centrality); + FillProfile(corrconfigs.at(5), BootstrapArray[SampleIndex][kc32etagap], centrality); + FillProfile(corrconfigs.at(6), BootstrapArray[SampleIndex][kc34], centrality); // Filling Flow Container for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { - FillFC(corrconfigs.at(l_ind), cent, l_Random); + FillFC(corrconfigs.at(l_ind), centrality, l_Random); } } // End of process diff --git a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx deleted file mode 100644 index 9ad0696091a..00000000000 --- a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -/// -/// \brief this is a code for the elliptic flow of identified hadrons -/// \author prottay das, preet -/// \since 29/05/2024 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" -#include "Framework/runDataProcessing.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "ReconstructionDataFormats/Track.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using std::array; - -struct v2ellip { - - // Connect to ccdb - Service ccdb; - Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable url{"ccdb-url", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; - - SliceCache cache; - - // Histograms are defined with HistogramRegistry - HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - - // Confugrable for QA histograms - Configurable onlyTOF{"onlyTOF", false, "only TOF tracks"}; - Configurable onlyTOFHIT{"onlyTOFHIT", false, "accept only TOF hit tracks at high pt"}; - bool onlyTPC = true; - - // Configurables for track selections - Configurable cfgCutPT{"cfgCutPT", 0.2f, "PT cut on daughter track"}; - Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta cut on daughter track"}; - Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; - Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; - Configurable nsigmaCutTPCPi{"nsigmacutTPCPi", 3.0, "Value of the TPC Nsigma cut for pions"}; - Configurable nsigmaCutTPCKa{"nsigmacutTPCKa", 3.0, "Value of the TPC Nsigma cut for kaons"}; - Configurable nsigmaCutTPCPr{"nsigmacutTPCPr", 3.0, "Value of the TPC Nsigma cut for protons"}; - Configurable nsigmaCutTOFPi{"nsigmacutTOFPi", 3.0, "Value of the TOF Nsigma cut for pions"}; - Configurable nsigmaCutTOFKa{"nsigmacutTOFKa", 3.0, "Value of the TOF Nsigma cut for kaons"}; - Configurable nsigmaCutTOFPr{"nsigmacutTOFPr", 3.0, "Value of the TOF Nsigma cut for protons"}; - Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the Combined Nsigma cut"}; - Configurable ismanualDCAcut{"ismanualDCAcut", true, "ismanualDCAcut"}; - Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; - Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; - - // Event selection configurables - Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; - Configurable TVXEvsel{"TVXEvsel", false, "Triggger selection"}; - Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; - - // Configurable for histograms - Configurable nBins{"nBins", 100, "N bins in all histos"}; - ConfigurableAxis binsMultPlot{"binsCent", {201, -0.5f, 200.5f}, "Binning of the centrality axis for plots"}; - - void init(InitContext const&) - { - // Axes - AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm] for plots"}; - AxisSpec axisv2ref = {10, 0, 10, "v2_{ref}"}; - AxisSpec axisv2diff = {14, 0, 14, "v2_{def}"}; - AxisSpec axisphi = {700, 0, 7, "#phi"}; - - // Histograms - // Event selection - rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); - rEventSelection.add("hmult", "Centrality distribution", kTH1F, {{binsMultPlot}}); - - // v2 tprofiles for reference and differential flow - histos.add("profv2ref", "profv2ref", kTProfile, {axisv2ref}); - histos.add("profv2diff_pr_10_20", "profv2diff_pr_10_20", kTProfile, {axisv2diff}); - histos.add("profv2diff_pi_10_20", "profv2diff_pi_10_20", kTProfile, {axisv2diff}); - histos.add("profv2diff_k_10_20", "profv2diff_k_10_20", kTProfile, {axisv2diff}); - - histos.add("profv2diff_pr_20_30", "profv2diff_pr_20_30", kTProfile, {axisv2diff}); - histos.add("profv2diff_pi_20_30", "profv2diff_pi_20_30", kTProfile, {axisv2diff}); - histos.add("profv2diff_k_20_30", "profv2diff_k_20_30", kTProfile, {axisv2diff}); - - histos.add("profv2diff_pr_30_40", "profv2diff_pr_30_40", kTProfile, {axisv2diff}); - histos.add("profv2diff_pi_30_40", "profv2diff_pi_30_40", kTProfile, {axisv2diff}); - histos.add("profv2diff_k_30_40", "profv2diff_k_30_40", kTProfile, {axisv2diff}); - - histos.add("profv2diff_pr_40_50", "profv2diff_pr_40_50", kTProfile, {axisv2diff}); - histos.add("profv2diff_pi_40_50", "profv2diff_pi_40_50", kTProfile, {axisv2diff}); - histos.add("profv2diff_k_40_50", "profv2diff_k_40_50", kTProfile, {axisv2diff}); - - // histogram for phi distribution - histos.add("hphi", "hphi", kTH1F, {axisphi}); - } - - template - bool selectionTrack(const T& candidate) - { - if (ismanualDCAcut && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) { - return false; - } - - return true; - } - - template - bool selectionPID(const T& candidate, int PID) - { - if (candidate.pt() > 0.4) { - onlyTPC = false; - } - - if (PID == 0) { - if (onlyTOF) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi) { - return true; - } - } else if (onlyTOFHIT) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi) { - return true; - } - if (!candidate.hasTOF() && - std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { - return true; - } - } else if (onlyTPC) { - if (std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { - return true; - } - } else { - if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (nsigmaCutCombined * nsigmaCutCombined)) { - return true; - } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { - return true; - } - } - } else if (PID == 1) { - if (onlyTOF) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa) { - return true; - } - } else if (onlyTOFHIT) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa) { - return true; - } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { - return true; - } - } else if (onlyTPC) { - if (std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { - return true; - } - } else { - if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nsigmaCutCombined * nsigmaCutCombined)) { - return true; - } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { - return true; - } - } - } else if (PID == 2) { - if (onlyTOF) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < nsigmaCutTOFPr) { - return true; - } - } else if (onlyTOFHIT) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < nsigmaCutTOFPr) { - return true; - } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < nsigmaCutTPCPr) { - return true; - } - } else if (onlyTPC) { - if (std::abs(candidate.tpcNSigmaPr()) < nsigmaCutTPCPr) { - return true; - } - } else { - if (candidate.hasTOF() && (candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < (nsigmaCutCombined * nsigmaCutCombined)) { - return true; - } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < nsigmaCutTPCPr) { - return true; - } - } - } - return false; - } - - // Defining filters for events (event selection) - // Processed events will be already fulfilling the event selection - // requirements - - Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex); - Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); - Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); - - using EventCandidates = soa::Filtered>; - using TrackCandidates = soa::Filtered>; - - // Defining partitions for subevents for eta-gap method - Partition Atracks = (aod::track::eta > 0.4f) && (aod::track::eta < 0.8f); // partition for subevent A - Partition Btracks = (aod::track::eta < -0.4f) && (aod::track::eta > -0.8f); // partition for subevent B - - array ptbins = {0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0, 3.5, 4.0, 4.5, 5.0}; - - void processSE(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) - - { - float sum_sinA = 0.0, sum_cosA = 0.0, sum_sinB = 0.0, sum_cosB = 0.0; - int multA = 0, multB = 0; - - // Q vector elements - array sum_sindsA = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // sin component of Q vector for subevent A - array sum_cosdsA = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // cos component of Q vector for subevent A - array sum_sindsB = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // sin component of Q vector for subevent B - array sum_cosdsB = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // cos component of Q vector for subevent B - - // p vector definitions for subevent A - array pn_sumsinA_pr = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for proton - array pn_sumcosA_pr = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for proton - - array pn_sumsinA_pi = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for pion - array pn_sumcosA_pi = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for pion - - array pn_sumsinA_k = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for kaon - array pn_sumcosA_k = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for kaon - - // p vector definitions for subevent B - array pn_sumsinB_pr = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for proton - array pn_sumcosB_pr = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for proton - - array pn_sumsinB_pi = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for pion - array pn_sumcosB_pi = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for pion - - array pn_sumsinB_k = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for kaon - array pn_sumcosB_k = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // to store ptwise pn vector components for kaon - - // POI multiplicities - array mpA_pr = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // proton multiplicity for subevent A - array mpB_pr = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // proton multiplicity for subevent B - - array mpA_pi = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // pion multiplicity for subevent A - array mpB_pi = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // pion multiplicity for subevent B - - array mpA_k = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // kaon multiplicity for subevent A - array mpB_k = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // kaon multiplicity for subevent B - - if (!collision.sel8()) { - return; - } - - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - return; - } - - if (TVXEvsel && (!collision.selection_bit(aod::evsel::kIsTriggerTVX))) { - return; - } - - float multiplicity = 0.0f; - multiplicity = collision.centFT0C(); - - // Fill the event counter - rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); - rEventSelection.fill(HIST("hmult"), multiplicity); - - auto atrack = Atracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto btrack = Btracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - - for (auto track : tracks) { - if (!selectionTrack(track)) { - continue; - } - if (selectionPID(track, 0) || selectionPID(track, 1) || selectionPID(track, 2)) { // If track pion, kaon or proton - histos.fill(HIST("hphi"), track.phi()); - } else { - continue; - } - } // end of track loop - - for (auto track1 : atrack) { - if (!selectionTrack(track1)) { - continue; - } - - sum_sinA += TMath::Sin(2.0 * track1.phi()); // sum of sin components of Q vector - sum_cosA += TMath::Cos(2.0 * track1.phi()); // sum of cos components of Q vector - multA++; // charged particle multiplicity - - if (selectionPID(track1, 0) || selectionPID(track1, 1) || selectionPID(track1, 2)) { // If track pion, kaon or proton - // pt loop for component sums of p vector, POI multiplicities pt wise - for (auto pt = 0; pt < 14; pt++) { - sum_sindsA[pt] += TMath::Sin(2 * track1.phi()); - sum_cosdsA[pt] += TMath::Cos(2 * track1.phi()); - - if (track1.pt() > ptbins[pt] && track1.pt() <= ptbins[pt + 1] && selectionPID(track1, 0)) { // for pion - pn_sumsinA_pi[pt] += TMath::Sin(2 * track1.phi()); - pn_sumcosA_pi[pt] += TMath::Cos(2 * track1.phi()); - mpA_pi[pt]++; - } else if (track1.pt() > ptbins[pt] && track1.pt() <= ptbins[pt + 1] && selectionPID(track1, 1)) { // for kaon - pn_sumsinA_k[pt] += TMath::Sin(2 * track1.phi()); - pn_sumcosA_k[pt] += TMath::Cos(2 * track1.phi()); - mpA_k[pt]++; - } else if (track1.pt() > ptbins[pt] && track1.pt() <= ptbins[pt + 1] && selectionPID(track1, 2)) { // for proton - pn_sumsinA_pr[pt] += TMath::Sin(2 * track1.phi()); - pn_sumcosA_pr[pt] += TMath::Cos(2 * track1.phi()); - mpA_pr[pt]++; - } else { - continue; - } - } // end of pt loop - } else { - continue; - } - } // track loop ends - - for (auto track2 : btrack) { - if (!selectionTrack(track2)) { - continue; - } - - sum_sinB += TMath::Sin(2.0 * track2.phi()); // sum of sin components of Q vector - sum_cosB += TMath::Cos(2.0 * track2.phi()); // sum of cos components of Q vector - multB++; // charged particle multiplicity - - if (selectionPID(track2, 0) || selectionPID(track2, 1) || selectionPID(track2, 2)) { // If track pion, kaon or proton - // pt loop for component sums of p vector, POI multiplicities pt wise - for (auto pt = 0; pt < 14; pt++) { - sum_sindsB[pt] += TMath::Sin(2 * track2.phi()); - sum_cosdsB[pt] += TMath::Cos(2 * track2.phi()); - - if (track2.pt() > ptbins[pt] && track2.pt() <= ptbins[pt + 1] && selectionPID(track2, 0)) { // for pion - pn_sumsinB_pi[pt] += TMath::Sin(2 * track2.phi()); - pn_sumcosB_pi[pt] += TMath::Cos(2 * track2.phi()); - mpB_pi[pt]++; - } else if (track2.pt() > ptbins[pt] && track2.pt() <= ptbins[pt + 1] && selectionPID(track2, 1)) { // for kaon - pn_sumsinB_k[pt] += TMath::Sin(2 * track2.phi()); - pn_sumcosB_k[pt] += TMath::Cos(2 * track2.phi()); - mpB_k[pt]++; - } else if (track2.pt() > ptbins[pt] && track2.pt() <= ptbins[pt + 1] && selectionPID(track2, 2)) { // for proton - pn_sumsinB_pr[pt] += TMath::Sin(2 * track2.phi()); - pn_sumcosB_pr[pt] += TMath::Cos(2 * track2.phi()); - mpB_pr[pt]++; - } else { - continue; - } - } // end of pt loop - } else { - continue; - } - } // track loop ends - - if (10.0 < multiplicity && multiplicity <= 20.0) { - // reference flow - if ((multA * multB) != 0) { - histos.fill(HIST("profv2ref"), 1, ((sum_cosA * sum_cosB + sum_sinA * sum_sinB) / (multA * multB)), multA * multB); - } - - // pt wise differential flow - for (auto pt = 0; pt < 14; pt++) { - if ((mpA_pr[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_pr_10_20"), pt + 1, ((pn_sumcosA_pr[pt] * sum_cosB + pn_sumsinA_pr[pt] * sum_sinB) / (mpA_pr[pt] * multB)), mpA_pr[pt] * multB); - } // for proton - if ((mpA_pi[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_pi_10_20"), pt + 1, ((pn_sumcosA_pi[pt] * sum_cosB + pn_sumsinA_pi[pt] * sum_sinB) / (mpA_pi[pt] * multB)), mpA_pi[pt] * multB); - } // for pion - if ((mpA_k[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_k_10_20"), pt + 1, ((pn_sumcosA_k[pt] * sum_cosB + pn_sumsinA_k[pt] * sum_sinB) / (mpA_k[pt] * multB)), mpA_k[pt] * multB); - } // for kaon - } - } // 10 to 20 percent centrality - - if (20.0 < multiplicity && multiplicity <= 30.0) { - // reference flow - if ((multA * multB) != 0) { - histos.fill(HIST("profv2ref"), 2, ((sum_cosA * sum_cosB + sum_sinA * sum_sinB) / (multA * multB)), multA * multB); - } - - // pt wise differential flow - for (auto pt = 0; pt < 14; pt++) { - if ((mpA_pr[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_pr_20_30"), pt + 1, ((pn_sumcosA_pr[pt] * sum_cosB + pn_sumsinA_pr[pt] * sum_sinB) / (mpA_pr[pt] * multB)), mpA_pr[pt] * multB); - } // for proton - if ((mpA_pi[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_pi_20_30"), pt + 1, ((pn_sumcosA_pi[pt] * sum_cosB + pn_sumsinA_pi[pt] * sum_sinB) / (mpA_pi[pt] * multB)), mpA_pi[pt] * multB); - } // for pion - if ((mpA_k[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_k_20_30"), pt + 1, ((pn_sumcosA_k[pt] * sum_cosB + pn_sumsinA_k[pt] * sum_sinB) / (mpA_k[pt] * multB)), mpA_k[pt] * multB); - } // for kaon - } - } // 20 to 30 percent centrality - - if (30.0 < multiplicity && multiplicity <= 40.0) { - // reference flow - if ((multA * multB) != 0) { - histos.fill(HIST("profv2ref"), 3, ((sum_cosA * sum_cosB + sum_sinA * sum_sinB) / (multA * multB)), multA * multB); - } - - // pt wise differential flow - for (auto pt = 0; pt < 14; pt++) { - if ((mpA_pr[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_pr_30_40"), pt + 1, ((pn_sumcosA_pr[pt] * sum_cosB + pn_sumsinA_pr[pt] * sum_sinB) / (mpA_pr[pt] * multB)), mpA_pr[pt] * multB); - } // for proton - if ((mpA_pi[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_pi_30_40"), pt + 1, ((pn_sumcosA_pi[pt] * sum_cosB + pn_sumsinA_pi[pt] * sum_sinB) / (mpA_pi[pt] * multB)), mpA_pi[pt] * multB); - } // for pion - if ((mpA_k[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_k_30_40"), pt + 1, ((pn_sumcosA_k[pt] * sum_cosB + pn_sumsinA_k[pt] * sum_sinB) / (mpA_k[pt] * multB)), mpA_k[pt] * multB); - } // for kaon - } - } // 30 to 40 percent centrality - - if (40.0 < multiplicity && multiplicity <= 50.0) { - // reference flow - if ((multA * multB) != 0) { - histos.fill(HIST("profv2ref"), 4, ((sum_cosA * sum_cosB + sum_sinA * sum_sinB) / (multA * multB)), multA * multB); - } - - // pt wise differential flow - for (auto pt = 0; pt < 14; pt++) { - if ((mpA_pr[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_pr_40_50"), pt + 1, ((pn_sumcosA_pr[pt] * sum_cosB + pn_sumsinA_pr[pt] * sum_sinB) / (mpA_pr[pt] * multB)), mpA_pr[pt] * multB); - } // for proton - if ((mpA_pi[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_pi_40_50"), pt + 1, ((pn_sumcosA_pi[pt] * sum_cosB + pn_sumsinA_pi[pt] * sum_sinB) / (mpA_pi[pt] * multB)), mpA_pi[pt] * multB); - } // for pion - if ((mpA_k[pt] * multB) != 0) { - histos.fill(HIST("profv2diff_k_40_50"), pt + 1, ((pn_sumcosA_k[pt] * sum_cosB + pn_sumsinA_k[pt] * sum_sinB) / (mpA_k[pt] * multB)), mpA_k[pt] * multB); - } // for kaon - } - } // 40 to 50 percent centrality - - if (50.0 < multiplicity && multiplicity <= 60.0) { - // reference flow - if ((multA * multB) != 0) { - histos.fill(HIST("profv2ref"), 5, ((sum_cosA * sum_cosB + sum_sinA * sum_sinB) / (multA * multB)), multA * multB); - } - } // 50 to 60 percent centrality - - if (60.0 < multiplicity && multiplicity <= 70.0) { - // reference flow - if ((multA * multB) != 0) { - histos.fill(HIST("profv2ref"), 6, ((sum_cosA * sum_cosB + sum_sinA * sum_sinB) / (multA * multB)), multA * multB); - } - } // 60 to 70 percent centrality - - if (70.0 < multiplicity && multiplicity <= 80.0) { - // reference flow - if ((multA * multB) != 0) { - histos.fill(HIST("profv2ref"), 7, ((sum_cosA * sum_cosB + sum_sinA * sum_sinB) / (multA * multB)), multA * multB); - } - } // 70 to 80 percent centrality - - } // end of process - - PROCESS_SWITCH(v2ellip, processSE, "Process Same event", true); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} diff --git a/PWGCF/Flow/Tasks/FlowRunbyRun.cxx b/PWGCF/Flow/Tasks/FlowRunbyRun.cxx new file mode 100644 index 00000000000..4478ca9e0a7 --- /dev/null +++ b/PWGCF/Flow/Tasks/FlowRunbyRun.cxx @@ -0,0 +1,299 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// code author: Zhiyong Lu (zhiyong.lu@cern.ch) +// jira: PWGCF-254 +// Produce Run-by-Run QA plots and flow analysis for Run3 + +#include +#include +#include +#include +#include +#include +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/HistogramRegistry.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" + +#include "GFWPowerArray.h" +#include "GFW.h" +#include "GFWCumulant.h" +#include "GFWWeights.h" +#include "FlowContainer.h" +#include "TList.h" +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +struct FlowRunbyRun { + + O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") + O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMin, float, 0.2f, "Minimal pT for poi tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMax, float, 10.0f, "Maximal pT for poi tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtRefMin, float, 0.2f, "Minimal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtRefMax, float, 3.0f, "Maximal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "Minimal pT for all tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 10.0f, "Maximal pT for all tracks") + O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z") + O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables") + O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins") + Configurable> cfgRunNumbers{"cfgRunNumbers", std::vector{544095, 544098, 544116, 544121, 544122, 544123, 544124}, "Preconfigured run numbers"}; + Configurable> cfgUserDefineGFWCorr{"cfgUserDefineGFWCorr", std::vector{"refN10 {2} refP10 {-2}"}, "User defined GFW CorrelatorConfig"}; + Configurable> cfgUserDefineGFWName{"cfgUserDefineGFWName", std::vector{"Ch10Gap22"}, "User defined GFW Name"}; + + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; + ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; + ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}, "pt axis for histograms"}; + ConfigurableAxis axisIndependent{"axisIndependent", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "X axis for histograms"}; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter trackFilter = ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + + // Connect to ccdb + Service ccdb; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + + // Define output + OutputObj fFC{FlowContainer("FlowContainer")}; + OutputObj fWeightList{"WeightList", OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registry{"registry"}; + + // define global variables + GFW* fGFW = new GFW(); + std::vector corrconfigs; + std::vector corrconfigsFC; + TAxis* fPtAxis; + TRandom3* fRndm = new TRandom3(0); + int lastRunNumer = -1; + std::vector RunNumbers; // vector of run numbers + std::map>> TH1sList; // map of histograms for all runs + std::map>> ProfilesList; // map of profiles for all runs + std::map WeightsList; // map of weights for all runs + enum OutputTH1Names { + // here are TProfiles for vn-pt correlations that are not implemented in GFW + hPhi = 0, + hEta, + hVtxZ, + hMult, + hCent, + kCount_TH1Names + }; + enum OutputTProfileNames { + c22 = 0, + c22_gap10, + kCount_TProfileNames + }; + + using aodCollisions = soa::Filtered>; + using aodTracks = soa::Filtered>; + + void init(InitContext const&) + { + ccdb->setURL(url.value); + ccdb->setCaching(true); + ccdb->setCreatedNotAfter(nolaterthan.value); + + TList* weightlist = new TList(); + weightlist->SetOwner(true); + fWeightList.setObject(weightlist); + + // Add output histograms to the registry + RunNumbers = cfgRunNumbers; + for (auto& runNumber : RunNumbers) { + CreateOutputObjectsForRun(runNumber); + } + + o2::framework::AxisSpec axis = axisPt; + int nPtBins = axis.binEdges.size() - 1; + double* PtBins = &(axis.binEdges)[0]; + fPtAxis = new TAxis(nPtBins, PtBins); + + // Create FlowContainer + TObjArray* oba = new TObjArray(); + std::vector UserDefineGFWCorr = cfgUserDefineGFWCorr; + std::vector UserDefineGFWName = cfgUserDefineGFWName; + if (!UserDefineGFWCorr.empty() && !UserDefineGFWName.empty()) { + for (uint i = 0; i < UserDefineGFWName.size(); i++) { + oba->Add(new TNamed(UserDefineGFWName.at(i).c_str(), UserDefineGFWName.at(i).c_str())); + } + } + fFC->SetName("FlowContainer"); + fFC->SetXAxis(fPtAxis); + fFC->Initialize(oba, axisIndependent, 1); + delete oba; + + fGFW->AddRegion("full", -0.8, 0.8, 1, 1); + fGFW->AddRegion("refN10", -0.8, -0.5, 1, 1); + fGFW->AddRegion("refP10", 0.5, 0.8, 1, 1); + corrconfigs.resize(kCount_TProfileNames); + corrconfigs[c22] = fGFW->GetCorrelatorConfig("full {2 -2}", "ChFull22", kFALSE); + corrconfigs[c22_gap10] = fGFW->GetCorrelatorConfig("refN10 {2} refP10 {-2}", "Ch10Gap22", kFALSE); + if (!UserDefineGFWCorr.empty() && !UserDefineGFWName.empty()) { + LOGF(info, "User adding GFW CorrelatorConfig:"); + // attentaion: here we follow the index of cfgUserDefineGFWCorr + for (uint i = 0; i < UserDefineGFWCorr.size(); i++) { + if (i >= UserDefineGFWName.size()) { + LOGF(fatal, "The names you provided are more than configurations. UserDefineGFWName.size(): %d > UserDefineGFWCorr.size(): %d", UserDefineGFWName.size(), UserDefineGFWCorr.size()); + break; + } + LOGF(info, "%d: %s %s", i, UserDefineGFWCorr.at(i).c_str(), UserDefineGFWName.at(i).c_str()); + corrconfigsFC.push_back(fGFW->GetCorrelatorConfig(UserDefineGFWCorr.at(i).c_str(), UserDefineGFWName.at(i).c_str(), kFALSE)); + } + } + fGFW->CreateRegions(); + } + + template + void FillProfile(const GFW::CorrConfig& corrconf, std::shared_ptr profile, const double& cent) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + profile->Fill(cent, val, dnx); + return; + } + return; + } + + void FillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm); + return; + } + for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) { + dnx = fGFW->Calculate(corrconf, i - 1, kTRUE).real(); + if (dnx == 0) + continue; + val = fGFW->Calculate(corrconf, i - 1, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + fFC->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm); + } + return; + } + + void CreateOutputObjectsForRun(int runNumber) + { + std::vector> histos(kCount_TH1Names); + histos[hPhi] = registry.add(Form("%d/hPhi", runNumber), "", {HistType::kTH1D, {axisPhi}}); + histos[hEta] = registry.add(Form("%d/hEta", runNumber), "", {HistType::kTH1D, {axisEta}}); + histos[hVtxZ] = registry.add(Form("%d/hVtxZ", runNumber), "", {HistType::kTH1D, {axisVertex}}); + histos[hMult] = registry.add(Form("%d/hMult", runNumber), "", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); + histos[hCent] = registry.add(Form("%d/hCent", runNumber), "", {HistType::kTH1D, {{90, 0, 90}}}); + TH1sList.insert(std::make_pair(runNumber, histos)); + + std::vector> profiles(kCount_TProfileNames); + profiles[c22] = registry.add(Form("%d/c22", runNumber), "", {HistType::kTProfile, {axisIndependent}}); + profiles[c22_gap10] = registry.add(Form("%d/c22_gap10", runNumber), "", {HistType::kTProfile, {axisIndependent}}); + ProfilesList.insert(std::make_pair(runNumber, profiles)); + + // WeightsList + o2::framework::AxisSpec axis = axisPt; + int nPtBins = axis.binEdges.size() - 1; + double* PtBins = &(axis.binEdges)[0]; + GFWWeights* weight = new GFWWeights(Form("weight_%d", runNumber)); + weight->SetPtBins(nPtBins, PtBins); + weight->Init(true, false); + fWeightList->Add(weight); + WeightsList.insert(std::make_pair(runNumber, weight)); + } + + void process(aodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, aodTracks const& tracks) + { + if (!collision.sel8()) + return; + if (tracks.size() < 1) + return; + // detect run number + auto bc = collision.bc_as(); + int runNumber = bc.runNumber(); + float l_Random = fRndm->Rndm(); + if (runNumber != lastRunNumer) { + lastRunNumer = runNumber; + if (std::find(RunNumbers.begin(), RunNumbers.end(), runNumber) == RunNumbers.end()) { + // if run number is not in the preconfigured list, create new output histograms for this run + CreateOutputObjectsForRun(runNumber); + RunNumbers.push_back(runNumber); + } + + if (TH1sList.find(runNumber) == TH1sList.end()) { + LOGF(fatal, "RunNumber %d not found in TH1sList", runNumber); + return; + } + } + + TH1sList[runNumber][hVtxZ]->Fill(collision.posZ()); + TH1sList[runNumber][hMult]->Fill(tracks.size()); + TH1sList[runNumber][hCent]->Fill(collision.centFT0C()); + + fGFW->Clear(); + const auto cent = collision.centFT0C(); + float weff = 1, wacc = 1; + for (auto& track : tracks) { + TH1sList[runNumber][hPhi]->Fill(track.phi()); + TH1sList[runNumber][hEta]->Fill(track.eta()); + // bool WithinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range + bool WithinPtRef = (cfgCutPtRefMin < track.pt()) && (track.pt() < cfgCutPtRefMax); // within RF pT range + if (WithinPtRef) { + fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 1); + } + if (cfgOutputNUAWeightsRefPt) { + if (WithinPtRef) + WeightsList[runNumber]->Fill(track.phi(), track.eta(), collision.posZ(), track.pt(), cent, 0); + } else { + WeightsList[runNumber]->Fill(track.phi(), track.eta(), collision.posZ(), track.pt(), cent, 0); + } + } + + // Filling TProfile + for (uint i = 0; i < kCount_TProfileNames; ++i) { + FillProfile(corrconfigs[i], ProfilesList[runNumber][i], cent); + } + // Filling Flow Container + for (uint l_ind = 0; l_ind < corrconfigsFC.size(); l_ind++) { + FillFC(corrconfigsFC.at(l_ind), cent, l_Random); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/Flow/Tasks/FlowTask.cxx b/PWGCF/Flow/Tasks/FlowTask.cxx index 27f2c29122a..0f4d6977855 100644 --- a/PWGCF/Flow/Tasks/FlowTask.cxx +++ b/PWGCF/Flow/Tasks/FlowTask.cxx @@ -16,6 +16,9 @@ #include #include #include +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" @@ -24,6 +27,7 @@ #include "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" @@ -58,6 +62,11 @@ struct FlowTask { O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5f, "max chi2 per TPC clusters") O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 70.0f, "minimum TPC clusters") O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z") + O2_DEFINE_CONFIGURABLE(cfgCutDCAxyppPass3Enabled, bool, false, "switch of ppPass3 DCAxy pt dependent cut") + O2_DEFINE_CONFIGURABLE(cfgCutDCAzPtDepEnabled, bool, false, "switch of DCAz pt dependent cut") + O2_DEFINE_CONFIGURABLE(cfgTrkSelSwitch, bool, false, "switch for self-defined track selection") + O2_DEFINE_CONFIGURABLE(cfgTrkSelRun3ITSMatch, bool, false, "GlobalTrackRun3ITSMatching::Run3ITSall7Layers selection") + O2_DEFINE_CONFIGURABLE(cfgRejectionTPCsectorOverlap, bool, true, "rejection for TPC sector overlap") O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") O2_DEFINE_CONFIGURABLE(cfgTriggerkTVXinTRD, bool, true, "TRD triggered") O2_DEFINE_CONFIGURABLE(cfgEvSelkNoSameBunchPileup, bool, true, "rejects collisions which are associated with the same found-by-T0 bunch crossing") @@ -65,13 +74,13 @@ struct FlowTask { O2_DEFINE_CONFIGURABLE(cfgEvSelkNoCollInTimeRangeStandard, bool, true, "no collisions in specified time range") O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") O2_DEFINE_CONFIGURABLE(cfgEvSelV0AT0ACut, bool, true, "V0A T0A 5 sigma cut") - O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, false, "Use additional track cut on phi") O2_DEFINE_CONFIGURABLE(cfgGetInteractionRate, bool, false, "Get interaction rate from CCDB") O2_DEFINE_CONFIGURABLE(cfgUseInteractionRateCut, bool, false, "Use events with low interaction rate") O2_DEFINE_CONFIGURABLE(cfgCutIR, float, 50.0, "maximum interaction rate (kHz)") O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables") O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights") + O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins") O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object") O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object") @@ -81,6 +90,7 @@ struct FlowTask { O2_DEFINE_CONFIGURABLE(cfgUseSmallMemory, bool, false, "Use small memory mode") Configurable> cfgUserDefineGFWCorr{"cfgUserDefineGFWCorr", std::vector{"refN02 {2} refP02 {-2}", "refN12 {2} refP12 {-2}"}, "User defined GFW CorrelatorConfig"}; Configurable> cfgUserDefineGFWName{"cfgUserDefineGFWName", std::vector{"Ch02Gap22", "Ch12Gap22"}, "User defined GFW Name"}; + Configurable> cfgRunRemoveList{"cfgRunRemoveList", std::vector{-1}, "excluded run numbers"}; ConfigurableAxis axisVertex{"axisVertex", {40, -20, 20}, "vertex axis for histograms"}; ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; @@ -141,9 +151,11 @@ struct FlowTask { using aodCollisions = soa::Filtered>; using aodTracks = soa::Filtered>; - // Additional Event selection cuts - Copy from flowGenericFramework.cxx + // Track selection + TrackSelection myTrackSel; TF1* fPhiCutLow = nullptr; TF1* fPhiCutHigh = nullptr; + // Additional Event selection cuts - Copy from flowGenericFramework.cxx TF1* fMultPVCutLow = nullptr; TF1* fMultPVCutHigh = nullptr; TF1* fMultCutLow = nullptr; @@ -163,7 +175,7 @@ struct FlowTask { registry.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{5, 0, 5}}}); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "after sel8"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "after strict Pile-up cut"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "after supicious Runs removal"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "after additional event cut"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(5, "after correction loads"); registry.add("hVtxZ", "Vexter Z distribution", {HistType::kTH1D, {axisVertex}}); @@ -236,13 +248,15 @@ struct FlowTask { // add in FlowContainer to Get boostrap sample automatically TObjArray* oba = new TObjArray(); oba->Add(new TNamed("ChGap22", "ChGap22")); - for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) - oba->Add(new TNamed(Form("ChGap22_pt_%i", i + 1), "ChGap22_pTDiff")); oba->Add(new TNamed("ChFull22", "ChFull22")); oba->Add(new TNamed("ChFull32", "ChFull32")); oba->Add(new TNamed("ChFull42", "ChFull42")); oba->Add(new TNamed("ChFull24", "ChFull24")); oba->Add(new TNamed("ChFull26", "ChFull26")); + for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("ChFull22_pt_%i", i + 1), "ChFull22_pTDiff")); + for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("ChFull24_pt_%i", i + 1), "ChFull24_pTDiff")); oba->Add(new TNamed("Ch04Gap22", "Ch04Gap22")); oba->Add(new TNamed("Ch06Gap22", "Ch06Gap22")); oba->Add(new TNamed("Ch08Gap22", "Ch08Gap22")); @@ -280,7 +294,7 @@ struct FlowTask { std::vector UserDefineGFWCorr = cfgUserDefineGFWCorr; std::vector UserDefineGFWName = cfgUserDefineGFWName; if (!UserDefineGFWCorr.empty() && !UserDefineGFWName.empty()) { - for (auto i = 0; i < UserDefineGFWName.size(); i++) { + for (uint i = 0; i < UserDefineGFWName.size(); i++) { oba->Add(new TNamed(UserDefineGFWName.at(i).c_str(), UserDefineGFWName.at(i).c_str())); } } @@ -305,13 +319,17 @@ struct FlowTask { fGFW->AddRegion("refP10", 0.5, 0.8, 1, 1); fGFW->AddRegion("refN12", -0.8, -0.6, 1, 1); fGFW->AddRegion("refP12", 0.6, 0.8, 1, 1); + fGFW->AddRegion("refN14", -0.8, -0.7, 1, 1); + fGFW->AddRegion("refP14", 0.7, 0.8, 1, 1); fGFW->AddRegion("refN", -0.8, -0.4, 1, 1); fGFW->AddRegion("refP", 0.4, 0.8, 1, 1); fGFW->AddRegion("refM", -0.4, 0.4, 1, 1); fGFW->AddRegion("poiN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 2); fGFW->AddRegion("poiN10", -0.8, -0.5, 1 + fPtAxis->GetNbins(), 2); + fGFW->AddRegion("poifull", -0.8, 0.8, 1 + fPtAxis->GetNbins(), 2); fGFW->AddRegion("olN", -0.8, -0.4, 1, 4); fGFW->AddRegion("olN10", -0.8, -0.5, 1, 4); + fGFW->AddRegion("olfull", -0.8, 0.8, 1, 4); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 -2}", "ChFull22", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {3 -3}", "ChFull32", kFALSE)); @@ -334,7 +352,8 @@ struct FlowTask { corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {4} refP10 {-4}", "Ch10Gap42", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN12 {4} refP12 {-4}", "Ch12Gap42", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN {2} refP {-2}", "ChGap22", kFALSE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN refN | olN {2} refP {-2}", "ChGap22", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poifull full | olfull {2 -2}", "ChFull22", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poifull full | olfull {2 2 -2 -2}", "ChFull24", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10 refN10 | olN10 {2} refP10 {-2}", "Ch10Gap22", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10 refN10 | olN10 {3} refP10 {-3}", "Ch10Gap32", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10 refN10 | olN10 {4} refP10 {-4}", "Ch10Gap42", kTRUE)); @@ -354,7 +373,7 @@ struct FlowTask { if (!UserDefineGFWCorr.empty() && !UserDefineGFWName.empty()) { LOGF(info, "User adding GFW CorrelatorConfig:"); // attentaion: here we follow the index of cfgUserDefineGFWCorr - for (auto i = 0; i < UserDefineGFWCorr.size(); i++) { + for (uint i = 0; i < UserDefineGFWCorr.size(); i++) { if (i >= UserDefineGFWName.size()) { LOGF(fatal, "The names you provided are more than configurations. UserDefineGFWName.size(): %d > UserDefineGFWCorr.size(): %d", UserDefineGFWName.size(), UserDefineGFWCorr.size()); break; @@ -382,10 +401,19 @@ struct FlowTask { fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); } - if (cfgUseAdditionalTrackCut) { + if (cfgRejectionTPCsectorOverlap) { fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); } + + if (cfgTrkSelRun3ITSMatch) { + myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + } else { + myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + } + myTrackSel.SetMinNClustersTPC(cfgCutTPCclu); + if (cfgCutDCAxyppPass3Enabled) + myTrackSel.SetMaxDcaXYPtDep([](float pt) { return 0.004f + 0.013f / pt; }); // Tuned on the LHC22f anchored MC LHC23d1d on primary pions. 7 Sigmas of the resolution } template @@ -523,13 +551,6 @@ struct FlowTask { // no collisions in specified time range return 0; } - float vtxz = -999; - if (collision.numContrib() > 1) { - vtxz = collision.posZ(); - float zRes = TMath::Sqrt(collision.covZZ()); - if (zRes > 0.25 && collision.numContrib() < 20) - vtxz = -999; - } auto multNTracksPV = collision.multNTracksPV(); auto occupancy = collision.trackOccupancyInTimeRange(); if (cfgEvSelOccupancy && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)) @@ -570,11 +591,18 @@ struct FlowTask { template bool trackSelected(TTrack track) { - return (track.tpcNClsFound() >= cfgCutTPCclu); + if (cfgCutDCAzPtDepEnabled && (track.dcaZ() > (0.004f + 0.013f / track.pt()))) + return false; + + if (cfgTrkSelSwitch) { + return myTrackSel.IsSelected(track); + } else { + return (track.tpcNClsFound() >= cfgCutTPCclu); + } } template - bool AdditionaltrackSelected(TTrack track, const int field) + bool RejectionTPCoverlap(TTrack track, const int field) { double phimodn = track.phi(); if (field < 0) // for negative polarity field @@ -617,6 +645,15 @@ struct FlowTask { return; if (tracks.size() < 1) return; + registry.fill(HIST("hEventCount"), 1.5); + auto bc = collision.bc_as(); + int currentRunNumber = bc.runNumber(); + for (auto& ExcludedRun : cfgRunRemoveList.value) { + if (currentRunNumber == ExcludedRun) { + return; + } + } + registry.fill(HIST("hEventCount"), 2.5); if (!cfgUseSmallMemory) { registry.fill(HIST("BeforeCut_globalTracks_centT0C"), collision.centFT0C(), tracks.size()); registry.fill(HIST("BeforeCut_PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); @@ -626,9 +663,6 @@ struct FlowTask { registry.fill(HIST("BeforeCut_multV0A_multT0A"), collision.multFT0A(), collision.multFV0A()); registry.fill(HIST("BeforeCut_multT0C_centT0C"), collision.centFT0C(), collision.multFT0C()); } - registry.fill(HIST("hEventCount"), 1.5); - // place holder for pile-up rejection - registry.fill(HIST("hEventCount"), 2.5); const auto cent = collision.centFT0C(); if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent)) return; @@ -639,7 +673,6 @@ struct FlowTask { registry.fill(HIST("hMult"), tracks.size()); registry.fill(HIST("hCent"), collision.centFT0C()); fGFW->Clear(); - auto bc = collision.bc_as(); if (cfgGetInteractionRate) { initHadronicRate(bc); double hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // @@ -670,7 +703,7 @@ struct FlowTask { double sum_ptSquare_wSquare_WithinGap08 = 0., sum_pt_wSquare_WithinGap08 = 0.; int Magnetfield = 0; double NTracksCorrected = 0; - if (cfgUseAdditionalTrackCut) { + if (cfgRejectionTPCsectorOverlap) { // magnet field dependence cut Magnetfield = getMagneticField(bc.timestamp()); } @@ -681,15 +714,21 @@ struct FlowTask { for (auto& track : tracks) { if (!trackSelected(track)) continue; - if (cfgUseAdditionalTrackCut && !AdditionaltrackSelected(track, Magnetfield)) - continue; - if (cfgOutputNUAWeights) - fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); - if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) + if (cfgRejectionTPCsectorOverlap && !RejectionTPCoverlap(track, Magnetfield)) continue; bool WithinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range bool WithinPtRef = (cfgCutPtRefMin < track.pt()) && (track.pt() < cfgCutPtRefMax); // within RF pT range bool WithinEtaGap08 = (track.eta() >= -0.4) && (track.eta() <= 0.4); + if (cfgOutputNUAWeights) { + if (cfgOutputNUAWeightsRefPt) { + if (WithinPtRef) + fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + } else { + fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + } + } + if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) + continue; registry.fill(HIST("hPt"), track.pt()); if (WithinPtRef) { registry.fill(HIST("hPhi"), track.phi()); diff --git a/PWGCF/Flow/Tasks/FlowZDCtask.cxx b/PWGCF/Flow/Tasks/FlowZDCtask.cxx index 641ef3cb1e5..7efdeff3d05 100644 --- a/PWGCF/Flow/Tasks/FlowZDCtask.cxx +++ b/PWGCF/Flow/Tasks/FlowZDCtask.cxx @@ -36,7 +36,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod::mult; -using ColEvSels = soa::Join; +using ColEvSels = soa::Join; using aodCollisions = soa::Filtered>; using aodTracks = soa::Filtered>; using BCsRun3 = soa::Join; @@ -70,16 +70,19 @@ struct FlowZDCtask { Configurable nBinsADC{"nBinsADC", 1000, "nbinsADC"}; Configurable nBinsAmp{"nBinsAmp", 1025, "nbinsAmp"}; Configurable MaxZN{"MaxZN", 4099.5, "Max ZN signal"}; + Configurable acceptnace_ZNA{"acceptnace_ZNA", 0.92, "ZNA acceptance factor"}; + Configurable acceptnace_ZNC{"acceptnace_ZNC", 0.90, "ZNC acceptance factor"}; + Configurable acceptnace_ZPA{"acceptnace_ZPA", 0.52, "ZPA acceptance factor"}; + Configurable acceptnace_ZPC{"acceptnace_ZPC", 0.50, "ZPC acceptance factor"}; ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.30, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00}, "pt axis for histograms"}; ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "centrality axis for histograms"}; - + ConfigurableAxis axisEnergy{"axisEnergy", {100, 0, 700}, "energy axis for zdc histos"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); - Partition tracksIUWithTPC = (aod::track::tpcNClsFindable > (uint8_t)0); TComplex qTPC; // init q TPC @@ -102,6 +105,12 @@ struct FlowZDCtask { OutputObj ZDC_ZEM_Energy{TProfile("ZDC_ZEM_Energy", "ZDC vs ZEM Energy", 10, 0, 1000)}; OutputObj pCosPsiDifferences{TProfile("pCosPsiDifferences", "Differences in cos(psi) vs Centrality;Centrality;Mean cos(psi) Difference", 200, 0, 100, -1, 1)}; OutputObj pSinPsiDifferences{TProfile("pSinPsiDifferences", "Differences in sin(psi) vs Centrality;Centrality;Mean sin(psi) Difference", 200, 0, 100, -1, 1)}; + OutputObj pZNvsFT0MAmp{TProfile("pZNvsFT0MAmp", "ZN Energy vs FT0M Amplitude", 1025, 0, 1e7, 0, 500)}; + OutputObj pZPvsFT0MAmp{TProfile("pZPvsFT0MAmp", "ZP Energy vs FT0M Amplitude", 1025, 0, 1e7, 0, 500)}; + OutputObj pZNvsFT0Ccent{TProfile("pZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", 100, 0, 100, 0, 500)}; + OutputObj pZPvsFT0Ccent{TProfile("pZPvsFT0Ccent", "ZP Energy vs FT0C Centrality", 100, 0, 100, 0, 500)}; + OutputObj pZNratiovscent{TProfile("pZNratiovscent", "Ratio ZNC/ZNA vs FT0C Centrality", 100, 0, 100, 0, 5)}; + OutputObj pZPratiovscent{TProfile("pZPratiovscent", "Ratio ZPC/ZPA vs FT0C Centrality", 100, 0, 100, 0, 5)}; double sumCosPsiDiff = 0.0; // Sum of cos(psiZNC) - cos(psiZNA) int countEvents = 0; // Count of processed events @@ -120,11 +129,10 @@ struct FlowZDCtask { const AxisSpec axisQZNA{100, -1, 1, "Q"}; const AxisSpec axisREQ{100, -1, 1, "real Q"}; const AxisSpec axisIMQ{100, -1, 1, "imag Q"}; - const AxisSpec axisEnergy{100, 0, 50, "energy"}; AxisSpec axisVtxcounts{2, -0.5f, 1.5f, "Vtx info (0=no, 1=yes)"}; AxisSpec axisZvert{120, -30.f, 30.f, "Vtx z (cm)"}; - AxisSpec axisCent{8, 0.f, 100.f, "centrality"}; + AxisSpec axisCent{8, 0.f, 105.f, "centrality"}; AxisSpec axisMult{1000, -0.5f, 1500.5f, "multiplicity"}; AxisSpec axisMultTPC{1000, -0.5f, 1999.5f, "TPCmultiplicity"}; AxisSpec axisCentBins{{0, 5., 10., 20., 30., 40., 50., 60., 70., 80.}, "centrality percentile"}; @@ -152,6 +160,16 @@ struct FlowZDCtask { histos.add("EnergyZNA", "ZNA Sector Energy", kTH1F, {axisEnergy}); histos.add("EnergyZNC", "ZNC Sector Energy", kTH1F, {axisEnergy}); + histos.add("hCentFT0C", "FT0C Centrality Distribution", kTH1F, {{100, 0, 105}}); + histos.add("hZNvsFT0Ccent", + "ZN Energy vs FT0C Centrality;Centrality [%];ZN Energy [TeV]", + kTH2F, + {AxisSpec{100, 0, 100, "Centrality [%]"}, AxisSpec{100, 0, 500, "ZN Energy [TeV]"}}); + + histos.add("hZPvsFT0Ccent", + "ZP Energy vs FT0C Centrality;Centrality [%];ZP Energy [TeV]", + kTH2F, + {AxisSpec{100, 0, 100, "Centrality [%]"}, AxisSpec{100, 0, 500, "ZP Energy [TeV]"}}); // for q vector recentering histos.add("revsimag", "revsimag", kTH2F, {axisREQ, axisIMQ}); @@ -179,6 +197,19 @@ struct FlowZDCtask { histos.add("hSinDifferences", "Differences in sin(psi);sin(psiZNC) - sin(psiZNA);Entries", {HistType::kTH1F, {{100, -2, 2}}}); histos.add("CosPsiDifferencesAvg", "Differences in cos(psi);cos(psiZNC) - cos(psiZNA);Entries", {HistType::kTH2F, {{axisCent}, {100, -2, 2}}}); histos.add("ZDC_energy_vs_ZEM", "ZDCvsZEM; ZEM; ZNA+ZNC+ZPA+ZPC", {HistType::kTH2F, {{{nBinsAmp, -0.5, MaxZEM}, {nBinsAmp, -0.5, 2. * MaxZN}}}}); + // common energies information for ZDC + histos.add("ZNCenergy", "ZN energy side c", kTH1F, {axisEnergy}); + histos.add("ZNAenergy", "ZN energy side a", kTH1F, {axisEnergy}); + histos.add("ZPCenergy", "ZP energy side c", kTH1F, {axisEnergy}); + histos.add("ZPAenergy", "ZP energy side a", kTH1F, {axisEnergy}); + histos.add("ZNenergy", "common zn (a + c sides) energy", kTH1F, {axisEnergy}); + histos.add("ZPenergy", "common zp energy (a + c sides)", kTH1F, {axisEnergy}); + histos.add("hFT0CAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 1e7}}); + histos.add("hFT0AAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 1e7}}); + histos.add("hFT0MAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 1e7}}); + histos.add("hMultT0A", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}}); + histos.add("hMultT0C", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}}); + histos.add("hMultT0M", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}}); } } @@ -228,18 +259,47 @@ struct FlowZDCtask { void processZdcCollAssoc( ColEvSels const& cols, BCsRun3 const& /*bcs*/, - aod::Zdcs const& /*zdcs*/) + aod::Zdcs const& /*zdcs*/, + aod::FT0s const& /*ft0s*/) { double sumCosPsiDiff = 0.0; // initialize Sum of cosPsiDiff for averaging double sumSinPsiDiff = 0.0; // initialize Sum of cosPsiDiff for averaging int countEvents = 0; // initialize Counter for the number of events processed + double FT0AAmp = 0; + double FT0CAmp = 0; + // init values for ft0 multiplicity + float multFT0A = 0.f; + float multFT0C = 0.f; + float multFT0M = 0.f; + // collision-based event selection for (auto& collision : cols) { const auto& foundBC = collision.foundBC_as(); + multFT0A = collision.multFT0A(); + multFT0C = collision.multFT0C(); + multFT0M = multFT0A + multFT0C; + + histos.fill(HIST("hMultT0A"), multFT0A); + histos.fill(HIST("hMultT0C"), multFT0C); + histos.fill(HIST("hMultT0M"), multFT0M); + if (collision.has_foundFT0()) { + auto ft0 = collision.foundFT0(); + for (auto amplitude : ft0.amplitudeA()) { + FT0AAmp += amplitude; + histos.fill(HIST("hFT0AAmp"), FT0AAmp); + } + for (auto amplitude : ft0.amplitudeC()) { + FT0CAmp += amplitude; + histos.fill(HIST("hFT0CAmp"), FT0CAmp); + } + } + double FT0MAmp = FT0AAmp + FT0CAmp; + histos.fill(HIST("hFT0MAmp"), FT0MAmp); if (foundBC.has_zdc()) { const auto& zdcread = foundBC.zdc(); const auto cent = collision.centFT0C(); + // ZDC data and histogram filling histos.get(HIST("ZNAcoll"))->Fill(zdcread.amplitudeZNA()); histos.get(HIST("ZNCcoll"))->Fill(zdcread.amplitudeZNC()); histos.get(HIST("ZNvsZEMcoll"))->Fill(zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2(), zdcread.amplitudeZNA() + zdcread.amplitudeZNC()); @@ -254,23 +314,48 @@ struct FlowZDCtask { float sumZPA = (zdcread.energySectorZPA())[0] + (zdcread.energySectorZPA())[1] + (zdcread.energySectorZPA())[2] + (zdcread.energySectorZPA())[3]; float sumZDC = sumZPA + sumZPC + sumZNA + sumZNC; float sumZEM = zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2(); + + // common energies + float common_sumZNC = (zdcread.energyCommonZNC()) / acceptnace_ZNC; + float common_sumZNA = (zdcread.energyCommonZNA()) / acceptnace_ZNA; + float common_sumZPC = (zdcread.energyCommonZPC()) / acceptnace_ZPC; + float common_sumZPA = (zdcread.energyCommonZPA()) / acceptnace_ZPA; + float sumZN = (sumZNC) + (sumZNA); + float sumZP = (sumZPC) + (sumZPA); + + histos.fill(HIST("ZNenergy"), sumZN); + histos.fill(HIST("ZPenergy"), sumZP); + histos.fill(HIST("ZNCenergy"), common_sumZNC); + histos.fill(HIST("ZNAenergy"), common_sumZNA); + histos.fill(HIST("ZPAenergy"), common_sumZPA); + histos.fill(HIST("ZPCenergy"), common_sumZPC); + histos.fill(HIST("hZNvsFT0Ccent"), cent, sumZN); + histos.fill(HIST("hZPvsFT0Ccent"), cent, sumZP); + float ratioZN = sumZNC / sumZNA; + float ratioZP = sumZPC / sumZPA; + pZNratiovscent->Fill(cent, ratioZN); + pZPratiovscent->Fill(cent, ratioZP); + pZNvsFT0Ccent->Fill(cent, sumZN); + pZPvsFT0Ccent->Fill(cent, sumZP); + pZPvsFT0MAmp->Fill(sumZP, FT0MAmp); + pZNvsFT0MAmp->Fill(sumZN, FT0MAmp); + histos.get(HIST("ZDC_energy_vs_ZEM"))->Fill(sumZEM, sumZDC); + // Spectator plane angle calculations and histograms const auto Ntot_ZNA = zdcread.amplitudeZNA(); const auto Ntot_ZNC = zdcread.amplitudeZNC(); - double qZNA_real = 0.0; // Initialize qZNA_real - double qZNA_im = 0.0; // Initialize - double qZNC_real = 0.0; // Initialize qZNC_real - double qZNC_im = 0.0; // Initialize + double qZNA_real = 0.0; + double qZNA_im = 0.0; + double qZNC_real = 0.0; + double qZNC_im = 0.0; const double phiRadians[4] = {45 * TMath::Pi() / 180, 135 * TMath::Pi() / 180, 225 * TMath::Pi() / 180, 315 * TMath::Pi() / 180}; TComplex qZNA(0, 0), qZNC(0, 0); for (int sector = 0; sector < 4; ++sector) { - // energy for current sector for ZNA and ZNC float energyZNA = zdcread.energySectorZNA()[sector]; float energyZNC = zdcread.energySectorZNC()[sector]; - // Calculate q-vector from current sector and add it to the total q-vector qZNA += TComplex(TMath::Cos(2 * phiRadians[sector]) * energyZNA / sumZNA, TMath::Sin(2 * phiRadians[sector]) * energyZNA / sumZNA); qZNC += TComplex(TMath::Cos(2 * phiRadians[sector]) * energyZNC / sumZNC, TMath::Sin(2 * phiRadians[sector]) * energyZNC / sumZNC); } @@ -313,6 +398,7 @@ struct FlowZDCtask { } } } + PROCESS_SWITCH(FlowZDCtask, processZdcCollAssoc, "Processing ZDC w. collision association", true); PROCESS_SWITCH(FlowZDCtask, processQVector, "Process before recentering", true); diff --git a/PWGCF/Flow/Tasks/flowGFWOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGFWOmegaXi.cxx index 9654dac54e4..8a491e46d28 100644 --- a/PWGCF/Flow/Tasks/flowGFWOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGFWOmegaXi.cxx @@ -13,7 +13,10 @@ /// \author Fuchun Cui(fcui@cern.ch) #include +#include +#include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" @@ -45,6 +48,19 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +namespace +{ +std::shared_ptr REFc22[10]; +std::shared_ptr REFc24[10]; +std::shared_ptr K0sc22[10]; +std::shared_ptr K0sc24[10]; +std::shared_ptr Lambdac22[10]; +std::shared_ptr Lambdac24[10]; +std::shared_ptr Xic22[10]; +std::shared_ptr Xic24[10]; +std::shared_ptr Omegac22[10]; +std::shared_ptr Omegac24[10]; +} // namespace #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; @@ -57,6 +73,8 @@ struct FlowGFWOmegaXi { O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 10.0f, "Maximal pT for ref tracks") O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") O2_DEFINE_CONFIGURABLE(cfgOmegaMassbins, int, 16, "Number of Omega mass axis bins for c22") O2_DEFINE_CONFIGURABLE(cfgXiMassbins, int, 14, "Number of Xi mass axis bins for c22") O2_DEFINE_CONFIGURABLE(cfgK0sMassbins, int, 80, "Number of K0s mass axis bins for c22") @@ -64,7 +82,7 @@ struct FlowGFWOmegaXi { // topological cut for V0 O2_DEFINE_CONFIGURABLE(cfgv0_radius, float, 5.0f, "minimum decay radius") O2_DEFINE_CONFIGURABLE(cfgv0_v0cospa, float, 0.995f, "minimum cosine of pointing angle") - O2_DEFINE_CONFIGURABLE(cfgv0_dcav0topv, float, 0.1f, "minimum daughter DCA to PV") + O2_DEFINE_CONFIGURABLE(cfgv0_dcadautopv, float, 0.1f, "minimum daughter DCA to PV") O2_DEFINE_CONFIGURABLE(cfgv0_dcav0dau, float, 0.5f, "maximum DCA among V0 daughters") O2_DEFINE_CONFIGURABLE(cfgv0_mk0swindow, float, 0.1f, "Invariant mass window of K0s") O2_DEFINE_CONFIGURABLE(cfgv0_mlambdawindow, float, 0.04f, "Invariant mass window of lambda") @@ -81,13 +99,20 @@ struct FlowGFWOmegaXi { // track quality and type selections O2_DEFINE_CONFIGURABLE(cfgtpcclusters, int, 70, "minimum number of TPC clusters requirement") O2_DEFINE_CONFIGURABLE(cfgitsclusters, int, 1, "minimum number of ITS clusters requirement") - O2_DEFINE_CONFIGURABLE(cfgcheckDauTPC, bool, false, "check if daughter tracks have TPC match") + O2_DEFINE_CONFIGURABLE(cfgtpcclufindable, int, 1, "minimum number of findable TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgtpccrossoverfindable, int, 1, "minimum number of Ratio crossed rows over findable clusters") + O2_DEFINE_CONFIGURABLE(cfgcheckDauTPC, bool, true, "check daughter tracks TPC or not") + O2_DEFINE_CONFIGURABLE(cfgcheckDauTOF, bool, false, "check daughter tracks TOF or not") O2_DEFINE_CONFIGURABLE(cfgCasc_rapidity, float, 0.5, "rapidity") - O2_DEFINE_CONFIGURABLE(cfgNSigmaCascPion, float, 3, "NSigmaCascPion") - O2_DEFINE_CONFIGURABLE(cfgNSigmaCascProton, float, 3, "NSigmaCascProton") - O2_DEFINE_CONFIGURABLE(cfgNSigmaCascKaon, float, 3, "NSigmaCascKaon") - O2_DEFINE_CONFIGURABLE(cfgAcceptancePath, std::vector, std::vector{"PathtoRef"}, "CCDB path to acceptance object") - O2_DEFINE_CONFIGURABLE(cfgEfficiencyPath, std::vector, std::vector{"PathtoRef"}, "CCDB path to efficiency object") + O2_DEFINE_CONFIGURABLE(cfgtpcNSigmaCascPion, float, 3, "NSigmaCascPion") + O2_DEFINE_CONFIGURABLE(cfgtpcNSigmaCascProton, float, 3, "NSigmaCascProton") + O2_DEFINE_CONFIGURABLE(cfgtpcNSigmaCascKaon, float, 3, "NSigmaCascKaon") + O2_DEFINE_CONFIGURABLE(cfgtofNSigmaCascPion, float, 3, "NSigmaCascPion") + O2_DEFINE_CONFIGURABLE(cfgtofNSigmaCascProton, float, 3, "NSigmaCascProton") + O2_DEFINE_CONFIGURABLE(cfgtofNSigmaCascKaon, float, 3, "NSigmaCascKaon") + O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, true, "Fill and output NUA weights") + O2_DEFINE_CONFIGURABLE(cfgAcceptancePath, std::vector, (std::vector{"Users/f/fcui/NUA/NUAREFPartical", "Users/f/fcui/NUA/NUAK0s", "Users/f/fcui/NUA/NUALambda", "Users/f/fcui/NUA/NUAXi", "Users/f/fcui/NUA/NUAOmega"}), "CCDB path to acceptance object") + O2_DEFINE_CONFIGURABLE(cfgEfficiencyPath, std::vector, (std::vector{"PathtoRef"}), "CCDB path to efficiency object") ConfigurableAxis cfgaxisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis cfgaxisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; @@ -117,6 +142,11 @@ struct FlowGFWOmegaXi { // Define output HistogramRegistry registry{"registry"}; + OutputObj fWeightsREF{GFWWeights("weightsREF")}; + OutputObj fWeightsK0s{GFWWeights("weightsK0s")}; + OutputObj fWeightsLambda{GFWWeights("weightsLambda")}; + OutputObj fWeightsXi{GFWWeights("weightsXiMinus")}; + OutputObj fWeightsOmega{GFWWeights("weightsOmegaMinus")}; // define global variables GFW* fGFW = new GFW(); // GFW class used from main src @@ -135,10 +165,10 @@ struct FlowGFWOmegaXi { TF1* fT0AV0AMean = nullptr; TF1* fT0AV0ASigma = nullptr; - using TracksPID = soa::Join; + using TracksPID = soa::Join; using aodTracks = soa::Filtered>; // tracks filter using aodCollisions = soa::Filtered>; // collisions filter - using DaughterTracks = soa::Join; + using DaughterTracks = soa::Join; // Declare the pt, mult and phi Axis; int nPtBins = 0; @@ -177,11 +207,11 @@ struct FlowGFWOmegaXi { registry.add("hMult", "", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); registry.add("hCent", "", {HistType::kTH1D, {{90, 0, 90}}}); registry.add("hPt", "", {HistType::kTH1D, {cfgaxisPt}}); - registry.add("hEtaPhiVtxzREF", "", {HistType::kTH3D, {cfgaxisEta, cfgaxisPhi, {20, -10, 10}}}); - registry.add("hEtaPhiVtxzPOIXi", "", {HistType::kTH3D, {cfgaxisEta, cfgaxisPhi, {20, -10, 10}}}); - registry.add("hEtaPhiVtxzPOIOmega", "", {HistType::kTH3D, {cfgaxisEta, cfgaxisPhi, {20, -10, 10}}}); - registry.add("hEtaPhiVtxzPOIK0s", "", {HistType::kTH3D, {cfgaxisEta, cfgaxisPhi, {20, -10, 10}}}); - registry.add("hEtaPhiVtxzPOILambda", "", {HistType::kTH3D, {cfgaxisEta, cfgaxisPhi, {20, -10, 10}}}); + registry.add("hEtaPhiVtxzREF", "", {HistType::kTH3D, {cfgaxisPhi, cfgaxisEta, {20, -10, 10}}}); + registry.add("hEtaPhiVtxzPOIXi", "", {HistType::kTH3D, {cfgaxisPhi, cfgaxisEta, {20, -10, 10}}}); + registry.add("hEtaPhiVtxzPOIOmega", "", {HistType::kTH3D, {cfgaxisPhi, cfgaxisEta, {20, -10, 10}}}); + registry.add("hEtaPhiVtxzPOIK0s", "", {HistType::kTH3D, {cfgaxisPhi, cfgaxisEta, {20, -10, 10}}}); + registry.add("hEtaPhiVtxzPOILambda", "", {HistType::kTH3D, {cfgaxisPhi, cfgaxisEta, {20, -10, 10}}}); registry.add("hEventCount", "", {HistType::kTH2D, {{4, 0, 4}, {4, 0, 4}}}); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "after sel8"); @@ -192,9 +222,27 @@ struct FlowGFWOmegaXi { registry.get(HIST("hEventCount"))->GetYaxis()->SetBinLabel(3, "XiMinus"); registry.get(HIST("hEventCount"))->GetYaxis()->SetBinLabel(4, "Omega"); + // QA + registry.add("hqaV0radiusbefore", "", {HistType::kTH1D, {{200, 0, 200}}}); + registry.add("hqaV0radiusafter", "", {HistType::kTH1D, {{200, 0, 200}}}); + registry.add("hqaV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("hqaV0cosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("hqadcaV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("hqadcaV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("hqaarm_podobefore", "", {HistType::kTH2D, {{100, -1, 1}, {50, 0, 0.3}}}); + registry.add("hqaarm_podoafter", "", {HistType::kTH2D, {{100, -1, 1}, {50, 0, 0.3}}}); + registry.add("hqadcapostoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("hqadcapostoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("hqadcanegtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("hqadcanegtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + // cumulant of flow - registry.add("c22", ";Centrality (%) ; C_{2}{2}", {HistType::kTProfile2D, {cfgaxisPt, axisMultiplicity}}); - registry.add("c24", ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("c22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + registry.add("c24", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + registry.add("K0sc22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + registry.add("Lambdac22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + registry.add("c22dpt", ";Centrality (%) ; C_{2}{2}", {HistType::kTProfile2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("c24dpt", ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile2D, {cfgaxisPt, axisMultiplicity}}); // pt-diff cumulant of flow registry.add("Xic22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiminusMassforflow, axisMultiplicity}}); registry.add("Omegac22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisOmegaminusMassforflow, axisMultiplicity}}); @@ -204,6 +252,19 @@ struct FlowGFWOmegaXi { registry.add("Omegac24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisOmegaminusMassforflow, axisMultiplicity}}); registry.add("K0sc24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisK0sMassforflow, axisMultiplicity}}); registry.add("Lambdac24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisLambdaMassforflow, axisMultiplicity}}); + // for Jackknife + for (int i = 1; i <= 10; i++) { + REFc22[i - 1] = registry.add(Form("Jackknife/REF/c22_%d", i), ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + REFc24[i - 1] = registry.add(Form("Jackknife/REF/c24_%d", i), ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + Xic22[i - 1] = registry.add(Form("Jackknife/Xi/Xic22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiminusMassforflow, axisMultiplicity}}); + Omegac22[i - 1] = registry.add(Form("Jackknife/Omega/Omegac22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisOmegaminusMassforflow, axisMultiplicity}}); + K0sc22[i - 1] = registry.add(Form("Jackknife/K0s/K0sc22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisK0sMassforflow, axisMultiplicity}}); + Lambdac22[i - 1] = registry.add(Form("Jackknife/Lambda/Lambdac22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisLambdaMassforflow, axisMultiplicity}}); + Xic24[i - 1] = registry.add(Form("Jackknife/Xi/Xic24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiminusMassforflow, axisMultiplicity}}); + Omegac24[i - 1] = registry.add(Form("Jackknife/Omega/Omegac24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisOmegaminusMassforflow, axisMultiplicity}}); + K0sc24[i - 1] = registry.add(Form("Jackknife/K0s/K0sc24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisK0sMassforflow, axisMultiplicity}}); + Lambdac24[i - 1] = registry.add(Form("Jackknife/Lambda/Lambdac24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisLambdaMassforflow, axisMultiplicity}}); + } // InvMass(GeV) of casc and v0 registry.add("InvMassXiMinus_all", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisXiminusMass, cfgaxisEta, axisMultiplicity}}); registry.add("InvMassOmegaMinus_all", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisOmegaminusMass, cfgaxisEta, axisMultiplicity}}); @@ -240,44 +301,59 @@ struct FlowGFWOmegaXi { fLambdaMass = new TAxis(cfgLambdaMassbins, 1.08, 1.16); fGFW->AddRegion("reffull", -0.8, 0.8, 1, 1); // ("name", etamin, etamax, ptbinnum, bitmask)eta region -0.8 to 0.8 - // with (-0.5, 0.5) eta gap - fGFW->AddRegion("refN10", -0.8, -0.5, 1, 1); - fGFW->AddRegion("refP10", 0.5, 0.8, 1, 1); - fGFW->AddRegion("refN10dpt", -0.8, -0.5, nPtBins, 1); - fGFW->AddRegion("refP10dpt", 0.5, 0.8, nPtBins, 1); - fGFW->AddRegion("reffulldpt", -0.8, 0.8, nPtBins, 1); - fGFW->AddRegion("refoldpt", -0.8, 0.8, nPtBins, 1); + fGFW->AddRegion("refN10", -0.8, -0.4, 1, 1); + fGFW->AddRegion("refP10", 0.4, 0.8, 1, 1); + // POI + fGFW->AddRegion("poiN10dpt", -0.8, -0.4, nPtBins, 32); + fGFW->AddRegion("poiP10dpt", 0.4, 0.8, nPtBins, 32); + fGFW->AddRegion("poifulldpt", -0.8, 0.8, nPtBins, 32); + fGFW->AddRegion("poioldpt", -0.8, 0.8, nPtBins, 1); int nXiptMassBins = nXiPtBins * cfgXiMassbins; - fGFW->AddRegion("poiXiP", 0.5, 0.8, nXiptMassBins, 2); - fGFW->AddRegion("poiXiN", -0.8, -0.5, nXiptMassBins, 2); - fGFW->AddRegion("poiXifull", -0.8, 0.8, nXiptMassBins, 2); + fGFW->AddRegion("poiXiPdpt", 0.4, 0.8, nXiptMassBins, 2); + fGFW->AddRegion("poiXiNdpt", -0.8, -0.4, nXiptMassBins, 2); + fGFW->AddRegion("poiXifulldpt", -0.8, 0.8, nXiptMassBins, 2); + fGFW->AddRegion("poiXiP", 0.4, 0.8, 1, 2); + fGFW->AddRegion("poiXiN", -0.8, -0.4, 1, 2); int nOmegaptMassBins = nXiPtBins * cfgOmegaMassbins; - fGFW->AddRegion("poiOmegaP", 0.5, 0.8, nOmegaptMassBins, 4); - fGFW->AddRegion("poiOmegaN", -0.8, -0.5, nOmegaptMassBins, 4); - fGFW->AddRegion("poiOmegafull", -0.8, 0.8, nOmegaptMassBins, 4); + fGFW->AddRegion("poiOmegaPdpt", 0.4, 0.8, nOmegaptMassBins, 4); + fGFW->AddRegion("poiOmegaNdpt", -0.8, -0.4, nOmegaptMassBins, 4); + fGFW->AddRegion("poiOmegafulldpt", -0.8, 0.8, nOmegaptMassBins, 4); + fGFW->AddRegion("poiOmegaP", 0.4, 0.8, 1, 4); + fGFW->AddRegion("poiOmegaN", -0.8, -0.4, 1, 4); int nK0sptMassBins = nV0PtBins * cfgK0sMassbins; - fGFW->AddRegion("poiK0sP", 0.5, 0.8, nK0sptMassBins, 8); - fGFW->AddRegion("poiK0sN", -0.8, -0.5, nK0sptMassBins, 8); - fGFW->AddRegion("poiK0sfull", -0.8, 0.8, nK0sptMassBins, 8); + fGFW->AddRegion("poiK0sPdpt", 0.4, 0.8, nK0sptMassBins, 8); + fGFW->AddRegion("poiK0sNdpt", -0.8, -0.4, nK0sptMassBins, 8); + fGFW->AddRegion("poiK0sfulldpt", -0.8, 0.8, nK0sptMassBins, 8); + fGFW->AddRegion("poiK0sP", 0.4, 0.8, 1, 8); + fGFW->AddRegion("poiK0sN", -0.8, 0.4, 1, 8); int nLambdaptMassBins = nV0PtBins * cfgLambdaMassbins; - fGFW->AddRegion("poiLambdaP", 0.5, 0.8, nLambdaptMassBins, 16); - fGFW->AddRegion("poiLambdaN", -0.8, -0.5, nLambdaptMassBins, 16); - fGFW->AddRegion("poiLambdafull", -0.8, 0.8, nLambdaptMassBins, 16); + fGFW->AddRegion("poiLambdaPdpt", 0.4, 0.8, nLambdaptMassBins, 16); + fGFW->AddRegion("poiLambdaNdpt", -0.8, -0.4, nLambdaptMassBins, 16); + fGFW->AddRegion("poiLambdafulldpt", -0.8, 0.8, nLambdaptMassBins, 16); + fGFW->AddRegion("poiLambdaP", 0.4, 0.8, 1, 16); + fGFW->AddRegion("poiLambdaN", -0.8, -0.4, 1, 16); // pushback - corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP10dpt {2} refN10dpt {-2}", "Ref10Gap22", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("reffulldpt reffulldpt {2 2 -2 -2}", "Ref10Gap24", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiP {2} refN10 {-2}", "Xi10Gap22a", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiN {2} refP10 {-2}", "Xi10Gap22b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXifull reffull {2 2 -2 -2}", "Xi10Gap24", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaP {2} refN10 {-2}", "Omega10Gap22a", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaN {2} refP10 {-2}", "Omega10Gap22b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaP reffull {2 2 -2 -2}", "Xi10Gap24", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sP {2} refN10 {-2}", "K0short10Gap22a", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sN {2} refP10 {-2}", "K0short10Gap22b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sP reffull {2 2 -2 -2}", "Xi10Gap24", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaP {2} refN10 {-2}", "Lambda10Gap22a", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaN {2} refP10 {-2}", "Lambda10Gap22b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaP reffull {2 2 -2 -2}", "Xi10Gap24a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiP10dpt {2} refN10 {-2}", "Poi10Gap22dpta", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10dpt {2} refP10 {-2}", "Poi10Gap22dptb", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poifulldpt reffull | poioldpt {2 2 -2 -2}", "Poi10Gap24dpt", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiPdpt {2} refN10 {-2}", "Xi10Gap22a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiNdpt {2} refP10 {-2}", "Xi10Gap22b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXifulldpt reffull {2 2 -2 -2}", "Xi10Gap24", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaPdpt {2} refN10 {-2}", "Omega10Gap22a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaNdpt {2} refP10 {-2}", "Omega10Gap22b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt reffull {2 2 -2 -2}", "Xi10Gap24", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sPdpt {2} refN10 {-2}", "K0short10Gap22a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sNdpt {2} refP10 {-2}", "K0short10Gap22b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sfulldpt reffull {2 2 -2 -2}", "Xi10Gap24", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaPdpt {2} refN10 {-2}", "Lambda10Gap22a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaNdpt {2} refP10 {-2}", "Lambda10Gap22b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdafulldpt reffull {2 2 -2 -2}", "Xi10Gap24a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP10 {2} refN10 {-2}", "Ref10Gap22a", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("reffull reffull {2 2 -2 -2}", "Ref10Gap24", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sP {2} refN10 {-2}", "K0s10Gap22inta", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sN {2} refP10 {-2}", "K0s10Gap22intb", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaP {2} refN10 {-2}", "Lambda10Gap22inta", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaN {2} refP10 {-2}", "Lambda10Gap22intb", kFALSE)); fGFW->CreateRegions(); // finalize the initialization // used for event selection @@ -293,25 +369,73 @@ struct FlowGFWOmegaXi { fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); + + // fWeight output + if (cfgOutputNUAWeights) { + fWeightsREF->SetPtBins(nPtBins, &(axisPt.binEdges)[0]); + fWeightsREF->Init(true, false); + fWeightsK0s->SetPtBins(nPtBins, &(axisPt.binEdges)[0]); + fWeightsK0s->Init(true, false); + fWeightsLambda->SetPtBins(nPtBins, &(axisPt.binEdges)[0]); + fWeightsLambda->Init(true, false); + fWeightsXi->SetPtBins(nPtBins, &(axisPt.binEdges)[0]); + fWeightsXi->Init(true, false); + fWeightsOmega->SetPtBins(nPtBins, &(axisPt.binEdges)[0]); + fWeightsOmega->Init(true, false); + } + } + + // input HIST("name") + template + void FillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (std::fabs(val) < 1) + registry.fill(tarName, cent, val, dnx); + return; + } + return; + } + + // input shared_ptr + void FillProfile(const GFW::CorrConfig& corrconf, std::shared_ptr TProfile, const double& cent) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (std::fabs(val) < 1) + TProfile->Fill(cent, val, dnx); + return; + } + return; } template - void FillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const int& ptbin, const double& cent) + void FillProfilepT(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const int& ptbin, const double& cent) { float dnx = 0; float val = 0; - dnx = fGFW->Calculate(corrconf, ptbin, kTRUE).real(); + dnx = fGFW->Calculate(corrconf, ptbin - 1, kTRUE).real(); if (dnx == 0) return; - val = fGFW->Calculate(corrconf, ptbin, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) { + val = fGFW->Calculate(corrconf, ptbin - 1, kFALSE).real() / dnx; + if (std::fabs(val) < 1) { registry.fill(tarName, fPtAxis->GetBinCenter(ptbin), cent, val, dnx); } return; } + // input HIST("name") template - void FillProfilepT(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const int& ptbin, const int& PDGCode, const float& cent) + void FillProfilepTMass(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const int& ptbin, const int& PDGCode, const float& cent) { int nMassBins = 0; int nptbins = 0; @@ -348,31 +472,79 @@ struct FlowGFWOmegaXi { if (dnx == 0) continue; val = fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) { + if (std::fabs(val) < 1) { registry.fill(tarName, fpt->GetBinCenter(ptbin), fMass->GetBinCenter(massbin), cent, val, dnx); } } return; } + // input shared_ptr + void FillProfilepTMass(const GFW::CorrConfig& corrconf, std::shared_ptr TProfile3D, const int& ptbin, const int& PDGCode, const float& cent) + { + int nMassBins = 0; + int nptbins = 0; + TAxis* fMass = nullptr; + TAxis* fpt = nullptr; + if (PDGCode == kXiMinus) { + nMassBins = cfgXiMassbins; + nptbins = nXiPtBins; + fpt = fXiPtAxis; + fMass = fXiMass; + } else if (PDGCode == kOmegaMinus) { + nMassBins = cfgOmegaMassbins; + nptbins = nXiPtBins; + fpt = fXiPtAxis; + fMass = fOmegaMass; + } else if (PDGCode == kK0Short) { + nMassBins = cfgK0sMassbins; + nptbins = nV0PtBins; + fpt = fV0PtAxis; + fMass = fK0sMass; + } else if (PDGCode == kLambda0) { + nMassBins = cfgLambdaMassbins; + nptbins = nV0PtBins; + fpt = fV0PtAxis; + fMass = fLambdaMass; + } else { + LOGF(error, "Error, please put in correct PDGCode of K0s, Lambda, Xi or Omega"); + return; + } + for (int massbin = 1; massbin <= nMassBins; massbin++) { + float dnx = 0; + float val = 0; + dnx = fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); + if (dnx == 0) + continue; + val = fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real() / dnx; + if (std::fabs(val) < 1) { + TProfile3D->Fill(fpt->GetBinCenter(ptbin), fMass->GetBinCenter(massbin), cent, val, dnx); + } + } + return; + } + void loadCorrections(uint64_t timestamp) { if (correctionsLoaded) return; - if (cfgAcceptance.size() == 5 && cfgEfficiency.size() == 5) { + if (cfgAcceptance.size() == 5) { + for (int i = 0; i <= 4; i++) { + mAcceptance.push_back(ccdb->getForTimeStamp(cfgAcceptance[i], timestamp)); + } + if (mAcceptance.size() == 5) + LOGF(info, "Loaded acceptance weights"); + else + LOGF(warning, "Could not load acceptance weights"); + } + if (cfgEfficiency.size() == 5) { for (int i = 0; i <= 4; i++) { mAcceptance.push_back(ccdb->getForTimeStamp(cfgAcceptance[i], timestamp)); - if (mAcceptance.size() == 4) - LOGF(info, "Loaded acceptance weights of REF particle from %s (%p)", cfgAcceptance[i], (void*)mAcceptance[i]); - else - LOGF(warning, "Could not load acceptance weights of REF particle from %s (%p)", cfgAcceptance[i], (void*)mAcceptance[i]); - - mEfficiency.push_back(ccdb->getForTimeStamp(cfgEfficiency[i], timestamp)); - if (mEfficiency.size() == 4) - LOGF(fatal, "Could not load efficiency of REF particle histogram for trigger particles from %s", cfgEfficiency[i]); - - LOGF(info, "Loaded efficiency of REF particle histogram from %s (%p)", cfgEfficiency[i], (void*)mEfficiency[i]); } + if (mEfficiency.size() == 5) + LOGF(info, "Loaded efficiency histogram"); + else + LOGF(fatal, "Could not load efficiency histogram"); } correctionsLoaded = true; } @@ -381,14 +553,14 @@ struct FlowGFWOmegaXi { bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, TrackObject track, float vtxz, int ispecies) { float eff = 1.; - if (mEfficiency.size() == 4) + if (mEfficiency.size() == 5) eff = mEfficiency[ispecies]->GetBinContent(mEfficiency[ispecies]->FindBin(track.pt())); else eff = 1.0; if (eff == 0) return false; weight_nue = 1. / eff; - if (mAcceptance.size() == 4) + if (mAcceptance.size() == 5) weight_nua = mAcceptance[ispecies]->GetNUA(track.phi(), track.eta(), vtxz); else weight_nua = 1; @@ -422,6 +594,10 @@ struct FlowGFWOmegaXi { // use this cut at low multiplicities with caution return false; } + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + // no collisions in specified time range + return 0; + } float vtxz = -999; if (collision.numContrib() > 1) { vtxz = collision.posZ(); @@ -430,8 +606,9 @@ struct FlowGFWOmegaXi { vtxz = -999; } auto multNTracksPV = collision.multNTracksPV(); + auto occupancy = collision.trackOccupancyInTimeRange(); - if (abs(vtxz) > cfgCutVertex) + if (std::fabs(vtxz) > cfgCutVertex) return false; if (multNTracksPV < fMultPVCutLow->Eval(centrality)) return false; @@ -441,9 +618,11 @@ struct FlowGFWOmegaXi { return false; if (multTrk > fMultCutHigh->Eval(centrality)) return false; + if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh) + return 0; // V0A T0A 5 sigma cut - if (abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A())) + if (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A())) return 0; return true; @@ -483,12 +662,17 @@ struct FlowGFWOmegaXi { continue; registry.fill(HIST("hPhi"), track.phi()); registry.fill(HIST("hEta"), track.eta()); - registry.fill(HIST("hEtaPhiVtxzREF"), track.eta(), track.phi(), vtxz); + registry.fill(HIST("hEtaPhiVtxzREF"), track.phi(), track.eta(), vtxz, wacc); registry.fill(HIST("hPt"), track.pt()); int ptbin = fPtAxis->FindBin(track.pt()) - 1; if ((track.pt() > cfgCutPtMin) && (track.pt() < cfgCutPtMax)) { fGFW->Fill(track.eta(), ptbin, track.phi(), wacc * weff, 1); //(eta, ptbin, phi, wacc*weff, bitmask) } + if ((track.pt() > cfgCutPtPOIMin) && (track.pt() < cfgCutPtPOIMax)) { + fGFW->Fill(track.eta(), ptbin, track.phi(), wacc * weff, 32); + } + if (cfgOutputNUAWeights) + fWeightsREF->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); } // fill GFW of V0 flow for (auto& v0 : V0s) { @@ -496,24 +680,44 @@ struct FlowGFWOmegaXi { auto v0negdau = v0.negTrack_as(); // check tpc int PDGCode = 0; - if (v0.qtarm() / TMath::Abs(v0.alpha()) > cfgv0_ArmPodocut && TMath::Abs(v0posdau.tpcNSigmaPi()) < cfgNSigmaCascPion && TMath::Abs(v0negdau.tpcNSigmaPi()) < cfgNSigmaCascPion) { + // fill QA + registry.fill(HIST("hqaarm_podobefore"), v0.alpha(), v0.qtarm()); + // check daughter TPC and TOF + if (v0.qtarm() / std::fabs(v0.alpha()) > cfgv0_ArmPodocut && + (!cfgcheckDauTPC || (std::fabs(v0posdau.tpcNSigmaPi()) < cfgtpcNSigmaCascPion && std::fabs(v0negdau.tpcNSigmaPi()) < cfgtpcNSigmaCascPion)) && + (!cfgcheckDauTOF || (std::fabs(v0posdau.tofNSigmaPi()) < cfgtofNSigmaCascPion && std::fabs(v0negdau.tofNSigmaPi()) < cfgtofNSigmaCascPion))) { registry.fill(HIST("InvMassK0s_all"), v0.pt(), v0.mK0Short(), v0.eta(), cent); if (!setCurrentParticleWeights(weff, wacc, v0, vtxz, 1)) continue; PDGCode = kK0Short; CandNum_all[0] = CandNum_all[0] + 1; - } else if (v0.qtarm() / TMath::Abs(v0.alpha()) < cfgv0_ArmPodocut && TMath::Abs(v0posdau.tpcNSigmaPr()) < cfgNSigmaCascProton && TMath::Abs(v0negdau.tpcNSigmaPi()) < cfgNSigmaCascPion) { + registry.fill(HIST("hqaarm_podoafter"), v0.alpha(), v0.qtarm()); + } else if ((!cfgcheckDauTPC || (std::fabs(v0posdau.tpcNSigmaPr()) < cfgtpcNSigmaCascProton && std::fabs(v0negdau.tpcNSigmaPi()) < cfgtpcNSigmaCascPion)) && + (!cfgcheckDauTOF || (std::fabs(v0posdau.tofNSigmaPr()) < cfgtofNSigmaCascProton && std::fabs(v0negdau.tofNSigmaPi()) < cfgtofNSigmaCascPion))) { registry.fill(HIST("InvMassLambda_all"), v0.pt(), v0.mLambda(), v0.eta(), cent); if (!setCurrentParticleWeights(weff, wacc, v0, vtxz, 2)) continue; PDGCode = kLambda0; CandNum_all[1] = CandNum_all[1] + 1; } + // fill QA before cut + registry.fill(HIST("hqaV0radiusbefore"), v0.v0radius()); + registry.fill(HIST("hqaV0cosPAbefore"), v0.v0cosPA()); + registry.fill(HIST("hqadcaV0daubefore"), v0.dcaV0daughters()); + registry.fill(HIST("hqadcapostoPVbefore"), v0.dcapostopv()); + registry.fill(HIST("hqadcanegtoPVbefore"), v0.dcanegtopv()); + // track quality check if (v0posdau.tpcNClsFound() < cfgtpcclusters) continue; if (v0negdau.tpcNClsFound() < cfgtpcclusters) continue; + if (v0posdau.tpcNClsFindable() < cfgtpcclufindable) + continue; + if (v0negdau.tpcNClsFindable() < cfgtpcclufindable) + continue; + if (v0posdau.tpcCrossedRowsOverFindableCls() < cfgtpccrossoverfindable) + continue; if (v0posdau.itsNCls() < cfgitsclusters) continue; if (v0negdau.itsNCls() < cfgitsclusters) @@ -525,19 +729,33 @@ struct FlowGFWOmegaXi { continue; if (v0.dcaV0daughters() > cfgv0_dcav0dau) continue; + if (std::fabs(v0.dcapostopv()) < cfgv0_dcadautopv) + continue; + if (std::fabs(v0.dcanegtopv()) < cfgv0_dcadautopv) + continue; + // fill QA after cut + registry.fill(HIST("hqaV0radiusafter"), v0.v0radius()); + registry.fill(HIST("hqaV0cosPAafter"), v0.v0cosPA()); + registry.fill(HIST("hqadcaV0dauafter"), v0.dcaV0daughters()); + registry.fill(HIST("hqadcapostoPVafter"), v0.dcapostopv()); + registry.fill(HIST("hqadcanegtoPVafter"), v0.dcanegtopv()); if (PDGCode == kK0Short) { - if (TMath::Abs(v0.mK0Short() - 0.49761) < cfgv0_mk0swindow) { + if (std::fabs(v0.mK0Short() - o2::constants::physics::MassK0Short) < cfgv0_mk0swindow) { CandNum[0] = CandNum[0] + 1; registry.fill(HIST("InvMassK0s"), v0.pt(), v0.mK0Short(), v0.eta(), cent); - registry.fill(HIST("hEtaPhiVtxzPOIK0s"), v0.eta(), v0.phi(), vtxz); + registry.fill(HIST("hEtaPhiVtxzPOIK0s"), v0.phi(), v0.eta(), vtxz, wacc); fGFW->Fill(v0.eta(), fV0PtAxis->FindBin(v0.pt()) - 1 + ((fK0sMass->FindBin(v0.mK0Short()) - 1) * nV0PtBins), v0.phi(), wacc * weff, 8); + if (cfgOutputNUAWeights) + fWeightsK0s->Fill(v0.phi(), v0.eta(), vtxz, v0.pt(), cent, 0); } } else if (PDGCode == kLambda0) { - if (TMath::Abs(v0.mLambda() - 1.115683) < cfgv0_mlambdawindow) { + if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda0) < cfgv0_mlambdawindow) { CandNum[1] = CandNum[1] + 1; registry.fill(HIST("InvMassLambda"), v0.pt(), v0.mLambda(), v0.eta(), cent); - registry.fill(HIST("hEtaPhiVtxzPOILambda"), v0.eta(), v0.phi(), vtxz); + registry.fill(HIST("hEtaPhiVtxzPOILambda"), v0.phi(), v0.eta(), vtxz, wacc); fGFW->Fill(v0.eta(), fV0PtAxis->FindBin(v0.pt()) - 1 + ((fLambdaMass->FindBin(v0.mLambda()) - 1) * nV0PtBins), v0.phi(), wacc * weff, 16); + if (cfgOutputNUAWeights) + fWeightsLambda->Fill(v0.phi(), v0.eta(), vtxz, v0.pt(), cent, 0); } } } @@ -551,13 +769,13 @@ struct FlowGFWOmegaXi { continue; } int PDGCode = 0; - if (casc.sign() < 0 && TMath::Abs(casc.yOmega()) < cfgCasc_rapidity && TMath::Abs(bachelor.tpcNSigmaKa()) < cfgNSigmaCascKaon && TMath::Abs(posdau.tpcNSigmaPr()) < cfgNSigmaCascProton && TMath::Abs(negdau.tpcNSigmaPi()) < cfgNSigmaCascPion) { + if (casc.sign() < 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && std::fabs(bachelor.tpcNSigmaKa()) < cfgtpcNSigmaCascKaon && std::fabs(posdau.tpcNSigmaPr()) < cfgtpcNSigmaCascProton && std::fabs(negdau.tpcNSigmaPi()) < cfgtpcNSigmaCascPion && std::fabs(bachelor.tofNSigmaKa()) < cfgtofNSigmaCascKaon && std::fabs(posdau.tofNSigmaPr()) < cfgtofNSigmaCascProton && std::fabs(negdau.tofNSigmaPi()) < cfgtofNSigmaCascPion) { registry.fill(HIST("InvMassOmegaMinus_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); if (!setCurrentParticleWeights(weff, wacc, casc, vtxz, 4)) continue; PDGCode = kOmegaMinus; CandNum_all[3] = CandNum_all[3] + 1; - } else if (casc.sign() < 0 && TMath::Abs(casc.yXi()) < cfgCasc_rapidity && TMath::Abs(bachelor.tpcNSigmaPi()) < cfgNSigmaCascPion && TMath::Abs(posdau.tpcNSigmaPr()) < cfgNSigmaCascProton && TMath::Abs(negdau.tpcNSigmaPi()) < cfgNSigmaCascPion) { + } else if (casc.sign() < 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && std::fabs(bachelor.tpcNSigmaPi()) < cfgtpcNSigmaCascPion && std::fabs(posdau.tpcNSigmaPr()) < cfgtpcNSigmaCascProton && std::fabs(negdau.tpcNSigmaPi()) < cfgtpcNSigmaCascPion && std::fabs(bachelor.tofNSigmaPi()) < cfgtofNSigmaCascPion && std::fabs(posdau.tofNSigmaPr()) < cfgtofNSigmaCascProton && std::fabs(negdau.tofNSigmaPi()) < cfgtofNSigmaCascPion) { registry.fill(HIST("InvMassXiMinus_all"), casc.pt(), casc.mXi(), casc.eta(), cent); if (!setCurrentParticleWeights(weff, wacc, casc, vtxz, 3)) continue; @@ -581,7 +799,7 @@ struct FlowGFWOmegaXi { continue; if (casc.dcaV0daughters() > cfgcasc_dcav0dau) continue; - if (TMath::Abs(casc.mLambda() - 1.115683) > cfgcasc_mlambdawindow) + if (std::fabs(casc.mLambda() - o2::constants::physics::MassLambda0) > cfgcasc_mlambdawindow) continue; // track quality check if (bachelor.tpcNClsFound() < cfgtpcclusters) @@ -598,49 +816,85 @@ struct FlowGFWOmegaXi { continue; if (PDGCode == kOmegaMinus) { CandNum[3] = CandNum[3] + 1; - registry.fill(HIST("hEtaPhiVtxzPOIOmega"), casc.eta(), casc.phi(), vtxz); + registry.fill(HIST("hEtaPhiVtxzPOIOmega"), casc.phi(), casc.eta(), vtxz, wacc); registry.fill(HIST("InvMassOmegaMinus"), casc.pt(), casc.mOmega(), casc.eta(), cent); if ((casc.pt() < cfgCutPtPOIMax) && (casc.pt() > cfgCutPtPOIMin) && (casc.mOmega() > 1.63) && (casc.mOmega() < 1.71)) { fGFW->Fill(casc.eta(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nXiPtBins), casc.phi(), wacc * weff, 4); } + if (cfgOutputNUAWeights) + fWeightsOmega->Fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); } if (PDGCode == kXiMinus) { CandNum[2] = CandNum[2] + 1; - registry.fill(HIST("hEtaPhiVtxzPOIXi"), casc.eta(), casc.phi(), vtxz); + registry.fill(HIST("hEtaPhiVtxzPOIXi"), casc.phi(), casc.eta(), vtxz, wacc); registry.fill(HIST("InvMassXiMinus"), casc.pt(), casc.mXi(), casc.eta(), cent); if ((casc.pt() < cfgCutPtPOIMax) && (casc.pt() > cfgCutPtPOIMin) && (casc.mXi() > 1.30) && (casc.mXi() < 1.37)) { fGFW->Fill(casc.eta(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fXiMass->FindBin(casc.mXi()) - 1) * nXiPtBins), casc.phi(), wacc * weff, 2); } + if (cfgOutputNUAWeights) + fWeightsXi->Fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); } } for (int i = 0; i < 4; i++) { - if (CandNum_all[i] > 1) { + if (CandNum_all[i] > 0) { registry.fill(HIST("hEventCount"), 2.5, i + 0.5); } - if (CandNum[i] > 1) { + if (CandNum[i] > 0) { registry.fill(HIST("hEventCount"), 3.5, i + 0.5); } } // Filling cumulant with ROOT TProfile and loop for all ptBins + FillProfile(corrconfigs.at(15), HIST("c22"), cent); + FillProfile(corrconfigs.at(16), HIST("c24"), cent); + FillProfile(corrconfigs.at(17), HIST("K0sc22"), cent); + FillProfile(corrconfigs.at(18), HIST("K0sc22"), cent); + FillProfile(corrconfigs.at(19), HIST("Lambdac22"), cent); + FillProfile(corrconfigs.at(20), HIST("Lambdac22"), cent); for (int i = 1; i <= nPtBins; i++) { - FillProfile(corrconfigs.at(0), HIST("c22"), i, cent); - FillProfile(corrconfigs.at(1), HIST("c24"), i, cent); + FillProfilepT(corrconfigs.at(0), HIST("c22dpt"), i, cent); + FillProfilepT(corrconfigs.at(1), HIST("c22dpt"), i, cent); + FillProfilepT(corrconfigs.at(2), HIST("c24dpt"), i, cent); } for (int i = 1; i <= nV0PtBins; i++) { - FillProfilepT(corrconfigs.at(8), HIST("K0sc22dpt"), i, kK0Short, cent); - FillProfilepT(corrconfigs.at(9), HIST("K0sc22dpt"), i, kK0Short, cent); - FillProfilepT(corrconfigs.at(10), HIST("K0sc24dpt"), i, kK0Short, cent); - FillProfilepT(corrconfigs.at(11), HIST("Lambdac22dpt"), i, kLambda0, cent); - FillProfilepT(corrconfigs.at(12), HIST("Lambdac22dpt"), i, kLambda0, cent); - FillProfilepT(corrconfigs.at(13), HIST("Lambdac24dpt"), i, kLambda0, cent); + FillProfilepTMass(corrconfigs.at(9), HIST("K0sc22dpt"), i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(10), HIST("K0sc22dpt"), i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(11), HIST("K0sc24dpt"), i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(12), HIST("Lambdac22dpt"), i, kLambda0, cent); + FillProfilepTMass(corrconfigs.at(13), HIST("Lambdac22dpt"), i, kLambda0, cent); + FillProfilepTMass(corrconfigs.at(14), HIST("Lambdac24dpt"), i, kLambda0, cent); } for (int i = 1; i <= nXiPtBins; i++) { - FillProfilepT(corrconfigs.at(2), HIST("Xic22dpt"), i, kXiMinus, cent); - FillProfilepT(corrconfigs.at(3), HIST("Xic22dpt"), i, kXiMinus, cent); - FillProfilepT(corrconfigs.at(4), HIST("Xic24dpt"), i, kXiMinus, cent); - FillProfilepT(corrconfigs.at(5), HIST("Omegac22dpt"), i, kOmegaMinus, cent); - FillProfilepT(corrconfigs.at(6), HIST("Omegac22dpt"), i, kOmegaMinus, cent); - FillProfilepT(corrconfigs.at(7), HIST("Omegac24dpt"), i, kOmegaMinus, cent); + FillProfilepTMass(corrconfigs.at(3), HIST("Xic22dpt"), i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(4), HIST("Xic22dpt"), i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(5), HIST("Xic24dpt"), i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(6), HIST("Omegac22dpt"), i, kOmegaMinus, cent); + FillProfilepTMass(corrconfigs.at(7), HIST("Omegac22dpt"), i, kOmegaMinus, cent); + FillProfilepTMass(corrconfigs.at(8), HIST("Omegac24dpt"), i, kOmegaMinus, cent); + } + // Fill subevents flow + TRandom3* fRdm = new TRandom3(0); + double Eventrdm = 10 * fRdm->Rndm(); + for (int j = 1; j <= 10; j++) { + if (Eventrdm > (j - 1) && Eventrdm < j) + continue; + FillProfile(corrconfigs.at(15), REFc22[j - 1], cent); + FillProfile(corrconfigs.at(16), REFc24[j - 1], cent); + for (int i = 1; i <= nV0PtBins; i++) { + FillProfilepTMass(corrconfigs.at(9), K0sc22[j - 1], i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(10), K0sc22[j - 1], i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(11), K0sc24[j - 1], i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(12), Lambdac22[j - 1], i, kLambda0, cent); + FillProfilepTMass(corrconfigs.at(13), Lambdac22[j - 1], i, kLambda0, cent); + FillProfilepTMass(corrconfigs.at(14), Lambdac24[j - 1], i, kLambda0, cent); + } + for (int i = 1; i <= nXiPtBins; i++) { + FillProfilepTMass(corrconfigs.at(3), Xic22[j - 1], i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(4), Xic22[j - 1], i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(5), Xic24[j - 1], i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(6), Omegac22[j - 1], i, kOmegaMinus, cent); + FillProfilepTMass(corrconfigs.at(7), Omegac22[j - 1], i, kOmegaMinus, cent); + FillProfilepTMass(corrconfigs.at(8), Omegac24[j - 1], i, kOmegaMinus, cent); + } } } }; diff --git a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx new file mode 100644 index 00000000000..4c93cefdf2d --- /dev/null +++ b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx @@ -0,0 +1,356 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file flowPbpbPikp.cxx +/// \brief PID flow using the generic framework +/// \author Preet Bhanjan Pati + +#include +#include +#include +#include +#include +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/StepTHn.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Multiplicity.h" +#include "CommonConstants/PhysicsConstants.h" + +#include "PWGCF/GenericFramework/Core/GFWPowerArray.h" +#include "PWGCF/GenericFramework/Core/GFW.h" +#include "PWGCF/GenericFramework/Core/GFWCumulant.h" +#include "PWGCF/GenericFramework/Core/FlowContainer.h" + +#include "ReconstructionDataFormats/Track.h" +#include "ReconstructionDataFormats/PID.h" + +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace std; + +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +struct FlowPbpbPikp { + Service ccdb; + Configurable noLaterThan{"noLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable ccdbUrl{"ccdbUrl", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; + + O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") + O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMin, float, 0.2f, "Minimal pT for poi tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMax, float, 10.0f, "Maximal pT for poi tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "Minimal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 3.0f, "Maximal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables") + O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") + + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; + ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; + ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.20, 1.40, 1.60, 1.80, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00, 3.50, 4.00, 5.00, 6.00, 8.00, 10.00}, "pt axis for histograms"}; + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "centrality axis for histograms"}; + ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {80, -5, 5}, "nsigmaTPC axis"}; + ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"}; + ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"}; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); + + OutputObj fFC{FlowContainer("FlowContainer")}; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + GFW* fGFW = new GFW(); + std::vector corrconfigs; + TAxis* fPtAxis; + TRandom3* fRndm = new TRandom3(0); + + using AodCollisions = soa::Filtered>; + // using AodTracks = soa::Filtered>; + using AodTracks = soa::Filtered>; + + void init(InitContext const&) + { + ccdb->setURL(ccdbUrl.value); + ccdb->setCaching(true); + ccdb->setCreatedNotAfter(noLaterThan.value); + + histos.add("hPhi", "", {HistType::kTH1D, {axisPhi}}); + histos.add("hEta", "", {HistType::kTH1D, {axisEta}}); + histos.add("hVtxZ", "", {HistType::kTH1D, {axisVertex}}); + histos.add("hMult", "", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); + histos.add("hCent", "", {HistType::kTH1D, {{90, 0, 90}}}); + histos.add("hPt", "", {HistType::kTH1D, {axisPt}}); + histos.add("c22_gap08", "", {HistType::kTProfile, {axisMultiplicity}}); + histos.add("c22_gap08_pi", "", {HistType::kTProfile, {axisMultiplicity}}); + histos.add("c22_gap08_ka", "", {HistType::kTProfile, {axisMultiplicity}}); + histos.add("c22_gap08_pr", "", {HistType::kTProfile, {axisMultiplicity}}); + histos.add("c24_full", "", {HistType::kTProfile, {axisMultiplicity}}); + histos.add("TofTpcNsigma", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); + histos.add("partCount", "", {HistType::kTHnSparseD, {{axisParticles, axisMultiplicity, axisPt}}}); + o2::framework::AxisSpec axis = axisPt; + int nPtBins = axis.binEdges.size() - 1; + double* ptBins = &(axis.binEdges)[0]; + fPtAxis = new TAxis(nPtBins, ptBins); + + TObjArray* oba = new TObjArray(); + oba->Add(new TNamed("Ch08Gap22", "Ch08Gap22")); + for (int i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("Ch08Gap22_pt_%i", i + 1), "Ch08Gap22_pTDiff")); + oba->Add(new TNamed("Pi08Gap22", "Pi08Gap22")); + for (int i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("Pi08Gap22_pt_%i", i + 1), "Pi08Gap22_pTDiff")); + oba->Add(new TNamed("Ka08Gap22", "Ka08Gap22")); + for (int i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("Ka08Gap22_pt_%i", i + 1), "Ka08Gap22_pTDiff")); + oba->Add(new TNamed("Pr08Gap22", "Pr08Gap22")); + for (int i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("Pr08Gap22_pt_%i", i + 1), "Pr08Gap22_pTDiff")); + oba->Add(new TNamed("ChFull24", "ChFull24")); + for (int i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("ChFull24_pt_%i", i + 1), "ChFull24_pTDiff")); + + fFC->SetName("FlowContainer"); + fFC->SetXAxis(fPtAxis); + fFC->Initialize(oba, axisMultiplicity, cfgNbootstrap); + delete oba; + + fGFW->AddRegion("refN08", -0.8, -0.4, 1, 1); + fGFW->AddRegion("refP08", 0.4, 0.8, 1, 1); + fGFW->AddRegion("full", -0.8, 0.8, 1, 512); + + // charged parts + fGFW->AddRegion("poiN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 128); + fGFW->AddRegion("olN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 256); + + // pion + fGFW->AddRegion("poiNpi", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 2); + fGFW->AddRegion("olNpi", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 16); + + // kaon + fGFW->AddRegion("poiNk", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 4); + fGFW->AddRegion("olNk", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 32); + + // proton + fGFW->AddRegion("poiNpr", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 8); + fGFW->AddRegion("olNpr", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 64); + + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN08 {2} refP08 {-2}", "Ch08Gap22", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN08 {2} refP08 {-2}", "Pi08Gap22", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN08 {2} refP08 {-2}", "Ka08Gap22", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN08 {2} refP08 {-2}", "Pr08Gap22", kFALSE)); + + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN refN08 | olN {2} refP08 {-2}", "Ch08Gap22", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiNpi refN08 | olNpi {2} refP08 {-2}", "Pi08Gap22", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiNk refN08 | olNk {2} refP08 {-2}", "Ka08Gap22", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiNpr refN08 | olNpr {2} refP08 {-2}", "Pr08Gap22", kTRUE)); + + corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 2 -2 -2}", "ChFull24", kFALSE)); + fGFW->CreateRegions(); + } + + enum Particles { + PIONS, + KAONS, + PROTONS + }; + + template + int getNsigmaPID(TTrack track) + { + // Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaCombined = {std::hypot(track.tpcNSigmaPi(), track.tofNSigmaPi()), std::hypot(track.tpcNSigmaKa(), track.tofNSigmaKa()), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())}; + int pid = -1; + float nsigma = 3.0; + + // Choose which nSigma to use + std::array nSigmaToUse = (track.pt() > 0.4 && track.hasTOF()) ? nSigmaCombined : nSigmaTPC; + + // Select particle with the lowest nsigma + for (int i = 0; i < 3; ++i) { + if (std::abs(nSigmaToUse[i]) < nsigma) { + pid = i; + nsigma = std::abs(nSigmaToUse[i]); + } + } + return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton + } + + /*template + std::pair getBayesID(TTrack track) + { + std::array bayesprobs = {static_cast(track.bayesPi()), static_cast(track.bayesKa()), static_cast(track.bayesPr())}; + int bayesid = -1; + int prob = 0; + + for (int i = 0; i < 3; ++i) { + if (bayesprobs[i] > prob && bayesprobs[i] > 80) { + bayesid = i; + prob = bayesprobs[i]; + } + } + return std::make_pair(bayesid, prob); + } + + template + int getBayesPIDIndex(TTrack track) + { + int maxProb[3] = {80, 80, 80}; + int pidID = -1; + std::pair idprob = getBayesID(track); + if (idprob.first == PIONS || idprob.first == KAONS || idprob.first == PROTONS) { // 0 = pion, 1 = kaon, 2 = proton + pidID = idprob.first; + float nsigmaTPC[3] = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + if (idprob.second > maxProb[pidID]) { + if (std::fabs(nsigmaTPC[pidID]) > 3) + return 0; + return pidID + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton + } else { + return 0; + } + } + return 0; + }*/ + + template + void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (std::fabs(val) < 1) + histos.fill(tarName, cent, val, dnx); + return; + } + for (int i = 1; i <= fPtAxis->GetNbins(); i++) { + dnx = fGFW->Calculate(corrconf, i - 1, kTRUE).real(); + if (dnx == 0) + continue; + val = fGFW->Calculate(corrconf, i - 1, kFALSE).real() / dnx; + if (std::fabs(val) < 1) + histos.fill(tarName, fPtAxis->GetBinCenter(i), val, dnx); + } + return; + } + + void fillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) { + return; + } + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (std::fabs(val) < 1) { + fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm); + } + return; + } + for (int i = 1; i <= fPtAxis->GetNbins(); i++) { + dnx = fGFW->Calculate(corrconf, i - 1, kTRUE).real(); + if (dnx == 0) + continue; + val = fGFW->Calculate(corrconf, i - 1, kFALSE).real() / dnx; + if (std::fabs(val) < 1) + fFC->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm); + } + return; + } + + void process(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks) + { + int nTot = tracks.size(); + if (nTot < 1) + return; + if (!collision.sel8()) + return; + float lRandom = fRndm->Rndm(); + + float vtxz = collision.posZ(); + histos.fill(HIST("hVtxZ"), vtxz); + histos.fill(HIST("hMult"), nTot); + histos.fill(HIST("hCent"), collision.centFT0C()); + fGFW->Clear(); + const auto cent = collision.centFT0C(); + float weff = 1, wacc = 1; + int pidIndex; + for (auto const& track : tracks) { + double pt = track.pt(); + histos.fill(HIST("hPhi"), track.phi()); + histos.fill(HIST("hEta"), track.eta()); + histos.fill(HIST("hPt"), pt); + + histos.fill(HIST("TofTpcNsigma"), PIONS, track.tpcNSigmaPi(), track.tofNSigmaPi(), pt); + histos.fill(HIST("TofTpcNsigma"), KAONS, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt); + histos.fill(HIST("TofTpcNsigma"), PROTONS, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt); + + bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range + bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range + + // pidIndex = getBayesPIDIndex(track); + pidIndex = getNsigmaPID(track); + if (withinPtRef) + fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1); + if (withinPtPOI) + fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 128); + if (withinPtPOI && withinPtRef) + fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 256); + fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 512); + + if (pidIndex) { + histos.fill(HIST("partCount"), pidIndex - 1, cent, pt); + if (withinPtPOI) + fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1 << (pidIndex)); + if (withinPtPOI && withinPtRef) + fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1 << (pidIndex + 3)); + } + } + + // Filling c22 with ROOT TProfile + fillProfile(corrconfigs.at(0), HIST("c22_gap08"), cent); + fillProfile(corrconfigs.at(1), HIST("c22_gap08_pi"), cent); + fillProfile(corrconfigs.at(2), HIST("c22_gap08_ka"), cent); + fillProfile(corrconfigs.at(3), HIST("c22_gap08_pr"), cent); + fillProfile(corrconfigs.at(4), HIST("c24_full"), cent); + + for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { + fillFC(corrconfigs.at(l_ind), cent, lRandom); + } + + } // end of process +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/Flow/Tasks/flowPtEfficiency.cxx b/PWGCF/Flow/Tasks/flowPtEfficiency.cxx index 43a6eff399d..874f0c3d2df 100644 --- a/PWGCF/Flow/Tasks/flowPtEfficiency.cxx +++ b/PWGCF/Flow/Tasks/flowPtEfficiency.cxx @@ -14,11 +14,15 @@ /// \author everyone #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" #include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" using namespace o2; using namespace o2::framework; @@ -32,18 +36,38 @@ struct flowPtEfficiency { O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "Minimal pT for tracks") O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 3.0f, "Maximal pT for tracks") O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") + O2_DEFINE_CONFIGURABLE(cfgTrkSelRun3ITSMatch, bool, false, "GlobalTrackRun3ITSMatching::Run3ITSall7Layers selection") + O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5f, "max chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 70.0f, "minimum TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCcrossedrows, float, 70.0f, "minimum TPC crossed rows") O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 0.2f, "DCAxy cut for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "DCAz cut for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutDCAxyppPass3Enabled, bool, false, "switch of ppPass3 DCAxy pt dependent cut") + O2_DEFINE_CONFIGURABLE(cfgCutDCAzPtDepEnabled, bool, false, "switch of DCAz pt dependent cut") + O2_DEFINE_CONFIGURABLE(cfgSelRunNumberEnabled, bool, false, "switch of run number selection") + Configurable> cfgRunNumberList{"cfgRunNumberList", std::vector{-1}, "runnumber list in consideration for analysis"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.30, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00}, "pt axis for histograms"}; // Filter the tracks - Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (nabs(aod::track::dcaXY) < cfgCutDCAxy); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); using myTracks = soa::Filtered>; + // Filter for collisions + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + using myCollisions = soa::Filtered>; + // Filter for MCParticle Filter particleFilter = (nabs(aod::mcparticle::eta) < cfgCutEta) && (aod::mcparticle::pt > cfgCutPtMin) && (aod::mcparticle::pt < cfgCutPtMax); using myMcParticles = soa::Filtered; + // Filter for MCcollisions + Filter mccollisionFilter = nabs(aod::mccollision::posZ) < cfgCutVertex; + using myMcCollisions = soa::Filtered; + + // Additional filters for tracks + TrackSelection myTrackSel; + // Define the output HistogramRegistry registry{"registry"}; @@ -71,13 +95,46 @@ struct flowPtEfficiency { registry.add("mcEventCounter", "Monte Carlo Truth EventCounter", kTH1F, {axisCounter}); registry.add("hPtMCGen", "Monte Carlo Truth", {HistType::kTH1D, {axisPt}}); + + if (cfgTrkSelRun3ITSMatch) { + myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + } else { + myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + } + if (cfgCutDCAxyppPass3Enabled) { + myTrackSel.SetMaxDcaXYPtDep([](float pt) { return 0.004f + 0.013f / pt; }); + } else { + myTrackSel.SetMaxDcaXY(cfgCutDCAxy); + } + myTrackSel.SetMinNClustersTPC(cfgCutTPCclu); + myTrackSel.SetMinNCrossedRowsTPC(cfgCutTPCcrossedrows); + if (!cfgCutDCAzPtDepEnabled) + myTrackSel.SetMaxDcaZ(cfgCutDCAz); } - void processReco(o2::aod::Collision const&, myTracks const& tracks, aod::McParticles const&) + template + bool trackSelected(TTrack track) + { + if (cfgCutDCAzPtDepEnabled && (track.dcaZ() > (0.004f + 0.013f / track.pt()))) + return false; + return myTrackSel.IsSelected(track); + } + + void processReco(myCollisions::iterator const& collision, aod::BCsWithTimestamps const&, myTracks const& tracks, aod::McParticles const&) { registry.fill(HIST("eventCounter"), 0.5); + if (!collision.sel8()) + return; + if (tracks.size() < 1) + return; + if (cfgSelRunNumberEnabled) { + auto bc = collision.bc_as(); + int RunNumber = bc.runNumber(); + if (!std::count(cfgRunNumberList.value.begin(), cfgRunNumberList.value.end(), RunNumber)) + return; + } for (const auto& track : tracks) { - if (track.tpcNClsCrossedRows() < 70) + if (!trackSelected(track)) continue; if (track.has_mcParticle()) { auto mcParticle = track.mcParticle(); @@ -89,8 +146,14 @@ struct flowPtEfficiency { } PROCESS_SWITCH(flowPtEfficiency, processReco, "process reconstructed information", true); - void processSim(aod::McCollision const&, soa::SmallGroups> const& collisions, myMcParticles const& mcParticles) + void processSim(myMcCollisions::iterator const& collision, aod::BCsWithTimestamps const&, soa::SmallGroups> const& collisions, myMcParticles const& mcParticles) { + if (cfgSelRunNumberEnabled) { + auto bc = collision.bc_as(); + int RunNumber = bc.runNumber(); + if (!std::count(cfgRunNumberList.value.begin(), cfgRunNumberList.value.end(), RunNumber)) + return; + } if (collisions.size() > -1) { registry.fill(HIST("mcEventCounter"), 0.5); for (const auto& mcParticle : mcParticles) { diff --git a/PWGCF/Flow/Tasks/flowSP.cxx b/PWGCF/Flow/Tasks/flowSP.cxx new file mode 100644 index 00000000000..e64492dfa06 --- /dev/null +++ b/PWGCF/Flow/Tasks/flowSP.cxx @@ -0,0 +1,423 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file flowSP.cxx +/// \author Noor Koster +/// \since 01/12/2024 +/// \brief task to evaluate flow with respect to spectator plane. + +#include +#include +#include +#include +#include +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/HistogramRegistry.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/Core/RecoDecay.h" + +#include "PWGCF/DataModel/SPTableZDC.h" +#include "TF1.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +// using namespace o2::analysis; + +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +struct FlowSP { + + O2_DEFINE_CONFIGURABLE(cfgDCAxy, float, 0.2, "Cut on DCA in the transverse direction (cm)"); + O2_DEFINE_CONFIGURABLE(cfgDCAz, float, 2, "Cut on DCA in the longitudinal direction (cm)"); + O2_DEFINE_CONFIGURABLE(cfgNcls, float, 70, "Cut on number of TPC clusters found"); + O2_DEFINE_CONFIGURABLE(cfgPtmin, float, 0.2, "minimum pt (GeV/c)"); + O2_DEFINE_CONFIGURABLE(cfgPtmax, float, 10, "maximum pt (GeV/c)"); + O2_DEFINE_CONFIGURABLE(cfgEta, float, 0.8, "eta cut"); + O2_DEFINE_CONFIGURABLE(cfgVtxZ, float, 10, "vertex cut (cm)"); + O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field; default CCDB will be queried"); + O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, true, "Bool to enable Additional Event Cut"); + O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, true, "Bool to enable Additional Track Cut"); + O2_DEFINE_CONFIGURABLE(cfgCentMax, float, 60, "Maximum cenrality for selected events"); + O2_DEFINE_CONFIGURABLE(cfgCentMin, float, 10, "Minimum cenrality for selected events"); + + O2_DEFINE_CONFIGURABLE(cfgDoubleTrackFunction, bool, true, "Include track cut at low pt"); + O2_DEFINE_CONFIGURABLE(cfgTrackCutSize, float, 0.06, "Spread of track cut"); + O2_DEFINE_CONFIGURABLE(cfgMaxOccupancy, int, 500, "Maximum occupancy of selected events"); + O2_DEFINE_CONFIGURABLE(cfgNoSameBunchPileupCut, bool, true, "kNoSameBunchPileupCut"); + O2_DEFINE_CONFIGURABLE(cfgIsGoodZvtxFT0vsPV, bool, true, "kIsGoodZvtxFT0vsPV"); + O2_DEFINE_CONFIGURABLE(cfgNoCollInTimeRangeStandard, bool, true, "kNoCollInTimeRangeStandard"); + O2_DEFINE_CONFIGURABLE(cfgDoOccupancySel, bool, true, "Bool for event selection on detector occupancy"); + O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, true, "Use additional evenr cut on mult correlations"); + O2_DEFINE_CONFIGURABLE(cfgTVXinTRD, bool, true, "Use kTVXinTRD (reject TRD triggered events)"); + O2_DEFINE_CONFIGURABLE(cfgIsVertexITSTPC, bool, true, "Selects collisions with at least one ITS-TPC track"); + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; + Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && nabs(aod::track::dcaXY) < cfgDCAxy&& nabs(aod::track::dcaZ) < cfgDCAz; + using UsedCollisions = soa::Filtered>; + using UsedTracks = soa::Filtered>; + + // Connect to ccdb + Service ccdb; + + HistogramRegistry registry{"registry"}; + + // Event selection cuts - Alex + TF1* fPhiCutLow = nullptr; + TF1* fPhiCutHigh = nullptr; + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fMultMultPVCut = nullptr; + + void init(InitContext const&) + { + std::vector ptbinning = {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}; + + AxisSpec phiModAxis = {100, 0, constants::math::PI / 9, "fmod(#varphi,#pi/9)"}; + AxisSpec ptAxis = {ptbinning, "#it{p}_{T} GeV/#it{c}"}; + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + + registry.add("hSPplaneA", "hSPplaneA", kTH1D, {{100, -3, 3}}); + registry.add("hSPplaneC", "hSPplaneC", kTH1D, {{100, -3, 3}}); + registry.add("hSPplaneA-C", "hSPplaneA-C", kTH1D, {{100, -3, 3}}); + registry.add("hCent", "hCent", kTH1D, {{80, 0, 80}}); + + registry.add("hqIm", "hqIm", kTH1D, {{100, -2, 2}}); + registry.add("hqRe", "hqRe", kTH1D, {{100, -2, 2}}); + + registry.add("hCosdPhi", "hCosdPhi; Centrality(%); #LT Cos( #Psi^{A}-#Psi^{C})#GT", kTProfile, {{80, 0, 80}}); + registry.add("hSindPhi", "hSindPhi; Centrality(%); #LT Sin( #Psi^{A}-#Psi^{C})#GT", kTProfile, {{80, 0, 80}}); + registry.add("hSPlaneRes", "hSPlaneRes; Centrality(%); ", kTProfile, {{80, 0, 80}}); + + registry.add("pt_phi_bef", "", {HistType::kTH2D, {ptAxis, phiModAxis}}); + registry.add("pt_phi_aft", "", {HistType::kTH2D, {ptAxis, phiModAxis}}); + + registry.add("v1_eta", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1A_eta", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1C_eta", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1AC_eta", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + + registry.add("v1_eta_odd", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1_eta_even", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + + registry.add("v1_eta_odd_dev", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1_eta_even_dev", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + + registry.add("v1_eta_odd_dev_pos", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1_eta_even_dev_pos", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1_eta_odd_pos", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1_eta_even_pos", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + + registry.add("v1_eta_odd_dev_neg", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1_eta_even_dev_neg", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1_eta_odd_neg", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + registry.add("v1_eta_even_neg", "", kTProfile2D, {{10, -.8, .8}, ptAxis}); + + registry.add("v2_cent", "", kTProfile2D, {{80, 0, 80}, ptAxis}); + registry.add("v2A_cent", "", kTProfile2D, {{80, 0, 80}, ptAxis}); + registry.add("v2C_cent", "", kTProfile2D, {{80, 0, 80}, ptAxis}); + registry.add("v2AC_cent", "", kTProfile2D, {{80, 0, 80}, ptAxis}); + + registry.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{11, 0, 11}}}); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "sel8"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "occupancy"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "kTVXinTRD"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(5, "kNoSameBunchPileup"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(6, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(7, "kNoCollInTimeRangeStandard"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(8, "kIsVertexITSTPC"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(9, "after Mult cuts"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(10, "after Cent cuts"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(11, "isSelected"); + + if (cfgUseAdditionalEventCut) { + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); + + fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + } + + if (cfgUseAdditionalTrackCut) { + fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); + fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); + } + } + + int getMagneticField(uint64_t timestamp) + { + // TODO done only once (and not per run). Will be replaced by CCDBConfigurable + // static o2::parameters::GRPObject* grpo = nullptr; + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + // grpo = ccdb->getForTimeStamp("GLO/GRP/GRP", timestamp); + grpo = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } + + template + bool eventSelected(TCollision collision, const int& multTrk, const float& centrality) + { + if (cfgTVXinTRD) { + if (collision.alias_bit(kTVXinTRD)) { + // TRD triggered + // "CMTVX-B-NOPF-TRD,minbias_TVX" + return 0; + } + registry.fill(HIST("hEventCount"), 3.5); + } + + if (cfgNoSameBunchPileupCut) { + if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return 0; + } + registry.fill(HIST("hEventCount"), 4.5); + } + if (cfgIsGoodZvtxFT0vsPV) { + if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return 0; + } + registry.fill(HIST("hEventCount"), 5.5); + } + if (cfgNoCollInTimeRangeStandard) { + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + // Rejection of the collisions which have other events nearby + return 0; + } + registry.fill(HIST("hEventCount"), 6.5); + } + + if (cfgIsVertexITSTPC) { + if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + // selects collisions with at least one ITS-TPC track, and thus rejects vertices built from ITS-only tracks + return 0; + } + registry.fill(HIST("hEventCount"), 7.5); + } + + float vtxz = -999; + if (collision.numContrib() > 1) { + vtxz = collision.posZ(); + float zRes = std::sqrt(collision.covZZ()); + if (zRes > 0.25 && collision.numContrib() < 20) + vtxz = -999; + } + // auto multV0A = collision.multFV0A(); + // auto multT0A = collision.multFT0A(); + // auto multT0C = collision.multFT0C(); + auto multNTracksPV = collision.multNTracksPV(); + + if (vtxz > 10 || vtxz < -10) + return 0; + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + return 0; + if (multTrk < fMultCutLow->Eval(centrality)) + return 0; + if (multTrk > fMultCutHigh->Eval(centrality)) + return 0; + + registry.fill(HIST("hEventCount"), 8.5); + + if (centrality > cfgCentMax || centrality < cfgCentMin) + return 0; + + registry.fill(HIST("hEventCount"), 9.5); + + return 1; + } + + template + bool trackSelected(TTrack track, const int& field) + { + double phimodn = track.phi(); + if (field < 0) // for negative polarity field + phimodn = o2::constants::math::TwoPI - phimodn; + if (track.sign() < 0) // for negative charge + phimodn = o2::constants::math::TwoPI - phimodn; + if (phimodn < 0) + LOGF(warning, "phi < 0: %g", phimodn); + + phimodn += o2::constants::math::PI / 18.0; // to center gap in the middle + phimodn = fmod(phimodn, o2::constants::math::PI / 9.0); + registry.fill(HIST("pt_phi_bef"), track.pt(), phimodn); + if (phimodn < fPhiCutHigh->Eval(track.pt()) && phimodn > fPhiCutLow->Eval(track.pt())) + return false; // reject track + registry.fill(HIST("pt_phi_aft"), track.pt(), phimodn); + return true; + } + + void process(UsedCollisions::iterator const& collision, aod::BCsWithTimestamps const&, UsedTracks const& tracks) + { + // Hier sum over collisions and get ZDC data. + registry.fill(HIST("hEventCount"), .5); + + if (!collision.sel8()) + return; + registry.fill(HIST("hEventCount"), 1.5); + + auto bc = collision.bc_as(); + auto field = (cfgMagField == 99999) ? getMagneticField(bc.timestamp()) : cfgMagField; + + auto centrality = collision.centFT0C(); + // auto bc = collision.template bc_as(); + if (!eventSelected(collision, tracks.size(), centrality)) + return; + + if (collision.isSelected()) { + registry.fill(HIST("hEventCount"), 10.5); + + registry.fill(HIST("hCent"), centrality); + + double qxA = collision.qxA(); + double qyA = collision.qyA(); + double qxC = collision.qxC(); + double qyC = collision.qyC(); + + double psiA = 1.0 * std::atan2(qyA, qxA); + registry.fill(HIST("hSPplaneA"), psiA, 1); + + double psiC = 1.0 * std::atan2(qyC, qxC); + registry.fill(HIST("hSPplaneC"), psiC, 1); + + registry.fill(HIST("hSPplaneA-C"), psiA - psiC, 1); + + registry.fill(HIST("hCosdPhi"), centrality, std::cos(psiA - psiC)); + if (std::cos(psiA - psiC) < 0) + registry.fill(HIST("hSPlaneRes"), centrality, std::sqrt(-1. * std::cos(psiA - psiC))); + + registry.fill(HIST("hSindPhi"), centrality, std::sin(psiA - psiC)); + + auto qxAqxC = qxA * qxC; + auto qyAqyC = qyA * qyC; + + for (const auto& track : tracks) { + if (!trackSelected(track, field)) + continue; + + bool pos; + if (track.sign() == 0.0) + continue; + if (track.sign() > 0) { + pos = true; + } else { + pos = false; + } + + // constrain angle to 0 -> [0,0+2pi] + auto phi = RecoDecay::constrainAngle(track.phi(), 0); + + auto ux = std::cos(phi); + auto uy = std::sin(phi); + + // auto uxQxA = ux * qxA; + // auto uyQyA = uy * qyA; + // auto uxyQxyA = uxQxA + uyQyA; + // auto uxQxC = ux * qxC; + // auto uyQyC = uy * qyC; + // auto uxyQxyC = uxQxC + uyQyC; + + auto oddv1 = ux * (qxA - qxC) + uy * (qyA - qyC); + auto evenv1 = ux * (qxA + qxC) + uy * (qyA + qyC); + + auto oddv1Dev = ux * (qxA - qxC) / std::sqrt(std::abs(qxAqxC)) + uy * (qyA - qyC) / std::sqrt(std::abs(qyAqyC)); + auto evenv1Dev = ux * (qxA + qxC) / std::sqrt(std::abs(qxAqxC)) + uy * (qyA + qyC) / std::sqrt(std::abs(qyAqyC)); + + double v1A = std::cos(phi - psiA); + double v1C = std::cos(phi - psiC); + + double v1AC = std::cos(phi - (psiA - psiC)); + + registry.fill(HIST("v1_eta"), track.eta(), track.pt(), (1. / std::sqrt(2)) * (v1A - v1C)); + registry.fill(HIST("v1A_eta"), track.eta(), track.pt(), (v1A)); + registry.fill(HIST("v1C_eta"), track.eta(), track.pt(), (v1C)); + registry.fill(HIST("v1AC_eta"), track.eta(), track.pt(), (v1AC)); + + registry.fill(HIST("v1_eta_odd"), track.eta(), track.pt(), oddv1); + registry.fill(HIST("v1_eta_even"), track.eta(), track.pt(), evenv1); + + registry.fill(HIST("v1_eta_odd_dev"), track.eta(), track.pt(), oddv1Dev); + registry.fill(HIST("v1_eta_even_dev"), track.eta(), track.pt(), evenv1Dev); + + if (pos) { + registry.fill(HIST("v1_eta_odd_pos"), track.eta(), track.pt(), oddv1); + registry.fill(HIST("v1_eta_even_pos"), track.eta(), track.pt(), evenv1); + + registry.fill(HIST("v1_eta_odd_dev_pos"), track.eta(), track.pt(), oddv1Dev); + registry.fill(HIST("v1_eta_even_dev_pos"), track.eta(), track.pt(), evenv1Dev); + } else { + registry.fill(HIST("v1_eta_odd_neg"), track.eta(), track.pt(), oddv1); + registry.fill(HIST("v1_eta_even_neg"), track.eta(), track.pt(), evenv1); + + registry.fill(HIST("v1_eta_odd_dev_neg"), track.eta(), track.pt(), oddv1Dev); + registry.fill(HIST("v1_eta_even_dev_neg"), track.eta(), track.pt(), evenv1Dev); + } + + double v2A = std::cos(2 * (phi - psiA)); + double v2C = std::cos(2 * (phi - psiC)); + double v2AC = std::cos(2 * (phi - (psiA - psiC))); + + registry.fill(HIST("v2_cent"), centrality, track.pt(), (1. / std::sqrt(2)) * (v2A - v2C)); + registry.fill(HIST("v2A_cent"), centrality, track.pt(), (v2A)); + registry.fill(HIST("v2C_cent"), centrality, track.pt(), (v2C)); + registry.fill(HIST("v2AC_cent"), centrality, track.pt(), (v2AC)); + } + + float qIm = collision.qvecIm()[0]; + float qRe = collision.qvecRe()[0]; + + registry.fill(HIST("hqIm"), qIm); + registry.fill(HIST("hqRe"), qRe); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/PWGCF/Flow/Tasks/pidcme.cxx b/PWGCF/Flow/Tasks/pidcme.cxx new file mode 100644 index 00000000000..882e97aabec --- /dev/null +++ b/PWGCF/Flow/Tasks/pidcme.cxx @@ -0,0 +1,627 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// C++/ROOT includes. +#include +#include +#include +#include +#include +#include +#include +#include + +// o2Physics includes. +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StaticFor.h" + +#include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +#include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/PIDResponse.h" + +#include "CommonConstants/PhysicsConstants.h" + +// o2 includes. + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace CMETrackPIDcolums +{ +DECLARE_SOA_COLUMN(NPIDFlag, Npid, int8_t); // Flag tracks without proper binning as -1, and indicate type of particle 0->un-Id, 1->pion, 2->kaon, 3->proton +} // namespace CMETrackPIDcolums +DECLARE_SOA_TABLE(Flags, "AOD", "Flags", CMETrackPIDcolums::NPIDFlag); +} // namespace o2::aod + +using TracksPID = soa::Join; +struct FillPIDcolums { + Configurable cfgnSigmaCutTPCPi{"cfgnSigmaCutTPCPi", 3.0, "Value of the TPC Nsigma cut for pions"}; + Configurable cfgnSigmaCutTPCKa{"cfgnSigmaCutTPCKa", 3.0, "Value of the TPC Nsigma cut for kaons"}; + Configurable cfgnSigmaCutTPCPr{"cfgnSigmaCutTPCPr", 3.0, "Value of the TPC Nsigma cut for protons"}; + Configurable cfgnSigmaCutTOFPi{"cfgnSigmaCutTOFPi", 3.0, "Value of the TOF Nsigma cut for pions"}; + Configurable cfgnSigmaCutTOFKa{"cfgnSigmaCutTOFKa", 3.0, "Value of the TOF Nsigma cut for kaons"}; + Configurable cfgnSigmaCutTOFPr{"cfgnSigmaCutTOFPr", 3.0, "Value of the TOF Nsigma cut for protons"}; + Configurable cfgnSigmaCutCombine{"cfgnSigmaCutCombine", 3.0, "Value of the Combined Nsigma cut"}; + Configurable cfgPtMaxforTPCOnlyPID{"cfgPtMaxforTPCOnlyPID", 0.4, "Maxmium track pt for TPC only PID,only when onlyTOF and onlyTOFHIT closed"}; + Configurable cfgMinPtPID{"cfgMinPtPID", 0.15, "Minimum track #P_{t} for PID"}; + Configurable cfgMaxEtaPID{"cfgMaxEtaPID", 0.8, "Maximum track #eta for PID"}; + + ConfigurableAxis cfgrigidityBins{"cfgrigidityBins", {200, -10.f, 10.f}, "Binning for rigidity #it{p}^{TPC}/#it{z}"}; + ConfigurableAxis cfgdedxBins{"cfgdedxBins", {1000, 0.f, 1000.f}, "Binning for dE/dx"}; + ConfigurableAxis cfgnSigmaBins{"cfgnSigmaBins", {200, -5.f, 5.f}, "Binning for n sigma"}; + ConfigurableAxis cfgaxisptPID{"cfgaxisptPID", {24, 0, 12}, ""}; + + Configurable onlyTOF{"onlyTOF", false, "only TOF tracks"}; + Configurable onlyTOFHIT{"onlyTOFHIT", false, "accept only TOF hit tracks at high pt"}; + bool onlyTPC = true; + + template + bool SelTrack_PID(const TrackType track) + { + if (!(track.pt() > cfgMinPtPID)) + return false; + if (!(std::abs(track.eta()) < cfgMaxEtaPID)) + return false; + if (!track.passedITSNCls()) + return false; + if (!track.passedITSChi2NDF()) + return false; + if (!track.passedITSHits()) + return false; + if (!track.passedTPCCrossedRowsOverNCls()) + return false; + if (!track.passedTPCChi2NDF()) + return false; + if (!track.passedDCAxy()) + return false; + if (!track.passedDCAz()) + return false; + return true; + } + + template + bool selectionPID(const T& candidate, int8_t PID) + { + if (candidate.pt() > cfgPtMaxforTPCOnlyPID) { + onlyTPC = false; + } + + if (PID == 0) { + if (onlyTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < cfgnSigmaCutTOFPi) { + return true; + } + } else if (onlyTOFHIT) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < cfgnSigmaCutTOFPi) { + return true; + } + if (!candidate.hasTOF() && + std::abs(candidate.tpcNSigmaPi()) < cfgnSigmaCutTPCPi) { + return true; + } + } else if (onlyTPC) { + if (std::abs(candidate.tpcNSigmaPi()) < cfgnSigmaCutTPCPi) { + return true; + } + } else { + if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (cfgnSigmaCutCombine * cfgnSigmaCutCombine)) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < cfgnSigmaCutTPCPi) { + return true; + } + } + } else if (PID == 1) { + if (onlyTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < cfgnSigmaCutTOFKa) { + return true; + } + } else if (onlyTOFHIT) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < cfgnSigmaCutTOFKa) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < cfgnSigmaCutTPCPi) { + return true; + } + } else if (onlyTPC) { + if (std::abs(candidate.tpcNSigmaKa()) < cfgnSigmaCutTPCPi) { + return true; + } + } else { + if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (cfgnSigmaCutCombine * cfgnSigmaCutCombine)) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < cfgnSigmaCutTPCPi) { + return true; + } + } + } else if (PID == 2) { + if (onlyTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < cfgnSigmaCutTOFPr) { + return true; + } + } else if (onlyTOFHIT) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < cfgnSigmaCutTOFPr) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < cfgnSigmaCutTPCPr) { + return true; + } + } else if (onlyTPC) { + if (std::abs(candidate.tpcNSigmaPr()) < cfgnSigmaCutTPCPr) { + return true; + } + } else { + if (candidate.hasTOF() && (candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < (cfgnSigmaCutCombine * cfgnSigmaCutCombine)) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < cfgnSigmaCutTPCPr) { + return true; + } + } + } + return false; + } + + HistogramRegistry histosQA{"histosQAPID", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext const&) + { + AxisSpec axisRigidity{cfgrigidityBins, "#it{p}^{TPC}/#it{z}"}; + AxisSpec axisdEdx{cfgdedxBins, "d#it{E}/d#it{x}"}; + AxisSpec axisnSigma{cfgnSigmaBins, "n_{#sigma}TPC"}; + AxisSpec axisPtPID{cfgaxisptPID, "#it{p}_{T}"}; + + histosQA.add(Form("QA/PID/histdEdxTPC_All"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); + histosQA.add(Form("QA/PID/histdEdxTPC_Pi"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); + histosQA.add(Form("QA/PID/histnSigma_Pi"), "", {HistType::kTH1F, {axisnSigma}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_Pi"), "", {HistType::kTH2F, {axisPtPID, axisnSigma}}); + histosQA.add(Form("QA/PID/histdEdxTPC_Ka"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); + histosQA.add(Form("QA/PID/histnSigma_Ka"), "", {HistType::kTH1F, {axisnSigma}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_Ka"), "", {HistType::kTH2F, {axisPtPID, axisnSigma}}); + histosQA.add(Form("QA/PID/histdEdxTPC_Pr"), "", {HistType::kTH2F, {axisRigidity, axisdEdx}}); + histosQA.add(Form("QA/PID/histnSigma_Pr"), "", {HistType::kTH1F, {axisnSigma}}); + histosQA.add(Form("QA/PID/histnSigma_Pt_Pr"), "", {HistType::kTH2F, {axisPtPID, axisnSigma}}); + } + Produces PIDCMEtable; + void process(TracksPID const& tracks) + { + int8_t PID_flag; + for (auto& track : tracks) { + if (!SelTrack_PID(track)) { + PID_flag = -1; + } else { + histosQA.fill(HIST("QA/PID/histdEdxTPC_All"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); + float nsigma_array[3] = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + PID_flag = 0; + for (int8_t i = 0; i < 3; i++) { + if (selectionPID(track, i)) + PID_flag = PID_flag * 10 + i + 1; + if (PID_flag > 10) { // If a track is identified as two different tracks. + if (fabs(nsigma_array[(PID_flag / 10) - 1]) < fabs(nsigma_array[(PID_flag % 10) - 1])) // The track is identified as the particle whose |nsigma| is the least. + PID_flag /= 10; + else + PID_flag %= 10; + } + } + + switch (PID_flag) { + case 1: + histosQA.fill(HIST("QA/PID/histdEdxTPC_Pi"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); + histosQA.fill(HIST("QA/PID/histnSigma_Pi"), track.tpcNSigmaPi()); + histosQA.fill(HIST("QA/PID/histnSigma_Pt_Pi"), track.pt(), track.tpcNSigmaPi()); + break; + case 2: + histosQA.fill(HIST("QA/PID/histdEdxTPC_Ka"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); + histosQA.fill(HIST("QA/PID/histnSigma_Ka"), track.tpcNSigmaKa()); + histosQA.fill(HIST("QA/PID/histnSigma_Pt_Ka"), track.pt(), track.tpcNSigmaKa()); + break; + case 3: + histosQA.fill(HIST("QA/PID/histdEdxTPC_Pr"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); + histosQA.fill(HIST("QA/PID/histnSigma_Pr"), track.tpcNSigmaPr()); + histosQA.fill(HIST("QA/PID/histnSigma_Pt_Pr"), track.pt(), track.tpcNSigmaPr()); + break; + } + } + PIDCMEtable(PID_flag); + } + } +}; + +struct pidcme { + HistogramRegistry histosQA{"histosmain", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable> cfgnMods{"cfgnMods", {2}, "Modulation of interest"}; + Configurable cfgDetName{"cfgDetName", "FT0C", "The name of detector to be analyzed"}; + Configurable cfgRefAName{"cfgRefAName", "TPCpos", "The name of detector for reference A"}; + Configurable cfgRefBName{"cfgRefBName", "TPCneg", "The name of detector for reference B"}; + + Configurable cfgnTotalSystem{"cfgnTotalSystem", 7, "total qvector number"}; + + Configurable cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for charged track"}; + Configurable cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"}; + Configurable cfgMaxDCArToPVcut{"cfgMaxDCArToPVcut", 0.1, "Maximum transverse DCA"}; + Configurable cfgMaxDCAzToPVcut{"cfgMaxDCAzToPVcut", 1.0, "Maximum longitudinal DCA"}; + + ConfigurableAxis cfgaxisQvecF{"cfgaxisQvecF", {300, -1, 1}, ""}; + ConfigurableAxis cfgaxisQvec{"cfgaxisQvec", {100, -3, 3}, ""}; + ConfigurableAxis cfgaxisCent{"cfgaxisCent", {100, 0, 100}, ""}; + + ConfigurableAxis cfgaxiscos{"cfgaxiscos", {102, -1.02, 1.02}, ""}; + ConfigurableAxis cfgaxispt{"cfgaxispt", {100, 0, 10}, ""}; + ConfigurableAxis cfgaxisCentMerged{"cfgaxisCentMerged", {20, 0, 100}, ""}; + + ConfigurableAxis cfgaxissumpt{"cfgaxissumpt", {7, 1, 8}, "Binning for #gamma and #delta pt(particle1 + particle2)"}; + ConfigurableAxis cfgaxisdeltaeta{"cfgaxisdeltaeta", {5, 0, 1}, "Binning for #gamma and #delta |#eta(particle1 - particle2)|"}; + + Configurable OpenCME = {"cfgkOpeanCME", true, "open PID CME"}; + + EventPlaneHelper helperEP; + SliceCache cache; + + unsigned int mult1, mult2, mult3; + int DetId; + int RefAId; + int RefBId; + + template + int GetDetId(const T& name) + { + if (name.value == "BPos" || name.value == "BNeg" || name.value == "BTot") { + LOGF(warning, "Using deprecated label: %s. Please use TPCpos, TPCneg, TPCall instead.", name.value); + } + if (name.value == "FT0C") { + return 0; + } else if (name.value == "FT0A") { + return 1; + } else if (name.value == "FT0M") { + return 2; + } else if (name.value == "FV0A") { + return 3; + } else if (name.value == "TPCpos" || name.value == "BPos") { + return 4; + } else if (name.value == "TPCneg" || name.value == "BNeg") { + return 5; + } else if (name.value == "TPCall" || name.value == "BTot") { + return 6; + } else { + return 0; + } + } + + Filter col = aod::evsel::sel8 == true; + Filter collisionFilter = (nabs(aod::collision::posZ) < 10.f); + Filter ptfilter = aod::track::pt > cfgMinPt; + Filter etafilter = aod::track::eta < cfgMaxEta; + Filter properPIDfilter = aod::CMETrackPIDcolums::Npid != -1; + + Partition>> Tracks_set1 = aod::CMETrackPIDcolums::Npid == 1; + Partition>> Tracks_set2 = aod::CMETrackPIDcolums::Npid == 2; + Partition>> Tracks_set3 = aod::CMETrackPIDcolums::Npid == 3; + void init(InitContext const&) + { + + DetId = GetDetId(cfgDetName); + RefAId = GetDetId(cfgRefAName); + RefBId = GetDetId(cfgRefBName); + + if (DetId == RefAId || DetId == RefBId || RefAId == RefBId) { + LOGF(info, "Wrong detector configuration \n The FT0C will be used to get Q-Vector \n The TPCpos and TPCneg will be used as reference systems"); + DetId = 0; + RefAId = 4; + RefBId = 5; + } + + AxisSpec axisCent{cfgaxisCent, "centrality"}; + AxisSpec axisQvec{cfgaxisQvec, "Q"}; + AxisSpec axisQvecF{cfgaxisQvecF, "Q"}; + AxisSpec axisEvtPl = {100, -1.0 * constants::math::PI, constants::math::PI}; + + AxisSpec axisCos{cfgaxiscos, "angle function"}; + AxisSpec axisPt{cfgaxispt, "trasverse momentum"}; + AxisSpec axisCentMerged{cfgaxisCentMerged, "merged centrality"}; + + AxisSpec axissumpt{cfgaxissumpt, "#it{p}_{T}^{sum}}"}; + AxisSpec axisdeltaeta{cfgaxisdeltaeta, "#Delta#eta"}; + AxisSpec axisvertexz = {100, -15., 15., "vrtx_{Z} [cm]"}; + + histosQA.add(Form("QA/histEventCount"), "", {HistType::kTH1F, {{2, 0.0, 2.0}}}); + histosQA.get(HIST("QA/histEventCount"))->GetXaxis()->SetBinLabel(1, "Not selected events"); + histosQA.get(HIST("QA/histEventCount"))->GetXaxis()->SetBinLabel(2, "Selected events"); + histosQA.add(Form("QA/histVertexZRec"), "", {HistType::kTH1F, {axisvertexz}}); + histosQA.add(Form("QA/histCentrality"), "", {HistType::kTH1F, {axisCent}}); + histosQA.add(Form("QA/histQvec_CorrL0_V2"), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); + histosQA.add(Form("QA/histQvec_CorrL1_V2"), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); + histosQA.add(Form("QA/histQvec_CorrL2_V2"), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); + histosQA.add(Form("QA/histQvec_CorrL3_V2"), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); + histosQA.add(Form("QA/histEvtPl_CorrL0_V2"), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + histosQA.add(Form("QA/histEvtPl_CorrL1_V2"), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + histosQA.add(Form("QA/histEvtPl_CorrL2_V2"), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + histosQA.add(Form("QA/histEvtPl_CorrL3_V2"), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + histosQA.add(Form("QA/histQvecRes_SigRefAV2"), "", {HistType::kTH2F, {axisQvecF, axisCent}}); + histosQA.add(Form("QA/histQvecRes_SigRefBV2"), "", {HistType::kTH2F, {axisQvecF, axisCent}}); + histosQA.add(Form("QA/histQvecRes_RefARefBV2"), "", {HistType::kTH2F, {axisQvecF, axisCent}}); + + histosQA.add(Form("V2/histCosDetV2"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + histosQA.add(Form("V2/histSinDetV2"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + + histosQA.add(Form("V2/PID/histCosDetV2_Pi"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + histosQA.add(Form("V2/PID/histCosDetV2_Ka"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + histosQA.add(Form("V2/PID/histCosDetV2_Pr"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + histosQA.add(Form("V2/PID/histCosDetV2_Pi_Neg"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + histosQA.add(Form("V2/PID/histCosDetV2_Ka_Neg"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + histosQA.add(Form("V2/PID/histCosDetV2_Pr_Neg"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + + if (OpenCME) { + histosQA.add(Form("PIDCME/histgamama_PiKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_PiKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_PiPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_PiPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_KaPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histgamama_KaPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + + histosQA.add(Form("PIDCME/histdelta_PiKa_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiKa_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_PiPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_KaPr_ss"), "", {HistType::kTProfile, {axisCentMerged}}); + histosQA.add(Form("PIDCME/histdelta_KaPr_os"), "", {HistType::kTProfile, {axisCentMerged}}); + + histosQA.add(Form("PIDCME/Differential/histgamama_PiKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_PiPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_KaPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histgamama_KaPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + + histosQA.add(Form("PIDCME/Differential/histdelta_PiKa_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiKa_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_PiPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_KaPr_ss_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + histosQA.add(Form("PIDCME/Differential/histdelta_KaPr_os_Dif"), "", {HistType::kTProfile3D, {axisCentMerged, axissumpt, axisdeltaeta}}); + } + } + + template + bool SelEvent(const CollType& collision) + { + if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return 0; + } + if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return 0; + } + return 1; + } + + template + bool SelTrack(const TrackType track) + { + if (!track.passedITSNCls()) + return false; + if (!track.passedITSChi2NDF()) + return false; + if (!track.passedITSHits()) + return false; + if (!track.passedTPCCrossedRowsOverNCls()) + return false; + if (!track.passedTPCChi2NDF()) + return false; + if (!track.passedDCAxy()) + return false; + if (!track.passedDCAz()) + return false; + return true; + } + + template + void fillHistosQvec(const CollType& collision, int nmode) + { + int DetInd = DetId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + int RefAInd = RefAId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + int RefBInd = RefBId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + if (nmode == 2) { + if (collision.qvecAmp()[DetId] > 1e-8) { + histosQA.fill(HIST("QA/histQvec_CorrL0_V2"), collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], collision.centFT0C()); + histosQA.fill(HIST("QA/histQvec_CorrL1_V2"), collision.qvecRe()[DetInd + 1], collision.qvecIm()[DetInd + 1], collision.centFT0C()); + histosQA.fill(HIST("QA/histQvec_CorrL2_V2"), collision.qvecRe()[DetInd + 2], collision.qvecIm()[DetInd + 2], collision.centFT0C()); + histosQA.fill(HIST("QA/histQvec_CorrL3_V2"), collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], collision.centFT0C()); + histosQA.fill(HIST("QA/histEvtPl_CorrL0_V2"), helperEP.GetEventPlane(collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], nmode), collision.centFT0C()); + histosQA.fill(HIST("QA/histEvtPl_CorrL1_V2"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 1], collision.qvecIm()[DetInd + 1], nmode), collision.centFT0C()); + histosQA.fill(HIST("QA/histEvtPl_CorrL2_V2"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 2], collision.qvecIm()[DetInd + 2], nmode), collision.centFT0C()); + histosQA.fill(HIST("QA/histEvtPl_CorrL3_V2"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], nmode), collision.centFT0C()); + } + if (collision.qvecAmp()[DetId] > 1e-8 && collision.qvecAmp()[RefAId] > 1e-8 && collision.qvecAmp()[RefBId] > 1e-8) { + histosQA.fill(HIST("QA/histQvecRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[RefAInd + 3], collision.qvecIm()[RefAInd + 3], nmode), nmode), collision.centFT0C()); + histosQA.fill(HIST("QA/histQvecRes_SigRefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[RefBInd + 3], collision.qvecIm()[RefBInd + 3], nmode), nmode), collision.centFT0C()); + histosQA.fill(HIST("QA/histQvecRes_RefARefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[RefAInd + 3], collision.qvecIm()[RefAInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[RefBInd + 3], collision.qvecIm()[RefBInd + 3], nmode), nmode), collision.centFT0C()); + } + } + } + + template + void fillHistosFlow_gamma_delta(const CollType& collision, const TrackType& track1, const TrackType& track2, const TrackType& track3, int nmode) + { + if (collision.qvecAmp()[DetId] < 1e-8) { + return; + } + int DetInd = DetId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + float Psi_n = helperEP.GetEventPlane(collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], nmode); + for (auto& trk : track1) { + if (!SelTrack(trk)) + continue; + if (nmode == 2) { + if (trk.sign() > 0) { + histosQA.fill(HIST("V2/PID/histCosDetV2_Pi"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(nmode) * (trk.phi() - Psi_n))); + } else if (trk.sign() < 0) { + histosQA.fill(HIST("V2/PID/histCosDetV2_Pi_Neg"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(nmode) * (trk.phi() - Psi_n))); + } + } + } + for (auto& trk : track2) { + if (!SelTrack(trk)) + continue; + if (nmode == 2) { + if (trk.sign() > 0) { + histosQA.fill(HIST("V2/PID/histCosDetV2_Ka"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(nmode) * (trk.phi() - Psi_n))); + } else if (trk.sign() < 0) { + histosQA.fill(HIST("V2/PID/histCosDetV2_Ka_Neg"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(nmode) * (trk.phi() - Psi_n))); + } + } + } + for (auto& trk : track3) { + if (!SelTrack(trk)) + continue; + if (nmode == 2) { + if (trk.sign() > 0) { + histosQA.fill(HIST("V2/PID/histCosDetV2_Pr"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(nmode) * (trk.phi() - Psi_n))); + } else if (trk.sign() < 0) { + histosQA.fill(HIST("V2/PID/histCosDetV2_Pr_Neg"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(nmode) * (trk.phi() - Psi_n))); + } + } + } + if (OpenCME) { + for (auto& trk1 : track1) { + for (auto& trk2 : track2) { + if (trk1.globalIndex() == trk2.globalIndex()) + continue; + if (nmode == 2) { + if (trk1.sign() == trk2.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_PiKa_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/histdelta_PiKa_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiKa_ss_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_PiKa_os"), collision.centFT0C(), std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/histdelta_PiKa_os"), collision.centFT0C(), std::cos((trk1.phi() - trk2.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() + trk2.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiKa_os_Dif"), collision.centFT0C(), trk1.pt() + trk2.pt(), std::abs(trk1.eta() - trk2.eta()), + std::cos((trk1.phi() - trk2.phi()))); + } + } + } + } + for (auto& trk1 : track1) { + for (auto& trk3 : track3) { + if (trk1.globalIndex() == trk3.globalIndex()) + continue; + if (nmode == 2) { + if (trk1.sign() == trk3.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_PiPr_ss"), collision.centFT0C(), std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/histdelta_PiPr_ss"), collision.centFT0C(), std::cos((trk1.phi() - trk3.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), + std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPr_ss_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), + std::cos((trk1.phi() - trk3.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_PiPr_os"), collision.centFT0C(), std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/histdelta_PiPr_os"), collision.centFT0C(), std::cos((trk1.phi() - trk3.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_PiPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), + std::cos((trk1.phi() + trk3.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_PiPr_os_Dif"), collision.centFT0C(), trk1.pt() + trk3.pt(), std::abs(trk1.eta() - trk3.eta()), + std::cos((trk1.phi() - trk3.phi()))); + } + } + } + } + for (auto& trk2 : track2) { + for (auto& trk3 : track3) { + if (trk2.globalIndex() == trk3.globalIndex()) + continue; + if (nmode == 2) { + if (trk2.sign() == trk3.sign()) { + histosQA.fill(HIST("PIDCME/histgamama_KaPr_ss"), collision.centFT0C(), std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/histdelta_KaPr_ss"), collision.centFT0C(), std::cos((trk2.phi() - trk3.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_KaPr_ss_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), + std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_KaPr_ss_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), + std::cos((trk2.phi() - trk3.phi()))); + } else { + histosQA.fill(HIST("PIDCME/histgamama_KaPr_os"), collision.centFT0C(), std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/histdelta_KaPr_os"), collision.centFT0C(), std::cos((trk2.phi() - trk3.phi()))); + histosQA.fill(HIST("PIDCME/Differential/histgamama_KaPr_os_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), + std::cos((trk2.phi() + trk3.phi() - static_cast(nmode) * Psi_n))); + histosQA.fill(HIST("PIDCME/Differential/histdelta_KaPr_os_Dif"), collision.centFT0C(), trk2.pt() + trk3.pt(), std::abs(trk2.eta() - trk3.eta()), + std::cos((trk2.phi() - trk3.phi()))); + } + } + } + } + } + } + + void process(soa::Filtered>::iterator const& collision, soa::Filtered> const& tracks) + { + histosQA.fill(HIST("QA/histEventCount"), 0.5); + if (!SelEvent(collision)) { + return; + } + histosQA.fill(HIST("QA/histEventCount"), 1.5); + histosQA.fill(HIST("QA/histCentrality"), collision.centFT0C()); + histosQA.fill(HIST("QA/histVertexZRec"), collision.posZ()); + auto tracks1 = Tracks_set1->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto tracks2 = Tracks_set2->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto tracks3 = Tracks_set3->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + mult1 = tracks1.size(); + mult2 = tracks2.size(); + mult3 = tracks3.size(); + if (mult1 < 1 || mult2 < 1 || mult3 < 1) // Reject Collisions without sufficient particles + return; + for (auto i = 0; i < static_cast(cfgnMods->size()); i++) { + int DetInd_global = DetId * 4 + cfgnTotalSystem * 4 * (cfgnMods->at(i) - 2); + float Psi_n_global = helperEP.GetEventPlane(collision.qvecRe()[DetInd_global + 3], collision.qvecIm()[DetInd_global + 3], cfgnMods->at(i)); + for (auto& trk : tracks) { + if (!SelTrack(trk)) + continue; + histosQA.fill(HIST("V2/histSinDetV2"), collision.centFT0C(), trk.pt(), + std::sin(static_cast(cfgnMods->at(i)) * (trk.phi() - Psi_n_global))); + histosQA.fill(HIST("V2/histCosDetV2"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(cfgnMods->at(i)) * (trk.phi() - Psi_n_global))); + } + fillHistosQvec(collision, cfgnMods->at(i)); + fillHistosFlow_gamma_delta(collision, tracks1, tracks2, tracks3, cfgnMods->at(i)); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), + }; +} diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index cb44d59a4fa..a402ce23621 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -30,7 +30,6 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" - #include "GFWPowerArray.h" #include "GFW.h" #include "GFWCumulant.h" @@ -125,8 +124,6 @@ struct GenericFramework { bool correctionsLoaded = false; } cfg; - - // Define output OutputObj fFC{FlowContainer("FlowContainer")}; OutputObj fFCpt{FlowPtContainer("FlowPtContainer")}; @@ -214,29 +211,27 @@ struct GenericFramework { weightlist->SetOwner(true); fWeightList.setObject(weightlist); - if(!cfgRunByRunWeights && cfgFillWeights){ - if(cfgUsePID){ + if (!cfgRunByRunWeights && cfgFillWeights) { + if (cfgUsePID) { std::vector weights; - std::vector species = {"ref","ch","pi","ka","pr"}; - for(size_t i = 0; i < species.size(); ++i) { - weights.push_back(new GFWWeights(Form("w_%s",species[i].c_str()))); - if(i==0) { - auto it = std::find(ptbinning.begin(),ptbinning.end(),ptrefup); - std::vector refpt(ptbinning.begin(),it+1); - weights[i]->SetPtBins(refpt.size()-1, &refpt[0]); - } - else weights[i]->SetPtBins(fPtAxis->GetNbins(), &ptbinning[0]); + std::vector species = {"ref", "ch", "pi", "ka", "pr"}; + for (size_t i = 0; i < species.size(); ++i) { + weights.push_back(new GFWWeights(Form("w_%s", species[i].c_str()))); + if (i == 0) { + auto it = std::find(ptbinning.begin(), ptbinning.end(), ptrefup); + std::vector refpt(ptbinning.begin(), it + 1); + weights[i]->SetPtBins(refpt.size() - 1, &refpt[0]); + } else + weights[i]->SetPtBins(fPtAxis->GetNbins(), &ptbinning[0]); weights[i]->Init(true, false); fWeightList->Add(weights[i]); } - } - else { + } else { GFWWeights* weight = new GFWWeights("w_ch"); weight->SetPtBins(fPtAxis->GetNbins(), &ptbinning[0]); weight->Init(true, false); fWeightList->Add(weight); } - } if (doprocessMCGen) { @@ -249,9 +244,9 @@ struct GenericFramework { registry.add("trackQA/before/pt_dcaXY_dcaZ", "", {HistType::kTH3D, {ptAxis, dcaXYAXis, dcaZAXis}}); registry.add("trackQA/before/pt_phi", "", {HistType::kTH2D, {ptAxis, phiModAxis}}); registry.addClone("trackQA/before/", "trackQA/after/"); - registry.add("trackQA/after/pt_ref", "", {HistType::kTH1D, {{100,ptreflow,ptrefup}}}); - registry.add("trackQA/after/pt_poi", "", {HistType::kTH1D, {{100,ptpoilow,ptpoiup}}}); - registry.add("trackQA/after/runNo", "", {HistType::kTH1D, {{10,544090,544100}}}); + registry.add("trackQA/after/pt_ref", "", {HistType::kTH1D, {{100, ptreflow, ptrefup}}}); + registry.add("trackQA/after/pt_poi", "", {HistType::kTH1D, {{100, ptpoilow, ptpoiup}}}); + registry.add("trackQA/after/runNo", "", {HistType::kTH1D, {{10, 544090, 544100}}}); registry.add("eventQA/before/globalTracks_centT0C", "", {HistType::kTH2D, {centAxis, nchAxis}}); registry.add("eventQA/before/PVTracks_centT0C", "", {HistType::kTH2D, {centAxis, multpvAxis}}); @@ -260,15 +255,15 @@ struct GenericFramework { registry.add("eventQA/before/globalTracks_multV0A", "", {HistType::kTH2D, {t0aAxis, nchAxis}}); registry.add("eventQA/before/multV0A_multT0A", "", {HistType::kTH2D, {t0aAxis, t0aAxis}}); registry.add("eventQA/before/multT0C_centT0C", "", {HistType::kTH2D, {centAxis, t0cAxis}}); - registry.add("eventQA/before/runNo", "", {HistType::kTH1I, {{10,544090,544100}}}); + registry.add("eventQA/before/runNo", "", {HistType::kTH1I, {{10, 544090, 544100}}}); registry.addClone("eventQA/before/", "eventQA/after/"); - registry.add("eventQA/after/runNo2", "", {HistType::kTH1I, {{10,544090,544100}}}); - registry.add("eventQA/after/runNo3", "", {HistType::kTH1I, {{10,544090,544100}}}); - registry.add("eventQA/after/runNo4", "", {HistType::kTH1I, {{10,544090,544100}}}); - registry.add("eventQA/after/runNo5", "", {HistType::kTH1I, {{10,544090,544100}}}); - registry.add("eventQA/after/runNo6", "", {HistType::kTH1I, {{10,544090,544100}}}); - registry.add("eventQA/after/runNo7", "", {HistType::kTH1I, {{10,544090,544100}}}); - registry.add("eventQA/after/runNo8", "", {HistType::kTH1I, {{10,544090,544100}}}); + registry.add("eventQA/after/runNo2", "", {HistType::kTH1I, {{10, 544090, 544100}}}); + registry.add("eventQA/after/runNo3", "", {HistType::kTH1I, {{10, 544090, 544100}}}); + registry.add("eventQA/after/runNo4", "", {HistType::kTH1I, {{10, 544090, 544100}}}); + registry.add("eventQA/after/runNo5", "", {HistType::kTH1I, {{10, 544090, 544100}}}); + registry.add("eventQA/after/runNo6", "", {HistType::kTH1I, {{10, 544090, 544100}}}); + registry.add("eventQA/after/runNo7", "", {HistType::kTH1I, {{10, 544090, 544100}}}); + registry.add("eventQA/after/runNo8", "", {HistType::kTH1I, {{10, 544090, 544100}}}); registry.add("eventQA/eventSel", "Number of Events;; Counts", {HistType::kTH1D, {{10, 0, 10}}}); registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(1, "Filtered event"); registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(2, "sel8"); @@ -342,7 +337,7 @@ struct GenericFramework { } } - static constexpr std::string_view moment[] = { + static constexpr std::string_view moment[] = { "before/", "after/"}; @@ -387,46 +382,43 @@ struct GenericFramework { { uint64_t timestamp = bc.timestamp(); int run = bc.runNumber(); - if (cfg.correctionsLoaded){ - if(!cfgRunByRunWeights) + if (cfg.correctionsLoaded) { + if (!cfgRunByRunWeights) return; - if(run == lastRun) + if (run == lastRun) return; } - if(cfgUsePID){ + if (cfgUsePID) { if (cfgAcceptance.value.empty() == false) { - if(cfgRunByRunWeights){ //run-by-run NUA weights from ccdb, stored in TList to hold PID weights - TList* weightlist = ccdb->getForTimeStamp(cfgAcceptance, timestamp); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_ref",run)))); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_ch",run)))); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_pi",run)))); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_ka",run)))); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_pr",run)))); - } - else { //run-averaged weights, stored in TList to hold PID weights - TList* weightlist = ccdb->getForTimeStamp(cfgAcceptance, timestamp); - weightlist->ls(); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_ref"))); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_ch"))); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_pi"))); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_ka"))); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_pr"))); + if (cfgRunByRunWeights) { // run-by-run NUA weights from ccdb, stored in TList to hold PID weights + TList* weightlist = ccdb->getForTimeStamp(cfgAcceptance, timestamp); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_ref", run)))); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_ch", run)))); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_pi", run)))); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_ka", run)))); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_pr", run)))); + } else { // run-averaged weights, stored in TList to hold PID weights + TList* weightlist = ccdb->getForTimeStamp(cfgAcceptance, timestamp); + weightlist->ls(); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_ref"))); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_ch"))); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_pi"))); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_ka"))); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("weights_pr"))); } if (!cfg.mAcceptance.empty()) LOGF(info, "Loaded acceptance weights from %s", cfgAcceptance.value.c_str()); else LOGF(warning, "Could not load acceptance weights from %s", cfgAcceptance.value.c_str()); } - } - else { + } else { if (cfgAcceptance.value.empty() == false) { - if(cfgRunByRunWeights){ //run-by-run NUA weights from ccdb, stored in TList - TList* weightlist = ccdb->getForTimeStamp(cfgAcceptance, timestamp); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_ch",run)))); - } - else { //run-averaged weights, stored in TList - TList* weightlist = ccdb->getForTimeStamp(cfgAcceptance, timestamp); - cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("w_ch"))); + if (cfgRunByRunWeights) { // run-by-run NUA weights from ccdb, stored in TList + TList* weightlist = ccdb->getForTimeStamp(cfgAcceptance, timestamp); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject(Form("w%i_ch", run)))); + } else { // run-averaged weights, stored in TList + TList* weightlist = ccdb->getForTimeStamp(cfgAcceptance, timestamp); + cfg.mAcceptance.push_back(dynamic_cast(weightlist->FindObject("w_ch"))); } if (!cfg.mAcceptance.empty()) LOGF(info, "Loaded acceptance weights from %s", cfgAcceptance.value.c_str()); @@ -444,23 +436,24 @@ struct GenericFramework { cfg.correctionsLoaded = true; } - template - double getAcceptance(TTrack track, const double &vtxz, int index) { //-1 ref, 0 ch, 1 pi, 2 ka, 3 pr + template + double getAcceptance(TTrack track, const double& vtxz, int index) + { //-1 ref, 0 ch, 1 pi, 2 ka, 3 pr double wacc = 1; - index+=1; - if (!cfg.mAcceptance.empty()){ - if(cfgUsePID){ + index += 1; + if (!cfg.mAcceptance.empty()) { + if (cfgUsePID) { wacc = cfg.mAcceptance[index]->GetNUA(track.phi(), track.eta(), vtxz); - } - else { + } else { wacc = cfg.mAcceptance[0]->GetNUA(track.phi(), track.eta(), vtxz); } } return wacc; } - template - double getEfficiency(TTrack track) { //-1 ref, 0 ch, 1 pi, 2 ka, 3 pr + template + double getEfficiency(TTrack track) + { //-1 ref, 0 ch, 1 pi, 2 ka, 3 pr double eff = 1.; if (cfg.mEfficiency) eff = cfg.mEfficiency->GetBinContent(cfg.mEfficiency->FindBin(track.pt())); @@ -469,44 +462,44 @@ struct GenericFramework { else return 1. / eff; } -//Obsolete for now untill service wagons get added -/* template - int getBayesPIDIndex(TTrack track) { - float maxProb[3] = {0.95,0.85,0.85}; - int pidID = 0; - if(track.bayesID()==o2::track::PID::Pion || track.bayesID()==o2::track::PID::Kaon || track.bayesID()==o2::track::PID::Proton){ - pidID = track.bayesID()-1; //Realign - float nsigmaTPC[3] = {track.tpcNSigmaPi(),track.tpcNSigmaKa(),track.tpcNSigmaPr()}; - float nsigmaTOF[3] = {track.tofNSigmaPi(),track.tofNSigmaKa(),track.tofNSigmaPr()}; - if(track.bayesProb() > maxProb[pidID-1]) { - if(abs(nsigmaTPC[pidID-1]) > 3) return 0; - if(abs(nsigmaTOF[pidID-1]) > 3) return 0; - return pidID; + // Obsolete for now untill service wagons get added + /* template + int getBayesPIDIndex(TTrack track) { + float maxProb[3] = {0.95,0.85,0.85}; + int pidID = 0; + if(track.bayesID()==o2::track::PID::Pion || track.bayesID()==o2::track::PID::Kaon || track.bayesID()==o2::track::PID::Proton){ + pidID = track.bayesID()-1; //Realign + float nsigmaTPC[3] = {track.tpcNSigmaPi(),track.tpcNSigmaKa(),track.tpcNSigmaPr()}; + float nsigmaTOF[3] = {track.tofNSigmaPi(),track.tofNSigmaKa(),track.tofNSigmaPr()}; + if(track.bayesProb() > maxProb[pidID-1]) { + if(abs(nsigmaTPC[pidID-1]) > 3) return 0; + if(abs(nsigmaTOF[pidID-1]) > 3) return 0; + return pidID; + } + else return 0; } - else return 0; - } - return 0; - } */ + return 0; + } */ template int GetNsigmaPID(TTrack track) { - //Computing Nsigma arrays for pion, kaon, and protons + // Computing Nsigma arrays for pion, kaon, and protons std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; std::array nSigmaCombined = {std::hypot(track.tpcNSigmaPi(), track.tofNSigmaPi()), std::hypot(track.tpcNSigmaKa(), track.tofNSigmaKa()), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())}; int pid = -1; float nsigma = 3.0; - //Choose which nSigma to use + // Choose which nSigma to use std::array nSigmaToUse = (track.pt() > 0.4 && track.hasTOF()) ? nSigmaCombined : nSigmaTPC; - //Select particle with the lowest nsigma + // Select particle with the lowest nsigma for (int i = 0; i < 3; ++i) { - if (std::abs(nSigmaToUse[i]) < nsigma) { - pid = i; - nsigma = std::abs(nSigmaToUse[i]); - } + if (std::abs(nSigmaToUse[i]) < nsigma) { + pid = i; + nsigma = std::abs(nSigmaToUse[i]); } + } return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton } @@ -604,10 +597,12 @@ struct GenericFramework { phimodn += TMath::Pi() / 18.0; // to center gap in the middle phimodn = fmod(phimodn, TMath::Pi() / 9.0); - if(cfgFillQA) registry.fill(HIST("trackQA/before/pt_phi"), track.pt(), phimodn); + if (cfgFillQA) + registry.fill(HIST("trackQA/before/pt_phi"), track.pt(), phimodn); if (phimodn < fPhiCutHigh->Eval(track.pt()) && phimodn > fPhiCutLow->Eval(track.pt())) return false; // reject track - if(cfgFillQA) registry.fill(HIST("trackQA/after/pt_phi"), track.pt(), phimodn); + if (cfgFillQA) + registry.fill(HIST("trackQA/after/pt_phi"), track.pt(), phimodn); return true; } @@ -617,50 +612,53 @@ struct GenericFramework { }; template - void FillWeights(const TTrack track, const double vtxz, const double multcent, int pid_index){ - if(cfgUsePID){ - std::vector species = {"ref","ch","pi","ka","pr"}; - double ptpidmins[] = {ptpoilow,ptpoilow,0.3,0.5}; //min pt for ch, pi, ka, pr - double ptpidmaxs[] = {ptpoiup,ptpoiup,6.0,6.0}; //max pt for ch, pi, ka, pr + void FillWeights(const TTrack track, const double vtxz, const double multcent, int pid_index) + { + if (cfgUsePID) { + std::vector species = {"ref", "ch", "pi", "ka", "pr"}; + double ptpidmins[] = {ptpoilow, ptpoilow, 0.3, 0.5}; // min pt for ch, pi, ka, pr + double ptpidmaxs[] = {ptpoiup, ptpoiup, 6.0, 6.0}; // max pt for ch, pi, ka, pr bool withinPtPOI = (ptpidmins[pid_index] < track.pt()) && (track.pt() < ptpidmaxs[pid_index]); // within POI pT range - bool withinPtRef = (ptreflow < track.pt()) && (track.pt() < ptrefup); // within RF pT range - if(cfgRunByRunWeights){ - if(withinPtRef && !pid_index) dynamic_cast(fWeightList->FindObject(Form("w%i_%s",lastRun,species[pid_index].c_str())))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); //pt-subset of charged particles for ref flow - if(withinPtPOI) dynamic_cast(fWeightList->FindObject(Form("w%i_%s",lastRun,species[pid_index+1].c_str())))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); //charged and id'ed particle weights - } - else { - if(withinPtRef && !pid_index) dynamic_cast(fWeightList->FindObject(Form("w_%s",species[pid_index].c_str())))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); //pt-subset of charged particles for ref flow - if(withinPtPOI) dynamic_cast(fWeightList->FindObject(Form("w_%s",species[pid_index+1].c_str())))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); //charged and id'ed particle weights + bool withinPtRef = (ptreflow < track.pt()) && (track.pt() < ptrefup); // within RF pT range + if (cfgRunByRunWeights) { + if (withinPtRef && !pid_index) + dynamic_cast(fWeightList->FindObject(Form("w%i_%s", lastRun, species[pid_index].c_str())))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); // pt-subset of charged particles for ref flow + if (withinPtPOI) + dynamic_cast(fWeightList->FindObject(Form("w%i_%s", lastRun, species[pid_index + 1].c_str())))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); // charged and id'ed particle weights + } else { + if (withinPtRef && !pid_index) + dynamic_cast(fWeightList->FindObject(Form("w_%s", species[pid_index].c_str())))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); // pt-subset of charged particles for ref flow + if (withinPtPOI) + dynamic_cast(fWeightList->FindObject(Form("w_%s", species[pid_index + 1].c_str())))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); // charged and id'ed particle weights } - } - else { - if(cfgRunByRunWeights) - dynamic_cast(fWeightList->FindObject(Form("w%i_ch",lastRun)))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); + } else { + if (cfgRunByRunWeights) + dynamic_cast(fWeightList->FindObject(Form("w%i_ch", lastRun)))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); else dynamic_cast(fWeightList->FindObject("w_ch"))->Fill(track.phi(), track.eta(), vtxz, track.pt(), multcent, 0); } return; } - void CreateRunByRunWeights(){ - if(cfgUsePID){ + void CreateRunByRunWeights() + { + if (cfgUsePID) { std::vector weights; - std::vector species = {"ref","ch","pi","ka","pr"}; - for(size_t i = 0; i < species.size(); ++i) { - weights.push_back(new GFWWeights(Form("w%i_%s",lastRun,species[i].c_str()))); - if(i==0) { - auto it = std::find(ptbinning.begin(),ptbinning.end(),5.); - std::vector refpt(ptbinning.begin(),it+1); - weights[i]->SetPtBins(refpt.size()-1, &refpt[0]); - } - else weights[i]->SetPtBins(fPtAxis->GetNbins(), &ptbinning[0]); + std::vector species = {"ref", "ch", "pi", "ka", "pr"}; + for (size_t i = 0; i < species.size(); ++i) { + weights.push_back(new GFWWeights(Form("w%i_%s", lastRun, species[i].c_str()))); + if (i == 0) { + auto it = std::find(ptbinning.begin(), ptbinning.end(), 5.); + std::vector refpt(ptbinning.begin(), it + 1); + weights[i]->SetPtBins(refpt.size() - 1, &refpt[0]); + } else + weights[i]->SetPtBins(fPtAxis->GetNbins(), &ptbinning[0]); weights[i]->Init(true, false); fWeightList->Add(weights[i]); } - } - else { - GFWWeights* weight = new GFWWeights(Form("w%i_ch",lastRun)); + } else { + GFWWeights* weight = new GFWWeights(Form("w%i_ch", lastRun)); weight->SetPtBins(fPtAxis->GetNbins(), &ptbinning[0]); weight->Init(true, false); fWeightList->Add(weight); @@ -718,7 +716,8 @@ struct GenericFramework { for (auto& track : tracks) { ProcessTrack(track, centrality, vtxz, field); } - if(!cfgFillWeights) FillOutputContainers
((cfgUseNch) ? tracks.size() : centrality, l_Random); + if (!cfgFillWeights) + FillOutputContainers
((cfgUseNch) ? tracks.size() : centrality, l_Random); } template @@ -729,9 +728,10 @@ struct GenericFramework { return; auto mcParticle = track.mcParticle(); - if (!mcParticle.isPhysicalPrimary()) return; + if (!mcParticle.isPhysicalPrimary()) + return; if (cfgFillQA) - FillTrackQA(track, vtxz); + FillTrackQA(track, vtxz); if (mcParticle.eta() < etalow || mcParticle.eta() > etaup || mcParticle.pt() < ptlow || mcParticle.pt() > ptup || track.tpcNClsFound() < cfgNcls) return; @@ -740,46 +740,52 @@ struct GenericFramework { return; int pid_index = 0; - if(cfgUsePID){ - if(mcParticle.pdgCode() == 211) pid_index = 1; - if(mcParticle.pdgCode() == 321) pid_index = 2; - if(mcParticle.pdgCode() == 2212) pid_index = 3; + if (cfgUsePID) { + if (mcParticle.pdgCode() == 211) + pid_index = 1; + if (mcParticle.pdgCode() == 321) + pid_index = 2; + if (mcParticle.pdgCode() == 2212) + pid_index = 3; } - if (cfgFillWeights){ - FillWeights(mcParticle,vtxz,centrality,0); - } - else { + if (cfgFillWeights) { + FillWeights(mcParticle, vtxz, centrality, 0); + } else { FillPtSums(track, vtxz); FillGFW(mcParticle, vtxz, pid_index); } if (cfgFillQA) - FillTrackQA(track, vtxz); + FillTrackQA(track, vtxz); } else if constexpr (framework::has_type_v) { - if (!track.isPhysicalPrimary()) return; + if (!track.isPhysicalPrimary()) + return; if (cfgFillQA) - FillTrackQA(track, vtxz); + FillTrackQA(track, vtxz); - if(track.eta() < etalow || track.eta() > etaup || track.pt() < ptlow || track.pt() > ptup) + if (track.eta() < etalow || track.eta() > etaup || track.pt() < ptlow || track.pt() > ptup) return; int pid_index = 0; - if(cfgUsePID){ - if(track.pdgCode() == 211) pid_index = 1; - if(track.pdgCode() == 321) pid_index = 2; - if(track.pdgCode() == 2212) pid_index = 3; + if (cfgUsePID) { + if (track.pdgCode() == 211) + pid_index = 1; + if (track.pdgCode() == 321) + pid_index = 2; + if (track.pdgCode() == 2212) + pid_index = 3; } FillPtSums(track, vtxz); FillGFW(track, vtxz, pid_index); if (cfgFillQA) - FillTrackQA(track, vtxz); + FillTrackQA(track, vtxz); } else { if (cfgFillQA) - FillTrackQA(track, vtxz); + FillTrackQA(track, vtxz); if (track.tpcNClsFound() < cfgNcls) return; @@ -787,28 +793,29 @@ struct GenericFramework { return; int pid_index = 0; - if(cfgUsePID){ - //pid_index = getBayesPIDIndex(track); + if (cfgUsePID) { + // pid_index = getBayesPIDIndex(track); pid_index = GetNsigmaPID(track); } if (cfgFillWeights) { - FillWeights(track,vtxz,centrality,pid_index); - } - else { + FillWeights(track, vtxz, centrality, pid_index); + } else { FillPtSums(track, vtxz); FillGFW(track, vtxz, pid_index); } if (cfgFillQA) - FillTrackQA(track, vtxz); + FillTrackQA(track, vtxz); } } template - inline void FillPtSums(TTrack track, const double &vtxz){ - double wacc = (dt == kGen)?1.:getAcceptance(track,vtxz,-1); - double weff = (dt == kGen)?1.:getEfficiency(track); - if(weff<0) return; - if (fabs(track.eta()) < cfgEtaPtPt){ + inline void FillPtSums(TTrack track, const double& vtxz) + { + double wacc = (dt == kGen) ? 1. : getAcceptance(track, vtxz, -1); + double weff = (dt == kGen) ? 1. : getEfficiency(track); + if (weff < 0) + return; + if (fabs(track.eta()) < cfgEtaPtPt) { fFCpt->Fill(weff, track.pt()); } if (!cfgUseGapMethod) { @@ -820,34 +827,36 @@ struct GenericFramework { } template - inline void FillGFW(TTrack track, const double &vtxz, int pid_index) + inline void FillGFW(TTrack track, const double& vtxz, int pid_index) { - if(cfgUsePID){ //Analysing POI flow with id'ed particles - double ptmins[] = {ptpoilow,ptpoilow,0.3,0.5}; - double ptmaxs[] = {ptpoiup,ptpoiup,6.0,6.0}; - bool WithinPtRef= (track.pt() > ptreflow && track.pt() < ptrefup); - bool WithinPtPOI= (track.pt() > ptmins[pid_index] && track.pt() < ptmaxs[pid_index]); - bool WithinPtNch= (track.pt() > ptmins[0] && track.pt() < ptmaxs[0]); - if(!WithinPtPOI && !WithinPtRef) return; - double wacc_ref = (dt == kGen)?1.:getAcceptance(track,vtxz,-1); - double wacc_poi = (dt == kGen)?1.:WithinPtPOI?getAcceptance(track,vtxz,pid_index):getAcceptance(track,vtxz,0); // - if(WithinPtRef && WithinPtPOI && pid_index) - wacc_ref = wacc_poi; //if particle is both (then it's overlap), override ref with POI + if (cfgUsePID) { // Analysing POI flow with id'ed particles + double ptmins[] = {ptpoilow, ptpoilow, 0.3, 0.5}; + double ptmaxs[] = {ptpoiup, ptpoiup, 6.0, 6.0}; + bool WithinPtRef = (track.pt() > ptreflow && track.pt() < ptrefup); + bool WithinPtPOI = (track.pt() > ptmins[pid_index] && track.pt() < ptmaxs[pid_index]); + bool WithinPtNch = (track.pt() > ptmins[0] && track.pt() < ptmaxs[0]); + if (!WithinPtPOI && !WithinPtRef) + return; + double wacc_ref = (dt == kGen) ? 1. : getAcceptance(track, vtxz, -1); + double wacc_poi = (dt == kGen) ? 1. : WithinPtPOI ? getAcceptance(track, vtxz, pid_index) + : getAcceptance(track, vtxz, 0); // + if (WithinPtRef && WithinPtPOI && pid_index) + wacc_ref = wacc_poi; // if particle is both (then it's overlap), override ref with POI if (WithinPtRef) fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_ref, 1); if (WithinPtPOI && pid_index) - fGFW->Fill(track.eta(),fPtAxis->FindBin(track.pt()) - 1,track.phi(),wacc_poi,(1<<(pid_index+1))); + fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_poi, (1 << (pid_index + 1))); if (WithinPtNch) fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_poi, 2); if (WithinPtPOI && WithinPtRef && pid_index) - fGFW->Fill(track.eta(),fPtAxis->FindBin(track.pt()) - 1,track.phi(),wacc_poi,(1<<(pid_index+5))); + fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_poi, (1 << (pid_index + 5))); if (WithinPtNch && WithinPtRef) fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_poi, 32); - } - else { //Analysing only integrated flow - double weff = (dt == kGen)?1.:getEfficiency(track); - if(weff<0) return; - double wacc = (dt == kGen)?1.:getAcceptance(track,vtxz,-1); + } else { // Analysing only integrated flow + double weff = (dt == kGen) ? 1. : getEfficiency(track); + if (weff < 0) + return; + double wacc = (dt == kGen) ? 1. : getAcceptance(track, vtxz, -1); fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, 1); } return; @@ -860,10 +869,10 @@ struct GenericFramework { registry.fill(HIST("MCGen/") + HIST(moment[ft]) + HIST("phi_eta_vtxZ_gen"), track.phi(), track.eta(), vtxz); registry.fill(HIST("MCGen/") + HIST(moment[ft]) + HIST("pt_gen"), track.pt()); } else { - double wacc = getAcceptance(track,vtxz,-1); + double wacc = getAcceptance(track, vtxz, -1); registry.fill(HIST("trackQA/") + HIST(moment[ft]) + HIST("phi_eta_vtxZ"), track.phi(), track.eta(), vtxz, wacc); registry.fill(HIST("trackQA/") + HIST(moment[ft]) + HIST("pt_dcaXY_dcaZ"), track.pt(), track.dcaXY(), track.dcaZ()); - if(ft == kAfter){ + if (ft == kAfter) { registry.fill(HIST("trackQA/") + HIST(moment[ft]) + HIST("pt_ref"), track.pt()); registry.fill(HIST("trackQA/") + HIST(moment[ft]) + HIST("pt_poi"), track.pt()); } @@ -884,16 +893,16 @@ struct GenericFramework { } Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; - Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin && aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && nabs(aod::track::dcaXY) < cfgDCAxy && nabs(aod::track::dcaZ) < cfgDCAz; - using myTracks = soa::Filtered>; + Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && nabs(aod::track::dcaXY) < cfgDCAxy&& nabs(aod::track::dcaZ) < cfgDCAz; + using myTracks = soa::Filtered>; void processData(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, myTracks const& tracks) { auto bc = collision.bc_as(); int run = bc.runNumber(); - if(run != lastRun) { + if (run != lastRun) { lastRun = run; - if(cfgFillWeights && cfgRunByRunWeights) + if (cfgFillWeights && cfgRunByRunWeights) CreateRunByRunWeights(); } registry.fill(HIST("eventQA/eventSel"), 0.5); @@ -915,10 +924,10 @@ struct GenericFramework { return; if (cfgFillQA) FillEventQA(collision, tracks); - if(!cfgFillWeights) loadCorrections(bc); + if (!cfgFillWeights) + loadCorrections(bc); auto field = (cfgMagField == 99999) ? getMagneticField(bc.timestamp()) : cfgMagField; processCollision(collision, tracks, centrality, field); - } PROCESS_SWITCH(GenericFramework, processData, "Process analysis for non-derived data", true); @@ -926,10 +935,10 @@ struct GenericFramework { { auto bc = collision.bc_as(); int run = bc.runNumber(); - registry.fill(HIST("eventQA/before/runNo"),run); - if(run != lastRun) { + registry.fill(HIST("eventQA/before/runNo"), run); + if (run != lastRun) { lastRun = run; - if(cfgFillWeights && cfgRunByRunWeights) + if (cfgFillWeights && cfgRunByRunWeights) CreateRunByRunWeights(); } if (!collision.sel8()) @@ -942,10 +951,10 @@ struct GenericFramework { if (cfgFillQA) FillEventQA(collision, tracks); - if(!cfgFillWeights) loadCorrections(bc); + if (!cfgFillWeights) + loadCorrections(bc); auto field = (cfgMagField == 99999) ? getMagneticField(bc.timestamp()) : cfgMagField; processCollision(collision, tracks, centrality, field); - } PROCESS_SWITCH(GenericFramework, processMCReco, "Process analysis for MC reconstructed events", false); diff --git a/PWGCF/JCorran/Tasks/CMakeLists.txt b/PWGCF/JCorran/Tasks/CMakeLists.txt index 18284bd2f4c..31fc41e4c6d 100644 --- a/PWGCF/JCorran/Tasks/CMakeLists.txt +++ b/PWGCF/JCorran/Tasks/CMakeLists.txt @@ -33,3 +33,8 @@ o2physics_add_dpl_workflow(epflow-analysis SOURCES jEPFlowAnalysis.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::JCorran COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(epdzeroflow-analysis + SOURCES jEPDzeroFlowAnalysis.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/JCorran/Tasks/jEPDzeroFlowAnalysis.cxx b/PWGCF/JCorran/Tasks/jEPDzeroFlowAnalysis.cxx new file mode 100644 index 00000000000..be132b44684 --- /dev/null +++ b/PWGCF/JCorran/Tasks/jEPDzeroFlowAnalysis.cxx @@ -0,0 +1,222 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/// \author junlee.kim@cern.ch +/// \since Jul 2024 + +#include +#include +#include +#include +#include +#include +#include + +#include "TLorentzVector.h" +#include "TRandom3.h" +#include "TF1.h" +#include "TVector2.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "Math/GenVector/Boost.h" +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/StaticFor.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Qvectors.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/EventPlaneHelper.h" + +#include "CommonConstants/PhysicsConstants.h" + +#include "ReconstructionDataFormats/Track.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" + +#include "CCDB/CcdbApi.h" +#include "CCDB/BasicCCDBManager.h" + +#include "PWGCF/DataModel/CorrelationsDerived.h" + +using namespace std; +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +struct jEPDzeroFlowAnalysis { + enum { + kFT0C = 0, + kFT0A = 1, + kFT0M, + kFV0A, + kTPCpos, + kTPCneg, + kTPCall + }; + + using MyCollisions = soa::Join; + HistogramRegistry histos{ + "histos", + {}, + OutputObjHandlingPolicy::AnalysisObject}; + + Configurable cfgCentSel{"cfgCentSel", 80., "Centrality selection"}; + Configurable cfgCentEst{"cfgCentEst", "FT0C", "Centrality estimator; FT0M or FT0C available"}; + + Configurable cfgPVSel{"cfgPVSel", false, "Additional PV selection flag for syst"}; + Configurable cfgPV{"cfgPV", 8.0, "Additional PV selection range for syst"}; + Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "flag for additional pileup selection"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + + Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + Configurable cfgNQvec{"cfgNQvec", 7, "The number of total Qvectors for looping over the task"}; + + Configurable cfgEtaMax{"cfgEtaMax", 0.8, "eta selection"}; + Configurable cfgPtMin{"cfgPtMin", 0.0, "pt selection"}; + + Configurable cfgDetName{"cfgDetName", "FT0C", "The name of detector to be analyzed"}; + Configurable cfgRefAName{"cfgRefAName", "TPCPos", "The name of detector for reference A"}; + Configurable cfgRefBName{"cfgRefBName", "TPCNeg", "The name of detector for reference B"}; + + ConfigurableAxis massAxis{"massAxis", {175, 1.7, 2.05}, "Invariant mass axis"}; + ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"}; + ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"}; + ConfigurableAxis cosAxis{"cosAxis", {110, -1.05, 1.05}, "Cosine axis"}; + + // Filter track2pFilter = (nabs(aod::cf2prongtrack::eta) < cfgEtaMax) && (aod::cf2prongtrack::pt > cfgPtMin); + + EventPlaneHelper helperEP; + + int DetId; + int RefAId; + int RefBId; + + float centrality; + + template + using hasInvMass = decltype(std::declval().invMass()); + + template + int GetDetId(const T& name) + { + if (name.value == "FT0C") { + return kFT0C; + } else if (name.value == "FT0A") { + return kFT0A; + } else if (name.value == "FT0M") { + return kFT0M; + } else if (name.value == "FV0A") { + return kFV0A; + } else if (name.value == "TPCpos") { + return kTPCpos; + } else if (name.value == "TPCneg") { + return kTPCneg; + } else if (name.value == "TPCall") { + return kTPCall; + } else { + return 0; + } + } + + template + bool eventSelected(TCollision collision) + { + if (!collision.sel8()) { + return false; + } + if (cfgCentSel < centrality) { + return false; + } + if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (cfgPVSel && std::abs(collision.posZ()) > cfgPV) { + return false; + } + if (cfgAddEvtSelPileup && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy) { + return false; + } + return true; + } // event selection + + template + void fillHistosFlow(const CollType& coll, TrackType& trks) + { + if (coll.qvecAmp()[DetId] < 1e-4 || coll.qvecAmp()[RefAId] < 1e-4 || coll.qvecAmp()[RefBId] < 1e-4) { + return; + } + int DetInd = DetId * 4 + cfgNQvec * 4; + // int RefAInd = RefAId * 4 + cfgNQvec * 4; + // int RefBInd = RefBId * 4 + cfgNQvec * 4; + for (auto& trk : trks) { + histos.fill(HIST("hist_EP_cos_Det_v2"), trk.invMass(), trk.pt(), std::cos(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecRe()[DetInd + 3], coll.qvecIm()[DetInd + 3], 2))), centrality); + histos.fill(HIST("hist_EP_sin_Det_v2"), trk.invMass(), trk.pt(), std::sin(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecRe()[DetInd + 3], coll.qvecIm()[DetInd + 3], 2))), centrality); + } + } + + void init(InitContext const&) + { + DetId = GetDetId(cfgDetName); + RefAId = GetDetId(cfgRefAName); + RefBId = GetDetId(cfgRefBName); + + if (DetId == RefAId || DetId == RefBId || RefAId == RefBId) { + LOGF(fatal, "Wrong detector configuration \n set the systems correctly"); + DetId = 0; + RefAId = 4; + RefBId = 5; + } + + histos.add(Form("hist_EP_cos_Det_v2"), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add(Form("hist_EP_sin_Det_v2"), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + } + + void processData(MyCollisions::iterator const& collision, aod::CF2ProngTracks const& p2tracks) + { + if (cfgCentEst.value == "FT0C") { + centrality = collision.centFT0C(); + } else if (cfgCentEst.value == "FT0M") { + centrality = collision.centFT0M(); + } + if (!eventSelected(collision)) { + return; + } + fillHistosFlow(collision, p2tracks); + } + PROCESS_SWITCH(jEPDzeroFlowAnalysis, processData, "Process Event for data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h index be2658d44aa..c1aecefbc0e 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h @@ -19,95 +19,116 @@ // *) Task configuration: struct : ConfigurableGroup { // std::string prefix = "Task configuration"; // AA: now these configurables also appear grouped on hyperloop => TBI 20240522 check if this work, and if further modifications in init are needed + Configurable cfTaskIsConfiguredFromJson{"cfTaskIsConfiguredFromJson", "no", "always set manaully to \"yes\" via JSON, merely to ensure that settings are not ignored silently"}; Configurable cfTaskName{"cfTaskName", "Default task name", "set task name - use eventually to determine weights for this task"}; Configurable cfDryRun{"cfDryRun", false, "book all histos and run without storing and calculating anything"}; - Configurable cfVerbose{"cfVerbose", false, "run or not in verbose mode (but not for function calls per particle)"}; + Configurable cfVerbose{"cfVerbose", false, "run or not in verbose mode (but not for simple utility functions or function calls per particle)"}; + Configurable cfVerboseUtility{"cfVerboseUtility", false, "run or not in verbose mode, also for simple utility functions (but not for function calls per particle)"}; Configurable cfVerboseForEachParticle{"cfVerboseForEachParticle", false, "run or not in verbose mode (also for function calls per particle)"}; + Configurable cfVerboseEventCounter{"cfVerboseEventCounter", false, "print or not only event counter"}; + Configurable cfVerboseEventCut{"cfVerboseEventCut", false, "print or not which event cut didn't survive"}; + Configurable cfPlainPrintout{"cfPlainPrintout", false, "print in color or in plain (use the latter in HL)"}; Configurable cfDoAdditionalInsanityChecks{"cfDoAdditionalInsanityChecks", false, "do additional insanity checks at run time (this leads to small loss of performance)"}; Configurable cfInsanityCheckForEachParticle{"cfInsanityCheckForEachParticle", false, "do insanity checks at run time for each particle, at the expense of losing a lot of performance. Use only during debugging."}; - Configurable cfUseCCDB{"cfUseCCDB", true, "if requested, access personal files from CCDB (true) or from home dir in AliEn (false)"}; Configurable cfRandomSeed{"cfRandomSeed", 0, "0 = random seed is guaranteed to be unique in space and time"}; Configurable cfUseFisherYates{"cfUseFisherYates", false, "use or not Fisher-Yates algorithm to randomize particle indices"}; Configurable cfFixedNumberOfRandomlySelectedTracks{"cfFixedNumberOfRandomlySelectedTracks", -1, "set to some integer > 0, to apply and use. Set to <=0, to ignore."}; Configurable cfUseStopwatch{"cfUseStopwatch", false, "if true, some basic info on time execution is printed, here and there. Very loosely, this can be used for execution time profiling."}; + Configurable cfFloatingPointPrecision{"cfFloatingPointPrecision", 0.000001, "two floats are the same if TMath::Abs(f1 - f2) < fFloatingPointPrecision"}; + Configurable cfSequentialBailout{"cfSequentialBailout", 0, "if fSequentialBailout > 0, then each fSequentialBailout events the function BailOut() is called. Can be used for real analysis and for IV"}; + Configurable cfUseSpecificCuts{"cfUseSpecificCuts", false, "if true, analysis-specific cuts set via configurable cfWhichSpecificCuts are applied after DefaultCuts(). "}; + Configurable cfWhichSpecificCuts{"cfWhichSpecificCuts", "some supported set of analysis-specific cuts (e.g. LHC23zzh, ...)", "determine which set of analysis-specific cuts will be applied after DefaultCuts(). Use in combination with tc.fUseSpecificCuts"}; + } cf_tc; // *) QA: struct : ConfigurableGroup { Configurable cfCheckUnderflowAndOverflow{"cfCheckUnderflowAndOverflow", false, "check and bail out if in event and particle histograms there are entries which went to underflow or overflow bins (use only locally)"}; + Configurable cfRebin{"cfRebin", 1, "number of bins of selected heavy 2D histograms are devided with this number"}; Configurable cfFillQAEventHistograms2D{"cfFillQAEventHistograms2D", false, "if false, all QA 2D event histograms are not filled. if true, only the ones for which fBookQAEventHistograms2D[...] is true, are filled"}; - Configurable> cfBookQAEventHistograms2D{"cfBookQAEventHistograms2D", {"MultTPC_vs_NContributors-1", "Vertex_z_vs_MultTPC-1", "Vertex_z_vs_NContributors-1", "CentFT0M_vs_CentNTPV-1", "CentRun2V0M_vs_CentRun2SPDTracklets-1", "CentRun2V0M_vs_NContributors-1"}, "book (1) or do not book (0) this QA 2D event histogram"}; + Configurable> cfBookQAEventHistograms2D{"cfBookQAEventHistograms2D", {"1-Multiplicity_vs_ReferenceMultiplicity", "1-Multiplicity_vs_NContributors", "1-Multiplicity_vs_Centrality", "1-Multiplicity_vs_Vertex_z", "1-Multiplicity_vs_Occupancy", "1-ReferenceMultiplicity_vs_NContributors", "1-ReferenceMultiplicity_vs_Centrality", "1-ReferenceMultiplicity_vs_Vertex_z", "1-ReferenceMultiplicity_vs_Occupancy", "1-NContributors_vs_Centrality", "1-NContributors_vs_Vertex_z", "1-NContributors_vs_Occupancy", "1-Centrality_vs_Vertex_z", "1-Centrality_vs_Occupancy", "1-Centrality_vs_ImpactParameter", "1-Vertex_z_vs_Occupancy", "0-MultNTracksPV_vs_MultNTracksGlobal", "0-CentFT0C_vs_CentNTPV", "0-CentFT0M_vs_CentNTPV", "0-CentRun2V0M_vs_CentRun2SPDTracklets", "1-TrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange", "1-CurrentRunDuration_vs_InteractionRate"}, "book (1) or do not book (0) this QA 2D event histogram"}; Configurable cfFillQAParticleHistograms2D{"cfFillQAParticleHistograms2D", false, "if false, all QA 2D particle histograms are not filled. if true, only the ones for which fBookQAParticleHistograms2D[...] is true, are filled"}; - Configurable> cfBookQAParticleHistograms2D{"cfBookQAParticleHistograms2D", {"Pt_vs_dcaXY-1"}, "book (1) or do not book (0) this QA 2D particle histogram"}; + Configurable> cfBookQAParticleHistograms2D{"cfBookQAParticleHistograms2D", {"1-Pt_vs_dcaXY"}, "book (1) or do not book (0) this QA 2D particle histogram"}; } cf_qa; // *) Event histograms: struct : ConfigurableGroup { Configurable cfFillEventHistograms{"cfFillEventHistograms", true, "if false, all event histograms are not filled. if true, only the ones for which fBookEventHistograms[...] is true, are filled"}; - Configurable> cfBookEventHistograms{"cfBookEventHistograms", {"NumberOfEvents-1", "TotalMultiplicity-1", "SelectedTracks-1", "MultFV0M-1", "MultFT0M-1", "MultTPC-1", "MultNTracksPV-1", "MultTracklets-1", "Centrality-1", "Vertex_x-1", "Vertex_y-1", "Vertex_z-1", "NContributors-1", "ImpactParameter-1"}, "Book (1) or do not book (0) event histogram"}; + Configurable> cfBookEventHistograms{"cfBookEventHistograms", {"1-NumberOfEvents", "1-TotalMultiplicity", "1-Multiplicity", "1-ReferenceMultiplicity", "1-Centrality", "1-Vertex_x", "1-Vertex_y", "1-Vertex_z", "1-NContributors", "0-ImpactParameter", "0-EventPlaneAngle", "1-Occupancy", "1-InteractionRate", "1-CurrentRunDuration", "0-MultMCNParticlesEta08"}, "Book (1) or do not book (0) event histogram"}; } cf_eh; // *) Event cuts: struct : ConfigurableGroup { - Configurable> cfUseEventCuts{"cfUseEventCuts", {"NumberOfEvents-1", "TotalMultiplicity-1", "SelectedTracks-1", "MultFV0M-1", "MultFT0M-1", "MultTPC-1", "MultNTracksPV-1", "MultTracklets-1", "Centrality-1", "Vertex_x-1", "Vertex_y-1", "Vertex_z-1", "NContributors-1", "ImpactParameter-1", "Trigger-1", "Sel7-1", "Sel8-1", "CentralityEstimator-1", "SelectedEvents-1", "NoSameBunchPileup-1", "IsGoodZvtxFT0vsPV-1", "IsVertexITSTPC-1", "IsVertexTOFmatched-1", "IsVertexTRDmatched-1"}, "use (1) or do not use (0) event cuts"}; + Configurable> cfUseEventCuts{"cfUseEventCuts", {"1-NumberOfEvents", "1-TotalMultiplicity", "1-Multiplicity", "1-ReferenceMultiplicity", "1-Centrality", "1-Vertex_x", "1-Vertex_y", "1-Vertex_z", "1-NContributors", "1-ImpactParameter", "0-EventPlaneAngle", "1-Occupancy", "1-InteractionRate", "1-CurrentRunDuration", "0-MultMCNParticlesEta08", "0-Trigger", "0-Sel7", "1-Sel8", "1-MultiplicityEstimator", "1-ReferenceMultiplicityEstimator", "1-CentralityEstimator", "1-SelectedEvents", "1-NoSameBunchPileup", "1-IsGoodZvtxFT0vsPV", "1-IsVertexITSTPC", "1-IsVertexTOFmatched", "1-IsVertexTRDmatched", "0-NoCollInTimeRangeStrict", "0-NoCollInTimeRangeStandard", "0-NoCollInRofStrict", "0-NoCollInRofStandard", "0-NoHighMultCollInPrevRof", "1-OccupancyEstimator"}, "use (1) or do not use (0) event cuts"}; Configurable cfUseEventCutCounterAbsolute{"cfUseEventCutCounterAbsolute", false, "profile and save how many times each event cut counter triggered (absolute). Use with care, as this is computationally heavy"}; Configurable cfUseEventCutCounterSequential{"cfUseEventCutCounterSequential", false, "profile and save how many times each event cut counter triggered (sequential). Use with care, as this is computationally heavy"}; Configurable cfPrintCutCounterContent{"cfPrintCutCounterContent", false, "if true, prints on the screen after each event the content of fEventCutCounterHist[*][*] (all which were booked)"}; // Remark: Preserve below the same ordering as in enum's eEventHistograms + eEventCuts. In hyperloop, in any case this ordering is lost, because there it's alphabetical TBI 20240521 check this, after I added now std::string prefix thingie Configurable> cfNumberOfEvents{"cfNumberOfEvents", {-1, 1000000000}, "total number of events to process (whether or not they survive event cuts): {min, max}, with convention: min <= N < max"}; Configurable> cfTotalMultiplicity{"cfTotalMultiplicity", {-1, 1000000000}, "total multiplicity range: {min, max}, with convention: min <= M < max"}; - Configurable> cfSelectedTracks{"cfSelectedTracks", {-1, 1000000000}, "selected tracks range: {min, max}, with convention: min <= M < max"}; - Configurable> cfMultFV0M{"cfMultFV0M", {-1, 1000000000}, "MultFV0M range {min, max}, with convention: min <= M < max"}; - Configurable> cfMultFT0M{"cfMultFT0M", {-1, 1000000000}, "MultFT0M range {min, max}, with convention: min <= M < max"}; - Configurable> cfMultTPC{"cfMultTPC", {-1, 1000000000}, "MultTPC range {min, max}, with convention: min <= M < max"}; - Configurable> cfMultNTracksPV{"cfMultNTracksPV", {-1, 1000000000}, "MultNTracksPV range {min, max}, with convention: min <= M < max"}; - Configurable> cfMultTracklets{"cfMultTracklets", {-1, 1000000000}, "MultTracklets range {min, max}, with convention: min <= M < max"}; + Configurable> cfMultiplicity{"cfMultiplicity", {-1., 1000000000.}, "multiplicity (defined via cfMultiplicityEstimator) range {min, max}, with convention: min <= M < max"}; + Configurable> cfReferenceMultiplicity{"cfReferenceMultiplicity", {-1., 1000000000.}, "reference multiplicity (defined via cfReferenceMultiplicityEstimator) range {min, max}, with convention: min <= M < max"}; Configurable> cfCentrality{"cfCentrality", {-10., 110.}, "centrality range: {min, max}, with convention: min <= cent < max"}; Configurable> cfVertex_x{"cfVertex_x", {-10., 10.}, "vertex x position range: {min, max}[cm], with convention: min <= Vx < max"}; Configurable> cfVertex_y{"cfVertex_y", {-10., 10.}, "vertex y position range: {min, max}[cm], with convention: min <= Vy < max"}; Configurable> cfVertex_z{"cfVertex_z", {-10., 10.}, "vertex z position range: {min, max}[cm], with convention: min <= Vz < max"}; - Configurable> cfNContributors{"cfNContributors", {-1, 1000000000}, "Number of vertex contributors: {min, max}, with convention: min <= N < max"}; + Configurable> cfNContributors{"cfNContributors", {2, 1000000000}, "Number of vertex contributors: {min, max}, with convention: min <= N < max"}; Configurable> cfImpactParameter{"cfImpactParameter", {-1, 1000000000}, "Impact parameter range (can be used only for sim): {min, max}, with convention: min <= IP < max"}; - Configurable cfTrigger{"cfTrigger", "some supported trigger", "set here some supported trigger (kINT7, ...) "}; + Configurable> cfEventPlaneAngle{"cfEventPlaneAngle", {-1000, 1000000000}, "Event Plane Angle range (can be used only for sim): {min, max}, with convention: min <= EP < max"}; + Configurable> cfOccupancy{"cfOccupancy", {-2, 1000000000}, "Range for occupancy (use cfOccupancyEstimator to set specific estimator): {min, max}, with convention: min <= X < max"}; + Configurable> cfInteractionRate{"cfInteractionRate", {-2, 1000000000}, "Range for interaction rate: {min, max}, with convention: min <= X < max"}; + Configurable> cfCurrentRunDuration{"cfCurrentRunDuration", {-2, 1000000000}, "Range for current run duration (i.e. seconds since start of run) in seconds: {min, max}, with convention: min <= X < max. Only collisions taken in this range (measured from SOR) are taken for analysis"}; + Configurable> cfMultMCNParticlesEta08{"cfMultMCNParticlesEta08", {-1, 1000000000}, "Range for MultMCNParticlesEta08 : {min, max}, with convention: min <= X < max"}; + Configurable cfTrigger{"cfTrigger", "some supported trigger (e.g. INT7 for Run 2, TVXinTRD for Run 3, etc...)", "set here some supported trigger"}; Configurable cfUseSel7{"cfUseSel7", false, "use for Run 1 and 2 data and MC (see official doc)"}; Configurable cfUseSel8{"cfUseSel8", false, "use for Run 3 data and MC (see official doc)"}; + Configurable cfMultiplicityEstimator{"cfMultiplicityEstimator", "SelectedTracks", "all results vs. mult are calculated against this multiplicity. Can be set to SelectedTracks (calculated internally), ReferenceMultiplicity (calculated outside of my code), etc."}; + // Configurable cfReferenceMultiplicityEstimator{"cfReferenceMultiplicityEstimator", "some supported option for ref. mult. (MultFT0C, MultFV0M, MultTPC, etc.)", "Reference multiplicity, calculated outside of my code. Can be MultFT0C, MultFV0M, MultTPC, etc."}; + Configurable cfReferenceMultiplicityEstimator{"cfReferenceMultiplicityEstimator", "MultFT0C", "Reference multiplicity, calculated outside of my code. Can be MultFT0C, MultFV0M, MultTPC, etc."}; + // Configurable cfCentralityEstimator{"cfCentralityEstimator", "some supported centrality estimator (e.g. CentFT0C, ...)", "set here some supported centrality estimator (CentFT0C, CentFT0M, CentFV0A, CentNTPV, ... for Run 3, and CentRun2V0M, CentRun2SPDTracklets, ..., for Run 2 and 1) "}; + Configurable cfCentralityEstimator{"cfCentralityEstimator", "CentFT0C", "set here some supported centrality estimator (CentFT0C, CentFT0M, CentFV0A, CentNTPV, ... for Run 3, and CentRun2V0M, CentRun2SPDTracklets, ..., for Run 2 and 1) "}; Configurable> cfSelectedEvents{"cfSelectedEvents", {-1, 1000000000}, "Selected number of events to process (i.e. only events which survive event cuts): {min, max}, with convention: min <= N < max"}; Configurable cfUseNoSameBunchPileup{"cfUseNoSameBunchPileup", false, "TBI 20240521 explanation"}; Configurable cfUseIsGoodZvtxFT0vsPV{"cfUseIsGoodZvtxFT0vsPV", false, "TBI 20240521 explanation"}; Configurable cfUseIsVertexITSTPC{"cfUseIsVertexITSTPC", false, "TBI 20240521 explanation"}; Configurable cfUseIsVertexTOFmatched{"cfUseIsVertexTOFmatched", false, "TBI 20240521 explanation"}; Configurable cfUseIsVertexTRDmatched{"cfUseIsVertexTRDmatched", false, "TBI 20240521 explanation"}; - Configurable cfCentralityEstimator{"cfCentralityEstimator", "some supported centrality estimator", "set here some supported centrality estimator (CentFT0M, CentFV0A, CentNTPV, ... for Run 3, and CentRun2V0M, CentRun2SPDTracklets, ..., for Run 2 and 1) "}; + Configurable cfUseNoCollInTimeRangeStrict{"cfUseNoCollInTimeRangeStrict", false, "TBI 20240521 explanation"}; + Configurable cfUseNoCollInTimeRangeStandard{"cfUseNoCollInTimeRangeStandard", false, "TBI 20240521 explanation"}; + Configurable cfUseNoCollInRofStrict{"cfUseNoCollInRofStrict", false, "TBI 20240521 explanation"}; + Configurable cfUseNoCollInRofStandard{"cfUseNoCollInRofStandard", false, "TBI 20240521 explanation"}; + Configurable cfUseNoHighMultCollInPrevRof{"cfUseNoHighMultCollInPrevRof", false, "TBI 20240521 explanation"}; + Configurable cfOccupancyEstimator{"cfOccupancyEstimator", "FT0COccupancyInTimeRange", "set here some supported occupancy estimator (TrackOccupancyInTimeRange, FT0COccupancyInTimeRange, ..."}; } cf_ec; // *) Particle histograms: struct : ConfigurableGroup { Configurable cfFillParticleHistograms{"cfFillParticleHistograms", true, "if false, all 1D particle histograms are not filled. if kTRUE, the ones for which fBookParticleHistograms[...] is kTRUE, are filled"}; - Configurable> cfBookParticleHistograms{"cfBookParticleHistograms", {"Phi-1", "Pt-1", "Eta-1", "Charge-1", "tpcNClsFindable-1", "tpcNClsShared-1", "tpcNClsFound-1", "tpcNClsCrossedRows-1", "itsNCls-1", "itsNClsInnerBarrel-1", "tpcCrossedRowsOverFindableCls-1", "tpcFoundOverFindableCls-1", "tpcFractionSharedCls-1", "dcaXY-1", "dcaZ-1", "PDG-1"}, "Book (1) or do not book (0) particle histogram"}; - Configurable cfFillParticleHistograms2D{"cfFillParticleHistograms2D", true, "if false, all 2D particle histograms are not filled. if kTRUE, the ones for which fBookParticleHistograms2D[...] is kTRUE, are filled"}; - Configurable> cfBookParticleHistograms2D{"cfBookParticleHistograms2D", {"Phi_vs_Pt-1", "Phi_vs_Eta-1"}, "Book (1) or do not book (0) this 2D particle histogram"}; + Configurable> cfBookParticleHistograms{"cfBookParticleHistograms", {"1-Phi", "1-Pt", "1-Eta", "1-Charge", "1-tpcNClsFindable", "1-tpcNClsShared", "1-tpcNClsFound", "1-tpcNClsCrossedRows", "1-itsNCls", "1-itsNClsInnerBarrel", "1-tpcCrossedRowsOverFindableCls", "1-tpcFoundOverFindableCls", "1-tpcFractionSharedCls", "1-dcaXY", "1-dcaZ", "0-PDG"}, "Book (1) or do not book (0) particle histogram"}; + Configurable cfFillParticleHistograms2D{"cfFillParticleHistograms2D", false, "if false, all 2D particle histograms are not filled. if kTRUE, the ones for which fBookParticleHistograms2D[...] is kTRUE, are filled"}; + Configurable> cfBookParticleHistograms2D{"cfBookParticleHistograms2D", {"1-Phi_vs_Pt", "1-Phi_vs_Eta"}, "Book (1) or do not book (0) 2D particle histograms"}; } cf_ph; // *) Particle cuts: struct : ConfigurableGroup { - Configurable> cfUseParticleCuts{"cfUseParticleCuts", {"Phi-1", "Pt-1", "Eta-1", "Charge-1", "tpcNClsFindable-1", "tpcNClsShared-1", "tpcNClsFound-1", "tpcNClsCrossedRows-1", "itsNCls-1", "itsNClsInnerBarrel-1", "tpcCrossedRowsOverFindableCls-1", "tpcFoundOverFindableCls-1", "tpcFractionSharedCls-1", "dcaXY-1", "dcaZ-1", "PDG-1", "trackCutFlagFb1-0", "trackCutFlagFb2-0", "isQualityTrack-0", "isPrimaryTrack-0", "isInAcceptanceTrack-0", "isGlobalTrack-0", "PtDependentDCAxyParameterization-0"}, "Use (1) or do not use (0) particle cuts"}; + Configurable> cfUseParticleCuts{"cfUseParticleCuts", {"1-Phi", "1-Pt", "1-Eta", "1-Charge", "1-tpcNClsFindable", "1-tpcNClsShared", "1-tpcNClsFound", "1-tpcNClsCrossedRows", "1-itsNCls", "1-itsNClsInnerBarrel", "1-tpcCrossedRowsOverFindableCls", "1-tpcFoundOverFindableCls", "1-tpcFractionSharedCls", "1-dcaXY", "1-dcaZ", "1-PDG", "0-trackCutFlagFb1", "0-trackCutFlagFb2", "0-isQualityTrack", "0-isPrimaryTrack", "0-isInAcceptanceTrack", "0-isGlobalTrack", "0-PtDependentDCAxyParameterization"}, "Use (1) or do not use (0) particle cuts"}; Configurable cfUseParticleCutCounterAbsolute{"cfUseParticleCutCounterAbsolute", false, "profile and save how many times each particle cut counter triggered (absolute). Use with care, as this is computationally heavy"}; Configurable cfUseParticleCutCounterSequential{"cfUseParticleCutCounterSequential", false, "profile and save how many times each particle cut counter triggered (sequential). Use with care, as this is computationally heavy"}; Configurable> cfPhi{"cfPhi", {0.0, TMath::TwoPi()}, "phi range: {min, max}[rad], with convention: min <= phi < max"}; Configurable> cfPt{"cfPt", {0.2, 5.0}, "pt range: {min, max}[GeV], with convention: min <= pt < max"}; Configurable> cfEta{"cfEta", {-0.8, 0.8}, "eta range: {min, max}, with convention: min <= eta < max"}; Configurable> cfCharge{"cfCharge", {-1.5, 1.5}, "particle charge. {-1.5,0} = only negative, {0,1.5} = only positive"}; - Configurable> cftpcNClsFindable{"cftpcNClsFindable", {-1000., 1000.}, "tpcNClsFindable range: {min, max}, with convention: min <= eta < max"}; - Configurable> cftpcNClsShared{"cftpcNClsShared", {-1000., 1000.}, "tpcNClsShared range: {min, max}, with convention: min <= eta < max"}; - Configurable> cftpcNClsFound{"cftpcNClsFound", {-1000., 1000.}, "tpcNClsFound range: {min, max}, with convention: min <= eta < max"}; - Configurable> cftpcNClsCrossedRows{"cftpcNClsCrossedRows", {-1000., 1000.}, "tpcNClsCrossedRows range: {min, max}, with convention: min <= eta < max"}; - Configurable> cfitsNCls{"cfitsNCls", {-1000., 1000.}, "itsNCls range: {min, max}, with convention: min <= eta < max"}; - Configurable> cfitsNClsInnerBarrel{"cfitsNClsInnerBarrel", {-1000., 1000.}, "itsNClsInnerBarrel range: {min, max}, with convention: min <= eta < max"}; - Configurable> cftpcCrossedRowsOverFindableCls{"cftpcCrossedRowsOverFindableCls", {-1000., 1000.}, "tpcCrossedRowsOverFindableCls range: {min, max}, with convention: min <= eta < max"}; - Configurable> cftpcFoundOverFindableCls{"cftpcFoundOverFindableCls", {-1000., 1000.}, "tpcFoundOverFindableCls range: {min, max}, with convention: min <= eta < max"}; - Configurable> cftpcFractionSharedCls{"cftpcFractionSharedCls", {-1000., 1000.}, "tpcFractionSharedCls range: {min, max}, with convention: min <= eta < max"}; - Configurable> cfdcaXY{"cfdcaXY", {-1000., 1000.}, "dcaXY range: {min, max}, with convention: min <= eta < max"}; - Configurable> cfdcaZ{"cfdcaZ", {-1000., 1000.}, "dcaZ range: {min, max}, with convention: min <= eta < max"}; + Configurable> cftpcNClsFindable{"cftpcNClsFindable", {-1000., 1000.}, "tpcNClsFindable range: {min, max}, with convention: min <= cftpcNClsFindable < max"}; + Configurable> cftpcNClsShared{"cftpcNClsShared", {-1000., 1000.}, "tpcNClsShared range: {min, max}, with convention: min <= cftpcNClsShared < max"}; + Configurable> cftpcNClsFound{"cftpcNClsFound", {-1000., 1000.}, "tpcNClsFound range: {min, max}, with convention: min <= cftpcNClsFound < max"}; + Configurable> cftpcNClsCrossedRows{"cftpcNClsCrossedRows", {70., 1000.}, "tpcNClsCrossedRows range: {min, max}, with convention: min <= tpcNClsCrossedRows < max"}; + Configurable> cfitsNCls{"cfitsNCls", {5., 1000.}, "itsNCls range: {min, max}, with convention: min <= itsNCls < max"}; + Configurable> cfitsNClsInnerBarrel{"cfitsNClsInnerBarrel", {-1000., 1000.}, "itsNClsInnerBarrel range: {min, max}, with convention: min <= cfitsNClsInnerBarrel < max"}; + Configurable> cftpcCrossedRowsOverFindableCls{"cftpcCrossedRowsOverFindableCls", {0.8, 1000.}, "tpcCrossedRowsOverFindableCls range: {min, max}, with convention: min <= cftpcCrossedRowsOverFindableCls < max"}; + Configurable> cftpcFoundOverFindableCls{"cftpcFoundOverFindableCls", {-1000., 1000.}, "tpcFoundOverFindableCls range: {min, max}, with convention: min <= cftpcFoundOverFindableCls < max"}; + Configurable> cftpcFractionSharedCls{"cftpcFractionSharedCls", {-1000., 0.4}, "tpcFractionSharedCls range: {min, max}, with convention: min <= cftpcFractionSharedCls < max"}; + Configurable> cfdcaXY{"cfdcaXY", {-2.4, 2.4}, "dcaXY range: {min, max}, with convention: min <= dcaXY < max (yes, DCA can be negative!)"}; + Configurable> cfdcaZ{"cfdcaZ", {-3.2, 3.2}, "dcaZ range: {min, max}, with convention: min <= dcaZ < max (yes, DCA can be negative!)"}; Configurable> cfPDG{"cfPDG", {-5000., 5000.}, "PDG code"}; Configurable cftrackCutFlagFb1{"cftrackCutFlagFb1", false, "TBI 20240510 add description"}; Configurable cftrackCutFlagFb2{"cftrackCutFlagFb2", false, "TBI 20240510 add description"}; @@ -121,12 +142,20 @@ struct : ConfigurableGroup { // *) Q-vector: struct : ConfigurableGroup { - Configurable cfCalculateQvectors{"cfCalculateQvectors", false, "calculate or not Q-vectors (all, also diff. ones). If I want only to fill control histograms, then set here false"}; + Configurable cfCalculateQvectors{"cfCalculateQvectors", true, "calculate or not Q-vectors (all, also diff. ones). If I want only to fill control histograms, then set here false"}; } cf_qv; // *) Multiparticle correlations: struct : ConfigurableGroup { Configurable cfCalculateCorrelations{"cfCalculateCorrelations", false, "calculate or not multiparticle correlations"}; + Configurable cfCalculateCorrelationsAsFunctionOfIntegrated{"cfCalculateCorrelationsAsFunctionOfIntegrated", false, "calculate or not correlations as a function of integrated"}; + Configurable cfCalculateCorrelationsAsFunctionOfMultiplicity{"cfCalculateCorrelationsAsFunctionOfMultiplicity", false, "calculate or not correlations as a function of multiplicity"}; + Configurable cfCalculateCorrelationsAsFunctionOfCentrality{"cfCalculateCorrelationsAsFunctionOfCentrality", false, "calculate or not correlations as a function of centrality"}; + Configurable cfCalculateCorrelationsAsFunctionOfPt{"cfCalculateCorrelationsAsFunctionOfPt", false, "calculate or not correlations as a function of pt"}; + Configurable cfCalculateCorrelationsAsFunctionOfEta{"cfCalculateCorrelationsAsFunctionOfEta", false, "calculate or not correlations as a function of eta"}; + Configurable cfCalculateCorrelationsAsFunctionOfOccupancy{"cfCalculateCorrelationsAsFunctionOfOccupancy", false, "calculate or not correlations as a function of occupancy"}; + Configurable cfCalculateCorrelationsAsFunctionOfInteractionRate{"cfCalculateCorrelationsAsFunctionOfInteractionRate", false, "calculate or not correlations as a function of interaction rate"}; + Configurable cfCalculateCorrelationsAsFunctionOfCurrentRunDuration{"cfCalculateCorrelationsAsFunctionOfCurrentRunDuration", false, "calculate or not correlations as a function of current run duration (i.e. vs. seconds since start of run)"}; } cf_mupa; // *) Test0: @@ -137,9 +166,29 @@ struct : ConfigurableGroup { Configurable cfCalculateTest0AsFunctionOfCentrality{"cfCalculateTest0AsFunctionOfCentrality", false, "calculate or not Test0 as a function of centrality"}; Configurable cfCalculateTest0AsFunctionOfPt{"cfCalculateTest0AsFunctionOfPt", false, "calculate or not Test0 as a function of pt"}; Configurable cfCalculateTest0AsFunctionOfEta{"cfCalculateTest0AsFunctionOfEta", false, "calculate or not Test0 as a function of eta"}; + Configurable cfCalculateTest0AsFunctionOfOccupancy{"cfCalculateTest0AsFunctionOfOccupancy", false, "calculate or not Test0 as a function of occupancy"}; + Configurable cfCalculateTest0AsFunctionOfInteractionRate{"cfCalculateTest0AsFunctionOfInteractionRate", false, "calculate or not Test0 as a function of interaction rate"}; + Configurable cfCalculateTest0AsFunctionOfCurrentRunDuration{"cfCalculateTest0AsFunctionOfCurrentRunDuration", false, "calculate or not Test0 as a function of current run duration (i.e. vs. seconds since start of run)"}; Configurable cfFileWithLabels{"cfFileWithLabels", "/home/abilandz/DatasetsO2/labels.root", "path to external ROOT file which specifies all labels"}; // for AliEn file prepend "/alice/cern.ch/", for CCDB prepend "/alice-ccdb.cern.ch" + Configurable cfUseDefaultLabels{"cfUseDefaultLabels", false, "use default internally hardwired labels, only for testing purposes"}; + Configurable cfWhichDefaultLabels{"cfWhichDefaultLabels", "standard", "only for testing purposes, select one set of default labels, see GetDefaultObjArrayWithLabels for supported options"}; } cf_t0; +// *) Eta separation: +struct : ConfigurableGroup { + Configurable cfCalculateEtaSeparations{"cfCalculateEtaSeparations", false, "calculate or not 2p corr. vs. eta separations"}; + Configurable cfCalculateEtaSeparationsAsFunctionOfIntegrated{"cfCalculateEtaSeparationsAsFunctionOfIntegrated", false, "calculate or not 2p corr. vs. eta separations ..."}; + Configurable cfCalculateEtaSeparationsAsFunctionOfMultiplicity{"cfCalculateEtaSeparationsAsFunctionOfMultiplicity", false, "calculate or not 2p corr. vs. eta separations as a function of multiplicity"}; + Configurable cfCalculateEtaSeparationsAsFunctionOfCentrality{"cfCalculateEtaSeparationsAsFunctionOfCentrality", false, "calculate or not 2p corr. vs. eta separations as a function of centrality"}; + Configurable cfCalculateEtaSeparationsAsFunctionOfPt{"cfCalculateEtaSeparationsAsFunctionOfPt", false, "calculate or not 2p corr. vs. eta separations as a function of pt"}; + // Configurable cfCalculateEtaSeparationsAsFunctionOfEta{"cfCalculateEtaSeparationsAsFunctionOfEta", false, "this one doesn't make sense in this context"}; + Configurable cfCalculateEtaSeparationsAsFunctionOfOccupancy{"cfCalculateEtaSeparationsAsFunctionOfOccupancy", false, "calculate or not 2p corr. vs. eta separations as a function of occupancy"}; + Configurable cfCalculateEtaSeparationsAsFunctionOfInteractionRate{"cfCalculateEtaSeparationsAsFunctionOfInteractionRate", false, "calculate or not 2p corr. vs. eta separations as a function of interaction rate"}; + Configurable cfCalculateEtaSeparationsAsFunctionOfCurrentRunDuration{"cfCalculateEtaSeparationsAsFunctionOfCurrentRunDuration", false, "calculate or not E2p corr. vs. eta separations as a function of current run duration (i.e. vs. seconds since start of run)"}; + Configurable> cfEtaSeparationsValues{"cfEtaSeparationsValues", {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8}, "Eta separation between interval A (-eta) and B (+eta)"}; + Configurable> cfEtaSeparationsSkipHarmonics{"cfEtaSeparationsSkipHarmonics", {"0-v1", "0-v2", "0-v3", "0-v4", "1-v5", "1-v6", "1-v7", "1-v8", "1-v9"}, "For calculation of 2p correlation with eta separation these harmonics will be skipped (if first flag = \"0-v1\", v1 will be NOT be skipped in the calculus of 2p correlations with eta separations, etc.)"}; +} cf_es; + // *) Particle weights: struct : ConfigurableGroup { Configurable cfUsePhiWeights{"cfUsePhiWeights", false, "use or not phi weights"}; @@ -150,6 +199,12 @@ struct : ConfigurableGroup { Configurable cfFileWithWeights{"cfFileWithWeights", "/home/abilandz/DatasetsO2/weights.root", "path to external ROOT file which holds all particle weights in O2 format"}; // for AliEn file prepend "/alice/cern.ch/", for CCDB prepend "/alice-ccdb.cern.ch" } cf_pw; +// *) Centrality weights: +struct : ConfigurableGroup { + Configurable cfUseCentralityWeights{"cfUseCentralityWeights", false, "use or not centrality weights"}; + Configurable cfFileWithCentralityWeights{"cfFileWithCentralityWeights", "/home/abilandz/DatasetsO2/centralityWeights.root", "path to external ROOT file which holds centrality weights in O2 format"}; // for AliEn file prepend "/alice/cern.ch/", for CCDB prepend "/alice-ccdb.cern.ch" +} cf_cw; + // *) Nested loops: struct : ConfigurableGroup { Configurable cfCalculateNestedLoops{"cfCalculateNestedLoops", false, "cross-check for all events all correlations with nested loops"}; @@ -171,21 +226,27 @@ struct : ConfigurableGroup { Configurable cfUseInternalValidation{"cfUseInternalValidation", false, "perform internal validation using flow analysis on-the-fly"}; Configurable cfInternalValidationForceBailout{"cfInternalValidationForceBailout", false, "force bailout (use only locally, since there is no graceful exit (yet))"}; Configurable cfnEventsInternalValidation{"cfnEventsInternalValidation", 0, "number of events simulated on-the-fly for internal validation"}; - Configurable cfHarmonicsOptionInternalValidation{"cfHarmonicsOptionInternalValidation", "constant", "for internal validation, set whether flow amplitudes are \"constant\" or \"correlared\""}; + Configurable cfHarmonicsOptionInternalValidation{"cfHarmonicsOptionInternalValidation", "constant", "for internal validation, set whether flow amplitudes are \"constant\" or \"correlated\""}; Configurable cfRescaleWithTheoreticalInput{"cfRescaleWithTheoreticalInput", false, "if kTRUE, all correlators are rescaled with theoretical input, so that all results in profiles are 1"}; - Configurable> cfInternalValidationAmplitudes{"cfInternalValidationAmplitudes", {0.01, 0.02, 0.03, 0.04}, "{v1, v2, v3, v4, ...} + has an effect only in combination with cfHarmonicsOptionInternalValidation = \"constant\". Max number of vn's is gMaxHarmonic."}; - Configurable> cfInternalValidationPlanes{"cfInternalValidationPlanes", {0.0, 0.0, 0.0, 0.0}, "{Psi1, Psi2, Psi3, Psi4, ...} + has an effect only in combination with cfHarmonicsOptionInternalValidation = \"constant\". Max number of Psin's is gMaxHarmonic."}; + Configurable> cfInternalValidationAmplitudes{"cfInternalValidationAmplitudes", {0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09}, "{v1, v2, v3, v4, ...} + has an effect only in combination with cfHarmonicsOptionInternalValidation = \"constant\". Max number of vn's is gMaxHarmonic."}; + Configurable> cfInternalValidationPlanes{"cfInternalValidationPlanes", {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, "{Psi1, Psi2, Psi3, Psi4, ...} + has an effect only in combination with cfHarmonicsOptionInternalValidation = \"constant\". Max number of Psin's is gMaxHarmonic."}; Configurable> cfMultRangeInternalValidation{"cfMultRangeInternalValidation", {1000, 1001}, "{min, max}, with convention: min <= M < max"}; } cf_iv; // *) Results histograms: struct : ConfigurableGroup { Configurable cfSaveResultsHistograms{"cfSaveResultsHistograms", false, "save or not results histograms"}; + // Fixed-length binning (default): - Configurable> cfFixedLength_mult_bins{"cfFixedLength_mult_bins", {2000, 0., 20000.}, "nMultBins, multMin, multMax"}; - Configurable> cfFixedLength_cent_bins{"cfFixedLength_cent_bins", {110, 0., 110.}, "nCentBins, centMin, centMax"}; - Configurable> cfFixedLength_pt_bins{"cfFixedLength_pt_bins", {1000, 0., 100.}, "nPtBins, ptMin, ptMax"}; - Configurable> cfFixedLength_eta_bins{"cfFixedLength_eta_bins", {1000, -2., 2.}, "nEtaBins, etaMin, etaMax"}; + Configurable> cfFixedLength_mult_bins{"cfFixedLength_mult_bins", {2000, 0., 20000.}, "nMultBins, multMin, multMax (only for results histograms)"}; + Configurable> cfFixedLength_cent_bins{"cfFixedLength_cent_bins", {110, 0., 110.}, "nCentBins, centMin, centMax (only for results histograms)"}; + Configurable> cfFixedLength_pt_bins{"cfFixedLength_pt_bins", {1000, 0., 10.}, "nPtBins, ptMin, ptMax (only for results histograms)"}; + Configurable> cfFixedLength_eta_bins{"cfFixedLength_eta_bins", {80, -2., 2.}, "nEtaBins, etaMin, etaMax (only for results histograms)"}; + Configurable> cfFixedLength_occu_bins{"cfFixedLength_occu_bins", {600, 0., 60000.}, "nOccuBins, occuMin, occuMax (only for results histograms)"}; + Configurable> cfFixedLength_ir_bins{"cfFixedLength_ir_bins", {1000, 0., 100.}, "nirBins, irMin, irMax (only for results histograms)"}; + Configurable> cfFixedLength_crd_bins{"cfFixedLength_crd_bins", {1000, 0., 10000.}, "nrdBins, rdMin, rdMax (only for results histograms)"}; + + // Variable-length binning (per request): Configurable cfUseVariableLength_mult_bins{"cfUseVariableLength_mult_bins", false, "use or not variable-length multiplicity bins"}; Configurable> cfVariableLength_mult_bins{"cfVariableLength_mult_bins", {0., 5., 6., 7., 8., 9., 100., 200., 500., 1000., 10000.}, "variable-length multiplicity bins"}; Configurable cfUseVariableLength_cent_bins{"cfUseVariableLength_cent_bins", false, "use or not variable-length centrality bins"}; @@ -193,7 +254,14 @@ struct : ConfigurableGroup { Configurable cfUseVariableLength_pt_bins{"cfUseVariableLength_pt_bins", false, "use or not variable-length pt bins"}; Configurable> cfVariableLength_pt_bins{"cfVariableLength_pt_bins", {0.20, 0.30, 0.40, 0.65, 1.00, 2.00, 5.00}, "variable-length pt bins"}; Configurable cfUseVariableLength_eta_bins{"cfUseVariableLength_eta_bins", false, "use or not variable-length eta bins"}; - Configurable> cfVariableLength_eta_bins{"cfVariableLength_eta_bins", {3.0, -1.0, -0.4, 0.0, 0.4, 1.0, 3.0}, "variable-length eta bins"}; + Configurable> cfVariableLength_eta_bins{"cfVariableLength_eta_bins", {-0.8, 0.0, 0.3, 0.8}, "variable-length eta bins"}; + Configurable cfUseVariableLength_occu_bins{"cfUseVariableLength_occu_bins", false, "use or not variable-length occupancy bins"}; + Configurable> cfVariableLength_occu_bins{"cfVariableLength_occu_bins", {0., 5., 6., 7., 8., 9., 100., 200., 500., 1000., 10000.}, "variable-length occupancy bins"}; + Configurable cfUseVariableLength_ir_bins{"cfUseVariableLength_ir_bins", false, "use or not variable-length interaction rate bins"}; + Configurable> cfVariableLength_ir_bins{"cfVariableLength_ir_bins", {0., 5., 10., 50., 100., 200.}, "variable-length ineraction rate bins"}; + Configurable cfUseVariableLength_crd_bins{"cfUseVariableLength_crd_bins", false, "use or not variable-length current run duration bins"}; + Configurable> cfVariableLength_crd_bins{"cfVariableLength_crd_bins", {0., 5., 10., 50., 100., 500.}, "variable-length current run duration bins"}; + } cf_res; #endif // PWGCF_MULTIPARTICLECORRELATIONS_CORE_MUPA_CONFIGURABLES_H_ diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h index 1a257bd3946..c27345ad515 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h @@ -37,19 +37,22 @@ TProfile* fBasePro = NULL; //! 0. Set to <=0 to ignore. Bool_t fUseStopwatch = kFALSE; // do some basing profiling with TStopwatch for where the execution time is going TStopwatch* fTimer[eTimer_N] = {NULL}; // stopwatch, global (overal execution time) and local - // Bool_t fRescaleWithTheoreticalInput; // if kTRUE, all measured correlators are - // rescaled with theoretical input, so that in profiles everything is at 1. Used - // both in OTF and internal val. -} tc; // "tc" labels an instance of this group of variables. + Float_t fFloatingPointPrecision = 1.e-6; // two floats are the same if TMath::Abs(f1 - f2) < fFloatingPointPrecision (there is configurable for it) + Int_t fSequentialBailout = 0; // if fSequentialBailout > 0, then each fSequentialBailout events the function BailOut() is called. Can be used for real analysis and for IV. + Bool_t fUseSpecificCuts = kFALSE; // apply after DefaultCuts() also hardwired analysis-specific cuts, determined via tc.fWhichSpecificCuts + TString fWhichSpecificCuts = ""; // determine which set of analysis-specific cuts will be applied after DefaultCuts(). Use in combination with tc.fUseSpecificCuts +} tc; // "tc" labels an instance of this group of variables. // *) Event-by-event quantities: struct EventByEventQuantities { - Int_t fSelectedTracks = 0; // integer counter of tracks used to calculate Q-vectors, after all particle cuts have been applied - Double_t fCentrality = 0.; // event-by-event centrality. Value of the default centrality estimator, set via configurable cfCentralityEstimator -} ebye; // "ebye" is a common label for objects in this struct + Int_t fSelectedTracks = 0; // integer counter of tracks used to calculate Q-vectors, after all particle cuts have been applied + Float_t fMultiplicity = 0.; // my internal multiplicity, can be set to fSelectedTracks (calculated internally), fReferenceMultiplicity (calculated outside of my code), etc. + // Results "vs. mult" are plotted against fMultiplicity, whatever it is set to. + // Use configurable cfMultiplicityEstimator[eMultiplicityEstimator] to define what is this multiplicity, by default it is "SelectedTracks" + Float_t fReferenceMultiplicity = 0.; // reference multiplicity, calculated outside of my code. Can be "MultTPC", "MultFV0M", etc. + // Use configurable cfReferenceMultiplicityEstimator[eReferenceMultiplicityEstimator]" to define what is this multiplicity, by default it is "TBI 20241123 I do not know yet which estimator is best for ref. mult." + Float_t fCentrality = 0.; // event-by-event centrality. Value of the default centrality estimator, set via configurable cfCentralityEstimator + Float_t fOccupancy = 0.; // event-by-event occupancy. Value of the default occupancy estimator, set via configurable cfOccupancyEstimator + Float_t fInteractionRate = 0.; // event-by-event interaction rate + Float_t fCurrentRunDuration = 0.; // how many seconds after start of run this collision was taken, i.e. seconds after start of run (SOR) +} ebye; // "ebye" is a common label for objects in this struct // *) QA: // Remark 1: I keep new histograms in this group, until I need them permanently in the analysis. Then, they are moved to EventHistograms or ParticleHistograms (yes, even if they are 2D). // Remark 2: All 2D histograms book as TH2F, due to "stmem error" in terminate (see .cxx for further details) struct QualityAssurance { - TList* fQAList = NULL; //! 0. + UInt_t fnEventsInternalValidation = 0; // how many on-the-fly events will be sampled for each real event, for internal validation + TString* fHarmonicsOptionInternalValidation = NULL; // "constant" or "correlated", see .cxx for full documentation Bool_t fRescaleWithTheoreticalInput = kFALSE; // if kTRUE, all measured correlators are rescaled with theoretical input, so that in profiles everything is at 1 TArrayD* fInternalValidationVnPsin[2] = {NULL}; // 0 = { v1, v2, ... }, 1 = { Psi1, Psi2, ... } Int_t fMultRangeInternalValidation[2] = {0, 0}; // min and max values for uniform multiplicity distribution in on-the-fly analysis (convention: min <= M < max) @@ -239,15 +276,39 @@ struct InternalValidation { // *) Test0: struct Test0 { - TList* fTest0List = NULL; // list to hold all objects for Test0 - TProfile* fTest0FlagsPro = NULL; // store all flags for Test0 - Bool_t fCalculateTest0 = kFALSE; // calculate or not Test0 - TProfile* fTest0Pro[gMaxCorrelator][gMaxIndex][eAsFunctionOf_N] = {{{NULL}}}; //! [order][index][0=integrated,1=vs. multiplicity,2=vs. centrality,3=pT,4=eta] - TString* fTest0Labels[gMaxCorrelator][gMaxIndex] = {{NULL}}; // all labels: k-p'th order is stored in k-1'th index. So yes, I also store 1-p - Bool_t fCalculateTest0AsFunctionOf[eAsFunctionOf_N] = {true, true, true, false, false}; //! [0=integrated,1=vs. multiplicity,2=vs. centrality,3=pT,4=eta] - TString fFileWithLabels = ""; // path to external ROOT file which specifies all labels of interest - TH1I* fTest0LabelsPlaceholder = NULL; // store all Test0 labels in this histogram -} t0; // "t0" labels an instance of this group of histograms + TList* fTest0List = NULL; // list to hold all objects for Test0 + TProfile* fTest0FlagsPro = NULL; // store all flags for Test0 + Bool_t fCalculateTest0 = kFALSE; // calculate or not Test0 + TProfile* fTest0Pro[gMaxCorrelator][gMaxIndex][eAsFunctionOf_N] = {{{NULL}}}; //! [order][index][0=integrated,1=vs. multiplicity,2=vs. centrality,3=pT,4=eta] + TString* fTest0Labels[gMaxCorrelator][gMaxIndex] = {{NULL}}; // all labels: k-p'th order is stored in k-1'th index. So yes, I also store 1-p + Bool_t fCalculateTest0AsFunctionOf[eAsFunctionOf_N] = {false}; //! [0=integrated,1=vs. multiplicity,2=vs. centrality,3=pT,4=eta,5=vs. occupancy, ...] + TString fFileWithLabels = ""; // path to external ROOT file which specifies all labels of interest + Bool_t fUseDefaultLabels = kFALSE; // use default labels hardwired in GetDefaultObjArrayWithLabels(), the choice is made with cfWhichDefaultLabels + TString fWhichDefaultLabels = ""; // only for testing purposes, select one set of default labels, see GetDefaultObjArrayWithLabels for supported options + TH1I* fTest0LabelsPlaceholder = NULL; // store all Test0 labels in this histogram +} t0; // "t0" labels an instance of this group of histograms + +// *) Eta separations: +struct EtaSeparations { + TList* fEtaSeparationsList; // list to hold all correlations with eta separations + TProfile* fEtaSeparationsFlagsPro; // profile to hold all flags for correlations with eta separations + bool fCalculateEtaSeparations; // calculate correlations with eta separations + bool fCalculateEtaSeparationsAsFunctionOf[eAsFunctionOf_N] = {false}; //! [0=integrated,1=vs. multiplicity,2=vs. centrality,3=pT,4=eta,5=vs. occupancy, ...] + float fEtaSeparationsValues[gMaxNumberEtaSeparations] = {-1.}; // this array holds eta separation interals for which 2p correlations with eta separation will be calculated + // See the corresponding cofigurable cfEtaSeparationsValues. If entry is -1, it's ignored + bool fEtaSeparationsSkipHarmonics[gMaxHarmonic] = {false}; // For calculation of 2p correlation with eta separation these harmonics will be skipped + TProfile* fEtaSeparationsPro[gMaxHarmonic][gMaxNumberEtaSeparations][eAsFunctionOf_N]; // [harmonic, 0 = v1, 8 = v9][ different eta Separations - see that enum ] [ AFO ] +} es; + +// *) Global cosmetics: +struct GlobalCosmetics { + TString srs[2] = {"rec", "sim"}; // used in the histogram name as index when saved to the file + TString srs_long[2] = {"reconstructed", "simulated"}; // used in the histogram title + TString sba[2] = {"before", "after"}; // used in the histogram name as index when saved to the file + TString sba_long[2] = {"before cuts", "after cuts"}; // used in the histogram title + TString scc[eCutCounter_N] = {"abs", "seq"}; // used in the histogram name as index when saved to the file + TString scc_long[eCutCounter_N] = {"absolute", "sequential"}; // used in the histogram title +} gc; // *) Results: struct Results { // This is in addition also sort of "abstract" interface, which defines common binning, etc., for other groups of histograms. @@ -257,12 +318,12 @@ struct Results { // This is in addition also s TProfile* fResultsPro[eAsFunctionOf_N] = {NULL}; //! use only in Run 2 and Run 1. TBI 20240522 I stil need to validate this one over MC - eSel8, // Event selection decision based on TVX => use only in Run 3, both for data and MC - // *) As of 20240410, kNoITSROFrameBorder (only in MC) and kNoTimeFrameBorder event selection cuts are part of Sel8 => see def. of sel8 in Ref. a) - // See also email from EK from 20240410 - eCentralityEstimator, // the default centrality estimator, set via configurable. All supported centrality estimatos, for QA, etc, are in enum eCentralityEstimators - eSelectedEvents, // selected events = eNumberOfEvents + eAfter => therefore I do not need a special histogram for it - eNoSameBunchPileup, // reject collisions in case of pileup with another collision in the same foundBC (emails from IA on 20240404 and EK on 20240410) - eIsGoodZvtxFT0vsPV, // small difference between z-vertex from PV and from FT0 (emails from IA on 20240404 and EK on 20240410) - eIsVertexITSTPC, // at least one ITS-TPC track (reject vertices built from ITS-only tracks) (emails from IA on 20240404 and EK on 20240410 - eIsVertexTOFmatched, // at least one of vertex contributors is matched to TOF - eIsVertexTRDmatched, // at least one of vertex contributors is matched to TRD + // a) For available event selection bits, check https://github.com/AliceO2Group/O2Physics/blob/master/Common/CCDB/EventSelectionParams.cxx + // b) Some settings are configurable, check: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/eventSelection.cxx + eTrigger = eEventHistograms_N, // Implemented and validated so far: + // a) Run 3: "kTVXinTRD" (use optionally for systematics, and only in real data) + // b) Run 2: "kINT7" (at the moment the usage of this one is enfored in fact) + // c) Run 1: TBI 20241209 check if I can use kINT7 also for Run 1 + eSel7, // See def. of sel7 in Ref. b) above. Event selection decision based on V0A & V0C => use only in Run 2 and Run 1. TBI 20240522 I stil need to validate this one over MC + eSel8, // See def. of sel7 in Ref. b) above. Event selection decision based on TVX => use only in Run 3, both for data and MC + // *) As of 20240410, kNoITSROFrameBorder (only in MC) and kNoTimeFrameBorder event selection cuts are part of Sel8 + // See also email from EK from 2024041 + eMultiplicityEstimator, // see documentation for ebye.fMultiplicity + eReferenceMultiplicityEstimator, // see documentation for ebye.fReferenceMultiplicity + eCentralityEstimator, // the default centrality estimator, set via configurable. All supported centrality estimators, for QA, etc, are in enum eCentralityEstimators + eSelectedEvents, // selected events = eNumberOfEvents + eAfter => therefore I do not need a special histogram for it + eNoSameBunchPileup, // reject collisions in case of pileup with another collision in the same foundBC (emails from IA on 20240404 and EK on 20240410) + eIsGoodZvtxFT0vsPV, // small difference between z-vertex from PV and from FT0 (emails from IA on 20240404 and EK on 20240410) + eIsVertexITSTPC, // at least one ITS-TPC track (reject vertices built from ITS-only tracks) (emails from IA on 20240404 and EK on 20240410 + eIsVertexTOFmatched, // at least one of vertex contributors is matched to TOF + eIsVertexTRDmatched, // at least one of vertex contributors is matched to TRD + eNoCollInTimeRangeStrict, // rejects a collision if there are other events in dtime +/- 10 μs, see IA Slide 39 in https://indico.cern.ch/event/1462154/ + eNoCollInTimeRangeStandard, // rejects a collision if there are other events in dtime +/- 2 μs + additional cuts on multiplicity, see IA Slide 39 in https://indico.cern.ch/event/1462154/ + eNoCollInRofStrict, // rejects a collision if there are other events within the same ROF (in-ROF pileup), ROF = "ITS Readout Frames", see IA Slide 39 in https://indico.cern.ch/event/1462154/ + eNoCollInRofStandard, // same as previous + additional cuts on multiplicity, see IA Slide 39 in https://indico.cern.ch/event/1462154/ + eNoHighMultCollInPrevRof, // veto an event if FT0C amplitude in previous ITS ROF is above threshold (default is >5000 a.e. by FT0C), see IA Slide 39 in https://indico.cern.ch/event/1462154/ + eOccupancyEstimator, // the default Occupancy estimator, set via configurable. All supported centrality estimators, for QA, etc, are in enum eOccupancyEstimators eEventCuts_N }; enum eParticleHistograms { - // from o2::aod::Tracks: (Track parameters at collision vertex) + // from o2::aod::Tracks (Track parameters at their point closest to the collision vertex) ePhi = 0, ePt, eEta, @@ -175,10 +194,13 @@ enum eParticleCuts { enum eAsFunctionOf { AFO_INTEGRATED = 0, - AFO_MULTIPLICITY = 1, // vs. default multiplicity, which is (at the moment) fSelectedTracks, i.e. number of tracks in Q-vector - AFO_CENTRALITY = 2, // vs. default centrality estimator, see how it's calculated in DetermineCentrality(...) - AFO_PT = 3, - AFO_ETA = 4, + AFO_MULTIPLICITY, // vs. default multiplicity, which is (at the moment) fSelectedTracks, i.e. number of tracks in Q-vector + AFO_CENTRALITY, // vs. default centrality estimator, see how it's calculated in DetermineCentrality(...) + AFO_PT, + AFO_ETA, + AFO_OCCUPANCY, // vs. default "occupancy" variable which is (at the moment) "FT0COccupancyInTimeRange" (alternative is "TrackOccupancyInTimeRange") + AFO_INTERACTIONRATE, // vs. "interation rate" + AFO_CURRENTRUNDURATION, // vs. "current run duration", i.e. vs "seconds since start of run" eAsFunctionOf_N }; // prefix is needed, to avoid conflict with enum eKinematics @@ -201,7 +223,7 @@ enum eTimer { eTimer_N }; -enum eEventCounter { +enum eEventCounterForDryRun { eFill = 0, ePrint }; @@ -220,15 +242,31 @@ enum eCutCounter { }; enum eQAEventHistograms2D { - // Common: - eMultTPC_vs_NContributors = 0, - eVertex_z_vs_MultTPC, - eVertex_z_vs_NContributors, - // Run 3: - eCentFT0M_vs_CentNTPV, - // Run 2 (do not use in Run 1 converted, because there is no centrality information): - eCentRun2V0M_vs_CentRun2SPDTracklets, - eCentRun2V0M_vs_NContributors, + // General (estimators can be chosen via configurables): + eMultiplicity_vs_ReferenceMultiplicity = 0, // multiplicity is x, reference multiplicity is y. I can swap offline if needed: histOriginal->GetBinContent(x,y); histSwapped->Fill(y,x); + eMultiplicity_vs_NContributors, + eMultiplicity_vs_Centrality, + eMultiplicity_vs_Vertex_z, + eMultiplicity_vs_Occupancy, + eReferenceMultiplicity_vs_NContributors, + eReferenceMultiplicity_vs_Centrality, + eReferenceMultiplicity_vs_Vertex_z, + eReferenceMultiplicity_vs_Occupancy, + eNContributors_vs_Centrality, + eNContributors_vs_Vertex_z, + eNContributors_vs_Occupancy, + eCentrality_vs_Vertex_z, + eCentrality_vs_Occupancy, + eCentrality_vs_ImpactParameter, // [sim] = reconstructed centrality vs. simulated impact parameter. [rec] = ... TBI 20241210 + eVertex_z_vs_Occupancy, + // ... + // Specific (everything is hardwired): + eMultNTracksPV_vs_MultNTracksGlobal, // Run 3 multiplicity + eCentFT0C_vs_CentNTPV, // Run 3 centrality + eCentFT0M_vs_CentNTPV, // Run 3 centrality + eCentRun2V0M_vs_CentRun2SPDTracklets, // Run 2 centrality (do not use in Run 1 converted, because there is no centrality information) + eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange, + eCurrentRunDuration_vs_InteractionRate, // ... eQAEventHistograms2D_N }; @@ -237,9 +275,23 @@ enum eQAParticleHistograms2D { eQAParticleHistograms2D_N }; +enum eReferenceMultiplicityEstimators { + // Run 3: + eMultTPC = 0, + eMultFV0M, // ref. mult from helper task o2-analysis-multiplicity-table + eMultFT0C, // ref. mult from helper task o2-analysis-multiplicity-table + eMultFT0M, // ref. mult from helper task o2-analysis-multiplicity-table + eMultNTracksPV, // ref. mult from helper task o2-analysis-multiplicity-table + eMultNTracksGlobal, // ref. mult from helper task o2-analysis-multiplicity-table + // Run 2: + eMultTracklets, // ref. mult from helper task o2-analysis-multiplicity-table, use only for Run 2 + eReferenceMultiplicityEstimators_N +}; + enum eCentralityEstimators { // Run 3: - eCentFT0M = 0, + eCentFT0C = 0, + eCentFT0M, eCentFV0A, eCentNTPV, // Run 2: @@ -248,4 +300,28 @@ enum eCentralityEstimators { eCentralityEstimators_N }; +enum eOccupancyEstimators { + eTrackOccupancyInTimeRange, // from helper task o2-analysis-event-selection, see also IA's presentation in https://indico.cern.ch/event/1464946, slide 38 + eFT0COccupancyInTimeRange, // from helper task o2-analysis-event-selection + eOccupancyEstimators_N +}; + +enum eEventCounter { + eTotal, // total number of events, before any cuts are applied + eProcessed, // number of processed events, i.e. number of events which survived cuts and on which analysis have been performed + eEventCounter_N +}; + +enum eSpecificCuts { + eLHC23zzh, + eSpecificCuts_N +}; + +enum eRunTime { + eStartOfRun = 0, // in abs. seconds since Unix epoch + eEndOfRun, // in abs. seconds since Unix epoch + eDurationInSec, // in seconds + eRunTime_N +}; + #endif // PWGCF_MULTIPARTICLECORRELATIONS_CORE_MUPA_ENUMS_H_ diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-GlobalConstants.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-GlobalConstants.h index b7cc29c4232..c62ffeaf6c8 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-GlobalConstants.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-GlobalConstants.h @@ -14,8 +14,9 @@ const Int_t gMaxCorrelator = 12; const Int_t gMaxHarmonic = 9; -const Int_t gMaxIndex = 300; // per order, used only in Test0 -const Int_t gMaxNoBinsKine = 1000; // max number of bins for differential q-vector -const Int_t fMaxBinsDiffWeights = 100; // max number of bins for differential weights, see MakeWeights.C +const Int_t gMaxIndex = 300; // per order, used only in Test0 +const Int_t gMaxNoBinsKine = 1000; // max number of bins for differential q-vector +const Int_t gMaxBinsDiffWeights = 100; // max number of bins for differential weights, see MakeWeights.C +const Int_t gMaxNumberEtaSeparations = 9; // max number of different eta separations used to calculated 2p corr. with eta separations #endif // PWGCF_MULTIPARTICLECORRELATIONS_CORE_MUPA_GLOBALCONSTANTS_H_ diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h index 2d11e225513..869acf1d44b 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h @@ -20,64 +20,92 @@ void BookBaseList() { - // ... + // Book base TList and store task configuration. + + // a) Book base TList; + // b) Store task configuration. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } + // a) Book base TList: TList* temp = new TList(); temp->SetOwner(kTRUE); fBaseList.setObject(temp); - // fBaseList.object->SetName("4444"); - fBasePro = new TProfile("fBasePro", "flags for the whole analysis", eConfiguration_N, 0.5, 0.5 + static_cast(eConfiguration_N)); + // b) Store task configuration: + fBasePro = new TProfile("fBasePro", "flags for the whole analysis", eConfiguration_N - 1, 0.5, static_cast(eConfiguration_N) - 0.5); + // yes, eConfiguration_N - 1 and -0.5, because eConfiguration kicks off from 1 fBasePro->SetStats(kFALSE); fBasePro->SetLineColor(eColor); fBasePro->SetFillColor(eFillColor); // Remark: If I want to change the ordering of bin labels, simply change the // ordering in enum eConfiguration { ... }, nothing needs to be changed here. + fBasePro->GetXaxis()->SetBinLabel(eTaskIsConfiguredFromJson, Form("fTaskIsConfiguredFromJson = %s", tc.fTaskIsConfiguredFromJson.Data())); + fBasePro->GetXaxis()->SetBinLabel(eTaskName, Form("fTaskName = %s", tc.fTaskName.Data())); fBasePro->GetXaxis()->SetBinLabel(eRunNumber, Form("fRunNumber = %s", "__RUN_NUMBER__")); // I have to do it this way via placeholder, because run number is available only when i start to process data. - // Then, I replace placeholder with run number in DetermineAndPropagateRunNumber(T const& collision) + // Then, I replace placeholder with run number in PropagateRunNumber(...) fBasePro->GetXaxis()->SetBinLabel(eDryRun, "fDryRun"); - fBasePro->Fill(eDryRun, static_cast(tc.fDryRun)); + fBasePro->Fill(eDryRun, static_cast(tc.fDryRun)); fBasePro->GetXaxis()->SetBinLabel(eVerbose, "fVerbose"); - fBasePro->Fill(eVerbose, static_cast(tc.fVerbose)); + fBasePro->Fill(eVerbose, static_cast(tc.fVerbose)); + + fBasePro->GetXaxis()->SetBinLabel(eVerboseUtility, "fVerboseUtility"); + fBasePro->Fill(eVerboseUtility, static_cast(tc.fVerboseUtility)); fBasePro->GetXaxis()->SetBinLabel(eVerboseForEachParticle, "fVerboseForEachParticle"); - fBasePro->Fill(eVerboseForEachParticle, static_cast(tc.fVerboseForEachParticle)); + fBasePro->Fill(eVerboseForEachParticle, static_cast(tc.fVerboseForEachParticle)); + + fBasePro->GetXaxis()->SetBinLabel(eVerboseEventCounter, "fVerboseEventCounter"); + fBasePro->Fill(eVerboseEventCounter, static_cast(tc.fVerboseEventCounter)); + + fBasePro->GetXaxis()->SetBinLabel(ePlainPrintout, "fPlainPrintout"); + fBasePro->Fill(ePlainPrintout, static_cast(tc.fPlainPrintout)); fBasePro->GetXaxis()->SetBinLabel(eDoAdditionalInsanityChecks, "fDoAdditionalInsanityChecks"); - fBasePro->Fill(eDoAdditionalInsanityChecks, static_cast(tc.fDoAdditionalInsanityChecks)); + fBasePro->Fill(eDoAdditionalInsanityChecks, static_cast(tc.fDoAdditionalInsanityChecks)); fBasePro->GetXaxis()->SetBinLabel(eInsanityCheckForEachParticle, "fInsanityCheckForEachParticle"); - fBasePro->Fill(eInsanityCheckForEachParticle, static_cast(tc.fInsanityCheckForEachParticle)); - - fBasePro->GetXaxis()->SetBinLabel(eUseCCDB, "fUseCCDB"); - fBasePro->Fill(eUseCCDB, static_cast(tc.fUseCCDB)); + fBasePro->Fill(eInsanityCheckForEachParticle, static_cast(tc.fInsanityCheckForEachParticle)); fBasePro->GetXaxis()->SetBinLabel(eWhichProcess, Form("WhichProcess = %s", tc.fWhichProcess.Data())); fBasePro->GetXaxis()->SetBinLabel(eRandomSeed, "fRandomSeed"); - fBasePro->Fill(eRandomSeed, static_cast(tc.fRandomSeed)); + fBasePro->Fill(eRandomSeed, static_cast(tc.fRandomSeed)); fBasePro->GetXaxis()->SetBinLabel(eUseFisherYates, "fUseFisherYates"); - fBasePro->Fill(eUseFisherYates, static_cast(tc.fUseFisherYates)); + fBasePro->Fill(eUseFisherYates, static_cast(tc.fUseFisherYates)); fBasePro->GetXaxis()->SetBinLabel(eFixedNumberOfRandomlySelectedTracks, "fFixedNumberOfRandomlySelectedTracks"); fBasePro->Fill(eFixedNumberOfRandomlySelectedTracks, static_cast(tc.fFixedNumberOfRandomlySelectedTracks)); fBasePro->GetXaxis()->SetBinLabel(eUseStopwatch, "fUseStopwatch"); - fBasePro->Fill(eUseStopwatch, static_cast(tc.fUseStopwatch)); + fBasePro->Fill(eUseStopwatch, static_cast(tc.fUseStopwatch)); + + fBasePro->GetXaxis()->SetBinLabel(eFloatingPointPrecision, "fFloatingPointPrecision"); + fBasePro->Fill(eFloatingPointPrecision, tc.fFloatingPointPrecision); + + fBasePro->GetXaxis()->SetBinLabel(eSequentialBailout, "fSequentialBailout"); + fBasePro->Fill(eSequentialBailout, static_cast(tc.fSequentialBailout)); + + fBasePro->GetXaxis()->SetBinLabel(eUseSpecificCuts, "fUseSpecificCuts"); + fBasePro->Fill(eUseSpecificCuts, static_cast(tc.fUseSpecificCuts)); + + fBasePro->GetXaxis()->SetBinLabel(eWhichSpecificCuts, Form("WhichSpecificCuts = %s", tc.fWhichSpecificCuts.Data())); fBaseList->Add(fBasePro); + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookBaseList() //============================================================ @@ -112,15 +140,18 @@ void DefaultConfiguration() // *) Therefore, wrap up all data members in some struct fields + use in instead of individual configurables ConfigurableGroup whenever possible. // *) Within a given struct field, number of data members do not add to that number. Also, number of enum fields do not add. + tc.fTaskIsConfiguredFromJson = TString(cf_tc.cfTaskIsConfiguredFromJson); tc.fTaskName = TString(cf_tc.cfTaskName); tc.fDryRun = cf_tc.cfDryRun; tc.fVerbose = cf_tc.cfVerbose; if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // yes, here + StartFunction(__FUNCTION__); // yes, here } + tc.fVerboseUtility = cf_tc.cfVerboseUtility; tc.fVerboseForEachParticle = cf_tc.cfVerboseForEachParticle; + tc.fVerboseEventCounter = cf_tc.cfVerboseEventCounter; + tc.fPlainPrintout = cf_tc.cfPlainPrintout; tc.fDoAdditionalInsanityChecks = cf_tc.cfDoAdditionalInsanityChecks; - tc.fUseCCDB = cf_tc.cfUseCCDB; // Set automatically what to process, from an implicit variable "doprocessSomeProcessName" within a PROCESS_SWITCH clause: tc.fProcess[eProcessRec] = doprocessRec; tc.fProcess[eProcessRecSim] = doprocessRecSim; @@ -186,22 +217,28 @@ void DefaultConfiguration() tc.fUseFisherYates = cf_tc.cfUseFisherYates; tc.fFixedNumberOfRandomlySelectedTracks = cf_tc.cfFixedNumberOfRandomlySelectedTracks; tc.fUseStopwatch = cf_tc.cfUseStopwatch; + tc.fFloatingPointPrecision = cf_tc.cfFloatingPointPrecision; + tc.fSequentialBailout = cf_tc.cfSequentialBailout; + tc.fUseSpecificCuts = cf_tc.cfUseSpecificCuts; + tc.fWhichSpecificCuts = cf_tc.cfWhichSpecificCuts; - // *) Event histograms: + // *) Event histograms (for QA see below): eh.fEventHistogramsName[eNumberOfEvents] = "NumberOfEvents"; eh.fEventHistogramsName[eTotalMultiplicity] = "TotalMultiplicity"; - eh.fEventHistogramsName[eSelectedTracks] = "SelectedTracks"; - eh.fEventHistogramsName[eMultFV0M] = "MultFV0M"; - eh.fEventHistogramsName[eMultFT0M] = "MultFT0M"; - eh.fEventHistogramsName[eMultTPC] = "MultTPC"; - eh.fEventHistogramsName[eMultNTracksPV] = "MultNTracksPV"; - eh.fEventHistogramsName[eMultTracklets] = "MultTracklets"; + eh.fEventHistogramsName[eMultiplicity] = "Multiplicity"; + eh.fEventHistogramsName[eReferenceMultiplicity] = "ReferenceMultiplicity"; eh.fEventHistogramsName[eCentrality] = "Centrality"; eh.fEventHistogramsName[eVertex_x] = "Vertex_x"; eh.fEventHistogramsName[eVertex_y] = "Vertex_y"; eh.fEventHistogramsName[eVertex_z] = "Vertex_z"; eh.fEventHistogramsName[eNContributors] = "NContributors"; eh.fEventHistogramsName[eImpactParameter] = "ImpactParameter"; + eh.fEventHistogramsName[eEventPlaneAngle] = "EventPlaneAngle"; + eh.fEventHistogramsName[eOccupancy] = "Occupancy"; + eh.fEventHistogramsName[eInteractionRate] = "InteractionRate"; + eh.fEventHistogramsName[eCurrentRunDuration] = "CurrentRunDuration"; + eh.fEventHistogramsName[eMultMCNParticlesEta08] = "MultMCNParticlesEta08"; + for (Int_t t = 0; t < eEventHistograms_N; t++) { if (eh.fEventHistogramsName[t].EqualTo("")) { LOGF(fatal, "\033[1;31m%s at line %d : name of fEventHistogramsName[%d] is not set \033[0m", __FUNCTION__, __LINE__, static_cast(t)); @@ -216,35 +253,44 @@ void DefaultConfiguration() // Set names of all event cuts: ec.fEventCutName[eNumberOfEvents] = "NumberOfEvents"; ec.fEventCutName[eTotalMultiplicity] = "TotalMultiplicity"; - ec.fEventCutName[eSelectedTracks] = "SelectedTracks"; - ec.fEventCutName[eMultFV0M] = "MultFV0M"; - ec.fEventCutName[eMultFT0M] = "MultFT0M"; - ec.fEventCutName[eMultTPC] = "MultTPC"; - ec.fEventCutName[eMultNTracksPV] = "MultNTracksPV"; - ec.fEventCutName[eMultTracklets] = "MultTracklets"; + ec.fEventCutName[eMultiplicity] = "Multiplicity"; + ec.fEventCutName[eReferenceMultiplicity] = "ReferenceMultiplicity"; ec.fEventCutName[eCentrality] = "Centrality"; ec.fEventCutName[eVertex_x] = "Vertex_x"; ec.fEventCutName[eVertex_y] = "Vertex_y"; ec.fEventCutName[eVertex_z] = "Vertex_z"; ec.fEventCutName[eNContributors] = "NContributors"; ec.fEventCutName[eImpactParameter] = "ImpactParameter"; + ec.fEventCutName[eEventPlaneAngle] = "EventPlaneAngle"; + ec.fEventCutName[eOccupancy] = "Occupancy"; + ec.fEventCutName[eInteractionRate] = "InteractionRate"; + ec.fEventCutName[eCurrentRunDuration] = "CurrentRunDuration"; + ec.fEventCutName[eMultMCNParticlesEta08] = "MultMCNParticlesEta08"; ec.fEventCutName[eTrigger] = "Trigger"; ec.fEventCutName[eSel7] = "Sel7"; ec.fEventCutName[eSel8] = "Sel8"; ec.fEventCutName[eCentralityEstimator] = "CentralityEstimator"; + ec.fEventCutName[eMultiplicityEstimator] = "MultiplicityEstimator"; + ec.fEventCutName[eReferenceMultiplicityEstimator] = "ReferenceMultiplicityEstimator"; ec.fEventCutName[eSelectedEvents] = "SelectedEvents"; ec.fEventCutName[eNoSameBunchPileup] = "NoSameBunchPileup"; ec.fEventCutName[eIsGoodZvtxFT0vsPV] = "IsGoodZvtxFT0vsPV"; ec.fEventCutName[eIsVertexITSTPC] = "IsVertexITSTPC"; ec.fEventCutName[eIsVertexTOFmatched] = "IsVertexTOFmatched"; ec.fEventCutName[eIsVertexTRDmatched] = "IsVertexTRDmatched"; + ec.fEventCutName[eNoCollInTimeRangeStrict] = "NoCollInTimeRangeStrict"; + ec.fEventCutName[eNoCollInTimeRangeStandard] = "NoCollInTimeRangeStandard"; + ec.fEventCutName[eNoCollInRofStrict] = "NoCollInRofStrict"; + ec.fEventCutName[eNoCollInRofStandard] = "NoCollInRofStandard"; + ec.fEventCutName[eNoHighMultCollInPrevRof] = "NoHighMultCollInPrevRof"; + ec.fEventCutName[eOccupancyEstimator] = "OccupancyEstimator"; for (Int_t t = 0; t < eEventCuts_N; t++) { if (ec.fEventCutName[t].EqualTo("")) { LOGF(fatal, "\033[1;31m%s at line %d : event cut name is not set for ec.fEventCutName[%d]. The last cut name which was set is \"%s\" \033[0m", __FUNCTION__, __LINE__, t, ec.fEventCutName[t - 1].Data()); } } - // *) Particle histograms 1D: + // *) Particle histograms 1D (for QA see below): ph.fParticleHistogramsName[ePhi] = "Phi"; ph.fParticleHistogramsName[ePt] = "Pt"; ph.fParticleHistogramsName[eEta] = "Eta"; @@ -267,7 +313,7 @@ void DefaultConfiguration() } } - // *) Particle histograms 2D: + // *) Particle histograms 2D (for QA see below): ph.fParticleHistogramsName2D[ePhiPt] = Form("%s_vs_%s", ph.fParticleHistogramsName[ePhi].Data(), ph.fParticleHistogramsName[ePt].Data()), ph.fParticleHistogramsName2D[ePhiEta] = Form("%s_vs_%s", ph.fParticleHistogramsName[ePhi].Data(), ph.fParticleHistogramsName[eEta].Data()); for (Int_t t = 0; t < eParticleHistograms2D_N; t++) { @@ -315,23 +361,30 @@ void DefaultConfiguration() // *) Multiparticle correlations: mupa.fCalculateCorrelations = cf_mupa.cfCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_INTEGRATED] = cf_mupa.cfCalculateCorrelationsAsFunctionOfIntegrated && mupa.fCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_MULTIPLICITY] = cf_mupa.cfCalculateCorrelationsAsFunctionOfMultiplicity && mupa.fCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_CENTRALITY] = cf_mupa.cfCalculateCorrelationsAsFunctionOfCentrality && mupa.fCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT] = cf_mupa.cfCalculateCorrelationsAsFunctionOfPt && mupa.fCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA] = cf_mupa.cfCalculateCorrelationsAsFunctionOfEta && mupa.fCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_OCCUPANCY] = cf_mupa.cfCalculateCorrelationsAsFunctionOfOccupancy && mupa.fCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_INTERACTIONRATE] = cf_mupa.cfCalculateCorrelationsAsFunctionOfInteractionRate && mupa.fCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_CURRENTRUNDURATION] = cf_mupa.cfCalculateCorrelationsAsFunctionOfCurrentRunDuration && mupa.fCalculateCorrelations; // *) Test0: - // TBI 20250506 Implemented this way, I miss possibility to switch off all Test0 flags in one go. Re-think if i really need that. - t0.fCalculateTest0 = cf_t0.cfCalculateTest0; // + see below, how it's automatically set via other Test0 flags - t0.fCalculateTest0AsFunctionOf[AFO_INTEGRATED] = cf_t0.cfCalculateTest0AsFunctionOfIntegrated; - t0.fCalculateTest0AsFunctionOf[AFO_MULTIPLICITY] = cf_t0.cfCalculateTest0AsFunctionOfMultiplicity; - t0.fCalculateTest0AsFunctionOf[AFO_CENTRALITY] = cf_t0.cfCalculateTest0AsFunctionOfCentrality; - t0.fCalculateTest0AsFunctionOf[AFO_PT] = cf_t0.cfCalculateTest0AsFunctionOfPt; - t0.fCalculateTest0AsFunctionOf[AFO_ETA] = cf_t0.cfCalculateTest0AsFunctionOfEta; - // Use above Test0 flags to automatically set the main Test0 flag: TBI 20240521 do I really want to do it this way? - for (Int_t v = 0; v < eAsFunctionOf_N; v++) { - if (t0.fCalculateTest0AsFunctionOf[v]) { - t0.fCalculateTest0 = true; - break; // yes, it suffices one diff. flag to be true, for the main Test0 flag to be true - } + t0.fCalculateTest0 = cf_t0.cfCalculateTest0; + t0.fCalculateTest0AsFunctionOf[AFO_INTEGRATED] = cf_t0.cfCalculateTest0AsFunctionOfIntegrated && t0.fCalculateTest0; + t0.fCalculateTest0AsFunctionOf[AFO_MULTIPLICITY] = cf_t0.cfCalculateTest0AsFunctionOfMultiplicity && t0.fCalculateTest0; + t0.fCalculateTest0AsFunctionOf[AFO_CENTRALITY] = cf_t0.cfCalculateTest0AsFunctionOfCentrality && t0.fCalculateTest0; + t0.fCalculateTest0AsFunctionOf[AFO_PT] = cf_t0.cfCalculateTest0AsFunctionOfPt && t0.fCalculateTest0; + t0.fCalculateTest0AsFunctionOf[AFO_ETA] = cf_t0.cfCalculateTest0AsFunctionOfEta && t0.fCalculateTest0; + t0.fCalculateTest0AsFunctionOf[AFO_OCCUPANCY] = cf_t0.cfCalculateTest0AsFunctionOfOccupancy && t0.fCalculateTest0; + t0.fCalculateTest0AsFunctionOf[AFO_INTERACTIONRATE] = cf_t0.cfCalculateTest0AsFunctionOfInteractionRate && t0.fCalculateTest0; + t0.fCalculateTest0AsFunctionOf[AFO_CURRENTRUNDURATION] = cf_t0.cfCalculateTest0AsFunctionOfCurrentRunDuration && t0.fCalculateTest0; + if (t0.fCalculateTest0) { + t0.fFileWithLabels = TString(cf_t0.cfFileWithLabels); + t0.fUseDefaultLabels = cf_t0.cfUseDefaultLabels; + t0.fWhichDefaultLabels = TString(cf_t0.cfWhichDefaultLabels); } - t0.fFileWithLabels = TString(cf_t0.cfFileWithLabels); // *) Particle weights: pw.fUseWeights[wPHI] = cf_pw.cfUsePhiWeights; @@ -341,6 +394,10 @@ void DefaultConfiguration() pw.fUseDiffWeights[wPHIETA] = cf_pw.cfUseDiffPhiEtaWeights; pw.fFileWithWeights = cf_pw.cfFileWithWeights; + // *) Centrality weights: + cw.fUseCentralityWeights = cf_cw.cfUseCentralityWeights; + cw.fFileWithCentralityWeights = cf_cw.cfFileWithCentralityWeights; + // ... // *) Nested loops: @@ -387,6 +444,7 @@ void DefaultConfiguration() // *) histogram names with custom NUA distributions in that file + get those histograms immediately here: auto lCustomNUAPDFHistNames = (vector)cf_nua.cfCustomNUAPDFHistNames; + // TBI 20241115 For some reason, the default values of configurable "cfCustomNUAPDFHistNames" are not correctly propagated in the local variables, but I can circumvent that with JSON settings for the time being if (lCustomNUAPDFHistNames.size() != eNUAPDF_N) { LOGF(info, "\033[1;31m lCustomNUAPDFHistNames.size() = %d\033[0m", lCustomNUAPDFHistNames.size()); LOGF(info, "\033[1;31m eNUAPDF_N = %d\033[0m", static_cast(eNUAPDF_N)); @@ -426,26 +484,77 @@ void DefaultConfiguration() iv.fRescaleWithTheoreticalInput = cf_iv.cfRescaleWithTheoreticalInput; // *) Results histograms: + // Define axis titles: + // Remark: keep ordering in sync with enum eAsFunctionOf + res.fResultsProXaxisTitle[AFO_INTEGRATED] = "integrated"; + res.fResultsProRawName[AFO_INTEGRATED] = "int"; // this is how it appears simplified in the hist name when saved to the file + res.fResultsProXaxisTitle[AFO_MULTIPLICITY] = "multiplicity"; + res.fResultsProRawName[AFO_MULTIPLICITY] = "mult"; + res.fResultsProXaxisTitle[AFO_CENTRALITY] = "centrality"; + res.fResultsProRawName[AFO_CENTRALITY] = "cent"; + res.fResultsProXaxisTitle[AFO_PT] = "pt"; + res.fResultsProRawName[AFO_PT] = "pt"; + res.fResultsProXaxisTitle[AFO_ETA] = "eta"; + res.fResultsProRawName[AFO_ETA] = "eta"; + res.fResultsProXaxisTitle[AFO_OCCUPANCY] = "occupancy"; + res.fResultsProRawName[AFO_OCCUPANCY] = "occu"; + res.fResultsProXaxisTitle[AFO_INTERACTIONRATE] = "interaction rate"; + res.fResultsProRawName[AFO_INTERACTIONRATE] = "ir"; + res.fResultsProXaxisTitle[AFO_CURRENTRUNDURATION] = "current run duration"; + res.fResultsProRawName[AFO_CURRENTRUNDURATION] = "crd"; + res.fSaveResultsHistograms = cf_res.cfSaveResultsHistograms; // *) QA: // Remark: I keep it on the bottom, because here I define some names in temrs of names defined above. qa.fCheckUnderflowAndOverflow = cf_qa.cfCheckUnderflowAndOverflow; + qa.fRebin = cf_qa.cfRebin; + + // **) Reference multiplicity estimators: + qa.fReferenceMultiplicityEstimatorName[eMultTPC] = "MultTPC"; + qa.fReferenceMultiplicityEstimatorName[eMultFV0M] = "MultFV0M"; + qa.fReferenceMultiplicityEstimatorName[eMultFT0C] = "MultFT0C"; + qa.fReferenceMultiplicityEstimatorName[eMultFT0M] = "MultFT0M"; + qa.fReferenceMultiplicityEstimatorName[eMultNTracksPV] = "MultNTracksPV"; + qa.fReferenceMultiplicityEstimatorName[eMultNTracksGlobal] = "MultNTracksGlobal"; + qa.fReferenceMultiplicityEstimatorName[eMultTracklets] = "MultTracklets"; // **) Centrality estimators: + qa.fCentralityEstimatorName[eCentFT0C] = "CentFT0C"; qa.fCentralityEstimatorName[eCentFT0M] = "CentFT0M"; qa.fCentralityEstimatorName[eCentFV0A] = "CentFV0A"; qa.fCentralityEstimatorName[eCentNTPV] = "CentNTPV"; qa.fCentralityEstimatorName[eCentRun2V0M] = "CentRun2V0M"; qa.fCentralityEstimatorName[eCentRun2SPDTracklets] = "CentRun2SPDTracklets"; - // **) Names of 2D event histograms: - qa.fEventHistogramsName2D[eMultTPC_vs_NContributors] = Form("%s_vs_%s", eh.fEventHistogramsName[eMultTPC].Data(), eh.fEventHistogramsName[eNContributors].Data()); - qa.fEventHistogramsName2D[eVertex_z_vs_MultTPC] = Form("%s_vs_%s", eh.fEventHistogramsName[eVertex_z].Data(), eh.fEventHistogramsName[eMultTPC].Data()); - qa.fEventHistogramsName2D[eVertex_z_vs_NContributors] = Form("%s_vs_%s", eh.fEventHistogramsName[eVertex_z].Data(), eh.fEventHistogramsName[eNContributors].Data()); + // **) Occupancy estimators: + qa.fOccupancyEstimatorName[eTrackOccupancyInTimeRange] = "TrackOccupancyInTimeRange"; + qa.fOccupancyEstimatorName[eFT0COccupancyInTimeRange] = "FT0COccupancyInTimeRange"; + + // **) Names of QA 2D event histograms: + // Remark: Do NOT use FancyFormatting here, only later in BookQAHistograms() for axis titles! + qa.fEventHistogramsName2D[eMultiplicity_vs_ReferenceMultiplicity] = Form("%s_vs_%s", eh.fEventHistogramsName[eMultiplicity].Data(), eh.fEventHistogramsName[eReferenceMultiplicity].Data()); + qa.fEventHistogramsName2D[eMultiplicity_vs_NContributors] = Form("%s_vs_%s", eh.fEventHistogramsName[eMultiplicity].Data(), eh.fEventHistogramsName[eNContributors].Data()); + qa.fEventHistogramsName2D[eMultiplicity_vs_Centrality] = Form("%s_vs_%s", eh.fEventHistogramsName[eMultiplicity].Data(), eh.fEventHistogramsName[eCentrality].Data()); + qa.fEventHistogramsName2D[eMultiplicity_vs_Vertex_z] = Form("%s_vs_%s", eh.fEventHistogramsName[eMultiplicity].Data(), eh.fEventHistogramsName[eVertex_z].Data()); + qa.fEventHistogramsName2D[eMultiplicity_vs_Occupancy] = Form("%s_vs_%s", eh.fEventHistogramsName[eMultiplicity].Data(), eh.fEventHistogramsName[eOccupancy].Data()); + qa.fEventHistogramsName2D[eReferenceMultiplicity_vs_NContributors] = Form("%s_vs_%s", eh.fEventHistogramsName[eReferenceMultiplicity].Data(), eh.fEventHistogramsName[eNContributors].Data()); + qa.fEventHistogramsName2D[eReferenceMultiplicity_vs_Centrality] = Form("%s_vs_%s", eh.fEventHistogramsName[eReferenceMultiplicity].Data(), eh.fEventHistogramsName[eCentrality].Data()); + qa.fEventHistogramsName2D[eReferenceMultiplicity_vs_Vertex_z] = Form("%s_vs_%s", eh.fEventHistogramsName[eReferenceMultiplicity].Data(), eh.fEventHistogramsName[eVertex_z].Data()); + qa.fEventHistogramsName2D[eReferenceMultiplicity_vs_Occupancy] = Form("%s_vs_%s", eh.fEventHistogramsName[eReferenceMultiplicity].Data(), eh.fEventHistogramsName[eOccupancy].Data()); + qa.fEventHistogramsName2D[eNContributors_vs_Centrality] = Form("%s_vs_%s", eh.fEventHistogramsName[eNContributors].Data(), eh.fEventHistogramsName[eCentrality].Data()); + qa.fEventHistogramsName2D[eNContributors_vs_Vertex_z] = Form("%s_vs_%s", eh.fEventHistogramsName[eNContributors].Data(), eh.fEventHistogramsName[eVertex_z].Data()); + qa.fEventHistogramsName2D[eNContributors_vs_Occupancy] = Form("%s_vs_%s", eh.fEventHistogramsName[eNContributors].Data(), eh.fEventHistogramsName[eOccupancy].Data()); + qa.fEventHistogramsName2D[eCentrality_vs_Vertex_z] = Form("%s_vs_%s", eh.fEventHistogramsName[eCentrality].Data(), eh.fEventHistogramsName[eVertex_z].Data()); + qa.fEventHistogramsName2D[eCentrality_vs_Occupancy] = Form("%s_vs_%s", eh.fEventHistogramsName[eCentrality].Data(), eh.fEventHistogramsName[eOccupancy].Data()); + qa.fEventHistogramsName2D[eCentrality_vs_ImpactParameter] = Form("%s_vs_%s", eh.fEventHistogramsName[eCentrality].Data(), eh.fEventHistogramsName[eImpactParameter].Data()); + qa.fEventHistogramsName2D[eVertex_z_vs_Occupancy] = Form("%s_vs_%s", eh.fEventHistogramsName[eVertex_z].Data(), eh.fEventHistogramsName[eOccupancy].Data()); + qa.fEventHistogramsName2D[eMultNTracksPV_vs_MultNTracksGlobal] = Form("%s_vs_%s", qa.fReferenceMultiplicityEstimatorName[eMultNTracksPV].Data(), qa.fReferenceMultiplicityEstimatorName[eMultNTracksGlobal].Data()); + qa.fEventHistogramsName2D[eCentFT0C_vs_CentNTPV] = Form("%s_vs_%s", qa.fCentralityEstimatorName[eCentFT0C].Data(), qa.fCentralityEstimatorName[eCentNTPV].Data()); qa.fEventHistogramsName2D[eCentFT0M_vs_CentNTPV] = Form("%s_vs_%s", qa.fCentralityEstimatorName[eCentFT0M].Data(), qa.fCentralityEstimatorName[eCentNTPV].Data()); qa.fEventHistogramsName2D[eCentRun2V0M_vs_CentRun2SPDTracklets] = Form("%s_vs_%s", qa.fCentralityEstimatorName[eCentRun2V0M].Data(), qa.fCentralityEstimatorName[eCentRun2SPDTracklets].Data()); - qa.fEventHistogramsName2D[eCentRun2V0M_vs_NContributors] = Form("%s_vs_%s", qa.fCentralityEstimatorName[eCentRun2V0M].Data(), eh.fEventHistogramsName[eNContributors].Data()); + qa.fEventHistogramsName2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = Form("%s_vs_%s", qa.fOccupancyEstimatorName[eTrackOccupancyInTimeRange].Data(), qa.fOccupancyEstimatorName[eFT0COccupancyInTimeRange].Data()); + qa.fEventHistogramsName2D[eCurrentRunDuration_vs_InteractionRate] = Form("%s_vs_%s", ec.fEventCutName[eCurrentRunDuration].Data(), ec.fEventCutName[eInteractionRate].Data()); // ***) Quick insanity check that all names are set: for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) { @@ -454,7 +563,7 @@ void DefaultConfiguration() } } - // **) Names of 2D particle histograms: + // **) Names of QA 2D particle histograms: qa.fParticleHistogramsName2D[ePt_vs_dcaXY] = Form("%s_vs_%s", ph.fParticleHistogramsName[ePt].Data(), ph.fParticleHistogramsName[edcaXY].Data()); // ***) Quick insanity check that all names are set: @@ -464,21 +573,65 @@ void DefaultConfiguration() } } + // ** Eta separations: + es.fCalculateEtaSeparations = cf_es.cfCalculateEtaSeparations; + es.fCalculateEtaSeparationsAsFunctionOf[AFO_INTEGRATED] = cf_es.cfCalculateEtaSeparationsAsFunctionOfIntegrated && es.fCalculateEtaSeparations; + es.fCalculateEtaSeparationsAsFunctionOf[AFO_MULTIPLICITY] = cf_es.cfCalculateEtaSeparationsAsFunctionOfMultiplicity && es.fCalculateEtaSeparations; + es.fCalculateEtaSeparationsAsFunctionOf[AFO_CENTRALITY] = cf_es.cfCalculateEtaSeparationsAsFunctionOfCentrality && es.fCalculateEtaSeparations; + es.fCalculateEtaSeparationsAsFunctionOf[AFO_PT] = cf_es.cfCalculateEtaSeparationsAsFunctionOfPt && es.fCalculateEtaSeparations; + es.fCalculateEtaSeparationsAsFunctionOf[AFO_ETA] = false; // this one doesn't make sense in this context, obviously + es.fCalculateEtaSeparationsAsFunctionOf[AFO_OCCUPANCY] = cf_es.cfCalculateEtaSeparationsAsFunctionOfOccupancy && es.fCalculateEtaSeparations; + es.fCalculateEtaSeparationsAsFunctionOf[AFO_INTERACTIONRATE] = cf_es.cfCalculateEtaSeparationsAsFunctionOfInteractionRate && es.fCalculateEtaSeparations; + es.fCalculateEtaSeparationsAsFunctionOf[AFO_CURRENTRUNDURATION] = cf_es.cfCalculateEtaSeparationsAsFunctionOfCurrentRunDuration && es.fCalculateEtaSeparations; + + if (es.fCalculateEtaSeparations) { + auto lEtaSeparationsValues = cf_es.cfEtaSeparationsValues.value; + if (lEtaSeparationsValues.size() != gMaxNumberEtaSeparations) { + LOGF(info, "\033[1;31m%s at line %d : lEtaSeparationsValues.size() = %d\n \033[0m", __FUNCTION__, __LINE__, lEtaSeparationsValues.size()); + LOGF(fatal, "\033[1;31m%s at line %d : Provide in configurable cfEtaSeparationsValues precisely %d entries\n \033[0m", __FUNCTION__, __LINE__, static_cast(gMaxNumberEtaSeparations)); + } + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + if (lEtaSeparationsValues[e] < 0.) { + LOGF(fatal, "\033[1;31m%s at line %d : lEtaSeparationsValues[%d] = %f is not >= 0. \n \033[0m", __FUNCTION__, __LINE__, e, static_cast(lEtaSeparationsValues[e])); + } + es.fEtaSeparationsValues[e] = lEtaSeparationsValues[e]; + } + + auto lEtaSeparationsSkipHarmonics = cf_es.cfEtaSeparationsSkipHarmonics.value; + if (lEtaSeparationsSkipHarmonics.size() != gMaxHarmonic) { + LOGF(info, "\033[1;31m lEtaSeparationsSkipHarmonics.size() = %d\033[0m", lEtaSeparationsSkipHarmonics.size()); + LOGF(info, "\033[1;31m gMaxHarmonic) = %d\033[0m", static_cast(gMaxHarmonic)); + LOGF(fatal, "\033[1;31m%s at line %d : Mismatch in the number of flags in configurable cfEtaSeparationsSkipHarmonics, and max number of supported harmonics \n \033[0m", __FUNCTION__, __LINE__); + } + + for (Int_t h = 0; h < static_cast(lEtaSeparationsSkipHarmonics.size()); h++) { + es.fEtaSeparationsSkipHarmonics[h] = Alright(lEtaSeparationsSkipHarmonics[h]); + } + + } // if(es.fCalculateEtaSeparations) { + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void DefaultConfiguration() //============================================================ Bool_t Alright(TString s) { - // Simple utility function, which for a string formatted "someName-0" returns false, and for "someName-1" returns true. + // Simple utility function, which for a string formatted "0-someName" returns false, and for "1-someName" returns true. // a) Insanity check on the format; // b) Do the thing. - if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + if (tc.fVerboseUtility) { + StartFunction(__FUNCTION__); + LOGF(info, "\033[1;32m TString s = %s\033[0m", s.Data()); } + Bool_t returnValue = kFALSE; + // a) Insanity check on the format: TObjArray* oa = s.Tokenize("-"); if (!oa) { @@ -490,17 +643,22 @@ Bool_t Alright(TString s) } // b) Do the thing: - // Algorithm: I split "someName-0" with respect to "-" as a field separator, and check what is in the 2nd field. - if (TString(oa->At(1)->GetName()).EqualTo("0")) { + // Algorithm: I split "0-someName" or "1-someName" with respect to "-" as a field separator, and check what is in the 1st field. + if (TString(oa->At(0)->GetName()).EqualTo("0")) { delete oa; - return kFALSE; - } else if (TString(oa->At(1)->GetName()).EqualTo("1")) { + returnValue = kFALSE; + } else if (TString(oa->At(0)->GetName()).EqualTo("1")) { delete oa; - return kTRUE; + returnValue = kTRUE; } else { - LOGF(fatal, "\033[1;31m%s at line %d : string expected in this function must be formatted as \"someName-0\" or \"someName-1\" => s = %s\033[0m", __FUNCTION__, __LINE__, s.Data()); + LOGF(fatal, "\033[1;31m%s at line %d : string expected in this function must be formatted as \"0-someName\" or \"1-someName\" => s = %s\033[0m", __FUNCTION__, __LINE__, s.Data()); + } + + if (tc.fVerboseUtility) { + ExitFunction(__FUNCTION__); } - return kFALSE; // obsolete, but suppresses the warning + + return returnValue; } // Bool_t Alright(const char* name) @@ -517,168 +675,211 @@ void DefaultBooking() // e) QA; if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Event histograms 1D: // By default all event histograms are booked. Set this flag to kFALSE to switch off booking of all event histograms: eh.fFillEventHistograms = cf_eh.cfFillEventHistograms; - // *) By default all event histograms are booked. If you do not want particular event histogram to be booked, - // use configurable array cfBookEventHistograms, where you can specify name of the histogram accompanied with flags 1 (book) or 0 (do not book). - // Supported format: "someName-0" and "someName-1", where "-" is a field separator. - // Ordering of the flags in that array is interpreted through ordering of enums in enum eEventHistograms. - auto lBookEventHistograms = (vector)cf_eh.cfBookEventHistograms; // this is now the local version of that int array from configurable. - if (lBookEventHistograms.size() != eEventHistograms_N) { - LOGF(info, "\033[1;31m lBookEventHistograms.size() = %d\033[0m", lBookEventHistograms.size()); - LOGF(info, "\033[1;31m eEventHistograms_N) = %d\033[0m", static_cast(eEventHistograms_N)); - LOGF(fatal, "\033[1;31m%s at line %d : Mismatch in the number of flags in configurable cfBookEventHistograms, and number of entries in enum eEventHistograms \n \033[0m", __FUNCTION__, __LINE__); - } - - // *) Insanity check on the content and ordering of histogram names in the initialization in configurable cfBookEventHistograms: - // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. - for (Int_t name = 0; name < eEventHistograms_N; name++) { - // TBI 20240518 I could implement even a strickter EqualTo instead of BeginsWith, but then I need to tokenize, etc., etc. This shall be safe enough. - if (!TString(lBookEventHistograms[name]).BeginsWith(eh.fEventHistogramsName[name].Data())) { - LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookEventHistograms => name = %d, lBookEventHistograms[%d] = \"%s\", eh.fEventHistogramsName[%d] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, name, TString(lBookEventHistograms[name]).Data(), name, eh.fEventHistogramsName[name].Data()); - } - } - - // I append "&& eh.fFillEventHistograms" below, to switch off booking of all event histograms with one common flag: - eh.fBookEventHistograms[eNumberOfEvents] = Alright(lBookEventHistograms[eNumberOfEvents]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eTotalMultiplicity] = Alright(lBookEventHistograms[eTotalMultiplicity]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eSelectedTracks] = Alright(lBookEventHistograms[eSelectedTracks]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eMultFV0M] = Alright(lBookEventHistograms[eMultFV0M]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eMultFT0M] = Alright(lBookEventHistograms[eMultFT0M]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eMultTPC] = Alright(lBookEventHistograms[eMultTPC]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eMultNTracksPV] = Alright(lBookEventHistograms[eMultNTracksPV]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eMultTracklets] = Alright(lBookEventHistograms[eMultTracklets]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eCentrality] = Alright(lBookEventHistograms[eCentrality]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eVertex_x] = Alright(lBookEventHistograms[eVertex_x]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eVertex_y] = Alright(lBookEventHistograms[eVertex_y]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eVertex_z] = Alright(lBookEventHistograms[eVertex_z]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eNContributors] = Alright(lBookEventHistograms[eNContributors]) && eh.fFillEventHistograms; - eh.fBookEventHistograms[eImpactParameter] = Alright(lBookEventHistograms[eImpactParameter]) && eh.fFillEventHistograms; + if (eh.fFillEventHistograms) { + // *) By default all event histograms are booked. If you do not want particular event histogram to be booked, + // use configurable array cfBookEventHistograms, where you can specify name of the histogram accompanied with flags 1 (book) or 0 (do not book). + // Supported format: "someName-0" and "someName-1", where "-" is a field separator. + // Ordering of the flags in that array is interpreted through ordering of enums in enum eEventHistograms. + auto lBookEventHistograms = cf_eh.cfBookEventHistograms.value; // this is now the local version of that string array from configurable. + if (lBookEventHistograms.size() != eEventHistograms_N) { + LOGF(info, "\033[1;31m lBookEventHistograms.size() = %d\033[0m", lBookEventHistograms.size()); + LOGF(info, "\033[1;31m eEventHistograms_N) = %d\033[0m", static_cast(eEventHistograms_N)); + LOGF(fatal, "\033[1;31m%s at line %d : Mismatch in the number of flags in configurable cfBookEventHistograms, and number of entries in enum eEventHistograms \n \033[0m", __FUNCTION__, __LINE__); + } + + // *) Insanity check on the content and ordering of histogram names in the initialization in configurable cfBookEventHistograms: + // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. + for (Int_t name = 0; name < eEventHistograms_N; name++) { + // TBI 20240518 I could implement even a strickter EqualTo instead of EndsWith, but then I need to tokenize, etc., etc. This shall be safe enough. + if (!TString(lBookEventHistograms[name]).EndsWith(eh.fEventHistogramsName[name].Data())) { + LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookEventHistograms => name = %d, lBookEventHistograms[%d] = \"%s\", eh.fEventHistogramsName[%d] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, name, TString(lBookEventHistograms[name]).Data(), name, eh.fEventHistogramsName[name].Data()); + } + } + + // I append "&& eh.fFillEventHistograms" below, to switch off booking of all event histograms with one common flag: + eh.fBookEventHistograms[eNumberOfEvents] = Alright(lBookEventHistograms[eNumberOfEvents]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eTotalMultiplicity] = Alright(lBookEventHistograms[eTotalMultiplicity]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eMultiplicity] = Alright(lBookEventHistograms[eMultiplicity]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eReferenceMultiplicity] = Alright(lBookEventHistograms[eReferenceMultiplicity]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eCentrality] = Alright(lBookEventHistograms[eCentrality]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eVertex_x] = Alright(lBookEventHistograms[eVertex_x]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eVertex_y] = Alright(lBookEventHistograms[eVertex_y]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eVertex_z] = Alright(lBookEventHistograms[eVertex_z]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eNContributors] = Alright(lBookEventHistograms[eNContributors]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eImpactParameter] = Alright(lBookEventHistograms[eImpactParameter]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eEventPlaneAngle] = Alright(lBookEventHistograms[eEventPlaneAngle]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eOccupancy] = Alright(lBookEventHistograms[eOccupancy]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eInteractionRate] = Alright(lBookEventHistograms[eInteractionRate]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eCurrentRunDuration] = Alright(lBookEventHistograms[eCurrentRunDuration]) && eh.fFillEventHistograms; + eh.fBookEventHistograms[eMultMCNParticlesEta08] = Alright(lBookEventHistograms[eMultMCNParticlesEta08]) && eh.fFillEventHistograms; + } // end of if (eh.fFillEventHistograms) // b) Event histograms 2D: // TBI 20240515 Ideally, all 2D shall go to QA group, see below + // ... // c) Particle histograms 1D: // By default all 1D particle histograms are booked. Set this flag to kFALSE to switch off booking of all 1D particle histograms: ph.fFillParticleHistograms = cf_ph.cfFillParticleHistograms; - // *) If you do not want particular particle histogram to be booked, use configurable array cfBookParticleHistograms, where you can specify flags 1 (book) or 0 (do not book). - // Ordering of the flags in that array is interpreted through ordering of enums in enum eParticleHistograms. // TBI 20240124 is this safe enough? - auto lBookParticleHistograms = (vector)cf_ph.cfBookParticleHistograms; // this is now the local version of that int array from configurable. TBI 20240124 why is this casting mandatory? - if (lBookParticleHistograms.size() != eParticleHistograms_N) { - LOGF(info, "\033[1;31m lBookParticleHistograms.size() = %d\033[0m", lBookParticleHistograms.size()); - LOGF(info, "\033[1;31m eParticleHistograms_N) = %d\033[0m", static_cast(eParticleHistograms_N)); - LOGF(fatal, "in function \033[1;31m%s at line %d Mismatch in the number of flags in configurable cfBookParticleHistograms, and number of entries in enum eParticleHistograms \n \033[0m", __FUNCTION__, __LINE__); - } - - // *) Insanity check on the content and ordering of particle histograms in the initialization in configurable cfBookParticleHistograms: - // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. - for (Int_t name = 0; name < eParticleHistograms_N; name++) { - // TBI 20240518 I could implement even a strickter EqualTo instead of BeginsWith, but then I need to tokenize, etc., etc. This shall be safe enough. - if (!TString(lBookParticleHistograms[name]).BeginsWith(ph.fParticleHistogramsName[name].Data())) { - LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookParticleHistograms => name = %d, lBookParticleHistograms[name] = \"%s\", ph.fParticleHistogramsName[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lBookParticleHistograms[name]).Data(), ph.fParticleHistogramsName[name].Data()); - } - } - - // I append "&& ph.fFillParticleHistograms" below, to switch off booking of all 1D particle histograms with one common flag: - ph.fBookParticleHistograms[ePhi] = Alright(lBookParticleHistograms[ePhi]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[ePt] = Alright(lBookParticleHistograms[ePt]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[eEta] = Alright(lBookParticleHistograms[eEta]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[eCharge] = Alright(lBookParticleHistograms[eCharge]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[etpcNClsFindable] = Alright(lBookParticleHistograms[etpcNClsFindable]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[etpcNClsShared] = Alright(lBookParticleHistograms[etpcNClsShared]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[etpcNClsFound] = Alright(lBookParticleHistograms[etpcNClsFound]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[etpcNClsCrossedRows] = Alright(lBookParticleHistograms[etpcNClsCrossedRows]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[eitsNCls] = Alright(lBookParticleHistograms[eitsNCls]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[eitsNClsInnerBarrel] = Alright(lBookParticleHistograms[eitsNClsInnerBarrel]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[etpcCrossedRowsOverFindableCls] = Alright(lBookParticleHistograms[etpcCrossedRowsOverFindableCls]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[etpcFoundOverFindableCls] = Alright(lBookParticleHistograms[etpcFoundOverFindableCls]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[etpcFractionSharedCls] = Alright(lBookParticleHistograms[etpcFractionSharedCls]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[edcaXY] = Alright(lBookParticleHistograms[edcaXY]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[edcaZ] = Alright(lBookParticleHistograms[edcaZ]) && ph.fFillParticleHistograms; - ph.fBookParticleHistograms[ePDG] = Alright(lBookParticleHistograms[ePDG]) && ph.fFillParticleHistograms; - // Remark #1: I do not need here anythig for etrackCutFlagFb1, etrackCutFlagFb2, ... eisGlobalTrack, because they are booleans - // Remark #2: Nothing special here for ePtDependentDCAxyParameterization, because that is a string. + if (ph.fFillParticleHistograms) { + // *) If you do not want particular particle histogram to be booked, use configurable array cfBookParticleHistograms, where you can specify flags 1 (book) or 0 (do not book). + // Ordering of the flags in that array is interpreted through ordering of enums in enum eParticleHistograms. // TBI 20240124 is this safe enough? + auto lBookParticleHistograms = cf_ph.cfBookParticleHistograms.value; // this is now the local version of that string array from configurable. + if (lBookParticleHistograms.size() != eParticleHistograms_N) { + LOGF(info, "\033[1;31m lBookParticleHistograms.size() = %d\033[0m", lBookParticleHistograms.size()); + LOGF(info, "\033[1;31m eParticleHistograms_N) = %d\033[0m", static_cast(eParticleHistograms_N)); + LOGF(fatal, "in function \033[1;31m%s at line %d Mismatch in the number of flags in configurable cfBookParticleHistograms, and number of entries in enum eParticleHistograms \n \033[0m", __FUNCTION__, __LINE__); + } + + // *) Insanity check on the content and ordering of particle histograms in the initialization in configurable cfBookParticleHistograms: + // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. + for (Int_t name = 0; name < eParticleHistograms_N; name++) { + // TBI 20240518 I could implement even a strickter EqualTo instead of EndsWith, but then I need to tokenize, etc., etc. This shall be safe enough. + if (!TString(lBookParticleHistograms[name]).EndsWith(ph.fParticleHistogramsName[name].Data())) { + LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookParticleHistograms => name = %d, lBookParticleHistograms[name] = \"%s\", ph.fParticleHistogramsName[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lBookParticleHistograms[name]).Data(), ph.fParticleHistogramsName[name].Data()); + } + } + + // I append "&& ph.fFillParticleHistograms" below, to switch off booking of all 1D particle histograms with one common flag: + ph.fBookParticleHistograms[ePhi] = Alright(lBookParticleHistograms[ePhi]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[ePt] = Alright(lBookParticleHistograms[ePt]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[eEta] = Alright(lBookParticleHistograms[eEta]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[eCharge] = Alright(lBookParticleHistograms[eCharge]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[etpcNClsFindable] = Alright(lBookParticleHistograms[etpcNClsFindable]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[etpcNClsShared] = Alright(lBookParticleHistograms[etpcNClsShared]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[etpcNClsFound] = Alright(lBookParticleHistograms[etpcNClsFound]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[etpcNClsCrossedRows] = Alright(lBookParticleHistograms[etpcNClsCrossedRows]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[eitsNCls] = Alright(lBookParticleHistograms[eitsNCls]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[eitsNClsInnerBarrel] = Alright(lBookParticleHistograms[eitsNClsInnerBarrel]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[etpcCrossedRowsOverFindableCls] = Alright(lBookParticleHistograms[etpcCrossedRowsOverFindableCls]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[etpcFoundOverFindableCls] = Alright(lBookParticleHistograms[etpcFoundOverFindableCls]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[etpcFractionSharedCls] = Alright(lBookParticleHistograms[etpcFractionSharedCls]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[edcaXY] = Alright(lBookParticleHistograms[edcaXY]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[edcaZ] = Alright(lBookParticleHistograms[edcaZ]) && ph.fFillParticleHistograms; + ph.fBookParticleHistograms[ePDG] = Alright(lBookParticleHistograms[ePDG]) && ph.fFillParticleHistograms; + // Remark #1: I do not need here anythig for etrackCutFlagFb1, etrackCutFlagFb2, ... eisGlobalTrack, because they are booleans + // Remark #2: Nothing special here for ePtDependentDCAxyParameterization, because that is a string. + } // end of if(ph.fFillParticleHistograms) // d) Particle histograms 2D: // By default all 2D particle histograms are booked. Set this flag to kFALSE to switch off booking of all 2D particle histograms: ph.fFillParticleHistograms2D = cf_ph.cfFillParticleHistograms2D; - // If you do not want particular 2D particle histogram to be booked, use configurable array cfBookParticleHistograms2D, where you can specify flags 1 (book) or 0 (do not book). - // Ordering of the flags in that array is interpreted through ordering of enums in enum eParticleHistograms2D. // TBI 20240124 is this safe enough? - auto lBookParticleHistograms2D = (vector)cf_ph.cfBookParticleHistograms2D; // this is now the local version of that int array from configurable. TBI 20240124 why is this casting mandatory? - if (lBookParticleHistograms2D.size() != eParticleHistograms2D_N) { - LOGF(info, "\033[1;31m lBookParticleHistograms2D.size() = %d\033[0m", lBookParticleHistograms2D.size()); - LOGF(info, "\033[1;31m eParticleHistograms2D_N) = %d\033[0m", static_cast(eParticleHistograms2D_N)); - LOGF(fatal, "in function \033[1;31m%s at line %d Mismatch in the number of flags in configurable cfBookParticleHistograms2D, and number of entries in enum eParticleHistograms2D \n \033[0m", __FUNCTION__, __LINE__); - } + if (ph.fFillParticleHistograms2D) { + // If you do not want particular 2D particle histogram to be booked, use configurable array cfBookParticleHistograms2D, where you can specify flags 1 (book) or 0 (do not book). + // *) Ordering of the flags in that array is interpreted through ordering of enums in enum eParticleHistograms2D. + auto lBookParticleHistograms2D = cf_ph.cfBookParticleHistograms2D.value; // this is now the local version of that string array from configurable + // TBI 20241113 For some reason, the default values of configurable "cfBookParticleHistograms2D" are not correctly propagated in the local variables, but I can circumvent that with JSON settings for the time being + if (lBookParticleHistograms2D.size() != eParticleHistograms2D_N) { + LOGF(info, "\033[1;31m lBookParticleHistograms2D.size() = %d\033[0m", lBookParticleHistograms2D.size()); + LOGF(info, "\033[1;31m eParticleHistograms2D_N) = %d\033[0m", static_cast(eParticleHistograms2D_N)); + LOGF(fatal, "in function \033[1;31m%s at line %d Mismatch in the number of flags in configurable cfBookParticleHistograms2D, and number of entries in enum eParticleHistograms2D \n \033[0m", __FUNCTION__, __LINE__); + } + + // *) Insanity check on the content and ordering of 2D particle histograms in the initialization in configurable cfBookParticleHistograms2D: + // TBI 20241109 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. + for (Int_t name = 0; name < eParticleHistograms2D_N; name++) { + // TBI 20241109 I could implement even a strickter EqualTo instead of EndsWith, but then I need to tokenize, etc., etc. This shall be safe enough. + if (!TString(lBookParticleHistograms2D[name]).EndsWith(ph.fParticleHistogramsName2D[name].Data())) { + LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookParticleHistograms2D => name = %d, lBookParticleHistograms2D[name] = \"%s\", ph.fParticleHistogramsName2D[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lBookParticleHistograms2D[name]).Data(), ph.fParticleHistogramsName2D[name].Data()); + } + } - // I append "&& ph.fFillParticleHistograms2D" below, to switch off booking of all 2D particle histograms with one common flag: - ph.fBookParticleHistograms2D[ePhiPt] = Alright(lBookParticleHistograms2D[ePhiPt]) && ph.fFillParticleHistograms2D; - ph.fBookParticleHistograms2D[ePhiEta] = Alright(lBookParticleHistograms2D[ePhiEta]) && ph.fFillParticleHistograms2D; + // I append "&& ph.fFillParticleHistograms2D" below, to switch off booking of all 2D particle histograms with one common flag: + ph.fBookParticleHistograms2D[ePhiPt] = Alright(lBookParticleHistograms2D[ePhiPt]) && ph.fFillParticleHistograms2D; + ph.fBookParticleHistograms2D[ePhiEta] = Alright(lBookParticleHistograms2D[ePhiEta]) && ph.fFillParticleHistograms2D; + } // end of if (ph.fFillParticleHistograms2D) // e) QA: // **) QA 2D event histograms: qa.fFillQAEventHistograms2D = cf_qa.cfFillQAEventHistograms2D; - // *) If you do not want particular 2D event histogram to be booked, use configurable array cfBookQAEventHistograms2D, where you can specify flags 1 (book) or 0 (do not book). - // Ordering of the flags in that array is interpreted through ordering of enums in enum eQAEventHistograms2D - auto lBookQAEventHistograms2D = (vector)cf_qa.cfBookQAEventHistograms2D; // this is now the local version of that int array from configurable - if (lBookQAEventHistograms2D.size() != eQAEventHistograms2D_N) { - LOGF(info, "\033[1;31m lBookQAEventHistograms2D.size() = %d\033[0m", lBookQAEventHistograms2D.size()); - LOGF(info, "\033[1;31m eQAEventHistograms2D_N = %d\033[0m", static_cast(eQAEventHistograms2D_N)); - LOGF(fatal, "in function \033[1;31m%s at line %d Mismatch in the number of flags in configurable cfBookQAEventHistograms2D, and number of entries in enum eEventHistograms2D \n \033[0m", __FUNCTION__, __LINE__); - } - - // *) Insanity check on the content and ordering of QA 2D event histograms in the initialization in configurable cfBookQAEventHistograms2D: - // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. - for (Int_t name = 0; name < eQAEventHistograms2D_N; name++) { - // TBI 20240518 I could implement even a strickter EqualTo instead of BeginsWith, but then I need to tokenize, etc., etc. This shall be safe enough. - if (!TString(lBookQAEventHistograms2D[name]).BeginsWith(qa.fEventHistogramsName2D[name].Data())) { - LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookQAEventHistograms2D => name = %d, lBookQAEventHistograms2D[name] = \"%s\", qa.fEventHistogramsName2D[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lBookQAEventHistograms2D[name]).Data(), qa.fEventHistogramsName2D[name].Data()); - } - } - - // I append "&& qa.fFillQAEventHistograms2D" below, to switch off booking of all 2D event histograms with one common flag: - qa.fBookQAEventHistograms2D[eMultTPC_vs_NContributors] = Alright(lBookQAEventHistograms2D[eMultTPC_vs_NContributors]) && qa.fFillQAEventHistograms2D; - qa.fBookQAEventHistograms2D[eVertex_z_vs_MultTPC] = Alright(lBookQAEventHistograms2D[eVertex_z_vs_MultTPC]) && qa.fFillQAEventHistograms2D; - qa.fBookQAEventHistograms2D[eVertex_z_vs_NContributors] = Alright(lBookQAEventHistograms2D[eVertex_z_vs_NContributors]) && qa.fFillQAEventHistograms2D; - qa.fBookQAEventHistograms2D[eCentFT0M_vs_CentNTPV] = Alright(lBookQAEventHistograms2D[eCentFT0M_vs_CentNTPV]) && qa.fFillQAEventHistograms2D; - qa.fBookQAEventHistograms2D[eCentRun2V0M_vs_CentRun2SPDTracklets] = Alright(lBookQAEventHistograms2D[eCentRun2V0M_vs_CentRun2SPDTracklets]) && qa.fFillQAEventHistograms2D; - qa.fBookQAEventHistograms2D[eCentRun2V0M_vs_NContributors] = Alright(lBookQAEventHistograms2D[eCentRun2V0M_vs_NContributors]) && qa.fFillQAEventHistograms2D; + if (qa.fFillQAEventHistograms2D) { + // *) If you do not want particular 2D event histogram to be booked, use configurable array cfBookQAEventHistograms2D, where you can specify flags 1 (book) or 0 (do not book). + // Ordering of the flags in that array is interpreted through ordering of enums in enum eQAEventHistograms2D + auto lBookQAEventHistograms2D = cf_qa.cfBookQAEventHistograms2D.value; // this is now the local version of that string array from configurable + // TBI 20241115 For some reason, the default values of configurable "cfBookQAEventHistograms2D" are not correctly propagated in the local variables, but I can circumvent that with JSON settings for the time being + if (lBookQAEventHistograms2D.size() != eQAEventHistograms2D_N) { + LOGF(info, "\033[1;31m lBookQAEventHistograms2D.size() = %d\033[0m", lBookQAEventHistograms2D.size()); + LOGF(info, "\033[1;31m eQAEventHistograms2D_N = %d\033[0m", static_cast(eQAEventHistograms2D_N)); + LOGF(fatal, "in function \033[1;31m%s at line %d Mismatch in the number of flags in configurable cfBookQAEventHistograms2D, and number of entries in enum eQAEventHistograms2D \n \033[0m", __FUNCTION__, __LINE__); + } + + // *) Insanity check on the content and ordering of QA 2D event histograms in the initialization in configurable cfBookQAEventHistograms2D: + // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. + for (Int_t name = 0; name < eQAEventHistograms2D_N; name++) { + // TBI 20240518 I could implement even a strickter EqualTo instead of EndsWith, but then I need to tokenize, etc., etc. This shall be safe enough. + if (!TString(lBookQAEventHistograms2D[name]).EndsWith(qa.fEventHistogramsName2D[name].Data())) { + LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookQAEventHistograms2D => name = %d, lBookQAEventHistograms2D[name] = \"%s\", qa.fEventHistogramsName2D[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lBookQAEventHistograms2D[name]).Data(), qa.fEventHistogramsName2D[name].Data()); + } + } + + // I append "&& qa.fFillQAEventHistograms2D" below, to switch off booking of all 2D event histograms with one common flag: + qa.fBookQAEventHistograms2D[eMultiplicity_vs_ReferenceMultiplicity] = Alright(lBookQAEventHistograms2D[eMultiplicity_vs_ReferenceMultiplicity]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eMultiplicity_vs_NContributors] = Alright(lBookQAEventHistograms2D[eMultiplicity_vs_NContributors]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eMultiplicity_vs_Centrality] = Alright(lBookQAEventHistograms2D[eMultiplicity_vs_Centrality]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eMultiplicity_vs_Vertex_z] = Alright(lBookQAEventHistograms2D[eMultiplicity_vs_Vertex_z]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eMultiplicity_vs_Occupancy] = Alright(lBookQAEventHistograms2D[eMultiplicity_vs_Occupancy]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eReferenceMultiplicity_vs_NContributors] = Alright(lBookQAEventHistograms2D[eReferenceMultiplicity_vs_NContributors]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eReferenceMultiplicity_vs_Centrality] = Alright(lBookQAEventHistograms2D[eReferenceMultiplicity_vs_Centrality]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eReferenceMultiplicity_vs_Vertex_z] = Alright(lBookQAEventHistograms2D[eReferenceMultiplicity_vs_Vertex_z]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eReferenceMultiplicity_vs_Occupancy] = Alright(lBookQAEventHistograms2D[eReferenceMultiplicity_vs_Occupancy]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eNContributors_vs_Centrality] = Alright(lBookQAEventHistograms2D[eNContributors_vs_Centrality]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eNContributors_vs_Vertex_z] = Alright(lBookQAEventHistograms2D[eNContributors_vs_Vertex_z]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eNContributors_vs_Occupancy] = Alright(lBookQAEventHistograms2D[eNContributors_vs_Occupancy]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eCentrality_vs_Vertex_z] = Alright(lBookQAEventHistograms2D[eCentrality_vs_Vertex_z]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eCentrality_vs_Occupancy] = Alright(lBookQAEventHistograms2D[eCentrality_vs_Occupancy]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eCentrality_vs_ImpactParameter] = Alright(lBookQAEventHistograms2D[eCentrality_vs_ImpactParameter]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eVertex_z_vs_Occupancy] = Alright(lBookQAEventHistograms2D[eVertex_z_vs_Occupancy]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eMultNTracksPV_vs_MultNTracksGlobal] = Alright(lBookQAEventHistograms2D[eMultNTracksPV_vs_MultNTracksGlobal]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eCentFT0C_vs_CentNTPV] = Alright(lBookQAEventHistograms2D[eCentFT0C_vs_CentNTPV]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eCentFT0M_vs_CentNTPV] = Alright(lBookQAEventHistograms2D[eCentFT0M_vs_CentNTPV]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eCentRun2V0M_vs_CentRun2SPDTracklets] = Alright(lBookQAEventHistograms2D[eCentRun2V0M_vs_CentRun2SPDTracklets]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = Alright(lBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eCurrentRunDuration_vs_InteractionRate] = Alright(lBookQAEventHistograms2D[eCurrentRunDuration_vs_InteractionRate]) && qa.fFillQAEventHistograms2D; + } // end of if (qa.fFillQAEventHistograms2D) // **) QA 2D particle histograms: qa.fFillQAParticleHistograms2D = cf_qa.cfFillQAParticleHistograms2D; - // *) If you do not want particular 2D particle histogram to be booked, use configurable array cfBookQAParticleHistograms2D, where you can specify flags 1 (book) or 0 (do not book). - // Ordering of the flags in that array is interpreted through ordering of enums in enum eQAParticleHistograms2D. - auto lBookQAParticleHistograms2D = (vector)cf_qa.cfBookQAParticleHistograms2D; // this is now the local version of that int array from configurable - if (lBookQAParticleHistograms2D.size() != eQAParticleHistograms2D_N) { - LOGF(info, "\033[1;31m lBookQAParticleHistograms2D.size() = %d\033[0m", lBookQAParticleHistograms2D.size()); - LOGF(info, "\033[1;31m eQAParticleHistograms2D_N = %d\033[0m", static_cast(eQAParticleHistograms2D_N)); - LOGF(fatal, "in function \033[1;31m%s at line %d Mismatch in the number of flags in configurable cfBookQAParticleHistograms2D, and number of entries in enum eParticleHistograms2D \n \033[0m", __FUNCTION__, __LINE__); - } + if (qa.fFillQAParticleHistograms2D) { + // *) If you do not want particular 2D particle histogram to be booked, use configurable array cfBookQAParticleHistograms2D, where you can specify flags 1 (book) or 0 (do not book). + // Ordering of the flags in that array is interpreted through ordering of enums in enum eQAParticleHistograms2D. + auto lBookQAParticleHistograms2D = (vector)cf_qa.cfBookQAParticleHistograms2D; // this is now the local version of that int array from configurable + if (lBookQAParticleHistograms2D.size() != eQAParticleHistograms2D_N) { + LOGF(info, "\033[1;31m lBookQAParticleHistograms2D.size() = %d\033[0m", lBookQAParticleHistograms2D.size()); + LOGF(info, "\033[1;31m eQAParticleHistograms2D_N = %d\033[0m", static_cast(eQAParticleHistograms2D_N)); + LOGF(fatal, "in function \033[1;31m%s at line %d Mismatch in the number of flags in configurable cfBookQAParticleHistograms2D, and number of entries in enum eParticleHistograms2D \n \033[0m", __FUNCTION__, __LINE__); + } - // *) Insanity check on the content and ordering of QA 2D particle histograms in the initialization in configurable cfBookQAParticleHistograms2D: - // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. - for (Int_t name = 0; name < eQAParticleHistograms2D_N; name++) { - // TBI 20240518 I could implement even a strickter EqualTo instead of BeginsWith, but then I need to tokenize, etc., etc. This shall be safe enough. - if (!TString(lBookQAParticleHistograms2D[name]).BeginsWith(qa.fParticleHistogramsName2D[name].Data())) { - LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookQAParticleHistograms2D => name = %d, lBookQAParticleHistograms2D[name] = \"%s\", qa.fParticleHistogramsName2D[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lBookQAParticleHistograms2D[name]).Data(), qa.fParticleHistogramsName2D[name].Data()); + // *) Insanity check on the content and ordering of QA 2D particle histograms in the initialization in configurable cfBookQAParticleHistograms2D: + // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. + for (Int_t name = 0; name < eQAParticleHistograms2D_N; name++) { + // TBI 20240518 I could implement even a strickter EqualTo instead of EndsWith, but then I need to tokenize, etc., etc. This shall be safe enough. + if (!TString(lBookQAParticleHistograms2D[name]).EndsWith(qa.fParticleHistogramsName2D[name].Data())) { + LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfBookQAParticleHistograms2D => name = %d, lBookQAParticleHistograms2D[name] = \"%s\", qa.fParticleHistogramsName2D[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lBookQAParticleHistograms2D[name]).Data(), qa.fParticleHistogramsName2D[name].Data()); + } } - } - // I append "&& qa.fFillQAParticleHistograms2D" below, to switch off booking of all 2D particle histograms with one common flag: - qa.fBookQAParticleHistograms2D[ePt_vs_dcaXY] = Alright(lBookQAParticleHistograms2D[ePt_vs_dcaXY]) && qa.fFillQAParticleHistograms2D; + // I append "&& qa.fFillQAParticleHistograms2D" below, to switch off booking of all 2D particle histograms with one common flag: + qa.fBookQAParticleHistograms2D[ePt_vs_dcaXY] = Alright(lBookQAParticleHistograms2D[ePt_vs_dcaXY]) && qa.fFillQAParticleHistograms2D; + } // end of if (qa.fFillQAParticleHistograms2D) // ... + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void DefaultBooking() //============================================================ @@ -697,7 +898,7 @@ void DefaultBinning() // e) Variable-length binning set via MuPa-Configurables.h. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Default binning for event histograms: @@ -705,36 +906,20 @@ void DefaultBinning() eh.fEventHistogramsBins[eNumberOfEvents][1] = 0.; eh.fEventHistogramsBins[eNumberOfEvents][2] = 1.; - eh.fEventHistogramsBins[eTotalMultiplicity][0] = 20000; - eh.fEventHistogramsBins[eTotalMultiplicity][1] = -1.e5; - eh.fEventHistogramsBins[eTotalMultiplicity][2] = 1.e5; - - eh.fEventHistogramsBins[eSelectedTracks][0] = 20000; - eh.fEventHistogramsBins[eSelectedTracks][1] = -1.e5; - eh.fEventHistogramsBins[eSelectedTracks][2] = 1.e5; - - eh.fEventHistogramsBins[eMultFV0M][0] = 20000; - eh.fEventHistogramsBins[eMultFV0M][1] = -1.e5; - eh.fEventHistogramsBins[eMultFV0M][2] = 1.e5; - - eh.fEventHistogramsBins[eMultFT0M][0] = 20000; - eh.fEventHistogramsBins[eMultFT0M][1] = -1.e5; - eh.fEventHistogramsBins[eMultFT0M][2] = 1.e5; + eh.fEventHistogramsBins[eTotalMultiplicity][0] = 10000.; + eh.fEventHistogramsBins[eTotalMultiplicity][1] = 0.; + eh.fEventHistogramsBins[eTotalMultiplicity][2] = 100000.; - eh.fEventHistogramsBins[eMultTPC][0] = 20000; - eh.fEventHistogramsBins[eMultTPC][1] = -1.e5; - eh.fEventHistogramsBins[eMultTPC][2] = 1.e5; + eh.fEventHistogramsBins[eMultiplicity][0] = 2000.; + eh.fEventHistogramsBins[eMultiplicity][1] = 0.; + eh.fEventHistogramsBins[eMultiplicity][2] = 20000.; - eh.fEventHistogramsBins[eMultNTracksPV][0] = 20000; - eh.fEventHistogramsBins[eMultNTracksPV][1] = -1.e5; - eh.fEventHistogramsBins[eMultNTracksPV][2] = 1.e5; + eh.fEventHistogramsBins[eReferenceMultiplicity][0] = 6000.; + eh.fEventHistogramsBins[eReferenceMultiplicity][1] = 0.; + eh.fEventHistogramsBins[eReferenceMultiplicity][2] = 60000.; - eh.fEventHistogramsBins[eMultTracklets][0] = 20000; - eh.fEventHistogramsBins[eMultTracklets][1] = -1.e5; - eh.fEventHistogramsBins[eMultTracklets][2] = 1.e5; - - eh.fEventHistogramsBins[eCentrality][0] = 120; // intentionally, because if centrality is not determined, it's set to 105.0 at the moment - eh.fEventHistogramsBins[eCentrality][1] = -10.; + eh.fEventHistogramsBins[eCentrality][0] = 110; // intentionally, because if centrality is not determined, it's set to 105.0 at the moment + eh.fEventHistogramsBins[eCentrality][1] = 0.; eh.fEventHistogramsBins[eCentrality][2] = 110.; eh.fEventHistogramsBins[eVertex_x][0] = 800; @@ -749,13 +934,41 @@ void DefaultBinning() eh.fEventHistogramsBins[eVertex_z][1] = -40.; eh.fEventHistogramsBins[eVertex_z][2] = 40.; - eh.fEventHistogramsBins[eNContributors][0] = 1000; + eh.fEventHistogramsBins[eNContributors][0] = 1000.; eh.fEventHistogramsBins[eNContributors][1] = 0.; eh.fEventHistogramsBins[eNContributors][2] = 10000.; - eh.fEventHistogramsBins[eImpactParameter][0] = 2000; - eh.fEventHistogramsBins[eImpactParameter][1] = -1000.; - eh.fEventHistogramsBins[eImpactParameter][2] = 1000.; // It's set to -999 is not meaningful + eh.fEventHistogramsBins[eImpactParameter][0] = 1000; + eh.fEventHistogramsBins[eImpactParameter][1] = 0.; + eh.fEventHistogramsBins[eImpactParameter][2] = 100.; + + eh.fEventHistogramsBins[eEventPlaneAngle][0] = 720; + eh.fEventHistogramsBins[eEventPlaneAngle][1] = -o2::constants::math::PI; // just in case somebody uses the convention -Pi < EP < Pi, instead of 0 < EP < 2Pi + eh.fEventHistogramsBins[eEventPlaneAngle][2] = o2::constants::math::TwoPI; + + if (ec.fsEventCuts[eOccupancyEstimator].EqualTo("TrackOccupancyInTimeRange", TString::kIgnoreCase)) { + eh.fEventHistogramsBins[eOccupancy][0] = 150; + eh.fEventHistogramsBins[eOccupancy][1] = 0.; + eh.fEventHistogramsBins[eOccupancy][2] = 15000.; + } else if (ec.fsEventCuts[eOccupancyEstimator].EqualTo("FT0COccupancyInTimeRange", TString::kIgnoreCase)) { // keep in sync with values below for 2D QA + eh.fEventHistogramsBins[eOccupancy][0] = 1000; + eh.fEventHistogramsBins[eOccupancy][1] = 0.; + eh.fEventHistogramsBins[eOccupancy][2] = 100000.; + } + // For 2D QA correlation plot, temporarily I set it to maximum of the two above: + if (qa.fBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange]) { + eh.fEventHistogramsBins[eOccupancy][0] = 1000; // keep in sync. with definition above + eh.fEventHistogramsBins[eOccupancy][1] = 0.; + eh.fEventHistogramsBins[eOccupancy][2] = 100000.; + } + + eh.fEventHistogramsBins[eInteractionRate][0] = 1000; + eh.fEventHistogramsBins[eInteractionRate][1] = 0.; + eh.fEventHistogramsBins[eInteractionRate][2] = 100.; + + eh.fEventHistogramsBins[eCurrentRunDuration][0] = 10000; + eh.fEventHistogramsBins[eCurrentRunDuration][1] = 0.; + eh.fEventHistogramsBins[eCurrentRunDuration][2] = 100000.; // b) Default binning for particle histograms 1D: ph.fParticleHistogramsBins[ePhi][0] = 360; @@ -806,17 +1019,17 @@ void DefaultBinning() ph.fParticleHistogramsBins[etpcFoundOverFindableCls][1] = 0.; ph.fParticleHistogramsBins[etpcFoundOverFindableCls][2] = 5000.; - ph.fParticleHistogramsBins[etpcFractionSharedCls][0] = 600; + ph.fParticleHistogramsBins[etpcFractionSharedCls][0] = 110; ph.fParticleHistogramsBins[etpcFractionSharedCls][1] = -1.; // yes, I saw here entries with negative values TBI 20240507 check what are these values - ph.fParticleHistogramsBins[etpcFractionSharedCls][2] = 1000.; + ph.fParticleHistogramsBins[etpcFractionSharedCls][2] = 10.; ph.fParticleHistogramsBins[edcaXY][0] = 2000; - ph.fParticleHistogramsBins[edcaXY][1] = -1000.; - ph.fParticleHistogramsBins[edcaXY][2] = 1000.; + ph.fParticleHistogramsBins[edcaXY][1] = -10.; + ph.fParticleHistogramsBins[edcaXY][2] = 10.; ph.fParticleHistogramsBins[edcaZ][0] = 2000; - ph.fParticleHistogramsBins[edcaZ][1] = -1000.; - ph.fParticleHistogramsBins[edcaZ][2] = 1000.; + ph.fParticleHistogramsBins[edcaZ][1] = -10.; + ph.fParticleHistogramsBins[edcaZ][2] = 10.; ph.fParticleHistogramsBins[ePDG][0] = 2000; ph.fParticleHistogramsBins[ePDG][1] = -1000.; @@ -853,6 +1066,12 @@ void DefaultBinning() this->InitializeFixedLengthBins(AFO_PT); // *) Fixed-length binning vs. eta: this->InitializeFixedLengthBins(AFO_ETA); + // *) Fixed-length binning vs. occupancy: + this->InitializeFixedLengthBins(AFO_OCCUPANCY); + // *) Fixed-length binning vs. interaction rate: + this->InitializeFixedLengthBins(AFO_INTERACTIONRATE); + // *) Fixed-length binning vs. run duration: + this->InitializeFixedLengthBins(AFO_CURRENTRUNDURATION); // e) Variable-length binning set via MuPa-Configurables.h: // *) Variable-length binning vs. multiplicity: @@ -871,6 +1090,22 @@ void DefaultBinning() if (cf_res.cfUseVariableLength_eta_bins) { this->InitializeVariableLengthBins(AFO_ETA); } + // *) Variable-length binning vs. occupancy: + if (cf_res.cfUseVariableLength_occu_bins) { + this->InitializeVariableLengthBins(AFO_OCCUPANCY); + } + // *) Variable-length binning vs. interaction rate: + if (cf_res.cfUseVariableLength_ir_bins) { + this->InitializeVariableLengthBins(AFO_INTERACTIONRATE); + } + // *) Variable-length binning vs. run duration: + if (cf_res.cfUseVariableLength_crd_bins) { + this->InitializeVariableLengthBins(AFO_CURRENTRUNDURATION); + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } } // void DefaultBinning() @@ -882,7 +1117,7 @@ void InitializeFixedLengthBins(eAsFunctionOf AFO) // It merely initalizes res.fResultsProFixedLengthBins[...] from corresponding configurables + a few other minor thingies. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // Common local vector for all fixed-length bins: @@ -901,6 +1136,15 @@ void InitializeFixedLengthBins(eAsFunctionOf AFO) case AFO_ETA: lFixedLength_bins = cf_res.cfFixedLength_eta_bins.value; break; + case AFO_OCCUPANCY: + lFixedLength_bins = cf_res.cfFixedLength_occu_bins.value; + break; + case AFO_INTERACTIONRATE: + lFixedLength_bins = cf_res.cfFixedLength_ir_bins.value; + break; + case AFO_CURRENTRUNDURATION: + lFixedLength_bins = cf_res.cfFixedLength_crd_bins.value; + break; // ... default: LOGF(fatal, "\033[1;31m%s at line %d : This enum AFO = %d is not supported yet. \033[0m", __FUNCTION__, __LINE__, static_cast(AFO)); @@ -920,6 +1164,7 @@ void InitializeFixedLengthBins(eAsFunctionOf AFO) LOGF(info, "\033[1;32m [0] : %f \033[0m", res.fResultsProFixedLengthBins[AFO][0]); LOGF(info, "\033[1;32m [1] : %f \033[0m", res.fResultsProFixedLengthBins[AFO][1]); LOGF(info, "\033[1;32m [2] : %f \033[0m", res.fResultsProFixedLengthBins[AFO][2]); + ExitFunction(__FUNCTION__); } } // void InitializeFixedLengthBins(eAsFunctionOf AFO) @@ -932,7 +1177,7 @@ void InitializeVariableLengthBins(eAsFunctionOf AFO) // It merely initalizes res.fResultsProVariableLengthBins[...] from corresponding configurables + a few other minor thingies. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // Common local vector for all variable-length bins: @@ -940,7 +1185,6 @@ void InitializeVariableLengthBins(eAsFunctionOf AFO) switch (AFO) { case AFO_MULTIPLICITY: - // lVariableLength_bins = (vector)cf_res.cfVariableLength_mult_bins; // this works as well, but it requires casting lVariableLength_bins = cf_res.cfVariableLength_mult_bins.value; break; case AFO_CENTRALITY: @@ -952,6 +1196,15 @@ void InitializeVariableLengthBins(eAsFunctionOf AFO) case AFO_ETA: lVariableLength_bins = cf_res.cfVariableLength_eta_bins.value; break; + case AFO_OCCUPANCY: + lVariableLength_bins = cf_res.cfVariableLength_occu_bins.value; + break; + case AFO_INTERACTIONRATE: + lVariableLength_bins = cf_res.cfVariableLength_ir_bins.value; + break; + case AFO_CURRENTRUNDURATION: + lVariableLength_bins = cf_res.cfVariableLength_crd_bins.value; + break; // ... default: LOGF(fatal, "\033[1;31m%s at line %d : This enum AFO = %d is not supported yet. \033[0m", __FUNCTION__, __LINE__, static_cast(AFO)); @@ -971,6 +1224,10 @@ void InitializeVariableLengthBins(eAsFunctionOf AFO) } } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void InitializeVariableLengthBins(eAsFunctionOf AFO) //============================================================ @@ -996,7 +1253,6 @@ void CastStringIntoArray(Int_t AFO) Int_t nEntries = oa->GetEntries(); res.fResultsProVariableLengthBins[AFO] = new TArrayF(nEntries); for (Int_t i = 0; i < nEntries; i++) { - // cout<< TString(oa->At(i)->GetName()).Atof() <AddAt(TString(oa->At(i)->GetName()).Atof(), i); } delete oa; // yes, otherwise it's a memory leak @@ -1023,7 +1279,7 @@ void DefaultCuts() // b) Default particle cuts. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Default event cuts: @@ -1040,8 +1296,8 @@ void DefaultCuts() // *) Insanity check on the content and ordering of event cuts in the initialization in configurable cfUseEventCuts: // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. for (Int_t name = 0; name < eEventCuts_N; name++) { - // TBI 20240518 I could implement even a strickter EqualTo instead of BeginsWith, but then I need to tokenize, etc., etc. This shall be safe enough. - if (!TString(lUseEventCuts[name]).BeginsWith(ec.fEventCutName[name].Data())) { + // TBI 20240518 I could implement even a strickter EqualTo instead of EndsWith, but then I need to tokenize, etc., etc. This shall be safe enough. + if (!TString(lUseEventCuts[name]).EndsWith(ec.fEventCutName[name].Data())) { LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfUseEventCuts => name = %d, lUseEventCuts[name] = \"%s\", ec.fEventCutName[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lUseEventCuts[name]).Data(), ec.fEventCutName[name].Data()); } } @@ -1049,29 +1305,39 @@ void DefaultCuts() // *) from enum eEventHistograms: ec.fUseEventCuts[eNumberOfEvents] = Alright(lUseEventCuts[eNumberOfEvents]); // total number of events (before event cuts) ec.fUseEventCuts[eTotalMultiplicity] = Alright(lUseEventCuts[eTotalMultiplicity]); - ec.fUseEventCuts[eSelectedTracks] = Alright(lUseEventCuts[eSelectedTracks]); - ec.fUseEventCuts[eMultFV0M] = Alright(lUseEventCuts[eMultFV0M]); - ec.fUseEventCuts[eMultFT0M] = Alright(lUseEventCuts[eMultFT0M]); - ec.fUseEventCuts[eMultTPC] = Alright(lUseEventCuts[eMultTPC]); - ec.fUseEventCuts[eMultNTracksPV] = Alright(lUseEventCuts[eMultNTracksPV]); - ec.fUseEventCuts[eMultTracklets] = Alright(lUseEventCuts[eMultTracklets]); + ec.fUseEventCuts[eMultiplicity] = Alright(lUseEventCuts[eMultiplicity]); + ec.fUseEventCuts[eReferenceMultiplicity] = Alright(lUseEventCuts[eReferenceMultiplicity]); ec.fUseEventCuts[eCentrality] = Alright(lUseEventCuts[eCentrality]); ec.fUseEventCuts[eVertex_x] = Alright(lUseEventCuts[eVertex_x]); ec.fUseEventCuts[eVertex_y] = Alright(lUseEventCuts[eVertex_y]); ec.fUseEventCuts[eVertex_z] = Alright(lUseEventCuts[eVertex_z]); ec.fUseEventCuts[eNContributors] = Alright(lUseEventCuts[eNContributors]); ec.fUseEventCuts[eImpactParameter] = Alright(lUseEventCuts[eImpactParameter]); + ec.fUseEventCuts[eEventPlaneAngle] = Alright(lUseEventCuts[eEventPlaneAngle]); + ec.fUseEventCuts[eOccupancy] = Alright(lUseEventCuts[eOccupancy]); + ec.fUseEventCuts[eInteractionRate] = Alright(lUseEventCuts[eInteractionRate]); + ec.fUseEventCuts[eCurrentRunDuration] = Alright(lUseEventCuts[eCurrentRunDuration]); + ec.fUseEventCuts[eMultMCNParticlesEta08] = Alright(lUseEventCuts[eMultMCNParticlesEta08]); + // *) from enum eEventCuts: ec.fUseEventCuts[eTrigger] = Alright(lUseEventCuts[eTrigger]); ec.fUseEventCuts[eSel7] = Alright(lUseEventCuts[eSel7]); ec.fUseEventCuts[eSel8] = Alright(lUseEventCuts[eSel8]); + ec.fUseEventCuts[eMultiplicityEstimator] = Alright(lUseEventCuts[eMultiplicityEstimator]); ec.fUseEventCuts[eCentralityEstimator] = Alright(lUseEventCuts[eCentralityEstimator]); + ec.fUseEventCuts[eReferenceMultiplicityEstimator] = Alright(lUseEventCuts[eReferenceMultiplicityEstimator]); ec.fUseEventCuts[eSelectedEvents] = Alright(lUseEventCuts[eSelectedEvents]); // selected number of events (after all event cuts) ec.fUseEventCuts[eNoSameBunchPileup] = Alright(lUseEventCuts[eNoSameBunchPileup]); ec.fUseEventCuts[eIsGoodZvtxFT0vsPV] = Alright(lUseEventCuts[eIsGoodZvtxFT0vsPV]); ec.fUseEventCuts[eIsVertexITSTPC] = Alright(lUseEventCuts[eIsVertexITSTPC]); ec.fUseEventCuts[eIsVertexTOFmatched] = Alright(lUseEventCuts[eIsVertexTOFmatched]); ec.fUseEventCuts[eIsVertexTRDmatched] = Alright(lUseEventCuts[eIsVertexTRDmatched]); + ec.fUseEventCuts[eNoCollInTimeRangeStrict] = Alright(lUseEventCuts[eNoCollInTimeRangeStrict]); + ec.fUseEventCuts[eNoCollInTimeRangeStandard] = Alright(lUseEventCuts[eNoCollInTimeRangeStandard]); + ec.fUseEventCuts[eNoCollInRofStrict] = Alright(lUseEventCuts[eNoCollInRofStrict]); + ec.fUseEventCuts[eNoCollInRofStandard] = Alright(lUseEventCuts[eNoCollInRofStandard]); + ec.fUseEventCuts[eNoHighMultCollInPrevRof] = Alright(lUseEventCuts[eNoHighMultCollInPrevRof]); + ec.fUseEventCuts[eOccupancyEstimator] = Alright(lUseEventCuts[eOccupancyEstimator]); // **) event cuts defined via booleans: ec.fUseEventCuts[eSel7] = ec.fUseEventCuts[eSel7] && cf_ec.cfUseSel7; @@ -1081,6 +1347,11 @@ void DefaultCuts() ec.fUseEventCuts[eIsVertexITSTPC] = ec.fUseEventCuts[eIsVertexITSTPC] && cf_ec.cfUseIsVertexITSTPC; ec.fUseEventCuts[eIsVertexTOFmatched] = ec.fUseEventCuts[eIsVertexTOFmatched] && cf_ec.cfUseIsVertexTOFmatched; ec.fUseEventCuts[eIsVertexTRDmatched] = ec.fUseEventCuts[eIsVertexTRDmatched] && cf_ec.cfUseIsVertexTRDmatched; + ec.fUseEventCuts[eNoCollInTimeRangeStrict] = ec.fUseEventCuts[eNoCollInTimeRangeStrict] && cf_ec.cfUseNoCollInTimeRangeStrict; + ec.fUseEventCuts[eNoCollInTimeRangeStandard] = ec.fUseEventCuts[eNoCollInTimeRangeStandard] && cf_ec.cfUseNoCollInTimeRangeStandard; + ec.fUseEventCuts[eNoCollInRofStrict] = ec.fUseEventCuts[eNoCollInRofStrict] && cf_ec.cfUseNoCollInRofStrict; + ec.fUseEventCuts[eNoCollInRofStandard] = ec.fUseEventCuts[eNoCollInRofStandard] && cf_ec.cfUseNoCollInRofStandard; + ec.fUseEventCuts[eNoHighMultCollInPrevRof] = ec.fUseEventCuts[eNoHighMultCollInPrevRof] && cf_ec.cfUseNoHighMultCollInPrevRof; // **) event cuts defined via [min, max): auto lNumberOfEvents = (vector)cf_ec.cfNumberOfEvents; @@ -1091,29 +1362,13 @@ void DefaultCuts() ec.fdEventCuts[eTotalMultiplicity][eMin] = lTotalMultiplicity[eMin]; ec.fdEventCuts[eTotalMultiplicity][eMax] = lTotalMultiplicity[eMax]; - auto lSelectedTracks = (vector)cf_ec.cfSelectedTracks; - ec.fdEventCuts[eSelectedTracks][eMin] = lSelectedTracks[eMin]; - ec.fdEventCuts[eSelectedTracks][eMax] = lSelectedTracks[eMax]; - - auto lMultFV0M = (vector)cf_ec.cfMultFV0M; - ec.fdEventCuts[eMultFV0M][eMin] = lMultFV0M[eMin]; - ec.fdEventCuts[eMultFV0M][eMax] = lMultFV0M[eMax]; - - auto lMultFT0M = (vector)cf_ec.cfMultFT0M; - ec.fdEventCuts[eMultFT0M][eMin] = lMultFT0M[eMin]; - ec.fdEventCuts[eMultFT0M][eMax] = lMultFT0M[eMax]; + auto lMultiplicity = (vector)cf_ec.cfMultiplicity; + ec.fdEventCuts[eMultiplicity][eMin] = lMultiplicity[eMin]; + ec.fdEventCuts[eMultiplicity][eMax] = lMultiplicity[eMax]; - auto lMultTPC = (vector)cf_ec.cfMultTPC; - ec.fdEventCuts[eMultTPC][eMin] = lMultTPC[eMin]; - ec.fdEventCuts[eMultTPC][eMax] = lMultTPC[eMax]; - - auto lMultNTracksPV = (vector)cf_ec.cfMultNTracksPV; - ec.fdEventCuts[eMultNTracksPV][eMin] = lMultNTracksPV[eMin]; - ec.fdEventCuts[eMultNTracksPV][eMax] = lMultNTracksPV[eMax]; - - auto lMultTracklets = (vector)cf_ec.cfMultTracklets; - ec.fdEventCuts[eMultTracklets][eMin] = lMultTracklets[eMin]; - ec.fdEventCuts[eMultTracklets][eMax] = lMultTracklets[eMax]; + auto lReferenceMultiplicity = (vector)cf_ec.cfReferenceMultiplicity; + ec.fdEventCuts[eReferenceMultiplicity][eMin] = lReferenceMultiplicity[eMin]; + ec.fdEventCuts[eReferenceMultiplicity][eMax] = lReferenceMultiplicity[eMax]; auto lCentrality = (vector)cf_ec.cfCentrality; ec.fdEventCuts[eCentrality][eMin] = lCentrality[eMin]; @@ -1139,13 +1394,36 @@ void DefaultCuts() ec.fdEventCuts[eImpactParameter][eMin] = lImpactParameter[eMin]; ec.fdEventCuts[eImpactParameter][eMax] = lImpactParameter[eMax]; + auto lEventPlaneAngle = (vector)cf_ec.cfEventPlaneAngle; + ec.fdEventCuts[eEventPlaneAngle][eMin] = lEventPlaneAngle[eMin]; + ec.fdEventCuts[eEventPlaneAngle][eMax] = lEventPlaneAngle[eMax]; + + auto lOccupancy = (vector)cf_ec.cfOccupancy; + ec.fdEventCuts[eOccupancy][eMin] = lOccupancy[eMin]; + ec.fdEventCuts[eOccupancy][eMax] = lOccupancy[eMax]; + + auto lInteractionRate = (vector)cf_ec.cfInteractionRate; + ec.fdEventCuts[eInteractionRate][eMin] = lInteractionRate[eMin]; + ec.fdEventCuts[eInteractionRate][eMax] = lInteractionRate[eMax]; + + auto lCurrentRunDuration = (vector)cf_ec.cfCurrentRunDuration; + ec.fdEventCuts[eCurrentRunDuration][eMin] = lCurrentRunDuration[eMin]; + ec.fdEventCuts[eCurrentRunDuration][eMax] = lCurrentRunDuration[eMax]; + + auto lMultMCNParticlesEta08 = (vector)cf_ec.cfMultMCNParticlesEta08; + ec.fdEventCuts[eMultMCNParticlesEta08][eMin] = lMultMCNParticlesEta08[eMin]; + ec.fdEventCuts[eMultMCNParticlesEta08][eMax] = lMultMCNParticlesEta08[eMax]; + auto lSelectedEvents = (vector)cf_ec.cfSelectedEvents; ec.fdEventCuts[eSelectedEvents][eMin] = lSelectedEvents[eMin]; ec.fdEventCuts[eSelectedEvents][eMax] = lSelectedEvents[eMax]; // **) event cuts defined via string: + ec.fsEventCuts[eMultiplicityEstimator] = cf_ec.cfMultiplicityEstimator; + ec.fsEventCuts[eReferenceMultiplicityEstimator] = cf_ec.cfReferenceMultiplicityEstimator; ec.fsEventCuts[eCentralityEstimator] = cf_ec.cfCentralityEstimator; ec.fsEventCuts[eTrigger] = cf_ec.cfTrigger; + ec.fsEventCuts[eOccupancyEstimator] = cf_ec.cfOccupancyEstimator; // ---------------------------------------------------------------------- @@ -1163,8 +1441,8 @@ void DefaultCuts() // *) Insanity check on the content and ordering of particle cuts in the initialization in configurable cfUseParticleCuts: // TBI 20240518 I do not need this in fact, I can automate initialization even without ordering in configurable, but it feels with the ordering enforced, it's much safer. for (Int_t name = 0; name < eParticleCuts_N; name++) { - // TBI 20240518 I could implement even a strickter EqualTo instead of BeginsWith, but then I need to tokenize, etc., etc. This shall be safe enough. - if (!TString(lUseParticleCuts[name]).BeginsWith(pc.fParticleCutName[name].Data())) { + // TBI 20240518 I could implement even a strickter EqualTo instead of EndsWith, but then I need to tokenize, etc., etc. This shall be safe enough. + if (!TString(lUseParticleCuts[name]).EndsWith(pc.fParticleCutName[name].Data())) { LOGF(fatal, "\033[1;31m%s at line %d : Wrong content or ordering of contents in configurable cfUseParticleCuts => name = %d, lUseParticleCuts[name] = \"%s\", pc.fParticleCutName[name] = \"%s\" \033[0m", __FUNCTION__, __LINE__, name, TString(lUseParticleCuts[name]).Data(), pc.fParticleCutName[name].Data()); } } @@ -1270,32 +1548,190 @@ void DefaultCuts() // **) particles cuts defined via string: pc.fsParticleCuts[ePtDependentDCAxyParameterization] = cf_pc.cfPtDependentDCAxyParameterization; + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void DefaultCuts() //============================================================ +void SpecificCuts(TString whichSpecificCuts) +{ + // After default cuts are applied, on top of them apply analysis-specific cuts. Has to be called after DefaultBinning() and DefaultCuts(). + // Typically, analysis-specific cuts are determined through period tag, see below the case statement. + // Both event and particle cuts are hardwired here. + // All expert suggestions about the cuts to be used for specific period are hardwired here. + // For the time being, all specific cuts are defaulted and tuned for the latest reconstruction pass. + + // a) Mapping; + // b) Implementation of analysis-specific cuts. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Mapping: + // I need this mapping, for the switch statement below. TBI 20241120 I could introduce a utility function for this as well... + eSpecificCuts specificCuts = eSpecificCuts_N; + if (whichSpecificCuts.EqualTo("LHC23zzh")) { + specificCuts = eLHC23zzh; + } else if (whichSpecificCuts.EqualTo("...")) { + // ... + } else { + LOGF(fatal, "\033[1;31m%s at line %d : whichSpecificCuts = %s is not supported \033[0m", __FUNCTION__, __LINE__, whichSpecificCuts.Data()); + } + + // b) Implementation of analysis-specific cuts: + // Remark: Whichever cuts start to repeat below across different case statements, promote them into DefaultCuts(). + switch (specificCuts) { + case eLHC23zzh: + ec.fUseEventCuts[eSel8] = kTRUE; // central event selection for Run 3 + ec.fUseEventCuts[eNoCollInTimeRangeStrict] = kTRUE; // IA Slide 39 in https://indico.cern.ch/event/1462154/ + ec.fUseEventCuts[eNoCollInRofStrict] = kTRUE; // IA Slide 39 in https://indico.cern.ch/event/1462154/ + ec.fUseEventCuts[eNoHighMultCollInPrevRof] = kTRUE; // IA Slide 39 in https://indico.cern.ch/event/1462154/ + break; + + // ... + + default: + LOGF(fatal, "\033[1;31m%s at line %d : specificCuts = %d is not supported yet \033[0m", __FUNCTION__, __LINE__, static_cast(specificCuts)); + break; + } // switch((specificCuts)) + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void SpecificCuts(const char* specificCutsName) + +//============================================================ + +void InsanityChecksOnDefinitionsOfConfigurables() +{ + // Do insanity checks on values obtained from configurables before using them in the remaining function. + // This is really important, because one misconfigured configurable (e.g. boolean set to string), causes the whole json config to die silently, and + // only default values from MuPa-Configurables.h are used. + // Here I only check if configurables are correctly defined, I do NOT here initialize local variables with configurables, that is done later. + // Example misconfiguration in JSON: + // "var": "true", => var = 1 + other configurables are processed correctly + // "var": "truee", => var = 0 + all settings in JSON for configurables are ingored silently + + // TBI 20241127 finalize this function eventually. This is not urgent, though, as only a check below on cfTaskIsConfiguredFromJson covers most cases already. + + // Remark: Ordering below reflects the ordering in Configurables.h, not in DataMembers.h + // a) Task configuration; + // b) QA; + // c) Event histograms; + // d) Event cuts; + // e) Particle histograms; + // f) Particle cuts; + // g) Q-vectors; + // h) Multiparticle correlations; + // i) Test0; + // j) Particle weights; + // k) Centrality weights; + // l) Nested loops; + // m) Toy NUA; + // n) Internal validation; + // o) Results histograms. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Task configuration: + if (!TString(cf_tc.cfTaskIsConfiguredFromJson).EqualTo("yes")) { + LOGF(fatal, "\033[1;31m%s at line %d : configurable cfTaskIsConfiguredFromJson = \"%s\", but it has to be set to \"yes\" in JSON => most likely some other configurable is misconfigured and all remaining settings in JSON are ignored silently\033[0m", __FUNCTION__, __LINE__, TString(cf_tc.cfTaskIsConfiguredFromJson).Data()); + } + + // b) QA: + // ... + + // c) Event histograms: + // ... + + // d) Event cuts: + // ... + + // e) Particle histograms: + // ... + + // f) Particle cuts: + // ... + + // g) Q-vectors: + // ... + + // h) Multiparticle correlations: + // ... + + // i) Test0: + // ... + + // j) Particle weights: + // ... + + // k) Centrality weights: + // ... + + // l) Nested loops: + // ... + + // m) Toy NUA: + // ... + + // n) Internal validation: + // ... + + // o) Results histograms: + // ... + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // InsanityChecksOnDefinitionsOfConfigurables() + +//============================================================ + void InsanityChecksBeforeBooking() { - // Do insanity checks on configuration, binning and cuts. Values to be checked are either hardwired locally, or obtained from configurables. - // Remember that here I cannot do insanity checks on local hostograms, etc., because they are not vbooked yet. + // Do insanity checks on configuration, binning and cuts. Values obtained from configurables are checked before being used in InsanityChecksOnDefinitionsOfConfigurables(). + // Remember that here I cannot do insanity checks on local histograms, etc., because they are not booked yet. // For those additional checks, use InsanityChecksAfterBooking(). // a) Insanity checks on configuration; // b) Ensure that Run 1/2 specific cuts and flags are used only in Run 1/2 (both data and sim); // c) Ensure that Run 3 specific cuts and flags are used only in Run 3 (both data and sim); // d) Insanity checks on binning; - // e) Insanity checks on Toy NUA; - // f) Insanity checks on internal validation. + // e) Insanity checks on events cuts; + // f) Insanity checks on Toy NUA; + // g) Insanity checks on internal validation; + // h) Insanity checks on results histograms. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Insanity checks on configuration: + // **) Dry run and internal validation are not meant to be run together: + if (tc.fDryRun && iv.fUseInternalValidation) { + LOGF(fatal, "\033[1;31m%s at line %d : Dry run and internal validation are not meant to be run together\033[0m", __FUNCTION__, __LINE__); + } + // **) Cannot calculate multiparticle correlations, in case Q-vectors are not filled: if (mupa.fCalculateCorrelations && !qv.fCalculateQvectors) { - LOGF(fatal, "\033[1;31m%s at line %d : Cannot calculate multiparticle correlations, in case Q-vectors are not filled \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : Cannot calculate multiparticle correlations, in case Q-vectors are not calculated \033[0m", __FUNCTION__, __LINE__); + } + + // **) If some differential "correlations" flag is set to true, but the main fCalculateCorrelations is false, only print the warning that that differential correlations won't be calculated. + // This is not fatal, because this way I can turn off all differential "correlations" flags, just by setting fCalculateCorrelations to false, e.g. when I want to fill only control histograms. + for (Int_t v = 0; v < eAsFunctionOf_N; v++) { + if (mupa.fCalculateCorrelationsAsFunctionOf[v] && !mupa.fCalculateCorrelations) { + LOGF(warning, "\033[1;33m%s at line %d : mupa.fCalculateCorrelationsAsFunctionOf[%d] is true, but mupa.fCalculateCorrelations is false. This differential correlations won't be calculated.\033[0m", __FUNCTION__, __LINE__, v); + } } // **) Cannot calculate Test0, in case Q-vectors are not filled: @@ -1303,6 +1739,14 @@ void InsanityChecksBeforeBooking() LOGF(fatal, "\033[1;31m%s at line %d : Cannot calculate Test0, in case Q-vectors are not filled \033[0m", __FUNCTION__, __LINE__); } + // **) If some differential Test0 flag is set to true, but the main fCalculateTest0 is false, only print the warning that that differential Test0 won't be calculated. + // This is not fatal, because this way I can turn off all differential Test0 flags, just by setting fCalculateTest0 to false, e.g. when I want to fill only control histograms. + for (Int_t v = 0; v < eAsFunctionOf_N; v++) { + if (t0.fCalculateTest0AsFunctionOf[v] && !t0.fCalculateTest0) { + LOGF(warning, "\033[1;33m%s at line %d : t0.fCalculateTest0AsFunctionOf[%d] is true, but t0.fCalculateTest0 is false. This differential Test0 won't be calculated.\033[0m", __FUNCTION__, __LINE__, v); + } + } + // **) Enforce that if fixed number of randomly selected tracks is used in the analysis, that Fisher-Yates algorithm is enabled: if (tc.fFixedNumberOfRandomlySelectedTracks > 0 && !tc.fUseFisherYates) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); @@ -1322,9 +1766,6 @@ void InsanityChecksBeforeBooking() } // **) Insanity checks on event cuts: - if (ec.fUseEventCuts[eTrigger] && !(tc.fProcess[eProcessRec_Run2])) { - LOGF(fatal, "\033[1;31m%s at line %d : trigger \"%s\" => From documentation: Bypass this check if you analyse MC or continuous Run3 data. By now, it's validated only for \"Rec_Run2\", for other cases, simply switch off this event cut eTrigger. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eTrigger].Data()); - } // **) This check is meant to prevent the case when I want to bailout for max number of events, but I do not fill event histograms: if (ec.fdEventCuts[eNumberOfEvents][eMax] < 1e6) { // TBI 20241011 Do I need to tune 1000000000 @@ -1336,10 +1777,33 @@ void InsanityChecksBeforeBooking() } } - // **) Check if the trigger makes sense for this dataset: + // **) Check if the trigger makes sense or was validated for this dataset: + if (ec.fUseEventCuts[eTrigger]) { + + // Validated and supported Run 3 triggers: + if (tc.fProcess[eProcessRec]) { + if (!ec.fsEventCuts[eTrigger].EqualTo("kTVXinTRD")) { + LOGF(fatal, "\033[1;31m%s at line %d : trigger \"%s\" is not internally validated or supported for Run 3. Add it to the list of supported triggers, if you really want to use that one.\033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eTrigger].Data()); + } + } + + // Validated and supported Run 2 triggers: + if (tc.fProcess[eProcessRec_Run2]) { + if (!ec.fsEventCuts[eTrigger].EqualTo("kINT7")) { + // LOGF(fatal, "\033[1;31m%s at line %d : trigger \"%s\" is not internally validated/supported yet for Run 2. Add it to the list of supported triggers, if you really want to use that one.\033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eTrigger].Data()); + } + } + + // Validated and supported Run 1 triggers: + // ... + + } // if (ec.fUseEventCuts[eTrigger]) { + + // **) Enforce the usage of particular trigger for this dataset: if (tc.fProcess[eProcessRec_Run2]) { - // TBI 20240517 for the time being, here I am enforcing that "kINT7" is mandatory for Run 2 and Run 1 converted real data - if (!(ec.fUseEventCuts[eTrigger] && ec.fsEventCuts[eTrigger].EqualTo("kINT7"))) { // TBI 20240223 expand this list with other supported triggers eventually in this category (see if(...) above) + // TBI 20240517 for the time being, here I am enforcing that "kINT7" is mandatory for Run 2 + // TBI 20241209 I still have to validate it for Run 1 converted real data => then expand if(...) statemebt above + if (!(ec.fUseEventCuts[eTrigger] && ec.fsEventCuts[eTrigger].EqualTo("kINT7"))) { LOGF(fatal, "\033[1;31m%s at line %d : trigger \"%s\" is not internally validated/supported yet. Add it to the list of supported triggers, if you really want to use that one.\033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eTrigger].Data()); } else { LOGF(info, "\033[1;32m%s at line %d : WARNING => trigger \"%s\" can be used only on real converted Run 2 and Run 1 data. For MC converted Run 2 and Run 1 data, this trigger shouldn't be used.\033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eTrigger].Data()); @@ -1347,16 +1811,17 @@ void InsanityChecksBeforeBooking() } } - // **) Do NOT use eTrigger for Run 3. From documentation: Bypass this check if you analyse MC or continuous Run3 data: - // TBI 20241023 this needs further scrutiny - if (tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim]) { - if (ec.fUseEventCuts[eTrigger]) { - LOGF(fatal, "\033[1;31m%s at line %d : offline trigger eTrigger (e.g. kINT7) cannot be used in Run 3\033[0m", __FUNCTION__, __LINE__); - } + // **) Ensure that fFloatingPointPrecision makes sense: + if (!(tc.fFloatingPointPrecision > 0.)) { + LOGF(fatal, "\033[1;31m%s at line %d : set fFloatingPointPrecision = %f to some small positive value, which will determine if two floats are the same \033[0m", __FUNCTION__, __LINE__, tc.fFloatingPointPrecision); } - // b) Ensure that Run 1/2 specific cuts and flags are used only in Run 1/2 (both data and sim): + // **) Ensure that fSequentialBailout makes sense: + if (!(tc.fSequentialBailout >= 0)) { + LOGF(fatal, "\033[1;31m%s at line %d : set fSequentialBailout = %d either to 0 (not used), or to positive integer.\033[0m", __FUNCTION__, __LINE__, tc.fSequentialBailout); + } + // b) Ensure that Run 1/2 specific cuts and flags are used only in Run 1/2 (both data and sim): // **) Ensure that eSel7 is used only for converted Run 2 and Run 1 (both data and sim): if (ec.fUseEventCuts[eSel7]) { if (!(tc.fProcess[eProcessRec_Run2] || tc.fProcess[eProcessRecSim_Run2] || tc.fProcess[eProcessSim_Run2] || tc.fProcess[eProcessRec_Run1] || tc.fProcess[eProcessRecSim_Run1] || tc.fProcess[eProcessSim_Run1])) { @@ -1364,11 +1829,20 @@ void InsanityChecksBeforeBooking() } } + // **) Supported reference multiplicity estimators for Run 1 and 2 are enlisted here: + if (tc.fProcess[eProcessRec_Run2] || tc.fProcess[eProcessRecSim_Run2] || tc.fProcess[eProcessRec_Run1] || tc.fProcess[eProcessRecSim_Run1]) { + if (!(ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("MultTracklets", TString::kIgnoreCase))) { + LOGF(fatal, "\033[1;31m%s at line %d : reference multiplicity estimator = %s is not supported yet for Run 1 and 2 analysis.\nUse \"MultTracklets\"\033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eReferenceMultiplicityEstimator].Data()); + } + } else if (tc.fProcess[eProcessSim_Run2] || tc.fProcess[eProcessSim_Run1]) { + LOGF(fatal, "\033[1;31m%s at line %d : eProcessSim is not validated yet \033[0m", __FUNCTION__, __LINE__); + } + // **) Supported centrality estimators for Run 1 and 2 are enlisted here: if (tc.fProcess[eProcessRec_Run2] || tc.fProcess[eProcessRecSim_Run2] || tc.fProcess[eProcessSim_Run2] || tc.fProcess[eProcessRec_Run1] || tc.fProcess[eProcessRecSim_Run1] || tc.fProcess[eProcessSim_Run1]) { - if (!(ec.fsEventCuts[eCentralityEstimator].EqualTo("centRun2V0M", TString::kIgnoreCase) || - ec.fsEventCuts[eCentralityEstimator].EqualTo("centRun2SPDTracklets", TString::kIgnoreCase))) { - LOGF(fatal, "\033[1;31m%s at line %d : centrality estimator = %s is not supported yet for converted Run 2 and Run 1 analysis. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eCentralityEstimator].Data()); + if (!(ec.fsEventCuts[eCentralityEstimator].EqualTo("centRun2V0M") || + ec.fsEventCuts[eCentralityEstimator].EqualTo("centRun2SPDTracklets"))) { + LOGF(fatal, "\033[1;31m%s at line %d : centrality estimator = %s is not supported yet for converted Run 2 and Run 1 analysis.\nUse either \"centRun2V0M\" or \"centRun2SPDTracklets\" (case sensitive!) \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eCentralityEstimator].Data()); } } @@ -1422,12 +1896,66 @@ void InsanityChecksBeforeBooking() } } + if (ec.fUseEventCuts[eNoCollInTimeRangeStrict]) { + if (!(tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim])) { + LOGF(fatal, "\033[1;31m%s at line %d : use eNoCollInTimeRangeStrict only for Run 3 data and MC\033[0m", __FUNCTION__, __LINE__); + } + } + + if (ec.fUseEventCuts[eNoCollInTimeRangeStandard]) { + if (!(tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim])) { + LOGF(fatal, "\033[1;31m%s at line %d : use eNoCollInTimeRangeStandard only for Run 3 data and MC\033[0m", __FUNCTION__, __LINE__); + } + } + + if (ec.fUseEventCuts[eNoCollInRofStrict]) { + if (!(tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim])) { + LOGF(fatal, "\033[1;31m%s at line %d : use eNoCollInRofStrict only for Run 3 data and MC\033[0m", __FUNCTION__, __LINE__); + } + } + + if (ec.fUseEventCuts[eNoCollInRofStandard]) { + if (!(tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim])) { + LOGF(fatal, "\033[1;31m%s at line %d : use eNoCollInRofStandard only for Run 3 data and MC\033[0m", __FUNCTION__, __LINE__); + } + } + + if (ec.fUseEventCuts[eNoHighMultCollInPrevRof]) { + if (!(tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim])) { + LOGF(fatal, "\033[1;31m%s at line %d : use eNoHighMultCollInPrevRof only for Run 3 data and MC\033[0m", __FUNCTION__, __LINE__); + } + } + + // **) Supported reference multiplicity estimators for Run 3 are enlisted here: + if (tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim]) { + if (!(ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("MultTPC", TString::kIgnoreCase) || + ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("MultFV0M", TString::kIgnoreCase) || + ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("MultFT0C", TString::kIgnoreCase) || + ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("MultFT0M", TString::kIgnoreCase) || + ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("MultNTracksPV", TString::kIgnoreCase))) { + LOGF(fatal, "\033[1;31m%s at line %d : reference multiplicity estimator = %s is not supported yet for Run 3 analysis.\nUse \"MultTPC\", \"MultFV0M\", \"MultFT0C\", \"MultFT0M\" or \"MultNTracksPV\"\033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eReferenceMultiplicityEstimator].Data()); + } + } else if (tc.fProcess[eProcessSim]) { + LOGF(fatal, "\033[1;31m%s at line %d : eProcessSim is not validated yet \033[0m", __FUNCTION__, __LINE__); + } + // **) Supported centrality estimators for Run 3 are enlisted here: - if (tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim]) { - if (!(ec.fsEventCuts[eCentralityEstimator].EqualTo("centFT0M", TString::kIgnoreCase) || + if (tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim]) { + if (!(ec.fsEventCuts[eCentralityEstimator].EqualTo("centFT0C", TString::kIgnoreCase) || + ec.fsEventCuts[eCentralityEstimator].EqualTo("centFT0M", TString::kIgnoreCase) || ec.fsEventCuts[eCentralityEstimator].EqualTo("centFV0A", TString::kIgnoreCase) || ec.fsEventCuts[eCentralityEstimator].EqualTo("centNTPV", TString::kIgnoreCase))) { - LOGF(fatal, "\033[1;31m%s at line %d : centrality estimator = %s is not supported yet for Run 3 analysis. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eCentralityEstimator].Data()); + LOGF(fatal, "\033[1;31m%s at line %d : centrality estimator = %s is not supported yet for Run 3 analysis.\nUse \"centFT0C\", \"centFT0M\", \"centFV0A\", or \"centNTPV\"\033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eCentralityEstimator].Data()); + } + } else if (tc.fProcess[eProcessSim]) { + LOGF(fatal, "\033[1;31m%s at line %d : eProcessSim is not validated yet \033[0m", __FUNCTION__, __LINE__); + } + + // **) Supported occupancy estimators for Run 3 are enlisted here: + if (tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim]) { + if (!(ec.fsEventCuts[eOccupancyEstimator].EqualTo("TrackOccupancyInTimeRange", TString::kIgnoreCase) || + ec.fsEventCuts[eOccupancyEstimator].EqualTo("FT0COccupancyInTimeRange", TString::kIgnoreCase))) { + LOGF(fatal, "\033[1;31m%s at line %d : occupancy estimator = %s is not supported yet for Run 3 analysis. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eOccupancyEstimator].Data()); } } @@ -1446,10 +1974,16 @@ void InsanityChecksBeforeBooking() // d) Insanity checks on binning: // ... - // e) Insanity checks on Toy NUA: + // e) Insanity checks on events cuts: + if (ec.fsEventCuts[eMultiplicityEstimator].EqualTo("ReferenceMultiplicity", TString::kIgnoreCase) && ec.fUseEventCuts[eMultiplicity]) { + LOGF(fatal, "\033[1;31m%s at line %d : use ec.fUseEventCuts[eMultiplicity] only when eMultiplicityEstimator = SelectedTracks. Otherwise, things can happen... \033[0m", __FUNCTION__, __LINE__); + } + // ... + + // f) Insanity checks on Toy NUA: // ... - // f) Insanity checks on internal validation: + // g) Insanity checks on internal validation: // Remark: I check here only in the settings I could define in DefaultConfiguration(). // The other insanity checks are in BookInternalValidationHistograms() or in InsanityChecksAfterBooking() if (iv.fUseInternalValidation) { @@ -1457,19 +1991,33 @@ void InsanityChecksBeforeBooking() LOGF(fatal, "\033[1;31m%s at line %d : iv.fnEventsInternalValidation <= 0 => Set number of events to positive integer\033[0m", __FUNCTION__, __LINE__); } - if (pw.fUseWeights[wPHI] || pw.fUseWeights[wPT] || pw.fUseWeights[wETA]) { - LOGF(fatal, "\033[1;31m%s at line %d : integrated weights are not supported (yet) for internal validation. \033[0m", __FUNCTION__, __LINE__); + if (iv.fRescaleWithTheoreticalInput && (nl.fCalculateNestedLoops || nl.fCalculateCustomNestedLoops || nl.fCalculateKineCustomNestedLoops)) { + LOGF(fatal, "\033[1;31m%s at line %d : rescaling with theoretical input is not supported when cross-check is done with nested loops. \033[0m", __FUNCTION__, __LINE__); } - if (pw.fUseDiffWeights[wPHIPT] || pw.fUseDiffWeights[wPHIETA]) { - LOGF(fatal, "\033[1;31m%s at line %d : differential weights are not supported (yet) for internal validation. \033[0m", __FUNCTION__, __LINE__); + if (ec.fsEventCuts[eMultiplicityEstimator].EqualTo("ReferenceMultiplicity", TString::kIgnoreCase)) { + LOGF(fatal, "\033[1;31m%s at line %d : in IV eMultiplicityEstimator cannot be set to \"ReferenceMultiplicity\" (yet) \033[0m", __FUNCTION__, __LINE__); } - if (iv.fRescaleWithTheoreticalInput && (nl.fCalculateNestedLoops || nl.fCalculateCustomNestedLoops || nl.fCalculateKineCustomNestedLoops)) { - LOGF(fatal, "\033[1;31m%s at line %d : rescaling with theoretical input is not supported when cross-check is done with nested loops. \033[0m", __FUNCTION__, __LINE__); + } // if (iv.fUseInternalValidation) { + + // h) Insanity checks on results histograms: + // **) Check if all arrays are initialized until the end: + for (Int_t afo = 0; afo < eAsFunctionOf_N; afo++) { + if (res.fResultsProXaxisTitle[afo].EqualTo("")) { + LOGF(fatal, "\033[1;31m%s at line %d : res.fResultsProXaxisTitle[%d] is empty.\033[0m", __FUNCTION__, __LINE__, afo); } - } // if (iv.fUseInternalValidation) { + if (res.fResultsProRawName[afo].EqualTo("")) { + LOGF(fatal, "\033[1;31m%s at line %d : res.fResultsProRawName[%d] is empty.\033[0m", __FUNCTION__, __LINE__, afo); + } + } // for(Int_t afo = 0; afo < eAsFunctionOf_N; afo++) { + + // ... + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } } // void InsanityChecksBeforeBooking() @@ -1480,17 +2028,87 @@ void InsanityChecksAfterBooking() // Do insanity checks on all booked histograms, etc., // Configuration, binning and cuts are checked already before booking in InsanityChecksBeforeBooking(). - // a) Insanity checks on booking: + // a) Insanity checks on booking; + // b) Insanity checks on internal validation; // ... if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Insanity checks on booking: - // ... -} // void InsanityChecksAfterBooking() + // **) Check that the last bin is not empty in fBasePro, and that there is no underflow or overflow bins: + if (TString(fBasePro->GetXaxis()->GetBinLabel(eConfiguration_N - 1)).EqualTo("")) { + LOGF(fatal, "\033[1;31m%s at line %d : The very last bin of \"fBasePro\" doesn't have the title, check the booking of this hostogram. \033[0m", __FUNCTION__, __LINE__); + } + if (TMath::Abs(fBasePro->GetBinContent(0)) > 0.) { + LOGF(fatal, "\033[1;31m%s at line %d : In \"fBasePro\" something was filled in the underflow, check the booking of this hostogram. \033[0m", __FUNCTION__, __LINE__); + } + if (TMath::Abs(fBasePro->GetBinContent(eConfiguration_N)) > 0.) { + LOGF(fatal, "\033[1;31m%s at line %d : In \"fBasePro\" something was filled in the overflow, check the booking of this hostogram. \033[0m", __FUNCTION__, __LINE__); + } + + // ... + + // b) Insanity checks on internal validation: + + if (iv.fUseInternalValidation) { + + // **) Check that rescaling is used only when it makes sense: + if (iv.fRescaleWithTheoreticalInput && iv.fHarmonicsOptionInternalValidation->EqualTo("correlated")) { + LOGF(fatal, "\033[1;31m%s at line %d : rescaling with theoretical input doesn't make sanse for fHarmonicsOptionInternalValidation = \"correlated\". \033[0m", __FUNCTION__, __LINE__); + } + + // **) Print a warning if this histogram is not booked: + if (!eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]) { + LOGF(warning, "\033[1;31m%s at line %d : eh.fEventHistograms[eNumberOfEvents][eSim][eAfter] is not booked => no info on the total number of events in internal validation can be provided \033[0m", __FUNCTION__, __LINE__); + } + + } // end of if (iv.fUseInternalValidation) { + + // ... + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void InsanityChecksAfterBooking() + +//============================================================ + +Bool_t Skip(Int_t recOrSim) +{ + // Decide here whether a certain histogram, etc., will be booked and used both for eRec and eSim. + // Same for cuts. + + if (tc.fVerboseUtility) { + StartFunction(__FUNCTION__); + } + + // *) Insanity check: + if (!(recOrSim == eRec || recOrSim == eSim)) { + LOGF(fatal, "\033[1;31m%s at line %d : recOrSim = %d \033[0m", __FUNCTION__, __LINE__, recOrSim); + } + + // *) If I am doing internal validation, I book and fill only eSim: + if (iv.fUseInternalValidation) { + if (recOrSim == eRec) { + return kTRUE; // yes, skip + } else { + return kFALSE; // this is eSim, do not skip + } + } + + // *) If I am analyzing only reconstructed data, do not book histos for simulated, and vice versa. + // TBI 20240223 tc.fProcess[eProcessTest] is treated as tc.fProcess[eProcessRec], for the time being + if ((tc.fProcess[eGenericRec] && recOrSim == eSim) || (tc.fProcess[eGenericSim] && recOrSim == eRec)) { + return kTRUE; // yes, skip + } + + return kFALSE; // by default, I do not skip anything + +} // Bool_t Skip(Int_t recOrSim) //============================================================ @@ -1502,14 +2120,16 @@ void BookAndNestAllLists() // *) Correlations; // *) Q-vectors; // *) Particle weights; + // *) Centrality weights; // *) Nested loops; // *) Toy NUA; // *) Internal validation; // *) Test0; + // *) Eta separations; // *) Results. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // *) QA: @@ -1560,6 +2180,12 @@ void BookAndNestAllLists() pw.fWeightsList->SetOwner(kTRUE); fBaseList->Add(pw.fWeightsList); + // *) Centrality weights: + cw.fCentralityWeightsList = new TList(); + cw.fCentralityWeightsList->SetName("CentralityWeights"); + cw.fCentralityWeightsList->SetOwner(kTRUE); + fBaseList->Add(cw.fCentralityWeightsList); + // *) Nested loops: nl.fNestedLoopsList = new TList(); nl.fNestedLoopsList->SetName("NestedLoops"); @@ -1584,12 +2210,22 @@ void BookAndNestAllLists() t0.fTest0List->SetOwner(kTRUE); fBaseList->Add(t0.fTest0List); + // *) Eta separations: + es.fEtaSeparationsList = new TList(); + es.fEtaSeparationsList->SetName("EtaSeparations"); + es.fEtaSeparationsList->SetOwner(kTRUE); + fBaseList->Add(es.fEtaSeparationsList); + // *) Results: res.fResultsList = new TList(); res.fResultsList->SetName("Results"); res.fResultsList->SetOwner(kTRUE); fBaseList->Add(res.fResultsList); + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookAndNestAllLists() //============================================================ @@ -1606,7 +2242,7 @@ void BookQAHistograms() // d) Book specific QA 2D particle histograms. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // *) Print the warning message, because with too many 2D histograms with double precision, the code crashes in terminate, due to: @@ -1617,10 +2253,12 @@ void BookQAHistograms() [1450742:multiparticle-correlations-a-b]: *** Program crashed (Aborted) [1450742:multiparticle-correlations-a-b]: Backtrace by DPL: */ - LOGF(info, "\033[1;33m%s: !!!! WARNING !!!! With too many 2D histograms with double precision, the code will crash in terminate (\"... shmem: could not create a message of size ...\") . Locally, you can circumvent this while testing by calling Bailout() explicitly. !!!! WARNING !!!! \033[0m", __FUNCTION__); + if (tc.fVerbose) { + LOGF(info, "\033[1;33m%s: !!!! WARNING !!!! With too many 2D histograms with double precision, the code will crash in terminate (\"... shmem: could not create a message of size ...\") . Locally, you can circumvent this while testing by calling Bailout() explicitly. !!!! WARNING !!!! \033[0m", __FUNCTION__); + } // a) Book the profile holding flags: - qa.fQAHistogramsPro = new TProfile("fQAHistogramsPro", "flags for QA histograms", 3, 0., 3.); + qa.fQAHistogramsPro = new TProfile("fQAHistogramsPro", "flags for QA histograms", 4, 0., 4.); qa.fQAHistogramsPro->SetStats(kFALSE); qa.fQAHistogramsPro->SetLineColor(eColor); qa.fQAHistogramsPro->SetFillColor(eFillColor); @@ -1630,16 +2268,15 @@ void BookQAHistograms() qa.fQAHistogramsPro->Fill(1.5, static_cast(qa.fFillQAEventHistograms2D)); qa.fQAHistogramsPro->GetXaxis()->SetBinLabel(3, "fFillQAParticleHistograms2D"); qa.fQAHistogramsPro->Fill(2.5, static_cast(qa.fFillQAParticleHistograms2D)); + qa.fQAHistogramsPro->GetXaxis()->SetBinLabel(4, "fRebin"); + qa.fQAHistogramsPro->Fill(3.5, static_cast(qa.fRebin)); // ... qa.fQAList->Add(qa.fQAHistogramsPro); // b) Common local variables: - TString srs[2] = {"rec", "sim"}; - TString srs_long[2] = {"reconstructed", "simulated"}; - TString sba[2] = {"before", "after"}; - TString sba_long[2] = {"before cuts", "after cuts"}; + // ... // c) Book specific QA 2D event histograms: // Binning of 2D event histos: TBI 20240503 see if you can automate all this @@ -1652,35 +2289,185 @@ void BookQAHistograms() Double_t max_y_Event[eQAEventHistograms2D_N] = {0.}; TString title_y_Event[eQAEventHistograms2D_N] = {""}; - // *) "MultTPC_vs_NContributors": - nBins_x_Event[eMultTPC_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eMultTPC][0]); // TBI 20240702 add support for rebinning - min_x_Event[eMultTPC_vs_NContributors] = eh.fEventHistogramsBins[eMultTPC][1]; - max_x_Event[eMultTPC_vs_NContributors] = eh.fEventHistogramsBins[eMultTPC][2]; - title_x_Event[eMultTPC_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eMultTPC].Data()); - nBins_y_Event[eMultTPC_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eNContributors][0]); // TBI 20240702 add support for rebinning - min_y_Event[eMultTPC_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][1]; - max_y_Event[eMultTPC_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][2]; - title_y_Event[eMultTPC_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eNContributors].Data()); - - // *) "Vertex_z_vs_MultTPC": - nBins_x_Event[eVertex_z_vs_MultTPC] = static_cast(eh.fEventHistogramsBins[eVertex_z][0]); // TBI 20240702 add support for rebinning - min_x_Event[eVertex_z_vs_MultTPC] = eh.fEventHistogramsBins[eVertex_z][1]; - max_x_Event[eVertex_z_vs_MultTPC] = eh.fEventHistogramsBins[eVertex_z][2]; - title_x_Event[eVertex_z_vs_MultTPC] = FancyFormatting(eh.fEventHistogramsName[eVertex_z].Data()); - nBins_y_Event[eVertex_z_vs_MultTPC] = static_cast(eh.fEventHistogramsBins[eMultTPC][0]); // TBI 20240702 add support for rebinning - min_y_Event[eVertex_z_vs_MultTPC] = eh.fEventHistogramsBins[eMultTPC][1]; - max_y_Event[eVertex_z_vs_MultTPC] = eh.fEventHistogramsBins[eMultTPC][2]; - title_y_Event[eVertex_z_vs_MultTPC] = FancyFormatting(eh.fEventHistogramsName[eMultTPC].Data()); - - // *) "Vertex_z_vs_NContributors": - nBins_x_Event[eVertex_z_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eVertex_z][0]); // TBI 20240702 add support for rebinning - min_x_Event[eVertex_z_vs_NContributors] = eh.fEventHistogramsBins[eVertex_z][1]; - max_x_Event[eVertex_z_vs_NContributors] = eh.fEventHistogramsBins[eVertex_z][2]; - title_x_Event[eVertex_z_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eVertex_z].Data()); - nBins_y_Event[eVertex_z_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eNContributors][0]); // TBI 20240702 add support for rebinning - min_y_Event[eVertex_z_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][1]; - max_y_Event[eVertex_z_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][2]; - title_y_Event[eVertex_z_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eNContributors].Data()); + // *) "Multiplicity_vs_ReferenceMultiplicity": + nBins_x_Event[eMultiplicity_vs_ReferenceMultiplicity] = static_cast(eh.fEventHistogramsBins[eMultiplicity][0] / qa.fRebin); + min_x_Event[eMultiplicity_vs_ReferenceMultiplicity] = eh.fEventHistogramsBins[eMultiplicity][1]; + max_x_Event[eMultiplicity_vs_ReferenceMultiplicity] = eh.fEventHistogramsBins[eMultiplicity][2]; + title_x_Event[eMultiplicity_vs_ReferenceMultiplicity] = FancyFormatting(eh.fEventHistogramsName[eMultiplicity].Data()); + nBins_y_Event[eMultiplicity_vs_ReferenceMultiplicity] = static_cast(eh.fEventHistogramsBins[eReferenceMultiplicity][0] / qa.fRebin); + min_y_Event[eMultiplicity_vs_ReferenceMultiplicity] = eh.fEventHistogramsBins[eReferenceMultiplicity][1]; + max_y_Event[eMultiplicity_vs_ReferenceMultiplicity] = eh.fEventHistogramsBins[eReferenceMultiplicity][2]; + title_y_Event[eMultiplicity_vs_ReferenceMultiplicity] = FancyFormatting(eh.fEventHistogramsName[eReferenceMultiplicity].Data()); + + // *) "Multiplicity_vs_NContributors": + nBins_x_Event[eMultiplicity_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eMultiplicity][0] / qa.fRebin); + min_x_Event[eMultiplicity_vs_NContributors] = eh.fEventHistogramsBins[eMultiplicity][1]; + max_x_Event[eMultiplicity_vs_NContributors] = eh.fEventHistogramsBins[eMultiplicity][2]; + title_x_Event[eMultiplicity_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eMultiplicity].Data()); + nBins_y_Event[eMultiplicity_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eNContributors][0] / qa.fRebin); + min_y_Event[eMultiplicity_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][1]; + max_y_Event[eMultiplicity_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][2]; + title_y_Event[eMultiplicity_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eNContributors].Data()); + + // *) "Multiplicity_vs_Centrality": + nBins_x_Event[eMultiplicity_vs_Centrality] = static_cast(eh.fEventHistogramsBins[eMultiplicity][0] / qa.fRebin); + min_x_Event[eMultiplicity_vs_Centrality] = eh.fEventHistogramsBins[eMultiplicity][1]; + max_x_Event[eMultiplicity_vs_Centrality] = eh.fEventHistogramsBins[eMultiplicity][2]; + title_x_Event[eMultiplicity_vs_Centrality] = FancyFormatting(eh.fEventHistogramsName[eMultiplicity].Data()); + nBins_y_Event[eMultiplicity_vs_Centrality] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); + min_y_Event[eMultiplicity_vs_Centrality] = eh.fEventHistogramsBins[eCentrality][1]; + max_y_Event[eMultiplicity_vs_Centrality] = eh.fEventHistogramsBins[eCentrality][2]; + title_y_Event[eMultiplicity_vs_Centrality] = FancyFormatting(eh.fEventHistogramsName[eCentrality].Data()); + + // *) "Multiplicity_vs_Vertex_z": + nBins_x_Event[eMultiplicity_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eMultiplicity][0] / qa.fRebin); + min_x_Event[eMultiplicity_vs_Vertex_z] = eh.fEventHistogramsBins[eMultiplicity][1]; + max_x_Event[eMultiplicity_vs_Vertex_z] = eh.fEventHistogramsBins[eMultiplicity][2]; + title_x_Event[eMultiplicity_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eMultiplicity].Data()); + nBins_y_Event[eMultiplicity_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eVertex_z][0]); + min_y_Event[eMultiplicity_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][1]; + max_y_Event[eMultiplicity_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][2]; + title_y_Event[eMultiplicity_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eVertex_z].Data()); + + // *) "Multiplicity_vs_Occupancy": + nBins_x_Event[eMultiplicity_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eMultiplicity][0] / qa.fRebin); + min_x_Event[eMultiplicity_vs_Occupancy] = eh.fEventHistogramsBins[eMultiplicity][1]; + max_x_Event[eMultiplicity_vs_Occupancy] = eh.fEventHistogramsBins[eMultiplicity][2]; + title_x_Event[eMultiplicity_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eMultiplicity].Data()); + nBins_y_Event[eMultiplicity_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eOccupancy][0] / qa.fRebin); + min_y_Event[eMultiplicity_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][1]; + max_y_Event[eMultiplicity_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][2]; + title_y_Event[eMultiplicity_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eOccupancy].Data()); + + // *) "ReferenceMultiplicity_vs_NContributors": + nBins_x_Event[eReferenceMultiplicity_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eReferenceMultiplicity][0] / qa.fRebin); + min_x_Event[eReferenceMultiplicity_vs_NContributors] = eh.fEventHistogramsBins[eReferenceMultiplicity][1]; + max_x_Event[eReferenceMultiplicity_vs_NContributors] = eh.fEventHistogramsBins[eReferenceMultiplicity][2]; + title_x_Event[eReferenceMultiplicity_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eReferenceMultiplicity].Data()); + nBins_y_Event[eReferenceMultiplicity_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eNContributors][0] / qa.fRebin); + min_y_Event[eReferenceMultiplicity_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][1]; + max_y_Event[eReferenceMultiplicity_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][2]; + title_y_Event[eReferenceMultiplicity_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eNContributors].Data()); + + // *) "ReferenceMultiplicity_vs_Centrality": + nBins_x_Event[eReferenceMultiplicity_vs_Centrality] = static_cast(eh.fEventHistogramsBins[eReferenceMultiplicity][0] / qa.fRebin); + min_x_Event[eReferenceMultiplicity_vs_Centrality] = eh.fEventHistogramsBins[eReferenceMultiplicity][1]; + max_x_Event[eReferenceMultiplicity_vs_Centrality] = eh.fEventHistogramsBins[eReferenceMultiplicity][2]; + title_x_Event[eReferenceMultiplicity_vs_Centrality] = FancyFormatting(eh.fEventHistogramsName[eReferenceMultiplicity].Data()); + nBins_y_Event[eReferenceMultiplicity_vs_Centrality] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); + min_y_Event[eReferenceMultiplicity_vs_Centrality] = eh.fEventHistogramsBins[eCentrality][1]; + max_y_Event[eReferenceMultiplicity_vs_Centrality] = eh.fEventHistogramsBins[eCentrality][2]; + title_y_Event[eReferenceMultiplicity_vs_Centrality] = FancyFormatting(eh.fEventHistogramsName[eCentrality].Data()); + + // *) "ReferenceMultiplicity_vs_Vertex_z": + nBins_x_Event[eReferenceMultiplicity_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eReferenceMultiplicity][0] / qa.fRebin); + min_x_Event[eReferenceMultiplicity_vs_Vertex_z] = eh.fEventHistogramsBins[eReferenceMultiplicity][1]; + max_x_Event[eReferenceMultiplicity_vs_Vertex_z] = eh.fEventHistogramsBins[eReferenceMultiplicity][2]; + title_x_Event[eReferenceMultiplicity_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eReferenceMultiplicity].Data()); + nBins_y_Event[eReferenceMultiplicity_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eVertex_z][0]); + min_y_Event[eReferenceMultiplicity_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][1]; + max_y_Event[eReferenceMultiplicity_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][2]; + title_y_Event[eReferenceMultiplicity_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eVertex_z].Data()); + + // *) "ReferenceMultiplicity_vs_Occupancy": + nBins_x_Event[eReferenceMultiplicity_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eReferenceMultiplicity][0] / qa.fRebin); + min_x_Event[eReferenceMultiplicity_vs_Occupancy] = eh.fEventHistogramsBins[eReferenceMultiplicity][1]; + max_x_Event[eReferenceMultiplicity_vs_Occupancy] = eh.fEventHistogramsBins[eReferenceMultiplicity][2]; + title_x_Event[eReferenceMultiplicity_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eReferenceMultiplicity].Data()); + nBins_y_Event[eReferenceMultiplicity_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eOccupancy][0] / qa.fRebin); + min_y_Event[eReferenceMultiplicity_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][1]; + max_y_Event[eReferenceMultiplicity_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][2]; + title_y_Event[eReferenceMultiplicity_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eOccupancy].Data()); + + // *) "NContributors_vs_Centrality": + nBins_x_Event[eNContributors_vs_Centrality] = static_cast(eh.fEventHistogramsBins[eNContributors][0] / qa.fRebin); + min_x_Event[eNContributors_vs_Centrality] = eh.fEventHistogramsBins[eNContributors][1]; + max_x_Event[eNContributors_vs_Centrality] = eh.fEventHistogramsBins[eNContributors][2]; + title_x_Event[eNContributors_vs_Centrality] = FancyFormatting(eh.fEventHistogramsName[eNContributors].Data()); + nBins_y_Event[eNContributors_vs_Centrality] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); + min_y_Event[eNContributors_vs_Centrality] = eh.fEventHistogramsBins[eCentrality][1]; + max_y_Event[eNContributors_vs_Centrality] = eh.fEventHistogramsBins[eCentrality][2]; + title_y_Event[eNContributors_vs_Centrality] = FancyFormatting(eh.fEventHistogramsName[eCentrality].Data()); + + // *) "NContributors_vs_Vertex_z": + nBins_x_Event[eNContributors_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eNContributors][0] / qa.fRebin); + min_x_Event[eNContributors_vs_Vertex_z] = eh.fEventHistogramsBins[eNContributors][1]; + max_x_Event[eNContributors_vs_Vertex_z] = eh.fEventHistogramsBins[eNContributors][2]; + title_x_Event[eNContributors_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eNContributors].Data()); + nBins_y_Event[eNContributors_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eVertex_z][0]); + min_y_Event[eNContributors_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][1]; + max_y_Event[eNContributors_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][2]; + title_y_Event[eNContributors_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eVertex_z].Data()); + + // *) "NContributors_vs_Occupancy": + nBins_x_Event[eNContributors_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eNContributors][0] / qa.fRebin); + min_x_Event[eNContributors_vs_Occupancy] = eh.fEventHistogramsBins[eNContributors][1]; + max_x_Event[eNContributors_vs_Occupancy] = eh.fEventHistogramsBins[eNContributors][2]; + title_x_Event[eNContributors_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eNContributors].Data()); + nBins_y_Event[eNContributors_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eOccupancy][0] / qa.fRebin); + min_y_Event[eNContributors_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][1]; + max_y_Event[eNContributors_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][2]; + title_y_Event[eNContributors_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eOccupancy].Data()); + + // *) "Centrality_vs_Vertex_z": + nBins_x_Event[eCentrality_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); + min_x_Event[eCentrality_vs_Vertex_z] = eh.fEventHistogramsBins[eCentrality][1]; + max_x_Event[eCentrality_vs_Vertex_z] = eh.fEventHistogramsBins[eCentrality][2]; + title_x_Event[eCentrality_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eCentrality].Data()); + nBins_y_Event[eCentrality_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eVertex_z][0]); + min_y_Event[eCentrality_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][1]; + max_y_Event[eCentrality_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][2]; + title_y_Event[eCentrality_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eVertex_z].Data()); + + // *) "Centrality_vs_Occupancy": + nBins_x_Event[eCentrality_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); + min_x_Event[eCentrality_vs_Occupancy] = eh.fEventHistogramsBins[eCentrality][1]; + max_x_Event[eCentrality_vs_Occupancy] = eh.fEventHistogramsBins[eCentrality][2]; + title_x_Event[eCentrality_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eCentrality].Data()); + nBins_y_Event[eCentrality_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eOccupancy][0] / qa.fRebin); + min_y_Event[eCentrality_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][1]; + max_y_Event[eCentrality_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][2]; + title_y_Event[eCentrality_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eOccupancy].Data()); + + // *) "Centrality_vs_ImpactParameter": + nBins_x_Event[eCentrality_vs_ImpactParameter] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); + min_x_Event[eCentrality_vs_ImpactParameter] = eh.fEventHistogramsBins[eCentrality][1]; + max_x_Event[eCentrality_vs_ImpactParameter] = eh.fEventHistogramsBins[eCentrality][2]; + title_x_Event[eCentrality_vs_ImpactParameter] = FancyFormatting(eh.fEventHistogramsName[eCentrality].Data()); + nBins_y_Event[eCentrality_vs_ImpactParameter] = static_cast(eh.fEventHistogramsBins[eImpactParameter][0] / qa.fRebin); + min_y_Event[eCentrality_vs_ImpactParameter] = eh.fEventHistogramsBins[eImpactParameter][1]; + max_y_Event[eCentrality_vs_ImpactParameter] = eh.fEventHistogramsBins[eImpactParameter][2]; + title_y_Event[eCentrality_vs_ImpactParameter] = FancyFormatting(eh.fEventHistogramsName[eImpactParameter].Data()); + + // *) "Vertex_z_vs_Occupancy": + nBins_x_Event[eVertex_z_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eVertex_z][0]); + min_x_Event[eVertex_z_vs_Occupancy] = eh.fEventHistogramsBins[eVertex_z][1]; + max_x_Event[eVertex_z_vs_Occupancy] = eh.fEventHistogramsBins[eVertex_z][2]; + title_x_Event[eVertex_z_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eVertex_z].Data()); + nBins_y_Event[eVertex_z_vs_Occupancy] = static_cast(eh.fEventHistogramsBins[eOccupancy][0] / qa.fRebin); + min_y_Event[eVertex_z_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][1]; + max_y_Event[eVertex_z_vs_Occupancy] = eh.fEventHistogramsBins[eOccupancy][2]; + title_y_Event[eVertex_z_vs_Occupancy] = FancyFormatting(eh.fEventHistogramsName[eOccupancy].Data()); + + // *) "eMultNTracksPV_vs_MultNTracksGlobal": + nBins_x_Event[eMultNTracksPV_vs_MultNTracksGlobal] = static_cast(eh.fEventHistogramsBins[eMultiplicity][0] / qa.fRebin); + min_x_Event[eMultNTracksPV_vs_MultNTracksGlobal] = eh.fEventHistogramsBins[eMultiplicity][1]; + max_x_Event[eMultNTracksPV_vs_MultNTracksGlobal] = eh.fEventHistogramsBins[eMultiplicity][2]; + title_x_Event[eMultNTracksPV_vs_MultNTracksGlobal] = FancyFormatting(qa.fReferenceMultiplicityEstimatorName[eMultNTracksPV].Data()); + nBins_y_Event[eMultNTracksPV_vs_MultNTracksGlobal] = static_cast(eh.fEventHistogramsBins[eMultiplicity][0] / qa.fRebin); + min_y_Event[eMultNTracksPV_vs_MultNTracksGlobal] = eh.fEventHistogramsBins[eMultiplicity][1]; + max_y_Event[eMultNTracksPV_vs_MultNTracksGlobal] = eh.fEventHistogramsBins[eMultiplicity][2]; + title_y_Event[eMultNTracksPV_vs_MultNTracksGlobal] = FancyFormatting(qa.fReferenceMultiplicityEstimatorName[eMultNTracksGlobal].Data()); + + // *) "eCentFT0C_vs_CentNTPV": + nBins_x_Event[eCentFT0C_vs_CentNTPV] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); + min_x_Event[eCentFT0C_vs_CentNTPV] = eh.fEventHistogramsBins[eCentrality][1]; + max_x_Event[eCentFT0C_vs_CentNTPV] = eh.fEventHistogramsBins[eCentrality][2]; + title_x_Event[eCentFT0C_vs_CentNTPV] = FancyFormatting(qa.fCentralityEstimatorName[eCentFT0C].Data()); + nBins_y_Event[eCentFT0C_vs_CentNTPV] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); + min_y_Event[eCentFT0C_vs_CentNTPV] = eh.fEventHistogramsBins[eCentrality][1]; + max_y_Event[eCentFT0C_vs_CentNTPV] = eh.fEventHistogramsBins[eCentrality][2]; + title_y_Event[eCentFT0C_vs_CentNTPV] = FancyFormatting(qa.fCentralityEstimatorName[eCentNTPV].Data()); // *) "eCentFT0M_vs_CentNTPV": nBins_x_Event[eCentFT0M_vs_CentNTPV] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); @@ -1702,27 +2489,48 @@ void BookQAHistograms() max_y_Event[eCentRun2V0M_vs_CentRun2SPDTracklets] = eh.fEventHistogramsBins[eCentrality][2]; title_y_Event[eCentRun2V0M_vs_CentRun2SPDTracklets] = FancyFormatting(qa.fCentralityEstimatorName[eCentRun2SPDTracklets].Data()); - // *) "eCentRun2V0M_vs_NContributors": - nBins_x_Event[eCentRun2V0M_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eCentrality][0]); - min_x_Event[eCentRun2V0M_vs_NContributors] = eh.fEventHistogramsBins[eCentrality][1]; - max_x_Event[eCentRun2V0M_vs_NContributors] = eh.fEventHistogramsBins[eCentrality][2]; - title_x_Event[eCentRun2V0M_vs_NContributors] = FancyFormatting(qa.fCentralityEstimatorName[eCentRun2V0M].Data()); - nBins_y_Event[eCentRun2V0M_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eNContributors][0]); - min_y_Event[eCentRun2V0M_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][1]; - max_y_Event[eCentRun2V0M_vs_NContributors] = eh.fEventHistogramsBins[eNContributors][2]; - title_y_Event[eCentRun2V0M_vs_NContributors] = FancyFormatting(eh.fEventHistogramsName[eNContributors].Data()); + // *) "eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange": + nBins_x_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = static_cast(eh.fEventHistogramsBins[eOccupancy][0] / qa.fRebin); + min_x_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = eh.fEventHistogramsBins[eOccupancy][1]; + max_x_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = eh.fEventHistogramsBins[eOccupancy][2]; + title_x_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = FancyFormatting(qa.fOccupancyEstimatorName[eTrackOccupancyInTimeRange].Data()); + nBins_y_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = static_cast(eh.fEventHistogramsBins[eOccupancy][0] / qa.fRebin); + min_y_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = eh.fEventHistogramsBins[eOccupancy][1]; + max_y_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = eh.fEventHistogramsBins[eOccupancy][2]; + title_y_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = FancyFormatting(qa.fOccupancyEstimatorName[eFT0COccupancyInTimeRange].Data()); + + // *) "eCurrentRunDuration_vs_InteractionRate": + nBins_x_Event[eCurrentRunDuration_vs_InteractionRate] = static_cast(eh.fEventHistogramsBins[eCurrentRunDuration][0] / qa.fRebin); + min_x_Event[eCurrentRunDuration_vs_InteractionRate] = eh.fEventHistogramsBins[eCurrentRunDuration][1]; + max_x_Event[eCurrentRunDuration_vs_InteractionRate] = eh.fEventHistogramsBins[eCurrentRunDuration][2]; + title_x_Event[eCurrentRunDuration_vs_InteractionRate] = FancyFormatting(eh.fEventHistogramsName[eCurrentRunDuration].Data()); + nBins_y_Event[eCurrentRunDuration_vs_InteractionRate] = static_cast(eh.fEventHistogramsBins[eInteractionRate][0] / qa.fRebin); + min_y_Event[eCurrentRunDuration_vs_InteractionRate] = eh.fEventHistogramsBins[eInteractionRate][1]; + max_y_Event[eCurrentRunDuration_vs_InteractionRate] = eh.fEventHistogramsBins[eInteractionRate][2]; + title_y_Event[eCurrentRunDuration_vs_InteractionRate] = FancyFormatting(eh.fEventHistogramsName[eInteractionRate].Data()); // ... // *) Quick insanity check on title_x_Event and title_y_Event: for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) { + + // **) title_x_Event: + if (tc.fVerbose) { + LOGF(info, "\033[1;32m title_x_Event[%d] = %s \033[0m", t, title_x_Event[t].Data()); + } if (title_x_Event[t].EqualTo("")) { LOGF(fatal, "\033[1;31m%s at line %d : title_x_Event[%d] is not set, check corresponding enum \033[0m", __FUNCTION__, __LINE__, t); } + + // **) title_y_Event: + if (tc.fVerbose) { + LOGF(info, "\033[1;32m title_y_Event[%d] = %s \033[0m", t, title_y_Event[t].Data()); + } if (title_y_Event[t].EqualTo("")) { LOGF(fatal, "\033[1;31m%s at line %d : title_y_Event[%d] is not set, check corresponding enum \033[0m", __FUNCTION__, __LINE__, t); } - } + + } // for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) { // Okay, let's book 'em all: for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) // type, see enum eQAEventHistograms2D @@ -1732,24 +2540,28 @@ void BookQAHistograms() } for (Int_t rs = 0; rs < 2; rs++) // reco/sim { - // If I am analyzing only reconstructed data, do not book histos for simulated, and vice versa. - // TBI 20240223 tc.fProcess[eProcessTest] is treated as tc.fProcess[eProcessRec], for the time being - if ((tc.fProcess[eGenericRec] && rs == eSim) || (tc.fProcess[eGenericSim] && rs == eRec)) { - continue; - } - // If I am doing internal validation, I need only sim: - if (iv.fUseInternalValidation && rs == eRec) { + if (Skip(rs)) { continue; } for (Int_t ba = 0; ba < 2; ba++) // before/after cuts { + + // Special treatment for eMultiplicity => I will never fill this one before the cuts, if Multiplicity = SelectedTracks, obviously: + if (ba == eBefore && (title_x_Event[t].BeginsWith("Multiplicity") || title_y_Event[t].BeginsWith("Multiplicity")) && ec.fsEventCuts[eMultiplicityEstimator].EqualTo("SelectedTracks", TString::kIgnoreCase)) { + // TBI 20241123 what remains ill-defined is the case when Multiplicity != SelectedTracks , check that further + // TBI 20241123 not sure if checking with BeginsWith(...) x2 is robust enough + // TBI 20241123 just like I have Skip(rs), introduce the same thingie for "ba" counter + propagate to other member functions + // TBI 20241124 there is a corner case when eMultiplicityEstimator itself is "ReferenceMultiplicity" => all 2D QA booked both before and after cuts, + // but it's filled trivially before the cuts, because Multiplicity is always 0. Re-think this at some point. + continue; + } + qa.fQAEventHistograms2D[t][rs][ba] = new TH2F( - Form("fQAEventHistograms2D[%s][%s][%s]", qa.fEventHistogramsName2D[t].Data(), srs[rs].Data(), sba[ba].Data()), - Form("%s, %s, %s", "__RUN_NUMBER__", srs_long[rs].Data(), sba_long[ba].Data()), // __RUN_NUMBER__ is handled in DetermineAndPropagateRunNumber(T const& collision) + Form("fQAEventHistograms2D[%s][%s][%s]", qa.fEventHistogramsName2D[t].Data(), gc.srs[rs].Data(), gc.sba[ba].Data()), + Form("%s, %s, %s", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.sba_long[ba].Data()), // __RUN_NUMBER__ is handled in PropagateRunNumber(...) nBins_x_Event[t], min_x_Event[t], max_x_Event[t], nBins_y_Event[t], min_y_Event[t], max_y_Event[t]); - qa.fQAEventHistograms2D[t][rs][ba]->GetXaxis()->SetTitle(title_x_Event[t].Data()); qa.fQAEventHistograms2D[t][rs][ba]->GetYaxis()->SetTitle(title_y_Event[t].Data()); qa.fQAEventHistograms2D[t][rs][ba]->SetLineColor(ec.fBeforeAfterColor[ba]); @@ -1803,22 +2615,16 @@ void BookQAHistograms() } for (Int_t rs = 0; rs < 2; rs++) // reco/sim { - // If I am analyzing only reconstructed data, do not book histos for simulated, and vice versa. - // TBI 20240223 tc.fProcess[eProcessTest] is treated as tc.fProcess[eProcessRec], for the time being - if ((tc.fProcess[eGenericRec] && rs == eSim) || (tc.fProcess[eGenericSim] && rs == eRec)) { - continue; - } - // If I am doing internal validation, I need only sim: - if (iv.fUseInternalValidation && rs == eRec) { + if (Skip(rs)) { continue; } for (Int_t ba = 0; ba < 2; ba++) // before/after cuts { qa.fQAParticleHistograms2D[t][rs][ba] = new TH2F( - Form("fQAParticleHistograms2D[%s][%s][%s]", qa.fParticleHistogramsName2D[t].Data(), srs[rs].Data(), sba[ba].Data()), - Form("%s, %s, %s", "__RUN_NUMBER__", srs_long[rs].Data(), sba_long[ba].Data()), // __RUN_NUMBER__ is handled in DetermineAndPropagateRunNumber(T const& collision) + Form("fQAParticleHistograms2D[%s][%s][%s]", qa.fParticleHistogramsName2D[t].Data(), gc.srs[rs].Data(), gc.sba[ba].Data()), + Form("%s, %s, %s", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.sba_long[ba].Data()), // __RUN_NUMBER__ is handled in PropagateRunNumber(...) nBins_x_Particle[t], min_x_Particle[t], max_x_Particle[t], nBins_y_Particle[t], min_y_Particle[t], max_y_Particle[t]); qa.fQAParticleHistograms2D[t][rs][ba]->GetXaxis()->SetTitle(title_x_Particle[t].Data()); @@ -1831,6 +2637,10 @@ void BookQAHistograms() } // for(Int_t rs=0;rs<2;rs++) // reco/sim } // for(Int_t t=0;tAdd(eh.fEventHistogramsPro); // b) Book specific control event histograms 1D: - TString srs[2] = {"rec", "sim"}; - TString srs_long[2] = {"reconstructed", "simulated"}; - TString sba[2] = {"before", "after"}; - TString sba_long[2] = {"before cuts", "after cuts"}; + // ... for (Int_t t = 0; t < eEventHistograms_N; t++) // type, see enum eEventHistograms { if (!eh.fBookEventHistograms[t]) { continue; } + for (Int_t rs = 0; rs < 2; rs++) // reco/sim { - // If I am analyzing only reconstructed data, do not book histos for simulated, and vice versa. - // TBI 20240223 tc.fProcess[eProcessTest] is treated as tc.fProcess[eProcessRec], for the time being - if ((tc.fProcess[eGenericRec] && rs == eSim) || (tc.fProcess[eGenericSim] && rs == eRec)) { - continue; - } - - // If I am doing internal validation, I need only sim: - if (iv.fUseInternalValidation && rs == eRec) { + if (Skip(rs)) { continue; } for (Int_t ba = 0; ba < 2; ba++) // before/after cuts { - // Special treatment for eSelectedTracks => I will never fill this one before the cuts, obviously: - if (ba == eBefore && eh.fEventHistogramsName[t].EqualTo("SelectedTracks")) { + // Special treatment for eMultiplicity => I will never fill this one before the cuts, if Multiplicity = SelectedTracks, obviously: + if (ba == eBefore && eh.fEventHistogramsName[t].EqualTo("Multiplicity") && ec.fsEventCuts[eMultiplicityEstimator].EqualTo("SelectedTracks", TString::kIgnoreCase)) { + // TBI 20241123 what remains ill-defined is the case when Multiplicity != SelectedTracks , check that further continue; } - - eh.fEventHistograms[t][rs][ba] = new TH1D( - Form("fEventHistograms[%s][%s][%s]", eh.fEventHistogramsName[t].Data(), srs[rs].Data(), sba[ba].Data()), - Form("%s, %s, %s", "__RUN_NUMBER__", srs_long[rs].Data(), sba_long[ba].Data()), // __RUN_NUMBER__ is handled in DetermineAndPropagateRunNumber(T const& collision) + eh.fEventHistograms[t][rs][ba] = new TH1F( + Form("fEventHistograms[%s][%s][%s]", eh.fEventHistogramsName[t].Data(), gc.srs[rs].Data(), gc.sba[ba].Data()), + Form("%s, %s, %s", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.sba_long[ba].Data()), // __RUN_NUMBER__ is handled in PropagateRunNumber(...) static_cast(eh.fEventHistogramsBins[t][0]), eh.fEventHistogramsBins[t][1], eh.fEventHistogramsBins[t][2]); - eh.fEventHistograms[t][rs][ba]->GetXaxis()->SetTitle(FancyFormatting(eh.fEventHistogramsName[t].Data())); eh.fEventHistograms[t][rs][ba]->SetLineColor(ec.fBeforeAfterColor[ba]); eh.fEventHistograms[t][rs][ba]->SetFillColor(ec.fBeforeAfterColor[ba] - 10); @@ -1903,6 +2703,10 @@ void BookEventHistograms() } // for(Int_t rs=0;rs<2;rs++) // reco/sim } // for(Int_t t=0;t(eEventCuts_N) + 0.5); + ec.fEventCutCounterHist[rs][cc] = new TH1I(Form("fEventCutCounterHist[%s][%s]", gc.srs[rs].Data(), gc.scc[cc].Data()), Form("%s, %s, event cut counter (%s)", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.scc_long[cc].Data()), eEventCuts_N, 0.5, static_cast(eEventCuts_N) + 0.5); // I cast in double the last argument, because that's what this particular TH1I constructor expects + // Yes, +0.5, because eEventCuts kicks off from 0 ec.fEventCutCounterHist[rs][cc]->SetStats(kFALSE); ec.fEventCutCounterHist[rs][cc]->SetLineColor(eColor); ec.fEventCutCounterHist[rs][cc]->SetFillColor(eFillColor); @@ -1977,6 +2773,10 @@ void BookEventCutsHistograms() } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookEventCutsHistograms() //============================================================ @@ -1990,7 +2790,7 @@ void BookParticleHistograms() // c) Book specific particle histograms 2D. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: @@ -2005,11 +2805,7 @@ void BookParticleHistograms() ph.fParticleHistogramsList->Add(ph.fParticleHistogramsPro); // b) Book specific particle histograms 1D: - TString srs[2] = {"rec", "sim"}; - TString srs_long[2] = {"reconstructed", "simulated"}; - TString sba[2] = {"before", "after"}; - TString sba_long[2] = {"before cuts", "after cuts"}; - + // ... for (Int_t t = 0; t < eParticleHistograms_N; t++) // type, see enum eParticleHistograms { if (!ph.fBookParticleHistograms[t]) { @@ -2018,8 +2814,7 @@ void BookParticleHistograms() for (Int_t rs = 0; rs < 2; rs++) // reco/sim { - // **) If I am analyzing only reconstructed data, do not book histos for simulated, and vice versa. - if ((tc.fProcess[eGenericRec] && rs == eSim) || (tc.fProcess[eGenericSim] && rs == eRec)) { + if (Skip(rs)) { continue; } @@ -2030,15 +2825,10 @@ void BookParticleHistograms() } } - // **) If I am doing internal validation, I need only sim: - if (iv.fUseInternalValidation && rs == eRec) { - continue; - } - for (Int_t ba = 0; ba < 2; ba++) // before/after cuts { - ph.fParticleHistograms[t][rs][ba] = new TH1D(Form("fParticleHistograms[%s][%s][%s]", ph.fParticleHistogramsName[t].Data(), srs[rs].Data(), sba[ba].Data()), - Form("%s, %s, %s", "__RUN_NUMBER__", srs_long[rs].Data(), sba_long[ba].Data()), + ph.fParticleHistograms[t][rs][ba] = new TH1F(Form("fParticleHistograms[%s][%s][%s]", ph.fParticleHistogramsName[t].Data(), gc.srs[rs].Data(), gc.sba[ba].Data()), + Form("%s, %s, %s", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.sba_long[ba].Data()), static_cast(ph.fParticleHistogramsBins[t][0]), ph.fParticleHistogramsBins[t][1], ph.fParticleHistogramsBins[t][2]); ph.fParticleHistograms[t][rs][ba]->SetLineColor(ec.fBeforeAfterColor[ba]); ph.fParticleHistograms[t][rs][ba]->SetFillColor(ec.fBeforeAfterColor[ba] - 10); @@ -2078,33 +2868,35 @@ void BookParticleHistograms() } for (Int_t rs = 0; rs < 2; rs++) // reco/sim { - if ((tc.fProcess[eGenericRec] && rs == eSim) || (tc.fProcess[eGenericSim] && rs == eRec)) { - continue; // if I am analyzing only reconstructed data, do not book histos for simulated, and vice versa. + + if (Skip(rs)) { + continue; } + for (Int_t ba = 0; ba < 2; ba++) // before/after cuts { // optional variable-length binning for y-axis (for supported observables): if (ph.fParticleHistogramsName2D[t].EqualTo("Phi_vs_Pt") && res.fUseResultsProVariableLengthBins[AFO_PT]) { - // Remark: placeholder __RUN_NUMBER__ is handled in DetermineAndPropagateRunNumber(T const& collision) + // Remark: placeholder __RUN_NUMBER__ is handled in PropagateRunNumber(...) // *) variable-length binning for phi vs pt, but only in pt axis: - ph.fParticleHistograms2D[t][rs][ba] = new TH2D(Form("fParticleHistograms2D[%s][%s][%s]", ph.fParticleHistogramsName2D[t].Data(), srs[rs].Data(), sba[ba].Data()), - Form("%s, %s, %s", "__RUN_NUMBER__", srs_long[rs].Data(), sba_long[ba].Data()), + ph.fParticleHistograms2D[t][rs][ba] = new TH2D(Form("fParticleHistograms2D[%s][%s][%s]", ph.fParticleHistogramsName2D[t].Data(), gc.srs[rs].Data(), gc.sba[ba].Data()), + Form("%s, %s, %s", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.sba_long[ba].Data()), static_cast(ph.fParticleHistogramsBins2D[t][eX][0]), ph.fParticleHistogramsBins2D[t][eX][1], ph.fParticleHistogramsBins2D[t][eX][2], res.fResultsPro[AFO_PT]->GetXaxis()->GetXbins()->GetSize() - 1, res.fResultsPro[AFO_PT]->GetXaxis()->GetXbins()->GetArray()); // yes, x-axis of "results vs pt" hist is y-axis here for 2D. } else if (ph.fParticleHistogramsName2D[t].EqualTo("Phi_vs_Eta") && res.fUseResultsProVariableLengthBins[AFO_ETA]) { // *) variable-length binning for phi vs eta, but only in eta axis: - ph.fParticleHistograms2D[t][rs][ba] = new TH2D(Form("fParticleHistograms2D[%s][%s][%s]", ph.fParticleHistogramsName2D[t].Data(), srs[rs].Data(), sba[ba].Data()), - Form("%s, %s, %s", "__RUN_NUMBER__", srs_long[rs].Data(), sba_long[ba].Data()), + ph.fParticleHistograms2D[t][rs][ba] = new TH2D(Form("fParticleHistograms2D[%s][%s][%s]", ph.fParticleHistogramsName2D[t].Data(), gc.srs[rs].Data(), gc.sba[ba].Data()), + Form("%s, %s, %s", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.sba_long[ba].Data()), static_cast(ph.fParticleHistogramsBins2D[t][eX][0]), ph.fParticleHistogramsBins2D[t][eX][1], ph.fParticleHistogramsBins2D[t][eX][2], res.fResultsPro[AFO_ETA]->GetXaxis()->GetXbins()->GetSize() - 1, res.fResultsPro[AFO_ETA]->GetXaxis()->GetXbins()->GetArray()); // yes, x-axis of "results vs pt" hist is y-axis here for 2D } else { // default fixed-length binning: - ph.fParticleHistograms2D[t][rs][ba] = new TH2D(Form("fParticleHistograms2D[%s][%s][%s]", ph.fParticleHistogramsName2D[t].Data(), srs[rs].Data(), sba[ba].Data()), - Form("%s, %s, %s", "__RUN_NUMBER__", srs_long[rs].Data(), sba_long[ba].Data()), + ph.fParticleHistograms2D[t][rs][ba] = new TH2D(Form("fParticleHistograms2D[%s][%s][%s]", ph.fParticleHistogramsName2D[t].Data(), gc.srs[rs].Data(), gc.sba[ba].Data()), + Form("%s, %s, %s", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.sba_long[ba].Data()), static_cast(ph.fParticleHistogramsBins2D[t][eX][0]), ph.fParticleHistogramsBins2D[t][eX][1], ph.fParticleHistogramsBins2D[t][eX][2], static_cast(ph.fParticleHistogramsBins2D[t][eY][0]), ph.fParticleHistogramsBins2D[t][eY][1], ph.fParticleHistogramsBins2D[t][eY][2]); } @@ -2118,6 +2910,10 @@ void BookParticleHistograms() } // for(Int_t t=0;t(eParticleCuts_N) + 0.5); + pc.fParticleCutCounterHist[rs][cc] = new TH1I(Form("fParticleCutCounterHist[%s][%s]", gc.srs[rs].Data(), gc.scc[cc].Data()), Form("%s, %s, particle cut counter (%s)", "__RUN_NUMBER__", gc.srs_long[rs].Data(), gc.scc_long[cc].Data()), eParticleCuts_N, 0.5, static_cast(eParticleCuts_N) + 0.5); + // I cast in double the last argument, because that's what this particular TH1I constructor expects + // Yes, +0.5, because eParticleCuts kicks off from 0 pc.fParticleCutCounterHist[rs][cc]->SetStats(kFALSE); pc.fParticleCutCounterHist[rs][cc]->SetLineColor(eColor); pc.fParticleCutCounterHist[rs][cc]->SetFillColor(eFillColor); @@ -2203,6 +2991,10 @@ void BookParticleCutsHistograms() } } // if(pc.fUseParticleCuts[ePtDependentDCAxyParameterization]) { + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookParticleCutsHistograms() //============================================================ @@ -2212,10 +3004,11 @@ void BookQvectorHistograms() // Book all Q-vector histograms. // a) Book the profile holding flags; - // b) ... + // b) Book multiplicity distributions in A and B, for each eta separation; + // c) ... if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: @@ -2233,7 +3026,44 @@ void BookQvectorHistograms() qv.fQvectorFlagsPro->Fill(2.5, gMaxCorrelator); qv.fQvectorList->Add(qv.fQvectorFlagsPro); - // b) ... + // b) Book multiplicity distributions in A and B, for each eta separation: + TString sEtaSep[2] = {"A", "B"}; // A <=> -eta , B <=> + eta + TString sEtaSep_long[2] = {Form("%.2f < #eta <", pc.fdParticleCuts[eEta][eMin]), Form("< #eta < %.2f", pc.fdParticleCuts[eEta][eMax])}; + // yes, here I define first the part of intervals as etaCutMin < eta < "subevent boundary", and "subevent" boundary < eta < etaCutMax + // Then below in the loop, I inject for "subevent boundary" the corresponding fEtaSeparationsValues (devided by 2, becaus it's symmetric round 0) + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t rs = 0; rs < 2; rs++) { // reco/sim + if (Skip(rs)) { + continue; + } + for (Int_t ba = 0; ba < 2; ba++) { // before/after cuts + if (eBefore == ba) { + continue; // it make sense to fill these histos only for "eAfter", because Q-vectors are not filled for "eBefore" + } + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + qv.fMabDist[ab][rs][ba][e] = new TH1F(Form("fMabDist[%s][%s][%s][%d]", sEtaSep[ab].Data(), gc.srs[rs].Data(), gc.sba[ba].Data(), e), + Form("%s, %s, %s, %s", "__RUN_NUMBER__", + 0 == ab ? Form("%s -%.2f", sEtaSep_long[ab].Data(), es.fEtaSeparationsValues[e] / 2.) : Form("%.2f %s", es.fEtaSeparationsValues[e] / 2., sEtaSep_long[ab].Data()), gc.srs_long[rs].Data(), gc.sba_long[ba].Data()), + static_cast(eh.fEventHistogramsBins[eMultiplicity][0]), eh.fEventHistogramsBins[eMultiplicity][1], eh.fEventHistogramsBins[eMultiplicity][2]); // TBI 20241207 I have hardwired in this constructor "0 == ab", this can backfire... + qv.fMabDist[ab][rs][ba][e]->SetLineColor(ec.fBeforeAfterColor[ba]); + qv.fMabDist[ab][rs][ba][e]->SetFillColor(ec.fBeforeAfterColor[ba] - 10); + qv.fMabDist[ab][rs][ba][e]->GetXaxis()->SetTitle("subevent multiplicity (sum of particle weights)"); + qv.fMabDist[ab][rs][ba][e]->SetMinimum(1.e-4); // so that I can switch to log scale, even if some bins are empty + // Remark: For empty histograms, when plotting interactively, because of this line, I will get + // E-TCanvas::Range: illegal world coordinates range .... + // But it's harmless, because in any case I do not care about the content of empty histogram... + qv.fMabDist[ab][rs][ba][e]->SetOption("hist"); // do not plot marker and error (see BanishmentLoopOverParticles why errors are not reliable) for each bin, only content + filled area. + qv.fQvectorList->Add(qv.fMabDist[ab][rs][ba][e]); + } + } + } + } + + // c) ... + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } } // void BookQvectorHistograms() @@ -2249,12 +3079,12 @@ void BookCorrelationsHistograms() // d) Few quick insanity checks on booking. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: mupa.fCorrelationsFlagsPro = new TProfile("fCorrelationsFlagsPro", - "flags for correlations", 1, 0., 31); + "flags for correlations", 1, 0., 1.); mupa.fCorrelationsFlagsPro->SetStats(kFALSE); mupa.fCorrelationsFlagsPro->SetLineColor(eColor); mupa.fCorrelationsFlagsPro->SetFillColor(eFillColor); @@ -2281,16 +3111,41 @@ void BookCorrelationsHistograms() { for (Int_t n = 0; n < gMaxHarmonic; n++) // harmonic { - for (Int_t v = 0; v < eAsFunctionOf_N; - v++) // variable [0=integrated,1=vs. multiplicity,2=vs. centrality,3=pt,4=eta] - { + for (Int_t v = 0; v < eAsFunctionOf_N; v++) { + + // decide what is booked, then later valid pointer to fCorrelationsPro[k][n][v] is used as a boolean, in the standard way: + if (AFO_INTEGRATED == v && !mupa.fCalculateCorrelationsAsFunctionOf[AFO_INTEGRATED]) { + continue; + } + if (AFO_MULTIPLICITY == v && !mupa.fCalculateCorrelationsAsFunctionOf[AFO_MULTIPLICITY]) { + continue; + } + if (AFO_CENTRALITY == v && !mupa.fCalculateCorrelationsAsFunctionOf[AFO_CENTRALITY]) { + continue; + } + if (AFO_PT == v && !mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT]) { + continue; + } + if (AFO_ETA == v && !mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA]) { + continue; + } + if (AFO_OCCUPANCY == v && !mupa.fCalculateCorrelationsAsFunctionOf[AFO_OCCUPANCY]) { + continue; + } + if (AFO_INTERACTIONRATE == v && !mupa.fCalculateCorrelationsAsFunctionOf[AFO_INTERACTIONRATE]) { + continue; + } + if (AFO_CURRENTRUNDURATION == v && !mupa.fCalculateCorrelationsAsFunctionOf[AFO_CURRENTRUNDURATION]) { + continue; + } + if (!res.fResultsPro[v]) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } mupa.fCorrelationsPro[k][n][v] = reinterpret_cast(res.fResultsPro[v]->Clone(Form("fCorrelationsPro[%d][%d][%s]", k, n, res.fResultsProRawName[v].Data()))); // yes mupa.fCorrelationsPro[k][n][v]->SetStats(kFALSE); mupa.fCorrelationsPro[k][n][v]->Sumw2(); - mupa.fCorrelationsPro[k][n][v]->GetXaxis()->SetTitle(res.fResultsProXaxisTitle[v].Data()); + mupa.fCorrelationsPro[k][n][v]->GetXaxis()->SetTitle(FancyFormatting(res.fResultsProXaxisTitle[v].Data())); mupa.fCorrelationsPro[k][n][v]->GetYaxis()->SetTitle(Form("#LT#LTcos[%s(%s)]#GT#GT", 1 == n + 1 ? "" : Form("%d", n + 1), oVariable[k].Data())); mupa.fCorrelationsList->Add(mupa.fCorrelationsPro[k][n][v]); } @@ -2305,6 +3160,10 @@ void BookCorrelationsHistograms() LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); // ordering in enum eAsFunctionOf is not the same as in TString fResultsProXaxisTitle[eAsFunctionOf_N] } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // BookCorrelationsHistograms() //============================================================ @@ -2318,7 +3177,7 @@ void BookWeightsHistograms() // c) Histograms for differential weights. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: @@ -2356,10 +3215,51 @@ void BookWeightsHistograms() // c) Histograms for differential weights: // Same comment applies as for b) => add histograms to the list, only after they are cloned from external files. + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookWeightsHistograms() //============================================================ +void BookCentralityWeightsHistograms() +{ + // Book all objects for centrality weights. + + // a) Book the profile holding flags; + // b) Histograms for centrality weights. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Book the profile holding flags: + cw.fCentralityWeightsFlagsPro = + new TProfile("fWeightsFlagsPro", "flags for centrality weights", 1, 0., 1.); + cw.fCentralityWeightsFlagsPro->SetStats(kFALSE); + cw.fCentralityWeightsFlagsPro->SetLineColor(eColor); + cw.fCentralityWeightsFlagsPro->SetFillColor(eFillColor); + cw.fCentralityWeightsFlagsPro->GetXaxis()->SetLabelSize(0.05); + cw.fCentralityWeightsFlagsPro->GetXaxis()->SetBinLabel(1, "TBI 20241118 I need to store here name of centrality esimator for which centrality weights were calculated"); + if (cw.fUseCentralityWeights) { + cw.fCentralityWeightsFlagsPro->Fill(0.5, 1.); // TBI 20241118 shall I automate this? + } + cw.fCentralityWeightsList->Add(cw.fCentralityWeightsFlagsPro); + + // b) Histograms for centrality weights: + // As of 20240216, I have abandoned the idea to generate centrality weights internally, centrality weights + // are always fetched and cloned from external files, in any case (local, AliEn, CCDB). + // Therefore, add histos with centrality weights to this list only after they are cloned from external files. + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void BookCentralityWeightsHistograms() + +//============================================================ + void BookNestedLoopsHistograms() { // Book all nested loops histograms. @@ -2370,7 +3270,7 @@ void BookNestedLoopsHistograms() // d) Few quick insanity checks on booking. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: @@ -2433,9 +3333,7 @@ void BookNestedLoopsHistograms() for (Int_t n = 0; n < gMaxHarmonic; n++) // harmonic { - for (Int_t v = 0; v < eAsFunctionOf_N; - v++) // variable [0=integrated,1=vs. multiplicity,2=vs. centrality,3=pt,4=eta] - { + for (Int_t v = 0; v < eAsFunctionOf_N; v++) { // if(PTKINE == v && !fCalculatePtCorrelations){continue;} // if(ETAKINE == v && !fCalculateEtaCorrelations){continue;} @@ -2473,6 +3371,10 @@ void BookNestedLoopsHistograms() LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); // ordering in enum eAsFunctionOf is not the same as in TString fResultsProXaxisTitle[eAsFunctionOf_N] } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookNestedLoopsHistograms() //============================================================ @@ -2486,7 +3388,7 @@ void BookNUAHistograms() // c) Histograms. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: @@ -2611,6 +3513,10 @@ void BookNUAHistograms() } // for(Int_t pdf=0;pdfSetStats(kFALSE); iv.fInternalValidationFlagsPro->SetLineColor(eColor); iv.fInternalValidationFlagsPro->SetFillColor(eFillColor); @@ -2698,6 +3604,10 @@ void BookInternalValidationHistograms() LOGF(fatal, "\033[1;31m%s at line %d : iv.fMultRangeInternalValidation[eMin] >= iv.fMultRangeInternalValidation[eMax] \n \033[0m", __FUNCTION__, __LINE__); } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // BookInternalValidationHistograms() //============================================================ @@ -2712,7 +3622,7 @@ TComplex TheoreticalValue(TArrayI* harmonics, TArrayD* amplitudes, TArrayD* plan // c) Return value. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Insanity checks: @@ -2737,6 +3647,9 @@ TComplex TheoreticalValue(TArrayI* harmonics, TArrayD* amplitudes, TArrayD* plan } // for(Int_t h=0;hGetSize();h++) // c) Return value: + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } return value; } // TComplex TheoreticalValue(TArrayI *harmonics, TArrayD *amplitudes, TArrayD *planes) @@ -2747,21 +3660,38 @@ void InternalValidation() { // Internal validation against theoretical values in on-the-fly study for all implemented correlators. + // Last update: 20241111 + // To do: // 20231114 Do I need to add support for diff. weights also here? + // *) Set and propagate some fake run number; + // *) Fetch the weights for this particular run number. Do it only once; // a) Fourier like p.d.f. for azimuthal angles and flow amplitudes; // b) Loop over on-the-fly events. - // b0) Reset ebe quantities; + // b0) Reset ebye quantities; // b1) Determine multiplicity, centrality, reaction plane and configure p.d.f. for azimuthal angles if harmonics are not constant e-by-e; - // b2) Fill event histograms; + // b2) Fill event histograms before cuts; // b3) Loop over particles; - // b4) Calculate correlations; - // b5) Optionally, cross-check with nested loops; + // b4) Fill event histograms after cuts; + // b5) Calculate everything for selected events and particles; // c) Delete persistent objects. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); + } + + // *) Set and propagate some fake run number: + tc.fRunNumber = "123456"; + PropagateRunNumber(); + + // *) Fetch the weights for this particular run number. Do it only once. + // TBI 20231012 If eventualy I can access programatically run number in init(...) at run time, this shall go there. + if (!pw.fParticleWeightsAreFetched) { + if (pw.fUseWeights[wPHI] || pw.fUseWeights[wPT] || pw.fUseWeights[wETA] || pw.fUseDiffWeights[wPHIPT] || pw.fUseDiffWeights[wPHIETA]) { + GetParticleWeights(); + pw.fParticleWeightsAreFetched = kTRUE; + } } // a) Fourier like p.d.f. for azimuthal angles and flow amplitudes: @@ -2796,7 +3726,7 @@ void InternalValidation() for (Int_t h = 0; h < 2 * gMaxHarmonic; h++) { LOGF(info, Form("%d %s = %f", h, fPhiPDF->GetParName(h), fPhiPDF->GetParameter(h))); } - LOGF(info, " Remark: Parameter [18] at the moment is reaction plane.\n"); + LOGF(info, "Remark: Parameter [18] at the moment is reaction plane.\n"); } // if (tc.fVerbose) { } else if (iv.fHarmonicsOptionInternalValidation->EqualTo("correlated")) { // if(iv.fHarmonicsOptionInternalValidation->EqualTo("constant")) // For this option, three selected vn's (v1,v2,v3) are correlated, and all psin's are set to zero, for simplicity. @@ -2819,53 +3749,56 @@ void InternalValidation() } // else if(fHarmonicsOptionInternalValidation->EqualTo("correlated")) // b) Loop over on-the-fly events: - // Double_t step = 10.; // in percentage. Used only for the printout of progress - // TStopwatch watch; - // watch.Start(); Double_t v1 = 0., v2 = 0., v3 = 0.; for (Int_t e = 0; e < static_cast(iv.fnEventsInternalValidation); e++) { - // b0) Reset ebe quantities: + // b0) Reset ebye quantities: ResetEventByEventQuantities(); // b1) Determine multiplicity, centrality, reaction plane and configure p.d.f. for azimuthal angles if harmonics are not constant e-by-e: - Int_t nMult = gRandom->Uniform(iv.fMultRangeInternalValidation[eMin], iv.fMultRangeInternalValidation[eMax]); + Int_t nMult = static_cast(gRandom->Uniform(iv.fMultRangeInternalValidation[eMin], iv.fMultRangeInternalValidation[eMax])); - Double_t fReactionPlane = gRandom->Uniform(0., TMath::TwoPi()); + Double_t fReactionPlane = gRandom->Uniform(0., TMath::TwoPi()); // no cast is needed, since Uniform(...) returns double if (iv.fHarmonicsOptionInternalValidation->EqualTo("constant")) { fPhiPDF->SetParameter(18, fReactionPlane); } else if (iv.fHarmonicsOptionInternalValidation->EqualTo("correlated")) { fPhiPDF->SetParameter(3, fReactionPlane); } - ebye.fCentrality = gRandom->Uniform(0., 100.); // this is perfectly fine for this exercise + ebye.fCentrality = static_cast(gRandom->Uniform(0., 100.)); // this is perfectly fine for this exercise + ebye.fOccupancy = static_cast(gRandom->Uniform(0., 10000.)); // this is perfectly fine for this exercise + ebye.fInteractionRate = static_cast(gRandom->Uniform(0., 10000.)); // this is perfectly fine for this exercise + ebye.fCurrentRunDuration = static_cast(gRandom->Uniform(0., 86400.)); // this is perfectly fine for this exercise - // b2) Fill event histograms: + // b2) Fill event histograms before cuts: if (eh.fFillEventHistograms) { - !eh.fEventHistograms[eNumberOfEvents][eSim][eAfter] ? true : eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]->Fill(0.5); - !eh.fEventHistograms[eTotalMultiplicity][eSim][eAfter] ? true : eh.fEventHistograms[eTotalMultiplicity][eSim][eAfter]->Fill(nMult); - !eh.fEventHistograms[eSelectedTracks][eSim][eAfter] ? true : eh.fEventHistograms[eSelectedTracks][eSim][eAfter]->Fill(ebye.fSelectedTracks); - !eh.fEventHistograms[eCentrality][eSim][eAfter] ? true : eh.fEventHistograms[eCentrality][eSim][eAfter]->Fill(ebye.fCentrality); + !eh.fEventHistograms[eNumberOfEvents][eSim][eBefore] ? true : eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]->Fill(0.5); + !eh.fEventHistograms[eTotalMultiplicity][eSim][eBefore] ? true : eh.fEventHistograms[eTotalMultiplicity][eSim][eBefore]->Fill(nMult); + !eh.fEventHistograms[eCentrality][eSim][eBefore] ? true : eh.fEventHistograms[eCentrality][eSim][eBefore]->Fill(ebye.fCentrality); + !eh.fEventHistograms[eOccupancy][eSim][eBefore] ? true : eh.fEventHistograms[eOccupancy][eSim][eBefore]->Fill(ebye.fOccupancy); + !eh.fEventHistograms[eInteractionRate][eSim][eBefore] ? true : eh.fEventHistograms[eInteractionRate][eSim][eBefore]->Fill(ebye.fInteractionRate); + !eh.fEventHistograms[eCurrentRunDuration][eSim][eBefore] ? true : eh.fEventHistograms[eCurrentRunDuration][eSim][eBefore]->Fill(ebye.fCurrentRunDuration); + !eh.fEventHistograms[eEventPlaneAngle][eSim][eBefore] ? true : eh.fEventHistograms[eEventPlaneAngle][eSim][eBefore]->Fill(fReactionPlane); } + // ... here I could implement some event cuts, if necessary ... + // configure p.d.f. for azimuthal angles if harmonics are not constant e-by-e: if (iv.fHarmonicsOptionInternalValidation->EqualTo("correlated")) { // Sample 3 correlated vn's from TF3 fvnPDF, and with them initialize fPhiPDF: fvnPDF->GetRandom3(v1, v2, v3); - // cout<SetParameter(0, v1); fPhiPDF->SetParameter(1, v2); fPhiPDF->SetParameter(2, v3); // reaction plane is set above } // if(fHarmonicsOptionInternalValidation->EqualTo("correlated")) - // b2) Loop over particles: + // b3) Loop over particles: Double_t dPhi = 0.; Double_t dPt = 0.; Double_t dEta = 0.; - // ..) Define min and max ranges for sampling: + // *) Define min and max ranges for sampling: Double_t dPt_min = res.fResultsPro[AFO_PT]->GetXaxis()->GetBinLowEdge(1); // yes, low edge of first bin is pt min Double_t dPt_max = res.fResultsPro[AFO_PT]->GetXaxis()->GetBinLowEdge(1 + res.fResultsPro[AFO_PT]->GetNbinsX()); // yes, low edge of overflow bin is max pt Double_t dEta_min = res.fResultsPro[AFO_ETA]->GetXaxis()->GetBinLowEdge(1); // yes, low edge of first bin is eta min @@ -2876,15 +3809,16 @@ void InternalValidation() dPhi = fPhiPDF->GetRandom(); // *) To increase performance, sample pt or eta only if requested: - if (mupa.fCalculateCorrelations || t0.fCalculateTest0AsFunctionOf[AFO_PT]) { // TBI 20240423 The first switch I need to replace with differentual switch, like I have it for Test0 now + if (mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT] || t0.fCalculateTest0AsFunctionOf[AFO_PT] || es.fCalculateEtaSeparationsAsFunctionOf[AFO_PT]) { dPt = gRandom->Uniform(dPt_min, dPt_max); } - if (mupa.fCalculateCorrelations || t0.fCalculateTest0AsFunctionOf[AFO_ETA]) { // TBI 20240423 The first switch I need to replace with differentual switch, like I have it for Test0 now + if (mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA] || t0.fCalculateTest0AsFunctionOf[AFO_ETA] || es.fCalculateEtaSeparations) { + // Yes, I have to use here es.fCalculateEtaSeparations , and not some differential flag, like for pt case above dEta = gRandom->Uniform(dEta_min, dEta_max); } - // *) Fill few selected particle histograms before cuts here directly here: + // *) Fill few selected particle histograms before cuts here directly: // Remark: I do not call FillParticleHistograms(track, eBefore), as I do not want to bother to make here full 'track' object, etc., just to fill simple kine info: if (ph.fFillParticleHistograms || ph.fFillParticleHistograms2D) { // 1D: @@ -2920,17 +3854,26 @@ void InternalValidation() !ph.fParticleHistograms2D[ePhiEta][eSim][eAfter] ? true : ph.fParticleHistograms2D[ePhiEta][eSim][eAfter]->Fill(dPhi, dEta); } + // Remark: Keep in sync all calls and flags below with the ones in MainLoopOverParticles(). // *) Integrated Q-vectors: - if (qv.fCalculateQvectors) { + if (qv.fCalculateQvectors || es.fCalculateEtaSeparations) { this->FillQvector(dPhi, dPt, dEta); // all 3 arguments are passed by reference } // *) Differential q-vectors: - if (qv.fCalculateQvectors && t0.fCalculateTest0AsFunctionOf[AFO_PT]) { // TBI 20240423 I need to extend this condition to mupa.fCalculateCorrelations or some differential version of it - this->Fillqvector(dPhi, dPt, PTq); // first 2 arguments are passed by reference, 3rd argument is enum + // **) pt-dependence: + if (qv.fCalculateQvectors && (mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT] || t0.fCalculateTest0AsFunctionOf[AFO_PT]) && !es.fCalculateEtaSeparations) { + // In this branch I do not need eta separation, so the ligher call can be executed: + this->Fillqvector(dPhi, dPt, PTq); // first 2 arguments are passed by reference, 3rd argument is enum + } else if (es.fCalculateEtaSeparations && es.fCalculateEtaSeparationsAsFunctionOf[AFO_PT]) { + // In this branch I do need eta separation, so the heavier call must be executed: + // Remark: Within Fillqvector() I check again all the relevant flags. + this->Fillqvector(dPhi, dPt, PTq, dEta); // first 2 arguments and the last one are passed by reference, 3rd argument is enum. "kine" variable is the 2nd argument } - if (qv.fCalculateQvectors && t0.fCalculateTest0AsFunctionOf[AFO_ETA]) { // TBI 20240423 I need to extend this condition to mupa.fCalculateCorrelations or some differential version of it - this->Fillqvector(dPhi, dEta, ETAq); // first 2 arguments are passed by reference, 3rd argument is enum + // **) eta-dependence: + if (qv.fCalculateQvectors && (mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA] || t0.fCalculateTest0AsFunctionOf[AFO_ETA])) { + // Remark: For eta dependence I do not consider es.fCalculateEtaSeparations, because in this context that calculation is meaningless. + this->Fillqvector(dPhi, dEta, ETAq); // first 2 arguments are passed by reference, 3rd argument is enum } // *) Fill nested loops containers: @@ -2939,35 +3882,66 @@ void InternalValidation() } // *) Counter of selected tracks in the current event: + // Remark: This has to go after FillNestedLoopsContainers(...), because ebye.fSelectedTracks is used as a particle index there. ebye.fSelectedTracks++; - if (ebye.fSelectedTracks >= ec.fdEventCuts[eSelectedTracks][eMax]) { + if (ebye.fSelectedTracks >= ec.fdEventCuts[eMultiplicity][eMax]) { break; } } // for(Int_t p=0;pFill(0.5); + !eh.fEventHistograms[eTotalMultiplicity][eSim][eAfter] ? true : eh.fEventHistograms[eTotalMultiplicity][eSim][eAfter]->Fill(nMult); + !eh.fEventHistograms[eMultiplicity][eSim][eAfter] ? true : eh.fEventHistograms[eMultiplicity][eSim][eAfter]->Fill(ebye.fMultiplicity); + !eh.fEventHistograms[eCentrality][eSim][eAfter] ? true : eh.fEventHistograms[eCentrality][eSim][eAfter]->Fill(ebye.fCentrality); + !eh.fEventHistograms[eOccupancy][eSim][eAfter] ? true : eh.fEventHistograms[eOccupancy][eSim][eAfter]->Fill(ebye.fOccupancy); + !eh.fEventHistograms[eInteractionRate][eSim][eAfter] ? true : eh.fEventHistograms[eCentrality][eSim][eAfter]->Fill(ebye.fInteractionRate); + !eh.fEventHistograms[eCurrentRunDuration][eSim][eAfter] ? true : eh.fEventHistograms[eCurrentRunDuration][eSim][eAfter]->Fill(ebye.fCurrentRunDuration); + !eh.fEventHistograms[eEventPlaneAngle][eSim][eAfter] ? true : eh.fEventHistograms[eEventPlaneAngle][eSim][eAfter]->Fill(fReactionPlane); + } + + // *) Fill subevent multiplicities: + // Remark: I can call this one only after Qa and Qb vectors are filled: + if (es.fCalculateEtaSeparations) { + FillSubeventMultiplicities(); + } + + // b5) Calculate everything for selected events and particles: CalculateEverything(); // *) Reset event-by-event quantities: ResetEventByEventQuantities(); - // *) Print info on the current event number after cuts: - if (tc.fVerbose) { - if (eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]) { - LOGF(info, "\033[1;32m%s : event number %d/%d\033[0m", __FUNCTION__, static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]->GetBinContent(1)), static_cast(iv.fnEventsInternalValidation)); - } + // *) Print info on the current event number (within current real event): + LOGF(info, " Event # %d/%d (within current real event) ....", e + 1, static_cast(iv.fnEventsInternalValidation)); + + // *) Determine all event counters: + DetermineEventCounters(); + + // *) Sequential bailout: After each tc.fSequentialBailout events, I bail out: + if (iv.fInternalValidationForceBailout && tc.fSequentialBailout > 0 && eh.fEventCounter[eProcessed] > 0 && 0 == eh.fEventCounter[eProcessed] % tc.fSequentialBailout) { + BailOut(); } // *) If I reached max number of events, ignore the remaining collisions: if (MaxNumberOfEvents(eAfter)) { if (iv.fInternalValidationForceBailout) { - BailOut(); + BailOut(kTRUE); } } } // for(Int_t e=0;e(iv.fnEventsInternalValidation);e++) + // *) Print info on the current event number (total): + if (tc.fVerboseEventCounter) { + PrintEventCounter(eAfter); + } + // c) Delete persistent objects: if (fPhiPDF) { delete fPhiPDF; @@ -2976,6 +3950,10 @@ void InternalValidation() delete fvnPDF; } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void InternalValidation() //============================================================ @@ -3034,7 +4012,7 @@ void BookTest0Histograms() // e) Few quick insanity checks on booking. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: @@ -3084,6 +4062,15 @@ void BookTest0Histograms() if (AFO_ETA == v && !t0.fCalculateTest0AsFunctionOf[AFO_ETA]) { continue; } + if (AFO_OCCUPANCY == v && !t0.fCalculateTest0AsFunctionOf[AFO_OCCUPANCY]) { + continue; + } + if (AFO_INTERACTIONRATE == v && !t0.fCalculateTest0AsFunctionOf[AFO_INTERACTIONRATE]) { + continue; + } + if (AFO_CURRENTRUNDURATION == v && !t0.fCalculateTest0AsFunctionOf[AFO_CURRENTRUNDURATION]) { + continue; + } if (!res.fResultsPro[v]) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); @@ -3093,7 +4080,7 @@ void BookTest0Histograms() t0.fTest0Pro[mo][mi][v]->SetStats(kFALSE); t0.fTest0Pro[mo][mi][v]->Sumw2(); t0.fTest0Pro[mo][mi][v]->SetTitle(t0.fTest0Labels[mo][mi]->Data()); - t0.fTest0Pro[mo][mi][v]->GetXaxis()->SetTitle(res.fResultsProXaxisTitle[v].Data()); + t0.fTest0Pro[mo][mi][v]->GetXaxis()->SetTitle(FancyFormatting(res.fResultsProXaxisTitle[v].Data())); /* if(fUseFixedNumberOfRandomlySelectedParticles && 1==v) // just a warning for the meaning of multiplicity in this special case { @@ -3114,50 +4101,146 @@ void BookTest0Histograms() LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); // ordering in enum eAsFunctionOf is not the same as in TString fResultsProXaxisTitle[eAsFunctionOf_N] } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookTest0Histograms() //============================================================ -void BookResultsHistograms() +void BookEtaSeparationsHistograms() { - // Book all results histograms. + // Book all eta separations histograms. // a) Book the profile holding flags; - // b) Book results histograms, which in addition act as a sort of "abstract" interface, which defines common binning, etc., for other groups of histograms. + // b) Book what needs to be booked; + // c) Few quick insanity checks on booking. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: - res.fResultsFlagsPro = new TProfile("fResultsFlagsPro", - "flags for results histograms", 1, 0., 1.); - res.fResultsFlagsPro->SetStats(kFALSE); - res.fResultsFlagsPro->SetLineColor(eColor); - res.fResultsFlagsPro->SetFillColor(eFillColor); - res.fResultsFlagsPro->GetXaxis()->SetBinLabel(1, "fSaveResultsHistograms"); - res.fResultsFlagsPro->Fill(0.5, res.fSaveResultsHistograms); - // ... - res.fResultsList->Add(res.fResultsFlagsPro); - - // b) Book results histograms, which in addition act as a sort of "abstract" interface, which defines common binning, etc., for other groups of histograms: - for (Int_t v = 0; v < eAsFunctionOf_N; v++) { - if (res.fUseResultsProVariableLengthBins[v]) { - // per demand, variable-length binning: - res.fResultsPro[v] = new TProfile(Form("fResultsPro[%s]", res.fResultsProRawName[v].Data()), "...", res.fResultsProVariableLengthBins[v]->GetSize() - 1, res.fResultsProVariableLengthBins[v]->GetArray()); - } else { - // the default fixed-length binning: - res.fResultsPro[v] = new TProfile(Form("fResultsPro[%s]", res.fResultsProRawName[v].Data()), "...", static_cast(res.fResultsProFixedLengthBins[v][0]), res.fResultsProFixedLengthBins[v][1], res.fResultsProFixedLengthBins[v][2]); - } + es.fEtaSeparationsFlagsPro = new TProfile("fEtaSeparationsFlagsPro", "flags for eta separations", 1, 0., 1.); + es.fEtaSeparationsFlagsPro->SetStats(kFALSE); + es.fEtaSeparationsFlagsPro->SetLineColor(eColor); + es.fEtaSeparationsFlagsPro->SetFillColor(eFillColor); + es.fEtaSeparationsFlagsPro->GetXaxis()->SetLabelSize(0.04); + es.fEtaSeparationsFlagsPro->GetXaxis()->SetBinLabel(1, "fCalculateEtaSeparations"); + es.fEtaSeparationsFlagsPro->Fill(0.5, es.fCalculateEtaSeparations); + es.fEtaSeparationsList->Add(es.fEtaSeparationsFlagsPro); + + if (!es.fCalculateEtaSeparations) { + return; + } - // Optionally, save these histograms. Or just use them as an "abstract" interface for the booking of other group of histograms: - if (res.fSaveResultsHistograms) { - res.fResultsList->Add(res.fResultsPro[v]); + // b) Book what needs to be booked: + for (Int_t h = 0; h < gMaxHarmonic; h++) { + if (es.fEtaSeparationsSkipHarmonics[h]) { + continue; } - } // for (Int_t v = 0; v < eAsFunctionOf_N; v++) { - -} // void BookResultsHistograms() - + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + for (Int_t v = 0; v < eAsFunctionOf_N; v++) { + // decide what is booked, then later valid pointer to fCorrelationsPro[k][n][v] is used as a boolean, in the standard way: + if (AFO_INTEGRATED == v && !es.fCalculateEtaSeparationsAsFunctionOf[AFO_INTEGRATED]) { + continue; + } + if (AFO_MULTIPLICITY == v && !es.fCalculateEtaSeparationsAsFunctionOf[AFO_MULTIPLICITY]) { + continue; + } + if (AFO_CENTRALITY == v && !es.fCalculateEtaSeparationsAsFunctionOf[AFO_CENTRALITY]) { + continue; + } + if (AFO_PT == v && !es.fCalculateEtaSeparationsAsFunctionOf[AFO_PT]) { + continue; + } + if (AFO_ETA == v && !es.fCalculateEtaSeparationsAsFunctionOf[AFO_ETA]) { + continue; + } + if (AFO_OCCUPANCY == v && !es.fCalculateEtaSeparationsAsFunctionOf[AFO_OCCUPANCY]) { + continue; + } + if (AFO_INTERACTIONRATE == v && !es.fCalculateEtaSeparationsAsFunctionOf[AFO_INTERACTIONRATE]) { + continue; + } + if (AFO_CURRENTRUNDURATION == v && !es.fCalculateEtaSeparationsAsFunctionOf[AFO_CURRENTRUNDURATION]) { + continue; + } + + if (!res.fResultsPro[v]) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + + es.fEtaSeparationsPro[h][e][v] = reinterpret_cast(res.fResultsPro[v]->Clone(Form("fEtaSeparationsPro[%d][%d][%s]", h, e, res.fResultsProRawName[v].Data()))); // yes + es.fEtaSeparationsPro[h][e][v]->SetStats(kFALSE); + es.fEtaSeparationsPro[h][e][v]->Sumw2(); + es.fEtaSeparationsPro[h][e][v]->SetTitle(Form("%d -%d, |#Delta#eta| > %.2f", h + 1, h + 1, es.fEtaSeparationsValues[e])); + es.fEtaSeparationsPro[h][e][v]->GetXaxis()->SetTitle(FancyFormatting(res.fResultsProXaxisTitle[v].Data())); + es.fEtaSeparationsList->Add(es.fEtaSeparationsPro[h][e][v]); // yes, this has to be here + } // for(Int_t v=0;vGetXaxis()->GetTitle()).EqualTo("integrated")) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); // ordering in enum eAsFunctionOf is not the same as in TString fResultsProXaxisTitle[eAsFunctionOf_N] + } + if (es.fEtaSeparationsPro[0][0][AFO_PT] && !TString(es.fEtaSeparationsPro[0][0][AFO_PT]->GetXaxis()->GetTitle()).EqualTo("p_{T}")) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); // ordering in enum eAsFunctionOf is not the same as in TString fResultsProXaxisTitle[eAsFunctionOf_N] + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void BookEtaSeparationsHistograms() + +//============================================================ + +void BookResultsHistograms() +{ + // Book all results histograms. + + // a) Book the profile holding flags; + // b) Book results histograms, which in addition act as a sort of "abstract" interface, which defines common binning, etc., for other groups of histograms. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Book the profile holding flags: + res.fResultsFlagsPro = new TProfile("fResultsFlagsPro", "flags for results histograms", 1, 0., 1.); + res.fResultsFlagsPro->SetStats(kFALSE); + res.fResultsFlagsPro->SetLineColor(eColor); + res.fResultsFlagsPro->SetFillColor(eFillColor); + res.fResultsFlagsPro->GetXaxis()->SetBinLabel(1, "fSaveResultsHistograms"); + res.fResultsFlagsPro->Fill(0.5, res.fSaveResultsHistograms); + // ... + res.fResultsList->Add(res.fResultsFlagsPro); + + // b) Book results histograms, which in addition act as a sort of "abstract" interface, which defines common binning, etc., for other groups of histograms: + for (Int_t v = 0; v < eAsFunctionOf_N; v++) { + if (res.fUseResultsProVariableLengthBins[v]) { + // per demand, variable-length binning: + res.fResultsPro[v] = new TProfile(Form("fResultsPro[%s]", res.fResultsProRawName[v].Data()), "...", res.fResultsProVariableLengthBins[v]->GetSize() - 1, res.fResultsProVariableLengthBins[v]->GetArray()); + } else { + // the default fixed-length binning: + res.fResultsPro[v] = new TProfile(Form("fResultsPro[%s]", res.fResultsProRawName[v].Data()), "...", static_cast(res.fResultsProFixedLengthBins[v][0]), res.fResultsProFixedLengthBins[v][1], res.fResultsProFixedLengthBins[v][2]); + } + + // Optionally, save these histograms. Or just use them as an "abstract" interface for the booking of other group of histograms: + if (res.fSaveResultsHistograms) { + res.fResultsList->Add(res.fResultsPro[v]); + } + } // for (Int_t v = 0; v < eAsFunctionOf_N; v++) { + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void BookResultsHistograms() + //============================================================ void BookTheRest() @@ -3168,7 +4251,7 @@ void BookTheRest() // *) ... if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the timer: @@ -3178,31 +4261,43 @@ void BookTheRest() tc.fTimer[eLocal] = new TStopwatch(); } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookTheRest() //============================================================ -template -void Preprocess(T const& collision) +template +void Preprocess(T1 const& collision, T2 const& bcs) { // Do all thingies before starting to process data (e.g. count number of events, fetch the run number, get the weights for this run number, etc.). if (tc.fVerbose) { - // LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // full function signature (including arguments, etc.), too verbose here... - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // just a bare function name + StartFunction(__FUNCTION__); + } + + // *) Determine all event counters: + DetermineEventCounters(); + + // *) Sequential bailout: After each tc.fSequentialBailout events, I bail out: + if (tc.fSequentialBailout > 0 && eh.fEventCounter[eProcessed] > 0 && 0 == eh.fEventCounter[eProcessed] % tc.fSequentialBailout) { + BailOut(); } // *) If I reached max number of events, ignore the remaining collisions: if (MaxNumberOfEvents(eAfter) || MaxNumberOfEvents(eBefore)) { // TBI 20240510 this is a bit confusing, implemented this way. Shall I split off? - BailOut(); + BailOut(kTRUE); } // *) Determine and propagate run number info to already booked objects: if (!tc.fRunNumberIsDetermined) { - DetermineAndPropagateRunNumber(collision); + DetermineRunNumber(collision, bcs); + PropagateRunNumber(); } if (tc.fDoAdditionalInsanityChecks && tc.fRunNumberIsDetermined) { - CheckCurrentRunNumber(collision); + CheckCurrentRunNumber(collision, bcs); } // *) Fetch the weights for this particular run number. Do it only once. @@ -3214,38 +4309,98 @@ void Preprocess(T const& collision) } } -} // template void Preprocess(T const& collision) + // *) Fetch the centrality weights for this particular run number. Do it only once. + // TBI 20231012 If eventualy I can access programatically run number in init(...) at run time, this shall go there. + if (!cw.fCentralityWeightsAreFetched) { + if (cw.fUseCentralityWeights) { + GetCentralityWeights(); + cw.fCentralityWeightsAreFetched = kTRUE; + } + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // template void Preprocess(T1 const& collision, T2 const& bcs) //============================================================ -template -void DetermineAndPropagateRunNumber(T const& collision) +template +void DetermineRunNumber(T1 const& collision, T2 const&) { - // Determine and propagate run number info to already booked objects, wherever it's relevant. + // Determine run number and all related thingies. // Make sure in process(...) that this function is called only once. - // TBI 20231018 At the moment I can access run number info only in process(...) via collision->bc().runNumber(), but not in init(...) + // TBI 20231018 At the moment I can access run number info only in process(...), but not in init(...) // Once I can access run number info in init(...), this function shall be called in init(...), not in process(...) - // a) Determine run number; - // b) Propagate run number to all booked objects, wherever that info is relevant. + // a) Determine run number for Run 3 real data; + // b) Determine run number for the rest. TBI 20241126 differentiate this support as well, e.g. for eRecSim and eSim. But Run 2 and Run 1 most likely will stay as before if (tc.fVerbose) { - // LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // full function signature (including arguments, etc.), too verbose here... - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // just a bare function name + StartFunction(__FUNCTION__); } - // a) Determine run number for reconstructed data: - tc.fRunNumber = Form("%d", collision.bc().runNumber()); // implemented for both aod::Collision and aod::McCollision, so I can use it straight, as long as I have subscribed to aod::BCs - if (tc.fRunNumber.EqualTo("")) { - LOGF(error, "\033[1;33m%s fRunNumber is empty, collision->bc().runNumber() failed...\033[0m", __FUNCTION__); - LOGF(fatal, "collision->bc().runNumber() = %d", collision.bc().runNumber()); + // a) Determine run number for Run 3 real data: + if constexpr (rs == eRec || rs == eRecAndSim) { + + // **) Determine run number: + // Get start timestamp and end timemstamp for this run in miliseconds, and convert both of them in seconds: + // o see O2/CCDB/src/BasicCCDBManager.cxx, O2/CCDB/include/CCDB/BasicCCDBManager.h + // o example usage in O2Physics/PWGLF/TableProducer/Common/zdcSP.cxx + auto bc = collision.template foundBC_as(); // I have the same code snippet at other places, keep in sync. + tc.fRunNumber = Form("%d", bc.runNumber()); + if (tc.fRunNumber.EqualTo("")) { + LOGF(error, "\033[1;33m%fRunNumber is empty, bc.runNumber() failed...\033[0m"); + LOGF(fatal, "\033[1;31m%s at line %d : bc.runNumber() = %d \033[0m", __FUNCTION__, __LINE__, bc.runNumber()); + } + + // **) Determine SoR, EoR, and run duration: + auto runDuration = ccdb->getRunDuration(bc.runNumber()); // this is total run duration, not the current one (see below) + tc.fRunTime[eStartOfRun] = std::floor(runDuration.first * 0.001); // in seconds since Unix epoch + tc.fRunTime[eEndOfRun] = std::ceil(runDuration.second * 0.001); // in seconds since Unix epoch + tc.fRunTime[eDurationInSec] = tc.fRunTime[eEndOfRun] - tc.fRunTime[eStartOfRun]; // yes, this is now run duration in seconds + + if (!(tc.fRunTime[eStartOfRun] > 0)) { + LOGF(fatal, "\033[1;31m%s at line %d : tc.fRunTime[eStartOfRun] = %d is not positive\033[0m", __FUNCTION__, __LINE__, tc.fRunTime[eStartOfRun]); + } + if (!(tc.fRunTime[eEndOfRun] > 0)) { + LOGF(fatal, "\033[1;31m%s at line %d : tc.fRunTime[eEndOfRun] = %d is not positive\033[0m", __FUNCTION__, __LINE__, tc.fRunTime[eEndOfRun]); + } + if (!(tc.fRunTime[eDurationInSec] > 0)) { + LOGF(fatal, "\033[1;31m%s at line %d : tc.fRunTime[eDurationInSec] = %d is not positive\033[0m", __FUNCTION__, __LINE__, tc.fRunTime[eDurationInSec]); + } + + } else { + // b) Determine run number for the rest. TBI 20241126 differentiate this support as well, e.g. for eRecSim and eSim. But Run 2 and Run 1 most likely will stay as before + LOGF(fatal, "\033[1;31m%s at line %d : bc.runNumber() is not validated yet for this case\033[0m", __FUNCTION__, __LINE__); } tc.fRunNumberIsDetermined = kTRUE; - // b) Propagate run number to all booked objects, wherever that info is relevant: + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // template void DetermineRunNumber(T1 const& collision, T2 const&) + +//============================================================ + +void PropagateRunNumber() +{ + // Propagate run number info to already booked objects, wherever it's relevant. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // Do some local insanity checks: + if (tc.fRunNumber.EqualTo("")) { + LOGF(fatal, "\033[1;31m%s at line %d : tc.fRunNumber is empty \033[0m", __FUNCTION__, __LINE__); + } + // *) base: - fBasePro->GetXaxis()->SetBinLabel(eRunNumber, Form("tc.fRunNumber = %s", tc.fRunNumber.Data())); + fBasePro->GetXaxis()->SetBinLabel(eRunNumber, Form("fRunNumber = %s", tc.fRunNumber.Data())); // *) common title var: TString histTitle = ""; @@ -3328,7 +4483,6 @@ void DetermineAndPropagateRunNumber(T const& collision) { for (Int_t cc = 0; cc < eCutCounter_N; cc++) // enum eCutCounter { - if (!pc.fParticleCutCounterHist[rs][cc]) { continue; } @@ -3378,21 +4532,94 @@ void DetermineAndPropagateRunNumber(T const& collision) } // for(Int_t rs=0;rs<2;rs++) // reco/sim } // for(Int_t t=0;t void DetermineAndPropagateRunNumber(T const& collision) + // *) eta separations: + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t rs = 0; rs < 2; rs++) { // reco/sim + for (Int_t ba = 0; ba < 2; ba++) { // before/after cuts + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + if (!qv.fMabDist[ab][rs][ba][e]) { + continue; + } + histTitle = qv.fMabDist[ab][rs][ba][e]->GetTitle(); + if (histTitle.Contains("__RUN_NUMBER__")) { + histTitle.ReplaceAll("__RUN_NUMBER__", tc.fRunNumber.Data()); // it replaces in-place + qv.fMabDist[ab][rs][ba][e]->SetTitle(histTitle.Data()); + } + } + } + } + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // PropagateRunNumber() //============================================================ -template -void CheckCurrentRunNumber(T const& collision) +template +void CheckCurrentRunNumber(T1 const& collision, T2 const&) { - // Insanity check for the current run number. + // Insanity check for the current run number and related thingies. + // Used only during validation. - if (!tc.fRunNumber.EqualTo(Form("%d", collision.bc().runNumber()))) { - LOGF(error, "\033[1;33m%s Run number changed within process(). This most likely indicates that a given masterjob is processing 2 or more different runs in one go.\033[0m", __FUNCTION__); - LOGF(fatal, "tc.fRunNumber = %s, collision.bc().runNumber() = %d", tc.fRunNumber.Data(), collision.bc().runNumber()); + // a) Support for Run 3 real data; + // b) The rest. TBI 20241126 differentiate this support as well, e.g. for eRecSim and eSim. But Run 2 and Run 1 most likely will stay as before + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Support for Run 3 real data: + if constexpr (rs == eRec) { + + // **) Check run number: + auto bc = collision.template foundBC_as(); // I have the same code snippet at other places, keep in sync. + if (!tc.fRunNumber.EqualTo(Form("%d", bc.runNumber()))) { + LOGF(error, "\033[1;33m%s Run number changed within process(). This most likely indicates that a given masterjob is processing 2 or more different runs in one go.\033[0m", __FUNCTION__); + LOGF(fatal, "tc.fRunNumber = %s, bc.runNumber() = %d", tc.fRunNumber.Data(), bc.runNumber()); + } + + // **) Check SoR, EoR, and run duration: + auto runDuration = ccdb->getRunDuration(bc.runNumber()); // this is total run duration, not the current one (see below) + int64_t startOfRun = std::floor(runDuration.first * 0.001); // in seconds since Unix epoch + int64_t endOfRun = std::ceil(runDuration.second * 0.001); // in seconds since Unix epoch + int64_t durationInSec = endOfRun - startOfRun; // yes, this is now run duration in seconds + + // **) Insanity check on SoR: + if (!(tc.fRunTime[eStartOfRun] == startOfRun)) { + LOGF(error, "\033[1;33m%s tc.fRunTime[eStartOfRun] changed within process(). This most likely indicates that a given masterjob is processing 2 or more different runs in one go.\033[0m", __FUNCTION__); + LOGF(fatal, "tc.fRunTime[eStartOfRun] = %d, startOfRun = %d", tc.fRunTime[eStartOfRun], startOfRun); + } + + // **) Insanity check on EoR: + if (!(tc.fRunTime[eEndOfRun] == endOfRun)) { + LOGF(error, "\033[1;33m%s tc.fRunTime[eEndOfRun] changed within process(). This most likely indicates that a given masterjob is processing 2 or more different runs in one go.\033[0m", __FUNCTION__); + LOGF(fatal, "tc.fRunTime[eEndOfRun] = %d, endOfRun = %d", tc.fRunTime[eEndOfRun], endOfRun); + } + + // **) Insanity check on run duration: + if (!(tc.fRunTime[eDurationInSec] == durationInSec)) { + LOGF(error, "\033[1;33m%s tc.fRunTime[eDurationInSec] changed within process(). This most likely indicates that a given masterjob is processing 2 or more different runs in one go.\033[0m", __FUNCTION__); + LOGF(fatal, "tc.fRunTime[eDurationInSec] = %d, durationInSec = %d", tc.fRunTime[eDurationInSec], durationInSec); + } + + } else { + // b) The rest: + + if (!tc.fRunNumber.EqualTo(Form("%d", collision.bc().runNumber()))) { + LOGF(error, "\033[1;33m%s Run number changed within process(). This most likely indicates that a given masterjob is processing 2 or more different runs in one go.\033[0m", __FUNCTION__); + LOGF(fatal, "tc.fRunNumber = %s, collision.bc().runNumber() = %d", tc.fRunNumber.Data(), collision.bc().runNumber()); + } + + } // to else + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); } -} // template void CheckCurrentRunNumber(T const& collision) +} // template void CheckCurrentRunNumber(T1 const& collision, T2 const&) //============================================================ @@ -3406,15 +4633,21 @@ void ResetEventByEventQuantities() // d) Fisher-Yates algorithm. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Event-by-event quantities: ebye.fSelectedTracks = 0; - ebye.fCentrality = 0; + ebye.fMultiplicity = 0.; + ebye.fReferenceMultiplicity = 0.; + ebye.fCentrality = 0.; + ebye.fOccupancy = 0.; + ebye.fInteractionRate = 0.; + ebye.fCurrentRunDuration = 0.; // b) Q-vectors: if (qv.fCalculateQvectors) { + // b0) generic Q-vector: ResetQ(); // b1) integrated Q-vector: @@ -3424,6 +4657,7 @@ void ResetEventByEventQuantities() qv.fQvector[h][wp] = TComplex(0., 0.); } } + // b2) diff. Q-vector: for (Int_t bin = 1; bin <= gMaxNoBinsKine; bin++) { qv.fqVectorEntries[PTq][bin - 1] = 0; // TBI 20240214 shall I loop also over enum's PTq and ETAq? If yes, fix it also below for qv.fqvector[PTq][bin - 1][... @@ -3437,6 +4671,49 @@ void ResetEventByEventQuantities() } // for (Int_t b = 0; b < gMaxNoBinsKine; b++ ) { } // if(qv.fCalculateQvectors) + // b3) integrated Q-vector needed for calculations with eta separations: + if (es.fCalculateEtaSeparations) { + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t h = 0; h < gMaxHarmonic; h++) { + if (es.fEtaSeparationsSkipHarmonics[h]) { + continue; + } + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + qv.fQabVector[ab][h][e] = TComplex(0., 0.); + } + } + } + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + qv.fMab[ab][e] = 0.; + } + } + } + + // b4) diff. q-vector in pt needed for calculations with eta separations: + if (es.fCalculateEtaSeparationsAsFunctionOf[AFO_PT]) { // yes, for the time being, only as a function of pt makes sense if eta separation is used + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t bin = 1; bin <= gMaxNoBinsKine; bin++) { + for (Int_t h = 0; h < gMaxHarmonic; h++) { + if (es.fEtaSeparationsSkipHarmonics[h]) { + continue; + } + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + qv.fqabVector[ab][bin - 1][h][e] = TComplex(0., 0.); // yes, bin - 1 here + } + } + } + } + + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t bin = 1; bin <= gMaxNoBinsKine; bin++) { + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + qv.fmab[ab][bin - 1][e] = 0.; // yes, bin - 1 here + } + } + } + } + // c) Reset ebe containers for nested loops: if (nl.fCalculateNestedLoops || nl.fCalculateCustomNestedLoops) { if (nl.ftaNestedLoops[0]) { @@ -3465,7 +4742,9 @@ void ResetEventByEventQuantities() tc.fRandomIndices = NULL; } - // ... TBI 20240117 port the rest ... + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } } // void ResetEventByEventQuantities() @@ -3477,7 +4756,7 @@ void EventCutsCounters(T1 const& collision, T2 const& tracks) // Use this function to fill absolute and sequential event cut counters. Use only during QA, as this is computationally heavy. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // just a bare function name + StartFunction(__FUNCTION__); } // *) Establish ordering of binning in event cut counters histograms, which resembles ordering of event cuts implementation: @@ -3486,19 +4765,19 @@ void EventCutsCounters(T1 const& collision, T2 const& tracks) ec.fEventCutCounterBinNumber[eSim] = 1; EventCuts(collision, tracks, eCutCounterBinning); // dry call, to establish the map fEventCutCounterMap and its inverse - // **) Special treatment for event cuts implemented outside of EventCuts(), like eSelectedTracks: - // Algorithm: I simply add eSelectedTracks at the end of what was esatablished by now in the above call EventCuts(collision, tracks, eCutCounterBinning) + // **) Special treatment for event cuts implemented outside of EventCuts(), like eMultiplicity: + // Algorithm: I simply add eMultiplicity at the end of what was esatablished by now in the above call EventCuts(collision, tracks, eCutCounterBinning) // unless proven it shall be done some other way. if (ec.fEventCutCounterMap[eRec]) { // TBI 20240414 also here have to hardcode 'eRec', because 'rs' spans over all enums in eRecSim => I definitely need 'generic Rec' case, perhaps via TExMap ? // But I have already tc.fProcess[eGenericRec] and tc.fProcess[eGenericRecSim], available, shall I simply re-use them? - ec.fEventCutCounterMap[eRec]->Add(ec.fEventCutCounterBinNumber[eRec], eSelectedTracks); - ec.fEventCutCounterMapInverse[eRec]->Add(eSelectedTracks, ec.fEventCutCounterBinNumber[eRec]); + ec.fEventCutCounterMap[eRec]->Add(ec.fEventCutCounterBinNumber[eRec], eMultiplicity); + ec.fEventCutCounterMapInverse[eRec]->Add(eMultiplicity, ec.fEventCutCounterBinNumber[eRec]); ec.fEventCutCounterBinNumber[eRec]++; // yes } if (ec.fEventCutCounterMap[eSim]) { // TBI 20240414 also here have to hardcode 'eSim', because 'rs' spans over all enums in eRecSim => I definitely need 'generic Rec' case, perhaps via TExMap ? // But I have already tc.fProcess[eGenericRec] and tc.fProcess[eGenericRecSim], available, shall I simply re-use them? - ec.fEventCutCounterMap[eSim]->Add(ec.fEventCutCounterBinNumber[eSim], eSelectedTracks); - ec.fEventCutCounterMapInverse[eSim]->Add(eSelectedTracks, ec.fEventCutCounterBinNumber[eSim]); + ec.fEventCutCounterMap[eSim]->Add(ec.fEventCutCounterBinNumber[eSim], eMultiplicity); + ec.fEventCutCounterMapInverse[eSim]->Add(eMultiplicity, ec.fEventCutCounterBinNumber[eSim]); ec.fEventCutCounterBinNumber[eSim]++; // yes } @@ -3516,10 +4795,13 @@ void EventCutsCounters(T1 const& collision, T2 const& tracks) } for (Int_t bin = ec.fEventCutCounterBinNumber[rec_sim]; bin <= eEventCuts_N; bin++) // implemented, but unused cuts in this analysis { - ec.fEventCutCounterHist[rec_sim][cc]->GetXaxis()->SetBinLabel(bin, "TBI"); + ec.fEventCutCounterHist[rec_sim][cc]->GetXaxis()->SetBinLabel(bin, Form("binNo = %d (unused cut)", bin)); + // Remark: I have to write here something concrete as a bin label, if I leave "TBI" for all bin labels here for cuts which were not used, + // I get this harmless but annoying warning during merging: + // Warning in : Histogram fEventCutCounterHist[rec][seq] has duplicate labels in the x axis. Bin contents will be merged in a single bin + // TBI 20241130 as a better solution, I shall re-define this histogram with the narower range on x-axis... } - // All cuts which were implemeted, not used, and tagged temporarily with "TBI", simply do not show: - // TBI 20240522 re-think if this is really what I want here. + // All cuts which were implemeted, but not used I simply do not show (i can always UnZoom x-axis in TBrowser, if I want to see 'em): ec.fEventCutCounterHist[rec_sim][cc]->GetXaxis()->SetRangeUser(ec.fEventCutCounterHist[rec_sim][cc]->GetBinLowEdge(1), ec.fEventCutCounterHist[rec_sim][cc]->GetBinLowEdge(ec.fEventCutCounterBinNumber[rec_sim])); } } @@ -3538,7 +4820,7 @@ void EventCutsCounters(T1 const& collision, T2 const& tracks) EventCuts(collision, tracks, eCutCounterAbsolute); // **) Special treatments: - // a) eSelectedTracks: It doesn't make sense to treat this one in eCutCounterAbsolute + // a) eMultiplicity: It doesn't make sense to treat this one in eCutCounterAbsolute } // *) Event cut counter (sequential): @@ -3548,11 +4830,15 @@ void EventCutsCounters(T1 const& collision, T2 const& tracks) EventCuts(collision, tracks, eCutCounterSequential); // **) Special treatments: - // a) eSelectedTracks: Since cut on eSelectedTracks is implenented outside of EventCuts - // I call EventCut(rs, eSelectedTracks, eCutCounterSequential) directly where its implemented. + // a) eMultiplicity: Since cut on eMultiplicity is implenented outside of EventCuts + // I call EventCut(rs, eMultiplicity, eCutCounterSequential) directly where its implemented. // Add same treatment for other special cases, but do not forget above to expand **) Special treatment for event cuts ... } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // template void EventCutsCounters(T1 const& collision, T2 const& tracks, eCutModus cutModus) //============================================================ @@ -3562,6 +4848,8 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) { // Event cuts on reconstructed and simulated data. Supports event cut counters, both absolute and sequential. // There is also a related enum eEventCuts. + // Remark: I have added to all if statemets below which deals with floats, e.g. TMath::Abs(ebye.fCentrality - ec.fdEventCuts[eCentrality][eMax]) < tc.fFloatingPointPrecision , + // to enforce the ROOT convention: "lower boundary included, upper boundary excluded" // a) Event cuts on reconstructed, and corresponding MC truth simulated (common to Run 3, Run 2 and Run 1); // b) Event cuts only on simulated (common to Run 3, Run 2 and Run 1); @@ -3572,7 +4860,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) // *) Event cuts on Test case. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // just a bare function name + StartFunction(__FUNCTION__); } // a) Event cuts on reconstructed, and corresponding MC truth simulated (common to Run 3, Run 2 and Run 1) ... @@ -3580,92 +4868,76 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) // *) NumberOfEvents: => this event cut is implemented directly in Steer(...) - // *) Sel8: // see definition in Common/TableProducer/eventSelection.cxx - if (ec.fUseEventCuts[eSel8]) { - if (cutModus == eCutCounterBinning) { - EventCut(eRec, eSel8, eCutCounterBinning); - } else if (!collision.sel8()) { - if (!EventCut(eRec, eSel8, cutModus)) { - return kFALSE; - } - } - } + // *) SelectedEvents: => this event cut is implemented directly in Steer(...) - // *) NoSameBunchPileup: // see O2Physics/Common/CCDB/EventSelectionParams.cxx - if (ec.fUseEventCuts[eNoSameBunchPileup]) { + // *) Offline trigger: + // Remark from documentation: Bypass this check if you analyse MC or continuous Run3 data. + // Documentation: + // a) O2Physics/Common/CCDB/TriggerAliases.h => available trigger aliases + // b) O2Physics/Common/CCDB/macros/upload_trigger_aliases.C => definitions of each trigger alias + // In addition: remember that I can use it only for process cases where I have joined aod::Collisions with aod::EvSels + // TBI 20240517 I didn't validate this trigger on Run 1, in fact, I have added protection against its usage in InsanityChecks. + if (ec.fUseEventCuts[eTrigger]) { if (cutModus == eCutCounterBinning) { - EventCut(eRec, eNoSameBunchPileup, eCutCounterBinning); - } else if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - if (!EventCut(eRec, eNoSameBunchPileup, cutModus)) { + EventCut(eRec, eTrigger, eCutCounterBinning); + } else if (ec.fsEventCuts[eTrigger].EqualTo("kINT7") && !collision.alias_bit(kINT7)) { // Validated only for Run 2 + if (!EventCut(eRec, eTrigger, cutModus)) { return kFALSE; } - } - } - - // *) IsGoodZvtxFT0vsPV: // see O2Physics/Common/CCDB/EventSelectionParams.cxx - if (ec.fUseEventCuts[eIsGoodZvtxFT0vsPV]) { - if (cutModus == eCutCounterBinning) { - EventCut(eRec, eIsGoodZvtxFT0vsPV, eCutCounterBinning); - } else if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - if (!EventCut(eRec, eIsGoodZvtxFT0vsPV, cutModus)) { + } else if (ec.fsEventCuts[eTrigger].EqualTo("kTVXinTRD") && !collision.alias_bit(kTVXinTRD)) { // Validated only for Run 3 + if (!EventCut(eRec, eTrigger, cutModus)) { return kFALSE; } } + // ... } - // *) IsVertexITSTPC: // see O2Physics/Common/CCDB/EventSelectionParams.cxx - if (ec.fUseEventCuts[eIsVertexITSTPC]) { - if (cutModus == eCutCounterBinning) { - EventCut(eRec, eIsVertexITSTPC, eCutCounterBinning); - } else if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - if (!EventCut(eRec, eIsVertexITSTPC, cutModus)) { - return kFALSE; - } - } - } + // collision.alias_bit(kTVXinTRD); - // *) IsVertexTOFmatched: // see O2Physics/Common/CCDB/EventSelectionParams.cxx - if (ec.fUseEventCuts[eIsVertexTOFmatched]) { + // *) Sel8: // see definition in Common/TableProducer/eventSelection.cxx + if (ec.fUseEventCuts[eSel8]) { if (cutModus == eCutCounterBinning) { - EventCut(eRec, eIsVertexTOFmatched, eCutCounterBinning); - } else if (!collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { - if (!EventCut(eRec, eIsVertexTOFmatched, cutModus)) { + EventCut(eRec, eSel8, eCutCounterBinning); + } else if (!collision.sel8()) { + if (!EventCut(eRec, eSel8, cutModus)) { return kFALSE; } } } - // *) IsVertexTRDmatched: // see O2Physics/Common/CCDB/EventSelectionParams.cxx - if (ec.fUseEventCuts[eIsVertexTRDmatched]) { + // *) TotalMultiplicity: + if (ec.fUseEventCuts[eTotalMultiplicity]) { if (cutModus == eCutCounterBinning) { - EventCut(eRec, eIsVertexTRDmatched, eCutCounterBinning); - } else if (!collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { - if (!EventCut(eRec, eIsVertexTRDmatched, cutModus)) { + EventCut(eRec, eTotalMultiplicity, eCutCounterBinning); + } else if (tracks.size() < ec.fdEventCuts[eTotalMultiplicity][eMin] || tracks.size() > ec.fdEventCuts[eTotalMultiplicity][eMax] || TMath::Abs(tracks.size() - ec.fdEventCuts[eTotalMultiplicity][eMax]) < tc.fFloatingPointPrecision) { + if (!EventCut(eRec, eTotalMultiplicity, cutModus)) { return kFALSE; } } } - // *) TotalMultiplicity: - if (ec.fUseEventCuts[eTotalMultiplicity]) { + // *) Multiplicity: + // Remark: This cut is implemented directly in Steer(...), because I allow the possibility that ebye.fMultiplicity = ebye.fSelectedTracks . + // In fact, that will be true in most cases of practical interest. + + // *) Reference multiplicity: + // Remark: In this member function, reference multiplicity is just a number, and any specific setting for Run 3, 2, or 1 is already done in DetermineReferenceMultiplicity(...) + if (ec.fUseEventCuts[eReferenceMultiplicity]) { if (cutModus == eCutCounterBinning) { - EventCut(eRec, eTotalMultiplicity, eCutCounterBinning); - } else if (tracks.size() < ec.fdEventCuts[eTotalMultiplicity][eMin] || tracks.size() > ec.fdEventCuts[eTotalMultiplicity][eMax]) { - if (!EventCut(eRec, eTotalMultiplicity, cutModus)) { + EventCut(eRec, eReferenceMultiplicity, eCutCounterBinning); + } else if (ebye.fReferenceMultiplicity < ec.fdEventCuts[eReferenceMultiplicity][eMin] || ebye.fReferenceMultiplicity > ec.fdEventCuts[eReferenceMultiplicity][eMax] || TMath::Abs(ebye.fReferenceMultiplicity - ec.fdEventCuts[eReferenceMultiplicity][eMax]) < tc.fFloatingPointPrecision) { + if (!EventCut(eRec, eReferenceMultiplicity, cutModus)) { return kFALSE; } } } - // *) SelectedTracks: - // Remark: This cut is implemented directly in void process( ... ) TBI 20240508 check how to implement this one with the current re-write - // *) Centrality: // Remark: In this member function, centrality is just a number, and any specific setting for Run 3, 2, or 1 is already done in DetermineCentrality(...) if (ec.fUseEventCuts[eCentrality]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eCentrality, eCutCounterBinning); - } else if (ebye.fCentrality < ec.fdEventCuts[eCentrality][eMin] || ebye.fCentrality > ec.fdEventCuts[eCentrality][eMax]) { + } else if (ebye.fCentrality < ec.fdEventCuts[eCentrality][eMin] || ebye.fCentrality > ec.fdEventCuts[eCentrality][eMax] || TMath::Abs(ebye.fCentrality - ec.fdEventCuts[eCentrality][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eCentrality, cutModus)) { return kFALSE; } @@ -3676,7 +4948,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eVertex_x]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eVertex_x, eCutCounterBinning); - } else if (collision.posX() < ec.fdEventCuts[eVertex_x][eMin] || collision.posX() > ec.fdEventCuts[eVertex_x][eMax]) { + } else if (collision.posX() < ec.fdEventCuts[eVertex_x][eMin] || collision.posX() > ec.fdEventCuts[eVertex_x][eMax] || TMath::Abs(collision.posX() - ec.fdEventCuts[eVertex_x][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eVertex_x, cutModus)) { return kFALSE; } @@ -3687,7 +4959,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eVertex_y]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eVertex_y, eCutCounterBinning); - } else if (collision.posY() < ec.fdEventCuts[eVertex_y][eMin] || collision.posY() > ec.fdEventCuts[eVertex_y][eMax]) { + } else if (collision.posY() < ec.fdEventCuts[eVertex_y][eMin] || collision.posY() > ec.fdEventCuts[eVertex_y][eMax] || TMath::Abs(collision.posY() - ec.fdEventCuts[eVertex_y][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eVertex_y, cutModus)) { return kFALSE; } @@ -3698,7 +4970,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eVertex_z]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eVertex_z, eCutCounterBinning); - } else if (collision.posZ() < ec.fdEventCuts[eVertex_z][eMin] || collision.posZ() > ec.fdEventCuts[eVertex_z][eMax]) { + } else if (collision.posZ() < ec.fdEventCuts[eVertex_z][eMin] || collision.posZ() > ec.fdEventCuts[eVertex_z][eMax] || TMath::Abs(collision.posZ() - ec.fdEventCuts[eVertex_z][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eVertex_z, cutModus)) { return kFALSE; } @@ -3709,15 +4981,13 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eNContributors]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eNContributors, eCutCounterBinning); - } else if (collision.numContrib() < ec.fdEventCuts[eNContributors][eMin] || collision.numContrib() > ec.fdEventCuts[eNContributors][eMax]) { + } else if (collision.numContrib() < ec.fdEventCuts[eNContributors][eMin] || collision.numContrib() > ec.fdEventCuts[eNContributors][eMax] || TMath::Abs(collision.numContrib() - ec.fdEventCuts[eNContributors][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eNContributors, cutModus)) { return kFALSE; } } } - // *) SelectedEvents: => this event cut is implemented directly in Steer(...) - // ... // ... and corresponding MC truth simulated: @@ -3751,26 +5021,37 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eImpactParameter]) { if (cutModus == eCutCounterBinning) { EventCut(eSim, eImpactParameter, eCutCounterBinning); - } else if (collision.impactParameter() < ec.fdEventCuts[eImpactParameter][eMin] || collision.impactParameter() > ec.fdEventCuts[eImpactParameter][eMax]) { + } else if (collision.impactParameter() < ec.fdEventCuts[eImpactParameter][eMin] || collision.impactParameter() > ec.fdEventCuts[eImpactParameter][eMax] || TMath::Abs(collision.impactParameter() - ec.fdEventCuts[eImpactParameter][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eSim, eImpactParameter, cutModus)) { return kFALSE; } } } - // *) TotalMultiplicity: - // TBI 20240509 check what is the Monte Carlo analogy for tracks.size() - - // *) SelectedTracks: - // Remark: This cut is implemented directly in void process( ... ) TBI 20240508 check how to implement this one with the current re-write - + // *) Event plane angle: + if (ec.fUseEventCuts[eEventPlaneAngle]) { + if (cutModus == eCutCounterBinning) { + EventCut(eSim, eEventPlaneAngle, eCutCounterBinning); + } else if (collision.eventPlaneAngle() < ec.fdEventCuts[eEventPlaneAngle][eMin] || collision.eventPlaneAngle() > ec.fdEventCuts[eEventPlaneAngle][eMax] || TMath::Abs(collision.eventPlaneAngle() - ec.fdEventCuts[eEventPlaneAngle][eMax]) < tc.fFloatingPointPrecision) { + if (!EventCut(eSim, eEventPlaneAngle, cutModus)) { + return kFALSE; + } + } + } + + // *) TotalMultiplicity: + // TBI 20240509 check what is the Monte Carlo analogy for tracks.size() + + // *) Multiplicity: + // Remark: This cut is implemented directly in Steer(...) TBI 20240508 check how to implement this one with the current re-write + // *) Centrality: this is related to eImpactParameter. TBI 20240509 How do I proceed here? Shall i calculate it in void DetermineCentrality( ... ), from IP, and store it in ebye.fCentrality? // *) Vertex_x: if (ec.fUseEventCuts[eVertex_x]) { if (cutModus == eCutCounterBinning) { EventCut(eSim, eVertex_x, eCutCounterBinning); - } else if (collision.posX() < ec.fdEventCuts[eVertex_x][eMin] || collision.posX() > ec.fdEventCuts[eVertex_x][eMax]) { + } else if (collision.posX() < ec.fdEventCuts[eVertex_x][eMin] || collision.posX() > ec.fdEventCuts[eVertex_x][eMax] || TMath::Abs(collision.posX() - ec.fdEventCuts[eVertex_x][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eSim, eVertex_x, cutModus)) { return kFALSE; } @@ -3781,7 +5062,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eVertex_y]) { if (cutModus == eCutCounterBinning) { EventCut(eSim, eVertex_y, eCutCounterBinning); - } else if (collision.posY() < ec.fdEventCuts[eVertex_y][eMin] || collision.posY() > ec.fdEventCuts[eVertex_y][eMax]) { + } else if (collision.posY() < ec.fdEventCuts[eVertex_y][eMin] || collision.posY() > ec.fdEventCuts[eVertex_y][eMax] || TMath::Abs(collision.posY() - ec.fdEventCuts[eVertex_y][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eSim, eVertex_y, cutModus)) { return kFALSE; } @@ -3792,7 +5073,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eVertex_z]) { if (cutModus == eCutCounterBinning) { EventCut(eSim, eVertex_z, eCutCounterBinning); - } else if (collision.posZ() < ec.fdEventCuts[eVertex_z][eMin] || collision.posZ() > ec.fdEventCuts[eVertex_z][eMax]) { + } else if (collision.posZ() < ec.fdEventCuts[eVertex_z][eMin] || collision.posZ() > ec.fdEventCuts[eVertex_z][eMax] || TMath::Abs(collision.posZ() - ec.fdEventCuts[eVertex_z][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eSim, eVertex_z, cutModus)) { return kFALSE; } @@ -3818,45 +5099,144 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) // Therefore, I need always a header Common/DataModel/Multiplicity.h and o2-analysis-multiplicity-table in the workflow // TBI 20240509 check also o2::aod::MultExtra - // *) MultFV0M: - if (ec.fUseEventCuts[eMultFV0M]) { + // *) Occupancy: + if (ec.fUseEventCuts[eOccupancy]) { if (cutModus == eCutCounterBinning) { - EventCut(eRec, eMultFV0M, eCutCounterBinning); - } else if (collision.multFV0M() < ec.fdEventCuts[eMultFV0M][eMin] || collision.multFV0M() > ec.fdEventCuts[eMultFV0M][eMax]) { - if (!EventCut(eRec, eVertex_z, cutModus)) { + EventCut(eRec, eOccupancy, eCutCounterBinning); + } else if (ebye.fOccupancy < ec.fdEventCuts[eOccupancy][eMin] || ebye.fOccupancy > ec.fdEventCuts[eOccupancy][eMax] || TMath::Abs(ebye.fOccupancy - ec.fdEventCuts[eOccupancy][eMax]) < tc.fFloatingPointPrecision) { + if (!EventCut(eRec, eOccupancy, cutModus)) { return kFALSE; } } } - // *) MultFT0M: - if (ec.fUseEventCuts[eMultFT0M]) { + // *) InteractionRate: + if (ec.fUseEventCuts[eInteractionRate]) { if (cutModus == eCutCounterBinning) { - EventCut(eRec, eMultFT0M, eCutCounterBinning); - } else if (collision.multFT0M() < ec.fdEventCuts[eMultFT0M][eMin] || collision.multFT0M() > ec.fdEventCuts[eMultFT0M][eMax]) { - if (!EventCut(eRec, eVertex_z, cutModus)) { + EventCut(eRec, eInteractionRate, eCutCounterBinning); + } else if (ebye.fInteractionRate < ec.fdEventCuts[eInteractionRate][eMin] || ebye.fInteractionRate > ec.fdEventCuts[eInteractionRate][eMax] || TMath::Abs(ebye.fInteractionRate - ec.fdEventCuts[eInteractionRate][eMax]) < tc.fFloatingPointPrecision) { + if (!EventCut(eRec, eInteractionRate, cutModus)) { return kFALSE; } } } - // *) MultTPC: - if (ec.fUseEventCuts[eMultTPC]) { + // *) CurrentRunDuration: // TBI 20241128 check if I can use this one also on Run 2 and Run 1, most likely not + if (ec.fUseEventCuts[eCurrentRunDuration]) { if (cutModus == eCutCounterBinning) { - EventCut(eRec, eMultTPC, eCutCounterBinning); - } else if (collision.multTPC() < ec.fdEventCuts[eMultTPC][eMin] || collision.multTPC() > ec.fdEventCuts[eMultTPC][eMax]) { - if (!EventCut(eRec, eVertex_z, cutModus)) { + EventCut(eRec, eCurrentRunDuration, eCutCounterBinning); + } else if (ebye.fCurrentRunDuration < ec.fdEventCuts[eCurrentRunDuration][eMin] || ebye.fCurrentRunDuration > ec.fdEventCuts[eCurrentRunDuration][eMax] || TMath::Abs(ebye.fCurrentRunDuration - ec.fdEventCuts[eCurrentRunDuration][eMax]) < tc.fFloatingPointPrecision) { + if (!EventCut(eRec, eCurrentRunDuration, cutModus)) { + return kFALSE; + } + } + } + + // *) NoSameBunchPileup: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eNoSameBunchPileup]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eNoSameBunchPileup, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + if (!EventCut(eRec, eNoSameBunchPileup, cutModus)) { + return kFALSE; + } + } + } + + // *) IsGoodZvtxFT0vsPV: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eIsGoodZvtxFT0vsPV]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eIsGoodZvtxFT0vsPV, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (!EventCut(eRec, eIsGoodZvtxFT0vsPV, cutModus)) { + return kFALSE; + } + } + } + + // *) IsVertexITSTPC: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eIsVertexITSTPC]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eIsVertexITSTPC, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + if (!EventCut(eRec, eIsVertexITSTPC, cutModus)) { + return kFALSE; + } + } + } + + // *) IsVertexTOFmatched: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eIsVertexTOFmatched]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eIsVertexTOFmatched, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + if (!EventCut(eRec, eIsVertexTOFmatched, cutModus)) { + return kFALSE; + } + } + } + + // *) IsVertexTRDmatched: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eIsVertexTRDmatched]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eIsVertexTRDmatched, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + if (!EventCut(eRec, eIsVertexTRDmatched, cutModus)) { + return kFALSE; + } + } + } + + // *) NoCollInTimeRangeStrict: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eNoCollInTimeRangeStrict]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eNoCollInTimeRangeStrict, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + if (!EventCut(eRec, eNoCollInTimeRangeStrict, cutModus)) { + return kFALSE; + } + } + } + + // *) NoCollInTimeRangeStandard: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eNoCollInTimeRangeStandard]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eNoCollInTimeRangeStandard, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + if (!EventCut(eRec, eNoCollInTimeRangeStandard, cutModus)) { return kFALSE; } } } - // *) MultNTracksPV: - if (ec.fUseEventCuts[eMultNTracksPV]) { + // *) NoCollInRofStrict: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eNoCollInRofStrict]) { if (cutModus == eCutCounterBinning) { - EventCut(eRec, eMultNTracksPV, eCutCounterBinning); - } else if (collision.multNTracksPV() < ec.fdEventCuts[eMultNTracksPV][eMin] || collision.multNTracksPV() > ec.fdEventCuts[eMultNTracksPV][eMax]) { - if (!EventCut(eRec, eMultNTracksPV, cutModus)) { + EventCut(eRec, eNoCollInRofStrict, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + if (!EventCut(eRec, eNoCollInRofStrict, cutModus)) { + return kFALSE; + } + } + } + + // *) NoCollInRofStandard: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eNoCollInRofStandard]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eNoCollInRofStandard, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + if (!EventCut(eRec, eNoCollInRofStandard, cutModus)) { + return kFALSE; + } + } + } + + // *) NoHighMultCollInPrevRof: // see O2Physics/Common/CCDB/EventSelectionParams.cxx + if (ec.fUseEventCuts[eNoHighMultCollInPrevRof]) { + if (cutModus == eCutCounterBinning) { + EventCut(eRec, eNoHighMultCollInPrevRof, eCutCounterBinning); + } else if (!collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { + if (!EventCut(eRec, eNoHighMultCollInPrevRof, cutModus)) { return kFALSE; } } @@ -3901,23 +5281,6 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) // Remark: I implement here only the event cuts which are not already in group a) above, and which make sense only for Run 1 and 2 data. if constexpr (rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { - // *) Offline trigger: - // Remark from documentation: Bypass this check if you analyse MC or continuous Run3 data. - // Documentation: - // a) O2Physics/Common/CCDB/TriggerAliases.h => available trigger aliases - // b) O2Physics/Common/CCDB/macros/upload_trigger_aliases.C => definitions of each trigger alias - // In addition: remember that I can use it only for process cases where I have joined aod::Collisions with aod::EvSels - // TBI 20240517 I didn't validate this trigger on Run 1, in fact, I have added protection against its usage in InsanityChecks. - if (ec.fUseEventCuts[eTrigger]) { - if (cutModus == eCutCounterBinning) { - EventCut(eRec, eTrigger, eCutCounterBinning); - } else if (ec.fsEventCuts[eTrigger].EqualTo("kINT7") && !collision.alias_bit(kINT7)) { - if (!EventCut(eRec, eTrigger, cutModus)) { - return kFALSE; - } - } - } - // *) Sel7: if (ec.fUseEventCuts[eSel7]) { if (cutModus == eCutCounterBinning) { @@ -3933,7 +5296,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eMultTracklets]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eMultTracklets, eCutCounterBinning); - } else if (collision.multTracklets() < ec.fdEventCuts[eMultTracklets][eMin] || collision.multTracklets() > ec.fdEventCuts[eMultTracklets][eMax]) { + } else if (collision.multTracklets() < ec.fdEventCuts[eMultTracklets][eMin] || collision.multTracklets() > ec.fdEventCuts[eMultTracklets][eMax] || TMath::Abs(collision.multTracklets() - ec.fdEventCuts[eMultTracklets][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eMultTracklets, cutModus)) { return kFALSE; } @@ -3984,7 +5347,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eTotalMultiplicity]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eTotalMultiplicity, eCutCounterBinning); - } else if (tracks.size() < ec.fdEventCuts[eTotalMultiplicity][eMin] || tracks.size() > ec.fdEventCuts[eTotalMultiplicity][eMax]) { + } else if (tracks.size() < ec.fdEventCuts[eTotalMultiplicity][eMin] || tracks.size() > ec.fdEventCuts[eTotalMultiplicity][eMax] || TMath::Abs(tracks.size() - ec.fdEventCuts[eTotalMultiplicity][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eTotalMultiplicity, cutModus)) { return kFALSE; } @@ -3995,7 +5358,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eVertex_z]) { if (cutModus == eCutCounterBinning) { EventCut(eSim, eVertex_z, eCutCounterBinning); - } else if (collision.posZ() < ec.fdEventCuts[eVertex_z][eMin] || collision.posZ() > ec.fdEventCuts[eVertex_z][eMax]) { + } else if (collision.posZ() < ec.fdEventCuts[eVertex_z][eMin] || collision.posZ() > ec.fdEventCuts[eVertex_z][eMax] || TMath::Abs(collision.posZ() - ec.fdEventCuts[eVertex_z][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eSim, eVertex_z, cutModus)) { return kFALSE; } @@ -4006,7 +5369,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eCentrality]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eCentrality, eCutCounterBinning); - } else if (ebye.fCentrality < ec.fdEventCuts[eCentrality][eMin] || ebye.fCentrality > ec.fdEventCuts[eCentrality][eMax]) { + } else if (ebye.fCentrality < ec.fdEventCuts[eCentrality][eMin] || ebye.fCentrality > ec.fdEventCuts[eCentrality][eMax] || TMath::Abs(ebye.fCentrality - ec.fdEventCuts[eCentrality][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eCentrality, cutModus)) { return kFALSE; } @@ -4026,7 +5389,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) Bool_t EventCut(Int_t rs, Int_t eventCut, eCutModus cutModus) { // Helper function to reduce code bloat in EventCuts(). It's meant to be used only in EventCuts(). - // It can be used also in exceptional cases outside of EventCuts(), like for eSelectedTracks, but use with care. + // It can be used also in exceptional cases outside of EventCuts(), like for eMultiplicity, but use with care. // Remark: Remember that as a second argument I cannot use enum eEventCuts, because here in one go I take both enum eEventCuts and enum eEventHistograms . @@ -4041,8 +5404,8 @@ Bool_t EventCut(Int_t rs, Int_t eventCut, eCutModus cutModus) // *) Do the thing: switch (cutModus) { case eCut: - if (tc.fVerbose) { - LOGF(info, "\033[1;31mEvent didn't pass the cut: %s\033[0m", ec.fEventCutName[eventCut].Data()); + if (tc.fVerboseEventCut) { + LOGF(info, "\033[1;31mEvent didn't survive the cut: %s\033[0m", ec.fEventCutName[eventCut].Data()); } return kFALSE; break; @@ -4071,6 +5434,88 @@ Bool_t EventCut(Int_t rs, Int_t eventCut, eCutModus cutModus) //============================================================ +bool RemainingEventCuts() +{ + // Remaining event cuts which can be applied ONLY after the main loop over particles. + // For instance, cut on total number of selected particles (eMultiplicity). + // Remark #1: Whichever cut I implement here, update EventCutsCounters(...) for that cut (like I did for eMultiplicity, as a sort of template). + // Remark #2: I do not have here templated arguments like in EventCuts(), because I do not anticipate using any getter from the framework directly here. + // Remark #3: With the current implementation, I support here only eCutCounterSequential, i.e. eCutCounterAbsolute is not supported for cuts applied here. + + // a) Determine if this function was called for generic rec or generic sim: + // *) eMultiplicity; + // ... + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Determine if this function was called for generic rec or generic sim: + // Remark: I can do it in this simplified way, because I do not anticipate I will call here any getters from the framework. + int rs = -1; + if (tc.fProcess[eGenericRec] || tc.fProcess[eGenericRecSim]) { + rs = eRec; // yes, I do not count in RecSim mode separately particles and rec and sim level which survived particle cuts + } else if (tc.fProcess[eGenericSim]) { + rs = eSim; + } + + // *) Multiplicity: (see documentation for ebye.fMultiplicity for its definition) + if (ec.fUseEventCuts[eMultiplicity]) { + if (ebye.fMultiplicity < ec.fdEventCuts[eMultiplicity][eMin] || ebye.fMultiplicity > ec.fdEventCuts[eMultiplicity][eMax] || TMath::Abs(ebye.fMultiplicity - ec.fdEventCuts[eMultiplicity][eMax]) < tc.fFloatingPointPrecision) { + // Remark: I have to implement RemainingEventCuts() in a slightly different way as EventCuts() + EventCut(rs, eMultiplicity, eCut); // just a printout that this event didn't survive this cut + EventCut(rs, eMultiplicity, eCutCounterSequential); + return kFALSE; + } + } + + return kTRUE; + +} // bool RemainingEventCuts() + +//============================================================ + +template +void FillSubeventMultiplicities() +{ + // Fill subevent (defined via eta separation) multiplicities. + + // a) Fill reconstructed (common to Run 3, Run 2 and Run 1 + Test mode); + // b) Fill only simulated (common to Run 3, Run 2 and Run 1). + + // Remark: This function has to be called after Q-vectors are filled. It makes sense to fill these histograms only for "eAfter", + // becase Q-vectors are not filled before the event cuts. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Fill reconstructed (common to Run 3, Run 2 and Run 1 + Test mode): + if constexpr (rs == eRec || rs == eRecAndSim || rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1 || rs == eTest) { + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + !qv.fMabDist[ab][eRec][eAfter][e] ? true : qv.fMabDist[ab][eRec][eAfter][e]->Fill(qv.fMab[ab][e]); + } + } + } + + // b) Fill only simulated (common to Run 3, Run 2 and Run 1): + if constexpr (rs == eSim || rs == eSim_Run2 || rs == eSim_Run1) { + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + !qv.fMabDist[ab][eSim][eAfter][e] ? true : qv.fMabDist[ab][eSim][eAfter][e]->Fill(qv.fMab[ab][e]); + } + } + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void FillSubeventMultiplicities() + +//============================================================ + template void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) { @@ -4084,8 +5529,10 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) // f) Fill only simulated (Run 1 and 2 specific); // In case there is some corner case between Run 1 and Run 2, simply branch further this one // g) Test case. + // Remark: in most cases, all histogram which depend on eMultiplicity are booked only for "after", because by default, Multiplicity = SelectedTracks. + if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Fill reconstructed ... (common to Run 3, Run 2 and Run 1): @@ -4096,18 +5543,24 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) !eh.fEventHistograms[eVertex_y][eRec][ba] ? true : eh.fEventHistograms[eVertex_y][eRec][ba]->Fill(collision.posY()); !eh.fEventHistograms[eVertex_z][eRec][ba] ? true : eh.fEventHistograms[eVertex_z][eRec][ba]->Fill(collision.posZ()); !eh.fEventHistograms[eNContributors][eRec][ba] ? true : eh.fEventHistograms[eNContributors][eRec][ba]->Fill(collision.numContrib()); - !eh.fEventHistograms[eTotalMultiplicity][eRec][ba] ? true : eh.fEventHistograms[eTotalMultiplicity][eRec][ba]->Fill(tracks.size()); // TBI 20231106 check and validate further - !eh.fEventHistograms[eSelectedTracks][eRec][ba] ? true : eh.fEventHistograms[eSelectedTracks][eRec][ba]->Fill(ebye.fSelectedTracks); // TBI 20240108 this one makes sense only for eAfter - !eh.fEventHistograms[eMultTPC][eRec][ba] ? true : eh.fEventHistograms[eMultTPC][eRec][ba]->Fill(collision.multTPC()); - !eh.fEventHistograms[eMultNTracksPV][eRec][ba] ? true : eh.fEventHistograms[eMultNTracksPV][eRec][ba]->Fill(collision.multNTracksPV()); + !eh.fEventHistograms[eTotalMultiplicity][eRec][ba] ? true : eh.fEventHistograms[eTotalMultiplicity][eRec][ba]->Fill(tracks.size()); // TBI 20231106 check and validate further + !eh.fEventHistograms[eMultiplicity][eRec][ba] ? true : eh.fEventHistograms[eMultiplicity][eRec][ba]->Fill(ebye.fMultiplicity); + !eh.fEventHistograms[eReferenceMultiplicity][eRec][ba] ? true : eh.fEventHistograms[eReferenceMultiplicity][eRec][ba]->Fill(ebye.fReferenceMultiplicity); !eh.fEventHistograms[eCentrality][eRec][ba] ? true : eh.fEventHistograms[eCentrality][eRec][ba]->Fill(ebye.fCentrality); } + // QA: if (qa.fFillQAEventHistograms2D) { - !qa.fQAEventHistograms2D[eMultTPC_vs_NContributors][eRec][ba] ? true : qa.fQAEventHistograms2D[eMultTPC_vs_NContributors][eRec][ba]->Fill(collision.multTPC(), collision.numContrib()); - !qa.fQAEventHistograms2D[eVertex_z_vs_MultTPC][eRec][ba] ? true : qa.fQAEventHistograms2D[eVertex_z_vs_MultTPC][eRec][ba]->Fill(collision.posZ(), collision.multTPC()); - !qa.fQAEventHistograms2D[eVertex_z_vs_NContributors][eRec][ba] ? true : qa.fQAEventHistograms2D[eVertex_z_vs_NContributors][eRec][ba]->Fill(collision.posZ(), collision.numContrib()); - !qa.fQAEventHistograms2D[eCentFT0M_vs_CentNTPV][eRec][ba] ? true : qa.fQAEventHistograms2D[eCentFT0M_vs_CentNTPV][eRec][ba]->Fill(qa.fCentrality[eCentFT0M], qa.fCentrality[eCentNTPV]); + !qa.fQAEventHistograms2D[eMultiplicity_vs_ReferenceMultiplicity][eRec][ba] ? true : qa.fQAEventHistograms2D[eMultiplicity_vs_ReferenceMultiplicity][eRec][ba]->Fill(ebye.fMultiplicity, ebye.fReferenceMultiplicity); + !qa.fQAEventHistograms2D[eMultiplicity_vs_NContributors][eRec][ba] ? true : qa.fQAEventHistograms2D[eMultiplicity_vs_NContributors][eRec][ba]->Fill(ebye.fMultiplicity, collision.numContrib()); + !qa.fQAEventHistograms2D[eMultiplicity_vs_Centrality][eRec][ba] ? true : qa.fQAEventHistograms2D[eMultiplicity_vs_Centrality][eRec][ba]->Fill(ebye.fMultiplicity, ebye.fCentrality); + !qa.fQAEventHistograms2D[eMultiplicity_vs_Vertex_z][eRec][ba] ? true : qa.fQAEventHistograms2D[eMultiplicity_vs_Vertex_z][eRec][ba]->Fill(ebye.fMultiplicity, collision.posZ()); + !qa.fQAEventHistograms2D[eReferenceMultiplicity_vs_NContributors][eRec][ba] ? true : qa.fQAEventHistograms2D[eReferenceMultiplicity_vs_NContributors][eRec][ba]->Fill(ebye.fReferenceMultiplicity, collision.numContrib()); + !qa.fQAEventHistograms2D[eReferenceMultiplicity_vs_Centrality][eRec][ba] ? true : qa.fQAEventHistograms2D[eReferenceMultiplicity_vs_Centrality][eRec][ba]->Fill(ebye.fReferenceMultiplicity, ebye.fCentrality); + !qa.fQAEventHistograms2D[eReferenceMultiplicity_vs_Vertex_z][eRec][ba] ? true : qa.fQAEventHistograms2D[eReferenceMultiplicity_vs_Vertex_z][eRec][ba]->Fill(ebye.fReferenceMultiplicity, collision.posZ()); + !qa.fQAEventHistograms2D[eNContributors_vs_Centrality][eRec][ba] ? true : qa.fQAEventHistograms2D[eNContributors_vs_Centrality][eRec][ba]->Fill(collision.numContrib(), ebye.fCentrality); + !qa.fQAEventHistograms2D[eNContributors_vs_Vertex_z][eRec][ba] ? true : qa.fQAEventHistograms2D[eNContributors_vs_Vertex_z][eRec][ba]->Fill(collision.numContrib(), collision.posZ()); + !qa.fQAEventHistograms2D[eCentrality_vs_Vertex_z][eRec][ba] ? true : qa.fQAEventHistograms2D[eCentrality_vs_Vertex_z][eRec][ba]->Fill(ebye.fCentrality, collision.posZ()); } // ... and corresponding MC truth simulated (common to Run 3, Run 2 and Run 1) ( see https://github.com/AliceO2Group/O2Physics/blob/master/Tutorials/src/mcHistograms.cxx ): @@ -4122,11 +5575,18 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) !eh.fEventHistograms[eVertex_y][eSim][ba] ? true : eh.fEventHistograms[eVertex_y][eSim][ba]->Fill(collision.mcCollision().posY()); !eh.fEventHistograms[eVertex_z][eSim][ba] ? true : eh.fEventHistograms[eVertex_z][eSim][ba]->Fill(collision.mcCollision().posZ()); !eh.fEventHistograms[eImpactParameter][eSim][ba] ? true : eh.fEventHistograms[eImpactParameter][eSim][ba]->Fill(collision.mcCollision().impactParameter()); + !eh.fEventHistograms[eEventPlaneAngle][eSim][ba] ? true : eh.fEventHistograms[eEventPlaneAngle][eSim][ba]->Fill(collision.mcCollision().eventPlaneAngle()); // eh.fEventHistograms[eTotalMultiplicity][eSim][ba]->Fill(tracks.size()); // TBI 20231106 check how to get corresponding MC truth info, and validate further - // eh.fEventHistograms[eSelectedTracks][eSim][ba]->Fill(ebye.fSelectedTracks); // TBI 20240108 this one makes sense only for eAfter + re-think if I really need it here - // TBI 20240120 eMultFT0M, ..., eMultNTracksPV are not needed here + // eh.fEventHistograms[eMultiplicity][eSim][ba]->Fill(ebye.fMultiplicity); // TBI 20241123 re-think if I really need it here. If yes, most likely I will have to + // generalize fSelectedTracks to an array, to counter separately selected sim particles // eh.fEventHistograms[eCentrality][eSim][ba]->Fill(ebye.fCentrality); // TBI 20240120 this case is still not supported in DetermineCentrality() } + + // QA: + if (qa.fFillQAEventHistograms2D) { + !qa.fQAEventHistograms2D[eCentrality_vs_ImpactParameter][eSim][ba] ? true : qa.fQAEventHistograms2D[eCentrality_vs_ImpactParameter][eSim][ba]->Fill(ebye.fCentrality, collision.mcCollision().impactParameter()); + // ... + } } // if constexpr (rs == eRecAndSim) { } // if constexpr (rs == eRec || rs == eRecAndSim) { @@ -4136,10 +5596,21 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) if constexpr (rs == eSim || rs == eSim_Run2 || rs == eSim_Run1) { if (eh.fFillEventHistograms) { !eh.fEventHistograms[eImpactParameter][eSim][ba] ? true : eh.fEventHistograms[eImpactParameter][eSim][ba]->Fill(collision.impactParameter()); // yes, because in this branch 'collision' is always aod::McCollision - !eh.fEventHistograms[eSelectedTracks][eSim][ba] ? true : eh.fEventHistograms[eSelectedTracks][eSim][ba]->Fill(ebye.fSelectedTracks); // TBI 20240108 this one makes sense only for eAfter + !eh.fEventHistograms[eEventPlaneAngle][eSim][ba] ? true : eh.fEventHistograms[eEventPlaneAngle][eSim][ba]->Fill(collision.eventPlaneAngle()); // yes, because in this branch 'collision' is always aod::McCollision + !eh.fEventHistograms[eMultiplicity][eSim][ba] ? true : eh.fEventHistograms[eMultiplicity][eSim][ba]->Fill(ebye.fMultiplicity); // eh.fEventHistograms[eCentrality][eSim][ba]->Fill(ebye.fCentrality); // TBI 20240120 this case is still not supported in DetermineCentrality() + // eh.fEventHistograms[eReferenceMultiplicity][eSim][ba]->Fill(ebye.fReferenceMultiplicity); // TBI 20241123 this case is still not supported in DetermineReferenceMultiplicity() // eh.fEventHistograms[eTotalMultiplicity][eSim][ba]->Fill(tracks.size()); // TBI 20231030 check further how to use the same thing for 'sim' } + + // Eta separations: + if (es.fCalculateEtaSeparations) { + for (Int_t ab = 0; ab < 2; ab++) { // ab = 0 <=> -eta , ab = 1 <=> + eta + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + !qv.fMabDist[ab][eSim][ba][e] ? true : qv.fMabDist[ab][eSim][ba][e]->Fill(qv.fMab[ab][e]); + } + } + } } // ----------------------------------------------------------------------------- @@ -4147,8 +5618,26 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) // c) Fill reconstructed (Run 3 specific): if constexpr (rs == eRec || rs == eRecAndSim) { if (eh.fFillEventHistograms) { - !eh.fEventHistograms[eMultFT0M][eRec][ba] ? true : eh.fEventHistograms[eMultFT0M][eRec][ba]->Fill(collision.multFT0M()); - !eh.fEventHistograms[eMultFV0M][eRec][ba] ? true : eh.fEventHistograms[eMultFV0M][eRec][ba]->Fill(collision.multFV0M()); + !eh.fEventHistograms[eOccupancy][eRec][ba] ? true : eh.fEventHistograms[eOccupancy][eRec][ba]->Fill(ebye.fOccupancy); + !eh.fEventHistograms[eInteractionRate][eRec][ba] ? true : eh.fEventHistograms[eInteractionRate][eRec][ba]->Fill(ebye.fInteractionRate); + !eh.fEventHistograms[eCurrentRunDuration][eRec][ba] ? true : eh.fEventHistograms[eCurrentRunDuration][eRec][ba]->Fill(ebye.fCurrentRunDuration); // TBI 20241128 check if this one can be used for Run 2 and Run 1 converted, most likely not + } + // QA: + if (qa.fFillQAEventHistograms2D) { + // General (estimators can be chosen via configurables): + !qa.fQAEventHistograms2D[eMultiplicity_vs_Occupancy][eRec][ba] ? true : qa.fQAEventHistograms2D[eMultiplicity_vs_Occupancy][eRec][ba]->Fill(ebye.fMultiplicity, ebye.fOccupancy); + !qa.fQAEventHistograms2D[eReferenceMultiplicity_vs_Occupancy][eRec][ba] ? true : qa.fQAEventHistograms2D[eReferenceMultiplicity_vs_Occupancy][eRec][ba]->Fill(ebye.fReferenceMultiplicity, ebye.fOccupancy); + !qa.fQAEventHistograms2D[eNContributors_vs_Occupancy][eRec][ba] ? true : qa.fQAEventHistograms2D[eNContributors_vs_Occupancy][eRec][ba]->Fill(collision.numContrib(), ebye.fOccupancy); + !qa.fQAEventHistograms2D[eCentrality_vs_Occupancy][eRec][ba] ? true : qa.fQAEventHistograms2D[eCentrality_vs_Occupancy][eRec][ba]->Fill(ebye.fCentrality, ebye.fOccupancy); + !qa.fQAEventHistograms2D[eVertex_z_vs_Occupancy][eRec][ba] ? true : qa.fQAEventHistograms2D[eVertex_z_vs_Occupancy][eRec][ba]->Fill(collision.posZ(), ebye.fOccupancy); + // ... + + // Specific (estimators are hardwired): + !qa.fQAEventHistograms2D[eMultNTracksPV_vs_MultNTracksGlobal][eRec][ba] ? true : qa.fQAEventHistograms2D[eMultNTracksPV_vs_MultNTracksGlobal][eRec][ba]->Fill(qa.fReferenceMultiplicity[eMultNTracksPV], qa.fReferenceMultiplicity[eMultNTracksGlobal]); // TBI 20241209 check if I can use this one for Run 2 and 1 + !qa.fQAEventHistograms2D[eCentFT0C_vs_CentNTPV][eRec][ba] ? true : qa.fQAEventHistograms2D[eCentFT0C_vs_CentNTPV][eRec][ba]->Fill(qa.fCentrality[eCentFT0C], qa.fCentrality[eCentNTPV]); + !qa.fQAEventHistograms2D[eCentFT0M_vs_CentNTPV][eRec][ba] ? true : qa.fQAEventHistograms2D[eCentFT0M_vs_CentNTPV][eRec][ba]->Fill(qa.fCentrality[eCentFT0M], qa.fCentrality[eCentNTPV]); + !qa.fQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange][eRec][ba] ? true : qa.fQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange][eRec][ba]->Fill(collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); + !qa.fQAEventHistograms2D[eCurrentRunDuration_vs_InteractionRate][eRec][ba] ? true : qa.fQAEventHistograms2D[eCurrentRunDuration_vs_InteractionRate][eRec][ba]->Fill(ebye.fCurrentRunDuration, ebye.fInteractionRate); } // ... and corresponding MC truth simulated (Run 3 specific) @@ -4158,15 +5647,19 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) LOGF(warning, "No MC collision for this collision, skip..."); return; } + + // !eh.fEventHistograms[eMultMCNParticlesEta08][eSim][ba] ? true : eh.fEventHistograms[eMultMCNParticlesEta08][eSim][ba]->Fill(collision.multMCNParticlesEta08()); + // !eh.fEventHistograms[eNumberOfEvents][eSim][ba] ? true : eh.fEventHistograms[eNumberOfEvents][eSim][ba]->Fill(0.5); } // if constexpr (rs == eRecAndSim) { } // if constexpr (rs == eRec || rs == eRecAndSim) { // ----------------------------------------------------------------------------- - // d) Fill only simulated(Run 3 specific): + // d) Fill only simulated (Run 3 specific): if constexpr (rs == eSim) { // !eh.fEventHistograms[eImpactParameter][eSim][ba] ? true : eh.fEventHistograms[eImpactParameter][eSim][ba]->Fill(collision.impactParameter()); // yes, because in this branch 'collision' is always aod::McCollision + // !eh.fEventHistograms[eEventPlaneAngle][eSim][ba] ? true : eh.fEventHistograms[eEventPlaneAngle][eSim][ba]->Fill(collision.eventPlaneAngle()); // yes, because in this branch 'collision' is always aod::McCollision } // if constexpr (rs == eSim) { // ----------------------------------------------------------------------------- @@ -4179,7 +5672,6 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) // QA: if (qa.fFillQAEventHistograms2D) { !qa.fQAEventHistograms2D[eCentRun2V0M_vs_CentRun2SPDTracklets][eRec][ba] ? true : qa.fQAEventHistograms2D[eCentRun2V0M_vs_CentRun2SPDTracklets][eRec][ba]->Fill(qa.fCentrality[eCentRun2V0M], qa.fCentrality[eCentRun2SPDTracklets]); - !qa.fQAEventHistograms2D[eCentRun2V0M_vs_NContributors][eRec][ba] ? true : qa.fQAEventHistograms2D[eCentRun2V0M_vs_NContributors][eRec][ba]->Fill(qa.fCentrality[eCentRun2V0M], collision.numContrib()); } // ... and corresponding MC truth simulated (Run 1 and Run 2 specific): @@ -4199,6 +5691,7 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) // f) Fill only simulated (Run 1 and 2 specific): // In case there is some corner case between Run 1 and Run 2, simply branch further this one if constexpr (rs == eSim_Run2 || rs == eSim_Run1) { // !eh.fEventHistograms[eImpactParameter][eSim][ba] ? true : eh.fEventHistograms[eImpactParameter][eSim][ba]->Fill(collision.impactParameter()); // yes, because in this branch 'collision' is always aod::McCollision + // !eh.fEventHistograms[eEventPlaneAngle][eSim][ba] ? true : eh.fEventHistograms[eEventPlaneAngle][eSim][ba]->Fill(collision.eventPlaneAngle()); // yes, because in this branch 'collision' is always aod::McCollision } // if constexpr (rs == eSim_Run2 || rs == eSim_Run1) { // ----------------------------------------------------------------------------- @@ -4214,6 +5707,10 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) } } // if constexpr (rs == eTest) { + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // template void FillEventHistograms(...) //============================================================ @@ -4230,7 +5727,7 @@ void CheckUnderflowAndOverflow() // f) QA Particle histograms 2D. if (tc.fVerboseForEachParticle) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Event histograms 1D: @@ -4377,6 +5874,10 @@ void CheckUnderflowAndOverflow() } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim } // for (Int_t t = 0; t < eQAParticleHistograms2D_N; t++) // type, see enum eParticleHistograms2D + if (tc.fVerboseForEachParticle) { + ExitFunction(__FUNCTION__); + } + } // void CheckUnderflowAndOverflow() //============================================================ @@ -4384,17 +5885,17 @@ void CheckUnderflowAndOverflow() template bool ValidTrack(T const& track) { - // Before I start applying any particle tracks, check if this is a valid track. + // Before I start applying any track cuts, check if this is a valid track. // For instance, Run 2 or Run 1 tracklets are NOT valid tracks, as they carry no pt information, and in this function they are filtered out. // See enum TrackTypeEnum in O2/Framework/Core/include/Framework/DataTypes.h for further info. // a) Validity checks for tracks in Run 3; - // b) Validity checks for tracks in Run 2 and 1. + // b) Validity checks for tracks in Run 2 and 1; // c) Additional validity checks for all tracks (in Run 3, 2 and 1), use only during debugging. if (tc.fVerboseForEachParticle) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); LOGF(info, " track.phi() = %f", track.phi()); LOGF(info, " track.pt() = %f", track.pt()); LOGF(info, " track.eta() = %f", track.eta()); @@ -4458,7 +5959,7 @@ void ParticleCutsCounters(T const& track) // Use this function to fill absolute and sequential particle cut counters. Use only during QA, as this is computationally heavy (I mean really). if (tc.fVerboseForEachParticle) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // *) Establish ordering of binning in particle cut counters histograms, which resembles ordering of particle cuts implementation: @@ -4481,14 +5982,16 @@ void ParticleCutsCounters(T const& track) } for (Int_t bin = pc.fParticleCutCounterBinNumber[rec_sim]; bin <= eParticleCuts_N; bin++) // implemented, but unused particle cuts in this analysis { - pc.fParticleCutCounterHist[rec_sim][cc]->GetXaxis()->SetBinLabel(bin, "TBI"); + pc.fParticleCutCounterHist[rec_sim][cc]->GetXaxis()->SetBinLabel(bin, Form("binNo = %d (unused cut)", bin)); + // Remark: I have to write here something concrete as a bin label, if I leave "TBI" for all bin labels here for cuts which were not used, + // I get this harmless but annoying warning during merging: + // Warning in : Histogram fParticleCutCounterHist[rec][seq] has duplicate labels in the x axis. Bin contents will be merged in a single bin + // TBI 20241130 as a better solution, I shall re-define this histogram with the narower range on x-axis... } - // All cuts which were implemeted, not used, and tagged temporarily with "TBI", simply do not show: - // TBI 20240522 re-think if this is really what I want here. + // All cuts which were implemeted, but not used I simply do not show (i can always UnZoom x-axis in TBrowser, if I want to see 'em). pc.fParticleCutCounterHist[rec_sim][cc]->GetXaxis()->SetRangeUser(pc.fParticleCutCounterHist[rec_sim][cc]->GetBinLowEdge(1), pc.fParticleCutCounterHist[rec_sim][cc]->GetBinLowEdge(pc.fParticleCutCounterBinNumber[rec_sim])); } } - pc.fParticleCutCounterBinLabelingIsDone = kTRUE; // this flag ensures that this specific binning is performed only once, for the first processed particle // delete pc.fParticleCutCounterMap[eRec]; // TBI 20240508 if i do not need them later, I could delete here // delete pc.fParticleCutCounterMap[eSim]; @@ -4519,6 +6022,8 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) { // Particle cuts on reconstructed and simulated data. Supports particle cut counters, both absolute and sequential. // There is also a related enum eParticleCuts. + // Remark: I have added to all if statemets below which deals with floats, e.g. TMath::Abs(track.eta() - pc.fdParticleCuts[eEta][eMax]) < tc.fFloatingPointPrecision , + // to enforce the ROOT convention: "lower boundary included, upper boundary excluded" // a) Particle cuts on reconstructed, and corresponding MC truth simulated (common to Run 3, Run 2 and Run 1); // b) Particle cuts only on simulated (common to Run 3, Run 2 and Run 1); @@ -4530,7 +6035,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) // *) Toy NUA. if (tc.fVerboseForEachParticle) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Particle cuts on reconstructed, and corresponding MC truth simulated (common to Run 3, Run 2 and Run 1) ... @@ -4540,7 +6045,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[ePhi]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, ePhi, eCutCounterBinning); - } else if (track.phi() < pc.fdParticleCuts[ePhi][eMin] || track.phi() > pc.fdParticleCuts[ePhi][eMax]) { + } else if (track.phi() < pc.fdParticleCuts[ePhi][eMin] || track.phi() > pc.fdParticleCuts[ePhi][eMax] || TMath::Abs(track.phi() - pc.fdParticleCuts[ePhi][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, ePhi, cutModus)) { return kFALSE; } @@ -4551,7 +6056,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[ePt]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, ePt, eCutCounterBinning); - } else if (track.pt() < pc.fdParticleCuts[ePt][eMin] || track.pt() > pc.fdParticleCuts[ePt][eMax]) { + } else if (track.pt() < pc.fdParticleCuts[ePt][eMin] || track.pt() > pc.fdParticleCuts[ePt][eMax] || TMath::Abs(track.pt() - pc.fdParticleCuts[ePt][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, ePt, cutModus)) { return kFALSE; } @@ -4562,7 +6067,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[eEta]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, eEta, eCutCounterBinning); - } else if (track.eta() < pc.fdParticleCuts[eEta][eMin] || track.eta() > pc.fdParticleCuts[eEta][eMax]) { + } else if (track.eta() < pc.fdParticleCuts[eEta][eMin] || track.eta() > pc.fdParticleCuts[eEta][eMax] || TMath::Abs(track.eta() - pc.fdParticleCuts[eEta][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, eEta, cutModus)) { return kFALSE; } @@ -4574,7 +6079,8 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (cutModus == eCutCounterBinning) { ParticleCut(eRec, eCharge, eCutCounterBinning); } else if (0 == track.sign() || track.sign() < pc.fdParticleCuts[eCharge][eMin] || track.sign() > pc.fdParticleCuts[eCharge][eMax]) { - // TBI 20240511 with first condition, I always throw away neutral particles, so for the time being that is hardcoded + // With first condition, I always throw away neutral particles. + // I can use safely == here, because track.sign() returns short int. if (!ParticleCut(eRec, eCharge, cutModus)) { return kFALSE; } @@ -4651,7 +6157,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[etpcCrossedRowsOverFindableCls]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, etpcCrossedRowsOverFindableCls, eCutCounterBinning); - } else if (track.tpcCrossedRowsOverFindableCls() < pc.fdParticleCuts[etpcCrossedRowsOverFindableCls][eMin] || track.tpcCrossedRowsOverFindableCls() > pc.fdParticleCuts[etpcCrossedRowsOverFindableCls][eMax]) { + } else if (track.tpcCrossedRowsOverFindableCls() < pc.fdParticleCuts[etpcCrossedRowsOverFindableCls][eMin] || track.tpcCrossedRowsOverFindableCls() > pc.fdParticleCuts[etpcCrossedRowsOverFindableCls][eMax] || TMath::Abs(track.tpcCrossedRowsOverFindableCls() - pc.fdParticleCuts[etpcCrossedRowsOverFindableCls][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, etpcCrossedRowsOverFindableCls, cutModus)) { return kFALSE; } @@ -4662,7 +6168,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[etpcFoundOverFindableCls]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, etpcFoundOverFindableCls, eCutCounterBinning); - } else if (track.tpcFoundOverFindableCls() < pc.fdParticleCuts[etpcFoundOverFindableCls][eMin] || track.tpcFoundOverFindableCls() > pc.fdParticleCuts[etpcFoundOverFindableCls][eMax]) { + } else if (track.tpcFoundOverFindableCls() < pc.fdParticleCuts[etpcFoundOverFindableCls][eMin] || track.tpcFoundOverFindableCls() > pc.fdParticleCuts[etpcFoundOverFindableCls][eMax] || TMath::Abs(track.tpcFoundOverFindableCls() - pc.fdParticleCuts[etpcFoundOverFindableCls][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, etpcFoundOverFindableCls, cutModus)) { return kFALSE; } @@ -4673,7 +6179,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[etpcFractionSharedCls]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, etpcFractionSharedCls, eCutCounterBinning); - } else if (track.tpcFractionSharedCls() < pc.fdParticleCuts[etpcFractionSharedCls][eMin] || track.tpcFractionSharedCls() > pc.fdParticleCuts[etpcFractionSharedCls][eMax]) { + } else if (track.tpcFractionSharedCls() < pc.fdParticleCuts[etpcFractionSharedCls][eMin] || track.tpcFractionSharedCls() > pc.fdParticleCuts[etpcFractionSharedCls][eMax] || TMath::Abs(track.tpcFractionSharedCls() - pc.fdParticleCuts[etpcFractionSharedCls][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, etpcFractionSharedCls, cutModus)) { return kFALSE; } @@ -4684,7 +6190,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[edcaXY]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, edcaXY, eCutCounterBinning); - } else if (track.dcaXY() < pc.fdParticleCuts[edcaXY][eMin] || track.dcaXY() > pc.fdParticleCuts[edcaXY][eMax]) { + } else if (track.dcaXY() < pc.fdParticleCuts[edcaXY][eMin] || track.dcaXY() > pc.fdParticleCuts[edcaXY][eMax] || TMath::Abs(track.dcaXY() - pc.fdParticleCuts[edcaXY][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, edcaXY, cutModus)) { return kFALSE; } @@ -4695,7 +6201,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[edcaZ]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, edcaZ, eCutCounterBinning); - } else if (track.dcaZ() < pc.fdParticleCuts[edcaZ][eMin] || track.dcaZ() > pc.fdParticleCuts[edcaZ][eMax]) { + } else if (track.dcaZ() < pc.fdParticleCuts[edcaZ][eMin] || track.dcaZ() > pc.fdParticleCuts[edcaZ][eMax] || TMath::Abs(track.dcaZ() - pc.fdParticleCuts[edcaZ][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, edcaZ, cutModus)) { return kFALSE; } @@ -4839,7 +6345,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[ePhi]) { if (cutModus == eCutCounterBinning) { ParticleCut(eSim, ePhi, eCutCounterBinning); - } else if (track.phi() < pc.fdParticleCuts[ePhi][eMin] || track.phi() > pc.fdParticleCuts[ePhi][eMax]) { + } else if (track.phi() < pc.fdParticleCuts[ePhi][eMin] || track.phi() > pc.fdParticleCuts[ePhi][eMax] || TMath::Abs(track.phi() - pc.fdParticleCuts[ePhi][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eSim, ePhi, cutModus)) { return kFALSE; } @@ -4850,7 +6356,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[ePt]) { if (cutModus == eCutCounterBinning) { ParticleCut(eSim, ePt, eCutCounterBinning); - } else if (track.pt() < pc.fdParticleCuts[ePt][eMin] || track.pt() > pc.fdParticleCuts[ePt][eMax]) { + } else if (track.pt() < pc.fdParticleCuts[ePt][eMin] || track.pt() > pc.fdParticleCuts[ePt][eMax] || TMath::Abs(track.pt() - pc.fdParticleCuts[ePt][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eSim, ePt, cutModus)) { return kFALSE; } @@ -4861,7 +6367,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[eEta]) { if (cutModus == eCutCounterBinning) { ParticleCut(eSim, eEta, eCutCounterBinning); - } else if (track.eta() < pc.fdParticleCuts[eEta][eMin] || track.eta() > pc.fdParticleCuts[eEta][eMax]) { + } else if (track.eta() < pc.fdParticleCuts[eEta][eMin] || track.eta() > pc.fdParticleCuts[eEta][eMax] || TMath::Abs(track.eta() - pc.fdParticleCuts[eEta][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eSim, eEta, cutModus)) { return kFALSE; } @@ -4970,7 +6476,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[ePhi]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, ePhi, eCutCounterBinning); - } else if (track.phi() < pc.fdParticleCuts[ePhi][eMin] || track.phi() > pc.fdParticleCuts[ePhi][eMax]) { + } else if (track.phi() < pc.fdParticleCuts[ePhi][eMin] || track.phi() > pc.fdParticleCuts[ePhi][eMax] || TMath::Abs(track.phi() - pc.fdParticleCuts[ePhi][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, ePhi, cutModus)) { return kFALSE; } @@ -4981,7 +6487,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[ePt]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, ePt, eCutCounterBinning); - } else if (track.pt() < pc.fdParticleCuts[ePt][eMin] || track.pt() > pc.fdParticleCuts[ePt][eMax]) { + } else if (track.pt() < pc.fdParticleCuts[ePt][eMin] || track.pt() > pc.fdParticleCuts[ePt][eMax] || TMath::Abs(track.pt() - pc.fdParticleCuts[ePt][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, ePt, cutModus)) { return kFALSE; } @@ -4992,7 +6498,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) if (pc.fUseParticleCuts[eEta]) { if (cutModus == eCutCounterBinning) { ParticleCut(eRec, eEta, eCutCounterBinning); - } else if (track.eta() < pc.fdParticleCuts[eEta][eMin] || track.eta() > pc.fdParticleCuts[eEta][eMax]) { + } else if (track.eta() < pc.fdParticleCuts[eEta][eMin] || track.eta() > pc.fdParticleCuts[eEta][eMax] || TMath::Abs(track.eta() - pc.fdParticleCuts[eEta][eMax]) < tc.fFloatingPointPrecision) { if (!ParticleCut(eRec, eEta, cutModus)) { return kFALSE; } @@ -5141,11 +6647,11 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // But GetMeanErorr(), GetRMSError(), etc. are affected. // For instance, GetMean() remains the same, because (x+y)/(1+1) = (x+y+z-z)(1+1+1-1). But whenever weight in the formula is taken directly to some higher power, // like in the calculation of GetMeanError(), this idea with BanishmentLoopOverParticles is not applicable (also when I enable Setw2() in histograms). - // Since from particle histograms I only care about the number of enties, I rarely need even GetMean(), and basically never GetMeanError(), + // Since from particle histograms I only care about the number of entries, I rarely need even GetMean(), and basically never GetMeanError(), // I use BanishmentLoopOverParticles . Alternatively, I would need new set of histograms, fill them separately, etc. if (tc.fVerboseForEachParticle) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } if (tc.fInsanityCheckForEachParticle) { @@ -5163,26 +6669,26 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // 1D: if (ph.fFillParticleHistograms) { // From o2::aod::Tracks - !ph.fParticleHistograms[ePhi][eRec][ba] ? true : ph.fParticleHistograms[ePhi][eRec][ba]->Fill(track.phi(), weight); // 3 2 - !ph.fParticleHistograms[ePt][eRec][ba] ? true : ph.fParticleHistograms[ePt][eRec][ba]->Fill(track.pt(), weight); // 3 2 - !ph.fParticleHistograms[eEta][eRec][ba] ? true : ph.fParticleHistograms[eEta][eRec][ba]->Fill(track.eta(), weight); // 3 2 - !ph.fParticleHistograms[eCharge][eRec][ba] ? true : ph.fParticleHistograms[eCharge][eRec][ba]->Fill(track.sign(), weight); // 3 2 + !ph.fParticleHistograms[ePhi][eRec][ba] ? true : ph.fParticleHistograms[ePhi][eRec][ba]->Fill(track.phi(), weight); + !ph.fParticleHistograms[ePt][eRec][ba] ? true : ph.fParticleHistograms[ePt][eRec][ba]->Fill(track.pt(), weight); + !ph.fParticleHistograms[eEta][eRec][ba] ? true : ph.fParticleHistograms[eEta][eRec][ba]->Fill(track.eta(), weight); + !ph.fParticleHistograms[eCharge][eRec][ba] ? true : ph.fParticleHistograms[eCharge][eRec][ba]->Fill(track.sign(), weight); // From o2::aod::TracksExtra_001 - !ph.fParticleHistograms[etpcNClsFindable][eRec][ba] ? true : ph.fParticleHistograms[etpcNClsFindable][eRec][ba]->Fill(track.tpcNClsFindable(), weight); // 3 2 - !ph.fParticleHistograms[etpcNClsShared][eRec][ba] ? true : ph.fParticleHistograms[etpcNClsShared][eRec][ba]->Fill(track.tpcNClsShared(), weight); // 3 2 - !ph.fParticleHistograms[etpcNClsFound][eRec][ba] ? true : ph.fParticleHistograms[etpcNClsFound][eRec][ba]->Fill(track.tpcNClsFound(), weight); // 3 2 - !ph.fParticleHistograms[etpcNClsCrossedRows][eRec][ba] ? true : ph.fParticleHistograms[etpcNClsCrossedRows][eRec][ba]->Fill(track.tpcNClsCrossedRows(), weight); // 3 2 - !ph.fParticleHistograms[eitsNCls][eRec][ba] ? true : ph.fParticleHistograms[eitsNCls][eRec][ba]->Fill(track.itsNCls(), weight); // 3 2 - !ph.fParticleHistograms[eitsNClsInnerBarrel][eRec][ba] ? true : ph.fParticleHistograms[eitsNClsInnerBarrel][eRec][ba]->Fill(track.itsNClsInnerBarrel(), weight); // 3 2 - !ph.fParticleHistograms[etpcCrossedRowsOverFindableCls][eRec][ba] ? true : ph.fParticleHistograms[etpcCrossedRowsOverFindableCls][eRec][ba]->Fill(track.tpcCrossedRowsOverFindableCls(), weight); // 3 2 - !ph.fParticleHistograms[etpcFoundOverFindableCls][eRec][ba] ? true : ph.fParticleHistograms[etpcFoundOverFindableCls][eRec][ba]->Fill(track.tpcFoundOverFindableCls(), weight); // 3 2 - !ph.fParticleHistograms[etpcFractionSharedCls][eRec][ba] ? true : ph.fParticleHistograms[etpcFractionSharedCls][eRec][ba]->Fill(track.tpcFractionSharedCls(), weight); // 3 2 + !ph.fParticleHistograms[etpcNClsFindable][eRec][ba] ? true : ph.fParticleHistograms[etpcNClsFindable][eRec][ba]->Fill(track.tpcNClsFindable(), weight); + !ph.fParticleHistograms[etpcNClsShared][eRec][ba] ? true : ph.fParticleHistograms[etpcNClsShared][eRec][ba]->Fill(track.tpcNClsShared(), weight); + !ph.fParticleHistograms[etpcNClsFound][eRec][ba] ? true : ph.fParticleHistograms[etpcNClsFound][eRec][ba]->Fill(track.tpcNClsFound(), weight); + !ph.fParticleHistograms[etpcNClsCrossedRows][eRec][ba] ? true : ph.fParticleHistograms[etpcNClsCrossedRows][eRec][ba]->Fill(track.tpcNClsCrossedRows(), weight); + !ph.fParticleHistograms[eitsNCls][eRec][ba] ? true : ph.fParticleHistograms[eitsNCls][eRec][ba]->Fill(track.itsNCls(), weight); + !ph.fParticleHistograms[eitsNClsInnerBarrel][eRec][ba] ? true : ph.fParticleHistograms[eitsNClsInnerBarrel][eRec][ba]->Fill(track.itsNClsInnerBarrel(), weight); + !ph.fParticleHistograms[etpcCrossedRowsOverFindableCls][eRec][ba] ? true : ph.fParticleHistograms[etpcCrossedRowsOverFindableCls][eRec][ba]->Fill(track.tpcCrossedRowsOverFindableCls(), weight); + !ph.fParticleHistograms[etpcFoundOverFindableCls][eRec][ba] ? true : ph.fParticleHistograms[etpcFoundOverFindableCls][eRec][ba]->Fill(track.tpcFoundOverFindableCls(), weight); + !ph.fParticleHistograms[etpcFractionSharedCls][eRec][ba] ? true : ph.fParticleHistograms[etpcFractionSharedCls][eRec][ba]->Fill(track.tpcFractionSharedCls(), weight); // From o2::aod::TracksDCA // Remark: For this one, in Run 3 workflow I need helper task o2-analysis-track-propagation, while in Run 2 and 1 I need o2-analysis-trackextension . - !ph.fParticleHistograms[edcaXY][eRec][ba] ? true : ph.fParticleHistograms[edcaXY][eRec][ba]->Fill(track.dcaXY(), weight); // 3 2 - !ph.fParticleHistograms[edcaZ][eRec][ba] ? true : ph.fParticleHistograms[edcaZ][eRec][ba]->Fill(track.dcaZ(), weight); // 3 2 + !ph.fParticleHistograms[edcaXY][eRec][ba] ? true : ph.fParticleHistograms[edcaXY][eRec][ba]->Fill(track.dcaXY(), weight); + !ph.fParticleHistograms[edcaZ][eRec][ba] ? true : ph.fParticleHistograms[edcaZ][eRec][ba]->Fill(track.dcaZ(), weight); } // 2D: @@ -5209,9 +6715,9 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // 1D: if (ph.fFillParticleHistograms) { - !ph.fParticleHistograms[ePhi][eSim][ba] ? true : ph.fParticleHistograms[ePhi][eSim][ba]->Fill(mcparticle.phi(), weight); // 3 - !ph.fParticleHistograms[ePt][eSim][ba] ? true : ph.fParticleHistograms[ePt][eSim][ba]->Fill(mcparticle.pt(), weight); // 3 - !ph.fParticleHistograms[eEta][eSim][ba] ? true : ph.fParticleHistograms[eEta][eSim][ba]->Fill(mcparticle.eta(), weight); // 3 + !ph.fParticleHistograms[ePhi][eSim][ba] ? true : ph.fParticleHistograms[ePhi][eSim][ba]->Fill(mcparticle.phi(), weight); + !ph.fParticleHistograms[ePt][eSim][ba] ? true : ph.fParticleHistograms[ePt][eSim][ba]->Fill(mcparticle.pt(), weight); + !ph.fParticleHistograms[eEta][eSim][ba] ? true : ph.fParticleHistograms[eEta][eSim][ba]->Fill(mcparticle.eta(), weight); // !ph.fParticleHistograms[eCharge][eSim][ba] ? true : ph.fParticleHistograms[eCharge][eSim][ba]->Fill( ... ); // TBI 20240511 there is no mcparticle.sign()) !ph.fParticleHistograms[ePDG][eSim][ba] ? true : ph.fParticleHistograms[ePDG][eSim][ba]->Fill(mcparticle.pdgCode(), weight); // TBI 20240512 this one gets filles correctly, deduce from it charge signature } @@ -5352,7 +6858,7 @@ void CalculateCorrelations() // c) Flush the generic Q-vectors. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Flush 'n' fill the generic Q-vectors: @@ -5391,10 +6897,10 @@ void CalculateCorrelations() harmonics->SetAt(h, 0); harmonics->SetAt(-h, 1); Double_t nestedLoopValue = this->CalculateCustomNestedLoops(harmonics); - if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(twoC - nestedLoopValue) > 1.e-5) { + if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(twoC - nestedLoopValue) > tc.fFloatingPointPrecision) { LOGF(fatal, "\033[1;31m%s at line %d : nestedLoopValue = %f is not the same as twoC = %f\033[0m", __FUNCTION__, __LINE__, nestedLoopValue, twoC); } else { - LOGF(info, " e-b-e check with CustomNestedLoops is OK for isotropic 2-p, harmonic %d", h); + LOGF(info, "\033[1;32m ebye check (integrated) with CustomNestedLoops is OK for isotropic 2-p, harmonic %d\033[0m", h); } delete harmonics; harmonics = NULL; @@ -5417,6 +6923,18 @@ void CalculateCorrelations() if (mupa.fCorrelationsPro[0][h - 1][AFO_CENTRALITY]) { mupa.fCorrelationsPro[0][h - 1][AFO_CENTRALITY]->Fill(ebye.fCentrality, twoC, wTwo); } + // vs. occupancy: + if (mupa.fCorrelationsPro[0][h - 1][AFO_OCCUPANCY]) { + mupa.fCorrelationsPro[0][h - 1][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, twoC, wTwo); + } + // vs. interaction rate: + if (mupa.fCorrelationsPro[0][h - 1][AFO_INTERACTIONRATE]) { + mupa.fCorrelationsPro[0][h - 1][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, twoC, wTwo); + } + // vs. current run duration: + if (mupa.fCorrelationsPro[0][h - 1][AFO_CURRENTRUNDURATION]) { + mupa.fCorrelationsPro[0][h - 1][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, twoC, wTwo); + } // 4p: if (ebye.fSelectedTracks < 4) { @@ -5444,10 +6962,10 @@ void CalculateCorrelations() harmonics->SetAt(-h, 2); harmonics->SetAt(-h, 3); Double_t nestedLoopValue = this->CalculateCustomNestedLoops(harmonics); - if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(fourC - nestedLoopValue) > 1.e-5) { + if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(fourC - nestedLoopValue) > tc.fFloatingPointPrecision) { LOGF(fatal, "\033[1;31m%s at line %d : nestedLoopValue = %f is not the same as fourC = %f\033[0m", __FUNCTION__, __LINE__, nestedLoopValue, fourC); } else { - LOGF(info, " e-b-e check with CustomNestedLoops is OK for isotropic 4-p, harmonic %d", h); + LOGF(info, "\033[1;32m ebye check (integrated) with CustomNestedLoops is OK for isotropic 4-p, harmonic %d\033[0m", h); } delete harmonics; harmonics = NULL; @@ -5470,6 +6988,18 @@ void CalculateCorrelations() if (mupa.fCorrelationsPro[1][h - 1][AFO_CENTRALITY]) { mupa.fCorrelationsPro[1][h - 1][AFO_CENTRALITY]->Fill(ebye.fCentrality, fourC, wFour); } + // vs. occupancy: + if (mupa.fCorrelationsPro[1][h - 1][AFO_OCCUPANCY]) { + mupa.fCorrelationsPro[1][h - 1][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, fourC, wFour); + } + // vs. interaction rate: + if (mupa.fCorrelationsPro[1][h - 1][AFO_INTERACTIONRATE]) { + mupa.fCorrelationsPro[1][h - 1][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, fourC, wFour); + } + // vs. current run duration: + if (mupa.fCorrelationsPro[1][h - 1][AFO_CURRENTRUNDURATION]) { + mupa.fCorrelationsPro[1][h - 1][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, fourC, wFour); + } // 6p: if (ebye.fSelectedTracks < 6) { @@ -5499,10 +7029,10 @@ void CalculateCorrelations() harmonics->SetAt(-h, 4); harmonics->SetAt(-h, 5); Double_t nestedLoopValue = this->CalculateCustomNestedLoops(harmonics); - if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(sixC - nestedLoopValue) > 1.e-5) { + if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(sixC - nestedLoopValue) > tc.fFloatingPointPrecision) { LOGF(fatal, "\033[1;31m%s at line %d : nestedLoopValue = %f is not the same as sixC = %f\033[0m", __FUNCTION__, __LINE__, nestedLoopValue, sixC); } else { - LOGF(info, " e-b-e check with CustomNestedLoops is OK for isotropic 6-p, harmonic %d", h); + LOGF(info, "\033[1;32m ebye check (integrated) with CustomNestedLoops is OK for isotropic 6-p, harmonic %d\033[0m", h); } delete harmonics; harmonics = NULL; @@ -5525,6 +7055,18 @@ void CalculateCorrelations() if (mupa.fCorrelationsPro[2][h - 1][AFO_CENTRALITY]) { mupa.fCorrelationsPro[2][h - 1][AFO_CENTRALITY]->Fill(ebye.fCentrality, sixC, wSix); } + // vs. occupancy: + if (mupa.fCorrelationsPro[2][h - 1][AFO_OCCUPANCY]) { + mupa.fCorrelationsPro[2][h - 1][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, sixC, wSix); + } + // vs. interaction rate: + if (mupa.fCorrelationsPro[2][h - 1][AFO_INTERACTIONRATE]) { + mupa.fCorrelationsPro[2][h - 1][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, sixC, wSix); + } + // vs. current run duration: + if (mupa.fCorrelationsPro[2][h - 1][AFO_CURRENTRUNDURATION]) { + mupa.fCorrelationsPro[2][h - 1][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, sixC, wSix); + } // 8p: if (ebye.fSelectedTracks < 8) { @@ -5556,10 +7098,10 @@ void CalculateCorrelations() harmonics->SetAt(-h, 6); harmonics->SetAt(-h, 7); Double_t nestedLoopValue = this->CalculateCustomNestedLoops(harmonics); - if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(eightC - nestedLoopValue) > 1.e-5) { + if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(eightC - nestedLoopValue) > tc.fFloatingPointPrecision) { LOGF(fatal, "\033[1;31m%s at line %d : nestedLoopValue = %f is not the same as eightC = %f\033[0m", __FUNCTION__, __LINE__, nestedLoopValue, eightC); } else { - LOGF(info, " e-b-e check with CustomNestedLoops is OK for isotropic 8-p, harmonic %d", h); + LOGF(info, "\033[1;32m ebye check (integrated) with CustomNestedLoops is OK for isotropic 8-p, harmonic %d\033[0m", h); } delete harmonics; harmonics = NULL; @@ -5582,15 +7124,77 @@ void CalculateCorrelations() if (mupa.fCorrelationsPro[3][h - 1][AFO_CENTRALITY]) { mupa.fCorrelationsPro[3][h - 1][AFO_CENTRALITY]->Fill(ebye.fCentrality, eightC, wEight); } + // vs. occupancy: + if (mupa.fCorrelationsPro[3][h - 1][AFO_OCCUPANCY]) { + mupa.fCorrelationsPro[3][h - 1][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, eightC, wEight); + } + // vs. interaction rate: + if (mupa.fCorrelationsPro[3][h - 1][AFO_INTERACTIONRATE]) { + mupa.fCorrelationsPro[3][h - 1][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, eightC, wEight); + } + // vs. current run duration: + if (mupa.fCorrelationsPro[3][h - 1][AFO_CURRENTRUNDURATION]) { + mupa.fCorrelationsPro[3][h - 1][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, eightC, wEight); + } + } // for(Int_t h=1;h<=gMaxHarmonic;h++) // harmonic // c) Flush the generic Q-vectors: ResetQ(); + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void CalculateCorrelations() //============================================================ +void CalculateKineCorrelations(eAsFunctionOf AFO_variable) +{ + // Calculate analytically differential multiparticle correlations from Q-vectors. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // *) ... + eqvectorKine qvKine = eqvectorKine_N; // which eqvectorKine enum + // Int_t nBins = -1; // TBI 20241111 temporarily commented out just to suppress warnings + + switch (AFO_variable) { + case AFO_PT: + qvKine = PTq; + // nBins = res.fResultsPro[AFO_PT]->GetNbinsX(); // TBI 20241111 temporarily commented out just to suppress warnings + break; + case AFO_ETA: + qvKine = ETAq; + // nBins = res.fResultsPro[AFO_ETA]->GetNbinsX(); // TBI 20241111 temporarily commented out just to suppress warnings + break; + default: + LOGF(fatal, "\033[1;31m%s at line %d : This AFO_variable = %d is not supported yet. \033[0m", __FUNCTION__, __LINE__, static_cast(AFO_variable)); + break; + } // switch(AFO_variable) + + // *) Insanity checks on above settings: + if (qvKine == eqvectorKine_N) { + LOGF(fatal, "\033[1;31m%s at line %d : qvKine == eqvectorKine_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); + } + + // ... + + LOGF(warning, "\033[1;33m%s at line %d : Not implemented yet, this is just a placeholder for future implementation.\033[0m", __FUNCTION__, __LINE__); + + // ... + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void CalculateKineCorrelations(eAsFunctionOf AFO_variable) + +//============================================================ + void CalculateTest0() { // Calculate Test0. @@ -5600,7 +7204,7 @@ void CalculateTest0() // c) Flush the generic Q-vectors. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Flush 'n' fill the generic Q-vectors: @@ -5758,11 +7362,11 @@ void CalculateTest0() } Double_t nestedLoopValue = this->CalculateCustomNestedLoops(harmonics); if (!(TMath::Abs(nestedLoopValue) > 0.)) { - LOGF(info, " e-b-e check with CustomNestedLoops was NOT calculated for %d-p Test0 corr. %s", mo + 1, t0.fTest0Labels[mo][mi]->Data()); - } else if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(correlation / weight - nestedLoopValue) > 1.e-5) { + LOGF(info, " ebye check (integrated) with CustomNestedLoops was NOT calculated for %d-p Test0 corr. %s", mo + 1, t0.fTest0Labels[mo][mi]->Data()); + } else if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(correlation / weight - nestedLoopValue) > tc.fFloatingPointPrecision) { LOGF(fatal, "\033[1;31m%s at line %d : nestedLoopValue = %f is not the same as correlation/weight = %f, for correlator %s\033[0m", __FUNCTION__, __LINE__, nestedLoopValue, correlation / weight, t0.fTest0Labels[mo][mi]->Data()); } else { - LOGF(info, " e-b-e check with CustomNestedLoops is OK for %d-p Test0 corr. %s", mo + 1, t0.fTest0Labels[mo][mi]->Data()); + LOGF(info, "\033[1;32m ebye check (integrated) with CustomNestedLoops is OK for %d-p Test0 corr. %s\033[0m", mo + 1, t0.fTest0Labels[mo][mi]->Data()); } delete harmonics; harmonics = NULL; @@ -5790,12 +7394,24 @@ void CalculateTest0() } // vs. multiplicity: if (t0.fTest0Pro[mo][mi][AFO_MULTIPLICITY]) { - t0.fTest0Pro[mo][mi][AFO_MULTIPLICITY]->Fill(ebye.fSelectedTracks + 0.5, correlation / weight, weight); + t0.fTest0Pro[mo][mi][AFO_MULTIPLICITY]->Fill(ebye.fMultiplicity + 0.5, correlation / weight, weight); } // vs. centrality: if (t0.fTest0Pro[mo][mi][AFO_CENTRALITY]) { t0.fTest0Pro[mo][mi][AFO_CENTRALITY]->Fill(ebye.fCentrality, correlation / weight, weight); } + // vs. occupancy: + if (t0.fTest0Pro[mo][mi][AFO_OCCUPANCY]) { + t0.fTest0Pro[mo][mi][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, correlation / weight, weight); + } + // vs. interaction rate: + if (t0.fTest0Pro[mo][mi][AFO_INTERACTIONRATE]) { + t0.fTest0Pro[mo][mi][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, correlation / weight, weight); + } + // vs. current run duration: + if (t0.fTest0Pro[mo][mi][AFO_CURRENTRUNDURATION]) { + t0.fTest0Pro[mo][mi][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, correlation / weight, weight); + } } // if(t0.fTest0Labels[mo][mi]) } // for(Int_t mi=0;mi add some more entries to the case stamenent \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : qvKine == eqvectorKine_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); } // *) Uniform loop over bin for all kine variables: for (Int_t b = 0; b < nBins; b++) { // *) Ensures that in each bin of interest, I have the same cut on number of particles, like in integrated analysis: - if ((qv.fqVectorEntries[qvKine][b] < ec.fdEventCuts[eSelectedTracks][eMin]) || (qv.fqVectorEntries[qvKine][b] > ec.fdEventCuts[eSelectedTracks][eMax])) { + if ((qv.fqVectorEntries[qvKine][b] < ec.fdEventCuts[eMultiplicity][eMin]) || (qv.fqVectorEntries[qvKine][b] > ec.fdEventCuts[eMultiplicity][eMax] || TMath::Abs(qv.fqVectorEntries[qvKine][b] - ec.fdEventCuts[eMultiplicity][eMax]) < tc.fFloatingPointPrecision)) { if (tc.fVerbose) { - LOGF(info, "\033[1;31m%s eSelectedTracks cut in bin = %d, for qvKine = %d\033[0m", __FUNCTION__, b, static_cast(qvKine)); + LOGF(info, "\033[1;31m%s eMultiplicity cut in bin = %d, for qvKine = %d\033[0m", __FUNCTION__, b, static_cast(qvKine)); } } @@ -5870,8 +7490,7 @@ void CalculateKineTest0(eAsFunctionOf AFO_variable) // cout<At(h)->GetName()).Atoi(); delete oa; // yes, otherwise it's a memory leak @@ -5959,10 +7578,10 @@ void CalculateKineTest0(eAsFunctionOf AFO_variable) Double_t nestedLoopValue = this->CalculateKineCustomNestedLoops(harmonics, AFO_variable, b); if (!(TMath::Abs(nestedLoopValue) > 0.)) { LOGF(info, " e-b-e check with CalculateKineCustomNestedLoops was NOT calculated for %d-p Test0 corr. %s, bin = %d", mo + 1, t0.fTest0Labels[mo][mi]->Data(), b + 1); - } else if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(correlation / weight - nestedLoopValue) > 1.e-5) { + } else if (TMath::Abs(nestedLoopValue) > 0. && TMath::Abs(correlation / weight - nestedLoopValue) > tc.fFloatingPointPrecision) { LOGF(fatal, "\033[1;31m%s at line %d : correlator: %s \n correlation: %f \n custom loop: %f \033[0m", __FUNCTION__, __LINE__, t0.fTest0Labels[mo][mi]->Data(), correlation / weight, nestedLoopValue); } else { - LOGF(info, " e-b-e check with CalculateKineCustomNestedLoops is OK for %d-p Test0 corr. %s, bin = %d", mo + 1, t0.fTest0Labels[mo][mi]->Data(), b + 1); + LOGF(info, "\033[1;32m ebye check (differential) with CalculateKineCustomNestedLoops is OK for %d-p Test0 corr. %s, bin = %d\033[0m", mo + 1, t0.fTest0Labels[mo][mi]->Data(), b + 1); } delete harmonics; harmonics = NULL; @@ -6010,21 +7629,184 @@ void CalculateKineTest0(eAsFunctionOf AFO_variable) } // for(Int_t b=0;b 0. && qv.fQabVector[1][h][e].Rho() > 0.)) { + continue; + } + if (!(qv.fMab[0][e] > 0. && qv.fMab[1][e] > 0.)) { + continue; + } + + // calculate correlation and weights with particular eta separation: + correlation = TComplex(qv.fQabVector[0][h][e] * TComplex::Conjugate(qv.fQabVector[1][h][e])).Re(); + weight = qv.fMab[0][e] * qv.fMab[1][e]; + + // for on-the-fly and internal validation, rescale results with theoretical value: + if (iv.fUseInternalValidation && iv.fRescaleWithTheoreticalInput && iv.fInternalValidationVnPsin[eVn] && TMath::Abs(iv.fInternalValidationVnPsin[eVn]->GetAt(h)) > 0.) { + correlation /= pow(iv.fInternalValidationVnPsin[eVn]->GetAt(h), 2.); + } + + // integrated: + if (es.fEtaSeparationsPro[h][e][AFO_INTEGRATED]) { + es.fEtaSeparationsPro[h][e][AFO_INTEGRATED]->Fill(0.5, correlation / weight, weight); + } + + // vs. multiplicity: + if (es.fEtaSeparationsPro[h][e][AFO_MULTIPLICITY]) { + es.fEtaSeparationsPro[h][e][AFO_MULTIPLICITY]->Fill(ebye.fMultiplicity + 0.5, correlation / weight, weight); + } + + // vs. centrality: + if (es.fEtaSeparationsPro[h][e][AFO_CENTRALITY]) { + es.fEtaSeparationsPro[h][e][AFO_CENTRALITY]->Fill(ebye.fCentrality, correlation / weight, weight); + } + + // vs. occupancy: + if (es.fEtaSeparationsPro[h][e][AFO_OCCUPANCY]) { + es.fEtaSeparationsPro[h][e][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, correlation / weight, weight); + } + + // vs. interaction rate: + if (es.fEtaSeparationsPro[h][e][AFO_INTERACTIONRATE]) { + es.fEtaSeparationsPro[h][e][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, correlation / weight, weight); + } + + // vs. current run duration: + if (es.fEtaSeparationsPro[h][e][AFO_CURRENTRUNDURATION]) { + es.fEtaSeparationsPro[h][e][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, correlation / weight, weight); + } + + } // for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + } // for (Int_t h = 0; h < gMaxHarmonic; h++) { + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void CalculateEtaSeparations() + +//============================================================ + +void CalculateKineEtaSeparations(eAsFunctionOf AFO_variable) +{ + // Calculate differential correlations with pseudorapidity separations. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // *) ... + eqvectorKine qvKine = eqvectorKine_N; // which eqvectorKine enum + Int_t nBins = -1; + + switch (AFO_variable) { + case AFO_PT: + qvKine = PTq; + nBins = res.fResultsPro[AFO_PT]->GetNbinsX(); + break; + case AFO_ETA: + LOGF(fatal, "\033[1;31m%s at line %d : It doesn't make sense (i.e. AFO_ETA cannot be used here). \033[0m", __FUNCTION__, __LINE__, static_cast(AFO_variable)); + break; // obsolete, but it supresses the warning + default: + LOGF(fatal, "\033[1;31m%s at line %d : This AFO_variable = %d is not supported yet. \033[0m", __FUNCTION__, __LINE__, static_cast(AFO_variable)); + break; + } // switch(AFO_variable) + + // *) Insanity checks on above settings: + if (qvKine == eqvectorKine_N) { + LOGF(fatal, "\033[1;31m%s at line %d : qvKine == eqvectorKine_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); + } + + // *) Uniform loop over bin for all kine variables: + for (Int_t b = 0; b < nBins; b++) { + + /* TBI 20241206 Do I need to adapt and apply this cut, also for Qa and Qb? If so, most likely I would need to apply it on sum, i.e. on entries in Qa + Qb + + // *) Ensures that in each bin of interest, I have the same cut on number of particles, like in integrated analysis: + if ((qv.fqVectorEntries[qvKine][b] < ec.fdEventCuts[eMultiplicity][eMin]) || (qv.fqVectorEntries[qvKine][b] > ec.fdEventCuts[eMultiplicity][eMax] || TMath::Abs(qv.fqVectorEntries[qvKine][b] - ec.fdEventCuts[eMultiplicity][eMax]) < tc.fFloatingPointPrecision)) { + if (tc.fVerbose) { + LOGF(info, "\033[1;31m%s eMultiplicity cut in bin = %d, for qvKine = %d\033[0m", __FUNCTION__, b, static_cast(qvKine)); + } + } + */ + + // Calculate differential 2-p correlations with eta separations from Qa (-eta, index [0]) and Qb (+eta, index [1]) vectors: + Double_t correlation = 0.; + Double_t weight = 0.; + for (Int_t h = 0; h < gMaxHarmonic; h++) { + if (es.fEtaSeparationsSkipHarmonics[h]) { + continue; + } + + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + if (!(qv.fqabVector[0][b][h][e].Rho() > 0. && qv.fqabVector[1][b][h][e].Rho() > 0.)) { + continue; + } + if (!(qv.fmab[0][b][e] > 0. && qv.fmab[1][b][e] > 0.)) { + continue; + } + + // calculate correlation and weights with particular eta separation: + correlation = TComplex(qv.fqabVector[0][b][h][e] * TComplex::Conjugate(qv.fqabVector[1][b][h][e])).Re(); + weight = qv.fmab[0][b][e] * qv.fmab[1][b][e]; + + // for on-the-fly and internal validation, rescale results with theoretical value: + if (iv.fUseInternalValidation && iv.fRescaleWithTheoreticalInput && iv.fInternalValidationVnPsin[eVn] && TMath::Abs(iv.fInternalValidationVnPsin[eVn]->GetAt(h)) > 0.) { + correlation /= pow(iv.fInternalValidationVnPsin[eVn]->GetAt(h), 2.); + } + + // finally, fill: + if (es.fEtaSeparationsPro[h][e][AFO_variable]) { + es.fEtaSeparationsPro[h][e][AFO_variable]->Fill(es.fEtaSeparationsPro[h][e][AFO_variable]->GetXaxis()->GetBinCenter(b + 1), correlation / weight, weight); + } + } + } + } // for (Int_t b = 0; b < nBins; b++) { + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void CalculateKineEtaSeparations() + +//============================================================ + +void FillNestedLoopsContainers(const Int_t& particleIndex, const Double_t& dPhi, const Double_t& dPt, const Double_t& dEta) +{ + // Fill into the nested loop containers the current particle. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + if (tc.fInsanityCheckForEachParticle) { + if (particleIndex < 0) { + LOGF(fatal, "\033[1;31m%s at line %d : particleIndex = %d\033[0m", __FUNCTION__, __LINE__, particleIndex); } if (!(TMath::Abs(nl.ftaNestedLoops[0]->GetAt(particleIndex - 1)) > 0.)) { LOGF(fatal, "\033[1;31m%s at line %d : there are empty elements in nl.ftaNestedLoops[0] \033[0m", __FUNCTION__, __LINE__); @@ -6058,6 +7840,10 @@ void FillNestedLoopsContainers(const Int_t& particleIndex, const Double_t& dPhi, nl.ftaNestedLoops[1]->AddAt(wPhi * wPt * wEta, particleIndex); // remember that the 2nd argument here must start from 0 } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void FillNestedLoopsContainers(const Int_t& particleIndex, const Double_t& dPhi, const Double_t& dPt, const Double_t& dEta) //============================================================ @@ -6072,7 +7858,7 @@ void CalculateNestedLoops() // d) 8-particle nested loops. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } LOGF(info, " ebye.fSelectedTracks = %d", ebye.fSelectedTracks); @@ -6117,7 +7903,7 @@ void CalculateNestedLoops() // fill cos, 2p, vs. multiplicity: if (nl.fNestedLoopsPro[0][h][AFO_MULTIPLICITY]) { nl.fNestedLoopsPro[0][h][AFO_MULTIPLICITY]->Fill( - ebye.fSelectedTracks + 0.5, TMath::Cos((h + 1.) * (dPhi1 - dPhi2)), + ebye.fMultiplicity + 0.5, TMath::Cos((h + 1.) * (dPhi1 - dPhi2)), dW1 * dW2); } // fill cos, 2p, vs. centrality: @@ -6125,6 +7911,21 @@ void CalculateNestedLoops() nl.fNestedLoopsPro[0][h][AFO_CENTRALITY]->Fill( ebye.fCentrality, TMath::Cos((h + 1.) * (dPhi1 - dPhi2)), dW1 * dW2); } + // fill cos, 2p, vs. occupancy: + if (nl.fNestedLoopsPro[0][h][AFO_OCCUPANCY]) { + nl.fNestedLoopsPro[0][h][AFO_OCCUPANCY]->Fill( + ebye.fOccupancy, TMath::Cos((h + 1.) * (dPhi1 - dPhi2)), dW1 * dW2); + } + // fill cos, 2p, vs. interaction rate: + if (nl.fNestedLoopsPro[0][h][AFO_INTERACTIONRATE]) { + nl.fNestedLoopsPro[0][h][AFO_INTERACTIONRATE]->Fill( + ebye.fInteractionRate, TMath::Cos((h + 1.) * (dPhi1 - dPhi2)), dW1 * dW2); + } + // fill cos, 2p, vs. current run duration: + if (nl.fNestedLoopsPro[0][h][AFO_CURRENTRUNDURATION]) { + nl.fNestedLoopsPro[0][h][AFO_CURRENTRUNDURATION]->Fill( + ebye.fCurrentRunDuration, TMath::Cos((h + 1.) * (dPhi1 - dPhi2)), dW1 * dW2); + } } // for(int h=1; h<=6; h++) } // for(int i2=0; i2Fill(ebye.fSelectedTracks + 0.5, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 - dPhi3 - dPhi4)), dW1 * dW2 * dW3 * dW4); + nl.fNestedLoopsPro[1][h][AFO_MULTIPLICITY]->Fill(ebye.fMultiplicity + 0.5, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 - dPhi3 - dPhi4)), dW1 * dW2 * dW3 * dW4); } // fill cos, 4p, all harmonics, vs. centrality: if (nl.fNestedLoopsPro[1][h][AFO_CENTRALITY]) { nl.fNestedLoopsPro[1][h][AFO_CENTRALITY]->Fill(ebye.fCentrality, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 - dPhi3 - dPhi4)), dW1 * dW2 * dW3 * dW4); } + // fill cos, 4p, all harmonics, vs. occupancy: + if (nl.fNestedLoopsPro[1][h][AFO_OCCUPANCY]) { + nl.fNestedLoopsPro[1][h][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 - dPhi3 - dPhi4)), dW1 * dW2 * dW3 * dW4); + } + // fill cos, 4p, all harmonics, vs. interaction rate: + if (nl.fNestedLoopsPro[1][h][AFO_INTERACTIONRATE]) { + nl.fNestedLoopsPro[1][h][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 - dPhi3 - dPhi4)), dW1 * dW2 * dW3 * dW4); + } + // fill cos, 4p, all harmonics, vs. current run duratione: + if (nl.fNestedLoopsPro[1][h][AFO_CURRENTRUNDURATION]) { + nl.fNestedLoopsPro[1][h][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 - dPhi3 - dPhi4)), dW1 * dW2 * dW3 * dW4); + } } // for(int h=0; hFill(ebye.fSelectedTracks + 0.5, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 - dPhi4 - dPhi5 - dPhi6)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6); + nl.fNestedLoopsPro[2][h][AFO_MULTIPLICITY]->Fill(ebye.fMultiplicity + 0.5, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 - dPhi4 - dPhi5 - dPhi6)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6); } - // fill cos, 6p, all harmonics, vs. M: + // fill cos, 6p, all harmonics, vs. centrality: if (nl.fNestedLoopsPro[2][h][AFO_CENTRALITY]) { nl.fNestedLoopsPro[2][h][AFO_CENTRALITY]->Fill(ebye.fCentrality, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 - dPhi4 - dPhi5 - dPhi6)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6); } + // fill cos, 6p, all harmonics, vs. occupancy: + if (nl.fNestedLoopsPro[2][h][AFO_OCCUPANCY]) { + nl.fNestedLoopsPro[2][h][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 - dPhi4 - dPhi5 - dPhi6)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6); + } + // fill cos, 6p, all harmonics, vs. interaction rate: + if (nl.fNestedLoopsPro[2][h][AFO_INTERACTIONRATE]) { + nl.fNestedLoopsPro[2][h][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 - dPhi4 - dPhi5 - dPhi6)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6); + } + // fill cos, 6p, all harmonics, vs. current run duration: + if (nl.fNestedLoopsPro[2][h][AFO_CURRENTRUNDURATION]) { + nl.fNestedLoopsPro[2][h][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 - dPhi4 - dPhi5 - dPhi6)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6); + } } // for(int h=0; hFill(ebye.fSelectedTracks + 0.5, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 + dPhi4 - dPhi5 - dPhi6 - dPhi7 - dPhi8)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6 * dW7 * dW8); + nl.fNestedLoopsPro[3][h][AFO_MULTIPLICITY]->Fill(ebye.fMultiplicity + 0.5, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 + dPhi4 - dPhi5 - dPhi6 - dPhi7 - dPhi8)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6 * dW7 * dW8); } - // fill cos, 8p, all harmonics, vs. M: + // fill cos, 8p, all harmonics, vs. centrality: if (nl.fNestedLoopsPro[3][h][AFO_CENTRALITY]) { nl.fNestedLoopsPro[3][h][AFO_CENTRALITY]->Fill(ebye.fCentrality, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 + dPhi4 - dPhi5 - dPhi6 - dPhi7 - dPhi8)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6 * dW7 * dW8); } + // fill cos, 8p, all harmonics, vs. occupancy: + if (nl.fNestedLoopsPro[3][h][AFO_OCCUPANCY]) { + nl.fNestedLoopsPro[3][h][AFO_OCCUPANCY]->Fill(ebye.fOccupancy, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 + dPhi4 - dPhi5 - dPhi6 - dPhi7 - dPhi8)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6 * dW7 * dW8); + } + // fill cos, 8p, all harmonics, vs. interaction rate: + if (nl.fNestedLoopsPro[3][h][AFO_INTERACTIONRATE]) { + nl.fNestedLoopsPro[3][h][AFO_INTERACTIONRATE]->Fill(ebye.fInteractionRate, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 + dPhi4 - dPhi5 - dPhi6 - dPhi7 - dPhi8)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6 * dW7 * dW8); + } + // fill cos, 8p, all harmonics, vs. current run duration: + if (nl.fNestedLoopsPro[3][h][AFO_CURRENTRUNDURATION]) { + nl.fNestedLoopsPro[3][h][AFO_CURRENTRUNDURATION]->Fill(ebye.fCurrentRunDuration, TMath::Cos((h + 1.) * (dPhi1 + dPhi2 + dPhi3 + dPhi4 - dPhi5 - dPhi6 - dPhi7 - dPhi8)), dW1 * dW2 * dW3 * dW4 * dW5 * dW6 * dW7 * dW8); + } } // for(int h=0; hGetNbinsX(); nBinsNL = nl.fNestedLoopsPro[0][0][v]->GetNbinsX(); if (nBinsQV != nBinsNL) { @@ -6359,17 +8201,21 @@ void ComparisonNestedLoopsVsCorrelations() if (TMath::Abs(valueQV) > 0. && TMath::Abs(valueNL) > 0.) { LOGF(info, " bin=%d, h=%d, Q-vectors: %f", b, h + 1, valueQV); LOGF(info, " bin=%d, h=%d, Nested loops: %f", b, h + 1, valueNL); - if (TMath::Abs(valueQV - valueNL) > 1.e-5) { + if (TMath::Abs(valueQV - valueNL) > tc.fFloatingPointPrecision) { LOGF(info, "\n\033[1;33m[%d][%d][%d] \033[0m\n", o, h, v); LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } } // if(TMath::Abs(valueQV)>0. && TMath::Abs(valueNL)>0.) } // for(Int_t b=1;b<=nBinsQV;b++) - } // for(Int_t h=0;h<6;h++) + } // for (Int_t h = 0; h < gMaxHarmonic; h++) { LOGF(info, ""); // new line } // for(Int_t o=0;o<4;o++) } // for (Int_t v = 0; v < 3; v++) + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void ComparisonNestedLoopsVsCorrelations() //============================================================ @@ -6603,7 +8449,7 @@ void ResetQ() // standard functions for correlations, for some custom Q-vectors. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } for (Int_t h = 0; h < gMaxHarmonic * gMaxCorrelator + 1; h++) { @@ -6613,6 +8459,10 @@ void ResetQ() } } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void ResetQ() //============================================================ @@ -6622,7 +8472,7 @@ void SetWeightsHist(TH1D* const hist, eWeights whichWeight) // Copy histogram holding weights from an external file to the corresponding data member. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // Finally: @@ -6651,6 +8501,10 @@ void SetWeightsHist(TH1D* const hist, eWeights whichWeight) // Flag: pw.fUseWeights[whichWeight] = kTRUE; + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void SetWeightsHist(TH1D* const hist, eWeights whichWeight) //============================================================ @@ -6663,7 +8517,7 @@ void SetDiffWeightsHist(TH1D* const hist, eDiffWeights whichDiffWeight, Int_t bi // Only if I promote "filePath" to data members, re-think the design of this function, and what goes where. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // Finally: @@ -6692,16 +8546,66 @@ void SetDiffWeightsHist(TH1D* const hist, eDiffWeights whichDiffWeight, Int_t bi pw.fUseDiffWeights[whichDiffWeight] = kTRUE; } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // SetDiffWeightsHist(TH1D* const hist, const char *variable, Int_t bin) //============================================================ +void SetCentralityWeightsHist(TH1D* const hist) +{ + // Copy histogram holding weights from an external file to the corresponding data member. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // Finally: + hist->SetDirectory(0); + cw.fCentralityWeightsHist = reinterpret_cast(hist->Clone()); + + if (!cw.fCentralityWeightsHist) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + + // Cosmetics: TBI 20240216 do I really want to overwrite initial cosmetics, perhaps this shall go better into MakeCentralityWeights.C ? + // Or I could move all this to GetHistogramWithCentralityWeights, where in any case I am setting e.g. histogram title, etc. + cw.fCentralityWeightsHist->SetStats(kFALSE); + cw.fCentralityWeightsHist->GetXaxis()->SetTitle("Centrality percentile"); + cw.fCentralityWeightsHist->GetYaxis()->SetTitle(Form("Centrality weight (%s)", ec.fsEventCuts[eCentralityEstimator].Data())); + cw.fCentralityWeightsHist->SetFillColor(eFillColor); + cw.fCentralityWeightsHist->SetLineColor(eColor); + if (!cw.fCentralityWeightsList) { + LOGF(fatal, "\033[1;31m%s at line %d: fCentralityWeightsList is NULL. That means that you have called SetCentralityWeightsHist(...) in init(), before this TList was booked.\033[0m", __FUNCTION__, __LINE__); + } + cw.fCentralityWeightsList->Add(cw.fCentralityWeightsHist); // This is working at the moment, because I am fetching all centrality weights in Preprocess(), which is called after init() + // But if eventually it will be possible to fetch run number programatically in init(), I will have to re-think this line. + + // Flag: + cw.fUseCentralityWeights = kTRUE; + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void SetCentralityWeightsHist(TH1D* const hist) + +//============================================================ + TH1D* GetWeightsHist(eWeights whichWeight) { // The standard getter. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); + } + + // ... + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); } // Finally: @@ -6736,7 +8640,7 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const // g) The final touch on histogram with weights. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); LOGF(info, "\033[1;33m filePath = %s\033[0m", filePath); LOGF(info, "\033[1;33m runNumber = %s\033[0m", runNumber); LOGF(info, "\033[1;33m variable = %s\033[0m", variable); @@ -6784,7 +8688,7 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const } weightsFile->GetObject( - "ccdb_object", baseList); // TBI 20231008 for simplicity, harwired name + "ccdb_object", baseList); // TBI 20231008 for simplicity, hardwired name // of base TList is "ccdb_object" also for // AliEn case, see if I need to change this if (!baseList) { @@ -6818,14 +8722,10 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const ccdb->setURL("http://alice-ccdb.cern.ch"); if (tc.fVerbose) { - LOGF(info, "\033[1;32mAccessing in CCDB %s\033[0m", - TString(filePath).ReplaceAll("/alice-ccdb.cern.ch/", "").Data()); + LOGF(info, "\033[1;32mAccessing in CCDB %s\033[0m", TString(filePath).ReplaceAll("/alice-ccdb.cern.ch/", "").Data()); } - baseList = - reinterpret_cast(ccdb->get(TString(filePath) - .ReplaceAll("/alice-ccdb.cern.ch/", "") - .Data())); + baseList = reinterpret_cast(ccdb->get(TString(filePath).ReplaceAll("/alice-ccdb.cern.ch/", "").Data())); if (!baseList) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); @@ -6860,10 +8760,9 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - weightsFile->GetObject( - "ccdb_object", baseList); // TBI 20231008 for simplicity, harwired name - // of base TList is "ccdb_object" also for - // local case, see if I need to change this + weightsFile->GetObject("ccdb_object", baseList); // TBI 20231008 for simplicity, hardwired name + // of base TList is "ccdb_object" also for + // local case, see if I need to change this if (!baseList) { // weightsFile->ls(); LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); @@ -6875,7 +8774,8 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const runNumberWithLeadingZeroes += runNumber; // another try, with "000" prepended to run number listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumberWithLeadingZeroes.Data())); if (!listWithRuns) { - LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + // baseList->ls(); + LOGF(fatal, "\033[1;31m%s at line %d : this crash can happen if in the output file there is no list with weights for the current run number = %s\033[0m", __FUNCTION__, __LINE__, tc.fRunNumber.Data()); } } @@ -6954,12 +8854,12 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const LOGF(fatal, "\033[1;33m min = %f, max = %f, res.fResultsPro[AFO]->GetName() = %s\033[0m", min, max, res.fResultsPro[AFO]->GetName()); } - // Compare with min and max value store in external weights.root file using MakeWeights.C: - if (!(TMath::Abs(TString(oa->At(nEntries - 1)->GetName()).Atof() - max) < 1.e-6)) { + // Compare with min and max value stored in external weights.root file using MakeWeights.C: + if (!(TMath::Abs(TString(oa->At(nEntries - 1)->GetName()).Atof() - max) < tc.fFloatingPointPrecision)) { LOGF(info, "\033[1;33m hist->GetTitle() = %s, res.fResultsPro[AFO]->GetName() = %s\033[0m", hist->GetTitle(), res.fResultsPro[AFO]->GetName()); LOGF(fatal, "in function \033[1;31m%s at line %d : mismatch in upper bin boundaries \n from title = %f , local = %f\033[0m", __FUNCTION__, __LINE__, TString(oa->At(nEntries - 1)->GetName()).Atof(), max); } - if (!(TMath::Abs(TString(oa->At(nEntries - 5)->GetName()).Atof() - min) < 1.e-6)) { + if (!(TMath::Abs(TString(oa->At(nEntries - 5)->GetName()).Atof() - min) < tc.fFloatingPointPrecision)) { LOGF(info, "\033[1;33m hist->GetTitle() = %s, res.fResultsPro[AFO]->GetName() = %s\033[0m", hist->GetTitle(), res.fResultsPro[AFO]->GetName()); LOGF(fatal, "in function \033[1;31m%s at line %d : mismatch in lower bin boundaries \n from title = %f , local = %f\033[0m", __FUNCTION__, __LINE__, TString(oa->At(nEntries - 5)->GetName()).Atof(), min); } @@ -6974,42 +8874,54 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const // TBI 20241021 if I need to split hist title across two lines, use this technique: // hist->SetTitle(Form("#splitline{#scale[0.6]{%s}}{#scale[0.4]{%s}}",hist->GetTitle(),filePath)); + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + return hist; } // TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const char* variable, Int_t bin = -1) //============================================================ -TObjArray* GetObjArrayWithLabels(const char* filePath) +TH1D* GetHistogramWithCentralityWeights(const char* filePath, const char* runNumber) { - // This function extracts from an external file TObjArray named "labels", and - // returns it. External file can be: 1) on a local computer; 2) in home - // directory AliEn => configurable "cfFileWithLabels" must begin with - // "/alice/cern.ch/" 3) in CCDB => configurable "cfFileWithLabels" must begin - // with "/alice-ccdb.cern.ch/" For all CCDB wisdom, see toggle "CCDB" in page - // "O2" + // Get and return histogram with centrality weights from an external file. + + // TBI 20241118 Shall I merge this function with GetHistogramWithWeights(...) as there is a bit of code bloat? + + // TBI 20241021 Strictly speaking, I do not need to pass here first 2 arguments, "filePath" and "runNumber", because they are initialized at call from data members. + // But since this function is called only once, it's not an important performance loss. But re-think the design here eventually. // a) Return value; - // b) Determine from filePath if the file in on a local machine, or in AliEn; - // c) Handle the AliEn case; - // d) Handle the CCDB case; - // e) Handle the local case. + // b) Basic protection for arguments; + // c) Determine from filePath if the file in on a local machine, or in AliEn, or in CCDB; + // d) Handle the AliEn case; + // e) Handle the CCDB case; + // f) Handle the local case; + // g) The final touch on histogram with centrality weights. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); + LOGF(info, "\033[1;33m filePath = %s\033[0m", filePath); + LOGF(info, "\033[1;33m runNumber = %s\033[0m", runNumber); + LOGF(info, "\033[1;33m fTaskName = %s\033[0m", tc.fTaskName.Data()); } // a) Return value: - TObjArray* oa = NULL; + TH1D* hist = NULL; + TList* baseList = NULL; // base top-level list in the TFile, e.g. named "ccdb_object" + TList* listWithRuns = NULL; // nested list with run-wise TList's holding run-specific weights - // b) Determine from filePath if the file in on a local machine, or in home + // b) Basic protection for arguments: + // ... + + // c) Determine from filePath if the file in on a local machine, or in home // dir AliEn, or in CCDB: // Algorithm: If filePath begins with "/alice/cern.ch/" then it's in home - // dir AliEn. - // If filePath begins with "/alice-ccdb.cern.ch/" then it's in - // CCDB. Therefore, files in AliEn and CCDB must be specified - // with abs path, for local files both abs and relative paths - // are just fine. + // dir AliEn. If filePath begins with "/alice-ccdb.cern.ch/" then it's in + // CCDB. Therefore, files in AliEn and CCDB must be specified with abs path, + // for local files both abs and relative paths are just fine. Bool_t bFileIsInAliEn = kFALSE; Bool_t bFileIsInCCDB = kFALSE; if (TString(filePath).BeginsWith("/alice/cern.ch/")) { @@ -7020,41 +8932,39 @@ TObjArray* GetObjArrayWithLabels(const char* filePath) } // else { } // if (TString(filePath).BeginsWith("/alice/cern.ch/")) { - TFile* oaFile = NULL; // file holding TObjArray with all labels if (bFileIsInAliEn) { - // c) Handle the AliEn case: + // d) Handle the AliEn case: TGrid* alien = TGrid::Connect("alien", gSystem->Getenv("USER"), "", ""); if (!alien) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - oaFile = TFile::Open(Form("alien://%s", filePath), "READ"); - if (!oaFile) { + TFile* centralityWeightsFile = TFile::Open(Form("alien://%s", filePath), "READ"); + if (!centralityWeightsFile) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - // Fetch TObjArray from external file (keep in sync with local file case below): - TList* lok = oaFile->GetListOfKeys(); - if (!lok) { + centralityWeightsFile->GetObject("ccdb_object", baseList); // TBI 20231008 for simplicity, hardwired name + // of base TList is "ccdb_object" also for + // AliEn case, see if I need to change this + if (!baseList) { + // centralityWeightsFile->ls(); LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - for (Int_t l = 0; l < lok->GetEntries(); l++) { - oaFile->GetObject(lok->At(l)->GetName(), oa); - if (oa && TString(oa->ClassName()).EqualTo("TObjArray")) { - break; // TBI 20231107 the working assumption is that in an external file there is only one TObjArray object, - // and here I fetch it, whatever its name is. The advantage is that I do not have to do - // any additional work for TObjArray's name. Since I do not anticipate ever having more than 1 - // TObjArray in an external file, this shall be alright. With the current implementation, - // if there are multiple TObjArray objects in the same ROOT file, the first one will be fetched. - } - } // for(Int_t l=0;lGetEntries();l++) - if (!oa) { - LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumber)); + if (!listWithRuns) { + TString runNumberWithLeadingZeroes = "000"; + runNumberWithLeadingZeroes += runNumber; // another try, with "000" prepended to run number + listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumberWithLeadingZeroes.Data())); + if (!listWithRuns) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } } + } else if (bFileIsInCCDB) { - // d) Handle the CCDB case: Remember that here I do not access the file, - // instead directly object in that file. + // e) Handle the CCDB case: Remember that here I do not access the file, + // instead directly object in that file. // My home dir in CCDB: https://alice-ccdb.cern.ch/browse/Users/a/abilandz/ // Inspired by: // 1. Discussion at: @@ -7066,18 +8976,274 @@ TObjArray* GetObjArrayWithLabels(const char* filePath) // https://indico.cern.ch/event/1267433/timetable/#20230417.detailed ccdb->setURL("http://alice-ccdb.cern.ch"); - oa = reinterpret_cast(ccdb->get( - TString(filePath) - .ReplaceAll("/alice-ccdb.cern.ch/", "") - .Data())); + if (tc.fVerbose) { + LOGF(info, "\033[1;32mAccessing in CCDB %s\033[0m", TString(filePath).ReplaceAll("/alice-ccdb.cern.ch/", "").Data()); + } - if (!oa) { + baseList = reinterpret_cast(ccdb->get(TString(filePath).ReplaceAll("/alice-ccdb.cern.ch/", "").Data())); + + if (!baseList) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - } else { - // e) Handle the local case: - // Check if the external ROOT file exists at specified path: + listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumber)); + if (!listWithRuns) { + TString runNumberWithLeadingZeroes = "000"; + runNumberWithLeadingZeroes += runNumber; // another try, with "000" prepended to run number + listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumberWithLeadingZeroes.Data())); + if (!listWithRuns) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + } + + } else { + + // f) Handle the local case: + // TBI 20231008 In principle, also for the local case in O2, I could + // maintain the same local structure of weights as it was in AliPhysics. + // But for simplicity, in O2 I organize local weights in the + // same way as in AliEn or CCDB. + + // Check if the external ROOT file exists at specified path: + if (gSystem->AccessPathName(filePath, kFileExists)) { + LOGF(info, "\033[1;33m if(gSystem->AccessPathName(filePath,kFileExists)), filePath = %s \033[0m", filePath); + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + + TFile* centralityWeightsFile = TFile::Open(filePath, "READ"); + if (!centralityWeightsFile) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + + // xxxxxxxxxxxx TBI 20241124 remove this code + + hist = reinterpret_cast(centralityWeightsFile->Get("FT0C_Default list name")); // TBI 20241122 temporary workaround + if (!hist) { + Exit(); + } + hist->SetDirectory(0); + hist->SetTitle(Form("%s, %s", filePath, runNumber)); // I have to do it here, because only here I have "filePath" available + return hist; + + // xxxxxxxxxxxx + + /* + centralityWeightsFile->GetObject("ccdb_object", baseList); // TBI 20231008 for simplicity, hardwired name + // of base TList is "ccdb_object" also for + // local case, see if I need to change this + + if (!baseList) { + // centralityWeightsFile->ls(); + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + + listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumber)); + if (!listWithRuns) { + TString runNumberWithLeadingZeroes = "000"; + runNumberWithLeadingZeroes += runNumber; // another try, with "000" prepended to run number + listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumberWithLeadingZeroes.Data())); + if (!listWithRuns) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + } + */ + + } // else { + + // g) The final touch on histogram with centrality weights: + // fetch histogram directly from this list: + hist = reinterpret_cast(listWithRuns->FindObject(Form("%s_%s", ec.fsEventCuts[eCentralityEstimator].Data(), tc.fTaskName.Data()))); + // if the previous search failed, descend recursively also into the nested lists: + if (!hist) { + hist = reinterpret_cast(GetObjectFromList(listWithRuns, Form("%s_%s", ec.fsEventCuts[eCentralityEstimator].Data(), tc.fTaskName.Data()))); + } + if (!hist) { + hist = reinterpret_cast(GetObjectFromList(listWithRuns, Form("%s", ec.fsEventCuts[eCentralityEstimator].Data()))); // yes, for some simple tests I can have only histogram named e.g. 'CentFT0C' + } + if (!hist) { + listWithRuns->ls(); + LOGF(fatal, "\033[1;31m%s at line %d : \033[0m", __FUNCTION__, __LINE__); + } + hist->SetDirectory(0); + hist->SetTitle(Form("%s, %s", filePath, runNumber)); // I have to do it here, because only here I have "filePath" available + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + + return hist; + +} // TH1D* GetHistogramWithCentralityWeights(const char* filePath, const char* runNumber) + +//============================================================ + +TObjArray* GetDefaultObjArrayWithLabels(const char* whichDefaultLabels) +{ + // To speed up testing, I hardwire here some labels and use them directly as they are. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // Define TObjArray: + TObjArray* arr = new TObjArray(); + arr->SetOwner(); + + // Define some labels, depending on the chosen option for whichDefaultLabels: + if (TString(whichDefaultLabels).EqualTo("trivial")) { + const Int_t nLabels = 1; + TString labels[nLabels] = {"2 -2"}; + for (Int_t l = 0; l < nLabels; l++) { + TObjString* objstr = new TObjString(labels[l].Data()); + arr->Add(objstr); + } + } else if (TString(whichDefaultLabels).EqualTo("standard")) { + const Int_t nLabels = 7; + TString labels[nLabels] = {"1 -1", "2 -2", "3 -3", "2 1 -1 -2", "3 1 -1 -3", "3 2 -2 -3", "3 2 1 -1 -2 -3"}; + for (Int_t l = 0; l < nLabels; l++) { + TObjString* objstr = new TObjString(labels[l].Data()); + arr->Add(objstr); + } + } else if (TString(whichDefaultLabels).EqualTo("isotropic")) { + const Int_t nLabels = 8; + TString labels[nLabels] = {"1 -1", "2 -2", "3 -3", "4 -4", "1 1 -1 -1", "2 2 -2 -2", "3 3 -3 -3", "4 4 -4 -4"}; + for (Int_t l = 0; l < nLabels; l++) { + TObjString* objstr = new TObjString(labels[l].Data()); + arr->Add(objstr); + } + } else if (TString(whichDefaultLabels).EqualTo("upto8th")) { + const Int_t nLabels = 7; // yes, because I do not care about 1-p + TString labels[nLabels] = {"1 -1", "1 1 -1", "1 1 -1 -1", "1 1 -1 -1 -1", "1 1 1 -1 -1 -1", "1 1 1 1 -1 -1 -1", "1 1 1 1 -1 -1 -1 -1"}; + for (Int_t l = 0; l < nLabels; l++) { + TObjString* objstr = new TObjString(labels[l].Data()); + arr->Add(objstr); + } + } else if (TString(whichDefaultLabels).EqualTo("upto10th")) { + const Int_t nLabels = 9; // yes, because I do not care about 1-p + TString labels[nLabels] = {"1 -1", "1 1 -1", "1 1 -1 -1", "1 1 -1 -1 -1", "1 1 1 -1 -1 -1", "1 1 1 1 -1 -1 -1", "1 1 1 1 -1 -1 -1 -1", "1 1 1 1 -1 -1 -1 -1 -1", "1 1 1 1 1 -1 -1 -1 -1 -1"}; + for (Int_t l = 0; l < nLabels; l++) { + TObjString* objstr = new TObjString(labels[l].Data()); + arr->Add(objstr); + } + } else if (TString(whichDefaultLabels).EqualTo("upto12th")) { + const Int_t nLabels = 11; // yes, because I do not care about 1-p + TString labels[nLabels] = {"1 -1", "1 1 -1", "1 1 -1 -1", "1 1 -1 -1 -1", "1 1 1 -1 -1 -1", "1 1 1 1 -1 -1 -1", "1 1 1 1 -1 -1 -1 -1", "1 1 1 1 -1 -1 -1 -1 -1", "1 1 1 1 1 -1 -1 -1 -1 -1", "1 1 1 1 1 1 -1 -1 -1 -1 -1", "1 1 1 1 1 1 -1 -1 -1 -1 -1 -1"}; + for (Int_t l = 0; l < nLabels; l++) { + TObjString* objstr = new TObjString(labels[l].Data()); + arr->Add(objstr); + } + } else { + LOGF(fatal, "\033[1;31m%s at line %d : whichDefaultLabels = %s is not supported yet \033[0m", __FUNCTION__, __LINE__, whichDefaultLabels); + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + + return arr; + +} // TObjArray* GetDefaultObjArrayWithLabels(const char* whichDefaultLabels) + +//============================================================ + +TObjArray* GetObjArrayWithLabels(const char* filePath) +{ + // This function extracts from an external file TObjArray named "labels", and + // returns it. External file can be: + // 1) on a local computer; + // 2) in home directory AliEn => configurable "cfFileWithLabels" must begin with "/alice/cern.ch/" + // 3) in CCDB => configurable "cfFileWithLabels" must begin with "/alice-ccdb.cern.ch/" + // For all CCDB wisdom, see toggle "CCDB" in page "O2" + + // a) Return value; + // b) Determine from filePath if the file in on a local machine, or in AliEn; + // c) Handle the AliEn case; + // d) Handle the CCDB case; + // e) Handle the local case. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Return value: + TObjArray* oa = NULL; + + // b) Determine from filePath if the file in on a local machine, or in home + // dir AliEn, or in CCDB: + // Algorithm: If filePath begins with "/alice/cern.ch/" then it's in home + // dir AliEn. + // If filePath begins with "/alice-ccdb.cern.ch/" then it's in + // CCDB. Therefore, files in AliEn and CCDB must be specified + // with abs path, for local files both abs and relative paths + // are just fine. + Bool_t bFileIsInAliEn = kFALSE; + Bool_t bFileIsInCCDB = kFALSE; + if (TString(filePath).BeginsWith("/alice/cern.ch/")) { + bFileIsInAliEn = kTRUE; + } else { + if (TString(filePath).BeginsWith("/alice-ccdb.cern.ch/")) { + bFileIsInCCDB = kTRUE; + } // else { + } // if (TString(filePath).BeginsWith("/alice/cern.ch/")) { + + TFile* oaFile = NULL; // file holding TObjArray with all labels + if (bFileIsInAliEn) { + // c) Handle the AliEn case: + TGrid* alien = TGrid::Connect("alien", gSystem->Getenv("USER"), "", ""); + if (!alien) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + oaFile = TFile::Open(Form("alien://%s", filePath), "READ"); + if (!oaFile) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + + // Fetch TObjArray from external file (keep in sync with local file case below): + TList* lok = oaFile->GetListOfKeys(); + if (!lok) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + for (Int_t l = 0; l < lok->GetEntries(); l++) { + oaFile->GetObject(lok->At(l)->GetName(), oa); + if (oa && TString(oa->ClassName()).EqualTo("TObjArray")) { + break; // TBI 20231107 the working assumption is that in an external file there is only one TObjArray object, + // and here I fetch it, whatever its name is. The advantage is that I do not have to do + // any additional work for TObjArray's name. Since I do not anticipate ever having more than 1 + // TObjArray in an external file, this shall be alright. With the current implementation, + // if there are multiple TObjArray objects in the same ROOT file, the first one will be fetched. + } + } // for(Int_t l=0;lGetEntries();l++) + + if (!oa) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + } else if (bFileIsInCCDB) { + + // d) Handle the CCDB case: Remember that here I do not access the file, + // instead directly object in that file. + // My home dir in CCDB: https://alice-ccdb.cern.ch/browse/Users/a/abilandz/ + // Inspired by: + // 1. Discussion at: + // https://alice-talk.web.cern.ch/t/access-to-lhc-filling-scheme/1073/17 + // 2. See also: + // https://github.com/AliceO2Group/O2Physics/blob/master/Tutorials/src/efficiencyGlobal.cxx + // https://github.com/AliceO2Group/O2Physics/blob/master/Tutorials/src/efficiencyPerRun.cxx + // 3. O2 Analysis Tutorial 2.0: + // https://indico.cern.ch/event/1267433/timetable/#20230417.detailed + + ccdb->setURL("http://alice-ccdb.cern.ch"); + oa = reinterpret_cast(ccdb->get( + TString(filePath) + .ReplaceAll("/alice-ccdb.cern.ch/", "") + .Data())); + + if (!oa) { + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + } + } else { + + // e) Handle the local case: + // Check if the external ROOT file exists at specified path: if (gSystem->AccessPathName(filePath, kFileExists)) { LOGF(info, "\033[1;33m if(gSystem->AccessPathName(filePath,kFileExists)), filePath = %s \033[0m", filePath); LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); @@ -7110,6 +9276,7 @@ TObjArray* GetObjArrayWithLabels(const char* filePath) if (tc.fVerbose) { LOGF(info, "\033[1;32m%s => Fetched TObjArray named \"%s\" from file %s\033[0m", __FUNCTION__, oa->GetName(), filePath); + ExitFunction(__FUNCTION__); } return oa; @@ -7139,7 +9306,7 @@ void GetHistogramWithCustomNUA(const char* filePath, eNUAPDF variable) // g) The final touch. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); LOGF(info, "\033[1;32m filePath = %s\033[0m", filePath); LOGF(info, "\033[1;32m variable = %d\033[0m", static_cast(variable)); LOGF(info, "\033[1;32m nua.fCustomNUAPDFHistNames[variable]->Data() = %s\033[0m", nua.fCustomNUAPDFHistNames[variable]->Data()); @@ -7252,6 +9419,10 @@ void GetHistogramWithCustomNUA(const char* filePath, eNUAPDF variable) // TBI 20240501 if additional cosmetics is needed, it can be implemented here + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void GetHistogramWithCustomNUA(const char* filePath, eNUAPDF variable) //============================================================ @@ -7267,7 +9438,7 @@ void StoreLabelsInPlaceholder() // e) Insantity check on labels. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Initialize all counters; @@ -7277,7 +9448,12 @@ void StoreLabelsInPlaceholder() } // now it's safe :-) // b) Fetch TObjArray with labels from an external file: - TObjArray* oa = GetObjArrayWithLabels(t0.fFileWithLabels.Data()); + TObjArray* oa = NULL; + if (t0.fUseDefaultLabels) { + oa = GetDefaultObjArrayWithLabels(t0.fWhichDefaultLabels.Data()); + } else { + oa = GetObjArrayWithLabels(t0.fFileWithLabels.Data()); + } if (!oa) { LOGF(info, "\033[1;33m fFileWithLabels = %s \033[0m", t0.fFileWithLabels.Data()); @@ -7330,6 +9506,10 @@ void StoreLabelsInPlaceholder() delete temp; // yes, otherwise it's a memory leak } // for(Int_t b = 1; b <= t0.fTest0LabelsPlaceholder->GetXaxis()->GetNbins(); b++) { + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void StoreLabelsInPlaceholder() //============================================================ @@ -7340,7 +9520,7 @@ Bool_t RetrieveCorrelationsLabels() // from TH1I *t0.fTest0LabelsPlaceholder if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } Int_t counter[gMaxCorrelator] = {0}; // is this safe? @@ -7363,21 +9543,21 @@ Bool_t RetrieveCorrelationsLabels() continue; } // empty lines, or the label format which is not supported // 1-p => 0, 2-p => 1, etc.: - t0.fTest0Labels[order - 1][counter[order - 1]] = new TString( - t0.fTest0LabelsPlaceholder->GetXaxis()->GetBinLabel(b)); // okay... - // cout<<__LINE__<<": - // "<Data()<GetXaxis()->GetBinLabel(b)); // okay... counter[order - 1]++; } // for(Int_t b=1;b<=nBins;b++) + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + return kTRUE; } // Bool_t RetrieveCorrelationsLabels() //============================================================ -TObject* GetObjectFromList(TList* list, - const Char_t* objectName) // Last update: 20210918 +TObject* GetObjectFromList(TList* list, const Char_t* objectName) // Last update: 20210918 { // Get TObject pointer from TList, even if it's in some nested TList. Foreseen // to be used to fetch histograms or profiles from files directly. Some ideas @@ -7397,6 +9577,10 @@ TObject* GetObjectFromList(TList* list, // a) Check if I can make it working in compiled mode. // b) If I have objects with same name, nested in different TLists, what then? + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + // Insanity checks: if (!list) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); @@ -7427,6 +9611,10 @@ TObject* GetObjectFromList(TList* list, } } // while(objectIter = next()) + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + return NULL; } // TObject* GetObjectFromList(TList *list, Char_t *objectName) @@ -7438,7 +9626,7 @@ Double_t Weight(const Double_t& value, eWeights whichWeight) // value, integrate // Determine particle weight. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); LOGF(info, "\033[1;32m value = %f\033[0m", value); LOGF(info, "\033[1;32m variable = %d\033[0m", static_cast(whichWeight)); } @@ -7456,6 +9644,10 @@ Double_t Weight(const Double_t& value, eWeights whichWeight) // value, integrate weight = pw.fWeightsHist[whichWeight]->GetBinContent(bin); } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + return weight; } // Weight(const Double_t &value, eWeights whichWeight) // value, integrated [phi,pt,eta] weight @@ -7466,6 +9658,10 @@ Double_t DiffWeight(const Double_t& valueY, const Double_t& valueX, eqvectorKine { // Determine differential particle weight y(x). For the time being, "y = phi" always, but this can be generalized. + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + // *) Determine first to which bin the 'valueX' corresponds to. // Based on that, I decide from which histogram I fetch weight for y. See MakeWeights.C @@ -7482,10 +9678,10 @@ Double_t DiffWeight(const Double_t& valueY, const Double_t& valueX, eqvectorKine // *) Insanity checks on above settings: if (AFO_var == eAsFunctionOf_N) { - LOGF(fatal, "\033[1;31m%s at line %d : AFO_var == eAsFunctionOf_N => add some more entries to the case stamenent \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : AFO_var == eAsFunctionOf_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); } if (AFO_diffWeight == eDiffWeights_N) { - LOGF(fatal, "\033[1;31m%s at line %d : AFO_diffWeight == eDiffWeights_N => add some more entries to the case stamenent \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : AFO_diffWeight == eDiffWeights_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); } // *) Determine first to which bin the 'valueX' corresponds to. @@ -7534,6 +9730,10 @@ Double_t DiffWeight(const Double_t& valueY, const Double_t& valueX, eqvectorKine } } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + return diffWeight; } // DiffWeight(const Double_t &valueY, const Double_t &valueX, eqvectorKine variableX) @@ -7553,7 +9753,7 @@ void GetParticleWeights() // b) Differential weights. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Integrated weights: @@ -7643,16 +9843,53 @@ void GetParticleWeights() } // for(Int_t b=0; bGetBinContent(1) == static_cast(iv.fnEventsInternalValidation)) { + if (eh.fEventHistograms[eNumberOfEvents][eSim][eAfter] && (eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]->GetBinContent(1) == ec.fdEventCuts[eNumberOfEvents][eMax] || eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]->GetBinContent(1) == ec.fdEventCuts[eSelectedEvents][eMax])) { return kTRUE; } else { return kFALSE; @@ -7695,6 +9932,9 @@ Bool_t MaxNumberOfEvents(eBeforeAfter ba) } // *) Hasta la vista: + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } return reachedMaxNumberOfEvents; } // void MaxNumberOfEvents(eBeforeAfter ba) @@ -7704,27 +9944,26 @@ Bool_t MaxNumberOfEvents(eBeforeAfter ba) void PrintEventCounter(eBeforeAfter ba) { // Print how many events were processed by now. + // Remark: If I am processing RecSim, the counter is corresponding to Rec. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // *) Print or die: switch (ba) { case eBefore: - if (eh.fEventHistograms[eNumberOfEvents][eRec][eBefore]) { - LOGF(info, "\033[1;32m%s : processing event %d\033[0m", __FUNCTION__, static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eBefore]->GetBinContent(1))); - } else if (eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]) { - LOGF(info, "\033[1;32m%s : processing event %d\033[0m", __FUNCTION__, static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]->GetBinContent(1))); + if (!tc.fPlainPrintout) { + LOGF(info, "\033[1;32m%s : processing event %d ....\033[0m", __FUNCTION__, eh.fEventCounter[eTotal]); + } else { + LOGF(info, "%s : processing event %d ....", __FUNCTION__, eh.fEventCounter[eTotal]); } break; case eAfter: - if (tc.fVerbose) { - if (eh.fEventHistograms[eNumberOfEvents][eRec][eBefore]) { - LOGF(info, "\033[1;32m%s : this event passed all cuts %d/%d\033[0m", __FUNCTION__, static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]->GetBinContent(1)), static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eBefore]->GetBinContent(1))); - } else if (eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]) { - LOGF(info, "\033[1;32m%s : this event passed all cuts %d/%d\033[0m", __FUNCTION__, static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]->GetBinContent(1)), static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]->GetBinContent(1))); - } + if (!tc.fPlainPrintout) { + LOGF(info, "\033[1;32m%s : event passed all cuts %d/%d\033[0m", __FUNCTION__, eh.fEventCounter[eProcessed], eh.fEventCounter[eTotal]); + } else { + LOGF(info, "%s : event passed all cuts %d/%d", __FUNCTION__, eh.fEventCounter[eProcessed], eh.fEventCounter[eTotal]); } break; default: @@ -7732,22 +9971,26 @@ void PrintEventCounter(eBeforeAfter ba) break; } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void PrintEventCounter(eBeforeAfter ba) //============================================================ -void EventCounter(eEventCounter eVar) +void EventCounterForDryRun(eEventCounterForDryRun eVar) { // Simple utility function which either fills histogram with event count, or prints its current content. // Remark: Use only in combination with tc.fDryRun = kTRUE, otherwise I might be filling the same histogram in different member functions, there is a protection below. // It fills or prints per call, therefore I do not have to pass 'collision' objects, etc. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } if (!tc.fDryRun) { - LOGF(fatal, "\033[1;31m%s at line %d : for the time being, function EventCounter(...) can be safely used only for tc.fDryRun = kTRUE \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : for the time being, function EventCounterForDryRun(...) can be safely used only for tc.fDryRun = kTRUE \033[0m", __FUNCTION__, __LINE__); } switch (eVar) { @@ -7758,10 +10001,10 @@ void EventCounter(eEventCounter eVar) break; case ePrint: // Print current status of event counter: - // Remark: if I am processign RecSim, the counter is corresponding to Rec. + // Remark: if I am processing RecSim, the counter is corresponding to Rec. if (eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]) { LOGF(info, "Processing event %d (dry run) ....", static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]->GetBinContent(1))); - } else if (eh.fEventHistograms[eNumberOfEvents][eRec][eBefore] && eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]) { + } else if (eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]) { LOGF(info, "Processing event %d (dry run) ....", static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]->GetBinContent(1))); } break; @@ -7770,7 +10013,11 @@ void EventCounter(eEventCounter eVar) break; } // switch(eVar) -} // void EventCounter() + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void EventCounterForDryRun(eEventCounterForDryRun eVar) //============================================================ @@ -7783,19 +10030,20 @@ const char* FancyFormatting(const char* name) // 2. add additional information to defalt name (e.g. "Centrality" => "Centrality (V0M)" // 3. ... - if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + if (tc.fVerboseUtility) { + StartFunction(__FUNCTION__); + LOGF(info, "\033[1;32m const char* name = %s\033[0m", name); } // By default, do nothing and return the same thing: const char* fancyFormatting = name; // Special cases supported by now: - if (TString(name).EqualTo("Phi")) { + if (TString(name).EqualTo("Phi", TString::kIgnoreCase)) { fancyFormatting = "#varphi"; - } else if (TString(name).EqualTo("Pt")) { + } else if (TString(name).EqualTo("Pt", TString::kIgnoreCase)) { fancyFormatting = "p_{T}"; - } else if (TString(name).EqualTo("Eta")) { + } else if (TString(name).EqualTo("Eta", TString::kIgnoreCase)) { fancyFormatting = "#eta"; } else if (TString(name).EqualTo("Vertex_x")) { fancyFormatting = "V_{x}"; @@ -7803,15 +10051,37 @@ const char* FancyFormatting(const char* name) fancyFormatting = "V_{y}"; } else if (TString(name).EqualTo("Vertex_z")) { fancyFormatting = "V_{z}"; - } else if (TString(name).EqualTo("Centrality")) { + } else if (TString(name).EqualTo("TotalMultiplicity")) { + fancyFormatting = "TotalMultiplicity (tracks.size())"; + } else if (TString(name).EqualTo("Multiplicity", TString::kIgnoreCase)) { + fancyFormatting = Form("Multiplicity (%s)", ec.fsEventCuts[eMultiplicityEstimator].Data()); + } else if (TString(name).EqualTo("ReferenceMultiplicity")) { + fancyFormatting = Form("ReferenceMultiplicity (%s)", ec.fsEventCuts[eReferenceMultiplicityEstimator].Data()); + } else if (TString(name).EqualTo("Centrality", TString::kIgnoreCase)) { TString tmp = ec.fsEventCuts[eCentralityEstimator]; // I have to introduce local TString tmp, because ReplaceAll replaces in-place if (tmp.BeginsWith("CentRun2")) { - fancyFormatting = Form("Centrality (%s)", tmp.ReplaceAll("CentRun2", "").Data()); + fancyFormatting = Form("Centrality (%s)", tmp.ReplaceAll("CentRun2", "").Data()); // "CentRun2V0M" => "Centrality (V0M)" } else if (tmp.BeginsWith("Cent")) { - fancyFormatting = Form("Centrality (%s)", tmp.ReplaceAll("Cent", "").Data()); + fancyFormatting = Form("Centrality (%s)", tmp.ReplaceAll("Cent", "").Data()); // "CentFT0C" => "Centrality (FT0C)" + } else { + LOGF(fatal, "\033[1;31m%s at line %d : the case tmp = %s is not supported yet\033[0m", __FUNCTION__, __LINE__, tmp.Data()); } } else if (TString(name).EqualTo("Trigger")) { fancyFormatting = Form("Trigger (%s)", ec.fsEventCuts[eTrigger].Data()); + } else if (TString(name).EqualTo("TrackOccupancyInTimeRange")) { + fancyFormatting = "trackOccupancyInTimeRange()"; + } else if (TString(name).EqualTo("FT0COccupancyInTimeRange")) { + fancyFormatting = "ft0cOccupancyInTimeRange()"; + } else if (TString(name).EqualTo("Occupancy", TString::kIgnoreCase)) { + fancyFormatting = Form("Occupancy (%s)", ec.fsEventCuts[eOccupancyEstimator].Data()); + } else if (TString(name).EqualTo("InteractionRate", TString::kIgnoreCase) || TString(name).EqualTo("Interaction Rate", TString::kIgnoreCase)) { + fancyFormatting = "Interaction Rate [kHz]"; // TBI 20241127 do I leave kHz hardwired here? + } else if (TString(name).EqualTo("CurrentRunDuration", TString::kIgnoreCase) || TString(name).EqualTo("Current Run Duration", TString::kIgnoreCase)) { + fancyFormatting = "Current run duration [s] (i.e. time in seconds since start of run)"; + } + + if (tc.fVerboseUtility) { + ExitFunction(__FUNCTION__); } return fancyFormatting; @@ -7830,7 +10100,7 @@ Double_t CalculateCustomNestedLoops(TArrayI* harmonics) // c) Return value. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } if (!harmonics) { @@ -8025,6 +10295,9 @@ Double_t CalculateCustomNestedLoops(TArrayI* harmonics) Double_t finalValue = profile->GetBinContent(1); delete profile; profile = NULL; + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } return finalValue; } // Double_t CalculateCustomNestedLoops(TArrayI *harmonics) @@ -8041,7 +10314,7 @@ Double_t CalculateKineCustomNestedLoops(TArrayI* harmonics, eAsFunctionOf AFO_va // c) Return value. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } if (!harmonics) { @@ -8050,12 +10323,15 @@ Double_t CalculateKineCustomNestedLoops(TArrayI* harmonics, eAsFunctionOf AFO_va // *) ... eqvectorKine qvKine = eqvectorKine_N; // which component of q-vector + TString kineVarName = ""; switch (AFO_variable) { case AFO_PT: qvKine = PTq; + kineVarName = "pt"; break; case AFO_ETA: qvKine = ETAq; + kineVarName = "eta"; break; default: LOGF(fatal, "\033[1;31m%s at line %d : This AFO_variable = %d is not supported yet. \033[0m", __FUNCTION__, __LINE__, static_cast(AFO_variable)); @@ -8064,7 +10340,7 @@ Double_t CalculateKineCustomNestedLoops(TArrayI* harmonics, eAsFunctionOf AFO_va // *) Insanity checks on above settings: if (qvKine == eqvectorKine_N) { - LOGF(fatal, "\033[1;31m%s at line %d : qvKine == eqvectorKine_N => add some more entries to the case stamenent \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : qvKine == eqvectorKine_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); } if (0 > bin || res.fResultsPro[AFO_variable]->GetNbinsX() < bin) { // this 'bin' starts from 0, i.e. this is an array bin @@ -8081,15 +10357,17 @@ Double_t CalculateKineCustomNestedLoops(TArrayI* harmonics, eAsFunctionOf AFO_va } // 'qvKine' is enum eqvectorKine: - LOGF(info, " %s: nParticles = %d, bin range = [%f,%f)", static_cast(qvKine), nParticles, res.fResultsPro[AFO_variable]->GetBinLowEdge(bin + 1), res.fResultsPro[AFO_variable]->GetBinLowEdge(bin + 2)); + if (!res.fResultsPro[AFO_variable]) { + LOGF(fatal, "\033[1;31m%s at line %d : AFO_variable = %d, bin = %d \033[0m", __FUNCTION__, __LINE__, static_cast(AFO_variable), bin); + } + + LOGF(info, " Processing qvKine = %d (vs. %s), nParticles in this kine bin = %d, bin range = [%f,%f) ....", static_cast(qvKine), kineVarName.Data(), nParticles, res.fResultsPro[AFO_variable]->GetBinLowEdge(bin + 1), res.fResultsPro[AFO_variable]->GetBinLowEdge(bin + 2)); // a) Determine the order of correlator; Int_t order = harmonics->GetSize(); if (0 == order || order > gMaxCorrelator) { - cout << __LINE__ << endl; - exit(1); + LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - if (order > nParticles) { LOGF(info, " There is no enough particles in this bin to calculate the requested correlator"); return 0.; // TBI 20240405 Is this really safe here? Re-think... @@ -8265,14 +10543,130 @@ Double_t CalculateKineCustomNestedLoops(TArrayI* harmonics, eAsFunctionOf AFO_va Double_t finalValue = profile->GetBinContent(1); delete profile; profile = NULL; + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } return finalValue; } // Double_t CalculateKineCustomNestedLoops(TArrayI *harmonics, eAsFunctionOf AFO_variable, Int_t bin) //============================================================ -template -void DetermineCentrality(T const& collision) +void DetermineMultiplicity() +{ + // Determine multiplicity for "vs. mult" results. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + if (ec.fsEventCuts[eMultiplicityEstimator].EqualTo("SelectedTracks", TString::kIgnoreCase)) { + ebye.fMultiplicity = static_cast(ebye.fSelectedTracks); + } else if (ec.fsEventCuts[eMultiplicityEstimator].EqualTo("ReferenceMultiplicity", TString::kIgnoreCase)) { + ebye.fMultiplicity = ebye.fReferenceMultiplicity; + } else { + LOGF(fatal, "\033[1;31m%s at line %d : multiplicity estimator = %s is not supported yet. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eMultiplicityEstimator].Data()); + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void DetermineMultiplicity() + +//============================================================ + +template +void DetermineReferenceMultiplicity(T const& collision) +{ + // Determine collision reference multiplicity. + + // a) Determine reference multiplicity for real Run 3 data; + // b) Determine reference multiplicity for simulated Run 3 data; + // c) Same as a), just for converted Run 2 and Run 1 data; + // d) Same as b), just for converted Run 2 and Run 1 data; + // e) Test case; + // f) Print reference multiplicity for the audience... + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Determine reference multiplicity for real Run 3 data: + if constexpr (rs == eRec || rs == eRecAndSim) { + // Local convention for name of reference multiplicity estimator: use the same name as the getter, case insensitive. + if (ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("multTPC", TString::kIgnoreCase)) { + ebye.fReferenceMultiplicity = collision.multTPC(); + } else if (ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("multFV0M", TString::kIgnoreCase)) { + ebye.fReferenceMultiplicity = collision.multFV0M(); + } else if (ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("multFT0C", TString::kIgnoreCase)) { + ebye.fReferenceMultiplicity = collision.multFT0C(); + } else if (ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("multFT0M", TString::kIgnoreCase)) { + ebye.fReferenceMultiplicity = collision.multFT0M(); + } else if (ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("multNTracksPV", TString::kIgnoreCase)) { + ebye.fReferenceMultiplicity = collision.multNTracksPV(); + } else if (ec.fsEventCuts[eReferenceMultiplicityEstimator].EqualTo("multNTracksGlobal", TString::kIgnoreCase)) { + // ebye.fReferenceMultiplicity = collision.multNTracksGlobal(); // TBI 20241209 not validated yet + } else { + LOGF(fatal, "\033[1;31m%s at line %d : reference multiplicity estimator = %d is not supported yet for Run 3. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eReferenceMultiplicityEstimator].Data()); + } + // QA: + if (qa.fFillQAEventHistograms2D) { // TBI 20240515 this flag is too general here, I need to make it more specific + qa.fReferenceMultiplicity[eMultTPC] = collision.multTPC(); + qa.fReferenceMultiplicity[eMultFV0M] = collision.multFV0M(); + qa.fReferenceMultiplicity[eMultFT0C] = collision.multFT0C(); + qa.fReferenceMultiplicity[eMultFT0M] = collision.multFT0M(); + qa.fReferenceMultiplicity[eMultNTracksPV] = collision.multNTracksPV(); + // qa.fReferenceMultiplicity[eMultNTracksGlobal] = collision.multNTracksGlobal(); // TBI 20241209 not validated yet + } + + // TBI 20241123 check if corresponding simulated ref. mult. is available through collision.has_mcCollision() + // ... + } + + // b) Determine reference multiplicity for simulated Run 3 data: + if constexpr (rs == eSim) { + ebye.fReferenceMultiplicity = -44.; // TBI 20241123 check what to use here and add support eventualy + } + + // c) Same as a), just for converted Run 2 and Run 1 data: + if constexpr (rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { + if (ec.fsEventCuts[eReferenceMultiplicity].EqualTo("multTracklets", TString::kIgnoreCase)) { + ebye.fReferenceMultiplicity = collision.multTracklets(); + } else { + LOGF(fatal, "\033[1;31m%s at line %d : reference multiplicity estimator = %d is not supported yet for Run 2. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eReferenceMultiplicityEstimator].Data()); + } + // QA: + if (qa.fFillQAEventHistograms2D) { // TBI 20240515 this flag is too general here, I need to make it more specific + // ... + } + + // TBI 20241123 check if corresponding simulated ref. mult. is available through collision.has_mcCollision() + // ... + } + + // d) Same as b), just for converted Run 2 and Run 1 data: + if constexpr (rs == eSim_Run2 || rs == eSim_Run1) { + ebye.fReferenceMultiplicity = -44.; // TBI 20241123 check what to use here and add support eventualy + } + + // e) Test case: + if constexpr (rs == eTest) { + ebye.fReferenceMultiplicity = static_cast(gRandom->Uniform(0., 5000.)); // TBI 20241123 I could implement here a getter, if there is one available both for Run 3 and Run 2/1 + } + + // f) Print centrality for the audience...: + if (tc.fVerbose) { + LOGF(info, "\033[1;32m ebye.fReferenceMultiplicity = %f\033[0m", ebye.fReferenceMultiplicity); + ExitFunction(__FUNCTION__); + } + +} // template void DetermineReferenceMultiplicity(T const& collision) + +//============================================================ + +template +void DetermineCentrality(T const& collision) { // Determine collision centrality. @@ -8282,25 +10676,30 @@ void DetermineCentrality(T const& collision) // d) Same as b), just for converted Run 2 data; // e) Same as a), just for converted Run 1 data; // f) Same as b), just for converted Run 1 data; - // g) Test case. + // g) Test case; + // h) Print centrality for the audience... if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // just a bare function name + StartFunction(__FUNCTION__); } // a) For real data, determine centrality from default centrality estimator: if constexpr (rs == eRec || rs == eRecAndSim) { - if (ec.fsEventCuts[eCentralityEstimator].EqualTo("centFT0M", TString::kIgnoreCase)) { + // Local convention for name of centrality estimator: use the same name as the getter, case insensitive. + if (ec.fsEventCuts[eCentralityEstimator].EqualTo("centFT0C", TString::kIgnoreCase)) { + ebye.fCentrality = collision.centFT0C(); + } else if (ec.fsEventCuts[eCentralityEstimator].EqualTo("centFT0M", TString::kIgnoreCase)) { ebye.fCentrality = collision.centFT0M(); - } else if (ec.fsEventCuts[eCentralityEstimator].EqualTo("CentFV0A", TString::kIgnoreCase)) { + } else if (ec.fsEventCuts[eCentralityEstimator].EqualTo("centFV0A", TString::kIgnoreCase)) { ebye.fCentrality = collision.centFV0A(); - } else if (ec.fsEventCuts[eCentralityEstimator].EqualTo("CentNTPV", TString::kIgnoreCase)) { + } else if (ec.fsEventCuts[eCentralityEstimator].EqualTo("centNTPV", TString::kIgnoreCase)) { ebye.fCentrality = collision.centNTPV(); } else { LOGF(fatal, "\033[1;31m%s at line %d : centrality estimator = %d is not supported yet. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eCentralityEstimator].Data()); } // QA: if (qa.fFillQAEventHistograms2D) { // TBI 20240515 this flag is too general here, I need to make it more specific + qa.fCentrality[eCentFT0C] = collision.centFT0C(); qa.fCentrality[eCentFT0M] = collision.centFT0M(); qa.fCentrality[eCentFV0A] = collision.centFV0A(); qa.fCentrality[eCentNTPV] = collision.centNTPV(); @@ -8316,7 +10715,6 @@ void DetermineCentrality(T const& collision) // c) Same as a), just for converted Run 2 data: if constexpr (rs == eRec_Run2 || rs == eRecAndSim_Run2) { - // Local convention for name of centrality estimator: use the same name as the getter, case insensitive. if (ec.fsEventCuts[eCentralityEstimator].EqualTo("centRun2V0M", TString::kIgnoreCase)) { ebye.fCentrality = collision.centRun2V0M(); } else if (ec.fsEventCuts[eCentralityEstimator].EqualTo("centRun2SPDTracklets", TString::kIgnoreCase)) { @@ -8357,24 +10755,147 @@ void DetermineCentrality(T const& collision) // g) Test case: if constexpr (rs == eTest) { - ebye.fCentrality = gRandom->Uniform(0., 100.); + ebye.fCentrality = static_cast(gRandom->Uniform(0., 100.)); } - // *) Print centrality for the audience...: + // h) Print centrality for the audience...: if (tc.fVerbose) { LOGF(info, "\033[1;32m ebye.fCentrality = %f\033[0m", ebye.fCentrality); + ExitFunction(__FUNCTION__); } } // template void DetermineCentrality(T const& collision) //============================================================ +template +void DetermineOccupancy(T const& collision) +{ + // Determine collision occupancy. + + // a) Determine occupancy from default occupancy estimator, only for eRec and eRecAndSim; + // b) For all other cases, set occupancy to -1 (not defined). + // c) Print occupancy for the audience... + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Determine occupancy from default occupancy estimator, only for eRec and eRecAndSim: + if constexpr (rs == eRec || rs == eRecAndSim) { + if (ec.fsEventCuts[eOccupancyEstimator].EqualTo("TrackOccupancyInTimeRange", TString::kIgnoreCase)) { + ebye.fOccupancy = collision.trackOccupancyInTimeRange(); + } else if (ec.fsEventCuts[eOccupancyEstimator].EqualTo("FT0COccupancyInTimeRange", TString::kIgnoreCase)) { + ebye.fOccupancy = collision.ft0cOccupancyInTimeRange(); + } else { + LOGF(fatal, "\033[1;31m%s at line %d : occupancy estimator = %d is not supported yet. \033[0m", __FUNCTION__, __LINE__, ec.fsEventCuts[eOccupancyEstimator].Data()); + } + // QA: + if (qa.fFillQAEventHistograms2D) { // TBI 20240515 this flag is too general here, I need to make it more specific + qa.fOccupancy[eTrackOccupancyInTimeRange] = collision.trackOccupancyInTimeRange(); + qa.fOccupancy[eFT0COccupancyInTimeRange] = collision.ft0cOccupancyInTimeRange(); + } + } else { + // b) For all other cases, set occupancy to -1 (not defined): + ebye.fOccupancy = -1.; + // QA: + if (qa.fFillQAEventHistograms2D) { // TBI 20240515 this flag is too general here, I need to make it more specific + for (Int_t oe = 0; oe < eOccupancyEstimators_N; oe++) { + qa.fOccupancy[oe] = -1.; + } + } + } + + // c) Print occupancy for the audience...: + if (tc.fVerbose) { + LOGF(info, "\033[1;32m ebye.fOccupancy = %f\033[0m", ebye.fOccupancy); + ExitFunction(__FUNCTION__); + } + +} // template void DetermineOccupancy(T const& collision) + +//============================================================ + +template +void DetermineInteractionRate(T1 const& collision, T2 const&) +{ + // Determine interaction rate. + + // a) Determine interaction rate only for eRec; + // b) For all other cases, set interaction rate to -1 for the time being; + // c) Print interaction rate and run duration for the audience... + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Determine interaction rate only for eRec: + if constexpr (rs == eRec) { + auto bc = collision.template foundBC_as(); // I have the same code snippet at other places, keep in sync. + double hadronicRate = mRateFetcher.fetch(ccdb.service, static_cast(bc.timestamp()), static_cast(bc.runNumber()), "ZNC hadronic") * 1.e-3; + if (hadronicRate > 0.) { + ebye.fInteractionRate = static_cast(hadronicRate); + } else { + LOGF(fatal, "\033[1;31m%s at line %d : hadronicRate = %f is meaningless \033[0m", __FUNCTION__, __LINE__, hadronicRate); + } + + // If I fill 2D QA histogram eCurrentRunDuration_vs_InteractionRate , extract still the current run duration: + if (qa.fBookQAEventHistograms2D[eCurrentRunDuration_vs_InteractionRate]) { // TBI 20241127 do I check this flag, or pointer, like in FillEventHistograms(...) ? + ebye.fCurrentRunDuration = std::floor(bc.timestamp() * 0.001) - tc.fRunTime[eStartOfRun]; + if (ebye.fCurrentRunDuration > tc.fRunTime[eDurationInSec]) { + LOGF(fatal, "\033[1;31m%s at line %d : ebye.fCurrentRunDuration = %d is bigger than tc.fRunTime[eDurationInSec] = %d, which is meaningless \033[0m", __FUNCTION__, __LINE__, static_cast(ebye.fCurrentRunDuration), static_cast(tc.fRunTime[eDurationInSec])); + } + } + } else { + ebye.fInteractionRate = -1.; + ebye.fCurrentRunDuration = -1.; + } + + // c) Print interaction rate and run duration for the audience...: + if (tc.fVerbose) { + LOGF(info, "\033[1;32m ebye.fInteractionRate = %f kHz\033[0m", ebye.fInteractionRate); + if (qa.fBookQAEventHistograms2D[eCurrentRunDuration_vs_InteractionRate]) { // TBI 20241127 do I check this flag, or pointer, like in FillEventHistograms(...) ? + LOGF(info, "\033[1;32m ebye.fCurrentRunDuration = %f s (in seconds after SOR)\033[0m", ebye.fCurrentRunDuration); + } + ExitFunction(__FUNCTION__); + } + +} // template void DetermineInteractionRate(T1 const& collision, T2 const& bcs) + +//============================================================ + +void DetermineEventCounters() +{ + // Determine all event counters. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // Remark: For "RecSim", the total number of events is taken from eRec. + if (eh.fEventHistograms[eNumberOfEvents][eRec][eBefore] && eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]) { + eh.fEventCounter[eTotal] = static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eBefore]->GetBinContent(1)); + eh.fEventCounter[eProcessed] = static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]->GetBinContent(1)); + } else if (eh.fEventHistograms[eNumberOfEvents][eSim][eBefore] && eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]) { + // Remark: This branch covers automatically also internal validation, because I book and fill there only eSim. + eh.fEventCounter[eTotal] = static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]->GetBinContent(1)); + eh.fEventCounter[eProcessed] = static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]->GetBinContent(1)); + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void DetermineEventCounters() + +//============================================================ + void RandomIndices(Int_t nTracks) { // Randomize indices using Fisher-Yates algorithm. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } if (nTracks < 1) { @@ -8394,6 +10915,10 @@ void RandomIndices(Int_t nTracks) tc.fRandomIndices->AddAt(temp, i); } // end of for(Int_t i=nTracks-1;i>=1;i--) + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void RandomIndices(Int_t nTracks) //============================================================ @@ -8401,7 +10926,7 @@ void RandomIndices(Int_t nTracks) template void BanishmentLoopOverParticles(T const& tracks) { - // This is the quick banishment loop over particles, as a support for eSelectedTracks cut. + // This is the quick banishment loop over particles, as a support for eSelectedTracks cut (used through eMultiplicity, see comments for ebye.fMultiplicity). // This is particularly relevant to get all efficiency corrections right. // The underlying problem is that particle histograms got filled before eSelectedTracks could be applied in Steer. // Therefore, particle histograms got filled even for events which were rejected by eSelectedTracks cut. @@ -8413,7 +10938,7 @@ void BanishmentLoopOverParticles(T const& tracks) // at the end with central data member ebye.fSelectedTracks if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // *) If random access of tracks from collection is requested, use Fisher-Yates algorithm to generate random indices: @@ -8425,7 +10950,7 @@ void BanishmentLoopOverParticles(T const& tracks) } // *) Counter of selected tracks in the current event: - Int_t lSelectedTracks = 0; // I could reset and reuse here ebye.fSelectedTracks, but it's safer to use separate local variable, as I can did additional insanity checks here + Int_t lSelectedTracks = 0; // I could reset and reuse here ebye.fSelectedTracks, but it's safer to use separate local variable, as I can do additional insanity checks here // *) Banishment loop over particles: // for (auto& track : tracks) { // default standard way of looping of tracks @@ -8436,7 +10961,7 @@ void BanishmentLoopOverParticles(T const& tracks) if (!tc.fUseFisherYates) { track = tracks.iteratorAt(i); } else { - track = tracks.iteratorAt((int64_t)tc.fRandomIndices->GetAt(i)); + track = tracks.iteratorAt(static_cast(tc.fRandomIndices->GetAt(i))); } // *) Skip track objects which are not valid tracks (e.g. Run 2 and 1 tracklets, etc.): @@ -8453,21 +10978,24 @@ void BanishmentLoopOverParticles(T const& tracks) // } // *) Particle cuts: - if (!ParticleCuts(track, eCut)) { // Main call for event cuts. + if (!ParticleCuts(track, eCut)) { // Main call for particle cuts. continue; // not return!! } - // *) Increase the local selected particle counter: - lSelectedTracks++; - // *) Banish particle histograms after particle cuts: if (ph.fFillParticleHistograms || ph.fFillParticleHistograms2D || qa.fFillQAParticleHistograms2D) { FillParticleHistograms(track, eAfter, -1); // with negative weight -1, I effectively remove the previous fill for this track } + // *) Increase the local selected particle counter: + lSelectedTracks++; + if (lSelectedTracks >= ec.fdEventCuts[eMultiplicity][eMax]) { + break; + } + // *) Break the loop if fixed number of particles is taken randomly from each event (use always in combination with tc.fUseFisherYates = kTRUE): if (tc.fFixedNumberOfRandomlySelectedTracks > 0 && tc.fFixedNumberOfRandomlySelectedTracks == lSelectedTracks) { - LOGF(info, "%s Breaking the loop over particles, since requested fixed number of %d particles was reached", __FUNCTION__, tc.fFixedNumberOfRandomlySelectedTracks); + LOGF(info, "%s : Breaking the loop over particles, since requested fixed number of %d particles was reached", __FUNCTION__, tc.fFixedNumberOfRandomlySelectedTracks); break; } @@ -8478,6 +11006,10 @@ void BanishmentLoopOverParticles(T const& tracks) LOGF(fatal, "\033[1;31m%s at line %d : lSelectedTracks != ebye.fSelectedTracks , lSelectedTracks = %d, ebye.fSelectedTracks = %d \033[0m", __FUNCTION__, __LINE__, lSelectedTracks, ebye.fSelectedTracks); } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // template void BanishmentLoopOverParticles(T const& tracks) { //============================================================ @@ -8490,7 +11022,7 @@ void PrintCutCounterContent() // b) Print or die. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Insanity checks: @@ -8516,6 +11048,10 @@ void PrintCutCounterContent() } // for (Int_t cc = 0; cc < eCutCounter_N; cc++) // enum eCutCounter } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void PrintCutCounterContent() //============================================================ @@ -8531,18 +11067,67 @@ void Trace(const char* functionName, Int_t lineNumber) //============================================================ -void BailOut() +void Exit() +{ + // A simple utility wrapper. Used only during debugging. + // Use directly as: Exit(); + // Line number, function name, formatting, etc, are determinad automatically. + + LOGF(info, "\n\n\n\n\n\n\n\n\n\n"); + exit(1); + +} // void Exit() + +//============================================================ + +void StartFunction(const char* functionName) +{ + // A simple utility wrapper, used when tc.fVerbose = kTRUE. It merely ensures uniform formatting of notification when the function starts. + + LOGF(info, "\033[1;32mStart %s\033[0m", functionName); // prints in green + +} // void StartFunction(const char* functionName) + +//============================================================ + +void ExitFunction(const char* functionName) +{ + // A simple utility wrapper, used when tc.fVerbose = kTRUE. It merely ensures uniform formatting of notification when the function exits. + + LOGF(info, "\033[1;32mExit %s\033[0m", functionName); // prints in green + +} // void ExitFunction(const char* functionName) + +//============================================================ + +void BailOut(Bool_t finalBailout = kFALSE) { // Use only locally - bail out if maximum number of events was reached, and dump all results by that point in a local ROOT file. + // If fSequentialBailout > 0, bail out is performed each fSequentialBailout events, each time in a new local ROOT file. + // For sequential bailout, the naming scheme of ROOT files is AnalysisResultsBailOut_eh.fEventCounter[eProcessed].root . + // If ROOT file with the same name already exists, BailOut is not performed, since the argument is that + // it's pointless to perform Bailout for same eh.fEventCounter[eProcessed], even if eh.fEventCounter[eTotal] changed. + // Only if finalBailout = kTRUE, I will overwrite the existing file with the same name. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // *) Local variables: TBI 20240130 shall I promote 'em to data members + add support for configurables? TString sBailOutFile = "AnalysisResultsBailOut.root"; TString sDirectoryFile = "multiparticle-correlations-a-b"; + // *) For sequential bailout, I need to adapt the ROOT file name each time this function is called: + if (tc.fSequentialBailout > 0) { + sBailOutFile.ReplaceAll(".root", Form("_%d.root", eh.fEventCounter[eProcessed])); // replaces in-place + // basically, at 1st call "AnalysisResultsBailOut.root" => "AnalysisResultsBailOut_1*eh.fEventCounter[eProcessed].root", + // at 2nd call "AnalysisResultsBailOut.root" => "AnalysisResultsBailOut_2*eh.fEventCounter[eProcessed].root", etc. + if (!finalBailout && !gSystem->AccessPathName(sBailOutFile.Data(), kFileExists)) { // only for finalBailout = kTRUE, I will overwrite the existing file with the same name. + LOGF(info, "\033[1;33m\nsBailOutFile = %s already exits, that means that eh.fEventCounter[eProcessed] is the same as in the previous call of BailOut.\nJust skipping and waiting more events to pass selection criteria... \033[0m", sBailOutFile.Data()); + return; + } + } + // *) Info message: if (eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]) { LOGF(info, "\033[1;32m=> Per request, bailing out after %d selected events in the local file %s .\n\033[0m", static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]->GetBinContent(1)), sBailOutFile.Data()); @@ -8551,11 +11136,11 @@ void BailOut() // *) Okay, let's bail out intentionally: TFile* f = new TFile(sBailOutFile.Data(), "recreate"); TDirectoryFile* dirFile = new TDirectoryFile(sDirectoryFile.Data(), sDirectoryFile.Data()); - // TBI 20240130 I cannot add here fBaseList directtly, since that one is declared as OutputObj + // TBI 20240130 I cannot add here fBaseList directly, since that one is declared as OutputObj // Therefore, adding one-by-one nested TList's I want to bail out. // Keep in sync with BookAndNestAllLists(). TList* bailOutList = new TList(); // this is sort of 'fake' fBaseList - bailOutList->SetOwner(kTRUE); + bailOutList->SetOwner(kFALSE); // yes, beacause for sequential bailout, with SetOwner(kTRUE) the code is crashing after 1st sequential bailout is done bailOutList->SetName(sBaseListName.Data()); bailOutList->Add(fBasePro); // yes, this one needs a special treatment bailOutList->Add(qa.fQAList); @@ -8566,10 +11151,12 @@ void BailOut() bailOutList->Add(qv.fQvectorList); bailOutList->Add(mupa.fCorrelationsList); bailOutList->Add(pw.fWeightsList); + bailOutList->Add(cw.fCentralityWeightsList); bailOutList->Add(nl.fNestedLoopsList); bailOutList->Add(nua.fNUAList); bailOutList->Add(iv.fInternalValidationList); bailOutList->Add(t0.fTest0List); + bailOutList->Add(es.fEtaSeparationsList); bailOutList->Add(res.fResultsList); // *) Add list with nested list to TDirectoryFile: @@ -8579,10 +11166,21 @@ void BailOut() dirFile = NULL; f->Close(); + if (tc.fVerbose && !(tc.fSequentialBailout > 0)) { // then it will be called only once, for the only and permanent bailout + ExitFunction(__FUNCTION__); + } + // *) Hasta la vista: - LOGF(fatal, "\n\nHasta la vista - bailed out intentionally in function \033[1;31m%s at line %d\n The output file is: %s\n\n\033[0m", __FUNCTION__, __LINE__, sBailOutFile.Data()); + if (finalBailout) { + LOGF(fatal, "\033[1;31mHasta la vista - bailed out permanently in function %s at line %d\n The output file is: %s\n\n\033[0m", __FUNCTION__, __LINE__, sBailOutFile.Data()); + } else { + LOGF(info, "\033[1;32mBailed out sequentially in function %s at line %d\n The output file is: %s\n\n\033[0m", __FUNCTION__, __LINE__, sBailOutFile.Data()); + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } -} // void BailOut() +} // void BailOut(Bool_t finalBailout = kFALSE) //============================================================ @@ -8595,7 +11193,7 @@ void FillQvector(const Double_t& dPhi, const Double_t& dPt, const Double_t& dEta // But since usage of weights amounts to checking a few simple booleans here, I do not anticipate any big gain in efficiency... if (tc.fVerboseForEachParticle) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); LOGF(info, "\033[1;32m dPhi = %f\033[0m", dPhi); LOGF(info, "\033[1;32m dPt = %f\033[0m", dPt); LOGF(info, "\033[1;32m dEta = %f\033[0m", dEta); @@ -8644,17 +11242,52 @@ void FillQvector(const Double_t& dPhi, const Double_t& dPt, const Double_t& dEta } // for(Int_t h=0;h 0.) { + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + if (dEta > es.fEtaSeparationsValues[e] / 2.) { // yes, if eta separation is 0.2, then separation interval runs from -0.1 to 0.1 + qv.fMab[1][e] += wPhi * wPt * wEta; + for (Int_t h = 0; h < gMaxHarmonic; h++) { + { + if (es.fEtaSeparationsSkipHarmonics[h]) { + continue; + } + qv.fQabVector[1][h][e] += TComplex(wPhi * wPt * wEta * TMath::Cos((h + 1) * dPhi), wPhi * wPt * wEta * TMath::Sin((h + 1) * dPhi)); + } + } // for (Int_t h = 0; h < gMaxHarmonic; h++) { + } // for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + } + } + } // if(es.fCalculateEtaSeparations) { + + if (tc.fVerboseForEachParticle) { + ExitFunction(__FUNCTION__); + } + } // void FillQvector(const Double_t& dPhi, const Double_t& dPt, const Double_t& dEta) //============================================================ -void Fillqvector(const Double_t& dPhi, const Double_t& kineVarValue, eqvectorKine kineVarChoice) +void Fillqvector(const Double_t& dPhi, const Double_t& kineVarValue, eqvectorKine kineVarChoice, const Double_t& dEta = 0.) { // Fill differential q-vector, in generic kinematic variable. Here "kine" originally meant vs. pt or vs. eta, now it's general. - // Example usage: this->Fillqvector(dPhi, dPt, PTq); + // Example usage #1: this->Fillqvector(dPhi, dPt, PTq); // differential q-vectors without using eta separations + // Example usage #2: this->Fillqvector(dPhi, dPt, PTq, dEta); // differential q-vectors with using eta separations (I need dEta of particle to decide whether particle is added to qa or qb) if (tc.fVerboseForEachParticle) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // *) Mapping between enum's "eqvectorKine" on one side, and "eAsFunctionOf", "eWeights" and "eDiffWeights" on the other: @@ -8680,13 +11313,13 @@ void Fillqvector(const Double_t& dPhi, const Double_t& kineVarValue, eqvectorKin // *) Insanity checks on above settings: if (AFO_var == eAsFunctionOf_N) { - LOGF(fatal, "\033[1;31m%s at line %d : AFO_var == eAsFunctionOf_N => add some more entries to the case stamenent \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : AFO_var == eAsFunctionOf_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); } if (AFO_weight == eWeights_N) { - LOGF(fatal, "\033[1;31m%s at line %d : AFO_weight == eWeights_N => add some more entries to the case stamenent \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : AFO_weight == eWeights_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); } if (AFO_diffWeight == eDiffWeights_N) { - LOGF(fatal, "\033[1;31m%s at line %d : AFO_diffWeight == eDiffWeights_N => add some more entries to the case stamenent \033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d : AFO_diffWeight == eDiffWeights_N => add some more entries to the case statement \033[0m", __FUNCTION__, __LINE__); } // *) Get the desired bin number: @@ -8743,7 +11376,47 @@ void Fillqvector(const Double_t& dPhi, const Double_t& kineVarValue, eqvectorKin // *) Multiplicity counter in this bin: qv.fqVectorEntries[kineVarChoice][bin - 1]++; // count number of particles in this pt bin in this event -} // void Fillqvector(const Double_t &dPhi, const Double_t &kineVarValue, eqvectorKine kineVarChoice) + // *) Usage of eta separations in differential correlations: + if (es.fCalculateEtaSeparations && es.fCalculateEtaSeparationsAsFunctionOf[AFO_var]) { // yes, I can decouple this one from if (qv.fCalculateQvectors) + + if (AFO_var == AFO_ETA) { + LOGF(fatal, "\033[1;31m%s at line %d : AFO_var == AFO_ETA . This doesn't make any sense in this context. \033[0m", __FUNCTION__, __LINE__); + } + + if (dEta < 0.) { + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + if (dEta < -1. * es.fEtaSeparationsValues[e] / 2.) { // yes, if eta separation is 0.2, then separation interval runs from -0.1 to 0.1 + qv.fmab[0][bin - 1][e] += diffPhiWeightsForThisKineVar * kineVarWeight; // Remark: I can hardwire linear weight like this only for 2-p correlation + for (Int_t h = 0; h < gMaxHarmonic; h++) { + if (es.fEtaSeparationsSkipHarmonics[h]) { + continue; + } + qv.fqabVector[0][bin - 1][h][e] += TComplex(diffPhiWeightsForThisKineVar * kineVarWeight * TMath::Cos((h + 1) * dPhi), diffPhiWeightsForThisKineVar * kineVarWeight * TMath::Sin((h + 1) * dPhi)); // Remark: I can hardwire linear weight like this only for 2-p correlation + } + } // for (Int_t h = 0; h < gMaxHarmonic; h++) { + } // for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + } else if (dEta > 0.) { + for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { + if (dEta > es.fEtaSeparationsValues[e] / 2.) { // yes, if eta separation is 0.2, then separation interval runs from -0.1 to 0.1 + qv.fmab[1][bin - 1][e] += diffPhiWeightsForThisKineVar * kineVarWeight; // Remark: I can hardwire linear weight like this only for 2-p correlation + for (Int_t h = 0; h < gMaxHarmonic; h++) { + { + if (es.fEtaSeparationsSkipHarmonics[h]) { + continue; + } + qv.fqabVector[1][bin - 1][h][e] += TComplex(diffPhiWeightsForThisKineVar * kineVarWeight * TMath::Cos((h + 1) * dPhi), diffPhiWeightsForThisKineVar * kineVarWeight * TMath::Sin((h + 1) * dPhi)); // Remark: I can hardwire linear weight like this only for 2-p correlation + } + } // for (Int_t h = 0; h < gMaxHarmonic; h++) { + } // for (Int_t e = 0; e < gMaxNumberEtaSeparations; e++) { // eta separation + } + } + } // if(es.fCalculateEtaSeparations) { + + if (tc.fVerboseForEachParticle) { + ExitFunction(__FUNCTION__); + } + +} // void Fillqvector(const Double_t& dPhi, const Double_t& kineVarValue, eqvectorKine kineVarChoice) //============================================================ @@ -8753,23 +11426,23 @@ void CalculateEverything() // Remark: Data members for Q-vectors, containers for nested loops, etc., must all be filled when this function is called. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); - } - - // *) Progress info: - if (iv.fUseInternalValidation && eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]) { - // this branch is relevant e.g. for internal validation: - LOGF(info, " Processing event %d .... ", static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eBefore]->GetBinContent(1))); - } else if (eh.fEventHistograms[eNumberOfEvents][eRec][eBefore] && eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]) { - LOGF(info, " Processing event %d/%d (selected/total) .... ", static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]->GetBinContent(1)), static_cast(eh.fEventHistograms[eNumberOfEvents][eRec][eBefore]->GetBinContent(1))); + StartFunction(__FUNCTION__); } - // TBI 20240423 I need to re-organize here if-else statements + add support for the case when I process only sim, etc. // *) Calculate multiparticle correlations (standard, isotropic, same harmonic): if (qv.fCalculateQvectors && mupa.fCalculateCorrelations) { this->CalculateCorrelations(); } + // *) Calculate differential ("kine") multiparticle correlations: + // Remark: vs. pt, vs. eta, etc., are all calculated here + if (qv.fCalculateQvectors && mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT]) { + this->CalculateKineCorrelations(AFO_PT); + } + if (qv.fCalculateQvectors && mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA]) { + this->CalculateKineCorrelations(AFO_ETA); + } + // *) Calculate Test0: TBI 20240110 name convention // Remark: integrated, vs. M and vs. centrality are all calculated here if (qv.fCalculateQvectors && t0.fCalculateTest0) { @@ -8789,127 +11462,25 @@ void CalculateEverything() if (nl.fCalculateNestedLoops) { this->CalculateNestedLoops(); if (mupa.fCalculateCorrelations) { + // I do not have option here for Test0, because in Test0 I cross-check either e-by-e with CustomNestedLoops or + // for all events with IV + fRescaleWithTheoreticalInput = kTRUE this->ComparisonNestedLoopsVsCorrelations(); // I call it here, so comparison is performed cumulatively after each event. The final printout corresponds to all events. } } -} // void CalculateEverything() - -//============================================================ - -template -void Steer(T1 const& collision, T2 const& tracks) -{ - // This is the only function to be called in processRec(...), processRecSim(...), and processSim(...). - // All analysis workflow is defined step-by-step here, via dedicated function calls. - // The order of function calls obviously matters. - - if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s starting ...\033[0m", __FUNCTION__); // just a bare function name - } - - // *) Dry run: - if (tc.fDryRun) { - EventCounter(eFill); - EventCounter(ePrint); - Preprocess(collision); // yes, so that e.g. I can only test if the weights were correctly fetched from external file and initialized locally into data members - return; - } - - // *) Reset event-by-event quantities: TBI 20240430 I do not need this call also here really, but it doesn't hurt either... - ResetEventByEventQuantities(); - - // *) Only do internal validation for all implemented correlators against the theoretical values: - if (iv.fUseInternalValidation) { - InternalValidation(); - return; - } - - // *) Global timestamp: - if (tc.fUseStopwatch) { - LOGF(info, "\033[1;32m\n\n=> Global timer: Steer begins ... %.6f\n\033[0m", tc.fTimer[eGlobal]->RealTime()); - tc.fTimer[eGlobal]->Continue(); // yes - } - - // *) Do all thingies before starting to process data from this collision (e.g. cut on number of events (bot total and selected), fetch the run number, etc.): - Preprocess(collision); - - // *) Determine collision centrality: - DetermineCentrality(collision); - - // *) Fill event histograms before event cuts: - if (eh.fFillEventHistograms || qa.fFillQAEventHistograms2D) { - FillEventHistograms(collision, tracks, eBefore); - } - - // *) Print info on the current event number (total, before cuts): - PrintEventCounter(eBefore); - - // *) Event cuts counters (use only during QA, as this is computationally heavy): - if (ec.fUseEventCutCounterAbsolute || ec.fUseEventCutCounterSequential) { - EventCutsCounters(collision, tracks); - } - - // *) Event cuts: - if (!EventCuts(collision, tracks, eCut)) { // Main call for event cuts - return; - } - - // *) Main loop over particles: - MainLoopOverParticles(tracks); - - // *) Remaining event cuts which can be applied only after the loop over particles is performed: - if ((ebye.fSelectedTracks < ec.fdEventCuts[eSelectedTracks][eMin]) || (ebye.fSelectedTracks > ec.fdEventCuts[eSelectedTracks][eMax])) { - if (tc.fVerbose) { - LOGF(info, "\033[1;31m%s eSelectedTracks \033[0m", __FUNCTION__); - } - // **) Special treatment for event cut counter: - // TBI 20240514 not sure if everything is done here correctly. Do some additional validation checks, and them move all this to some dedicated member function, e.g. RemainingEventCuts() - if (tc.fProcess[eGenericRec] || tc.fProcess[eGenericRecSim]) { - EventCut(eRec, eSelectedTracks, eCutCounterSequential); - } - if (tc.fProcess[eGenericSim] || tc.fProcess[eGenericRecSim]) { - EventCut(eSim, eSelectedTracks, eCutCounterSequential); + // *) Calculate correlations with eta separations: + if (es.fCalculateEtaSeparations) { + this->CalculateEtaSeparations(); + if (es.fCalculateEtaSeparationsAsFunctionOf[AFO_PT]) { + this->CalculateKineEtaSeparations(AFO_PT); // The implementation of CalculateKineEtaSeparations( ... ) is generic and can be used for any other "kine" variable, for which it makes sense } - - // TBI 20240514 Do I need to do here also something about particle cut counters? Most likely yes, but it's not that important, really - - BanishmentLoopOverParticles(tracks); // yes, I need to remove particles from ParticleHistograms, which were filled in the MainLoopOverParticles also for events < eSelectedTracks - ResetEventByEventQuantities(); - return; - } - - // *) Fill event histograms after event AND particle cuts: // TBI 20240110 not sure still if this one is called here, or it has to be moved above - if (eh.fFillEventHistograms || qa.fFillQAEventHistograms2D) { - FillEventHistograms(collision, tracks, eAfter); - } - - // *) Calculate everything for selected events and particles: - CalculateEverything(); - - // *) Reset event-by-event quantities: - ResetEventByEventQuantities(); - - // *) QA: - if (qa.fCheckUnderflowAndOverflow) { // TBI 20240507 introduce eventualy common function QA(), within which I will call all specific QA functions - CheckUnderflowAndOverflow(); } - // *) Print info on the current event number after cuts: - PrintEventCounter(eAfter); - - // *) Per request, print content of event cut counters: - if (ec.fPrintCutCounterContent) { - PrintCutCounterContent(); - } - - // *) Global timestamp: - if (tc.fUseStopwatch) { - LOGF(info, "\033[1;32m\n\n=> Global timer: Steer ends ... %.6f\n\n\033[0m", tc.fTimer[eGlobal]->RealTime()); - tc.fTimer[eGlobal]->Continue(); // yes + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); } -} // template void Steer(T1 const* collision, T2 const* tracks) +} // void CalculateEverything() //============================================================ @@ -8930,7 +11501,7 @@ void MainLoopOverParticles(T const& tracks) // *) There is also processTest(...), to process data with minimum subscription to the tables. To use it, set field "processTest": "true" in json config if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); // just a bare function name + StartFunction(__FUNCTION__); } // *) Declare local kinematic variables: @@ -8950,7 +11521,7 @@ void MainLoopOverParticles(T const& tracks) } // *) Local timestamp: - if (tc.fUseStopwatch) { + if (tc.fUseStopwatch && tc.fVerboseUtility) { LOGF(info, " Local timer starts at line %d", __LINE__); tc.fTimer[eLocal]->Reset(); tc.fTimer[eLocal]->Start(); @@ -8965,7 +11536,7 @@ void MainLoopOverParticles(T const& tracks) if (!tc.fUseFisherYates) { track = tracks.iteratorAt(i); } else { - track = tracks.iteratorAt((int64_t)tc.fRandomIndices->GetAt(i)); + track = tracks.iteratorAt(static_cast(tc.fRandomIndices->GetAt(i))); } // *) Skip track objects which are not valid tracks (e.g. Run 2 and 1 tracklets, etc.): @@ -8999,17 +11570,26 @@ void MainLoopOverParticles(T const& tracks) dPt = track.pt(); dEta = track.eta(); + // Remark: Keep in sync all calls and flags below with the ones in InternalValidation(). // *) Integrated Q-vectors: - if (qv.fCalculateQvectors) { + if (qv.fCalculateQvectors || es.fCalculateEtaSeparations) { this->FillQvector(dPhi, dPt, dEta); // all 3 arguments are passed by reference } // *) Differential q-vectors: - if (qv.fCalculateQvectors && t0.fCalculateTest0AsFunctionOf[AFO_PT]) { // TBI 20240423 I need to extend this condition to mupa.fCalculateCorrelations or some differential version of it - this->Fillqvector(dPhi, dPt, PTq); // first 2 arguments are passed by reference, 3rd argument is enum + // **) pt-dependence: + if (qv.fCalculateQvectors && (mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT] || t0.fCalculateTest0AsFunctionOf[AFO_PT]) && !es.fCalculateEtaSeparations) { + // In this branch I do not need eta separation, so the ligher call can be executed: + this->Fillqvector(dPhi, dPt, PTq); // first 2 arguments are passed by reference, 3rd argument is enum + } else if (es.fCalculateEtaSeparations && es.fCalculateEtaSeparationsAsFunctionOf[AFO_PT]) { + // In this branch I do need eta separation, so the heavier call must be executed: + // Remark: Within Fillqvector() I check again all the relevant flags. + this->Fillqvector(dPhi, dPt, PTq, dEta); // first 2 arguments and the last one are passed by reference, 3rd argument is enum. "kine" variable is the 2nd argument } - if (qv.fCalculateQvectors && t0.fCalculateTest0AsFunctionOf[AFO_ETA]) { // TBI 20240423 I need to extend this condition to mupa.fCalculateCorrelations or some differential version of it - this->Fillqvector(dPhi, dEta, ETAq); // first 2 arguments are passed by reference, 3rd argument is enum + // **) eta-dependence: + if (qv.fCalculateQvectors && (mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA] || t0.fCalculateTest0AsFunctionOf[AFO_ETA])) { + // Remark: For eta dependence I do not consider es.fCalculateEtaSeparations, because in this context that calculation is meaningless. + this->Fillqvector(dPhi, dEta, ETAq); // first 2 arguments are passed by reference, 3rd argument is enum } // *) Fill nested loops containers: @@ -9019,20 +11599,20 @@ void MainLoopOverParticles(T const& tracks) // *) Counter of selected tracks in the current event: ebye.fSelectedTracks++; - if (ebye.fSelectedTracks >= ec.fdEventCuts[eSelectedTracks][eMax]) { + if (ebye.fSelectedTracks >= ec.fdEventCuts[eMultiplicity][eMax]) { break; } // *) Break the loop if fixed number of particles is taken randomly from each event (use always in combination with tc.fUseFisherYates = kTRUE): if (tc.fFixedNumberOfRandomlySelectedTracks > 0 && tc.fFixedNumberOfRandomlySelectedTracks == ebye.fSelectedTracks) { - LOGF(info, " Breaking the loop over particles, since requested fixed number of %d particles was reached", tc.fFixedNumberOfRandomlySelectedTracks); + LOGF(info, "%s : Breaking the loop over particles, since requested fixed number of %d particles was reached", __FUNCTION__, tc.fFixedNumberOfRandomlySelectedTracks); break; } } // for (auto& track : tracks) // *) Local timestamp: - if (tc.fUseStopwatch) { + if (tc.fUseStopwatch && tc.fVerboseUtility) { LOGF(info, " Local timer ends at line %d, time elapsed ... %.6f", __LINE__, tc.fTimer[eLocal]->RealTime()); tc.fTimer[eLocal]->Continue(); } @@ -9042,6 +11622,138 @@ void MainLoopOverParticles(T const& tracks) LOGF(fatal, "\033[1;31mIn this event there are too few particles (ebye.fSelectedTracks = %d), and requested number of fixed number randomly selected tracks %d couldn't be reached\033[0m", ebye.fSelectedTracks, tc.fFixedNumberOfRandomlySelectedTracks); } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } } // template void MainLoopOverParticles(T const& tracks) { +//============================================================ + +template +void Steer(T1 const& collision, T2 const& bcs, T3 const& tracks) +{ + // This is the only function to be called in processRec(...), processRecSim(...), and processSim(...). + // All analysis workflow is defined step-by-step here, via dedicated function calls. + // The order of function calls obviously matters. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // *) Dry run: + if (tc.fDryRun) { + EventCounterForDryRun(eFill); + EventCounterForDryRun(ePrint); + Preprocess(collision, bcs); // yes, so that e.g. I can only test if the particle and centrality weights were correctly fetched from external file and initialized locally into data members + return; + } + + // *) Reset event-by-event quantities: TBI 20240430 I do not need this call also here really, but it doesn't hurt either... + ResetEventByEventQuantities(); + + // *) Only do internal validation for all implemented correlators against the theoretical values: + if (iv.fUseInternalValidation) { + InternalValidation(); + return; + } + + // *) Global timestamp: + if (tc.fUseStopwatch) { + LOGF(info, "\033[1;32m=> Global timer: Steer begins ... %.6f\033[0m", tc.fTimer[eGlobal]->RealTime()); + tc.fTimer[eGlobal]->Continue(); // yes + } + + // *) Do all thingies before starting to process data from this collision (e.g. cut on number of events (both total and selected), fetch the run number, etc.): + Preprocess(collision, bcs); + + // *) Determine collision reference multiplicity: + DetermineReferenceMultiplicity(collision); + + // *) Determine collision centrality: + DetermineCentrality(collision); + + // *) Determine collision occupancy: + DetermineOccupancy(collision); + + // *) Determine collision interaction rate: + DetermineInteractionRate(collision, bcs); + + // *) Fill event histograms before event cuts: + if (eh.fFillEventHistograms || qa.fFillQAEventHistograms2D) { + FillEventHistograms(collision, tracks, eBefore); + } + + // *) Print info on the current event number (total, before cuts): + if (tc.fVerboseEventCounter) { + PrintEventCounter(eBefore); + } + + // *) Event cuts counters (use only during QA, as this is computationally heavy): + if (ec.fUseEventCutCounterAbsolute || ec.fUseEventCutCounterSequential) { + EventCutsCounters(collision, tracks); + } + + // *) Event cuts: + if (!EventCuts(collision, tracks, eCut)) { // Main call for event cuts + return; + } + + // *) Main loop over particles: + MainLoopOverParticles(tracks); + + // *) Determine multiplicity of this event, for all "vs. mult" results: + DetermineMultiplicity(); + + // *) Remaining event cuts which can be applied only after the loop over particles is performed: + if (!RemainingEventCuts()) { + // yes, I need to remove particles from ParticleHistograms, which were filled in the MainLoopOverParticles also for events which didn't survive RemainingEventCuts + BanishmentLoopOverParticles(tracks); + ResetEventByEventQuantities(); + return; + } + + // *) Fill event histograms after event AND particle cuts: + if (eh.fFillEventHistograms || qa.fFillQAEventHistograms2D) { + FillEventHistograms(collision, tracks, eAfter); + } + + // *) Fill subevent multiplicities: + // Remark: I can call this one only after Qa and Qb vectors are filled, and after all particle and event cuts: + if (es.fCalculateEtaSeparations) { + FillSubeventMultiplicities(); + } + + // *) Calculate everything for selected events and particles: + CalculateEverything(); + + // *) Reset event-by-event quantities: + ResetEventByEventQuantities(); + + // *) QA: + if (qa.fCheckUnderflowAndOverflow) { // TBI 20240507 introduce eventualy common function QA(), within which I will call all specific QA functions + CheckUnderflowAndOverflow(); + } + + // *) Print info on the current event number after cuts: + if (tc.fVerboseEventCounter) { + PrintEventCounter(eAfter); + } + + // *) Per request, print content of event cut counters: + if (ec.fPrintCutCounterContent) { + PrintCutCounterContent(); + } + + // *) Global timestamp: + if (tc.fUseStopwatch) { + LOGF(info, "\033[1;32m=> Global timer: Steer ends ... %.6f\033[0m\n", tc.fTimer[eGlobal]->RealTime()); + tc.fTimer[eGlobal]->Continue(); // yes + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // template void Steer(T1 const* collision, T2 const* tracks) + #endif // PWGCF_MULTIPARTICLECORRELATIONS_CORE_MUPA_MEMBERFUNCTIONS_H_ diff --git a/PWGCF/MultiparticleCorrelations/Tasks/CMakeLists.txt b/PWGCF/MultiparticleCorrelations/Tasks/CMakeLists.txt index 4240aaf37e0..bc0ad886d5c 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/CMakeLists.txt +++ b/PWGCF/MultiparticleCorrelations/Tasks/CMakeLists.txt @@ -11,7 +11,7 @@ o2physics_add_dpl_workflow(multiparticle-correlations-ab SOURCES multiparticle-correlations-ab.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(multiparticle-correlations-ar diff --git a/PWGCF/MultiparticleCorrelations/Tasks/ThreeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/ThreeParticleCorrelations.cxx index f16e72accd1..fdb4ff9dcca 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/ThreeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/ThreeParticleCorrelations.cxx @@ -9,20 +9,24 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" +#include "CCDB/BasicCCDBManager.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "TPDGCode.h" -#include "TLorentzVector.h" +#include "RecoDecay.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; struct ThreePartCorr { + Service CCDB; // Histogram registry HistogramRegistry MECorrRegistry{"MECorrRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; @@ -61,7 +65,9 @@ struct ThreePartCorr { using MyFilteredMCGenCollision = soa::Filtered::iterator; using MyFilteredMCParticles = soa::Filtered; using MyFilteredMCRecCollision = soa::Filtered>::iterator; - using MyFilteredMCTracks = soa::Filtered>; + using MyFilteredMCTracks = soa::Filtered>; // Mixed-events binning policy SliceCache cache; @@ -79,6 +85,11 @@ struct ThreePartCorr { Double_t massLambda = o2::constants::physics::MassLambda0; Double_t DGaussSigma = 0.0021; + // Efficiency histograms + TH1D** hEffPions = new TH1D*[2]; + TH1D** hEffKaons = new TH1D*[2]; + TH1D** hEffProtons = new TH1D*[2]; + // Correlation variables Int_t T_Sign; Double_t CandMass; @@ -91,6 +102,7 @@ struct ThreePartCorr { void init(InitContext const&) { + // Histograms axes const AxisSpec CentralityAxis{ConfCentBins}; const AxisSpec ZvtxAxis{ConfZvtxBins}; const AxisSpec PhiAxis{36, (-1. / 2) * M_PI, (3. / 2) * M_PI}; @@ -99,6 +111,7 @@ struct ThreePartCorr { const AxisSpec TrackPtAxis{28, 0.2, 3}; const AxisSpec LambdaInvMassAxis{100, 1.08, 1.16}; + // QA & PID QARegistry.add("hTrackPt", "hTrackPt", {HistType::kTH1D, {{100, 0, 4}}}); QARegistry.add("hTrackEta", "hTrackEta", {HistType::kTH1D, {{100, -1, 1}}}); QARegistry.add("hTrackPhi", "hTrackPhi", {HistType::kTH1D, {{100, (-1. / 2) * M_PI, (5. / 2) * M_PI}}}); @@ -120,12 +133,15 @@ struct ThreePartCorr { QARegistry.add("hInvMassLambda", "hInvMassLambda", {HistType::kTH3D, {{LambdaInvMassAxis}, {V0PtAxis}, {CentralityAxis}}}); QARegistry.add("hInvMassAntiLambda", "hInvMassAntiLambda", {HistType::kTH3D, {{LambdaInvMassAxis}, {V0PtAxis}, {CentralityAxis}}}); + // Efficiency + MCRegistry.add("hGenerated", "hGenerated", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hGenPionP", "hGenPionP", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hGenPionN", "hGenPionN", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hGenKaonP", "hGenKaonP", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hGenKaonN", "hGenKaonN", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hGenProtonP", "hGenProtonP", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hGenProtonN", "hGenProtonN", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hReconstructed", "hReconstructed", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hRecPionP", "hRecPionP", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hRecPionN", "hRecPionN", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hRecKaonP", "hRecKaonP", {HistType::kTH1D, {TrackPtAxis}}); @@ -133,6 +149,21 @@ struct ThreePartCorr { MCRegistry.add("hRecProtonP", "hRecProtonP", {HistType::kTH1D, {TrackPtAxis}}); MCRegistry.add("hRecProtonN", "hRecProtonN", {HistType::kTH1D, {TrackPtAxis}}); + // Purity + MCRegistry.add("hSelectPionP", "hSelectPionP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hSelectPionN", "hSelectPionN", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hSelectKaonP", "hSelectKaonP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hSelectKaonN", "hSelectKaonN", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hSelectProtonP", "hSelectProtonP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hSelectProtonN", "hSelectProtonN", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hTrueSelectPionP", "hTrueSelectPionP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hTrueSelectPionN", "hTrueSelectPionN", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hTrueSelectKaonP", "hTrueSelectKaonP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hTrueSelectKaonN", "hTrueSelectKaonN", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hTrueSelectProtonP", "hTrueSelectProtonP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hTrueSelectProtonN", "hTrueSelectProtonN", {HistType::kTH1D, {TrackPtAxis}}); + + // Correlations SECorrRegistry.add("hSameLambdaPion_SGNL", "Same-event #Lambda - #pi correlator (SGNL region)", {HistType::kTHnSparseD, {{PhiAxis}, {EtaAxis}, {CentralityAxis}, {ZvtxAxis}, {2, -2, 2}, {2, -2, 2}}}); SECorrRegistry.add("hSameLambdaPion_SB", "Same-event #Lambda - #pi correlator (SB region)", {HistType::kTHnSparseD, {{PhiAxis}, {EtaAxis}, {CentralityAxis}, {ZvtxAxis}, {2, -2, 2}, {2, -2, 2}}}); SECorrRegistry.add("hSameLambdaKaon_SGNL", "Same-event #Lambda - K correlator (SGNL region)", {HistType::kTHnSparseD, {{PhiAxis}, {EtaAxis}, {CentralityAxis}, {ZvtxAxis}, {2, -2, 2}, {2, -2, 2}}}); @@ -146,6 +177,16 @@ struct ThreePartCorr { MECorrRegistry.add("hMixLambdaKaon_SB", "Mixed-event #Lambda - K correlator (SB region)", {HistType::kTHnSparseD, {{PhiAxis}, {EtaAxis}, {CentralityAxis}, {ZvtxAxis}, {2, -2, 2}, {2, -2, 2}}}); MECorrRegistry.add("hMixLambdaProton_SGNL", "Mixed-event #Lambda - p correlator (SGNL region)", {HistType::kTHnSparseD, {{PhiAxis}, {EtaAxis}, {CentralityAxis}, {ZvtxAxis}, {2, -2, 2}, {2, -2, 2}}}); MECorrRegistry.add("hMixLambdaProton_SB", "Mixed-event #Lambda - p correlator (SB region)", {HistType::kTHnSparseD, {{PhiAxis}, {EtaAxis}, {CentralityAxis}, {ZvtxAxis}, {2, -2, 2}, {2, -2, 2}}}); + + CCDB->setURL("http://alice-ccdb.cern.ch"); + CCDB->setCaching(true); + TList* EfficiencyList = CCDB->getForTimeStamp("Users/j/jstaa/Efficiency/ChargedParticles", 1); + hEffPions[0] = static_cast(EfficiencyList->FindObject("hEfficiencyPionP")); + hEffPions[1] = static_cast(EfficiencyList->FindObject("hEfficiencyPionN")); + hEffKaons[0] = static_cast(EfficiencyList->FindObject("hEfficiencyKaonP")); + hEffKaons[1] = static_cast(EfficiencyList->FindObject("hEfficiencyKaonN")); + hEffProtons[0] = static_cast(EfficiencyList->FindObject("hEfficiencyProtonP")); + hEffProtons[1] = static_cast(EfficiencyList->FindObject("hEfficiencyProtonN")); } //================================================================================================================================================================================================================ @@ -205,19 +246,19 @@ struct ThreePartCorr { if (CandMass >= massLambda - 4 * DGaussSigma && CandMass <= massLambda + 4 * DGaussSigma) { if (A_PID[0] == 0.0) { // Pions - SECorrRegistry.fill(HIST("hSameLambdaPion_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + SECorrRegistry.fill(HIST("hSameLambdaPion_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffPions, associate.sign(), associate.pt())); } else if (A_PID[0] == 1.0) { // Kaons - SECorrRegistry.fill(HIST("hSameLambdaKaon_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + SECorrRegistry.fill(HIST("hSameLambdaKaon_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffKaons, associate.sign(), associate.pt())); } else if (A_PID[0] == 2.0) { // Protons - SECorrRegistry.fill(HIST("hSameLambdaProton_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + SECorrRegistry.fill(HIST("hSameLambdaProton_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffProtons, associate.sign(), associate.pt())); } } else if (CandMass >= massLambda - 8 * DGaussSigma && CandMass <= massLambda + 8 * DGaussSigma) { if (A_PID[0] == 0.0) { // Pions - SECorrRegistry.fill(HIST("hSameLambdaPion_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + SECorrRegistry.fill(HIST("hSameLambdaPion_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffPions, associate.sign(), associate.pt())); } else if (A_PID[0] == 1.0) { // Kaons - SECorrRegistry.fill(HIST("hSameLambdaKaon_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + SECorrRegistry.fill(HIST("hSameLambdaKaon_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffKaons, associate.sign(), associate.pt())); } else if (A_PID[0] == 2.0) { // Protons - SECorrRegistry.fill(HIST("hSameLambdaProton_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + SECorrRegistry.fill(HIST("hSameLambdaProton_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffProtons, associate.sign(), associate.pt())); } } } @@ -250,19 +291,19 @@ struct ThreePartCorr { if (CandMass >= massLambda - 4 * DGaussSigma && CandMass <= massLambda + 4 * DGaussSigma) { if (A_PID[0] == 0.0) { // Pions - MECorrRegistry.fill(HIST("hMixLambdaPion_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); + MECorrRegistry.fill(HIST("hMixLambdaPion_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffPions, associate.sign(), associate.pt())); } else if (A_PID[0] == 1.0) { // Kaons - MECorrRegistry.fill(HIST("hMixLambdaKaon_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); + MECorrRegistry.fill(HIST("hMixLambdaKaon_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffKaons, associate.sign(), associate.pt())); } else if (A_PID[0] == 2.0) { // Protons - MECorrRegistry.fill(HIST("hMixLambdaProton_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); + MECorrRegistry.fill(HIST("hMixLambdaProton_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffProtons, associate.sign(), associate.pt())); } } else if (CandMass >= massLambda - 8 * DGaussSigma && CandMass <= massLambda + 8 * DGaussSigma) { if (A_PID[0] == 0.0) { // Pions - MECorrRegistry.fill(HIST("hMixLambdaPion_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); + MECorrRegistry.fill(HIST("hMixLambdaPion_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffPions, associate.sign(), associate.pt())); } else if (A_PID[0] == 1.0) { // Kaons - MECorrRegistry.fill(HIST("hMixLambdaKaon_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); + MECorrRegistry.fill(HIST("hMixLambdaKaon_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffKaons, associate.sign(), associate.pt())); } else if (A_PID[0] == 2.0) { // Protons - MECorrRegistry.fill(HIST("hMixLambdaProton_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); + MECorrRegistry.fill(HIST("hMixLambdaProton_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign(), 1. / TrackEff(hEffProtons, associate.sign(), associate.pt())); } } } @@ -279,6 +320,8 @@ struct ThreePartCorr { for (const auto& particle : particles) { if (particle.isPhysicalPrimary()) { + // Efficiency - Generated + MCRegistry.fill(HIST("hGenerated"), particle.pt()); if (particle.pdgCode() == kPiPlus) { // Pos pions MCRegistry.fill(HIST("hGenPionP"), particle.pt()); } else if (particle.pdgCode() == kPiMinus) { // Neg pions @@ -313,6 +356,8 @@ struct ThreePartCorr { auto particle = track.mcParticle(); if (particle.isPhysicalPrimary()) { + // Efficiency - Reconstructed + MCRegistry.fill(HIST("hReconstructed"), track.pt()); if (particle.pdgCode() == kPiPlus) { // Pos pions MCRegistry.fill(HIST("hRecPionP"), track.pt()); } else if (particle.pdgCode() == kPiMinus) { // Neg pions @@ -326,6 +371,47 @@ struct ThreePartCorr { } else if (particle.pdgCode() == kProtonBar) { // Neg protons MCRegistry.fill(HIST("hRecProtonN"), track.pt()); } + + // Purity + A_PID = TrackPID(track); + if (A_PID[1] < 4.0) { + + if (track.sign() > 0) { // Positive tracks + if (A_PID[0] == 0.0) { // Pions + MCRegistry.fill(HIST("hSelectPionP"), track.pt()); + if (particle.pdgCode() == kPiPlus) { + MCRegistry.fill(HIST("hTrueSelectPionP"), track.pt()); + } + } else if (A_PID[0] == 1.0) { // Kaons + MCRegistry.fill(HIST("hSelectKaonP"), track.pt()); + if (particle.pdgCode() == kKPlus) { + MCRegistry.fill(HIST("hTrueSelectKaonP"), track.pt()); + } + } else if (A_PID[0] == 2.0) { // Protons + MCRegistry.fill(HIST("hSelectProtonP"), track.pt()); + if (particle.pdgCode() == kProton) { + MCRegistry.fill(HIST("hTrueSelectProtonP"), track.pt()); + } + } + } else if (track.sign() < 0) { // Negative tracks + if (A_PID[0] == 0.0) { // Pions + MCRegistry.fill(HIST("hSelectPionN"), track.pt()); + if (particle.pdgCode() == kPiMinus) { + MCRegistry.fill(HIST("hTrueSelectPionN"), track.pt()); + } + } else if (A_PID[0] == 1.0) { // Kaons + MCRegistry.fill(HIST("hSelectKaonN"), track.pt()); + if (particle.pdgCode() == kKMinus) { + MCRegistry.fill(HIST("hTrueSelectKaonN"), track.pt()); + } + } else if (A_PID[0] == 2.0) { // Protons + MCRegistry.fill(HIST("hSelectProtonN"), track.pt()); + if (particle.pdgCode() == kProtonBar) { + MCRegistry.fill(HIST("hTrueSelectProtonN"), track.pt()); + } + } + } + } } } // End of the Monte-Carlo reconstructed QA @@ -352,6 +438,32 @@ struct ThreePartCorr { return dPhi; } + Double_t TrackEff(TH1D** Efficiencies, Int_t Sign, Double_t pT) + { + + Int_t Index = -999; + if (Sign > 0) { + Index = 0; + } else if (Sign < 0) { + Index = 1; + } + + return Efficiencies[Index]->GetBinContent(Efficiencies[Index]->FindBin(pT)); + } + + template + Int_t V0Sign(const V0Cand& V0) + { + + if (TMath::Abs(V0.mLambda() - massLambda) <= TMath::Abs(V0.mAntiLambda() - massLambda)) { + return 1; + } else if (TMath::Abs(V0.mLambda() - massLambda) > TMath::Abs(V0.mAntiLambda() - massLambda)) { + return -1; + } + + return 0; + } + template Double_t* TrackPID(const TrackCand& Track) { @@ -387,19 +499,6 @@ struct ThreePartCorr { return ID; } - template - Int_t V0Sign(const V0Cand& V0) - { - - if (TMath::Abs(V0.mLambda() - massLambda) <= TMath::Abs(V0.mAntiLambda() - massLambda)) { - return 1; - } else if (TMath::Abs(V0.mLambda() - massLambda) > TMath::Abs(V0.mAntiLambda() - massLambda)) { - return -1; - } - - return 0; - } - template Bool_t V0Filters(const V0Cand& V0) { @@ -439,28 +538,37 @@ struct ThreePartCorr { if (ConfFilterSwitch) { - TLorentzVector Daughter, Associate; if (TrackPID(Track)[0] == 1.0) { // Kaons return kTRUE; - } else if (V0Sign(V0) == 1 && TrackPID(Track)[0] == 0.0 && Track.sign() == -1) { // Lambda - Pi_min - const auto& dTrack = V0.template posTrack_as(); - Daughter.SetPtEtaPhiM(dTrack.pt(), dTrack.eta(), dTrack.phi(), o2::constants::physics::MassProton); - Associate.SetPtEtaPhiM(Track.pt(), Track.eta(), Track.phi(), o2::constants::physics::MassPionCharged); - } else if (V0Sign(V0) == -1 && TrackPID(Track)[0] == 0.0 && Track.sign() == 1) { // Antilambda - Pi_plus - const auto& dTrack = V0.template negTrack_as(); - Daughter.SetPtEtaPhiM(dTrack.pt(), dTrack.eta(), dTrack.phi(), o2::constants::physics::MassProton); - Associate.SetPtEtaPhiM(Track.pt(), Track.eta(), Track.phi(), o2::constants::physics::MassPionCharged); - } else if (V0Sign(V0) == 1 && TrackPID(Track)[0] == 2.0 && Track.sign() == 1) { // Lambda - Proton - const auto& dTrack = V0.template negTrack_as(); - Daughter.SetPtEtaPhiM(dTrack.pt(), dTrack.eta(), dTrack.phi(), o2::constants::physics::MassPionCharged); - Associate.SetPtEtaPhiM(Track.pt(), Track.eta(), Track.phi(), o2::constants::physics::MassProton); - } else if (V0Sign(V0) == -1 && TrackPID(Track)[0] == 2.0 && Track.sign() == -1) { // Antilambda - Antiproton - const auto& dTrack = V0.template posTrack_as(); - Daughter.SetPtEtaPhiM(dTrack.pt(), dTrack.eta(), dTrack.phi(), o2::constants::physics::MassPionCharged); - Associate.SetPtEtaPhiM(Track.pt(), Track.eta(), Track.phi(), o2::constants::physics::MassProton); } - if ((Daughter + Associate).M() >= massLambda - 4 * DGaussSigma && (Daughter + Associate).M() <= massLambda + 4 * DGaussSigma) { + std::array MassArray; + std::array DMomArray; + std::array AMomArray = Track.pVector(); + if (TrackPID(Track)[0] == 0.0) { + MassArray = {o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}; + + if (V0Sign(V0) == 1 && Track.sign() == -1) { // Lambda - Pi_min + const auto& dTrack = V0.template posTrack_as(); + DMomArray = dTrack.pVector(); + } else if (V0Sign(V0) == -1 && Track.sign() == 1) { // Antilambda - Pi_plus + const auto& dTrack = V0.template negTrack_as(); + DMomArray = dTrack.pVector(); + } + } else if (TrackPID(Track)[0] == 2.0) { + MassArray = {o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}; + + if (V0Sign(V0) == 1 && Track.sign() == 1) { // Lambda - Proton + const auto& dTrack = V0.template negTrack_as(); + DMomArray = dTrack.pVector(); + } else if (V0Sign(V0) == -1 && Track.sign() == -1) { // Antilambda - Antiproton + const auto& dTrack = V0.template posTrack_as(); + DMomArray = dTrack.pVector(); + } + } + + Double_t M = RecoDecay::m(std::array{DMomArray, AMomArray}, MassArray); + if (M >= massLambda - 4 * DGaussSigma && M <= massLambda + 4 * DGaussSigma) { return kFALSE; } } diff --git a/PWGCF/MultiparticleCorrelations/Tasks/multiparticle-correlations-ab.cxx b/PWGCF/MultiparticleCorrelations/Tasks/multiparticle-correlations-ab.cxx index 99534d91763..6bf5b16249f 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/multiparticle-correlations-ab.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/multiparticle-correlations-ab.cxx @@ -11,6 +11,7 @@ // O2: #include +#include "Common/CCDB/ctpRateFetcher.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -24,12 +25,19 @@ using namespace o2; using namespace o2::framework; // *) Run 3: -using EventSelection = soa::Join; +using BCs_Run3 = soa::Join; // TBI 20241126 under testing +// Remark 1: I have already timestamp in workflow, due to track-propagation. With Run3MatchedToBCSparse, I can use bc.has_zdc() +// Remark 2: For consistency with notation below, drop _Run3 and instead use _Run2 and _Run1 + +// using EventSelection = soa::Join; // TBI 20241209 validating "MultsGlobal" +// for using collision.multNTracksGlobal() +using EventSelection = soa::Join; using CollisionRec = soa::Join::iterator; // use in json "isMC": "true" for "event-selection-task" using CollisionRecSim = soa::Join::iterator; +// using CollisionRecSim = soa::Join::iterator; // TBI 20241210 validating "MultsExtraMC" for multMCNParticlesEta08 using CollisionSim = aod::McCollision; using TracksRec = soa::Join; -using TrackRec = soa::Join::iterator; +// using TrackRec = soa::Join::iterator; using TracksRecSim = soa::Join; // + use in json "isMC" : "true" using TrackRecSim = soa::Join::iterator; using TracksSim = aod::McParticles; @@ -62,6 +70,7 @@ using CollisionRecSim_Run1 = soa::Join #include #include +#include using namespace std; // *) Enums: @@ -76,6 +85,7 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to // *) CCDB: Service ccdb; + ctpRateFetcher mRateFetcher; // see email from MP on 20240508 and example usage in O2Physics/PWGLF/TableProducer/Common/zdcSP.cxx // *) Configurables (cuts): #include "PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h" @@ -105,14 +115,21 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to TH1::AddDirectory(kFALSE); // *) Default configuration, booking, binning and cuts: - DefaultConfiguration(); // here default values from configurables are taken into account - DefaultBooking(); // here I decide only which histograms are booked, not details like binning, etc. - DefaultBinning(); // here default values for bins are either hardwired, or values for bins provided via configurables are taken into account - DefaultCuts(); // here default values for cuts are either hardwired, or defined through default binning to ease bookeeping, or values for cuts provided via configurables are taken into account - // Remark: DefaultCuts() has to be called after DefaultBinning() + InsanityChecksOnDefinitionsOfConfigurables(); // values passed via configurables are insanitized here. Nothing is initialized yet via configurables in this method + DefaultConfiguration(); // here default values from configurables are taken into account + DefaultBooking(); // here I decide only which histograms are booked, not details like binning, etc. + DefaultBinning(); // here default values for bins are either hardwired, or values for bins provided via configurables are taken into account + DefaultCuts(); // here default values for cuts are either hardwired, or defined through default binning to ease bookeeping, + // or values for cuts provided via configurables are taken into account + // Remark: DefaultCuts() has to be called after DefaultBinning() + + // *) Specific cuts: + if (tc.fUseSpecificCuts) { + SpecificCuts(tc.fWhichSpecificCuts); // after default cuts are applied, on top of them apply analysis-specific cuts. Has to be called after DefaultBinning() and DefaultCuts() + } // *) Insanity checks before booking: - InsanityChecksBeforeBooking(); // check only harwired values and the ones obtained from configurables + InsanityChecksBeforeBooking(); // check only hardwired values and the ones obtained from configurables // *) Book random generator: delete gRandom; @@ -132,10 +149,12 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to BookQvectorHistograms(); BookCorrelationsHistograms(); BookWeightsHistograms(); + BookCentralityWeightsHistograms(); BookNestedLoopsHistograms(); BookNUAHistograms(); BookInternalValidationHistograms(); BookTest0Histograms(); + BookEtaSeparationsHistograms(); BookTheRest(); // here I book everything that was not sorted (yet) in the specific functions above // *) Insanity checks after booking: @@ -169,48 +188,49 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to // ------------------------------------------- // A) Process only reconstructed data: - void processRec(CollisionRec const& collision, aod::BCs const&, TracksRec const& tracks) + // void processRec(CollisionRec const& collision, aod::BCs const&, TracksRec const& tracks) + void processRec(CollisionRec const& collision, BCs_Run3 const& bcs, TracksRec const& tracks) { // Remark: Do not use here LOGF(fatal, ...) or LOGF(info, ...), because their stdout/stderr is suppressed. Use them in regular member functions instead. // *) Steer all analysis steps: - Steer(collision, tracks); + Steer(collision, bcs, tracks); } PROCESS_SWITCH(MultiparticleCorrelationsAB, processRec, "process only reconstructed data", true); // yes, keep always one process switch "true", so that I have default running version // ------------------------------------------- // B) Process both reconstructed and corresponding MC truth simulated data: - void processRecSim(CollisionRecSim const& collision, aod::BCs const&, TracksRecSim const& tracks, aod::McParticles const&, aod::McCollisions const&) + void processRecSim(CollisionRecSim const& collision, aod::BCs const& bcs, TracksRecSim const& tracks, aod::McParticles const&, aod::McCollisions const&) { - Steer(collision, tracks); + Steer(collision, bcs, tracks); } PROCESS_SWITCH(MultiparticleCorrelationsAB, processRecSim, "process both reconstructed and corresponding MC truth simulated data", false); // ------------------------------------------- // C) Process only simulated data: - void processSim(CollisionSim const& /*collision*/, aod::BCs const&, TracksSim const& /*tracks*/) + void processSim(CollisionSim const& /*collision*/, aod::BCs const& /*bcs*/, TracksSim const& /*tracks*/) { - // Steer(collision, tracks); // TBI 20240517 not ready yet, but I do not really need this one urgently, since RecSim is working, and I need that one for efficiencies... + // Steer(collision, bcs, tracks); // TBI 20240517 not ready yet, but I do not really need this one urgently, since RecSim is working, and I need that one for efficiencies... } PROCESS_SWITCH(MultiparticleCorrelationsAB, processSim, "process only simulated data", false); // ------------------------------------------- // D) Process only converted reconstructed Run 2 data: - void processRec_Run2(CollisionRec_Run2 const& collision, aod::BCs const&, TracksRec const& tracks) + void processRec_Run2(CollisionRec_Run2 const& collision, aod::BCs const& bcs, TracksRec const& tracks) { - Steer(collision, tracks); + Steer(collision, bcs, tracks); } PROCESS_SWITCH(MultiparticleCorrelationsAB, processRec_Run2, "process only converted reconstructed Run 2 data", false); // ------------------------------------------- // E) Process both converted reconstructed and corresponding MC truth simulated Run 2 data: - void processRecSim_Run2(CollisionRecSim_Run2 const& collision, aod::BCs const&, TracksRecSim const& tracks, aod::McParticles const&, aod::McCollisions const&) + void processRecSim_Run2(CollisionRecSim_Run2 const& collision, aod::BCs const& bcs, TracksRecSim const& tracks, aod::McParticles const&, aod::McCollisions const&) { - Steer(collision, tracks); + Steer(collision, bcs, tracks); } PROCESS_SWITCH(MultiparticleCorrelationsAB, processRecSim_Run2, "process both converted reconstructed and simulated Run 2 data", false); @@ -226,18 +246,18 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to // ------------------------------------------- // G) Process only converted reconstructed Run 1 data: - void processRec_Run1(CollisionRec_Run1 const& collision, aod::BCs const&, TracksRec const& tracks) + void processRec_Run1(CollisionRec_Run1 const& collision, aod::BCs const& bcs, TracksRec const& tracks) { - Steer(collision, tracks); + Steer(collision, bcs, tracks); } PROCESS_SWITCH(MultiparticleCorrelationsAB, processRec_Run1, "process only converted reconstructed Run 1 data", false); // ------------------------------------------- // H) Process both converted reconstructed and corresponding MC truth simulated Run 1 data; - void processRecSim_Run1(CollisionRecSim_Run1 const& /*collision*/, aod::BCs const&, TracksRecSim const& /*tracks*/, aod::McParticles const&, aod::McCollisions const&) + void processRecSim_Run1(CollisionRecSim_Run1 const& /*collision*/, aod::BCs const& /*bcs*/, TracksRecSim const& /*tracks*/, aod::McParticles const&, aod::McCollisions const&) { - // Steer(collision, tracks); // TBI 20240517 not ready yet, but for benchmarking in any case I need only "Rec" + // Steer(collision, bcs, tracks); // TBI 20240517 not ready yet, but for benchmarking in any case I need only "Rec" } PROCESS_SWITCH(MultiparticleCorrelationsAB, processRecSim_Run1, "process both converted reconstructed and simulated Run 1 data", false); @@ -253,9 +273,9 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to // ------------------------------------------- // J) Process data with minimum subscription to the tables, for testing purposes: - void processTest(aod::Collision const& collision, aod::BCs const&, aod::Tracks const& tracks) + void processTest(aod::Collision const& collision, aod::BCs const& bcs, aod::Tracks const& tracks) { - Steer(collision, tracks); + Steer(collision, bcs, tracks); } PROCESS_SWITCH(MultiparticleCorrelationsAB, processTest, "test processing", false); diff --git a/PWGCF/TableProducer/dptdptfilter.cxx b/PWGCF/TableProducer/dptdptfilter.cxx index 371b9b581f4..35136acff91 100644 --- a/PWGCF/TableProducer/dptdptfilter.cxx +++ b/PWGCF/TableProducer/dptdptfilter.cxx @@ -9,12 +9,19 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file dptdptfilter.cxx +/// \brief Filters collisions and tracks according to selection criteria +/// \author victor.gonzalez.sebastian@gmail.com + #include #include +#include +#include #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "CommonConstants/PhysicsConstants.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Centrality.h" #include "Common/Core/TableHelper.h" @@ -25,10 +32,11 @@ #include "PWGCF/DataModel/DptDptFiltered.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/CollisionAssociationTables.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" #include -#include +#include #include #include #include @@ -85,10 +93,27 @@ const char* speciesName[kDptDptNoOfSpecies] = {"h", "e", "mu", "pi", "ka", "p"}; const char* speciesTitle[kDptDptNoOfSpecies] = {"", "e", "#mu", "#pi", "K", "p"}; +const char* eventSelectionSteps[knCollisionSelectionFlags] = { + "IN", + "MB", + "INT7", + "SEL7", + "SEL8", + "NOSAMEBUNCHPUP", + "ISGOODZVTXFT0VSPV", + "ISVERTEXITSTPC", + "ISVERTEXTOFMATCHED", + "ISVERTEXTRDMATCHED", + "OCCUPANCY", + "CENTRALITY", + "ZVERTEX", + "SELECTED"}; + //============================================================================================ // The DptDptFilter histogram objects // TODO: consider registering in the histogram registry //============================================================================================ +TH1D* fhEventSelection = nullptr; TH1F* fhCentMultB = nullptr; TH1F* fhCentMultA = nullptr; TH1F* fhVertexZB = nullptr; @@ -163,6 +188,169 @@ std::vector partMultNeg; // multiplicity of negative particles using namespace dptdptfilter; +////////////////////////////////////////////////////////////////////////////// +// Multiplicity in principle for on the fly generated events +////////////////////////////////////////////////////////////////////////////// + +struct Multiplicity { + enum MultEst { + kV0M, + kCL1, + kCL1GAP + }; + + float getMultiplicityClass() { return multiplicityClass; } + float getMultiplicity() { return multiplicity; } + + MultEst classestimator = kV0M; + + float multiplicityClass = -1.0; + float multiplicity = 0.0; + bool inelgth0 = false; + int v0am = 0; + int v0cm = 0; + int cl1m = 0; + int cl1EtaGapM = 0; + int dNchdEta = 0; + int nPart = 0; + TH1F* fhNPartTot = nullptr; ///< total number of particles analyzed + TH1F* fhMultiplicity; ///< the multiplicity distribution + TH2F* fhV0Multiplicity; ///< the V0M multiplicity histogram + TH2F* fhCL1Multiplicity; ///< the CL1 multiplicity histogram + TH2F* fhCL1EtaGapMultiplicity; ///< the CL1 with an eta gap multiplicity histogram + const TH1* fhV0MMultPercentile; ///< the V0M Centrality / Multiplicity percentile estimation histogram + const TH1* fhCL1MultPercentile; ///< the CL1 Centrality / Multiplicity percentile estimation histogram + const TH1* fhCL1EtaGapMultPercentile; ///< the CL1 with an eta gap Centrality / Multiplicity percentile estimation histogram + + void init(TList* hlist) + { + fhNPartTot = new TH1F("CollisionNpart", "Collision analyzed particles;number of particles;counts", 8000, -0.5, 8000 - 0.5); + fhMultiplicity = new TH1F("CollisionMultiplicity", "Event multiplicity;multiplicity (%);counts", 101, -0.5, 101 - 0.5); + fhV0Multiplicity = new TH2F("V0Multiplicity", "V0M;V0M;d#it{N}/d#eta;counts", 3000, -9.5, 3000 - 9.5, 2500, -9.5, 2500 - 9.5); + fhCL1Multiplicity = new TH2F("CL1Multiplicity", "CL1M;CL1M;d#it{N}/d#eta;counts", 3000, -9.5, 3000 - 9.5, 2500, -9.5, 2500 - 9.5); + fhCL1EtaGapMultiplicity = new TH2F("CL1EtaGapMultiplicity", "CL1M (excl |#eta|<0.8);CL1M;d#it{N}/d#eta;counts", 3000, -9.5, 3000 - 9.5, 2500, -9.5, 2500 - 9.5); + + hlist->Add(fhNPartTot); + hlist->Add(fhMultiplicity); + hlist->Add(fhV0Multiplicity); + hlist->Add(fhCL1Multiplicity); + hlist->Add(fhCL1EtaGapMultiplicity); + } + + void setMultiplicityPercentiles(TList* list) + { + LOGF(info, "setMultiplicityPercentiles()", "From list %s", list->GetName()); + fhV0MMultPercentile = reinterpret_cast(list->FindObject("V0MCentMult")); + fhCL1MultPercentile = reinterpret_cast(list->FindObject("CL1MCentMult")); + fhCL1EtaGapMultPercentile = reinterpret_cast(list->FindObject("CL1EtaGapMCentMult")); + + if (fhV0MMultPercentile == nullptr || fhCL1MultPercentile == nullptr || fhCL1EtaGapMultPercentile == nullptr) { + LOGF(fatal, "setMultiplicityPercentiles()", "Percentiles histograms not correctly loaded. ABORTING!!!"); + return; + } + } + + template + bool addParticleToMultiplicity(const Particle& p) + { + /* on the fly MC production */ + /* get event multiplicity according to the passed eta range */ + /* event multiplicity as number of primary charged particles */ + /* based on AliAnalysisTaskPhiCorrelations implementation */ + int pdgcode = std::abs(p.pdgCode()); + auto addTo = [](const Particle& p, int& est, float etamin, float etamax) { + if (p.eta() < etamax && etamin < p.eta()) { + est = est + 1; + } + }; + + /* pdg checks */ + switch (pdgcode) { + case kPiPlus: + case kKPlus: + case kProton: + /* not clear if we should use IsPhysicalPrimary here */ + /* TODO: adapt to FT0M Run 3 and other estimators */ + if (0.001 < p.pt() && p.pt() < 50.0) { + if (p.eta() < 1.0 && -1.0 < p.eta()) { + inelgth0 = true; + } + addTo(p, v0am, 2.8, 5.1); + addTo(p, v0cm, -3.7, -1.7); + addTo(p, cl1m, -1.4, 1.4); + addTo(p, cl1EtaGapM, -1.4, -0.8); + addTo(p, cl1EtaGapM, 0.8, 1.4); + addTo(p, dNchdEta, -0.5, 0.5); + nPart++; + } + break; + default: + break; + } + return true; + } + + template + void extractMultiplicity(const CollisionParticles& particles) + { + multiplicityClass = 105; + multiplicity = 0; + inelgth0 = false; + nPart = 0; + v0am = 0; + v0cm = 0; + cl1m = 0; + cl1EtaGapM = 0; + dNchdEta = 0; + + for (auto const& particle : particles) { + addParticleToMultiplicity(particle); + } + + if (inelgth0) { + if (fhNPartTot != nullptr) { + fhNPartTot->Fill(nPart); + } + if (fhV0Multiplicity != nullptr) { + fhV0Multiplicity->Fill(v0am + v0cm, dNchdEta); + } + if (fhCL1Multiplicity != nullptr) { + fhCL1Multiplicity->Fill(cl1m, dNchdEta); + } + if (fhCL1EtaGapMultiplicity != nullptr) { + fhCL1EtaGapMultiplicity->Fill(cl1EtaGapM, dNchdEta); + } + switch (classestimator) { + case kV0M: + if (fhV0MMultPercentile != nullptr) { + multiplicityClass = fhV0MMultPercentile->GetBinContent(fhV0MMultPercentile->FindFixBin(v0am + v0cm)); + multiplicity = v0am + v0cm; + } + break; + case kCL1: + if (fhCL1MultPercentile != nullptr) { + multiplicityClass = fhCL1MultPercentile->GetBinContent(fhCL1MultPercentile->FindFixBin(cl1m)); + multiplicity = cl1m; + } + break; + case kCL1GAP: + if (fhCL1EtaGapMultPercentile != nullptr) { + multiplicityClass = fhCL1EtaGapMultPercentile->GetBinContent(fhCL1EtaGapMultPercentile->FindFixBin(cl1EtaGapM)); + multiplicity = cl1EtaGapM; + } + break; + default: + break; + } + fhMultiplicity->Fill(multiplicityClass); + } + } +}; + +////////////////////////////////////////////////////////////////////////////// +// The filter class +////////////////////////////////////////////////////////////////////////////// + struct DptDptFilter { struct : ConfigurableGroup { Configurable cfgCCDBUrl{"input_ccdburl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; @@ -172,6 +360,8 @@ struct DptDptFilter { } cfginputfile; Configurable cfgFullDerivedData{"fullderiveddata", false, "Produce the full derived data for external storage. Default false"}; Configurable cfgCentMultEstimator{"centmultestimator", "V0M", "Centrality/multiplicity estimator detector: V0M,CL0,CL1,FV0A,FT0M,FT0A,FT0C,NTPV,NOCM: none. Default V0M"}; + Configurable cfgOccupancyEstimation{"occestimation", "None", "Occupancy estimation: None, Tracks, FT0C. Default None"}; + Configurable cfgMaxOccupancy{"occmax", 1e6f, "Maximum allowed occupancy. Depends on the occupancy estimation"}; Configurable cfgSystem{"syst", "PbPb", "System: pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; Configurable cfgDataType{"datatype", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; Configurable cfgTriggSel{"triggsel", "MB", "Trigger selection: MB,VTXTOFMATCHED,VTXTRDMATCHED,VTXTRDTOFMATCHED,None. Default MB"}; @@ -189,6 +379,8 @@ struct DptDptFilter { Produces acceptedtrueevents; Produces gencollisionsinfo; + Multiplicity multiplicity; + void init(InitContext const&) { using namespace dptdptfilter; @@ -212,9 +404,15 @@ struct DptDptFilter { /* the centrality/multiplicity estimation */ if (doprocessWithoutCent || doprocessWithoutCentDetectorLevel || doprocessWithoutCentGeneratorLevel) { fCentMultEstimator = kNOCM; + } else if (doprocessOnTheFlyGeneratorLevel) { + fCentMultEstimator = kFV0A; } else { fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator); } + /* the occupancy selection */ + fOccupancyEstimation = getOccupancyEstimator(cfgOccupancyEstimation); + fMaxOccupancy = cfgMaxOccupancy; + /* the trigger selection */ fTriggerSelection = getTriggerSelection(cfgTriggSel); traceCollId0 = cfgTraceCollId0; @@ -230,6 +428,10 @@ struct DptDptFilter { if ((fDataType == kData) || (fDataType == kDataNoEvtSel) || (fDataType == kMC)) { /* create the reconstructed data histograms */ + fhEventSelection = new TH1D("EventSelection", ";;counts", knCollisionSelectionFlags, -0.5f, static_cast(knCollisionSelectionFlags) - 0.5f); + for (int ix = 0; ix < knCollisionSelectionFlags; ++ix) { + fhEventSelection->GetXaxis()->SetBinLabel(ix + 1, eventSelectionSteps[ix]); + } /* TODO: proper axes and axes titles according to the system; still incomplete */ std::string multestimator = getCentMultEstimatorName(fCentMultEstimator); if (fSystem > kPbp) { @@ -249,6 +451,7 @@ struct DptDptFilter { fhVertexZA = new TH1F("VertexZA", "Vertex Z; z_{vtx}", zvtxbins, zvtxlow, zvtxup); /* add the hstograms to the output list */ + fOutputList->Add(fhEventSelection); fOutputList->Add(fhCentMultB); fOutputList->Add(fhCentMultA); fOutputList->Add(fhMultB); @@ -271,14 +474,20 @@ struct DptDptFilter { fhTrueVertexZB = new TH1F("TrueVertexZB", "Vertex Z before (truth); z_{vtx}", 60, -15, 15); fhTrueVertexZA = new TH1F("TrueVertexZA", "Vertex Z (truth); z_{vtx}", zvtxbins, zvtxlow, zvtxup); - fhTrueVertexZAA = new TH1F("TrueVertexZAA", "Vertex Z (truth rec associated); z_{vtx}", zvtxbins, zvtxlow, zvtxup); + if (!doprocessOnTheFlyGeneratorLevel) { + fhTrueVertexZAA = new TH1F("TrueVertexZAA", "Vertex Z (truth rec associated); z_{vtx}", zvtxbins, zvtxlow, zvtxup); + } /* add the hstograms to the output list */ fOutputList->Add(fhTrueCentMultB); fOutputList->Add(fhTrueCentMultA); fOutputList->Add(fhTrueVertexZB); fOutputList->Add(fhTrueVertexZA); - fOutputList->Add(fhTrueVertexZAA); + if (doprocessOnTheFlyGeneratorLevel) { + multiplicity.init(fOutputList); + } else { + fOutputList->Add(fhTrueVertexZAA); + } } } @@ -304,7 +513,7 @@ struct DptDptFilter { PROCESS_SWITCH(DptDptFilter, processWithoutCentDetectorLevel, "Process MC detector level without centrality", false); template - void processGenerated(CollisionObject const& mccollision, ParticlesList const& mcparticles, float centormult); + bool processGenerated(CollisionObject const& mccollision, ParticlesList const& mcparticles, float centormult); template void processGeneratorLevel(aod::McCollision const& mccollision, @@ -331,6 +540,10 @@ struct DptDptFilter { aod::CollisionsEvSel const& allcollisions); PROCESS_SWITCH(DptDptFilter, processWithoutCentGeneratorLevel, "Process generated without centrality", false); + void processOnTheFlyGeneratorLevel(aod::McCollision const& mccollision, + aod::McParticles const& mcparticles); + PROCESS_SWITCH(DptDptFilter, processOnTheFlyGeneratorLevel, "Process on the fly generated events", false); + void processVertexGenerated(aod::McCollisions const&); PROCESS_SWITCH(DptDptFilter, processVertexGenerated, "Process vertex generator level", false); }; @@ -349,7 +562,7 @@ void DptDptFilter::processReconstructed(CollisionObject const& collision, Tracks fhVertexZB->Fill(collision.posZ()); uint8_t acceptedevent = uint8_t(false); float centormult = tentativecentmult; - if (IsEvtSelected(collision, centormult)) { + if (isEventSelected(collision, centormult)) { acceptedevent = true; fhCentMultA->Fill(centormult); fhMultA->Fill(mult); @@ -365,6 +578,12 @@ void DptDptFilter::processReconstructed(CollisionObject const& collision, Tracks collisionsinfo(uint8_t(false), 105.0); } } + /* report the event selection */ + for (int iflag = 0; iflag < knCollisionSelectionFlags; ++iflag) { + if (collisionFlags.test(iflag)) { + fhEventSelection->Fill(iflag); + } + } } void DptDptFilter::processWithCent(aod::CollisionEvSelCent const& collision, DptDptFullTracks const& ftracks) @@ -398,12 +617,12 @@ void DptDptFilter::processWithoutCentDetectorLevel(aod::CollisionEvSel const& co } template -void DptDptFilter::processGenerated(CollisionObject const& mccollision, ParticlesList const&, float centormult) +bool DptDptFilter::processGenerated(CollisionObject const& mccollision, ParticlesList const&, float centormult) { using namespace dptdptfilter; uint8_t acceptedevent = uint8_t(false); - if (IsEvtSelected(mccollision, centormult)) { + if (isEventSelected(mccollision, centormult)) { acceptedevent = uint8_t(true); } if (fullDerivedData) { @@ -411,6 +630,7 @@ void DptDptFilter::processGenerated(CollisionObject const& mccollision, Particle } else { gencollisionsinfo(acceptedevent, centormult); } + return static_cast(acceptedevent); } template @@ -429,11 +649,11 @@ void DptDptFilter::processGeneratorLevel(aod::McCollision const& mccollision, } bool processed = false; - for (auto& tmpcollision : collisions) { + for (auto const& tmpcollision : collisions) { if (tmpcollision.has_mcCollision()) { if (tmpcollision.mcCollisionId() == mccollision.globalIndex()) { typename AllCollisions::iterator const& collision = allcollisions.iteratorAt(tmpcollision.globalIndex()); - if (IsEvtSelected(collision, defaultcent)) { + if (isEventSelected(collision, defaultcent)) { fhTrueVertexZAA->Fill((mccollision.posZ())); processGenerated(mccollision, mcparticles, defaultcent); processed = true; @@ -471,13 +691,33 @@ void DptDptFilter::processWithoutCentGeneratorLevel(aod::McCollision const& mcco processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); } +void DptDptFilter::processOnTheFlyGeneratorLevel(aod::McCollision const& mccollision, + aod::McParticles const& mcparticles) +{ + uint8_t acceptedEvent = uint8_t(false); + fhTrueVertexZB->Fill(mccollision.posZ()); + /* we assign a default value for the time being */ + float centormult = 50.0f; + if (isEventSelected(mccollision, centormult)) { + acceptedEvent = true; + multiplicity.extractMultiplicity(mcparticles); + fhTrueVertexZA->Fill((mccollision.posZ())); + centormult = multiplicity.getMultiplicityClass(); + } + if (fullDerivedData) { + acceptedtrueevents(mccollision.bcId(), mccollision.posZ(), acceptedEvent, centormult); + } else { + gencollisionsinfo(acceptedEvent, centormult); + } +} + void DptDptFilter::processVertexGenerated(aod::McCollisions const& mccollisions) { for (aod::McCollision const& mccollision : mccollisions) { fhTrueVertexZB->Fill(mccollision.posZ()); /* we assign a default value */ float centmult = 50.0f; - if (IsEvtSelected(mccollision, centmult)) { + if (isEventSelected(mccollision, centmult)) { fhTrueVertexZA->Fill((mccollision.posZ())); } } @@ -493,10 +733,10 @@ T computeRMS(std::vector& vec) std::vector diff(vec.size()); std::transform(vec.begin(), vec.end(), diff.begin(), [mean](T x) { return x - mean; }); - T sq_sum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0); - T stdev = std::sqrt(sq_sum / vec.size()); + T sqSum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0); + T stdDev = std::sqrt(sqSum / vec.size()); - return stdev; + return stdDev; } struct DptDptFilterTracks { @@ -539,6 +779,7 @@ struct DptDptFilterTracks { "PID criteria for muons"}; OutputObj fOutput{"DptDptFilterTracksInfo", OutputObjHandlingPolicy::AnalysisObject}; + Service fPDG; PIDSpeciesSelection pidselector; bool checkAmbiguousTracks = false; @@ -582,7 +823,6 @@ struct DptDptFilterTracks { fSystem = getSystemType(tmpstr); getTaskOptionValue(initContext, "dpt-dpt-filter", "datatype", tmpstr, false); fDataType = getDataType(tmpstr); - fPDG = TDatabasePDG::Instance(); /* required ambiguous tracks checks? */ if (dofilterDetectorLevelWithoutPIDAmbiguous || dofilterDetectorLevelWithPIDAmbiguous || dofilterDetectorLevelWithFullPIDAmbiguous || @@ -594,10 +834,10 @@ struct DptDptFilterTracks { auto insertInPIDselector = [&](auto cfg, uint sp) { if (cfg.value.mUseIt) { if (cfg.value.mExclude) { - pidselector.AddExclude(sp, &(cfg.value)); + pidselector.addExcludedSpecies(sp, &(cfg.value)); LOGF(info, "Incorporated species: %s to PID selection for exclusion", pidselector.spnames[sp].data()); } else { - pidselector.Add(sp, &(cfg.value)); + pidselector.addSpecies(sp, &(cfg.value)); LOGF(info, "Incorporated species: %s to PID selection", pidselector.spnames[sp].data()); } } @@ -614,9 +854,9 @@ struct DptDptFilterTracks { fOutput.setObject(fOutputList); /* incorporate configuration parameters to the output */ - fOutputList->Add(new TParameter("TrackType", cfgTrackType, 'f')); - fOutputList->Add(new TParameter("TrackOneCharge", 1, 'f')); - fOutputList->Add(new TParameter("TrackTwoCharge", -1, 'f')); + fOutputList->Add(new TParameter("TrackType", cfgTrackType, 'f')); + fOutputList->Add(new TParameter("TrackOneCharge", 1, 'f')); + fOutputList->Add(new TParameter("TrackTwoCharge", -1, 'f')); if ((fDataType == kData) || (fDataType == kDataNoEvtSel) || (fDataType == kMC)) { /* create the reconstructed data histograms */ @@ -884,12 +1124,12 @@ struct DptDptFilterTracks { if (!fullDerivedData) { tracksinfo.reserve(tracks.size()); } - for (auto collision : collisions) { + for (auto const& collision : collisions) { if (collision.collisionaccepted()) { ncollaccepted++; } } - for (auto track : tracks) { + for (auto const& track : tracks) { int8_t pid = -1; if (track.has_collision() && (track.template collision_as>()).collisionaccepted()) { pid = selectTrackAmbiguousCheck(collisions, track); @@ -935,16 +1175,17 @@ struct DptDptFilterTracks { gentracksinfo.reserve(particles.size()); } - for (auto gencoll : gencollisions) { + for (auto const& gencoll : gencollisions) { if (gencoll.collisionaccepted()) { acceptedcollisions++; } } - for (auto& particle : particles) { - float charge = getCharge(particle); - + for (auto const& particle : particles) { int8_t pid = -1; + auto pdgpart = fPDG->GetParticle(particle.pdgCode()); + float charge = pdgpart != nullptr ? getCharge(pdgpart->Charge()) : 0; + if (charge != 0) { if (particle.has_mcCollision() && (particle.template mcCollision_as>()).collisionaccepted()) { auto mccollision = particle.template mcCollision_as>(); @@ -1114,7 +1355,7 @@ int8_t DptDptFilterTracks::selectTrack(TrackObject const& track) /* track selection */ int8_t sp = -127; - if (AcceptTrack(track)) { + if (acceptTrack(track)) { /* the track has been accepted */ /* let's identify it */ sp = trackIdentification(track); @@ -1169,22 +1410,22 @@ int8_t DptDptFilterTracks::selectTrackAmbiguousCheck(CollisionObjects const& col } } - float multiplicityclass = (track.template collision_as()).centmult(); + float multiplicityClass = (track.template collision_as()).centmult(); if (ambiguoustrack) { /* keep track of ambiguous tracks */ - fhAmbiguousTrackType->Fill(ambtracktype, multiplicityclass); - fhAmbiguousTrackPt->Fill(track.pt(), multiplicityclass); - fhAmbiguityDegree->Fill(zvertexes.size(), multiplicityclass); + fhAmbiguousTrackType->Fill(ambtracktype, multiplicityClass); + fhAmbiguousTrackPt->Fill(track.pt(), multiplicityClass); + fhAmbiguityDegree->Fill(zvertexes.size(), multiplicityClass); if (ambtracktype == 2) { - fhCompatibleCollisionsZVtxRms->Fill(-computeRMS(zvertexes), multiplicityclass); + fhCompatibleCollisionsZVtxRms->Fill(-computeRMS(zvertexes), multiplicityClass); } else { - fhCompatibleCollisionsZVtxRms->Fill(computeRMS(zvertexes), multiplicityclass); + fhCompatibleCollisionsZVtxRms->Fill(computeRMS(zvertexes), multiplicityClass); } return -1; } else { if (checkAmbiguousTracks) { /* feedback of no ambiguous tracks only if checks required */ - fhAmbiguousTrackType->Fill(ambtracktype, multiplicityclass); + fhAmbiguousTrackType->Fill(ambtracktype, multiplicityClass); } return selectTrack(track); } @@ -1266,14 +1507,15 @@ inline int8_t DptDptFilterTracks::identifySecFromMaterialParticle(ParticleObject template inline int8_t DptDptFilterTracks::selectParticle(ParticleObject const& particle, MCCollisionObject const& mccollision) { - float charge = getCharge(particle); int8_t sp = -127; + auto pdgpart = fPDG->GetParticle(particle.pdgCode()); + float charge = pdgpart != nullptr ? getCharge(pdgpart->Charge()) : 0; if (charge != 0) { /* before particle selection */ fillParticleHistosBeforeSelection(particle, mccollision, charge); /* track selection */ - if (AcceptParticle(particle, mccollision)) { + if (acceptParticle(particle, mccollision)) { /* the particle has been accepted */ /* the particle is only accepted if it is a primary particle */ /* let's identify the particle */ @@ -1310,14 +1552,14 @@ void DptDptFilterTracks::fillParticleHistosBeforeSelection(ParticleObject const& fhTruePtNegB->Fill(particle.pt()); } - float dcaxy = TMath::Sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); + float dcaxy = std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + + (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); if (traceDCAOutliers.mDoIt && (traceDCAOutliers.mLowValue < dcaxy) && (dcaxy < traceDCAOutliers.mUpValue)) { fhTrueDCAxyBid->Fill(TString::Format("%d", particle.pdgCode()).Data(), 1.0); } - fhTrueDCAxyB->Fill(TMath::Sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY()))); + fhTrueDCAxyB->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + + (particle.vy() - collision.posY()) * (particle.vy() - collision.posY()))); fhTrueDCAzB->Fill((particle.vz() - collision.posZ())); } @@ -1326,16 +1568,16 @@ void DptDptFilterTracks::fillParticleHistosAfterSelection(ParticleObject const& { fhTrueEtaA->Fill(particle.eta()); fhTruePhiA->Fill(particle.phi()); - float dcaxy = TMath::Sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); + float dcaxy = std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + + (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); if (traceDCAOutliers.mDoIt && (traceDCAOutliers.mLowValue < dcaxy) && (dcaxy < traceDCAOutliers.mUpValue)) { LOGF(info, "DCAxy outlier: Particle with index %d and pdg code %d assigned to MC collision %d, pT: %f, phi: %f, eta: %f", particle.globalIndex(), particle.pdgCode(), particle.mcCollisionId(), particle.pt(), particle.phi(), particle.eta()); LOGF(info, " With status %d and flags %0X", particle.statusCode(), particle.flags()); } - fhTrueDCAxyA->Fill(TMath::Sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY()))); + fhTrueDCAxyA->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + + (particle.vy() - collision.posY()) * (particle.vy() - collision.posY()))); fhTrueDCAzA->Fill((particle.vz() - collision.posZ())); fhTruePA[sp]->Fill(particle.p()); fhTruePtA[sp]->Fill(particle.pt()); diff --git a/PWGCF/TableProducer/dptdptfilter.h b/PWGCF/TableProducer/dptdptfilter.h index b4a6f2859b8..40cb60c13fb 100644 --- a/PWGCF/TableProducer/dptdptfilter.h +++ b/PWGCF/TableProducer/dptdptfilter.h @@ -8,15 +8,20 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. + +/// \file dptdptfilter.h +/// \brief Filters collisions and tracks according to selection criteria +/// \author victor.gonzalez.sebastian@gmail.com + #ifndef PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_ #define PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_ #include #include #include +#include #include #include -#include #include #include #include @@ -106,6 +111,35 @@ enum TriggerSelectionType { knEventSelection ///< number of triggers for event selection }; +/// \enum OccupancyEstimationType +/// \brief The type of occupancy estimation +enum OccupancyEstimationType { + kNOOCC = 0, ///< do not use occupancy estimation + kTRACKSOCC, ///< occupancy estimated using tracks + kFT0COCC, ///< occupancy estimated using the FT0C + knOccupancyEstimators ///< the number of occupancy estimators +}; + +/// \enum CollisionSelectionFlags +/// \brief The different criteria for selecting/rejecting collisions +enum CollisionSelectionFlags { + kIN = 0, ///< new unhandled, yet, event + kMBBIT, ///< minimum bias + kINT7BIT, ///< INT7 Run 1/2 + kSEL7BIT, ///< Sel7 Run 1/2 + kSEL8BIT, ///< Sel8 + kNOSAMEBUNCHPUPBIT, ///< no same bunch pile up + kISGOODZVTXFT0VSPVBIT, ///< good zvtx FT0 vs PV + kISVERTEXITSTPCBIT, ///< is vertex TPC and ITS + kISVERTEXTOFMATCHEDBIT, ///< vertex contributor with TOF matched + kISVERTEXTRDMATCHEDBIT, ///< vertex contributor with TRD matche + kOCCUPANCYBIT, ///< occupancy within limits + kCENTRALITYBIT, ///< centrality cut passed + kZVERTEXBIT, ///< zvtx cut passed + kSELECTED, ///< the event has passed all selections + knCollisionSelectionFlags ///< number of flags +}; + /// \enum StrongDebugging /// \brief Enable a per track information debugging. Only for local analyses enum StrongDebugging { @@ -123,6 +157,11 @@ std::ofstream debugstream; //============================================================================================ float overallminp = 0.0f; +//============================================================================================ +// The collision selection flags and configuration objects +//============================================================================================ +std::bitset<32> collisionFlags; + //============================================================================================ // The DptDptFilter configuration objects //============================================================================================ @@ -139,18 +178,18 @@ bool onlyInOneSide = false; /* select only tracks that don't cross the TPC centr /* selection criteria from PWGMM */ // default quality criteria for tracks with ITS contribution -static constexpr o2::aod::track::TrackSelectionFlags::flagtype trackSelectionITS = +static constexpr o2::aod::track::TrackSelectionFlags::flagtype TrackSelectionITS = o2::aod::track::TrackSelectionFlags::kITSNCls | o2::aod::track::TrackSelectionFlags::kITSChi2NDF | o2::aod::track::TrackSelectionFlags::kITSHits; // default quality criteria for tracks with TPC contribution -static constexpr o2::aod::track::TrackSelectionFlags::flagtype trackSelectionTPC = +static constexpr o2::aod::track::TrackSelectionFlags::flagtype TrackSelectionTPC = o2::aod::track::TrackSelectionFlags::kTPCNCls | o2::aod::track::TrackSelectionFlags::kTPCCrossedRowsOverNCls | o2::aod::track::TrackSelectionFlags::kTPCChi2NDF; // default standard DCA cuts -static constexpr o2::aod::track::TrackSelectionFlags::flagtype trackSelectionDCA = +static constexpr o2::aod::track::TrackSelectionFlags::flagtype TrackSelectionDCA = o2::aod::track::TrackSelectionFlags::kDCAz | o2::aod::track::TrackSelectionFlags::kDCAxy; int tracktype = 1; @@ -278,7 +317,7 @@ inline void initializeTrackSelection(const TrackSelectionTuneCfg& tune) break; } if (tune.mUseIt) { - for (auto filter : trackFilters) { + for (auto const& filter : trackFilters) { if (tune.mUseTPCclusters) { filter->SetMinNClustersTPC(tune.mTPCclusters); } @@ -302,6 +341,8 @@ SystemType fSystem = kNoSystem; DataType fDataType = kData; CentMultEstimatorType fCentMultEstimator = kV0M; TriggerSelectionType fTriggerSelection = kMB; +OccupancyEstimationType fOccupancyEstimation = kNOOCC; /* the occupancy estimator to use */ +float fMaxOccupancy = 1e6f; /* the maximum allowed occupancy */ /* adaptations for the pp nightly checks */ analysis::CheckRangeCfg traceDCAOutliers; @@ -311,8 +352,6 @@ float particleMaxDCAxy = 999.9f; float particleMaxDCAZ = 999.9f; bool traceCollId0 = false; -TDatabasePDG* fPDG = nullptr; - inline TriggerSelectionType getTriggerSelection(std::string const& triggstr) { if (triggstr.empty() || triggstr == "MB") { @@ -449,6 +488,20 @@ inline std::string getCentMultEstimatorName(CentMultEstimatorType est) } } +inline OccupancyEstimationType getOccupancyEstimator(const std::string& estimator) +{ + if (estimator == "None") { + return kNOOCC; + } else if (estimator == "Tracks") { + return kTRACKSOCC; + } else if (estimator == "FT0C") { + return kFT0COCC; + } else { + LOGF(fatal, "Occupancy estimator %s not supported yet", estimator.c_str()); + return kNOOCC; + } +} + ////////////////////////////////////////////////////////////////////////////////// /// Trigger selection ////////////////////////////////////////////////////////////////////////////////// @@ -469,17 +522,21 @@ inline bool triggerSelectionReco(CollisionObject const& collision) switch (fDataType) { case kData: if (collision.alias_bit(kINT7)) { + collisionFlags.set(kINT7BIT); if (collision.sel7()) { trigsel = true; + collisionFlags.set(kSEL7BIT); } } break; case kMC: if (collision.sel7()) { trigsel = true; + collisionFlags.set(kSEL7BIT); } break; default: + collisionFlags.set(kMBBIT); trigsel = true; break; } @@ -502,6 +559,14 @@ inline bool triggerSelectionReco(CollisionObject const& collision) coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && coll.selection_bit(aod::evsel::kIsVertexITSTPC); }; + auto setCollisionFlags = [](auto& flags, auto const& coll) { + flags.set(kSEL8BIT, coll.sel8() != 0); + flags.set(kNOSAMEBUNCHPUPBIT, coll.selection_bit(aod::evsel::kNoSameBunchPileup)); + flags.set(kISGOODZVTXFT0VSPVBIT, coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)); + flags.set(kISVERTEXITSTPCBIT, coll.selection_bit(aod::evsel::kIsVertexITSTPC)); + flags.set(kISVERTEXTOFMATCHEDBIT, coll.selection_bit(aod::evsel::kIsVertexTOFmatched)); + flags.set(kISVERTEXTRDMATCHEDBIT, coll.selection_bit(aod::evsel::kIsVertexTRDmatched)); + }; switch (fTriggerSelection) { case kMB: if (run3Accepted(collision)) { @@ -549,6 +614,7 @@ inline bool triggerSelectionReco(CollisionObject const& collision) default: break; } + setCollisionFlags(collisionFlags, collision); } break; default: break; @@ -704,6 +770,7 @@ inline bool centralitySelectionMult(CollisionObject collision, float& centmult) float mult = getCentMultPercentile(collision); if (mult < 100 && 0 < mult) { centmult = mult; + collisionFlags.set(kCENTRALITYBIT); return true; } return false; @@ -718,6 +785,7 @@ inline bool centralitySelectionNoMult(CollisionObject const&, float& centmult) case kNOCM: centmult = 50.0; centmultsel = true; + collisionFlags.set(kCENTRALITYBIT); break; default: break; @@ -786,15 +854,108 @@ inline bool centralitySelection(aod::McCollision const&, float } } +////////////////////////////////////////////////////////////////////////////////// +/// Occupancy selection +////////////////////////////////////////////////////////////////////////////////// + +/// \brief get the collision occupancy +template +inline bool selectOnOccupancy(CollisionObject collision) +{ + switch (fOccupancyEstimation) { + case kNOOCC: + collisionFlags.set(kOCCUPANCYBIT); + return true; + case kTRACKSOCC: + if (collision.trackOccupancyInTimeRange() < fMaxOccupancy) { + collisionFlags.set(kOCCUPANCYBIT); + return true; + } else { + return false; + } + case kFT0COCC: + if (collision.ft0cOccupancyInTimeRange() < fMaxOccupancy) { + collisionFlags.set(kOCCUPANCYBIT); + return true; + } else { + return false; + } + default: + return false; + } +} + +/// \brief Occupancy selection by default: unknown subscribed collision table +template +inline bool occupancySelection(CollisionObject const&) +{ + LOGF(fatal, "Occupancy selection not implemented for this kind of collisions"); + return false; +} + +/// \brief Occupancy selection for reconstructed and detector level collision tables with centrality/multiplicity information +template <> +inline bool occupancySelection(aod::CollisionEvSelCent const& collision) +{ + return selectOnOccupancy(collision); +} + +/// \brief Occupancy selection for reconstructed and detector level collision tables with Run 2 centrality/multiplicity information +template <> +inline bool occupancySelection(aod::CollisionEvSelRun2Cent const& collision) +{ + return selectOnOccupancy(collision); +} + +/// \brief Occupancy selection for reconstructed and detector level collision tables without centrality/multiplicity information +template <> +inline bool occupancySelection(aod::CollisionEvSel const& collision) +{ + return selectOnOccupancy(collision); +} + +/// \brief Occupancy selection for detector level collision tables without centrality/multiplicity +template <> +inline bool occupancySelection::iterator>(soa::Join::iterator const& collision) +{ + return selectOnOccupancy(collision); +} + +/// \brief Occupancy selection for detector level collision tables with centrality/multiplicity +template <> +inline bool occupancySelection::iterator>(soa::Join::iterator const& collision) +{ + return selectOnOccupancy(collision); +} + +/// \brief Occupancy selection for detector level collision tables with Run 2 centrality/multiplicity +template <> +inline bool occupancySelection::iterator>(soa::Join::iterator const& collision) +{ + return selectOnOccupancy(collision); +} + +/// \brief Occupancy selection for generator level collision table +template <> +inline bool occupancySelection(aod::McCollision const&) +{ + return true; +} + ////////////////////////////////////////////////////////////////////////////////// /// Event selection ////////////////////////////////////////////////////////////////////////////////// template -inline bool IsEvtSelected(CollisionObject const& collision, float& centormult) +inline bool isEventSelected(CollisionObject const& collision, float& centormult) { + collisionFlags.reset(); + collisionFlags.set(kIN); + bool trigsel = triggerSelection(collision); + bool occupancysel = occupancySelection(collision); + bool zvtxsel = false; /* TODO: vertex quality checks */ if (zvtxlow < collision.posZ() && collision.posZ() < zvtxup) { @@ -802,15 +963,23 @@ inline bool IsEvtSelected(CollisionObject const& collision, float& centormult) if (collision.posZ() != 0.0) { /* if only one side, we accept collisions which have zvtx different than zero */ zvtxsel = true; + collisionFlags.set(kZVERTEXBIT); } } else { zvtxsel = true; + collisionFlags.set(kZVERTEXBIT); } } bool centmultsel = centralitySelection(collision, centormult); - return trigsel && zvtxsel && centmultsel; + bool accepted = trigsel && occupancysel && zvtxsel && centmultsel; + + if (accepted) { + collisionFlags.set(kSELECTED); + } + + return accepted; } ////////////////////////////////////////////////////////////////////////////////// @@ -829,11 +998,11 @@ inline bool matchTrackType(TrackObject const& track) // (track.passedDCAxy && track.passedDCAz && track.passedGoldenChi2) && // (track.passedITSNCls && track.passedITSChi2NDF && track.passedITSHits) && // (!track.hasTPC || (track.passedTPCNCls && track.passedTPCChi2NDF && track.passedTPCCrossedRowsOverNCls)); - return track.hasITS() && ((track.trackCutFlag() & trackSelectionITS) == trackSelectionITS) && - (!track.hasTPC() || ((track.trackCutFlag() & trackSelectionTPC) == trackSelectionTPC)) && - ((track.trackCutFlag() & trackSelectionDCA) == trackSelectionDCA); + return track.hasITS() && ((track.trackCutFlag() & TrackSelectionITS) == TrackSelectionITS) && + (!track.hasTPC() || ((track.trackCutFlag() & TrackSelectionTPC) == TrackSelectionTPC)) && + ((track.trackCutFlag() & TrackSelectionDCA) == TrackSelectionDCA); } else { - for (auto filter : trackFilters) { + for (auto const& filter : trackFilters) { if (filter->IsSelected(track)) { /* additional track cuts if needed */ auto checkDca2Dcut = [&](auto const& track) { @@ -870,7 +1039,7 @@ inline bool matchTrackType(TrackObject const& track) /// \param track the track of interest /// \return true if the track is in the acceptance, otherwise false template -inline bool InTheAcceptance(TrackObject const& track) +inline bool inTheAcceptance(TrackObject const& track) { /* the side on which the collision happened */ float side = track.template collision_as().posZ(); @@ -912,9 +1081,9 @@ inline bool InTheAcceptance(TrackObject const& track) /// \param track the track of interest /// \return true if the track is accepted, otherwise false template -inline bool AcceptTrack(TrackObject const& track) +inline bool acceptTrack(TrackObject const& track) { - if (InTheAcceptance(track)) { + if (inTheAcceptance(track)) { if (matchTrackType(track)) { return true; } @@ -925,7 +1094,7 @@ inline bool AcceptTrack(TrackObject const& track) template void exploreMothers(ParticleObject& particle, MCCollisionObject& collision) { - for (auto& m : particle.template mothers_as()) { + for (const auto& m : particle.template mothers_as()) { LOGF(info, " mother index: %d", m.globalIndex()); LOGF(info, " Tracking back mother"); LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", m.mcCollisionId(), collision.globalIndex()); @@ -936,14 +1105,9 @@ void exploreMothers(ParticleObject& particle, MCCollisionObject& collision) } } -template -inline float getCharge(ParticleObject& particle) +inline float getCharge(float pdgCharge) { - float charge = 0.0; - TParticlePDG* pdgparticle = fPDG->GetParticle(particle.pdgCode()); - if (pdgparticle != nullptr) { - charge = (pdgparticle->Charge() / 3 >= 1) ? 1.0 : ((pdgparticle->Charge() / 3 <= -1) ? -1.0 : 0); - } + float charge = (pdgCharge / 3 >= 1) ? 1.0 : ((pdgCharge / 3 <= -1) ? -1.0 : 0); return charge; } @@ -951,22 +1115,20 @@ inline float getCharge(ParticleObject& particle) /// \param track the particle of interest /// \return `true` if the particle is accepted, `false` otherwise template -inline bool AcceptParticle(ParticleObject& particle, MCCollisionObject const&) +inline bool acceptParticle(ParticleObject& particle, MCCollisionObject const&) { /* overall momentum cut */ if (!(overallminp < particle.p())) { return false; } - float charge = getCharge(particle); - if (particle.isPhysicalPrimary()) { if ((particle.mcCollisionId() == 0) && traceCollId0) { LOGF(info, "Particle %d passed isPhysicalPrimary", particle.globalIndex()); } if (ptlow < particle.pt() && particle.pt() < ptup && etalow < particle.eta() && particle.eta() < etaup) { - return (charge != 0) ? true : false; + return true; } } else { if ((particle.mcCollisionId() == 0) && traceCollId0) { @@ -1026,7 +1188,7 @@ struct PIDSpeciesSelection { reportadjdetectorwithcharge(tpcnsigmasshiftneg, "TPC", "M"); reportadjdetectorwithcharge(tofnsigmasshiftneg, "TOF", "M"); } - void Add(uint8_t sp, o2::analysis::TrackSelectionPIDCfg* incfg) + void addSpecies(uint8_t sp, o2::analysis::TrackSelectionPIDCfg* incfg) { o2::analysis::TrackSelectionPIDCfg* cfg = new o2::analysis::TrackSelectionPIDCfg(*incfg); config.push_back(cfg); @@ -1041,7 +1203,7 @@ struct PIDSpeciesSelection { LOGF(info, " maxTOF nsigmas: el: %.2f, mu: %.2f, pi: %.2f, ka: %.2f, pr: %.2f", last->mMaxNSigmasTOF[0], last->mMaxNSigmasTOF[1], last->mMaxNSigmasTOF[2], last->mMaxNSigmasTOF[3], last->mMaxNSigmasTOF[4]); LOGF(info, " %.1f < pT < %.1f", last->mPtMin, last->mPtMax); } - void AddExclude(uint8_t sp, const o2::analysis::TrackSelectionPIDCfg* incfg) + void addExcludedSpecies(uint8_t sp, const o2::analysis::TrackSelectionPIDCfg* incfg) { o2::analysis::TrackSelectionPIDCfg* cfg = new o2::analysis::TrackSelectionPIDCfg(*incfg); configexclude.push_back(cfg); @@ -1070,10 +1232,10 @@ struct PIDSpeciesSelection { }; auto outnsigmasdebug = [&]() { if constexpr (outdebug != 0) { - for (auto tpcn : tpcnsigmas) { + for (auto const& tpcn : tpcnsigmas) { debuginfo += TString::Format("%.4f,", tpcn); } - for (auto tofn : tofnsigmas) { + for (auto const& tofn : tofnsigmas) { debuginfo += TString::Format("%.4f,", tofn); } } diff --git a/PWGCF/TableProducer/filterCorrelations.cxx b/PWGCF/TableProducer/filterCorrelations.cxx index 9cbde25a20c..5ae37e93384 100644 --- a/PWGCF/TableProducer/filterCorrelations.cxx +++ b/PWGCF/TableProducer/filterCorrelations.cxx @@ -60,9 +60,12 @@ struct FilterCF { O2_DEFINE_CONFIGURABLE(cfgCutMCEta, float, 0.8f, "Eta range for particles") O2_DEFINE_CONFIGURABLE(cfgVerbosity, int, 1, "Verbosity level (0 = major, 1 = per collision)") O2_DEFINE_CONFIGURABLE(cfgTrigger, int, 7, "Trigger choice: (0 = none, 7 = sel7, 8 = sel8, 9 = sel8 + kNoSameBunchPileup + kIsGoodZvtxFT0vsPV, 10 = sel8 before April, 2024, 11 = sel8 for MC, 12 = sel8 with low occupancy cut)") + O2_DEFINE_CONFIGURABLE(cfgMinOcc, int, 0, "minimum occupancy selection") + O2_DEFINE_CONFIGURABLE(cfgMaxOcc, int, 3000, "maximum occupancy selection") O2_DEFINE_CONFIGURABLE(cfgCollisionFlags, uint16_t, aod::collision::CollisionFlagsRun2::Run2VertexerTracks, "Request collision flags if non-zero (0 = off, 1 = Run2VertexerTracks)") O2_DEFINE_CONFIGURABLE(cfgTransientTables, bool, false, "Output transient tables for collision and track IDs") O2_DEFINE_CONFIGURABLE(cfgTrackSelection, int, 0, "Type of track selection (0 = Run 2/3 without systematics | 1 = Run 3 with systematics)") + O2_DEFINE_CONFIGURABLE(cfgMinMultiplicity, float, -1, "Minimum multiplicity considered for filtering (if value positive)") // Filters and input definitions Filter collisionZVtxFilter = nabs(aod::collision::posZ) < cfgCutVertex; @@ -92,22 +95,26 @@ struct FilterCF { template bool keepCollision(TCollision& collision) { + bool isMultSelected = false; + if (collision.multiplicity() >= cfgMinMultiplicity) + isMultSelected = true; + if (cfgTrigger == 0) { return true; } else if (cfgTrigger == 7) { - return collision.alias_bit(kINT7) && collision.sel7(); + return isMultSelected && collision.alias_bit(kINT7) && collision.sel7(); } else if (cfgTrigger == 8) { - return collision.sel8(); + return isMultSelected && collision.sel8(); } else if (cfgTrigger == 9) { // relevant only for Pb-Pb - return collision.sel8() && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV); + return isMultSelected && collision.sel8() && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV); } else if (cfgTrigger == 10) { // TVX trigger only (sel8 selection before April, 2024) - return collision.selection_bit(aod::evsel::kIsTriggerTVX); + return isMultSelected && collision.selection_bit(aod::evsel::kIsTriggerTVX); } else if (cfgTrigger == 11) { // sel8 selection for MC - return collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder); + return isMultSelected && collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder); } else if (cfgTrigger == 12) { // relevant only for Pb-Pb with occupancy cuts and rejection of the collisions which have other events nearby int occupancy = collision.trackOccupancyInTimeRange(); - if (occupancy >= 0 && occupancy < 500) - return collision.sel8() && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && collision.selection_bit(aod::evsel::kNoCollInTimeRangeStandard); + if (occupancy >= cfgMinOcc && occupancy < cfgMaxOcc) + return isMultSelected && collision.sel8() && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && collision.selection_bit(aod::evsel::kNoCollInTimeRangeStandard); else return false; } diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index d6e0e94752b..850cdd4d455 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -8,7 +8,15 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. + +/// \file correlations.cxx +/// \brief task for the correlation calculations with CF-filtered tracks for O2 analysis +/// \author Jan Fiete Grosse-Oetringhaus , Jasper Parkkila +// o2-linter: disable=name/workflow-file + #include +#include +#include #include #include @@ -25,6 +33,7 @@ #include "Framework/HistogramRegistry.h" #include "Framework/RunningWorkflowInfo.h" #include "CommonConstants/MathConstants.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -53,7 +62,7 @@ using namespace constants::math; // cfcorreff::Correction); // } // namespace o2::aod -static constexpr float cfgPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; +static constexpr float kCfgPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; struct CorrelationTask { SliceCache cache; @@ -74,7 +83,7 @@ struct CorrelationTask { O2_DEFINE_CONFIGURABLE(cfgCentBinsForMC, int, 0, "0 = OFF and 1 = ON for data like multiplicity/centrality bins for MC steps"); O2_DEFINE_CONFIGURABLE(cfgTrackBitMask, uint8_t, 0, "BitMask for track selection systematics; refer to the enum TrackSelectionCuts in filtering task"); // Suggested values: Photon: 0.004; K0 and Lambda: 0.005 - Configurable> cfgPairCut{"cfgPairCut", {cfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Pair cuts on various particles"}; + Configurable> cfgPairCut{"cfgPairCut", {kCfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Pair cuts on various particles"}; O2_DEFINE_CONFIGURABLE(cfgEfficiencyTrigger, std::string, "", "CCDB path to efficiency object for trigger particles") O2_DEFINE_CONFIGURABLE(cfgEfficiencyAssociated, std::string, "", "CCDB path to efficiency object for associated particles") @@ -85,6 +94,7 @@ struct CorrelationTask { O2_DEFINE_CONFIGURABLE(cfgDecayParticleMask, int, 0, "Selection bitmask for the decay particles: 0 = no selection") O2_DEFINE_CONFIGURABLE(cfgMassAxis, int, 0, "Use invariant mass axis (0 = OFF, 1 = ON)") + O2_DEFINE_CONFIGURABLE(cfgMcTriggerPDGs, std::vector, {}, "MC PDG codes to use exclusively as trigger particles and exclude from associated particles. Empty = no selection.") ConfigurableAxis axisVertex{"axisVertex", {7, -7, 7}, "vertex axis for histograms"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; @@ -103,7 +113,7 @@ struct CorrelationTask { // This filter is applied to AOD and derived data (column names are identical) Filter collisionZVtxFilter = nabs(aod::collision::posZ) < cfgCutVertex; // This filter is only applied to AOD - Filter collisionVertexTypeFilter = (aod::collision::flags & (uint16_t)aod::collision::CollisionFlagsRun2::Run2VertexerTracks) == (uint16_t)aod::collision::CollisionFlagsRun2::Run2VertexerTracks; + Filter collisionVertexTypeFilter = (aod::collision::flags & static_cast(aod::collision::CollisionFlagsRun2::Run2VertexerTracks)) == static_cast(aod::collision::CollisionFlagsRun2::Run2VertexerTracks); // Track filters Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPt) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)); @@ -134,22 +144,25 @@ struct CorrelationTask { Service ccdb; - using aodCollisions = soa::Filtered>; - using aodTracks = soa::Filtered>; + using AodCollisions = soa::Filtered>; + using AodTracks = soa::Filtered>; - using derivedTracks = soa::Filtered; - using derivedCollisions = soa::Filtered; + using DerivedCollisions = soa::Filtered; + using DerivedTracks = soa::Filtered; void init(o2::framework::InitContext&) { registry.add("yields", "multiplicity/centrality vs pT vs eta", {HistType::kTH3F, {{100, 0, 100, "/multiplicity/centrality"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("etaphi", "multiplicity/centrality vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity/centrality"}, {100, -2, 2, "#eta"}, {200, 0, 2 * M_PI, "#varphi"}}}); - if (doprocessSame2ProngDerived || doprocessMixed2ProngDerived) { + registry.add("etaphi", "multiplicity/centrality vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity/centrality"}, {100, -2, 2, "#eta"}, {200, 0, o2::constants::math::TwoPI, "#varphi"}}}); + if (doprocessSame2ProngDerived || doprocessMixed2ProngDerived || doprocessSame2Prong2Prong) { registry.add("yieldsTrigger", "multiplicity/centrality vs pT vs eta (triggers)", {HistType::kTH3F, {{100, 0, 100, "/multiplicity/centrality"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("etaphiTrigger", "multiplicity/centrality vs eta vs phi (triggers)", {HistType::kTH3F, {{100, 0, 100, "multiplicity/centrality"}, {100, -2, 2, "#eta"}, {200, 0, 2 * M_PI, "#varphi"}}}); + registry.add("etaphiTrigger", "multiplicity/centrality vs eta vs phi (triggers)", {HistType::kTH3F, {{100, 0, 100, "multiplicity/centrality"}, {100, -2, 2, "#eta"}, {200, 0, o2::constants::math::TwoPI, "#varphi"}}}); registry.add("invMass", "2-prong invariant mass (GeV/c^2)", {HistType::kTH3F, {axisInvMassHistogram, axisPtTrigger, axisMultiplicity}}); + if (doprocessSame2Prong2Prong) { + registry.add("invMassTwoPart", "2D 2-prong invariant mass (GeV/c^2)", {HistType::kTHnSparseF, {axisInvMassHistogram, axisInvMassHistogram, axisPtTrigger, axisPtAssoc, axisMultiplicity}}); + } } - registry.add("multiplicity", "multiplicity vs track count", {HistType::kTH1F, {{1000, 0, 100, "/multiplicity/centrality"}}}); + registry.add("multiplicity", "event multiplicity", {HistType::kTH1F, {{1000, 0, 100, "/multiplicity/centrality"}}}); const int maxMixBin = AxisSpec(axisMultiplicity).getNbins() * AxisSpec(axisVertex).getNbins(); registry.add("eventcount_same", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); @@ -182,10 +195,17 @@ struct CorrelationTask { {axisPtEfficiency, "p_{T} (GeV/c)"}, {axisVertexEfficiency, "z-vtx (cm)"}}; std::vector userAxis; - if (cfgMassAxis != 0) + std::vector userMixingAxis; + + if (cfgMassAxis != 0) { + userAxis.emplace_back(axisInvMass, "m (GeV/c^2)"); + userMixingAxis.emplace_back(axisInvMass, "m (GeV/c^2)"); + } + if (doprocessSame2Prong2Prong) userAxis.emplace_back(axisInvMass, "m (GeV/c^2)"); + same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); - mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); + mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userMixingAxis)); same->setTrackEtaCut(cfgCutEta); mixed->setTrackEtaCut(cfgCutEta); @@ -223,25 +243,42 @@ struct CorrelationTask { void fillQA(const TCollision& /*collision*/, float multiplicity, const TTracks& tracks) { registry.fill(HIST("multiplicity"), multiplicity); - for (auto& track1 : tracks) { + for (const auto& track1 : tracks) { registry.fill(HIST("yields"), multiplicity, track1.pt(), track1.eta()); registry.fill(HIST("etaphi"), multiplicity, track1.eta(), track1.phi()); } } template - using hasInvMass = decltype(std::declval().invMass()); + using HasInvMass = decltype(std::declval().invMass()); + template + using HasPDGCode = decltype(std::declval().pdgCode()); template void fillQA(const TCollision& collision, float multiplicity, const TTracks1& tracks1, const TTracks2& tracks2) { - for (auto& track1 : tracks1) { - if constexpr (std::experimental::is_detected::value) { - if constexpr (std::experimental::is_detected::value) { - if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << (uint32_t)track1.decay())) == 0u) + for (const auto& track1 : tracks1) { + if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) continue; } registry.fill(HIST("invMass"), track1.invMass(), track1.pt(), multiplicity); + for (const auto& track2 : tracks2) { + if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) { + if (doprocessSame2Prong2Prong) { + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) + continue; + if ((track1.decay() != 0) || (track2.decay() != 1)) // D0 in trk1, D0bar in trk2 + continue; + registry.fill(HIST("invMassTwoPart"), track1.invMass(), track2.invMass(), track1.pt(), track2.pt(), multiplicity); + } + } + } + } + if constexpr (std::experimental::is_detected::value) { + if (!cfgMcTriggerPDGs->empty() && std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), track1->pdgCode()) == cfgMcTriggerPDGs->end()) + continue; } registry.fill(HIST("yieldsTrigger"), multiplicity, track1.pt(), track1.eta()); registry.fill(HIST("etaphiTrigger"), multiplicity, track1.eta(), track1.phi()); @@ -278,13 +315,13 @@ struct CorrelationTask { } template - using hasSign = decltype(std::declval().sign()); + using HasSign = decltype(std::declval().sign()); template - using hasDecay = decltype(std::declval().decay()); + using HasDecay = decltype(std::declval().decay()); template - using hasProng0Id = decltype(std::declval().cfTrackProng0Id()); + using HasProng0Id = decltype(std::declval().cfTrackProng0Id()); template - using hasProng1Id = decltype(std::declval().cfTrackProng1Id()); + using HasProng1Id = decltype(std::declval().cfTrackProng1Id()); template void fillCorrelations(TTarget target, TTracks1& tracks1, TTracks2& tracks2, float multiplicity, float posZ, int magField, float eventWeight) @@ -294,13 +331,13 @@ struct CorrelationTask { if (cfg.mEfficiencyAssociated) { efficiencyAssociatedCache.clear(); efficiencyAssociatedCache.reserve(tracks2.size()); - for (auto& track : tracks2) { + for (const auto& track : tracks2) { efficiencyAssociatedCache.push_back(getEfficiencyCorrection(cfg.mEfficiencyAssociated, track.eta(), track.pt(), multiplicity, posZ)); } } } - for (auto& track1 : tracks1) { + for (const auto& track1 : tracks1) { // LOGF(info, "Track %f | %f | %f %d %d", track1.eta(), track1.phi(), track1.pt(), track1.isGlobalTrack(), track1.isGlobalTrackSDD()); if constexpr (step <= CorrelationContainer::kCFStepTracked) { @@ -309,12 +346,17 @@ struct CorrelationTask { } } - if constexpr (std::experimental::is_detected::value) { - if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << (uint32_t)track1.decay())) == 0u) + if constexpr (std::experimental::is_detected::value) { + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) continue; } - if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { + if (!cfgMcTriggerPDGs->empty() && std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), track1.pdgCode()) == cfgMcTriggerPDGs->end()) + continue; + } + + if constexpr (std::experimental::is_detected::value) { if (cfgTriggerCharge != 0 && cfgTriggerCharge * track1.sign() < 0) { continue; } @@ -328,7 +370,7 @@ struct CorrelationTask { } if (cfgMassAxis) { - if constexpr (std::experimental::is_detected::value) + if constexpr (std::experimental::is_detected::value) target->getTriggerHist()->Fill(step, track1.pt(), multiplicity, posZ, track1.invMass(), triggerWeight); else LOGF(fatal, "Can not fill mass axis without invMass column. Disable cfgMassAxis."); @@ -336,18 +378,23 @@ struct CorrelationTask { target->getTriggerHist()->Fill(step, track1.pt(), multiplicity, posZ, triggerWeight); } - for (auto& track2 : tracks2) { + for (const auto& track2 : tracks2) { if constexpr (std::is_same::value) { if (track1.globalIndex() == track2.globalIndex()) { // LOGF(info, "Track identical: %f | %f | %f || %f | %f | %f", track1.eta(), track1.phi(), track1.pt(), track2.eta(), track2.phi(), track2.pt()); continue; } } - if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { + if (!cfgMcTriggerPDGs->empty() && std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), track2.pdgCode()) != cfgMcTriggerPDGs->end()) + continue; + } + + if constexpr (std::experimental::is_detected::value) { if (track2.globalIndex() == track1.cfTrackProng0Id()) // do not correlate daughter tracks of the same event continue; } - if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { if (track2.globalIndex() == track1.cfTrackProng1Id()) // do not correlate daughter tracks of the same event continue; } @@ -358,15 +405,54 @@ struct CorrelationTask { } } + if constexpr (std::experimental::is_detected::value) { + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track2.decay()))) == 0u) + continue; + } + + if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) { + if (doprocessSame2Prong2Prong && (track1.decay() == track2.decay() || track1.decay() > 1 || track2.decay() > 1)) { + continue; + } + } // D0 and anti-D0 selection + + if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { + if (track1.cfTrackProng0Id() == track2.cfTrackProng0Id()) { + continue; + } + } + if constexpr (std::experimental::is_detected::value) { + if (track1.cfTrackProng0Id() == track2.cfTrackProng1Id()) { + continue; + } + } + } + + if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { + if (track1.cfTrackProng1Id() == track2.cfTrackProng0Id()) { + continue; + } + } + if constexpr (std::experimental::is_detected::value) { + if (track1.cfTrackProng1Id() == track2.cfTrackProng1Id()) { + continue; + } + } + } // no shared prong for two mothers + if (cfgPtOrder != 0 && track2.pt() >= track1.pt()) { continue; } - if (cfgAssociatedCharge != 0 && cfgAssociatedCharge * track2.sign() < 0) { - continue; + if constexpr (std::experimental::is_detected::value) { + if (cfgAssociatedCharge != 0 && cfgAssociatedCharge * track2.sign() < 0) { + continue; + } } - if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) { if (cfgPairCharge != 0 && cfgPairCharge * track1.sign() * track2.sign() < 0) { continue; } @@ -374,12 +460,13 @@ struct CorrelationTask { if constexpr (std::is_same::value) { if constexpr (step >= CorrelationContainer::kCFStepReconstructed) { - if (cfg.mPairCuts && mPairCuts.conversionCuts(track1, track2)) { - continue; - } - - if (cfgTwoTrackCut > 0 && mPairCuts.twoTrackCut(track1, track2, magField)) { - continue; + if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) { + if (cfg.mPairCuts && mPairCuts.conversionCuts(track1, track2)) { + continue; + } + if (cfgTwoTrackCut > 0 && mPairCuts.twoTrackCut(track1, track2, magField)) { + continue; + } } } } @@ -391,17 +478,16 @@ struct CorrelationTask { } } - float deltaPhi = track1.phi() - track2.phi(); - if (deltaPhi > 1.5f * PI) { - deltaPhi -= TwoPI; - } - if (deltaPhi < -PIHalf) { - deltaPhi += TwoPI; - } + float deltaPhi = RecoDecay::constrainAngle(track1.phi() - track2.phi(), -o2::constants::math::PIHalf); // last param is the weight - if (cfgMassAxis) { - if constexpr (std::experimental::is_detected::value) + if (cfgMassAxis && doprocessSame2Prong2Prong) { + if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) + target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, track2.invMass(), track1.invMass(), associatedWeight); + else + LOGF(fatal, "Can not fill mass axis without invMass column. \n no mass for two particles"); + } else if (cfgMassAxis) { + if constexpr (std::experimental::is_detected::value) target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, track1.invMass(), associatedWeight); else LOGF(fatal, "Can not fill mass axis without invMass column. Disable cfgMassAxis."); @@ -455,7 +541,7 @@ struct CorrelationTask { } // Version with explicit nested loop - void processSameAOD(aodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, aodTracks const& tracks) + void processSameAOD(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks) { // NOTE legacy function for O2 integration tests. Full version needs derived data @@ -478,7 +564,7 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processSameAOD, "Process same event on AOD", true); - void processSameDerived(derivedCollisions::iterator const& collision, soa::Filtered const& tracks) + void processSameDerived(DerivedCollisions::iterator const& collision, soa::Filtered const& tracks) { BinningTypeDerived configurableBinningDerived{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. if (cfgVerbosity > 0) { @@ -506,7 +592,7 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processSameDerived, "Process same event on derived data", false); - void processSame2ProngDerived(derivedCollisions::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& p2tracks) + void processSame2ProngDerived(DerivedCollisions::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& p2tracks) { BinningTypeDerived configurableBinningDerived{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. if (cfgVerbosity > 0) { @@ -530,15 +616,39 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processSame2ProngDerived, "Process same event on derived data", false); + void processSame2Prong2Prong(DerivedCollisions::iterator const& collision, soa::Filtered const& p2tracks) + { + BinningTypeDerived configurableBinningDerived{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. + if (cfgVerbosity > 0) { + LOGF(info, "processSame2ProngDerived: 2-prong candidates: %d | Vertex: %.1f | Multiplicity/Centrality: %.1f", p2tracks.size(), collision.posZ(), collision.multiplicity()); + } + loadEfficiency(collision.timestamp()); + + const auto multiplicity = collision.multiplicity(); + + int bin = configurableBinningDerived.getBin({collision.posZ(), collision.multiplicity()}); + registry.fill(HIST("eventcount_same"), bin); + fillQA(collision, multiplicity, p2tracks, p2tracks); + + same->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelations(same, p2tracks, p2tracks, multiplicity, collision.posZ(), 0, 1.0f); + + if (cfg.mEfficiencyAssociated || cfg.mEfficiencyTrigger) { + same->fillEvent(multiplicity, CorrelationContainer::kCFStepCorrected); + fillCorrelations(same, p2tracks, p2tracks, multiplicity, collision.posZ(), 0, 1.0f); + } + } + PROCESS_SWITCH(CorrelationTask, processSame2Prong2Prong, "Process same event on derived data", false); + using BinningTypeAOD = ColumnBinningPolicy; - void processMixedAOD(aodCollisions& collisions, aodTracks const& tracks, aod::BCsWithTimestamps const&) + void processMixedAOD(AodCollisions const& collisions, AodTracks const& tracks, aod::BCsWithTimestamps const&) { // NOTE legacy function for O2 integration tests. Full version needs derived data // Strictly upper categorised collisions, for cfgNoMixedEvents combinations per bin, skipping those in entry -1 BinningTypeAOD configurableBinning{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. auto tracksTuple = std::make_tuple(tracks); - SameKindPair pairs{configurableBinning, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + SameKindPair pairs{configurableBinning, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip int skipID = -1; for (auto it = pairs.begin(); it != pairs.end(); it++) { @@ -574,12 +684,12 @@ struct CorrelationTask { PROCESS_SWITCH(CorrelationTask, processMixedAOD, "Process mixed events on AOD", false); using BinningTypeDerived = ColumnBinningPolicy; - void processMixedDerived(derivedCollisions& collisions, derivedTracks const& tracks) + void processMixedDerived(DerivedCollisions const& collisions, DerivedTracks const& tracks) { BinningTypeDerived configurableBinningDerived{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. // Strictly upper categorised collisions, for cfgNoMixedEvents combinations per bin, skipping those in entry -1 auto tracksTuple = std::make_tuple(tracks); - SameKindPair pairs{configurableBinningDerived, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + SameKindPair pairs{configurableBinningDerived, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip for (auto it = pairs.begin(); it != pairs.end(); it++) { auto& [collision1, tracks1, collision2, tracks2] = *it; @@ -615,12 +725,12 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processMixedDerived, "Process mixed events on derived data", false); - void processMixed2ProngDerived(derivedCollisions& collisions, derivedTracks const& tracks, soa::Filtered const& p2tracks) + void processMixed2ProngDerived(DerivedCollisions const& collisions, DerivedTracks const& tracks, soa::Filtered const& p2tracks) { BinningTypeDerived configurableBinningDerived{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. // Strictly upper categorised collisions, for cfgNoMixedEvents combinations per bin, skipping those in entry -1 auto tracksTuple = std::make_tuple(p2tracks, tracks); - Pair, derivedTracks, BinningTypeDerived> pairs{configurableBinningDerived, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + Pair, DerivedTracks, BinningTypeDerived> pairs{configurableBinningDerived, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip for (auto it = pairs.begin(); it != pairs.end(); it++) { auto& [collision1, tracks1, collision2, tracks2] = *it; @@ -676,7 +786,7 @@ struct CorrelationTask { // mixed->getTriggerHist()->Fill(eventValues, CorrelationContainer::kCFStepReconstructed); } - for (auto& [track1, track2] : combinations(tracks, tracks)) { + for (const auto& [track1, track2] : combinations(tracks, tracks)) { // LOGF(info, "Combination %d %d", track1.index(), track2.index()); if (cfgTriggerCharge != 0 && cfgTriggerCharge * track1.sign() < 0) { @@ -697,14 +807,7 @@ struct CorrelationTask { continue; } - float deltaPhi = track1.phi() - track2.phi(); - if (deltaPhi > 1.5f * PI) { - deltaPhi -= TwoPI; - } - if (deltaPhi < -PIHalf) { - deltaPhi += TwoPI; - } - + float deltaPhi = RecoDecay::constrainAngle(track1.phi() - track2.phi(), -o2::constants::math: :PIHalf); same->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, collision.posZ()); // mixed->getPairHist()->Fill(values, CorrelationContainer::kCFStepReconstructed); @@ -712,7 +815,7 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processWithCombinations, "Process same event on AOD with combinations", false);*/ - int GetSpecies(int pdgCode) + int getSpecies(int pdgCode) { switch (pdgCode) { case 211: // pion @@ -724,8 +827,11 @@ struct CorrelationTask { case 2212: // proton case -2212: return 2; - default: + case 421: // D0 + case -421: return 3; + default: + return 4; } } @@ -742,30 +848,30 @@ struct CorrelationTask { if (collisions.size() == 0) { return; } - for (auto& collision : collisions) { + for (const auto& collision : collisions) { multiplicity = collision.multiplicity(); } } // Primaries - for (auto& mcParticle : mcParticles) { + for (const auto& mcParticle : mcParticles) { if (mcParticle.isPhysicalPrimary() && mcParticle.sign() != 0) { - same->getTrackHistEfficiency()->Fill(CorrelationContainer::MC, mcParticle.eta(), mcParticle.pt(), GetSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); + same->getTrackHistEfficiency()->Fill(CorrelationContainer::MC, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); } } - for (auto& collision : collisions) { + for (const auto& collision : collisions) { auto groupedTracks = tracks.sliceBy(perCollision, collision.globalIndex()); if (cfgVerbosity > 0) { LOGF(info, " Reconstructed collision at vtx-z = %f", collision.posZ()); LOGF(info, " which has %d tracks", groupedTracks.size()); } - for (auto& track : groupedTracks) { + for (const auto& track : groupedTracks) { if (track.has_cfMCParticle()) { const auto& mcParticle = track.cfMCParticle(); if (mcParticle.isPhysicalPrimary()) { - same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), GetSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); + same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); } - same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoAll, mcParticle.eta(), mcParticle.pt(), GetSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); + same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoAll, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); // LOGF(info, "Filled track %d", track.globalIndex()); } else { // fake track @@ -788,7 +894,7 @@ struct CorrelationTask { if (collisions.size() == 0) { return; } - for (auto& collision : collisions) { + for (const auto& collision : collisions) { multiplicity = collision.multiplicity(); } if (cfgVerbosity > 0) { @@ -820,7 +926,7 @@ struct CorrelationTask { PROCESS_SWITCH(CorrelationTask, processMCSameDerived, "Process MC same event on derived data", false); PresliceUnsorted collisionPerMCCollision = aod::cfcollision::cfMcCollisionId; - void processMCMixedDerived(soa::Filtered& mcCollisions, soa::Filtered const& mcParticles, soa::Filtered const& collisions) + void processMCMixedDerived(soa::Filtered const& mcCollisions, soa::Filtered const& mcParticles, soa::Filtered const& collisions) { bool useMCMultiplicity = (cfgCentBinsForMC == 0); auto getMultiplicity = diff --git a/PWGCF/Tasks/dptdptcorrelations.cxx b/PWGCF/Tasks/dptdptcorrelations.cxx index ad227a09e7d..e89a4958f81 100644 --- a/PWGCF/Tasks/dptdptcorrelations.cxx +++ b/PWGCF/Tasks/dptdptcorrelations.cxx @@ -9,8 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file dptdptcorrelations.cxx +/// \brief implements two-particle correlations base data collection +/// \author victor.gonzalez.sebastian@gmail.com + #include -#include #include #include #include @@ -21,6 +24,9 @@ #include #include #include +#include +#include +#include #include #include @@ -62,6 +68,7 @@ float deltaphibinwidth = constants::math::TwoPI / deltaphibins; float deltaphilow = 0.0 - deltaphibinwidth / 2.0; float deltaphiup = constants::math::TwoPI - deltaphibinwidth / 2.0; +int nNoOfDimensions = 1; // number of dimensions for the NUA & NUE corrections bool processpairs = false; // process pairs analysis bool processmixedevents = false; // process mixed events bool ptorder = false; // consider pt ordering @@ -90,34 +97,34 @@ struct DptDptCorrelationsTask { // The DptDptCorrelationsAnalysisTask output objects //============================================================================================ /* histograms */ - TH1F* fhVertexZA; //! fhN1_vsPt{nch, nullptr}; //! fhN1_vsEtaPhi{nch, nullptr}; //! fhSum1Pt_vsEtaPhi{nch, nullptr}; //! fhN1_vsZEtaPhiPt{nch, nullptr}; //! fhSum1Pt_vsZEtaPhiPt{nch, nullptr}; //! fhNuaNue_vsZEtaPhiPt{nch, nullptr}; //! fhPtAvg_vsEtaPhi{nch, nullptr}; //!> fhN2_vsPtPt{nch, {nch, nullptr}}; //!> fhN2_vsDEtaDPhi{nch, {nch, nullptr}}; //!> fhN2cont_vsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSum2PtPt_vsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSum2DptDpt_vsDEtaDPhi{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ for the different species combinations - std::vector> fhSupN1N1_vsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSupPt1Pt1_vsDEtaDPhi{nch, {nch, nullptr}}; //!> fhInvMassDEta{nch, {nch, nullptr}}; //!> fhInvMassDPhi{nch, {nch, nullptr}}; //! fhN1VsPt{nch, nullptr}; //! fhN1VsEtaPhi{nch, nullptr}; //! fhSum1PtVsEtaPhi{nch, nullptr}; //! fhN1VsZEtaPhiPt{nch, nullptr}; //! fhSum1PtVsZEtaPhiPt{nch, nullptr}; //! fhNuaNue{nch, nullptr}; //! fhPtAvgVsEtaPhi{nch, nullptr}; //!> fhN2VsPtPt{nch, {nch, nullptr}}; //!> fhN2VsDEtaDPhi{nch, {nch, nullptr}}; //!> fhN2contVsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSum2PtPtVsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSum2DptDptVsDEtaDPhi{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ for the different species combinations + std::vector> fhSupN1N1VsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSupPt1Pt1VsDEtaDPhi{nch, {nch, nullptr}}; //!> fhInvMassDEta{nch, {nch, nullptr}}; //!> fhInvMassDPhi{nch, {nch, nullptr}}; //! fhN1_vsC{nch, nullptr}; //! fhSum1Pt_vsC{nch, nullptr}; //! fhN1nw_vsC{nch, nullptr}; //! fhSum1Ptnw_vsC{nch, nullptr}; //!> fhN2_vsC{nch, {nch, nullptr}}; //!> fhSum2PtPt_vsC{nch, {nch, nullptr}}; //!> fhSum2DptDpt_vsC{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs event centrality/multiplicity 1-1,1-2,2-1,2-2, combinations - std::vector> fhN2nw_vsC{nch, {nch, nullptr}}; //!> fhSum2PtPtnw_vsC{nch, {nch, nullptr}}; //!> fhSum2DptDptnw_vsC{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ distribution vs event centrality/multiplicity 1-1,1-2,2-1,2-2, combinations + std::vector fhN1VsC{nch, nullptr}; //! fhSum1PtVsC{nch, nullptr}; //! fhN1nwVsC{nch, nullptr}; //! fhSum1PtnwVsC{nch, nullptr}; //!> fhN2VsC{nch, {nch, nullptr}}; //!> fhSum2PtPtVsC{nch, {nch, nullptr}}; //!> fhSum2DptDptVsC{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs event centrality/multiplicity 1-1,1-2,2-1,2-2, combinations + std::vector> fhN2nwVsC{nch, {nch, nullptr}}; //!> fhSum2PtPtnwVsC{nch, {nch, nullptr}}; //!> fhSum2DptDptnwVsC{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ distribution vs event centrality/multiplicity 1-1,1-2,2-1,2-2, combinations bool ccdbstored = false; @@ -129,7 +136,7 @@ struct DptDptCorrelationsTask { /// \brief Returns the potentially phi origin shifted phi /// \param phi the track azimuthal angle /// \return the track phi origin shifted azimuthal angle - float GetShiftedPhi(float phi) + float getShiftedPhi(float phi) { using namespace correlationstask; using namespace o2::analysis::dptdptfilter; @@ -153,14 +160,14 @@ struct DptDptCorrelationsTask { /// the track has been accepted and it is within that ranges /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS template - int GetEtaPhiIndex(TrackObject const& t) + int getEtaPhiIndex(TrackObject const& t) { using namespace correlationstask; using namespace o2::analysis::dptdptfilter; int etaix = static_cast((t.eta() - etalow) / etabinwidth); /* consider a potential phi origin shift */ - float phi = GetShiftedPhi(t.phi()); + float phi = getShiftedPhi(t.phi()); int phiix = static_cast((phi - philow) / phibinwidth); return etaix * phibins + phiix; } @@ -175,18 +182,18 @@ struct DptDptCorrelationsTask { /// the tracks have been accepted and they are within that ranges /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS template - float GetDEtaValue(TrackObject const& t1, TrackObject const& t2) + float getDEtaValue(TrackObject const& t1, TrackObject const& t2) { using namespace correlationstask; using namespace o2::analysis::dptdptfilter; /* rule: ix are always zero based while bins are always one based */ - int etaix_1 = static_cast((t1.eta() - etalow) / etabinwidth); - int etaix_2 = static_cast((t2.eta() - etalow) / etabinwidth); + int etaIx1 = static_cast((t1.eta() - etalow) / etabinwidth); + int etaIx2 = static_cast((t2.eta() - etalow) / etabinwidth); - int deltaeta_ix = etaix_1 - etaix_2 + etabins - 1; + int deltaEtaIx = etaIx1 - etaIx2 + etabins - 1; - return deltaetalow + (deltaeta_ix + 0.5) * deltaetabinwidth; + return deltaetalow + (deltaEtaIx + 0.5) * deltaetabinwidth; } /// \brief Returns the delta phi value for the differential phi @@ -199,25 +206,25 @@ struct DptDptCorrelationsTask { /// the tracks have been accepted and they are within that ranges /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS template - float GetDPhiValue(TrackObject const& t1, TrackObject const& t2) + float getDPhiValue(TrackObject const& t1, TrackObject const& t2) { using namespace correlationstask; using namespace o2::analysis::dptdptfilter; /* rule: ix are always zero based while bins are always one based */ /* consider a potential phi origin shift */ - float phi = GetShiftedPhi(t1.phi()); - int phiix_1 = static_cast((phi - philow) / phibinwidth); + float phi = getShiftedPhi(t1.phi()); + int phiIx1 = static_cast((phi - philow) / phibinwidth); /* consider a potential phi origin shift */ - phi = GetShiftedPhi(t2.phi()); - int phiix_2 = static_cast((phi - philow) / phibinwidth); + phi = getShiftedPhi(t2.phi()); + int phiIx2 = static_cast((phi - philow) / phibinwidth); - int deltaphi_ix = phiix_1 - phiix_2; - if (deltaphi_ix < 0) { - deltaphi_ix += phibins; + int deltaPhiIx = phiIx1 - phiIx2; + if (deltaPhiIx < 0) { + deltaPhiIx += phibins; } - float value = deltaphilow + (deltaphi_ix + 0.5) * deltaphibinwidth; + float value = deltaphilow + (deltaPhiIx + 0.5) * deltaphibinwidth; return (value < (deltaphiup - constants::math::PI)) ? value : value - constants::math::TwoPI; } @@ -232,28 +239,28 @@ struct DptDptCorrelationsTask { /// the tracks have been accepted and they are within that ranges /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS template - int GetDEtaDPhiGlobalBin(TrackObject const& t1, TrackObject const& t2) + int getDEtaDPhiGlobalBin(TrackObject const& t1, TrackObject const& t2) { using namespace correlationstask; using namespace o2::analysis::dptdptfilter; /* rule: ix are always zero based while bins are always one based */ - int etaix_1 = static_cast((t1.eta() - etalow) / etabinwidth); + int etaIx1 = static_cast((t1.eta() - etalow) / etabinwidth); /* consider a potential phi origin shift */ - float phi = GetShiftedPhi(t1.phi()); - int phiix_1 = static_cast((phi - philow) / phibinwidth); - int etaix_2 = static_cast((t2.eta() - etalow) / etabinwidth); + float phi = getShiftedPhi(t1.phi()); + int phiIx1 = static_cast((phi - philow) / phibinwidth); + int etaIx2 = static_cast((t2.eta() - etalow) / etabinwidth); /* consider a potential phi origin shift */ - phi = GetShiftedPhi(t2.phi()); - int phiix_2 = static_cast((phi - philow) / phibinwidth); + phi = getShiftedPhi(t2.phi()); + int phiIx2 = static_cast((phi - philow) / phibinwidth); - int deltaeta_ix = etaix_1 - etaix_2 + etabins - 1; - int deltaphi_ix = phiix_1 - phiix_2; - if (deltaphi_ix < 0) { - deltaphi_ix += phibins; + int deltaEtaIx = etaIx1 - etaIx2 + etabins - 1; + int deltaPhiIx = phiIx1 - phiIx2; + if (deltaPhiIx < 0) { + deltaPhiIx += phibins; } - return fhN2_vsDEtaDPhi[0][0]->GetBin(deltaeta_ix + 1, deltaphi_ix + 1); + return fhN2VsDEtaDPhi[0][0]->GetBin(deltaEtaIx + 1, deltaPhiIx + 1); } /* taken from PWGCF/Core/PairCuts.h implemented by JFGO */ @@ -289,24 +296,43 @@ struct DptDptCorrelationsTask { return mass2; } - void storeTrackCorrections(std::vector corrs) + void storeTrackCorrections(std::vector corrs) { - LOGF(info, "Stored NUA&NUE corrections for %d track ids", corrs.size()); + using namespace correlationstask; + + LOGF(info, "Storing NUA&NUE corrections for %d track ids", corrs.size()); for (uint i = 0; i < corrs.size(); ++i) { - LOGF(info, " Stored NUA&NUE corrections %s for track id %d %s", corrs[i] != nullptr ? corrs[i]->GetName() : "nullptr", i, corrs[i] != nullptr ? "yes" : "no"); - fhNuaNue_vsZEtaPhiPt[i] = corrs[i]; - if (fhNuaNue_vsZEtaPhiPt[i] != nullptr) { + if (corrs[i] != nullptr) { + if (nNoOfDimensions != corrs[i]->GetDimension()) { + LOGF(fatal, " Corrections received dimensions %d for track id %d different than expected %d", corrs[i]->GetDimension(), i, nNoOfDimensions); + } else { + LOGF(info, " Storing NUA&NUE corrections %s for track id %d with %d dimensions %s", + corrs[i] != nullptr ? corrs[i]->GetName() : "nullptr", i, nNoOfDimensions, corrs[i] != nullptr ? "yes" : "no"); + } + } + fhNuaNue[i] = corrs[i]; + if (fhNuaNue[i] != nullptr) { int nbins = 0; double avg = 0.0; - for (int ix = 0; ix < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsX(); ++ix) { - for (int iy = 0; iy < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsY(); ++iy) { - for (int iz = 0; iz < fhNuaNue_vsZEtaPhiPt[i]->GetNbinsZ(); ++iz) { - nbins++; - avg += fhNuaNue_vsZEtaPhiPt[i]->GetBinContent(ix + 1, iy + 1, iz + 1); + for (int ix = 0; ix < fhNuaNue[i]->GetNbinsX(); ++ix) { + if (nNoOfDimensions == 1) { + nbins++; + avg += fhNuaNue[i]->GetBinContent(ix + 1); + } else { + for (int iy = 0; iy < fhNuaNue[i]->GetNbinsY(); ++iy) { + if (nNoOfDimensions == 2) { + nbins++; + avg += fhNuaNue[i]->GetBinContent(ix + 1, iy + 1); + } else if (nNoOfDimensions == 3 || nNoOfDimensions == 4) { + for (int iz = 0; iz < fhNuaNue[i]->GetNbinsZ(); ++iz) { + nbins++; + avg += fhNuaNue[i]->GetBinContent(ix + 1, iy + 1, iz + 1); + } + } } } } - LOGF(info, "Average NUA&NUE correction for track id %d: %f", i, avg / nbins); + LOGF(info, " Average NUA&NUE correction for track id %d: %f", i, avg / nbins); } } ccdbstored = true; @@ -317,33 +343,54 @@ struct DptDptCorrelationsTask { LOGF(info, "Stored pT average for %d track ids", ptavgs.size()); for (uint i = 0; i < ptavgs.size(); ++i) { LOGF(info, " Stored pT average for track id %d %s", i, ptavgs[i] != nullptr ? "yes" : "no"); - fhPtAvg_vsEtaPhi[i] = ptavgs[i]; + fhPtAvgVsEtaPhi[i] = ptavgs[i]; } ccdbstored = true; } - template + template std::vector* getTrackCorrections(TrackListObject const& tracks, float zvtx) { std::vector* corr = new std::vector(tracks.size(), 1.0f); int index = 0; - for (auto& t : tracks) { - if (fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()] != nullptr) { - (*corr)[index] = fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->GetBinContent(fhNuaNue_vsZEtaPhiPt[t.trackacceptedid()]->FindFixBin(zvtx, GetEtaPhiIndex(t) + 0.5, t.pt())); + for (const auto& t : tracks) { + if (fhNuaNue[t.trackacceptedid()] != nullptr) { + if constexpr (nDim == 1) { + (*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(t.pt())); + } else if constexpr (nDim == 2) { + (*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(t.eta(), t.pt())); + } else if constexpr (nDim == 3) { + (*corr)[index] = fhNuaNue[t.trackacceptedid()]->GetBinContent(fhNuaNue[t.trackacceptedid()]->FindFixBin(zvtx, getEtaPhiIndex(t) + 0.5, t.pt())); + } } index++; } return corr; } + template + std::vector* getTrackCorrections(TrackListObject const& tracks, float zvtx) + { + using namespace correlationstask; + + if (nNoOfDimensions == 1) { + return getTrackCorrections<1>(tracks, zvtx); + } else if (nNoOfDimensions == 2) { + return getTrackCorrections<2>(tracks, zvtx); + } else if (nNoOfDimensions == 3) { + return getTrackCorrections<3>(tracks, zvtx); + } + return getTrackCorrections<4>(tracks, zvtx); + } + template std::vector* getPtAvg(TrackListObject const& tracks) { std::vector* ptavg = new std::vector(tracks.size(), 0.0f); int index = 0; - for (auto& t : tracks) { - if (fhPtAvg_vsEtaPhi[t.trackacceptedid()] != nullptr) { - (*ptavg)[index] = fhPtAvg_vsEtaPhi[t.trackacceptedid()]->GetBinContent(fhPtAvg_vsEtaPhi[t.trackacceptedid()]->FindFixBin(t.eta(), t.phi())); + for (auto const& t : tracks) { + if (fhPtAvgVsEtaPhi[t.trackacceptedid()] != nullptr) { + (*ptavg)[index] = fhPtAvgVsEtaPhi[t.trackacceptedid()]->GetBinContent(fhPtAvgVsEtaPhi[t.trackacceptedid()]->FindFixBin(t.eta(), t.phi())); index++; } } @@ -357,15 +404,15 @@ struct DptDptCorrelationsTask { void processSingles(TrackListObject const& passedtracks, std::vector* corrs, float zvtx) { int index = 0; - for (auto& track : passedtracks) { + for (auto const& track : passedtracks) { float corr = (*corrs)[index]; - fhN1_vsPt[track.trackacceptedid()]->Fill(track.pt(), corr); + fhN1VsPt[track.trackacceptedid()]->Fill(track.pt(), corr); if constexpr (smallsingles) { - fhN1_vsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), GetShiftedPhi(track.phi()), corr); - fhSum1Pt_vsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), GetShiftedPhi(track.phi()), track.pt() * corr); + fhN1VsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), corr); + fhSum1PtVsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), track.pt() * corr); } else { - fhN1_vsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, GetEtaPhiIndex(track) + 0.5, track.pt(), corr); - fhSum1Pt_vsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, GetEtaPhiIndex(track) + 0.5, track.pt(), track.pt() * corr); + fhN1VsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); + fhSum1PtVsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), track.pt() * corr); } index++; } @@ -386,22 +433,22 @@ struct DptDptCorrelationsTask { std::vector n1nw(nch, 0.0); ///< not weighted number of single tracks for current collision std::vector sum1Ptnw(nch, 0.0); ///< accumulated sum of not weighted single \f$p_T\f$ for current collision int index = 0; - for (auto& track : passedtracks) { + for (auto const& track : passedtracks) { float corr = (*corrs)[index]; n1[track.trackacceptedid()] += corr; sum1Pt[track.trackacceptedid()] += track.pt() * corr; n1nw[track.trackacceptedid()] += 1; sum1Ptnw[track.trackacceptedid()] += track.pt(); - fhN1_vsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), GetShiftedPhi(track.phi()), corr); - fhSum1Pt_vsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), GetShiftedPhi(track.phi()), track.pt() * corr); + fhN1VsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), corr); + fhSum1PtVsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), track.pt() * corr); index++; } for (uint tid = 0; tid < nch; ++tid) { - fhN1_vsC[tid]->Fill(cmul, n1[tid]); - fhSum1Pt_vsC[tid]->Fill(cmul, sum1Pt[tid]); - fhN1nw_vsC[tid]->Fill(cmul, n1nw[tid]); - fhSum1Ptnw_vsC[tid]->Fill(cmul, sum1Ptnw[tid]); + fhN1VsC[tid]->Fill(cmul, n1[tid]); + fhSum1PtVsC[tid]->Fill(cmul, sum1Pt[tid]); + fhN1nwVsC[tid]->Fill(cmul, n1nw[tid]); + fhSum1PtnwVsC[tid]->Fill(cmul, sum1Ptnw[tid]); } } @@ -427,11 +474,11 @@ struct DptDptCorrelationsTask { int globalbin = 0; LOGF(debug, "Initializing globalbin to ", globalbin); - for (auto& track1 : trks1) { - double ptavg_1 = (*ptavgs1)[index1]; + for (auto const& track1 : trks1) { + double ptAvg1 = (*ptavgs1)[index1]; double corr1 = (*corrs1)[index1]; int index2 = 0; - for (auto& track2 : trks2) { + for (auto const& track2 : trks2) { /* checking the same track id condition */ if (track1 == track2) { /* exclude autocorrelations */ @@ -446,15 +493,15 @@ struct DptDptCorrelationsTask { } } /* process pair magnitudes */ - double ptavg_2 = (*ptavgs2)[index2]; + double ptAvg2 = (*ptavgs2)[index2]; double corr2 = (*corrs2)[index2]; double corr = corr1 * corr2; - double dptdptnw = (track1.pt() - ptavg_1) * (track2.pt() - ptavg_2); - double dptdptw = (corr1 * track1.pt() - ptavg_1) * (corr2 * track2.pt() - ptavg_2); + double dptdptnw = (track1.pt() - ptAvg1) * (track2.pt() - ptAvg2); + double dptdptw = (corr1 * track1.pt() - ptAvg1) * (corr2 * track2.pt() - ptAvg2); /* get the global bin for filling the differential histograms */ if constexpr (docorrelations) { - globalbin = GetDEtaDPhiGlobalBin(track1, track2); + globalbin = getDEtaDPhiGlobalBin(track1, track2); } float deltaeta = track1.eta() - track2.eta(); float deltaphi = track1.phi() - track2.phi(); @@ -467,8 +514,8 @@ struct DptDptCorrelationsTask { if ((fUseConversionCuts && fPairCuts.conversionCuts(track1, track2)) || (fUseTwoTrackCut && fPairCuts.twoTrackCut(track1, track2, bfield))) { /* suppress the pair */ if constexpr (docorrelations) { - fhSupN1N1_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); - fhSupPt1Pt1_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); + fhSupN1N1VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); + fhSupPt1Pt1VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); } n2sup[track1.trackacceptedid()][track2.trackacceptedid()] += corr; } else { @@ -481,18 +528,18 @@ struct DptDptCorrelationsTask { sum2DptDptnw[track1.trackacceptedid()][track2.trackacceptedid()] += dptdptnw; if constexpr (docorrelations) { - fhN2_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); - fhN2cont_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(deltaeta, deltaphi, corr); - fhSum2DptDpt_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, dptdptw); - fhSum2PtPt_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); - fhN2_vsPtPt[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.pt(), track2.pt(), corr); + fhN2VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); + fhN2contVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(deltaeta, deltaphi, corr); + fhSum2DptDptVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, dptdptw); + fhSum2PtPtVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); + fhN2VsPtPt[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.pt(), track2.pt(), corr); } if constexpr (doinvmass) { if (!(track2.trackacceptedid() < track1.trackacceptedid())) { /* only 12 combinations, 21 are exactly the same */ double invariantMass = std::sqrt(getInvMassSquared(track1, poimass[static_cast(track1.trackacceptedid() / 2)], track2, poimass[static_cast(track2.trackacceptedid() / 2)])) * 1000.0f; - fhInvMassDEta[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(GetDEtaValue(track1, track2), invariantMass); - fhInvMassDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(GetDPhiValue(track1, track2), invariantMass); + fhInvMassDEta[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(getDEtaValue(track1, track2), invariantMass); + fhInvMassDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(getDPhiValue(track1, track2), invariantMass); } } } @@ -502,19 +549,19 @@ struct DptDptCorrelationsTask { } for (uint pid1 = 0; pid1 < nch; ++pid1) { for (uint pid2 = 0; pid2 < nch; ++pid2) { - fhN2_vsC[pid1][pid2]->Fill(cmul, n2[pid1][pid2]); - fhSum2PtPt_vsC[pid1][pid2]->Fill(cmul, sum2PtPt[pid1][pid2]); - fhSum2DptDpt_vsC[pid1][pid2]->Fill(cmul, sum2DptDpt[pid1][pid2]); - fhN2nw_vsC[pid1][pid2]->Fill(cmul, n2nw[pid1][pid2]); - fhSum2PtPtnw_vsC[pid1][pid2]->Fill(cmul, sum2PtPtnw[pid1][pid2]); - fhSum2DptDptnw_vsC[pid1][pid2]->Fill(cmul, sum2DptDptnw[pid1][pid2]); + fhN2VsC[pid1][pid2]->Fill(cmul, n2[pid1][pid2]); + fhSum2PtPtVsC[pid1][pid2]->Fill(cmul, sum2PtPt[pid1][pid2]); + fhSum2DptDptVsC[pid1][pid2]->Fill(cmul, sum2DptDpt[pid1][pid2]); + fhN2nwVsC[pid1][pid2]->Fill(cmul, n2nw[pid1][pid2]); + fhSum2PtPtnwVsC[pid1][pid2]->Fill(cmul, sum2PtPtnw[pid1][pid2]); + fhSum2DptDptnwVsC[pid1][pid2]->Fill(cmul, sum2DptDptnw[pid1][pid2]); /* let's also update the number of entries in the differential histograms */ if constexpr (docorrelations) { - fhN2_vsDEtaDPhi[pid1][pid2]->SetEntries(fhN2_vsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSum2DptDpt_vsDEtaDPhi[pid1][pid2]->SetEntries(fhSum2DptDpt_vsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSum2PtPt_vsDEtaDPhi[pid1][pid2]->SetEntries(fhSum2PtPt_vsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSupN1N1_vsDEtaDPhi[pid1][pid2]->SetEntries(fhSupN1N1_vsDEtaDPhi[pid1][pid2]->GetEntries() + n2sup[pid1][pid2]); - fhSupPt1Pt1_vsDEtaDPhi[pid1][pid2]->SetEntries(fhSupPt1Pt1_vsDEtaDPhi[pid1][pid2]->GetEntries() + n2sup[pid1][pid2]); + fhN2VsDEtaDPhi[pid1][pid2]->SetEntries(fhN2VsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); + fhSum2DptDptVsDEtaDPhi[pid1][pid2]->SetEntries(fhSum2DptDptVsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); + fhSum2PtPtVsDEtaDPhi[pid1][pid2]->SetEntries(fhSum2PtPtVsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); + fhSupN1N1VsDEtaDPhi[pid1][pid2]->SetEntries(fhSupN1N1VsDEtaDPhi[pid1][pid2]->GetEntries() + n2sup[pid1][pid2]); + fhSupPt1Pt1VsDEtaDPhi[pid1][pid2]->SetEntries(fhSupPt1Pt1VsDEtaDPhi[pid1][pid2]->GetEntries() + n2sup[pid1][pid2]); } } } @@ -612,7 +659,7 @@ struct DptDptCorrelationsTask { LOGF(info, "Do invariant mass: %s; do correlation histograms: %s", doinvmass ? "yes" : "no", docorrelations ? "yes" : "no"); /* create the histograms */ - Bool_t oldstatus = TH1::AddDirectoryStatus(); + bool oldstatus = TH1::AddDirectoryStatus(); TH1::AddDirectory(kFALSE); if (!processpairs) { @@ -620,23 +667,23 @@ struct DptDptCorrelationsTask { fOutputList->Add(fhVertexZA); for (uint i = 0; i < nch; ++i) { /* histograms for each track, one and two */ - fhN1_vsPt[i] = new TH1F(TString::Format("n1_%s_vsPt", tnames[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;p_{t,%s} (GeV/c);#LT n_{1} #GT", tnames[i].c_str()).Data(), - ptbins, ptlow, ptup); + fhN1VsPt[i] = new TH1F(TString::Format("n1_%s_vsPt", tnames[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT;p_{t,%s} (GeV/c);#LT n_{1} #GT", tnames[i].c_str()).Data(), + ptbins, ptlow, ptup); /* we don't want the Sumw2 structure being created here */ bool defSumw2 = TH1::GetDefaultSumw2(); if constexpr (smallsingles) { - fhN1_vsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tnames[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tnames[i].c_str(), tnames[i].c_str()).Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhSum1Pt_vsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tnames[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", - tnames[i].c_str(), tnames[i].c_str(), tnames[i].c_str(), tnames[i].c_str()) - .Data(), - etabins, etalow, etaup, phibins, philow, phiup); + fhN1VsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tnames[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tnames[i].c_str(), tnames[i].c_str()).Data(), + etabins, etalow, etaup, phibins, philow, phiup); + fhSum1PtVsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tnames[i].c_str()).Data(), + TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", + tnames[i].c_str(), tnames[i].c_str(), tnames[i].c_str(), tnames[i].c_str()) + .Data(), + etabins, etalow, etaup, phibins, philow, phiup); } else { TH1::SetDefaultSumw2(false); - fhN1_vsZEtaPhiPt[i] = new TH3F( + fhN1VsZEtaPhiPt[i] = new TH3F( TString::Format("n1_%s_vsZ_vsEtaPhi_vsPt", tnames[i].c_str()).Data(), TString::Format("#LT n_{1} #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", tnames[i].c_str(), @@ -652,7 +699,7 @@ struct DptDptCorrelationsTask { ptbins, ptlow, ptup); - fhSum1Pt_vsZEtaPhiPt[i] = new TH3F( + fhSum1PtVsZEtaPhiPt[i] = new TH3F( TString::Format("sumPt1_%s_vsZ_vsEtaPhi_vsPt", tnames[i].c_str()).Data(), TString::Format( "#LT #Sigma p_{t,%s}#GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", @@ -676,58 +723,58 @@ struct DptDptCorrelationsTask { /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ if constexpr (smallsingles) { - fhN1_vsEtaPhi[i]->SetBit(TH1::kIsNotW); - fhN1_vsEtaPhi[i]->Sumw2(false); - fhSum1Pt_vsEtaPhi[i]->SetBit(TH1::kIsNotW); - fhSum1Pt_vsEtaPhi[i]->Sumw2(false); + fhN1VsEtaPhi[i]->SetBit(TH1::kIsNotW); + fhN1VsEtaPhi[i]->Sumw2(false); + fhSum1PtVsEtaPhi[i]->SetBit(TH1::kIsNotW); + fhSum1PtVsEtaPhi[i]->Sumw2(false); } else { - fhN1_vsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); - fhN1_vsZEtaPhiPt[i]->Sumw2(false); - fhSum1Pt_vsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); - fhSum1Pt_vsZEtaPhiPt[i]->Sumw2(false); + fhN1VsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); + fhN1VsZEtaPhiPt[i]->Sumw2(false); + fhSum1PtVsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); + fhSum1PtVsZEtaPhiPt[i]->Sumw2(false); } - fhNuaNue_vsZEtaPhiPt[i] = nullptr; - fhPtAvg_vsEtaPhi[i] = nullptr; + fhNuaNue[i] = nullptr; + fhPtAvgVsEtaPhi[i] = nullptr; - fOutputList->Add(fhN1_vsPt[i]); + fOutputList->Add(fhN1VsPt[i]); if constexpr (smallsingles) { - fOutputList->Add(fhN1_vsEtaPhi[i]); - fOutputList->Add(fhSum1Pt_vsEtaPhi[i]); + fOutputList->Add(fhN1VsEtaPhi[i]); + fOutputList->Add(fhSum1PtVsEtaPhi[i]); } else { - fOutputList->Add(fhN1_vsZEtaPhiPt[i]); - fOutputList->Add(fhSum1Pt_vsZEtaPhiPt[i]); + fOutputList->Add(fhN1VsZEtaPhiPt[i]); + fOutputList->Add(fhSum1PtVsZEtaPhiPt[i]); } } } else { for (uint i = 0; i < nch; ++i) { /* histograms for each track species */ - fhN1_vsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tnames[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tnames[i].c_str(), tnames[i].c_str()).Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhSum1Pt_vsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tnames[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", - tnames[i].c_str(), tnames[i].c_str(), tnames[i].c_str(), tnames[i].c_str()) - .Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhN1_vsC[i] = new TProfile(TString::Format("n1_%s_vsM", tnames[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT (weighted);Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), - 100, 0.0, 100.0); - fhSum1Pt_vsC[i] = new TProfile(TString::Format("sumPt_%s_vsM", tnames[i].c_str()), - TString::Format("#LT #Sigma p_{t,%s} #GT (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tnames[i].c_str(), tnames[i].c_str()).Data(), - 100, 0.0, 100.0); - fhN1nw_vsC[i] = new TProfile(TString::Format("n1Nw_%s_vsM", tnames[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), - 100, 0.0, 100.0); - fhSum1Ptnw_vsC[i] = new TProfile(TString::Format("sumPtNw_%s_vsM", tnames[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tnames[i].c_str(), tnames[i].c_str()).Data(), 100, 0.0, 100.0); - fhNuaNue_vsZEtaPhiPt[i] = nullptr; - fhPtAvg_vsEtaPhi[i] = nullptr; - fOutputList->Add(fhN1_vsEtaPhi[i]); - fOutputList->Add(fhSum1Pt_vsEtaPhi[i]); - fOutputList->Add(fhN1_vsC[i]); - fOutputList->Add(fhSum1Pt_vsC[i]); - fOutputList->Add(fhN1nw_vsC[i]); - fOutputList->Add(fhSum1Ptnw_vsC[i]); + fhN1VsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tnames[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tnames[i].c_str(), tnames[i].c_str()).Data(), + etabins, etalow, etaup, phibins, philow, phiup); + fhSum1PtVsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tnames[i].c_str()).Data(), + TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", + tnames[i].c_str(), tnames[i].c_str(), tnames[i].c_str(), tnames[i].c_str()) + .Data(), + etabins, etalow, etaup, phibins, philow, phiup); + fhN1VsC[i] = new TProfile(TString::Format("n1_%s_vsM", tnames[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT (weighted);Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), + 100, 0.0, 100.0); + fhSum1PtVsC[i] = new TProfile(TString::Format("sumPt_%s_vsM", tnames[i].c_str()), + TString::Format("#LT #Sigma p_{t,%s} #GT (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tnames[i].c_str(), tnames[i].c_str()).Data(), + 100, 0.0, 100.0); + fhN1nwVsC[i] = new TProfile(TString::Format("n1Nw_%s_vsM", tnames[i].c_str()).Data(), + TString::Format("#LT n_{1} #GT;Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), + 100, 0.0, 100.0); + fhSum1PtnwVsC[i] = new TProfile(TString::Format("sumPtNw_%s_vsM", tnames[i].c_str()).Data(), + TString::Format("#LT #Sigma p_{t,%s} #GT;Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tnames[i].c_str(), tnames[i].c_str()).Data(), 100, 0.0, 100.0); + fhNuaNue[i] = nullptr; + fhPtAvgVsEtaPhi[i] = nullptr; + fOutputList->Add(fhN1VsEtaPhi[i]); + fOutputList->Add(fhSum1PtVsEtaPhi[i]); + fOutputList->Add(fhN1VsC[i]); + fOutputList->Add(fhSum1PtVsC[i]); + fOutputList->Add(fhN1nwVsC[i]); + fOutputList->Add(fhSum1PtnwVsC[i]); } for (uint i = 0; i < nch; ++i) { @@ -738,20 +785,20 @@ struct DptDptCorrelationsTask { TH1::SetDefaultSumw2(false); const char* pname = trackPairsNames[i][j].c_str(); if constexpr (docorrelations) { - fhN2_vsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhN2cont_vsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12cont_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSum2PtPt_vsDEtaDPhi[i][j] = new TH2F(TString::Format("sumPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSum2DptDpt_vsDEtaDPhi[i][j] = new TH2F(TString::Format("sumDptDpt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSupN1N1_vsDEtaDPhi[i][j] = new TH2F(TString::Format("suppn1n1_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT n_{1} #GT#LT n_{1} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{1} #GT#LT n_{1} #GT", pname), + fhN2VsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), + deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); + fhN2contVsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12cont_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), + deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); + fhSum2PtPtVsDEtaDPhi[i][j] = new TH2F(TString::Format("sumPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSupPt1Pt1_vsDEtaDPhi[i][j] = new TH2F(TString::Format("suppPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT p_{t,1} #GT#LT p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT p_{t,1} #GT#LT p_{t,2} #GT (GeV^{2})", pname), + fhSum2DptDptVsDEtaDPhi[i][j] = new TH2F(TString::Format("sumDptDpt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhN2_vsPtPt[i][j] = new TH2F(TString::Format("n2_12_vsPtVsPt_%s", pname), TString::Format("#LT n_{2} #GT (%s);p_{t,1} (GeV/c);p_{t,2} (GeV/c);#LT n_{2} #GT", pname), - ptbins, ptlow, ptup, ptbins, ptlow, ptup); + fhSupN1N1VsDEtaDPhi[i][j] = new TH2F(TString::Format("suppn1n1_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT n_{1} #GT#LT n_{1} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{1} #GT#LT n_{1} #GT", pname), + deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); + fhSupPt1Pt1VsDEtaDPhi[i][j] = new TH2F(TString::Format("suppPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT p_{t,1} #GT#LT p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT p_{t,1} #GT#LT p_{t,2} #GT (GeV^{2})", pname), + deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); + fhN2VsPtPt[i][j] = new TH2F(TString::Format("n2_12_vsPtVsPt_%s", pname), TString::Format("#LT n_{2} #GT (%s);p_{t,1} (GeV/c);p_{t,2} (GeV/c);#LT n_{2} #GT", pname), + ptbins, ptlow, ptup, ptbins, ptlow, ptup); } if constexpr (doinvmass) { if (!(j < i)) { @@ -765,27 +812,27 @@ struct DptDptCorrelationsTask { /* we return it back to previuos state */ TH1::SetDefaultSumw2(defSumw2); - fhN2_vsC[i][j] = new TProfile(TString::Format("n2_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); - fhSum2PtPt_vsC[i][j] = new TProfile(TString::Format("sumPtPt_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhSum2DptDpt_vsC[i][j] = new TProfile(TString::Format("sumDptDpt_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhN2nw_vsC[i][j] = new TProfile(TString::Format("n2Nw_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); - fhSum2PtPtnw_vsC[i][j] = new TProfile(TString::Format("sumPtPtNw_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhSum2DptDptnw_vsC[i][j] = new TProfile(TString::Format("sumDptDptNw_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); + fhN2VsC[i][j] = new TProfile(TString::Format("n2_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); + fhSum2PtPtVsC[i][j] = new TProfile(TString::Format("sumPtPt_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); + fhSum2DptDptVsC[i][j] = new TProfile(TString::Format("sumDptDpt_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); + fhN2nwVsC[i][j] = new TProfile(TString::Format("n2Nw_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); + fhSum2PtPtnwVsC[i][j] = new TProfile(TString::Format("sumPtPtNw_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); + fhSum2DptDptnwVsC[i][j] = new TProfile(TString::Format("sumDptDptNw_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ if constexpr (docorrelations) { - fhN2_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhN2_vsDEtaDPhi[i][j]->Sumw2(false); - fhN2cont_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhN2cont_vsDEtaDPhi[i][j]->Sumw2(false); - fhSum2PtPt_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSum2PtPt_vsDEtaDPhi[i][j]->Sumw2(false); - fhSum2DptDpt_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSum2DptDpt_vsDEtaDPhi[i][j]->Sumw2(false); - fhSupN1N1_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSupN1N1_vsDEtaDPhi[i][j]->Sumw2(false); - fhSupPt1Pt1_vsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSupPt1Pt1_vsDEtaDPhi[i][j]->Sumw2(false); + fhN2VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhN2VsDEtaDPhi[i][j]->Sumw2(false); + fhN2contVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhN2contVsDEtaDPhi[i][j]->Sumw2(false); + fhSum2PtPtVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhSum2PtPtVsDEtaDPhi[i][j]->Sumw2(false); + fhSum2DptDptVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhSum2DptDptVsDEtaDPhi[i][j]->Sumw2(false); + fhSupN1N1VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhSupN1N1VsDEtaDPhi[i][j]->Sumw2(false); + fhSupPt1Pt1VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); + fhSupPt1Pt1VsDEtaDPhi[i][j]->Sumw2(false); } if constexpr (doinvmass) { if (!(j < i)) { @@ -798,13 +845,13 @@ struct DptDptCorrelationsTask { } if constexpr (docorrelations) { - fOutputList->Add(fhN2_vsDEtaDPhi[i][j]); - fOutputList->Add(fhN2cont_vsDEtaDPhi[i][j]); - fOutputList->Add(fhSum2PtPt_vsDEtaDPhi[i][j]); - fOutputList->Add(fhSum2DptDpt_vsDEtaDPhi[i][j]); - fOutputList->Add(fhSupN1N1_vsDEtaDPhi[i][j]); - fOutputList->Add(fhSupPt1Pt1_vsDEtaDPhi[i][j]); - fOutputList->Add(fhN2_vsPtPt[i][j]); + fOutputList->Add(fhN2VsDEtaDPhi[i][j]); + fOutputList->Add(fhN2contVsDEtaDPhi[i][j]); + fOutputList->Add(fhSum2PtPtVsDEtaDPhi[i][j]); + fOutputList->Add(fhSum2DptDptVsDEtaDPhi[i][j]); + fOutputList->Add(fhSupN1N1VsDEtaDPhi[i][j]); + fOutputList->Add(fhSupPt1Pt1VsDEtaDPhi[i][j]); + fOutputList->Add(fhN2VsPtPt[i][j]); } if constexpr (doinvmass) { if (!(j < i)) { @@ -813,12 +860,12 @@ struct DptDptCorrelationsTask { fOutputList->Add(fhInvMassDPhi[i][j]); } } - fOutputList->Add(fhN2_vsC[i][j]); - fOutputList->Add(fhSum2PtPt_vsC[i][j]); - fOutputList->Add(fhSum2DptDpt_vsC[i][j]); - fOutputList->Add(fhN2nw_vsC[i][j]); - fOutputList->Add(fhSum2PtPtnw_vsC[i][j]); - fOutputList->Add(fhSum2DptDptnw_vsC[i][j]); + fOutputList->Add(fhN2VsC[i][j]); + fOutputList->Add(fhSum2PtPtVsC[i][j]); + fOutputList->Add(fhSum2DptDptVsC[i][j]); + fOutputList->Add(fhN2nwVsC[i][j]); + fOutputList->Add(fhSum2PtPtnwVsC[i][j]); + fOutputList->Add(fhSum2DptDptnwVsC[i][j]); } } } @@ -836,7 +883,7 @@ struct DptDptCorrelationsTask { /* the data collecting engine instances */ DataCollectingEngine** dataCE; - DataCollectingEngine** dataCE_small; + DataCollectingEngine** dataCEsmall; DataCollectingEngine** dataCEME; /* the input file structure from CCDB */ @@ -848,8 +895,8 @@ struct DptDptCorrelationsTask { std::string cfgCCDBPeriod{"LHC22o"}; /* pair conversion suppression defaults */ - static constexpr float cfgPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; - Configurable> cfgPairCut{"paircut", {cfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Conversion suppressions"}; + static constexpr float kCfgPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; + Configurable> cfgPairCut{"paircut", {kCfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Conversion suppressions"}; /* two tracks cut */ Configurable cfgTwoTrackCut{"twotrackcut", -1, "Two-tracks cut: -1 = off; >0 otherwise distance value (suggested: 0.02"}; Configurable cfgTwoTrackCutMinRadius{"twotrackcutminradius", 0.8f, "Two-tracks cut: radius in m from which two-tracks cut is applied"}; @@ -860,6 +907,7 @@ struct DptDptCorrelationsTask { Configurable cfgProcessPairs{"processpairs", false, "Process pairs: false = no, just singles, true = yes, process pairs"}; Configurable cfgProcessME{"processmixedevents", false, "Process mixed events: false = no, just same event, true = yes, also process mixed events"}; Configurable cfgPtOrder{"ptorder", false, "enforce pT_1 < pT_2. Defalut: false"}; + Configurable cfgNoOfDimensions{"cfgNoOfDimensions", 1, "Number of dimensions for the NUA&NUE corrections. Default 1"}; OutputObj fOutput{"DptDptCorrelationsData", OutputObjHandlingPolicy::AnalysisObject, OutputObjSourceType::OutputObjSource}; void init(InitContext& initContext) @@ -902,6 +950,7 @@ struct DptDptCorrelationsTask { ptorder = cfgPtOrder.value; invmass = cfgDoInvMass.value; corrana = cfgDoCorrelations.value; + nNoOfDimensions = cfgNoOfDimensions.value; /* self configure the CCDB access to the input file */ getTaskOptionValue(initContext, "dpt-dpt-filter", "input_ccdburl", cfgCCDBUrl, false); @@ -960,7 +1009,7 @@ struct DptDptCorrelationsTask { auto cfg = new o2::analysis::TrackSelectionPIDCfg(); cfg->mUseIt = true; cfg->mExclude = false; - pidselector.Add(spid, cfg); + pidselector.addSpecies(spid, cfg); } } }; @@ -1016,7 +1065,7 @@ struct DptDptCorrelationsTask { fCentMultMax[0] = 100.0f; } if (cfgSmallDCE) { - dataCE_small = new DataCollectingEngine*[ncmranges]; + dataCEsmall = new DataCollectingEngine*[ncmranges]; } else { dataCE = new DataCollectingEngine*[ncmranges]; } @@ -1065,7 +1114,7 @@ struct DptDptCorrelationsTask { if (invmass) { LOGF(fatal, "Invariant mass cannot be used with singles in the small DCE mode, please configure properly!!"); } - dataCE_small[i] = builSmallDCEInstance(range.Data()); + dataCEsmall[i] = builSmallDCEInstance(range.Data()); } else { if (invmass) { if (!processpairs) { @@ -1148,6 +1197,14 @@ struct DptDptCorrelationsTask { return grpo->getNominalL3Field(); } + const char* getDimensionStr() + { + using namespace correlationstask; + + static constexpr std::string_view kStrDim[] = {"", "", "2D", "3D", "4D"}; + return kStrDim[nNoOfDimensions].data(); + } + template void processSame(FilterdCollision const& collision, FilteredTracks const& tracks, uint64_t timestamp = 0) { @@ -1164,21 +1221,21 @@ struct DptDptCorrelationsTask { if (!(ixDCE < 0)) { auto isCCDBstored = [&]() { if (cfgSmallDCE.value) { - return dataCE_small[ixDCE]->isCCDBstored(); + return dataCEsmall[ixDCE]->isCCDBstored(); } else { return dataCE[ixDCE]->isCCDBstored(); } }; auto storePtAverages = [&](auto& ptavgs) { if (cfgSmallDCE.value) { - dataCE_small[ixDCE]->storePtAverages(ptavgs); + dataCEsmall[ixDCE]->storePtAverages(ptavgs); } else { dataCE[ixDCE]->storePtAverages(ptavgs); } }; auto storeTrackCorrections = [&](auto& corrs) { if (cfgSmallDCE.value) { - dataCE_small[ixDCE]->storeTrackCorrections(corrs); + dataCEsmall[ixDCE]->storeTrackCorrections(corrs); } else { dataCE[ixDCE]->storeTrackCorrections(corrs); } @@ -1196,14 +1253,15 @@ struct DptDptCorrelationsTask { } storePtAverages(ptavgs); } else { - std::vector corrs{tnames.size(), nullptr}; + std::vector corrs{tnames.size(), nullptr}; for (uint isp = 0; isp < tnames.size(); ++isp) { - corrs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("correction_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tnames[isp].c_str()) - .Data())); + auto hName = TString::Format("correction%s_%02d-%02d_%s", getDimensionStr(), static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE]), tnames[isp].c_str()); + corrs[isp] = reinterpret_cast(ccdblst->FindObject(hName.Data())); + if (corrs[isp] != nullptr) { + LOGF(info, "Loaded %s", corrs[isp]->GetName()); + } else { + LOGF(warning, "No correction histogram for species %d with name %s", isp, hName.Data()); + } } storeTrackCorrections(corrs); std::vector ptavgs{tnames.size(), nullptr}; @@ -1236,7 +1294,7 @@ struct DptDptCorrelationsTask { bfield = (fUseConversionCuts || fUseTwoTrackCut) ? getMagneticField(timestamp) : 0; } if (cfgSmallDCE.value) { - dataCE_small[ixDCE]->processCollision(tracks, tracks, collision.posZ(), collision.centmult(), bfield); + dataCEsmall[ixDCE]->processCollision(tracks, tracks, collision.posZ(), collision.centmult(), bfield); } else { dataCE[ixDCE]->processCollision(tracks, tracks, collision.posZ(), collision.centmult(), bfield); } @@ -1270,14 +1328,15 @@ struct DptDptCorrelationsTask { } dataCEME[ixDCE]->storePtAverages(ptavgs); } else { - std::vector corrs{tnames.size(), nullptr}; + std::vector corrs{tnames.size(), nullptr}; for (uint isp = 0; isp < tnames.size(); ++isp) { - corrs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("correction_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tnames[isp].c_str()) - .Data())); + auto hName = TString::Format("correction%s_%02d-%02d_%s", getDimensionStr(), static_cast(fCentMultMin[ixDCE]), static_cast(fCentMultMax[ixDCE]), tnames[isp].c_str()); + corrs[isp] = reinterpret_cast(ccdblst->FindObject(hName.Data())); + if (corrs[isp] != nullptr) { + LOGF(info, "Loaded %s", corrs[isp]->GetName()); + } else { + LOGF(warning, "No correction histogram for species %d with name %s", isp, hName.Data()); + } } dataCEME[ixDCE]->storeTrackCorrections(corrs); std::vector ptavgs{tnames.size(), nullptr}; @@ -1318,20 +1377,20 @@ struct DptDptCorrelationsTask { Filter onlyacceptedcollisions = (aod::dptdptfilter::collisionaccepted == uint8_t(true)); Filter onlyacceptedtracks = (aod::dptdptfilter::trackacceptedid >= int8_t(0)); - void processRecLevel(soa::Filtered::iterator const& collision, aod::BCsWithTimestamps const&, soa::Filtered& tracks) + void processRecLevel(soa::Filtered::iterator const& collision, aod::BCsWithTimestamps const&, soa::Filtered const& tracks) { processSame(collision, tracks, collision.bc_as().timestamp()); } PROCESS_SWITCH(DptDptCorrelationsTask, processRecLevel, "Process reco level correlations", false); - void processRecLevelCheck(aod::Collisions const& collisions, aod::Tracks& tracks) + void processRecLevelCheck(aod::Collisions const& collisions, aod::Tracks const& tracks) { int nAssignedTracks = 0; int nNotAssignedTracks = 0; int64_t firstNotAssignedIndex = -1; int64_t lastNotAssignedIndex = -1; - for (auto track : tracks) { + for (auto const& track : tracks) { if (track.has_collision()) { nAssignedTracks++; } else { @@ -1351,14 +1410,14 @@ struct DptDptCorrelationsTask { } PROCESS_SWITCH(DptDptCorrelationsTask, processRecLevelCheck, "Process reco level checks", true); - void processGenLevelCheck(aod::McCollisions const& mccollisions, aod::McParticles& particles) + void processGenLevelCheck(aod::McCollisions const& mccollisions, aod::McParticles const& particles) { int nAssignedParticles = 0; int nNotAssignedParticles = 0; int64_t firstNotAssignedIndex = -1; int64_t lastNotAssignedIndex = -1; - for (auto particle : particles) { + for (auto const& particle : particles) { if (particle.has_mcCollision()) { nAssignedParticles++; } else { @@ -1381,18 +1440,15 @@ struct DptDptCorrelationsTask { void processRecLevelNotStored( soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, - soa::Filtered>& tracks) + soa::Filtered> const& tracks) { processSame(collision, tracks, collision.bc_as().timestamp()); } - PROCESS_SWITCH(DptDptCorrelationsTask, - processRecLevelNotStored, - "Process reco level correlations for not stored derived data", - true); + PROCESS_SWITCH(DptDptCorrelationsTask, processRecLevelNotStored, "Process reco level correlations for not stored derived data", true); void processGenLevel( soa::Filtered::iterator const& collision, - soa::Filtered>& tracks) + soa::Filtered> const& tracks) { processSame(collision, tracks); } @@ -1400,14 +1456,11 @@ struct DptDptCorrelationsTask { void processGenLevelNotStored( soa::Filtered>::iterator const& collision, - soa::Filtered>& particles) + soa::Filtered> const& particles) { processSame(collision, particles); } - PROCESS_SWITCH(DptDptCorrelationsTask, - processGenLevelNotStored, - "Process generator level correlations for not stored derived data", - false); + PROCESS_SWITCH(DptDptCorrelationsTask, processGenLevelNotStored, "Process generator level correlations for not stored derived data", false); std::vector vtxBinsEdges{VARIABLE_WIDTH, -7.0f, -5.0f, -3.0f, -1.0f, 1.0f, 3.0f, 5.0f, 7.0f}; @@ -1416,14 +1469,14 @@ struct DptDptCorrelationsTask { using BinningZVtxMultRec = ColumnBinningPolicy; BinningZVtxMultRec bindingOnVtxAndMultRec{{vtxBinsEdges, multBinsEdges}, true}; // true is for 'ignore overflows' (true by default) - void processRecLevelMixed(soa::Filtered& collisions, aod::BCsWithTimestamps const&, soa::Filtered& tracks) + void processRecLevelMixed(soa::Filtered const& collisions, aod::BCsWithTimestamps const&, soa::Filtered const& tracks) { auto tracksTuple = std::make_tuple(tracks); SameKindPair, soa::Filtered, BinningZVtxMultRec> pairreco{bindingOnVtxAndMultRec, 5, -1, collisions, tracksTuple, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored LOGF(DPTDPTLOGCOLLISIONS, "Received %d collisions", collisions.size()); int logcomb = 0; - for (auto& [collision1, tracks1, collision2, tracks2] : pairreco) { + for (auto const& [collision1, tracks1, collision2, tracks2] : pairreco) { if (logcomb < 10) { LOGF(DPTDPTLOGCOLLISIONS, "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", @@ -1441,9 +1494,9 @@ struct DptDptCorrelationsTask { PROCESS_SWITCH(DptDptCorrelationsTask, processRecLevelMixed, "Process reco level mixed events correlations", false); void processRecLevelMixedNotStored( - soa::Filtered>& collisions, + soa::Filtered> const& collisions, aod::BCsWithTimestamps const&, - soa::Filtered>& tracks) + soa::Filtered> const& tracks) { auto tracksTuple = std::make_tuple(tracks); SameKindPair>, @@ -1458,7 +1511,7 @@ struct DptDptCorrelationsTask { LOGF(DPTDPTLOGCOLLISIONS, "Received %d collisions", collisions.size()); int logcomb = 0; - for (auto& [collision1, tracks1, collision2, tracks2] : pairreco) { + for (auto const& [collision1, tracks1, collision2, tracks2] : pairreco) { if (logcomb < 10) { LOGF(DPTDPTLOGCOLLISIONS, "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", @@ -1490,22 +1543,19 @@ struct DptDptCorrelationsTask { collision1.bc_as().timestamp()); } } - PROCESS_SWITCH(DptDptCorrelationsTask, - processRecLevelMixedNotStored, - "Process reco level mixed events correlations for not stored derived data", - false); + PROCESS_SWITCH(DptDptCorrelationsTask, processRecLevelMixedNotStored, "Process reco level mixed events correlations for not stored derived data", false); using BinningZVtxMultGen = ColumnBinningPolicy; BinningZVtxMultGen bindingOnVtxAndMultGen{{vtxBinsEdges, multBinsEdges}, true}; // true is for 'ignore overflows' (true by default) - void processGenLevelMixed(soa::Filtered& collisions, soa::Filtered& tracks) + void processGenLevelMixed(soa::Filtered const& collisions, soa::Filtered const& tracks) { auto tracksTuple = std::make_tuple(tracks); SameKindPair, soa::Filtered, BinningZVtxMultGen> pairgen{bindingOnVtxAndMultGen, 5, -1, collisions, tracksTuple, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored LOGF(DPTDPTLOGCOLLISIONS, "Received %d generated collisions", collisions.size()); int logcomb = 0; - for (auto& [collision1, tracks1, collision2, tracks2] : pairgen) { + for (auto const& [collision1, tracks1, collision2, tracks2] : pairgen) { if (logcomb < 10) { LOGF(DPTDPTLOGCOLLISIONS, "Received generated collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", @@ -1521,9 +1571,7 @@ struct DptDptCorrelationsTask { } PROCESS_SWITCH(DptDptCorrelationsTask, processGenLevelMixed, "Process generator level mixed events correlations", false); - void processGenLevelMixedNotStored( - soa::Filtered>& collisions, - soa::Filtered>& tracks) + void processGenLevelMixedNotStored(soa::Filtered> const& collisions, soa::Filtered> const& tracks) { auto tracksTuple = std::make_tuple(tracks); SameKindPair>, @@ -1538,7 +1586,7 @@ struct DptDptCorrelationsTask { LOGF(DPTDPTLOGCOLLISIONS, "Received %d generated collisions", collisions.size()); int logcomb = 0; - for (auto& [collision1, tracks1, collision2, tracks2] : pairgen) { + for (auto const& [collision1, tracks1, collision2, tracks2] : pairgen) { if (logcomb < 10) { LOGF(DPTDPTLOGCOLLISIONS, "Received generated collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", @@ -1566,10 +1614,7 @@ struct DptDptCorrelationsTask { processMixed(collision1, tracks1, tracks2); } } - PROCESS_SWITCH(DptDptCorrelationsTask, - processGenLevelMixedNotStored, - "Process generator level mixed events correlations for not stored derived data", - false); + PROCESS_SWITCH(DptDptCorrelationsTask, processGenLevelMixedNotStored, "Process generator level mixed events correlations for not stored derived data", false); /// cleans the output object when the task is not used void processCleaner(soa::Filtered const& colls) @@ -1583,7 +1628,7 @@ struct DptDptCorrelationsTask { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc, TaskName{"DptDptCorrelationsTaskRec"}, SetDefaultProcesses{{{"processRecLevel", true}, {"processRecLevelMixed", false}, {"processCleaner", false}}}), - adaptAnalysisTask(cfgc, TaskName{"DptDptCorrelationsTaskGen"}, SetDefaultProcesses{{{"processGenLevel", false}, {"processGenLevelMixed", false}, {"processCleaner", true}}})}; + adaptAnalysisTask(cfgc, TaskName{"DptDptCorrelationsTaskRec"}, SetDefaultProcesses{{{"processRecLevel", true}, {"processRecLevelMixed", false}, {"processCleaner", false}}}), // o2-linter: disable=name/o2-task + adaptAnalysisTask(cfgc, TaskName{"DptDptCorrelationsTaskGen"}, SetDefaultProcesses{{{"processGenLevel", false}, {"processGenLevelMixed", false}, {"processCleaner", true}}})}; // o2-linter: disable=name/o2-task return workflow; } diff --git a/PWGCF/Tasks/match-reco-gen.cxx b/PWGCF/Tasks/match-reco-gen.cxx index adf0b363e6b..2b2fe0fa47e 100644 --- a/PWGCF/Tasks/match-reco-gen.cxx +++ b/PWGCF/Tasks/match-reco-gen.cxx @@ -10,6 +10,8 @@ // or submit itself to any jurisdiction. #include +#include +#include #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" @@ -20,11 +22,11 @@ #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" #include "PWGCF/Core/AnalysisConfigurableCuts.h" #include "PWGCF/DataModel/DptDptFiltered.h" #include "PWGCF/TableProducer/dptdptfilter.h" -#include #include #include #include @@ -69,6 +71,7 @@ struct CheckGeneratorLevelVsDetectorLevel { Configurable cfgTrackCollAssoc{"trackcollassoc", false, "Track collision id association, track-mcparticle-mccollision vs. track-collision-mccollision: true, false. Default false"}; HistogramRegistry histos{"RecoGenHistograms", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + Service fPDG; typedef enum { kBEFORE = 0, kAFTER } beforeafterselection; typedef enum { kPOSITIVE = 0, @@ -108,7 +111,6 @@ struct CheckGeneratorLevelVsDetectorLevel { /* if the system type is not known at this time, we have to put the initialization somewhere else */ fSystem = getSystemType(cfgSystem); fDataType = getDataType(cfgDataType); - fPDG = TDatabasePDG::Instance(); AxisSpec deltaEta = {100, -2, 2, "#Delta#eta"}; AxisSpec deltaPhi = {100, 0, constants::math::TwoPI, "#Delta#varphi (rad)"}; @@ -335,10 +337,10 @@ struct CheckGeneratorLevelVsDetectorLevel { size_t nreco = tracks.size(); size_t ngen = 0; - for (auto& part : mcParticles) { + for (auto const& part : mcParticles) { auto pdgpart = fPDG->GetParticle(part.pdgCode()); if (pdgpart != nullptr) { - float charge = (pdgpart->Charge() >= 3) ? 1.0 : ((pdgpart->Charge() <= -3) ? -1.0 : 0.0); + float charge = getCharge(pdgpart->Charge()); if (charge != 0.0) { ngen++; } @@ -392,7 +394,7 @@ struct CheckGeneratorLevelVsDetectorLevel { for (auto& part : mcParticles) { auto pdgpart = fPDG->GetParticle(part.pdgCode()); if (pdgpart != nullptr) { - float charge = (pdgpart->Charge() >= 3) ? 1.0 : ((pdgpart->Charge() <= -3) ? -1.0 : 0.0); + float charge = getCharge(pdgpart->Charge()); if (charge != 0.0) { ngen++; } @@ -407,9 +409,9 @@ struct CheckGeneratorLevelVsDetectorLevel { if (!(track.collisionId() < 0)) { typename CollisionsObject::iterator coll = collisions.iteratorAt(track.collisionId()); float centormult = -100.0f; - if (IsEvtSelected(coll, centormult)) { + if (isEventSelected(coll, centormult)) { /* TODO: AcceptTrack does not consider PID */ - if (AcceptTrack(track)) { + if (acceptTrack(track)) { /* the track has been accepted */ nreco++; LOGF(MATCHRECGENLOGTRACKS, "Accepted track with global Id %d and collision Id %d has label %d associated to MC collision %d", recix, track.collisionId(), label, track.template mcParticle_as().mcCollisionId()); diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx index 734b1b1185c..fee15c95f97 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx @@ -12,6 +12,8 @@ #include #include +#include +#include #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -935,9 +937,9 @@ struct IdentifiedBfFilterTracks { template inline MatchRecoGenSpecies IdentifyTrack(TrackObject const& track); template - MatchRecoGenSpecies trackIdentification(TrackObject const& track); - template int8_t AcceptTrack(TrackObject const& track); + template + int8_t AcceptParticle(ParticleObject& particle, MCCollisionObject const& mccollision); template int8_t selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track); template @@ -1018,7 +1020,6 @@ struct IdentifiedBfFilterTracks { void filterParticles(soa::Join const& gencollisions, aod::McParticles const& particles) { using namespace identifiedbffilter; - int acceptedparticles = 0; int acceptedcollisions = 0; if (!fullDerivedData) { @@ -1047,38 +1048,9 @@ struct IdentifiedBfFilterTracks { fillParticleHistosBeforeSelection(particle, mccollision, charge); /* track selection */ - /* TODO: at some point the pid has to be substituted by the identified species */ pid = AcceptParticle(particle, mccollision); - if (!(pid < 0)) { - /* the particle has been accepted */ - /* let's identify the particle */ - /* TODO: probably this needs to go to AcceptParticle */ - MatchRecoGenSpecies sp = IdentifyParticle(particle); - if (sp != kWrongSpecies) { - if (sp != kIdBfCharged) { - /* fill the charged particle histograms */ - fillParticleHistosAfterSelection(particle, mccollision, charge, kIdBfCharged); - /* update charged multiplicities */ - if (pid % 2 == 0) { - partMultPos[kIdBfCharged]++; - } - if (pid % 2 == 1) { - partMultNeg[kIdBfCharged]++; - } - } - /* fill the species histograms */ - fillParticleHistosAfterSelection(particle, mccollision, charge, sp); - /* update species multiplicities */ - if (pid % 2 == 0) { - partMultPos[sp]++; - } - if (pid % 2 == 1) { - partMultNeg[sp]++; - } - acceptedparticles++; - } else { - pid = -1; - } + if (!(pid < 0)) { // if PID isn't negative + acceptedparticles++; } } } else { @@ -1159,7 +1131,7 @@ struct IdentifiedBfFilterTracks { } PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithoutPIDAmbiguous, "Track filtering without PID information with ambiguous tracks check", false) - void filterDetectorLevelWithoutPID(soa::Join const& collisions, IdBfFullTracksDetLevel const& tracks) + void filterDetectorLevelWithoutPID(soa::Join const& collisions, IdBfFullTracksDetLevel const& tracks, aod::McParticles const&) { filterTracks(collisions, tracks); } @@ -1182,7 +1154,6 @@ template inline MatchRecoGenSpecies IdentifiedBfFilterTracks::IdentifyParticle(ParticleObject const& particle) { using namespace identifiedbffilter; - constexpr int pdgcodeEl = 11; constexpr int pdgcodePi = 211; constexpr int pdgcodeKa = 321; @@ -1357,31 +1328,6 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::IdentifyTrack(TrackObject c } } -template -MatchRecoGenSpecies IdentifiedBfFilterTracks::trackIdentification(TrackObject const& track) -{ - using namespace identifiedbffilter; - - MatchRecoGenSpecies sp = kWrongSpecies; - if (recoIdMethod == 0) { - sp = kIdBfCharged; - } else if (recoIdMethod == 1) { - - if constexpr (framework::has_type_v || framework::has_type_v) { - sp = IdentifyTrack(track); - } else { - LOGF(fatal, "Track identification required but PID information not present"); - } - } else if (recoIdMethod == 2) { - if constexpr (framework::has_type_v) { - sp = IdentifyParticle(track.template mcParticle_as()); - } else { - LOGF(fatal, "Track identification required from MC particle but MC information not present"); - } - } - return sp; -} - /// \brief Accepts or not the passed track /// \param track the track of interest /// \return the internal track id, -1 if not accepted @@ -1404,17 +1350,33 @@ inline int8_t IdentifiedBfFilterTracks::AcceptTrack(TrackObject const& track) if (matchTrackType(track)) { if (ptlow < track.pt() && track.pt() < ptup && etalow < track.eta() && track.eta() < etaup) { fillTrackHistosAfterSelection(track, kIdBfCharged); - MatchRecoGenSpecies sp = trackIdentification(track); + MatchRecoGenSpecies sp = kWrongSpecies; + if (recoIdMethod == 0) { + sp = kIdBfCharged; + } else if (recoIdMethod == 1) { + + if constexpr (framework::has_type_v || framework::has_type_v) { + sp = IdentifyTrack(track); + } else { + LOGF(fatal, "Track identification required but PID information not present"); + } + } else if (recoIdMethod == 2) { + if constexpr (framework::has_type_v) { + sp = IdentifyParticle(track.template mcParticle_as()); + } else { + LOGF(fatal, "Track identification required from MC particle but MC information not present"); + } + } if (sp == kWrongSpecies) { return -1; } if (!(sp < 0)) { fillTrackHistosAfterSelection(track, sp); // 0) { + if (track.sign() > 0) { // if positive trkMultPos[sp]++; //<< Update Particle Multiplicity return speciesChargeValue1[sp]; } - if (track.sign() < 0) { + if (track.sign() < 0) { // if negative trkMultNeg[sp]++; //<< Update Particle Multiplicity return speciesChargeValue1[sp] + 1; } @@ -1424,6 +1386,61 @@ inline int8_t IdentifiedBfFilterTracks::AcceptTrack(TrackObject const& track) return -1; } +/// \brief Accepts or not the passed generated particle +/// \param track the particle of interest +/// \return `true` if the particle is accepted, `false` otherwise +template +inline int8_t IdentifiedBfFilterTracks::AcceptParticle(ParticleObject& particle, MCCollisionObject const& mccollision) +{ + /* overall momentum cut */ + if (!(overallminp < particle.p())) { + return kWrongSpecies; + } + + float charge = getCharge(particle); + + if (particle.isPhysicalPrimary()) { + if ((particle.mcCollisionId() == 0) && traceCollId0) { + LOGF(info, "Particle %d passed isPhysicalPrimary", particle.globalIndex()); + } + + if (ptlow < particle.pt() && particle.pt() < ptup && etalow < particle.eta() && particle.eta() < etaup) { + MatchRecoGenSpecies sp = IdentifyParticle(particle); + if (sp != kWrongSpecies) { + if (sp != kIdBfCharged) { + /* fill the charged particle histograms */ + fillParticleHistosAfterSelection(particle, mccollision, charge, kIdBfCharged); + /* update charged multiplicities */ + if (charge == 1) { + partMultPos[kIdBfCharged]++; + } else if (charge == -1) { + partMultNeg[kIdBfCharged]++; + } + } + /* fill the species histograms */ + fillParticleHistosAfterSelection(particle, mccollision, charge, sp); + /* update species multiplicities */ + if (charge == 1) { + partMultPos[sp]++; + } else if (charge == -1) { + partMultNeg[sp]++; + } + } + if (charge == 1) { + return speciesChargeValue1[sp]; + + } else if (charge == -1) { + return speciesChargeValue1[sp] + 1; + } + } + } else { + if ((particle.mcCollisionId() == 0) && traceCollId0) { + LOGF(info, "Particle %d NOT passed isPhysicalPrimary", particle.globalIndex()); + } + } + return kWrongSpecies; +} + template int8_t IdentifiedBfFilterTracks::selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track) { diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h index a502101a818..6897cac98b4 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h +++ b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h @@ -34,8 +34,8 @@ namespace aod { using CollisionsEvSelCent = soa::Join; using CollisionEvSelCent = soa::Join::iterator; -using CollisionsEvSelRun2Cent = soa::Join; -using CollisionEvSelRun2Cent = soa::Join::iterator; +using CollisionsEvSelRun2Cent = soa::Join; +using CollisionEvSelRun2Cent = soa::Join::iterator; using CollisionsEvSel = soa::Join; using CollisionEvSel = soa::Join::iterator; using TrackData = soa::Join::iterator; @@ -45,6 +45,8 @@ namespace analysis namespace identifiedbffilter { +const std::vector pdgcodes = {11, 211, 321, 2212}; + /// \enum MatchRecoGenSpecies /// \brief The species considered by the matching test enum MatchRecoGenSpecies { @@ -128,6 +130,8 @@ enum CentMultEstimatorType { knCentMultEstimators ///< number of centrality/mutiplicity estimator }; +float overallminp = 0.0f; + /// \enum TriggerSelectionType /// \brief The type of trigger to apply for event selection enum TriggerSelectionType { @@ -519,38 +523,60 @@ inline float extractMultiplicity(CollisionObject const& collision, CentMultEstim ////////////////////////////////////////////////////////////////////////////////// /// \brief Centrality/multiplicity percentile template - requires(o2::aod::HasRun2Centrality) float getCentMultPercentile(CollisionObject collision) { - switch (fCentMultEstimator) { - case kV0M: - return collision.centRun2V0M(); - case kCL0: - return collision.centRun2CL0(); - case kCL1: - return collision.centRun2CL1(); - default: - return 105.0; - } -} + if constexpr (framework::has_type_v || + framework::has_type_v || + framework::has_type_v) { + switch (fCentMultEstimator) { + case kV0M: + return collision.centRun2V0M(); + break; + case kCL0: + if constexpr (framework::has_type_v) { + return collision.centRun2CL0(); + } else { + return 105.0; + } + break; -template - requires(o2::aod::HasCentrality) -float getCentMultPercentile(CollisionObject collision) -{ - switch (fCentMultEstimator) { - case kFV0A: - return collision.centFV0A(); - case kFT0M: - return collision.centFT0M(); - case kFT0A: - return collision.centFT0A(); - case kFT0C: - return collision.centFT0C(); - case kNTPV: - return collision.centNTPV(); - default: - return 105.0; + case kCL1: + if constexpr (framework::has_type_v) { + return collision.centRun2CL1(); + } else { + return 105.0; + } + break; + default: + return 105.0; + break; + } + } + if constexpr (framework::has_type_v || + framework::has_type_v || + framework::has_type_v || + framework::has_type_v || + framework::has_type_v) { + switch (fCentMultEstimator) { + case kFV0A: + return collision.centFV0A(); + break; + case kFT0M: + return collision.centFT0M(); + break; + case kFT0A: + return collision.centFT0A(); + break; + case kFT0C: + return collision.centFT0C(); + break; + case kNTPV: + return collision.centNTPV(); + break; + default: + return 105.0; + break; + } } } @@ -716,54 +742,15 @@ void exploreMothers(ParticleObject& particle, MCCollisionObject& collision) } } -/// \brief Accepts or not the passed generated particle -/// \param track the particle of interest -/// \return the internal particle id, -1 if not accepted -/// TODO: the PID implementation -/// For the time being we keep the convention -/// - positive particle pid even -/// - negative particle pid odd -/// - charged hadron 0/1 -template -inline int8_t AcceptParticle(ParticleObject& particle, MCCollisionObject const& collision) +template +inline float getCharge(ParticleObject& particle) { - float charge = (fPDG->GetParticle(particle.pdgCode())->Charge() / 3 >= 1) ? 1.0 : ((fPDG->GetParticle(particle.pdgCode())->Charge() / 3 <= -1) ? -1.0 : 0.0); - - if (particle.isPhysicalPrimary()) { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Particle %d passed isPhysicalPrimary", particle.globalIndex()); - } - if (useOwnParticleSelection) { - float dcaxy = TMath::Sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); - float dcaz = TMath::Abs(particle.vz() - collision.posZ()); - if (!((dcaxy < particleMaxDCAxy) && (dcaz < particleMaxDCAZ))) { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Rejecting particle with dcaxy: %.2f and dcaz: %.2f", dcaxy, dcaz); - LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", particle.mcCollisionId(), collision.globalIndex()); - LOGF(info, " Collision x: %.5f, y: %.5f, z: %.5f", collision.posX(), collision.posY(), collision.posZ()); - LOGF(info, " Particle x: %.5f, y: %.5f, z: %.5f", particle.vx(), particle.vy(), particle.vz()); - LOGF(info, " index: %d, pdg code: %d", particle.globalIndex(), particle.pdgCode()); - - exploreMothers(particle, collision); - } - return -1; - } - } - if (ptlow < particle.pt() && particle.pt() < ptup && etalow < particle.eta() && particle.eta() < etaup) { - if (charge > 0) { - return 0; - } - if (charge < 0) { - return 1; - } - } - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Particle %d NOT passed isPhysicalPrimary", particle.globalIndex()); - } + float charge = 0.0; + TParticlePDG* pdgparticle = fPDG->GetParticle(particle.pdgCode()); + if (pdgparticle != nullptr) { + charge = (pdgparticle->Charge() / 3 >= 1) ? 1.0 : ((pdgparticle->Charge() / 3 <= -1) ? -1.0 : 0); } - return -1; + return charge; } } // namespace identifiedbffilter diff --git a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt index f6742441246..84207fe8c5b 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt +++ b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt @@ -33,8 +33,8 @@ o2physics_add_dpl_workflow(identifiedbf-filter-qa PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(twopartcorr-efficiency-qc - SOURCES efficiencyAndQc.cxx +o2physics_add_dpl_workflow(dpt-dpt-efficiency-and-qc + SOURCES dptDptEfficiencyAndQc.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) @@ -47,3 +47,17 @@ o2physics_add_dpl_workflow(twopartcorr-per-run-extraqc SOURCES perRunExtraQc.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(corr-sparse + SOURCES corrSparse.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(neutronprotoncorrzdc + SOURCES neutronProtonCorrZdc.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + + + + diff --git a/PWGCF/TwoParticleCorrelations/Tasks/corrSparse.cxx b/PWGCF/TwoParticleCorrelations/Tasks/corrSparse.cxx new file mode 100644 index 00000000000..49d9a573de9 --- /dev/null +++ b/PWGCF/TwoParticleCorrelations/Tasks/corrSparse.cxx @@ -0,0 +1,177 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file corrSparse.cxx +/// \brief Provides a sparse with usefull two particle correlation info +/// \author Thor Jensen (djt288@alumni.ku.dk) + +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "CommonConstants/MathConstants.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" +#include "Common/Core/RecoDecay.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct CorrSparse { + Configurable cfgZVtxCut = {"cfgZVtxCut", 10.0, "Vertex z cut. Default 10 cm"}; + Configurable cfgPtCutMin = {"cfgPtCutMin", 0.2, "Minimum accepted track pT. Default 0.2 GeV"}; + Configurable cfgPtCutMax = {"cfgPtCutMax", 5.0, "Maximum accepted track pT. Default 5.0 GeV"}; + Configurable cfgEtaCut = {"cfgEtaCut", 0.8, "Eta cut. Default 0.8"}; + ConfigurableAxis axisVertex{"axisVertex", {7, -7, 7}, "vertex axis for histograms"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; + ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"}; + 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"}; + 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"}; + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100}, "multiplicity / centrality axis for histograms"}; + HistogramRegistry registry{"registry"}; + int logcolls = 0; + int logcollpairs = 0; + + void init(InitContext&) + { + LOGF(info, "Starting init"); + 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 + registry.add("etaphi_Trigger", "eta vs phi vs Nch", {HistType::kTH3F, {{100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}, {100, 0, 100, "Nch"}}}); + + // Make histograms to check the distributions after cuts + registry.add("deltaEta_deltaPhi_same", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution + registry.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); + registry.add("Phi", "Phi", {HistType::kTH1D, {{72, 0, TwoPI, "Phi"}}}); + registry.add("Eta", "Eta", {HistType::kTH1D, {{40, -2, 2, "Eta"}}}); + registry.add("pT", "pT", {HistType::kTH1D, {axisPtTrigger}}); + registry.add("Nch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); + + registry.add("Sparse_mixed", "", {HistType::kTHnSparseD, {{axisVertex, axisPtTrigger, axisPtAssoc, axisMultiplicity, axisDeltaPhi, axisDeltaEta}}}); // Make the output sparse + registry.add("Sparse_same", "", {HistType::kTHnSparseD, {{axisVertex, axisPtTrigger, axisPtAssoc, axisMultiplicity, axisDeltaPhi, axisDeltaEta}}}); + + const int maxMixBin = axisMultiplicity->size() * axisVertex->size(); + 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 + } + + // fill multiple histograms + template + void fillYield(TCollision /*collision*/, float /*centrality*/, TTracks tracks) // function to fill the yield and etaphi histograms. + { + registry.fill(HIST("Nch"), tracks.size()); + for (auto const& track1 : tracks) { + registry.fill(HIST("Yield"), track1.pt(), track1.eta(), track1.size()); + registry.fill(HIST("etaphi_Trigger"), track1.eta(), track1.phi(), track1.size()); + registry.fill(HIST("Phi"), track1.phi()); + registry.fill(HIST("Eta"), track1.eta()); + registry.fill(HIST("pT"), track1.pt()); + } + } + + template + bool fillCollision(TCollision collision, float /*centrality*/) + { + + if (!collision.sel8()) { + return false; + } + + return true; + } + + template + 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 + { + // loop over all tracks + for (auto const& track1 : tracks1) { + + for (auto const& track2 : tracks2) { + if (track1 == track2) { + continue; + } + + float deltaPhi = RecoDecay::constrainAngle(track1.phi() - track2.phi(), -PIHalf); + float deltaEta = track1.eta() - track2.eta(); + + // fill the right sparse and histograms + if (system == 1) { + registry.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta); + registry.fill(HIST("Sparse_same"), posZ, track1.pt(), track2.pt(), Nch, deltaPhi, deltaEta); + } else if (system == 2) { + registry.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta); + registry.fill(HIST("Sparse_mixed"), posZ, track1.pt(), track2.pt(), Nch, deltaPhi, deltaEta); + } + } + } + } + + // make the filters and cuts. + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgZVtxCut; + + Filter trackFilter = (nabs(aod::track::eta) < cfgEtaCut) && (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)); + + // define the filtered collisions and tracks + + using AodCollisions = soa::Filtered>; + using AodTracks = soa::Filtered>; + + void processSame(AodCollisions::iterator const& collision, AodTracks const& tracks) + { + const auto centrality = collision.centFT0C(); + + registry.fill(HIST("eventcount"), -2); // because its same event i put it in the -2 bin + fillYield(collision, centrality, tracks); + fillCorrelations(tracks, tracks, collision.posZ(), 1, tracks.size()); // fill the SE histogram and Sparse + } + PROCESS_SWITCH(CorrSparse, processSame, "Process same event", true); + + // i do the event mixing (i have not changed this from the tutorial i got). + std::vector vtxBinsEdges{VARIABLE_WIDTH, -7.0f, -5.0f, -3.0f, -1.0f, 1.0f, 3.0f, 5.0f, 7.0f}; + std::vector multBinsEdges{VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0, 100.1f}; + SliceCache cache; + + ColumnBinningPolicy + bindingOnVtxAndMult{{vtxBinsEdges, multBinsEdges}, true}; // true is for 'ignore overflows' (true by default) + SameKindPair> + pair{bindingOnVtxAndMult, 5, -1, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored + + // the process for filling the mixed events + void processMixed(AodCollisions const& /*collisions*/, AodTracks const& /*tracks*/) + { + for (auto const& [collision1, tracks1, collision2, tracks2] : pair) { + + if (fillCollision(collision1, collision1.centFT0C()) == false) { + continue; + } + + registry.fill(HIST("eventcount"), 1); // fill the mixed event in the 1 bin + + fillCorrelations(tracks1, tracks2, collision1.posZ(), 2, tracks1.size()); + } + } + PROCESS_SWITCH(CorrSparse, processMixed, "Process mixed events", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/PWGCF/TwoParticleCorrelations/Tasks/efficiencyAndQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx similarity index 54% rename from PWGCF/TwoParticleCorrelations/Tasks/efficiencyAndQc.cxx rename to PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx index 216f273fde3..b902057451a 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/efficiencyAndQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx @@ -9,9 +9,17 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file dptDptEfficiencyAndQc.cxx +/// \brief Provides efficiency extraction and QC for track cuts and PID +/// \author victor.gonzalez.sebastian@gmail.com + #include #include #include +#include +#include +#include +#include #include "ReconstructionDataFormats/PID.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TableHelper.h" @@ -45,12 +53,20 @@ using namespace o2::framework::expressions; namespace efficiencyandqatask { /// \enum KindOfProcessQA -/// \brief The kind of processing for templating the procedures -enum KindOfProcess { +/// \brief The kind of data for templating the procedures +enum KindOfData { kReco = 0, ///< processing over reconstructed particles/tracks kGen ///< processing over generated particles }; +/// \enum KindOfProcess +/// \brief The kind of processing for templating the procedures and produce histograms +enum KindOfProcess { + kBASIC, ///< produce the basic histograms + kPID, ///< produce the basic PID histograms + kPIDEXTRA ///< produce the extra PID histograms +}; + /// \enum BeforeAfter /// \brief The kind of filling, before or after track selection enum BeforeAfter { @@ -58,6 +74,12 @@ enum BeforeAfter { kAfter ///< filling after track selection }; +/* the configuration of the nsigma axis */ +float minNSigma = -4.05f; +float maxNSigma = 4.05f; +float widthNSigmaBin = 0.1f; +int noOfNSigmaBins = static_cast((maxNSigma - minNSigma) / widthNSigmaBin); + /* the PID selector object to help with the configuration and the id of the selected particles */ o2::analysis::dptdptfilter::PIDSpeciesSelection pidselector; @@ -91,65 +113,65 @@ struct QADataCollectingEngine { /* when two indexes, first index reco and detector level, second index generator level */ /* when no indexes, reco and detector level */ std::vector> fhPtB{2, nullptr}; - std::vector> fhPt_vs_EtaB{2, nullptr}; - std::vector> fhPt_vs_ZvtxB{2, nullptr}; + std::vector> fhPtVsEtaB{2, nullptr}; + std::vector> fhPtVsZvtxB{2, nullptr}; std::vector>> fhPtA{2, {nsp, nullptr}}; - std::vector>> fhPt_vs_EtaA{2, {nsp, nullptr}}; - std::vector>> fhPt_vs_ZvtxA{2, {nsp, nullptr}}; - std::shared_ptr fhPt_vs_EtaItsAcc{nullptr}; - std::shared_ptr fhPt_vs_EtaTpcAcc{nullptr}; - std::shared_ptr fhPt_vs_EtaItsTpcAcc{nullptr}; - std::shared_ptr fhPt_vs_EtaItsTofAcc{nullptr}; - std::shared_ptr fhPt_vs_EtaTpcTofAcc{nullptr}; - std::shared_ptr fhPt_vs_EtaItsTpcTofAcc{nullptr}; - std::vector> fhPt_vs_EtaItsA{nsp, nullptr}; - std::vector> fhPt_vs_EtaTpcA{nsp, nullptr}; - std::vector> fhPt_vs_EtaItsTpcA{nsp, nullptr}; - std::vector> fhPt_vs_EtaItsTofA{nsp, nullptr}; - std::vector> fhPt_vs_EtaTpcTofA{nsp, nullptr}; - std::vector> fhPt_vs_EtaItsTpcTofA{nsp, nullptr}; + std::vector>> fhPtVsEtaA{2, {nsp, nullptr}}; + std::vector>> fhPtVsZvtxA{2, {nsp, nullptr}}; + std::shared_ptr fhPtVsEtaItsAcc{nullptr}; + std::shared_ptr fhPtVsEtaTpcAcc{nullptr}; + std::shared_ptr fhPtVsEtaItsTpcAcc{nullptr}; + std::shared_ptr fhPtVsEtaItsTofAcc{nullptr}; + std::shared_ptr fhPtVsEtaTpcTofAcc{nullptr}; + std::shared_ptr fhPtVsEtaItsTpcTofAcc{nullptr}; + std::vector> fhPtVsEtaItsA{nsp, nullptr}; + std::vector> fhPtVsEtaTpcA{nsp, nullptr}; + std::vector> fhPtVsEtaItsTpcA{nsp, nullptr}; + std::vector> fhPtVsEtaItsTofA{nsp, nullptr}; + std::vector> fhPtVsEtaTpcTofA{nsp, nullptr}; + std::vector> fhPtVsEtaItsTpcTofA{nsp, nullptr}; /* primaries and secondaries */ /* overall, first index detector level second index generator level */ /* detailed, first index detector level, second index associated particle */ std::shared_ptr fhPtPurityPosPrimA{nullptr}; std::shared_ptr fhPtPurityNegPrimA{nullptr}; - std::vector> fhPt_vs_EtaPrimA{nsp, nullptr}; - std::vector>> fhPt_vs_EtaPrimItsA{2, {nsp, nullptr}}; - std::vector>> fhPt_vs_EtaPrimItsTpcA{2, {nsp, nullptr}}; - std::vector>> fhPt_vs_EtaPrimItsTpcTofA{2, {nsp, nullptr}}; + std::vector> fhPtVsEtaPrimA{nsp, nullptr}; + std::vector>> fhPtVsEtaPrimItsA{2, {nsp, nullptr}}; + std::vector>> fhPtVsEtaPrimItsTpcA{2, {nsp, nullptr}}; + std::vector>> fhPtVsEtaPrimItsTpcTofA{2, {nsp, nullptr}}; std::shared_ptr fhPtPurityPosSecA{nullptr}; std::shared_ptr fhPtPurityNegSecA{nullptr}; - std::vector> fhPt_vs_EtaSecA{nsp, nullptr}; - std::vector>> fhPt_vs_EtaSecItsA{2, {nsp, nullptr}}; - std::vector>> fhPt_vs_EtaSecItsTpcA{2, {nsp, nullptr}}; - std::vector>> fhPt_vs_EtaSecItsTpcTofA{2, {nsp, nullptr}}; + std::vector> fhPtVsEtaSecA{nsp, nullptr}; + std::vector>> fhPtVsEtaSecItsA{2, {nsp, nullptr}}; + std::vector>> fhPtVsEtaSecItsTpcA{2, {nsp, nullptr}}; + std::vector>> fhPtVsEtaSecItsTpcTofA{2, {nsp, nullptr}}; std::shared_ptr fhPtPurityPosMatA{nullptr}; std::shared_ptr fhPtPurityNegMatA{nullptr}; - std::vector> fhPt_vs_EtaMatA{nsp, nullptr}; - std::vector>> fhPt_vs_EtaMatItsA{2, {nsp, nullptr}}; - std::vector>> fhPt_vs_EtaMatItsTpcA{2, {nsp, nullptr}}; - std::vector>> fhPt_vs_EtaMatItsTpcTofA{2, {nsp, nullptr}}; + std::vector> fhPtVsEtaMatA{nsp, nullptr}; + std::vector>> fhPtVsEtaMatItsA{2, {nsp, nullptr}}; + std::vector>> fhPtVsEtaMatItsTpcA{2, {nsp, nullptr}}; + std::vector>> fhPtVsEtaMatItsTpcTofA{2, {nsp, nullptr}}; /* QC histograms */ - std::shared_ptr fhITS_NCls_vs_PtB{nullptr}; - std::shared_ptr fhITS_Chi2NCls_vs_PtB{nullptr}; - std::shared_ptr fhTPC_FindableNCls_vs_PtB{nullptr}; - std::shared_ptr fhTPC_FoundNCls_vs_PtB{nullptr}; - std::shared_ptr fhTPC_SharedNCls_vs_PtB{nullptr}; - std::shared_ptr fhTPC_FractionSharedCls_vs_PtB{nullptr}; - std::shared_ptr fhTPC_CrossedRows_vs_PtB{nullptr}; - std::shared_ptr fhTPC_CrossedRowsOverFindableCls_vs_PtB{nullptr}; - std::shared_ptr fhTPC_Chi2NCls_vs_PtB{nullptr}; - std::vector> fhITS_NCls_vs_PtA{nsp, nullptr}; - std::vector> fhITS_Chi2NCls_vs_PtA{nsp, nullptr}; - std::vector> fhTPC_FindableNCls_vs_PtA{nsp, nullptr}; - std::vector> fhTPC_FoundNCls_vs_PtA{nsp, nullptr}; - std::vector> fhTPC_SharedNCls_vs_PtA{nsp, nullptr}; - std::vector> fhTPC_FractionSharedCls_vs_PtA{nsp, nullptr}; - std::vector> fhTPC_CrossedRows_vs_PtA{nsp, nullptr}; - std::vector> fhTPC_CrossedRowsOverFindableCls_vs_PtA{nsp, nullptr}; - std::vector> fhTPC_Chi2NCls_vs_PtA{nsp, nullptr}; - - template + std::shared_ptr fhItsNClsVsPtB{nullptr}; + std::shared_ptr fhItsChi2NClsVsPtB{nullptr}; + std::shared_ptr fhTpcFindableNClsVsPtB{nullptr}; + std::shared_ptr fhTpcFoundNClsVsPtB{nullptr}; + std::shared_ptr fhTpcSharedNClsVsPtB{nullptr}; + std::shared_ptr fhTpcFractionSharedClsVsPtB{nullptr}; + std::shared_ptr fhTpcCrossedRowsVsPtB{nullptr}; + std::shared_ptr fhTpcCrossedRowsOverFindableClsVsPtB{nullptr}; + std::shared_ptr fhTpcChi2NClsVsPtB{nullptr}; + std::vector> fhItsNClsVsPtA{nsp, nullptr}; + std::vector> fhItsChi2NClsVsPtA{nsp, nullptr}; + std::vector> fhTpcFindableNClsVsPtA{nsp, nullptr}; + std::vector> fhTpcFoundNClsVsPtA{nsp, nullptr}; + std::vector> fhTpcSharedNClsVsPtA{nsp, nullptr}; + std::vector> fhTpcFractionSharedClsVsPtA{nsp, nullptr}; + std::vector> fhTpcCrossedRowsVsPtA{nsp, nullptr}; + std::vector> fhTpcCrossedRowsOverFindableClsVsPtA{nsp, nullptr}; + std::vector> fhTpcChi2NClsVsPtA{nsp, nullptr}; + + template void init(HistogramRegistry& registry, const char* dirname) { using namespace efficiencyandqatask; @@ -170,52 +192,52 @@ struct QADataCollectingEngine { const AxisSpec tpcCh2Axis{100, 0, 10, "#Chi^{2}/Cls TPC"}; /* the reconstructed and generated levels histograms */ - std::string recogen = (kind == kReco) ? "Reco" : "Gen"; - fhPtB[kind] = ADDHISTOGRAM(TH1, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "Before"), "Pt", "#it{p}_{T}", kTH1F, {ptAxis}); - fhPt_vs_EtaB[kind] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "Before"), "PtVsEta", "#it{p}_T vs #eta", kTH2F, {etaAxis, ptAxis}); - fhPt_vs_ZvtxB[kind] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "Before"), "PtVsZvtx", "#it{p}_T vs #it{z}_{vtx}", kTH2F, {zvtxAxis, ptAxis}); + std::string recogen = (kindOfData == kReco) ? "Reco" : "Gen"; + fhPtB[kindOfData] = ADDHISTOGRAM(TH1, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "Before"), "Pt", "#it{p}_{T}", kTH1F, {ptAxis}); + fhPtVsEtaB[kindOfData] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "Before"), "PtVsEta", "#it{p}_T vs #eta", kTH2F, {etaAxis, ptAxis}); + fhPtVsZvtxB[kindOfData] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "Before"), "PtVsZvtx", "#it{p}_T vs #it{z}_{vtx}", kTH2F, {zvtxAxis, ptAxis}); for (uint isp = 0; isp < nsp; ++isp) { - fhPtA[kind][isp] = ADDHISTOGRAM(TH1, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("Pt_%s", tnames[isp].c_str()), HTITLESTRING("#it{p}_{T} %s", tnames[isp].c_str()), kTH1F, {ptAxis}); - fhPt_vs_EtaA[kind][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("PtVsEta_%s", tnames[isp].c_str()), HTITLESTRING("#it{p}_{T} vs #eta %s", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); - fhPt_vs_ZvtxA[kind][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("PtVsZvtx_%s", tnames[isp].c_str()), HTITLESTRING("#it{p}_{T} vs #it{z}_{zvtx} %s", tnames[isp].c_str()), kTH2F, {zvtxAxis, ptAxis}); + fhPtA[kindOfData][isp] = ADDHISTOGRAM(TH1, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("Pt_%s", tnames[isp].c_str()), HTITLESTRING("#it{p}_{T} %s", tnames[isp].c_str()), kTH1F, {ptAxis}); + fhPtVsEtaA[kindOfData][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("PtVsEta_%s", tnames[isp].c_str()), HTITLESTRING("#it{p}_{T} vs #eta %s", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); + fhPtVsZvtxA[kindOfData][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, recogen.c_str(), "After"), HNAMESTRING("PtVsZvtx_%s", tnames[isp].c_str()), HTITLESTRING("#it{p}_{T} vs #it{z}_{zvtx} %s", tnames[isp].c_str()), kTH2F, {zvtxAxis, ptAxis}); } - if constexpr (kind == kReco) { + if constexpr (kindOfData == kReco) { /* only the reconstructed level histograms*/ - fhITS_NCls_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "ITSNCls", "ITS clusters", kTH2F, {ptAxis, itsNClsAxis}); - fhITS_Chi2NCls_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "ITSChi2NCls", "ITS #Chi^{2}", kTH2F, {ptAxis, itsCh2Axis}); - fhTPC_FindableNCls_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCFindableNCls", "TPC findable clusters", kTH2F, {ptAxis, tpcNClsAxis}); - fhTPC_FoundNCls_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCFoundNCls", "TPC found clusters", kTH2F, {ptAxis, tpcNClsAxis}); - fhTPC_SharedNCls_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCSharedNCls", "TPC shared clusters", kTH2F, {ptAxis, tpcNClsAxis}); - fhTPC_FractionSharedCls_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCFractionSharedCls", "TPC fraction shared clusters", kTH2F, {ptAxis, tpcFractionAxis}); - fhTPC_CrossedRows_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCXrows", "TPC crossed rows", kTH2F, {ptAxis, tpcNRowsAxis}); - fhTPC_CrossedRowsOverFindableCls_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "XRowsOverFindableCls", "TPC xrows over findable clusters", kTH2F, {ptAxis, tpcXRowsOverFindClsAxis}); - fhTPC_Chi2NCls_vs_PtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCChi2NCls", "TPC #Chi^{2}", kTH2F, {ptAxis, tpcCh2Axis}); + fhItsNClsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "ITSNCls", "ITS clusters", kTH2F, {ptAxis, itsNClsAxis}); + fhItsChi2NClsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "ITSChi2NCls", "ITS #Chi^{2}", kTH2F, {ptAxis, itsCh2Axis}); + fhTpcFindableNClsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCFindableNCls", "TPC findable clusters", kTH2F, {ptAxis, tpcNClsAxis}); + fhTpcFoundNClsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCFoundNCls", "TPC found clusters", kTH2F, {ptAxis, tpcNClsAxis}); + fhTpcSharedNClsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCSharedNCls", "TPC shared clusters", kTH2F, {ptAxis, tpcNClsAxis}); + fhTpcFractionSharedClsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCFractionSharedCls", "TPC fraction shared clusters", kTH2F, {ptAxis, tpcFractionAxis}); + fhTpcCrossedRowsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCXrows", "TPC crossed rows", kTH2F, {ptAxis, tpcNRowsAxis}); + fhTpcCrossedRowsOverFindableClsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "XRowsOverFindableCls", "TPC xrows over findable clusters", kTH2F, {ptAxis, tpcXRowsOverFindClsAxis}); + fhTpcChi2NClsVsPtB = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "Before"), "TPCChi2NCls", "TPC #Chi^{2}", kTH2F, {ptAxis, tpcCh2Axis}); /* efficiency histograms */ fhPvsInnerP = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "pVsInnerP", "#it{p} versus TPC inner wall #it{p}", kTH2F, {pidPAxis, pidPAxis}); - fhPt_vs_EtaItsAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptItsAcc", "ITS tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaTpcAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptTpcAcc", "TPC tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaItsTpcAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptItsTpcAcc", "ITS&TPC tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaItsTofAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptItsTofAcc", "ITS&TOF tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaTpcTofAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptTpcTofAcc", "TPC&TOF tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaItsTpcTofAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptItsTpcTofAcc", "ITS&TPC&TOF tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaItsAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptItsAcc", "ITS tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaTpcAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptTpcAcc", "TPC tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaItsTpcAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptItsTpcAcc", "ITS&TPC tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaItsTofAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptItsTofAcc", "ITS&TOF tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaTpcTofAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptTpcTofAcc", "TPC&TOF tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaItsTpcTofAcc = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), "ptItsTpcTofAcc", "ITS&TPC&TOF tracks within the acceptance", kTH2F, {etaAxis, ptAxis}); for (uint isp = 0; isp < nsp; ++isp) { - fhITS_NCls_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("ITSNCls_%s", tnames[isp].c_str()), HTITLESTRING("ITS clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, itsNClsAxis}); - fhITS_Chi2NCls_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("ITSChi2NCls_%s", tnames[isp].c_str()), HTITLESTRING("ITS #Chi^{2} %s", tnames[isp].c_str()), kTH2F, {ptAxis, itsCh2Axis}); - fhTPC_FindableNCls_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCFindableNCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC findable clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcNClsAxis}); - fhTPC_FoundNCls_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCFoundNCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC found clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcNClsAxis}); - fhTPC_SharedNCls_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCSharedNCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC shared clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcNClsAxis}); - fhTPC_FractionSharedCls_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCFractionSharedCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC fraction shared clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcFractionAxis}); - fhTPC_CrossedRows_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCXrows_%s", tnames[isp].c_str()), HTITLESTRING("TPC crossed rows %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcNRowsAxis}); - fhTPC_CrossedRowsOverFindableCls_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("XRowsOverFindableCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC xrows over findable clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcXRowsOverFindClsAxis}); - fhTPC_Chi2NCls_vs_PtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCChi2NCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC #Chi^{2} %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcCh2Axis}); + fhItsNClsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("ITSNCls_%s", tnames[isp].c_str()), HTITLESTRING("ITS clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, itsNClsAxis}); + fhItsChi2NClsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("ITSChi2NCls_%s", tnames[isp].c_str()), HTITLESTRING("ITS #Chi^{2} %s", tnames[isp].c_str()), kTH2F, {ptAxis, itsCh2Axis}); + fhTpcFindableNClsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCFindableNCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC findable clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcNClsAxis}); + fhTpcFoundNClsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCFoundNCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC found clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcNClsAxis}); + fhTpcSharedNClsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCSharedNCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC shared clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcNClsAxis}); + fhTpcFractionSharedClsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCFractionSharedCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC fraction shared clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcFractionAxis}); + fhTpcCrossedRowsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCXrows_%s", tnames[isp].c_str()), HTITLESTRING("TPC crossed rows %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcNRowsAxis}); + fhTpcCrossedRowsOverFindableClsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("XRowsOverFindableCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC xrows over findable clusters %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcXRowsOverFindClsAxis}); + fhTpcChi2NClsVsPtA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Reco", "After"), HNAMESTRING("TPCChi2NCls_%s", tnames[isp].c_str()), HTITLESTRING("TPC #Chi^{2} %s", tnames[isp].c_str()), kTH2F, {ptAxis, tpcCh2Axis}); /* efficiency histograms */ - fhPt_vs_EtaItsA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptIts_%s", tnames[isp].c_str()), HTITLESTRING("ITS %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaTpcA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptTpc_%s", tnames[isp].c_str()), HTITLESTRING("TPC %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaItsTpcA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptItsTpc_%s", tnames[isp].c_str()), HTITLESTRING("ITS&TPC %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaItsTofA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptItsTof_%s", tnames[isp].c_str()), HTITLESTRING("ITS&TOF %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaTpcTofA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptTpcTof_%s", tnames[isp].c_str()), HTITLESTRING("TPC&TOF %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaItsTpcTofA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptItsTpcTof_%s", tnames[isp].c_str()), HTITLESTRING("ITS&TPC&TOF %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaItsA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptIts%s", tnames[isp].c_str()), HTITLESTRING("ITS %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaTpcA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptTpc%s", tnames[isp].c_str()), HTITLESTRING("TPC %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaItsTpcA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptItsTpc%s", tnames[isp].c_str()), HTITLESTRING("ITS&TPC %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaItsTofA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptItsTof_%s", tnames[isp].c_str()), HTITLESTRING("ITS&TOF %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaTpcTofA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptTpcTof_%s", tnames[isp].c_str()), HTITLESTRING("TPC&TOF %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaItsTpcTofA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Reco"), HNAMESTRING("ptItsTpcTof_%s", tnames[isp].c_str()), HTITLESTRING("ITS&TPC&TOF %s tracks", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); } } else { AxisSpec recoSpecies{static_cast(nsp) + 1, -0.5, nsp - 0.5, "reco species"}; @@ -230,123 +252,123 @@ struct QADataCollectingEngine { fhPtPurityNegMatA = ADDHISTOGRAM(TH3, DIRECTORYSTRING("%s/%s", dirname, "Purity"), "ptPurityNegMat", "Secondaries from material for reconstructed negative", kTH3F, {recoSpecies, trueSpecies, ptAxis}); for (uint isp = 0; isp < nsp; ++isp) { /* detector level and generator level histograms */ - fhPt_vs_EtaPrimA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Gen"), - HNAMESTRING("ptPrim%s", tnames[isp].c_str()), - HTITLESTRING("ITS %s tracks (primaries)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaSecA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Gen"), - HNAMESTRING("ptSec%s", tnames[isp].c_str()), - HTITLESTRING("ITS %s tracks (secondaries)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaMatA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Gen"), - HNAMESTRING("ptMat%s", tnames[isp].c_str()), - HTITLESTRING("ITS %s tracks (from material)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaPrimA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Gen"), + HNAMESTRING("ptPrim%s", tnames[isp].c_str()), + HTITLESTRING("ITS %s tracks (primaries)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaSecA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Gen"), + HNAMESTRING("ptSec%s", tnames[isp].c_str()), + HTITLESTRING("ITS %s tracks (secondaries)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaMatA[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", "Gen"), + HNAMESTRING("ptMat%s", tnames[isp].c_str()), + HTITLESTRING("ITS %s tracks (from material)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); const std::vector detectedorigin = {"DetReco", "DetAssoc"}; for (uint ix = 0; ix < detectedorigin.size(); ++ix) { - fhPt_vs_EtaPrimItsA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsPrim_%s", tnames[isp].c_str()), - HTITLESTRING("ITS %s tracks (primaries)", tnames[isp].c_str()), + fhPtVsEtaPrimItsA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsPrim_%s", tnames[isp].c_str()), + HTITLESTRING("ITS %s tracks (primaries)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaPrimItsTpcA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsTpcPrim_%s", tnames[isp].c_str()), + HTITLESTRING("ITS&TPC %s tracks (primaries)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaPrimItsTpcTofA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsTpcTofPrim_%s", tnames[isp].c_str()), + HTITLESTRING("ITS&TPC&TOF %s tracks (primaries)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaSecItsA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsSec_%s", tnames[isp].c_str()), + HTITLESTRING("ITS %s tracks (secondaries)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaSecItsTpcA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsTpcSec_%s", tnames[isp].c_str()), + HTITLESTRING("ITS&TPC %s tracks (secondaries)", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaPrimItsTpcA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsTpcPrim_%s", tnames[isp].c_str()), - HTITLESTRING("ITS&TPC %s tracks (primaries)", tnames[isp].c_str()), + fhPtVsEtaSecItsTpcTofA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsTpcTofSec_%s", tnames[isp].c_str()), + HTITLESTRING("ITS&TPC&TOF %s tracks (secondaries)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaMatItsA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsMat_%s", tnames[isp].c_str()), + HTITLESTRING("ITS %s tracks (from material)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaMatItsTpcA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsTpcMat_%s", tnames[isp].c_str()), + HTITLESTRING("ITS&TPC %s tracks (from material)", tnames[isp].c_str()), + kTH2F, {etaAxis, ptAxis}); + fhPtVsEtaMatItsTpcTofA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), + HNAMESTRING("ptItsTpcTofMat_%s", tnames[isp].c_str()), + HTITLESTRING("ITS&TPC&TOF %s tracks (from material)", tnames[isp].c_str()), kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaPrimItsTpcTofA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsTpcTofPrim_%s", tnames[isp].c_str()), - HTITLESTRING("ITS&TPC&TOF %s tracks (primaries)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaSecItsA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsSec_%s", tnames[isp].c_str()), - HTITLESTRING("ITS %s tracks (secondaries)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaSecItsTpcA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsTpcSec_%s", tnames[isp].c_str()), - HTITLESTRING("ITS&TPC %s tracks (secondaries)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaSecItsTpcTofA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsTpcTofSec_%s", tnames[isp].c_str()), - HTITLESTRING("ITS&TPC&TOF %s tracks (secondaries)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaMatItsA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsMat_%s", tnames[isp].c_str()), - HTITLESTRING("ITS %s tracks (from material)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaMatItsTpcA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsTpcMat_%s", tnames[isp].c_str()), - HTITLESTRING("ITS&TPC %s tracks (from material)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); - fhPt_vs_EtaMatItsTpcTofA[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "Efficiency", detectedorigin[ix].c_str()), - HNAMESTRING("ptItsTpcTofMat_%s", tnames[isp].c_str()), - HTITLESTRING("ITS&TPC&TOF %s tracks (from material)", tnames[isp].c_str()), - kTH2F, {etaAxis, ptAxis}); } } } } - template + template void processTrack(float zvtx, TrackObject const& track) { using namespace efficiencyandqatask; using namespace analysis::dptdptfilter; using namespace o2::aod::track; - fhPtB[kind]->Fill(track.pt()); - fhPt_vs_EtaB[kind]->Fill(track.eta(), track.pt()); - fhPt_vs_ZvtxB[kind]->Fill(zvtx, track.pt()); + fhPtB[kindOfData]->Fill(track.pt()); + fhPtVsEtaB[kindOfData]->Fill(track.eta(), track.pt()); + fhPtVsZvtxB[kindOfData]->Fill(zvtx, track.pt()); if (!(track.trackacceptedid() < 0)) { - fhPtA[kind][track.trackacceptedid()]->Fill(track.pt()); - fhPt_vs_EtaA[kind][track.trackacceptedid()]->Fill(track.eta(), track.pt()); - fhPt_vs_ZvtxA[kind][track.trackacceptedid()]->Fill(zvtx, track.pt()); + fhPtA[kindOfData][track.trackacceptedid()]->Fill(track.pt()); + fhPtVsEtaA[kindOfData][track.trackacceptedid()]->Fill(track.eta(), track.pt()); + fhPtVsZvtxA[kindOfData][track.trackacceptedid()]->Fill(zvtx, track.pt()); } - if constexpr (kind == kReco) { + if constexpr (kindOfData == kReco) { auto fillhisto = [&track](auto& h, bool cond) { if (cond) { h->Fill(track.eta(), track.pt()); } }; - bool hasits = track.hasITS() && TrackSelectionFlags::checkFlag(track.trackCutFlag(), trackSelectionITS); - bool hastpc = track.hasTPC() && TrackSelectionFlags::checkFlag(track.trackCutFlag(), trackSelectionTPC); + bool hasits = track.hasITS() && TrackSelectionFlags::checkFlag(track.trackCutFlag(), TrackSelectionITS); + bool hastpc = track.hasTPC() && TrackSelectionFlags::checkFlag(track.trackCutFlag(), TrackSelectionTPC); bool hastof = track.hasTOF(); - fhITS_NCls_vs_PtB->Fill(track.pt(), track.itsNCls()); - fhITS_Chi2NCls_vs_PtB->Fill(track.pt(), track.itsChi2NCl()); - fhTPC_FindableNCls_vs_PtB->Fill(track.pt(), track.tpcNClsFindable()); - fhTPC_FoundNCls_vs_PtB->Fill(track.pt(), track.tpcNClsFound()); - fhTPC_SharedNCls_vs_PtB->Fill(track.pt(), track.tpcNClsShared()); - fhTPC_FractionSharedCls_vs_PtB->Fill(track.pt(), track.tpcFractionSharedCls()); - fhTPC_CrossedRows_vs_PtB->Fill(track.pt(), track.tpcNClsCrossedRows()); - fhTPC_CrossedRowsOverFindableCls_vs_PtB->Fill(track.pt(), track.tpcCrossedRowsOverFindableCls()); - fhTPC_Chi2NCls_vs_PtB->Fill(track.pt(), track.tpcChi2NCl()); - if (InTheAcceptance(track)) { + fhItsNClsVsPtB->Fill(track.pt(), track.itsNCls()); + fhItsChi2NClsVsPtB->Fill(track.pt(), track.itsChi2NCl()); + fhTpcFindableNClsVsPtB->Fill(track.pt(), track.tpcNClsFindable()); + fhTpcFoundNClsVsPtB->Fill(track.pt(), track.tpcNClsFound()); + fhTpcSharedNClsVsPtB->Fill(track.pt(), track.tpcNClsShared()); + fhTpcFractionSharedClsVsPtB->Fill(track.pt(), track.tpcFractionSharedCls()); + fhTpcCrossedRowsVsPtB->Fill(track.pt(), track.tpcNClsCrossedRows()); + fhTpcCrossedRowsOverFindableClsVsPtB->Fill(track.pt(), track.tpcCrossedRowsOverFindableCls()); + fhTpcChi2NClsVsPtB->Fill(track.pt(), track.tpcChi2NCl()); + if (inTheAcceptance(track)) { /* efficiency histograms */ - fillhisto(fhPt_vs_EtaItsAcc, hasits); - fillhisto(fhPt_vs_EtaTpcAcc, hastpc); - fillhisto(fhPt_vs_EtaItsTpcAcc, hasits && hastpc); - fillhisto(fhPt_vs_EtaItsTofAcc, hasits && hastof); - fillhisto(fhPt_vs_EtaTpcTofAcc, hastpc && hastof); - fillhisto(fhPt_vs_EtaItsTpcTofAcc, hasits && hastpc && hastof); + fillhisto(fhPtVsEtaItsAcc, hasits); + fillhisto(fhPtVsEtaTpcAcc, hastpc); + fillhisto(fhPtVsEtaItsTpcAcc, hasits && hastpc); + fillhisto(fhPtVsEtaItsTofAcc, hasits && hastof); + fillhisto(fhPtVsEtaTpcTofAcc, hastpc && hastof); + fillhisto(fhPtVsEtaItsTpcTofAcc, hasits && hastpc && hastof); } if (!(track.trackacceptedid() < 0)) { - fhITS_NCls_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.itsNCls()); - fhITS_Chi2NCls_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.itsChi2NCl()); - fhTPC_FindableNCls_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcNClsFindable()); - fhTPC_FoundNCls_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcNClsFound()); - fhTPC_SharedNCls_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcNClsShared()); - fhTPC_FractionSharedCls_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcFractionSharedCls()); - fhTPC_CrossedRows_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcNClsCrossedRows()); - fhTPC_CrossedRowsOverFindableCls_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcCrossedRowsOverFindableCls()); - fhTPC_Chi2NCls_vs_PtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcChi2NCl()); + fhItsNClsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.itsNCls()); + fhItsChi2NClsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.itsChi2NCl()); + fhTpcFindableNClsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcNClsFindable()); + fhTpcFoundNClsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcNClsFound()); + fhTpcSharedNClsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcNClsShared()); + fhTpcFractionSharedClsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcFractionSharedCls()); + fhTpcCrossedRowsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcNClsCrossedRows()); + fhTpcCrossedRowsOverFindableClsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcCrossedRowsOverFindableCls()); + fhTpcChi2NClsVsPtA[track.trackacceptedid()]->Fill(track.pt(), track.tpcChi2NCl()); /* efficiency histograms */ fhPvsInnerP->Fill(track.tpcInnerParam(), track.p()); - fillhisto(fhPt_vs_EtaItsA[track.trackacceptedid()], hasits); - fillhisto(fhPt_vs_EtaTpcA[track.trackacceptedid()], hastpc); - fillhisto(fhPt_vs_EtaItsTpcA[track.trackacceptedid()], hasits && hastpc); - fillhisto(fhPt_vs_EtaItsTofA[track.trackacceptedid()], hasits && hastof); - fillhisto(fhPt_vs_EtaTpcTofA[track.trackacceptedid()], hastpc && hastof); - fillhisto(fhPt_vs_EtaItsTpcTofA[track.trackacceptedid()], hasits && hastpc && hastof); + fillhisto(fhPtVsEtaItsA[track.trackacceptedid()], hasits); + fillhisto(fhPtVsEtaTpcA[track.trackacceptedid()], hastpc); + fillhisto(fhPtVsEtaItsTpcA[track.trackacceptedid()], hasits && hastpc); + fillhisto(fhPtVsEtaItsTofA[track.trackacceptedid()], hasits && hastof); + fillhisto(fhPtVsEtaTpcTofA[track.trackacceptedid()], hastpc && hastof); + fillhisto(fhPtVsEtaItsTpcTofA[track.trackacceptedid()], hasits && hastpc && hastof); /* the detector / generator combined level */ if constexpr (framework::has_type_v) { auto findgenid = [&](auto& part) { @@ -385,31 +407,31 @@ struct QADataCollectingEngine { h->Fill(eta, pt); } }; - std::vector t_pt = {track.pt(), mcparticle.pt()}; - std::vector t_eta = {track.eta(), mcparticle.eta()}; - for (uint ix = 0; ix < t_pt.size(); ++ix) { - fillhisto(fhPt_vs_EtaPrimItsA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits, isprimary); - fillhisto(fhPt_vs_EtaPrimItsTpcA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits && hastpc, isprimary); - fillhisto(fhPt_vs_EtaPrimItsTpcTofA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits && hastof, isprimary); - fillhisto(fhPt_vs_EtaSecItsA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits, issecdecay); - fillhisto(fhPt_vs_EtaSecItsTpcA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits && hastpc, issecdecay); - fillhisto(fhPt_vs_EtaSecItsTpcTofA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits && hastof, issecdecay); - fillhisto(fhPt_vs_EtaMatItsA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits, isfrommaterial); - fillhisto(fhPt_vs_EtaMatItsTpcA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits && hastpc, isfrommaterial); - fillhisto(fhPt_vs_EtaMatItsTpcTofA[ix][track.trackacceptedid()], t_pt[ix], t_eta[ix], hasits && hastof, isfrommaterial); + std::vector tPt = {track.pt(), mcparticle.pt()}; + std::vector tEta = {track.eta(), mcparticle.eta()}; + for (uint ix = 0; ix < tPt.size(); ++ix) { + fillhisto(fhPtVsEtaPrimItsA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits, isprimary); + fillhisto(fhPtVsEtaPrimItsTpcA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits && hastpc, isprimary); + fillhisto(fhPtVsEtaPrimItsTpcTofA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits && hastof, isprimary); + fillhisto(fhPtVsEtaSecItsA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits, issecdecay); + fillhisto(fhPtVsEtaSecItsTpcA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits && hastpc, issecdecay); + fillhisto(fhPtVsEtaSecItsTpcTofA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits && hastof, issecdecay); + fillhisto(fhPtVsEtaMatItsA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits, isfrommaterial); + fillhisto(fhPtVsEtaMatItsTpcA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits && hastpc, isfrommaterial); + fillhisto(fhPtVsEtaMatItsTpcTofA[ix][track.trackacceptedid()], tPt[ix], tEta[ix], hasits && hastof, isfrommaterial); } } } } - if constexpr (kind == kGen) { + if constexpr (kindOfData == kGen) { if (!(track.trackacceptedid() < 0)) { /* pure generator level */ if (track.isPhysicalPrimary()) { - fhPt_vs_EtaPrimA[track.trackacceptedid()]->Fill(track.eta(), track.pt()); + fhPtVsEtaPrimA[track.trackacceptedid()]->Fill(track.eta(), track.pt()); } else if (track.getProcess() == 4) { - fhPt_vs_EtaSecA[track.trackacceptedid()]->Fill(track.eta(), track.pt()); + fhPtVsEtaSecA[track.trackacceptedid()]->Fill(track.eta(), track.pt()); } else { - fhPt_vs_EtaMatA[track.trackacceptedid()]->Fill(track.eta(), track.pt()); + fhPtVsEtaMatA[track.trackacceptedid()]->Fill(track.eta(), track.pt()); } } } @@ -432,19 +454,8 @@ struct PidDataCollectingEngine { std::vector>> fhTOFnSigmasVsP{2, {nallmainsp, nullptr}}; std::vector> fhPvsTOFSqMass{2, nullptr}; std::vector>> fhTPCTOFSigmaVsP{2, {nmainsp, nullptr}}; - /* PID histograms */ - /* only after track selection */ - std::vector> fhIdTPCdEdxSignalVsP{nsp, nullptr}; - std::vector> fpIdTPCdEdxSignalVsPSigmas{nsp, nullptr}; - std::vector>> fhIdTPCdEdxSignalDiffVsP{nsp, {nmainsp, nullptr}}; - std::vector>> fhIdTPCnSigmasVsP{nsp, {nallmainsp, nullptr}}; - std::vector> fhIdTOFSignalVsP{nsp, nullptr}; - std::vector> fpIdTOFSignalVsPSigmas{nsp, nullptr}; - std::vector>> fhIdTOFSignalDiffVsP{nsp, {nmainsp, nullptr}}; - std::vector>> fhIdTOFnSigmasVsP{nsp, {nallmainsp, nullptr}}; - std::vector> fhIdPvsTOFSqMass{nsp, nullptr}; - template + template void init(HistogramRegistry& registry, const char* dirname) { using namespace efficiencyandqatask; @@ -453,7 +464,7 @@ struct PidDataCollectingEngine { AxisSpec pidPAxis{150, 0.1, 5.0, "#it{p} (GeV/#it{c})"}; pidPAxis.makeLogarithmic(); - if constexpr (kind == kReco) { + if constexpr (kindOfData == kReco) { /* PID histograms */ std::vector whenname{"Before", "After"}; char whenprefix[2]{'B', 'A'}; @@ -482,19 +493,121 @@ struct PidDataCollectingEngine { fhTPCTOFSigmaVsP[ix][isp] = ADDHISTOGRAM(TH3, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), HNAMESTRING("toftpcNSigmasVsP%c_%s", whenprefix[ix], mainspnames[isp].c_str()), HTITLESTRING("n#sigma to the %s line %s", mainsptitles[isp].c_str(), whentitle[ix].c_str()), - kTH3F, {pidPAxis, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TPC}^{%s}", mainsptitles[isp].c_str())}, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TOF}^{%s}", mainsptitles[isp].c_str())}}); + kTH3F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TPC}^{%s}", mainsptitles[isp].c_str())}, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TOF}^{%s}", mainsptitles[isp].c_str())}}); } for (uint isp = 0; isp < nallmainsp; ++isp) { fhTPCnSigmasVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), HNAMESTRING("tpcNSigmasVsP%c_%s", whenprefix[ix], allmainspnames[isp].c_str()), HTITLESTRING("TPC n#sigma to the %s line %s", allmainsptitles[isp].c_str(), whentitle[ix].c_str()), - kTH2F, {pidPAxis, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TPC}^{%s}", allmainsptitles[isp].c_str())}}); + kTH2F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TPC}^{%s}", allmainsptitles[isp].c_str())}}); fhTOFnSigmasVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), HNAMESTRING("tofNSigmasVsP%c_%s", whenprefix[ix], allmainspnames[isp].c_str()), HTITLESTRING("TOF n#sigma to the %s line %s", allmainsptitles[isp].c_str(), whentitle[ix].c_str()), - kTH2F, {pidPAxis, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TOF}^{%s}", allmainsptitles[isp].c_str())}}); + kTH2F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TOF}^{%s}", allmainsptitles[isp].c_str())}}); } } + } + } + + template + void fillAllSpeciesPID(uint ix, TrackObject const& track, float mom) + { + if (track.sign() < 0) { + ix = 2 * ix + 1; + } else { + ix = 2 * ix; + } + for (uint when = 0; when < 2; ++when) { + fhTPCnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma(track)); + fhTOFnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofNSigma(track)); + if (track.trackacceptedid() < 0) { + /* track not accepted */ + return; + } + } + } + + template + void fillSpeciesPID(uint ix, TrackObject const& track, float mom) + { + if (track.sign() < 0) { + ix = 2 * ix + 1; + } else { + ix = 2 * ix; + } + for (uint when = 0; when < 2; ++when) { + fhTPCdEdxSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcExpSignalDiff(track)); + fhTOFSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofExpSignalDiff(track)); + fhTPCTOFSigmaVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma(track), o2::aod::pidutils::tofNSigma(track)); + if (track.trackacceptedid() < 0) { + /* track not accepted */ + return; + } + } + } + + template + void fillPID(TrackObject const& track, float mom) + { + for (uint when = 0; when < 2; ++when) { + fhTPCdEdxSignalVsP[when]->Fill(mom, track.tpcSignal()); + fhTOFSignalVsP[when]->Fill(mom, track.beta()); + fhPvsTOFSqMass[when]->Fill(track.mass() * track.mass(), mom); + if (track.trackacceptedid() < 0) { + /* track not accepted */ + return; + } + } + } + + template + void processTrack(TrackObject const& track, float mom) + { + using namespace efficiencyandqatask; + + if constexpr (kindOfData == kReco) { + fillPID(track, mom); + fillSpeciesPID(0, track, mom); + fillSpeciesPID(1, track, mom); + fillSpeciesPID(2, track, mom); + fillAllSpeciesPID(0, track, mom); + fillAllSpeciesPID(1, track, mom); + fillAllSpeciesPID(2, track, mom); + fillAllSpeciesPID(3, track, mom); + fillAllSpeciesPID(4, track, mom); + } + } +}; + +/* the PID extra data collecting engine */ +struct PidExtraDataCollectingEngine { + uint nsp = static_cast(efficiencyandqatask::tnames.size()); + uint nmainsp = static_cast(efficiencyandqatask::mainspnames.size()); + uint nallmainsp = static_cast(efficiencyandqatask::allmainspnames.size()); + + /* PID histograms */ + /* only after track selection */ + std::vector> fhIdTPCdEdxSignalVsP{nsp, nullptr}; + std::vector> fpIdTPCdEdxSignalVsPSigmas{nsp, nullptr}; + std::vector>> fhIdTPCdEdxSignalDiffVsP{nsp, {nmainsp, nullptr}}; + std::vector>> fhIdTPCnSigmasVsP{nsp, {nallmainsp, nullptr}}; + std::vector> fhIdTOFSignalVsP{nsp, nullptr}; + std::vector> fpIdTOFSignalVsPSigmas{nsp, nullptr}; + std::vector>> fhIdTOFSignalDiffVsP{nsp, {nmainsp, nullptr}}; + std::vector>> fhIdTOFnSigmasVsP{nsp, {nallmainsp, nullptr}}; + std::vector> fhIdPvsTOFSqMass{nsp, nullptr}; + + template + void init(HistogramRegistry& registry, const char* dirname) + { + using namespace efficiencyandqatask; + + const AxisSpec dEdxAxis{200, 0.0, 200.0, "dE/dx (au)"}; + AxisSpec pidPAxis{150, 0.1, 5.0, "#it{p} (GeV/#it{c})"}; + pidPAxis.makeLogarithmic(); + + if constexpr (kindOfData == kReco) { + /* PID histograms */ for (uint isp = 0; isp < nsp; ++isp) { fhIdTPCdEdxSignalVsP[isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", "Selected"), HNAMESTRING("tpcSignalVsPSelected_%s", tnames[isp].c_str()), @@ -518,11 +631,11 @@ struct PidDataCollectingEngine { fhIdTPCnSigmasVsP[isp][imainsp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", "Selected"), HNAMESTRING("tpcNSigmasVsPSelected_%s_to%s", tnames[isp].c_str(), allmainspnames[imainsp].c_str()), HTITLESTRING("TPC n#sigma for selected %s to the %s line", tnames[isp].c_str(), allmainsptitles[imainsp].c_str()), - kTH2F, {pidPAxis, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TPC}^{%s}", mainsptitles[isp].c_str())}}); + kTH2F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TPC}^{%s}", mainsptitles[isp].c_str())}}); fhIdTOFnSigmasVsP[isp][imainsp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", "Selected"), HNAMESTRING("tofNSigmasVsPSelected_%s_to%s", tnames[isp].c_str(), allmainspnames[imainsp].c_str()), HTITLESTRING("TOF n#sigma for selected %s to the %s line", tnames[isp].c_str(), allmainsptitles[imainsp].c_str()), - kTH2F, {pidPAxis, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TOF}^{%s}", mainsptitles[isp].c_str())}}); + kTH2F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TOF}^{%s}", mainsptitles[isp].c_str())}}); } } } @@ -532,19 +645,15 @@ struct PidDataCollectingEngine { template void fillAllSpeciesPID(uint ix, TrackObject const& track, float mom) { + if (track.trackacceptedid() < 0) { + /* track not accepted */ + return; + } if (track.sign() < 0) { ix = 2 * ix + 1; } else { ix = 2 * ix; } - for (uint when = 0; when < 2; ++when) { - fhTPCnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma(track)); - fhTOFnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofNSigma(track)); - if (track.trackacceptedid() < 0) { - /* track not accepted */ - return; - } - } fhIdTPCnSigmasVsP[track.trackacceptedid()][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma(track)); fhIdTOFnSigmasVsP[track.trackacceptedid()][ix]->Fill(mom, o2::aod::pidutils::tofNSigma(track)); if (efficiencyandqatask::pidselector.isGlobalSpecies(track.trackacceptedid() / 2, id)) { @@ -555,46 +664,27 @@ struct PidDataCollectingEngine { } template - void fillSpeciesPID(uint ix, TrackObject const& track, float mom) + void fillSpeciesPID(uint, TrackObject const&, float) { - if (track.sign() < 0) { - ix = 2 * ix + 1; - } else { - ix = 2 * ix; - } - for (uint when = 0; when < 2; ++when) { - fhTPCdEdxSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcExpSignalDiff(track)); - fhTOFSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofExpSignalDiff(track)); - fhTPCTOFSigmaVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma(track), o2::aod::pidutils::tofNSigma(track)); - if (track.trackacceptedid() < 0) { - /* track not accepted */ - return; - } - } } template void fillPID(TrackObject const& track, float mom) { - for (uint when = 0; when < 2; ++when) { - fhTPCdEdxSignalVsP[when]->Fill(mom, track.tpcSignal()); - fhTOFSignalVsP[when]->Fill(mom, track.beta()); - fhPvsTOFSqMass[when]->Fill(track.mass() * track.mass(), mom); - if (track.trackacceptedid() < 0) { - /* track not accepted */ - return; - } + if (track.trackacceptedid() < 0) { + /* track not accepted */ + return; } fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(mom, track.tpcSignal()); fhIdTOFSignalVsP[track.trackacceptedid()]->Fill(mom, track.beta()); } - template + template void processTrack(TrackObject const& track, float mom) { using namespace efficiencyandqatask; - if constexpr (kind == kReco) { + if constexpr (kindOfData == kReco) { fillPID(track, mom); fillSpeciesPID(0, track, mom); fillSpeciesPID(1, track, mom); @@ -618,35 +708,39 @@ struct DptDptEfficiencyAndQc { /* the data collecting engine instances */ QADataCollectingEngine** qaDataCE; PidDataCollectingEngine** pidDataCE; + PidExtraDataCollectingEngine** pidExtraDataCE; /* the histogram registries */ - HistogramRegistry registry_one{"registry_one", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_two{"registry_two", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_three{"registry_three", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_four{"registry_four", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_five{"registry_five", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_six{"registry_six", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_seven{"registry_seven", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_eight{"registry_eight", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_nine{"registry_nine", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_ten{"registry_ten", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidone{"pidregistry_one", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidtwo{"pidregistry_two", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidthree{"pidregistry_three", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidfour{"pidregistry_four", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidfive{"pidregistry_five", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidsix{"pidregistry_six", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidseven{"pidregistry_seven", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pideight{"pidregistry_eight", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidnine{"pidregistry_nine", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registry_pidten{"pidregistry_ten", {}, OutputObjHandlingPolicy::AnalysisObject}; - std::vector registrybank{®istry_one, ®istry_two, ®istry_three, ®istry_four, ®istry_five, - ®istry_six, ®istry_seven, ®istry_eight, ®istry_nine, ®istry_ten}; - std::vector pidregistrybank{®istry_pidone, ®istry_pidtwo, ®istry_pidthree, ®istry_pidfour, ®istry_pidfive, - ®istry_pidsix, ®istry_pidseven, ®istry_pideight, ®istry_pidnine, ®istry_pidten}; - - Configurable inCentralityClasses{"usecentrality", false, "Perform the task using centrality/multiplicity classes. Default value: false"}; - Configurable useTPCInnerWallMomentum{"useinnerwallmomm", false, "Use the TPC inner wall momentum. Default: false"}; + HistogramRegistry registryOne{"registryOne", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryTwo{"registryTwo", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryThree{"registryThree", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryFour{"registryFour", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryFive{"registryFive", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registrySix{"registrySix", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registrySeven{"registrySeven", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryEight{"registryEight", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryNine{"registryNine", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryTen{"registryTen", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidOne{"pidregistryOne", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidTwo{"pidregistryTwo", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidThree{"pidregistryThree", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidFour{"pidregistryFour", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidFive{"pidregistryFive", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidSix{"pidregistrySix", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidSeven{"pidregistrySeven", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidEight{"pidregistryEight", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidNine{"pidregistryNine", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryPidTen{"pidregistryTen", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::vector registrybank{®istryOne, ®istryTwo, ®istryThree, ®istryFour, ®istryFive, + ®istrySix, ®istrySeven, ®istryEight, ®istryNine, ®istryTen}; + std::vector pidregistrybank{®istryPidOne, ®istryPidTwo, ®istryPidThree, ®istryPidFour, ®istryPidFive, + ®istryPidSix, ®istryPidSeven, ®istryPidEight, ®istryPidNine, ®istryPidTen}; + + Configurable useCentrality{"useCentrality", false, "Perform the task using centrality/multiplicity classes. Default value: false"}; + Configurable useTPCInnerWallMomentum{"useTPCInnerWallMomentum", false, "Use the TPC inner wall momentum. Default: false"}; + Configurable cfgMinNSigma{"cfgMinNSigma", -4.05f, "nsigma axes lowest value. Default: -4.05"}; + Configurable cfgMaxNSigma{"cfgMaxNSigma", 4.05f, "nsigma axes highest value. Default: 4.05"}; + Configurable cfgWidthNSigmaBin{"cfgWidthNSigmaBin", 0.1, "nsigma axes bin width. Deafault: 0.1"}; void init(o2::framework::InitContext& initContext) { @@ -654,11 +748,16 @@ struct DptDptEfficiencyAndQc { using namespace analysis::dptdptfilter; /* do nothing if not active */ - if (!doprocessDetectorLevelNotStored && !doprocessDetectorLevelNotStoredNoPID && !doprocessGeneratorLevelNotStored && !doprocessReconstructedNotStored && !doprocessReconstructedNotStoredNoPID) { + if (!doprocessDetectorLevelNotStored && + !doprocessDetectorLevelNotStoredPID && + !doprocessDetectorLevelNotStoredPIDExtra && + !doprocessGeneratorLevelNotStored && + !doprocessReconstructedNotStored && + !doprocessReconstructedNotStoredPID && + !doprocessReconstructedNotStoredPIDExtra) { return; } - fPDG = TDatabasePDG::Instance(); /* Self configuration: requires dptdptfilter task in the workflow */ { /* the binning */ @@ -686,7 +785,7 @@ struct DptDptEfficiencyAndQc { auto cfg = new o2::analysis::TrackSelectionPIDCfg(); cfg->mUseIt = true; cfg->mExclude = false; - pidselector.Add(spid, cfg); + pidselector.addSpecies(spid, cfg); } } }; @@ -710,7 +809,7 @@ struct DptDptEfficiencyAndQc { /* create the data collecting engine instances according to the configured centrality/multiplicity ranges */ std::string centspec; - if (inCentralityClasses.value && getTaskOptionValue(initContext, "dpt-dpt-filter", "centralities", centspec, false)) { + if (useCentrality.value && getTaskOptionValue(initContext, "dpt-dpt-filter", "centralities", centspec, false)) { LOGF(info, "Got the centralities specification: %s", centspec.c_str()); auto tokens = TString(centspec.c_str()).Tokenize(","); ncmranges = tokens->GetEntries(); @@ -732,15 +831,26 @@ struct DptDptEfficiencyAndQc { fCentMultMin[0] = 0.0f; fCentMultMax[0] = 100.0f; } - bool doPidAnalysis = doprocessDetectorLevelNotStored || doprocessReconstructedNotStored; - qaDataCE = new QADataCollectingEngine*[ncmranges]; + /* configure nsigma axes */ + minNSigma = cfgMinNSigma.value; + maxNSigma = cfgMaxNSigma.value; + widthNSigmaBin = cfgWidthNSigmaBin.value; + noOfNSigmaBins = static_cast((maxNSigma - minNSigma) / widthNSigmaBin); + + bool doBasicAnalysis = doprocessDetectorLevelNotStored || doprocessReconstructedNotStored; + bool doPidAnalysis = doprocessDetectorLevelNotStoredPID || doprocessReconstructedNotStoredPID; + bool doPidExtraAnalysis = doprocessDetectorLevelNotStoredPIDExtra || doprocessReconstructedNotStoredPIDExtra; + + if (doBasicAnalysis) { + qaDataCE = new QADataCollectingEngine*[ncmranges]; + } if (doPidAnalysis) { pidDataCE = new PidDataCollectingEngine*[ncmranges]; } - std::string recogen; - if (!(doprocessReconstructedNotStored || doprocessReconstructedNotStoredNoPID) && !(doprocessDetectorLevelNotStored || doprocessDetectorLevelNotStoredNoPID)) { - LOGF(fatal, "Neither reco nor detector level not configured. Please, fix it!"); + if (doPidExtraAnalysis) { + pidExtraDataCE = new PidExtraDataCollectingEngine*[ncmranges]; } + std::string recogen; if (ncmranges > registrybank.size()) { LOGF(fatal, "There are more centrality ranges configured than registries in the bank. Please fix it!"); } @@ -764,11 +874,21 @@ struct DptDptEfficiencyAndQc { initializeCEInstance(dce, TString::Format("EfficiencyAndPidData-%d-%d", static_cast(min), static_cast(max)), *pidregistrybank[i]); return dce; }; + auto buildPidExtraCEInstance = [&](float min, float max) { + auto* dce = new PidExtraDataCollectingEngine(); + initializeCEInstance(dce, TString::Format("EfficiencyAndPidData-%d-%d", static_cast(min), static_cast(max)), *pidregistrybank[i]); + return dce; + }; /* in reverse order for proper order in results file */ - qaDataCE[ncmranges - i - 1] = buildQACEInstance(fCentMultMin[ncmranges - i - 1], fCentMultMax[ncmranges - i - 1]); + if (doBasicAnalysis) { + qaDataCE[ncmranges - i - 1] = buildQACEInstance(fCentMultMin[ncmranges - i - 1], fCentMultMax[ncmranges - i - 1]); + } if (doPidAnalysis) { pidDataCE[ncmranges - i - 1] = buildPidCEInstance(fCentMultMin[ncmranges - i - 1], fCentMultMax[ncmranges - i - 1]); } + if (doPidExtraAnalysis) { + pidExtraDataCE[ncmranges - i - 1] = buildPidExtraCEInstance(fCentMultMin[ncmranges - i - 1], fCentMultMax[ncmranges - i - 1]); + } } for (uint i = 0; i < ncmranges; ++i) { LOGF(info, " centrality/multipliicty range: %d, low limit: %0.2f, up limit: %0.2f", i, fCentMultMin[i], fCentMultMax[i]); @@ -780,7 +900,7 @@ struct DptDptEfficiencyAndQc { template int getDCEindex(FilteredCollision collision) { - if (!inCentralityClasses.value) { + if (!useCentrality.value) { return 0; } else { int ixDCE = -1; @@ -800,23 +920,28 @@ struct DptDptEfficiencyAndQc { } } - template + template void processTracks(FilteredCollisions::iterator const& collision, PassedTracks const& tracks) { using namespace efficiencyandqatask; int ixDCE = getDCEindex(collision); if (!(ixDCE < 0)) { - for (auto& track : tracks) { + for (auto const& track : tracks) { float mom = track.p(); if (useTPCInnerWallMomentum.value) { if constexpr (!framework::has_type_v) { mom = track.tpcInnerParam(); } } - qaDataCE[ixDCE]->processTrack(collision.posZ(), track); - if constexpr (dopid) { - pidDataCE[ixDCE]->processTrack(track, mom); + if constexpr (kindOfProcess == kBASIC) { + qaDataCE[ixDCE]->processTrack(collision.posZ(), track); + } + if constexpr (kindOfProcess == kPID) { + pidDataCE[ixDCE]->processTrack(track, mom); + } + if constexpr (kindOfProcess == kPIDEXTRA) { + pidExtraDataCE[ixDCE]->processTrack(track, mom); } } } @@ -828,67 +953,86 @@ struct DptDptEfficiencyAndQc { LOGF(debug, "Received %d collisions", collisions.size()); } - using tpcPID = soa::Join; - using tofPID = soa::Join; + using TpcPID = soa::Join; + using TofPID = soa::Join; Filter onlyacceptedcollisions = (aod::dptdptfilter::collisionaccepted == uint8_t(true)); void processReconstructedNotStored(soa::Filtered>::iterator const& collision, - soa::Join& tracks) + soa::Join const& tracks) { using namespace efficiencyandqatask; - processTracks>, true, kReco>(collision, tracks); + processTracks>, kBASIC, kReco>(collision, tracks); } PROCESS_SWITCH(DptDptEfficiencyAndQc, processReconstructedNotStored, "Process reconstructed efficiency and QA for not stored derived data", false); void processDetectorLevelNotStored(soa::Filtered>::iterator const& collision, - soa::Join& tracks, + soa::Join const& tracks, soa::Join const&) { using namespace efficiencyandqatask; - processTracks>, true, kReco>(collision, tracks); + processTracks>, kBASIC, kReco>(collision, tracks); } PROCESS_SWITCH(DptDptEfficiencyAndQc, processDetectorLevelNotStored, "Process MC detector level efficiency and QA for not stored derived data", false); void processGeneratorLevelNotStored(soa::Filtered>::iterator const& collision, - soa::Join& particles) + soa::Join const& particles) { using namespace efficiencyandqatask; - processTracks>, false, kGen>(collision, particles); + processTracks>, kBASIC, kGen>(collision, particles); } PROCESS_SWITCH(DptDptEfficiencyAndQc, processGeneratorLevelNotStored, "Process MC generator level efficiency and QA for not stored derived data", true); - void processReconstructedNotStoredNoPID(soa::Filtered>::iterator const& collision, - soa::Join& tracks) + void processReconstructedNotStoredPID(soa::Filtered>::iterator const& collision, + soa::Join const& tracks) + { + using namespace efficiencyandqatask; + + processTracks>, kPID, kReco>(collision, tracks); + } + PROCESS_SWITCH(DptDptEfficiencyAndQc, processReconstructedNotStoredPID, "Process reconstructed PID QA for not stored derived data", false); + + void processReconstructedNotStoredPIDExtra(soa::Filtered>::iterator const& collision, + soa::Join const& tracks) + { + using namespace efficiencyandqatask; + + processTracks>, kPIDEXTRA, kReco>(collision, tracks); + } + PROCESS_SWITCH(DptDptEfficiencyAndQc, processReconstructedNotStoredPIDExtra, "Process reconstructed PID extra QA for not stored derived data", false); + + void processDetectorLevelNotStoredPID(soa::Filtered>::iterator const& collision, + soa::Join const& tracks, + soa::Join const&) { using namespace efficiencyandqatask; - processTracks>, false, kReco>(collision, tracks); + processTracks>, kPID, kReco>(collision, tracks); } - PROCESS_SWITCH(DptDptEfficiencyAndQc, processReconstructedNotStoredNoPID, "Process reconstructed efficiency and QA for not stored derived data", false); + PROCESS_SWITCH(DptDptEfficiencyAndQc, processDetectorLevelNotStoredPID, "Process MC detector level PID QA for not stored derived data", true); - void processDetectorLevelNotStoredNoPID(soa::Filtered>::iterator const& collision, - soa::Join& tracks, - soa::Join const&) + void processDetectorLevelNotStoredPIDExtra(soa::Filtered>::iterator const& collision, + soa::Join const& tracks, + soa::Join const&) { using namespace efficiencyandqatask; - processTracks>, false, kReco>(collision, tracks); + processTracks>, kPIDEXTRA, kReco>(collision, tracks); } - PROCESS_SWITCH(DptDptEfficiencyAndQc, processDetectorLevelNotStoredNoPID, "Process MC detector level efficiency and QA for not stored derived data", true); + PROCESS_SWITCH(DptDptEfficiencyAndQc, processDetectorLevelNotStoredPIDExtra, "Process MC detector level PID extra QA for not stored derived data", true); }; using BCsWithTimestamps = soa::Join; -struct checkTimestamp { +struct CheckTimestamp { - o2::ccdb::CcdbApi ccdb_api; + o2::ccdb::CcdbApi ccdbApi; int mRunNumber; - ULong64_t runsor = 0; - ULong64_t runeor = 0; + uint64_t runsor = 0; + uint64_t runeor = 0; std::shared_ptr hTimeStampDiffNegative = nullptr; std::shared_ptr hTimeStampDiffPositive = nullptr; @@ -903,7 +1047,7 @@ struct checkTimestamp { hTimeStampDiffNegative = registry.add("DiffNegative", "Time before SOR (s)", kTH2F, {{100, 0.5, 100.5, "Run number"}, diffAxis}); hTimeStampDiffPositive = registry.add("DiffPositive", "Time after EOR (s)", kTH2F, {{100, 0.5, 100.5, "Run number"}, diffAxis}); - ccdb_api.init(ccdburl); + ccdbApi.init(ccdburl); } void process(aod::Collisions const& collisions, BCsWithTimestamps const&) @@ -916,7 +1060,7 @@ struct checkTimestamp { mRunNumber = bc.runNumber(); // read SOR and EOR timestamps from RCT CCDB via utility function - auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(ccdb_api, mRunNumber, false); + auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, mRunNumber, false); runeor = soreor.second; runsor = soreor.first; } @@ -941,6 +1085,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; return workflow; } diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index f9c07ba86cb..fa0d783fe52 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -9,10 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file lambdaCorrelationAnalysis.cxx +/// \file lambdaR2Correlation.cxx /// \brief R2 correlation of Lambda baryons. /// \author Yash Patley +#include +#include + #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" @@ -23,12 +26,14 @@ #include "PWGLF/DataModel/LFStrangenessTables.h" #include "CommonConstants/PhysicsConstants.h" #include "Common/Core/RecoDecay.h" +#include "CCDB/BasicCCDBManager.h" #include "TPDGCode.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::physics; +using namespace o2::constants::math; namespace o2::aod { @@ -46,11 +51,11 @@ using LambdaCollision = LambdaCollisions::iterator; namespace lambdamcgencollision { } -DECLARE_SOA_TABLE(LambdaMCGenCollisions, "AOD", "LMCGENCOLS", o2::soa::Index<>, +DECLARE_SOA_TABLE(LambdaMcGenCollisions, "AOD", "LMCGENCOLS", o2::soa::Index<>, o2::aod::mccollision::PosX, o2::aod::mccollision::PosY, o2::aod::mccollision::PosZ); -using LambdaMCGenCollision = LambdaMCGenCollisions::iterator; +using LambdaMcGenCollision = LambdaMcGenCollisions::iterator; namespace lambdatrack { @@ -59,12 +64,16 @@ DECLARE_SOA_COLUMN(Px, px, float); DECLARE_SOA_COLUMN(Py, py, float); DECLARE_SOA_COLUMN(Pz, pz, float); DECLARE_SOA_COLUMN(Pt, pt, float); -DECLARE_SOA_COLUMN(Rap, rap, float); +DECLARE_SOA_COLUMN(Eta, eta, float); DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(Rap, rap, float); DECLARE_SOA_COLUMN(Mass, mass, float); -DECLARE_SOA_COLUMN(PosTrackId, postrackid, int64_t); -DECLARE_SOA_COLUMN(NegTrackId, negtrackid, int64_t); -DECLARE_SOA_COLUMN(V0Type, v0type, int8_t); +DECLARE_SOA_COLUMN(PosTrackId, posTrackId, int64_t); +DECLARE_SOA_COLUMN(NegTrackId, negTrackId, int64_t); +DECLARE_SOA_COLUMN(V0Type, v0Type, int8_t); +DECLARE_SOA_COLUMN(CosPA, cosPA, float); +DECLARE_SOA_COLUMN(DcaDau, dcaDau, float); +DECLARE_SOA_COLUMN(CorrFact, corrFact, float); } // namespace lambdatrack DECLARE_SOA_TABLE(LambdaTracks, "AOD", "LAMBDATRACKS", o2::soa::Index<>, lambdatrack::LambdaCollisionId, @@ -72,31 +81,39 @@ DECLARE_SOA_TABLE(LambdaTracks, "AOD", "LAMBDATRACKS", o2::soa::Index<>, lambdatrack::Py, lambdatrack::Pz, lambdatrack::Pt, - lambdatrack::Rap, + lambdatrack::Eta, lambdatrack::Phi, + lambdatrack::Rap, lambdatrack::Mass, lambdatrack::PosTrackId, lambdatrack::NegTrackId, - lambdatrack::V0Type); + lambdatrack::V0Type, + lambdatrack::CosPA, + lambdatrack::DcaDau, + lambdatrack::CorrFact); using LambdaTrack = LambdaTracks::iterator; namespace lambdamcgentrack { -DECLARE_SOA_INDEX_COLUMN(LambdaMCGenCollision, lambdaMcGenCollision); +DECLARE_SOA_INDEX_COLUMN(LambdaMcGenCollision, lambdaMcGenCollision); } -DECLARE_SOA_TABLE(LambdaMCGenTracks, "AOD", "LMCGENTRACKS", o2::soa::Index<>, - lambdamcgentrack::LambdaMCGenCollisionId, +DECLARE_SOA_TABLE(LambdaMcGenTracks, "AOD", "LMCGENTRACKS", o2::soa::Index<>, + lambdamcgentrack::LambdaMcGenCollisionId, o2::aod::mcparticle::Px, o2::aod::mcparticle::Py, o2::aod::mcparticle::Pz, - o2::aod::mcparticle::Pt, + lambdatrack::Pt, + lambdatrack::Eta, + lambdatrack::Phi, lambdatrack::Rap, - o2::aod::mcparticle::Phi, lambdatrack::Mass, lambdatrack::PosTrackId, lambdatrack::NegTrackId, - lambdatrack::V0Type); -using LambdaMCGenTrack = LambdaMCGenTracks::iterator; + lambdatrack::V0Type, + lambdatrack::CosPA, + lambdatrack::DcaDau, + lambdatrack::CorrFact); +using LambdaMcGenTrack = LambdaMcGenTracks::iterator; } // namespace o2::aod @@ -116,78 +133,101 @@ enum RecGenType { kGen }; -struct lambdaCorrTableProducer { +enum DMCType { + kData = 0, + kMC +}; + +struct LambdaCorrTableProducer { Produces lambdaCollisionTable; Produces lambdaTrackTable; - Produces lambdaMCGenCollisionTable; - Produces lambdaMCGenTrackTable; + Produces lambdaMCGenCollisionTable; + Produces lambdaMCGenTrackTable; // Collisions - Configurable cfg_z_vtx{"cfg_z_vtx", 10.0, "z vertex cut"}; - Configurable cfg_sel8_sel{"cfg_sel8_sel", true, "Sel8 (T0A + T0C) Selection"}; - Configurable cfg_trigger_tvx_sel{"cfg_trigger_tvx_sel", false, "Trigger Time and Vertex Selection"}; - Configurable cfg_tf_border{"cfg_tf_border", false, "Timeframe Border Selection"}; - Configurable cfg_noitsro_border{"cfg_noitsro_border", false, "No ITSRO Border Cut"}; - Configurable cfg_itstpc_vtx{"cfg_itstpc_vtx", false, "ITS+TPC Vertex Selection"}; - Configurable cfg_pileup_reject{"cfg_pileup_reject", false, "Pileup rejection"}; - Configurable cfg_zvtx_time_diff{"cfg_zvtx_time_diff", false, "z-vtx time diff selection"}; + Configurable cMinZVtx{"cMinZVtx", -10.0, "z vertex cut"}; + Configurable cMaxZVtx{"cMaxZVtx", 10.0, "z vertex cut"}; + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection"}; + Configurable cTriggerTvxSel{"cTriggerTvxSel", false, "Trigger Time and Vertex Selection"}; + Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; + Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; + Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; + Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // Tracks - Configurable cfg_pt_min{"cfg_pt_min", 0.2, "p_{T} minimum"}; - Configurable cfg_pt_max{"cfg_pt_max", 4.0, "p_{T} minimum"}; - Configurable cfg_eta_cut{"cfg_eta_cut", 0.8, "Pseudorapidity cut"}; - Configurable cfg_min_crossed_rows{"cfg_min_crossed_rows", 70, "min crossed rows"}; - Configurable cfg_tpc_nsigma{"cfg_tpc_nsigma", 2.0, "TPC NSigma Selection Cut"}; - Configurable cfg_track_dcaXY_min{"cfg_track_dcaXY_min", 0.05, "Minimum DcaXY of Daughter Tracks"}; + Configurable cTrackMinPt{"cTrackMinPt", 0.2, "p_{T} minimum"}; + Configurable cTrackMaxPt{"cTrackMaxPt", 4.0, "p_{T} minimum"}; + Configurable cTrackEtaCut{"cTrackEtaCut", 0.8, "Pseudorapidity cut"}; + Configurable cMinTpcCrossedRows{"cMinTpcCrossedRows", 70, "min crossed rows"}; + Configurable cTpcNsigmaCut{"cTpcNsigmaCut", 2.0, "TPC NSigma Selection Cut"}; + Configurable cTrackMinDcaXY{"cTrackMinDcaXY", 0.05, "Minimum DcaXY of Daughter Tracks"}; // V0s - Configurable cfg_min_dca_V0_daughters{"cfg_min_dca_V0_daughters", 1.0, "min DCA between V0 daughters"}; - Configurable cfg_min_dca_pos_to_PV{"cfg_min_dca_pos_to_PV", 0.1, "Minimum V0 Positive Track DCAr cut to PV"}; - Configurable cfg_min_dca_neg_to_PV{"cfg_min_dca_neg_to_PV", 0.1, "Minimum V0 Negative Track DCAr cut to PV"}; - Configurable cfg_min_dca_V0_to_PV{"cfg_min_dca_V0_to_PV", 0.6, "Minimum DCA V0 to PV"}; - Configurable cfg_min_V0_radius{"cfg_min_V0_radius", 0.0, "Minimum V0 radius from PV"}; - Configurable cfg_max_V0_radius{"cfg_max_V0_radius", 50.0, "Maximum V0 radius from PV"}; - Configurable cfg_min_ctau{"cfg_min_ctau", 0.0, "Minimum ctau"}; - Configurable cfg_max_ctau{"cfg_max_ctau", 50.0, "Maximum ctau"}; - Configurable cfg_min_V0_cosPA{"cfg_min_V0_cosPA", 0.998, "Minimum V0 CosPA to PV"}; - Configurable cfg_lambda_mass_window{"cfg_lambda_mass_window", 0.007, "Mass Window to select Lambda"}; - Configurable cfg_kshort_rej{"cfg_kshort_rej", 0.005, "Reject K0Short Candidates"}; - Configurable cfg_kshort_rej_flag{"cfg_kshort_rej_flag", false, "K0short Mass Rej Flag"}; - Configurable cfg_armpod_flag{"cfg_armpod_flag", true, "Armentros-Podolanski Cut Flag"}; - Configurable cfg_armpod_val{"cfg_armpod_val", 0.5, "Armentros-Podolanski Slope Parameter"}; + Configurable cMinV0DcaDaughters{"cMinV0DcaDaughters", 1.0, "min DCA between V0 daughters"}; + Configurable cMinDcaPosToPV{"cMinDcaPosToPV", 0.1, "Minimum V0 Positive Track DCAr cut to PV"}; + Configurable cMinDcaNegToPV{"cMinDcaNegToPV", 0.1, "Minimum V0 Negative Track DCAr cut to PV"}; + Configurable cMinDcaV0ToPV{"cMinDcaV0ToPV", 0.6, "Minimum DCA V0 to PV"}; + Configurable cMinV0TransRadius{"cMinV0TransRadius", 0.0, "Minimum V0 radius from PV"}; + Configurable cMaxV0TransRadius{"cMaxV0TransRadius", 50.0, "Maximum V0 radius from PV"}; + Configurable cMinV0CTau{"cMinV0CTau", 0.0, "Minimum ctau"}; + Configurable cMaxV0CTau{"cMaxV0CTau", 50.0, "Maximum ctau"}; + Configurable cMinV0CosPA{"cMinV0CosPA", 0.998, "Minimum V0 CosPA to PV"}; + Configurable cLambdaMassWindow{"cLambdaMassWindow", 0.007, "Mass Window to select Lambda"}; + Configurable cKshortRejMassWindow{"cKshortRejMassWindow", 0.005, "Reject K0Short Candidates"}; + Configurable cKshortRejFlag{"cKshortRejFlag", false, "K0short Mass Rej Flag"}; + Configurable cArmPodCutValue{"cArmPodCutValue", 0.5, "Armentros-Podolanski Slope Parameter"}; + Configurable cArmPodCutFlag{"cArmPodCutFlag", true, "Armentros-Podolanski Cut Flag"}; // V0s kinmatic acceptance - Configurable cfg_v0_pt_min{"cfg_v0_pt_min", 0.3, "Minimum V0 pT"}; - Configurable cfg_v0_pt_max{"cfg_v0_pt_max", 3.0, "Minimum V0 pT"}; - Configurable cfg_v0_rap_max{"cfg_v0_rap_max", 0.8, "|rap| cut"}; - - // bool eta/rapidity - Configurable cfg_do_eta_analysis{"cfg_do_eta_analysis", false, "Eta Analysis"}; + Configurable cMinV0Pt{"cMinV0Pt", 0.8, "Minimum V0 pT"}; + Configurable cMaxV0Pt{"cMaxV0Pt", 3.2, "Minimum V0 pT"}; + Configurable cMaxV0Rap{"cMaxV0Rap", 0.6, "|rap| cut"}; // V0s MC - Configurable cfg_has_mc_flag{"cfg_has_mc_flag", true, "Has Mc Tag"}; - Configurable cfg_rec_primary_lambda{"cfg_rec_primary_lambda", false, "Primary Lambda"}; - Configurable cfg_rec_secondary_lambda{"cfg_rec_secondary_lambda", false, "Secondary Lambda"}; - Configurable cfg_rec_pid_flag{"cfg_rec_pid_flag", false, "PID Flag"}; - Configurable cfg_gen_primary_lambda{"cfg_gen_primary_lambda", true, "Primary Lambda"}; - Configurable cfg_gen_secondary_lambda{"cfg_gen_secondary_lambda", false, "Secondary Lambda"}; + Configurable cHasMcFlag{"cHasMcFlag", true, "Has Mc Tag"}; + Configurable cSelectTrueLambda{"cSelectTrueLambda", true, "Select True Lambda"}; + Configurable cRecPrimaryLambda{"cRecPrimaryLambda", true, "Primary Lambda"}; + Configurable cGenPrimaryLambda{"cGenPrimaryLambda", true, "Primary Lambda"}; + + // Efficiency Correction + Configurable cCorrectionFlag{"cCorrectionFlag", true, "Efficiency Correction Flag"}; + Configurable cCorrFactHistType{"cCorrFactHistType", 0, "Histogram Type {TH1F, TH2F, TH3F}"}; + + // CCDB + Configurable cUrlCCDB{"cUrlCCDB", "http://ccdb-test.cern.ch:8080", "url of ccdb"}; + Configurable cPathCCDB{"cPathCCDB", "Users/y/ypatley/lambda_corr_fact", "Path for ccdb-object"}; + + // Initialize CCDB Service + Service ccdb; // Histogram Registry. HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // initialize corr_factor objects + std::vector> vCorrFactStrings = {{"h1f_LaP_cf", "h1f_LaM_cf"}, + {"h2f_LaP_cf", "h2f_LaM_cf"}, + {"h3f_LaP_cf", "h3f_LaM_cf"}}; + void init(InitContext const&) { - const AxisSpec axisCol(6, 0, 6, ""); + // Set CCDB url + ccdb->setURL(cUrlCCDB.value); + ccdb->setCaching(true); + + // initialize axis specifications + const AxisSpec axisCol(20, 0, 20, ""); const AxisSpec axisCent(105, 0, 105, "FT0M (%)"); const AxisSpec axisMult(10, 0, 10, "N_{#Lambda}"); const AxisSpec axisVz(220, -11, 11, "V_{z} (cm)"); const AxisSpec axisPID(8000, -4000, 4000, "PdgCode"); const AxisSpec axisV0Mass(200, 1.09, 1.14, "M_{p#pi} (GeV/#it{c}^{2})"); - const AxisSpec axisV0Pt(64, 0.3, 3.5, "p_{T} (GeV/#it{c})"); - const AxisSpec axisV0Rap(16, -0.8, 0.8, "rap"); - const AxisSpec axisV0Phi(36, 0., 2. * TMath::Pi(), "#phi (rad)"); + const AxisSpec axisV0Pt(32, 0.3, 3.5, "p_{T} (GeV/#it{c})"); + const AxisSpec axisV0Rap(24, -1.2, 1.2, "y"); + const AxisSpec axisV0Eta(24, -1.2, 1.2, "#eta"); + const AxisSpec axisV0Phi(36, 0., TwoPI, "#phi (rad)"); const AxisSpec axisRadius(400, 0, 200, "r(cm)"); const AxisSpec axisCosPA(100, 0.99, 1.0, "cos(#theta_{PA})"); @@ -207,126 +247,94 @@ struct lambdaCorrTableProducer { // Create Histograms. // Event histograms - histos.add("Event/h1d_collision_posZ", "V_{z}-distribution", kTH1F, {axisVz}); - histos.add("Event/h1d_collisions_info", "# of Collisions", kTH1F, {axisCol}); + histos.add("Events/h1f_collision_posZ", "V_{z}-distribution", kTH1F, {axisVz}); + histos.add("Events/h1f_collisions_info", "# of Collisions", kTH1F, {axisCol}); // QA - histos.add("QA_Checks/h1d_tracks_info", "# of tracks", kTH1F, {axisCol}); - histos.add("QA_Checks/h1d_lambda_mass", "M_{#Lambda}", kTH1F, {axisV0Mass}); - histos.add("QA_Checks/h1d_antilambda_mass", "M_{#Lambda}", kTH1F, {axisV0Mass}); - histos.add("QA_Checks/h2d_lambda_pt_vs_mass", "p_{T} vs M_{#Lambda}", kTH2F, {axisV0Mass, axisV0Pt}); - histos.add("QA_Checks/h2d_antilambda_pt_vs_mass", "p_{T} vs M_{#Lambda}", kTH2F, {axisV0Mass, axisV0Pt}); - histos.add("QA_Checks/h2d_before_topo_cuts_pt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); - histos.add("QA_Checks/h2d_after_topo_cuts_pt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); - histos.add("QA_Checks/h2d_before_masswincut_pt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); - histos.add("QA_Checks/h2d_after_masswincut_pt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); + histos.add("Tracks/h1f_tracks_info", "# of tracks", kTH1F, {axisCol}); + histos.add("Tracks/h2f_armpod_before_sel", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); + histos.add("Tracks/h2f_armpod_after_sel", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); + histos.add("Tracks/h1f_lambda_pt_vs_invm", "p_{T} vs M_{#Lambda}", kTH2F, {axisV0Mass, axisV0Pt}); + histos.add("Tracks/h1f_antilambda_pt_vs_invm", "p_{T} vs M_{#bar{#Lambda}}", kTH2F, {axisV0Mass, axisV0Pt}); // QA Lambda - histos.add("QA_Sel_Lambda/h1d_V0_inv_mass", "V_{0} mass", kTH1F, {axisV0Mass}); - histos.add("QA_Sel_Lambda/h1d_V0_pt", "V_{0} p_{T}", kTH1F, {axisV0Pt}); - histos.add("QA_Sel_Lambda/h1d_V0_eta", "#eta-distribution", kTH1F, {axisV0Rap}); - histos.add("QA_Sel_Lambda/h1d_V0_rap", "y-distribution", kTH1F, {axisV0Rap}); - histos.add("QA_Sel_Lambda/h1d_V0_phi", "#phi-distribution", kTH1F, {axisV0Phi}); - histos.add("QA_Sel_Lambda/h2d_V0_pt_vs_eta", "p_{T} vs #eta", kTH2F, {axisV0Rap, axisV0Pt}); - histos.add("QA_Sel_Lambda/h2d_V0_pt_vs_rap", "p_{T} vs y", kTH2F, {axisV0Rap, axisV0Pt}); - histos.add("QA_Sel_Lambda/h2d_V0_pt_vs_phi", "p_{T} vs #phi", kTH2F, {axisV0Phi, axisV0Pt}); - histos.add("QA_Sel_Lambda/h2d_V0_pt_vs_mass", "p_{T} vs M_{p#pi}", kTH2F, {axisV0Mass, axisV0Pt}); - - histos.add("QA_Sel_Lambda/h1d_dca_V0_daughters", "DCA between V0 daughters", kTH1F, {axisDcaDau}); - histos.add("QA_Sel_Lambda/h1d_dca_pos_to_PV", "DCA positive prong to PV", kTH1F, {axisDcaProngPV}); - histos.add("QA_Sel_Lambda/h1d_dca_neg_to_PV", "DCA negative prong to PV", kTH1F, {axisDcaProngPV}); - histos.add("QA_Sel_Lambda/h1d_dca_V0_to_PV", "DCA V0 to PV", kTH1F, {axisDcaV0PV}); - histos.add("QA_Sel_Lambda/h1d_V0_cospa", "cos(#theta_{PA})", kTH1F, {axisCosPA}); - histos.add("QA_Sel_Lambda/h1d_V0_radius", "V_{0} Decay Radius in XY plane", kTH1F, {axisRadius}); - histos.add("QA_Sel_Lambda/h1d_V0_ctau", "V_{0} c#tau", kTH1F, {axisCTau}); - histos.add("QA_Sel_Lambda/h1d_V0_gctau", "V_{0} #gammac#tau", kTH1F, {axisGCTau}); - histos.add("QA_Sel_Lambda/h2d_qt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); - - histos.add("QA_Sel_Lambda/h1d_pos_prong_pt", "Pos-Prong p_{T}", kTH1F, {axisTrackPt}); - histos.add("QA_Sel_Lambda/h1d_neg_prong_pt", "Neg-Prong p_{T}", kTH1F, {axisTrackPt}); - histos.add("QA_Sel_Lambda/h1d_pos_prong_eta", "Pos-Prong #eta-distribution", kTH1F, {axisV0Rap}); - histos.add("QA_Sel_Lambda/h1d_neg_prong_eta", "Neg-Prong #eta-distribution", kTH1F, {axisV0Rap}); - histos.add("QA_Sel_Lambda/h1d_pos_prong_phi", "Pos-Prong #phi-distribution", kTH1F, {axisV0Phi}); - histos.add("QA_Sel_Lambda/h1d_neg_prong_phi", "Neg-Prong #phi-distribution", kTH1F, {axisV0Phi}); - - histos.add("QA_Sel_Lambda/h2d_pos_prong_dcaXY_vs_pt", "DCA vs p_{T}", kTH2F, {axisTrackPt, axisTrackDCA}); - histos.add("QA_Sel_Lambda/h2d_neg_prong_dcaXY_vs_pt", "DCA vs p_{T}", kTH2F, {axisTrackPt, axisTrackDCA}); - histos.add("QA_Sel_Lambda/h2d_pos_prong_dEdx_vs_p", "TPC Signal Pos-Prong", kTH2F, {axisMomPID, axisdEdx}); - histos.add("QA_Sel_Lambda/h2d_neg_prong_dEdx_vs_p", "TPC Signal Neg-Prong", kTH2F, {axisMomPID, axisdEdx}); - histos.add("QA_Sel_Lambda/h2d_pos_prong_tpc_nsigma_pr_vs_p", "TPC n#sigma Pos Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_neg_prong_tpc_nsigma_pr_vs_p", "TPC n#sigma Neg Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_pos_prong_tpc_nsigma_pi_vs_p", "TPC n#sigma Pos Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_neg_prong_tpc_nsigma_pi_vs_p", "TPC n#sigma Neg Prong", kTH2F, {axisMomPID, axisNsigma}); + histos.add("QA/Lambda/h2f_qt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); + histos.add("QA/Lambda/h1f_dca_V0_daughters", "DCA between V0 daughters", kTH1F, {axisDcaDau}); + histos.add("QA/Lambda/h1f_dca_pos_to_PV", "DCA positive prong to PV", kTH1F, {axisDcaProngPV}); + histos.add("QA/Lambda/h1f_dca_neg_to_PV", "DCA negative prong to PV", kTH1F, {axisDcaProngPV}); + histos.add("QA/Lambda/h1f_dca_V0_to_PV", "DCA V0 to PV", kTH1F, {axisDcaV0PV}); + histos.add("QA/Lambda/h1f_V0_cospa", "cos(#theta_{PA})", kTH1F, {axisCosPA}); + histos.add("QA/Lambda/h1f_V0_radius", "V_{0} Decay Radius in XY plane", kTH1F, {axisRadius}); + histos.add("QA/Lambda/h1f_V0_ctau", "V_{0} c#tau", kTH1F, {axisCTau}); + histos.add("QA/Lambda/h1f_V0_gctau", "V_{0} #gammac#tau", kTH1F, {axisGCTau}); + + histos.add("QA/Lambda/h1f_pos_prong_pt", "Pos-Prong p_{T}", kTH1F, {axisTrackPt}); + histos.add("QA/Lambda/h1f_neg_prong_pt", "Neg-Prong p_{T}", kTH1F, {axisTrackPt}); + histos.add("QA/Lambda/h1f_pos_prong_eta", "Pos-Prong #eta-distribution", kTH1F, {axisV0Eta}); + histos.add("QA/Lambda/h1f_neg_prong_eta", "Neg-Prong #eta-distribution", kTH1F, {axisV0Eta}); + histos.add("QA/Lambda/h1f_pos_prong_phi", "Pos-Prong #phi-distribution", kTH1F, {axisV0Phi}); + histos.add("QA/Lambda/h1f_neg_prong_phi", "Neg-Prong #phi-distribution", kTH1F, {axisV0Phi}); + + histos.add("QA/Lambda/h2f_pos_prong_dcaXY_vs_pt", "DCA vs p_{T}", kTH2F, {axisTrackPt, axisTrackDCA}); + histos.add("QA/Lambda/h2f_neg_prong_dcaXY_vs_pt", "DCA vs p_{T}", kTH2F, {axisTrackPt, axisTrackDCA}); + histos.add("QA/Lambda/h2f_pos_prong_dEdx_vs_p", "TPC Signal Pos-Prong", kTH2F, {axisMomPID, axisdEdx}); + histos.add("QA/Lambda/h2f_neg_prong_dEdx_vs_p", "TPC Signal Neg-Prong", kTH2F, {axisMomPID, axisdEdx}); + histos.add("QA/Lambda/h2f_pos_prong_tpc_nsigma_pr_vs_p", "TPC n#sigma Pos Prong", kTH2F, {axisMomPID, axisNsigma}); + histos.add("QA/Lambda/h2f_neg_prong_tpc_nsigma_pr_vs_p", "TPC n#sigma Neg Prong", kTH2F, {axisMomPID, axisNsigma}); + histos.add("QA/Lambda/h2f_pos_prong_tpc_nsigma_pi_vs_p", "TPC n#sigma Pos Prong", kTH2F, {axisMomPID, axisNsigma}); + histos.add("QA/Lambda/h2f_neg_prong_tpc_nsigma_pi_vs_p", "TPC n#sigma Neg Prong", kTH2F, {axisMomPID, axisNsigma}); // QA Anti-Lambda - histos.addClone("QA_Sel_Lambda/", "QA_Sel_AntiLambda/"); + histos.addClone("QA/Lambda/", "QA/AntiLambda/"); // MC Generated Histograms if (doprocessMCGen) { // McReco Histos - histos.add("QA_Checks/h2d_tracks_pid_before_mccuts", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("QA_Checks/h2d_tracks_pid_phyprim", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("QA_Checks/h2d_tracks_pid_after_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("QA_Checks/h2d_lambda_from_sigma", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("QA_Checks/h2d_lambda_from_cascade", "PIDs", kTH2F, {axisPID, axisV0Pt}); + histos.add("Tracks/h2f_tracks_pid_before_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); + histos.add("Tracks/h2f_tracks_pid_after_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); + histos.add("Tracks/h2f_lambda_from_sigma", "PIDs", kTH2F, {axisPID, axisV0Pt}); + histos.add("Tracks/h2f_lambda_from_cascade", "PIDs", kTH2F, {axisPID, axisV0Pt}); // McGen Histos - histos.add("McGen/h1d_collisions_info", "# of collisions", kTH1F, {axisCol}); - histos.add("McGen/h1d_collision_posZ", "V_{z}-distribution", kTH1F, {axisVz}); - histos.add("McGen/h1d_lambda_daughter_PDG", "PDG Daughters", kTH1F, {axisPID}); - histos.add("McGen/h1d_antilambda_daughter_PDG", "PDG Daughters", kTH1F, {axisPID}); - histos.add("McGen/h1d_mass_lambda", "M_{#Lambda}", kTH1F, {axisV0Mass}); - histos.add("McGen/h1d_pt_lambda", "#Lambda p_{T}", kTH1F, {axisV0Pt}); - histos.add("McGen/h1d_eta_lambda", "#Lambda #eta-distribution", kTH1F, {axisV0Rap}); - histos.add("McGen/h1d_y_lambda", "#Lambda y-distribution", kTH1F, {axisV0Rap}); - histos.add("McGen/h1d_phi_lambda", "#Lambda #phi-distribution", kTH1F, {axisV0Phi}); - histos.add("McGen/h2d_pteta_lambda", "#Lambda p_{T} vs #eta", kTH2F, {axisV0Rap, axisV0Pt}); - histos.add("McGen/h2d_ptrap_lambda", "#Lambda p_{T} vs y", kTH2F, {axisV0Rap, axisV0Pt}); - histos.add("McGen/h2d_ptphi_lambda", "#Lambda p_{T} vs #phi", kTH2F, {axisV0Phi, axisV0Pt}); - histos.add("McGen/h1d_mass_antilambda", "M_{#bar{#Lambda}}", kTH1F, {axisV0Mass}); - histos.add("McGen/h1d_pt_antilambda", "#bar{#Lambda} p_{T}", kTH1F, {axisV0Pt}); - histos.add("McGen/h1d_eta_antilambda", "#bar{#Lambda} #eta-distribution", kTH1F, {axisV0Rap}); - histos.add("McGen/h1d_y_antilambda", "#bar{#Lambda} y-distribution", kTH1F, {axisV0Rap}); - histos.add("McGen/h1d_phi_antilambda", "#bar{#Lambda} #phi-distribution", kTH1F, {axisV0Phi}); - histos.add("McGen/h2d_pteta_antilambda", "#bar{#Lambda} p_{T} vs #eta", kTH2F, {axisV0Rap, axisV0Pt}); - histos.add("McGen/h2d_ptrap_antilambda", "#bar{#Lambda} p_{T} vs y", kTH2F, {axisV0Rap, axisV0Pt}); - histos.add("McGen/h2d_ptphi_antilambda", "#bar{#Lambda} p_{T} vs #phi", kTH2F, {axisV0Phi, axisV0Pt}); + histos.add("McGen/h1f_collisions_info", "# of collisions", kTH1F, {axisCol}); + histos.add("McGen/h1f_collision_posZ", "V_{z}-distribution", kTH1F, {axisVz}); + histos.add("McGen/h1f_lambda_daughter_PDG", "PDG Daughters", kTH1F, {axisPID}); + histos.add("McGen/h1f_antilambda_daughter_PDG", "PDG Daughters", kTH1F, {axisPID}); } } template - bool selCol(C const& col) + bool selCollision(C const& col) { - - if (fabs(col.posZ()) > cfg_z_vtx) { + if (col.posZ() < cMinZVtx || col.posZ() >= cMaxZVtx) { return false; } - if (!col.sel8() && cfg_sel8_sel) { + if (!col.sel8() && cSel8Trig) { return false; } - if (!col.selection_bit(aod::evsel::kIsTriggerTVX) && cfg_trigger_tvx_sel) { + if (!col.selection_bit(aod::evsel::kIsTriggerTVX) && cTriggerTvxSel) { return false; } - if (!col.selection_bit(aod::evsel::kNoTimeFrameBorder) && cfg_tf_border) { + if (!col.selection_bit(aod::evsel::kNoTimeFrameBorder) && cTFBorder) { return false; } - if (!col.selection_bit(aod::evsel::kNoITSROFrameBorder) && cfg_noitsro_border) { + if (!col.selection_bit(aod::evsel::kNoITSROFrameBorder) && cNoItsROBorder) { return false; } - if (!col.selection_bit(aod::evsel::kIsVertexITSTPC) && cfg_itstpc_vtx) { + if (!col.selection_bit(aod::evsel::kIsVertexITSTPC) && cItsTpcVtx) { return false; } - if (!col.selection_bit(aod::evsel::kNoSameBunchPileup) && cfg_pileup_reject) { + if (!col.selection_bit(aod::evsel::kNoSameBunchPileup) && cPileupReject) { return false; } - if (!col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && cfg_zvtx_time_diff) { + if (!col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && cZVtxTimeDiff) { return false; } @@ -334,22 +342,21 @@ struct lambdaCorrTableProducer { } template - bool dauTrackSelection(T const& track) + bool selDaughterTracks(T const& track) { - - if (track.pt() < cfg_pt_min || track.pt() > cfg_pt_max) { + if (track.pt() < cTrackMinPt || track.pt() > cTrackMaxPt) { return false; } - if (fabs(track.eta()) >= cfg_eta_cut) { + if (std::abs(track.eta()) >= cTrackEtaCut) { return false; } - if (track.tpcNClsCrossedRows() < cfg_min_crossed_rows) { + if (track.tpcNClsCrossedRows() < cMinTpcCrossedRows) { return false; } - if (fabs(track.dcaXY()) < cfg_track_dcaXY_min) { + if (std::abs(track.dcaXY()) < cTrackMinDcaXY) { return false; } @@ -357,43 +364,69 @@ struct lambdaCorrTableProducer { } template - bool topologicalCutsV0(C const& col, V const& v0, T const&) + bool selLambdaWithTopoKinCuts(C const& col, V const& v0, T const&) { - auto postrack = v0.template posTrack_as(); auto negtrack = v0.template negTrack_as(); - if (!dauTrackSelection(postrack) || !dauTrackSelection(negtrack)) { + if (!selDaughterTracks(postrack) || !selDaughterTracks(negtrack)) { return false; } - if (v0.dcaV0daughters() > cfg_min_dca_V0_daughters) { + histos.fill(HIST("Tracks/h1f_tracks_info"), 2.5); + + if (v0.dcaV0daughters() > cMinV0DcaDaughters) { return false; } - if (fabs(v0.dcapostopv()) < cfg_min_dca_pos_to_PV) { + if (std::abs(v0.dcapostopv()) < cMinDcaPosToPV) { return false; } - if (fabs(v0.dcanegtopv()) < cfg_min_dca_neg_to_PV) { + if (std::abs(v0.dcanegtopv()) < cMinDcaNegToPV) { return false; } - if (v0.dcav0topv() > cfg_min_dca_V0_to_PV) { + if (v0.dcav0topv() > cMinDcaV0ToPV) { return false; } - if ((v0.v0radius() > cfg_max_V0_radius) || (v0.v0radius() < cfg_min_V0_radius)) { + if ((v0.v0radius() > cMaxV0TransRadius) || (v0.v0radius() < cMinV0TransRadius)) { return false; } // ctau float ctau = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * MassLambda0; - if (ctau < cfg_min_ctau || ctau > cfg_max_ctau) { + if (ctau < cMinV0CTau || ctau > cMaxV0CTau) { + return false; + } + + // cosine of pointing angle + if (v0.v0cosPA() < cMinV0CosPA) { + return false; + } + + histos.fill(HIST("Tracks/h1f_tracks_info"), 3.5); + + // pT cut + if (v0.pt() <= cMinV0Pt || v0.pt() >= cMaxV0Pt) { return false; } - if (v0.v0cosPA() < cfg_min_V0_cosPA) { + // rapidity cut + if (std::abs(v0.yLambda()) >= cMaxV0Rap) { + return false; + } + + histos.fill(HIST("Tracks/h1f_tracks_info"), 4.5); + + // Armentros-Podolanski Selection + if (cArmPodCutFlag && (std::abs(v0.alpha()) < v0.qtarm() / cArmPodCutValue)) { + return false; + } + + // Kshort mass rejection hypothesis + if (cKshortRejFlag && (std::abs(v0.mK0Short() - MassK0Short) <= cKshortRejMassWindow)) { return false; } @@ -401,9 +434,9 @@ struct lambdaCorrTableProducer { } template - bool selPIDTrack(T const& postrack, T const& negtrack) + bool selLambdaDauWithTpcPid(T const& postrack, T const& negtrack) { - bool return_flag = false; + bool returnFlag = false; float tpcNSigmaPr = 0., tpcNSigmaPi = 0.; switch (part) { @@ -420,61 +453,130 @@ struct lambdaCorrTableProducer { break; } - if (fabs(tpcNSigmaPr) < cfg_tpc_nsigma && fabs(tpcNSigmaPi) < cfg_tpc_nsigma) { - return_flag = true; + if (std::abs(tpcNSigmaPr) < cTpcNsigmaCut && std::abs(tpcNSigmaPi) < cTpcNsigmaCut) { + returnFlag = true; } - return return_flag; + return returnFlag; } - template - bool checkKinCuts(T const& v0track, float& rap) + template + bool selLambdaMassWindow(V const& v0, T const&, ParticleType& v0type) { + // initialize daughter tracks + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); - // pT cut - if (v0track.pt() <= cfg_v0_pt_min || v0track.pt() >= cfg_v0_pt_max) { - return false; + // initialize selection flags + bool lambdaFlag = false, antiLambdaFlag = false; + + // get v0 track as lambda + if ((std::abs(v0.mLambda() - MassLambda0) < cLambdaMassWindow) && (selLambdaDauWithTpcPid(postrack, negtrack))) { + lambdaFlag = true; + v0type = kLambda; } - // apply rapidity/pseudorapidity acceptance - if (cfg_do_eta_analysis) { - rap = v0track.eta(); - } else { - rap = v0track.yLambda(); + // get v0 track as anti-lambda + if ((std::abs(v0.mAntiLambda() - MassLambda0) < cLambdaMassWindow) && (selLambdaDauWithTpcPid(postrack, negtrack))) { + antiLambdaFlag = true; + v0type = kAntiLambda; } - if (fabs(rap) >= cfg_v0_rap_max) { + if (!lambdaFlag && !antiLambdaFlag) { // neither Lambda nor Anti-Lambda + histos.fill(HIST("Tracks/h1f_tracks_info"), 18.5); + return false; + } else if (lambdaFlag && antiLambdaFlag) { // check if the track is identified as lambda and anti-lambda both (DISCARD THIS TRACK) + histos.fill(HIST("Tracks/h1f_tracks_info"), 19.5); return false; } return true; } - template - void getPDGsIDs(T const& mcparts, std::vector& PDGs, std::vector& IDs) + template + bool selTrueMcRecLambda(V const& v0, T const&) { + auto mcpart = v0.template mcParticle_as(); - for (auto mcpart : mcparts) { - if (mcpart.globalIndex() != 0) { - IDs.push_back(mcpart.globalIndex()); - PDGs.push_back(mcpart.pdgCode()); - } + // check for lambda/anti-lambda + if (std::abs(mcpart.pdgCode()) != kLambda0) { + histos.fill(HIST("Tracks/h1f_tracks_info"), 10.5); + return false; + } + + // check for primary/secondary lambda + if (cRecPrimaryLambda && !mcpart.isPhysicalPrimary()) { + histos.fill(HIST("Tracks/h1f_tracks_info"), 11.5); + return false; + } else if (!cRecPrimaryLambda && mcpart.isPhysicalPrimary()) { + histos.fill(HIST("Tracks/h1f_tracks_info"), 12.5); + return false; } - while (IDs.size() > 2) { - IDs.pop_back(); + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); + + // check if the daughters have corresponding mcparticle + if (!postrack.has_mcParticle() || !negtrack.has_mcParticle()) { + histos.fill(HIST("Tracks/h1f_tracks_info"), 13.5); + return false; } - while (PDGs.size() > 2) { - PDGs.pop_back(); + auto mcpostrack = postrack.template mcParticle_as(); + auto mcnegtrack = negtrack.template mcParticle_as(); + + if (std::abs(mcpostrack.pdgCode()) != kProton || std::abs(mcnegtrack.pdgCode()) != kPiPlus) { // incorrect decay channel -> return false + histos.fill(HIST("Tracks/h1f_tracks_info"), 14.5); + return false; } + + return true; } - template - void fillQALambda(C const& col, V const& v0, T const&) + template + float getCorrectionFactors(C const& col, V const& v0) { + // Check for efficiency correction flag and Rec/Gen Data + if (!cCorrectionFlag) { + return 1.; + } - static constexpr std::string_view sub_dir[] = {"QA_Sel_Lambda/", "QA_Sel_AntiLambda/"}; + // Get from CCDB + auto ccdbObj = ccdb->getForTimeStamp(cPathCCDB.value, -1); + + // Check CCDB Object + if (!ccdbObj) { + LOGF(warning, "CCDB OBJECT NOT FOUND"); + return 1.; + } + + // get ccdb object + TObject* obj = reinterpret_cast(ccdbObj->FindObject(Form("%s", vCorrFactStrings[cCorrFactHistType][part].c_str()))); + + if (obj->InheritsFrom("TH1F")) { + TH1F* hist = reinterpret_cast(obj->Clone()); + int ptBin = hist->GetXaxis()->FindBin(v0.pt()); + return hist->GetBinContent(ptBin); + } else if (obj->InheritsFrom("TH2F")) { + TH2F* hist = reinterpret_cast(obj->Clone()); + int ptBin = hist->GetXaxis()->FindBin(v0.pt()); + int rapBin = hist->GetYaxis()->FindBin(v0.yLambda()); + return hist->GetBinContent(ptBin, rapBin); + } else if (obj->InheritsFrom("TH3F")) { + TH3F* hist = reinterpret_cast(obj->Clone()); + int ptBin = hist->GetXaxis()->FindBin(v0.pt()); + int rapBin = hist->GetYaxis()->FindBin(v0.yLambda()); + int vzBin = hist->GetZaxis()->FindBin(col.posZ()); + return hist->GetBinContent(ptBin, rapBin, vzBin); + } else { + return 1.; + } + } + + template + void fillLambdaQAHistos(C const& col, V const& v0, T const&) + { + static constexpr std::string_view SubDir[] = {"QA/Lambda/", "QA/AntiLambda/"}; // daugthers auto postrack = v0.template posTrack_as(); @@ -493,164 +595,117 @@ struct lambdaCorrTableProducer { float ctau = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * MassLambda0; float gctau = ctau * gamma; - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_inv_mass"), mass); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_pt"), v0.pt()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_eta"), v0.eta()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_rap"), v0.yLambda()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_phi"), v0.phi()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_V0_pt_vs_eta"), v0.eta(), v0.pt()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_V0_pt_vs_rap"), v0.yLambda(), v0.pt()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_V0_pt_vs_phi"), v0.phi(), v0.pt()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_V0_pt_vs_mass"), mass, v0.pt()); - - histos.fill(HIST(sub_dir[part]) + HIST("h1d_dca_V0_daughters"), v0.dcaV0daughters()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_dca_pos_to_PV"), v0.dcapostopv()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_dca_neg_to_PV"), v0.dcanegtopv()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_dca_V0_to_PV"), v0.dcav0topv()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_cospa"), v0.v0cosPA()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_radius"), v0.v0radius()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_ctau"), ctau); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_V0_gctau"), gctau); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_qt_vs_alpha"), v0.alpha(), v0.qtarm()); - - histos.fill(HIST(sub_dir[part]) + HIST("h1d_pos_prong_pt"), postrack.pt()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_pos_prong_eta"), postrack.eta()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_pos_prong_phi"), postrack.phi()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_neg_prong_pt"), negtrack.pt()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_neg_prong_eta"), negtrack.eta()); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_neg_prong_phi"), negtrack.phi()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_pos_prong_dcaXY_vs_pt"), postrack.pt(), postrack.dcaXY()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_neg_prong_dcaXY_vs_pt"), negtrack.pt(), negtrack.dcaXY()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_pos_prong_dEdx_vs_p"), postrack.tpcInnerParam(), postrack.tpcSignal()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_neg_prong_dEdx_vs_p"), negtrack.tpcInnerParam(), negtrack.tpcSignal()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_pos_prong_tpc_nsigma_pr_vs_p"), postrack.tpcInnerParam(), postrack.tpcNSigmaPr()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_neg_prong_tpc_nsigma_pr_vs_p"), negtrack.tpcInnerParam(), negtrack.tpcNSigmaPr()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_pos_prong_tpc_nsigma_pi_vs_p"), postrack.tpcInnerParam(), postrack.tpcNSigmaPi()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_neg_prong_tpc_nsigma_pi_vs_p"), negtrack.tpcInnerParam(), negtrack.tpcNSigmaPi()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_qt_vs_alpha"), v0.alpha(), v0.qtarm()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_dca_V0_daughters"), v0.dcaV0daughters()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_dca_pos_to_PV"), v0.dcapostopv()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_dca_neg_to_PV"), v0.dcanegtopv()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_dca_V0_to_PV"), v0.dcav0topv()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_V0_cospa"), v0.v0cosPA()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_V0_radius"), v0.v0radius()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_V0_ctau"), ctau); + histos.fill(HIST(SubDir[part]) + HIST("h1f_V0_gctau"), gctau); + + histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_pt"), postrack.pt()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_eta"), postrack.eta()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_phi"), postrack.phi()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_pt"), negtrack.pt()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_eta"), negtrack.eta()); + histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_phi"), negtrack.phi()); + + histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_dcaXY_vs_pt"), postrack.pt(), postrack.dcaXY()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_dcaXY_vs_pt"), negtrack.pt(), negtrack.dcaXY()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_dEdx_vs_p"), postrack.tpcInnerParam(), postrack.tpcSignal()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_dEdx_vs_p"), negtrack.tpcInnerParam(), negtrack.tpcSignal()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_tpc_nsigma_pr_vs_p"), postrack.tpcInnerParam(), postrack.tpcNSigmaPr()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_tpc_nsigma_pr_vs_p"), negtrack.tpcInnerParam(), negtrack.tpcNSigmaPr()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_tpc_nsigma_pi_vs_p"), postrack.tpcInnerParam(), postrack.tpcNSigmaPi()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_tpc_nsigma_pi_vs_p"), negtrack.tpcInnerParam(), negtrack.tpcNSigmaPi()); } - template - void selV0Particle(C const& collision, V const& v0track, T const& tracks) + template + void fillLambdaTables(C const& collision, V const& v0tracks, T const& tracks) { - - // apply kinematic cuts - float rap = 0.; - if (!checkKinCuts(v0track, rap)) { - return; - } - - // initialize daughter tracks - auto postrack = v0track.template posTrack_as(); - auto negtrack = v0track.template negTrack_as(); - - // initialize mass and v0lambda/v0antilambda - float mass = 0.; - ParticleType v0part; - - // apply daughter particle id - // check for Lambda / Anti-Lambda - if (selPIDTrack(postrack, negtrack)) { - mass = v0track.mLambda(); - v0part = kLambda; - } else if (selPIDTrack(postrack, negtrack)) { - mass = v0track.mAntiLambda(); - v0part = kAntiLambda; - } else { - return; - } - - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 3.5); - histos.fill(HIST("QA_Checks/h2d_before_masswincut_pt_vs_alpha"), v0track.alpha(), v0track.qtarm()); - - // apply Armentros-Podolanski Selection - if (cfg_armpod_flag && (fabs(v0track.alpha()) < v0track.qtarm() / cfg_armpod_val)) { - return; - } - - // apply kshort rejection hypothesis - if (cfg_kshort_rej_flag && (fabs(v0track.mK0Short() - MassK0Short) <= cfg_kshort_rej)) { - return; + if constexpr (dmc == kMC) { + histos.fill(HIST("Events/h1f_collisions_info"), 0.5); + if (!collision.has_mcCollision()) { + return; + } } - // fill mass histograms before applying mass window cut to get % purity - if (v0part == kLambda) { - histos.fill(HIST("QA_Checks/h1d_lambda_mass"), mass); - histos.fill(HIST("QA_Checks/h2d_lambda_pt_vs_mass"), mass, v0track.pt()); - } else if (v0part == kAntiLambda) { - histos.fill(HIST("QA_Checks/h1d_antilambda_mass"), mass); - histos.fill(HIST("QA_Checks/h2d_antilambda_pt_vs_mass"), mass, v0track.pt()); - } + histos.fill(HIST("Events/h1f_collisions_info"), 1.5); - // apply mass window cut (Selection of Lambda/AntiLambda) - if (fabs(mass - MassLambda0) >= cfg_lambda_mass_window) { + // select collision + if (!selCollision(collision)) { return; } - histos.fill(HIST("QA_Checks/h2d_after_masswincut_pt_vs_alpha"), v0track.alpha(), v0track.qtarm()); - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 4.5); + histos.fill(HIST("Events/h1f_collisions_info"), 2.5); + histos.fill(HIST("Events/h1f_collision_posZ"), collision.posZ()); - // MC Reco Analysis - if constexpr (reco) { - auto v0mcpart = v0track.mcParticle(); + lambdaCollisionTable(collision.centFT0M(), collision.posX(), collision.posY(), collision.posZ()); - histos.fill(HIST("QA_Checks/h2d_tracks_pid_before_mccuts"), v0mcpart.pdgCode(), v0mcpart.pt()); + // initialize v0track objects + ParticleType v0type = kLambda; + float mass = 0., corr_fact = 1.; - if (cfg_rec_primary_lambda && !v0mcpart.isPhysicalPrimary()) { - return; - } else if (cfg_rec_secondary_lambda && v0mcpart.isPhysicalPrimary()) { - return; + for (auto const& v0 : v0tracks) { + // check for corresponding MCGen Particle + if constexpr (dmc == kMC) { + histos.fill(HIST("Tracks/h1f_tracks_info"), 0.5); + if (!v0.has_mcParticle()) { + continue; + } } - histos.fill(HIST("QA_Checks/h2d_tracks_pid_phyprim"), v0mcpart.pdgCode(), v0mcpart.pt()); + histos.fill(HIST("Tracks/h1f_tracks_info"), 1.5); + histos.fill(HIST("Tracks/h2f_armpod_before_sel"), v0.alpha(), v0.qtarm()); - // Get Daughters and Mothers - bool decay_channel_flag = false; - std::vector daughterPDGs{}, daughterIDs{}, motherPDGs{}, motherIDs{}; - auto mcpart_daughters = v0mcpart.template daughters_as(); - auto mcpart_mothers = v0mcpart.template mothers_as(); - - if (cfg_rec_pid_flag) { + // topological and kinematic selection + // armeteros-podolanski selection | kshort mass rejection hypothesis + if (!selLambdaWithTopoKinCuts(collision, v0, tracks)) { + continue; + } - if (v0part == kLambda && v0mcpart.pdgCode() != kLambda0) { - return; - } else if (v0part == kAntiLambda && v0mcpart.pdgCode() != kLambda0Bar) { - return; - } + histos.fill(HIST("Tracks/h1f_tracks_info"), 5.5); - getPDGsIDs(mcpart_daughters, daughterPDGs, daughterIDs); - getPDGsIDs(mcpart_mothers, motherPDGs, motherIDs); + // select v0 as lambda / anti-lambda + if (!selLambdaMassWindow(v0, tracks, v0type)) { + continue; + } - // Decay to Proton-Pion - if (abs(daughterPDGs[0]) == kProton && abs(daughterPDGs[1]) == kPiPlus) { - decay_channel_flag = true; - } + histos.fill(HIST("Tracks/h1f_tracks_info"), 6.5); + histos.fill(HIST("Tracks/h2f_armpod_after_sel"), v0.alpha(), v0.qtarm()); - if (!decay_channel_flag) { - return; + // we have v0 as lambda + // do MC analysis + if constexpr (dmc == kMC) { + histos.fill(HIST("Tracks/h2f_tracks_pid_before_sel"), v0.mcParticle().pdgCode(), v0.pt()); + if (cSelectTrueLambda && !selTrueMcRecLambda(v0, tracks)) { + continue; } + histos.fill(HIST("Tracks/h1f_tracks_info"), 7.5); + histos.fill(HIST("Tracks/h2f_tracks_pid_after_sel"), v0.mcParticle().pdgCode(), v0.pt()); + } - // check the secondary lambdas coming from Sigma, Cascades and Omegas - if (abs(motherPDGs[0]) == kSigma0 || abs(motherPDGs[1]) == kSigma0Bar) { - histos.fill(HIST("QA_Checks/h2d_lambda_from_sigma"), v0mcpart.pdgCode(), v0mcpart.pt()); - } + // get correction factors and mass + corr_fact = (v0type == kLambda) ? getCorrectionFactors(collision, v0) : getCorrectionFactors(collision, v0); + mass = (v0type == kLambda) ? v0.mLambda() : v0.mAntiLambda(); - if (abs(motherPDGs[0]) == kXiMinus || abs(motherPDGs[1]) == kXiMinus) { - histos.fill(HIST("QA_Checks/h2d_lambda_from_cascade"), v0mcpart.pdgCode(), v0mcpart.pt()); - } + // fill lambda qa + if (v0type == kLambda) { + histos.fill(HIST("Tracks/h1f_lambda_pt_vs_invm"), mass, v0.pt()); + fillLambdaQAHistos(collision, v0, tracks); + } else { + histos.fill(HIST("Tracks/h1f_antilambda_pt_vs_invm"), mass, v0.pt()); + fillLambdaQAHistos(collision, v0, tracks); } - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 5.5); - histos.fill(HIST("QA_Checks/h2d_tracks_pid_after_sel"), v0mcpart.pdgCode(), v0mcpart.pt()); + // Fill Lambda/AntiLambda Table + lambdaTrackTable(lambdaCollisionTable.lastIndex(), v0.px(), v0.py(), v0.pz(), + v0.pt(), v0.eta(), v0.phi(), v0.yLambda(), mass, + v0.template posTrack_as().index(), v0.template negTrack_as().index(), + (int8_t)v0type, v0.v0cosPA(), v0.dcaV0daughters(), corr_fact); } - - if (v0part == kLambda) { - fillQALambda(collision, v0track, tracks); - } else { - fillQALambda(collision, v0track, tracks); - } - - // Fill Lambda/AntiLambda Table - lambdaTrackTable(lambdaCollisionTable.lastIndex(), v0track.px(), v0track.py(), v0track.pz(), v0track.pt(), rap, v0track.phi(), mass, postrack.index(), negtrack.index(), (int8_t)v0part); } using Collisions = soa::Join; @@ -658,220 +713,89 @@ struct lambdaCorrTableProducer { void processData(Collisions::iterator const& collision, aod::V0Datas const& V0s, Tracks const& tracks) { - - histos.fill(HIST("Event/h1d_collisions_info"), 1.5); - - // select collision - if (!selCol(collision)) { - return; - } - - histos.fill(HIST("Event/h1d_collisions_info"), 2.5); - histos.fill(HIST("Event/h1d_collision_posZ"), collision.posZ()); - - lambdaCollisionTable(collision.centFT0M(), collision.posX(), collision.posY(), collision.posZ()); - - for (auto const& v0 : V0s) { - - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 1.5); - histos.fill(HIST("QA_Checks/h2d_before_topo_cuts_pt_vs_alpha"), v0.alpha(), v0.qtarm()); - - // apply topological cuts on v0 candidates - if (!topologicalCutsV0(collision, v0, tracks)) { - continue; - } - - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 2.5); - histos.fill(HIST("QA_Checks/h2d_after_topo_cuts_pt_vs_alpha"), v0.alpha(), v0.qtarm()); - - selV0Particle(collision, v0, tracks); - } + fillLambdaTables(collision, V0s, tracks); } - PROCESS_SWITCH(lambdaCorrTableProducer, processData, "Process for DATA", true); - - Preslice> perCol = aod::track::collisionId; - Preslice perMCCol = aod::mcparticle::mcCollisionId; - - SliceCache cache1; - - // Service pdgDB; + PROCESS_SWITCH(LambdaCorrTableProducer, processData, "Process for DATA", true); - using CollisionsWithMcLabels = soa::Join; - // using McCollisions = soa::Join; - using McCollisions = aod::McCollisions; using McV0Tracks = soa::Join; using TracksMC = soa::Join; - void processMCReco(CollisionsWithMcLabels const& collisions, McCollisions const&, McV0Tracks const& V0s, aod::McParticles const& /*mcParticles*/, TracksMC const& tracks) + void processMCReco(soa::Join::iterator const& collision, aod::McCollisions const&, + McV0Tracks const& V0s, aod::McParticles const&, TracksMC const& tracks) { - - for (auto const& collision : collisions) { - - histos.fill(HIST("Event/h1d_collisions_info"), 1.5); - - // select collision - if (!selCol(collision)) { - continue; - } - - histos.fill(HIST("Event/h1d_collisions_info"), 2.5); - - // check for corresponding MCGen Collision - if (cfg_has_mc_flag && !collision.has_mcCollision()) { - continue; - } - - histos.fill(HIST("Event/h1d_collisions_info"), 3.5); - histos.fill(HIST("Event/h1d_collision_posZ"), collision.posZ()); - - lambdaCollisionTable(collision.centFT0M(), collision.posX(), collision.posY(), collision.posZ()); - - // auto const& mcCollision = collision.mcCollision_as(); - - // v0-track loop - auto v0sThisCollision = V0s.sliceBy(perCol, collision.globalIndex()); - for (auto const& v0 : v0sThisCollision) { - - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 0.5); - - // check for corresponding MCGen Particle - if (cfg_has_mc_flag && !v0.has_mcParticle()) { - continue; - } - - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 1.5); - histos.fill(HIST("QA_Checks/h2d_before_topo_cuts_pt_vs_alpha"), v0.alpha(), v0.qtarm()); - - // apply topological cuts on v0 candidates - if (!topologicalCutsV0(collision, v0, tracks)) { - continue; - } - - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 2.5); - histos.fill(HIST("QA_Checks/h2d_after_topo_cuts_pt_vs_alpha"), v0.alpha(), v0.qtarm()); - - selV0Particle(collision, v0, tracks); - } - } + fillLambdaTables(collision, V0s, tracks); } - PROCESS_SWITCH(lambdaCorrTableProducer, processMCReco, "Process for MC Reconstructed", false); + PROCESS_SWITCH(LambdaCorrTableProducer, processMCReco, "Process for MC Reconstructed", false); - void processMCGen(McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles) + void processMCGen(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles) { - - histos.fill(HIST("McGen/h1d_collisions_info"), 1.5); + histos.fill(HIST("McGen/h1f_collisions_info"), 1.5); // apply collision cuts - if (fabs(mcCollision.posZ()) > cfg_z_vtx) { + if (mcCollision.posZ() < cMinZVtx || mcCollision.posZ() > cMaxZVtx) { return; } - histos.fill(HIST("McGen/h1d_collisions_info"), 2.5); - histos.fill(HIST("McGen/h1d_collision_posZ"), mcCollision.posZ()); + histos.fill(HIST("McGen/h1f_collisions_info"), 2.5); + histos.fill(HIST("McGen/h1f_collision_posZ"), mcCollision.posZ()); lambdaMCGenCollisionTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()); - float mass = 0.; + + // initialize track objects + ParticleType v0type = kLambda; for (auto const& mcpart : mcParticles) { // check for Lambda first - if (abs(mcpart.pdgCode()) != kLambda0) { + if (mcpart.pdgCode() == kLambda0) { + v0type = kLambda; + } else if (mcpart.pdgCode() == kLambda0Bar) { + v0type = kAntiLambda; + } else { continue; } // check for Primary Lambdas/AntiLambdas - if (cfg_gen_primary_lambda && !mcpart.isPhysicalPrimary()) { - continue; - } else if (cfg_gen_secondary_lambda && mcpart.isPhysicalPrimary()) { + if (cGenPrimaryLambda && !mcpart.isPhysicalPrimary()) { continue; } // apply kinematic acceptance - if (mcpart.pt() < cfg_v0_pt_min || mcpart.pt() > cfg_v0_pt_max) { + if (mcpart.pt() <= cMinV0Pt || mcpart.pt() >= cMaxV0Pt || std::abs(mcpart.y()) >= cMaxV0Rap) { continue; } - float rap = 0.; - if (cfg_do_eta_analysis) { - rap = mcpart.eta(); - } else { - rap = mcpart.y(); + // check for correct decay channel + auto dautracks = mcpart.template daughters_as(); + std::vector daughterPDGs, daughterIDs; + for (auto const& dautrack : dautracks) { + daughterPDGs.push_back(dautrack.pdgCode()); + daughterIDs.push_back(dautrack.globalIndex()); } - - if (fabs(rap) > cfg_v0_rap_max) { + if (std::abs(daughterPDGs[0]) != kProton || std::abs(daughterPDGs[1]) != kPiPlus) { continue; } - // Get Daughters and Mothers - bool decay_channel_flag = false; - std::vector daughterPDGs{}, daughterIDs{}, motherPDGs{}, motherIDs{}; - auto mcpart_daughters = mcpart.template daughters_as(); - auto mcpart_mothers = mcpart.template mothers_as(); - getPDGsIDs(mcpart_daughters, daughterPDGs, daughterIDs); - getPDGsIDs(mcpart_mothers, motherPDGs, motherIDs); - - // Decay to Proton-Pion - if (abs(daughterPDGs[0]) == kProton && abs(daughterPDGs[1]) == kPiPlus) { - decay_channel_flag = true; - } - - if (!decay_channel_flag) { - continue; - } - - mass = RecoDecay::m(mcpart.p(), mcpart.e()); - - // Fill histograms - if (mcpart.pdgCode() == kLambda0) { - histos.fill(HIST("McGen/h1d_lambda_daughter_PDG"), daughterPDGs[0]); - histos.fill(HIST("McGen/h1d_lambda_daughter_PDG"), daughterPDGs[1]); - histos.fill(HIST("McGen/h1d_mass_lambda"), mass); - histos.fill(HIST("McGen/h1d_pt_lambda"), mcpart.pt()); - histos.fill(HIST("McGen/h1d_eta_lambda"), mcpart.eta()); - histos.fill(HIST("McGen/h1d_y_lambda"), mcpart.y()); - histos.fill(HIST("McGen/h1d_phi_lambda"), mcpart.phi()); - histos.fill(HIST("McGen/h2d_pteta_lambda"), mcpart.eta(), mcpart.pt()); - histos.fill(HIST("McGen/h2d_ptrap_lambda"), mcpart.y(), mcpart.pt()); - histos.fill(HIST("McGen/h2d_ptphi_lambda"), mcpart.phi(), mcpart.pt()); - lambdaMCGenTrackTable(lambdaMCGenCollisionTable.lastIndex(), mcpart.px(), mcpart.py(), mcpart.pz(), mcpart.pt(), rap, mcpart.phi(), mass, daughterIDs[0], daughterIDs[1], (int8_t)kLambda); - } else if (mcpart.pdgCode() == kLambda0Bar) { - histos.fill(HIST("McGen/h1d_antilambda_daughter_PDG"), daughterPDGs[0]); - histos.fill(HIST("McGen/h1d_antilambda_daughter_PDG"), daughterPDGs[1]); - histos.fill(HIST("McGen/h1d_mass_antilambda"), mass); - histos.fill(HIST("McGen/h1d_pt_antilambda"), mcpart.pt()); - histos.fill(HIST("McGen/h1d_eta_antilambda"), mcpart.eta()); - histos.fill(HIST("McGen/h1d_y_antilambda"), mcpart.y()); - histos.fill(HIST("McGen/h1d_phi_antilambda"), mcpart.phi()); - histos.fill(HIST("McGen/h2d_pteta_antilambda"), mcpart.eta(), mcpart.pt()); - histos.fill(HIST("McGen/h2d_ptrap_antilambda"), mcpart.y(), mcpart.pt()); - histos.fill(HIST("McGen/h2d_ptphi_antilambda"), mcpart.phi(), mcpart.pt()); - lambdaMCGenTrackTable(lambdaMCGenCollisionTable.lastIndex(), mcpart.px(), mcpart.py(), mcpart.pz(), mcpart.pt(), rap, mcpart.phi(), mass, daughterIDs[1], daughterIDs[0], (int8_t)kAntiLambda); - } + lambdaMCGenTrackTable(lambdaMCGenCollisionTable.lastIndex(), mcpart.px(), mcpart.py(), mcpart.pz(), + mcpart.pt(), mcpart.eta(), mcpart.phi(), mcpart.y(), RecoDecay::m(mcpart.p(), mcpart.e()), + daughterIDs[0], daughterIDs[1], (int8_t)v0type, -999., -999., 1.); } } - PROCESS_SWITCH(lambdaCorrTableProducer, processMCGen, "Process for MC Generated", false); + PROCESS_SWITCH(LambdaCorrTableProducer, processMCGen, "Process for MC Generated", false); }; -struct lambdaCorrelationAnalysis { +struct LambdaR2Correlation { // Global Configurables - Configurable cfg_nRapBins{"cfg_nRapBins", 16, "N Rapidity Bins"}; - Configurable cfg_Rap_Min{"cfg_Rap_Min", -0.8, "Minimum Rapidity"}; - Configurable cfg_Rap_Max{"cfg_Rap_Max", 0.8, "Maximum Rapidity"}; - Configurable cfg_nPhiBins{"cfg_nPhiBins", 64, "N Phi Bins"}; - Configurable cfg_Phi_Min{"cfg_Phi_Min", 0, "Minimum Phi"}; - Configurable cfg_Phi_Max{"cfg_Phi_Max", 2 * TMath::Pi(), "Maximum Phi"}; + Configurable cNRapBins{"cNRapBins", 12, "N Rapidity Bins"}; + Configurable cMinRap{"cMinRap", -0.6, "Minimum Rapidity"}; + Configurable cMaxRap{"cMaxRap", 0.6, "Maximum Rapidity"}; + Configurable cNPhiBins{"cNPhiBins", 64, "N Phi Bins"}; // remove lambda with shared daughters - Configurable cfg_remove_lambda{"cfg_remove_lambda", true, "Flag to remove lambda"}; - - // pt dependent efficiencies - Configurable cfg_eff_corr_flag{"cfg_eff_corr_flag", true, "Efficiency Correction Flag"}; - Configurable> cfg_pt_bins{"cfg_pt_bins", {0.5, 0.7, 0.9, 1.1, 1.3, 1.5, 1.8, 2.1, 2.5, 3.5}, "pT bins for efficiencies"}; - Configurable> cfg_lambda_eff{"cfg_lambda_eff", {0.00499, 0.03007, 0.05419, 0.07322, 0.08602, 0.09528, 0.103604, 0.11106, 0.11578}, "Lambda Efficiencies"}; - Configurable> cfg_antilambda_eff{"cfg_antilambda_eff", {0.00456, 0.02738, 0.04972, 0.068052, 0.08091, 0.09014, 0.09902, 0.107007, 0.112431}, "AntiLambda Efficiencies"}; + Configurable cRemoveLambdaSharingDau{"cRemoveLambdaSharingDau", true, "Flag to remove lambda"}; // Histogram Registry. HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -882,28 +806,23 @@ struct lambdaCorrelationAnalysis { float kmaxrap = 0.; float nphibins = 0.; float kminphi = 0.; - float kmaxphi = 0.; + float kmaxphi = TwoPI; float rapbinwidth = 0.; float phibinwidth = 0.; float q = 0., e = 0., qinv = 0.; - std::vector v_pt_bins = static_cast>(cfg_pt_bins); - std::vector v_lambda_eff = static_cast>(cfg_lambda_eff); - std::vector v_antilambda_eff = static_cast>(cfg_antilambda_eff); - void init(InitContext const&) { - nrapbins = static_cast(cfg_nRapBins); - kminrap = static_cast(cfg_Rap_Min); - kmaxrap = static_cast(cfg_Rap_Max); - nphibins = static_cast(cfg_nPhiBins); - kminphi = static_cast(cfg_Phi_Min); - kmaxphi = static_cast(cfg_Phi_Max); + // Set Density Histogram Attributes + nrapbins = static_cast(cNRapBins); + kminrap = static_cast(cMinRap); + kmaxrap = static_cast(cMaxRap); + nphibins = static_cast(cNPhiBins); rapbinwidth = (kmaxrap - kminrap) / nrapbins; phibinwidth = (kmaxphi - kminphi) / nphibins; - int knrapphibins = static_cast(cfg_nRapBins) * static_cast(cfg_nPhiBins); + int knrapphibins = static_cast(cNRapBins) * static_cast(cNPhiBins); float kminrapphi = 0.; float kmaxrapphi = knrapphibins; @@ -912,56 +831,99 @@ struct lambdaCorrelationAnalysis { const AxisSpec axisCent(105, 0, 105, "FT0M (%)"); const AxisSpec axisMult(10, 0, 10, "N_{#Lambda}"); const AxisSpec axisMass(100, 1.06, 1.16, "Inv Mass (GeV/#it{c}^{2})"); - const AxisSpec axisPt(60, 0.5, 3.5, "p_{T} (GeV/#it{c})"); - const AxisSpec axisRap(cfg_nRapBins, cfg_Rap_Min, cfg_Rap_Max, "rap"); - const AxisSpec axisPhi(cfg_nPhiBins, cfg_Phi_Min, cfg_Phi_Max, "#phi (rad)"); - const AxisSpec axisRapPhi(knrapphibins, kminrapphi, kmaxrapphi, "rap #phi"); + const AxisSpec axisPt(64, 0.2, 3.5, "p_{T} (GeV/#it{c})"); + const AxisSpec axisEta(24, -1.2, 1.2, "#eta"); + const AxisSpec axisCPA(100, 0.99, 1.0, "cos(#theta_{PA})"); + const AxisSpec axisDcaDau(75, 0., 1.5, "Daug DCA (#sigma)"); + const AxisSpec axisRap(cNRapBins, cMinRap, cMaxRap, "y"); + const AxisSpec axisPhi(cNPhiBins, 0., TwoPI, "#phi (rad)"); + const AxisSpec axisRapPhi(knrapphibins, kminrapphi, kmaxrapphi, "y #phi"); const AxisSpec axisQinv(100, 0, 10, "q_{inv} (GeV/#it{c})"); + const AxisSpec axisEfPt(19, 0.2, 4.0, "p_{T}"); + const AxisSpec axisEfEta(24, -1.2, 1.2, "#eta"); + const AxisSpec axisEfRap(24, -1.2, 1.2, "y"); + const AxisSpec axisEfPosZ(10, -10., 10., "V_{Z}"); + // Create Histograms. // Event - histos.add("Event/Reco/h1d_collision_posz", "V_{Z} Distribution", kTH1F, {axisPosZ}); - histos.add("Event/Reco/h1d_ft0m_mult_percentile", "FT0M (%)", kTH1F, {axisCent}); - histos.add("Event/Reco/h1d_lambda_multiplicity", "#Lambda - Multiplicity", kTH1I, {axisMult}); - histos.add("Event/Reco/h1d_antilambda_multiplicity", "#bar{#Lambda} - Multiplicity", kTH1I, {axisMult}); - histos.add("Event/Reco/h1d_lambda_sdau", "#Lambda - Multiplicity", kTH1I, {axisMult}); - histos.add("Event/Reco/h1d_antilambda_sdau", "#bar{#Lambda} - Multiplicity", kTH1I, {axisMult}); - histos.add("Event/Reco/h1d_lambda_totmult", "#Lambda - Multiplicity", kTH1I, {axisMult}); - histos.add("Event/Reco/h1d_antilambda_totmult", "#bar{#Lambda} - Multiplicity", kTH1I, {axisMult}); + histos.add("Event/Reco/h1f_collision_posz", "V_{Z} Distribution", kTH1F, {axisPosZ}); + histos.add("Event/Reco/h1f_ft0m_mult_percentile", "FT0M (%)", kTH1F, {axisCent}); + histos.add("Event/Reco/h1i_lambda_multiplicity", "#Lambda - Multiplicity", kTH1I, {axisMult}); + histos.add("Event/Reco/h1i_antilambda_multiplicity", "#bar{#Lambda} - Multiplicity", kTH1I, {axisMult}); + histos.add("Event/Reco/h1i_lambda_sdau", "#Lambda - Multiplicity", kTH1I, {axisMult}); + histos.add("Event/Reco/h1i_antilambda_sdau", "#bar{#Lambda} - Multiplicity", kTH1I, {axisMult}); + histos.add("Event/Reco/h1i_lambda_totmult", "#Lambda - Multiplicity", kTH1I, {axisMult}); + histos.add("Event/Reco/h1i_antilambda_totmult", "#bar{#Lambda} - Multiplicity", kTH1I, {axisMult}); + + // InvMass, DcaDau and CosPA + histos.add("Reco/QA_Lambda/h1f_invmass", "M_{p#pi}", kTH1F, {axisMass}); + histos.add("Reco/QA_Lambda/h1f_cospa", "cos(#theta_{PA})", kTH1F, {axisCPA}); + histos.add("Reco/QA_Lambda/h1f_dcadau", "DCA_{p#pi} at V0 Decay Vertex", kTH1F, {axisDcaDau}); + + histos.addClone("Reco/QA_Lambda/", "Reco/QA_AntiLambda/"); + + // Efficiency Histograms + histos.add("Reco/Efficiency/h2f_n1_pteta_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisEfPt, axisEfEta}); + histos.add("Reco/Efficiency/h2f_n1_pteta_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisEfPt, axisEfEta}); + histos.add("Reco/Efficiency/h2f_n1_ptrap_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisEfPt, axisEfRap}); + histos.add("Reco/Efficiency/h2f_n1_ptrap_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisEfPt, axisEfRap}); + histos.add("Reco/Efficiency/h3f_n1_ptetaposz_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisEfPt, axisEfEta, axisEfPosZ}); + histos.add("Reco/Efficiency/h3f_n1_ptetaposz_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisEfPt, axisEfEta, axisEfPosZ}); + histos.add("Reco/Efficiency/h3f_n1_ptrapposz_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisEfPt, axisEfRap, axisEfPosZ}); + histos.add("Reco/Efficiency/h3f_n1_ptrapposz_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisEfPt, axisEfRap, axisEfPosZ}); // single and two particle densities // 1D Histograms histos.add("Reco/h1d_n1_pt_LaP", "#rho_{1}^{#Lambda}", kTH1D, {axisPt}); histos.add("Reco/h1d_n1_pt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH1D, {axisPt}); - histos.add("Reco/h1d_n1_rap_LaP", "#rho_{1}^{#Lambda}", kTH1D, {axisRap}); - histos.add("Reco/h1d_n1_rap_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH1D, {axisRap}); + histos.add("Reco/h1d_n1_eta_LaP", "#rho_{1}^{#Lambda}", kTH1D, {axisEta}); + histos.add("Reco/h1d_n1_eta_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH1D, {axisEta}); + histos.add("Reco/h1d_n1_rap_LaP", "#rho_{1}^{#Lambda}", kTH1D, {axisEta}); + histos.add("Reco/h1d_n1_rap_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH1D, {axisEta}); histos.add("Reco/h1d_n1_phi_LaP", "#rho_{1}^{#Lambda}", kTH1D, {axisPhi}); histos.add("Reco/h1d_n1_phi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH1D, {axisPhi}); + + // rho1 for R2 deta dphi histograms + histos.add("Reco/h2d_n1_rapphi_LaP", "#rho_{1}^{#Lambda}", kTH2D, {axisRap, axisPhi}); + histos.add("Reco/h2d_n1_rapphi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2D, {axisRap, axisPhi}); + + // rho1 for R2 qinv histograms + histos.add("Reco/h2d_n1_ptrap_LaP", "#rho_{1}^{#Lambda}", kTH2D, {axisPt, axisRap}); + histos.add("Reco/h2d_n1_ptrap_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2D, {axisPt, axisRap}); + + // rho2 for R2 deta dphi histograms + histos.add("Reco/h2d_n2_rapphi_LaP_LaM", "#rho_{2}^{#Lambda - #bar{#Lambda}}", kTH2D, {axisRapPhi, axisRapPhi}); + histos.add("Reco/h2d_n2_rapphi_LaP_LaP", "#rho_{2}^{#Lambda - #Lambda}", kTH2D, {axisRapPhi, axisRapPhi}); + histos.add("Reco/h2d_n2_rapphi_LaM_LaM", "#rho_{2}^{#bar{#Lambda} - #bar{#Lambda}}", kTH2D, {axisRapPhi, axisRapPhi}); + + // rho2 for R2 qinv histograms histos.add("Reco/h1d_n2_qinv_LaP_LaM", "#rho_{2}^{#Lambda-#bar{#Lambda}}", kTH1D, {axisQinv}); histos.add("Reco/h1d_n2_qinv_LaP_LaP", "#rho_{2}^{#Lambda-#Lambda}", kTH1D, {axisQinv}); histos.add("Reco/h1d_n2_qinv_LaM_LaM", "#rho_{2}^{#bar{#Lambda}-#bar{#Lambda}}", kTH1D, {axisQinv}); - // 2D Histograms - histos.add("Reco/h2d_n1_LaP", "#rho_{1}^{#Lambda}", kTH2D, {axisRap, axisPhi}); - histos.add("Reco/h2d_n1_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2D, {axisRap, axisPhi}); - histos.add("Reco/h2d_n2_LaP_LaM", "#rho_{2}^{#Lambda - #bar{#Lambda}}", kTH2D, {axisRapPhi, axisRapPhi}); - histos.add("Reco/h2d_n2_LaP_LaP", "#rho_{2}^{#Lambda - #Lambda}", kTH2D, {axisRapPhi, axisRapPhi}); - histos.add("Reco/h2d_n2_LaM_LaM", "#rho_{2}^{#bar{#Lambda} - #bar{#Lambda}}", kTH2D, {axisRapPhi, axisRapPhi}); + // rho2 for qa checks histos.add("Reco/h2d_n2_pt1pt2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPt, axisPt}); histos.add("Reco/h2d_n2_pt1pt2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPt, axisPt}); histos.add("Reco/h2d_n2_pt1pt2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPt, axisPt}); - histos.add("Reco/h2d_n2_eta1eta2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisRap, axisRap}); - histos.add("Reco/h2d_n2_eta1eta2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisRap, axisRap}); - histos.add("Reco/h2d_n2_eta1eta2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisRap, axisRap}); + histos.add("Reco/h2d_n2_eta1eta2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisEta, axisEta}); + histos.add("Reco/h2d_n2_eta1eta2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisEta, axisEta}); + histos.add("Reco/h2d_n2_eta1eta2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisEta, axisEta}); histos.add("Reco/h2d_n2_phi1phi2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPhi, axisPhi}); histos.add("Reco/h2d_n2_phi1phi2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPhi, axisPhi}); histos.add("Reco/h2d_n2_phi1phi2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPhi, axisPhi}); - histos.add("Reco/h2d_n2_pt1eta2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPt, axisRap}); - histos.add("Reco/h2d_n2_pt1eta2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPt, axisRap}); - histos.add("Reco/h2d_n2_pt1eta2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPt, axisRap}); + histos.add("Reco/h2d_n2_rap1rap2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisRap, axisRap}); + histos.add("Reco/h2d_n2_rap1rap2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisRap, axisRap}); + histos.add("Reco/h2d_n2_rap1rap2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisRap, axisRap}); + histos.add("Reco/h2d_n2_pt1eta2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPt, axisEta}); + histos.add("Reco/h2d_n2_pt1eta2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPt, axisEta}); + histos.add("Reco/h2d_n2_pt1eta2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPt, axisEta}); histos.add("Reco/h2d_n2_pt1phi2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPt, axisPhi}); histos.add("Reco/h2d_n2_pt1phi2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPt, axisPhi}); histos.add("Reco/h2d_n2_pt1phi2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPt, axisPhi}); + histos.add("Reco/h2d_n2_pt1rap2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPt, axisRap}); + histos.add("Reco/h2d_n2_pt1rap2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPt, axisRap}); + histos.add("Reco/h2d_n2_pt1rap2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPt, axisRap}); // MCGen if (doprocessMCGen) { @@ -970,58 +932,41 @@ struct lambdaCorrelationAnalysis { } } - template + template bool removeLambdaSharingDau(T const& v, V const& vs) { // check whether to remove lambda or not - if (!cfg_remove_lambda) { + if (!cRemoveLambdaSharingDau) { return true; } - bool ret_flag = true; + static constexpr std::string_view SubDirRecGen[] = {"Reco/", "McGen/"}; + static constexpr std::string_view SubDirHist[] = {"QA_Lambda/", "QA_AntiLambda/"}; + + bool retFlag = true; for (auto const& x : vs) { - if ((v.index() != x.index()) && (v.postrackid() == x.postrackid() || v.negtrackid() == x.negtrackid())) { + if ((v.index() != x.index()) && (v.posTrackId() == x.posTrackId() || v.negTrackId() == x.negTrackId())) { + if (fillHist) { + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirHist[part]) + HIST("h1f_invmass"), x.mass()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirHist[part]) + HIST("h1f_cospa"), x.cosPA()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirHist[part]) + HIST("h1f_dcadau"), x.dcaDau()); + } if (std::abs(v.mass() - MassLambda0) > std::abs(x.mass() - MassLambda0)) { - ret_flag = false; + retFlag = false; break; } } } - return ret_flag; - } - - template - void get_corr_factor(float& eff, float pt) - { - - if (!cfg_eff_corr_flag) { - eff = 1.; - return; - } - - int n = v_lambda_eff.size(); - - for (int i = 0; i < n; ++i) { - if (pt > v_pt_bins[i] && pt <= v_pt_bins[i + 1]) { - if constexpr (part == kLambda) { - eff = v_lambda_eff[i]; - } else if constexpr (part == kAntiLambda) { - eff = v_antilambda_eff[i]; - } - } else { - eff = 1.; - } - } + return retFlag; } template void fillPairHistos(U& p1, U& p2) { - - static constexpr std::string_view sub_dir_recgen[] = {"Reco/", "McGen/"}; - static constexpr std::string_view sub_dir_hist[] = {"LaP_LaM", "LaP_LaP", "LaM_LaM"}; + static constexpr std::string_view SubDirRecGen[] = {"Reco/", "McGen/"}; + static constexpr std::string_view SubDirHist[] = {"LaP_LaM", "LaP_LaP", "LaM_LaM"}; int rapbin1 = static_cast((p1.rap() - kminrap) / rapbinwidth); int rapbin2 = static_cast((p2.rap() - kminrap) / rapbinwidth); @@ -1029,88 +974,86 @@ struct lambdaCorrelationAnalysis { int phibin1 = static_cast(p1.phi() / phibinwidth); int phibin2 = static_cast(p2.phi() / phibinwidth); - float eff_1 = 1., eff_2 = 1.; - - if constexpr (rec_gen == kRec) { - if (part_pair == kLambdaAntiLambda) { - get_corr_factor(eff_1, p1.pt()); - get_corr_factor(eff_2, p2.pt()); - } else if (part_pair == kLambdaLambda) { - get_corr_factor(eff_1, p1.pt()); - get_corr_factor(eff_2, p2.pt()); - } else if (part_pair == kAntiLambdaAntiLambda) { - get_corr_factor(eff_1, p1.pt()); - get_corr_factor(eff_2, p2.pt()); - } - } + float corfac1 = p1.corrFact(), corfac2 = p2.corrFact(); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_pt1pt2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.pt(), eff_1 * eff_2); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_eta1eta2_") + HIST(sub_dir_hist[part_pair]), p1.rap(), p2.rap(), eff_1 * eff_2); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_phi1phi2_") + HIST(sub_dir_hist[part_pair]), p1.phi(), p2.phi(), eff_1 * eff_2); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_pt1eta2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.rap(), eff_1 * eff_2); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_pt1phi2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.phi(), eff_1 * eff_2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n2_pt1pt2_") + HIST(SubDirHist[part_pair]), p1.pt(), p2.pt(), corfac1 * corfac2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n2_eta1eta2_") + HIST(SubDirHist[part_pair]), p1.eta(), p2.eta(), corfac1 * corfac2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n2_phi1phi2_") + HIST(SubDirHist[part_pair]), p1.phi(), p2.phi(), corfac1 * corfac2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n2_rap1rap2_") + HIST(SubDirHist[part_pair]), p1.rap(), p2.rap(), corfac1 * corfac2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n2_pt1eta2_") + HIST(SubDirHist[part_pair]), p1.pt(), p2.eta(), corfac1 * corfac2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n2_pt1phi2_") + HIST(SubDirHist[part_pair]), p1.pt(), p2.phi(), corfac1 * corfac2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n2_pt1rap2_") + HIST(SubDirHist[part_pair]), p1.pt(), p2.rap(), corfac1 * corfac2); if (rapbin1 >= 0 && rapbin2 >= 0 && phibin1 >= 0 && phibin2 >= 0 && rapbin1 < nrapbins && rapbin2 < nrapbins && phibin1 < nphibins && phibin2 < nphibins) { int rapphix = rapbin1 * nphibins + phibin1; int rapphiy = rapbin2 * nphibins + phibin2; - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_") + HIST(sub_dir_hist[part_pair]), rapphix + 0.5, rapphiy + 0.5, eff_1 * eff_2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n2_rapphi_") + HIST(SubDirHist[part_pair]), rapphix + 0.5, rapphiy + 0.5, corfac1 * corfac2); } // qinv histos q = RecoDecay::p((p1.px() - p2.px()), (p1.py() - p2.py()), (p1.pz() - p2.pz())); e = RecoDecay::e(p1.px(), p1.py(), p1.pz(), MassLambda0) - RecoDecay::e(p2.px(), p2.py(), p2.pz(), MassLambda0); qinv = std::sqrt(-RecoDecay::m2(q, e)); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_n2_qinv_") + HIST(sub_dir_hist[part_pair]), qinv, eff_1 * eff_2); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h1d_n2_qinv_") + HIST(SubDirHist[part_pair]), qinv, corfac1 * corfac2); } - template - void analyzeSingles(T const& tracks) + template + void analyzeSingles(C const& col, T const& tracks) { - - static constexpr std::string_view sub_dir_recgen[] = {"Reco/", "McGen/"}; - static constexpr std::string_view sub_dir_hist[] = {"LaP", "LaM"}; + static constexpr std::string_view SubDirRecGen[] = {"Reco/", "McGen/"}; + static constexpr std::string_view SubDirHist[] = {"LaP", "LaM"}; int ntrk1 = 0, ntrk2 = 0, ntrk3 = 0; - float eff = 1.; for (auto const& track : tracks) { ++ntrk1; - if (!removeLambdaSharingDau(track, tracks)) { + if (!removeLambdaSharingDau(track, tracks)) { ++ntrk2; continue; } - get_corr_factor(eff, track.pt()); ++ntrk3; - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_n1_pt_") + HIST(sub_dir_hist[part]), track.pt(), eff); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_n1_rap_") + HIST(sub_dir_hist[part]), track.rap(), eff); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_n1_phi_") + HIST(sub_dir_hist[part]), track.phi(), eff); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n1_") + HIST(sub_dir_hist[part]), track.rap(), track.phi(), eff); + + // QA Plots + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h1d_n1_pt_") + HIST(SubDirHist[part]), track.pt(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h1d_n1_eta_") + HIST(SubDirHist[part]), track.eta(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h1d_n1_phi_") + HIST(SubDirHist[part]), track.phi(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h1d_n1_rap_") + HIST(SubDirHist[part]), track.rap(), track.corrFact()); + + // Efficiency Calculation Plots + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("Efficiency/h2f_n1_pteta_") + HIST(SubDirHist[part]), track.pt(), track.eta()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("Efficiency/h2f_n1_ptrap_") + HIST(SubDirHist[part]), track.pt(), track.rap()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("Efficiency/h3f_n1_ptetaposz_") + HIST(SubDirHist[part]), track.pt(), track.eta(), col.posZ()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("Efficiency/h3f_n1_ptrapposz_") + HIST(SubDirHist[part]), track.pt(), track.rap(), col.posZ()); + + // Rho1 for R2 Calculation + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n1_ptrap_") + HIST(SubDirHist[part]), track.pt(), track.rap(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST("h2d_n1_rapphi_") + HIST(SubDirHist[part]), track.rap(), track.phi(), track.corrFact()); } // fill multiplicity histograms if (ntrk1 != 0) { if (part == kLambda) { - histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_lambda_totmult"), ntrk1); + histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h1i_lambda_totmult"), ntrk1); } else { - histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_antilambda_totmult"), ntrk1); + histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h1i_antilambda_totmult"), ntrk1); } } if (ntrk2 != 0) { if (part == kLambda) { - histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_lambda_sdau"), ntrk2); + histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h1i_lambda_sdau"), ntrk2); } else { - histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_antilambda_sdau"), ntrk2); + histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h1i_antilambda_sdau"), ntrk2); } } if (ntrk3 != 0) { if (part == kLambda) { - histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_lambda_multiplicity"), ntrk3); + histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h1i_lambda_multiplicity"), ntrk3); } else { - histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_antilambda_multiplicity"), ntrk3); + histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h1i_antilambda_multiplicity"), ntrk3); } } } @@ -1119,7 +1062,7 @@ struct lambdaCorrelationAnalysis { void analyzePairs(T const& trks_1, T const& trks_2) { for (auto const& trk_1 : trks_1) { - if (!removeLambdaSharingDau(trk_1, trks_1)) { + if (!removeLambdaSharingDau(trk_1, trks_1)) { continue; } for (auto const& trk_2 : trks_2) { @@ -1127,8 +1070,7 @@ struct lambdaCorrelationAnalysis { if (samelambda && ((trk_1.index() == trk_2.index()))) { continue; } - // check if Lambda shares a daughter and select the one closest to PDG Mass - if (!removeLambdaSharingDau(trk_2, trks_2)) { + if (!removeLambdaSharingDau(trk_2, trks_2)) { continue; } fillPairHistos(trk_1, trk_2); @@ -1136,60 +1078,59 @@ struct lambdaCorrelationAnalysis { } } - using Lambda_Collisions = aod::LambdaCollisions; - using Lambda_Tracks = aod::LambdaTracks; + using LambdaCollisions = aod::LambdaCollisions; + using LambdaTracks = aod::LambdaTracks; SliceCache cache; - Partition part_lambda_tracks = (aod::lambdatrack::v0type == (int8_t)kLambda); - Partition part_anti_lambda_tracks = (aod::lambdatrack::v0type == (int8_t)kAntiLambda); + Partition partLambdaTracks = (aod::lambdatrack::v0Type == (int8_t)kLambda); + Partition partAntiLambdaTracks = (aod::lambdatrack::v0Type == (int8_t)kAntiLambda); - void processDataReco(Lambda_Collisions::iterator const& collision, Lambda_Tracks const&) + void processDataReco(LambdaCollisions::iterator const& collision, LambdaTracks const&) { + histos.fill(HIST("Event/Reco/h1f_collision_posz"), collision.posZ()); + histos.fill(HIST("Event/Reco/h1f_ft0m_mult_percentile"), collision.cent()); - histos.fill(HIST("Event/Reco/h1d_collision_posz"), collision.posZ()); - histos.fill(HIST("Event/Reco/h1d_ft0m_mult_percentile"), collision.cent()); - - auto lambda_tracks = part_lambda_tracks->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); - auto anti_lambda_tracks = part_anti_lambda_tracks->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); + auto lambdaTracks = partLambdaTracks->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); + auto antiLambdaTracks = partAntiLambdaTracks->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); - analyzeSingles(lambda_tracks); - analyzeSingles(anti_lambda_tracks); - analyzePairs(lambda_tracks, anti_lambda_tracks); - analyzePairs(lambda_tracks, lambda_tracks); - analyzePairs(anti_lambda_tracks, anti_lambda_tracks); + analyzeSingles(collision, lambdaTracks); + analyzeSingles(collision, antiLambdaTracks); + analyzePairs(lambdaTracks, antiLambdaTracks); + analyzePairs(lambdaTracks, lambdaTracks); + analyzePairs(antiLambdaTracks, antiLambdaTracks); } - PROCESS_SWITCH(lambdaCorrelationAnalysis, processDataReco, "Process for Data and MCReco", true); + PROCESS_SWITCH(LambdaR2Correlation, processDataReco, "Process for Data and MCReco", true); - using LambdaMCGenCollisions = aod::LambdaMCGenCollisions; - using LambdaMCGenTracks = aod::LambdaMCGenTracks; + using LambdaMcGenCollisions = aod::LambdaMcGenCollisions; + using LambdaMcGenTracks = aod::LambdaMcGenTracks; SliceCache cachemc; - Partition part_lambda_mcgen_tracks = aod::lambdatrack::v0type == (int8_t)kLambda; - Partition part_antilambda_mcgen_tracks = aod::lambdatrack::v0type == (int8_t)kAntiLambda; + Partition partLambdaMcGenTracks = aod::lambdatrack::v0Type == (int8_t)kLambda; + Partition partAntiLambdaMcGenTracks = aod::lambdatrack::v0Type == (int8_t)kAntiLambda; - void processMCGen(LambdaMCGenCollisions::iterator const& mcgencol, LambdaMCGenTracks const&) + void processMCGen(LambdaMcGenCollisions::iterator const& mcgencol, LambdaMcGenTracks const&) { - histos.fill(HIST("Event/McGen/h1d_collision_posz"), mcgencol.posZ()); + histos.fill(HIST("Event/McGen/h1f_collision_posz"), mcgencol.posZ()); - auto lambda_mcgen_tracks = part_lambda_mcgen_tracks->sliceByCached(aod::lambdamcgentrack::lambdaMcGenCollisionId, mcgencol.globalIndex(), cachemc); - auto antilambda_mcgen_tracks = part_antilambda_mcgen_tracks->sliceByCached(aod::lambdamcgentrack::lambdaMcGenCollisionId, mcgencol.globalIndex(), cachemc); + auto lambdaMcGenTracks = partLambdaMcGenTracks->sliceByCached(aod::lambdamcgentrack::lambdaMcGenCollisionId, mcgencol.globalIndex(), cachemc); + auto antiLambdaMcGenTracks = partAntiLambdaMcGenTracks->sliceByCached(aod::lambdamcgentrack::lambdaMcGenCollisionId, mcgencol.globalIndex(), cachemc); - analyzeSingles(lambda_mcgen_tracks); - analyzeSingles(antilambda_mcgen_tracks); - analyzePairs(lambda_mcgen_tracks, antilambda_mcgen_tracks); - analyzePairs(lambda_mcgen_tracks, lambda_mcgen_tracks); - analyzePairs(antilambda_mcgen_tracks, antilambda_mcgen_tracks); + analyzeSingles(mcgencol, lambdaMcGenTracks); + analyzeSingles(mcgencol, antiLambdaMcGenTracks); + analyzePairs(lambdaMcGenTracks, antiLambdaMcGenTracks); + analyzePairs(lambdaMcGenTracks, lambdaMcGenTracks); + analyzePairs(antiLambdaMcGenTracks, antiLambdaMcGenTracks); } - PROCESS_SWITCH(lambdaCorrelationAnalysis, processMCGen, "Process for MC Generated", false); + PROCESS_SWITCH(LambdaR2Correlation, processMCGen, "Process for MC Generated", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; } diff --git a/PWGCF/TwoParticleCorrelations/Tasks/neutronProtonCorrZdc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/neutronProtonCorrZdc.cxx new file mode 100644 index 00000000000..55082201362 --- /dev/null +++ b/PWGCF/TwoParticleCorrelations/Tasks/neutronProtonCorrZdc.cxx @@ -0,0 +1,247 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/// +/// \file neutronProtonCorrZdc.cxx +/// \brief Correlations between protons and neutrons in the ZDC +/// \author Olaf Massen + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" + +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct NeutronProtonCorrZdc { + // Histogram registry: an object to hold your histograms + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable cfgNBinsZN{"cfgNBinsZN", 100, "N bins for ZNA and ZNC"}; + Configurable cfgNBinsZP{"cfgNBinsZP", 100, "N bins for ZPA and ZPC"}; + Configurable cfgZNmin{"cfgZNmin", -10, "Minimum value for ZN signal"}; + Configurable cfgZNmax{"cfgZNmax", 350, "Maximum value for ZN signal"}; + Configurable cfgZPmin{"cfgZPmin", -10, "Minimum value for ZP signal"}; + Configurable cfgZPmax{"cfgZPmax", 200, "Maximum value for ZP signal"}; + Configurable cfgDiffZmin{"cfgDiffZmin", -50, "Minimum value for the diffZ signal"}; + Configurable cfgDiffZmax{"cfgDiffZmax", 50, "Maximum value for the diffZ signal"}; + Configurable cfgNBinsAlpha{"cfgNBinsAlpha", 100, "Number of bins for ZDC asymmetry"}; + Configurable cfgAlphaZmin{"cfgAlphaZmin", -1, "Minimum value for ZDC asymmetry"}; + Configurable cfgAlphaZmax{"cfgAlphaZmax", 1, "Maximum value for ZDC asymmetry"}; + Configurable cfgProcessRun2{"cfgProcessRun2", false, "Analyse Run 2 converted data"}; + // Configurable cfgCentralityEstimator{"cfgCentralityEstimator", 0, "Choice of centrality estimator"};//0 for FTOC, 1 for FTOA, 2 for FTOM, 3 for FVOA. //To be included at a later stage + + ConfigurableAxis cfgAxisCent{"cfgAxisCent", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.2f, 4.4f, 4.6f, 4.8f, 5.0f, 5.5f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 8.5f, 9.0f, 9.5f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f, 25.0f, 26.0f, 27.0f, 28.0f, 29.0f, 30.0f, 31.0f, 32.0f, 33.0f, 34.0f, 35.0f, 36.0f, 37.0f, 38.0f, 39.0f, 40.0f, 41.0f, 42.0f, 43.0f, 44.0f, 45.0f, 46.0f, 47.0f, 48.0f, 49.0f, 50.0f, 51.0f, 52.0f, 53.0f, 54.0f, 55.0f, 56.0f, 57.0f, 58.0f, 59.0f, 60.0f, 61.0f, 62.0f, 63.0f, 64.0f, 65.0f, 66.0f, 67.0f, 68.0f, 69.0f, 70.0f, 71.0f, 72.0f, 73.0f, 74.0f, 75.0f, 76.0f, 77.0f, 78.0f, 79.0f, 80.0f, 81.0f, 82.0f, 83.0f, 84.0f, 85.0f, 86.0f, 87.0f, 88.0f, 89.0f, 90.0f, 91.0f, 92.0f, 93.0f, 94.0f, 95.0f, 96.0f, 97.0f, 98.0f, 99.0f, 100.0f}, "Centrality [%]"}; + + Filter collisionVtxZ = nabs(aod::collision::posZ) < 10.f; + + using CentralitiesRun3 = aod::CentFT0Cs; + using CentralitiesRun2 = aod::CentRun2V0Ms; + using BCsRun3 = soa::Join; + + void init(InitContext const&) + { + // define axes you want to use + const AxisSpec axisCounter{4, 0, +2, ""}; + const AxisSpec axisZNSectorSignal{cfgNBinsZN, cfgZNmin, cfgZNmax / 3.}; + const AxisSpec axisZPSectorSignal{cfgNBinsZP, cfgZPmin, cfgZPmax / 3.}; + const AxisSpec axisZNASignal{cfgNBinsZN, cfgZNmin, cfgZNmax, "ZNA (a.u.)"}; + const AxisSpec axisZNCSignal{cfgNBinsZN, cfgZNmin, cfgZNmax, "ZNC (a.u.)"}; + const AxisSpec axisZPASignal{cfgNBinsZP, cfgZPmin, cfgZPmax, "ZPA (a.u.)"}; + const AxisSpec axisZPCSignal{cfgNBinsZP, cfgZPmin, cfgZPmax, "ZPC (a.u.)"}; + const AxisSpec axisZNSignal{2 * cfgNBinsZN, cfgZNmin, 1.5 * cfgZNmax, "ZN (a.u.)"}; + const AxisSpec axisZPSignal{2 * cfgNBinsZP, cfgZPmin, 1.5 * cfgZPmax, "ZP (a.u.)"}; + const AxisSpec axisAlphaZ{cfgNBinsAlpha, cfgAlphaZmin, cfgAlphaZmax, "#alpha_{spec}"}; + const AxisSpec axisZDiffSignal{cfgNBinsZN, cfgDiffZmin, cfgDiffZmax, "#Delta E"}; + + // create histograms + histos.add("eventCounter", "eventCounter", kTH1F, {axisCounter}); + + histos.add("ZNASector0Signal", "ZNASector0Signal", kTH1F, {axisZNSectorSignal}); + histos.add("ZNASector1Signal", "ZNASector1Signal", kTH1F, {axisZNSectorSignal}); + histos.add("ZNASector2Signal", "ZNASector2Signal", kTH1F, {axisZNSectorSignal}); + histos.add("ZNASector3Signal", "ZNASector3Signal", kTH1F, {axisZNSectorSignal}); + + histos.add("ZNCSector0Signal", "ZNCSector0Signal", kTH1F, {axisZNSectorSignal}); + histos.add("ZNCSector1Signal", "ZNCSector1Signal", kTH1F, {axisZNSectorSignal}); + histos.add("ZNCSector2Signal", "ZNCSector2Signal", kTH1F, {axisZNSectorSignal}); + histos.add("ZNCSector3Signal", "ZNCSector3Signal", kTH1F, {axisZNSectorSignal}); + + histos.add("ZPASector0Signal", "ZPASector0Signal", kTH1F, {axisZPSectorSignal}); + histos.add("ZPASector1Signal", "ZPASector1Signal", kTH1F, {axisZPSectorSignal}); + histos.add("ZPASector2Signal", "ZPASector2Signal", kTH1F, {axisZPSectorSignal}); + histos.add("ZPASector3Signal", "ZPASector3Signal", kTH1F, {axisZPSectorSignal}); + + histos.add("ZPCSector0Signal", "ZPCSector0Signal", kTH1F, {axisZPSectorSignal}); + histos.add("ZPCSector1Signal", "ZPCSector1Signal", kTH1F, {axisZPSectorSignal}); + histos.add("ZPCSector2Signal", "ZPCSector2Signal", kTH1F, {axisZPSectorSignal}); + histos.add("ZPCSector3Signal", "ZPCSector3Signal", kTH1F, {axisZPSectorSignal}); + + histos.add("ZNASignal", "ZNASignal", kTH1F, {axisZNASignal}); + histos.add("ZNCSignal", "ZNCSignal", kTH1F, {axisZNCSignal}); + histos.add("ZNSignal", "ZNSignal", kTH1F, {axisZNSignal}); + histos.add("ZPASignal", "ZPASignal", kTH1F, {axisZPASignal}); + histos.add("ZPCSignal", "ZPCSignal", kTH1F, {axisZPCSignal}); + histos.add("ZPSignal", "ZPSignal", kTH1F, {axisZPSignal}); + + histos.add("alphaZN", "alphaZN", kTH1F, {axisAlphaZ}); + histos.add("alphaZP", "alphaZP", kTH1F, {axisAlphaZ}); + + histos.add("diffZNASignal", "diffZNASignal", kTH1F, {axisZDiffSignal}); + histos.add("diffZNCSignal", "diffZNCSignal", kTH1F, {axisZDiffSignal}); + histos.add("diffZPASignal", "diffZPASignal", kTH1F, {axisZDiffSignal}); + histos.add("diffZPCSignal", "diffZPCSignal", kTH1F, {axisZDiffSignal}); + histos.add("diffZNSignal", "diffZNSignal", kTH1F, {axisZDiffSignal}); + histos.add("diffZPSignal", "diffZPSignal", kTH1F, {axisZDiffSignal}); + + histos.add("CentralityPercentile", "CentralityPercentile", kTH1F, {cfgAxisCent}); + + histos.add("CentvsZNASignal", "FT0CvsZNASignal", kTH2F, {cfgAxisCent, axisZNASignal}); + histos.add("CentvsZNCSignal", "FT0CvsZNCSignal", kTH2F, {cfgAxisCent, axisZNCSignal}); + histos.add("CentvsZPASignal", "FT0CvsZPASignal", kTH2F, {cfgAxisCent, axisZPASignal}); + histos.add("CentvsZPCSignal", "FT0CvsZPCSignal", kTH2F, {cfgAxisCent, axisZPCSignal}); + histos.add("CentvsZNSignal", "FT0CvsZNSignal", kTH2F, {cfgAxisCent, axisZNSignal}); + histos.add("CentvsZPSignal", "FT0CvsZPSignal", kTH2F, {cfgAxisCent, axisZPSignal}); + } + + void processRun3(soa::Filtered>::iterator const& collision, BCsRun3 const&, aod::Zdcs const&) + { + if (!collision.sel8()) { + histos.fill(HIST("eventCounter"), 0.25); + return; + } + const auto& foundBC = collision.foundBC_as(); + if (foundBC.has_zdc()) { + const auto& zdcread = foundBC.zdc(); + const auto cent = collision.centFT0C(); + + histos.fill(HIST("eventCounter"), 1.25); + histos.fill(HIST("ZNASignal"), zdcread.energyCommonZNA()); + histos.fill(HIST("ZNCSignal"), zdcread.energyCommonZNC()); + histos.fill(HIST("ZPASignal"), zdcread.energyCommonZPA()); + histos.fill(HIST("ZPCSignal"), zdcread.energyCommonZPC()); + histos.fill(HIST("ZNASector0Signal"), (zdcread.energySectorZNA())[0]); + histos.fill(HIST("ZNASector1Signal"), (zdcread.energySectorZNA())[1]); + histos.fill(HIST("ZNASector2Signal"), (zdcread.energySectorZNA())[2]); + histos.fill(HIST("ZNASector3Signal"), (zdcread.energySectorZNA())[3]); + histos.fill(HIST("ZNCSector0Signal"), (zdcread.energySectorZNC())[0]); + histos.fill(HIST("ZNCSector1Signal"), (zdcread.energySectorZNC())[1]); + histos.fill(HIST("ZNCSector2Signal"), (zdcread.energySectorZNC())[2]); + histos.fill(HIST("ZNCSector3Signal"), (zdcread.energySectorZNC())[3]); + histos.fill(HIST("ZPASector0Signal"), (zdcread.energySectorZPA())[0]); + histos.fill(HIST("ZPASector1Signal"), (zdcread.energySectorZPA())[1]); + histos.fill(HIST("ZPASector2Signal"), (zdcread.energySectorZPA())[2]); + histos.fill(HIST("ZPASector3Signal"), (zdcread.energySectorZPA())[3]); + histos.fill(HIST("ZPCSector0Signal"), (zdcread.energySectorZPC())[0]); + histos.fill(HIST("ZPCSector1Signal"), (zdcread.energySectorZPC())[1]); + histos.fill(HIST("ZPCSector2Signal"), (zdcread.energySectorZPC())[2]); + histos.fill(HIST("ZPCSector3Signal"), (zdcread.energySectorZPC())[3]); + + float sumZNC = (zdcread.energySectorZNC())[0] + (zdcread.energySectorZNC())[1] + (zdcread.energySectorZNC())[2] + (zdcread.energySectorZNC())[3]; + float sumZNA = (zdcread.energySectorZNA())[0] + (zdcread.energySectorZNA())[1] + (zdcread.energySectorZNA())[2] + (zdcread.energySectorZNA())[3]; + float sumZPC = (zdcread.energySectorZPC())[0] + (zdcread.energySectorZPC())[1] + (zdcread.energySectorZPC())[2] + (zdcread.energySectorZPC())[3]; + float sumZPA = (zdcread.energySectorZPA())[0] + (zdcread.energySectorZPA())[1] + (zdcread.energySectorZPA())[2] + (zdcread.energySectorZPA())[3]; + float alphaZN = (sumZNA - sumZNC) / (sumZNA + sumZNC); + float alphaZP = (sumZPA - sumZPC) / (sumZPA + sumZPC); + + histos.fill(HIST("alphaZN"), alphaZN); + histos.fill(HIST("alphaZP"), alphaZP); + + histos.fill(HIST("diffZNASignal"), sumZNA - zdcread.energyCommonZNA()); + histos.fill(HIST("diffZNCSignal"), sumZNC - zdcread.energyCommonZNC()); + histos.fill(HIST("diffZPASignal"), sumZPA - zdcread.energyCommonZPA()); + histos.fill(HIST("diffZPCSignal"), sumZPC - zdcread.energyCommonZPC()); + histos.fill(HIST("ZNSignal"), sumZNA + sumZNC); + histos.fill(HIST("ZPSignal"), sumZPA + sumZPC); + histos.fill(HIST("diffZNSignal"), (sumZNA + sumZNC) - (zdcread.energyCommonZNA() + zdcread.energyCommonZNC())); + histos.fill(HIST("diffZPSignal"), (sumZPA + sumZPC) - (zdcread.energyCommonZPA() + zdcread.energyCommonZPC())); + histos.fill(HIST("CentralityPercentile"), cent); + histos.fill(HIST("CentvsZNASignal"), cent, sumZNA); + histos.fill(HIST("CentvsZNCSignal"), cent, sumZNC); + histos.fill(HIST("CentvsZPASignal"), cent, sumZPA); + histos.fill(HIST("CentvsZPCSignal"), cent, sumZPC); + histos.fill(HIST("CentvsZNSignal"), cent, sumZNA + sumZNC); + histos.fill(HIST("CentvsZPSignal"), cent, sumZPA + sumZPC); + } + } + PROCESS_SWITCH(NeutronProtonCorrZdc, processRun3, "Process analysis for Run 3 data", true); + + void processRun2(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, aod::Zdcs const&) + { + if (!collision.alias_bit(kINT7)) { + histos.fill(HIST("eventCounter"), 0.25); + return; + } + + if (collision.has_zdc()) { + const auto& zdcread = collision.zdc(); + const auto cent = collision.centRun2V0M(); + histos.fill(HIST("eventCounter"), 1.25); + histos.fill(HIST("ZNASignal"), zdcread.energyCommonZNA()); + histos.fill(HIST("ZNCSignal"), zdcread.energyCommonZNC()); + histos.fill(HIST("ZPASignal"), zdcread.energyCommonZPA()); + histos.fill(HIST("ZPCSignal"), zdcread.energyCommonZPC()); + histos.fill(HIST("ZNASector0Signal"), (zdcread.energySectorZNA())[0]); + histos.fill(HIST("ZNASector1Signal"), (zdcread.energySectorZNA())[1]); + histos.fill(HIST("ZNASector2Signal"), (zdcread.energySectorZNA())[2]); + histos.fill(HIST("ZNASector3Signal"), (zdcread.energySectorZNA())[3]); + histos.fill(HIST("ZNCSector0Signal"), (zdcread.energySectorZNC())[0]); + histos.fill(HIST("ZNCSector1Signal"), (zdcread.energySectorZNC())[1]); + histos.fill(HIST("ZNCSector2Signal"), (zdcread.energySectorZNC())[2]); + histos.fill(HIST("ZNCSector3Signal"), (zdcread.energySectorZNC())[3]); + histos.fill(HIST("ZPASector0Signal"), (zdcread.energySectorZPA())[0]); + histos.fill(HIST("ZPASector1Signal"), (zdcread.energySectorZPA())[1]); + histos.fill(HIST("ZPASector2Signal"), (zdcread.energySectorZPA())[2]); + histos.fill(HIST("ZPASector3Signal"), (zdcread.energySectorZPA())[3]); + histos.fill(HIST("ZPCSector0Signal"), (zdcread.energySectorZPC())[0]); + histos.fill(HIST("ZPCSector1Signal"), (zdcread.energySectorZPC())[1]); + histos.fill(HIST("ZPCSector2Signal"), (zdcread.energySectorZPC())[2]); + histos.fill(HIST("ZPCSector3Signal"), (zdcread.energySectorZPC())[3]); + float sumZNC = (zdcread.energySectorZNC())[0] + (zdcread.energySectorZNC())[1] + (zdcread.energySectorZNC())[2] + (zdcread.energySectorZNC())[3]; + float sumZNA = (zdcread.energySectorZNA())[0] + (zdcread.energySectorZNA())[1] + (zdcread.energySectorZNA())[2] + (zdcread.energySectorZNA())[3]; + float sumZPC = (zdcread.energySectorZPC())[0] + (zdcread.energySectorZPC())[1] + (zdcread.energySectorZPC())[2] + (zdcread.energySectorZPC())[3]; + float sumZPA = (zdcread.energySectorZPA())[0] + (zdcread.energySectorZPA())[1] + (zdcread.energySectorZPA())[2] + (zdcread.energySectorZPA())[3]; + float alphaZN = (sumZNA - sumZNC) / (sumZNA + sumZNC); + float alphaZP = (sumZPA - sumZPC) / (sumZPA + sumZPC); + histos.fill(HIST("alphaZN"), alphaZN); + histos.fill(HIST("alphaZP"), alphaZP); + + histos.fill(HIST("diffZNASignal"), sumZNA - zdcread.energyCommonZNA()); + histos.fill(HIST("diffZNCSignal"), sumZNC - zdcread.energyCommonZNC()); + histos.fill(HIST("diffZPASignal"), sumZPA - zdcread.energyCommonZPA()); + histos.fill(HIST("diffZPCSignal"), sumZPC - zdcread.energyCommonZPC()); + histos.fill(HIST("ZNSignal"), sumZNA + sumZNC); + histos.fill(HIST("ZPSignal"), sumZPA + sumZPC); + histos.fill(HIST("diffZNSignal"), (sumZNA + sumZNC) - (zdcread.energyCommonZNA() + zdcread.energyCommonZNC())); + histos.fill(HIST("diffZPSignal"), (sumZPA + sumZPC) - (zdcread.energyCommonZPA() + zdcread.energyCommonZPC())); + histos.fill(HIST("CentralityPercentile"), cent); + histos.fill(HIST("CentvsZNASignal"), cent, sumZNA); + histos.fill(HIST("CentvsZNCSignal"), cent, sumZNC); + histos.fill(HIST("CentvsZPASignal"), cent, sumZPA); + histos.fill(HIST("CentvsZPCSignal"), cent, sumZPC); + histos.fill(HIST("CentvsZNSignal"), cent, sumZNA + sumZNC); + histos.fill(HIST("CentvsZPSignal"), cent, sumZPA + sumZPC); + } + } + PROCESS_SWITCH(NeutronProtonCorrZdc, processRun2, "Process analysis for Run 2 converted data", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/TwoParticleCorrelations/Tasks/r2p2-4-id.cxx b/PWGCF/TwoParticleCorrelations/Tasks/r2p2-4-id.cxx index d7187c49f0c..e6c13fe1318 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/r2p2-4-id.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/r2p2-4-id.cxx @@ -9,6 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Common/DataModel/EventSelection.h" @@ -49,12 +51,12 @@ struct FillFlagsTable { auto tpcnsigma = (std::vector>){TPCnsigmacutsPi, TPCnsigmacutsKa, TPCnsigmacutsPr}; auto tofpt = (std::vector>){TOFpTrangesPi, TOFpTrangesKa, TOFpTrangesPr}; auto tofnsigma = (std::vector>){TOFnsigmacutsPi, TOFnsigmacutsKa, TOFnsigmacutsPr}; - for (int8_t i = 0; i < tpcpt[species].size(); i++) + for (std::size_t i = 0; i < tpcpt[species].size(); i++) if (trackpt < tpcpt[species][i]) { tpcindex = i; break; } - for (int8_t i = 0; i < tofpt[species].size(); i++) + for (std::size_t i = 0; i < tofpt[species].size(); i++) if (trackpt >= tofpt[species][i]) { tofindex = i; break; @@ -258,8 +260,8 @@ struct r2p24id { Configurable maxpT{"maxpT", 2.0, "Maximum pT"}; Configurable trackpartition{"trackpartition", 1.0, "where(in pT) to partition"}; - Configurable pid_particle1{"pid_particle1", 1, "Define particle1 type"}; // 1->Pion, 2->Kaon, 3->Proton - Configurable pid_particle2{"pid_particle2", 1, "Define particle2 type"}; + Configurable pid_particle1{"pid_particle1", 1, "Define particle1 type"}; // 1->Pion, 2->Kaon, 3->Proton + Configurable pid_particle2{"pid_particle2", 1, "Define particle2 type"}; Configurable iftrackpartition{"iftrackpartition", false, "If track partition is needed"}; Configurable ifpid{"ifpid", false, "If PID is needed"}; diff --git a/PWGDQ/Core/CutsLibrary.cxx b/PWGDQ/Core/CutsLibrary.cxx index 7b0c206235d..20ae5000bc8 100644 --- a/PWGDQ/Core/CutsLibrary.cxx +++ b/PWGDQ/Core/CutsLibrary.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include "AnalysisCompositeCut.h" #include "VarManager.h" @@ -32,6 +33,8 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) // /////////////////////////////////////////////// // These are the Cuts used in the CEFP Task // // to select tracks in the event selection // + // // + // see CutsLubrary.h for the description // // /////////////////////////////////////////////// if (!nameStr.compare("Electron2022")) { cut->AddCut(GetAnalysisCut("jpsiStandardKine")); @@ -40,25 +43,15 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } if (!nameStr.compare("Electron2023")) { - cut->AddCut(GetAnalysisCut("jpsiStandardKine4")); + cut->AddCut(GetAnalysisCut("jpsiStandardKine")); cut->AddCut(GetAnalysisCut("electronStandardQualityForO2MCdebug")); - cut->AddCut(GetAnalysisCut("pidCut_lowP_Corr")); - - AnalysisCompositeCut* pidCut_highP = new AnalysisCompositeCut("pidCut_highP", "pidCut_highP", kFALSE); - pidCut_highP->AddCut(GetAnalysisCut("EleInclusion_highP_Corr")); - pidCut_highP->AddCut(GetAnalysisCut("PionExclusion_highP_Corr")); - cut->AddCut(pidCut_highP); + cut->AddCut(GetAnalysisCut("jpsi_TPCPID_debug5_noCorr")); return cut; } - if (!nameStr.compare("Electron2023_Tight")) { - cut->AddCut(GetAnalysisCut("jpsiStandardKine4")); - cut->AddCut(GetAnalysisCut("electronStandardQualityForO2MCdebug")); - cut->AddCut(GetAnalysisCut("pidCut_lowP_Corr")); - - AnalysisCompositeCut* pidCut_highP = new AnalysisCompositeCut("pidCut_highP", "pidCut_highP", kFALSE); - pidCut_highP->AddCut(GetAnalysisCut("EleInclusion_highP2_Corr")); - pidCut_highP->AddCut(GetAnalysisCut("PionExclusion_highP_Corr")); - cut->AddCut(pidCut_highP); + if (!nameStr.compare("LowMassElectron2023")) { + cut->AddCut(GetAnalysisCut("lmeeStandardKine")); + cut->AddCut(GetAnalysisCut("LooseGlobalTrackRun3")); + cut->AddCut(GetAnalysisCut("lmee_pp_502TeV_TOFloose_pionrej")); return cut; } if (!nameStr.compare("MuonLow2022")) { @@ -66,17 +59,17 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) cut->AddCut(GetAnalysisCut("muonQualityCuts")); return cut; } - if (!nameStr.compare("MuonLow2023")) { - cut->AddCut(GetAnalysisCut("muonLowPt2")); - cut->AddCut(GetAnalysisCut("muonQualityCuts")); - cut->AddCut(GetAnalysisCut("MCHMID")); - return cut; - } if (!nameStr.compare("MuonHigh2022")) { cut->AddCut(GetAnalysisCut("muonHighPt2")); cut->AddCut(GetAnalysisCut("muonQualityCuts")); return cut; } + if (!nameStr.compare("MuonLow2023")) { + cut->AddCut(GetAnalysisCut("muonLowPt2")); + cut->AddCut(GetAnalysisCut("muonQualityCuts10SigmaPDCA")); + cut->AddCut(GetAnalysisCut("MCHMID")); + return cut; + } if (!nameStr.compare("MuonHigh2023")) { cut->AddCut(GetAnalysisCut("muonHighPt6")); cut->AddCut(GetAnalysisCut("muonQualityCuts")); @@ -145,6 +138,15 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) cut->AddCut(GetAnalysisCut("electronPIDnsigmaMedium")); return cut; } + + if (!nameStr.compare("electronSelection1_idstoreh")) { // same as electronSelection1_ionut, but with kIsSPDAny -> kIsITSibAny + cut->AddCut(GetAnalysisCut("jpsiStandardKine")); + cut->AddCut(GetAnalysisCut("electronStandardQualityForO2MCdebug4")); + cut->AddCut(GetAnalysisCut("dcaCut1_ionut")); + cut->AddCut(GetAnalysisCut("electronPIDnsigmaMedium")); + return cut; + } + if (!nameStr.compare("electronSelection1pos_ionut")) { cut->AddCut(GetAnalysisCut("posTrack")); cut->AddCut(GetAnalysisCut("jpsiStandardKine")); @@ -370,12 +372,31 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } + if (!nameStr.compare("JpsiPWGSkimmedCuts4")) { + cut->AddCut(GetAnalysisCut("jpsiKineSkimmed")); + cut->AddCut(GetAnalysisCut("electronTrackQualitySkimmed2")); + cut->AddCut(GetAnalysisCut("jpsi_TPCPID_debug9")); // loose cut + return cut; + } + if (!nameStr.compare("pidElectron_ionut")) { cut->AddCut(GetAnalysisCut("pidcalib_ele")); cut->AddCut(GetAnalysisCut("jpsiStandardKine3")); return cut; } + if (!nameStr.compare("pidElectron_ionut_posEta")) { + cut->AddCut(GetAnalysisCut("pidcalib_ele")); + cut->AddCut(GetAnalysisCut("jpsiPIDcalibKine_posEta")); + return cut; + } + + if (!nameStr.compare("pidElectron_ionut_negEta")) { + cut->AddCut(GetAnalysisCut("pidcalib_ele")); + cut->AddCut(GetAnalysisCut("jpsiPIDcalibKine_negEta")); + return cut; + } + if (!nameStr.compare("pidPion_ionut")) { cut->AddCut(GetAnalysisCut("pidcalib_pion")); cut->AddCut(GetAnalysisCut("jpsiStandardKine3")); @@ -412,6 +433,29 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } + if (!nameStr.compare("emu_electronCuts_tof")) { + cut->AddCut(GetAnalysisCut("jpsiStandardKine")); + cut->AddCut(GetAnalysisCut("electronStandardQualityForO2MCdebug4")); + cut->AddCut(GetAnalysisCut("electronPIDnsigmaSkewed")); + cut->AddCut(GetAnalysisCut("tof_electron_sigma_2")); + return cut; + } + + if (!nameStr.compare("emu_electronCuts_tightTPC")) { + cut->AddCut(GetAnalysisCut("jpsiStandardKine")); + cut->AddCut(GetAnalysisCut("electronStandardQualityForO2MCdebug4")); + cut->AddCut(GetAnalysisCut("electronPIDnsigmaSkewed_2")); + return cut; + } + + if (!nameStr.compare("emu_electronCuts_tof_tightTPC")) { + cut->AddCut(GetAnalysisCut("jpsiStandardKine")); + cut->AddCut(GetAnalysisCut("electronStandardQualityForO2MCdebug4")); + cut->AddCut(GetAnalysisCut("electronPIDnsigmaSkewed_2")); + cut->AddCut(GetAnalysisCut("tof_electron_sigma_2")); + return cut; + } + if (!nameStr.compare("jpsiKineAndQuality")) { cut->AddCut(GetAnalysisCut("jpsiStandardKine")); cut->AddCut(GetAnalysisCut("electronStandardQuality")); @@ -602,6 +646,14 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } + if (!nameStr.compare("kaonPID3_withDCA")) { // same as kaonPID3 but with cut on DCA and SPDAny->ITSAny + cut->AddCut(GetAnalysisCut("AssocKine")); // standard kine cuts usually are applied via Filter in the task + cut->AddCut(GetAnalysisCut("electronStandardQualityForO2MCdebug4")); + cut->AddCut(GetAnalysisCut("dcaCut1_ionut")); + cut->AddCut(GetAnalysisCut("kaonPID_TPCnTOF")); + return cut; + } + if (!nameStr.compare("kaonPID4")) { cut->AddCut(GetAnalysisCut("kaonPID_TPCnTOF")); return cut; @@ -855,7 +907,7 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) } if (!nameStr.compare("Jpsi_TPCPost_calib_debug8")) { - cut->AddCut(GetAnalysisCut("jpsi_trackCut_debug3")); + cut->AddCut(GetAnalysisCut("jpsi_trackCut_debug5")); cut->AddCut(GetAnalysisCut("jpsi_TPCPID_debug8")); return cut; } @@ -2512,6 +2564,22 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } + if (!nameStr.compare("trackCut_compareDQEMframework")) { // cut setting to check least common factor between reduced data sets of PWGEM and PWGDQ + cut->AddCut(GetAnalysisCut("lmeeStandardKine")); + cut->AddCut(GetAnalysisCut("trackQuality_compareDQEMframework")); + cut->AddCut(GetAnalysisCut("trackDCA1cm")); + AnalysisCompositeCut* cut_tpc_nSigma = new AnalysisCompositeCut("pid_TPCnSigma", "pid_TPCnSigma", kTRUE); + cut_tpc_nSigma->AddCut(GetAnalysisCut("lmee_commonDQEM_PID_TPC")); + + AnalysisCompositeCut* cut_tof_nSigma = new AnalysisCompositeCut("pid_TOFnSigma", "pid_TOFnSigma", kTRUE); + cut_tof_nSigma->AddCut(GetAnalysisCut("lmee_commonDQEM_PID_TOF")); + + AnalysisCompositeCut* cut_pid_OR = new AnalysisCompositeCut("e_NSigma", "e_NSigma", kFALSE); + cut_pid_OR->AddCut(cut_tpc_nSigma); + cut_pid_OR->AddCut(cut_tof_nSigma); + return cut; + } + // ------------------------------------------------------------------------------------------------- // lmee pair cuts @@ -2549,14 +2617,19 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } - if (!nameStr.compare("muonQualityCuts3SigmaPDCA")) { - cut->AddCut(GetAnalysisCut("muonQualityCuts3SigmaPDCA")); + if (!nameStr.compare("matchedQualityCutsMFTeta")) { + cut->AddCut(GetAnalysisCut("matchedQualityCutsMFTeta")); + return cut; + } + + if (!nameStr.compare("muonQualityCuts5SigmaPDCA_Run3")) { + cut->AddCut(GetAnalysisCut("muonQualityCuts5SigmaPDCA_Run3")); return cut; } - if (!nameStr.compare("muonLowPt3SigmaPDCA")) { + if (!nameStr.compare("muonLowPt5SigmaPDCA_Run3")) { cut->AddCut(GetAnalysisCut("muonLowPt")); - cut->AddCut(GetAnalysisCut("muonQualityCuts3SigmaPDCA")); + cut->AddCut(GetAnalysisCut("muonQualityCuts5SigmaPDCA_Run3")); cut->AddCut(GetAnalysisCut("MCHMID")); return cut; } @@ -3341,6 +3414,34 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("eventStandardSel8PbPbQualityTightTrackOccupancyCollInTime")) { + cut->AddCut(VarManager::kVtxZ, -10.0, 10.0); + cut->AddCut(VarManager::kIsSel8, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoTFBorder, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoITSROFBorder, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoSameBunch, 0.5, 1.5); + cut->AddCut(VarManager::kIsGoodZvtxFT0vsPV, 0.5, 1.5); + cut->AddCut(VarManager::kCentFT0C, 0.0, 90.0); + cut->AddCut(VarManager::kTrackOccupancyInTimeRange, 0., 500); + cut->AddCut(VarManager::kNoCollInTimeRangeStandard, 0.5, 1.5); + + return cut; + } + + if (!nameStr.compare("eventStandardSel8PbPbQualityTightTrackOccupancyCollInTime")) { + cut->AddCut(VarManager::kVtxZ, -10.0, 10.0); + cut->AddCut(VarManager::kIsSel8, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoTFBorder, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoITSROFBorder, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoSameBunch, 0.5, 1.5); + cut->AddCut(VarManager::kIsGoodZvtxFT0vsPV, 0.5, 1.5); + cut->AddCut(VarManager::kCentFT0C, 0.0, 90.0); + cut->AddCut(VarManager::kTrackOccupancyInTimeRange, 0., 1000); + cut->AddCut(VarManager::kNoCollInTimeRangeStandard, 0.5, 1.5); + + return cut; + } + std::vector vecOccupancies = {0., 250., 500., @@ -3603,6 +3704,18 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("jpsiPIDcalibKine_posEta")) { + cut->AddCut(VarManager::kPin, 1.0, 1000.0); + cut->AddCut(VarManager::kEta, 0.0, 0.9); + return cut; + } + + if (!nameStr.compare("jpsiPIDcalibKine_negEta")) { + cut->AddCut(VarManager::kPin, 1.0, 1000.0); + cut->AddCut(VarManager::kEta, -0.9, 0.0); + return cut; + } + if (!nameStr.compare("jpsiStandardKine4")) { cut->AddCut(VarManager::kP, 1.5, 1000.0); cut->AddCut(VarManager::kEta, -0.9, 0.9); @@ -3784,6 +3897,14 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("jpsi_trackCut_debug5")) { + cut->AddCut(VarManager::kEta, -0.9, 0.9); + cut->AddCut(VarManager::kTPCchi2, 0.0, 4.0); + cut->AddCut(VarManager::kTPCncls, 70., 159); + cut->AddCut(VarManager::kIsITSibAny, 0.5, 1.5); + return cut; + } + if (!nameStr.compare("lmee_trackCut_debug")) { cut->AddCut(VarManager::kEta, -0.9, 0.9); cut->AddCut(VarManager::kTPCchi2, 0.0, 4.0); @@ -3801,6 +3922,17 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("trackQuality_compareDQEMframework")) { // cut setting to check least common factor between reduced data sets of PWGEM and PWGDQ + cut->AddCut(VarManager::kIsSPDfirst, 0.5, 1.5); + cut->AddCut(VarManager::kITSchi2, 0.0, 5.0); + cut->AddCut(VarManager::kITSncls, 4.5, 7.5); + cut->AddCut(VarManager::kTPCchi2, 0.0, 4.0); + cut->AddCut(VarManager::kTPCnclsCR, 80.0, 161.); + cut->AddCut(VarManager::kTPCnCRoverFindCls, 0.8, 1e+10); + cut->AddCut(VarManager::kTPCncls, 90.0, 170.); + return cut; + } + if ((!nameStr.compare("TightGlobalTrackRun3")) || (!nameStr.compare("lmeeQCTrackCuts"))) { cut->AddCut(VarManager::kIsSPDfirst, 0.5, 1.5); cut->AddCut(VarManager::kTPCchi2, 0.0, 4.0); @@ -4031,9 +4163,7 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) if (!nameStr.compare("pionQualityCut1")) { cut->AddCut(VarManager::kPt, 0.15, 1000.0); cut->AddCut(VarManager::kIsITSibAny, 0.5, 1.5); - cut->AddCut(VarManager::kTPCncls, 100, 161); - cut->AddCut(VarManager::kTrackDCAxy, -0.05, 0.05); - cut->AddCut(VarManager::kTrackDCAz, -0.1, 0.1); + cut->AddCut(VarManager::kTPCncls, 70, 161); return cut; } @@ -4049,6 +4179,12 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("trackDCA1cm")) { // cut setting to check least common factor between reduced data sets of PWGEM and PWGDQ + cut->AddCut(VarManager::kTrackDCAxy, -1.0, 1.0); + cut->AddCut(VarManager::kTrackDCAz, -1.0, 1.0); + return cut; + } + if (!nameStr.compare("dcaCut1_ionut")) { cut->AddCut(VarManager::kTrackDCAxy, -0.5, 0.5); cut->AddCut(VarManager::kTrackDCAz, -0.5, 0.5); @@ -4301,10 +4437,18 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) } if (!nameStr.compare("jpsi_TPCPID_debug8")) { - cut->AddCut(VarManager::kTOFbeta, 0.975, 1.025, false, VarManager::kPin, 0.0, 3.0); - cut->AddCut(VarManager::kTPCnSigmaEl, -3.0, 4.0); - cut->AddCut(VarManager::kTPCnSigmaPi, 2.0, 999, false, VarManager::kPin, 3.0, 999.0); - cut->AddCut(VarManager::kTPCnSigmaPr, 2.0, 999, false, VarManager::kPin, 3.0, 999.0); + cut->AddCut(VarManager::kTPCnSigmaEl, -2.0, 3.0, false, VarManager::kPin, 0.0, 3.0); + cut->AddCut(VarManager::kTPCnSigmaEl, -3.0, 3.0, false, VarManager::kPin, 3.0, 999.0); + cut->AddCut(VarManager::kTPCnSigmaPi, 3.0, 999, false, VarManager::kPin, 0.0, 3.0); + cut->AddCut(VarManager::kTPCnSigmaPi, 2.0, 999, false, VarManager::kPin, 5.0, 999.0); + cut->AddCut(VarManager::kTPCnSigmaPr, 3.0, 999, false, VarManager::kPin, 3.0, 999.0); + return cut; + } + + if (!nameStr.compare("jpsi_TPCPID_debug9")) { + cut->AddCut(VarManager::kTPCnSigmaEl, -2.5, 4.0); + cut->AddCut(VarManager::kTPCnSigmaPi, 1.0, 999, false, VarManager::kPin, 3.0, 999.0); + cut->AddCut(VarManager::kTPCnSigmaPr, 2.0, 999); return cut; } @@ -4409,6 +4553,21 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("lmee_commonDQEM_PID_TPC")) { // cut setting to check least common factor between reduced data sets of PWGEM and PWGDQ + cut->AddCut(VarManager::kTPCnSigmaEl, -2.5, 3., false, VarManager::kPin, 0.0, 1e+10, false); + cut->AddCut(VarManager::kTPCnSigmaPi, -1e12, 3.5, true, VarManager::kPin, 0.0, 1e+10, false); + cut->AddCut(VarManager::kTPCnSigmaKa, -3., 3., true, VarManager::kPin, 0.0, 1e+10, false); + cut->AddCut(VarManager::kTPCnSigmaPr, -3., 3., true, VarManager::kPin, 0.0, 1e+10, false); + return cut; + } + + if (!nameStr.compare("lmee_commonDQEM_PID_TOF")) { // cut setting to check least common factor between reduced data sets of PWGEM and PWGDQ + cut->AddCut(VarManager::kTPCnSigmaEl, -2.5, 3., false, VarManager::kPin, 0.0, 1e+10, false); + cut->AddCut(VarManager::kTPCnSigmaPi, -3., 3.5, true, VarManager::kPin, 0.0, 1e+10, false); + cut->AddCut(VarManager::kTOFnSigmaEl, -3., 3., false, VarManager::kPin, 0.3, 1e+10, false); + return cut; + } + std::vector vecPIDcase; vecPIDcase.emplace_back(""); // without post calibration vecPIDcase.emplace_back("_Corr"); // case of using post calibrated PID spectra @@ -4780,6 +4939,13 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("electronPIDnsigmaSkewed_2")) { + cut->AddCut(VarManager::kTPCnSigmaEl, -0.0, 3.0); + cut->AddCut(VarManager::kTPCnSigmaPr, 3.5, 3000.0); + cut->AddCut(VarManager::kTPCnSigmaPi, 3.5, 3000.0); + return cut; + } + if (!nameStr.compare("electronPIDPrKaPiRej")) { cut->AddCut(VarManager::kTPCnSigmaEl, -3.0, 3.0); cut->AddCut(VarManager::kTPCnSigmaPr, -3.0, 3.0, true); @@ -4944,6 +5110,11 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("tof_electron_sigma_2")) { + cut->AddCut(VarManager::kTOFnSigmaEl, -3., 3.); + return cut; + } + if (!nameStr.compare("tof_electron_loose")) { cut->AddCut(VarManager::kTOFbeta, 0.95, 1.05, false, VarManager::kPin, 0.0, 1e+10, false); return cut; @@ -5237,11 +5408,11 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } - if (!nameStr.compare("muonQualityCuts3SigmaPDCA")) { + if (!nameStr.compare("muonQualityCuts5SigmaPDCA_Run3")) { cut->AddCut(VarManager::kEta, -4.0, -2.5); cut->AddCut(VarManager::kMuonRAtAbsorberEnd, 17.6, 89.5); - cut->AddCut(VarManager::kMuonPDca, 0.0, 300.0, false, VarManager::kMuonRAtAbsorberEnd, 17.6, 26.5); - cut->AddCut(VarManager::kMuonPDca, 0.0, 201.0, false, VarManager::kMuonRAtAbsorberEnd, 26.5, 89.5); + cut->AddCut(VarManager::kMuonPDca, 0.0, 500.0, false, VarManager::kMuonRAtAbsorberEnd, 17.6, 26.5); + cut->AddCut(VarManager::kMuonPDca, 0.0, 335.0, false, VarManager::kMuonRAtAbsorberEnd, 26.5, 89.5); cut->AddCut(VarManager::kMuonChi2, 0.0, 1e6); cut->AddCut(VarManager::kMuonChi2MatchMCHMID, 0.0, 1e6); // matching MCH-MID return cut; @@ -5268,6 +5439,17 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("matchedQualityCutsMFTeta")) { + cut->AddCut(VarManager::kEta, -3.6, -2.5); + cut->AddCut(VarManager::kMuonRAtAbsorberEnd, 17.6, 89.5); + cut->AddCut(VarManager::kMuonPDca, 0.0, 594.0, false, VarManager::kMuonRAtAbsorberEnd, 17.6, 26.5); + cut->AddCut(VarManager::kMuonPDca, 0.0, 324.0, false, VarManager::kMuonRAtAbsorberEnd, 26.5, 89.5); + cut->AddCut(VarManager::kMuonChi2, 0.0, 1e6); + cut->AddCut(VarManager::kMuonChi2MatchMCHMID, 0.0, 1e6); // matching MCH-MID + cut->AddCut(VarManager::kMuonChi2MatchMCHMFT, 0.0, 1e6); // matching MFT-MCH + return cut; + } + if (!nameStr.compare("muonQualityCutsMatchingOnly")) { cut->AddCut(VarManager::kEta, -4.0, -2.5); cut->AddCut(VarManager::kMuonChi2, 0.0, 1e6); @@ -5689,7 +5871,7 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) } if (!nameStr.compare("pairX3872")) { - cut->AddCut(VarManager::kCosthetaDileptonDitrack, 0.98, 1); + cut->AddCut(VarManager::kQ, 0.0, 0.3); return cut; } diff --git a/PWGDQ/Core/CutsLibrary.h b/PWGDQ/Core/CutsLibrary.h index 59079166b29..1ce85510ab2 100644 --- a/PWGDQ/Core/CutsLibrary.h +++ b/PWGDQ/Core/CutsLibrary.h @@ -21,6 +21,82 @@ #include "PWGDQ/Core/AnalysisCompositeCut.h" #include "PWGDQ/Core/VarManager.h" +// /////////////////////////////////////////////// +// These are the Cuts used in the CEFP Task // +// to select tracks in the event selection // +// /////////////////////////////////////////////// +// +// Electron 2022 cuts : +// - Single e pT > 1.0 GeV/c +// - Single e eta = [-0.9 ; 0.9] +// - Is SPD Any : yes +// - TPC chi2 < 4.0 +// - TPC N Clusters = [70 ; 160] +// - n-sigma_e = [-4.0 ; 4.0] +// - n-sigma_pi > 2.5 +// - n-sigma_pr > 2.5 +// - PID post-calibration : Yes +// - Track-collision association : No +// For the dielectron Cut : pairNoCut +// mee > 0 GeV/c2 +// +// Electron 2023 & 2024 cuts : +// - Single e pT > 1.0 GeV/c +// - Single e eta = [-0.9 ; 0.9] +// - Is SPD Any : yes +// - TPC chi2 < 4.0 +// - TPC N Clusters = [70 ; 160] +// - n-sigma_e = [-4.0 ; 4.0] +// - n-sigma_pi > 2.5 +// - n-sigma_pr > 2.5 +// - PID post-calibration : No +// - Track-collision association : Yes +// For the dielectron Cut : pairMassLow5 +// mee > 1.8 GeV/c2 +// +// Low Mass electrons 2023 & 2024 cuts : +// - Single e pT > 0.4 GeV/c +// - Single e eta = [-0.8 ; 0.8] +// - Is SPD Any : yes +// - TPC chi2 < 4.0 +// - ITS chi2 < 6.0 +// - TPC N Clusters = [70 ; 170] +// - ITS N Clusters = [3.5 ; 7.5] +// - n-sigma_e = [-4.0 ; 4.0] +// - n-sigma_pi > 3.5 for 0.0 < pIN < 2.0 +// - n-sigma_pr > 2.5 for 2.0 < pIN < 1e+10 +// - n-sigma_e TOF = [-4.0 ; 4.0] for 0.3 < pIN < 1e+10 +// - PID post-calibration : No +// - Track-collision association : Yes +// For the dielectron Cut : +// - Intermediate Mass Range ee trigger : mee > 1.3 GeV/c2 (pairMass1_3) +// - High Mass Range ee trigger : mee > 3.5 GeV/c2 (pairMassLow12) +// +// Muons Cuts 2022 : +// - Single mu Low (High) pT > 0.7 (4.0) GeV/c +// - Single mu eta = [-4.0 ; -2.5] +// - Rabs = [17.6 ; 89.5] +// - p x DCA = ~6 sigma_[p x DCA] +// - Matching MCH-MID : No +// - Track-collision association : No +// For the dimuon cut +// m_mumu > 1.8 GeV/c2 +// +// Muons Cuts 2023 & 2024 : +// - Single mu Low (High) pT > 0.7 (20.0) GeV/c +// - Single mu eta = [-4.0 ; -2.5] +// - Rabs = [17.6 ; 89.5] +// - p x DCA = ~10 sigma_[p x DCA] +// - Matching MCH-MID : Yes +// - Track-collision association : Yes +// For the dimuon cut +// m_mumu > 1.8 GeV/c2 +// +// +// /////////////////////////////////////////////// +// End of Cuts for CEFP // +// /////////////////////////////////////////////// + namespace o2::aod { namespace dqcuts diff --git a/PWGDQ/Core/HistogramManager.cxx b/PWGDQ/Core/HistogramManager.cxx index 146baeb939a..f66ced3ca8b 100644 --- a/PWGDQ/Core/HistogramManager.cxx +++ b/PWGDQ/Core/HistogramManager.cxx @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include "Framework/Logger.h" using namespace std; @@ -121,7 +123,7 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co int nYbins, double ymin, double ymax, int varY, int nZbins, double zmin, double zmax, int varZ, const char* xLabels, const char* yLabels, const char* zLabels, - int varT, int varW, bool isdouble) + int varT, int varW, bool isdouble, bool isFillLabelx) { // // add a histogram (this function can define TH1F,TH2F,TH3F,TProfile,TProfile2D, and TProfile3D) @@ -137,7 +139,7 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co } // check whether this histogram name was used before if (hList->FindObject(hname)) { - LOG(warn) << "HistogramManager::AddHistogram(): Histogram " << hname << " already exists"; + LOG(warn) << "HistogramManager::AddHistogram(): Histogram " << hname << " already exists in class " << histClass; return; } @@ -179,7 +181,8 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co varVector.push_back(varX); // variables on each axis varVector.push_back(varY); varVector.push_back(varZ); - varVector.push_back(varT); // variable used for profiling in case of TProfile3D + varVector.push_back(varT); // variable used for profiling in case of TProfile3D + varVector.push_back(isFillLabelx ? 1 : 0); // whether to fill with the x-axis labels std::list varList = fVariablesMap[histClass]; varList.push_back(varVector); fVariablesMap[histClass] = varList; @@ -330,7 +333,7 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co int nYbins, double* ybins, int varY, int nZbins, double* zbins, int varZ, const char* xLabels, const char* yLabels, const char* zLabels, - int varT, int varW, bool isdouble) + int varT, int varW, bool isdouble, bool isFillLabelx) { // // add a histogram @@ -388,7 +391,8 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co varVector.push_back(varX); // variables on each axis varVector.push_back(varY); varVector.push_back(varZ); - varVector.push_back(varT); // variable used for profiling in case of TProfile3D + varVector.push_back(varT); // variable used for profiling in case of TProfile3D + varVector.push_back(isFillLabelx ? 1 : 0); // whether to fill with the x-axis labels std::list varList = fVariablesMap[histClass]; varList.push_back(varVector); fVariablesMap[histClass] = varList; @@ -754,6 +758,7 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values) bool isTHn; int dimension = 0; bool isSparse = kFALSE; + bool isFillLabelx = kFALSE; // TODO: At the moment, maximum 20 dimensions are foreseen for the THn histograms. We should make this more dynamic // But maybe its better to have it like to avoid dynamically allocating this array in the histogram loop double fillValues[20] = {0.0}; @@ -783,6 +788,7 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values) varY = varIter->at(4); varZ = varIter->at(5); varT = varIter->at(6); + isFillLabelx = (varIter->at(7) == 1 ? true : false); } if (!isTHn) { @@ -790,15 +796,31 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values) case 1: if (isProfile) { if (varW > kNothing) { - (reinterpret_cast(h))->Fill(values[varX], values[varY], values[varW]); + if (isFillLabelx) { + (reinterpret_cast(h))->Fill(Form("%d", static_cast(values[varX])), values[varY], values[varW]); + } else { + (reinterpret_cast(h))->Fill(values[varX], values[varY], values[varW]); + } } else { - (reinterpret_cast(h))->Fill(values[varX], values[varY]); + if (isFillLabelx) { + (reinterpret_cast(h))->Fill(Form("%d", static_cast(values[varX])), values[varY]); + } else { + (reinterpret_cast(h))->Fill(values[varX], values[varY]); + } } } else { if (varW > kNothing) { - (reinterpret_cast(h))->Fill(values[varX], values[varW]); + if (isFillLabelx) { + (reinterpret_cast(h))->Fill(Form("%d", static_cast(values[varX])), values[varW]); + } else { + (reinterpret_cast(h))->Fill(values[varX], values[varW]); + } } else { - (reinterpret_cast(h))->Fill(values[varX]); + if (isFillLabelx) { + (reinterpret_cast(h))->Fill(Form("%d", static_cast(values[varX])), 1.); + } else { + (reinterpret_cast(h))->Fill(values[varX]); + } } } break; @@ -811,9 +833,17 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values) } } else { if (varW > kNothing) { - (reinterpret_cast(h))->Fill(values[varX], values[varY], values[varW]); + if (isFillLabelx) { + (reinterpret_cast(h))->Fill(Form("%d", static_cast(values[varX])), values[varY], values[varW]); + } else { + (reinterpret_cast(h))->Fill(values[varX], values[varY], values[varW]); + } } else { - (reinterpret_cast(h))->Fill(values[varX], values[varY]); + if (isFillLabelx) { + (reinterpret_cast(h))->Fill(Form("%d", static_cast(values[varX])), values[varY], 1.); + } else { + (reinterpret_cast(h))->Fill(values[varX], values[varY]); + } } } break; @@ -852,7 +882,7 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values) } } } // end else - } // end loop over histograms + } // end loop over histograms } //____________________________________________________________________________________ diff --git a/PWGDQ/Core/HistogramManager.h b/PWGDQ/Core/HistogramManager.h index 273cbfd0bd6..4b1393b2eb7 100644 --- a/PWGDQ/Core/HistogramManager.h +++ b/PWGDQ/Core/HistogramManager.h @@ -67,14 +67,14 @@ class HistogramManager : public TNamed int nYbins = 0, double ymin = 0, double ymax = 0, int varY = -1, int nZbins = 0, double zmin = 0, double zmax = 0, int varZ = -1, const char* xLabels = "", const char* yLabels = "", const char* zLabels = "", - int varT = -1, int varW = -1, bool isdouble = false); + int varT = -1, int varW = -1, bool isdouble = false, bool isFillLabelx = false); // Similar to the above function, with the difference that the user can specify non-equidistant binning void AddHistogram(const char* histClass, const char* name, const char* title, bool isProfile, int nXbins, double* xbins, int varX, int nYbins = 0, double* ybins = nullptr, int varY = -1, int nZbins = 0, double* zbins = nullptr, int varZ = -1, const char* xLabels = "", const char* yLabels = "", const char* zLabels = "", - int varT = -1, int varW = -1, bool isdouble = false); + int varT = -1, int varW = -1, bool isdouble = false, bool isFillLabelx = false); // Create a THn histogram (either THnF or THnSparse) with equidistant binning void AddHistogram(const char* histClass, const char* name, const char* title, int nDimensions, int* vars, int* nBins, double* xmin, double* xmax, diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index e0f85cbf797..c55f34bf1c9 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -13,6 +13,7 @@ // #include "PWGDQ/Core/HistogramsLibrary.h" #include "VarManager.h" +#include "CommonConstants/MathConstants.h" void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* histClass, const char* groupName, const char* subGroupName) { @@ -30,7 +31,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (!groupStr.CompareTo("event")) { if (!subGroupStr.Contains("generator")) { hm->AddHistogram(histClass, "VtxZ", "Vtx Z", false, 60, -15.0, 15.0, VarManager::kVtxZ); - hm->AddHistogram(histClass, "VtxZ_Run", "Vtx Z", true, VarManager::GetDummyNRuns(), -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, 60, -15.0, 15.0, VarManager::kVtxZ, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); + hm->AddHistogram(histClass, "VtxZ_Run", "Vtx Z", true, 1, -0.5, 0.5, VarManager::kRunNo, 60, -15.0, 15.0, VarManager::kVtxZ, 1, 0, 1, VarManager::kNothing, "", "", "", VarManager::kNothing, VarManager::kNothing, false, true); hm->AddHistogram(histClass, "BC", "Event per BC", false, 3564, 0.0, 3564.0, VarManager::kBCOrbit); } if (subGroupStr.Contains("trigger")) { @@ -76,7 +77,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "CentFT0C", "CentFT0C", false, 100, 0., 100., VarManager::kCentFT0C); hm->AddHistogram(histClass, "CentFT0C_vtxZ", "CentFT0C vs Vtx Z", false, 60, -15.0, 15.0, VarManager::kVtxZ, 20, 0., 100., VarManager::kCentFT0C); hm->AddHistogram(histClass, "CentFT0C_MultTPC", "CentFT0C vs MultTPC", false, 100, 0., 100., VarManager::kCentFT0C, 100, 0., 50000., VarManager::kMultTPC); - hm->AddHistogram(histClass, "CentFT0C_Run", "Cent FT0C", true, VarManager::GetDummyNRuns(), -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, 100, 0., 100., VarManager::kCentFT0C, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); + hm->AddHistogram(histClass, "CentFT0C_Run", "Cent FT0C", true, 1, -0.5, 0.5, VarManager::kRunNo, 100, 0., 100., VarManager::kCentFT0C, 1, 0, 1, VarManager::kNothing, "", "", "", VarManager::kNothing, VarManager::kNothing, false, true); } if (subGroupStr.Contains("mult")) { if (subGroupStr.Contains("pp")) { @@ -93,6 +94,16 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "MultTPC_MultFT0A", "MultTPC vs MultFT0A", false, 100, 0, 500.0, VarManager::kMultTPC, 100, 0, 200.0, VarManager::kMultFT0A); hm->AddHistogram(histClass, "MultTPC_MultFT0C", "MultTPC vs MultFT0C", false, 100, 0, 500.0, VarManager::kMultTPC, 100, 0, 300.0, VarManager::kMultFT0C); hm->AddHistogram(histClass, "MultFT0A_MultFT0C", "MultFT0A vs MultFT0C", false, 100, 0, 200.0, VarManager::kMultFT0A, 100, 0, 300.0, VarManager::kMultFT0C); + hm->AddHistogram(histClass, "MultITSWithPV", "MultITSWithPV", false, 150, 0.0, 150.0, VarManager::kMultNTracksHasITS); + hm->AddHistogram(histClass, "MultTPCWithPV", "MultTPCWithPV", false, 150, 0.0, 150.0, VarManager::kMultNTracksHasTPC); + hm->AddHistogram(histClass, "MultITSTPCWithPV", "MultITSTPCWithPV", false, 150, 0.0, 150.0, VarManager::kMultNTracksITSTPC); + hm->AddHistogram(histClass, "MultITSOnly", "MultITSOnly", false, 150, 0.0, 150.0, VarManager::kMultNTracksITSOnly); + hm->AddHistogram(histClass, "MultITSWithPV_MultTPCWithPV", "MultITSWithPV_MultTPCWithPV", false, 150, 0.0, 150.0, VarManager::kMultNTracksHasITS, 150, 0.0, 150.0, VarManager::kMultNTracksHasTPC); + hm->AddHistogram(histClass, "MultITSWithPV_MultITSTPCWithPV", "MultITSWithPV_MultTPCWithPV", false, 150, 0.0, 150.0, VarManager::kMultNTracksHasITS, 150, 0.0, 150.0, VarManager::kMultNTracksITSTPC); + hm->AddHistogram(histClass, "MultITSWithPV_MultFT0C", "MultITSWithPV_MultFT0C", false, 150, 0.0, 150.0, VarManager::kMultNTracksHasITS, 250, 0.0, 2500.0, VarManager::kMultFT0C); + hm->AddHistogram(histClass, "MultITSWithPV_MultFT0A", "MultITSWithPV_MultFT0A", false, 150, 0.0, 150.0, VarManager::kMultNTracksHasITS, 250, 0.0, 2500.0, VarManager::kMultFT0A); + hm->AddHistogram(histClass, "MultITSTPCWithPV_MultFT0C", "MultITSTPCWithPV_MultFT0C", false, 150, 0.0, 150.0, VarManager::kMultNTracksITSTPC, 250, 0.0, 2500.0, VarManager::kMultFT0C); + hm->AddHistogram(histClass, "MultITSTPCWithPV_MultFT0A", "MultITSTPCWithPV_MultFT0A", false, 150, 0.0, 150.0, VarManager::kMultNTracksITSTPC, 250, 0.0, 2500.0, VarManager::kMultFT0A); } else { hm->AddHistogram(histClass, "MultTPC", "MultTPC", false, 200, 0.0, 50000.0, VarManager::kMultTPC); hm->AddHistogram(histClass, "MultTPC_vsTimeSOR", "MultTPC vs time from SOR", true, 10000, 0.0, 1000.0, VarManager::kTimeFromSOR, 10, 0.0, 50000.0, VarManager::kMultTPC); @@ -121,6 +132,32 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "TPCpileupZC", "TPC pileup Z, C-side", false, 200, -50.0, 50.0, VarManager::kNTPCpileupZC); hm->AddHistogram(histClass, "TPCpileupNcontribA", "TPC pileup n-contributors, A-side", false, 300, 0.0, 3000.0, VarManager::kNTPCpileupContribA); hm->AddHistogram(histClass, "TPCpileupNcontribC", "TPC pileup n-contributors, C-side", false, 300, 0.0, 3000.0, VarManager::kNTPCpileupContribC); + hm->AddHistogram(histClass, "TPCoccupContribLongA", "TPC occupancy from pileup, n-contrib, A-side, long time range", false, 100, 0.0, 10000.0, VarManager::kNTPCcontribLongA); + hm->AddHistogram(histClass, "TPCoccupContribLongAvsTime", "TPC occupancy from pileup, n-contrib, A-side, long time range", true, 1000, 0.0, 1000.0, VarManager::kTimeFromSOR, 10, 0.0, 10000.0, VarManager::kNTPCcontribLongA); + hm->AddHistogram(histClass, "TPCoccupContribLongAvsContribPV", "TPC occupancy from pileup, n-contrib, A-side, long time range, vs n.contrib", false, 100, 0.0, 5000.0, VarManager::kVtxNcontribReal, 100, 0.0, 10000.0, VarManager::kNTPCcontribLongA); + hm->AddHistogram(histClass, "TPCoccupContribLongC", "TPC occupancy from pileup, n-contrib, C-side, long time range", false, 100, 0.0, 10000.0, VarManager::kNTPCcontribLongC); + hm->AddHistogram(histClass, "TPCoccupContribLongCvsTime", "TPC occupancy from pileup, n-contrib, C-side, long time range", true, 1000, 0.0, 1000.0, VarManager::kTimeFromSOR, 10, 0.0, 10000.0, VarManager::kNTPCcontribLongC); + hm->AddHistogram(histClass, "TPCoccupContribLongCvsContribPV", "TPC occupancy from pileup, n-contrib, C-side, long time range, vs n.contrib", false, 100, 0.0, 5000.0, VarManager::kVtxNcontribReal, 100, 0.0, 10000.0, VarManager::kNTPCcontribLongC); + hm->AddHistogram(histClass, "TPCoccupContribLongAvsC", "TPC occupancy from pileup, n-contrib, A-side vs C-side, long time range", false, 100, 0.0, 10000.0, VarManager::kNTPCcontribLongA, 100, 0.0, 10000.0, VarManager::kNTPCcontribLongC); + hm->AddHistogram(histClass, "TPCoccupMeanTimeLongA", "TPC occupancy from pileup, mean time, A-side, long time range", false, 100, -100.0, 100.0, VarManager::kNTPCmeanTimeLongA); + hm->AddHistogram(histClass, "TPCoccupMeanTimeLongC", "TPC occupancy from pileup, mean time, C-side, long time range", false, 100, -100.0, 100.0, VarManager::kNTPCmeanTimeLongC); + hm->AddHistogram(histClass, "TPCoccupMeanTimeLongAvsC", "TPC occupancy from pileup, mean time, A-side vs C-side, long time range", false, 100, -100.0, 100.0, VarManager::kNTPCmeanTimeLongA, 100, -100.0, 100.0, VarManager::kNTPCmeanTimeLongC); + hm->AddHistogram(histClass, "TPCoccupMedianTimeLongA", "TPC occupancy from pileup, median time, A-side, long time range", false, 100, -100.0, 100.0, VarManager::kNTPCmedianTimeLongA); + hm->AddHistogram(histClass, "TPCoccupMedianTimeLongC", "TPC occupancy from pileup, median time, C-side, long time range", false, 100, -100.0, 100.0, VarManager::kNTPCmedianTimeLongC); + hm->AddHistogram(histClass, "TPCoccupMedianTimeLongAvsC", "TPC occupancy from pileup, median time, A-side vs C-side, long time range", false, 100, -100.0, 100.0, VarManager::kNTPCmedianTimeLongA, 100, -100.0, 100.0, VarManager::kNTPCmedianTimeLongC); + hm->AddHistogram(histClass, "TPCoccupContribShortA", "TPC occupancy from pileup, n-contrib, A-side, short time range", false, 100, 0.0, 7000.0, VarManager::kNTPCcontribShortA); + hm->AddHistogram(histClass, "TPCoccupContribShortAvsTime", "TPC occupancy from pileup, n-contrib, A-side, short time range", true, 1000, 0.0, 1000.0, VarManager::kTimeFromSOR, 10, 0.0, 10000.0, VarManager::kNTPCcontribShortA); + hm->AddHistogram(histClass, "TPCoccupContribShortAvsContribPV", "TPC occupancy from pileup, n-contrib, A-side, short time range, vs n.contrib", false, 100, 0.0, 5000.0, VarManager::kVtxNcontribReal, 100, 0.0, 7000.0, VarManager::kNTPCcontribShortA); + hm->AddHistogram(histClass, "TPCoccupContribShortC", "TPC occupancy from pileup, n-contrib, C-side, short time range", false, 100, 0.0, 7000.0, VarManager::kNTPCcontribShortC); + hm->AddHistogram(histClass, "TPCoccupContribShortCvsTime", "TPC occupancy from pileup, n-contrib, C-side, short time range", true, 1000, 0.0, 1000.0, VarManager::kTimeFromSOR, 10, 0.0, 10000.0, VarManager::kNTPCcontribShortC); + hm->AddHistogram(histClass, "TPCoccupContribShortAvsC", "TPC occupancy from pileup, n-contrib, A-side vs C-side, short time range", false, 100, 0.0, 7000.0, VarManager::kNTPCcontribShortA, 100, 0.0, 7000.0, VarManager::kNTPCcontribShortC); + hm->AddHistogram(histClass, "TPCoccupContribShortCvsContribPV", "TPC occupancy from pileup, n-contrib, C-side, short time range, vs n.contrib", false, 100, 0.0, 5000.0, VarManager::kVtxNcontribReal, 100, 0.0, 7000.0, VarManager::kNTPCcontribShortC); + hm->AddHistogram(histClass, "TPCoccupMeanTimeShortA", "TPC occupancy from pileup, mean time, A-side, short time range", false, 100, -20.0, 20.0, VarManager::kNTPCmeanTimeShortA); + hm->AddHistogram(histClass, "TPCoccupMeanTimeShortC", "TPC occupancy from pileup, mean time, C-side, short time range", false, 100, -20.0, 20.0, VarManager::kNTPCmeanTimeShortC); + hm->AddHistogram(histClass, "TPCoccupMeanTimeShortAvsC", "TPC occupancy from pileup, mean time, A-side vs C-side, short time range", false, 100, -20.0, 20.0, VarManager::kNTPCmeanTimeShortA, 100, -20.0, 20.0, VarManager::kNTPCmeanTimeShortC); + hm->AddHistogram(histClass, "TPCoccupMedianTimeShortA", "TPC occupancy from pileup, median time, A-side, short time range", false, 100, -20.0, 20.0, VarManager::kNTPCmedianTimeShortA); + hm->AddHistogram(histClass, "TPCoccupMedianTimeShortC", "TPC occupancy from pileup, median time, C-side, short time range", false, 100, -20.0, 20.0, VarManager::kNTPCmedianTimeShortC); + hm->AddHistogram(histClass, "TPCoccupMedianTimeShortAvsC", "TPC occupancy from pileup, median time, A-side vs C-side, short time range", false, 100, -20.0, 20.0, VarManager::kNTPCmedianTimeShortA, 100, -20.0, 20.0, VarManager::kNTPCmedianTimeShortC); } } if (subGroupStr.Contains("ftmulpbpb")) { @@ -228,11 +265,20 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Psi2A", "", false, 100, -2.0, 2.0, VarManager::kPsi2A); hm->AddHistogram(histClass, "Psi2B", "", false, 100, -2.0, 2.0, VarManager::kPsi2B); hm->AddHistogram(histClass, "Psi2C", "", false, 100, -2.0, 2.0, VarManager::kPsi2C); - hm->AddHistogram(histClass, "Psi2A_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -2.0, 2.0, VarManager::kPsi2A); - hm->AddHistogram(histClass, "Psi2B_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -2.0, 2.0, VarManager::kPsi2B); - hm->AddHistogram(histClass, "Psi2C_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -2.0, 2.0, VarManager::kPsi2C); - hm->AddHistogram(histClass, "centrFT0C_Corr2REF_ev", "", true, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -1.0, 1.0, VarManager::kCORR2REF, VarManager::kM11REF); - hm->AddHistogram(histClass, "centrFT0C_Corr4REF_ev", "", true, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -1.0, 1.0, VarManager::kCORR4REF, VarManager::kM1111REF); + hm->AddHistogram(histClass, "Psi2A_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 100, -2.0, 2.0, VarManager::kPsi2A); + hm->AddHistogram(histClass, "Psi2B_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 100, -2.0, 2.0, VarManager::kPsi2B); + hm->AddHistogram(histClass, "Psi2C_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 100, -2.0, 2.0, VarManager::kPsi2C); + hm->AddHistogram(histClass, "centrFT0C_Corr2REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 250, -1.0, 1.0, VarManager::kCORR2REF, VarManager::kM11REF); + hm->AddHistogram(histClass, "centrFT0C_Corr2REFetagap_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 250, -1.0, 1.0, VarManager::kCORR2REFetagap, VarManager::kM11REFetagap); + hm->AddHistogram(histClass, "centrFT0C_Corr4REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 250, -1.0, 1.0, VarManager::kCORR4REF, VarManager::kM1111REF); + hm->AddHistogram(histClass, "centrFT0C_Corr2Corr4REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 250, -1.0, 1.0, VarManager::kCORR2CORR4REF, VarManager::kM11M1111REF); + hm->AddHistogram(histClass, "Run2_centrFT0C_Corr2REF_ev", "", true, 9, std::array{0.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0}.data(), VarManager::kCentFT0C, 250, std::array{-1.0, 1.0}.data(), VarManager::kCORR2REF, 0, nullptr, -1, "", "", "", VarManager::kCORR2REF, VarManager::kM11REF); + hm->AddHistogram(histClass, "Run2_centrFT0C_Corr2REFetagap_ev", "", true, 9, std::array{0.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0}.data(), VarManager::kCentFT0C, 250, std::array{-1.0, 1.0}.data(), VarManager::kCORR2REFetagap, 0, nullptr, -1, "", "", "", VarManager::kCORR2REFetagap, VarManager::kM11REFetagap); + hm->AddHistogram(histClass, "Run2_centrFT0C_Corr4REF_ev", "", true, 9, std::array{0.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0}.data(), VarManager::kCentFT0C, 250, std::array{-1.0, 1.0}.data(), VarManager::kCORR4REF, 0, nullptr, -1, "", "", "", VarManager::kCORR4REF, VarManager::kM1111REF); + hm->AddHistogram(histClass, "Run2_centrFT0C_Corr2Corr4REF_ev", "", true, 9, std::array{0.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0}.data(), VarManager::kCentFT0C, 250, std::array{-1.0, 1.0}.data(), VarManager::kCORR2CORR4REF, 0, nullptr, -1, "", "", "", VarManager::kCORR2CORR4REF, VarManager::kM11M1111REF); + hm->AddHistogram(histClass, "centrFT0C_M11REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 1000000.0, VarManager::kM11REF); + hm->AddHistogram(histClass, "centrFT0C_M11etagap_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 10000000.0, VarManager::kM11REFetagap); + hm->AddHistogram(histClass, "centrFT0C_M1111REF_ev", "", true, 100, 0.0, 100.0, VarManager::kCentFT0C, 1000, 0.0, 100000000000000.0, VarManager::kM1111REF); if (subGroupStr.Contains("cross")) { hm->AddHistogram(histClass, "Q1ZNACXX_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 4000, -2, 2, VarManager::kQ1ZNACXX); hm->AddHistogram(histClass, "Q1ZNACYY_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 4000, -2, 2, VarManager::kQ1ZNACYY); @@ -280,23 +326,37 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "R2EP_TPCFT0A_CentV0M", "", false, 18, 0.0, 90.0, VarManager::kCentVZERO, 500, -10.0, 10.0, VarManager::kR2EP_AB); hm->AddHistogram(histClass, "R2EP_TPCFT0C_CentV0M", "", false, 18, 0.0, 90.0, VarManager::kCentVZERO, 500, -10.0, 10.0, VarManager::kR2EP_AC); hm->AddHistogram(histClass, "R2EP_FT0CFT0A_CentV0M", "", false, 18, 0.0, 90.0, VarManager::kCentVZERO, 500, -10.0, 10.0, VarManager::kR2EP_BC); - hm->AddHistogram(histClass, "R2SP_TPCFT0A_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_AB); - hm->AddHistogram(histClass, "R2SP_TPCFT0C_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_AC); - hm->AddHistogram(histClass, "R2SP_FT0AFT0C_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_BC); + hm->AddHistogram(histClass, "R2SP_TPCFT0A_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_AB); + hm->AddHistogram(histClass, "R2SP_TPCFT0C_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_AC); + hm->AddHistogram(histClass, "R2SP_FT0AFT0C_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_BC); hm->AddHistogram(histClass, "R2SP_FT0CTPCPOS_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_FT0CTPCPOS); hm->AddHistogram(histClass, "R2SP_FT0CTPCNEG_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_FT0CTPCNEG); hm->AddHistogram(histClass, "R2SP_FT0ATPCPOS_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_FT0ATPCPOS); hm->AddHistogram(histClass, "R2SP_FT0ATPCNEG_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2SP_FT0ATPCNEG); hm->AddHistogram(histClass, "R3SP_CentFT0C", "", true, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR3SP); - hm->AddHistogram(histClass, "R2EP_TPCFT0A_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_AB); - hm->AddHistogram(histClass, "R2EP_TPCFT0C_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_AC); - hm->AddHistogram(histClass, "R2EP_FT0CFT0A_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_BC); + hm->AddHistogram(histClass, "R2EP_TPCFT0A_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_AB); + hm->AddHistogram(histClass, "R2EP_TPCFT0C_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_AC); + hm->AddHistogram(histClass, "R2EP_FT0CFT0A_CentFT0C", "", false, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_BC); hm->AddHistogram(histClass, "R2EP_FT0CTPCPOS_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_FT0CTPCPOS); hm->AddHistogram(histClass, "R2EP_FT0CTPCNEG_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_FT0CTPCNEG); hm->AddHistogram(histClass, "R2EP_FT0ATPCPOS_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_FT0ATPCPOS); hm->AddHistogram(histClass, "R2EP_FT0ATPCNEG_CentFT0C", "", false, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR2EP_FT0ATPCNEG); hm->AddHistogram(histClass, "R3EP_CentFT0C", "", true, 18, 0.0, 90.0, VarManager::kCentFT0C, 500, -10.0, 10.0, VarManager::kR3EP); } + if (subGroupStr.Contains("reso-profile")) { + hm->AddHistogram(histClass, "Profile_R2SP_TPCFT0A_CentFT0C", "Profile_R2SP_TPCFT0A_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2SP_AB, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2SP_AB); + hm->AddHistogram(histClass, "Profile_R2SP_TPCFT0C_CentFT0C", "Profile_R2SP_TPCFT0C_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2SP_AC, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2SP_AC); + hm->AddHistogram(histClass, "Profile_R2SP_FT0AFT0C_CentFT0C", "Profile_R2SP_FT0AFT0C_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2SP_BC, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2SP_BC); + hm->AddHistogram(histClass, "Profile_R2EP_TPCFT0A_CentFT0C", "Profile_R2EP_TPCFT0A_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2EP_AB, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2EP_AB); + hm->AddHistogram(histClass, "Profile_R2EP_TPCFT0C_CentFT0C", "Profile_R2EP_TPCFT0C_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2EP_AC, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2EP_AC); + hm->AddHistogram(histClass, "Profile_R2EP_FT0AFT0C_CentFT0C", "Profile_R2EP_FT0AFT0C_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2EP_BC, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2EP_BC); + hm->AddHistogram(histClass, "Profile_R2SP_Im_TPCFT0A_CentFT0C", "Profile_R2SP_Im_TPCFT0A_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2SP_AB_Im, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2SP_AB_Im); + hm->AddHistogram(histClass, "Profile_R2SP_Im_TPCFT0C_CentFT0C", "Profile_R2SP_Im_TPCFT0C_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2SP_AC_Im, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2SP_AC_Im); + hm->AddHistogram(histClass, "Profile_R2SP_Im_FT0AFT0C_CentFT0C", "Profile_R2SP_Im_FT0AFT0C_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2SP_BC_Im, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2SP_BC_Im); + hm->AddHistogram(histClass, "Profile_R2EP_Im_TPCFT0A_CentFT0C", "Profile_R2EP_Im_TPCFT0A_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2EP_AB_Im, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2EP_AB_Im); + hm->AddHistogram(histClass, "Profile_R2EP_Im_TPCFT0C_CentFT0C", "Profile_R2EP_Im_TPCFT0C_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2EP_AC_Im, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2EP_AC_Im); + hm->AddHistogram(histClass, "Profile_R2EP_Im_FT0AFT0C_CentFT0C", "Profile_R2EP_Im_FT0AFT0C_CentFT0C", true, 90, 0.0, 90.0, VarManager::kCentFT0C, 500, 0.0, 5.0, VarManager::kR2EP_BC_Im, 0, 0, 0, -1, "", "", "", -1, VarManager::kWR2EP_BC_Im); + } if (subGroupStr.Contains("filter")) { hm->AddHistogram(histClass, "IsDoubleGap", "Is double gap", false, 2, -0.5, 1.5, VarManager::kIsDoubleGap); hm->AddHistogram(histClass, "IsSingleGapA", "Is single gap on side A", false, 2, -0.5, 1.5, VarManager::kIsSingleGapA); @@ -324,8 +384,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (!groupStr.CompareTo("track")) { hm->AddHistogram(histClass, "Pt", "p_{T} distribution", false, 2000, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Eta", "#eta distribution", false, 500, -5.0, 5.0, VarManager::kEta); - hm->AddHistogram(histClass, "Phi", "#varphi distribution", false, 500, -2. * TMath::Pi(), 2. * TMath::Pi(), VarManager::kPhi); - hm->AddHistogram(histClass, "Phi_Pt", "#varphi distribution", false, 50, 0.0, 10.0, VarManager::kPt, 720, 0.0, TMath::TwoPi(), VarManager::kPhi); + hm->AddHistogram(histClass, "Phi", "#varphi distribution", false, 500, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi); + hm->AddHistogram(histClass, "Phi_Pt", "#varphi distribution", false, 50, 0.0, 10.0, VarManager::kPt, 720, 0.0, o2::constants::math::TwoPI, VarManager::kPhi); hm->AddHistogram(histClass, "IsPVcontrib_pt", "is PV contributor vs pt", false, 50, 0.0, 50.0, VarManager::kPt, 2, -0.5, 1.5, VarManager::kPVContributor); hm->AddHistogram(histClass, "IsPVcontrib_pt_prof", "is PV contributor vs pt", true, 50, 0.0, 50.0, VarManager::kPt, 2, -0.5, 1.5, VarManager::kPVContributor); if (subGroupStr.Contains("ambiguity") && !subGroupStr.Contains("muon")) { @@ -337,10 +397,10 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (subGroupStr.Contains("cent")) { hm->AddHistogram(histClass, "Pt_CentFT0C", "p_{T} distribution", false, 2000, 0.0, 20.0, VarManager::kPt, 20, 0.0, 100.0, VarManager::kCentFT0C); hm->AddHistogram(histClass, "Eta_CentFT0C", "#eta distribution", false, 500, -5.0, 5.0, VarManager::kEta, 20, 0.0, 100.0, VarManager::kCentFT0C); - hm->AddHistogram(histClass, "Phi_CentFT0C", "#varphi distribution", false, 500, -2. * TMath::Pi(), 2. * TMath::Pi(), VarManager::kPhi, 20, 0.0, 100.0, VarManager::kCentFT0C); + hm->AddHistogram(histClass, "Phi_CentFT0C", "#varphi distribution", false, 500, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi, 20, 0.0, 100.0, VarManager::kCentFT0C); } if (subGroupStr.Contains("kine")) { - hm->AddHistogram(histClass, "Phi_Eta", "#phi vs #eta distribution", false, 200, -5.0, 5.0, VarManager::kEta, 200, -2. * TMath::Pi(), 2. * TMath::Pi(), VarManager::kPhi); + hm->AddHistogram(histClass, "Phi_Eta", "#phi vs #eta distribution", false, 200, -5.0, 5.0, VarManager::kEta, 200, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi); hm->AddHistogram(histClass, "Eta_Pt", "", false, 20, -1.0, 1.0, VarManager::kEta, 100, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Eta_VtxZ", "", false, 100, -1.0, 1.0, VarManager::kEta, 300, -15.0, 15.0, VarManager::kVtxZ); hm->AddHistogram(histClass, "Px", "p_{x} distribution", false, 200, 0.0, 20.0, VarManager::kPx); @@ -399,10 +459,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (subGroupStr.Contains("tpc")) { hm->AddHistogram(histClass, "TPCncls", "Number of cluster in TPC", false, 160, -0.5, 159.5, VarManager::kTPCncls); hm->AddHistogram(histClass, "TPCncls_vsTimeFromSOR", "Number of cluster in TPC vs time from SOR", true, 10000, 0.0, 1000., VarManager::kTimeFromSOR, 160, -0.5, 159.5, VarManager::kTPCncls); - hm->AddHistogram(histClass, "TPCncls_Phi", "Number of cluster in TPC vs #varphi", true, 720, 0.0, TMath::TwoPi(), VarManager::kPhi, 10, 0.0, 200.0, VarManager::kTPCncls); - hm->AddHistogram(histClass, "TPCncls_PhiPt", "Number of cluster in TPC vs p_{T} and #varphi", true, 20, 0.0, 10.0, VarManager::kPt, 720, 0.0, TMath::TwoPi(), VarManager::kPhi, 10, 0.0, 200.0, VarManager::kTPCncls); - hm->AddHistogram(histClass, "TPCncls_Run", "Number of cluster in TPC", true, (VarManager::GetNRuns() > 0 ? VarManager::GetNRuns() : 1), 0.5, 0.5 + VarManager::GetNRuns(), VarManager::kRunId, - 10, -0.5, 159.5, VarManager::kTPCncls, 10, 0., 1., VarManager::kNothing, VarManager::GetRunStr().Data()); + hm->AddHistogram(histClass, "TPCncls_Phi", "Number of cluster in TPC vs #varphi", true, 720, 0.0, o2::constants::math::TwoPI, VarManager::kPhi, 10, 0.0, 200.0, VarManager::kTPCncls); + hm->AddHistogram(histClass, "TPCncls_PhiPt", "Number of cluster in TPC vs p_{T} and #varphi", true, 20, 0.0, 10.0, VarManager::kPt, 720, 0.0, o2::constants::math::TwoPI, VarManager::kPhi, 10, 0.0, 200.0, VarManager::kTPCncls); hm->AddHistogram(histClass, "TPCnclsCR", "Number of crossed rows in TPC", false, 160, -0.5, 159.5, VarManager::kTPCnclsCR); hm->AddHistogram(histClass, "TPCncls_TPCnclsCR", "Number of TPC cluster vs Number of crossed rows in TPC", false, 160, -0.5, 159.5, VarManager::kTPCncls, 160, -0.5, 159.5, VarManager::kTPCnclsCR); hm->AddHistogram(histClass, "IsTPCrefit", "", false, 2, -0.5, 1.5, VarManager::kIsTPCrefit); @@ -458,24 +516,33 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h } else { hm->AddHistogram(histClass, "TPCdedx_pIN", "TPC dE/dx vs pIN", false, 100, 0.0, 10.0, VarManager::kPin, 200, 0.0, 200., VarManager::kTPCsignal); hm->AddHistogram(histClass, "TPCnSigEle_pIN", "TPC n-#sigma(e) vs pIN", false, 100, 0.0, 10.0, VarManager::kPin, 100, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupancy", "TPC n-#sigma(e) vs occupancy", false, 200, 0., 20000., VarManager::kTrackOccupancyInTimeRange, 100, -5.0, 5.0, VarManager::kTPCnSigmaEl); hm->AddHistogram(histClass, "TPCnSigEle_timeFromSOR", "TPC n-#sigma(e) vs time from SOR", true, 10000, 0.0, 1000.0, VarManager::kTimeFromSOR, 10, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCcontribLongA", "TPC n-#sigma(e) vs pileup n-contrib, long time range A-side", false, 20, 0.0, 10000.0, VarManager::kNTPCcontribLongA, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCmeanTimeLongA", "TPC n-#sigma(e) vs pileup mean time, long time range, A-side", false, 20, -100.0, 100.0, VarManager::kNTPCmeanTimeLongA, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCmedianTimeLongA", "TPC n-#sigma(e) vs pileup mean time, long time range, A-side", false, 20, -100.0, 100.0, VarManager::kNTPCmedianTimeLongA, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCcontribShortA", "TPC n-#sigma(e) vs pileup n-contrib, short time range A-side", false, 50, 0.0, 10000.0, VarManager::kNTPCcontribShortA, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCmeanTimeShortA", "TPC n-#sigma(e) vs pileup mean time, short time range, A-side", false, 20, -15.0, 15.0, VarManager::kNTPCmeanTimeShortA, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCmedianTimeShortA", "TPC n-#sigma(e) vs pileup mean time, short time range, A-side", false, 20, -15.0, 15.0, VarManager::kNTPCmedianTimeShortA, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCcontribLongC", "TPC n-#sigma(e) vs pileup n-contrib, long time range C-side", false, 20, 0.0, 10000.0, VarManager::kNTPCcontribLongC, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCmeanTimeLongC", "TPC n-#sigma(e) vs pileup mean time, long time range, C-side", false, 20, -100.0, 100.0, VarManager::kNTPCmeanTimeLongC, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCmedianTimeLongC", "TPC n-#sigma(e) vs pileup mean time, long time range, C-side", false, 20, -100.0, 100.0, VarManager::kNTPCmedianTimeLongC, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCcontribShortC", "TPC n-#sigma(e) vs pileup n-contrib, short time range C-side", false, 50, 0.0, 10000.0, VarManager::kNTPCcontribShortC, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCmeanTimeShortC", "TPC n-#sigma(e) vs pileup mean time, short time range, C-side", false, 20, -15.0, 15.0, VarManager::kNTPCmeanTimeShortC, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); + hm->AddHistogram(histClass, "TPCnSigEle_occupTPCmedianTimeShortC", "TPC n-#sigma(e) vs pileup mean time, short time range, C-side", false, 20, -15.0, 15.0, VarManager::kNTPCmedianTimeShortC, 200, -5.0, 5.0, VarManager::kTPCnSigmaEl); hm->AddHistogram(histClass, "TPCnSigPi_pIN", "TPC n-#sigma(#pi) vs pIN", false, 100, 0.0, 10.0, VarManager::kPin, 100, -5.0, 5.0, VarManager::kTPCnSigmaPi); hm->AddHistogram(histClass, "TPCnSigPi_timeFromSOR", "TPC n-#sigma(#pi) vs time from SOR", true, 1000, 0.0, 1000.0, VarManager::kTimeFromSOR, 10, -5.0, 5.0, VarManager::kTPCnSigmaPi); hm->AddHistogram(histClass, "TPCnSigPi_eta", "TPC n-#sigma(#pi) vs #eta", false, 20, -1.0, 1.0, VarManager::kEta, 200, -5.0, 5.0, VarManager::kTPCnSigmaPi); hm->AddHistogram(histClass, "TPCnSigPi_etaPin_prof", " vs (#eta,p_{IN}), --s--", true, 20, -1.0, 1.0, VarManager::kEta, 20, 0.0, 10.0, VarManager::kPin, 10, -5.0, 5.0, VarManager::kTPCnSigmaPi); hm->AddHistogram(histClass, "TPCnSigPi_etaCent_prof", " vs (#eta,cent), --s--", true, 20, -1.0, 1.0, VarManager::kEta, 20, 0.0, 100.0, VarManager::kCentFT0C, 10, -5.0, 5.0, VarManager::kTPCnSigmaPi); hm->AddHistogram(histClass, "TPCnSigPi_etaContrib_prof", " vs (#eta,n-contrib real), --s--", true, 20, -1.0, 1.0, VarManager::kEta, 20, 0.0, 4000.0, VarManager::kVtxNcontribReal, 10, -5.0, 5.0, VarManager::kTPCnSigmaPi); - hm->AddHistogram(histClass, "TPCnSigPi_etaZA_prof", " vs (#eta,ZA), --s--", true, 20, -1.0, 1.0, VarManager::kEta, 30, -15.0, 15.0, VarManager::kNTPCpileupZA, 10, -5.0, 5.0, VarManager::kTPCnSigmaPi); - hm->AddHistogram(histClass, "TPCnSigPi_etaNZA_prof", " vs (#eta,NZA), --s--", true, 20, -1.0, 1.0, VarManager::kEta, 30, 0.0, 1500.0, VarManager::kNTPCpileupContribA, 10, -5.0, 5.0, VarManager::kTPCnSigmaPi); hm->AddHistogram(histClass, "TPCnSigPi_centFT0C", "TPC n-#sigma(#pi) vs centrality", false, 20, 0.0, 100.0, VarManager::kCentFT0C, 200, -5.0, 5.0, VarManager::kTPCnSigmaPi); - hm->AddHistogram(histClass, "TPCnSigPi_itsOccup", "TPC n-#sigma(#pi) vs vtx. contrib real", false, 50, 0.0, 4000.0, VarManager::kVtxNcontribReal, 200, -5.0, 5.0, VarManager::kTPCnSigmaPi); - hm->AddHistogram(histClass, "TPCnSigPi_pileupZA", "TPC n-#sigma(#pi) vs pileup ZA", false, 60, -15.0, 15.0, VarManager::kNTPCpileupZA, 200, -5.0, 5.0, VarManager::kTPCnSigmaPi); - hm->AddHistogram(histClass, "TPCnSigPi_pileupZC", "TPC n-#sigma(#pi) vs pileup ZC", false, 60, -15.0, 15.0, VarManager::kNTPCpileupZC, 200, -5.0, 5.0, VarManager::kTPCnSigmaPi); - hm->AddHistogram(histClass, "TPCnSigPi_pileupNA", "TPC n-#sigma(#pi) vs n.pileup contrib A", false, 60, 0.0, 1500.0, VarManager::kNTPCpileupContribA, 200, -5.0, 5.0, VarManager::kTPCnSigmaPi); - hm->AddHistogram(histClass, "TPCnSigPi_pileupNC", "TPC n-#sigma(#pi) vs n.pileup contrib C", false, 60, 0.0, 1500.0, VarManager::kNTPCpileupContribC, 200, -5.0, 5.0, VarManager::kTPCnSigmaPi); + hm->AddHistogram(histClass, "TPCnSigPi_vtxContrib", "TPC n-#sigma(#pi) vs vtx. contrib real", false, 50, 0.0, 4000.0, VarManager::kVtxNcontribReal, 200, -5.0, 5.0, VarManager::kTPCnSigmaPi); + hm->AddHistogram(histClass, "TPCnSigPi_occupancy", "TPC n-#sigma(#pi) vs occupancy", false, 200, 0., 20000., VarManager::kTrackOccupancyInTimeRange, 100, -5.0, 5.0, VarManager::kTPCnSigmaPi); hm->AddHistogram(histClass, "TPCnSigKa_pIN", "TPC n-#sigma(K) vs pIN", false, 100, 0.0, 10.0, VarManager::kPin, 100, -5.0, 5.0, VarManager::kTPCnSigmaKa); hm->AddHistogram(histClass, "TPCnSigPr_pIN", "TPC n-#sigma(p) vs pIN", false, 100, 0.0, 10.0, VarManager::kPin, 100, -5.0, 5.0, VarManager::kTPCnSigmaPr); hm->AddHistogram(histClass, "TPCnSigPr_timeFromSOR", "TPC n-#sigma(p) vs time from SOR", true, 10000, 0.0, 1000.0, VarManager::kTimeFromSOR, 10, -5.0, 5.0, VarManager::kTPCnSigmaPr); + hm->AddHistogram(histClass, "TPCnSigPr_occupancy", "TPC n-#sigma(p) vs. occupancy", false, 200, 0., 20000., VarManager::kTrackOccupancyInTimeRange, 100, -5.0, 5.0, VarManager::kTPCnSigmaPr); if (subGroupStr.Contains("tpcpid_Corr")) { hm->AddHistogram(histClass, "TPCnSigEl_Corr_pIN", "TPC n-#sigma(e) Corr. vs pIN", false, 100, 0.0, 10.0, VarManager::kPin, 100, -5.0, 5.0, VarManager::kTPCnSigmaEl_Corr); hm->AddHistogram(histClass, "TPCnSigPi_Corr_pIN", "TPC n-#sigma(#pi) Corr. vs pIN", false, 100, 0.0, 10.0, VarManager::kPin, 100, -5.0, 5.0, VarManager::kTPCnSigmaPi_Corr); @@ -491,8 +558,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h for (int i = 0; i <= kTPCnsigmaNbins; ++i) tpcNsigmaBinLims[i] = -7.0 + 0.2 * i; - const int kPinEleNbins = 18; - double pinEleBinLims[kPinEleNbins + 1] = {0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 8.0, 10.0, 15.0}; + const int kPinEleNbins = 20; + double pinEleBinLims[kPinEleNbins + 1] = {0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 8.0, 10.0, 12.0, 16.0, 20.0}; const int kEtaNbins = 9; double etaBinLimsI[kEtaNbins + 1] = {-0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9}; @@ -651,30 +718,15 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h } } if (subGroupStr.Contains("runbyrun")) { - hm->AddHistogram(histClass, "TPCncls_run", "Number of cluster in TPC vs RunNumber", false, (VarManager::GetNRuns() > 0 ? VarManager::GetNRuns() : 1), -0.5, -0.5 + VarManager::GetNRuns(), VarManager::kRunIndex, - 160, -0.5, 159.5, VarManager::kTPCncls, 10, 0., 1., VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "TPCdEdx_run", "TPCdEdx vs RunNumber", false, (VarManager::GetNRuns() > 0 ? VarManager::GetNRuns() : 1), -0.5, -0.5 + VarManager::GetNRuns(), VarManager::kRunIndex, - 300, 0., 300., VarManager::kTPCsignal, 10, 0., 1., VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "TPCchi2_run", "TPCchi2 vs RunNumber", false, (VarManager::GetNRuns() > 0 ? VarManager::GetNRuns() : 1), -0.5, -0.5 + VarManager::GetNRuns(), VarManager::kRunIndex, - 100, 0., 10., VarManager::kTPCchi2, 10, 0., 1., VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "Pt_Run", "p_{T} distribution", false, VarManager::GetDummyNRuns(), -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 2000, 0.0, 20.0, VarManager::kPt, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "ITSncls_Run", "Number of cluster in ITS", false, 100, -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 8, -0.5, 7.5, VarManager::kITSncls, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "ITSchi2_Run", "ITS chi2", false, VarManager::GetDummyNRuns(), -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 100, 0.0, 50.0, VarManager::kITSchi2, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "TPCncls_Run", "Number of cluster in TPC", false, 100, -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 160, -0.5, 159.5, VarManager::kTPCncls, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "TPCchi2_Run", "TPC chi2", false, VarManager::GetDummyNRuns(), -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 100, 0.0, 10.0, VarManager::kTPCchi2, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "TPCdedx_Run", "TPC dE/dx", false, VarManager::GetDummyNRuns(), -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 200, 0.0, 200., VarManager::kTPCsignal, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "TPCnSigEle_Run", "TPC n-#sigma(e)", false, 100, -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 100, -5.0, 5.0, VarManager::kTPCnSigmaEl, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "DCAxy_Run", "DCA_{xy}", false, VarManager::GetDummyNRuns(), -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 400, -2.0, 2.0, VarManager::kTrackDCAxy, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); - hm->AddHistogram(histClass, "DCAz_Run", "DCA_{z}", false, VarManager::GetDummyNRuns(), -0.5 + VarManager::GetDummyFirst(), 0.5 + VarManager::GetDummyLast(), VarManager::kRunNo, - 800, -4.0, 4.0, VarManager::kTrackDCAz, 1, 0, 1, VarManager::kNothing, VarManager::GetRunStr().Data()); + hm->AddHistogram(histClass, "TPCncls_Run", "Number of cluster in TPC vs RunNumber", true, 1, -0.5, 0.5, VarManager::kRunNo, 160, -0.5, 159.5, VarManager::kTPCncls, 1, 0., 1., VarManager::kNothing, "", "", "", -1, -1, false, true); + hm->AddHistogram(histClass, "TPCdEdx_Run", "TPCdEdx vs RunNumber", true, 1, -0.5, 0.5, VarManager::kRunNo, 300, 0., 300., VarManager::kTPCsignal, 1, 0., 1., VarManager::kNothing, "", "", "", -1, -1, false, true); + hm->AddHistogram(histClass, "TPCchi2_Run", "TPCchi2 vs RunNumber", true, 1, -0.5, 0.5, VarManager::kRunNo, 100, 0., 10., VarManager::kTPCchi2, 1, 0., 1., VarManager::kNothing, "", "", "", -1, -1, false, true); + hm->AddHistogram(histClass, "Pt_Run", "p_{T} distribution", true, 1, -0.5, 0.5, VarManager::kRunNo, 2000, 0.0, 20.0, VarManager::kPt, 1, 0, 1, VarManager::kNothing, "", "", "", -1, -1, false, true); + hm->AddHistogram(histClass, "ITSncls_Run", "Number of cluster in ITS", true, 1, -0.5, 0.5, VarManager::kRunNo, 8, -0.5, 7.5, VarManager::kITSncls, 1, 0, 1, VarManager::kNothing, "", "", "", -1, -1, false, true); + hm->AddHistogram(histClass, "ITSchi2_Run", "ITS chi2", true, 1, -0.5, 0.5, VarManager::kRunNo, 100, 0.0, 50.0, VarManager::kITSchi2, 1, 0, 1, VarManager::kNothing, "", "", "", -1, -1, false, true); + hm->AddHistogram(histClass, "TPCnSigEle_Run", "TPC n-#sigma(e)", true, 1, -0.5, 0.5, VarManager::kRunNo, 100, -5.0, 5.0, VarManager::kTPCnSigmaEl, 1, 0, 1, VarManager::kNothing, "", "", "", -1, -1, false, true); + hm->AddHistogram(histClass, "DCAxy_Run", "DCA_{xy}", true, 1, -0.5, 0.5, VarManager::kRunNo, 100, -1.0, 1.0, VarManager::kTrackDCAxy, 1, 0, 1, VarManager::kNothing, "", "", "", -1, -1, false, true); + hm->AddHistogram(histClass, "DCAz_Run", "DCA_{z}", true, 1, -0.5, 0.5, VarManager::kRunNo, 100, -1.0, 1.0, VarManager::kTrackDCAz, 1, 0, 1, VarManager::kNothing, "", "", "", -1, -1, false, true); } if (subGroupStr.Contains("dca")) { hm->AddHistogram(histClass, "DCAxy", "DCA_{xy}", false, 400, -2.0, 2.0, VarManager::kTrackDCAxy); @@ -727,13 +779,18 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "MCHBitMap_vs_pt", "MCH vs pt", false, 1025, 0.0, 1025.0, VarManager::kMCHBitMap, 400, 0, 100, VarManager::kPt); hm->AddHistogram(histClass, "MuonTime", "", false, 100, -1.0, 1.0, VarManager::kMuonTime); hm->AddHistogram(histClass, "MuonTimeRes", "", false, 100, -1.0, 1.0, VarManager::kMuonTimeRes); - hm->AddHistogram(histClass, "MuonDcaX_vs_phi", "", false, 2000, -20.0, 20.0, VarManager::kMuonDCAx, 200, -2. * TMath::Pi(), 2. * TMath::Pi(), VarManager::kPhi); - hm->AddHistogram(histClass, "MuonDcaY_vs_phi", "", false, 2000, -20.0, 20.0, VarManager::kMuonDCAy, 200, -2. * TMath::Pi(), 2. * TMath::Pi(), VarManager::kPhi); + hm->AddHistogram(histClass, "MuonDcaX_vs_phi", "", false, 2000, -20.0, 20.0, VarManager::kMuonDCAx, 200, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi); + hm->AddHistogram(histClass, "MuonDcaY_vs_phi", "", false, 2000, -20.0, 20.0, VarManager::kMuonDCAy, 200, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi); hm->AddHistogram(histClass, "MuonDcaX_vs_eta", "", false, 2000, -20.0, 20.0, VarManager::kMuonDCAx, 500, -5.0, 5.0, VarManager::kEta); hm->AddHistogram(histClass, "MuonDcaY_vs_eta", "", false, 2000, -20.0, 20.0, VarManager::kMuonDCAy, 500, -5.0, 5.0, VarManager::kEta); } else { + hm->AddHistogram(histClass, "Pt", "p_{T} distribution", false, 2000, 0.0, 20.0, VarManager::kPt); + hm->AddHistogram(histClass, "Eta", "#eta distribution", false, 500, -5.0, 5.0, VarManager::kEta); + hm->AddHistogram(histClass, "Phi", "#varphi distribution", false, 500, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi); hm->AddHistogram(histClass, "AmbiguityInBunch", "", false, 10, 0.0, 10., VarManager::kMuonNAssocsInBunch); hm->AddHistogram(histClass, "AmbiguityOutOfBunch", "", false, 10, 0.0, 10., VarManager::kMuonNAssocsOutOfBunch); + hm->AddHistogram(histClass, "AmbiguityInBunch_pt", "in bunch collision ambiguity vs p_{T}", false, 50, 0.0, 10.0, VarManager::kPt, 10, 0., 10., VarManager::kMuonNAssocsInBunch); + hm->AddHistogram(histClass, "AmbiguityOutOfBunch_pt", "out of bunch collision ambiguity vs p_{T}", false, 50, 0.0, 10.0, VarManager::kPt, 10, 0., 10., VarManager::kMuonNAssocsOutOfBunch); } } @@ -742,8 +799,6 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "pdca_vs_p", "pDCA vs p", false, 2000, 0.0, 20.0, VarManager::kP, 200, 0.0, 1000., VarManager::kMuonPDca); hm->AddHistogram(histClass, "pdca_vs_pt", "pDCA vs pt", false, 2000, 0.0, 20.0, VarManager::kPt, 200, 0.0, 1000., VarManager::kMuonPDca); hm->AddHistogram(histClass, "pdca_vs_Rabs", "pDCA vs R_{abs}", false, 100, 0., 200., VarManager::kMuonRAtAbsorberEnd, 200, 0.0, 1000., VarManager::kMuonPDca); - hm->AddHistogram(histClass, "pdca_vs_Rabs_vs_p", "pDCA vs R_{abs} vs p", false, 2000, 0.0, 20.0, VarManager::kP, 100, 0., 200., VarManager::kMuonRAtAbsorberEnd, 200, 0.0, 1000., VarManager::kMuonPDca); - hm->AddHistogram(histClass, "pdca_vs_Rabs_vs_pt", "pDCA vs R_{abs} vs pt", false, 2000, 0.0, 20.0, VarManager::kPt, 100, 0., 200., VarManager::kMuonRAtAbsorberEnd, 200, 0.0, 1000., VarManager::kMuonPDca); } if (subGroupStr.Contains("mft-pid")) { hm->AddHistogram(histClass, "hMftTrackEtaVsPt", "", false, 100, -5.f, -2.f, VarManager::kEta, 100, 0.f, 20.f, VarManager::kPt); @@ -754,7 +809,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (subGroupStr.Contains("mc")) { hm->AddHistogram(histClass, "Pt_vs_PtMC", "pT vs MC pT", false, 200, 0.0, 20.0, VarManager::kPt, 200, 0.0, 20.0, VarManager::kMCPt); hm->AddHistogram(histClass, "Eta_vs_EtaMC", "#eta vs MC #eta", false, 50, -1.0, 1.0, VarManager::kEta, 50, -1.0, 1.0, VarManager::kMCEta); - hm->AddHistogram(histClass, "Phi_vs_PhiMC", "#varphi vs MC #varphi", false, 50, 0.0, 2. * TMath::Pi(), VarManager::kPhi, 50, 0.0, 2. * TMath::Pi(), VarManager::kMCPhi); + hm->AddHistogram(histClass, "Phi_vs_PhiMC", "#varphi vs MC #varphi", false, 50, 0.0, 2. * o2::constants::math::PI, VarManager::kPhi, 50, 0.0, 2. * o2::constants::math::PI, VarManager::kMCPhi); hm->AddHistogram(histClass, "TrackPDGcode", "PDG code of track", false, 10001, -5000, 5000, VarManager::kMCPdgCode); } if (subGroupStr.Contains("mcmother")) { @@ -775,7 +830,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Eta_Pt_lepton1", "", false, 100, -2.0, 2.0, VarManager::kEta1, 200, 0.0, 20.0, VarManager::kPt1); hm->AddHistogram(histClass, "Eta_Pt_lepton2", "", false, 100, -2.0, 2.0, VarManager::kEta2, 200, 0.0, 20.0, VarManager::kPt2); hm->AddHistogram(histClass, "Eta_Pt_Photon", "", false, 100, -2.0, 2.0, VarManager::kEta, 200, 0.0, 20.0, VarManager::kPt); - hm->AddHistogram(histClass, "Phi_Eta", "#phi vs #eta distribution", false, 200, -5.0, 5.0, VarManager::kPairEta, 200, -2. * TMath::Pi(), 2. * TMath::Pi(), VarManager::kPairPhi); + hm->AddHistogram(histClass, "Phi_Eta", "#phi vs #eta distribution", false, 200, -5.0, 5.0, VarManager::kPairEta, 200, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPairPhi); hm->AddHistogram(histClass, "Mass_Dilepton", "", false, 4500, 0.0, 4.5, VarManager::kPairMassDau); hm->AddHistogram(histClass, "Mass_Photon", "", false, 500, 0.0, 0.1, VarManager::kMassDau); hm->AddHistogram(histClass, "Mass_Dilepton_Mass_Photon", "", false, 500, 0.0, 5.0, VarManager::kPairMassDau, 500, 0.0, 5.0, VarManager::kMassDau); @@ -797,7 +852,18 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Eta_Pt_lepton2", "", false, 100, -2.0, 2.0, VarManager::kEta2, 200, 0.0, 20.0, VarManager::kPt2); hm->AddHistogram(histClass, "Mass", "", false, 500, 0.0, 5.0, VarManager::kMass); hm->AddHistogram(histClass, "Eta_Pt", "", false, 40, -2.0, 2.0, VarManager::kEta, 200, 0.0, 20.0, VarManager::kPt); - hm->AddHistogram(histClass, "Phi_Eta", "#phi vs #eta distribution", false, 200, -5.0, 5.0, VarManager::kEta, 200, -2. * TMath::Pi(), 2. * TMath::Pi(), VarManager::kPhi); + hm->AddHistogram(histClass, "Phi_Eta", "#phi vs #eta distribution", false, 200, -5.0, 5.0, VarManager::kEta, 200, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi); + } + if (!groupStr.CompareTo("mctruth_quad")) { + hm->AddHistogram(histClass, "hMass_defaultDileptonMass", "", false, 1000, 3.0, 5.0, VarManager::kQuadDefaultDileptonMass); + hm->AddHistogram(histClass, "hPt", "", false, 150, 0.0, 15.0, VarManager::kQuadPt); + hm->AddHistogram(histClass, "hMass_defaultDileptonMass_Pt", "", false, 100, 3.0, 5.0, VarManager::kQuadDefaultDileptonMass, 150, 0.0, 15.0, VarManager::kQuadPt); + hm->AddHistogram(histClass, "hQ", "", false, 150, 0.0, 3.0, VarManager::kQ); + hm->AddHistogram(histClass, "hDeltaR1", "", false, 100, 0.0, 10.0, VarManager::kDeltaR1); + hm->AddHistogram(histClass, "hDeltaR2", "", false, 100, 0.0, 10.0, VarManager::kDeltaR2); + hm->AddHistogram(histClass, "hDiTrackMass", "", false, 300, 0.0, 3.0, VarManager::kDitrackMass); + hm->AddHistogram(histClass, "hMCPt_MCRap", "", false, 200, 0.0, 20.0, VarManager::kMCPt, 100, -2.0, 2.0, VarManager::kMCY); + hm->AddHistogram(histClass, "hMCPhi", "", false, 100, -TMath::Pi(), TMath::Pi(), VarManager::kMCPhi); } if (!groupStr.CompareTo("mctruth_track")) { hm->AddHistogram(histClass, "PtMC", "MC pT", false, 200, 0.0, 20.0, VarManager::kMCPt); @@ -842,12 +908,12 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (subGroupStr.Contains("polarization")) { hm->AddHistogram(histClass, "cosThetaHE", "", false, 100, -1., 1., VarManager::kCosThetaHE); hm->AddHistogram(histClass, "cosThetaCS", "", false, 100, -1., 1., VarManager::kCosThetaCS); - hm->AddHistogram(histClass, "PhiHE", "", false, 100, -TMath::Pi(), TMath::Pi(), VarManager::kPhiHE); - hm->AddHistogram(histClass, "PhiCS", "", false, 100, -TMath::Pi(), TMath::Pi(), VarManager::kPhiCS); + hm->AddHistogram(histClass, "PhiHE", "", false, 100, -o2::constants::math::PI, o2::constants::math::PI, VarManager::kPhiHE); + hm->AddHistogram(histClass, "PhiCS", "", false, 100, -o2::constants::math::PI, o2::constants::math::PI, VarManager::kPhiCS); hm->AddHistogram(histClass, "Mass_Pt_cosThetaHE", "", false, 100, 1.0, 5.0, VarManager::kMass, 250, 0.0, 25.0, VarManager::kPt, 40, -1., 1., VarManager::kCosThetaHE); hm->AddHistogram(histClass, "Mass_Pt_cosThetaCS", "", false, 100, 1.0, 5.0, VarManager::kMass, 250, 0.0, 25.0, VarManager::kPt, 40, -1., 1., VarManager::kCosThetaCS); - hm->AddHistogram(histClass, "Mass_Pt_PhiHE", "", false, 100, 1.0, 5.0, VarManager::kMass, 250, 0.0, 25.0, VarManager::kPt, 40, -TMath::Pi(), TMath::Pi(), VarManager::kPhiHE); - hm->AddHistogram(histClass, "Mass_Pt_PhiCS", "", false, 100, 1.0, 5.0, VarManager::kMass, 250, 0.0, 25.0, VarManager::kPt, 40, -TMath::Pi(), TMath::Pi(), VarManager::kPhiCS); + hm->AddHistogram(histClass, "Mass_Pt_PhiHE", "", false, 100, 1.0, 5.0, VarManager::kMass, 250, 0.0, 25.0, VarManager::kPt, 40, -o2::constants::math::PI, o2::constants::math::PI, VarManager::kPhiHE); + hm->AddHistogram(histClass, "Mass_Pt_PhiCS", "", false, 100, 1.0, 5.0, VarManager::kMass, 250, 0.0, 25.0, VarManager::kPt, 40, -o2::constants::math::PI, o2::constants::math::PI, VarManager::kPhiCS); } if (subGroupStr.Contains("upsilon")) { hm->AddHistogram(histClass, "MassUpsilon_Pt", "", false, 500, 7.0, 12.0, VarManager::kMass, 400, 0.0, 40.0, VarManager::kPt); @@ -984,49 +1050,44 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "U2Q2_CentFT0C_ev2", "mass vs. centrality vs. U2Q2_event2", false, 125, 0.0, 5.0, VarManager::kMass, 9, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kU2Q2Ev2); } if (subGroupStr.Contains("metest")) { - int var1[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kU2Q2Ev1, VarManager::kCos2DeltaPhiMu1}; - int var2[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kU2Q2Ev2, VarManager::kCos2DeltaPhiMu2}; - int bins[5] = {250, 60, 18, 100, 100}; - double minBins[5] = {0.0, 0.0, 0.0, -10., -1.0}; - double maxBins[5] = {5.0, 30.0, 90.0, 10., 1.0}; - hm->AddHistogram(histClass, "Mass_Pt_CentFT0C_U2Q2ev1_cos2DeltaPhiMu1", "", 5, var1, bins, minBins, maxBins, 0, -1, kTRUE); - hm->AddHistogram(histClass, "Mass_Pt_CentFT0C_U2Q2ev2_cos2DeltaPhiMu2", "", 5, var2, bins, minBins, maxBins, 0, -1, kTRUE); - hm->AddHistogram(histClass, "R2SPAB1_CentFT0C", "mass vs centrality vs. R2SPAB_event1", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2SP_AB1); - hm->AddHistogram(histClass, "R2SPAB2_CentFT0C", "mass vs centrality vs. R2SPAB_event2", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2SP_AB2); - hm->AddHistogram(histClass, "R2SPAC1_CentFT0C", "mass vs centrality vs. R2SPAC_event1", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2SP_AC1); - hm->AddHistogram(histClass, "R2SPAC2_CentFT0C", "mass vs centrality vs. R2SPAC_event2", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2SP_AC2); - hm->AddHistogram(histClass, "R2SPBC1_CentFT0C", "mass vs centrality vs. R2SPBC_event1", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2SP_BC1); - hm->AddHistogram(histClass, "R2SPBC2_CentFT0C", "mass vs centrality vs. R2SPBC_event2", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2SP_BC2); - hm->AddHistogram(histClass, "R2EPAB1_CentFT0C", "mass vs centrality vs. R2EPAB_event1", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2EP_AB1); - hm->AddHistogram(histClass, "R2EPAB2_CentFT0C", "mass vs centrality vs. R2EPAB_event2", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2EP_AB2); - hm->AddHistogram(histClass, "R2EPAC1_CentFT0C", "mass vs centrality vs. R2EPAC_event1", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2EP_AC1); - hm->AddHistogram(histClass, "R2EPAC2_CentFT0C", "mass vs centrality vs. R2EPAC_event2", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2EP_AC2); - hm->AddHistogram(histClass, "R2EPBC1_CentFT0C", "mass vs centrality vs. R2EPBC_event1", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2EP_BC1); - hm->AddHistogram(histClass, "R2EPBC2_CentFT0C", "mass vs centrality vs. R2EPBC_event2", false, 250, 0.0, 5.0, VarManager::kMass, 18, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kTwoR2EP_BC2); + hm->AddHistogram(histClass, "Mass_Pt_CentFT0C_V2ME_SP", "Mass_Pt_CentFT0C_V2ME_SP", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 90, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kV2ME_SP, VarManager::kWV2ME_SP); + hm->AddHistogram(histClass, "Mass_Pt_CentFT0C_V2ME_EP", "Mass_Pt_CentFT0C_V2ME_EP", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 90, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kV2ME_EP, VarManager::kWV2ME_EP); } if (subGroupStr.Contains("dimuon-polarization-he")) { int varspTHE[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaHE, VarManager::kPhiHE}; - int varsFT0CCentHE[4] = {VarManager::kMass, VarManager::kCentFT0C, VarManager::kCosThetaHE, VarManager::kPhiHE}; + int varsrapHE[4] = {VarManager::kMass, VarManager::kRap, VarManager::kCosThetaHE, VarManager::kPhiHE}; int binspT[4] = {100, 20, 20, 20}; - int binsCent[4] = {100, 20, 20, 20}; + int binsy[4] = {100, 10, 20, 20}; double xminpT[4] = {1., 0., -1., -3.14}; double xmaxpT[4] = {5., 20., 1., +3.14}; - double xminCent[4] = {1., 0., -1., -3.14}; - double xmaxCent[4] = {5., 100., 1., +3.14}; + double xminy[4] = {1., 2.5, -1., -3.14}; + double xmaxy[4] = {5., 4.0, 1., +3.14}; hm->AddHistogram(histClass, "Mass_Pt_cosThetaHE_phiHE", "", 4, varspTHE, binspT, xminpT, xmaxpT, 0, -1, kFALSE); - hm->AddHistogram(histClass, "Mass_CentFT0C_cosThetaHE_phiHE", "", 4, varsFT0CCentHE, binsCent, xminCent, xmaxCent, 0, -1, kFALSE); + hm->AddHistogram(histClass, "Mass_y_cosThetaHE_phiHE", "", 4, varsrapHE, binsy, xminy, xmaxy, 0, -1, kFALSE); } if (subGroupStr.Contains("dimuon-polarization-cs")) { int varspTCS[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaCS, VarManager::kPhiCS}; - int varsFT0CCentCS[4] = {VarManager::kMass, VarManager::kCentFT0C, VarManager::kCosThetaCS, VarManager::kPhiCS}; + int varsrapCS[4] = {VarManager::kMass, VarManager::kRap, VarManager::kCosThetaCS, VarManager::kPhiCS}; int binspT[4] = {100, 20, 20, 20}; - int binsCent[4] = {100, 20, 20, 20}; + int binsy[4] = {100, 10, 20, 20}; double xminpT[4] = {1., 0., -1., -3.14}; double xmaxpT[4] = {5., 20., 1., +3.14}; - double xminCent[4] = {1., 0., -1., -3.14}; - double xmaxCent[4] = {5., 100., 1., +3.14}; + double xminy[4] = {1., 2.5, -1., -3.14}; + double xmaxy[4] = {5., 4.0, 1., +3.14}; hm->AddHistogram(histClass, "Mass_Pt_cosThetaCS_phiCS", "", 4, varspTCS, binspT, xminpT, xmaxpT, 0, -1, kFALSE); - hm->AddHistogram(histClass, "Mass_CentFT0C_cosThetaCS_phiCS", "", 4, varsFT0CCentCS, binsCent, xminCent, xmaxCent, 0, -1, kFALSE); + hm->AddHistogram(histClass, "Mass_y_cosThetaCS_phiCS", "", 4, varsrapCS, binsy, xminy, xmaxy, 0, -1, kFALSE); + } + if (subGroupStr.Contains("dimuon-polarization-vp")) { + int varspTCS[3] = {VarManager::kMass, VarManager::kPt, VarManager::kPhiVP}; + int varsrapCS[3] = {VarManager::kMass, VarManager::kRap, VarManager::kPhiVP}; + int binspT[3] = {100, 20, 24}; + int binsy[3] = {100, 10, 24}; + double xminpT[3] = {1., 0., 0.}; + double xmaxpT[3] = {5., 20., +3.14}; + double xminy[3] = {1., 2.5, 0.}; + double xmaxy[3] = {5., 4.0, +3.14}; + hm->AddHistogram(histClass, "Mass_Pt_phiVP", "", 3, varspTCS, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + hm->AddHistogram(histClass, "Mass_y_phiVP", "", 3, varsrapCS, binsy, xminy, xmaxy, 0, -1, kFALSE); } if (subGroupStr.Contains("dimuon-rap")) { int vars[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kRap}; @@ -1063,6 +1124,20 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h double xmaxpT[5] = {1.2, 3., 100, 1., 3.14}; hm->AddHistogram(histClass, "Mass_Pt_Cent_cosThetaCS_lowmass", "", 5, varsCSpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } + if (subGroupStr.Contains("dimuon-polarization-vp-pbpb")) { + int varsHEpbpb[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kPhiVP}; + int binspT[4] = {150, 30, 10, 24}; + double xminpT[4] = {2., 0., 0, 0.}; + double xmaxpT[4] = {5., 3., 100, 3.14}; + hm->AddHistogram(histClass, "Mass_Pt_Cent_phiVP", "", 4, varsHEpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + } + if (subGroupStr.Contains("dimuon-polarization-lowmass-vp-pbpb")) { + int varsHEpbpb[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kPhiVP}; + int binspT[4] = {200, 30, 10, 24}; + double xminpT[4] = {0.2, 0., 0, 0.}; + double xmaxpT[4] = {1.2, 3., 100, 3.14}; + hm->AddHistogram(histClass, "Mass_Pt_Cent_phiVP_lowmass", "", 4, varsHEpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + } if (subGroupStr.Contains("dimuon-rap-polarization-he-pbpb")) { int varsHEpbpb[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kCosThetaHE, VarManager::kRap}; int binspT[5] = {150, 30, 10, 10, 6}; @@ -1077,23 +1152,41 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h double xmaxpT[5] = {5., 3., 100, 1., 4.0}; hm->AddHistogram(histClass, "Mass_Pt_Cent_cosThetaCS_Rap", "", 5, varsCSpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } - if (subGroupStr.Contains("multiplicity-fvoa")) { + if (subGroupStr.Contains("dimuon-midmult-polarization-he")) { + int varsITSTPCMulHE[4] = {VarManager::kMass, VarManager::kMultNTracksITSTPC, VarManager::kCosThetaHE, VarManager::kPhiHE}; + int varsITSMulHE[4] = {VarManager::kMass, VarManager::kMultNTracksHasITS, VarManager::kCosThetaHE, VarManager::kPhiHE}; + int binsMul[4] = {100, 20, 20, 20}; + double xminMul[4] = {1., 0., -1., -3.14}; + double xmaxMul[4] = {5., 120., 1., +3.14}; + hm->AddHistogram(histClass, "Mass_ITSTPCMult_cosThetaHE_phiHE", "", 4, varsITSTPCMulHE, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); + hm->AddHistogram(histClass, "Mass_ITSMult_cosThetaHE_phiHE", "", 4, varsITSMulHE, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); + } + if (subGroupStr.Contains("dimuon-midmult-polarization-cs")) { + int varsITSTPCMulCS[4] = {VarManager::kMass, VarManager::kMultNTracksITSTPC, VarManager::kCosThetaCS, VarManager::kPhiCS}; + int varsITSMulCS[4] = {VarManager::kMass, VarManager::kMultNTracksHasITS, VarManager::kCosThetaCS, VarManager::kPhiCS}; + int binsMul[4] = {100, 20, 20, 20}; + double xminMul[4] = {1., 0., -1., -3.14}; + double xmaxMul[4] = {5., 120., 1., +3.14}; + hm->AddHistogram(histClass, "Mass_ITSTPCMult_cosThetaCS_phiCS", "", 4, varsITSTPCMulCS, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); + hm->AddHistogram(histClass, "Mass_ITSMult_cosThetaCS_phiCS", "", 4, varsITSMulCS, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); + } + if (subGroupStr.Contains("dimuon-fwdmult-polarization-he")) { + int varsFT0AMulHE[4] = {VarManager::kMass, VarManager::kMultFT0A, VarManager::kCosThetaHE, VarManager::kPhiHE}; int varsFV0AMulHE[4] = {VarManager::kMass, VarManager::kMultFV0A, VarManager::kCosThetaHE, VarManager::kPhiHE}; - int varsFV0AMulCS[4] = {VarManager::kMass, VarManager::kMultFV0A, VarManager::kCosThetaCS, VarManager::kPhiCS}; int binsMul[4] = {100, 20, 20, 20}; double xminMul[4] = {1., 0., -1., -3.14}; - double xmaxMul[4] = {5., 5000., 1., +3.14}; - hm->AddHistogram(histClass, "Mass_MultFV0A_cosThetaHE_phiHE", "", 4, varsFV0AMulHE, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); - hm->AddHistogram(histClass, "Mass_MultFV0A_cosThetaCS_phiCS", "", 4, varsFV0AMulCS, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); + double xmaxMul[4] = {5., 3000., 1., +3.14}; + hm->AddHistogram(histClass, "Mass_FT0AMult_cosThetaHE_phiHE", "", 4, varsFT0AMulHE, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); + hm->AddHistogram(histClass, "Mass_FV0AMult_cosThetaHE_phiHE", "", 4, varsFV0AMulHE, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); } - if (subGroupStr.Contains("multiplicity-tpc")) { - int varsTPCMulHE[4] = {VarManager::kMass, VarManager::kMultTPC, VarManager::kCosThetaHE, VarManager::kPhiHE}; - int varsTPCMulCS[4] = {VarManager::kMass, VarManager::kMultTPC, VarManager::kCosThetaCS, VarManager::kPhiCS}; + if (subGroupStr.Contains("dimuon-fwdmult-polarization-cs")) { + int varsFT0AMulCS[4] = {VarManager::kMass, VarManager::kMultFT0A, VarManager::kCosThetaCS, VarManager::kPhiCS}; + int varsFV0AMulCS[4] = {VarManager::kMass, VarManager::kMultFV0A, VarManager::kCosThetaCS, VarManager::kPhiCS}; int binsMul[4] = {100, 20, 20, 20}; double xminMul[4] = {1., 0., -1., -3.14}; - double xmaxMul[4] = {5., 2000., 1., +3.14}; - hm->AddHistogram(histClass, "Mass_MultTPC_cosThetaCS_phiCS", "", 4, varsTPCMulCS, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); - hm->AddHistogram(histClass, "Mass_MultTPC_cosThetaHE_phiHE", "", 4, varsTPCMulHE, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); + double xmaxMul[4] = {5., 3000., 1., +3.14}; + hm->AddHistogram(histClass, "Mass_FT0AMult_cosThetaCS_phiCS", "", 4, varsFT0AMulCS, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); + hm->AddHistogram(histClass, "Mass_FV0AMult_cosThetaCS_phiCS", "", 4, varsFV0AMulCS, binsMul, xminMul, xmaxMul, 0, -1, kFALSE); } if (subGroupStr.Contains("vertexing-forward")) { hm->AddHistogram(histClass, "Lxyz", "", false, 100, 0.0, 10.0, VarManager::kVertexingLxyz); @@ -1120,7 +1213,9 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "MassLow", "", false, 400, 0.0, 2.0, VarManager::kMass); } if (subGroupStr.Contains("lmmumu")) { - hm->AddHistogram(histClass, "Mass_QuadDCAabsXY", "", false, 250, 0.0, 5.0, VarManager::kMass, 500, 0.0, 1, VarManager::kQuadDCAabsXY); + hm->AddHistogram(histClass, "Mass_QuadDCAabsXY", "", false, 250, 0.0, 5.0, VarManager::kMass, 900, 0.0, 3, VarManager::kQuadDCAabsXY); + hm->AddHistogram(histClass, "Mass_Lxyz", "", false, 250, 0.0, 5.0, VarManager::kMass, 1000, 0.0, 5, VarManager::kVertexingLxyz); + hm->AddHistogram(histClass, "Mass_OpeningAngle", "", false, 250, 0.0, 5.0, VarManager::kMass, 800, 0, 0.8, VarManager::kOpeningAngle); } if (subGroupStr.Contains("flow-dimuon")) { int varV2[6] = {VarManager::kMass, VarManager::kPt, VarManager::kRap, VarManager::kCentFT0C, VarManager::kU2Q2, VarManager::kCos2DeltaPhi}; @@ -1132,6 +1227,10 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_V2", "", 6, varV2, bins, minBins, maxBins, 0, -1, kTRUE); hm->AddHistogram(histClass, "Mass_Pt_centrFT0C_V3", "", 6, varV3, bins, minBins, maxBins, 0, -1, kTRUE); } + if (subGroupStr.Contains("flow-ccdb")) { + hm->AddHistogram(histClass, "Mass_Pt_CentFT0C_V2SPwR", "Mass_Pt_CentFT0C_V2SPwR", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 90, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kV2SP, VarManager::kWV2SP); + hm->AddHistogram(histClass, "Mass_Pt_CentFT0C_V2EPwR", "Mass_Pt_CentFT0C_V2EPwR", true, 250, 0.0, 5.0, VarManager::kMass, 60, 0.0, 30.0, VarManager::kPt, 90, 0.0, 90.0, VarManager::kCentFT0C, "", "", "", VarManager::kV2EP, VarManager::kWV2EP); + } if (subGroupStr.Contains("cumulant")) { int var[4] = {VarManager::kMass, VarManager::kPt, VarManager::kRap, VarManager::kCentFT0C}; int bins[4] = {250, 60, 6, 18}; @@ -1170,17 +1269,19 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "DeltaPhiPair", "", false, 130, -6.5, 6.5, VarManager::kDeltaPhiPair); } if (subGroupStr.Contains("correlation-emu")) { - hm->AddHistogram(histClass, "DeltaPhiPair2", "", false, 600, -0.5 * TMath::Pi(), 1.5 * TMath::Pi(), VarManager::kDeltaPhiPair2); + hm->AddHistogram(histClass, "DeltaPhiPair2", "", false, 600, -o2::constants::math::PIHalf, 1.5 * o2::constants::math::PI, VarManager::kDeltaPhiPair2); + hm->AddHistogram(histClass, "DeltaEtaPair2", "", false, 350, 1.5, 5.0, VarManager::kDeltaEtaPair2); + hm->AddHistogram(histClass, "DeltaPhiPair2_DeltaEtaPair2", "", false, 600, -o2::constants::math::PIHalf, 1.5 * o2::constants::math::PI, VarManager::kDeltaPhiPair2, 350, 1.5, 5.0, VarManager::kDeltaEtaPair2); } if (subGroupStr.Contains("dielectrons")) { if (subGroupStr.Contains("prefilter")) { hm->AddHistogram(histClass, "MassLow_OpeningAngle", "", false, 150, 0., 0.15, VarManager::kMass, 80, 0., 0.8, VarManager::kOpeningAngle); } if (subGroupStr.Contains("phiv")) { - hm->AddHistogram(histClass, "Mass_Pt_PhiV", "", false, 20, 0.0, 0.2, VarManager::kMass, 100, 0.0, 10.0, VarManager::kPt, 100, 0.0, TMath::Pi(), VarManager::kPairPhiv); + hm->AddHistogram(histClass, "Mass_Pt_PhiV", "", false, 20, 0.0, 0.2, VarManager::kMass, 100, 0.0, 10.0, VarManager::kPt, 100, 0.0, o2::constants::math::PI, VarManager::kPairPhiv); } if (subGroupStr.Contains("double-phi-v")) { - hm->AddHistogram(histClass, "Mass_Pt_PhiV", "", false, 20, 0.0, 0.2, VarManager::kMass, 100, 0.0, 10.0, VarManager::kPt, 100, 0.0, TMath::Pi(), VarManager::kPairPhiv, "", "", "", -1, -1, true); + hm->AddHistogram(histClass, "Mass_Pt_PhiV", "", false, 20, 0.0, 0.2, VarManager::kMass, 100, 0.0, 10.0, VarManager::kPt, 100, 0.0, o2::constants::math::PI, VarManager::kPairPhiv, "", "", "", -1, -1, true); } if (subGroupStr.Contains("largemass-phi-v")) { // binning for mee at large scales: @@ -1207,7 +1308,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h // steps of size pi/100 double phiv_bins[101]; for (int i = 0; i <= 100; i++) - phiv_bins[i] = TMath::Pi() / 100. * i; + phiv_bins[i] = o2::constants::math::PI / 100. * i; int nbins_phiv = sizeof(phiv_bins) / sizeof(*phiv_bins) - 1; // 3D histo @@ -1304,7 +1405,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Pt_Track", "", false, 120, 0.0, 30.0, VarManager::kPt); hm->AddHistogram(histClass, "Mass", "", false, 750, 0.0, 30.0, VarManager::kPairMass); hm->AddHistogram(histClass, "Pt", "", false, 750, 0.0, 30.0, VarManager::kPairPt); - hm->AddHistogram(histClass, "Mass_Pt", "", false, 40, 0.0, 20.0, VarManager::kPairMass, 40, 0.0, 20.0, VarManager::kPairPt); + hm->AddHistogram(histClass, "Mass_Pt", "", false, 100, 0.0, 20.0, VarManager::kPairMass, 40, 0.0, 20.0, VarManager::kPairPt); hm->AddHistogram(histClass, "Pt_Dilepton__Pt", "", false, 40, 0.0, 20.0, VarManager::kPairPtDau, 40, 0.0, 20.0, VarManager::kPairPt); hm->AddHistogram(histClass, "Pt_Track__Pt", "", false, 40, 0.0, 20.0, VarManager::kPt, 40, 0.0, 20.0, VarManager::kPairPt); } @@ -1327,6 +1428,34 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "TauzProj", "", false, 4000, -0.5, 0.5, VarManager::kVertexingTauzProjected); hm->AddHistogram(histClass, "TauxyProj", "", false, 4000, -0.5, 0.5, VarManager::kVertexingTauxyProjected); hm->AddHistogram(histClass, "CosPointingAngle", "", false, 100, 0.0, 1.0, VarManager::kCosPointingAngle); + hm->AddHistogram(histClass, "DCAxyzBetweenProngs", "", false, 100, 0.0, 1.0, VarManager::kKFDCAxyzBetweenProngs); + } + if (subGroupStr.Contains("multidimentional-vertexing-histograms")) { + hm->AddHistogram(histClass, "Mass_Tauxy", "", false, 75, 4.0, 7.0, VarManager::kPairMass, 40, -0.0, 0.02, VarManager::kVertexingTauxy); + hm->AddHistogram(histClass, "Mass_cosPointing", "", false, 75, 4.0, 7.0, VarManager::kPairMass, 40, 0.0, 1.0, VarManager::kCosPointingAngle); + + const int kNvarsTripletCuts = 4; + const int kInvMassNbins = 100; + double InvMassBinLims[kInvMassNbins + 1]; + for (int i = 0; i <= kInvMassNbins; ++i) + InvMassBinLims[i] = 4.0 + 0.02 * i; + + const int kPtNbins = 6; + double PtBinLims[kPtNbins + 1] = {0., 2., 4., 6., 8., 10., 20.}; + const int kCosPointingAngleNbins = 5; + double CosPointingAngleBinLims[kCosPointingAngleNbins + 1] = {0., 0.86, 0.90, 0.94, 0.98, 1.0}; + + const int kTauNBins = 6; + double TauBinLims[kTauNBins + 1] = {0., 0.005, 0.01, 0.015, 0.02, 0.025, 0.3}; + + TArrayD nCutsBinLimits[kNvarsTripletCuts]; + nCutsBinLimits[0] = TArrayD(kInvMassNbins + 1, InvMassBinLims); + nCutsBinLimits[1] = TArrayD(kPtNbins + 1, PtBinLims); + nCutsBinLimits[2] = TArrayD(kCosPointingAngleNbins + 1, CosPointingAngleBinLims); + nCutsBinLimits[3] = TArrayD(kTauNBins + 1, TauBinLims); + + int varsTripletCuts[kNvarsTripletCuts] = {VarManager::kPairMass, VarManager::kPairPt, VarManager::kCosPointingAngle, VarManager::kVertexingTauxyProjected}; + hm->AddHistogram(histClass, "multidimentional-vertexing", "Invariant mass vs. pT vs. cosine of pointing angle vs. tau", kNvarsTripletCuts, varsTripletCuts, nCutsBinLimits); } if (subGroupStr.Contains("correlation")) { hm->AddHistogram(histClass, "DeltaEta_DeltaPhi", "", false, 20, -2.0, 2.0, VarManager::kDeltaEta, 50, -8.0, 8.0, VarManager::kDeltaPhi); @@ -1452,7 +1581,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Pt_Photon", "p_{T} distribution", false, 4500, 0.0, 4.5, VarManager::kPt); hm->AddHistogram(histClass, "Eta", "#eta distribution", false, 500, -5.0, 5.0, VarManager::kEta); hm->AddHistogram(histClass, "Eta_Pt", "", false, 100, -2.0, 2.0, VarManager::kEta, 200, 0.0, 20.0, VarManager::kPt); - hm->AddHistogram(histClass, "Phi", "#varphi distribution", false, 500, -2. * TMath::Pi(), 2. * TMath::Pi(), VarManager::kPhi); + hm->AddHistogram(histClass, "Phi", "#varphi distribution", false, 500, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi); hm->AddHistogram(histClass, "Mass_Photon", "", false, 500, 0.0, 0.1, VarManager::kMassDau); hm->AddHistogram(histClass, "Mass_Pt", "", false, 500, 0.0, 5.0, VarManager::kMassDau, 200, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Rapidity", "", false, 400, -4.0, 4.0, VarManager::kRap); diff --git a/PWGDQ/Core/HistogramsLibrary.h b/PWGDQ/Core/HistogramsLibrary.h index 60fe4cc8714..aa53a2674cc 100644 --- a/PWGDQ/Core/HistogramsLibrary.h +++ b/PWGDQ/Core/HistogramsLibrary.h @@ -18,6 +18,7 @@ #include #include "PWGDQ/Core/HistogramManager.h" #include "PWGDQ/Core/VarManager.h" +#include "CommonConstants/MathConstants.h" namespace o2::aod { diff --git a/PWGDQ/Core/MCProng.cxx b/PWGDQ/Core/MCProng.cxx index b9e79931aed..975fee96681 100644 --- a/PWGDQ/Core/MCProng.cxx +++ b/PWGDQ/Core/MCProng.cxx @@ -147,7 +147,7 @@ void MCProng::Print() const std::cout << "Generation #" << i << " PDGcode(" << fPDGcodes[i] << ") CheckBothCharges(" << fCheckBothCharges[i] << ") ExcludePDG(" << fExcludePDG[i] << ") SourceBits(" << fSourceBits[i] << ") ExcludeSource(" << fExcludeSource[i] << ") UseANDonSource(" << fUseANDonSourceBitMap[i] << ") CheckGenerationsInTime(" << fCheckGenerationsInTime << ")"; - for (int j = 0; j < fPDGInHistory.size(); j++) { + for (std::size_t j = 0; j < fPDGInHistory.size(); j++) { std::cout << " #" << j << " PDGInHistory(" << fPDGInHistory[j] << ") ExcludePDGInHistory(" << fExcludePDGInHistory[j] << ")"; } std::cout << std::endl; diff --git a/PWGDQ/Core/MCSignal.cxx b/PWGDQ/Core/MCSignal.cxx index e66ebea3687..7a234b65088 100644 --- a/PWGDQ/Core/MCSignal.cxx +++ b/PWGDQ/Core/MCSignal.cxx @@ -9,6 +9,9 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include +#include + #include "PWGDQ/Core/MCSignal.h" using std::cout; @@ -22,6 +25,9 @@ MCSignal::MCSignal() : TNamed("", ""), fNProngs(0), fCommonAncestorIdxs({}), fExcludeCommonAncestor(false), + fDecayChannelIsExclusive(false), + fDecayChannelIsNotExclusive(false), + fNAncestorDirectProngs(0), fTempAncestorLabel(-1) { } @@ -32,23 +38,29 @@ MCSignal::MCSignal(int nProngs, const char* name /*= ""*/, const char* title /*= fNProngs(nProngs), fCommonAncestorIdxs({}), fExcludeCommonAncestor(false), + fDecayChannelIsExclusive(false), + fDecayChannelIsNotExclusive(false), + fNAncestorDirectProngs(0), fTempAncestorLabel(-1) { fProngs.reserve(nProngs); } //________________________________________________________________________________________________ -MCSignal::MCSignal(const char* name, const char* title, std::vector prongs, std::vector commonAncestors, bool excludeCommonAncestor) : TNamed(name, title), - fProngs(prongs), - fNProngs(prongs.size()), - fCommonAncestorIdxs(commonAncestors), - fExcludeCommonAncestor(excludeCommonAncestor), - fTempAncestorLabel(-1) +MCSignal::MCSignal(const char* name, const char* title, std::vector prongs, std::vector commonAncestors, bool excludeCommonAncestor) : TNamed(name, title), + fProngs(prongs), + fNProngs(prongs.size()), + fCommonAncestorIdxs(commonAncestors), + fExcludeCommonAncestor(excludeCommonAncestor), + fDecayChannelIsExclusive(false), + fDecayChannelIsNotExclusive(false), + fNAncestorDirectProngs(0), + fTempAncestorLabel(-1) { } //________________________________________________________________________________________________ -void MCSignal::SetProngs(std::vector prongs, std::vector commonAncestors) +void MCSignal::SetProngs(std::vector prongs, std::vector commonAncestors) { fProngs = prongs; fNProngs = fProngs.size(); @@ -56,7 +68,7 @@ void MCSignal::SetProngs(std::vector prongs, std::vector commonA } //________________________________________________________________________________________________ -void MCSignal::AddProng(MCProng prong, short commonAncestor) +void MCSignal::AddProng(MCProng prong, int8_t commonAncestor) { if (fProngs.size() < fNProngs) { fProngs.push_back(prong); @@ -71,6 +83,9 @@ void MCSignal::PrintConfig() { cout << "Name/Title: " << fName << " / " << fTitle << endl; cout << "Exclude common ancestor combinations: " << fExcludeCommonAncestor << endl; + cout << "Decay channel is exclusive: " << fDecayChannelIsExclusive << endl; + cout << "Decay channel is not exclusive: " << fDecayChannelIsNotExclusive << endl; + cout << "Decay channel direct prongs for the common ancestor: " << fNAncestorDirectProngs << endl; cout << "Printing " << fNProngs << "/" << fProngs.size() << " prongs:" << endl; int i = 0; for (auto& pr : fProngs) { diff --git a/PWGDQ/Core/MCSignal.h b/PWGDQ/Core/MCSignal.h index c2fa8227de2..0e979aae8b2 100644 --- a/PWGDQ/Core/MCSignal.h +++ b/PWGDQ/Core/MCSignal.h @@ -66,13 +66,23 @@ class MCSignal : public TNamed { public: MCSignal(); - MCSignal(int nProngs, const char* name = "", const char* title = ""); - MCSignal(const char* name, const char* title, std::vector prongs, std::vector commonAncestors, bool excludeCommonAncestor = false); + MCSignal(int nProngs, const char* name = "", const char* title = ""); // NOLINT + MCSignal(const char* name, const char* title, std::vector prongs, std::vector commonAncestors, bool excludeCommonAncestor = false); MCSignal(const MCSignal& c) = default; ~MCSignal() override = default; - void SetProngs(std::vector prongs, std::vector commonAncestors); - void AddProng(MCProng prong, short commonAncestor = -1); + void SetProngs(std::vector prongs, std::vector commonAncestors); + void AddProng(MCProng prong, int8_t commonAncestor = -1); + void SetDecayChannelIsExclusive(int nProngs, bool option = true) + { + fDecayChannelIsExclusive = option; + fNAncestorDirectProngs = nProngs; + } + void SetDecayChannelIsNotExclusive(int nProngs, bool option = true) + { + fDecayChannelIsNotExclusive = option; + fNAncestorDirectProngs = nProngs; + } int GetNProngs() const { @@ -82,6 +92,18 @@ class MCSignal : public TNamed { return fProngs[0].fNGenerations; } + bool GetDecayChannelIsExclusive() const + { + return fDecayChannelIsExclusive; + } + bool GetDecayChannelIsNotExclusive() const + { + return fDecayChannelIsNotExclusive; + } + int GetNAncestorDirectProngs() const + { + return fNAncestorDirectProngs; + } template bool CheckSignal(bool checkSources, const T&... args) @@ -97,10 +119,13 @@ class MCSignal : public TNamed void PrintConfig(); private: - std::vector fProngs; - unsigned int fNProngs; - std::vector fCommonAncestorIdxs; - bool fExcludeCommonAncestor; + std::vector fProngs; // vector of MCProng + unsigned int fNProngs; // number of prongs + std::vector fCommonAncestorIdxs; // index of the most recent ancestor, relative to each prong's history + bool fExcludeCommonAncestor; // explicitly request that there is no common ancestor + bool fDecayChannelIsExclusive; // if true, then the indicated mother particle has a number of daughters which is equal to the number of direct prongs defined in this MC signal + bool fDecayChannelIsNotExclusive; // if true, then the indicated mother particle has a number of daughters which is larger than the number of direct prongs defined in this MC signal + int fNAncestorDirectProngs; // number of direct prongs belonging to the common ancestor specified by this signal int fTempAncestorLabel; template @@ -139,6 +164,18 @@ bool MCSignal::CheckProng(int i, bool checkSources, const T& track) if (fNProngs > 1 && fCommonAncestorIdxs[i] == j) { if (i == 0) { fTempAncestorLabel = currentMCParticle.globalIndex(); + // In the case of decay channels marked as being "exclusive", check how many decay daughters this mother has registered + // in the stack and compare to the number of prongs defined for this MCSignal. + // If these numbers are equal, it means this decay MCSignal match is exclusive (there are no additional prongs for this mother besides the + // prongs defined here). + if (currentMCParticle.has_daughters()) { + if (fDecayChannelIsExclusive && currentMCParticle.daughtersIds()[1] - currentMCParticle.daughtersIds()[0] + 1 != fNAncestorDirectProngs) { + return false; + } + if (fDecayChannelIsNotExclusive && currentMCParticle.daughtersIds()[1] - currentMCParticle.daughtersIds()[0] + 1 == fNAncestorDirectProngs) { + return false; + } + } } else { if (currentMCParticle.globalIndex() != fTempAncestorLabel && !fExcludeCommonAncestor) return false; @@ -185,27 +222,27 @@ bool MCSignal::CheckProng(int i, bool checkSources, const T& track) // check each source uint64_t sourcesDecision = 0; // Check kPhysicalPrimary - if (fProngs[i].fSourceBits[j] & (uint64_t(1) << MCProng::kPhysicalPrimary)) { - if ((fProngs[i].fExcludeSource[j] & (uint64_t(1) << MCProng::kPhysicalPrimary)) != currentMCParticle.isPhysicalPrimary()) { - sourcesDecision |= (uint64_t(1) << MCProng::kPhysicalPrimary); + if (fProngs[i].fSourceBits[j] & (static_cast(1) << MCProng::kPhysicalPrimary)) { + if ((fProngs[i].fExcludeSource[j] & (static_cast(1) << MCProng::kPhysicalPrimary)) != currentMCParticle.isPhysicalPrimary()) { + sourcesDecision |= (static_cast(1) << MCProng::kPhysicalPrimary); } } // Check kProducedInTransport - if (fProngs[i].fSourceBits[j] & (uint64_t(1) << MCProng::kProducedInTransport)) { - if ((fProngs[i].fExcludeSource[j] & (uint64_t(1) << MCProng::kProducedInTransport)) != (!currentMCParticle.producedByGenerator())) { - sourcesDecision |= (uint64_t(1) << MCProng::kProducedInTransport); + if (fProngs[i].fSourceBits[j] & (static_cast(1) << MCProng::kProducedInTransport)) { + if ((fProngs[i].fExcludeSource[j] & (static_cast(1) << MCProng::kProducedInTransport)) != (!currentMCParticle.producedByGenerator())) { + sourcesDecision |= (static_cast(1) << MCProng::kProducedInTransport); } } // Check kProducedByGenerator - if (fProngs[i].fSourceBits[j] & (uint64_t(1) << MCProng::kProducedByGenerator)) { - if ((fProngs[i].fExcludeSource[j] & (uint64_t(1) << MCProng::kProducedByGenerator)) != currentMCParticle.producedByGenerator()) { - sourcesDecision |= (uint64_t(1) << MCProng::kProducedByGenerator); + if (fProngs[i].fSourceBits[j] & (static_cast(1) << MCProng::kProducedByGenerator)) { + if ((fProngs[i].fExcludeSource[j] & (static_cast(1) << MCProng::kProducedByGenerator)) != currentMCParticle.producedByGenerator()) { + sourcesDecision |= (static_cast(1) << MCProng::kProducedByGenerator); } } // Check kFromBackgroundEvent - if (fProngs[i].fSourceBits[j] & (uint64_t(1) << MCProng::kFromBackgroundEvent)) { - if ((fProngs[i].fExcludeSource[j] & (uint64_t(1) << MCProng::kFromBackgroundEvent)) != currentMCParticle.fromBackgroundEvent()) { - sourcesDecision |= (uint64_t(1) << MCProng::kFromBackgroundEvent); + if (fProngs[i].fSourceBits[j] & (static_cast(1) << MCProng::kFromBackgroundEvent)) { + if ((fProngs[i].fExcludeSource[j] & (static_cast(1) << MCProng::kFromBackgroundEvent)) != currentMCParticle.fromBackgroundEvent()) { + sourcesDecision |= (static_cast(1) << MCProng::kFromBackgroundEvent); } } // no source bit is fulfilled @@ -246,9 +283,9 @@ bool MCSignal::CheckProng(int i, bool checkSources, const T& track) } } - if (fProngs[i].fPDGInHistory.size() == 0) + if (fProngs[i].fPDGInHistory.size() == 0) { return true; - else { // check if mother pdg is in history + } else { // check if mother pdg is in history std::vector pdgInHistory; // while find mothers, check if the provided PDG codes are included or excluded in the particle decay history diff --git a/PWGDQ/Core/MCSignalLibrary.cxx b/PWGDQ/Core/MCSignalLibrary.cxx index 7a33333b0a7..22f445252f9 100644 --- a/PWGDQ/Core/MCSignalLibrary.cxx +++ b/PWGDQ/Core/MCSignalLibrary.cxx @@ -11,6 +11,8 @@ // // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // +#include + #include #include "CommonConstants/PhysicsConstants.h" #include "PWGDQ/Core/MCSignalLibrary.h" @@ -119,6 +121,11 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "Inclusive jpsi", {prong}, {-1}); return signal; } + if (!nameStr.compare("Helium3")) { + MCProng prong(1, {1000020030}, {true}, {false}, {0}, {0}, {false}); + signal = new MCSignal(name, "Helium3", {prong}, {-1}); + return signal; + } if (!nameStr.compare("nonPromptJpsi")) { MCProng prong(2, {443, 503}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); signal = new MCSignal(name, "Non-prompt jpsi", {prong}, {-1}); @@ -174,6 +181,21 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "Inclusive Chic0, Chic1 and Chic2", {prong}, {-1}); return signal; } + if (!nameStr.compare("Upsilon1S")) { + MCProng prong(1, {553}, {true}, {false}, {0}, {0}, {false}); + signal = new MCSignal(name, "Inclusive Upsilon1S", {prong}, {-1}); + return signal; + } + if (!nameStr.compare("Upsilon2S")) { + MCProng prong(1, {100553}, {true}, {false}, {0}, {0}, {false}); + signal = new MCSignal(name, "Inclusive Upsilon2S", {prong}, {-1}); + return signal; + } + if (!nameStr.compare("Upsilon3S")) { + MCProng prong(1, {200553}, {true}, {false}, {0}, {0}, {false}); + signal = new MCSignal(name, "Inclusive Upsilon3S", {prong}, {-1}); + return signal; + } if (!nameStr.compare("allBeautyHadrons")) { MCProng prong(1, {503}, {true}, {false}, {0}, {0}, {false}); signal = new MCSignal(name, "All beauty hadrons", {prong}, {-1}); @@ -385,6 +407,11 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "Electrons from jpsi decays", {prong}, {-1}); return signal; } + if (!nameStr.compare("anythingFromJpsi")) { + MCProng prong(2, {MCProng::kPDGCodeNotAssigned, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Anything from jpsi decays", {prong}, {-1}); + return signal; + } if (!nameStr.compare("eFromPromptJpsi")) { MCProng prong(2, {11, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); prong.SetSourceBit(0, MCProng::kPhysicalPrimary); @@ -681,6 +708,20 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "ee pairs from j/psi decays", {prong, prong}, {1, 1}); // signal at pair level return signal; } + if (!nameStr.compare("eeFromJpsiExclusive")) { + MCProng prong(2, {11, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + prong.SetSourceBit(0, MCProng::kPhysicalPrimary); + signal = new MCSignal(name, "ee pairs from j/psi decays", {prong, prong}, {1, 1}); // signal at pair level + signal->SetDecayChannelIsExclusive(2, true); + return signal; + } + if (!nameStr.compare("eeFromJpsiNotExclusive")) { + MCProng prong(2, {11, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + prong.SetSourceBit(0, MCProng::kPhysicalPrimary); + signal = new MCSignal(name, "ee pairs from j/psi decays", {prong, prong}, {1, 1}); // signal at pair level + signal->SetDecayChannelIsNotExclusive(2, true); + return signal; + } if (!nameStr.compare("eePrimaryFromPromptJPsi")) { MCProng prong(2, {11, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {503}, {true}); prong.SetSourceBit(0, MCProng::kPhysicalPrimary); @@ -709,6 +750,21 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "mumu pairs from psi2s decays", {prong, prong}, {1, 1}); // signal at pair level return signal; } + if (!nameStr.compare("mumuFromUpsilon1S")) { + MCProng prong(2, {13, 553}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "mumu pairs from upsilon1s decays", {prong, prong}, {1, 1}); // signal at pair level + return signal; + } + if (!nameStr.compare("mumuFromUpsilon2S")) { + MCProng prong(2, {13, 100553}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "mumu pairs from upsilon2s decays", {prong, prong}, {1, 1}); // signal at pair level + return signal; + } + if (!nameStr.compare("mumuFromUpsilon3S")) { + MCProng prong(2, {13, 200553}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "mumu pairs from upsilon3s decays", {prong, prong}, {1, 1}); // signal at pair level + return signal; + } if (!nameStr.compare("eeFromLMeeLFQ")) { MCProng prong(2, {11, 900}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); prong.SetSourceBit(0, MCProng::kPhysicalPrimary); @@ -1085,6 +1141,22 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) return signal; } + if (!nameStr.compare("eeKaonFromBplusExclusive")) { + MCProng pronge(3, {11, 443, 521}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}); + MCProng prongKaon(2, {321, 521}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Kaon and electron pair from B+", {pronge, pronge, prongKaon}, {2, 2, 1}); + signal->SetDecayChannelIsExclusive(2, true); + return signal; + } + + if (!nameStr.compare("eeKaonFromBplusNotExclusive")) { + MCProng pronge(3, {11, 443, 521}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}); + MCProng prongKaon(2, {321, 521}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Kaon and electron pair from B+", {pronge, pronge, prongKaon}, {2, 2, 1}); + signal->SetDecayChannelIsNotExclusive(2, true); + return signal; + } + if (!nameStr.compare("Bplus")) { MCProng prong(1, {521}, {true}, {false}, {0}, {0}, {false}); signal = new MCSignal(name, "B+", {prong}, {-1}); @@ -1253,5 +1325,83 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "Photon and electron pair from Pi0", {pronge, pronge, prongPhoton}, {1, 1, 1}); return signal; } + + //-------------------------------------------------------------------------------- + + if (!nameStr.compare("JpsiFromX3872")) { + MCProng prong(1, {443}, {true}, {false}, {0}, {0}, {false}, false, {9920443}, {false}); + signal = new MCSignal(name, "Jpsi from X3872", {prong}, {-1}); + return signal; + } + + if (!nameStr.compare("eFromX3872")) { + MCProng prong(3, {11, 443, 9920443}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}); + signal = new MCSignal(name, "Electron from Jpsi from X3872", {prong}, {1}); + return signal; + } + + if (!nameStr.compare("PionFromX3872")) { + MCProng prong(1, {211}, {true}, {false}, {0}, {0}, {false}, false, {9920443}, {false}); + signal = new MCSignal(name, "Pion from Jpsi from X3872", {prong}, {-1}); + return signal; + } + + if (!nameStr.compare("JpsiFromPsi2S")) { + MCProng prong(1, {443}, {true}, {false}, {0}, {0}, {false}, false, {100443}, {false}); + signal = new MCSignal(name, "Jpsi from Psi2S", {prong}, {-1}); + return signal; + } + + if (!nameStr.compare("eFromPsi2S")) { + MCProng prong(3, {11, 443, 100443}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}); + signal = new MCSignal(name, "Electron from Jpsi from Psi2S", {prong}, {1}); + return signal; + } + + if (!nameStr.compare("PionFromPsi2S")) { + MCProng prong(1, {211}, {true}, {false}, {0}, {0}, {false}, false, {100443}, {false}); + signal = new MCSignal(name, "Pion from Jpsi from Psi2S", {prong}, {-1}); + return signal; + } + + if (!nameStr.compare("eeFromJpsiFromX3872")) { + MCProng prong(2, {11, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {9920443}, {false}); + signal = new MCSignal(name, "Electron pair from Jpsi from X3872", {prong, prong}, {1, 1}); + return signal; + } + + if (!nameStr.compare("JpsiPiPiFromX3872")) { + MCProng prongJpsi(2, {443, 9920443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + MCProng prongPi(2, {211, 9920443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Jpsi and pion pair from X3872", {prongJpsi, prongPi, prongPi}, {1, 1, 1}); + return signal; + } + + if (!nameStr.compare("eePiPiFromX3872")) { + MCProng pronge(3, {11, 443, 9920443}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}); + MCProng prongPi(2, {211, 9920443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Electron pair and pion pair from X3872", {pronge, pronge, prongPi, prongPi}, {2, 2, 1, 1}); + return signal; + } + + if (!nameStr.compare("eeFromJpsiFromPsi2S")) { + MCProng prong(2, {11, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {100443}, {false}); + signal = new MCSignal(name, "Electron pair from Jpsi from Psi2S", {prong, prong}, {1, 1}); + return signal; + } + + if (!nameStr.compare("JpsiPiPiFromPsi2S")) { + MCProng prongJpsi(2, {443, 100443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + MCProng prongPi(2, {211, 100443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Jpsi and pion pair from Psi2S", {prongJpsi, prongPi, prongPi}, {1, 1, 1}); + return signal; + } + + if (!nameStr.compare("eePiPiFromPsi2S")) { + MCProng pronge(3, {11, 443, 100443}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}); + MCProng prongPi(2, {211, 100443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Electron pair and pion pair from Psi2S", {pronge, pronge, prongPi, prongPi}, {2, 2, 1, 1}); + return signal; + } return nullptr; } diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 9efae351b8a..77de7838f8e 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -9,6 +9,9 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. #include +#include +#include +#include #include "PWGDQ/Core/VarManager.h" #include "Tools/KFparticle/KFUtilities.h" @@ -360,6 +363,8 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kMultNTracksITSTPC] = ""; fgVariableNames[kTrackOccupancyInTimeRange] = "track occupancy in TPC drift time (PV tracks)"; fgVariableUnits[kTrackOccupancyInTimeRange] = ""; + fgVariableNames[kNoCollInTimeRangeStandard] = "track occupancy in TPC drift standart time"; + fgVariableUnits[kNoCollInTimeRangeStandard] = ""; fgVariableNames[kMultAllTracksITSTPC] = "# ITS-TPC tracks"; fgVariableUnits[kMultAllTracksITSTPC] = ""; fgVariableNames[kMultAllTracksTPCOnly] = "# TPC only tracks"; @@ -376,6 +381,30 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kNTPCtracksInPast] = ""; fgVariableNames[kNTPCtracksInFuture] = "# TPC tracks in future"; fgVariableUnits[kNTPCtracksInFuture] = ""; + fgVariableNames[kNTPCcontribLongA] = "# TPC-A pileup, long time range"; + fgVariableUnits[kNTPCcontribLongA] = ""; + fgVariableNames[kNTPCcontribLongC] = "# TPC-C pileup, long time range"; + fgVariableUnits[kNTPCcontribLongC] = ""; + fgVariableNames[kNTPCmeanTimeLongA] = "# TPC-A pileup mean time, long time range"; + fgVariableUnits[kNTPCmeanTimeLongA] = "#mu s"; + fgVariableNames[kNTPCmeanTimeLongC] = "# TPC-C pileup mean time, long time range"; + fgVariableUnits[kNTPCmeanTimeLongC] = "#mu s"; + fgVariableNames[kNTPCmedianTimeLongA] = "# TPC-A pileup median time, long time range"; + fgVariableUnits[kNTPCmedianTimeLongA] = "#mu s"; + fgVariableNames[kNTPCmedianTimeLongC] = "# TPC-C pileup median time, long time range"; + fgVariableUnits[kNTPCmedianTimeLongC] = "#mu s"; + fgVariableNames[kNTPCcontribShortA] = "# TPC-A pileup, short time range"; + fgVariableUnits[kNTPCcontribShortA] = ""; + fgVariableNames[kNTPCcontribShortC] = "# TPC-C pileup, short time range"; + fgVariableUnits[kNTPCcontribShortC] = ""; + fgVariableNames[kNTPCmeanTimeShortA] = "# TPC-A pileup mean time, short time range"; + fgVariableUnits[kNTPCmeanTimeShortA] = "#mu s"; + fgVariableNames[kNTPCmeanTimeShortC] = "# TPC-C pileup mean time, short time range"; + fgVariableUnits[kNTPCmeanTimeShortC] = "#mu s"; + fgVariableNames[kNTPCmedianTimeShortA] = "# TPC-A pileup median time, short time range"; + fgVariableUnits[kNTPCmedianTimeShortA] = "#mu s"; + fgVariableNames[kNTPCmedianTimeShortC] = "# TPC-C pileup median time, short time range"; + fgVariableUnits[kNTPCmedianTimeShortC] = "#mu s"; fgVariableNames[kPt] = "p_{T}"; fgVariableUnits[kPt] = "GeV/c"; fgVariableNames[kInvPt] = "1/p_{T}"; @@ -435,6 +464,8 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kTPCncls] = ""; fgVariableNames[kTPCnclsCR] = "TPC #cls crossed rows"; fgVariableUnits[kTPCnclsCR] = ""; + fgVariableNames[kTPCnCRoverFindCls] = "TPC crossed rows over findable cls"; + fgVariableUnits[kTPCnCRoverFindCls] = ""; fgVariableNames[kTPCchi2] = "TPC chi2"; fgVariableUnits[kTPCchi2] = ""; fgVariableNames[kTPCsignal] = "TPC dE/dx"; @@ -593,6 +624,8 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kVertexingTauxyProjected] = "ns"; fgVariableNames[kVertexingTauxyzProjected] = "Pair pseudo-proper Tauxyz"; fgVariableUnits[kVertexingTauxyzProjected] = "ns"; + fgVariableNames[kCosPointingAngle] = "cos(#theta_{pointing})"; + fgVariableUnits[kCosPointingAngle] = ""; fgVariableNames[kVertexingPz] = "Pz Pair"; fgVariableUnits[kVertexingPz] = "GeV/c"; fgVariableNames[kVertexingSV] = "Secondary Vertexing z"; @@ -751,14 +784,22 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kS31A] = ""; fgVariableNames[kM11REF] = "M_{11}^{REF} "; fgVariableUnits[kM11REF] = ""; + fgVariableNames[kM11REFetagap] = "M_{11}^{REF}-etagap "; + fgVariableUnits[kM11REFetagap] = ""; fgVariableNames[kM01POI] = "M^{'}_{01}^{POI} "; fgVariableUnits[kM01POI] = ""; fgVariableNames[kM1111REF] = "M_{1111}^{REF} "; fgVariableUnits[kM1111REF] = ""; + fgVariableNames[kM11M1111REF] = "M_{11}_{REF}M_{1111}_{REF} "; + fgVariableUnits[kM11M1111REF] = ""; + fgVariableNames[kCORR2CORR4REF] = "<2><4>"; + fgVariableUnits[kCORR2CORR4REF] = ""; fgVariableNames[kM0111POI] = "M^{'}_{0111}^{POI} "; fgVariableUnits[kM0111POI] = ""; fgVariableNames[kCORR2REF] = "<2> "; fgVariableUnits[kCORR2REF] = ""; + fgVariableNames[kCORR2REFetagap] = "<2-etagap> "; + fgVariableUnits[kCORR2REFetagap] = ""; fgVariableNames[kCORR2POI] = "<2'> "; fgVariableUnits[kCORR2POI] = ""; fgVariableNames[kCORR4REF] = "<4> "; @@ -849,8 +890,12 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kCosThetaCS] = ""; fgVariableNames[kPhiCS] = "#varphi_{CS}"; fgVariableUnits[kPhiCS] = "rad."; + fgVariableNames[kPhiVP] = "#varphi_{VP} - #Psi_{2}"; + fgVariableUnits[kPhiVP] = "rad."; fgVariableNames[kDeltaPhiPair2] = "#Delta#phi"; fgVariableUnits[kDeltaPhiPair2] = "rad."; + fgVariableNames[kDeltaEtaPair2] = "#Delta#eta"; + fgVariableUnits[kDeltaEtaPair2] = ""; fgVariableNames[kPsiPair] = "#Psi_{pair}"; fgVariableUnits[kPsiPair] = "rad."; fgVariableNames[kDeltaPhiPair] = "#Delta#phi"; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index 38115fb4608..bf328b6fa0c 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -235,6 +235,7 @@ class VarManager : public TObject kMultNTracksTPCOnly, kMultNTracksITSTPC, kTrackOccupancyInTimeRange, + kNoCollInTimeRangeStandard, kMultAllTracksTPCOnly, kMultAllTracksITSTPC, kNTPCpileupContribA, @@ -243,6 +244,18 @@ class VarManager : public TObject kNTPCpileupZC, kNTPCtracksInPast, kNTPCtracksInFuture, + kNTPCcontribLongA, + kNTPCcontribLongC, + kNTPCmeanTimeLongA, + kNTPCmeanTimeLongC, + kNTPCmedianTimeLongA, + kNTPCmedianTimeLongC, + kNTPCcontribShortA, + kNTPCcontribShortC, + kNTPCmeanTimeShortA, + kNTPCmeanTimeShortC, + kNTPCmedianTimeShortA, + kNTPCmedianTimeShortC, kMCEventGeneratorId, kMCEventSubGeneratorId, kMCVtxX, @@ -309,6 +322,15 @@ class VarManager : public TObject kR2SP_AB, kR2SP_AC, kR2SP_BC, + kWR2SP_AB, + kWR2SP_AC, + kWR2SP_BC, + kR2SP_AB_Im, + kR2SP_AC_Im, + kR2SP_BC_Im, + kWR2SP_AB_Im, + kWR2SP_AC_Im, + kWR2SP_BC_Im, kR2SP_FT0CTPCPOS, kR2SP_FT0CTPCNEG, kR2SP_FT0ATPCPOS, @@ -321,6 +343,15 @@ class VarManager : public TObject kR2EP_AB, kR2EP_AC, kR2EP_BC, + kWR2EP_AB, + kWR2EP_AC, + kWR2EP_BC, + kR2EP_AB_Im, + kR2EP_AC_Im, + kR2EP_BC_Im, + kWR2EP_AB_Im, + kWR2EP_AC_Im, + kWR2EP_BC_Im, kR2EP_FT0CTPCPOS, kR2EP_FT0CTPCNEG, kR2EP_FT0ATPCPOS, @@ -339,6 +370,8 @@ class VarManager : public TObject kTwoEvPosZ2, // vtx-z for collision 2 in two events correlations kTwoEvPosR1, // vtx-R for collision 1 in two events correlations kTwoEvPosR2, + kTwoEvCentFT0C1, + kTwoEvCentFT0C2, kTwoEvPVcontrib1, // n-contributors for collision 1 in two events correlations kTwoEvPVcontrib2, kTwoEvDeltaZ, // distance in z between collisions @@ -368,22 +401,20 @@ class VarManager : public TObject kQ2Y0A2, kU2Q2Ev1, kU2Q2Ev2, - kTwoR2SP1, // Scalar product resolution of event1 for ME technique - kTwoR2SP2, // Scalar product resolution of event2 for ME technique - kTwoR2EP1, // Event plane resolution of event2 for ME technique - kTwoR2EP2, // Event plane resolution of event2 for ME technique - kTwoR2SP_AB1, // Scalar product resolution of event1 for ME technique - kTwoR2SP_AB2, // Scalar product resolution of event2 for ME technique - kTwoR2SP_AC1, // Scalar product resolution of event1 for ME technique - kTwoR2SP_AC2, // Scalar product resolution of event2 for ME technique - kTwoR2SP_BC1, // Scalar product resolution of event1 for ME technique - kTwoR2SP_BC2, // Scalar product resolution of event2 for ME technique - kTwoR2EP_AB1, // Event plane resolution of event2 for ME technique - kTwoR2EP_AB2, // Event plane resolution of event2 for ME technique - kTwoR2EP_AC1, // Event plane resolution of event2 for ME technique - kTwoR2EP_AC2, // Event plane resolution of event2 for ME technique - kTwoR2EP_BC1, // Event plane resolution of event2 for ME technique - kTwoR2EP_BC2, // Event plane resolution of event2 for ME technique + kCos2DeltaPhiEv1, + kCos2DeltaPhiEv2, + kV2SP1, + kV2SP2, + kV2EP1, + kV2EP2, + kV2ME_SP, + kV2ME_EP, + kWV2ME_SP, + kWV2ME_EP, + kTwoR2SP1, // Scalar product resolution of event1 for ME technique + kTwoR2SP2, // Scalar product resolution of event2 for ME technique + kTwoR2EP1, // Event plane resolution of event2 for ME technique + kTwoR2EP2, // Event plane resolution of event2 for ME technique // Basic track/muon/pair wise variables kX, @@ -445,6 +476,7 @@ class VarManager : public TObject kTPCncls, kITSClusterMap, kTPCnclsCR, + kTPCnCRoverFindCls, kTPCchi2, kTPCsignal, kTPCsignalRandomized, @@ -591,7 +623,9 @@ class VarManager : public TObject kCosThetaCS, kPhiHE, kPhiCS, + kPhiVP, kDeltaPhiPair2, + kDeltaEtaPair2, kPsiPair, kDeltaPhiPair, kOpeningAngle, @@ -606,6 +640,10 @@ class VarManager : public TObject kImpParXYK, kDCATrackProd, kDCATrackVtxProd, + kV2SP, + kV2EP, + kWV2SP, + kWV2EP, kU2Q2, kU3Q3, kQ42XA, @@ -617,10 +655,14 @@ class VarManager : public TObject kS13A, kS31A, kM11REF, + kM11REFetagap, kM01POI, kM1111REF, + kM11M1111REF, + kCORR2CORR4REF, kM0111POI, kCORR2REF, + kCORR2REFetagap, kCORR2POI, kCORR4REF, kCORR4POI, @@ -630,6 +672,8 @@ class VarManager : public TObject kM0111POIoverMp, kCORR2POIMp, kCORR4POIMp, + kR2SP, + kR2EP, kPsi2A, kPsi2APOS, kPsi2ANEG, @@ -910,9 +954,13 @@ class VarManager : public TObject template static void FillEventTrackEstimators(TEvent const& collision, TAssoc const& groupedTrackIndices, TTracks const& tracks, float* values = nullptr); template + static void FillEventFlowResoFactor(T const& hs_sp, T const& hs_ep, float* values = nullptr); + template static void FillTwoEvents(T const& event1, T const& event2, float* values = nullptr); template static void FillTwoMixEvents(T1 const& event1, T1 const& event2, T2 const& tracks1, T2 const& tracks2, float* values = nullptr); + template + static void FillTwoMixEventsFlowResoFactor(T const& hs_sp, T const& hs_ep, float* values = nullptr); template static void FillTrack(T const& track, float* values = nullptr); template @@ -935,12 +983,14 @@ class VarManager : public TObject static void FillPairCollisionMatCorr(C const& collision, T1 const& t1, T2 const& t2, M const& materialCorr, P const& propagator, float* values = nullptr); template static void FillTriple(T1 const& t1, T2 const& t2, T3 const& t3, float* values = nullptr, PairCandidateType pairType = kTripleCandidateToEEPhoton); - template + template static void FillPairME(T1 const& t1, T2 const& t2, float* values = nullptr); template static void FillPairMC(T1 const& t1, T2 const& t2, float* values = nullptr, PairCandidateType pairType = kDecayToEE); template static void FillTripleMC(T1 const& t1, T2 const& t2, T3 const& t3, float* values = nullptr, PairCandidateType pairType = kTripleCandidateToEEPhoton); + template + static void FillQaudMC(T1 const& t1, T2 const& t2, T2 const& t3, float* values = nullptr); template static void FillPairVertexing(C const& collision, T const& t1, T const& t2, bool propToSV = false, float* values = nullptr); template @@ -1333,6 +1383,12 @@ void VarManager::FillEvent(T const& event, float* values) if (fgUsedVars[kIsNoITSROFBorder]) { values[kIsNoITSROFBorder] = event.selection_bit(o2::aod::evsel::kNoITSROFrameBorder); } + if (fgUsedVars[kTrackOccupancyInTimeRange]) { + values[kTrackOccupancyInTimeRange] = event.trackOccupancyInTimeRange(); + } + if (fgUsedVars[kNoCollInTimeRangeStandard]) { + values[kNoCollInTimeRangeStandard] = event.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard); + } if (fgUsedVars[kIsNoTFBorder]) { values[kIsNoTFBorder] = event.selection_bit(o2::aod::evsel::kNoTimeFrameBorder); } @@ -1429,16 +1485,21 @@ void VarManager::FillEvent(T const& event, float* values) values[kMultNTracksITSOnly] = event.multNTracksITSOnly(); values[kMultNTracksTPCOnly] = event.multNTracksTPCOnly(); values[kMultNTracksITSTPC] = event.multNTracksITSTPC(); - values[kTrackOccupancyInTimeRange] = event.trackOccupancyInTimeRange(); values[kMultAllTracksTPCOnly] = event.multAllTracksTPCOnly(); values[kMultAllTracksITSTPC] = event.multAllTracksITSTPC(); if constexpr ((fillMap & ReducedEventMultExtra) > 0) { - values[kNTPCpileupContribA] = event.nTPCpileupContribA(); - values[kNTPCpileupContribC] = event.nTPCpileupContribC(); - values[kNTPCpileupZA] = event.nTPCpileupZA(); - values[kNTPCpileupZC] = event.nTPCpileupZC(); - values[kNTPCtracksInPast] = event.nTPCtracksInPast(); - values[kNTPCtracksInFuture] = event.nTPCtracksInFuture(); + values[kNTPCcontribLongA] = event.nTPCoccupContribLongA(); + values[kNTPCcontribLongC] = event.nTPCoccupContribLongC(); + values[kNTPCcontribShortA] = event.nTPCoccupContribShortA(); + values[kNTPCcontribShortC] = event.nTPCoccupContribShortC(); + values[kNTPCmeanTimeLongA] = event.nTPCoccupMeanTimeLongA(); + values[kNTPCmeanTimeLongC] = event.nTPCoccupMeanTimeLongC(); + values[kNTPCmeanTimeShortA] = event.nTPCoccupMeanTimeShortA(); + values[kNTPCmeanTimeShortC] = event.nTPCoccupMedianTimeShortC(); + values[kNTPCmedianTimeLongA] = event.nTPCoccupMedianTimeLongA(); + values[kNTPCmedianTimeLongC] = event.nTPCoccupMedianTimeLongC(); + values[kNTPCmedianTimeShortA] = event.nTPCoccupMedianTimeShortA(); + values[kNTPCmedianTimeShortC] = event.nTPCoccupMedianTimeShortC(); } } // TODO: need to add EvSels and Cents tables, etc. in case of the central data model @@ -1456,6 +1517,9 @@ void VarManager::FillEvent(T const& event, float* values) if (fgUsedVars[kIsNoTFBorder]) { values[kIsNoTFBorder] = (event.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) > 0); } + if (fgUsedVars[kNoCollInTimeRangeStandard]) { + values[kNoCollInTimeRangeStandard] = (event.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) > 0); + } if (fgUsedVars[kIsNoSameBunch]) { values[kIsNoSameBunch] = (event.selection_bit(o2::aod::evsel::kNoSameBunchPileup) > 0); } @@ -1594,8 +1658,10 @@ void VarManager::FillEvent(T const& event, float* values) if constexpr ((fillMap & ReducedEventRefFlow) > 0) { values[kM1111REF] = event.m1111ref(); values[kM11REF] = event.m11ref(); - values[kCORR4REF] = event.corr4ref(); + values[kM11M1111REF] = event.m11ref() * event.m1111ref(); values[kCORR2REF] = event.corr2ref(); + values[kCORR4REF] = event.corr4ref(); + values[kCORR2CORR4REF] = event.corr2ref() * event.corr4ref(); values[kMultA] = event.multa(); } } @@ -1648,13 +1714,43 @@ void VarManager::FillEvent(T const& event, float* values) values[kPsi2B] = Psi2B; values[kPsi2C] = Psi2C; - values[kR2SP_AB] = (values[kQ2X0A] * values[kQ2X0B] + values[kQ2Y0A] * values[kQ2Y0B]); - values[kR2SP_AC] = (values[kQ2X0A] * values[kQ2X0C] + values[kQ2Y0A] * values[kQ2Y0C]); - values[kR2SP_BC] = (values[kQ2X0B] * values[kQ2X0C] + values[kQ2Y0B] * values[kQ2Y0C]); - - values[kR2EP_AB] = TMath::Cos(2 * (Psi2A - Psi2B)); - values[kR2EP_AC] = TMath::Cos(2 * (Psi2A - Psi2C)); - values[kR2EP_BC] = TMath::Cos(2 * (Psi2B - Psi2C)); + float R2SP_AB = (values[kQ2X0A] * values[kQ2X0B] + values[kQ2Y0A] * values[kQ2Y0B]); + float R2SP_AC = (values[kQ2X0A] * values[kQ2X0C] + values[kQ2Y0A] * values[kQ2Y0C]); + float R2SP_BC = (values[kQ2X0B] * values[kQ2X0C] + values[kQ2Y0B] * values[kQ2Y0C]); + float R2SP_AB_Im = (values[kQ2Y0A] * values[kQ2X0B] - values[kQ2X0A] * values[kQ2Y0B]); + float R2SP_AC_Im = (values[kQ2Y0A] * values[kQ2X0C] - values[kQ2X0A] * values[kQ2Y0C]); + float R2SP_BC_Im = (values[kQ2Y0B] * values[kQ2X0C] - values[kQ2X0B] * values[kQ2Y0C]); + values[kR2SP_AB] = std::isnan(R2SP_AB) || std::isinf(R2SP_AB) ? 0. : R2SP_AB; + values[kWR2SP_AB] = std::isnan(R2SP_AB) || std::isinf(R2SP_AB) ? 0. : 1.0; + values[kR2SP_AC] = std::isnan(R2SP_AC) || std::isinf(R2SP_AC) ? 0. : R2SP_AC; + values[kWR2SP_AC] = std::isnan(R2SP_AC) || std::isinf(R2SP_AC) ? 0. : 1.0; + values[kR2SP_BC] = std::isnan(R2SP_BC) || std::isinf(R2SP_BC) ? 0. : R2SP_BC; + values[kWR2SP_BC] = std::isnan(R2SP_BC) || std::isinf(R2SP_BC) ? 0. : 1.0; + values[kR2SP_AB_Im] = std::isnan(R2SP_AB_Im) || std::isinf(R2SP_AB_Im) ? 0. : R2SP_AB_Im; + values[kWR2SP_AB_Im] = std::isnan(R2SP_AB_Im) || std::isinf(R2SP_AB_Im) ? 0. : 1.0; + values[kR2SP_AC_Im] = std::isnan(R2SP_AC_Im) || std::isinf(R2SP_AC_Im) ? 0. : R2SP_AC_Im; + values[kWR2SP_AC_Im] = std::isnan(R2SP_AC_Im) || std::isinf(R2SP_AC_Im) ? 0. : 1.0; + values[kR2SP_BC_Im] = std::isnan(R2SP_BC_Im) || std::isinf(R2SP_BC_Im) ? 0. : R2SP_BC_Im; + values[kWR2SP_BC_Im] = std::isnan(R2SP_BC_Im) || std::isinf(R2SP_BC_Im) ? 0. : 1.0; + + float R2EP_AB = std::isnan(Psi2A) || std::isinf(Psi2A) || std::isnan(Psi2B) || std::isinf(Psi2B) ? 0. : TMath::Cos(2 * (Psi2A - Psi2B)); + float R2EP_AC = std::isnan(Psi2A) || std::isinf(Psi2A) || std::isnan(Psi2C) || std::isinf(Psi2C) ? 0. : TMath::Cos(2 * (Psi2A - Psi2C)); + float R2EP_BC = std::isnan(Psi2B) || std::isinf(Psi2B) || std::isnan(Psi2C) || std::isinf(Psi2C) ? 0. : TMath::Cos(2 * (Psi2B - Psi2C)); + float R2EP_AB_Im = std::isnan(Psi2A) || std::isinf(Psi2A) || std::isnan(Psi2B) || std::isinf(Psi2B) ? 0. : TMath::Sin(2 * (Psi2A - Psi2B)); + float R2EP_AC_Im = std::isnan(Psi2A) || std::isinf(Psi2A) || std::isnan(Psi2C) || std::isinf(Psi2C) ? 0. : TMath::Sin(2 * (Psi2A - Psi2C)); + float R2EP_BC_Im = std::isnan(Psi2B) || std::isinf(Psi2B) || std::isnan(Psi2C) || std::isinf(Psi2C) ? 0. : TMath::Sin(2 * (Psi2B - Psi2C)); + values[kR2EP_AB] = std::isnan(R2EP_AB) || std::isinf(R2EP_AB) ? 0. : R2EP_AB; + values[kWR2EP_AB] = std::isnan(R2EP_AB) || std::isinf(R2EP_AB) ? 0. : 1.0; + values[kR2EP_AC] = std::isnan(R2EP_AC) || std::isinf(R2EP_AC) ? 0. : R2EP_AC; + values[kWR2EP_AC] = std::isnan(R2EP_AC) || std::isinf(R2EP_AC) ? 0. : 1.0; + values[kR2EP_BC] = std::isnan(R2EP_BC) || std::isinf(R2EP_BC) ? 0. : R2EP_BC; + values[kWR2EP_BC] = std::isnan(R2EP_BC) || std::isinf(R2EP_BC) ? 0. : 1.0; + values[kR2EP_AB_Im] = std::isnan(R2EP_AB_Im) || std::isinf(R2EP_AB_Im) ? 0. : R2EP_AB_Im; + values[kWR2EP_AB_Im] = std::isnan(R2EP_AB_Im) || std::isinf(R2EP_AB_Im) ? 0. : 1.0; + values[kR2EP_AC_Im] = std::isnan(R2EP_AC_Im) || std::isinf(R2EP_AC_Im) ? 0. : R2EP_AC_Im; + values[kWR2EP_AC_Im] = std::isnan(R2EP_AC_Im) || std::isinf(R2EP_AC_Im) ? 0. : 1.0; + values[kR2EP_BC_Im] = std::isnan(R2EP_BC_Im) || std::isinf(R2EP_BC_Im) ? 0. : R2EP_BC_Im; + values[kWR2EP_BC_Im] = std::isnan(R2EP_BC_Im) || std::isinf(R2EP_BC_Im) ? 0. : 1.0; } if constexpr ((fillMap & CollisionMC) > 0) { @@ -1680,11 +1776,11 @@ void VarManager::FillEvent(T const& event, float* values) } if constexpr ((fillMap & EventFilter) > 0) { - values[kIsDoubleGap] = (event.eventFilter() & (uint64_t(1) << kDoubleGap)) > 0; - values[kIsSingleGapA] = (event.eventFilter() & (uint64_t(1) << kSingleGapA)) > 0; - values[kIsSingleGapC] = (event.eventFilter() & (uint64_t(1) << kSingleGapC)) > 0; + values[kIsDoubleGap] = (event.eventFilter() & (static_cast(1) << kDoubleGap)) > 0; + values[kIsSingleGapA] = (event.eventFilter() & (static_cast(1) << kSingleGapA)) > 0; + values[kIsSingleGapC] = (event.eventFilter() & (static_cast(1) << kSingleGapC)) > 0; values[kIsSingleGap] = values[kIsSingleGapA] || values[kIsSingleGapC]; - values[kIsITSUPCMode] = (event.eventFilter() & (uint64_t(1) << kITSUPCMode)) > 0; + values[kIsITSUPCMode] = (event.eventFilter() & (static_cast(1) << kITSUPCMode)) > 0; } if constexpr ((fillMap & ReducedZdc) > 0) { @@ -1744,6 +1840,46 @@ void VarManager::FillEventTrackEstimators(TEvent const& collision, TAssoc const& } } +template +void VarManager::FillEventFlowResoFactor(T const& hs_sp, T const& hs_ep, float* values) +{ + if (!values) { + values = fgValues; + } + + if (values[kCentFT0C] >= 0.) { + int idx_sp = hs_sp->FindBin(values[kCentFT0C]); + int idx_ep = hs_ep->FindBin(values[kCentFT0C]); + + values[kR2SP] = hs_sp->GetBinContent(idx_sp); + values[kR2EP] = hs_ep->GetBinContent(idx_ep); + } +} + +template +void VarManager::FillTwoMixEventsFlowResoFactor(T const& hs_sp, T const& hs_ep, float* values) +{ + if (!values) { + values = fgValues; + } + + if (values[kTwoEvCentFT0C1] >= 0.) { + int idx_sp1 = hs_sp->FindBin(values[kTwoEvCentFT0C1]); + int idx_ep1 = hs_ep->FindBin(values[kTwoEvCentFT0C1]); + + values[kTwoR2SP1] = hs_sp->GetBinContent(idx_sp1); + values[kTwoR2EP1] = hs_ep->GetBinContent(idx_ep1); + } + + if (values[kTwoEvCentFT0C2] >= 0.) { + int idx_sp2 = hs_sp->FindBin(values[kTwoEvCentFT0C2]); + int idx_ep2 = hs_ep->FindBin(values[kTwoEvCentFT0C2]); + + values[kTwoR2SP2] = hs_sp->GetBinContent(idx_sp2); + values[kTwoR2EP2] = hs_ep->GetBinContent(idx_ep2); + } +} + template void VarManager::FillTwoEvents(T const& ev1, T const& ev2, float* values) { @@ -1790,42 +1926,16 @@ void VarManager::FillTwoMixEvents(T1 const& ev1, T1 const& ev2, T2 const& /*trac for (auto& track1 : tracks1) { Track1Filter = uint32_t(track1.isMuonSelected());} for (auto& track2 : tracks2) { Track2Filter = uint32_t(track2.isMuonSelected());} */ + if constexpr ((fillMap & CollisionCent) > 0 || (fillMap & ReducedEventExtended) > 0) { + values[kTwoEvCentFT0C1] = ev1.centFT0C(); + values[kTwoEvCentFT0C2] = ev2.centFT0C(); + } if constexpr ((fillMap & ReducedEventQvector) > 0) { // Tobe used for the calculation of u1q1 and u2q2 values[kQ2X0A1] = ev1.q2x0a(); values[kQ2X0A2] = ev2.q2x0a(); values[kQ2Y0A1] = ev1.q2y0a(); values[kQ2Y0A2] = ev2.q2y0a(); - - values[kTwoR2SP1] = (ev1.q2x0b() * ev1.q2x0c() + ev1.q2y0b() * ev1.q2y0c()); - values[kTwoR2SP2] = (ev2.q2x0b() * ev2.q2x0c() + ev2.q2y0b() * ev2.q2y0c()); - values[kTwoR2SP_AB1] = (ev1.q2x0a() * ev1.q2x0b() + ev1.q2y0a() * ev1.q2y0b()); - values[kTwoR2SP_AB2] = (ev2.q2x0a() * ev2.q2x0b() + ev2.q2y0a() * ev2.q2y0b()); - values[kTwoR2SP_AC1] = (ev1.q2x0a() * ev1.q2x0c() + ev1.q2y0a() * ev1.q2y0c()); - values[kTwoR2SP_AC2] = (ev2.q2x0a() * ev2.q2x0c() + ev2.q2y0a() * ev2.q2y0c()); - values[kTwoR2SP_BC1] = (ev1.q2x0b() * ev1.q2x0c() + ev1.q2y0b() * ev1.q2y0c()); - values[kTwoR2SP_BC2] = (ev2.q2x0b() * ev2.q2x0c() + ev2.q2y0b() * ev2.q2y0c()); - - if (ev1.q2y0a() * ev1.q2y0b() != 0.0) { - values[kTwoR2EP_AB1] = TMath::Cos(2 * (getEventPlane(2, ev1.q2x0a(), ev1.q2y0a()) - getEventPlane(2, ev1.q2x0b(), ev1.q2y0b()))); - } - if (ev2.q2y0a() * ev2.q2y0b() != 0.0) { - values[kTwoR2EP_AB2] = TMath::Cos(2 * (getEventPlane(2, ev2.q2x0a(), ev2.q2y0a()) - getEventPlane(2, ev2.q2x0b(), ev2.q2y0b()))); - } - if (ev1.q2y0a() * ev1.q2y0c() != 0.0) { - values[kTwoR2EP_AC1] = TMath::Cos(2 * (getEventPlane(2, ev1.q2x0a(), ev1.q2y0a()) - getEventPlane(2, ev1.q2x0c(), ev1.q2y0c()))); - } - if (ev2.q2y0a() * ev2.q2y0c() != 0.0) { - values[kTwoR2EP_AC2] = TMath::Cos(2 * (getEventPlane(2, ev2.q2x0a(), ev2.q2y0a()) - getEventPlane(2, ev2.q2x0c(), ev2.q2y0c()))); - } - if (ev1.q2y0b() * ev1.q2y0c() != 0.0) { - values[kTwoR2EP1] = TMath::Cos(2 * (getEventPlane(2, ev1.q2x0b(), ev1.q2y0b()) - getEventPlane(2, ev1.q2x0c(), ev1.q2y0c()))); - values[kTwoR2EP_BC1] = TMath::Cos(2 * (getEventPlane(2, ev1.q2x0b(), ev1.q2y0b()) - getEventPlane(2, ev1.q2x0c(), ev1.q2y0c()))); - } - if (ev2.q2y0b() * ev2.q2y0c() != 0.0) { - values[kTwoR2EP2] = TMath::Cos(2 * (getEventPlane(2, ev2.q2x0b(), ev2.q2y0b()) - getEventPlane(2, ev2.q2x0c(), ev2.q2y0c()))); - values[kTwoR2EP_BC2] = TMath::Cos(2 * (getEventPlane(2, ev2.q2x0b(), ev2.q2y0b()) - getEventPlane(2, ev2.q2x0c(), ev2.q2y0c()))); - } } if constexpr ((fillMap & CollisionQvect) > 0) { // Tobe used for the calculation of u1q1 and u2q2 @@ -1833,61 +1943,6 @@ void VarManager::FillTwoMixEvents(T1 const& ev1, T1 const& ev2, T2 const& /*trac values[kQ2X0A2] = (ev2.qvecBPosRe() * ev2.nTrkBPos() + ev2.qvecBNegRe() * ev2.nTrkBNeg()) / (ev2.nTrkBPos() + ev2.nTrkBNeg()); values[kQ2Y0A1] = (ev1.qvecBPosIm() * ev1.nTrkBPos() + ev1.qvecBNegIm() * ev1.nTrkBNeg()) / (ev1.nTrkBPos() + ev1.nTrkBNeg()); values[kQ2Y0A2] = (ev2.qvecBPosIm() * ev2.nTrkBPos() + ev2.qvecBNegIm() * ev2.nTrkBNeg()) / (ev2.nTrkBPos() + ev2.nTrkBNeg()); - - values[kTwoR2SP1] = (ev1.qvecFT0ARe() * ev1.qvecFT0CRe() + ev1.qvecFT0AIm() * ev1.qvecFT0CIm()); - values[kTwoR2SP2] = (ev2.qvecFT0ARe() * ev2.qvecFT0CRe() + ev2.qvecFT0AIm() * ev2.qvecFT0CIm()); - values[kTwoR2SP_AB1] = (values[kQ2X0A1] * ev1.qvecFT0ARe() + values[kQ2Y0A1] * ev1.qvecFT0AIm()); - values[kTwoR2SP_AB2] = (values[kQ2X0A2] * ev2.qvecFT0ARe() + values[kQ2Y0A2] * ev2.qvecFT0AIm()); - values[kTwoR2SP_AC1] = (values[kQ2X0A1] * ev1.qvecFT0CRe() + values[kQ2Y0A1] * ev1.qvecFT0CIm()); - values[kTwoR2SP_AC2] = (values[kQ2X0A2] * ev2.qvecFT0CRe() + values[kQ2Y0A2] * ev2.qvecFT0CIm()); - values[kTwoR2SP_BC1] = values[kTwoR2SP1]; - values[kTwoR2SP_BC2] = values[kTwoR2SP2]; - - if (values[kQ2Y0A1] * ev1.qvecFT0AIm() != 0.0) { - values[kTwoR2EP_AB1] = TMath::Cos(2 * (getEventPlane(2, values[kQ2X0A1], values[kQ2Y0A1]) - getEventPlane(2, ev1.qvecFT0ARe(), ev1.qvecFT0AIm()))); - } - if (values[kQ2Y0A2] * ev2.qvecFT0AIm() != 0.0) { - values[kTwoR2EP_AB2] = TMath::Cos(2 * (getEventPlane(2, values[kQ2X0A2], values[kQ2Y0A2]) - getEventPlane(2, ev2.qvecFT0ARe(), ev2.qvecFT0AIm()))); - } - if (values[kQ2Y0A1] * ev1.qvecFT0CIm() != 0.0) { - values[kTwoR2EP_AC1] = TMath::Cos(2 * (getEventPlane(2, values[kQ2X0A1], values[kQ2Y0A1]) - getEventPlane(2, ev1.qvecFT0CRe(), ev1.qvecFT0CIm()))); - } - if (values[kQ2Y0A2] * ev2.qvecFT0CIm() != 0.0) { - values[kTwoR2EP_AC2] = TMath::Cos(2 * (getEventPlane(2, values[kQ2X0A2], values[kQ2Y0A2]) - getEventPlane(2, ev2.qvecFT0CRe(), ev2.qvecFT0CIm()))); - } - if (ev1.qvecFT0AIm() * ev1.qvecFT0CIm() != 0.0) { - values[kTwoR2EP1] = TMath::Cos(2 * (getEventPlane(2, ev1.qvecFT0ARe(), ev1.qvecFT0AIm()) - getEventPlane(2, ev1.qvecFT0CRe(), ev1.qvecFT0CIm()))); - values[kTwoR2EP_BC1] = values[kTwoR2EP1]; - } - if (ev2.qvecFT0AIm() * ev2.qvecFT0CIm() != 0.0) { - values[kTwoR2EP2] = TMath::Cos(2 * (getEventPlane(2, ev2.qvecFT0ARe(), ev2.qvecFT0AIm()) - getEventPlane(2, ev2.qvecFT0CRe(), ev2.qvecFT0CIm()))); - values[kTwoR2EP_BC2] = values[kTwoR2EP2]; - } - } - - if (std::isnan(VarManager::fgValues[VarManager::kTwoR2SP1]) == true || std::isnan(VarManager::fgValues[VarManager::kTwoR2EP1]) == true) { - values[kTwoR2SP1] = -999.; - values[kTwoR2SP2] = -999.; - values[kTwoR2EP1] = -999.; - values[kTwoR2EP2] = -999.; - } - if (std::isnan(VarManager::fgValues[VarManager::kTwoR2SP_AB1]) == true || std::isnan(VarManager::fgValues[VarManager::kTwoR2EP_AB1]) == true) { - values[kTwoR2SP_AB1] = -999.; - values[kTwoR2SP_AB2] = -999.; - values[kTwoR2EP_AB1] = -999.; - values[kTwoR2EP_AB2] = -999.; - } - if (std::isnan(VarManager::fgValues[VarManager::kTwoR2SP_AC1]) == true || std::isnan(VarManager::fgValues[VarManager::kTwoR2EP_AC1]) == true) { - values[kTwoR2SP_AC1] = -999.; - values[kTwoR2SP_AC2] = -999.; - values[kTwoR2EP_AC1] = -999.; - values[kTwoR2EP_AC2] = -999.; - } - if (std::isnan(VarManager::fgValues[VarManager::kTwoR2SP_BC1]) == true || std::isnan(VarManager::fgValues[VarManager::kTwoR2EP_BC1]) == true) { - values[kTwoR2SP_BC1] = -999.; - values[kTwoR2SP_BC2] = -999.; - values[kTwoR2EP_BC1] = -999.; - values[kTwoR2EP_BC2] = -999.; } } @@ -2045,6 +2100,9 @@ void VarManager::FillTrack(T const& track, float* values) values[kHasTPC] = track.hasTPC(); if constexpr ((fillMap & TrackExtra) > 0) { + if (fgUsedVars[kTPCnCRoverFindCls]) { + values[kTPCnCRoverFindCls] = track.tpcCrossedRowsOverFindableCls(); + } if (fgUsedVars[kITSncls]) { values[kITSncls] = track.itsNCls(); // dynamic column } @@ -2538,6 +2596,10 @@ void VarManager::FillPair(T1 const& t1, T2 const& t2, float* values) } } + if (fgUsedVars[kDeltaEtaPair2]) { + values[kDeltaEtaPair2] = v1.Eta() - v2.Eta(); + } + if (fgUsedVars[kPsiPair]) { values[kDeltaPhiPair] = (t1.sign() * fgMagField > 0.) ? (v1.Phi() - v2.Phi()) : (v2.Phi() - v1.Phi()); double xipair = TMath::ACos((v1.Px() * v2.Px() + v1.Py() * v2.Py() + v1.Pz() * v2.Pz()) / v1.P() / v2.P()); @@ -2840,7 +2902,7 @@ void VarManager::FillTriple(T1 const& t1, T2 const& t2, T3 const& t3, float* val } } -template +template void VarManager::FillPairME(T1 const& t1, T2 const& t2, float* values) { // @@ -2876,13 +2938,46 @@ void VarManager::FillPairME(T1 const& t1, T2 const& t2, float* values) values[kPhi] = v12.Phi() > 0 ? v12.Phi() : v12.Phi() + 2. * M_PI; values[kRap] = -v12.Rapidity(); - // TODO: provide different computations for vn - // Compute the scalar product UQ for two muon from different event using Q-vector from A, for second and third harmonic - values[kU2Q2Ev1] = values[kQ2X0A1] * std::cos(2 * v1.Phi()) + values[kQ2Y0A1] * std::sin(2 * v1.Phi()); - values[kU2Q2Ev2] = values[kQ2X0A2] * std::cos(2 * v2.Phi()) + values[kQ2Y0A2] * std::sin(2 * v2.Phi()); - values[kCos2DeltaPhiMu1] = std::cos(2 * (v1.Phi() - v12.Phi())); - values[kCos2DeltaPhiMu2] = std::cos(2 * (v2.Phi() - v12.Phi())); + if (fgUsedVars[kDeltaPhiPair2]) { + double phipair2ME = v1.Phi() - v2.Phi(); + if (phipair2ME > 3 * TMath::Pi() / 2) { + values[kDeltaPhiPair2] = phipair2ME - 2 * TMath::Pi(); + } else if (phipair2ME < -TMath::Pi() / 2) { + values[kDeltaPhiPair2] = phipair2ME + 2 * TMath::Pi(); + } else { + values[kDeltaPhiPair2] = phipair2ME; + } + } + + if (fgUsedVars[kDeltaEtaPair2]) { + values[kDeltaEtaPair2] = v1.Eta() - v2.Eta(); + } + + if constexpr ((fillMap & ReducedEventQvector) > 0 || (fillMap & CollisionQvect) > 0) { + // TODO: provide different computations for vn + // Compute the scalar product UQ for two muon from different event using Q-vector from A, for second and third harmonic + float Psi2A1 = getEventPlane(2, values[kQ2X0A1], values[kQ2Y0A1]); + float Psi2A2 = getEventPlane(2, values[kQ2X0A2], values[kQ2Y0A2]); + values[kCos2DeltaPhiEv1] = TMath::Cos(2 * (v1.Phi() - Psi2A1)); + values[kCos2DeltaPhiEv2] = TMath::Cos(2 * (v2.Phi() - Psi2A2)); + values[kU2Q2Ev1] = values[kQ2X0A1] * TMath::Cos(2 * v1.Phi()) + values[kQ2Y0A1] * TMath::Sin(2 * v1.Phi()); + values[kU2Q2Ev2] = values[kQ2X0A2] * TMath::Cos(2 * v2.Phi()) + values[kQ2Y0A2] * TMath::Sin(2 * v2.Phi()); + values[kCos2DeltaPhiMu1] = TMath::Cos(2 * (v1.Phi() - v12.Phi())); + values[kCos2DeltaPhiMu2] = TMath::Cos(2 * (v2.Phi() - v12.Phi())); + + values[kV2SP1] = values[kU2Q2Ev1] / values[kTwoR2SP1]; + values[kV2SP2] = values[kU2Q2Ev2] / values[kTwoR2SP2]; + values[kV2EP1] = values[kCos2DeltaPhiEv1] / values[kTwoR2EP1]; + values[kV2EP2] = values[kCos2DeltaPhiEv2] / values[kTwoR2EP2]; + + float V2ME_SP = values[kV2SP1] * values[kCos2DeltaPhiMu1] + values[kV2SP2] * values[kCos2DeltaPhiMu2]; + float V2ME_EP = values[kV2EP1] * values[kCos2DeltaPhiMu1] + values[kV2EP2] * values[kCos2DeltaPhiMu2]; + values[kV2ME_SP] = std::isnan(V2ME_SP) || std::isinf(V2ME_SP) ? 0. : V2ME_SP; + values[kWV2ME_SP] = std::isnan(V2ME_SP) || std::isinf(V2ME_SP) ? 0. : 1.0; + values[kV2ME_EP] = std::isnan(V2ME_EP) || std::isinf(V2ME_EP) ? 0. : V2ME_EP; + values[kWV2ME_EP] = std::isnan(V2ME_EP) || std::isinf(V2ME_EP) ? 0. : 1.0; + } if constexpr (pairType == kDecayToMuMu) { if (fgUsedVars[kQuadDCAabsXY]) { double dca1X = t1.fwdDcaX(); @@ -3727,10 +3822,10 @@ void VarManager::FillDileptonTrackVertexing(C const& collision, T1 const& lepton values[VarManager::kVertexingLxy] = (collision.posX() - secondaryVertex[0]) * (collision.posX() - secondaryVertex[0]) + (collision.posY() - secondaryVertex[1]) * (collision.posY() - secondaryVertex[1]); - values[VarManager::kVertexingLxy] = std::sqrt(values[VarManager::kVertexingLxy]); values[VarManager::kVertexingLz] = (collision.posZ() - secondaryVertex[2]) * (collision.posZ() - secondaryVertex[2]); - values[VarManager::kVertexingLz] = std::sqrt(values[VarManager::kVertexingLz]); values[VarManager::kVertexingLxyz] = values[VarManager::kVertexingLxy] + values[VarManager::kVertexingLz]; + values[VarManager::kVertexingLxy] = std::sqrt(values[VarManager::kVertexingLxy]); + values[VarManager::kVertexingLz] = std::sqrt(values[VarManager::kVertexingLz]); values[VarManager::kVertexingLxyz] = std::sqrt(values[VarManager::kVertexingLxyz]); } @@ -3920,8 +4015,21 @@ void VarManager::FillQVectorFromGFW(C const& /*collision*/, A const& compA11, A values[kM1111REF] = S41A - 6. * S12A * S21A + 8. * S13A * S11A + 3. * S22A - 6. * S14A; values[kCORR2REF] = (norm(compA21) - S12A) / values[kM11REF]; values[kCORR4REF] = (pow(norm(compA21), 2) + norm(compA42) - 2. * (compA42 * conj(compA21) * conj(compA21)).real() + 8. * (compA23 * conj(compA21)).real() - 4. * S12A * norm(compA21) - 6. * S14A - 2. * S22A) / values[kM1111REF]; - values[kCORR2REF] = std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : values[kCORR2REF]; - values[kCORR4REF] = std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) ? 0 : values[kCORR4REF]; + values[kCORR2REF] = std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : values[kCORR2REF]; + values[kM11REF] = std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : values[kM11REF]; + values[kCORR4REF] = std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) ? 0 : values[kCORR4REF]; + values[kM1111REF] = std::isnan(values[kM1111REF]) || std::isinf(values[kM1111REF]) || std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) ? 0 : values[kM1111REF]; + values[kCORR2CORR4REF] = values[kCORR2REF] * values[kCORR4REF]; + values[kM11M1111REF] = values[kM11REF] * values[kM1111REF]; + + // For cumulants: A = Full TPC, B = Negative TPC, C = Positive TPC + complex QA(values[kQ2X0A] * values[kS11A], values[kQ2Y0A] * values[kS11A]); + complex QB(values[kQ2X0B] * S11B, values[kQ2Y0B] * S11B); + complex QC(values[kQ2X0C] * S11C, values[kQ2Y0C] * S11C); + values[kM11REFetagap] = S11B * S11C; + values[kCORR2REFetagap] = ((QB * conj(QC)).real()) / values[kM11REFetagap]; + values[kCORR2REFetagap] = std::isnan(values[kM11REFetagap]) || std::isinf(values[kM11REFetagap]) || std::isnan(values[kCORR2REFetagap]) || std::isinf(values[kCORR2REFetagap]) ? 0 : values[kCORR2REFetagap]; + values[kM11REFetagap] = std::isnan(values[kM11REFetagap]) || std::isinf(values[kM11REFetagap]) || std::isnan(values[kCORR2REFetagap]) || std::isinf(values[kCORR2REFetagap]) ? 0 : values[kM11REFetagap]; // TODO: provide different computations for R // Compute the R factor using the 2 sub-events technique for second and third harmonic @@ -4029,17 +4137,17 @@ void VarManager::FillQVectorFromCentralFW(C const& collision, float* values) float epBNegs = epHelper.GetEventPlane(xQVecBNeg, yQVecBNeg, 2); float epTPCFull = epHelper.GetEventPlane(values[kQ2X0A], values[kQ2Y0A], 2); - values[kR2EP_AB] = std::cos(2 * getDeltaPsiInRange(epTPCFull, epFT0a, 2)); - values[kR2EP_AC] = std::cos(2 * getDeltaPsiInRange(epTPCFull, epFT0c, 2)); - values[kR2EP_BC] = std::cos(2 * getDeltaPsiInRange(epFT0a, epFT0c, 2)); - values[kR2EP_FT0CTPCPOS] = std::cos(2 * getDeltaPsiInRange(epFT0c, epBPoss, 2)); - values[kR2EP_FT0CTPCNEG] = std::cos(2 * getDeltaPsiInRange(epFT0c, epBNegs, 2)); - values[kR2EP_FT0ATPCPOS] = std::cos(2 * getDeltaPsiInRange(epFT0a, epBPoss, 2)); - values[kR2EP_FT0ATPCNEG] = std::cos(2 * getDeltaPsiInRange(epFT0a, epBNegs, 2)); - values[kR2EP_FT0MTPCPOS] = std::cos(2 * getDeltaPsiInRange(epFT0m, epBPoss, 2)); - values[kR2EP_FT0MTPCNEG] = std::cos(2 * getDeltaPsiInRange(epFT0m, epBNegs, 2)); - values[kR2EP_FV0ATPCPOS] = std::cos(2 * getDeltaPsiInRange(epFV0a, epBPoss, 2)); - values[kR2EP_FV0ATPCNEG] = std::cos(2 * getDeltaPsiInRange(epFV0a, epBNegs, 2)); + values[kR2EP_AB] = TMath::Cos(2 * getDeltaPsiInRange(epTPCFull, epFT0a, 2)); + values[kR2EP_AC] = TMath::Cos(2 * getDeltaPsiInRange(epTPCFull, epFT0c, 2)); + values[kR2EP_BC] = TMath::Cos(2 * getDeltaPsiInRange(epFT0a, epFT0c, 2)); + values[kR2EP_FT0CTPCPOS] = TMath::Cos(2 * getDeltaPsiInRange(epFT0c, epBPoss, 2)); + values[kR2EP_FT0CTPCNEG] = TMath::Cos(2 * getDeltaPsiInRange(epFT0c, epBNegs, 2)); + values[kR2EP_FT0ATPCPOS] = TMath::Cos(2 * getDeltaPsiInRange(epFT0a, epBPoss, 2)); + values[kR2EP_FT0ATPCNEG] = TMath::Cos(2 * getDeltaPsiInRange(epFT0a, epBNegs, 2)); + values[kR2EP_FT0MTPCPOS] = TMath::Cos(2 * getDeltaPsiInRange(epFT0m, epBPoss, 2)); + values[kR2EP_FT0MTPCNEG] = TMath::Cos(2 * getDeltaPsiInRange(epFT0m, epBNegs, 2)); + values[kR2EP_FV0ATPCPOS] = TMath::Cos(2 * getDeltaPsiInRange(epFV0a, epBPoss, 2)); + values[kR2EP_FV0ATPCNEG] = TMath::Cos(2 * getDeltaPsiInRange(epFV0a, epBNegs, 2)); } template @@ -4181,8 +4289,8 @@ void VarManager::FillPairVn(T1 const& t1, T2 const& t2, float* values) // TODO: provide different computations for vn // Compute the scalar product UQ using Q-vector from A, for second and third harmonic // Dilepton vn could be accessible after dividing this product with the R factor - values[kU2Q2] = values[kQ2X0A] * std::cos(2 * v12.Phi()) + values[kQ2Y0A] * std::sin(2 * v12.Phi()); - values[kU3Q3] = values[kQ3X0A] * std::cos(3 * v12.Phi()) + values[kQ3Y0A] * std::sin(3 * v12.Phi()); + values[kU2Q2] = values[kQ2X0A] * TMath::Cos(2 * v12.Phi()) + values[kQ2Y0A] * TMath::Sin(2 * v12.Phi()); + values[kU3Q3] = values[kQ3X0A] * TMath::Cos(3 * v12.Phi()) + values[kQ3Y0A] * TMath::Sin(3 * v12.Phi()); values[kR2SP_AB] = (values[kQ2X0A] * values[kQ2X0B] + values[kQ2Y0A] * values[kQ2Y0B]); values[kR2SP_AC] = (values[kQ2X0A] * values[kQ2X0C] + values[kQ2Y0A] * values[kQ2Y0C]); values[kR2SP_BC] = (values[kQ2X0B] * values[kQ2X0C] + values[kQ2Y0B] * values[kQ2Y0C]); @@ -4194,15 +4302,19 @@ void VarManager::FillPairVn(T1 const& t1, T2 const& t2, float* values) float Psi3B = getEventPlane(3, values[kQ3X0B], values[kQ3Y0B]); float Psi2C = getEventPlane(2, values[kQ2X0C], values[kQ2Y0C]); float Psi3C = getEventPlane(3, values[kQ3X0C], values[kQ3Y0C]); - values[kCos2DeltaPhi] = std::cos(2 * (v12.Phi() - Psi2A)); - values[kCos3DeltaPhi] = std::cos(3 * (v12.Phi() - Psi3A)); + values[kCos2DeltaPhi] = TMath::Cos(2 * (v12.Phi() - Psi2A)); + values[kCos3DeltaPhi] = TMath::Cos(3 * (v12.Phi() - Psi3A)); values[kR2EP_AB] = TMath::Cos(2 * (Psi2A - Psi2B)); values[kR2EP_AC] = TMath::Cos(2 * (Psi2A - Psi2C)); values[kR2EP_BC] = TMath::Cos(2 * (Psi2B - Psi2C)); values[kR3EP] = TMath::Cos(3 * (Psi3B - Psi3C)); - values[kCos2DeltaPhiMu1] = std::cos(2 * (v1.Phi() - v12.Phi())); - values[kCos2DeltaPhiMu2] = std::cos(2 * (v2.Phi() - v12.Phi())); + float V2SP = values[kU2Q2] / values[kR2SP]; + float V2EP = values[kCos2DeltaPhi] / values[kR2EP]; + values[kV2SP] = std::isnan(V2SP) || std::isinf(V2SP) ? 0. : V2SP; + values[kWV2SP] = std::isnan(V2SP) || std::isinf(V2SP) ? 0. : 1.0; + values[kV2EP] = std::isnan(V2EP) || std::isinf(V2EP) ? 0. : V2EP; + values[kWV2EP] = std::isnan(V2EP) || std::isinf(V2EP) ? 0. : 1.0; if (std::isnan(VarManager::fgValues[VarManager::kU2Q2]) == true) { values[kU2Q2] = -999.; @@ -4230,7 +4342,7 @@ void VarManager::FillPairVn(T1 const& t1, T2 const& t2, float* values) complex Q21(values[kQ2X0A] * values[kS11A], values[kQ2Y0A] * values[kS11A]); complex Q42(values[kQ42XA], values[kQ42YA]); complex Q23(values[kQ23XA], values[kQ23YA]); - complex P2(std::cos(2 * v12.Phi()), std::sin(2 * v12.Phi())); + complex P2(TMath::Cos(2 * v12.Phi()), TMath::Sin(2 * v12.Phi())); values[kM01POI] = values[kMultDimuons] * values[kS11A]; values[kM0111POI] = values[kMultDimuons] * (values[kS31A] - 3. * values[kS11A] * values[kS12A] + 2. * values[kS13A]); values[kCORR2POI] = (P2 * conj(Q21)).real() / values[kM01POI]; @@ -4244,6 +4356,16 @@ void VarManager::FillPairVn(T1 const& t1, T2 const& t2, float* values) values[kCORR2REF] = std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : values[kCORR2REF]; values[kCORR4REF] = std::isnan(values[kCORR4REF]) || std::isinf(values[kCORR4REF]) ? 0 : values[kCORR4REF]; } + + ROOT::Math::PtEtaPhiMVector v1_vp(v1.Pt(), v1.Eta(), v1.Phi() - Psi2B, v1.M()); + ROOT::Math::PtEtaPhiMVector v2_vp(v2.Pt(), v2.Eta(), v2.Phi() - Psi2B, v2.M()); + ROOT::Math::PtEtaPhiMVector v12_vp = v1_vp + v2_vp; + auto p12_vp = ROOT::Math::XYZVectorF(v12_vp.Px(), v12_vp.Py(), v12_vp.Pz()); + auto p12_vp_projXZ = ROOT::Math::XYZVectorF(p12_vp.X(), 0, p12_vp.Z()); + auto vDimu = (t1.sign() > 0 ? ROOT::Math::XYZVectorF(v1_vp.Px(), v1_vp.Py(), v1_vp.Pz()).Cross(ROOT::Math::XYZVectorF(v2_vp.Px(), v2_vp.Py(), v2_vp.Pz())) + : ROOT::Math::XYZVectorF(v2_vp.Px(), v2_vp.Py(), v2_vp.Pz()).Cross(ROOT::Math::XYZVectorF(v1_vp.Px(), v1_vp.Py(), v1_vp.Pz()))); + auto vRef = p12_vp.Cross(p12_vp_projXZ); + values[kPhiVP] = std::acos(vDimu.Dot(vRef) / (vRef.R() * vDimu.R())); } template @@ -4436,6 +4558,40 @@ void VarManager::FillDileptonTrackTrack(T1 const& dilepton, T2 const& hadron1, T } } +//__________________________________________________________________ +template +void VarManager::FillQaudMC(T1 const& dilepton, T2 const& track1, T2 const& track2, float* values) +{ + if (!values) { + values = fgValues; + } + + double defaultDileptonMass = 3.096; + double hadronMass1 = o2::constants::physics::MassPionCharged; + double hadronMass2 = o2::constants::physics::MassPionCharged; + if (candidateType == kXtoJpsiPiPi) { + defaultDileptonMass = 3.096; + hadronMass1 = o2::constants::physics::MassPionCharged; + hadronMass2 = o2::constants::physics::MassPionCharged; + } + + ROOT::Math::PtEtaPhiMVector v1(dilepton.pt(), dilepton.eta(), dilepton.phi(), defaultDileptonMass); + ROOT::Math::PtEtaPhiMVector v2(track1.pt(), track1.eta(), track1.phi(), hadronMass1); + ROOT::Math::PtEtaPhiMVector v3(track2.pt(), track2.eta(), track2.phi(), hadronMass2); + ROOT::Math::PtEtaPhiMVector v123 = v1 + v2 + v3; + ROOT::Math::PtEtaPhiMVector v23 = v2 + v3; + values[kQuadMass] = v123.M(); + values[kQuadDefaultDileptonMass] = v123.M(); + values[kQuadPt] = v123.Pt(); + values[kQuadEta] = v123.Eta(); + values[kQuadPhi] = v123.Phi(); + values[kQ] = v123.M() - defaultDileptonMass - v23.M(); + values[kDeltaR1] = sqrt(pow(v1.Eta() - v2.Eta(), 2) + pow(v1.Phi() - v2.Phi(), 2)); + values[kDeltaR2] = sqrt(pow(v1.Eta() - v3.Eta(), 2) + pow(v1.Phi() - v3.Phi(), 2)); + values[kDitrackMass] = v23.M(); + values[kDitrackPt] = v23.Pt(); +} + //__________________________________________________________________ template float VarManager::calculatePhiV(T1 const& t1, T2 const& t2) diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index 0a25b71065e..2c868f0873b 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -16,6 +16,7 @@ #define PWGDQ_DATAMODEL_REDUCEDINFOTABLES_H_ #include +#include #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Common/DataModel/Centrality.h" @@ -25,6 +26,8 @@ #include "Common/DataModel/PIDResponse.h" #include "MathUtils/Utils.h" +#include "PWGHF/Utils/utilsPid.h" + namespace o2::aod { @@ -45,12 +48,18 @@ DECLARE_SOA_BITMAP_COLUMN(Tag, tag, 64); //! Bit-field for storing event DECLARE_SOA_COLUMN(MCPosX, mcPosX, float); //! MC event position X DECLARE_SOA_COLUMN(MCPosY, mcPosY, float); //! MC event position Y DECLARE_SOA_COLUMN(MCPosZ, mcPosZ, float); //! MC event position Z -DECLARE_SOA_COLUMN(NTPCpileupContribA, nTPCpileupContribA, int); //! Number of TPC pileup tracks on A side -DECLARE_SOA_COLUMN(NTPCpileupContribC, nTPCpileupContribC, int); //! Number of TPC pileup tracks on C side -DECLARE_SOA_COLUMN(NTPCpileupZA, nTPCpileupZA, float); //! Median Z position of pileup tracks on A side -DECLARE_SOA_COLUMN(NTPCpileupZC, nTPCpileupZC, float); //! Median Z position of pileup tracks on C side -DECLARE_SOA_COLUMN(NTPCtracksInPast, nTPCtracksInPast, int); //! Number of TPC tracks in the past events (configurable, but e.g. one drift time) -DECLARE_SOA_COLUMN(NTPCtracksInFuture, nTPCtracksInFuture, int); //! Number of TPC tracks in the future events (configurable, but e.g. one drift time) +DECLARE_SOA_COLUMN(NTPCoccupContribLongA, nTPCoccupContribLongA, int); //! TPC pileup occupancy on A side (long time range) +DECLARE_SOA_COLUMN(NTPCoccupContribLongC, nTPCoccupContribLongC, int); //! TPC pileup occupancy on C side (long time range) +DECLARE_SOA_COLUMN(NTPCoccupMeanTimeLongA, nTPCoccupMeanTimeLongA, float); //! TPC pileup mean time on A side (long time range) +DECLARE_SOA_COLUMN(NTPCoccupMeanTimeLongC, nTPCoccupMeanTimeLongC, float); //! TPC pileup mean time on C side (long time range) +DECLARE_SOA_COLUMN(NTPCoccupMedianTimeLongA, nTPCoccupMedianTimeLongA, float); //! TPC pileup median time on A side (long time range) +DECLARE_SOA_COLUMN(NTPCoccupMedianTimeLongC, nTPCoccupMedianTimeLongC, float); //! TPC pileup median time on C side (long time range) +DECLARE_SOA_COLUMN(NTPCoccupContribShortA, nTPCoccupContribShortA, int); //! TPC pileup occupancy on A side (short time range) +DECLARE_SOA_COLUMN(NTPCoccupContribShortC, nTPCoccupContribShortC, int); //! TPC pileup occupancy on C side (short time range) +DECLARE_SOA_COLUMN(NTPCoccupMeanTimeShortA, nTPCoccupMeanTimeShortA, float); //! TPC pileup mean time on A side (short time range) +DECLARE_SOA_COLUMN(NTPCoccupMeanTimeShortC, nTPCoccupMeanTimeShortC, float); //! TPC pileup mean time on C side (short time range) +DECLARE_SOA_COLUMN(NTPCoccupMedianTimeShortA, nTPCoccupMedianTimeShortA, float); //! TPC pileup median time on A side (short time range) +DECLARE_SOA_COLUMN(NTPCoccupMedianTimeShortC, nTPCoccupMedianTimeShortC, float); //! TPC pileup median time on C side (short time range) // Columns declared to guarantee the backward compatibility of the tables DECLARE_SOA_COLUMN(QvecBPosRe, qvecBPosRe, float); @@ -108,18 +117,11 @@ DECLARE_SOA_COLUMN(M11REF, m11ref, float); //! Weighted multiplicity of <<2 DECLARE_SOA_COLUMN(M1111REF, m1111ref, float); //! Weighted multiplicity of <<4>> for reference flow } // namespace reducedevent -DECLARE_SOA_TABLE(ReducedEvents, "AOD", "REDUCEDEVENT", //! Main event information table - o2::soa::Index<>, - reducedevent::Tag, bc::RunNumber, - collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, - collision::CollisionTime, collision::CollisionTimeRes); - -DECLARE_SOA_TABLE(StoredReducedEvents, "AOD1", "REDUCEDEVENT", //! Main event information table - o2::soa::Index<>, - reducedevent::Tag, bc::RunNumber, - collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, - collision::CollisionTime, collision::CollisionTimeRes, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(ReducedEvents, "REDUCEDEVENT", //! Main event information table + o2::soa::Index<>, + reducedevent::Tag, bc::RunNumber, + collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, + collision::CollisionTime, collision::CollisionTimeRes); DECLARE_SOA_TABLE(ReducedEventsExtended, "AOD", "REEXTENDED", //! Extended event information bc::GlobalBC, evsel::Alias, evsel::Selection, timestamp::Timestamp, cent::CentRun2V0M, @@ -134,8 +136,12 @@ DECLARE_SOA_TABLE(ReducedEventsMultPV, "AOD", "REMULTPV", //! Multiplicity info DECLARE_SOA_TABLE(ReducedEventsMultAll, "AOD", "REMULTALL", //! Multiplicity information for all tracks in the event mult::MultAllTracksTPCOnly, mult::MultAllTracksITSTPC, - reducedevent::NTPCpileupContribA, reducedevent::NTPCpileupContribC, reducedevent::NTPCpileupZA, reducedevent::NTPCpileupZC, - reducedevent::NTPCtracksInPast, reducedevent::NTPCtracksInFuture); + reducedevent::NTPCoccupContribLongA, reducedevent::NTPCoccupContribLongC, + reducedevent::NTPCoccupMeanTimeLongA, reducedevent::NTPCoccupMeanTimeLongC, + reducedevent::NTPCoccupMedianTimeLongA, reducedevent::NTPCoccupMedianTimeLongC, + reducedevent::NTPCoccupContribShortA, reducedevent::NTPCoccupContribShortC, + reducedevent::NTPCoccupMeanTimeShortA, reducedevent::NTPCoccupMeanTimeShortC, + reducedevent::NTPCoccupMedianTimeShortA, reducedevent::NTPCoccupMedianTimeShortC); DECLARE_SOA_TABLE(ReducedEventsVtxCov, "AOD", "REVTXCOV", //! Event vertex covariance matrix collision::CovXX, collision::CovXY, collision::CovXZ, @@ -403,6 +409,9 @@ DECLARE_SOA_COLUMN(FwdDcaX, fwdDcaX, float); DECLARE_SOA_COLUMN(FwdDcaY, fwdDcaY, float); //! DECLARE_SOA_COLUMN(MftClusterSizesAndTrackFlags, mftClusterSizesAndTrackFlags, uint64_t); //! DECLARE_SOA_COLUMN(MftNClusters, mftNClusters, int); //! +DECLARE_SOA_INDEX_COLUMN(ReducedMCTrack, reducedMCTrack); //! +DECLARE_SOA_COLUMN(McMask, mcMask, uint16_t); //! +DECLARE_SOA_COLUMN(McReducedFlags, mcReducedFlags, uint16_t); //! } // namespace reducedmft // MFT track kinematics @@ -415,8 +424,13 @@ DECLARE_SOA_TABLE(ReducedMFTsExtra, "AOD", "RMFTEXTRA", //! reducedmft::MftClusterSizesAndTrackFlags, reducedmft::Sign, reducedmft::FwdDcaX, reducedmft::FwdDcaY, reducedmft::MftNClusters); +DECLARE_SOA_TABLE(ReducedMFTLabels, "AOD", "RTMFTLABELS", //! + reducedmft::ReducedMCTrackId, reducedmft::McMask, reducedmft::McReducedFlags); + // iterator using ReducedMFT = ReducedMFTs::iterator; +using ReducedMFTExtra = ReducedMFTsExtra::iterator; +using ReducedMFTLabel = ReducedMFTLabels::iterator; // muon quantities namespace reducedmuon @@ -697,28 +711,16 @@ DECLARE_SOA_DYNAMIC_COLUMN(Y, y, //! [](float pt, float eta, float m) -> float { return std::log((std::sqrt(m * m + pt * pt * std::cosh(eta) * std::cosh(eta)) + pt * std::sinh(eta)) / std::sqrt(m * m + pt * pt)); }); } // namespace reducedpair -DECLARE_SOA_TABLE(Dielectrons, "AOD", "RTDIELECTRON", //! - o2::soa::Index<>, reducedpair::ReducedEventId, - reducedpair::Mass, reducedpair::Pt, reducedpair::Eta, reducedpair::Phi, reducedpair::Sign, - reducedpair::FilterMap, reducedpair::McDecision, - reducedpair::Rap, - reducedpair::Y, - reducedpair::Px, - reducedpair::Py, - reducedpair::Pz, - reducedpair::P); - -DECLARE_SOA_TABLE(StoredDielectrons, "AOD1", "RTDIELECTRON", //! - o2::soa::Index<>, reducedpair::ReducedEventId, - reducedpair::Mass, reducedpair::Pt, reducedpair::Eta, reducedpair::Phi, reducedpair::Sign, - reducedpair::FilterMap, reducedpair::McDecision, - reducedpair::Rap, - reducedpair::Y, - reducedpair::Px, - reducedpair::Py, - reducedpair::Pz, - reducedpair::P, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(Dielectrons, "RTDIELECTRON", //! + o2::soa::Index<>, reducedpair::ReducedEventId, + reducedpair::Mass, reducedpair::Pt, reducedpair::Eta, reducedpair::Phi, reducedpair::Sign, + reducedpair::FilterMap, reducedpair::McDecision, + reducedpair::Rap, + reducedpair::Y, + reducedpair::Px, + reducedpair::Py, + reducedpair::Pz, + reducedpair::P); DECLARE_SOA_TABLE(Dimuons, "AOD", "RTDIMUON", //! o2::soa::Index<>, reducedpair::ReducedEventId, @@ -850,17 +852,18 @@ DECLARE_SOA_TABLE(DitracksExtra, "AOD", "RTDITRKEXTRA", //! // mft PID reduced data model namespace fwdpid { -DECLARE_SOA_COLUMN(Pt, pt, float); //! -DECLARE_SOA_COLUMN(Eta, eta, float); //! -DECLARE_SOA_COLUMN(Phi, phi, float); //! -DECLARE_SOA_COLUMN(Sign, sign, int); //! +DECLARE_SOA_COLUMN(Pt, pt, float); //! +DECLARE_SOA_COLUMN(Eta, eta, float); //! +DECLARE_SOA_COLUMN(Phi, phi, float); //! +DECLARE_SOA_COLUMN(Sign, sign, int); //! +DECLARE_SOA_COLUMN(McDecision, mcDecision, uint32_t); //! } // namespace fwdpid DECLARE_SOA_TABLE(FwdPidsAll, "AOD", "RTFWDPIDALL", //! fwdtrack::TrackType, collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, fwdpid::Pt, fwdpid::Eta, fwdpid::Phi, fwdpid::Sign, reducedmft::MftClusterSizesAndTrackFlags, - reducedmft::FwdDcaX, reducedmft::FwdDcaY, fwdtrack::Chi2MatchMCHMID, fwdtrack::Chi2MatchMCHMFT); + reducedmft::FwdDcaX, reducedmft::FwdDcaY, fwdtrack::Chi2MatchMCHMID, fwdtrack::Chi2MatchMCHMFT, fwdpid::McDecision); using FwdPidAll = FwdPidsAll::iterator; @@ -890,6 +893,62 @@ DECLARE_SOA_TABLE(DileptonTrackCandidates, "AOD", "RTDILEPTONTRACK", //! using DileptonTrackCandidate = DileptonTrackCandidates::iterator; +// candidate information +namespace dileptonTrackTrackCandidate +{ +// infotmation about the dilepton-track-track +DECLARE_SOA_COLUMN(Mass, mass, float); //! +DECLARE_SOA_COLUMN(Pt, pt, float); //! +DECLARE_SOA_COLUMN(Eta, eta, float); //! +DECLARE_SOA_COLUMN(Phi, phi, float); //! +DECLARE_SOA_COLUMN(Rap, rap, float); //! +DECLARE_SOA_COLUMN(DeltaQ, deltaQ, float); //! +DECLARE_SOA_COLUMN(R1, r1, float); //! distance between the dilepton and the track1 in theta-phi plane +DECLARE_SOA_COLUMN(R2, r2, float); //! distance between the dilepton and the track2 in theta-phi plane +DECLARE_SOA_COLUMN(DileptonMass, dileptonMass, float); //! +DECLARE_SOA_COLUMN(DileptonPt, dileptonPt, float); //! +DECLARE_SOA_COLUMN(DileptonEta, dileptonEta, float); //! +DECLARE_SOA_COLUMN(DileptonPhi, dileptonPhi, float); //! +DECLARE_SOA_COLUMN(DileptonSign, dileptonSign, int); //! +DECLARE_SOA_COLUMN(DiTracksMass, diTracksMass, float); //! +DECLARE_SOA_COLUMN(DiTracksPt, diTracksPt, float); //! +DECLARE_SOA_COLUMN(TrackPt1, trackPt1, float); //! +DECLARE_SOA_COLUMN(TrackPt2, trackPt2, float); //! +DECLARE_SOA_COLUMN(TrackEta1, trackEta1, float); //! +DECLARE_SOA_COLUMN(TrackEta2, trackEta2, float); //! +DECLARE_SOA_COLUMN(TrackPhi1, trackPhi1, float); //! +DECLARE_SOA_COLUMN(TrackPhi2, trackPhi2, float); //! +DECLARE_SOA_COLUMN(TrackSign1, trackSign1, int); //! +DECLARE_SOA_COLUMN(TrackSign2, trackSign2, int); //! +} // namespace dileptonTrackTrackCandidate + +DECLARE_SOA_TABLE(DileptonTrackTrackCandidates, "AOD", "RTDQUADPLET", //! + dileptonTrackTrackCandidate::Mass, + dileptonTrackTrackCandidate::Pt, + dileptonTrackTrackCandidate::Eta, + dileptonTrackTrackCandidate::Phi, + dileptonTrackTrackCandidate::Rap, + dileptonTrackTrackCandidate::DeltaQ, + dileptonTrackTrackCandidate::R1, + dileptonTrackTrackCandidate::R2, + dileptonTrackTrackCandidate::DileptonMass, + dileptonTrackTrackCandidate::DileptonPt, + dileptonTrackTrackCandidate::DileptonEta, + dileptonTrackTrackCandidate::DileptonPhi, + dileptonTrackTrackCandidate::DileptonSign, + dileptonTrackTrackCandidate::DiTracksMass, + dileptonTrackTrackCandidate::DiTracksPt, + dileptonTrackTrackCandidate::TrackPt1, + dileptonTrackTrackCandidate::TrackPt2, + dileptonTrackTrackCandidate::TrackEta1, + dileptonTrackTrackCandidate::TrackEta2, + dileptonTrackTrackCandidate::TrackPhi1, + dileptonTrackTrackCandidate::TrackPhi2, + dileptonTrackTrackCandidate::TrackSign1, + dileptonTrackTrackCandidate::TrackSign2); + +using DileptonTrackTrackCandidate = DileptonTrackTrackCandidates::iterator; + namespace v0bits { DECLARE_SOA_COLUMN(PIDBit, pidbit, uint8_t); //! @@ -919,33 +978,62 @@ DECLARE_SOA_TABLE(RedJpDmColls, "AOD", "REDJPDMCOLL", //! namespace jpsidmescorr { -DECLARE_SOA_INDEX_COLUMN(RedJpDmColl, redJpDmColl); //! -DECLARE_SOA_COLUMN(MassD0, massD0, float); //! -DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float); //! -DECLARE_SOA_COLUMN(Px, px, float); //! -DECLARE_SOA_COLUMN(Py, py, float); //! -DECLARE_SOA_COLUMN(Pz, pz, float); //! -DECLARE_SOA_COLUMN(DecVtxX, decVtxX, float); //! -DECLARE_SOA_COLUMN(DecVtxY, decVtxY, float); //! -DECLARE_SOA_COLUMN(DecVtxZ, decVtxZ, float); //! -DECLARE_SOA_COLUMN(BdtBkgMassHypo0, bdtBkgMassHypo0, float); //! -DECLARE_SOA_COLUMN(BdtPromptMassHypo0, bdtPromptMassHypo0, float); //! -DECLARE_SOA_COLUMN(BdtNonpromptMassHypo0, bdtNonpromptMassHypo0, float); //! -DECLARE_SOA_COLUMN(BdtBkg, bdtBkg, float); //! -DECLARE_SOA_COLUMN(BdtPrompt, bdtPrompt, float); //! -DECLARE_SOA_COLUMN(BdtNonprompt, bdtNonprompt, float); //! -DECLARE_SOA_COLUMN(BdtBkgMassHypo1, bdtBkgMassHypo1, float); //! -DECLARE_SOA_COLUMN(BdtPromptMassHypo1, bdtPromptMassHypo1, float); //! -DECLARE_SOA_COLUMN(BdtNonpromptMassHypo1, bdtNonpromptMassHypo1, float); //! -DECLARE_SOA_COLUMN(NumColls, numColls, uint64_t); //! -DECLARE_SOA_COLUMN(PtD0, ptD0, float); //! -DECLARE_SOA_COLUMN(PtJpsi, ptJpsi, float); //! -DECLARE_SOA_COLUMN(RapD0, rapD0, float); //! -DECLARE_SOA_COLUMN(RapJpsi, rapJpsi, float); //! -DECLARE_SOA_COLUMN(PhiD0, phiD0, float); //! -DECLARE_SOA_COLUMN(PhiJpsi, phiJpsi, float); //! -DECLARE_SOA_COLUMN(DeltaY, deltaY, float); //! -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! +DECLARE_SOA_INDEX_COLUMN(RedJpDmColl, redJpDmColl); //! +DECLARE_SOA_COLUMN(MassDmes, massDmes, float); //! +DECLARE_SOA_COLUMN(MassD0, massD0, float); //! +DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float); //! +DECLARE_SOA_COLUMN(Px, px, float); //! +DECLARE_SOA_COLUMN(Py, py, float); //! +DECLARE_SOA_COLUMN(Pz, pz, float); //! +DECLARE_SOA_COLUMN(DecVtxX, decVtxX, float); //! +DECLARE_SOA_COLUMN(DecVtxY, decVtxY, float); //! +DECLARE_SOA_COLUMN(DecVtxZ, decVtxZ, float); //! +DECLARE_SOA_COLUMN(BdtBkgMassHypo0, bdtBkgMassHypo0, float); //! +DECLARE_SOA_COLUMN(BdtPromptMassHypo0, bdtPromptMassHypo0, float); //! +DECLARE_SOA_COLUMN(BdtNonpromptMassHypo0, bdtNonpromptMassHypo0, float); //! +DECLARE_SOA_COLUMN(BdtBkg, bdtBkg, float); //! +DECLARE_SOA_COLUMN(BdtPrompt, bdtPrompt, float); //! +DECLARE_SOA_COLUMN(BdtNonprompt, bdtNonprompt, float); //! +DECLARE_SOA_COLUMN(BdtBkgMassHypo1, bdtBkgMassHypo1, float); //! +DECLARE_SOA_COLUMN(BdtPromptMassHypo1, bdtPromptMassHypo1, float); //! +DECLARE_SOA_COLUMN(BdtNonpromptMassHypo1, bdtNonpromptMassHypo1, float); //! +DECLARE_SOA_COLUMN(NumColls, numColls, uint64_t); //! +DECLARE_SOA_COLUMN(PtDmes, ptDmes, float); //! +DECLARE_SOA_COLUMN(PtJpsi, ptJpsi, float); //! +DECLARE_SOA_COLUMN(RapDmes, rapDmes, float); //! +DECLARE_SOA_COLUMN(RapJpsi, rapJpsi, float); //! +DECLARE_SOA_COLUMN(PhiDmes, phiDmes, float); //! +DECLARE_SOA_COLUMN(PhiJpsi, phiJpsi, float); //! +DECLARE_SOA_COLUMN(DeltaY, deltaY, float); //! +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! +DECLARE_SOA_COLUMN(NumItsClsDmesProng0, numItsClsDmesProng0, int); //! +DECLARE_SOA_COLUMN(NumItsClsDmesProng1, numItsClsDmesProng1, int); //! +DECLARE_SOA_COLUMN(NumTpcCrossedRowsDmesProng0, numTpcCrossedRowsDmesProng0, int); //! +DECLARE_SOA_COLUMN(NumTpcCrossedRowsDmesProng1, numTpcCrossedRowsDmesProng1, int); //! +DECLARE_SOA_COLUMN(EtaDmesProng0, etaDmesProng0, float); //! +DECLARE_SOA_COLUMN(EtaDmesProng1, etaDmesProng1, float); //! +DECLARE_SOA_COLUMN(PtDmesProng0, ptDmesProng0, float); //! +DECLARE_SOA_COLUMN(PtDmesProng1, ptDmesProng1, float); //! +DECLARE_SOA_COLUMN(MinNumItsClsDmesProng, minNumItsClsDmesProng, int); //! +DECLARE_SOA_COLUMN(MinNumTpcCrossedRowsDmesProng, minNumTpcCrossedRowsDmesProng, int); //! +DECLARE_SOA_COLUMN(MinAbsEtaDmesProng, minAbsEtaDmesProng, float); //! +DECLARE_SOA_COLUMN(MinPtDmesProng, minPtDmesProng, float); //! +DECLARE_SOA_COLUMN(NumSigmaTpcPiProng0, numSigmaTpcPiProng0, float); //! +DECLARE_SOA_COLUMN(NumSigmaTpcPiProng1, numSigmaTpcPiProng1, float); //! +DECLARE_SOA_COLUMN(NumSigmaTofPiProng0, numSigmaTofPiProng0, float); //! +DECLARE_SOA_COLUMN(NumSigmaTofPiProng1, numSigmaTofPiProng1, float); //! +DECLARE_SOA_COLUMN(NumSigmaTpcKaProng0, numSigmaTpcKaProng0, float); //! +DECLARE_SOA_COLUMN(NumSigmaTpcKaProng1, numSigmaTpcKaProng1, float); //! +DECLARE_SOA_COLUMN(NumSigmaTofKaProng0, numSigmaTofKaProng0, float); //! +DECLARE_SOA_COLUMN(NumSigmaTofKaProng1, numSigmaTofKaProng1, float); //! +DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofPiProng0, numSigmaTpcTofPiProng0, //! + [](float tpcNSigmaPi0, float tofNSigmaPi0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi0, tofNSigmaPi0); }); +DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofPiProng1, numSigmaTpcTofPiProng1, //! + [](float tpcNSigmaPi1, float tofNSigmaPi1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi1, tofNSigmaPi1); }); +DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofKaProng0, numSigmaTpcTofKaProng0, //! + [](float tpcNSigmaKa0, float tofNSigmaKa0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa0, tofNSigmaKa0); }); +DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofKaProng1, numSigmaTpcTofKaProng1, //! + [](float tpcNSigmaKa1, float tofNSigmaKa1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa1, tofNSigmaKa1); }); } // namespace jpsidmescorr DECLARE_SOA_TABLE(RedJpDmDileptons, "AOD", "REDJPDMDILEPTON", //! @@ -976,6 +1064,30 @@ DECLARE_SOA_TABLE(RedJpDmDmesons, "AOD", "REDJPDMDMESON", //! reducedpair::Sign, reducedpair::McDecision); +DECLARE_SOA_TABLE(RedJpDmDmDau0s, "AOD", "REDJPDMDMDAU0", //! + jpsidmescorr::PtDmesProng0, + jpsidmescorr::EtaDmesProng0, + jpsidmescorr::NumItsClsDmesProng0, + jpsidmescorr::NumTpcCrossedRowsDmesProng0, + jpsidmescorr::NumSigmaTpcPiProng0, + jpsidmescorr::NumSigmaTofPiProng0, + jpsidmescorr::NumSigmaTpcKaProng0, + jpsidmescorr::NumSigmaTofKaProng0, + jpsidmescorr::NumSigmaTpcTofPiProng0, + jpsidmescorr::NumSigmaTpcTofKaProng0); + +DECLARE_SOA_TABLE(RedJpDmDmDau1s, "AOD", "REDJPDMDMDAU1", //! + jpsidmescorr::PtDmesProng1, + jpsidmescorr::EtaDmesProng1, + jpsidmescorr::NumItsClsDmesProng1, + jpsidmescorr::NumTpcCrossedRowsDmesProng1, + jpsidmescorr::NumSigmaTpcPiProng1, + jpsidmescorr::NumSigmaTofPiProng1, + jpsidmescorr::NumSigmaTpcKaProng1, + jpsidmescorr::NumSigmaTofKaProng1, + jpsidmescorr::NumSigmaTpcTofPiProng1, + jpsidmescorr::NumSigmaTpcTofKaProng1); + DECLARE_SOA_TABLE(RedJpDmD0Masss, "AOD", "REDJPDMD0MASS", //! jpsidmescorr::MassD0, jpsidmescorr::MassD0bar); @@ -990,18 +1102,22 @@ DECLARE_SOA_TABLE(RedJpDmDmesBdts, "AOD", "REDJPDMDMESBDT", //! DECLARE_SOA_TABLE(RedDleptDmesAll, "AOD", "RTDILPTDMESALL", //! reducedpair::Mass, - jpsidmescorr::MassD0, + jpsidmescorr::MassDmes, jpsidmescorr::PtJpsi, - jpsidmescorr::PtD0, + jpsidmescorr::PtDmes, jpsidmescorr::RapJpsi, - jpsidmescorr::RapD0, + jpsidmescorr::RapDmes, jpsidmescorr::PhiJpsi, - jpsidmescorr::PhiD0, + jpsidmescorr::PhiDmes, jpsidmescorr::DeltaY, jpsidmescorr::DeltaPhi, jpsidmescorr::BdtBkg, jpsidmescorr::BdtPrompt, - jpsidmescorr::BdtNonprompt); + jpsidmescorr::BdtNonprompt, + jpsidmescorr::MinPtDmesProng, + jpsidmescorr::MinAbsEtaDmesProng, + jpsidmescorr::MinNumItsClsDmesProng, + jpsidmescorr::MinNumTpcCrossedRowsDmesProng); namespace muondca { @@ -1029,6 +1145,30 @@ DECLARE_SOA_TABLE(ReducedMuonsDca, "AOD", "RTMUONDCA", muondca::Pz); using ReducedMuonDca = ReducedMuonsDca::iterator; + +//______________________________________________________ +namespace generatedquarkoniamc +{ +//______________________________________________________ +// Binned content for generated particles: derived data +DECLARE_SOA_COLUMN(GeneratedEtaC1S, generatedEtaC1S, std::vector); //! Eta(1S) binned generated data +DECLARE_SOA_COLUMN(GeneratedJPsi, generatedJPsi, std::vector); //! J/Psi binned generated data +DECLARE_SOA_COLUMN(GeneratedChiC0, generatedChiC0, std::vector); //! ChiC0(1P) binned generated data +DECLARE_SOA_COLUMN(GeneratedChiC1, generatedChiC1, std::vector); //! ChiC1(1P) binned generated data +DECLARE_SOA_COLUMN(GeneratedHC, generatedHC, std::vector); //! hC binned generated data +DECLARE_SOA_COLUMN(GeneratedChiC2, generatedChiC2, std::vector); //! ChiC2(1P) binned generated data +DECLARE_SOA_COLUMN(GeneratedEtaC2S, generatedEtaC2S, std::vector); //! EtaC(2S) binned generated data +DECLARE_SOA_COLUMN(GeneratedPsi2S, generatedPsi2S, std::vector); //! Psi(2S) binned generated data +} // namespace generatedquarkoniamc + +DECLARE_SOA_TABLE(GeEtaC1S, "AOD", "GEETAC1S", generatedquarkoniamc::GeneratedEtaC1S); +DECLARE_SOA_TABLE(GeJPsi, "AOD", "GEJPSI", generatedquarkoniamc::GeneratedJPsi); +DECLARE_SOA_TABLE(GeChiC0, "AOD", "GECHIC0", generatedquarkoniamc::GeneratedChiC0); +DECLARE_SOA_TABLE(GeChiC1, "AOD", "GECHIC1", generatedquarkoniamc::GeneratedChiC1); +DECLARE_SOA_TABLE(GeHC, "AOD", "GEHC", generatedquarkoniamc::GeneratedHC); +DECLARE_SOA_TABLE(GeChiC2, "AOD", "GECHIC2", generatedquarkoniamc::GeneratedChiC2); +DECLARE_SOA_TABLE(GeEtaC2S, "AOD", "GEETAC2S", generatedquarkoniamc::GeneratedEtaC2S); +DECLARE_SOA_TABLE(GePsi2S, "AOD", "GEPSI2S", generatedquarkoniamc::GeneratedPsi2S); } // namespace o2::aod #endif // PWGDQ_DATAMODEL_REDUCEDINFOTABLES_H_ diff --git a/PWGDQ/TableProducer/CMakeLists.txt b/PWGDQ/TableProducer/CMakeLists.txt index 81c2976b2e7..b8fd20d356d 100644 --- a/PWGDQ/TableProducer/CMakeLists.txt +++ b/PWGDQ/TableProducer/CMakeLists.txt @@ -38,3 +38,8 @@ o2physics_add_dpl_workflow(table-maker-muon-mch-trk-eff SOURCES tableMakerMuonMchTrkEfficiency.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(generated-quarkonia-mc + SOURCES generatedQuarkoniaMC.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase O2Physics::PWGDQCore + COMPONENT_NAME Analysis) diff --git a/PWGDQ/TableProducer/generatedQuarkoniaMC.cxx b/PWGDQ/TableProducer/generatedQuarkoniaMC.cxx new file mode 100644 index 00000000000..737faaaa6b2 --- /dev/null +++ b/PWGDQ/TableProducer/generatedQuarkoniaMC.cxx @@ -0,0 +1,242 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//__________________________________________________ +// this task provides produces histograms containing +// the number of generated quarkonia per unit of +// percentile and per unit of pT +// It is meant to help with providing auxiliary information +// when dealing with derived data. + +#include +#include +#include +#include +#include +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "DCAFitter/DCAFitterN.h" +#include "ReconstructionDataFormats/Track.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFParticleIdentification.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/TableProducer/PID/pidTOFBase.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Qvectors.h" +#include "Framework/StaticFor.h" +#include "Common/DataModel/McCollisionExtra.h" +#include "PWGLF/DataModel/EPCalibrationTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; + +// simple bit checkers +#define bitset(var, nbit) ((var) |= (1 << (nbit))) +#define bitcheck(var, nbit) ((var) & (1 << (nbit))) + +struct generatedQuarkoniaMC { + SliceCache cache; + //__________________________________________________ + // Generated binned data + // this is a hack while the system does not do better + Produces geEtaC1S; + Produces geJPsi; + Produces geChiC0; + Produces geChiC1; + Produces geHC; + Produces geChiC2; + Produces geEtaC2S; + Produces gePsi2S; + + // histogram registry for bookkeeping + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + static constexpr int nSpecies = 8; + static constexpr int nParameters = 1; + static const std::vector particleNames; + static const std::vector particlePDGCodes; + static const std::vector parameterNames; + static const int defaultParameters[nSpecies][nParameters]; + static constexpr std::string_view particleNamesConstExpr[] = {"EtaC1S", "JPsi", "ChiC0", "ChiC1", + "hC", "ChiC2", "EtaC2S", "Psi2S"}; + + uint32_t enabledBits = 0; + + Configurable> enableGeneratedInfo{"enableGeneratedInfo", + {defaultParameters[0], nSpecies, + nParameters, particleNames, parameterNames}, + "Fill generated particle histograms for each species. 0: no, 1: yes"}; + + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; + ConfigurableAxis axisCentrality{"axisCentrality", {100, 0.0f, 100.0f}, "Centrality"}; + + ConfigurableAxis axisNVertices{"axisNVertices", {10, -0.5f, 9.5f}, "N(vertices)"}; + + std::vector genEtaC1S; + std::vector genJPsi; + std::vector genChiC0; + std::vector genChiC1; + std::vector genHC; + std::vector genChiC2; + std::vector genEtaC2S; + std::vector genPsi2S; + + // Preslice + Preslice mcParticlePerMcCollision = o2::aod::mcparticle::mcCollisionId; + + void init(InitContext&) + { + // setup map for fast checking if enabled + static_for<0, nSpecies - 1>([&](auto i) { + constexpr int index = i.value; + int f = enableGeneratedInfo->get(particleNames[index].c_str(), "Enable"); + if (f == 1) { + bitset(enabledBits, index); + } + }); + + // Creation of histograms: MC generated + for (Int_t i = 0; i < nSpecies; i++) { + histos.add(Form("h2dGenerated%s", particleNames[i].data()), Form("h2dGenerated%s", particleNames[i].data()), kTH2D, {axisCentrality, axisPt}); + } + + histos.add("h2dNVerticesVsCentrality", "h2dNVerticesVsCentrality", kTH2D, {axisCentrality, axisNVertices}); + + // reserve space for generated vectors if that process enabled + auto hBinFinder = histos.get(HIST("h2dGeneratedEtaC1S")); + LOGF(info, "Binned generated processing enabled. Initialising with %i elements...", hBinFinder->GetNcells()); + genEtaC1S.resize(hBinFinder->GetNcells(), 0); + genJPsi.resize(hBinFinder->GetNcells(), 0); + genChiC0.resize(hBinFinder->GetNcells(), 0); + genChiC1.resize(hBinFinder->GetNcells(), 0); + genHC.resize(hBinFinder->GetNcells(), 0); + genChiC2.resize(hBinFinder->GetNcells(), 0); + genEtaC2S.resize(hBinFinder->GetNcells(), 0); + genPsi2S.resize(hBinFinder->GetNcells(), 0); + LOGF(info, "Binned generated processing: init done."); + } + + void processReconstructedSimulation(aod::McCollision const& /*mcCollision*/, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles) + { + // this process function also checks if a given collision was reconstructed and checks explicitly for splitting, etc + // identify best-of collision + int biggestNContribs = -1; + float bestCentrality = 100.5; + for (auto& collision : collisions) { + if (biggestNContribs < collision.numContrib()) { + biggestNContribs = collision.numContrib(); + bestCentrality = collision.centFT0M(); + } + } + histos.fill(HIST("h2dNVerticesVsCentrality"), bestCentrality, collisions.size()); + + for (auto& mcp : mcParticles) { + if (TMath::Abs(mcp.y()) < 0.5 /* && mcp.isPhysicalPrimary()*/) { + static_for<0, nSpecies - 1>([&](auto i) { + constexpr int index = i.value; + if (mcp.pdgCode() == particlePDGCodes[index] && bitcheck(enabledBits, index)) { + histos.fill(HIST("h2dGenerated") + HIST(particleNamesConstExpr[index]), bestCentrality, mcp.pt()); + } + }); + } + } + } + + void processBinnedGenerated(soa::Join const& mcCollisions, aod::McParticles const& mcParticlesEntireTable) + { + // set to zero + std::fill(genEtaC1S.begin(), genEtaC1S.end(), 0); + std::fill(genJPsi.begin(), genJPsi.end(), 0); + std::fill(genChiC0.begin(), genChiC0.end(), 0); + std::fill(genChiC1.begin(), genChiC1.end(), 0); + std::fill(genHC.begin(), genHC.end(), 0); + std::fill(genChiC2.begin(), genChiC2.end(), 0); + std::fill(genEtaC2S.begin(), genEtaC2S.end(), 0); + std::fill(genPsi2S.begin(), genPsi2S.end(), 0); + + // this process function also checks if a given collision was reconstructed and checks explicitly for splitting, etc + for (auto& mcCollision : mcCollisions) { + const uint64_t mcCollIndex = mcCollision.globalIndex(); + + // use one of the generated histograms as the bin finder + auto hBinFinder = histos.get(HIST("h2dGeneratedEtaC1S")); + + auto mcParticles = mcParticlesEntireTable.sliceBy(mcParticlePerMcCollision, mcCollIndex); + for (auto& mcp : mcParticles) { + if (TMath::Abs(mcp.y()) < 0.5 /* && mcp.isPhysicalPrimary()*/) { + auto binNumber = hBinFinder->FindBin(mcCollision.bestCollisionCentFT0C(), mcp.pt()); // caution: pack + if (mcp.pdgCode() == 441) + genEtaC1S[binNumber]++; + if (mcp.pdgCode() == 443) + genJPsi[binNumber]++; + if (mcp.pdgCode() == 10441) + genChiC0[binNumber]++; + if (mcp.pdgCode() == 20443) + genChiC1[binNumber]++; + if (mcp.pdgCode() == 10443) + genHC[binNumber]++; + if (mcp.pdgCode() == 445) + genChiC2[binNumber]++; + if (mcp.pdgCode() == 100441) + genEtaC2S[binNumber]++; + if (mcp.pdgCode() == 100443) + genPsi2S[binNumber]++; + } + } + } + // at end of data frame + // -> pack information from this DF into a generated histogram, once / DF + geEtaC1S(genEtaC1S); + geJPsi(genJPsi); + geChiC0(genChiC0); + geChiC1(genChiC1); + geHC(genHC); + geChiC2(genChiC2); + geEtaC2S(genEtaC2S); + gePsi2S(genPsi2S); + } + + PROCESS_SWITCH(generatedQuarkoniaMC, processReconstructedSimulation, "Produce reco-ed simulated information", true); + PROCESS_SWITCH(generatedQuarkoniaMC, processBinnedGenerated, "Produce binned generated information", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} + +//__________________________________________________ +// do not over-populate general namespace, keep scope generatedQuarkoniaMC:: +const std::vector generatedQuarkoniaMC::particleNames{"EtaC1S", "JPsi", "ChiC0", "ChiC1", + "hC", "ChiC2", "EtaC2S", "Psi2S"}; +const std::vector generatedQuarkoniaMC::particlePDGCodes{441, 443, 10441, 20443, 10443, 445, 100441, 100443}; +const std::vector generatedQuarkoniaMC::parameterNames{"Enable"}; + +const int generatedQuarkoniaMC::defaultParameters[generatedQuarkoniaMC::nSpecies][generatedQuarkoniaMC::nParameters] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}}; diff --git a/PWGDQ/TableProducer/tableMaker.cxx b/PWGDQ/TableProducer/tableMaker.cxx index 6eb031eb38e..0e54baa926f 100644 --- a/PWGDQ/TableProducer/tableMaker.cxx +++ b/PWGDQ/TableProducer/tableMaker.cxx @@ -17,7 +17,13 @@ // The skimming can optionally produce just the barrel, muon, or both barrel and muon tracks // The event filtering (filterPP), centrality, and V0Bits (from v0-selector) can be switched on/off by selecting one // of the process functions +// C++ includes #include +#include +#include +#include +#include +// other includes #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" @@ -56,7 +62,6 @@ #include "DetectorsBase/Propagator.h" #include "DetectorsBase/GeometryManager.h" #include "EventFiltering/Zorro.h" -#include "Framework/HistogramRegistry.h" using std::cout; using std::endl; @@ -110,14 +115,6 @@ using MyMuonsColl = soa::Join; using ExtBCs = soa::Join; -namespace o2::aod -{ -DECLARE_SOA_TABLE(AmbiguousTracksMid, "AOD", "AMBIGUOUSTRACK", //! Table for tracks which are not uniquely associated with a collision - o2::soa::Index<>, o2::aod::ambiguous::TrackId, o2::aod::ambiguous::BCIdSlice, o2::soa::Marker<2>); -DECLARE_SOA_TABLE(AmbiguousTracksFwd, "AOD", "AMBIGUOUSFWDTR", //! Table for Fwd tracks which are not uniquely associated with a collision - o2::soa::Index<>, o2::aod::ambiguous::FwdTrackId, o2::aod::ambiguous::BCIdSlice, o2::soa::Marker<2>); -} // namespace o2::aod - constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; constexpr static uint32_t gkEventFillMapWithMult = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult | VarManager::ObjTypes::CollisionMultExtra; constexpr static uint32_t gkEventFillMapWithMultsAndEventFilter = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult | VarManager::ObjTypes::CollisionMultExtra | VarManager::ObjTypes::EventFilter; @@ -182,12 +179,13 @@ struct TableMaker { struct : ConfigurableGroup { Configurable fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"}; Configurable fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"}; + Configurable fConfigRunZorroSel{"cfgRunZorroSel", false, "Select events with trigger mask"}; } useZorro; struct : ConfigurableGroup { Configurable fConfigCcdbUrl{"useCCDBConfigurations.ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigCcdbPathTPC{"useCCDBConfigurations.ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; - Configurable fConfigCcdbPathZorro{"useCCDBConfigurations.ccdb-path-zorro", "Users/r/rlietava/EventFiltering/OTS/", "base path to the ccdb object for zorro"}; + Configurable fConfigCcdbPathZorro{"useCCDBConfigurations.ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/", "base path to the ccdb object for zorro"}; } useCCDBConfigurations; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -223,8 +221,6 @@ struct TableMaker { bool fDoDetailedQA = false; // Bool to set detailed QA true, if QA is set true int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. - HistogramRegistry registry{"registry"}; - // TODO: filter on TPC dedx used temporarily until electron PID will be improved Filter barrelSelectedTracks = ifnode(fIsRun2.node() == true, aod::track::trackType == uint8_t(aod::track::Run2Track), aod::track::trackType == uint8_t(aod::track::Track)) && o2::aod::track::pt >= fConfigBarrelTrackPtLow && nabs(o2::aod::track::eta) <= fConfigBarrelTrackMaxAbsEta && o2::aod::track::tpcSignal >= fConfigMinTpcSignal && o2::aod::track::tpcSignal <= fConfigMaxTpcSignal && o2::aod::track::tpcChi2NCl < 4.0f && o2::aod::track::itsChi2NCl < 36.0f; @@ -274,7 +270,7 @@ struct TableMaker { context.mOptions.get("processBarrelOnlyWithMultsAndEventFilter") || context.mOptions.get("processBarrelOnlyWithCovAndEventFilter") || context.mOptions.get("processBarrelOnlyWithDalitzBits") || context.mOptions.get("processBarrelOnlyWithV0Bits") || context.mOptions.get("processBarrelWithDalitzEvent") || context.mOptions.get("processBarrelOnlyWithV0BitsAndMaps") || context.mOptions.get("processAmbiguousBarrelOnly")) || - context.mOptions.get("processBarrelWithV0AndDalitzEvent"); + context.mOptions.get("processBarrelWithV0AndDalitzEvent") || context.mOptions.get("processBarrelOnlyWithV0BitsAndMults"); bool enableMuonHistos = (context.mOptions.get("processFull") || context.mOptions.get("processFullWithCov") || context.mOptions.get("processFullWithCent") || context.mOptions.get("processFullWithCovAndEventFilter") || context.mOptions.get("processFullWithCovMultsAndEventFilter") || context.mOptions.get("processMuonOnlyWithCovAndCent") || @@ -415,7 +411,7 @@ struct TableMaker { // if the BC found by event selection does not coincide with the collision.bc() auto bcEvSel = collision.template foundBC_as(); if (bcEvSel.globalIndex() != bc.globalIndex()) { - tag |= (uint64_t(1) << 0); + tag |= (static_cast(1) << 0); } // Put the 8 first bits of the event filter in the last 8 bits of the tag if constexpr ((TEventFillMap & VarManager::ObjTypes::EventFilter) > 0) { @@ -439,7 +435,7 @@ struct TableMaker { uint32_t triggerAliases = collision.alias_raw(); // fill stats information, before selections for (int i = 0; i < kNaliases; i++) { - if (triggerAliases & (uint32_t(1) << i)) { + if (triggerAliases & (static_cast(1) << i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(i)); } } @@ -448,12 +444,14 @@ struct TableMaker { if (useZorro.fConfigRunZorro) { zorro.setBaseCCDBPath(useCCDBConfigurations.fConfigCcdbPathZorro.value); zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), useZorro.fConfigZorroTrigMask.value); - - zorro.populateHistRegistry(registry, fCurrentRun); - - if (zorro.isSelected(bc.globalBC())) { + zorro.populateExternalHists(fCurrentRun, reinterpret_cast(fStatsList->At(3)), reinterpret_cast(fStatsList->At(4))); + bool zorroSel = zorro.isSelected(bc.globalBC(), 100UL, reinterpret_cast(fStatsList->At(4))); + if (zorroSel) { tag |= (static_cast(true) << 56); // the same bit is used for this zorro selections from ccdb } + if (useZorro.fConfigRunZorroSel && (!zorroSel || !fEventCut->IsSelected(VarManager::fgValues))) { + return; + } } else { if (!fEventCut->IsSelected(VarManager::fgValues)) { return; @@ -462,7 +460,7 @@ struct TableMaker { // fill stats information, after selections for (int i = 0; i < kNaliases; i++) { - if (triggerAliases & (uint32_t(1) << i)) { + if (triggerAliases & (static_cast(1) << i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(3.0, static_cast(i)); } } @@ -494,7 +492,7 @@ struct TableMaker { multPV(collision.multNTracksHasITS(), collision.multNTracksHasTPC(), collision.multNTracksHasTOF(), collision.multNTracksHasTRD(), collision.multNTracksITSOnly(), collision.multNTracksTPCOnly(), collision.multNTracksITSTPC(), collision.trackOccupancyInTimeRange()); multAll(collision.multAllTracksTPCOnly(), collision.multAllTracksITSTPC(), - 0, 0, 0.0, 0.0, 0, 0); + 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0); } uint64_t trackFilteringTag = 0; @@ -524,7 +522,7 @@ struct TableMaker { } } - trackFilteringTag = uint64_t(0); + trackFilteringTag = static_cast(0); trackTempFilterMap = uint8_t(0); VarManager::FillTrack(track); if (fDoDetailedQA) { @@ -560,35 +558,35 @@ struct TableMaker { trackFilteringTag |= (uint64_t(1) << 1); // BIT1: global track SSD }*/ if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackV0Bits)) { // BIT0-4: V0Bits - trackFilteringTag = uint64_t(track.pidbit()); + trackFilteringTag = static_cast(track.pidbit()); for (int iv0 = 0; iv0 < 5; iv0++) { if (track.pidbit() & (uint8_t(1) << iv0)) { (reinterpret_cast(fStatsList->At(1)))->Fill(fTrackCuts.size() + static_cast(iv0)); } } if (fConfigIsOnlyforMaps) { - if (trackFilteringTag & (uint64_t(1) << VarManager::kIsConversionLeg)) { // for electron + if (trackFilteringTag & (static_cast(1) << VarManager::kIsConversionLeg)) { // for electron fHistMan->FillHistClass("TrackBarrel_PostCalibElectron", VarManager::fgValues); } - if (trackFilteringTag & (uint64_t(1) << VarManager::kIsK0sLeg)) { // for pion + if (trackFilteringTag & (static_cast(1) << VarManager::kIsK0sLeg)) { // for pion fHistMan->FillHistClass("TrackBarrel_PostCalibPion", VarManager::fgValues); } - if ((static_cast(trackFilteringTag & (uint64_t(1) << VarManager::kIsLambdaLeg)) * (track.sign()) > 0)) { // for proton from Lambda + if ((static_cast(trackFilteringTag & (static_cast(1) << VarManager::kIsLambdaLeg)) * (track.sign()) > 0)) { // for proton from Lambda fHistMan->FillHistClass("TrackBarrel_PostCalibProton", VarManager::fgValues); } - if ((static_cast(trackFilteringTag & (uint64_t(1) << VarManager::kIsALambdaLeg)) * (track.sign()) < 0)) { // for proton from AntiLambda + if ((static_cast(trackFilteringTag & (static_cast(1) << VarManager::kIsALambdaLeg)) * (track.sign()) < 0)) { // for proton from AntiLambda fHistMan->FillHistClass("TrackBarrel_PostCalibProton", VarManager::fgValues); } } } if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::DalitzBits)) { - trackFilteringTag |= (uint64_t(track.dalitzBits()) << VarManager::kDalitzBits); // BIT5-12: Dalitz selection bits + trackFilteringTag |= (static_cast(track.dalitzBits()) << VarManager::kDalitzBits); // BIT5-12: Dalitz selection bits } - trackFilteringTag |= (uint64_t(trackTempFilterMap) << VarManager::kBarrelUserCutsBits); // BIT13-20...: user track filters + trackFilteringTag |= (static_cast(trackTempFilterMap) << VarManager::kBarrelUserCutsBits); // BIT13-20...: user track filters if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackPID)) { if (fConfigComputeTPCpostCalib) { - trackFilteringTag |= (uint64_t(1) << VarManager::kIsTPCPostcalibrated); // store the info on whether TPC pid is skimmed as postcalibrated + trackFilteringTag |= (static_cast(1) << VarManager::kIsTPCPostcalibrated); // store the info on whether TPC pid is skimmed as postcalibrated } } @@ -683,7 +681,7 @@ struct TableMaker { std::map newMFTMatchIndex; for (auto& muon : tracksMuon) { - fwdFilteringTag = uint64_t(0); + fwdFilteringTag = static_cast(0); VarManager::FillTrack(muon); if (fPropMuon) { VarManager::FillPropagateMuon(muon, collision); @@ -826,7 +824,7 @@ struct TableMaker { } } } // end if constexpr (TMuonFillMap) - } // end fullSkimming() + } // end fullSkimming() // Templated function instantianed for all of the process functions template @@ -877,7 +875,7 @@ struct TableMaker { // if the BC found by event selection does not coincide with the collision.bc() auto bcEvSel = collision.template foundBC_as(); if (bcEvSel.globalIndex() != bc.globalIndex()) { - tag |= (uint64_t(1) << 0); + tag |= (static_cast(1) << 0); } // Put the 8 first bits of the event filter in the last 8 bits of the tag if constexpr ((TEventFillMap & VarManager::ObjTypes::EventFilter) > 0) { @@ -900,7 +898,7 @@ struct TableMaker { // fill stats information, before selections for (int i = 0; i < kNaliases; i++) { - if (triggerAliases & (uint32_t(1) << i)) { + if (triggerAliases & (static_cast(1) << i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(i)); } } @@ -909,12 +907,14 @@ struct TableMaker { if (useZorro.fConfigRunZorro) { zorro.setBaseCCDBPath(useCCDBConfigurations.fConfigCcdbPathZorro.value); zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), useZorro.fConfigZorroTrigMask.value); - - zorro.populateHistRegistry(registry, fCurrentRun); - - if (zorro.isSelected(bc.globalBC())) { + zorro.populateExternalHists(fCurrentRun, reinterpret_cast(fStatsList->At(3)), reinterpret_cast(fStatsList->At(4))); + bool zorroSel = zorro.isSelected(bc.globalBC(), 100UL, reinterpret_cast(fStatsList->At(4))); + if (zorroSel) { tag |= (static_cast(true) << 56); // the same bit is used for this zorro selections from ccdb } + if (useZorro.fConfigRunZorroSel && (!zorroSel || !fEventCut->IsSelected(VarManager::fgValues))) { + return; + } } else { if (!fEventCut->IsSelected(VarManager::fgValues)) { return; @@ -923,7 +923,7 @@ struct TableMaker { // fill stats information, after selections for (int i = 0; i < kNaliases; i++) { - if (triggerAliases & (uint32_t(1) << i)) { + if (triggerAliases & (static_cast(1) << i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(3.0, static_cast(i)); } } @@ -971,7 +971,7 @@ struct TableMaker { isAmbiguous = (track.compatibleCollIds().size() != 1); } } - trackFilteringTag = uint64_t(0); + trackFilteringTag = static_cast(0); trackTempFilterMap = uint8_t(0); VarManager::FillTrack(track); if (fDoDetailedQA) { @@ -1001,37 +1001,37 @@ struct TableMaker { // store filtering information if (track.isGlobalTrack()) { - trackFilteringTag |= (uint64_t(1) << 0); // BIT0: global track + trackFilteringTag |= (static_cast(1) << 0); // BIT0: global track } if (track.isGlobalTrackSDD()) { - trackFilteringTag |= (uint64_t(1) << 1); // BIT1: global track SSD + trackFilteringTag |= (static_cast(1) << 1); // BIT1: global track SSD } if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackV0Bits)) { // BIT2-6: V0Bits - trackFilteringTag |= (uint64_t(track.pidbit()) << 2); + trackFilteringTag |= (static_cast(track.pidbit()) << 2); for (int iv0 = 0; iv0 < 5; iv0++) { if (track.pidbit() & (uint8_t(1) << iv0)) { (reinterpret_cast(fStatsList->At(1)))->Fill(fTrackCuts.size() + static_cast(iv0)); } } if (fConfigIsOnlyforMaps) { - if (trackFilteringTag & (uint64_t(1) << 2)) { // for electron + if (trackFilteringTag & (static_cast(1) << 2)) { // for electron fHistMan->FillHistClass("TrackBarrel_PostCalibElectron", VarManager::fgValues); } - if (trackFilteringTag & (uint64_t(1) << 3)) { // for pion + if (trackFilteringTag & (static_cast(1) << 3)) { // for pion fHistMan->FillHistClass("TrackBarrel_PostCalibPion", VarManager::fgValues); } - if ((static_cast(trackFilteringTag & (uint64_t(1) << 4)) * (track.sign()) > 0)) { // for proton from Lambda + if ((static_cast(trackFilteringTag & (static_cast(1) << 4)) * (track.sign()) > 0)) { // for proton from Lambda fHistMan->FillHistClass("TrackBarrel_PostCalibProton", VarManager::fgValues); } - if ((static_cast(trackFilteringTag & (uint64_t(1) << 5)) * (track.sign()) < 0)) { // for proton from AntiLambda + if ((static_cast(trackFilteringTag & (static_cast(1) << 5)) * (track.sign()) < 0)) { // for proton from AntiLambda fHistMan->FillHistClass("TrackBarrel_PostCalibProton", VarManager::fgValues); } } } if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::DalitzBits)) { - trackFilteringTag |= (uint64_t(track.dalitzBits()) << 7); // BIT7-14: Dalitz + trackFilteringTag |= (static_cast(track.dalitzBits()) << 7); // BIT7-14: Dalitz } - trackFilteringTag |= (uint64_t(trackTempFilterMap) << 15); // BIT15-...: user track filters + trackFilteringTag |= (static_cast(trackTempFilterMap) << 15); // BIT15-...: user track filters // create the track tables trackBarrelInfo(track.collisionId(), collision.posX(), collision.posY(), collision.posZ(), track.globalIndex()); @@ -1085,7 +1085,7 @@ struct TableMaker { for (const auto& muonId : fwdtrackIndices) { // start loop over tracks auto muon = muonId.template fwdtrack_as(); - trackFilteringTag = uint64_t(0); + trackFilteringTag = static_cast(0); VarManager::FillTrack(muon); if (muon.index() > idxPrev + 1) { // checks if some muons are filtered even before the skimming function @@ -1115,7 +1115,7 @@ struct TableMaker { isAmbiguous = (muon.compatibleCollIds().size() != 1); } } - trackFilteringTag = uint64_t(0); + trackFilteringTag = static_cast(0); trackTempFilterMap = uint8_t(0); VarManager::FillTrack(muon); @@ -1187,22 +1187,22 @@ struct TableMaker { muon.matchScoreMCHMFT(), muon.mchBitMap(), muon.midBitMap(), muon.midBoards(), muon.trackType(), VarManager::fgValues[VarManager::kMuonDCAx], VarManager::fgValues[VarManager::kMuonDCAy], muon.trackTime(), muon.trackTimeRes()); - } else { - muonExtra(muon.nClusters(), muon.pDca(), muon.rAtAbsorberEnd(), - muon.chi2(), muon.chi2MatchMCHMID(), muon.chi2MatchMCHMFT(), - muon.matchScoreMCHMFT(), muon.mchBitMap(), muon.midBitMap(), - muon.midBoards(), muon.trackType(), muon.fwdDcaX(), muon.fwdDcaY(), - muon.trackTime(), muon.trackTimeRes()); - } + } else { + muonExtra(muon.nClusters(), muon.pDca(), muon.rAtAbsorberEnd(), + muon.chi2(), muon.chi2MatchMCHMID(), muon.chi2MatchMCHMFT(), + muon.matchScoreMCHMFT(), muon.mchBitMap(), muon.midBitMap(), + muon.midBoards(), muon.trackType(), muon.fwdDcaX(), muon.fwdDcaY(), + muon.trackTime(), muon.trackTimeRes()); + } - muonCov(VarManager::fgValues[VarManager::kX], VarManager::fgValues[VarManager::kY], VarManager::fgValues[VarManager::kZ], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kTgl], muon.sign() / VarManager::fgValues[VarManager::kPt], - VarManager::fgValues[VarManager::kMuonCXX], VarManager::fgValues[VarManager::kMuonCXY], VarManager::fgValues[VarManager::kMuonCYY], VarManager::fgValues[VarManager::kMuonCPhiX], VarManager::fgValues[VarManager::kMuonCPhiY], VarManager::fgValues[VarManager::kMuonCPhiPhi], - VarManager::fgValues[VarManager::kMuonCTglX], VarManager::fgValues[VarManager::kMuonCTglY], VarManager::fgValues[VarManager::kMuonCTglPhi], VarManager::fgValues[VarManager::kMuonCTglTgl], VarManager::fgValues[VarManager::kMuonC1Pt2X], VarManager::fgValues[VarManager::kMuonC1Pt2Y], - VarManager::fgValues[VarManager::kMuonC1Pt2Phi], VarManager::fgValues[VarManager::kMuonC1Pt2Tgl], VarManager::fgValues[VarManager::kMuonC1Pt21Pt2]); + muonCov(VarManager::fgValues[VarManager::kX], VarManager::fgValues[VarManager::kY], VarManager::fgValues[VarManager::kZ], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kTgl], muon.sign() / VarManager::fgValues[VarManager::kPt], + VarManager::fgValues[VarManager::kMuonCXX], VarManager::fgValues[VarManager::kMuonCXY], VarManager::fgValues[VarManager::kMuonCYY], VarManager::fgValues[VarManager::kMuonCPhiX], VarManager::fgValues[VarManager::kMuonCPhiY], VarManager::fgValues[VarManager::kMuonCPhiPhi], + VarManager::fgValues[VarManager::kMuonCTglX], VarManager::fgValues[VarManager::kMuonCTglY], VarManager::fgValues[VarManager::kMuonCTglPhi], VarManager::fgValues[VarManager::kMuonCTglTgl], VarManager::fgValues[VarManager::kMuonC1Pt2X], VarManager::fgValues[VarManager::kMuonC1Pt2Y], + VarManager::fgValues[VarManager::kMuonC1Pt2Phi], VarManager::fgValues[VarManager::kMuonC1Pt2Tgl], VarManager::fgValues[VarManager::kMuonC1Pt21Pt2]); } } } // end if constexpr (TMuonFillMap) - } // end fullSkimming() + } // end fullSkimming() void DefineHistograms(TString histClasses) { @@ -1255,7 +1255,13 @@ struct TableMaker { } } - // create statistics histograms (event, tracks, muons) + // create statistics histograms + // 0: Event statistics + // 1: Track statistics + // 2: Muon statistics + // 3: Zorro information + // 4: Zorro trigger selection + // NOTE: Please keep the order of the histograms in the list fStatsList.setObject(new TList()); fStatsList->SetOwner(kTRUE); std::vector eventLabels{"BCs", "Collisions before filtering", "Before cuts", "After cuts"}; @@ -1268,7 +1274,7 @@ struct TableMaker { histEvents->GetYaxis()->SetBinLabel(ib, aliasLabels[ib - 1].data()); } histEvents->GetYaxis()->SetBinLabel(kNaliases + 1, "Total"); - fStatsList->Add(histEvents); + fStatsList->Add(histEvents); // At index 0 // Track statistics: one bin for each track selection and 5 bins for V0 tags (gamma, K0s, Lambda, anti-Lambda, Omega) TH1D* histTracks = new TH1D("TrackStats", "Track statistics", fTrackCuts.size() + 5.0, -0.5, fTrackCuts.size() - 0.5 + 5.0); @@ -1280,13 +1286,19 @@ struct TableMaker { for (ib = 0; ib < 5; ib++) { histTracks->GetXaxis()->SetBinLabel(fTrackCuts.size() + 1 + ib, v0TagNames[ib]); } - fStatsList->Add(histTracks); + fStatsList->Add(histTracks); // At index 1 TH1D* histMuons = new TH1D("MuonStats", "Muon statistics", fMuonCuts.size(), -0.5, fMuonCuts.size() - 0.5); ib = 1; for (auto cut = fMuonCuts.begin(); cut != fMuonCuts.end(); cut++, ib++) { histMuons->GetXaxis()->SetBinLabel(ib, (*cut).GetName()); } - fStatsList->Add(histMuons); + fStatsList->Add(histMuons); // At index 2 + + TH2D* histZorroInfo = new TH2D("ZorroInfo", "Zorro information", 1, -0.5, 0.5, 1, -0.5, 0.5); + fStatsList->Add(histZorroInfo); // At index 3 + + TH2D* histZorroSel = new TH2D("ZorroSel", "trigger of interested", 1, -0.5, 0.5, 1, -0.5, 0.5); + fStatsList->Add(histZorroSel); // At index 4 } // Produce barrel + muon tables ------------------------------------------------------------------------------------------------------------- @@ -1367,6 +1379,13 @@ struct TableMaker { fullSkimming(collision, bcs, tracksBarrel, nullptr, nullptr, nullptr); } + // Produce barrel only tables, with V0Bits and Mults + void processBarrelOnlyWithV0BitsAndMults(MyEventsWithMults::iterator const& collision, aod::BCsWithTimestamps const& bcs, + soa::Filtered const& tracksBarrel) + { + fullSkimming(collision, bcs, tracksBarrel, nullptr, nullptr, nullptr); + } + // Produce barrel only tables, with V0Bits and produce maps ------------------------------------------------------------------------------ void processBarrelOnlyWithV0BitsAndMaps(MyEvents::iterator const& collision, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksBarrel) @@ -1559,7 +1578,7 @@ struct TableMaker { } void processAssociatedMuonOnlyWithCov(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, - soa::Filtered const& tracksMuon, aod::AmbiguousTracksFwd const&, aod::FwdTrackAssoc const& fwdtrackIndices) + soa::Filtered const& tracksMuon, aod::AmbiguousFwdTracks const&, aod::FwdTrackAssoc const& fwdtrackIndices) { for (auto& collision : collisions) { auto muonIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); @@ -1568,7 +1587,7 @@ struct TableMaker { } void processAssociatedMuonOnlyWithCovAndCent(MyEventsWithCent const& collisions, aod::BCsWithTimestamps const& bcs, - soa::Filtered const& tracksMuon, aod::AmbiguousTracksFwd const&, aod::FwdTrackAssoc const& fwdtrackIndices) + soa::Filtered const& tracksMuon, aod::AmbiguousFwdTracks const&, aod::FwdTrackAssoc const& fwdtrackIndices) { for (auto& collision : collisions) { auto muonIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); @@ -1577,7 +1596,7 @@ struct TableMaker { } void processAssociatedMuonOnlyWithCovAndMults(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, - soa::Filtered const& tracksMuon, aod::AmbiguousTracksFwd const&, aod::FwdTrackAssoc const& fwdtrackIndices) + soa::Filtered const& tracksMuon, aod::AmbiguousFwdTracks const&, aod::FwdTrackAssoc const& fwdtrackIndices) { for (auto& collision : collisions) { auto muonIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); @@ -1586,7 +1605,7 @@ struct TableMaker { } void processAmbiguousMuonOnlyWithCov(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, - soa::Filtered const& tracksMuon, aod::AmbiguousTracksFwd const& ambiTracksFwd) + soa::Filtered const& tracksMuon, aod::AmbiguousFwdTracks const& ambiTracksFwd) { // Process orphan tracks if (fDoDetailedQA && fIsAmbiguous) { @@ -1610,7 +1629,7 @@ struct TableMaker { // Produce track tables only for ambiguous tracks studies ------------------------------------------------------------------------------------- void processAmbiguousBarrelOnly(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, - soa::Filtered const& tracksBarrel, aod::AmbiguousTracksMid const& ambiTracksMid) + soa::Filtered const& tracksBarrel, aod::AmbiguousTracks const& ambiTracksMid) { // Process orphan tracks if (fDoDetailedQA && fIsAmbiguous) { @@ -1719,6 +1738,7 @@ struct TableMaker { PROCESS_SWITCH(TableMaker, processFullWithCovCentAndMults, "Build full DQ skimmed data model, w/ centrality, multiplicities and track covariances", false); PROCESS_SWITCH(TableMaker, processFullForElectronMuon, "Build full DQ skimmed data model for electron-muon correlation analysis, w/o centrality", false); PROCESS_SWITCH(TableMaker, processBarrelOnlyWithV0Bits, "Build full DQ skimmed data model, w/o centrality, w/ V0Bits", false); + PROCESS_SWITCH(TableMaker, processBarrelOnlyWithV0BitsAndMults, "Build full DQ skimmed data model, w/ multiplicity, w/ V0Bits", false); PROCESS_SWITCH(TableMaker, processBarrelOnlyWithV0BitsAndMaps, "Build full DQ skimmed data model, w/o multiplicity, w/ V0Bits", false); PROCESS_SWITCH(TableMaker, processBarrelOnlyWithDalitzBits, "Build barrel-only DQ skimmed data model, w/o centrality, w/ DalitzBits", false); PROCESS_SWITCH(TableMaker, processBarrelWithDalitzEvent, "Build barrel-only DQ skimmed data model, w/o centrality, w/ DalitzBits", false); diff --git a/PWGDQ/TableProducer/tableMakerJpsiHf.cxx b/PWGDQ/TableProducer/tableMakerJpsiHf.cxx index 6bc27a63029..7ae949c40d1 100644 --- a/PWGDQ/TableProducer/tableMakerJpsiHf.cxx +++ b/PWGDQ/TableProducer/tableMakerJpsiHf.cxx @@ -75,8 +75,9 @@ struct CandidateDilepton { // Declarations of various short names using MyEvents = soa::Join; -using MyD0CandidatesSelected = soa::Join; -using MyD0CandidatesSelectedWithBdt = soa::Join; +using MyD0CandidatesSelected = soa::Join; +using MyD0CandidatesSelectedWithBdt = soa::Join; +using TracksWithExtra = soa::Join; using MyBarrelTracksSelectedWithColl = soa::Join; using MyMuonTracksSelectedWithColl = soa::Join; @@ -91,6 +92,8 @@ struct tableMakerJpsiHf { // Produce derived tables Produces redCollisions; Produces redDmesons; + Produces redDmesDau0; + Produces redDmesDau1; Produces redDmesBdts; Produces redD0Masses; Produces redDileptons; @@ -244,7 +247,7 @@ struct tableMakerJpsiHf { // Template function to run pair - hadron combinations // TODO: generalise to all charm-hadron species template - void runDileptonDmeson(TDqTrack const& leptons, THfTrack const& dmesons, MyEvents::iterator const& collision) + void runDileptonDmeson(TDqTrack const& leptons, THfTrack const& dmesons, MyEvents::iterator const& collision, TracksWithExtra const&) { VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); @@ -345,6 +348,11 @@ struct tableMakerJpsiHf { } if (!isDmesonFilled) { redDmesons(indexRed, dmeson.px(), dmeson.py(), dmeson.pz(), dmeson.xSecondaryVertex(), dmeson.ySecondaryVertex(), dmeson.zSecondaryVertex(), 0, 0); + auto trackProng0 = dmeson.template prong0_as(); + auto trackProng1 = dmeson.template prong1_as(); + // one table for each daughter with single track variables + redDmesDau0(trackProng0.pt(), trackProng0.eta(), trackProng0.itsNCls(), trackProng0.tpcNClsCrossedRows(), dmeson.nSigTpcPi0(), dmeson.nSigTofPi0(), dmeson.nSigTpcKa0(), dmeson.nSigTofKa0()); + redDmesDau1(trackProng1.pt(), trackProng1.eta(), trackProng1.itsNCls(), trackProng1.tpcNClsCrossedRows(), dmeson.nSigTpcPi1(), dmeson.nSigTofPi1(), dmeson.nSigTpcKa1(), dmeson.nSigTofKa1()); filledDmesonIds.push_back(dmesonIdx); } std::array scores = {999., -999., -999., 999., -999., -999.}; // D0 + D0bar @@ -385,7 +393,7 @@ struct tableMakerJpsiHf { } // process J/psi(->mumu) - D0 - void processJspiToMuMuD0(MyEvents const& collisions, MyMuonTracksSelectedWithColl const& muonCandidates, soa::Filtered const& selectedD0Candidates) + void processJspiToMuMuD0(MyEvents const& collisions, MyMuonTracksSelectedWithColl const& muonCandidates, soa::Filtered const& selectedD0Candidates, TracksWithExtra const& barrelTracks) { if (storeTableForNorm) { redCollCounter(collisions.size()); @@ -393,12 +401,12 @@ struct tableMakerJpsiHf { for (auto const& collision : collisions) { auto groupedDmesonCandidates = selectedD0Candidates.sliceBy(perCollisionDmeson, collision.globalIndex()); auto groupedLeptonCandidates = muonCandidates.sliceBy(perCollisionMuons, collision.globalIndex()); - runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); } } // process J/psi(->ee) - D0 - void processJspiToEED0(MyEvents const& collisions, MyBarrelTracksSelectedWithColl const& electronCandidates, soa::Filtered const& selectedD0Candidates) + void processJspiToEED0(MyEvents const& collisions, MyBarrelTracksSelectedWithColl const& electronCandidates, soa::Filtered const& selectedD0Candidates, TracksWithExtra const& barrelTracks) { if (storeTableForNorm) { redCollCounter(collisions.size()); @@ -406,12 +414,12 @@ struct tableMakerJpsiHf { for (auto const& collision : collisions) { auto groupedDmesonCandidates = selectedD0Candidates.sliceBy(perCollisionDmeson, collision.globalIndex()); auto groupedLeptonCandidates = electronCandidates.sliceBy(perCollisionElectrons, collision.globalIndex()); - runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); } } // process J/psi(->mumu) - D0 adding the BDT output scores to the D0 table - void processJspiToMuMuD0WithBdt(MyEvents const& collisions, MyMuonTracksSelectedWithColl const& muonCandidates, soa::Filtered const& selectedD0CandidatesWithBdt) + void processJspiToMuMuD0WithBdt(MyEvents const& collisions, MyMuonTracksSelectedWithColl const& muonCandidates, soa::Filtered const& selectedD0CandidatesWithBdt, TracksWithExtra const& barrelTracks) { if (storeTableForNorm) { redCollCounter(collisions.size()); @@ -419,12 +427,12 @@ struct tableMakerJpsiHf { for (auto const& collision : collisions) { auto groupedDmesonCandidates = selectedD0CandidatesWithBdt.sliceBy(perCollisionDmesonWithBdt, collision.globalIndex()); auto groupedLeptonCandidates = muonCandidates.sliceBy(perCollisionMuons, collision.globalIndex()); - runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); } } // process J/psi(->ee) - D0 adding the BDT output scores to the D0 table - void processJspiToEED0WithBdt(MyEvents const& collisions, MyBarrelTracksSelectedWithColl const& electronCandidates, soa::Filtered const& selectedD0CandidatesWithBdt) + void processJspiToEED0WithBdt(MyEvents const& collisions, MyBarrelTracksSelectedWithColl const& electronCandidates, soa::Filtered const& selectedD0CandidatesWithBdt, TracksWithExtra const& barrelTracks) { if (storeTableForNorm) { redCollCounter(collisions.size()); @@ -432,7 +440,7 @@ struct tableMakerJpsiHf { for (auto const& collision : collisions) { auto groupedDmesonCandidates = selectedD0CandidatesWithBdt.sliceBy(perCollisionDmesonWithBdt, collision.globalIndex()); auto groupedLeptonCandidates = electronCandidates.sliceBy(perCollisionElectrons, collision.globalIndex()); - runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); } } diff --git a/PWGDQ/TableProducer/tableMakerMC.cxx b/PWGDQ/TableProducer/tableMakerMC.cxx index 40d3c346b58..cd25c5c1a9d 100644 --- a/PWGDQ/TableProducer/tableMakerMC.cxx +++ b/PWGDQ/TableProducer/tableMakerMC.cxx @@ -17,6 +17,10 @@ // and the MC truth particles corresponding to the reconstructed tracks selected by the specified track cuts on reconstructed data. #include +#include +#include +#include +#include #include "TList.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -79,19 +83,13 @@ using MyMuonsWithCov = soa::Join; using MyMuonsCollWithCov = soa::Join; +using MyMftTracks = soa::Join; + using MyEvents = soa::Join; using MyEventsWithMults = soa::Join; using MyEventsWithCent = soa::Join; using MyEventsWithCentAndMults = soa::Join; -namespace o2::aod -{ -DECLARE_SOA_TABLE(AmbiguousTracksMid, "AOD", "AMBIGUOUSTRACK", //! Table for tracks which are not uniquely associated with a collision - o2::soa::Index<>, o2::aod::ambiguous::TrackId, o2::aod::ambiguous::BCIdSlice, o2::soa::Marker<2>); -DECLARE_SOA_TABLE(AmbiguousTracksFwd, "AOD", "AMBIGUOUSFWDTR", //! Table for Fwd tracks which are not uniquely associated with a collision - o2::soa::Index<>, o2::aod::ambiguous::FwdTrackId, o2::aod::ambiguous::BCIdSlice, o2::soa::Marker<2>); -} // namespace o2::aod - constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; constexpr static uint32_t gkEventFillMapWithMults = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult; constexpr static uint32_t gkEventFillMapWithCent = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionCent; @@ -105,6 +103,7 @@ constexpr static uint32_t gkMuonFillMapWithCov = VarManager::ObjTypes::Muon | Va constexpr static uint32_t gkMuonFillMapWithAmbi = VarManager::ObjTypes::Muon | VarManager::ObjTypes::AmbiMuon; constexpr static uint32_t gkMuonFillMapWithCovAmbi = VarManager::ObjTypes::Muon | VarManager::ObjTypes::MuonCov | VarManager::ObjTypes::AmbiMuon; constexpr static uint32_t gkTrackFillMapWithAmbi = VarManager::ObjTypes::Track | VarManager::ObjTypes::AmbiTrack; +constexpr static uint32_t gkMFTFillMap = VarManager::ObjTypes::TrackMFT; struct TableMakerMC { @@ -127,6 +126,9 @@ struct TableMakerMC { Produces muonExtra; Produces muonCov; Produces muonLabels; // TODO: enable this once we have fwdtrack labels + Produces trackMFT; + Produces trackMFTExtra; + Produces trackMFTLabels; // list of MCsignal objects std::vector fMCSignals; @@ -316,9 +318,9 @@ struct TableMakerMC { Preslice fwdtrackIndicesPerCollision = aod::track_association::collisionId; // Templated function instantianed for all of the process functions - template + template void fullSkimming(TEvent const& collisions, aod::BCsWithTimestamps const& /*bcs*/, TTracks const& tracksBarrel, TMuons const& tracksMuon, - aod::McCollisions const& /*mcEvents*/, aod::McParticles_001 const& mcTracks, TAmbiTracks const& ambiTracksMid, TAmbiMuons const& ambiTracksFwd) + aod::McCollisions const& /*mcEvents*/, aod::McParticles_001 const& mcTracks, TAmbiTracks const& ambiTracksMid, TAmbiMuons const& ambiTracksFwd, TMFTTracks const& mftTracks = nullptr) { // Loop over collisions and produce skimmed data tables for: // 1) all selected collisions @@ -399,7 +401,7 @@ struct TableMakerMC { // store the selection decisions uint64_t tag = collision.selection_raw(); if (collision.sel7()) { - tag |= (uint64_t(1) << evsel::kNsel); //! SEL7 stored at position kNsel in the tag bit map + tag |= (static_cast(1) << evsel::kNsel); //! SEL7 stored at position kNsel in the tag bit map } auto mcCollision = collision.mcCollision(); @@ -415,7 +417,7 @@ struct TableMakerMC { } // fill stats information, before selections for (int i = 0; i < kNaliases; i++) { - if (triggerAliases & (uint32_t(1) << i)) { + if (triggerAliases & (static_cast(1) << i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(i)); } } @@ -431,7 +433,7 @@ struct TableMakerMC { // fill stats information, after selections for (int i = 0; i < kNaliases; i++) { - if (triggerAliases & (uint32_t(1) << i)) { + if (triggerAliases & (static_cast(1) << i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(3.0, static_cast(i)); } } @@ -468,7 +470,7 @@ struct TableMakerMC { multPV(collision.multNTracksHasITS(), collision.multNTracksHasTPC(), collision.multNTracksHasTOF(), collision.multNTracksHasTRD(), collision.multNTracksITSOnly(), collision.multNTracksTPCOnly(), collision.multNTracksITSTPC(), collision.trackOccupancyInTimeRange()); multAll(collision.multAllTracksTPCOnly(), collision.multAllTracksITSTPC(), - 0, 0, 0.0, 0.0, 0, 0); + 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0); } // loop over the MC truth tracks and find those that need to be written @@ -486,7 +488,7 @@ struct TableMakerMC { checked = sig.CheckSignal(true, mctrack); } if (checked) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); } i++; } @@ -507,7 +509,7 @@ struct TableMakerMC { VarManager::FillTrackMC(mcTracks, mctrack); int j = 0; for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); signal++, j++) { - if (mcflags & (uint16_t(1) << j)) { + if (mcflags & (static_cast(1) << j)) { fHistMan->FillHistClass(Form("MCTruth_%s", (*signal).GetName()), VarManager::fgValues); } } @@ -541,8 +543,8 @@ struct TableMakerMC { } } } - trackFilteringTag = uint64_t(0); - trackTempFilterMap = uint8_t(0); + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); VarManager::FillTrack(track); // If no MC particle is found, skip the track if (!track.has_mcParticle()) { @@ -578,23 +580,23 @@ struct TableMakerMC { // store filtering information if (track.isGlobalTrack()) { - trackFilteringTag |= (uint64_t(1) << 0); // BIT0: global track + trackFilteringTag |= (static_cast(1) << 0); // BIT0: global track } if (track.isGlobalTrackSDD()) { - trackFilteringTag |= (uint64_t(1) << 1); // BIT1: global track SSD + trackFilteringTag |= (static_cast(1) << 1); // BIT1: global track SSD } if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackV0Bits)) { // BIT2-6: V0Bits - trackFilteringTag |= (uint64_t(track.pidbit()) << 2); + trackFilteringTag |= (static_cast(track.pidbit()) << 2); for (int iv0 = 0; iv0 < 5; iv0++) { - if (track.pidbit() & (uint8_t(1) << iv0)) { + if (track.pidbit() & (static_cast(1) << iv0)) { (reinterpret_cast(fStatsList->At(1)))->Fill(fTrackCuts.size() + static_cast(iv0)); } } } if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::DalitzBits)) { - trackFilteringTag |= (uint64_t(track.dalitzBits()) << 7); // BIT7-14: Dalitz + trackFilteringTag |= (static_cast(track.dalitzBits()) << 7); // BIT7-14: Dalitz } - trackFilteringTag |= (uint64_t(trackTempFilterMap) << 15); // BIT15-...: user track filters + trackFilteringTag |= (static_cast(trackTempFilterMap) << 15); // BIT15-...: user track filters mcflags = 0; i = 0; // runs over the MC signals @@ -602,7 +604,7 @@ struct TableMakerMC { // check all the specified signals and fill histograms for MC truth matched tracks for (auto& sig : fMCSignals) { if (sig.CheckSignal(true, mctrack)) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); if (fDoDetailedQA) { j = 0; for (auto& cut : fTrackCuts) { @@ -652,6 +654,71 @@ struct TableMakerMC { } // end loop over reconstructed tracks } // end if constexpr (static_cast(TTrackFillMap)) + // Maps for the MFT-muon matching index + std::map newMFTTableSize; // key : oldMFTIndex, value: size of the table-1 at step key + std::map mftOffsets; // key: mftoldglobalindex, value: mft.offsets + + if constexpr (static_cast(TMFTFillMap)) { + trackMFT.reserve(mftTracks.size()); + trackMFTExtra.reserve(mftTracks.size()); + // TODO add cuts on the MFT tracks + // int nDel = 0; + for (auto& mft : mftTracks) { + if (false) // for now no cuts + { + // nDel++; + } else { // it passes the cuts and will be saved in the tables + newMFTTableSize[mft.index()] = trackMFT.lastIndex(); + } + + // Check MC matching + if (!mft.has_mcParticle()) { + continue; + } + auto mctrack = mft.template mcParticle_as(); + + mcflags = 0; + int i = 0; // runs over the MC signals + // check all the specified signals and fill histograms for MC truth matched tracks + for (auto& sig : fMCSignals) { + if (sig.CheckSignal(true, mctrack)) { + mcflags |= (static_cast(1) << i); + } + i++; + } + + // if the MC truth particle corresponding to this reconstructed track is not already written, + // add it to the skimmed stack + if (!(fNewLabels.find(mctrack.globalIndex()) != fNewLabels.end())) { + fNewLabels[mctrack.globalIndex()] = fCounters[0]; + fNewLabelsReversed[fCounters[0]] = mctrack.globalIndex(); + fMCFlags[mctrack.globalIndex()] = mcflags; + fEventIdx[mctrack.globalIndex()] = fEventLabels.find(mcCollision.globalIndex())->second; + fCounters[0]++; + } + + mftOffsets[mft.globalIndex()] = mft.offsets(); + + double chi2 = mft.chi2(); + SMatrix5 tpars(mft.x(), mft.y(), mft.phi(), mft.tgl(), mft.signed1Pt()); + std::vector v1; + SMatrix55 tcovs(v1.begin(), v1.end()); + o2::track::TrackParCovFwd pars1{mft.z(), tpars, tcovs, chi2}; + pars1.propagateToZlinear(collision.posZ()); + + double dcaX = (pars1.getX() - collision.posX()); + double dcaY = (pars1.getY() - collision.posY()); + + VarManager::FillTrack(mft); + fHistMan->FillHistClass("MftTracks", VarManager::fgValues); + + trackMFT(event.lastIndex(), trackFilteringTag, mft.pt(), mft.eta(), mft.phi()); + trackMFTExtra(mft.mftClusterSizesAndTrackFlags(), mft.sign(), dcaX, dcaY, mft.nClusters()); + trackMFTLabels(fNewLabels.find(mctrack.index())->second, mft.mcMask(), mcflags); + } // end of mft : mftTracks + + } // end if constexpr (TMFTFillMap) + if constexpr (static_cast(TMuonFillMap)) { // build the muon tables muonBasic.reserve(tracksMuon.size()); @@ -669,10 +736,11 @@ struct TableMakerMC { int idxPrev = -1; std::map newEntryNb; std::map newMatchIndex; + std::map newMFTMatchIndex; for (auto& muon : groupedMuons) { - trackFilteringTag = uint64_t(0); - trackTempFilterMap = uint8_t(0); + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); if (!muon.has_mcParticle()) { continue; @@ -721,8 +789,8 @@ struct TableMakerMC { } } - trackFilteringTag = uint64_t(0); - trackTempFilterMap = uint8_t(0); + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); if (!muon.has_mcParticle()) { continue; @@ -757,7 +825,7 @@ struct TableMakerMC { continue; } // store the cut decisions - trackFilteringTag |= uint64_t(trackTempFilterMap); // BIT0-7: user selection cuts + trackFilteringTag |= static_cast(trackTempFilterMap); // BIT0-7: user selection cuts mcflags = 0; i = 0; // runs over the MC signals @@ -765,7 +833,7 @@ struct TableMakerMC { // check all the specified signals and fill histograms for MC truth matched tracks for (auto& sig : fMCSignals) { if (sig.CheckSignal(true, mctrack)) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); if (fDoDetailedQA) { for (auto& cut : fMuonCuts) { if (trackTempFilterMap & (uint8_t(1) << j)) { @@ -792,9 +860,13 @@ struct TableMakerMC { if (static_cast(muon.trackType()) == 0 || static_cast(muon.trackType()) == 2) { // MCH-MFT or GLB track int matchIdx = muon.matchMCHTrackId() - muon.offsets(); + int matchMFTIdx = muon.matchMFTTrackId() - mftOffsets[muon.matchMFTTrackId()]; + + // first for MCH matching index if (newEntryNb.count(matchIdx) > 0) { // if the key exists which means the match will not get deleted newMatchIndex[muon.index()] = newEntryNb[matchIdx]; // update the match for this muon to the updated entry of the match newMatchIndex[muon.index()] += muonBasic.lastIndex() + 1 - newEntryNb[muon.index()]; // adding the offset of muons, muonBasic.lastIndex() start at -1 + if (static_cast(muon.trackType()) == 0) { // for now only do this to global tracks newMatchIndex[matchIdx] = newEntryNb[muon.index()]; // add the updated index of this muon as a match to mch track newMatchIndex[matchIdx] += muonBasic.lastIndex() + 1 - newEntryNb[muon.index()]; // adding the offset, muonBasic.lastIndex() start at -1 @@ -802,6 +874,14 @@ struct TableMakerMC { } else { newMatchIndex[muon.index()] = -1; } + + // then for MFT match index + if (newMFTTableSize.count(matchMFTIdx) > 0) { // if the key exists i.e the match will not get deleted + newMFTMatchIndex[muon.index()] = newMFTTableSize[matchMFTIdx] + 1; // adding the offset of mfts, newMFTTableSize start at -1 + } else { + newMFTMatchIndex[muon.index()] = -1; + } + } else if (static_cast(muon.trackType() == 4)) { // an MCH track // in this case the matches should be filled from the other types but we need to check if (newMatchIndex.count(muon.index()) == 0) { @@ -809,7 +889,7 @@ struct TableMakerMC { } } - muonBasic(event.lastIndex(), newMatchIndex.find(muon.index())->second, -1, trackFilteringTag, VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], muon.sign(), isAmbiguous); + muonBasic(event.lastIndex(), newMatchIndex.find(muon.index())->second, newMFTMatchIndex.find(muon.index())->second, trackFilteringTag, VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], muon.sign(), isAmbiguous); if constexpr (static_cast(TMuonFillMap & VarManager::ObjTypes::MuonCov)) { if (fPropMuon) { muonExtra(muon.nClusters(), VarManager::fgValues[VarManager::kMuonPDca], VarManager::fgValues[VarManager::kMuonRAtAbsorberEnd], @@ -886,7 +966,7 @@ struct TableMakerMC { mctrack.weight(), mctrack.pt(), mctrack.eta(), mctrack.phi(), mctrack.e(), mctrack.vx(), mctrack.vy(), mctrack.vz(), mctrack.vt(), mcflags); for (unsigned int isig = 0; isig < fMCSignals.size(); isig++) { - if (mcflags & (uint16_t(1) << isig)) { + if (mcflags & (static_cast(1) << isig)) { (reinterpret_cast(fStatsList->At(3)))->Fill(static_cast(isig)); } } @@ -959,7 +1039,7 @@ struct TableMakerMC { // store the selection decisions uint64_t tag = collision.selection_raw(); if (collision.sel7()) { - tag |= (uint64_t(1) << evsel::kNsel); //! SEL7 stored at position kNsel in the tag bit map + tag |= (static_cast(1) << evsel::kNsel); //! SEL7 stored at position kNsel in the tag bit map } auto mcCollision = collision.mcCollision(); @@ -975,7 +1055,7 @@ struct TableMakerMC { } // fill stats information, before selections for (int i = 0; i < kNaliases; i++) { - if (triggerAliases & (uint32_t(1) << i)) { + if (triggerAliases & (static_cast(1) << i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(i)); } } @@ -991,7 +1071,7 @@ struct TableMakerMC { // fill stats information, after selections for (int i = 0; i < kNaliases; i++) { - if (triggerAliases & (uint32_t(1) << i)) { + if (triggerAliases & (static_cast(1) << i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(3.0, static_cast(i)); } } @@ -1040,7 +1120,7 @@ struct TableMakerMC { checked = sig.CheckSignal(true, mctrack); } if (checked) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); } i++; } @@ -1061,7 +1141,7 @@ struct TableMakerMC { VarManager::FillTrackMC(mcTracks, mctrack); int j = 0; for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); signal++, j++) { - if (mcflags & (uint16_t(1) << j)) { + if (mcflags & (static_cast(1) << j)) { fHistMan->FillHistClass(Form("MCTruth_%s", (*signal).GetName()), VarManager::fgValues); } } @@ -1090,8 +1170,8 @@ struct TableMakerMC { isAmbiguous = (track.compatibleCollIds().size() != 1); } } - trackFilteringTag = uint64_t(0); - trackTempFilterMap = uint8_t(0); + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); VarManager::FillTrack(track); // If no MC particle is found, skip the track if (!track.has_mcParticle()) { @@ -1127,23 +1207,23 @@ struct TableMakerMC { // store filtering information if (track.isGlobalTrack()) { - trackFilteringTag |= (uint64_t(1) << 0); // BIT0: global track + trackFilteringTag |= (static_cast(1) << 0); // BIT0: global track } if (track.isGlobalTrackSDD()) { - trackFilteringTag |= (uint64_t(1) << 1); // BIT1: global track SSD + trackFilteringTag |= (static_cast(1) << 1); // BIT1: global track SSD } if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackV0Bits)) { // BIT2-6: V0Bits - trackFilteringTag |= (uint64_t(track.pidbit()) << 2); + trackFilteringTag |= (static_cast(track.pidbit()) << 2); for (int iv0 = 0; iv0 < 5; iv0++) { - if (track.pidbit() & (uint8_t(1) << iv0)) { + if (track.pidbit() & (static_cast(1) << iv0)) { (reinterpret_cast(fStatsList->At(1)))->Fill(fTrackCuts.size() + static_cast(iv0)); } } } if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::DalitzBits)) { - trackFilteringTag |= (uint64_t(track.dalitzBits()) << 7); // BIT7-14: Dalitz + trackFilteringTag |= (static_cast(track.dalitzBits()) << 7); // BIT7-14: Dalitz } - trackFilteringTag |= (uint64_t(trackTempFilterMap) << 15); // BIT15-...: user track filters + trackFilteringTag |= (static_cast(trackTempFilterMap) << 15); // BIT15-...: user track filters mcflags = 0; i = 0; // runs over the MC signals @@ -1151,7 +1231,7 @@ struct TableMakerMC { // check all the specified signals and fill histograms for MC truth matched tracks for (auto& sig : fMCSignals) { if (sig.CheckSignal(true, mctrack)) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); if (fDoDetailedQA) { j = 0; for (auto& cut : fTrackCuts) { @@ -1218,11 +1298,12 @@ struct TableMakerMC { int idxPrev = -1; std::map newEntryNb; std::map newMatchIndex; + std::map newMFTMatchIndex; for (auto& muonId : fwdtrackIdsThisCollision) { auto muon = muonId.template fwdtrack_as(); - trackFilteringTag = uint64_t(0); - trackTempFilterMap = uint8_t(0); + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); if (!muon.has_mcParticle()) { continue; @@ -1266,8 +1347,8 @@ struct TableMakerMC { } } - trackFilteringTag = uint64_t(0); - trackTempFilterMap = uint8_t(0); + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); if (!muon.has_mcParticle()) { continue; @@ -1304,7 +1385,7 @@ struct TableMakerMC { continue; } // store the cut decisions - trackFilteringTag |= uint64_t(trackTempFilterMap); // BIT0-7: user selection cuts + trackFilteringTag |= static_cast(trackTempFilterMap); // BIT0-7: user selection cuts mcflags = 0; i = 0; // runs over the MC signals @@ -1312,7 +1393,7 @@ struct TableMakerMC { // check all the specified signals and fill histograms for MC truth matched tracks for (auto& sig : fMCSignals) { if (sig.CheckSignal(true, mctrack)) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); if (fDoDetailedQA) { for (auto& cut : fMuonCuts) { if (trackTempFilterMap & (uint8_t(1) << j)) { @@ -1427,7 +1508,7 @@ struct TableMakerMC { mctrack.weight(), mctrack.pt(), mctrack.eta(), mctrack.phi(), mctrack.e(), mctrack.vx(), mctrack.vy(), mctrack.vz(), mctrack.vt(), mcflags); for (unsigned int isig = 0; isig < fMCSignals.size(); isig++) { - if (mcflags & (uint16_t(1) << isig)) { + if (mcflags & (static_cast(1) << isig)) { (reinterpret_cast(fStatsList->At(3)))->Fill(static_cast(isig)); } } @@ -1529,14 +1610,14 @@ struct TableMakerMC { soa::Filtered const& tracksBarrel, soa::Filtered const& tracksMuon, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mcEvents, mcTracks, nullptr, nullptr, nullptr); } void processFullWithCov(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksBarrel, soa::Filtered const& tracksMuon, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce barrel only tables ------------------------------------------------------------------------------------ @@ -1544,7 +1625,7 @@ struct TableMakerMC { soa::Filtered const& tracksBarrel, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce barrel only tables, with multiplicity ------------------------------------------------------------------------------------ @@ -1552,7 +1633,7 @@ struct TableMakerMC { soa::Filtered const& tracksBarrel, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce barrel only tables, with centrality ------------------------------------------------------------------------------------ @@ -1560,7 +1641,7 @@ struct TableMakerMC { soa::Filtered const& tracksBarrel, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce barrel only tables, with centrality and multiplicity ------------------------------------------------------------------- @@ -1568,7 +1649,7 @@ struct TableMakerMC { soa::Filtered const& tracksBarrel, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce barrel only tables, with cov matrix----------------------------------------------------------------------- @@ -1576,7 +1657,7 @@ struct TableMakerMC { soa::Filtered const& tracksBarrel, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce barrel only tables, with centrality, multiplicity and cov matrix ------------------------------------------------------------------- @@ -1584,7 +1665,7 @@ struct TableMakerMC { soa::Filtered const& tracksBarrel, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce barrel only tables, with cov matrix and dalitz bits----------------------------------------------------------------------- @@ -1592,7 +1673,7 @@ struct TableMakerMC { soa::Filtered const& tracksBarrel, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce muon only tables ------------------------------------------------------------------------------------ @@ -1600,21 +1681,28 @@ struct TableMakerMC { soa::Filtered const& tracksMuon, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce muon only tables, with centrality------------------------------------------------------------------------------- void processMuonOnlyWithCent(MyEventsWithCent const& collisions, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksMuon, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, nullptr, nullptr); } // Produce muon only tables, with cov matrix ------------------------------------------------------------------------------------ void processMuonOnlyWithCov(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksMuon, aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, nullptr, nullptr); + } + // Produce MFT tracks tables and muons ------------------------------------------------------------------------------------------------------------------ + void processMuonsAndMFT(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, + MyMftTracks const& tracksMft, MyMuonsWithCov const& tracksMuon, + aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks) + { + fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, nullptr, tracksMft); } // Produce muon tables only based on track-collision association tables -------------------------------------------------------------------------------------- void processAssociatedMuonOnly(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, @@ -1647,24 +1735,24 @@ struct TableMakerMC { // Produce muon tables only for ambiguous tracks studies -------------------------------------------------------------------------------------- void processAmbiguousMuonOnly(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksMuon, - aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks, aod::AmbiguousTracksFwd const& ambiTracksFwd) + aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks, aod::AmbiguousFwdTracks const& ambiTracksFwd) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, ambiTracksFwd); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, ambiTracksFwd, nullptr); } void processAmbiguousMuonOnlyWithCov(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksMuon, - aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks, aod::AmbiguousTracksFwd const& ambiTracksFwd) + aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks, aod::AmbiguousFwdTracks const& ambiTracksFwd) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, ambiTracksFwd); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mcEvents, mcTracks, nullptr, ambiTracksFwd, nullptr); } // Produce track tables only for ambiguous tracks studies ------------------------------------------------------------------------------------- void processAmbiguousBarrelOnly(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksBarrel, - aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks, aod::AmbiguousTracksMid const& ambiTracksMid) + aod::McCollisions const& mcEvents, aod::McParticles_001 const& mcTracks, aod::AmbiguousTracks const& ambiTracksMid) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, ambiTracksMid, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, mcEvents, mcTracks, ambiTracksMid, nullptr, nullptr); } // Process the BCs and store stats for luminosity retrieval ----------------------------------------------------------------------------------- void processOnlyBCs(soa::Join::iterator const& bc) @@ -1688,6 +1776,7 @@ struct TableMakerMC { PROCESS_SWITCH(TableMakerMC, processBarrelOnlyWithDalitzBits, "Produce barrel skims, and dalitz bits", false); PROCESS_SWITCH(TableMakerMC, processMuonOnly, "Produce muon skims", false); PROCESS_SWITCH(TableMakerMC, processMuonOnlyWithCov, "Produce muon skims, with muon covariance matrix", false); + PROCESS_SWITCH(TableMakerMC, processMuonsAndMFT, "Produce muon and MFT skims", false); PROCESS_SWITCH(TableMakerMC, processMuonOnlyWithCent, "Produce muon skims, w/ centrality", false); PROCESS_SWITCH(TableMakerMC, processOnlyBCs, "Analyze the BCs to store sampled lumi", false); PROCESS_SWITCH(TableMakerMC, processAssociatedMuonOnly, "Produce muon skims using track-collision association tables", false); diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index bcb465d13fb..c85d44a4a19 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -17,6 +17,10 @@ // and the MC truth particles corresponding to the reconstructed tracks selected by the specified track cuts on reconstructed data. #include +#include +#include +#include +#include #include "TList.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -56,6 +60,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod; +// Declare Joins used in the various process functions using MyBarrelTracks = soa::Join; using MyEventsWithCentAndMults = soa::Join; +// Declare bit maps containing information on the table joins content (used as argument in templated functions) // constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; constexpr static uint32_t gkEventFillMapWithMults = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult | VarManager::ObjTypes::CollisionMultExtra; // constexpr static uint32_t gkEventFillMapWithCent = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionCent; @@ -132,51 +138,60 @@ struct TableMakerMC { OutputObj fStatsList{"Statistics"}; //! skimming statistics HistogramManager* fHistMan; + Configurable fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"}; + // Event and track AnalysisCut configurables - Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; - Configurable fConfigTrackCuts{"cfgBarrelTrackCuts", "jpsiPID1", "barrel track cut"}; - Configurable fConfigMuonCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; + struct : ConfigurableGroup { + Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; + Configurable fConfigTrackCuts{"cfgBarrelTrackCuts", "jpsiPID1", "barrel track cut"}; + Configurable fConfigMuonCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; + } fConfigCuts; // MC signals to be skimmed Configurable fConfigMCSignals{"cfgMCsignals", "", "Comma separated list of MC signals"}; // Steer QA output - Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; - Configurable fConfigDetailedQA{"cfgDetailedQA", false, "If true, include more QA histograms (BeforeCuts classes)"}; - Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigAddMCTruthHistogram{"cfgAddMCTruthHistogram", "", "Comma separated list of histograms"}; + struct : ConfigurableGroup { + Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; + Configurable fConfigDetailedQA{"cfgDetailedQA", false, "If true, include more QA histograms (BeforeCuts classes)"}; + Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddMCTruthHistogram{"cfgAddMCTruthHistogram", "", "Comma separated list of histograms"}; + } fConfigHistOutput; // Selections to be applied as Filter on the Track and FwdTrack - Configurable fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"}; - Configurable fConfigBarrelTrackMaxAbsEta{"cfgBarrelMaxAbsEta", 0.9f, "Eta absolute value cut for tracks in the barrel"}; + /*Configurable fConfigBarrelTrackMaxAbsEta{"cfgBarrelMaxAbsEta", 0.9f, "Eta absolute value cut for tracks in the barrel"}; Configurable fConfigBarrelTrackMinPt{"cfgBarrelMinPt", 0.5f, "Minimum pt for tracks in the barrel"}; Configurable fConfigBarrelMinTPCncls{"cfgBarrelMinTPCncls", 50.0f, "Minimum TPC cls for tracks in the barrel"}; Configurable fConfigBarrelMaxTPCchi2{"cfgBarrelMaxTPCchi2", 10.0f, "Maximum TPC chi2/ndf for tracks in the barrel"}; Configurable fConfigBarrelMaxITSchi2{"cfgBarrelMaxITSchi2", 36.0f, "Maximum ITS chi2/ndf for tracks in the barrel"}; Configurable fConfigMuonPtLow{"cfgMuonLowPt", 1.0f, "Low pt cut for muons"}; + */ // CCDB connection configurables - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable grpmagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"}; - - // Track related options - Configurable fPropTrack{"cfgPropTrack", true, "Propagate tracks to primary vertex"}; - - // Muon related options - Configurable fPropMuon{"cfgPropMuon", true, "Propagate muon tracks through absorber (do not use if applying pairing)"}; - Configurable fRefitGlobalMuon{"cfgRefitGlobalMuon", true, "Correct global muon parameters"}; - Configurable fMuonMatchEtaMin{"cfgMuonMatchEtaMin", -4.0f, "Definition of the acceptance of muon tracks to be matched with MFT"}; - Configurable fMuonMatchEtaMax{"cfgMuonMatchEtaMax", -2.5f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + struct : ConfigurableGroup { + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable fGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable fGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"}; + } fConfigCCDB; + + struct : ConfigurableGroup { + // Track related options + Configurable fPropTrack{"cfgPropTrack", true, "Propagate tracks to primary vertex"}; + // Muon related options + Configurable fPropMuon{"cfgPropMuon", true, "Propagate muon tracks through absorber (do not use if applying pairing)"}; + Configurable fRefitGlobalMuon{"cfgRefitGlobalMuon", true, "Correct global muon parameters"}; + Configurable fMuonMatchEtaMin{"cfgMuonMatchEtaMin", -4.0f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + Configurable fMuonMatchEtaMax{"cfgMuonMatchEtaMax", -2.5f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + } fConfigVariousOptions; Service fCCDB; o2::ccdb::CcdbApi fCCDBApi; - o2::parameters::GRPObject* grpmagrun2 = nullptr; // for run 2, we access the GRPObject from GLO/GRP/GRP - o2::parameters::GRPMagField* grpmag = nullptr; // for run 3, we access GRPMagField from GLO/Config/GRPMagField + o2::parameters::GRPObject* fGrpMagRun2 = nullptr; // for run 2, we access the GRPObject from GLO/GRP/GRP + o2::parameters::GRPMagField* fGrpMag = nullptr; // for run 3, we access GRPMagField from GLO/Config/GRPMagField AnalysisCompositeCut* fEventCut; //! Event selection cut std::vector fTrackCuts; //! Barrel track cuts @@ -199,6 +214,16 @@ struct TableMakerMC { void init(o2::framework::InitContext& context) { + // Check whether barrel or muon are enabled + bool isProcessBCenabled = context.mOptions.get("processPP"); + bool isBarrelEnabled = (context.mOptions.get("processPP") || context.mOptions.get("processPPBarrelOnly") || context.mOptions.get("processPbPbBarrelOnly")); + bool isMuonEnabled = (context.mOptions.get("processPP") || context.mOptions.get("processPPMuonOnly") || context.mOptions.get("processPbPbMuonOnly")); + // Make sure at least one process function is enabled + if (!(isProcessBCenabled || isBarrelEnabled || isMuonEnabled)) { + LOG(fatal) << "No process function was enabled for TableMakerMC. Check it out!!!"; + } + + // Define user specified cut DefineCuts(); VarManager::SetDefaultVarNames(); @@ -207,68 +232,73 @@ struct TableMakerMC { fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); // Only use detailed QA when QA is set true - if (fConfigQA && fConfigDetailedQA) { + if (fConfigHistOutput.fConfigQA && fConfigHistOutput.fConfigDetailedQA) { fDoDetailedQA = true; } // Create the histogram class names to be added to the histogram manager TString histClasses = ""; + // Event histograms before any cuts if (fDoDetailedQA) { histClasses += "Event_BeforeCuts;"; } - if (fConfigQA) { + // Event histograms after cuts and for MC truth collisions + if (fConfigHistOutput.fConfigQA) { histClasses += "Event_AfterCuts;"; histClasses += "Event_MCTruth;"; } - bool enableBarrelHistos = (context.mOptions.get("processPP") || context.mOptions.get("processPPBarrelOnly") || context.mOptions.get("processPbPbBarrelOnly")); - bool enableMuonHistos = (context.mOptions.get("processPP") || context.mOptions.get("processPPMuonOnly") || context.mOptions.get("processPbPbMuonOnly")); - - LOG(info) << "enable barrel/muon histograms :: " << enableBarrelHistos << " / " << enableMuonHistos; - - // TODO: switch on/off histogram classes depending on which process function we run - if (enableBarrelHistos) { + if (isBarrelEnabled) { + // Barrel track histograms before cuts if (fDoDetailedQA) { histClasses += "TrackBarrel_BeforeCuts;"; } - if (fConfigQA) { + // Barrel track histograms after cuts; one directory per cut + if (fConfigHistOutput.fConfigQA) { for (auto& cut : fTrackCuts) { histClasses += Form("TrackBarrel_%s;", cut.GetName()); } } } - if (enableMuonHistos) { + if (isMuonEnabled) { + // Muon track histograms before cuts if (fDoDetailedQA) { histClasses += "Muons_BeforeCuts;"; } - if (fConfigQA) { + // Muon track histograms after cuts; one directory per cut + if (fConfigHistOutput.fConfigQA) { for (auto& muonCut : fMuonCuts) { histClasses += Form("Muons_%s;", muonCut.GetName()); } } } + // Configure user specified MC signals and setup histogram classes TString configNamesStr = fConfigMCSignals.value; std::unique_ptr objArray(configNamesStr.Tokenize(",")); if (objArray->GetEntries() > 0) { + // loop over MC signals for (int isig = 0; isig < objArray->GetEntries(); ++isig) { MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objArray->At(isig)->GetName()); if (sig) { fMCSignals.push_back(*sig); - if (fConfigQA) { + // setup a histogram directory for this MC signal + if (fConfigHistOutput.fConfigQA) { histClasses += Form("MCTruth_%s;", objArray->At(isig)->GetName()); } } else { continue; } if (fDoDetailedQA) { - if (enableBarrelHistos) { + if (isBarrelEnabled) { + // in case of detailed QA, setup histogram directories for each combination of reconstructed track cuts and MC signals for (auto& cut : fTrackCuts) { histClasses += Form("TrackBarrel_%s_%s;", cut.GetName(), objArray->At(isig)->GetName()); } } - if (enableMuonHistos) { + if (isMuonEnabled) { + // in case of detailed QA, setup histogram directories for each combination of reconstructed muon cuts and MC signals for (auto& cut : fMuonCuts) { histClasses += Form("Muons_%s_%s;", cut.GetName(), objArray->At(isig)->GetName()); } @@ -281,24 +311,25 @@ struct TableMakerMC { VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); - fCCDB->setURL(fConfigCcdbUrl); + // Setup the CCDB + fCCDB->setURL(fConfigCCDB.fConfigCcdbUrl); fCCDB->setCaching(true); fCCDB->setLocalObjectValidityChecking(); if (!o2::base::GeometryManager::isGeometryLoaded()) { - fCCDB->get(geoPath); + fCCDB->get(fConfigCCDB.fGeoPath); } - fCCDBApi.init(fConfigCcdbUrl.value); + fCCDBApi.init(fConfigCCDB.fConfigCcdbUrl.value); } void DefineCuts() { // Event cuts fEventCut = new AnalysisCompositeCut(true); - TString eventCutStr = fConfigEventCuts.value; + TString eventCutStr = fConfigCuts.fConfigEventCuts.value; fEventCut->AddCut(dqcuts::GetAnalysisCut(eventCutStr.Data())); // Barrel track cuts - TString cutNamesStr = fConfigTrackCuts.value; + TString cutNamesStr = fConfigCuts.fConfigTrackCuts.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { @@ -307,7 +338,7 @@ struct TableMakerMC { } // Muon cuts - cutNamesStr = fConfigMuonCuts.value; + cutNamesStr = fConfigCuts.fConfigMuonCuts.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { @@ -329,10 +360,13 @@ struct TableMakerMC { // one has to do a mapping of the old vs new indices so that the skimmed labels are properly updated. VarManager::ResetValues(0, VarManager::kNVars); + // Loop over MC collisions for (auto& mcCollision : mcCollisions) { + // Get MC collision information into the VarManager VarManager::FillEvent(mcCollision); + // Fill histograms fHistMan->FillHistClass("Event_MCTruth", VarManager::fgValues); - + // Create the skimmed table entry for this collision eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter()); } @@ -340,16 +374,21 @@ struct TableMakerMC { void skimMCParticles(aod::McParticles const& mcTracks, aod::McCollisions const&) { - // select MC particles which fulfill at least one of the specified MC signals + // Select MC particles which fulfill at least one of the user specified MC signals + // In this function we just fill a map with the labels of selected particles, not creating the tables themselves. + // The reason is that in the skims we will additionally add any MC label connected to selected reconstructed tracks + // which were not selected already via the MC signals + + // Clear the label maps fLabelsMap.clear(); fLabelsMapReversed.clear(); fMCFlags.clear(); - uint16_t mcflags = 0; + uint16_t mcflags = static_cast(0); // flags which will hold the decisions for each MC signal int trackCounter = 0; for (auto& mctrack : mcTracks) { - // check all the requested MC signals and fill a decision bit map + // check all the requested MC signals and fill the decision bit map mcflags = 0; int i = 0; for (auto& sig : fMCSignals) { @@ -361,28 +400,29 @@ struct TableMakerMC { checked = sig.CheckSignal(true, mctrack); } if (checked) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); } i++; } + // if no MC signals were matched, continue if (mcflags == 0) { continue; } - if (!(fLabelsMap.find(mctrack.globalIndex()) != fLabelsMap.end())) { + // If this MC track was not already added to the map, add it now + if (fLabelsMap.find(mctrack.globalIndex()) == fLabelsMap.end()) { fLabelsMap[mctrack.globalIndex()] = trackCounter; fLabelsMapReversed[trackCounter] = mctrack.globalIndex(); fMCFlags[mctrack.globalIndex()] = mcflags; trackCounter++; - // if any of the MC signals was matched, then fill histograms and write that MC particle into the new stack // fill histograms for each of the signals, if found - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { VarManager::FillTrackMC(mcTracks, mctrack); VarManager::FillEvent(mctrack.mcCollision()); int j = 0; for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); signal++, j++) { - if (mcflags & (uint16_t(1) << j)) { + if (mcflags & (static_cast(1) << j)) { fHistMan->FillHistClass(Form("MCTruth_%s", (*signal).GetName()), VarManager::fgValues); } } @@ -394,7 +434,9 @@ struct TableMakerMC { template void skimCollisions(TEvents const& collisions, BCsWithTimestamps const& /*bcs*/) { - // Skim collisions + // Skim reconstructed collisions which are selected by the user specified cuts + + // Create a collision index map to relate between the "old" AO2D indices and the skimmed ones fCollIndexMap.clear(); int multTPC = -1.0; float multFV0A = -1.0; @@ -409,8 +451,10 @@ struct TableMakerMC { int multTracksPV = -1.0; float centFT0C = -1.0; + // Loop over collisions for (const auto& collision : collisions) { + // Fill the stats event histogram with the event selection bits for (int i = 0; i < o2::aod::evsel::kNsel; i++) { if (collision.selection_bit(i)) { (reinterpret_cast(fStatsList->At(0)))->Fill(1.0, static_cast(i)); @@ -420,14 +464,15 @@ struct TableMakerMC { auto bc = collision.template bc_as(); // store the selection decisions - uint64_t tag = 0; + uint64_t tag = static_cast(0); // store some more information in the tag - // if the BC found by event selection does not coincide with the collision.bc() + // if the BC found by event selection does not coincide with the collision.bc(), toggle the first bit auto bcEvSel = collision.template foundBC_as(); if (bcEvSel.globalIndex() != bc.globalIndex()) { - tag |= (uint64_t(1) << 0); + tag |= (static_cast(1) << 0); } + // Compute BC and event quantities and fill histograms VarManager::ResetValues(0, VarManager::kNEventWiseVariables); VarManager::FillBC(bc); VarManager::FillEvent(collision); // extract event information and place it in the fValues array @@ -444,6 +489,7 @@ struct TableMakerMC { } (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(o2::aod::evsel::kNsel)); + // Apply the user specified event selection if (!fEventCut->IsSelected(VarManager::fgValues)) { continue; } @@ -456,6 +502,7 @@ struct TableMakerMC { } (reinterpret_cast(fStatsList->At(0)))->Fill(3.0, static_cast(o2::aod::evsel::kNsel)); + // Fill historams after event cuts fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); // create the event tables @@ -485,9 +532,10 @@ struct TableMakerMC { multPV(collision.multNTracksHasITS(), collision.multNTracksHasTPC(), collision.multNTracksHasTOF(), collision.multNTracksHasTRD(), collision.multNTracksITSOnly(), collision.multNTracksTPCOnly(), collision.multNTracksITSTPC(), collision.trackOccupancyInTimeRange()); multAll(collision.multAllTracksTPCOnly(), collision.multAllTracksITSTPC(), - 0, 0, 0.0, 0.0, 0, 0); + 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0); } + // add an element for this collision into the map fCollIndexMap[collision.globalIndex()] = event.lastIndex(); } } @@ -495,46 +543,48 @@ struct TableMakerMC { template void skimTracks(TEvent const& collision, TTracks const& /*tracks*/, TrackAssoc const& assocs, aod::McParticles const& mcTracks) { - // Skim the barrel tracks - // Loop over the collision-track associations, retrieve the track, and apply track cuts for selection - // Tracks are written only once, even if they constribute to more than one association - // It is assumed that we do not apply cuts which depend on the track-collision association at the skimming time (e.g. DCA) - - uint64_t trackFilteringTag = uint64_t(0); - uint64_t trackTempFilterMap = uint8_t(0); - uint16_t mcflags = 0; + // Skim the barrel track associations + // Apply track cuts for each collision association and if it passes the cuts, we skim it. + // NOTE: If selection cuts include conditions on quantities dependent on the associated collision (e.g. DCA), + // one track may pass for some association and fail for others. + // Tracks are written only once in the skims, even if they contribute to more than one association + // so in case of multiple associations, the variables depending on the collision association (e.g. DCA, secondary vertexing, etc) + // have to be recomputed at analysis time for each association. + + uint64_t trackFilteringTag = static_cast(0); + uint32_t trackTempFilterMap = static_cast(0); + uint16_t mcflags = static_cast(0); int trackCounter = fLabelsMap.size(); + // Loop over associations for (const auto& assoc : assocs) { auto track = assoc.template track_as(); - // If this track exists already in the index map, it was checked already. - // So at this point we just skim the association and continue - // NOTE: This means we do not make cuts based on the barrel track-collision association in the skimming - if (fTrackIndexMap.find(track.globalIndex()) != fTrackIndexMap.end()) { - trackBarrelAssoc(fCollIndexMap[collision.globalIndex()], fTrackIndexMap[track.globalIndex()]); + // If the original collision of this track was not selected for skimming, then we skip this track. + // Normally, the filter-pp is selecting all collisions which contain the tracks which contributed to the triggering + // of an event, so this is rejecting possibly a few tracks unrelated to the trigger, originally associated with collisions distant in time. + if (fCollIndexMap.find(track.collisionId()) == fCollIndexMap.end()) { continue; } - // Here we have new tracks - trackFilteringTag = uint64_t(0); - trackTempFilterMap = uint8_t(0); + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); + + // Compute track quantities and fill histograms VarManager::FillTrack(track); - if (fPropTrack && (track.collisionId() != collision.globalIndex())) { + if (fConfigVariousOptions.fPropTrack && (track.collisionId() != collision.globalIndex())) { VarManager::FillTrackCollision(track, collision); } if (fDoDetailedQA) { fHistMan->FillHistClass("TrackBarrel_BeforeCuts", VarManager::fgValues); } - // apply track cuts and fill stats histogram + // apply track cuts and fill histograms int i = 0; for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, i++) { if ((*cut).IsSelected(VarManager::fgValues)) { - trackTempFilterMap |= (uint8_t(1) << i); - // NOTE: the QA is filled here for every (collision,track) association - // TODO: create a statistics histograms with unique tracks - if (fConfigQA) { + trackTempFilterMap |= (static_cast(1) << i); + if (fConfigHistOutput.fConfigQA) { fHistMan->FillHistClass(Form("TrackBarrel_%s", (*cut).GetName()), VarManager::fgValues); } (reinterpret_cast(fStatsList->At(1)))->Fill(static_cast(i)); @@ -544,9 +594,16 @@ struct TableMakerMC { continue; } - // store selection information in the track tag + // If this track is already present in the index map, it means it was already skimmed, + // so we just store the association and we skip the track + if (fTrackIndexMap.find(track.globalIndex()) != fTrackIndexMap.end()) { + trackBarrelAssoc(fCollIndexMap[collision.globalIndex()], fTrackIndexMap[track.globalIndex()]); + continue; + } + + // store V0 and Dalitz bits selection information in the track tag if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackV0Bits)) { // BIT0-4: V0Bits - trackFilteringTag |= uint64_t(track.pidbit()); + trackFilteringTag |= static_cast(track.pidbit()); for (int iv0 = 0; iv0 < 5; iv0++) { if (track.pidbit() & (uint8_t(1) << iv0)) { (reinterpret_cast(fStatsList->At(1)))->Fill(fTrackCuts.size() + static_cast(iv0)); @@ -554,18 +611,17 @@ struct TableMakerMC { } } // end if V0Bits if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::DalitzBits)) { - trackFilteringTag |= (uint64_t(track.dalitzBits()) << VarManager::kDalitzBits); // BIT5-12: Dalitz + trackFilteringTag |= (static_cast(track.dalitzBits()) << VarManager::kDalitzBits); // BIT5-12: Dalitz } - trackFilteringTag |= (uint64_t(trackTempFilterMap) << VarManager::kBarrelUserCutsBits); // BIT13-...: user track filters + trackFilteringTag |= (static_cast(trackTempFilterMap) << VarManager::kBarrelUserCutsBits); // BIT13-...: user track filters // NOTE: The collision ID that is written in the table is the one originally assigned in the AOD. // However, in data analysis one should loop over associations, so this one should not be used. // In the case of Run2-like analysis, there will be no associations, so this ID will be the one originally assigned in the AO2Ds (updated for the skims) - uint32_t reducedEventIdx = -1; - if (track.has_collision() && - fCollIndexMap.find(track.collisionId()) != fCollIndexMap.end()) { // if the original track collisionId is from a not skimmed collision, keep -1 as coll index - reducedEventIdx = fCollIndexMap[track.collisionId()]; - } + uint32_t reducedEventIdx = fCollIndexMap[track.collisionId()]; + + // NOTE: trackBarrelInfo stores the index of the collision as in AO2D (for use in some cases where the analysis on skims is done + // in workflows where the original AO2Ds are also present) trackBarrelInfo(track.collisionId(), collision.posX(), collision.posY(), collision.posZ(), track.globalIndex()); trackBasic(reducedEventIdx, trackFilteringTag, track.pt(), track.eta(), track.phi(), track.sign(), 0); trackBarrel(track.x(), track.alpha(), track.y(), track.z(), track.snp(), track.tgl(), track.signed1Pt(), @@ -603,7 +659,8 @@ struct TableMakerMC { // check all the specified signals and fill histograms for MC truth matched tracks for (auto& sig : fMCSignals) { if (sig.CheckSignal(true, mctrack)) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); + // If detailed QA is on, fill histograms for each MC signal and track cut combination if (fDoDetailedQA) { j = 0; for (auto& cut : fTrackCuts) { @@ -640,7 +697,7 @@ struct TableMakerMC { for (const auto& assoc : mftAssocs) { auto track = assoc.template mfttrack_as(); - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { VarManager::FillTrack(track); fHistMan->FillHistClass("MftTracks", VarManager::fgValues); } @@ -648,8 +705,8 @@ struct TableMakerMC { // write the MFT track global index in the map for skimming (to make sure we have it just once) if (fMftIndexMap.find(track.globalIndex()) == fMftIndexMap.end()) { uint32_t reducedEventIdx = fCollIndexMap[collision.globalIndex()]; - mftTrack(reducedEventIdx, uint64_t(0), track.pt(), track.eta(), track.phi()); - // TODO: We are not writing the DCA at the moment, because this depend on the collision association + mftTrack(reducedEventIdx, static_cast(0), track.pt(), track.eta(), track.phi()); + // TODO: We are not writing the DCA at the moment, because this depends on the collision association mftTrackExtra(track.mftClusterSizesAndTrackFlags(), track.sign(), 0.0, 0.0, track.nClusters()); fMftIndexMap[track.globalIndex()] = mftTrack.lastIndex(); @@ -665,10 +722,10 @@ struct TableMakerMC { // Loop over the collision-track associations, recompute track properties depending on the collision assigned, and apply track cuts for selection // Muons are written only once, even if they constribute to more than one association, // which means that in the case of multiple associations, the track parameters are wrong and should be computed again at analysis time. - uint8_t trackFilteringTag = uint8_t(0); - uint8_t trackTempFilterMap = uint8_t(0); + uint8_t trackFilteringTag = static_cast(0); + uint8_t trackTempFilterMap = static_cast(0); fFwdTrackIndexMapReversed.clear(); - uint16_t mcflags = 0; + uint16_t mcflags = static_cast(0); int trackCounter = fLabelsMap.size(); uint32_t offset = muonBasic.lastIndex(); @@ -682,13 +739,13 @@ struct TableMakerMC { VarManager::FillTrack(muon); // NOTE: If a muon is associated to multiple collisions, depending on the selections, // it may be accepted for some associations and rejected for other - if (fPropMuon) { + if (fConfigVariousOptions.fPropMuon) { VarManager::FillPropagateMuon(muon, collision); } // recalculte pDca and global muon kinematics - if (static_cast(muon.trackType()) < 2 && fRefitGlobalMuon) { + if (static_cast(muon.trackType()) < 2 && fConfigVariousOptions.fRefitGlobalMuon) { auto muontrack = muon.template matchMCHTrack_as(); - if (muontrack.eta() < fMuonMatchEtaMin || muontrack.eta() > fMuonMatchEtaMax) { + if (muontrack.eta() < fConfigVariousOptions.fMuonMatchEtaMin || muontrack.eta() > fConfigVariousOptions.fMuonMatchEtaMax) { continue; } auto mfttrack = muon.template matchMFTTrack_as(); @@ -701,12 +758,12 @@ struct TableMakerMC { if (fDoDetailedQA) { fHistMan->FillHistClass("Muons_BeforeCuts", VarManager::fgValues); } - // check the cuts and filters + // check the cuts and fill histograms for each fulfilled cut int i = 0; for (auto cut = fMuonCuts.begin(); cut != fMuonCuts.end(); cut++, i++) { if ((*cut).IsSelected(VarManager::fgValues)) { trackTempFilterMap |= (uint8_t(1) << i); - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { fHistMan->FillHistClass(Form("Muons_%s", (*cut).GetName()), VarManager::fgValues); } (reinterpret_cast(fStatsList->At(2)))->Fill(static_cast(i)); @@ -742,7 +799,7 @@ struct TableMakerMC { // check all the specified signals and fill histograms for MC truth matched tracks for (auto& sig : fMCSignals) { if (sig.CheckSignal(true, mctrack)) { - mcflags |= (uint16_t(1) << i); + mcflags |= (static_cast(1) << i); if (fDoDetailedQA) { for (auto& cut : fMuonCuts) { if (trackTempFilterMap & (uint8_t(1) << j)) { @@ -797,11 +854,11 @@ struct TableMakerMC { } } VarManager::FillTrack(muon); - if (fPropMuon) { + if (fConfigVariousOptions.fPropMuon) { VarManager::FillPropagateMuon(muon, collision); } // recalculte pDca and global muon kinematics - if (static_cast(muon.trackType()) < 2 && fRefitGlobalMuon) { + if (static_cast(muon.trackType()) < 2 && fConfigVariousOptions.fRefitGlobalMuon) { auto muontrack = muon.template matchMCHTrack_as(); auto mfttrack = muon.template matchMFTTrack_as(); VarManager::FillTrackCollision(muontrack, collision); @@ -838,16 +895,17 @@ struct TableMakerMC { TTrackAssoc const& trackAssocs, TFwdTrackAssoc const& fwdTrackAssocs, TMFTTrackAssoc const& mftAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { + // Check whether the run changed and update CCDB if it did if (bcs.size() > 0 && fCurrentRun != bcs.begin().runNumber()) { if (fIsRun2 == true) { - grpmagrun2 = fCCDB->getForTimeStamp(grpmagPathRun2, bcs.begin().timestamp()); - if (grpmagrun2 != nullptr) { - o2::base::Propagator::initFieldFromGRP(grpmagrun2); + fGrpMagRun2 = fCCDB->getForTimeStamp(fConfigCCDB.fGrpMagPathRun2, bcs.begin().timestamp()); + if (fGrpMagRun2 != nullptr) { + o2::base::Propagator::initFieldFromGRP(fGrpMagRun2); } } else { - grpmag = fCCDB->getForTimeStamp(grpmagPath, bcs.begin().timestamp()); - if (grpmag != nullptr) { - o2::base::Propagator::initFieldFromGRP(grpmag); + fGrpMag = fCCDB->getForTimeStamp(fConfigCCDB.fGrpMagPath, bcs.begin().timestamp()); + if (fGrpMag != nullptr) { + o2::base::Propagator::initFieldFromGRP(fGrpMag); } } std::map metadataRCT, header; @@ -878,6 +936,7 @@ struct TableMakerMC { return; } + // Clear index map and reserve memory for barrel tables if constexpr (static_cast(TTrackFillMap)) { fTrackIndexMap.clear(); trackBarrelInfo.reserve(tracksBarrel.size()); @@ -889,6 +948,7 @@ struct TableMakerMC { trackBarrelLabels.reserve(tracksBarrel.size()); } + // Clear index map and reserve memory for MFT tables if constexpr (static_cast(TMFTFillMap)) { fMftIndexMap.clear(); mftTrack.reserve(mftTracks.size()); @@ -896,6 +956,7 @@ struct TableMakerMC { mftAssoc.reserve(mftTracks.size()); } + // Clear index map and reserve memory for muon tables if constexpr (static_cast(TMuonFillMap)) { fFwdTrackIndexMap.clear(); fFwdTrackFilterMap.clear(); @@ -978,7 +1039,7 @@ struct TableMakerMC { mctrack.weight(), mctrack.pt(), mctrack.eta(), mctrack.phi(), mctrack.e(), mctrack.vx(), mctrack.vy(), mctrack.vz(), mctrack.vt(), mcflags); for (unsigned int isig = 0; isig < fMCSignals.size(); isig++) { - if (mcflags & (uint16_t(1) << isig)) { + if (mcflags & (static_cast(1) << isig)) { (reinterpret_cast(fStatsList->At(3)))->Fill(static_cast(isig)); } } @@ -993,36 +1054,36 @@ struct TableMakerMC { std::unique_ptr objArray(histClasses.Tokenize(";")); for (Int_t iclass = 0; iclass < objArray->GetEntries(); ++iclass) { TString classStr = objArray->At(iclass)->GetName(); - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { fHistMan->AddHistClass(classStr.Data()); } - TString histEventName = fConfigAddEventHistogram.value; + TString histEventName = fConfigHistOutput.fConfigAddEventHistogram.value; if (classStr.Contains("Event")) { - if (fConfigQA && !classStr.Contains("MCTruth")) { + if (fConfigHistOutput.fConfigQA && !classStr.Contains("MCTruth")) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "event", histEventName); } else { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "event", "generator"); } } - TString histTrackName = fConfigAddTrackHistogram.value; + TString histTrackName = fConfigHistOutput.fConfigAddTrackHistogram.value; if (classStr.Contains("Track")) { - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", histTrackName); } } - TString histMuonName = fConfigAddMuonHistogram.value; + TString histMuonName = fConfigHistOutput.fConfigAddMuonHistogram.value; if (classStr.Contains("Muons")) { - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", histMuonName); } } - TString histMCTruthName = fConfigAddMCTruthHistogram.value; + TString histMCTruthName = fConfigHistOutput.fConfigAddMCTruthHistogram.value; if (classStr.Contains("MCTruth") && !classStr.Contains("Event")) { - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "mctruth_track", histMCTruthName); } } diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index f7df4a672bc..295fd1168cd 100644 --- a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx @@ -17,6 +17,12 @@ // The skimming can optionally produce just the barrel, muon, or both barrel and muon tracks // The event filtering, centrality, and V0Bits (from v0-selector) can be switched on/off by selecting one // of the process functions +// C++ includes +#include +#include +#include +#include +// other includes #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" @@ -63,6 +69,7 @@ using namespace o2::aod; Zorro zorro; +// Declaration of various Joins used in the different process functions // TODO: Since DCA depends on which collision the track is associated to, we should remove writing and subscribing to DCA tables, to optimize on CPU / memory using MyBarrelTracks = soa::Join; -using MyBarrelTracksWithV0BitsForMaps = soa::Join; +using MyBarrelTracksWithV0BitsNoTOF = soa::Join; using MyBarrelTracksWithDalitzBits = soa::Join; using ExtBCs = soa::Join; -namespace o2::aod -{ -DECLARE_SOA_TABLE(AmbiguousTracksMid, "AOD", "AMBIGUOUSTRACK", //! Table for tracks which are not uniquely associated with a collision - o2::soa::Index<>, o2::aod::ambiguous::TrackId, o2::aod::ambiguous::BCIdSlice, o2::soa::Marker<2>); -DECLARE_SOA_TABLE(AmbiguousTracksFwd, "AOD", "AMBIGUOUSFWDTR", //! Table for Fwd tracks which are not uniquely associated with a collision - o2::soa::Index<>, o2::aod::ambiguous::FwdTrackId, o2::aod::ambiguous::BCIdSlice, o2::soa::Marker<2>); -} // namespace o2::aod - +// Declaration of various bit maps containing information on which tables are included in a Join +// These are used as template arguments and checked at compile time // constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; // constexpr static uint32_t gkEventFillMapWithFilter = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::EventFilter; - constexpr static uint32_t gkEventFillMapWithMults = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult; constexpr static uint32_t gkEventFillMapWithMultsZdc = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult | VarManager::ObjTypes::Zdc; constexpr static uint32_t gkEventFillMapWithMultsAndEventFilter = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult | VarManager::ObjTypes::CollisionMultExtra | VarManager::ObjTypes::EventFilter; @@ -121,7 +121,7 @@ constexpr static uint32_t gkEventFillMapWithCentAndMults = VarManager::ObjTypes: // constexpr static uint32_t gkTrackFillMap = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackPID | VarManager::ObjTypes::TrackPIDExtra; constexpr static uint32_t gkTrackFillMapWithCov = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackCov | VarManager::ObjTypes::TrackPID | VarManager::ObjTypes::TrackPIDExtra; constexpr static uint32_t gkTrackFillMapWithV0Bits = gkTrackFillMapWithCov | VarManager::ObjTypes::TrackV0Bits; -// constexpr static uint32_t gkTrackFillMapWithV0BitsForMaps = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackV0Bits | VarManager::ObjTypes::TrackTPCPID; +constexpr static uint32_t gkTrackFillMapWithV0BitsNoTOF = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackV0Bits | VarManager::ObjTypes::TrackTPCPID; // constexpr static uint32_t gkTrackFillMapWithDalitzBits = gkTrackFillMap | VarManager::ObjTypes::DalitzBits; // constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::Muon; constexpr static uint32_t gkMuonFillMapWithCov = VarManager::ObjTypes::Muon | VarManager::ObjTypes::MuonCov; @@ -130,6 +130,16 @@ constexpr static uint32_t gkMuonFillMapWithCov = VarManager::ObjTypes::Muon | Va // constexpr static uint32_t gkTrackFillMapWithAmbi = VarManager::ObjTypes::Track | VarManager::ObjTypes::AmbiTrack; constexpr static uint32_t gkMFTFillMap = VarManager::ObjTypes::TrackMFT; +// Enum containing the ordering of statistics histograms to be written in the QA file +enum SkimStatsHists { + kStatsEvent = 0, + kStatsTracks, + kStatsMuons, + kStatsOrphanTracks, + kStatsZorroInfo, + kStatsZorroSel +}; + struct TableMaker { Produces event; @@ -160,67 +170,90 @@ struct TableMaker { HistogramManager* fHistMan; // Event and track AnalysisCut configurables - Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; - Configurable fConfigTrackCuts{"cfgBarrelTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; - Configurable fConfigMuonCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; - Configurable fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"}; - Configurable fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"}; + struct : ConfigurableGroup { + Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; + Configurable fConfigTrackCuts{"cfgBarrelTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable fConfigMuonCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; + } fConfigCuts; + + // Zorro selection + struct : ConfigurableGroup { + Configurable fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"}; + Configurable fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"}; + Configurable fConfigRunZorroSel{"cfgRunZorroSel", false, "Select events with trigger mask"}; + } fConfigZorro; // Steer QA output - Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; - Configurable fConfigDetailedQA{"cfgDetailedQA", false, "If true, include more QA histograms (BeforeCuts classes)"}; - Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; + struct : ConfigurableGroup { + Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; + Configurable fConfigDetailedQA{"cfgDetailedQA", false, "If true, include more QA histograms (BeforeCuts classes)"}; + Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; + } fConfigHistOutput; - // Selections to be applied as Filter on the Track and FwdTrack Configurable fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"}; - Configurable fConfigBarrelTrackMaxAbsEta{"cfgBarrelMaxAbsEta", 0.9f, "Eta absolute value cut for tracks in the barrel"}; - Configurable fConfigBarrelTrackMinPt{"cfgBarrelMinPt", 0.5f, "Minimum pt for tracks in the barrel"}; - Configurable fConfigBarrelRequireTPC{"cfgBarrelRequireTPC", true, "Require TPC for tracks in the barrel"}; - Configurable fConfigBarrelMinTPCncls{"cfgBarrelMinTPCncls", 50.0f, "Minimum TPC cls for tracks in the barrel"}; - Configurable fConfigBarrelMaxTPCchi2{"cfgBarrelMaxTPCchi2", 10.0f, "Maximum TPC chi2/ndf for tracks in the barrel"}; - Configurable fConfigBarrelRequireITS{"cfgBarrelRequireITS", true, "Require ITS for tracks in the barrel"}; - Configurable fConfigBarrelMaxITSchi2{"cfgBarrelMaxITSchi2", 36.0f, "Maximum ITS chi2/ndf for tracks in the barrel"}; - Configurable fConfigMuonPtLow{"cfgMuonLowPt", 1.0f, "Low pt cut for muons"}; + + // Selections to be applied as Filter on the Track and FwdTrack + /*struct : ConfigurableGroup { + Configurable fConfigBarrelTrackMaxAbsEta{"cfgBarrelMaxAbsEta", 0.9f, "Eta absolute value cut for tracks in the barrel"}; + Configurable fConfigBarrelTrackMinPt{"cfgBarrelMinPt", 0.5f, "Minimum pt for tracks in the barrel"}; + Configurable fConfigBarrelRequireTPC{"cfgBarrelRequireTPC", true, "Require TPC for tracks in the barrel"}; + Configurable fConfigBarrelMinTPCncls{"cfgBarrelMinTPCncls", 50.0f, "Minimum TPC cls for tracks in the barrel"}; + Configurable fConfigBarrelMaxTPCchi2{"cfgBarrelMaxTPCchi2", 10.0f, "Maximum TPC chi2/ndf for tracks in the barrel"}; + Configurable fConfigBarrelRequireITS{"cfgBarrelRequireITS", true, "Require ITS for tracks in the barrel"}; + Configurable fConfigBarrelMaxITSchi2{"cfgBarrelMaxITSchi2", 36.0f, "Maximum ITS chi2/ndf for tracks in the barrel"}; + Configurable fConfigMuonPtLow{"cfgMuonLowPt", 1.0f, "Low pt cut for muons"}; + } fConfigFilter;*/ // CCDB connection configurables - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; - Configurable fConfigCcdbPathZorro{"ccdb-path-zorro", "Users/r/rlietava/EventFiltering/OTS/", "base path to the ccdb object for zorro"}; - Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable grpmagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"}; + struct : ConfigurableGroup { + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbPathZorro{"ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/Chunked/", "base path to the ccdb object for zorro"}; + Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable fConfigGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable fConfigGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"}; + } fConfigCCDB; // TPC postcalibration related options - Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas(electrons, pions, protons)"}; - Configurable fConfigComputeTPCpostCalibKaon{"cfgTPCpostCalibKaon", false, "If true, compute TPC post-calibrated n-sigmas for kaons"}; - Configurable fConfigIsOnlyforMaps{"cfgIsforMaps", false, "If true, run for postcalibration maps only"}; - Configurable fConfigSaveElectronSample{"cfgSaveElectronSample", false, "If true, only save electron sample"}; - Configurable fConfigDummyRunlist{"cfgDummyRunlist", false, "If true, use dummy runlist"}; - Configurable fConfigInitRunNumber{"cfgInitRunNumber", 543215, "Initial run number used in run by run checks"}; - - // Track related options - Configurable fPropTrack{"cfgPropTrack", true, "Propagate tracks to associated collision to recalculate DCA and momentum vector"}; - - // Muon related options - Configurable fPropMuon{"cfgPropMuon", true, "Propagate muon tracks through absorber (do not use if applying pairing)"}; - Configurable fRefitGlobalMuon{"cfgRefitGlobalMuon", true, "Correct global muon parameters"}; - Configurable fMuonMatchEtaMin{"cfgMuonMatchEtaMin", -4.0f, "Definition of the acceptance of muon tracks to be matched with MFT"}; - Configurable fMuonMatchEtaMax{"cfgMuonMatchEtaMax", -2.5f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + struct : ConfigurableGroup { + Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas(electrons, pions, protons)"}; + Configurable fConfigComputeTPCpostCalibKaon{"cfgTPCpostCalibKaon", false, "If true, compute TPC post-calibrated n-sigmas for kaons"}; + Configurable fConfigIsOnlyforMaps{"cfgIsforMaps", false, "If true, run for postcalibration maps only"}; + Configurable fConfigSaveElectronSample{"cfgSaveElectronSample", false, "If true, only save electron sample"}; + Configurable fConfigDummyRunlist{"cfgDummyRunlist", false, "If true, use dummy runlist"}; + Configurable fConfigInitRunNumber{"cfgInitRunNumber", 543215, "Initial run number used in run by run checks"}; + } fConfigPostCalibTPC; + + struct : ConfigurableGroup { + // Track related options + Configurable fPropTrack{"cfgPropTrack", true, "Propagate tracks to associated collision to recalculate DCA and momentum vector"}; + // Muon related options + Configurable fPropMuon{"cfgPropMuon", true, "Propagate muon tracks through absorber (do not use if applying pairing)"}; + Configurable fRefitGlobalMuon{"cfgRefitGlobalMuon", true, "Correct global muon parameters"}; + Configurable fMuonMatchEtaMin{"cfgMuonMatchEtaMin", -4.0f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + Configurable fMuonMatchEtaMax{"cfgMuonMatchEtaMax", -2.5f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + + // TPC occupancy related variables + Configurable fTPCShortPast{"cfgTPCShortPast", 8.0f, "Time in short past to look for occupancy (micro-seconds)"}; + Configurable fTPCShortFuture{"cfgTPCShortFuture", 8.0f, "Time in short future to look for occupancy (micro-seconds)"}; + Configurable fTPCLongPast{"cfgTPCLongPast", 100.0f, "Time in long past to look for occupancy (micro-seconds)"}; + Configurable fTPCLongFuture{"cfgTPCLongFuture", 100.0f, "Time in long future to look for occupancy (micro-seconds)"}; + Configurable fExcludeShort{"cfgTPCExcludeShort", true, "Exclude short term from long term occupancy (micro-seconds)"}; + } fConfigVariousOptions; Service fCCDB; + o2::ccdb::CcdbApi fCCDBApi; - o2::parameters::GRPObject* grpmagrun2 = nullptr; // for run 2, we access the GRPObject from GLO/GRP/GRP - o2::parameters::GRPMagField* grpmag = nullptr; // for run 3, we access GRPMagField from GLO/Config/GRPMagField + o2::parameters::GRPObject* fGrpMagRun2 = nullptr; // for run 2, we access the GRPObject from GLO/GRP/GRP + o2::parameters::GRPMagField* fGrpMag = nullptr; // for run 3, we access GRPMagField from GLO/Config/GRPMagField AnalysisCompositeCut* fEventCut; //! Event selection cut std::vector fTrackCuts; //! Barrel track cuts std::vector fMuonCuts; //! Muon track cuts - Service ccdb; - o2::ccdb::CcdbApi fCCDBApi; bool fDoDetailedQA = false; // Bool to set detailed QA true, if QA is set true int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. @@ -236,106 +269,141 @@ struct TableMaker { // our own Filtered tracks. If the filter is very selective, then it may be worth to run the association in this workflow // using the Common/CollisionAssociation class /*Filter barrelSelectedTracks = ifnode(fIsRun2.node() == true, track::trackType == uint8_t(track::Run2Track), track::trackType == uint8_t(track::Track)) - && track::pt > fConfigBarrelTrackMinPt - && nabs(track::eta) <= fConfigBarrelTrackMaxAbsEta - && ifnode(fConfigBarrelRequireITS.node() == true, track::itsChi2NCl < fConfigBarrelMaxITSchi2, true) - && ifnode(fConfigBarrelRequireTPC.node() == true, track::tpcNClsFound > fConfigBarrelMinTPCncls && track::tpcChi2NCl < fConfigBarrelMaxTPCchi2, true); + && track::pt > fConfigFilter.fConfigBarrelTrackMinPt + && nabs(track::eta) <= fConfigFilter.fConfigBarrelTrackMaxAbsEta + && ifnode(fConfigFilter.fConfigBarrelRequireITS.node() == true, track::itsChi2NCl < fConfigFilter.fConfigBarrelMaxITSchi2, true) + && ifnode(fConfigFilter.fConfigBarrelRequireTPC.node() == true, track::tpcNClsFound > fConfigFilter.fConfigBarrelMinTPCncls && track::tpcChi2NCl < fConfigFilter.fConfigBarrelMaxTPCchi2, true); - Filter muonFilter = o2::aod::fwdtrack::pt >= fConfigMuonPtLow;*/ + Filter muonFilter = o2::aod::fwdtrack::pt >= fConfigFilter.fConfigMuonPtLow;*/ Preslice trackIndicesPerCollision = aod::track_association::collisionId; Preslice fwdtrackIndicesPerCollision = aod::track_association::collisionId; Preslice mfttrackIndicesPerCollision = aod::track_association::collisionId; + Preslice preslice = aod::track::collisionId; + Partition tracksPos = (((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)) && (aod::track::tgl > static_cast(0.05))); + Partition tracksNeg = (((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)) && (aod::track::tgl < static_cast(-0.05))); + + Preslice presliceNoTOF = aod::track::collisionId; + Partition tracksPosNoTOF = (((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)) && (aod::track::tgl > static_cast(0.05))); + Partition tracksNegNoTOF = (((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)) && (aod::track::tgl < static_cast(-0.05))); + + struct { + std::map oMeanTimeShortA; + std::map oMeanTimeShortC; + std::map oMeanTimeLongA; + std::map oMeanTimeLongC; + std::map oMedianTimeShortA; + std::map oMedianTimeShortC; + std::map oMedianTimeLongA; + std::map oMedianTimeLongC; + std::map oContribShortA; + std::map oContribShortC; + std::map oContribLongA; + std::map oContribLongC; + } fOccup; + void init(o2::framework::InitContext& context) { - DefineCuts(); - ccdb->setURL(fConfigCcdbUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); + // CCDB configuration + if (fConfigPostCalibTPC.fConfigComputeTPCpostCalib) { + fCCDB->setURL(fConfigCCDB.fConfigCcdbUrl.value); + fCCDB->setCaching(true); + fCCDB->setLocalObjectValidityChecking(); + // Not later than now objects + fCCDB->setCreatedNotAfter(fConfigCCDB.fConfigNoLaterThan.value); + } + fCCDBApi.init(fConfigCCDB.fConfigCcdbUrl.value); + if (!o2::base::GeometryManager::isGeometryLoaded()) { - ccdb->get(geoPath); + fCCDB->get(fConfigCCDB.fConfigGeoPath); } + // Define the event, track and muon cuts + DefineCuts(); + + // Initialize the histogram manager VarManager::SetDefaultVarNames(); fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); fHistMan->SetUseDefaultVariableNames(kTRUE); fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); // Only use detailed QA when QA is set true - if (fConfigQA && fConfigDetailedQA) { + if (fConfigHistOutput.fConfigQA && fConfigHistOutput.fConfigDetailedQA) { fDoDetailedQA = true; } // Create the histogram class names to be added to the histogram manager + // The histogram class names are added into a string and then passed to the DefineHistograms() function which + // actually configures the HistogramManager + // Histograms are defined as histogram classes / groups and filled at specific points in the analysis flow TString histClasses = ""; + // Event-wise histograms, before selection cuts if (fDoDetailedQA) { histClasses += "Event_BeforeCuts;"; } - if (fConfigQA) { + // Event-wise histograms, after selection cuts + if (fConfigHistOutput.fConfigQA) { histClasses += "Event_AfterCuts;"; } + // Check whether we have to define barrel or muon histograms bool enableBarrelHistos = (context.mOptions.get("processPPWithFilter") || context.mOptions.get("processPPWithFilterBarrelOnly") || context.mOptions.get("processPPBarrelOnly") || - context.mOptions.get("processPbPb") || context.mOptions.get("processPbPbBarrelOnly") || context.mOptions.get("processPbPbBarrelOnlyWithV0Bits")); + context.mOptions.get("processPbPb") || context.mOptions.get("processPbPbBarrelOnly") || context.mOptions.get("processPbPbBarrelOnlyWithV0Bits") || context.mOptions.get("processPbPbBarrelOnlyWithV0BitsNoTOF")); + bool enableMuonHistos = (context.mOptions.get("processPPWithFilter") || context.mOptions.get("processPPWithFilterMuonOnly") || context.mOptions.get("processPPWithFilterMuonMFT") || context.mOptions.get("processPPMuonOnly") || context.mOptions.get("processPPMuonMFT") || context.mOptions.get("processPbPb") || context.mOptions.get("processPbPbMuonOnly") || context.mOptions.get("processPbPbMuonMFT")); if (enableBarrelHistos) { + // Barrel track histograms, before selections if (fDoDetailedQA) { histClasses += "TrackBarrel_BeforeCuts;"; } - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { + // Barrel track histograms after selections; one histogram directory for each user specified selection for (auto& cut : fTrackCuts) { histClasses += Form("TrackBarrel_%s;", cut.GetName()); } } - if (fConfigIsOnlyforMaps) { + // Barrel histograms for clean samples of V0 legs used for post-calibration + if (fConfigPostCalibTPC.fConfigIsOnlyforMaps) { histClasses += "TrackBarrel_PostCalibElectron;"; histClasses += "TrackBarrel_PostCalibPion;"; histClasses += "TrackBarrel_PostCalibProton;"; } } if (enableMuonHistos) { + // Muon tracks before cuts and MFT tracks if (fDoDetailedQA) { histClasses += "Muons_BeforeCuts;"; histClasses += "MftTracks;"; } - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { + // Muon tracks after selections; one directory per selection for (auto& muonCut : fMuonCuts) { histClasses += Form("Muons_%s;", muonCut.GetName()); } } } - if (fConfigDummyRunlist) { - VarManager::SetDummyRunlist(fConfigInitRunNumber); + if (fConfigPostCalibTPC.fConfigDummyRunlist) { + VarManager::SetDummyRunlist(fConfigPostCalibTPC.fConfigInitRunNumber); } DefineHistograms(histClasses); // define all histograms VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); - - // CCDB configuration - if (fConfigComputeTPCpostCalib) { - fCCDB->setURL(fConfigCcdbUrl.value); - fCCDB->setCaching(true); - fCCDB->setLocalObjectValidityChecking(); - // Not later than now objects - fCCDB->setCreatedNotAfter(fConfigNoLaterThan.value); - } - fCCDBApi.init(fConfigCcdbUrl.value); } void DefineCuts() { // Event cuts fEventCut = new AnalysisCompositeCut(true); - TString eventCutStr = fConfigEventCuts.value; + TString eventCutStr = fConfigCuts.fConfigEventCuts.value; fEventCut->AddCut(dqcuts::GetAnalysisCut(eventCutStr.Data())); // Barrel track cuts - TString cutNamesStr = fConfigTrackCuts.value; + TString cutNamesStr = fConfigCuts.fConfigTrackCuts.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { @@ -344,7 +412,7 @@ struct TableMaker { } // Muon cuts - cutNamesStr = fConfigMuonCuts.value; + cutNamesStr = fConfigCuts.fConfigMuonCuts.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { @@ -357,15 +425,16 @@ struct TableMaker { void DefineHistograms(TString histClasses) { + // Create histograms via HistogramManager std::unique_ptr objArray(histClasses.Tokenize(";")); for (Int_t iclass = 0; iclass < objArray->GetEntries(); ++iclass) { TString classStr = objArray->At(iclass)->GetName(); - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { fHistMan->AddHistClass(classStr.Data()); } // fill the THn histograms - if (fConfigIsOnlyforMaps) { + if (fConfigPostCalibTPC.fConfigIsOnlyforMaps) { if (classStr.Contains("PostCalibElectron")) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", "postcalib_electron"); } @@ -377,36 +446,42 @@ struct TableMaker { } } - TString histEventName = fConfigAddEventHistogram.value; + TString histEventName = fConfigHistOutput.fConfigAddEventHistogram.value; if (classStr.Contains("Event")) { - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "event", histEventName); } } - TString histTrackName = fConfigAddTrackHistogram.value; + TString histTrackName = fConfigHistOutput.fConfigAddTrackHistogram.value; if (classStr.Contains("Track")) { - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", histTrackName); } } - TString histMuonName = fConfigAddMuonHistogram.value; + TString histMuonName = fConfigHistOutput.fConfigAddMuonHistogram.value; if (classStr.Contains("Muons")) { - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", histMuonName); } } - TString histMftName = fConfigAddMuonHistogram.value; + TString histMftName = fConfigHistOutput.fConfigAddMuonHistogram.value; if (classStr.Contains("Mft")) { - if (fConfigDetailedQA) { + if (fConfigHistOutput.fConfigDetailedQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", histMftName); } } } - // create statistics histograms (event, tracks, muons) + // Create statistics histograms which will be stored in the QA output + // Event statistics: kStatsEvent + // Track statistics: kStatsTracks + // Muon statistics: kStatsMuons + // Orphan track statistics: kStatsOrphanTracks + // Zorro information: kStatsZorroInfo + // Zorro trigger selection: kStatsZorroSel fStatsList.setObject(new TList()); fStatsList->SetOwner(kTRUE); std::vector eventLabels{"BCs", "Collisions before filtering", "Before cuts", "After cuts"}; @@ -419,7 +494,7 @@ struct TableMaker { histEvents->GetYaxis()->SetBinLabel(ib, o2::aod::evsel::selectionLabels[ib - 1]); } histEvents->GetYaxis()->SetBinLabel(o2::aod::evsel::kNsel + 1, "Total"); - fStatsList->Add(histEvents); + fStatsList->AddAt(histEvents, kStatsEvent); // Track statistics: one bin for each track selection and 5 bins for V0 tags (gamma, K0s, Lambda, anti-Lambda, Omega) TH1D* histTracks = new TH1D("TrackStats", "Track statistics", fTrackCuts.size() + 5.0, -0.5, fTrackCuts.size() - 0.5 + 5.0); @@ -431,13 +506,200 @@ struct TableMaker { for (ib = 0; ib < 5; ib++) { histTracks->GetXaxis()->SetBinLabel(fTrackCuts.size() + 1 + ib, v0TagNames[ib]); } - fStatsList->Add(histTracks); + fStatsList->AddAt(histTracks, kStatsTracks); + TH1D* histMuons = new TH1D("MuonStats", "Muon statistics", fMuonCuts.size(), -0.5, fMuonCuts.size() - 0.5); ib = 1; for (auto cut = fMuonCuts.begin(); cut != fMuonCuts.end(); cut++, ib++) { histMuons->GetXaxis()->SetBinLabel(ib, (*cut).GetName()); } - fStatsList->Add(histMuons); + fStatsList->AddAt(histMuons, kStatsMuons); + + TH1D* histOrphanTracks = new TH1D("histOrphanTracks", "Orphan Track statistics", 2, -1, 1); + histOrphanTracks->GetXaxis()->SetBinLabel(1, "Track w/o collision ID"); + histOrphanTracks->GetXaxis()->SetBinLabel(2, "Track with +ve collision ID"); + fStatsList->AddAt(histOrphanTracks, kStatsOrphanTracks); + + TH2D* histZorroInfo = new TH2D("ZorroInfo", "Zorro information", 1, -0.5, 0.5, 1, -0.5, 0.5); + fStatsList->AddAt(histZorroInfo, kStatsZorroInfo); + + TH2D* histZorroSel = new TH2D("ZorroSel", "trigger of interested", 1, -0.5, 0.5, 1, -0.5, 0.5); + fStatsList->AddAt(histZorroSel, kStatsZorroSel); + } + + template + void computeOccupancyEstimators(TEvents const& collisions, Partition const& tracksPos, Partition const& tracksNeg, Preslice& preslice, TBCs const&) + { + + // clear the occupancy maps for this time frame + fOccup.oMeanTimeLongA.clear(); + fOccup.oMeanTimeLongC.clear(); + fOccup.oMeanTimeShortA.clear(); + fOccup.oMeanTimeShortC.clear(); + fOccup.oMedianTimeLongA.clear(); + fOccup.oMedianTimeLongC.clear(); + fOccup.oMedianTimeShortA.clear(); + fOccup.oMedianTimeShortC.clear(); + fOccup.oContribLongA.clear(); + fOccup.oContribLongC.clear(); + fOccup.oContribShortA.clear(); + fOccup.oContribShortC.clear(); + + std::map oBC; // key: collision index; value: global BC + std::map> oBCreversed; // key: global BC, value: list of collisions attached to this BC + std::map oVtxZ; // key: collision index; value: vtx-z position + std::map collMultPos; // key: collision index; value: tpc multiplicity on the A side + std::map collMultNeg; // key: collision index; value: tpc multiplicity on the C side + + const double bcUS = o2::constants::lhc::LHCBunchSpacingNS / 1000.0; // BC spacing in micro-seconds + const double vdrift = 2.5; // cm / mus + int32_t bcShortPast = std::lrint(fConfigVariousOptions.fTPCShortPast / bcUS); // (close in time collisions) 8 micro-seconds in BC intervals + int32_t bcShortFuture = std::lrint(fConfigVariousOptions.fTPCShortFuture / bcUS); // (close in time collisions) 8 micro-seconds in BC intervals + int32_t bcLongPast = std::lrint(fConfigVariousOptions.fTPCLongPast / bcUS); // (wide time range collisions) past 40 micro-seconds in BC intervals + int32_t bcLongFuture = std::lrint(fConfigVariousOptions.fTPCLongFuture / bcUS); // // (wide time range collisions) future 100 micro-seconds in BC intervals + + // Loop over collisions and extract needed info (BC, vtxZ, multiplicity separately in A and C sides) + for (const auto& collision : collisions) { + + auto bcEvSel = collision.template foundBC_as(); + int64_t bc = bcEvSel.globalBC(); + oBC[collision.globalIndex()] = bc; + oVtxZ[collision.globalIndex()] = collision.posZ(); + + // if more than one collision per bunch, add that collision to the list for that bunch + if (oBCreversed.find(bc) == oBCreversed.end()) { + std::vector evs = {collision.globalIndex()}; + oBCreversed[bc] = evs; + } else { + auto& evs = oBCreversed[bc]; + evs.push_back(collision.globalIndex()); + } + + // make a slice for this collision and get the number of tracks + auto thisCollTrackPos = tracksPos.sliceBy(preslice, collision.globalIndex()); + auto thisCollTrackNeg = tracksNeg.sliceBy(preslice, collision.globalIndex()); + collMultPos[collision.globalIndex()] = thisCollTrackPos.size(); + collMultNeg[collision.globalIndex()] = thisCollTrackNeg.size(); + } + + // loop over collisions and sum the multiplicity in the past and future + for (const auto& [collision, bc] : oBC) { + + int64_t pastShortBC = oBCreversed.lower_bound(bc - bcShortPast)->first; + int64_t futureShortBC = oBCreversed.lower_bound(bc + bcShortFuture)->first; + int64_t pastLongBC = oBCreversed.lower_bound(bc - bcLongPast)->first; + int64_t futureLongBC = oBCreversed.lower_bound(bc + bcLongFuture)->first; + + fOccup.oContribLongA[collision] = 0; + fOccup.oContribLongC[collision] = 0; + fOccup.oMeanTimeLongA[collision] = 0.0; + fOccup.oMeanTimeLongC[collision] = 0.0; + fOccup.oContribShortA[collision] = 0; + fOccup.oContribShortC[collision] = 0; + fOccup.oMeanTimeShortA[collision] = 0.0; + fOccup.oMeanTimeShortC[collision] = 0.0; + std::map oTimeMapShortA; + std::map oTimeMapShortC; + std::map oTimeMapLongA; + std::map oTimeMapLongC; + // loop over the BCs in the past and future wrt this one + for (auto bcIt = oBCreversed.find(pastLongBC); bcIt != oBCreversed.find(futureLongBC); ++bcIt) { + int64_t thisBC = bcIt->first; + auto colls = bcIt->second; + // delta time due to the different BCs + float dt = (thisBC - bc) * bcUS; + // check if this collision is also within the short time range + bool isShort = (thisBC >= pastShortBC && thisBC < futureShortBC); + // loop over all collisions in this BC + for (auto& thisColl : colls) { + // skip if this is the same collision + if (thisColl == collision) { + continue; + } + // compute the delta time due to the difference in longitudinal position + float dtDrift = (oVtxZ[thisColl] - oVtxZ[collision]) / vdrift; + + if (!(fConfigVariousOptions.fExcludeShort && isShort)) { + // sum the collision multiplicity on A and C sides + fOccup.oContribLongA[collision] += collMultPos[thisColl]; + fOccup.oContribLongC[collision] += collMultNeg[thisColl]; + // compute the multiplicity weighted average time + fOccup.oMeanTimeLongA[collision] += collMultPos[thisColl] * (dt + dtDrift); + fOccup.oMeanTimeLongC[collision] += collMultNeg[thisColl] * (dt - dtDrift); + // fill the time map + oTimeMapLongA[dt + dtDrift] = collMultPos[thisColl]; + oTimeMapLongC[dt - dtDrift] = collMultNeg[thisColl]; + } + + if (isShort) { + fOccup.oContribShortA[collision] += collMultPos[thisColl]; + fOccup.oContribShortC[collision] += collMultNeg[thisColl]; + fOccup.oMeanTimeShortA[collision] += collMultPos[thisColl] * (dt + dtDrift); + fOccup.oMeanTimeShortC[collision] += collMultNeg[thisColl] * (dt - dtDrift); + oTimeMapShortA[dt + dtDrift] = collMultPos[thisColl]; + oTimeMapShortC[dt - dtDrift] = collMultNeg[thisColl]; + } + } + } + // normalize to obtain the mean time + if (fOccup.oContribLongA[collision] > 0) { + fOccup.oMeanTimeLongA[collision] /= fOccup.oContribLongA[collision]; + } + if (fOccup.oContribLongC[collision] > 0) { + fOccup.oMeanTimeLongC[collision] /= fOccup.oContribLongC[collision]; + } + if (fOccup.oContribShortA[collision] > 0) { + fOccup.oMeanTimeShortA[collision] /= fOccup.oContribShortA[collision]; + } + if (fOccup.oContribShortC[collision] > 0) { + fOccup.oMeanTimeShortC[collision] /= fOccup.oContribShortC[collision]; + } + // iterate over the time maps to obtain the median time + fOccup.oMedianTimeLongA[collision] = 0.0; + float sumMult = 0.0; + if (oTimeMapLongA.size() > 0) { + for (auto& [dt, mult] : oTimeMapLongA) { + sumMult += mult; + if (sumMult > fOccup.oContribLongA[collision] / 2.0) { + fOccup.oMedianTimeLongA[collision] = dt; + break; + } + } + } + fOccup.oMedianTimeLongC[collision] = 0.0; + sumMult = 0.0; + if (oTimeMapLongC.size() > 0) { + for (auto& [dt, mult] : oTimeMapLongC) { + sumMult += mult; + if (sumMult > fOccup.oContribLongC[collision] / 2.0) { + fOccup.oMedianTimeLongC[collision] = dt; + break; + } + } + } + fOccup.oMedianTimeShortA[collision] = 0.0; + sumMult = 0.0; + if (oTimeMapShortA.size() > 0) { + for (auto& [dt, mult] : oTimeMapShortA) { + sumMult += mult; + if (sumMult > fOccup.oContribShortA[collision] / 2.0) { + fOccup.oMedianTimeShortA[collision] = dt; + break; + } + } + } + fOccup.oMedianTimeShortC[collision] = 0.0; + sumMult = 0.0; + if (oTimeMapShortC.size() > 0) { + for (auto& [dt, mult] : oTimeMapShortC) { + sumMult += mult; + if (sumMult > fOccup.oContribShortC[collision] / 2.0) { + fOccup.oMedianTimeShortC[collision] = dt; + break; + } + } + } + } // end loop over collisions } template @@ -445,7 +707,7 @@ struct TableMaker { TTrackAssoc const& trackAssocs, TTracks const& tracks) { // Skim collisions - // NOTE: So far, collisions are filtered based on the user specified analysis cuts and the filterPP event filter. + // NOTE: So far, collisions are filtered based on the user specified analysis cuts AND the filterPP or Zorro event filter. // The collision-track associations which point to an event that is not selected for writing are discarded! fCollIndexMap.clear(); @@ -466,10 +728,10 @@ struct TableMaker { for (int i = 0; i < o2::aod::evsel::kNsel; i++) { if (collision.selection_bit(i)) { - (reinterpret_cast(fStatsList->At(0)))->Fill(1.0, static_cast(i)); + (reinterpret_cast(fStatsList->At(kStatsEvent)))->Fill(1.0, static_cast(i)); } } - (reinterpret_cast(fStatsList->At(0)))->Fill(1.0, static_cast(o2::aod::evsel::kNsel)); + (reinterpret_cast(fStatsList->At(kStatsEvent)))->Fill(1.0, static_cast(o2::aod::evsel::kNsel)); // apply the event filter computed by filter-PP if constexpr ((TEventFillMap & VarManager::ObjTypes::EventFilter) > 0) { @@ -485,7 +747,7 @@ struct TableMaker { // if the BC found by event selection does not coincide with the collision.bc() auto bcEvSel = collision.template foundBC_as(); if (bcEvSel.globalIndex() != bc.globalIndex()) { - tag |= (uint64_t(1) << 0); + tag |= (static_cast(1) << 0); } // Put the 8 first bits of the event filter in the last 8 bits of the tag if constexpr ((TEventFillMap & VarManager::ObjTypes::EventFilter) > 0) { @@ -505,6 +767,21 @@ struct TableMaker { auto groupedTrackIndices = trackAssocs.sliceBy(trackIndicesPerCollision, collision.globalIndex()); VarManager::FillEventTrackEstimators(collision, groupedTrackIndices, tracks); } + // Exceptionally fill the TPC occupancy quantities here + if constexpr ((TEventFillMap & VarManager::ObjTypes::CollisionMultExtra) > 0) { + VarManager::fgValues[VarManager::kNTPCcontribLongA] = fOccup.oContribLongA[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCcontribLongC] = fOccup.oContribLongC[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCmeanTimeLongA] = fOccup.oMeanTimeLongA[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCmeanTimeLongC] = fOccup.oMeanTimeLongC[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCmedianTimeLongA] = fOccup.oMedianTimeLongA[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCmedianTimeLongC] = fOccup.oMedianTimeLongC[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCcontribShortA] = fOccup.oContribShortA[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCcontribShortC] = fOccup.oContribShortC[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCmeanTimeShortA] = fOccup.oMeanTimeShortA[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCmeanTimeShortC] = fOccup.oMeanTimeShortC[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCmedianTimeShortA] = fOccup.oMedianTimeShortA[collision.globalIndex()]; + VarManager::fgValues[VarManager::kNTPCmedianTimeShortC] = fOccup.oMedianTimeShortC[collision.globalIndex()]; + } if (fDoDetailedQA) { fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); } @@ -512,17 +789,22 @@ struct TableMaker { // fill stats information, before selections for (int i = 0; i < o2::aod::evsel::kNsel; i++) { if (collision.selection_bit(i)) { - (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(i)); + (reinterpret_cast(fStatsList->At(kStatsEvent)))->Fill(2.0, static_cast(i)); } } - (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(o2::aod::evsel::kNsel)); - - if (fConfigRunZorro) { - zorro.setBaseCCDBPath(fConfigCcdbPathZorro.value); - zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value); - if (zorro.isSelected(bc.globalBC())) { + (reinterpret_cast(fStatsList->At(kStatsEvent)))->Fill(2.0, static_cast(o2::aod::evsel::kNsel)); + + if (fConfigZorro.fConfigRunZorro) { + zorro.setBaseCCDBPath(fConfigCCDB.fConfigCcdbPathZorro.value); + zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorro.fConfigZorroTrigMask.value); + zorro.populateExternalHists(fCurrentRun, reinterpret_cast(fStatsList->At(kStatsZorroInfo)), reinterpret_cast(fStatsList->At(kStatsZorroSel))); + bool zorroSel = zorro.isSelected(bc.globalBC(), 100UL, reinterpret_cast(fStatsList->At(kStatsZorroSel))); + if (zorroSel) { tag |= (static_cast(true) << 56); // the same bit is used for this zorro selections from ccdb } + if (fConfigZorro.fConfigRunZorroSel && (!zorroSel || !fEventCut->IsSelected(VarManager::fgValues))) { + continue; + } } else { if (!fEventCut->IsSelected(VarManager::fgValues)) { continue; @@ -532,10 +814,10 @@ struct TableMaker { // fill stats information, after selections for (int i = 0; i < o2::aod::evsel::kNsel; i++) { if (collision.selection_bit(i)) { - (reinterpret_cast(fStatsList->At(0)))->Fill(3.0, static_cast(i)); + (reinterpret_cast(fStatsList->At(kStatsEvent)))->Fill(3.0, static_cast(i)); } } - (reinterpret_cast(fStatsList->At(0)))->Fill(3.0, static_cast(o2::aod::evsel::kNsel)); + (reinterpret_cast(fStatsList->At(kStatsEvent)))->Fill(3.0, static_cast(o2::aod::evsel::kNsel)); fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); @@ -575,8 +857,12 @@ struct TableMaker { collision.multNTracksITSOnly(), collision.multNTracksTPCOnly(), collision.multNTracksITSTPC(), collision.trackOccupancyInTimeRange()); multAll(collision.multAllTracksTPCOnly(), collision.multAllTracksITSTPC(), - VarManager::fgValues[VarManager::kNTPCpileupContribA], VarManager::fgValues[VarManager::kNTPCpileupContribC], - VarManager::fgValues[VarManager::kNTPCpileupZA], VarManager::fgValues[VarManager::kNTPCpileupZC], 0, 0); + fOccup.oContribLongA[collision.globalIndex()], fOccup.oContribLongC[collision.globalIndex()], + fOccup.oMeanTimeLongA[collision.globalIndex()], fOccup.oMeanTimeLongC[collision.globalIndex()], + fOccup.oMedianTimeLongA[collision.globalIndex()], fOccup.oMedianTimeLongC[collision.globalIndex()], + fOccup.oContribShortA[collision.globalIndex()], fOccup.oContribShortC[collision.globalIndex()], + fOccup.oMeanTimeShortA[collision.globalIndex()], fOccup.oMeanTimeShortC[collision.globalIndex()], + fOccup.oMedianTimeShortA[collision.globalIndex()], fOccup.oMedianTimeShortC[collision.globalIndex()]); } fCollIndexMap[collision.globalIndex()] = event.lastIndex(); @@ -591,23 +877,31 @@ struct TableMaker { // One can apply here cuts which depend on the association (e.g. DCA), which will discard (hopefully most) wrong associations. // Tracks are written only once, even if they constribute to more than one association - uint64_t trackFilteringTag = uint64_t(0); - uint64_t trackTempFilterMap = uint8_t(0); + uint64_t trackFilteringTag = static_cast(0); + uint32_t trackTempFilterMap = static_cast(0); // material correction for track propagation + // TODO: Do we need a configurable to switch between different material correction options? // o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; for (const auto& assoc : assocs) { - // get track + // get the track auto track = assoc.template track_as(); - trackFilteringTag = uint64_t(0); - trackTempFilterMap = uint8_t(0); + // If the original collision of this track was not selected for skimming, then we skip this track. + // Normally, the filter-pp is selecting all collisions which contain the tracks which contributed to the triggering + // of an event, so this is rejecting possibly a few tracks unrelated to the trigger, originally associated with collisions distant in time. + if (fCollIndexMap.find(track.collisionId()) == fCollIndexMap.end()) { + continue; + } + + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); VarManager::FillTrack(track); // compute quantities which depend on the associated collision, such as DCA - if (fPropTrack && (track.collisionId() != collision.globalIndex())) { + if (fConfigVariousOptions.fPropTrack && (track.collisionId() != collision.globalIndex())) { VarManager::FillTrackCollisionMatCorr(track, collision, noMatCorr, o2::base::Propagator::Instance()); } @@ -619,97 +913,121 @@ struct TableMaker { int i = 0; for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, i++) { if ((*cut).IsSelected(VarManager::fgValues)) { - trackTempFilterMap |= (uint8_t(1) << i); - // NOTE: the QA is filled here for every (collision,track) association since the results of the track cuts can be different depending on which collision is associated (e.g. DCA cuts) - // TODO: create a statistics histograms with unique tracks - if (fConfigQA) { + trackTempFilterMap |= (static_cast(1) << i); + // NOTE: the QA is filled here just for the first occurence of this track. + // So if there are histograms of quantities which depend on the collision association, these will not be accurate + if (fConfigHistOutput.fConfigQA && (fTrackIndexMap.find(track.globalIndex()) == fTrackIndexMap.end())) { fHistMan->FillHistClass(Form("TrackBarrel_%s", (*cut).GetName()), VarManager::fgValues); } - (reinterpret_cast(fStatsList->At(1)))->Fill(static_cast(i)); + (reinterpret_cast(fStatsList->At(kStatsTracks)))->Fill(static_cast(i)); } } if (!trackTempFilterMap) { continue; } + // If this track is already present in the index map, it means it was already skimmed, + // so we just store the association and we skip the track + if (fTrackIndexMap.find(track.globalIndex()) != fTrackIndexMap.end()) { + trackBarrelAssoc(fCollIndexMap[collision.globalIndex()], fTrackIndexMap[track.globalIndex()]); + continue; + } + // store selection information in the track tag if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackV0Bits)) { // BIT0-4: V0Bits - trackFilteringTag |= uint64_t(track.pidbit()); + trackFilteringTag |= static_cast(track.pidbit()); for (int iv0 = 0; iv0 < 5; iv0++) { if (track.pidbit() & (uint8_t(1) << iv0)) { - (reinterpret_cast(fStatsList->At(1)))->Fill(fTrackCuts.size() + static_cast(iv0)); + (reinterpret_cast(fStatsList->At(kStatsTracks)))->Fill(fTrackCuts.size() + static_cast(iv0)); } } - if (fConfigIsOnlyforMaps) { - if (trackFilteringTag & (uint64_t(1) << VarManager::kIsConversionLeg)) { // for electron + if (fConfigPostCalibTPC.fConfigIsOnlyforMaps) { + if (trackFilteringTag & (static_cast(1) << VarManager::kIsConversionLeg)) { // for electron fHistMan->FillHistClass("TrackBarrel_PostCalibElectron", VarManager::fgValues); } - if (trackFilteringTag & (uint64_t(1) << VarManager::kIsK0sLeg)) { // for pion + if (trackFilteringTag & (static_cast(1) << VarManager::kIsK0sLeg)) { // for pion fHistMan->FillHistClass("TrackBarrel_PostCalibPion", VarManager::fgValues); } - if ((static_cast(trackFilteringTag & (uint64_t(1) << VarManager::kIsLambdaLeg)) * (track.sign()) > 0)) { // for proton from Lambda + if ((static_cast(trackFilteringTag & (static_cast(1) << VarManager::kIsLambdaLeg)) * (track.sign()) > 0)) { // for proton from Lambda fHistMan->FillHistClass("TrackBarrel_PostCalibProton", VarManager::fgValues); } - if ((static_cast(trackFilteringTag & (uint64_t(1) << VarManager::kIsALambdaLeg)) * (track.sign()) < 0)) { // for proton from AntiLambda + if ((static_cast(trackFilteringTag & (static_cast(1) << VarManager::kIsALambdaLeg)) * (track.sign()) < 0)) { // for proton from AntiLambda fHistMan->FillHistClass("TrackBarrel_PostCalibProton", VarManager::fgValues); } } - if (fConfigSaveElectronSample) { // only save electron sample - if (!(trackFilteringTag & (uint64_t(1) << VarManager::kIsConversionLeg))) { + if (fConfigPostCalibTPC.fConfigSaveElectronSample) { // only save electron sample + if (!(trackFilteringTag & (static_cast(1) << VarManager::kIsConversionLeg))) { continue; } } } // end if V0Bits if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::DalitzBits)) { - trackFilteringTag |= (uint64_t(track.dalitzBits()) << VarManager::kDalitzBits); // BIT5-12: Dalitz + trackFilteringTag |= (static_cast(track.dalitzBits()) << VarManager::kDalitzBits); // BIT5-12: Dalitz } - trackFilteringTag |= (uint64_t(trackTempFilterMap) << VarManager::kBarrelUserCutsBits); // BIT13-...: user track filters + trackFilteringTag |= (static_cast(trackTempFilterMap) << VarManager::kBarrelUserCutsBits); // BIT13-...: user track filters if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackPID)) { - if (fConfigComputeTPCpostCalib) { - trackFilteringTag |= (uint64_t(1) << VarManager::kIsTPCPostcalibrated); + if (fConfigPostCalibTPC.fConfigComputeTPCpostCalib) { + trackFilteringTag |= (static_cast(1) << VarManager::kIsTPCPostcalibrated); } } - // write the track global index in the map for skimming (to make sure we have it just once) - if (fTrackIndexMap.find(track.globalIndex()) == fTrackIndexMap.end()) { - // NOTE: The collision ID that is written in the table is the one found in the first association for this track. - // However, in data analysis one should loop over associations, so this one should not be used. - // In the case of Run2-like analysis, there will be no associations, so this ID will be the one originally assigned in the AO2Ds (updated for the skims) - uint32_t reducedEventIdx = fCollIndexMap[collision.globalIndex()]; - // NOTE: trackBarrelInfo stores the index of the collision as in AO2D (for use in some cases where the analysis on skims is done - // in workflows where the original AO2Ds are also present) - trackBarrelInfo(collision.globalIndex(), collision.posX(), collision.posY(), collision.posZ(), track.globalIndex()); - trackBasic(reducedEventIdx, trackFilteringTag, track.pt(), track.eta(), track.phi(), track.sign(), 0); - trackBarrel(track.x(), track.alpha(), track.y(), track.z(), track.snp(), track.tgl(), track.signed1Pt(), - track.tpcInnerParam(), track.flags(), track.itsClusterMap(), track.itsChi2NCl(), - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), - track.tpcNClsShared(), track.tpcChi2NCl(), - track.trdChi2(), track.trdPattern(), track.tofChi2(), - track.length(), track.dcaXY(), track.dcaZ(), - track.trackTime(), track.trackTimeRes(), track.tofExpMom(), - track.detectorMap()); - if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackCov)) { - trackBarrelCov(track.cYY(), track.cZY(), track.cZZ(), track.cSnpY(), track.cSnpZ(), - track.cSnpSnp(), track.cTglY(), track.cTglZ(), track.cTglSnp(), track.cTglTgl(), - track.c1PtY(), track.c1PtZ(), track.c1PtSnp(), track.c1PtTgl(), track.c1Pt21Pt2()); - } - if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackPID)) { - float nSigmaEl = (fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaEl_Corr] : track.tpcNSigmaEl()); - float nSigmaPi = (fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaPi_Corr] : track.tpcNSigmaPi()); - float nSigmaKa = ((fConfigComputeTPCpostCalib && fConfigComputeTPCpostCalibKaon) ? VarManager::fgValues[VarManager::kTPCnSigmaKa_Corr] : track.tpcNSigmaKa()); - float nSigmaPr = (fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaPr_Corr] : track.tpcNSigmaPr()); - trackBarrelPID(track.tpcSignal(), - nSigmaEl, track.tpcNSigmaMu(), nSigmaPi, nSigmaKa, nSigmaPr, - track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.trdSignal()); - } - fTrackIndexMap[track.globalIndex()] = trackBasic.lastIndex(); + // Calculating the percentage of orphan tracks i.e., tracks which have no collisions associated to it + if (!track.has_collision()) { + (reinterpret_cast(fStatsList->At(kStatsOrphanTracks)))->Fill(static_cast(-1)); + } else { + (reinterpret_cast(fStatsList->At(kStatsOrphanTracks)))->Fill(0.9); + } + + // NOTE: The collision ID written in the table is the one of the original collision assigned in the AO2D. + // The reason is that the time associated to the track is wrt that collision. + // If new associations are done with the skimmed data, the track time wrt new collision can then be recomputed based on the + // relative difference in time between the original and the new collision. + uint32_t reducedEventIdx = fCollIndexMap[track.collisionId()]; // This gives the original iD of the track + + // NOTE: trackBarrelInfo stores the index of the collision as in AO2D (for use in some cases where the analysis on skims is done + // in workflows where the original AO2Ds are also present) + trackBarrelInfo(collision.globalIndex(), collision.posX(), collision.posY(), collision.posZ(), track.globalIndex()); + trackBasic(reducedEventIdx, trackFilteringTag, track.pt(), track.eta(), track.phi(), track.sign(), 0); + trackBarrel(track.x(), track.alpha(), track.y(), track.z(), track.snp(), track.tgl(), track.signed1Pt(), + track.tpcInnerParam(), track.flags(), track.itsClusterMap(), track.itsChi2NCl(), + track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsShared(), track.tpcChi2NCl(), + track.trdChi2(), track.trdPattern(), track.tofChi2(), + track.length(), track.dcaXY(), track.dcaZ(), + track.trackTime(), track.trackTimeRes(), track.tofExpMom(), + track.detectorMap()); + if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackCov)) { + trackBarrelCov(track.cYY(), track.cZY(), track.cZZ(), track.cSnpY(), track.cSnpZ(), + track.cSnpSnp(), track.cTglY(), track.cTglZ(), track.cTglSnp(), track.cTglTgl(), + track.c1PtY(), track.c1PtZ(), track.c1PtSnp(), track.c1PtTgl(), track.c1Pt21Pt2()); + } + if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackPID)) { + float nSigmaEl = (fConfigPostCalibTPC.fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaEl_Corr] : track.tpcNSigmaEl()); + float nSigmaPi = (fConfigPostCalibTPC.fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaPi_Corr] : track.tpcNSigmaPi()); + float nSigmaKa = ((fConfigPostCalibTPC.fConfigComputeTPCpostCalib && fConfigPostCalibTPC.fConfigComputeTPCpostCalibKaon) ? VarManager::fgValues[VarManager::kTPCnSigmaKa_Corr] : track.tpcNSigmaKa()); + float nSigmaPr = (fConfigPostCalibTPC.fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaPr_Corr] : track.tpcNSigmaPr()); + trackBarrelPID(track.tpcSignal(), + nSigmaEl, track.tpcNSigmaMu(), nSigmaPi, nSigmaKa, nSigmaPr, + track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), + track.trdSignal()); + } else if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackTPCPID)) { + float nSigmaEl = (fConfigPostCalibTPC.fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaEl_Corr] : track.tpcNSigmaEl()); + float nSigmaPi = (fConfigPostCalibTPC.fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaPi_Corr] : track.tpcNSigmaPi()); + float nSigmaKa = ((fConfigPostCalibTPC.fConfigComputeTPCpostCalib && fConfigPostCalibTPC.fConfigComputeTPCpostCalibKaon) ? VarManager::fgValues[VarManager::kTPCnSigmaKa_Corr] : track.tpcNSigmaKa()); + float nSigmaPr = (fConfigPostCalibTPC.fConfigComputeTPCpostCalib ? VarManager::fgValues[VarManager::kTPCnSigmaPr_Corr] : track.tpcNSigmaPr()); + trackBarrelPID(track.tpcSignal(), + nSigmaEl, -999.0, nSigmaPi, nSigmaKa, nSigmaPr, + -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, + -999.0); } + + fTrackIndexMap[track.globalIndex()] = trackBasic.lastIndex(); + // write the skimmed collision - track association trackBarrelAssoc(fCollIndexMap[collision.globalIndex()], fTrackIndexMap[track.globalIndex()]); } // end loop over associations - } // end skimTracks + } // end skimTracks template void skimMFT(TEvent const& collision, TBCs const& /*bcs*/, MFTTracks const& /*mfts*/, MFTTrackAssoc const& mftAssocs) @@ -720,7 +1038,7 @@ struct TableMaker { for (const auto& assoc : mftAssocs) { auto track = assoc.template mfttrack_as(); - if (fConfigQA) { + if (fConfigHistOutput.fConfigQA) { VarManager::FillTrack(track); fHistMan->FillHistClass("MftTracks", VarManager::fgValues); } @@ -728,7 +1046,7 @@ struct TableMaker { // write the MFT track global index in the map for skimming (to make sure we have it just once) if (fMftIndexMap.find(track.globalIndex()) == fMftIndexMap.end()) { uint32_t reducedEventIdx = fCollIndexMap[collision.globalIndex()]; - mftTrack(reducedEventIdx, uint64_t(0), track.pt(), track.eta(), track.phi()); + mftTrack(reducedEventIdx, static_cast(0), track.pt(), track.eta(), track.phi()); // TODO: We are not writing the DCA at the moment, because this depend on the collision association mftTrackExtra(track.mftClusterSizesAndTrackFlags(), track.sign(), 0.0, 0.0, track.nClusters()); @@ -746,8 +1064,10 @@ struct TableMaker { // Muons are written only once, even if they constribute to more than one association, // which means that in the case of multiple associations, the track parameters are wrong and should be computed again at analysis time. - uint8_t trackFilteringTag = uint8_t(0); - uint8_t trackTempFilterMap = uint8_t(0); + // TODO: Currently, the TMFTFillMap is not used in this function. Is it needed ? + + uint8_t trackFilteringTag = static_cast(0); + uint8_t trackTempFilterMap = static_cast(0); fFwdTrackIndexMapReversed.clear(); uint32_t offset = muonBasic.lastIndex(); @@ -756,22 +1076,25 @@ struct TableMaker { // get the muon auto muon = assoc.template fwdtrack_as(); - trackFilteringTag = uint8_t(0); - trackTempFilterMap = uint8_t(0); + trackFilteringTag = static_cast(0); + trackTempFilterMap = static_cast(0); VarManager::FillTrack(muon); - // NOTE: If a muon is associated to multiple collisions, depending on the selections, + // NOTE: Muons are propagated to the current associated collisions. + // So if a muon is associated to multiple collisions, depending on the selections, // it may be accepted for some associations and rejected for other - if (fPropMuon) { + if (fConfigVariousOptions.fPropMuon) { VarManager::FillPropagateMuon(muon, collision); } - // recalculte pDca and global muon kinematics - if (static_cast(muon.trackType()) < 2 && fRefitGlobalMuon) { + // recalculate pDca and global muon kinematics + if (static_cast(muon.trackType()) < 2 && fConfigVariousOptions.fRefitGlobalMuon) { auto muontrack = muon.template matchMCHTrack_as(); - if (muontrack.eta() < fMuonMatchEtaMin || muontrack.eta() > fMuonMatchEtaMax) { + if (muontrack.eta() < fConfigVariousOptions.fMuonMatchEtaMin || muontrack.eta() > fConfigVariousOptions.fMuonMatchEtaMax) { continue; } - auto mfttrack = muon.template matchMFTTrack_as(); VarManager::FillTrackCollision(muontrack, collision); + // NOTE: the MFT track originally associated to the MUON track is currently used in the global muon refit + // Should MUON - MFT time ambiguities be taken into account ? + auto mfttrack = muon.template matchMFTTrack_as(); VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); } else { VarManager::FillTrackCollision(muon, collision); @@ -784,11 +1107,14 @@ struct TableMaker { int i = 0; for (auto cut = fMuonCuts.begin(); cut != fMuonCuts.end(); cut++, i++) { if ((*cut).IsSelected(VarManager::fgValues)) { - trackTempFilterMap |= (uint8_t(1) << i); - if (fConfigQA) { + trackTempFilterMap |= (static_cast(1) << i); + // NOTE: the QA is filled here just for the first occurence of this muon, which means the current association + // will be skipped from histograms if this muon was already filled in the skimming map. + // So if there are histograms of quantities which depend on the collision association, these histograms will not be completely accurate + if (fConfigHistOutput.fConfigQA && (fFwdTrackIndexMap.find(muon.globalIndex()) == fFwdTrackIndexMap.end())) { fHistMan->FillHistClass(Form("Muons_%s", (*cut).GetName()), VarManager::fgValues); } - (reinterpret_cast(fStatsList->At(2)))->Fill(static_cast(i)); + (reinterpret_cast(fStatsList->At(kStatsMuons)))->Fill(static_cast(i)); } } @@ -823,13 +1149,13 @@ struct TableMaker { // get the muon auto muon = muons.rawIteratorAt(origIdx); uint32_t reducedEventIdx = fCollIndexMap[collision.globalIndex()]; - // NOTE: Currently, one writes the original AO2D momentum-vector (pt, eta and phi) in the tables because we write only one instance of the muon track, - // while multiple collision associations (and multiple mom vectors can exist) + // NOTE: Currently, one writes in the tables the momentum-vector (pt, eta and phi) of the first collision association for this muon, + // while multiple collision associations (and multiple mom vectors can exist). // The momentum can be recomputed at the analysis time based on the associations written in the skims // So all the information which pertains to collision association or MFT associations should not be taken from the skimmed data, but recomputed at analysis time. uint32_t mchIdx = -1; uint32_t mftIdx = -1; - if (muon.trackType() == uint8_t(0) || muon.trackType() == uint8_t(2)) { // MCH-MID (2) or global (0) + if (muon.trackType() == static_cast(0) || muon.trackType() == static_cast(2)) { // MCH-MID (2) or global (0) if (fFwdTrackIndexMap.find(muon.matchMCHTrackId()) != fFwdTrackIndexMap.end()) { mchIdx = fFwdTrackIndexMap[muon.matchMCHTrackId()]; } @@ -838,11 +1164,11 @@ struct TableMaker { } } VarManager::FillTrack(muon); - if (fPropMuon) { + if (fConfigVariousOptions.fPropMuon) { VarManager::FillPropagateMuon(muon, collision); } // recalculte pDca and global muon kinematics - if (static_cast(muon.trackType()) < 2 && fRefitGlobalMuon) { + if (static_cast(muon.trackType()) < 2 && fConfigVariousOptions.fRefitGlobalMuon) { auto muontrack = muon.template matchMCHTrack_as(); auto mfttrack = muon.template matchMFTTrack_as(); VarManager::FillTrackCollision(muontrack, collision); @@ -865,7 +1191,7 @@ struct TableMaker { VarManager::fgValues[VarManager::kMuonC1Pt2Phi], VarManager::fgValues[VarManager::kMuonC1Pt2Tgl], VarManager::fgValues[VarManager::kMuonC1Pt21Pt2]); } } // end loop over selected muons - } // end skimMuons + } // end skimMuons // Produce standard barrel + muon tables with event filter (typically for pp and p-Pb) ------------------------------------------------------ template 0 && fCurrentRun != bcs.begin().runNumber()) { - if (fConfigComputeTPCpostCalib) { - auto calibList = fCCDB->getForTimeStamp(fConfigCcdbPathTPC.value, bcs.begin().timestamp()); + if (fConfigPostCalibTPC.fConfigComputeTPCpostCalib) { + auto calibList = fCCDB->getForTimeStamp(fConfigCCDB.fConfigCcdbPathTPC.value, bcs.begin().timestamp()); VarManager::SetCalibrationObject(VarManager::kTPCElectronMean, calibList->FindObject("mean_map_electron")); VarManager::SetCalibrationObject(VarManager::kTPCElectronSigma, calibList->FindObject("sigma_map_electron")); VarManager::SetCalibrationObject(VarManager::kTPCPionMean, calibList->FindObject("mean_map_pion")); VarManager::SetCalibrationObject(VarManager::kTPCPionSigma, calibList->FindObject("sigma_map_pion")); VarManager::SetCalibrationObject(VarManager::kTPCProtonMean, calibList->FindObject("mean_map_proton")); VarManager::SetCalibrationObject(VarManager::kTPCProtonSigma, calibList->FindObject("sigma_map_proton")); - if (fConfigComputeTPCpostCalibKaon) { + if (fConfigPostCalibTPC.fConfigComputeTPCpostCalibKaon) { VarManager::SetCalibrationObject(VarManager::kTPCKaonMean, calibList->FindObject("mean_map_kaon")); VarManager::SetCalibrationObject(VarManager::kTPCKaonSigma, calibList->FindObject("sigma_map_kaon")); } } if (fIsRun2 == true) { - grpmagrun2 = ccdb->getForTimeStamp(grpmagPathRun2, bcs.begin().timestamp()); - if (grpmagrun2 != nullptr) { - o2::base::Propagator::initFieldFromGRP(grpmagrun2); + fGrpMagRun2 = fCCDB->getForTimeStamp(fConfigCCDB.fConfigGrpMagPathRun2, bcs.begin().timestamp()); + if (fGrpMagRun2 != nullptr) { + o2::base::Propagator::initFieldFromGRP(fGrpMagRun2); } } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, bcs.begin().timestamp()); - if (grpmag != nullptr) { - o2::base::Propagator::initFieldFromGRP(grpmag); + fGrpMag = fCCDB->getForTimeStamp(fConfigCCDB.fConfigGrpMagPath, bcs.begin().timestamp()); + if (fGrpMag != nullptr) { + o2::base::Propagator::initFieldFromGRP(fGrpMag); } } std::map metadataRCT, header; @@ -908,7 +1234,7 @@ struct TableMaker { VarManager::SetSORandEOR(sor, eor); fCurrentRun = bcs.begin().runNumber(); - } + } // end updating the CCDB quantities at change of run // skim collisions event.reserve(collisions.size()); @@ -947,18 +1273,20 @@ struct TableMaker { muonAssoc.reserve(muons.size()); } - // loop over selected collisions and select the tracks and fwd tracks to be skimmed + // loop over selected collisions, group the compatible associations, and run the skimming for (auto const& [origIdx, skimIdx] : fCollIndexMap) { auto collision = collisions.rawIteratorAt(origIdx); - // group the tracks and muons for this collision + // group the barrel track associations for this collision if constexpr (static_cast(TTrackFillMap)) { auto groupedTrackIndices = trackAssocs.sliceBy(trackIndicesPerCollision, origIdx); skimTracks(collision, bcs, tracksBarrel, groupedTrackIndices); } + // group the MFT associations for this collision if constexpr (static_cast(TMFTFillMap)) { auto groupedMFTIndices = mftAssocs.sliceBy(mfttrackIndicesPerCollision, origIdx); skimMFT(collision, bcs, mftTracks, groupedMFTIndices); } + // group the muon associations for this collision if constexpr (static_cast(TMuonFillMap)) { if constexpr (static_cast(TMFTFillMap)) { auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx); @@ -969,6 +1297,10 @@ struct TableMaker { } } } // end loop over skimmed collisions + + LOG(info) << "Skims in this TF: " << fCollIndexMap.size() << " collisions; " << trackBasic.lastIndex() << " barrel tracks; " + << muonBasic.lastIndex() << " muon tracks; " << mftTrack.lastIndex() << " MFT tracks; "; + LOG(info) << " " << trackBarrelAssoc.lastIndex() << " barrel assocs; " << muonAssoc.lastIndex() << " muon assocs; " << mftAssoc.lastIndex() << " MFT assoc"; } // produce the full DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), subscribe to the DQ event filter (filter-pp or filter-PbPb) @@ -986,10 +1318,6 @@ struct TableMaker { MyBarrelTracksWithCov const& tracksBarrel, TrackAssoc const& trackAssocs) { - /*const int& a = 0; - MFTTracks const& mftTracks = 0; - FwdTrackAssoc const& fwdTrackAssocs = 0; - MFTTrackAssoc const& mftAssocs = 0;*/ fullSkimming(collisions, bcs, zdcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); } @@ -1018,7 +1346,7 @@ struct TableMaker { // produce the muon-only DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), meant to run on skimmed data void processPPMuonOnly(MyEventsWithMults const& collisions, BCsWithTimestamps const& bcs, - MyMuonsWithCov const& muons, FwdTrackAssoc const& fwdTrackAssocs, MFTTracks const& mftTracks) + MyMuonsWithCov const& muons, FwdTrackAssoc const& fwdTrackAssocs) { fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr); } @@ -1054,9 +1382,19 @@ struct TableMaker { MyBarrelTracksWithV0Bits const& tracksBarrel, TrackAssoc const& trackAssocs) { + computeOccupancyEstimators(collisions, tracksPos, tracksNeg, preslice, bcs); fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); } + // produce the barrel only DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter + void processPbPbBarrelOnlyWithV0BitsNoTOF(MyEventsWithCentAndMults const& collisions, BCsWithTimestamps const& bcs, + MyBarrelTracksWithV0BitsNoTOF const& tracksBarrel, + TrackAssoc const& trackAssocs) + { + computeOccupancyEstimators(collisions, tracksPosNoTOF, tracksNegNoTOF, presliceNoTOF, bcs); + fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + } + // produce the muon only DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter void processPbPbMuonOnly(MyEventsWithCentAndMults const& collisions, BCsWithTimestamps const& bcs, MyMuonsWithCov const& muons, FwdTrackAssoc const& fwdTrackAssocs) @@ -1077,10 +1415,10 @@ struct TableMaker { { for (int i = 0; i < o2::aod::evsel::kNsel; i++) { if (bc.selection_bit(i) > 0) { - (reinterpret_cast(fStatsList->At(0)))->Fill(0.0, static_cast(i)); + (reinterpret_cast(fStatsList->At(kStatsEvent)))->Fill(0.0, static_cast(i)); } } - (reinterpret_cast(fStatsList->At(0)))->Fill(0.0, static_cast(o2::aod::evsel::kNsel)); + (reinterpret_cast(fStatsList->At(kStatsEvent)))->Fill(0.0, static_cast(o2::aod::evsel::kNsel)); } PROCESS_SWITCH(TableMaker, processPPWithFilter, "Build full DQ skimmed data model typically for pp/p-Pb and UPC Pb-Pb, w/ event filtering", false); @@ -1093,6 +1431,7 @@ struct TableMaker { PROCESS_SWITCH(TableMaker, processPbPb, "Build full DQ skimmed data model typically for Pb-Pb, w/o event filtering", false); PROCESS_SWITCH(TableMaker, processPbPbBarrelOnly, "Build barrel only DQ skimmed data model typically for Pb-Pb, w/o event filtering", false); PROCESS_SWITCH(TableMaker, processPbPbBarrelOnlyWithV0Bits, "Build barrel only DQ skimmed data model typically for Pb-Pb, w/ V0 bits, w/o event filtering", false); + PROCESS_SWITCH(TableMaker, processPbPbBarrelOnlyWithV0BitsNoTOF, "Build barrel only DQ skimmed data model typically for Pb-Pb, w/ V0 bits, no TOF, w/o event filtering", false); PROCESS_SWITCH(TableMaker, processPbPbMuonOnly, "Build muon only DQ skimmed data model typically for Pb-Pb, w/o event filtering", false); PROCESS_SWITCH(TableMaker, processPbPbMuonMFT, "Build muon + mft DQ skimmed data model typically for Pb-Pb, w/o event filtering", false); PROCESS_SWITCH(TableMaker, processOnlyBCs, "Analyze the BCs to store sampled lumi", false); diff --git a/PWGDQ/Tasks/CMakeLists.txt b/PWGDQ/Tasks/CMakeLists.txt index 8807aad7200..f64f67ee394 100644 --- a/PWGDQ/Tasks/CMakeLists.txt +++ b/PWGDQ/Tasks/CMakeLists.txt @@ -107,4 +107,9 @@ o2physics_add_dpl_workflow(task-muon-mid-eff o2physics_add_dpl_workflow(task-fwd-track-pid SOURCES taskFwdTrackPid.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(quarkonia-to-hyperons + SOURCES quarkoniaToHyperons.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGDQ/Tasks/MIDefficiency.cxx b/PWGDQ/Tasks/MIDefficiency.cxx index d4069750421..13377e5cc5c 100644 --- a/PWGDQ/Tasks/MIDefficiency.cxx +++ b/PWGDQ/Tasks/MIDefficiency.cxx @@ -260,7 +260,7 @@ struct midEfficiency { if (isPbPb) histos.fill(HIST("hSparseCentFiredBothperRPC"), deId, cent, pt, eta, phi); else - histos.fill(HIST("hSparseCentFiredNBPperRPC"), deId, pt, eta, phi); + histos.fill(HIST("hSparseCentFiredBothperRPC"), deId, pt, eta, phi); } if (effFlag < 3) { diff --git a/PWGDQ/Tasks/dqCorrelation.cxx b/PWGDQ/Tasks/dqCorrelation.cxx index 353a7fbf575..d2fa3a0dd4b 100644 --- a/PWGDQ/Tasks/dqCorrelation.cxx +++ b/PWGDQ/Tasks/dqCorrelation.cxx @@ -116,7 +116,7 @@ struct DqCumulantFlow { ConfigurableAxis axisEta{"axisEta", {40, -6.0, 1.5}, "eta axis for histograms"}; ConfigurableAxis axisPt{"axisPt", {100, 0, 20}, "pt axis for histograms"}; ConfigurableAxis axisMass{"axisMass", {40, 2, 4}, "mass axis for histograms"}; - Configurable fConfigNPow{"cfgNPow", 0, "Power of weights for Q vector"}; + Configurable fConfigNPow{"cfgNPow", 0, "Power of weights for Q vector"}; // Configurables for the reference flow Configurable fConfigTrackCuts{"cfgLeptonCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; Configurable fConfigCutPtMin{"cfgCutPtMin", 1.0f, "Minimal pT for tracks"}; diff --git a/PWGDQ/Tasks/dqEfficiency.cxx b/PWGDQ/Tasks/dqEfficiency.cxx index ee8cd2af5c1..f8f2a992d61 100644 --- a/PWGDQ/Tasks/dqEfficiency.cxx +++ b/PWGDQ/Tasks/dqEfficiency.cxx @@ -19,6 +19,9 @@ #include #include #include +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -264,7 +267,7 @@ struct AnalysisTrackSelection { int i = 0; for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, i++) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << i); + filterMap |= (static_cast(1) << i); if (fConfigQA) { fHistMan->FillHistClass(fHistNamesReco[i].Data(), VarManager::fgValues); } @@ -285,19 +288,19 @@ struct AnalysisTrackSelection { for (auto sig = fMCSignals.begin(); sig != fMCSignals.end(); sig++, isig++) { if constexpr ((TTrackFillMap & VarManager::ObjTypes::ReducedTrack) > 0) { if ((*sig).CheckSignal(false, track.reducedMCTrack())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } if constexpr ((TTrackFillMap & VarManager::ObjTypes::Track) > 0) { if ((*sig).CheckSignal(false, track.template mcParticle_as())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } // fill histograms for (unsigned int i = 0; i < fMCSignals.size(); i++) { - if (!(mcDecision & (uint32_t(1) << i))) { + if (!(mcDecision & (static_cast(1) << i))) { continue; } for (unsigned int j = 0; j < fTrackCuts.size(); j++) { @@ -313,11 +316,16 @@ struct AnalysisTrackSelection { { runSelection(event, tracks, eventsMC, tracksMC); } + void processSkimmedWithCov(MyEventsSelected::iterator const& event, MyBarrelTracksWithCov const& tracks, ReducedMCEvents const& eventsMC, ReducedMCTracks const& tracksMC) + { + runSelection(event, tracks, eventsMC, tracksMC); + } void processDummy(MyEvents&) { // do nothing } + PROCESS_SWITCH(AnalysisTrackSelection, processSkimmedWithCov, "Run barrel track selection on DQ skimmed tracks with covariance", false); PROCESS_SWITCH(AnalysisTrackSelection, processSkimmed, "Run barrel track selection on DQ skimmed tracks", false); PROCESS_SWITCH(AnalysisTrackSelection, processDummy, "Dummy process function", false); }; @@ -429,7 +437,7 @@ struct AnalysisMuonSelection { int i = 0; for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, i++) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << i); + filterMap |= (static_cast(1) << i); if (fConfigQA) { fHistMan->FillHistClass(fHistNamesReco[i].Data(), VarManager::fgValues); } @@ -453,19 +461,19 @@ struct AnalysisMuonSelection { for (auto sig = fMCSignals.begin(); sig != fMCSignals.end(); sig++, isig++) { if constexpr ((TMuonFillMap & VarManager::ObjTypes::ReducedMuon) > 0) { if ((*sig).CheckSignal(false, muon.reducedMCTrack())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } if constexpr ((TMuonFillMap & VarManager::ObjTypes::Muon) > 0) { if ((*sig).CheckSignal(false, muon.template mcParticle_as())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } // fill histograms for (unsigned int i = 0; i < fMCSignals.size(); i++) { - if (!(mcDecision & (uint32_t(1) << i))) { + if (!(mcDecision & (static_cast(1) << i))) { continue; } for (unsigned int j = 0; j < fTrackCuts.size(); j++) { @@ -767,13 +775,13 @@ struct AnalysisSameEventPairing { for (auto& [t1, t2] : combinations(tracks1, tracks2)) { if constexpr (TPairType == VarManager::kDecayToEE) { - twoTrackFilter = uint32_t(t1.isBarrelSelected()) & uint32_t(t2.isBarrelSelected()); + twoTrackFilter = static_cast(t1.isBarrelSelected()) & static_cast(t2.isBarrelSelected()); } if constexpr (TPairType == VarManager::kDecayToMuMu) { - twoTrackFilter = uint32_t(t1.isMuonSelected()) & uint32_t(t2.isMuonSelected()); + twoTrackFilter = static_cast(t1.isMuonSelected()) & static_cast(t2.isMuonSelected()); } if constexpr (TPairType == VarManager::kElectronMuon) { - twoTrackFilter = uint32_t(t1.isBarrelSelected()) & uint32_t(t2.isMuonSelected()); + twoTrackFilter = static_cast(t1.isBarrelSelected()) & static_cast(t2.isMuonSelected()); } if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue continue; @@ -790,12 +798,12 @@ struct AnalysisSameEventPairing { for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { if constexpr (TTrackFillMap & VarManager::ObjTypes::ReducedTrack || TTrackFillMap & VarManager::ObjTypes::ReducedMuon) { // for skimmed DQ model if ((*sig).CheckSignal(false, t1.reducedMCTrack(), t2.reducedMCTrack())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } if constexpr (TTrackFillMap & VarManager::ObjTypes::Track || TTrackFillMap & VarManager::ObjTypes::Muon) { // for Framework data model if ((*sig).CheckSignal(false, t1.template mcParticle_as(), t2.template mcParticle_as())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } // end loop over MC signals @@ -865,7 +873,7 @@ struct AnalysisSameEventPairing { fHistMan->FillHistClass(Form("%s_unambiguous", histNames[icut][0].Data()), VarManager::fgValues); } for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { - if (mcDecision & (uint32_t(1) << isig)) { + if (mcDecision & (static_cast(1) << isig)) { fHistMan->FillHistClass(histNamesMCmatched[icut][isig].Data(), VarManager::fgValues); if (fConfigAmbiguousHist && !(t1.isAmbiguous() || t2.isAmbiguous())) { fHistMan->FillHistClass(Form("%s_unambiguous", histNamesMCmatched[icut][isig].Data()), VarManager::fgValues); @@ -1195,13 +1203,13 @@ struct AnalysisDileptonTrack { for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { if constexpr (TTrackFillMap & VarManager::ObjTypes::ReducedTrack || TTrackFillMap & VarManager::ObjTypes::ReducedMuon) { // for skimmed DQ model if ((*sig).CheckSignal(false, lepton1MC, lepton2MC)) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } // end loop over MC signals for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { - if (mcDecision & (uint32_t(1) << isig)) { + if (mcDecision & (static_cast(1) << isig)) { fHistMan->FillHistClass(Form("DileptonsSelected_matchedMC_%s", fRecMCSignalsNames[isig].Data()), fValuesDilepton); } } @@ -1227,7 +1235,7 @@ struct AnalysisDileptonTrack { for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { if constexpr (TTrackFillMap & VarManager::ObjTypes::ReducedTrack || TTrackFillMap & VarManager::ObjTypes::ReducedMuon || TTrackFillMap & VarManager::ObjTypes::ReducedMuon) { // for skimmed DQ model if ((*sig).CheckSignal(false, lepton1MC, lepton2MC, trackMC)) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } @@ -1237,7 +1245,7 @@ struct AnalysisDileptonTrack { } for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { - if (mcDecision & (uint32_t(1) << isig)) { + if (mcDecision & (static_cast(1) << isig)) { fHistMan->FillHistClass(Form("DileptonTrackInvMass_matchedMC_%s", fRecMCSignalsNames[isig].Data()), fValuesTrack); } } @@ -1301,6 +1309,297 @@ struct AnalysisDileptonTrack { PROCESS_SWITCH(AnalysisDileptonTrack, processDummy, "Dummy function", false); }; +struct AnalysisDileptonTrackTrack { + OutputObj fOutputList{"output"}; + + Configurable fConfigTrackCut1{"cfgTrackCut1", "pionPIDCut1", "track1 cut"}; // used for select the tracks from SelectedTracks + Configurable fConfigTrackCut2{"cfgTrackCut2", "pionPIDCut2", "track2 cut"}; // used for select the tracks from SelectedTracks + Configurable fConfigDileptonCut{"cfgDileptonCut", "pairJpsi2", "Dilepton cut"}; + Configurable fConfigQuadrupletCuts{"cfgQuadrupletCuts", "pairX3872Cut1", "Comma separated list of Dilepton-Track-Track cut"}; + Configurable fConfigMCRecSignals{"cfgBarrelMCRecSignals", "", "Comma separated list of MC signals (reconstructed)"}; + Configurable fConfigMCGenSignals{"cfgBarrelMCGenSignals", "", "Comma separated list of MC signals (generated)"}; + Configurable fConfigDileptonMCRecSignal{"cfgDileptonMCRecSignal", "", "Comma separated list of MC signals (reconstructed)"}; + + Produces DileptonTrackTrackTable; + HistogramManager* fHistMan; + + std::vector fRecMCSignalsNames; + std::vector fRecMCSignals; + std::vector fGenMCSignals; + std::vector fDileptonMCRecSignals; + + Filter eventFilter = aod::dqanalysisflags::isEventSelected == 1; + Filter dileptonFilter = aod::reducedpair::sign == 0; + Filter filterBarrelTrackSelected = aod::dqanalysisflags::isBarrelSelected > 0; + + float* fValuesQuadruplet; + + std::vector fQuadrupletCutNames; + AnalysisCompositeCut fDileptonCut; + std::vector fQuadrupletCuts; + TString fTrackCutName1; + TString fTrackCutName2; + bool fIsSameTrackCut = false; + + constexpr static uint32_t fgDileptonFillMap = VarManager::ObjTypes::ReducedTrack | VarManager::ObjTypes::Pair; // fill map + + void init(o2::framework::InitContext& context) + { + if (context.mOptions.get("processDummy")) { + return; + } + + fValuesQuadruplet = new float[VarManager::kNVars]; + VarManager::SetDefaultVarNames(); + fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); + fHistMan->SetUseDefaultVariableNames(kTRUE); + fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); + + TString histNames; + + // check if the same track cuts are used for both tracks + if (fConfigTrackCut1.value == fConfigTrackCut2.value) { + fIsSameTrackCut = true; + } + fTrackCutName1 = fConfigTrackCut1.value; + fTrackCutName2 = fConfigTrackCut2.value; + + // dilepton cut + TString configDileptonCutNamesStr = fConfigDileptonCut.value; + fDileptonCut = *dqcuts::GetCompositeCut(configDileptonCutNamesStr.Data()); + + // dilepton-track-track cuts + TString configQuadruletCutNamesStr = fConfigQuadrupletCuts.value; + std::unique_ptr objArray(configQuadruletCutNamesStr.Tokenize(",")); + for (Int_t icut = 0; icut < objArray->GetEntries(); ++icut) { + TString cutName = objArray->At(icut)->GetName(); + fQuadrupletCutNames.push_back(cutName); + fQuadrupletCuts.push_back(*dqcuts::GetCompositeCut(cutName.Data())); + } + + // reconstructible MC signals + TString sigNamesStr = fConfigMCRecSignals.value; + std::unique_ptr objRecSigArray(sigNamesStr.Tokenize(",")); + for (int isig = 0; isig < objRecSigArray->GetEntries(); ++isig) { + MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objRecSigArray->At(isig)->GetName()); + if (sig) { + if (sig->GetNProngs() == 3) { + fRecMCSignals.push_back(*sig); + } + } + } + + // fill the histogram names + if (!context.mOptions.get("processDummy")) { + // Title_DileptonTrackTrackCutName + if (!configQuadruletCutNamesStr.IsNull()) { + for (std::size_t icut = 0; icut < fQuadrupletCutNames.size(); ++icut) { + if (fIsSameTrackCut) { + histNames += Form("QuadrupletSEPM_%s;", fQuadrupletCutNames[icut].Data()); + } else { + histNames += Form("QuadrupletSEPM_%s;", fQuadrupletCutNames[icut].Data()); + histNames += Form("QuadrupletSEMP_%s;", fQuadrupletCutNames[icut].Data()); + } + histNames += Form("QuadrupletSEPP_%s;", fQuadrupletCutNames[icut].Data()); + histNames += Form("QuadrupletSEMM_%s;", fQuadrupletCutNames[icut].Data()); + // Reco MC signals + for (int isig = 0; isig < objRecSigArray->GetEntries(); ++isig) { + MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objRecSigArray->At(isig)->GetName()); + if (sig) { + if (sig->GetNProngs() == 4) { + fRecMCSignals.push_back(*sig); + fRecMCSignalsNames.push_back(sig->GetName()); + histNames += Form("MCTruthRecQaud_%s_%s;", fQuadrupletCutNames[icut].Data(), sig->GetName()); + } + } + } + } // loop over dilepton-track-track cuts + } + } + + // Genarate MC signals + TString sigGenNamesStr = fConfigMCGenSignals.value; + std::unique_ptr objGenSigArray(sigGenNamesStr.Tokenize(",")); + for (int isig = 0; isig < objGenSigArray->GetEntries(); isig++) { + MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objGenSigArray->At(isig)->GetName()); + if (sig) { + if (sig->GetNProngs() == 1) { // NOTE: 1-prong signals required + fGenMCSignals.push_back(*sig); + histNames += Form("MCTruthGenQaud_%s;", sig->GetName()); // TODO: Add these names to a std::vector to avoid using Form in the process function + } + } + } + + DefineHistograms(fHistMan, histNames.Data()); // define all histograms + VarManager::SetUseVars(fHistMan->GetUsedVars()); + fOutputList.setObject(fHistMan->GetMainHistogramList()); + + // dilepton MC signal + TString configDileptonMCRecSignalStr = fConfigDileptonMCRecSignal.value; + std::unique_ptr objDileptonMCRecSignalArray(configDileptonMCRecSignalStr.Tokenize(",")); + for (int isig = 0; isig < objDileptonMCRecSignalArray->GetEntries(); isig++) { + MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objDileptonMCRecSignalArray->At(isig)->GetName()); + if (sig) { + if (sig->GetNProngs() == 2) { + fDileptonMCRecSignals.push_back(*sig); + } + } + } + } + + // Template function to run pair - track - track combinations + template + void runDileptonTrackTrack(TEvent const& event, TTracks const& tracks, TDileptons const& dileptons, TEventsMC const& /*eventsMC*/, TTracksMC const& /*tracksMC*/) + { + VarManager::ResetValues(0, VarManager::kNVars, fValuesQuadruplet); + VarManager::FillEvent(event, fValuesQuadruplet); + + // LOGF(info, "Number of dileptons: %d", dileptons.size()); + int indexOffset = -999; + std::vector trackGlobalIndexes; + + if (dileptons.size() > 0) { + for (auto track : tracks) { + trackGlobalIndexes.push_back(track.globalIndex()); + // std::cout << track.index() << " " << track.globalIndex() << std::endl; + } + } + + // loop over dileptons + for (auto dilepton : dileptons) { + VarManager::FillTrack(dilepton, fValuesQuadruplet); + + // apply the dilepton cut + if (!fDileptonCut.IsSelected(fValuesQuadruplet)) + continue; + + // get the index of the electron legs + int indexLepton1 = dilepton.index0Id(); + int indexLepton2 = dilepton.index1Id(); + + if (indexOffset == -999) { + indexOffset = trackGlobalIndexes.at(0); + } + trackGlobalIndexes.clear(); + + auto lepton1 = tracks.iteratorAt(indexLepton1 - indexOffset); + auto lepton2 = tracks.iteratorAt(indexLepton2 - indexOffset); + + auto lepton1MC = lepton1.reducedMCTrack(); + auto lepton2MC = lepton2.reducedMCTrack(); + + // loop over track - track combinations + for (auto& [t1, t2] : combinations(tracks, tracks)) { + // avoid self-combinations + if (t1.globalIndex() == indexLepton1 || t1.globalIndex() == indexLepton2 || t2.globalIndex() == indexLepton1 || t2.globalIndex() == indexLepton2) { + // LOGF(info, "self-combination: %d=%d %d=%d", t1.globalIndex(), indexLepton1, indexLepton2, t2.globalIndex()); + continue; + } + + // dilepton combinate with two same particles + if ((fIsSameTrackCut && (t1.isBarrelSelected() & (static_cast(1) << 1)) && (t2.isBarrelSelected() & (static_cast(1) << 1))) || + (!fIsSameTrackCut && (t1.isBarrelSelected() & (static_cast(1) << 1)) && (t2.isBarrelSelected() & (static_cast(1) << 2)))) { + } else { + continue; + } + + // Fill the Histograms + VarManager::FillDileptonTrackTrack(dilepton, t1, t2, fValuesQuadruplet); + uint32_t CutDecision = 0; + uint32_t mcDecision = 0; + int iCut = 0; + for (auto cut = fQuadrupletCuts.begin(); cut != fQuadrupletCuts.end(); cut++, iCut++) { + if (cut->IsSelected(fValuesQuadruplet)) { + CutDecision |= (static_cast(1) << iCut); + if (fIsSameTrackCut) { + if (t1.sign() * t2.sign() < 0) { + fHistMan->FillHistClass(Form("QuadrupletSEPM_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } + } else { + if ((t1.sign() < 0) && (t2.sign() > 0)) { + fHistMan->FillHistClass(Form("QuadrupletSEMP_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } else if ((t1.sign() > 0) && (t2.sign() < 0)) { + fHistMan->FillHistClass(Form("QuadrupletSEPM_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } + } + if ((t1.sign() > 0) && (t2.sign() > 0)) { + fHistMan->FillHistClass(Form("QuadrupletSEPP_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } else if ((t1.sign() < 0) && (t2.sign() < 0)) { + fHistMan->FillHistClass(Form("QuadrupletSEMM_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } + + // Reco MC signals + if (fRecMCSignals.size() > 0) { + int isig = 0; + for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { + if ((*sig).CheckSignal(true, lepton1MC, lepton2MC, t1.reducedMCTrack(), t2.reducedMCTrack())) { + mcDecision |= (static_cast(1) << isig); + } + } + for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { + if (mcDecision & (static_cast(1) << isig)) { + fHistMan->FillHistClass(Form("MCTruthRecQaud_%s_%s", fQuadrupletCutNames[iCut].Data(), fRecMCSignalsNames[isig].Data()), fValuesQuadruplet); + } + } + } + } + } // end loop over cuts + + // Fill the DileptonTrackTrackCandidates table + if (!CutDecision) + continue; + if (!mcDecision) + continue; + DileptonTrackTrackTable(fValuesQuadruplet[VarManager::kQuadMass], fValuesQuadruplet[VarManager::kQuadPt], fValuesQuadruplet[VarManager::kQuadEta], fValuesQuadruplet[VarManager::kQuadPhi], fValuesQuadruplet[VarManager::kRap], + fValuesQuadruplet[VarManager::kQ], fValuesQuadruplet[VarManager::kDeltaR1], fValuesQuadruplet[VarManager::kDeltaR2], + dilepton.mass(), dilepton.pt(), dilepton.eta(), dilepton.phi(), dilepton.sign(), + fValuesQuadruplet[VarManager::kDitrackMass], fValuesQuadruplet[VarManager::kDitrackPt], t1.pt(), t2.pt(), t1.eta(), t2.eta(), t1.phi(), t2.phi(), t1.sign(), t2.sign()); + } // end loop over track - track combinations + } // end loop over dileptons + }; + + template + void runMCGen(ReducedMCTracks const& mcTracks) + { + // loop over mc stack and fill histograms for pure MC truth signals + for (auto& track : mcTracks) { + VarManager::FillTrackMC(mcTracks, track); + for (auto& sig : fGenMCSignals) { + if (sig.CheckSignal(true, track)) { + int daughterIdFirst = track.daughtersIds()[0]; + int daughterIdEnd = track.daughtersIds()[1]; + int Ndaughters = daughterIdEnd - daughterIdFirst + 1; + if (Ndaughters == 3) { + auto dilepton = mcTracks.rawIteratorAt(daughterIdFirst); + auto track1 = mcTracks.rawIteratorAt(daughterIdFirst + 1); + auto track2 = mcTracks.rawIteratorAt(daughterIdFirst + 2); + VarManager::FillQaudMC(dilepton, track1, track2); + } + fHistMan->FillHistClass(Form("MCTruthGenQaud_%s", sig.GetName()), VarManager::fgValues); + } + } + } + }; + + PresliceUnsorted perReducedMcEvent = aod::reducedtrackMC::reducedMCeventId; + + void processX3872(soa::Filtered::iterator const& event, MyBarrelTracksSelectedWithCov const& tracks, soa::Join const& dileptons, ReducedMCEvents const& eventsMC, ReducedMCTracks const& tracksMC) + { + runDileptonTrackTrack(event, tracks, dileptons, eventsMC, tracksMC); + auto groupedMCTracks = tracksMC.sliceBy(perReducedMcEvent, event.reducedMCevent().globalIndex()); + groupedMCTracks.bindInternalIndicesTo(&tracksMC); + runMCGen(groupedMCTracks); + } + + void processDummy(MyEvents&) + { + // do nothing + } + + PROCESS_SWITCH(AnalysisDileptonTrackTrack, processX3872, "Run X3872 reconstruction", false); + PROCESS_SWITCH(AnalysisDileptonTrackTrack, processDummy, "Dummy function", false); +}; + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ @@ -1308,7 +1607,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; } void DefineHistograms(HistogramManager* histMan, TString histClasses) @@ -1353,6 +1653,9 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses) // histMan->AddHistogram(objArray->At(iclass)->GetName(), "Rapidity", "MC generator y distribution", false, 150, 2.5, 4.0, VarManager::kMCY); histMan->AddHistogram(objArray->At(iclass)->GetName(), "Phi", "MC generator #varphi distribution", false, 50, 0.0, 2. * TMath::Pi(), VarManager::kMCPhi); } + if (classStr.Contains("MCTruthGenQaud")) { + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "mctruth_quad"); + } if (classStr.Contains("MCTruthGen")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "mctruth"); histMan->AddHistogram(objArray->At(iclass)->GetName(), "Pt_Rapidity", "MC generator p_{T}, y distribution", false, 120, 0.0, 30.0, VarManager::kMCPt, 150, 2.5, 4.0, VarManager::kMCY); @@ -1369,6 +1672,9 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses) if (classStr.Contains("DileptonTrackInvMass")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "dilepton-hadron-mass"); } + if (classStr.Contains("Quadruplet") || classStr.Contains("MCTruthRecQaud")) { + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "dilepton-dihadron", "xtojpsipipi"); + } } // end loop over histogram classes } diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 03faa87837e..62dfcd46652 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -15,6 +15,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -76,6 +79,8 @@ DECLARE_SOA_COLUMN(TauxyBcandidate, tauxyBcandidate, float); DECLARE_SOA_COLUMN(TauzBcandidate, tauzBcandidate, float); DECLARE_SOA_COLUMN(CosPBcandidate, cosPBcandidate, float); DECLARE_SOA_COLUMN(Chi2Bcandidate, chi2Bcandidate, float); +DECLARE_SOA_COLUMN(DCAxyzBetweenProngs, dcaxyzBetweenProngs, float); +DECLARE_SOA_COLUMN(McFlag, mcFlag, int8_t); } // namespace dqanalysisflags DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTS", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents @@ -84,7 +89,7 @@ DECLARE_SOA_TABLE(BarrelAmbiguities, "AOD", "DQBARRELAMB", dqanalysisflags::Barr DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTS", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc DECLARE_SOA_TABLE(MuonAmbiguities, "AOD", "DQMUONAMB", dqanalysisflags::MuonAmbiguityInBunch, dqanalysisflags::MuonAmbiguityOutOfBunch); //! joinable to ReducedMuonTracks DECLARE_SOA_TABLE(Prefilter, "AOD", "DQPREFILTER", dqanalysisflags::IsBarrelSelectedPrefilter); //! joinable to ReducedTracksAssoc -DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", dqanalysisflags::massBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate); +DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", dqanalysisflags::massBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::DCAxyzBetweenProngs, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate, dqanalysisflags::McFlag); } // namespace o2::aod // Declarations of various short names @@ -142,6 +147,10 @@ struct AnalysisEventSelection { Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; Configurable fConfigAddEventMCHistogram{"cfgAddEventMCHistogram", "generator", "Comma separated list of histograms"}; + Configurable fConfigSplitCollisionsDeltaZ{"splitCollisionsDeltaZ", 1.0, "maximum delta-z (cm) between two collisions to consider them as split candidates"}; + Configurable fConfigSplitCollisionsDeltaBC{"splitCollisionsDeltaBC", 100, "maximum delta-BC between two collisions to consider them as split candidates; do not apply if value is negative"}; + Configurable fConfigCheckSplitCollisions{"checkSplitCollisions", false, "If true, run the split collision check and fill histograms"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -172,9 +181,12 @@ struct AnalysisEventSelection { fHistMan = new HistogramManager("analysisHistos", "", VarManager::kNVars); fHistMan->SetUseDefaultVariableNames(kTRUE); fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); - DefineHistograms(fHistMan, "Event_BeforeCuts;Event_AfterCuts;OutOfBunchCorrelations;SameBunchCorrelations;", fConfigAddEventHistogram.value.data()); // define all histograms - DefineHistograms(fHistMan, "EventsMC", fConfigAddEventMCHistogram.value.data()); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + DefineHistograms(fHistMan, "Event_BeforeCuts;Event_AfterCuts;", fConfigAddEventHistogram.value.data()); + if (fConfigCheckSplitCollisions) { + DefineHistograms(fHistMan, "OutOfBunchCorrelations;SameBunchCorrelations;", ""); + } + DefineHistograms(fHistMan, "EventsMC", fConfigAddEventMCHistogram.value.data()); + VarManager::SetUseVars(fHistMan->GetUsedVars()); fOutputList.setObject(fHistMan->GetMainHistogramList()); } @@ -193,8 +205,7 @@ struct AnalysisEventSelection { fHeader = fCCDBApi.retrieveHeaders(Form("RCT/Info/RunInformation/%i", events.begin().runNumber()), fMetadataRCT, -1); uint64_t sor = std::atol(fHeader["SOR"].c_str()); uint64_t eor = std::atol(fHeader["EOR"].c_str()); - cout << "=========================== SOR / EOR is " << sor << " / " << eor << endl; - // TODO: send SOR to VarManager and compute event times relative to SOR + VarManager::SetSORandEOR(sor, eor); } fSelMap.clear(); @@ -244,78 +255,67 @@ struct AnalysisEventSelection { // Reset the fValues array and fill event observables VarManager::ResetValues(0, VarManager::kNEventWiseVariables); - // loop over the BC map, find BCs with more than one collision and compute 2-event correlation quantities - // TODO: add also correlations for out of bunch events - // TODO: check event time resolution as a function of various multiplicity estimators - - // for (auto& [bc, evIndices] : fBCCollMap) { - for (auto it1 = fBCCollMap.begin(); it1 != fBCCollMap.end(); it1++) { - - // correlate events in neighbouring BCs (within one orbit) - for (auto it2 = it1; it2 != fBCCollMap.end(); it2++) { - if (it2 == it1) { + // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations + for (auto bc1It = fBCCollMap.begin(); bc1It != fBCCollMap.end(); ++bc1It) { + uint64_t bc1 = bc1It->first; + auto bc1Events = bc1It->second; + + // same bunch event correlations, if more than 1 collisions in this bunch + if (bc1Events.size() > 1) { + for (auto ev1It = bc1Events.begin(); ev1It != bc1Events.end(); ++ev1It) { + auto ev1 = events.rawIteratorAt(*ev1It); + for (auto ev2It = std::next(ev1It); ev2It != bc1Events.end(); ++ev2It) { + auto ev2 = events.rawIteratorAt(*ev2It); + // compute 2-event quantities and mark the candidate split collisions + VarManager::FillTwoEvents(ev1, ev2); + if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split + collisionSplittingMap[*ev1It] = true; + collisionSplittingMap[*ev2It] = true; + } + fHistMan->FillHistClass("SameBunchCorrelations", VarManager::fgValues); + } // end second event loop + } // end first event loop + } // end if BC1 events > 1 + + // loop over the following BCs in the TF + for (auto bc2It = std::next(bc1It); bc2It != fBCCollMap.end(); ++bc2It) { + uint64_t bc2 = bc2It->first; + if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > fConfigSplitCollisionsDeltaBC) { continue; } - - if ((it2->first - it1->first) > 100) { - break; - } - - for (auto& ev1Idx : it1->second) { - if (!fSelMap[ev1Idx]) { - continue; - } - auto ev1 = events.rawIteratorAt(ev1Idx); - for (auto& ev2Idx : it2->second) { - if (!fSelMap[ev2Idx]) { - continue; - } - auto ev2 = events.rawIteratorAt(ev2Idx); + auto bc2Events = bc2It->second; + + // loop over events in the first BC + for (auto ev1It : bc1Events) { + auto ev1 = events.rawIteratorAt(ev1It); + // loop over events in the second BC + for (auto ev2It : bc2Events) { + auto ev2 = events.rawIteratorAt(ev2It); + // compute 2-event quantities and mark the candidate split collisions VarManager::FillTwoEvents(ev1, ev2); + if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split + collisionSplittingMap[ev1It] = true; + collisionSplittingMap[ev2It] = true; + } fHistMan->FillHistClass("OutOfBunchCorrelations", VarManager::fgValues); } } } - - auto evIndices = it1->second; - if (evIndices.size() < 2) { - continue; - } - - // correlate the events inside one BC - for (auto ev1Idx = evIndices.begin(); ev1Idx != evIndices.end(); ++ev1Idx) { - if (!fSelMap[*ev1Idx]) { - continue; - } - auto ev1 = events.rawIteratorAt(*ev1Idx); - for (auto ev2Idx = std::next(ev1Idx); ev2Idx != evIndices.end(); ++ev2Idx) { - if (!fSelMap[*ev2Idx]) { - continue; - } - auto ev2 = events.rawIteratorAt(*ev2Idx); - VarManager::FillTwoEvents(ev1, ev2); - if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < 1.0) { // this is a possible collision split - collisionSplittingMap[*ev1Idx] = true; - collisionSplittingMap[*ev2Idx] = true; - } - fHistMan->FillHistClass("SameBunchCorrelations", VarManager::fgValues); - } - } } // publish the table - uint32_t evSel = 0; + uint32_t evSel = static_cast(0); for (auto& event : events) { evSel = 0; if (fSelMap[event.globalIndex()]) { // event passed the user cuts - evSel |= (uint32_t(1) << 0); + evSel |= (static_cast(1) << 0); } std::vector sameBunchEvents = fBCCollMap[event.globalBC()]; if (sameBunchEvents.size() > 1) { // event with in-bunch pileup - evSel |= (uint32_t(1) << 1); + evSel |= (static_cast(1) << 1); } if (collisionSplittingMap.find(event.globalIndex()) != collisionSplittingMap.end()) { // event with possible fake in-bunch pileup (collision splitting) - evSel |= (uint32_t(1) << 2); + evSel |= (static_cast(1) << 2); } eventSel(evSel); } @@ -346,6 +346,7 @@ struct AnalysisTrackSelection { Configurable fConfigCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigPublishAmbiguity{"cfgPublishAmbiguity", true, "If true, publish ambiguity table and fill QA histograms"}; Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -422,7 +423,9 @@ struct AnalysisTrackSelection { } DefineHistograms(fHistMan, histClasses.Data(), fConfigAddTrackHistogram.value.data()); - DefineHistograms(fHistMan, "TrackBarrel_AmbiguityInBunch;TrackBarrel_AmbiguityOutOfBunch;", "ambiguity"); + if (fConfigPublishAmbiguity) { + DefineHistograms(fHistMan, "TrackBarrel_AmbiguityInBunch;TrackBarrel_AmbiguityOutOfBunch;", "ambiguity"); + } VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); } @@ -501,10 +504,10 @@ struct AnalysisTrackSelection { } int iCut = 0; - uint32_t filterMap = 0; + uint32_t filterMap = static_cast(0); for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, iCut++) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << iCut); + filterMap |= (static_cast(1) << iCut); if (fConfigQA) { fHistMan->FillHistClass(fHistNamesReco[iCut], VarManager::fgValues); } @@ -513,24 +516,24 @@ struct AnalysisTrackSelection { trackSel(filterMap); // compute MC matching decisions and fill histograms for matched associations - uint32_t mcDecision = 0; + uint32_t mcDecision = static_cast(0); int isig = 0; if (filterMap > 0) { for (auto sig = fMCSignals.begin(); sig != fMCSignals.end(); sig++, isig++) { if (track.has_reducedMCTrack()) { if ((*sig).CheckSignal(true, track.reducedMCTrack())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } // fill histograms for (unsigned int i = 0; i < fMCSignals.size(); i++) { - if (!(mcDecision & (uint32_t(1) << i))) { + if (!(mcDecision & (static_cast(1) << i))) { continue; } for (unsigned int j = 0; j < fTrackCuts.size(); j++) { - if (filterMap & (uint32_t(1) << j)) { + if (filterMap & (static_cast(1) << j)) { if (isCorrectAssoc) { fHistMan->FillHistClass(fHistNamesMCMatched[j * fMCSignals.size() + 2 * i].Data(), VarManager::fgValues); } else { @@ -538,12 +541,13 @@ struct AnalysisTrackSelection { } } } // end loop over cuts - } // end loop over MC signals - } // end if (filterMap > 0) + } // end loop over MC signals + } // end if (filterMap > 0) // count the number of associations per track - if (filterMap > 0) { + if (fConfigPublishAmbiguity && filterMap > 0) { if (event.isEventSelected_bit(1)) { + // for this track, count the number of associated collisions with in-bunch pileup and out of bunch associations if (fNAssocsInBunch.find(track.globalIndex()) == fNAssocsInBunch.end()) { std::vector evVector = {event.globalIndex()}; fNAssocsInBunch[track.globalIndex()] = evVector; @@ -566,39 +570,43 @@ struct AnalysisTrackSelection { // QA the collision-track associations // TODO: some tracks can be associated to both collisions that have in bunch pileup and collisions from different bunches // So one could QA these tracks separately - for (auto& [trackIdx, evIndices] : fNAssocsInBunch) { - if (evIndices.size() == 1) { - continue; - } - auto track = tracks.rawIteratorAt(trackIdx); - VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); - VarManager::FillTrack(track); - VarManager::fgValues[VarManager::kBarrelNAssocsInBunch] = static_cast(evIndices.size()); - fHistMan->FillHistClass("TrackBarrel_AmbiguityInBunch", VarManager::fgValues); - } // end loop over in-bunch ambiguous tracks - - for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) { - if (evIndices.size() == 1) { - continue; - } - auto track = tracks.rawIteratorAt(trackIdx); - VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); - VarManager::FillTrack(track); - VarManager::fgValues[VarManager::kBarrelNAssocsOutOfBunch] = static_cast(evIndices.size()); - fHistMan->FillHistClass("TrackBarrel_AmbiguityOutOfBunch", VarManager::fgValues); - } // end loop over out-of-bunch ambiguous tracks - - // publish the ambiguity table - for (auto& track : tracks) { - int8_t nInBunch = 0; - if (fNAssocsInBunch.find(track.globalIndex()) != fNAssocsInBunch.end()) { - nInBunch = fNAssocsInBunch[track.globalIndex()].size(); - } - int8_t nOutOfBunch = 0; - if (fNAssocsOutOfBunch.find(track.globalIndex()) != fNAssocsOutOfBunch.end()) { - nOutOfBunch = fNAssocsOutOfBunch[track.globalIndex()].size(); + if (fConfigPublishAmbiguity) { + if (fConfigQA) { + for (auto& [trackIdx, evIndices] : fNAssocsInBunch) { + if (evIndices.size() == 1) { + continue; + } + auto track = tracks.rawIteratorAt(trackIdx); + VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); + VarManager::FillTrack(track); + VarManager::fgValues[VarManager::kBarrelNAssocsInBunch] = static_cast(evIndices.size()); + fHistMan->FillHistClass("TrackBarrel_AmbiguityInBunch", VarManager::fgValues); + } // end loop over in-bunch ambiguous tracks + + for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) { + if (evIndices.size() == 1) { + continue; + } + auto track = tracks.rawIteratorAt(trackIdx); + VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); + VarManager::FillTrack(track); + VarManager::fgValues[VarManager::kBarrelNAssocsOutOfBunch] = static_cast(evIndices.size()); + fHistMan->FillHistClass("TrackBarrel_AmbiguityOutOfBunch", VarManager::fgValues); + } // end loop over out-of-bunch ambiguous tracks + } + + // publish the ambiguity table + for (auto& track : tracks) { + int8_t nInBunch = 0; + if (fNAssocsInBunch.find(track.globalIndex()) != fNAssocsInBunch.end()) { + nInBunch = fNAssocsInBunch[track.globalIndex()].size(); + } + int8_t nOutOfBunch = 0; + if (fNAssocsOutOfBunch.find(track.globalIndex()) != fNAssocsOutOfBunch.end()) { + nOutOfBunch = fNAssocsOutOfBunch[track.globalIndex()].size(); + } + trackAmbiguities(nInBunch, nOutOfBunch); } - trackAmbiguities(nInBunch, nOutOfBunch); } } // end runTrackSelection() @@ -630,6 +638,7 @@ struct AnalysisMuonSelection { Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigPublishAmbiguity{"cfgPublishAmbiguity", true, "If true, publish ambiguity table and fill QA histograms"}; Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -701,7 +710,9 @@ struct AnalysisMuonSelection { histClasses += Form("%s;", nameStr2.Data()); } } - histClasses += "Muon_AmbiguityInBunch;Muon_AmbiguityOutOfBunch;"; + if (fConfigPublishAmbiguity) { + histClasses += "Muon_AmbiguityInBunch;Muon_AmbiguityOutOfBunch;"; + } DefineHistograms(fHistMan, histClasses.Data(), fConfigAddMuonHistogram.value.data()); // define all histograms VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill @@ -762,10 +773,10 @@ struct AnalysisMuonSelection { } int iCut = 0; - uint32_t filterMap = 0; + uint32_t filterMap = static_cast(0); for (auto cut = fMuonCuts.begin(); cut != fMuonCuts.end(); cut++, iCut++) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << iCut); + filterMap |= (static_cast(1) << iCut); if (fConfigQA) { fHistMan->FillHistClass(fHistNamesReco[iCut].Data(), VarManager::fgValues); } @@ -785,13 +796,13 @@ struct AnalysisMuonSelection { } // compute MC matching decisions - uint32_t mcDecision = 0; + uint32_t mcDecision = static_cast(0); int isig = 0; for (auto sig = fMCSignals.begin(); sig != fMCSignals.end(); sig++, isig++) { if constexpr ((TMuonFillMap & VarManager::ObjTypes::ReducedMuon) > 0) { if (track.has_reducedMCTrack()) { if ((*sig).CheckSignal(true, track.reducedMCTrack())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } @@ -799,11 +810,11 @@ struct AnalysisMuonSelection { // fill histograms for (unsigned int i = 0; i < fMCSignals.size(); i++) { - if (!(mcDecision & (uint32_t(1) << i))) { + if (!(mcDecision & (static_cast(1) << i))) { continue; } for (unsigned int j = 0; j < fMuonCuts.size(); j++) { - if (filterMap & (uint8_t(1) << j)) { + if (filterMap & (static_cast(1) << j)) { if (isCorrectAssoc) { fHistMan->FillHistClass(fHistNamesMCMatched[j * fMCSignals.size() + 2 * i].Data(), VarManager::fgValues); } else { @@ -811,24 +822,26 @@ struct AnalysisMuonSelection { } } } // end loop over cuts - } // end loop over MC signals + } // end loop over MC signals // count the number of associations per track - if (event.isEventSelected_bit(1)) { - if (fNAssocsInBunch.find(track.globalIndex()) == fNAssocsInBunch.end()) { - std::vector evVector = {event.globalIndex()}; - fNAssocsInBunch[track.globalIndex()] = evVector; - } else { - auto& evVector = fNAssocsInBunch[track.globalIndex()]; - evVector.push_back(event.globalIndex()); - } - } else { - if (fNAssocsOutOfBunch.find(track.globalIndex()) == fNAssocsOutOfBunch.end()) { - std::vector evVector = {event.globalIndex()}; - fNAssocsOutOfBunch[track.globalIndex()] = evVector; + if (fConfigPublishAmbiguity && filterMap > 0) { + if (event.isEventSelected_bit(1)) { + if (fNAssocsInBunch.find(track.globalIndex()) == fNAssocsInBunch.end()) { + std::vector evVector = {event.globalIndex()}; + fNAssocsInBunch[track.globalIndex()] = evVector; + } else { + auto& evVector = fNAssocsInBunch[track.globalIndex()]; + evVector.push_back(event.globalIndex()); + } } else { - auto& evVector = fNAssocsOutOfBunch[track.globalIndex()]; - evVector.push_back(event.globalIndex()); + if (fNAssocsOutOfBunch.find(track.globalIndex()) == fNAssocsOutOfBunch.end()) { + std::vector evVector = {event.globalIndex()}; + fNAssocsOutOfBunch[track.globalIndex()] = evVector; + } else { + auto& evVector = fNAssocsOutOfBunch[track.globalIndex()]; + evVector.push_back(event.globalIndex()); + } } } } // end loop over assocs @@ -836,39 +849,41 @@ struct AnalysisMuonSelection { // QA the collision-track associations // TODO: some tracks can be associated to both collisions that have in bunch pileup and collisions from different bunches // So one could QA these tracks separately - for (auto& [trackIdx, evIndices] : fNAssocsInBunch) { - if (evIndices.size() == 1) { - continue; - } - auto track = muons.rawIteratorAt(trackIdx); - VarManager::ResetValues(0, VarManager::kNVars); - VarManager::FillTrack(track); - VarManager::fgValues[VarManager::kMuonNAssocsInBunch] = static_cast(evIndices.size()); - fHistMan->FillHistClass("Muon_AmbiguityInBunch", VarManager::fgValues); - } // end loop over in-bunch ambiguous tracks - - for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) { - if (evIndices.size() == 1) { - continue; - } - auto track = muons.rawIteratorAt(trackIdx); - VarManager::ResetValues(0, VarManager::kNVars); - VarManager::FillTrack(track); - VarManager::fgValues[VarManager::kMuonNAssocsOutOfBunch] = static_cast(evIndices.size()); - fHistMan->FillHistClass("Muon_AmbiguityOutOfBunch", VarManager::fgValues); - } // end loop over out-of-bunch ambiguous tracks - - // publish the ambiguity table - for (auto& track : muons) { - int8_t nInBunch = 0; - if (fNAssocsInBunch.find(track.globalIndex()) != fNAssocsInBunch.end()) { - nInBunch = fNAssocsInBunch[track.globalIndex()].size(); - } - int8_t nOutOfBunch = 0; - if (fNAssocsOutOfBunch.find(track.globalIndex()) != fNAssocsOutOfBunch.end()) { - nOutOfBunch = fNAssocsOutOfBunch[track.globalIndex()].size(); + if (fConfigPublishAmbiguity) { + for (auto& [trackIdx, evIndices] : fNAssocsInBunch) { + if (evIndices.size() == 1) { + continue; + } + auto track = muons.rawIteratorAt(trackIdx); + VarManager::ResetValues(0, VarManager::kNVars); + VarManager::FillTrack(track); + VarManager::fgValues[VarManager::kMuonNAssocsInBunch] = static_cast(evIndices.size()); + fHistMan->FillHistClass("Muon_AmbiguityInBunch", VarManager::fgValues); + } // end loop over in-bunch ambiguous tracks + + for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) { + if (evIndices.size() == 1) { + continue; + } + auto track = muons.rawIteratorAt(trackIdx); + VarManager::ResetValues(0, VarManager::kNVars); + VarManager::FillTrack(track); + VarManager::fgValues[VarManager::kMuonNAssocsOutOfBunch] = static_cast(evIndices.size()); + fHistMan->FillHistClass("Muon_AmbiguityOutOfBunch", VarManager::fgValues); + } // end loop over out-of-bunch ambiguous tracks + + // publish the ambiguity table + for (auto& track : muons) { + int8_t nInBunch = 0; + if (fNAssocsInBunch.find(track.globalIndex()) != fNAssocsInBunch.end()) { + nInBunch = fNAssocsInBunch[track.globalIndex()].size(); + } + int8_t nOutOfBunch = 0; + if (fNAssocsOutOfBunch.find(track.globalIndex()) != fNAssocsOutOfBunch.end()) { + nOutOfBunch = fNAssocsOutOfBunch[track.globalIndex()].size(); + } + muonAmbiguities(nInBunch, nOutOfBunch); } - muonAmbiguities(nInBunch, nOutOfBunch); } } @@ -904,7 +919,7 @@ struct AnalysisPrefilterSelection { Configurable fConfigPrefilterPairCut{"cfgPrefilterPairCut", "", "Prefilter pair cut"}; Configurable fConfigTrackCuts{"cfgTrackCuts", "", "Track cuts for which to run the prefilter"}; // Track related options - Configurable fPropTrack{"cfgPropTrack", true, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; + Configurable fPropTrack{"cfgPropTrack", false, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; std::map fPrefilterMap; AnalysisCompositeCut* fPairCut; @@ -919,51 +934,60 @@ struct AnalysisPrefilterSelection { return; } + bool runPrefilter = true; // get the list of track cuts to be prefiltered TString trackCutsStr = fConfigTrackCuts.value; TObjArray* objArrayTrackCuts = nullptr; if (!trackCutsStr.IsNull()) { objArrayTrackCuts = trackCutsStr.Tokenize(","); + if (objArrayTrackCuts == nullptr) { + runPrefilter = false; + } + } else { + LOG(warn) << " No track cuts to prefilter! Prefilter will not be run"; + runPrefilter = false; } - if (objArrayTrackCuts->GetEntries() == 0) { - LOG(fatal) << " No track cuts to prefilter!"; + // get the cut to be used as loose selection + TString prefilterTrackCutStr = fConfigPrefilterTrackCut.value; + if (prefilterTrackCutStr.IsNull()) { + LOG(warn) << " No prefilter loose selection specified! Prefilter will not be run"; + runPrefilter = false; } - // get the list of cuts that were computed in the barrel track-selection task and create a bit mask - // to mark just the ones we want to apply a prefilter on fPrefilterMask = 0; fPrefilterCutBit = -1; - string trackCuts; - getTaskOptionValue(context, "analysis-track-selection", "cfgTrackCuts", trackCuts, false); - TString allTrackCutsStr = trackCuts; - TString prefilterTrackCutStr = fConfigPrefilterTrackCut.value; - if (!trackCutsStr.IsNull()) { + if (runPrefilter) { + // get the list of cuts that were computed in the barrel track-selection task and create a bit mask + // to mark just the ones we want to apply a prefilter on + string trackCuts; + getTaskOptionValue(context, "analysis-track-selection", "cfgTrackCuts", trackCuts, false); + TString allTrackCutsStr = trackCuts; + std::unique_ptr objArray(allTrackCutsStr.Tokenize(",")); + if (objArray == nullptr) { + LOG(fatal) << " Not getting any track cuts from the barrel-track-selection "; + } if (objArray->FindObject(prefilterTrackCutStr.Data()) == nullptr) { LOG(fatal) << " Prefilter track cut not among the cuts calculated by the track-selection task! "; } for (int icut = 0; icut < objArray->GetEntries(); ++icut) { TString tempStr = objArray->At(icut)->GetName(); if (objArrayTrackCuts->FindObject(tempStr.Data()) != nullptr) { - fPrefilterMask |= (uint32_t(1) << icut); + fPrefilterMask |= (static_cast(1) << icut); } if (tempStr.CompareTo(fConfigPrefilterTrackCut.value) == 0) { fPrefilterCutBit = icut; } } + // setup the prefilter pair cut + fPairCut = new AnalysisCompositeCut(true); + TString pairCutStr = fConfigPrefilterPairCut.value; + if (!pairCutStr.IsNull()) { + fPairCut = dqcuts::GetCompositeCut(pairCutStr.Data()); + } } - if (fPrefilterMask == 0) { - LOG(fatal) << "No specified track cuts for prefiltering"; - } - if (fPrefilterCutBit < 0) { - LOG(fatal) << "No or incorrectly specified loose track prefilter cut"; - } - - // setup the prefilter pair cut - fPairCut = new AnalysisCompositeCut(true); - TString pairCutStr = fConfigPrefilterPairCut.value; - if (!pairCutStr.IsNull()) { - fPairCut = dqcuts::GetCompositeCut(pairCutStr.Data()); + if (fPrefilterMask == static_cast(0) || fPrefilterCutBit < 0) { + LOG(warn) << "No specified loose cut or track cuts for prefiltering. This task will do nothing."; } VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill @@ -976,6 +1000,9 @@ struct AnalysisPrefilterSelection { template void runPrefilter(TEvent const& event, soa::Join const& assocs, TTracks const& /*tracks*/) { + if (fPrefilterCutBit < 0 || fPrefilterMask == 0) { + return; + } for (auto& [assoc1, assoc2] : o2::soa::combinations(assocs, assocs)) { auto track1 = assoc1.template reducedtrack_as(); @@ -1025,15 +1052,26 @@ struct AnalysisPrefilterSelection { runPrefilter(event, groupedAssocs, tracks); } } + uint32_t mymap = -1; - for (auto& assoc : assocs) { - auto track = assoc.template reducedtrack_as(); - mymap = -1; - if (fPrefilterMap.find(track.globalIndex()) != fPrefilterMap.end()) { - // NOTE: publish the bitwise negated bits (~), so there will be zeroes for cuts that failed the prefiltering and 1 everywhere else - mymap = ~fPrefilterMap[track.globalIndex()]; + // If cuts were not configured, then produce a map with all 1's and publish it for all associations + if (fPrefilterCutBit < 0 || fPrefilterMask == 0) { + for (int i = 0; i < assocs.size(); ++i) { + prefilter(mymap); + } + } else { + for (auto& assoc : assocs) { + // TODO: just use the index from the assoc (no need to cast the whole track) + auto track = assoc.template reducedtrack_as(); + mymap = -1; + if (fPrefilterMap.find(track.globalIndex()) != fPrefilterMap.end()) { + // NOTE: publish the bitwise negated bits (~), so there will be zeroes for cuts that failed the prefiltering and 1 everywhere else + mymap = ~fPrefilterMap[track.globalIndex()]; + prefilter(mymap); + } else { + prefilter(mymap); // track did not pass the prefilter selections, so publish just 1's + } } - prefilter(mymap); } } @@ -1059,7 +1097,6 @@ struct AnalysisSameEventPairing { Produces dielectronInfoList; Produces dimuonsExtraList; Produces dimuonAllList; - Produces dileptonFlowList; Produces dileptonInfoList; o2::base::MatLayerCylSet* fLUT = nullptr; @@ -1067,34 +1104,41 @@ struct AnalysisSameEventPairing { OutputObj fOutputList{"output"}; - Configurable fConfigTrackCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; - Configurable fConfigMuonCuts{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; - Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts, !!! Use only if you know what you are doing, otherwise leave empty"}; - - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPath{"ccdb-path", "Users/lm", "base path to the ccdb object"}; - Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable fConfigGRPMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable fConfigUseRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"}; - Configurable fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"}; + struct : ConfigurableGroup { + Configurable track{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; + Configurable pair{"cfgPairCuts", "", "Comma separated list of pair cuts, !!! Use only if you know what you are doing, otherwise leave empty"}; + } fConfigCuts; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigFlatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"}; - Configurable fConfigUseKFVertexing{"cfgUseKFVertexing", false, "Use KF Particle for secondary vertex reconstruction (DCAFitter is used by default)"}; - Configurable fConfigUseAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"}; - Configurable fConfigPropToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"}; - Configurable fConfigCorrFullGeo{"cfgCorrFullGeo", false, "Use full geometry to correct for MCS effects in track propagation"}; - Configurable fConfigNoCorr{"cfgNoCorrFwdProp", false, "Do not correct for MCS effects in track propagation"}; - Configurable fConfigLutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable fConfigCollisionSystem{"syst", "pp", "Collision system, pp or PbPb"}; - Configurable fConfigCenterMassEnergy{"energy", 13600, "Center of mass energy in GeV"}; - Configurable fConfigRunMCGenPair{"cfgRunMCGenPair", false, "Do pairing of true MC particles"}; - Configurable fConfigMCGenSignals{"cfgBarrelMCGenSignals", "", "Comma separated list of MC signals (generated)"}; - Configurable fConfigMCRecSignals{"cfgBarrelMCRecSignals", "", "Comma separated list of MC signals (reconstructed)"}; - Configurable fConfigSkimSignalOnly{"fConfigSkimSignalOnly", false, "Configurable to select only matched candidates"}; + struct : ConfigurableGroup { + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + } fConfigCCDB; + + struct : ConfigurableGroup { + Configurable useRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"}; + Configurable magField{"cfgMagField", 5.0f, "Manually set magnetic field"}; + Configurable flatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"}; + Configurable useKFVertexing{"cfgUseKFVertexing", false, "Use KF Particle for secondary vertex reconstruction (DCAFitter is used by default)"}; + Configurable useAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"}; + Configurable propToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"}; + Configurable corrFullGeo{"cfgCorrFullGeo", false, "Use full geometry to correct for MCS effects in track propagation"}; + Configurable noCorr{"cfgNoCorrFwdProp", false, "Do not correct for MCS effects in track propagation"}; + Configurable collisionSystem{"syst", "pp", "Collision system, pp or PbPb"}; + Configurable centerMassEnergy{"energy", 13600, "Center of mass energy in GeV"}; + } fConfigOptions; + + struct : ConfigurableGroup { + Configurable genSignals{"cfgBarrelMCGenSignals", "", "Comma separated list of MC signals (generated)"}; + Configurable recSignals{"cfgBarrelMCRecSignals", "", "Comma separated list of MC signals (reconstructed)"}; + Configurable skimSignalOnly{"cfgSkimSignalOnly", false, "Configurable to select only matched candidates"}; + Configurable runMCGenPair{"cfgRunMCGenPair", false, "Do pairing of true MC particles"}; + } fConfigMC; // Track related options Configurable fPropTrack{"cfgPropTrack", true, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; @@ -1136,20 +1180,10 @@ struct AnalysisSameEventPairing { fEnableBarrelHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processBarrelOnlySkimmed") || context.mOptions.get("processBarrelOnlyWithCollSkimmed"); fEnableMuonHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processMuonOnlySkimmed"); - bool isDummy = context.mOptions.get("processDummy"); - if (isDummy) { - if (fEnableBarrelHistos || fEnableMuonHistos) { - LOG(warning) << "The dummy process function is enabled while you have enabled normal process function. Check your configuration file!" << endl; - } else { - LOG(info) << "Dummy function enabled. Skipping the rest of init()" << endl; - return; - } - } // Keep track of all the histogram class names to avoid composing strings in the pairing loop TString histNames = ""; - - TString cutNamesStr = fConfigPairCuts.value; + TString cutNamesStr = fConfigCuts.pair.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { @@ -1159,19 +1193,19 @@ struct AnalysisSameEventPairing { // get the list of cuts for tracks/muons, check that they were played by the barrel/muon selection tasks // and make a mask for active cuts (barrel and muon selection tasks may run more cuts, needed for other analyses) - TString trackCutsStr = fConfigTrackCuts.value; + TString trackCutsStr = fConfigCuts.track.value; TObjArray* objArrayTrackCuts = nullptr; if (!trackCutsStr.IsNull()) { objArrayTrackCuts = trackCutsStr.Tokenize(","); } - TString muonCutsStr = fConfigMuonCuts.value; + TString muonCutsStr = fConfigCuts.muon.value; TObjArray* objArrayMuonCuts = nullptr; if (!muonCutsStr.IsNull()) { objArrayMuonCuts = muonCutsStr.Tokenize(","); } // Setting the MC rec signal names - TString sigNamesStr = fConfigMCRecSignals.value; + TString sigNamesStr = fConfigMC.recSignals.value; std::unique_ptr objRecSigArray(sigNamesStr.Tokenize(",")); for (int isig = 0; isig < objRecSigArray->GetEntries(); ++isig) { @@ -1198,7 +1232,7 @@ struct AnalysisSameEventPairing { // if the current barrel selection cut is required in this task, then switch on the corresponding bit in the mask // and assign histogram directories if (objArrayTrackCuts->FindObject(tempStr.Data()) != nullptr) { - fTrackFilterMask |= (uint32_t(1) << icut); + fTrackFilterMask |= (static_cast(1) << icut); if (fEnableBarrelHistos) { // assign the pair hist directories for the current cut @@ -1223,7 +1257,7 @@ struct AnalysisSameEventPairing { // if there are pair cuts specified, assign hist directories for each barrel cut - pair cut combination // NOTE: This could possibly lead to large histogram outputs. It is strongly advised to use pair cuts only // if you know what you are doing. - TString cutNamesStr = fConfigPairCuts.value; + TString cutNamesStr = fConfigCuts.pair.value; if (!cutNamesStr.IsNull()) { // if pair cuts std::unique_ptr objArrayPair(cutNamesStr.Tokenize(",")); fNPairCuts = objArrayPair->GetEntries(); @@ -1236,7 +1270,7 @@ struct AnalysisSameEventPairing { // NOTE: In the numbering scheme for the map key, we use the number of barrel cuts in the barrel-track selection task fTrackHistNames[fNCutsBarrel + icut * fNPairCuts + iPairCut] = names; } // end loop (pair cuts) - } // end if (pair cuts) + } // end if (pair cuts) // assign hist directories for the MC matched pairs for each (track cut,MCsignal) combination if (!sigNamesStr.IsNull()) { @@ -1279,7 +1313,7 @@ struct AnalysisSameEventPairing { TString tempStr = objArray->At(icut)->GetName(); if (objArrayMuonCuts->FindObject(tempStr.Data()) != nullptr) { // update the filter mask - fMuonFilterMask |= (uint32_t(1) << icut); + fMuonFilterMask |= (static_cast(1) << icut); if (fEnableMuonHistos) { // assign pair hist directories for each required muon cut @@ -1302,7 +1336,7 @@ struct AnalysisSameEventPairing { fMuonHistNames[icut] = names; // if there are specified pair cuts, assign hist dirs for each muon cut - pair cut combination - TString cutNamesStr = fConfigPairCuts.value; + TString cutNamesStr = fConfigCuts.pair.value; if (!cutNamesStr.IsNull()) { // if pair cuts std::unique_ptr objArrayPair(cutNamesStr.Tokenize(",")); fNPairCuts = objArrayPair->GetEntries(); @@ -1314,7 +1348,7 @@ struct AnalysisSameEventPairing { histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fMuonHistNames[fNCutsMuon + icut * fNCutsMuon + iPairCut] = names; } // end loop (pair cuts) - } // end if (pair cuts) + } // end if (pair cuts) // assign hist directories for pairs matched to MC signals for each (muon cut, MCrec signal) combination if (!sigNamesStr.IsNull()) { @@ -1343,11 +1377,11 @@ struct AnalysisSameEventPairing { } } } // end loop over cuts - } // end if (muonCutsStr) + } // end if (muonCutsStr) // Add histogram classes for each specified MCsignal at the generator level // TODO: create a std::vector of hist classes to be used at Fill time, to avoid using Form in the process function - TString sigGenNamesStr = fConfigMCGenSignals.value; + TString sigGenNamesStr = fConfigMC.genSignals.value; std::unique_ptr objGenSigArray(sigGenNamesStr.Tokenize(",")); for (int isig = 0; isig < objGenSigArray->GetEntries(); isig++) { MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objGenSigArray->At(isig)->GetName()); @@ -1365,18 +1399,18 @@ struct AnalysisSameEventPairing { fCurrentRun = 0; - fCCDB->setURL(fConfigCcdbUrl.value); + fCCDB->setURL(fConfigCCDB.url.value); fCCDB->setCaching(true); fCCDB->setLocalObjectValidityChecking(); - if (fConfigNoCorr) { + if (fConfigOptions.noCorr) { VarManager::SetupFwdDCAFitterNoCorr(); - } else if (fConfigCorrFullGeo || (fConfigUseKFVertexing && fConfigPropToPCA)) { + } else if (fConfigOptions.corrFullGeo || (fConfigOptions.useKFVertexing && fConfigOptions.propToPCA)) { if (!o2::base::GeometryManager::isGeometryLoaded()) { - fCCDB->get(fConfigGeoPath); + fCCDB->get(fConfigCCDB.geoPath); } } else { - fLUT = o2::base::MatLayerCylSet::rectifyPtrFromFile(fCCDB->get(fConfigLutPath)); + fLUT = o2::base::MatLayerCylSet::rectifyPtrFromFile(fCCDB->get(fConfigCCDB.lutPath)); VarManager::SetupMatLUTFwdDCAFitter(fLUT); } @@ -1385,7 +1419,7 @@ struct AnalysisSameEventPairing { fHistMan->SetUseDefaultVariableNames(kTRUE); fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); - VarManager::SetCollisionSystem((TString)fConfigCollisionSystem, fConfigCenterMassEnergy); // set collision system and center of mass energy + VarManager::SetCollisionSystem((TString)fConfigOptions.collisionSystem, fConfigOptions.centerMassEnergy); // set collision system and center of mass energy DefineHistograms(fHistMan, histNames.Data(), fConfigAddSEPHistogram.value.data()); // define all histograms VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill @@ -1394,8 +1428,8 @@ struct AnalysisSameEventPairing { void initParamsFromCCDB(uint64_t timestamp, bool withTwoProngFitter = true) { - if (fConfigUseRemoteField.value) { - o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(fConfigGRPMagPath, timestamp); + if (fConfigOptions.useRemoteField.value) { + o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(fConfigCCDB.grpMagPath, timestamp); float magField = 0.0; if (grpmag != nullptr) { magField = grpmag->getNominalL3Field(); @@ -1403,25 +1437,25 @@ struct AnalysisSameEventPairing { LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", timestamp); } if (withTwoProngFitter) { - if (fConfigUseKFVertexing.value) { + if (fConfigOptions.useKFVertexing.value) { VarManager::SetupTwoProngKFParticle(magField); } else { - VarManager::SetupTwoProngDCAFitter(magField, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); // TODO: get these parameters from Configurables - VarManager::SetupTwoProngFwdDCAFitter(magField, true, 200.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); + VarManager::SetupTwoProngDCAFitter(magField, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); // TODO: get these parameters from Configurables + VarManager::SetupTwoProngFwdDCAFitter(magField, true, 200.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); } } else { - VarManager::SetupTwoProngDCAFitter(magField, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); // needed because take in varmanager Bz from fgFitterTwoProngBarrel for PhiV calculations + VarManager::SetupTwoProngDCAFitter(magField, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); // needed because take in varmanager Bz from fgFitterTwoProngBarrel for PhiV calculations } } else { if (withTwoProngFitter) { - if (fConfigUseKFVertexing.value) { - VarManager::SetupTwoProngKFParticle(fConfigMagField.value); + if (fConfigOptions.useKFVertexing.value) { + VarManager::SetupTwoProngKFParticle(fConfigOptions.magField.value); } else { - VarManager::SetupTwoProngDCAFitter(fConfigMagField.value, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); // TODO: get these parameters from Configurables - VarManager::SetupTwoProngFwdDCAFitter(fConfigMagField.value, true, 200.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); + VarManager::SetupTwoProngDCAFitter(fConfigOptions.magField.value, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); // TODO: get these parameters from Configurables + VarManager::SetupTwoProngFwdDCAFitter(fConfigOptions.magField.value, true, 200.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); } } else { - VarManager::SetupTwoProngDCAFitter(fConfigMagField.value, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); // needed because take in varmanager Bz from fgFitterTwoProngBarrel for PhiV calculations + VarManager::SetupTwoProngDCAFitter(fConfigOptions.magField.value, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); // needed because take in varmanager Bz from fgFitterTwoProngBarrel for PhiV calculations } } } @@ -1435,21 +1469,21 @@ struct AnalysisSameEventPairing { fCurrentRun = events.begin().runNumber(); } - TString cutNames = fConfigTrackCuts.value; + TString cutNames = fConfigCuts.track.value; std::map> histNames = fTrackHistNames; std::map> histNamesMC = fBarrelHistNamesMCmatched; int ncuts = fNCutsBarrel; if constexpr (TPairType == VarManager::kDecayToMuMu) { - cutNames = fConfigMuonCuts.value; + cutNames = fConfigCuts.muon.value; histNames = fMuonHistNames; histNamesMC = fMuonHistNamesMCmatched; ncuts = fNCutsMuon; } - uint32_t twoTrackFilter = 0; + uint32_t twoTrackFilter = static_cast(0); int sign1 = 0; int sign2 = 0; - uint32_t mcDecision = 0; + uint32_t mcDecision = static_cast(0); bool isCorrectAssoc_leg1 = false; bool isCorrectAssoc_leg2 = false; dielectronList.reserve(1); @@ -1458,7 +1492,7 @@ struct AnalysisSameEventPairing { dimuonsExtraList.reserve(1); dielectronInfoList.reserve(1); dileptonInfoList.reserve(1); - if (fConfigFlatTables.value) { + if (fConfigOptions.flatTables.value) { dimuonAllList.reserve(1); } constexpr bool eventHasQvector = ((TEventFillMap & VarManager::ObjTypes::ReducedEventQvector) > 0); @@ -1493,16 +1527,16 @@ struct AnalysisSameEventPairing { sign2 = t2.sign(); // store the ambiguity number of the two dilepton legs in the last 4 digits of the two-track filter if (t1.barrelAmbiguityInBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 28); + twoTrackFilter |= (static_cast(1) << 28); } if (t2.barrelAmbiguityInBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 29); + twoTrackFilter |= (static_cast(1) << 29); } if (t1.barrelAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 30); + twoTrackFilter |= (static_cast(1) << 30); } if (t2.barrelAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 31); + twoTrackFilter |= (static_cast(1) << 31); } // run MC matching for this pair @@ -1511,7 +1545,7 @@ struct AnalysisSameEventPairing { for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { if (t1.has_reducedMCTrack() && t2.has_reducedMCTrack()) { if ((*sig).CheckSignal(true, t1.reducedMCTrack(), t2.reducedMCTrack())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } // end loop over MC signals @@ -1525,12 +1559,12 @@ struct AnalysisSameEventPairing { VarManager::FillPairCollision(event, t1, t2); } if constexpr (TTwoProngFitter) { - VarManager::FillPairVertexing(event, t1, t2, fConfigPropToPCA); + VarManager::FillPairVertexing(event, t1, t2, fConfigOptions.propToPCA); } if constexpr (eventHasQvector) { VarManager::FillPairVn(t1, t2); } - if (!fConfigSkimSignalOnly || (fConfigSkimSignalOnly && mcDecision > 0)) { + if (!fConfigMC.skimSignalOnly || (fConfigMC.skimSignalOnly && mcDecision > 0)) { dielectronList(event.globalIndex(), VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), twoTrackFilter, mcDecision); @@ -1560,16 +1594,16 @@ struct AnalysisSameEventPairing { sign2 = t2.sign(); // store the ambiguity number of the two dilepton legs in the last 4 digits of the two-track filter if (t1.muonAmbiguityInBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 28); + twoTrackFilter |= (static_cast(1) << 28); } if (t2.muonAmbiguityInBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 29); + twoTrackFilter |= (static_cast(1) << 29); } if (t1.muonAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 30); + twoTrackFilter |= (static_cast(1) << 30); } if (t2.muonAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 31); + twoTrackFilter |= (static_cast(1) << 31); } // run MC matching for this pair @@ -1578,7 +1612,7 @@ struct AnalysisSameEventPairing { for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { if (t1.has_reducedMCTrack() && t2.has_reducedMCTrack()) { if ((*sig).CheckSignal(true, t1.reducedMCTrack(), t2.reducedMCTrack())) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } // end loop over MC signals @@ -1593,7 +1627,7 @@ struct AnalysisSameEventPairing { VarManager::FillPairCollision(event, t1, t2); } if constexpr (TTwoProngFitter) { - VarManager::FillPairVertexing(event, t1, t2, fConfigPropToPCA); + VarManager::FillPairVertexing(event, t1, t2, fConfigOptions.propToPCA); } if constexpr (eventHasQvector) { VarManager::FillPairVn(t1, t2); @@ -1608,7 +1642,7 @@ struct AnalysisSameEventPairing { if constexpr (TTwoProngFitter) { dimuonsExtraList(t1.globalIndex(), t2.globalIndex(), VarManager::fgValues[VarManager::kVertexingTauz], VarManager::fgValues[VarManager::kVertexingLz], VarManager::fgValues[VarManager::kVertexingLxy]); - if (fConfigFlatTables.value) { + if (fConfigOptions.flatTables.value) { dimuonAllList(event.posX(), event.posY(), event.posZ(), event.numContrib(), -999., -999., -999., VarManager::fgValues[VarManager::kMass], @@ -1628,7 +1662,7 @@ struct AnalysisSameEventPairing { -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., - (twoTrackFilter & (uint32_t(1) << 28)) || (twoTrackFilter & (uint32_t(1) << 30)), (twoTrackFilter & (uint32_t(1) << 29)) || (twoTrackFilter & (uint32_t(1) << 31)), + (twoTrackFilter & (static_cast(1) << 28)) || (twoTrackFilter & (static_cast(1) << 30)), (twoTrackFilter & (static_cast(1) << 29)) || (twoTrackFilter & (static_cast(1) << 31)), -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, VarManager::fgValues[VarManager::kMultDimuons], @@ -1641,21 +1675,17 @@ struct AnalysisSameEventPairing { twoTrackFilter = a1.isBarrelSelected_raw() & a1.isBarrelSelectedPrefilter_raw() & a2.isMuonSelected_raw() & fTwoTrackFilterMask; }*/ - if constexpr (eventHasQvector) { - dileptonFlowList(VarManager::fgValues[VarManager::kU2Q2], VarManager::fgValues[VarManager::kU3Q3], VarManager::fgValues[VarManager::kCos2DeltaPhi], VarManager::fgValues[VarManager::kCos3DeltaPhi]); - } - // Fill histograms bool isAmbiInBunch = false; bool isAmbiOutOfBunch = false; for (int icut = 0; icut < ncuts; icut++) { - if (twoTrackFilter & (uint32_t(1) << icut)) { - isAmbiInBunch = (twoTrackFilter & (uint32_t(1) << 28)) || (twoTrackFilter & (uint32_t(1) << 29)); - isAmbiOutOfBunch = (twoTrackFilter & (uint32_t(1) << 30)) || (twoTrackFilter & (uint32_t(1) << 31)); + if (twoTrackFilter & (static_cast(1) << icut)) { + isAmbiInBunch = (twoTrackFilter & (static_cast(1) << 28)) || (twoTrackFilter & (static_cast(1) << 29)); + isAmbiOutOfBunch = (twoTrackFilter & (static_cast(1) << 30)) || (twoTrackFilter & (static_cast(1) << 31)); if (sign1 * sign2 < 0) { // +- pairs fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); // reconstructed, unmatched for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals - if (mcDecision & (uint32_t(1) << isig)) { + if (mcDecision & (static_cast(1) << isig)) { fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][0].Data(), VarManager::fgValues); // matched signal if (fConfigQA) { if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { // correct track-collision association @@ -1694,7 +1724,7 @@ struct AnalysisSameEventPairing { if (sign1 > 0) { // ++ pairs fHistMan->FillHistClass(histNames[icut][1].Data(), VarManager::fgValues); for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals - if (mcDecision & (uint32_t(1) << isig)) { + if (mcDecision & (static_cast(1) << isig)) { fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][1].Data(), VarManager::fgValues); } } @@ -1709,7 +1739,7 @@ struct AnalysisSameEventPairing { } else { // -- pairs fHistMan->FillHistClass(histNames[icut][2].Data(), VarManager::fgValues); for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals - if (mcDecision & (uint32_t(1) << isig)) { + if (mcDecision & (static_cast(1) << isig)) { fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][2].Data(), VarManager::fgValues); } } @@ -1739,8 +1769,8 @@ struct AnalysisSameEventPairing { } // end loop (pair cuts) } } // end loop (cuts) - } // end loop over pairs of track associations - } // end loop over events + } // end loop over pairs of track associations + } // end loop over events } // Preslice perReducedMcEvent = aod::reducedtrackMC::reducedMCeventId; @@ -1789,8 +1819,8 @@ struct AnalysisSameEventPairing { fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig.GetName()), VarManager::fgValues); } } // end loop over MC signals - } // end loop over pairs - } // end loop over events + } // end loop over pairs + } // end loop over events } } // end runMCGen @@ -1801,8 +1831,9 @@ struct AnalysisSameEventPairing { { runSameEventPairing(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, mcEvents, mcTracks); runSameEventPairing(events, muonAssocsPerCollision, muonAssocs, muons, mcEvents, mcTracks); - if (fConfigRunMCGenPair) + if (fConfigMC.runMCGenPair) { runMCGen(mcEvents, mcTracks); + } // runSameEventPairing(event, tracks, muons); } @@ -1811,8 +1842,9 @@ struct AnalysisSameEventPairing { MyBarrelTracksWithCovWithAmbiguities const& barrelTracks, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { runSameEventPairing(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, mcEvents, mcTracks); - if (fConfigRunMCGenPair) + if (fConfigMC.runMCGenPair) { runMCGen(mcEvents, mcTracks); + } } void processBarrelOnlyWithCollSkimmed(MyEventsVtxCovSelected const& events, @@ -1820,16 +1852,18 @@ struct AnalysisSameEventPairing { MyBarrelTracksWithCovWithAmbiguitiesWithColl const& barrelTracks, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { runSameEventPairing(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, mcEvents, mcTracks); - if (fConfigRunMCGenPair) + if (fConfigMC.runMCGenPair) { runMCGen(mcEvents, mcTracks); + } } void processMuonOnlySkimmed(MyEventsVtxCovSelected const& events, soa::Join const& muonAssocs, MyMuonTracksWithCovWithAmbiguities const& muons, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { runSameEventPairing(events, muonAssocsPerCollision, muonAssocs, muons, mcEvents, mcTracks); - if (fConfigRunMCGenPair) + if (fConfigMC.runMCGenPair) { runMCGen(mcEvents, mcTracks); + } } void processDummy(MyEvents&) @@ -1878,10 +1912,10 @@ struct AnalysisDileptonTrack { Service fCCDB; // TODO: The filter expressions seem to always use the default value of configurables, not the values from the actual configuration file - Filter eventFilter = aod::dqanalysisflags::isEventSelected > uint32_t(0); + Filter eventFilter = aod::dqanalysisflags::isEventSelected > static_cast(0); Filter dileptonFilter = aod::reducedpair::pt > fConfigDileptonpTCut&& aod::reducedpair::mass > fConfigDileptonLowMass&& aod::reducedpair::mass fConfigDileptonLxyCut; - Filter filterBarrel = aod::dqanalysisflags::isBarrelSelected > uint32_t(0); - Filter filterMuon = aod::dqanalysisflags::isMuonSelected > uint32_t(0); + Filter filterBarrel = aod::dqanalysisflags::isBarrelSelected > static_cast(0); + Filter filterMuon = aod::dqanalysisflags::isMuonSelected > static_cast(0); constexpr static uint32_t fgDileptonFillMap = VarManager::ObjTypes::ReducedTrack | VarManager::ObjTypes::Pair; // fill map @@ -1954,6 +1988,12 @@ struct AnalysisDileptonTrack { if (objArraySingleCuts->FindObject(fConfigTrackCut.value.data()) == nullptr) { LOG(fatal) << " Track cut chosen for the correlation task was not computed in the single-track task! Check it out!"; } + for (int icut = 0; icut < objArraySingleCuts->GetEntries(); ++icut) { + TString tempStr = objArraySingleCuts->At(icut)->GetName(); + if (tempStr.CompareTo(fConfigTrackCut.value.data()) == 0) { + fTrackCutBit = icut; // the bit corresponding to the track to be combined with dileptons + } + } // get the cuts employed for same-event pairing string tempCutsPair; if (isBarrel) { @@ -1965,23 +2005,21 @@ struct AnalysisDileptonTrack { if (!tempCutsSingleStr.IsNull() && !tempCutsPairStr.IsNull()) { std::unique_ptr objArray(tempCutsPairStr.Tokenize(",")); fNCuts = objArray->GetEntries(); - for (int icut = 0; icut < objArraySingleCuts->GetEntries(); ++icut) { - TString tempStr = objArraySingleCuts->At(icut)->GetName(); + for (int icut = 0; icut < objArray->GetEntries(); ++icut) { + TString tempStr = objArray->At(icut)->GetName(); if (objArray->FindObject(tempStr.Data()) != nullptr) { fHistNamesDileptonTrack[icut] = Form("DileptonTrack_%s_%s", tempStr.Data(), fConfigTrackCut.value.data()); fHistNamesDileptons[icut] = Form("DileptonsSelected_%s", tempStr.Data()); DefineHistograms(fHistMan, fHistNamesDileptonTrack[icut], fConfigHistogramSubgroups.value.data()); // define dilepton-track histograms DefineHistograms(fHistMan, fHistNamesDileptons[icut], "barrel,vertexing"); // define dilepton histograms std::vector mcHistNames; + for (auto& sig : fRecMCSignals) { mcHistNames.push_back(Form("DileptonTrackMCMatched_%s_%s_%s", tempStr.Data(), fConfigTrackCut.value.data(), sig.GetName())); - DefineHistograms(fHistMan, mcHistNames[mcHistNames.size() - 1], ""); + DefineHistograms(fHistMan, mcHistNames[mcHistNames.size() - 1], fConfigHistogramSubgroups.value.data()); } fHistNamesDileptonTrackMCmatched[icut] = mcHistNames; } - if (tempStr.CompareTo(fConfigTrackCut.value.data()) == 0) { - fTrackCutBit = icut; // the bit corresponding to the track to be combined with dileptons - } } } // Add histogram classes for each specified MCsignal at the generator level @@ -2043,7 +2081,7 @@ struct AnalysisDileptonTrack { VarManager::FillEvent(event, fValuesDilepton); VarManager::FillEvent(event.reducedMCevent(), fValuesDilepton); - uint32_t mcDecision = 0; + uint32_t mcDecision = static_cast(0); size_t isig = 0; for (auto dilepton : dileptons) { @@ -2082,7 +2120,7 @@ struct AnalysisDileptonTrack { isig = 0; for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { if ((*sig).CheckSignal(true, lepton1MC, lepton2MC, trackMC)) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } @@ -2103,7 +2141,7 @@ struct AnalysisDileptonTrack { isig = 0; for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { if ((*sig).CheckSignal(true, lepton1MC, lepton2MC, trackMC)) { - mcDecision |= (uint32_t(1) << isig); + mcDecision |= (static_cast(1) << isig); } } } @@ -2112,7 +2150,7 @@ struct AnalysisDileptonTrack { if (dilepton.filterMap_bit(icut)) { fHistMan->FillHistClass(fHistNamesDileptonTrack[icut].Data(), fValuesHadron); for (isig = 0; isig < fRecMCSignals.size(); isig++) { - if (mcDecision & (uint32_t(1) << isig)) { + if (mcDecision & (static_cast(1) << isig)) { // TODO: check also whether the collision association is correct (add dedicated histogram dirs) fHistMan->FillHistClass(fHistNamesDileptonTrackMCmatched[icut][isig], fValuesHadron); } @@ -2120,7 +2158,7 @@ struct AnalysisDileptonTrack { } } // table to be written out for ML analysis - BmesonsTable(fValuesHadron[VarManager::kPairMass], fValuesHadron[VarManager::kPairPt], fValuesHadron[VarManager::kVertexingLxy], fValuesHadron[VarManager::kVertexingLxyz], fValuesHadron[VarManager::kVertexingLz], fValuesHadron[VarManager::kVertexingTauxy], fValuesHadron[VarManager::kVertexingTauz], fValuesHadron[VarManager::kCosPointingAngle], fValuesHadron[VarManager::kVertexingChi2PCA]); + BmesonsTable(fValuesHadron[VarManager::kPairMass], fValuesHadron[VarManager::kPairPt], fValuesHadron[VarManager::kVertexingLxy], fValuesHadron[VarManager::kVertexingLxyz], fValuesHadron[VarManager::kVertexingLz], fValuesHadron[VarManager::kVertexingTauxy], fValuesHadron[VarManager::kVertexingTauz], fValuesHadron[VarManager::kKFDCAxyzBetweenProngs], fValuesHadron[VarManager::kCosPointingAngle], fValuesHadron[VarManager::kVertexingChi2PCA], mcDecision); } } // end loop over dileptons } @@ -2254,7 +2292,7 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses, const char dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "postcalib_proton"); } if (classStr.Contains("Ambiguity")) { - dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", Form("%s,ambiguity", histName.Data())); + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "ambiguity"); } } } diff --git a/PWGDQ/Tasks/dqFlow.cxx b/PWGDQ/Tasks/dqFlow.cxx index 36293babf41..b29efd014b8 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -117,7 +117,7 @@ struct DQEventQvector { Configurable fConfigCutTPCNClMin{"cfgCutTPCNclMin", 0, "Min requirement for number of TPC clusters"}; Configurable fConfigEtaLimitMin{"cfgEtaLimitMin", -0.4f, "Eta gap min separation, only if using subEvents"}; Configurable fConfigEtaLimitMax{"cfgEtaLimitMax", 0.4f, "Eta gap max separation, only if using subEvents"}; - // Configurable fConfigNPow{"cfgNPow", 0, "Power of weights for Q vector"}; + // Configurable fConfigNPow{"cfgNPow", 0, "Power of weights for Q vector"}; // Configurable cfgGFWBinning{"cfgGFWBinning", {40, 16, 72, 300, 0, 3000, 0.2, 10.0, 0.2, 3.0, {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}, {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}}, "Configuration for binning"}; // Access to the efficiencies and acceptances from CCDB diff --git a/PWGDQ/Tasks/filterPPwithAssociation.cxx b/PWGDQ/Tasks/filterPPwithAssociation.cxx index 4f92cf7cc90..d2d374b06ef 100644 --- a/PWGDQ/Tasks/filterPPwithAssociation.cxx +++ b/PWGDQ/Tasks/filterPPwithAssociation.cxx @@ -13,6 +13,8 @@ // #include #include +#include +#include #include #include #include @@ -68,6 +70,7 @@ enum DQTriggers { kSingleMuLow, kSingleMuHigh, kDiMuon, + // kElectronMuon, // the ElectronMuon trigger is not available now kNTriggersDQ }; } // namespace @@ -78,6 +81,8 @@ namespace dqppfilter DECLARE_SOA_COLUMN(IsDQEventSelected, isDQEventSelected, int); DECLARE_SOA_COLUMN(IsDQBarrelSelected, isDQBarrelSelected, uint32_t); DECLARE_SOA_COLUMN(IsDQMuonSelected, isDQMuonSelected, uint32_t); +DECLARE_SOA_COLUMN(IsDQEMuBarrelSelected, isDQEMuBarrelSelected, uint32_t); // for electron-muon pair +DECLARE_SOA_COLUMN(IsDQEMuMuonSelected, isDQEMuMuonSelected, uint32_t); // for electron-muon pair DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! Collision index DECLARE_SOA_INDEX_COLUMN(Track, track); //! Track index DECLARE_SOA_INDEX_COLUMN(FwdTrack, fwdtrack); //! FwdTrack index @@ -86,6 +91,8 @@ DECLARE_SOA_INDEX_COLUMN(FwdTrack, fwdtrack); //! FwdTrack index DECLARE_SOA_TABLE(DQEventCuts, "AOD", "DQEVENTCUTS", dqppfilter::IsDQEventSelected); DECLARE_SOA_TABLE(DQBarrelTrackCuts, "AOD", "DQBARRELCUTS", dqppfilter::IsDQBarrelSelected); DECLARE_SOA_TABLE(DQMuonsCuts, "AOD", "DQMUONCUTS", dqppfilter::IsDQMuonSelected); +DECLARE_SOA_TABLE(DQEMuBarrelTrackCuts, "AOD", "DQEMUBARRELCUTS", dqppfilter::IsDQEMuBarrelSelected); // for electron-muon pair +DECLARE_SOA_TABLE(DQEMuMuonsCuts, "AOD", "DQEMUMUONCUTS", dqppfilter::IsDQEMuMuonSelected); // for electron-muon pair } // namespace o2::aod using MyEvents = soa::Join; @@ -103,10 +110,10 @@ using MyBarrelTracksSelected = soa::Join; -using MyBarrelTracksAssocSelected = soa::Join; // As the kinelatic values must be re-computed for the tracks everytime it is associated to a collision, the selection is done not on the tracks, but on the track-collision association +using MyBarrelTracksAssocSelected = soa::Join; // As the kinelatic values must be re-computed for the tracks everytime it is associated to a collision, the selection is done not on the tracks, but on the track-collision association using MyMuons = soa::Join; -using MyMuonsAssocSelected = soa::Join; // As the kinelatic values must be re-computed for the muons tracks everytime it is associated to a collision, the selection is done not on the muon, but on the muon-collision association +using MyMuonsAssocSelected = soa::Join; // As the kinelatic values must be re-computed for the muons tracks everytime it is associated to a collision, the selection is done not on the muon, but on the muon-collision association constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; constexpr static uint32_t gkTrackFillMap = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackPID; @@ -185,10 +192,12 @@ struct DQEventSelectionTask { struct DQBarrelTrackSelection { Produces trackSel; + Produces emuSel; OutputObj fOutputList{"output"}; HistogramManager* fHistMan; Configurable fConfigCuts{"cfgBarrelTrackCuts", "jpsiPID1", "Comma separated list of barrel track cuts"}; + Configurable fConfigCutsForEMu{"cfgBarrelTrackCutsForEMu", "jpsiPID1", "Comma separated list of barrel track cuts"}; Configurable fConfigQA{"cfgWithQA", false, "If true, fill QA histograms"}; Configurable fPropTrack{"cfgPropTrack", false, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -201,6 +210,7 @@ struct DQBarrelTrackSelection { Preslice barrelTrackIndicesPerCollision = aod::track_association::collisionId; std::vector fTrackCuts; + std::vector fEMuTrackCuts; std::vector fCutHistNames; int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. @@ -208,6 +218,7 @@ struct DQBarrelTrackSelection { void init(o2::framework::InitContext&) { TString cutNamesStr = fConfigCuts.value; + TString cutEMuNamesStr = fConfigCutsForEMu.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { @@ -219,6 +230,17 @@ struct DQBarrelTrackSelection { } } } + if (!cutEMuNamesStr.IsNull()) { + std::unique_ptr objArray2(cutEMuNamesStr.Tokenize(",")); + for (int icut = 0; icut < objArray2->GetEntries(); ++icut) { + AnalysisCompositeCut* cut2 = dqcuts::GetCompositeCut(objArray2->At(icut)->GetName()); + if (cut2) { + fEMuTrackCuts.push_back(*cut2); + } else { + LOGF(fatal, "Invalid e-mu cut provided: %s", objArray2->At(icut)->GetName()); + } + } + } VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill if (fConfigQA) { @@ -272,12 +294,15 @@ struct DQBarrelTrackSelection { // o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - uint32_t filterMap = uint32_t(0); + uint32_t filterMap = static_cast(0); + uint32_t filterMapEMu = static_cast(0); trackSel.reserve(tracksBarrel.size()); + emuSel.reserve(tracksBarrel.size()); VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); for (auto& trackAssoc : trackAssocs) { - filterMap = uint32_t(0); + filterMap = static_cast(0); + filterMapEMu = static_cast(0); auto track = trackAssoc.template track_as(); @@ -292,13 +317,20 @@ struct DQBarrelTrackSelection { int i = 0; for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); ++cut, ++i) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << i); + filterMap |= (static_cast(1) << i); if (fConfigQA) { fHistMan->FillHistClass(fCutHistNames[i].Data(), VarManager::fgValues); } } } + int j = 0; + for (auto cut = fEMuTrackCuts.begin(); cut != fEMuTrackCuts.end(); ++cut, ++j) { + if ((*cut).IsSelected(VarManager::fgValues)) { + filterMapEMu |= (static_cast(1) << j); + } + } trackSel(filterMap); + emuSel(filterMapEMu); } // end loop over tracks } @@ -321,10 +353,12 @@ struct DQBarrelTrackSelection { struct DQMuonsSelection { Produces trackSel; + Produces emuSel; OutputObj fOutputList{"output"}; HistogramManager* fHistMan; Configurable fConfigCuts{"cfgMuonsCuts", "muonQualityCuts", "Comma separated list of ADDITIONAL muon track cuts"}; + Configurable fConfigCutsForEMu{"cfgMuonsCutsForEMu", "muonQualityCuts", "Comma separated list of ADDITIONAL muon track cuts"}; Configurable fConfigQA{"cfgWithQA", false, "If true, fill QA histograms"}; Configurable fPropMuon{"cfgPropMuon", false, "Propgate muon tracks through absorber"}; Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -341,6 +375,7 @@ struct DQMuonsSelection { // TODO: configure the histogram classes to be filled by QA std::vector fTrackCuts; + std::vector fEMuTrackCuts; std::vector fCutHistNames; void init(o2::framework::InitContext&) @@ -355,12 +390,19 @@ struct DQMuonsSelection { } TString cutNamesStr = fConfigCuts.value; + TString cutEMuNamesStr = fConfigCutsForEMu.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { fTrackCuts.push_back(*dqcuts::GetCompositeCut(objArray->At(icut)->GetName())); } } + if (!cutEMuNamesStr.IsNull()) { + std::unique_ptr objArray2(cutEMuNamesStr.Tokenize(",")); + for (int icut = 0; icut < objArray2->GetEntries(); ++icut) { + fEMuTrackCuts.push_back(*dqcuts::GetCompositeCut(objArray2->At(icut)->GetName())); + } + } VarManager::SetUseVars(AnalysisCut::fgUsedVars); if (fConfigQA) { @@ -396,13 +438,16 @@ struct DQMuonsSelection { } } - uint32_t filterMap = uint32_t(0); + uint32_t filterMap = static_cast(0); + uint32_t filterMapEMu = static_cast(0); trackSel.reserve(muons.size()); + emuSel.reserve(muons.size()); VarManager::ResetValues(0, VarManager::kNMuonTrackVariables); for (auto& muonAssoc : muonAssocs) { - filterMap = uint32_t(0); + filterMap = static_cast(0); + filterMapEMu = static_cast(0); auto muon = muonAssoc.template fwdtrack_as(); VarManager::FillTrack(muon); if (fPropMuon) { @@ -414,13 +459,20 @@ struct DQMuonsSelection { int i = 0; for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); ++cut, ++i) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << i); + filterMap |= (static_cast(1) << i); if (fConfigQA) { fHistMan->FillHistClass(fCutHistNames[i].Data(), VarManager::fgValues); } } } + int j = 0; + for (auto cut = fEMuTrackCuts.begin(); cut != fEMuTrackCuts.end(); ++cut, ++j) { + if ((*cut).IsSelected(VarManager::fgValues)) { + filterMapEMu |= (static_cast(1) << j); + } + } trackSel(filterMap); + emuSel(filterMapEMu); } // end loop over muons } @@ -510,10 +562,11 @@ struct DQFilterPPTask { Configurable fConfigBarrelSelections{"cfgBarrelSels", "jpsiPID1:pairMassLow:1", ":[]:,[:[]:],..."}; Configurable fConfigMuonSelections{"cfgMuonSels", "muonQualityCuts:pairNoCut:1", ":[]:"}; + Configurable fConfigElectronMuonSelections{"cfgElectronMuonSels", "jpsiPID1:muonQualityCuts:pairNoCut:1", "::[]:"}; Configurable fConfigQA{"cfgWithQA", false, "If true, fill QA histograms"}; Configurable fConfigFilterLsBarrelTracksPairs{"cfgWithBarrelLS", "false", "Comma separated list of booleans for each trigger, If true, also select like sign (--/++) barrel track pairs"}; Configurable fConfigFilterLsMuonsPairs{"cfgWithMuonLS", "false", "Comma separated list of booleans for each trigger, If true, also select like sign (--/++) muon pairs"}; - + Configurable fConfigFilterLsElectronMuonsPairs{"cfgWithElectronMuonLS", "false", "Comma separated list of booleans for each trigger, If true, also select like sign (--/++) muon pairs"}; Configurable fPropMuon{"cfgPropMuon", false, "Propgate muon tracks through absorber"}; Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; @@ -526,14 +579,19 @@ struct DQFilterPPTask { int fNBarrelCuts; // number of barrel selections int fNMuonCuts; // number of muon selections + int fNElectronMuonCuts; // number of electron-muon selections std::vector fBarrelRunPairing; // bit map on whether the selections require pairing (barrel) std::vector fMuonRunPairing; // bit map on whether the selections require pairing (muon) + std::vector fElectronMuonRunPairing; // bit map on whether the selections require pairing (e-mu) std::vector fBarrelNreqObjs; // minimal number of tracks/pairs required (barrel) std::vector fMuonNreqObjs; // minimal number of tracks/pairs required (muon) + std::vector fElectronMuonNreqObjs; // minimal number of electron-muon pairs required std::map fBarrelPairCuts; // map of barrel pair cuts std::map fMuonPairCuts; // map of muon pair cuts + std::map fElectronMuonPairCuts; // map of electron-muon pair cuts std::map fBarrelPairHistNames; // map with names of the barrel pairing histogram directories std::map fMuonPairHistNames; // map with names of the muon pairing histogram directories + std::map fElectronMuonPairHistNames; // map with names of the electron-muon pairing histogram directories std::map fFiltersMap; // map of filters for events that passed at least one filter std::map> fCEFPfilters; // map of CEFP filters for events that passed at least one filter @@ -584,10 +642,32 @@ struct DQFilterPPTask { } } } + // electron-muon pair + TString electronMuonSelsStr = fConfigElectronMuonSelections.value; + std::unique_ptr objArray3(electronMuonSelsStr.Tokenize(",")); + fNElectronMuonCuts = objArray3->GetEntries(); + if (fNElectronMuonCuts) { + for (int icut = 0; icut < fNElectronMuonCuts; ++icut) { + TString selStr = objArray3->At(icut)->GetName(); + std::unique_ptr sel(selStr.Tokenize(":")); + if (sel->GetEntries() < 3 || sel->GetEntries() > 4) { + continue; + } + if (sel->GetEntries() == 4) { + fElectronMuonPairCuts[icut] = (*dqcuts::GetCompositeCut(sel->At(2)->GetName())); + fElectronMuonRunPairing.push_back(true); + fElectronMuonNreqObjs.push_back(std::atoi(sel->At(3)->GetName())); + fElectronMuonPairHistNames[icut] = Form("PairsElectronMuonSEPM_%s_%s_%s", sel->At(0)->GetName(), sel->At(1)->GetName(), sel->At(2)->GetName()); + } else { + fElectronMuonNreqObjs.push_back(std::atoi(sel->At(2)->GetName())); + fElectronMuonRunPairing.push_back(false); + } + } + } VarManager::SetUseVars(AnalysisCut::fgUsedVars); // setup the Stats histogram - fStats.setObject(new TH1D("Statistics", "Stats for DQ triggers", fNBarrelCuts + fNMuonCuts + 2, -2.5, -0.5 + fNBarrelCuts + fNMuonCuts)); + fStats.setObject(new TH1D("Statistics", "Stats for DQ triggers", fNBarrelCuts + fNMuonCuts + fNElectronMuonCuts + 2, -2.5, -0.5 + fNBarrelCuts + fNMuonCuts + fNElectronMuonCuts)); fStats->GetXaxis()->SetBinLabel(1, "Events inspected"); fStats->GetXaxis()->SetBinLabel(2, "Events selected"); if (fNBarrelCuts) { @@ -600,6 +680,11 @@ struct DQFilterPPTask { fStats->GetXaxis()->SetBinLabel(ib, objArray2->At(ib - 3 - fNBarrelCuts)->GetName()); } } + if (fNElectronMuonCuts) { + for (int ib = 3 + fNBarrelCuts + fNMuonCuts; ib < 3 + fNBarrelCuts + fNMuonCuts + fNElectronMuonCuts; ib++) { + fStats->GetXaxis()->SetBinLabel(ib, objArray3->At(ib - 3 - fNBarrelCuts - fNMuonCuts)->GetName()); + } + } } void init(o2::framework::InitContext&) @@ -629,6 +714,10 @@ struct DQFilterPPTask { histNames += value; histNames += ";"; } + for (const auto& [key, value] : fElectronMuonPairHistNames) { + histNames += value; + histNames += ";"; + } DefineHistograms(fHistMan, histNames.Data()); VarManager::SetUseVars(fHistMan->GetUsedVars()); fOutputList.setObject(fHistMan->GetMainHistogramList()); @@ -661,7 +750,7 @@ struct DQFilterPPTask { // count the number of barrel tracks fulfilling each cut for (auto trackAssoc : barrelAssocs) { for (int i = 0; i < fNBarrelCuts; ++i) { - if (trackAssoc.isDQBarrelSelected() & (uint32_t(1) << i)) { + if (trackAssoc.isDQBarrelSelected() & (static_cast(1) << i)) { objCountersBarrel[i] += 1; } } @@ -672,7 +761,7 @@ struct DQFilterPPTask { for (int i = 0; i < fNBarrelCuts; i++) { if (fBarrelRunPairing[i]) { if (objCountersBarrel[i] > 1) { // pairing has to be enabled and at least two tracks are needed - pairingMask |= (uint32_t(1) << i); + pairingMask |= (static_cast(1) << i); } objCountersBarrel[i] = 0; // reset counters for selections where pairing is needed (count pairs instead) } @@ -685,7 +774,7 @@ struct DQFilterPPTask { for (int icut = 0; icut < fNBarrelCuts; icut++) { TString objStr = objArrayLS->At(icut)->GetName(); if (!objStr.CompareTo("true")) { - pairingLS |= (uint32_t(1) << icut); + pairingLS |= (static_cast(1) << icut); } } @@ -708,13 +797,13 @@ struct DQFilterPPTask { VarManager::FillPair(t1, t2); // compute pair quantities for (int icut = 0; icut < fNBarrelCuts; icut++) { // select like-sign pairs if trigger has set boolean true within fConfigFilterLsBarrelTracksPairs - if (!(pairingLS & (uint32_t(1) << icut))) { + if (!(pairingLS & (static_cast(1) << icut))) { if (t1.sign() * t2.sign() > 0) { continue; } } - if (!(pairFilter & (uint32_t(1) << icut))) { + if (!(pairFilter & (static_cast(1) << icut))) { continue; } if (!fBarrelPairCuts[icut].IsSelected(VarManager::fgValues)) { @@ -732,7 +821,7 @@ struct DQFilterPPTask { // count the number of muon-collision associations fulfilling each selection for (auto muon : muonAssocs) { for (int i = 0; i < fNMuonCuts; ++i) { - if (muon.isDQMuonSelected() & (uint32_t(1) << i)) { + if (muon.isDQMuonSelected() & (static_cast(1) << i)) { objCountersMuon[i] += 1; } } @@ -743,7 +832,7 @@ struct DQFilterPPTask { for (int i = 0; i < fNMuonCuts; i++) { if (fMuonRunPairing[i]) { // pairing has to be enabled and at least two tracks are needed if (objCountersMuon[i] > 1) { - pairingMask |= (uint32_t(1) << i); + pairingMask |= (static_cast(1) << i); } objCountersMuon[i] = 0; // reset counters for selections where pairing is needed (count pairs instead) } @@ -756,7 +845,7 @@ struct DQFilterPPTask { for (int icut = 0; icut < fNMuonCuts; icut++) { TString objStr = objArrayMuonLS->At(icut)->GetName(); if (!objStr.CompareTo("true")) { - pairingLS |= (uint32_t(1) << icut); + pairingLS |= (static_cast(1) << icut); } } @@ -783,12 +872,12 @@ struct DQFilterPPTask { } for (int icut = 0; icut < fNMuonCuts; icut++) { // select like-sign pairs if trigger has set boolean true within fConfigFilterLsMuonsPairs - if (!(pairingLS & (uint32_t(1) << icut))) { + if (!(pairingLS & (static_cast(1) << icut))) { if (t1.sign() * t2.sign() > 0) { continue; } } - if (!(pairFilter & (uint32_t(1) << icut))) { + if (!(pairFilter & (static_cast(1) << icut))) { continue; } if (!fMuonPairCuts[icut].IsSelected(VarManager::fgValues)) { @@ -802,16 +891,79 @@ struct DQFilterPPTask { } } + // electron-muon pair + std::vector objCountersElectronMuon(fNElectronMuonCuts, 0); // init all counters to zero + pairingMask = 0; + for (auto& [trackAssoc, muon] : combinations(barrelAssocs, muonAssocs)) { + for (int i = 0; i < fNElectronMuonCuts; ++i) { + if (trackAssoc.isDQEMuBarrelSelected() & muon.isDQEMuMuonSelected() & (static_cast(1) << i)) { + if (fElectronMuonRunPairing[i]) { + pairingMask |= (static_cast(1) << i); + } + } + } + } + // check which selection should use like sign (LS) (--/++) muon track pairs + pairingLS = 0; // reset the decisions for electron-muons + TString electronMuonLSstr = fConfigFilterLsElectronMuonsPairs.value; + std::unique_ptr objArrayElectronMuonLS(electronMuonLSstr.Tokenize(",")); + for (int icut = 0; icut < fNElectronMuonCuts; icut++) { + TString objStr = objArrayElectronMuonLS->At(icut)->GetName(); + if (!objStr.CompareTo("true")) { + pairingLS |= (static_cast(1) << icut); + } + } + + // run pairing if there is at least one selection that requires it + pairFilter = 0; + if (pairingMask > 0) { + // pairing is done using the collision grouped electron and muon associations + for (auto& [a1, a2] : combinations(barrelAssocs, muonAssocs)) { + // check the pairing mask and that the tracks share a cut bit + pairFilter = pairingMask & a1.isDQEMuBarrelSelected() & a2.isDQEMuMuonSelected(); + if (pairFilter == 0) { + continue; + } + // get the real electron and muon tracks + auto t1 = a1.template track_as(); + auto t2 = a2.template fwdtrack_as(); + // construct the pair and apply cuts + VarManager::FillPair(t1, t2); // compute pair quantities + for (int icut = 0; icut < fNElectronMuonCuts; icut++) { + // select like-sign pairs if trigger has set boolean true within fConfigFilterLsElectronMuonsPairs + if (!(pairingLS & (static_cast(1) << icut))) { + if (t1.sign() * t2.sign() > 0) { + continue; + } + } + if (!(pairFilter & (static_cast(1) << icut))) { + continue; + } + if (!fElectronMuonPairCuts[icut].IsSelected(VarManager::fgValues)) { + continue; + } + objCountersElectronMuon[icut] += 1; + if (fConfigQA) { + fHistMan->FillHistClass(fElectronMuonPairHistNames[icut].Data(), VarManager::fgValues); + } + } + } + } // compute the decisions and publish uint64_t filter = 0; for (int i = 0; i < fNBarrelCuts; i++) { if (objCountersBarrel[i] >= fBarrelNreqObjs[i]) { - filter |= (uint64_t(1) << i); + filter |= (static_cast(1) << i); } } for (int i = 0; i < fNMuonCuts; i++) { if (objCountersMuon[i] >= fMuonNreqObjs[i]) { - filter |= (uint64_t(1) << (i + fNBarrelCuts)); + filter |= (static_cast(1) << (i + fNBarrelCuts)); + } + } + for (int i = 0; i < fNElectronMuonCuts; i++) { + if (objCountersElectronMuon[i] >= fElectronMuonNreqObjs[i]) { + filter |= (static_cast(1) << (i + fNBarrelCuts + fNMuonCuts)); } } return filter; @@ -833,13 +985,12 @@ struct DQFilterPPTask { uint64_t barrelMask = 0; for (int i = 0; i < fNBarrelCuts; i++) { - barrelMask |= (uint64_t(1) << i); + barrelMask |= (static_cast(1) << i); } uint64_t muonMask = 0; for (int i = fNBarrelCuts; i < fNBarrelCuts + fNMuonCuts; i++) { - muonMask |= (uint64_t(1) << i); + muonMask |= (static_cast(1) << i); } - // Loop over collisions // int event = 0; int eventsFired = 0; @@ -866,20 +1017,29 @@ struct DQFilterPPTask { // compute the CEPF decisions (this is done in a spacial setup with exactly kNTriggersDQ configured triggers) std::vector decisions(kNTriggersDQ, false); // event decisions to be transmitted to CEFP for (int i = 0; i < fNBarrelCuts; i++) { - if (filter & (uint64_t(1) << i)) { + if (filter & (static_cast(1) << i)) { if (i < kNTriggersDQ) { decisions[i] = true; } } } for (int i = fNBarrelCuts; i < fNBarrelCuts + fNMuonCuts; i++) { - if (filter & (uint64_t(1) << i)) { + if (filter & (static_cast(1) << i)) { if (i < kNTriggersDQ) { decisions[i] = true; } } } - + // the ElectronMuon trigger is not available now + /* + for (int i = fNBarrelCuts + fNMuonCuts; i < fNBarrelCuts + fNMuonCuts + fNElectronMuonCuts; i++) { + if (filter & (static_cast(1) << i)) { + if (i < kNTriggersDQ) { + decisions[i] = true; + } + } + } + */ // if this collision fired at least one input, add it to the map, or if it is there already, update the decisions with a logical OR // This may happen in the case when some collisions beyond the iterator are added because they contain ambiguous tracks fired on by another collision if (fFiltersMap.find(collision.globalIndex()) == fFiltersMap.end()) { @@ -961,6 +1121,7 @@ struct DQFilterPPTask { if (!collision.isDQEventSelected()) { eventFilter(0); dqtable(false, false, false, false, false, false, false); + // dqtable(false, false, false, false, false, false, false, false); // the ElectronMuon trigger is not available now continue; } fStats->Fill(-1.0); @@ -968,15 +1129,17 @@ struct DQFilterPPTask { if (fFiltersMap.find(collision.globalIndex()) == fFiltersMap.end()) { eventFilter(0); dqtable(false, false, false, false, false, false, false); + // dqtable(false, false, false, false, false, false, false, false); // the ElectronMuon trigger is not available now } else { totalEventsTriggered++; - for (int i = 0; i < fNBarrelCuts + fNMuonCuts; i++) { - if (fFiltersMap[collision.globalIndex()] & (uint32_t(1) << i)) + for (int i = 0; i < fNBarrelCuts + fNMuonCuts + fNElectronMuonCuts; i++) { + if (fFiltersMap[collision.globalIndex()] & (static_cast(1) << i)) fStats->Fill(static_cast(i)); } eventFilter(fFiltersMap[collision.globalIndex()]); auto dqDecisions = fCEFPfilters[collision.globalIndex()]; dqtable(dqDecisions[0], dqDecisions[1], dqDecisions[2], dqDecisions[3], dqDecisions[4], dqDecisions[5], dqDecisions[6]); + // dqtable(dqDecisions[0], dqDecisions[1], dqDecisions[2], dqDecisions[3], dqDecisions[4], dqDecisions[5], dqDecisions[6], dqDecisions[7]); // the ElectronMuon trigger is not available now } } @@ -1021,7 +1184,7 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses) dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "its,tpcpid,dca"); } - if (classStr.Contains("Muon")) { + if (classStr.Contains("Muon") && !classStr.Contains("Electron")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "muon"); } @@ -1032,6 +1195,9 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses) if (classStr.Contains("Forward")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "pair", "dimuon,vertexing-forward"); } + if (classStr.Contains("ElectronMuon")) { + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "pair", "electronmuon"); + } } } } diff --git a/PWGDQ/Tasks/mchAlignRecord.cxx b/PWGDQ/Tasks/mchAlignRecord.cxx index 633b4b39709..6dfe8259564 100644 --- a/PWGDQ/Tasks/mchAlignRecord.cxx +++ b/PWGDQ/Tasks/mchAlignRecord.cxx @@ -137,7 +137,7 @@ struct mchAlignRecordTask { // Configuration for chamber fixing auto chambers = fFixChamber.value; - for (int i = 0; i < chambers.length(); ++i) { + for (std::size_t i = 0; i < chambers.length(); ++i) { if (chambers[i] == ',') continue; int chamber = chambers[i] - '0'; diff --git a/PWGDQ/Tasks/quarkoniaToHyperons.cxx b/PWGDQ/Tasks/quarkoniaToHyperons.cxx new file mode 100644 index 00000000000..f2fc85498a3 --- /dev/null +++ b/PWGDQ/Tasks/quarkoniaToHyperons.cxx @@ -0,0 +1,2078 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// V0 analysis task +// ================ +// +// This code loops over a V0Cores table and produces some +// standard analysis output. It is meant to be run over +// derived data. +// +// Comments, questions, complaints, suggestions? +// Please write to: +// romain.schotter@cern.ch +// david.dobrigkeit.chinellato@cern.ch +// + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "ReconstructionDataFormats/Track.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/trackUtilities.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessMLTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponse.h" +#include "PWGUD/Core/SGSelector.h" +#include "Tools/ML/MlResponse.h" +#include "Tools/ML/model.h" + +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" + +// constants +const float ctauXiPDG = 4.91; // from PDG +const float ctauOmegaPDG = 2.461; // from PDG + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; + +using dauTracks = soa::Join; +using dauMCTracks = soa::Join; +using v0Candidates = soa::Join; +// using v0MCCandidates = soa::Join; +using v0MCCandidates = soa::Join; + +using cascadeCandidates = soa::Join; +using cascadeMCCandidates = soa::Join; + +// simple checkers, but ensure 64 bit integers +#define bitset(var, nbit) ((var) |= (static_cast(1) << static_cast(nbit))) +#define bitcheck(var, nbit) ((var) & (static_cast(1) << static_cast(nbit))) + +struct quarkoniaToHyperons { + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // master analysis switches + Configurable isPP{"isPP", true, "If running on pp collision, switch it on true"}; + + // for running over skimmed dataset + Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "If running over skimmed data, switch it on true"}; + Configurable cfgSkimmedTrigger{"cfgSkimmedTrigger", "fDoubleXi,fTripleXi,fQuadrupleXi", "(std::string) Comma separated list of triggers of interest"}; + + // switch on/off event selections + Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; + Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", false, "require events with at least one ITS-TPC track"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; + Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", true, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + + Configurable buildLaLaBarPairs{"buildLaLaBarPairs", false, "Build Lambda antiLambda from charmonia decay"}; + Configurable buildXiXiBarPairs{"buildXiXiBarPairs", false, "Build Xi antiXi from charmonia decay"}; + Configurable buildOmOmBarPairs{"buildOmOmBarPairs", false, "Build Omega antiOmega from charmonia decay"}; + + Configurable buildSameSignPairs{"buildSameSignPairs", false, "If true: build same-sign pairs, otherwise consider only opposite-sign pairs"}; + + // fast check on occupancy + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + + // rapidity cut on the hyperon-antiHyperon pair + Configurable rapidityCut{"rapidityCut", 0.5, "rapidity cut on the hyp-antiHyp pair"}; + + struct : ConfigurableGroup { + Configurable v0TypeSelection{"v0Selections.v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + + // Selection criteria: acceptance + Configurable rapidityCut{"v0Selections.rapidityCut", 0.5, "rapidity"}; + Configurable daughterEtaCut{"v0Selections.daughterEtaCut", 0.8, "max eta for daughters"}; + + // Standard 6 topological criteria + Configurable v0cospa{"v0Selections.v0cospa", 0.97, "min V0 CosPA"}; + Configurable dcav0dau{"v0Selections.dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; + Configurable dcav0topv{"v0Selections.dcav0topv", .05, "min DCA V0 to PV (cm)"}; + Configurable dcapiontopv{"v0Selections.dcapiontopv", .05, "min DCA Pion To PV (cm)"}; + Configurable dcaprotontopv{"v0Selections.dcaprotontopv", .05, "min DCA Proton To PV (cm)"}; + Configurable v0radius{"v0Selections.v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"v0Selections.v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + + // invariant mass selection + Configurable v0MassWindow{"v0Selections.v0MassWindow", 0.008, "#Lambda mass (GeV/#it{c}^{2})"}; + Configurable compMassRejection{"v0Selections.compMassRejection", 0.008, "Competing mass rejection (GeV/#it{c}^{2})"}; + + // Additional selection on the AP plot (exclusive for K0Short) + // original equation: lArmPt*5>TMath::Abs(lArmAlpha) + Configurable armPodCut{"v0Selections.armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; + + // Track quality + Configurable minTPCrows{"v0Selections.minTPCrows", 70, "minimum TPC crossed rows"}; + Configurable minITSclusters{"v0Selections.minITSclusters", -1, "minimum ITS clusters"}; + Configurable skipTPConly{"v0Selections.skipTPConly", false, "skip V0s comprised of at least one TPC only prong"}; + Configurable requirePosITSonly{"v0Selections.requirePosITSonly", false, "require that positive track is ITSonly (overrides TPC quality)"}; + Configurable requireNegITSonly{"v0Selections.requireNegITSonly", false, "require that negative track is ITSonly (overrides TPC quality)"}; + + // PID (TPC/TOF) + Configurable TpcPidNsigmaCut{"v0Selections.TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; + Configurable TofPidNsigmaCutLaPr{"v0Selections.TofPidNsigmaCutLaPr", 1e+6, "TofPidNsigmaCutLaPr"}; + Configurable TofPidNsigmaCutLaPi{"v0Selections.TofPidNsigmaCutLaPi", 1e+6, "TofPidNsigmaCutLaPi"}; + Configurable TofPidNsigmaCutK0Pi{"v0Selections.TofPidNsigmaCutK0Pi", 1e+6, "TofPidNsigmaCutK0Pi"}; + + // PID (TOF) + Configurable maxDeltaTimeProton{"v0Selections.maxDeltaTimeProton", 1e+9, "check maximum allowed time"}; + Configurable maxDeltaTimePion{"v0Selections.maxDeltaTimePion", 1e+9, "check maximum allowed time"}; + } v0Selections; + + struct : ConfigurableGroup { + // Selection criteria: acceptance + Configurable rapidityCut{"cascSelections.rapidityCut", 0.5, "rapidity"}; + Configurable daughterEtaCut{"cascSelections.daughterEtaCut", 0.8, "max eta for daughters"}; + + // Standard 6 topological criteria on V0 + Configurable v0cospa{"cascSelections.v0cospa", 0.97, "min V0 CosPA"}; + Configurable dcav0dau{"cascSelections.dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; + Configurable dcav0topv{"cascSelections.dcav0topv", .05, "min DCA V0 to PV (cm)"}; + Configurable dcapiontopv{"cascSelections.dcapiontopv", .05, "min DCA Pion To PV (cm)"}; + Configurable dcaprotontopv{"cascSelections.dcaprotontopv", .05, "min DCA Proton To PV (cm)"}; + Configurable v0radius{"cascSelections.v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"cascSelections.v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + + // Standard 6 topological criteria on cascades + Configurable casccospa{"cascSelections.casccospa", 0.97, "min Cascade CosPA"}; + Configurable dcacascdau{"cascSelections.dcacascdau", 1.0, "max DCA Cascade Daughters (cm)"}; + Configurable dcaxybachbaryontopv{"cascSelections.dcaxybachbaryontopv", -1, "DCAxy Bachelor-Baryon to PV (cm)"}; + Configurable bachbaryoncospa{"cascSelections.bachbaryoncospa", -1, "Bachelor-Baryon CosPA"}; + Configurable dcabachtopv{"cascSelections.dcabachtopv", .05, "min DCA Bachelor To PV (cm)"}; + Configurable cascradius{"cascSelections.cascradius", 0.5, "minimum Cascade radius (cm)"}; + Configurable cascradiusMax{"cascSelections.cascradiusMax", 1E5, "maximum Cascade radius (cm)"}; + Configurable cascProperLifeTime{"cascSelections.cascProperLifeTime", 3, "maximum lifetime (ctau)"}; + + // invariant mass selection + Configurable v0MassWindow{"cascSelections.v0MassWindow", 0.008, "#Lambda mass (GeV/#it{c}^{2})"}; + Configurable cascMassWindow{"cascSelections.cascMassWindow", 0.008, "#Lambda mass (GeV/#it{c}^{2})"}; + Configurable compMassRejection{"cascSelections.compMassRejection", 0.008, "Competing mass rejection (GeV/#it{c}^{2})"}; + + // Track quality + Configurable minTPCrows{"cascSelections.minTPCrows", 70, "minimum TPC crossed rows"}; + Configurable minITSclusters{"cascSelections.minITSclusters", -1, "minimum ITS clusters"}; + Configurable skipTPConly{"cascSelections.skipTPConly", false, "skip V0s comprised of at least one TPC only prong"}; + Configurable requireBachITSonly{"cascSelections.requireBachITSonly", false, "require that bachelor track is ITSonly (overrides TPC quality)"}; + Configurable requirePosITSonly{"cascSelections.requirePosITSonly", false, "require that positive track is ITSonly (overrides TPC quality)"}; + Configurable requireNegITSonly{"cascSelections.requireNegITSonly", false, "require that negative track is ITSonly (overrides TPC quality)"}; + + // PID (TPC/TOF) + Configurable TpcPidNsigmaCut{"cascSelections.TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; + Configurable TofPidNsigmaCutLaPr{"cascSelections.TofPidNsigmaCutLaPr", 1e+6, "TofPidNsigmaCutLaPr"}; + Configurable TofPidNsigmaCutLaPi{"cascSelections.TofPidNsigmaCutLaPi", 1e+6, "TofPidNsigmaCutLaPi"}; + Configurable TofPidNsigmaCutXiPi{"cascSelections.TofPidNsigmaCutXiPi", 1e+6, "TofPidNsigmaCutXiPi"}; + Configurable TofPidNsigmaCutOmKa{"cascSelections.TofPidNsigmaCutOmKa", 1e+6, "TofPidNsigmaCutOmKa"}; + + // PID (TOF) + Configurable maxDeltaTimeProton{"cascSelections.maxDeltaTimeProton", 1e+9, "check maximum allowed time"}; + Configurable maxDeltaTimePion{"cascSelections.maxDeltaTimePion", 1e+9, "check maximum allowed time"}; + Configurable maxDeltaTimeKaon{"cascSelections.maxDeltaTimeKaon", 1e+9, "check maximum allowed time"}; + } cascSelections; + + Configurable qaCentrality{"qaCentrality", false, "qa centrality flag: check base raw values"}; + + // for MC + Configurable doMCAssociation{"doMCAssociation", true, "if MC, do MC association"}; + + // UPC selections + SGSelector sgSelector; + struct : ConfigurableGroup { + Configurable FV0cut{"upcCuts.FV0cut", 100., "FV0A threshold"}; + Configurable FT0Acut{"upcCuts.FT0Acut", 200., "FT0A threshold"}; + Configurable FT0Ccut{"upcCuts.FT0Ccut", 100., "FT0C threshold"}; + Configurable ZDCcut{"upcCuts.ZDCcut", 10., "ZDC threshold"}; + // Configurable gapSel{"upcCuts.gapSel", 2, "Gap selection"}; + } upcCuts; + + // Machine learning evaluation for pre-selection and corresponding information generation + o2::ml::OnnxModel mlCustomModelK0Short; + o2::ml::OnnxModel mlCustomModelLambda; + o2::ml::OnnxModel mlCustomModelAntiLambda; + o2::ml::OnnxModel mlCustomModelGamma; + + struct : ConfigurableGroup { + // ML classifiers: master flags to control whether we should use custom ML classifiers or the scores in the derived data + Configurable useK0ShortScores{"mlConfigurations.useK0ShortScores", false, "use ML scores to select K0Short"}; + Configurable useLambdaScores{"mlConfigurations.useLambdaScores", false, "use ML scores to select Lambda"}; + Configurable useAntiLambdaScores{"mlConfigurations.useAntiLambdaScores", false, "use ML scores to select AntiLambda"}; + + Configurable calculateK0ShortScores{"mlConfigurations.calculateK0ShortScores", false, "calculate K0Short ML scores"}; + Configurable calculateLambdaScores{"mlConfigurations.calculateLambdaScores", false, "calculate Lambda ML scores"}; + Configurable calculateAntiLambdaScores{"mlConfigurations.calculateAntiLambdaScores", false, "calculate AntiLambda ML scores"}; + + // ML input for ML calculation + Configurable customModelPathCCDB{"mlConfigurations.customModelPathCCDB", "", "Custom ML Model path in CCDB"}; + Configurable timestampCCDB{"mlConfigurations.timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; + Configurable loadCustomModelsFromCCDB{"mlConfigurations.loadCustomModelsFromCCDB", false, "Flag to enable or disable the loading of custom models from CCDB"}; + Configurable enableOptimizations{"mlConfigurations.enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; + + // Local paths for test purposes + Configurable localModelPathLambda{"mlConfigurations.localModelPathLambda", "Lambda_BDTModel.onnx", "(std::string) Path to the local .onnx file."}; + Configurable localModelPathAntiLambda{"mlConfigurations.localModelPathAntiLambda", "AntiLambda_BDTModel.onnx", "(std::string) Path to the local .onnx file."}; + Configurable localModelPathK0Short{"mlConfigurations.localModelPathK0Short", "KZeroShort_BDTModel.onnx", "(std::string) Path to the local .onnx file."}; + + // Thresholds for choosing to populate V0Cores tables with pre-selections + Configurable thresholdLambda{"mlConfigurations.thresholdLambda", -1.0f, "Threshold to keep Lambda candidates"}; + Configurable thresholdAntiLambda{"mlConfigurations.thresholdAntiLambda", -1.0f, "Threshold to keep AntiLambda candidates"}; + Configurable thresholdK0Short{"mlConfigurations.thresholdK0Short", -1.0f, "Threshold to keep K0Short candidates"}; + } mlConfigurations; + + // CCDB options + struct : ConfigurableGroup { + Configurable ccdburl{"ccdbConfigurations.ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"ccdbConfigurations.grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"ccdbConfigurations.grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"ccdbConfigurations.lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"ccdbConfigurations.geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable mVtxPath{"ccdbConfigurations.mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + } ccdbConfigurations; + + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + int mRunNumber; + std::map metadata; + + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + + static constexpr float defaultLifetimeCuts[1][2] = {{30., 20.}}; + Configurable> lifetimecut{"lifetimecut", {defaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; + + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f, 1.2f, 1.4f, 1.6f, 1.8f, 2.0f, 2.4f, 2.8f, 3.2f, 3.6f, 4.0f, 4.8f, 5.6f, 6.5f, 7.5f, 9.0f, 11.0f, 13.0f, 15.0f, 19.0f, 23.0f, 30.0f, 40.0f, 50.0f}, "pt axis for analysis"}; + ConfigurableAxis axisQuarkoniumMass{"axisQuarkoniumMass", {500, 2.600f, 4.000f}, "M (hyp. #bar{hyp.} ) (GeV/#it{c}^{2})"}; + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality"}; + ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; + + ConfigurableAxis axisRawCentrality{"axisRawCentrality", {VARIABLE_WIDTH, 0.000f, 52.320f, 75.400f, 95.719f, 115.364f, 135.211f, 155.791f, 177.504f, 200.686f, 225.641f, 252.645f, 281.906f, 313.850f, 348.302f, 385.732f, 426.307f, 470.146f, 517.555f, 568.899f, 624.177f, 684.021f, 748.734f, 818.078f, 892.577f, 973.087f, 1058.789f, 1150.915f, 1249.319f, 1354.279f, 1465.979f, 1584.790f, 1710.778f, 1844.863f, 1985.746f, 2134.643f, 2291.610f, 2456.943f, 2630.653f, 2813.959f, 3006.631f, 3207.229f, 3417.641f, 3637.318f, 3865.785f, 4104.997f, 4354.938f, 4615.786f, 4885.335f, 5166.555f, 5458.021f, 5762.584f, 6077.881f, 6406.834f, 6746.435f, 7097.958f, 7462.579f, 7839.165f, 8231.629f, 8635.640f, 9052.000f, 9484.268f, 9929.111f, 10389.350f, 10862.059f, 11352.185f, 11856.823f, 12380.371f, 12920.401f, 13476.971f, 14053.087f, 14646.190f, 15258.426f, 15890.617f, 16544.433f, 17218.024f, 17913.465f, 18631.374f, 19374.983f, 20136.700f, 20927.783f, 21746.796f, 22590.880f, 23465.734f, 24372.274f, 25314.351f, 26290.488f, 27300.899f, 28347.512f, 29436.133f, 30567.840f, 31746.818f, 32982.664f, 34276.329f, 35624.859f, 37042.588f, 38546.609f, 40139.742f, 41837.980f, 43679.429f, 45892.130f, 400000.000f}, "raw centrality signal"}; // for QA + + ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; + + // topological variable QA axes + ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {20, 0.0f, 1.0f}, "DCA (cm)"}; + ConfigurableAxis axisDCAdau{"axisDCAdau", {20, 0.0f, 2.0f}, "DCA (cm)"}; + ConfigurableAxis axisDCAV0ToPV{"axisDCAV0ToPV", {20, 0.0f, 2.0f}, "DCA (cm)"}; + ConfigurableAxis axisPointingAngle{"axisPointingAngle", {20, 0.0f, 2.0f}, "pointing angle (rad)"}; + ConfigurableAxis axisRadius{"axisRadius", {20, 0.0f, 60.0f}, "Decay radius (cm)"}; + ConfigurableAxis axisProperLifeTime{"axisV0ProperLifeTime", {100, 0.0f, 50.0f}, "ProperLifeTime 2D radius (cm)"}; + ConfigurableAxis axisMassWindow{"axisMassWindow", {40, -0.020f, 0.020f}, "Inv. mass - PDG mass (GeV/#it{c}^{2})"}; + ConfigurableAxis axisK0Mass{"axisK0Mass", {500, 0.400f, 0.600f}, "K0Short mass (GeV/#it{c}^{2})"}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {500, 1.098f, 1.198f}, "Lambda mass (GeV/#it{c}^{2})"}; + ConfigurableAxis axisXiMass{"axisXiMass", {500, 1.318f, 1.370f}, "Xi mass (GeV/#it{c}^{2})"}; + ConfigurableAxis axisOmegaMass{"axisOmegaMass", {500, 1.670f, 1.675f}, "Omega mass (GeV/#it{c}^{2})"}; + ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; + + // Track quality axes + ConfigurableAxis axisTPCrows{"axisTPCrows", {160, 0.0f, 160.0f}, "N TPC rows"}; + ConfigurableAxis axisITSclus{"axisITSclus", {7, 0.0f, 7.0f}, "N ITS Clusters"}; + + // UPC axes + ConfigurableAxis axisSelGap{"axisSelGap", {4, -1.5, 2.5}, "Gap side"}; + + // PDG database + Service pdgDB; + + // For manual sliceBy + PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; + + enum selection : uint64_t { selCosPA = 0, + selRadius, + selRadiusMax, + selDCANegToPV, + selDCAPosToPV, + selDCAV0ToPV, + selDCAV0Dau, + selK0ShortRapidity, + selLambdaRapidity, + selK0ShortMassWindow, + selLambdaMassWindow, + selAntiLambdaMassWindow, + selK0ShortMassRejection, + selLambdaMassRejection, + selTPCPIDPositivePion, + selTPCPIDNegativePion, + selTPCPIDPositiveProton, + selTPCPIDNegativeProton, + selTOFDeltaTPositiveProtonLambda, + selTOFDeltaTPositivePionLambda, + selTOFDeltaTPositivePionK0Short, + selTOFDeltaTNegativeProtonLambda, + selTOFDeltaTNegativePionLambda, + selTOFDeltaTNegativePionK0Short, + selTOFNSigmaPositiveProtonLambda, // Nsigma + selTOFNSigmaPositivePionLambda, // Nsigma + selTOFNSigmaPositivePionK0Short, // Nsigma + selTOFNSigmaNegativeProtonLambda, // Nsigma + selTOFNSigmaNegativePionLambda, // Nsigma + selTOFNSigmaNegativePionK0Short, // Nsigma + selK0ShortCTau, + selLambdaCTau, + selK0ShortArmenteros, + selPosGoodTPCTrack, // at least min # TPC rows + selNegGoodTPCTrack, // at least min # TPC rows + selPosGoodITSTrack, // at least min # ITS clusters + selNegGoodITSTrack, // at least min # ITS clusters + selPosItsOnly, + selNegItsOnly, + selPosNotTPCOnly, + selNegNotTPCOnly, + selConsiderK0Short, // for mc tagging + selConsiderLambda, // for mc tagging + selConsiderAntiLambda, // for mc tagging + selPhysPrimK0Short, // for mc tagging + selPhysPrimLambda, // for mc tagging + selPhysPrimAntiLambda, // for mc tagging + }; + + uint64_t maskTopological; + uint64_t maskTopoNoV0Radius; + uint64_t maskTopoNoDCANegToPV; + uint64_t maskTopoNoDCAPosToPV; + uint64_t maskTopoNoCosPA; + uint64_t maskTopoNoDCAV0Dau; + uint64_t maskTopoNoDCAV0ToPV; + uint64_t maskTrackProperties; + + uint64_t maskK0ShortSpecific; + uint64_t maskLambdaSpecific; + uint64_t maskAntiLambdaSpecific; + + uint64_t maskSelectionK0Short; + uint64_t maskSelectionLambda; + uint64_t maskSelectionAntiLambda; + + uint64_t secondaryMaskSelectionLambda; + uint64_t secondaryMaskSelectionAntiLambda; + + void init(InitContext const&) + { + // initialise bit masks + maskTopological = (uint64_t(1) << selCosPA) | (uint64_t(1) << selRadius) | (uint64_t(1) << selDCANegToPV) | (uint64_t(1) << selDCAPosToPV) | (uint64_t(1) << selDCAV0ToPV) | (uint64_t(1) << selDCAV0Dau) | (uint64_t(1) << selRadiusMax); + maskTopoNoV0Radius = (uint64_t(1) << selCosPA) | (uint64_t(1) << selDCANegToPV) | (uint64_t(1) << selDCAPosToPV) | (uint64_t(1) << selDCAV0ToPV) | (uint64_t(1) << selDCAV0Dau) | (uint64_t(1) << selRadiusMax); + maskTopoNoDCANegToPV = (uint64_t(1) << selCosPA) | (uint64_t(1) << selRadius) | (uint64_t(1) << selDCAPosToPV) | (uint64_t(1) << selDCAV0ToPV) | (uint64_t(1) << selDCAV0Dau) | (uint64_t(1) << selRadiusMax); + maskTopoNoDCAPosToPV = (uint64_t(1) << selCosPA) | (uint64_t(1) << selRadius) | (uint64_t(1) << selDCANegToPV) | (uint64_t(1) << selDCAV0ToPV) | (uint64_t(1) << selDCAV0Dau) | (uint64_t(1) << selRadiusMax); + maskTopoNoCosPA = (uint64_t(1) << selRadius) | (uint64_t(1) << selDCANegToPV) | (uint64_t(1) << selDCAPosToPV) | (uint64_t(1) << selDCAV0ToPV) | (uint64_t(1) << selDCAV0Dau) | (uint64_t(1) << selRadiusMax); + maskTopoNoDCAV0Dau = (uint64_t(1) << selCosPA) | (uint64_t(1) << selRadius) | (uint64_t(1) << selDCANegToPV) | (uint64_t(1) << selDCAPosToPV) | (uint64_t(1) << selDCAV0ToPV) | (uint64_t(1) << selRadiusMax); + maskTopoNoDCAV0ToPV = (uint64_t(1) << selCosPA) | (uint64_t(1) << selRadius) | (uint64_t(1) << selDCANegToPV) | (uint64_t(1) << selDCAPosToPV) | (uint64_t(1) << selDCAV0Dau) | (uint64_t(1) << selRadiusMax); + + maskK0ShortSpecific = (uint64_t(1) << selK0ShortRapidity) | (uint64_t(1) << selK0ShortCTau) | (uint64_t(1) << selK0ShortArmenteros) | (uint64_t(1) << selConsiderK0Short) | (uint64_t(1) << selK0ShortMassWindow) | (uint64_t(1) << selLambdaMassRejection); + maskLambdaSpecific = (uint64_t(1) << selLambdaRapidity) | (uint64_t(1) << selLambdaCTau) | (uint64_t(1) << selConsiderLambda) | (uint64_t(1) << selLambdaMassWindow) | (uint64_t(1) << selK0ShortMassRejection); + maskAntiLambdaSpecific = (uint64_t(1) << selLambdaRapidity) | (uint64_t(1) << selLambdaCTau) | (uint64_t(1) << selConsiderAntiLambda) | (uint64_t(1) << selAntiLambdaMassWindow) | (uint64_t(1) << selK0ShortMassRejection); + + // ask for specific TPC/TOF PID selections + maskTrackProperties = 0; + if (v0Selections.requirePosITSonly) { + maskTrackProperties = maskTrackProperties | (uint64_t(1) << selPosItsOnly) | (uint64_t(1) << selPosGoodITSTrack); + } else { + maskTrackProperties = maskTrackProperties | (uint64_t(1) << selPosGoodTPCTrack) | (uint64_t(1) << selPosGoodITSTrack); + // TPC signal is available: ask for positive track PID + if (v0Selections.TpcPidNsigmaCut < 1e+5) { // safeguard for no cut + maskK0ShortSpecific = maskK0ShortSpecific | (uint64_t(1) << selTPCPIDPositivePion); + maskLambdaSpecific = maskLambdaSpecific | (uint64_t(1) << selTPCPIDPositiveProton); + maskAntiLambdaSpecific = maskAntiLambdaSpecific | (uint64_t(1) << selTPCPIDPositivePion); + } + // TOF PID + if (v0Selections.TofPidNsigmaCutK0Pi < 1e+5) // safeguard for no cut + maskK0ShortSpecific = maskK0ShortSpecific | (uint64_t(1) << selTOFNSigmaPositivePionK0Short) | (uint64_t(1) << selTOFDeltaTPositivePionK0Short); + if (v0Selections.TofPidNsigmaCutLaPr < 1e+5) // safeguard for no cut + maskLambdaSpecific = maskLambdaSpecific | (uint64_t(1) << selTOFNSigmaPositiveProtonLambda) | (uint64_t(1) << selTOFDeltaTPositiveProtonLambda); + if (v0Selections.TofPidNsigmaCutLaPi < 1e+5) // safeguard for no cut + maskAntiLambdaSpecific = maskAntiLambdaSpecific | (uint64_t(1) << selTOFNSigmaPositivePionLambda) | (uint64_t(1) << selTOFDeltaTPositivePionLambda); + } + if (v0Selections.requireNegITSonly) { + maskTrackProperties = maskTrackProperties | (uint64_t(1) << selNegItsOnly) | (uint64_t(1) << selNegGoodITSTrack); + } else { + maskTrackProperties = maskTrackProperties | (uint64_t(1) << selNegGoodTPCTrack) | (uint64_t(1) << selNegGoodITSTrack); + // TPC signal is available: ask for negative track PID + if (v0Selections.TpcPidNsigmaCut < 1e+5) { // safeguard for no cut + maskK0ShortSpecific = maskK0ShortSpecific | (uint64_t(1) << selTPCPIDNegativePion); + maskLambdaSpecific = maskLambdaSpecific | (uint64_t(1) << selTPCPIDNegativePion); + maskAntiLambdaSpecific = maskAntiLambdaSpecific | (uint64_t(1) << selTPCPIDNegativeProton); + } + // TOF PID + if (v0Selections.TofPidNsigmaCutK0Pi < 1e+5) // safeguard for no cut + maskK0ShortSpecific = maskK0ShortSpecific | (uint64_t(1) << selTOFNSigmaNegativePionK0Short) | (uint64_t(1) << selTOFDeltaTNegativePionK0Short); + if (v0Selections.TofPidNsigmaCutLaPi < 1e+5) // safeguard for no cut + maskLambdaSpecific = maskLambdaSpecific | (uint64_t(1) << selTOFNSigmaNegativePionLambda) | (uint64_t(1) << selTOFDeltaTNegativePionLambda); + if (v0Selections.TofPidNsigmaCutLaPr < 1e+5) // safeguard for no cut + maskAntiLambdaSpecific = maskAntiLambdaSpecific | (uint64_t(1) << selTOFNSigmaNegativeProtonLambda) | (uint64_t(1) << selTOFDeltaTNegativeProtonLambda); + } + + if (v0Selections.skipTPConly) { + maskK0ShortSpecific = maskK0ShortSpecific | (uint64_t(1) << selPosNotTPCOnly) | (uint64_t(1) << selNegNotTPCOnly); + maskLambdaSpecific = maskLambdaSpecific | (uint64_t(1) << selPosNotTPCOnly) | (uint64_t(1) << selNegNotTPCOnly); + maskAntiLambdaSpecific = maskAntiLambdaSpecific | (uint64_t(1) << selPosNotTPCOnly) | (uint64_t(1) << selNegNotTPCOnly); + } + + // Primary particle selection, central to analysis + maskSelectionK0Short = maskTopological | maskTrackProperties | maskK0ShortSpecific; + maskSelectionLambda = maskTopological | maskTrackProperties | maskLambdaSpecific; + maskSelectionAntiLambda = maskTopological | maskTrackProperties | maskAntiLambdaSpecific; + + // No primary requirement for feeddown matrix + secondaryMaskSelectionLambda = maskTopological | maskTrackProperties | maskLambdaSpecific; + secondaryMaskSelectionAntiLambda = maskTopological | maskTrackProperties | maskAntiLambdaSpecific; + + // Event Counters + histos.add("hEventSelection", "hEventSelection", kTH1F, {{20, -0.5f, +19.5f}}); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "posZ cut"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(6, "kIsVertexITSTPC"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(7, "kIsGoodZvtxFT0vsPV"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(8, "kIsVertexTOFmatched"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(11, "kNoCollInTimeRangeStd"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeNarrow"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "Below min occup."); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "Above max occup."); + + histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}}); + histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2F, {axisCentrality, axisNch}); + + histos.add("hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy}); + histos.add("hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2F, {axisCentrality, axisOccupancy}); + + if (!isPP) { + histos.add("hGapSide", "Gap side; Entries", kTH1F, {{5, -0.5, 4.5}}); + histos.add("hSelGapSide", "Selected gap side; Entries", kTH1F, {axisSelGap}); + histos.add("hEventCentralityVsSelGapSide", ";Centrality (%); Selected gap side", kTH2F, {{100, 0.0f, +100.0f}, axisSelGap}); + } + + // for QA and test purposes + auto hRawCentrality = histos.add("hRawCentrality", "hRawCentrality", kTH1F, {axisRawCentrality}); + + for (int ii = 1; ii < 101; ii++) { + float value = 100.5f - static_cast(ii); + hRawCentrality->SetBinContent(ii, value); + } + + // histograms versus mass + if (buildLaLaBarPairs) { + histos.add("LaLaBar/h3dMassLaLabar", "h3dMassLaLabar", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + if (!isPP) { + // Non-UPC info + histos.add("LaLaBar/h3dMassLaLabarHadronic", "h3dMassLaLabarHadronic", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + // UPC info + histos.add("LaLaBar/h3dMassLaLabarSGA", "h3dMassLaLabarSGA", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dMassLaLabarSGC", "h3dMassLaLabarSGC", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dMassLaLabarDG", "h3dMassLaLabarDG", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + } + histos.add("LaLaBar/h2dNbrOfK0ShortVsCentrality", "h2dNbrOfK0ShortVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); + histos.add("LaLaBar/h2dNbrOfLambdaVsCentrality", "h2dNbrOfLambdaVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); + histos.add("LaLaBar/h2dNbrOfAntiLambdaVsCentrality", "h2dNbrOfAntiLambdaVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); + // QA plot + // Candidates after Lambda selections + histos.add("LaLaBar/Lambda/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("LaLaBar/Lambda/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("LaLaBar/Lambda/hDCAV0Daughters", "hDCAV0Daughters", kTH1F, {axisDCAdau}); + histos.add("LaLaBar/Lambda/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); + histos.add("LaLaBar/Lambda/hV0PointingAngle", "hV0PointingAngle", kTH1F, {axisPointingAngle}); + histos.add("LaLaBar/Lambda/hV0Radius", "hV0Radius", kTH1F, {axisRadius}); + histos.add("LaLaBar/Lambda/hV0DecayLength", "hDecayLength", kTH1F, {axisProperLifeTime}); + histos.add("LaLaBar/Lambda/hV0InvMassWindow", "hInvMassWindow", kTH1F, {axisMassWindow}); + histos.add("LaLaBar/Lambda/h2dCompetingMassRej", "h2dCompetingMassRej", kTH2F, {axisLambdaMass, axisK0Mass}); + histos.add("LaLaBar/Lambda/hPosTPCNsigma", "hPosTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("LaLaBar/Lambda/hNegTPCNsigma", "hNegTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("LaLaBar/Lambda/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("LaLaBar/Lambda/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + + // Candidates after AntiLambda selections + histos.add("LaLaBar/AntiLambda/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("LaLaBar/AntiLambda/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("LaLaBar/AntiLambda/hDCAV0Daughters", "hDCADaughters", kTH1F, {axisDCAdau}); + histos.add("LaLaBar/AntiLambda/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); + histos.add("LaLaBar/AntiLambda/hV0PointingAngle", "hV0PointingAngle", kTH1F, {axisPointingAngle}); + histos.add("LaLaBar/AntiLambda/hV0Radius", "hV0Radius", kTH1F, {axisRadius}); + histos.add("LaLaBar/AntiLambda/hV0DecayLength", "hDecayLength", kTH1F, {axisProperLifeTime}); + histos.add("LaLaBar/AntiLambda/hV0InvMassWindow", "hInvMassWindow", kTH1F, {axisMassWindow}); + histos.add("LaLaBar/AntiLambda/h2dCompetingMassRej", "h2dCompetingMassRej", kTH2F, {axisLambdaMass, axisK0Mass}); + histos.add("LaLaBar/AntiLambda/hPosTPCNsigma", "hPosTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("LaLaBar/AntiLambda/hNegTPCNsigma", "hNegTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("LaLaBar/AntiLambda/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("LaLaBar/AntiLambda/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + if (doMCAssociation) { + histos.add("LaLaBar/h3dInvMassTrueEtaC1S", "h3dInvMassTrueEtaC1S", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dInvMassTrueJPsi", "h3dInvMassTrueJPsi", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dInvMassTrueChiC0", "h3dInvMassTrueChiC0", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dInvMassTrueChiC1", "h3dInvMassTrueChiC1", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dInvMassTrueHC", "h3dInvMassTrueHC", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dInvMassTrueChiC2", "h3dInvMassTrueChiC2", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dInvMassTrueEtaC2S", "h3dInvMassTrueEtaC2S", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("LaLaBar/h3dInvMassTruePsi2S", "h3dInvMassTruePsi2S", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + } + } + if (buildXiXiBarPairs) { + histos.add("XiXiBar/h3dMassXiXibar", "h3dMassXiXibar", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + if (!isPP) { + // Non-UPC info + histos.add("XiXiBar/h3dMassXiXibarHadronic", "h3dMassXiXibarHadronic", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + // UPC info + histos.add("XiXiBar/h3dMassXiXibarSGA", "h3dMassXiXibarSGA", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dMassXiXibarSGC", "h3dMassXiXibarSGC", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dMassXiXibarDG", "h3dMassXiXibarDG", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + } + histos.add("XiXiBar/h2dNbrOfXiVsCentrality", "h2dNbrOfXiVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); + histos.add("XiXiBar/h2dNbrOfAntiXiVsCentrality", "h2dNbrOfAntiXiVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); + // QA plot + // Candidates after Xi selections + histos.add("XiXiBar/Xi/hBachDCAToPV", "hBachDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("XiXiBar/Xi/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("XiXiBar/Xi/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("XiXiBar/Xi/hDCACascDaughters", "hDCACascDaughters", kTH1F, {axisDCAdau}); + histos.add("XiXiBar/Xi/hDCAV0Daughters", "hDCAV0Daughters", kTH1F, {axisDCAdau}); + histos.add("XiXiBar/Xi/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); + histos.add("XiXiBar/Xi/hV0PointingAngle", "hV0PointingAngle", kTH1F, {axisPointingAngle}); + histos.add("XiXiBar/Xi/hV0Radius", "hV0Radius", kTH1F, {axisRadius}); + histos.add("XiXiBar/Xi/hCascPointingAngle", "hCascPointingAngle", kTH1F, {axisPointingAngle}); + histos.add("XiXiBar/Xi/hCascRadius", "hCascRadius", kTH1F, {axisRadius}); + histos.add("XiXiBar/Xi/hCascDecayLength", "hCascDecayLength", kTH1F, {axisProperLifeTime}); + histos.add("XiXiBar/Xi/hV0InvMassWindow", "hV0InvMassWindow", kTH1F, {axisMassWindow}); + histos.add("XiXiBar/Xi/hCascInvMassWindow", "hCascInvMassWindow", kTH1F, {axisMassWindow}); + histos.add("XiXiBar/Xi/h2dCompetingMassRej", "h2dCompetingMassRej", kTH2F, {axisXiMass, axisOmegaMass}); + histos.add("XiXiBar/Xi/hBachTPCNsigma", "hBachTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("XiXiBar/Xi/hPosTPCNsigma", "hPosTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("XiXiBar/Xi/hNegTPCNsigma", "hNegTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("XiXiBar/Xi/h2dBachelorITSvsTPCpts", "h2dBachelorITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("XiXiBar/Xi/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("XiXiBar/Xi/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + // Candidates after AntiXi selections + histos.add("XiXiBar/AntiXi/hBachDCAToPV", "hBachDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("XiXiBar/AntiXi/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("XiXiBar/AntiXi/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("XiXiBar/AntiXi/hDCACascDaughters", "hDCACascDaughters", kTH1F, {axisDCAdau}); + histos.add("XiXiBar/AntiXi/hDCAV0Daughters", "hDCAV0Daughters", kTH1F, {axisDCAdau}); + histos.add("XiXiBar/AntiXi/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); + histos.add("XiXiBar/AntiXi/hV0PointingAngle", "hV0PointingAngle", kTH1F, {axisPointingAngle}); + histos.add("XiXiBar/AntiXi/hV0Radius", "hV0Radius", kTH1F, {axisRadius}); + histos.add("XiXiBar/AntiXi/hCascPointingAngle", "hCascPointingAngle", kTH1F, {axisPointingAngle}); + histos.add("XiXiBar/AntiXi/hCascRadius", "hCascRadius", kTH1F, {axisRadius}); + histos.add("XiXiBar/AntiXi/hCascDecayLength", "hCascDecayLength", kTH1F, {axisProperLifeTime}); + histos.add("XiXiBar/AntiXi/hV0InvMassWindow", "hV0InvMassWindow", kTH1F, {axisMassWindow}); + histos.add("XiXiBar/AntiXi/hCascInvMassWindow", "hCascInvMassWindow", kTH1F, {axisMassWindow}); + histos.add("XiXiBar/AntiXi/h2dCompetingMassRej", "h2dCompetingMassRej", kTH2F, {axisXiMass, axisOmegaMass}); + histos.add("XiXiBar/AntiXi/hBachTPCNsigma", "hBachTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("XiXiBar/AntiXi/hPosTPCNsigma", "hPosTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("XiXiBar/AntiXi/hNegTPCNsigma", "hNegTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("XiXiBar/AntiXi/h2dBachelorITSvsTPCpts", "h2dBachelorITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("XiXiBar/AntiXi/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("XiXiBar/AntiXi/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + if (doMCAssociation) { + histos.add("XiXiBar/h3dInvMassTrueEtaC1S", "h3dInvMassTrueEtaC1S", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dInvMassTrueJPsi", "h3dInvMassTrueJPsi", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dInvMassTrueChiC0", "h3dInvMassTrueChiC0", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dInvMassTrueChiC1", "h3dInvMassTrueChiC1", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dInvMassTrueHC", "h3dInvMassTrueHC", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dInvMassTrueChiC2", "h3dInvMassTrueChiC2", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dInvMassTrueEtaC2S", "h3dInvMassTrueEtaC2S", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("XiXiBar/h3dInvMassTruePsi2S", "h3dInvMassTruePsi2S", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + } + } + if (buildOmOmBarPairs) { + histos.add("OmOmBar/h3dMassOmOmbar", "h3dMassOmOmbar", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + if (!isPP) { + // Non-UPC info + histos.add("OmOmBar/h3dMassOmOmbarHadronic", "h3dMassOmOmbarHadronic", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + // UPC info + histos.add("OmOmBar/h3dMassOmOmbarSGA", "h3dMassOmOmbarSGA", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("OmOmBar/h3dMassOmOmbarSGC", "h3dMassOmOmbarSGC", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("OmOmBar/h3dMassOmOmbarDG", "h3dMassOmOmbarDG", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + } + histos.add("OmOmBar/h2dNbrOfOmegaVsCentrality", "h2dNbrOfOmegaVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); + histos.add("OmOmBar/h2dNbrOfAntiOmegaVsCentrality", "h2dNbrOfAntiOmegaVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); + // QA plot + // Candidates after Omega selections + histos.add("OmOmBar/Omega/hBachDCAToPV", "hBachDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("OmOmBar/Omega/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("OmOmBar/Omega/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("OmOmBar/Omega/hDCACascDaughters", "hDCACascDaughters", kTH1F, {axisDCAdau}); + histos.add("OmOmBar/Omega/hDCAV0Daughters", "hDCAV0Daughters", kTH1F, {axisDCAdau}); + histos.add("OmOmBar/Omega/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); + histos.add("OmOmBar/Omega/hV0PointingAngle", "hV0PointingAngle", kTH1F, {axisPointingAngle}); + histos.add("OmOmBar/Omega/hV0Radius", "hV0Radius", kTH1F, {axisRadius}); + histos.add("OmOmBar/Omega/hCascPointingAngle", "hCascPointingAngle", kTH1F, {axisPointingAngle}); + histos.add("OmOmBar/Omega/hCascRadius", "hCascRadius", kTH1F, {axisRadius}); + histos.add("OmOmBar/Omega/hCascDecayLength", "hCascDecayLength", kTH1F, {axisProperLifeTime}); + histos.add("OmOmBar/Omega/hV0InvMassWindow", "hV0InvMassWindow", kTH1F, {axisMassWindow}); + histos.add("OmOmBar/Omega/hCascInvMassWindow", "hCascInvMassWindow", kTH1F, {axisMassWindow}); + histos.add("OmOmBar/Omega/h2dCompetingMassRej", "h2dCompetingMassRej", kTH2F, {axisXiMass, axisOmegaMass}); + histos.add("OmOmBar/Omega/hBachTPCNsigma", "hBachTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("OmOmBar/Omega/hPosTPCNsigma", "hPosTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("OmOmBar/Omega/hNegTPCNsigma", "hNegTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("OmOmBar/Omega/h2dBachelorITSvsTPCpts", "h2dBachelorITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("OmOmBar/Omega/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("OmOmBar/Omega/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + // Candidates after AntiOmega selections + histos.add("OmOmBar/AntiOmega/hBachDCAToPV", "hBachDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("OmOmBar/AntiOmega/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("OmOmBar/AntiOmega/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("OmOmBar/AntiOmega/hDCACascDaughters", "hDCACascDaughters", kTH1F, {axisDCAdau}); + histos.add("OmOmBar/AntiOmega/hDCAV0Daughters", "hDCAV0Daughters", kTH1F, {axisDCAdau}); + histos.add("OmOmBar/AntiOmega/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); + histos.add("OmOmBar/AntiOmega/hV0PointingAngle", "hV0PointingAngle", kTH1F, {axisPointingAngle}); + histos.add("OmOmBar/AntiOmega/hV0Radius", "hV0Radius", kTH1F, {axisRadius}); + histos.add("OmOmBar/AntiOmega/hCascPointingAngle", "hCascPointingAngle", kTH1F, {axisPointingAngle}); + histos.add("OmOmBar/AntiOmega/hCascRadius", "hCascRadius", kTH1F, {axisRadius}); + histos.add("OmOmBar/AntiOmega/hCascDecayLength", "hCascDecayLength", kTH1F, {axisProperLifeTime}); + histos.add("OmOmBar/AntiOmega/hV0InvMassWindow", "hV0InvMassWindow", kTH1F, {axisMassWindow}); + histos.add("OmOmBar/AntiOmega/hCascInvMassWindow", "hCascInvMassWindow", kTH1F, {axisMassWindow}); + histos.add("OmOmBar/AntiOmega/h2dCompetingMassRej", "h2dCompetingMassRej", kTH2F, {axisXiMass, axisOmegaMass}); + histos.add("OmOmBar/AntiOmega/hBachTPCNsigma", "hBachTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("OmOmBar/AntiOmega/hPosTPCNsigma", "hPosTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("OmOmBar/AntiOmega/hNegTPCNsigma", "hNegTPCNsigma", kTH1F, {axisNsigmaTPC}); + histos.add("OmOmBar/AntiOmega/h2dBachelorITSvsTPCpts", "h2dBachelorITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("OmOmBar/AntiOmega/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("OmOmBar/AntiOmega/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + if (doMCAssociation) { + histos.add("OmOmBar/h3dInvMassTrueEtaC2S", "h3dInvMassTrueEtaC2S", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + histos.add("OmOmBar/h3dInvMassTruePsi2S", "h3dInvMassTruePsi2S", kTH3F, {axisCentrality, axisPt, axisQuarkoniumMass}); + } + } + + if (cfgSkimmedProcessing) { + zorroSummary.setObject(zorro.getZorroSummary()); + } + + // inspect histogram sizes, please + histos.print(); + } + + template // TCollision should be of the type: soa::Join::iterator or so + void initCCDB(TCollision const& collision) + { + if (mRunNumber == collision.runNumber()) { + return; + } + + mRunNumber = collision.runNumber(); + if (cfgSkimmedProcessing) { + ccdb->setURL(ccdbConfigurations.ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + zorro.initCCDB(ccdb.service, collision.runNumber(), collision.timestamp(), cfgSkimmedTrigger.value); + zorro.populateHistRegistry(histos, collision.runNumber()); + } + + // machine learning initialization if requested + if (mlConfigurations.calculateK0ShortScores || + mlConfigurations.calculateLambdaScores || + mlConfigurations.calculateAntiLambdaScores) { + int64_t timeStampML = collision.timestamp(); + if (mlConfigurations.timestampCCDB.value != -1) + timeStampML = mlConfigurations.timestampCCDB.value; + LoadMachines(timeStampML); + } + } + + // function to load models for ML-based classifiers + void LoadMachines(int64_t timeStampML) + { + if (mlConfigurations.loadCustomModelsFromCCDB) { + ccdbApi.init(ccdbConfigurations.ccdburl); + LOG(info) << "Fetching models for timestamp: " << timeStampML; + + if (mlConfigurations.calculateLambdaScores) { + bool retrieveSuccessLambda = ccdbApi.retrieveBlob(mlConfigurations.customModelPathCCDB, ".", metadata, timeStampML, false, mlConfigurations.localModelPathLambda.value); + if (retrieveSuccessLambda) { + mlCustomModelLambda.initModel(mlConfigurations.localModelPathLambda.value, mlConfigurations.enableOptimizations.value); + } else { + LOG(fatal) << "Error encountered while fetching/loading the Lambda model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; + } + } + + if (mlConfigurations.calculateAntiLambdaScores) { + bool retrieveSuccessAntiLambda = ccdbApi.retrieveBlob(mlConfigurations.customModelPathCCDB, ".", metadata, timeStampML, false, mlConfigurations.localModelPathAntiLambda.value); + if (retrieveSuccessAntiLambda) { + mlCustomModelAntiLambda.initModel(mlConfigurations.localModelPathAntiLambda.value, mlConfigurations.enableOptimizations.value); + } else { + LOG(fatal) << "Error encountered while fetching/loading the AntiLambda model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; + } + } + + if (mlConfigurations.calculateK0ShortScores) { + bool retrieveSuccessKZeroShort = ccdbApi.retrieveBlob(mlConfigurations.customModelPathCCDB, ".", metadata, timeStampML, false, mlConfigurations.localModelPathK0Short.value); + if (retrieveSuccessKZeroShort) { + mlCustomModelK0Short.initModel(mlConfigurations.localModelPathK0Short.value, mlConfigurations.enableOptimizations.value); + } else { + LOG(fatal) << "Error encountered while fetching/loading the K0Short model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; + } + } + } else { + if (mlConfigurations.calculateLambdaScores) + mlCustomModelLambda.initModel(mlConfigurations.localModelPathLambda.value, mlConfigurations.enableOptimizations.value); + if (mlConfigurations.calculateAntiLambdaScores) + mlCustomModelAntiLambda.initModel(mlConfigurations.localModelPathAntiLambda.value, mlConfigurations.enableOptimizations.value); + if (mlConfigurations.calculateK0ShortScores) + mlCustomModelK0Short.initModel(mlConfigurations.localModelPathK0Short.value, mlConfigurations.enableOptimizations.value); + } + LOG(info) << "ML Models loaded."; + } + + template + bool IsEventAccepted(TCollision collision, bool fillHists) + // check whether the collision passes our collision selections + { + if (fillHists) + histos.fill(HIST("hEventSelection"), 0. /* all collisions */); + if (requireSel8 && !collision.sel8()) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); + + if (std::abs(collision.posZ()) > 10.f) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 2 /* vertex-Z selected */); + + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); + + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); + + if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 5 /* Contains at least one ITS-TPC track */); + + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 6 /* PV position consistency check */); + + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 7 /* PV with at least one contributor matched with TOF */); + + if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TRD */); + + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 9 /* Not at same bunch pile-up */); + + if (requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 10 /* No other collision within +/- 10 microseconds */); + + if (requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 4 microseconds */); + + if (minOccupancy > 0 && collision.trackOccupancyInTimeRange() < minOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 12 /* Below min occupancy */); + if (maxOccupancy > 0 && collision.trackOccupancyInTimeRange() > maxOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 13 /* Above max occupancy */); + + return true; + } + + template + void fillEventHistograms(TCollision collision, float& centrality, int& selGapSide) + { + if (isPP) { // + centrality = collision.centFT0M(); + + if (qaCentrality) { + auto hRawCentrality = histos.get(HIST("hRawCentrality")); + centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(collision.multFT0A() + collision.multFT0C())); + } + } else { + centrality = collision.centFT0C(); + + if (qaCentrality) { + auto hRawCentrality = histos.get(HIST("hRawCentrality")); + centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(collision.multFT0C())); + } + } + + // in case we want to push the analysis to Pb-Pb UPC + int gapSide = collision.gapSide(); + if (!isPP) { + // -1 --> Hadronic + // 0 --> Single Gap - A side + // 1 --> Single Gap - C side + // 2 --> Double Gap - both A & C sides + selGapSide = sgSelector.trueGap(collision, upcCuts.FV0cut, upcCuts.FT0Acut, upcCuts.FT0Ccut, upcCuts.ZDCcut); + histos.fill(HIST("hGapSide"), gapSide); + histos.fill(HIST("hSelGapSide"), selGapSide); + histos.fill(HIST("hEventCentralityVsSelGapSide"), centrality, selGapSide <= 2 ? selGapSide : -1); + } + + histos.fill(HIST("hEventCentrality"), centrality); + + histos.fill(HIST("hCentralityVsNch"), centrality, collision.multNTracksPVeta1()); + + histos.fill(HIST("hEventOccupancy"), collision.trackOccupancyInTimeRange()); + histos.fill(HIST("hCentralityVsOccupancy"), centrality, collision.trackOccupancyInTimeRange()); + + return; + } + + template + uint64_t computeReconstructionBitmap(TV0 v0, TCollision collision, float rapidityLambda, float rapidityK0Short, float /*pT*/) + // precalculate this information so that a check is one mask operation, not many + { + uint64_t bitMap = 0; + + // + // Base topological variables + // + + // v0 radius min/max selections + if (v0.v0radius() > v0Selections.v0radius) + bitset(bitMap, selRadius); + if (v0.v0radius() < v0Selections.v0radiusMax) + bitset(bitMap, selRadiusMax); + // DCA proton and pion to PV for Lambda and AntiLambda decay hypotheses + if (TMath::Abs(v0.dcapostopv()) > v0Selections.dcaprotontopv && + TMath::Abs(v0.dcanegtopv()) > v0Selections.dcapiontopv) { + bitset(bitMap, selDCAPosToPV); + bitset(bitMap, selDCANegToPV); + } else if (TMath::Abs(v0.dcapostopv()) > v0Selections.dcapiontopv && + TMath::Abs(v0.dcanegtopv()) > v0Selections.dcaprotontopv) { + bitset(bitMap, selDCAPosToPV); + bitset(bitMap, selDCANegToPV); + } + // V0 cosine of pointing angle + if (v0.v0cosPA() > v0Selections.v0cospa) + bitset(bitMap, selCosPA); + // DCA between v0 daughters + if (v0.dcaV0daughters() < v0Selections.dcav0dau) + bitset(bitMap, selDCAV0Dau); + // DCA V0 to prim vtx + if (v0.dcav0topv() > v0Selections.dcav0topv) + bitset(bitMap, selDCAV0ToPV); + + // + // rapidity + // + if (TMath::Abs(rapidityLambda) < v0Selections.rapidityCut) + bitset(bitMap, selLambdaRapidity); + if (TMath::Abs(rapidityK0Short) < v0Selections.rapidityCut) + bitset(bitMap, selK0ShortRapidity); + + // + // invariant mass window + // + if (TMath::Abs(v0.mK0Short() - pdgDB->Mass(310)) < v0Selections.v0MassWindow) + bitset(bitMap, selK0ShortMassWindow); + if (TMath::Abs(v0.mLambda() - pdgDB->Mass(3122)) < v0Selections.v0MassWindow) + bitset(bitMap, selLambdaMassWindow); + if (TMath::Abs(v0.mAntiLambda() - pdgDB->Mass(3122)) < v0Selections.v0MassWindow) + bitset(bitMap, selAntiLambdaMassWindow); + + // + // competing mass rejection + // + if (TMath::Abs(v0.mK0Short() - pdgDB->Mass(310)) > v0Selections.compMassRejection) + bitset(bitMap, selK0ShortMassRejection); + if (TMath::Abs(v0.mLambda() - pdgDB->Mass(3122)) > v0Selections.compMassRejection) + bitset(bitMap, selLambdaMassRejection); + + auto posTrackExtra = v0.template posTrackExtra_as(); + auto negTrackExtra = v0.template negTrackExtra_as(); + + // + // ITS quality flags + // + if (posTrackExtra.itsNCls() >= v0Selections.minITSclusters) + bitset(bitMap, selPosGoodITSTrack); + if (negTrackExtra.itsNCls() >= v0Selections.minITSclusters) + bitset(bitMap, selNegGoodITSTrack); + + // + // TPC quality flags + // + if (posTrackExtra.tpcCrossedRows() >= v0Selections.minTPCrows) + bitset(bitMap, selPosGoodTPCTrack); + if (negTrackExtra.tpcCrossedRows() >= v0Selections.minTPCrows) + bitset(bitMap, selNegGoodTPCTrack); + + // + // TPC PID + // + if (fabs(posTrackExtra.tpcNSigmaPi()) < v0Selections.TpcPidNsigmaCut) + bitset(bitMap, selTPCPIDPositivePion); + if (fabs(posTrackExtra.tpcNSigmaPr()) < v0Selections.TpcPidNsigmaCut) + bitset(bitMap, selTPCPIDPositiveProton); + if (fabs(negTrackExtra.tpcNSigmaPi()) < v0Selections.TpcPidNsigmaCut) + bitset(bitMap, selTPCPIDNegativePion); + if (fabs(negTrackExtra.tpcNSigmaPr()) < v0Selections.TpcPidNsigmaCut) + bitset(bitMap, selTPCPIDNegativeProton); + + // + // TOF PID in DeltaT + // Positive track + if (fabs(v0.posTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton) + bitset(bitMap, selTOFDeltaTPositiveProtonLambda); + if (fabs(v0.posTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion) + bitset(bitMap, selTOFDeltaTPositivePionLambda); + if (fabs(v0.posTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion) + bitset(bitMap, selTOFDeltaTPositivePionK0Short); + // Negative track + if (fabs(v0.negTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton) + bitset(bitMap, selTOFDeltaTNegativeProtonLambda); + if (fabs(v0.negTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion) + bitset(bitMap, selTOFDeltaTNegativePionLambda); + if (fabs(v0.negTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion) + bitset(bitMap, selTOFDeltaTNegativePionK0Short); + + // + // TOF PID in NSigma + // Positive track + if (fabs(v0.tofNSigmaLaPr()) < v0Selections.TofPidNsigmaCutLaPr) + bitset(bitMap, selTOFNSigmaPositiveProtonLambda); + if (fabs(v0.tofNSigmaALaPi()) < v0Selections.TofPidNsigmaCutLaPi) + bitset(bitMap, selTOFNSigmaPositivePionLambda); + if (fabs(v0.tofNSigmaK0PiPlus()) < v0Selections.TofPidNsigmaCutK0Pi) + bitset(bitMap, selTOFNSigmaPositivePionK0Short); + // Negative track + if (fabs(v0.tofNSigmaALaPr()) < v0Selections.TofPidNsigmaCutLaPr) + bitset(bitMap, selTOFNSigmaNegativeProtonLambda); + if (fabs(v0.tofNSigmaLaPi()) < v0Selections.TofPidNsigmaCutLaPi) + bitset(bitMap, selTOFNSigmaNegativePionLambda); + if (fabs(v0.tofNSigmaK0PiMinus()) < v0Selections.TofPidNsigmaCutK0Pi) + bitset(bitMap, selTOFNSigmaNegativePionK0Short); + + // + // ITS only tag + if (posTrackExtra.tpcCrossedRows() < 1) + bitset(bitMap, selPosItsOnly); + if (negTrackExtra.tpcCrossedRows() < 1) + bitset(bitMap, selNegItsOnly); + + // + // TPC only tag + if (posTrackExtra.detectorMap() != o2::aod::track::TPC) + bitset(bitMap, selPosNotTPCOnly); + if (negTrackExtra.detectorMap() != o2::aod::track::TPC) + bitset(bitMap, selNegNotTPCOnly); + + // + // proper lifetime + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda")) + bitset(bitMap, selLambdaCTau); + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S")) + bitset(bitMap, selK0ShortCTau); + + // + // armenteros + if (v0.qtarm() * v0Selections.armPodCut > TMath::Abs(v0.alpha()) || v0Selections.armPodCut < 1e-4) + bitset(bitMap, selK0ShortArmenteros); + + return bitMap; + } + + template + bool isCascadeSelected(TCascade casc, TCollision collision, float rapidity, bool isXi) + // precalculate this information so that a check is one mask operation, not many + { + // + // Base topological variables + // + + // v0 radius min/max selections + if (casc.v0radius() < cascSelections.v0radius) + return false; + if (casc.v0radius() > cascSelections.v0radiusMax) + return false; + // DCA proton and pion to PV for Lambda and AntiLambda decay hypotheses + if (casc.sign() < 0) { // Xi- or Omega- --> positive/negative daughter = proton/pion + if (TMath::Abs(casc.dcapostopv()) < cascSelections.dcaprotontopv) + return false; + if (TMath::Abs(casc.dcanegtopv()) < cascSelections.dcapiontopv) + return false; + } else { // Xi+ or Omega+ --> positive/negative daughter = pion/proton + if (TMath::Abs(casc.dcapostopv()) < cascSelections.dcapiontopv) + return false; + if (TMath::Abs(casc.dcanegtopv()) < cascSelections.dcaprotontopv) + return false; + } + // V0 cosine of pointing angle + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascSelections.v0cospa) + return false; + // DCA between v0 daughters + if (casc.dcaV0daughters() > cascSelections.dcav0dau) + return false; + // DCA V0 to prim vtx + if (casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < cascSelections.dcav0topv) + return false; + + // casc radius min/max selections + if (casc.cascradius() < cascSelections.cascradius) + return false; + if (casc.cascradius() > cascSelections.cascradiusMax) + return false; + // DCA bachelor selection + if (TMath::Abs(casc.dcabachtopv()) < cascSelections.dcabachtopv) + return false; + // Bachelor-baryon cosPA selection + if (casc.bachBaryonCosPA() < cascSelections.bachbaryoncospa) + return false; + // DCA bachelor-baryon selection + if (TMath::Abs(casc.bachBaryonDCAxyToPV()) < cascSelections.dcaxybachbaryontopv) + return false; + // casc cosine of pointing angle + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascSelections.casccospa) + return false; + // DCA between casc daughters + if (casc.dcacascdaughters() > cascSelections.dcacascdau) + return false; + + // + // rapidity + // + if (TMath::Abs(rapidity) > cascSelections.rapidityCut) + return false; + + // + // invariant mass window + // + if (TMath::Abs(casc.mLambda() - pdgDB->Mass(3122)) > cascSelections.v0MassWindow) + return false; + if (isXi && TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > cascSelections.cascMassWindow) + return false; + if (!isXi && TMath::Abs(casc.mOmega() - pdgDB->Mass(3334)) > cascSelections.cascMassWindow) + return false; + + // + // competing mass rejection + // + if (isXi && TMath::Abs(casc.mOmega() - pdgDB->Mass(3334)) < cascSelections.compMassRejection) + return false; + if (!isXi && TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) < cascSelections.compMassRejection) + return false; + + auto bachTrackExtra = casc.template bachTrackExtra_as(); + auto posTrackExtra = casc.template posTrackExtra_as(); + auto negTrackExtra = casc.template negTrackExtra_as(); + + // + // ITS quality flags + // + if (bachTrackExtra.itsNCls() < cascSelections.minITSclusters) + return false; + if (posTrackExtra.itsNCls() < cascSelections.minITSclusters) + return false; + if (negTrackExtra.itsNCls() < cascSelections.minITSclusters) + return false; + + // + // TPC quality flags + // + if (bachTrackExtra.tpcCrossedRows() < cascSelections.minTPCrows) + return false; + if (posTrackExtra.tpcCrossedRows() < cascSelections.minTPCrows) + return false; + if (negTrackExtra.tpcCrossedRows() < cascSelections.minTPCrows) + return false; + + // + // TPC PID + // + if (isXi && fabs(bachTrackExtra.tpcNSigmaPi()) > cascSelections.TpcPidNsigmaCut) + return false; + if (!isXi && fabs(bachTrackExtra.tpcNSigmaKa()) > cascSelections.TpcPidNsigmaCut) + return false; + if (casc.sign() < 0) { // Xi- or Omega- --> positive/negative daughter = proton/pion + if (fabs(posTrackExtra.tpcNSigmaPr()) > cascSelections.TpcPidNsigmaCut) + return false; + if (fabs(negTrackExtra.tpcNSigmaPi()) > cascSelections.TpcPidNsigmaCut) + return false; + } else { // Xi+ or Omega+ --> positive/negative daughter = pion/proton + if (fabs(posTrackExtra.tpcNSigmaPi()) > cascSelections.TpcPidNsigmaCut) + return false; + if (fabs(negTrackExtra.tpcNSigmaPr()) > cascSelections.TpcPidNsigmaCut) + return false; + } + + // + // TOF PID in DeltaT + // Bachelor track + if (bachTrackExtra.hasTOF()) { + if (isXi && fabs(casc.bachTOFDeltaTXiPi()) > cascSelections.maxDeltaTimePion) + return false; + if (!isXi && fabs(casc.bachTOFDeltaTOmKa()) > cascSelections.maxDeltaTimeKaon) + return false; + } + // Positive track + if (posTrackExtra.hasTOF()) { + if (casc.sign() < 0) { // Xi- or Omega- --> positive daughter = proton + if (isXi && fabs(casc.posTOFDeltaTXiPr()) > cascSelections.maxDeltaTimeProton) + return false; + if (!isXi && fabs(casc.posTOFDeltaTOmPr()) > cascSelections.maxDeltaTimeProton) + return false; + } else { // Xi+ or Omega+ --> positive daughter = pion + if (isXi && fabs(casc.posTOFDeltaTXiPi()) > cascSelections.maxDeltaTimePion) + return false; + if (!isXi && fabs(casc.posTOFDeltaTOmPi()) > cascSelections.maxDeltaTimePion) + return false; + } + } + // Negative track + if (negTrackExtra.hasTOF()) { + if (casc.sign() < 0) { // Xi- or Omega- --> negative daughter = pion + if (isXi && fabs(casc.negTOFDeltaTXiPi()) > cascSelections.maxDeltaTimePion) + return false; + if (!isXi && fabs(casc.negTOFDeltaTOmPi()) > cascSelections.maxDeltaTimePion) + return false; + } else { // Xi+ or Omega+ --> negative daughter = proton + if (isXi && fabs(casc.negTOFDeltaTXiPr()) > cascSelections.maxDeltaTimeProton) + return false; + if (!isXi && fabs(casc.negTOFDeltaTOmPr()) > cascSelections.maxDeltaTimeProton) + return false; + } + } + + // + // TOF PID in NSigma + // Bachelor track + if (bachTrackExtra.hasTOF()) { + if (isXi && fabs(casc.tofNSigmaXiPi()) > cascSelections.TofPidNsigmaCutXiPi) + return false; + if (!isXi && fabs(casc.tofNSigmaOmKa()) > cascSelections.TofPidNsigmaCutOmKa) + return false; + } + // Positive track + if (posTrackExtra.hasTOF()) { + if (casc.sign() < 0) { // Xi- or Omega- --> positive daughter = proton + if (isXi && fabs(casc.tofNSigmaXiLaPr()) > cascSelections.TofPidNsigmaCutLaPr) + return false; + if (!isXi && fabs(casc.tofNSigmaOmLaPr()) > cascSelections.TofPidNsigmaCutLaPr) + return false; + } else { // Xi+ or Omega+ --> positive daughter = pion + if (isXi && fabs(casc.tofNSigmaXiLaPi()) > cascSelections.TofPidNsigmaCutLaPi) + return false; + if (!isXi && fabs(casc.tofNSigmaOmLaPi()) > cascSelections.TofPidNsigmaCutLaPi) + return false; + } + } + // Negative track + if (negTrackExtra.hasTOF()) { + if (casc.sign() < 0) { // Xi- or Omega- --> negative daughter = pion + if (isXi && fabs(casc.tofNSigmaXiLaPr()) > cascSelections.TofPidNsigmaCutLaPi) + return false; + if (!isXi && fabs(casc.tofNSigmaOmLaPr()) > cascSelections.TofPidNsigmaCutLaPi) + return false; + } else { // Xi+ or Omega+ --> negative daughter = proton + if (isXi && fabs(casc.tofNSigmaXiLaPi()) > cascSelections.TofPidNsigmaCutLaPr) + return false; + if (!isXi && fabs(casc.tofNSigmaOmLaPi()) > cascSelections.TofPidNsigmaCutLaPr) + return false; + } + } + + // + // proper lifetime + float distOverTotMom = std::sqrt(std::pow(casc.x() - collision.posX(), 2) + std::pow(casc.y() - collision.posY(), 2) + std::pow(casc.z() - collision.posZ(), 2)) / (casc.p() + 1E-10); + if (isXi && distOverTotMom * o2::constants::physics::MassXiMinus / ctauXiPDG > cascSelections.cascProperLifeTime) + return false; + if (!isXi && distOverTotMom * o2::constants::physics::MassOmegaMinus / ctauOmegaPDG > cascSelections.cascProperLifeTime) + return false; + + // + // MC association (if asked) + if (doMCAssociation) { + if constexpr (requires { casc.template cascMCCore_as>(); }) { // check if MC information is available + auto cascMC = casc.template cascMCCore_as>(); + + if (isXi) { + if (casc.sign() < 0) { + if (cascMC.pdgCode() != 3312 || cascMC.pdgCodePositive() != 2212 || cascMC.pdgCodeNegative() != -211 || cascMC.pdgCodeBachelor() != -211) + return false; + } else { + if (cascMC.pdgCode() != -3312 || cascMC.pdgCodePositive() != 211 || cascMC.pdgCodeNegative() != -2212 || cascMC.pdgCodeBachelor() != 211) + return false; + } + } else { + if (casc.sign() < 0) { + if (cascMC.pdgCode() != 3334 || cascMC.pdgCodePositive() != 2212 || cascMC.pdgCodeNegative() != -211 || cascMC.pdgCodeBachelor() != -321) + return false; + } else { + if (cascMC.pdgCode() != -3334 || cascMC.pdgCodePositive() != 211 || cascMC.pdgCodeNegative() != -2212 || cascMC.pdgCodeBachelor() != 321) + return false; + } + } + } + } + + return true; + } + + template + uint64_t computeMCAssociation(TV0 v0) + // precalculate this information so that a check is one mask operation, not many + { + uint64_t bitMap = 0; + // check for specific particle species + + if (v0.pdgCode() == 310 && v0.pdgCodePositive() == 211 && v0.pdgCodeNegative() == -211) { + bitset(bitMap, selConsiderK0Short); + if (v0.isPhysicalPrimary()) + bitset(bitMap, selPhysPrimK0Short); + } + if (v0.pdgCode() == 3122 && v0.pdgCodePositive() == 2212 && v0.pdgCodeNegative() == -211) { + bitset(bitMap, selConsiderLambda); + if (v0.isPhysicalPrimary()) + bitset(bitMap, selPhysPrimLambda); + } + if (v0.pdgCode() == -3122 && v0.pdgCodePositive() == 211 && v0.pdgCodeNegative() == -2212) { + bitset(bitMap, selConsiderAntiLambda); + if (v0.isPhysicalPrimary()) + bitset(bitMap, selPhysPrimAntiLambda); + } + return bitMap; + } + + bool verifyMask(uint64_t bitmap, uint64_t mask) + { + return (bitmap & mask) == mask; + } + + template + void analyseV0Candidate(TV0 v0, float pt, uint64_t selMap, std::vector& selK0ShortIndices, std::vector& selLambdaIndices, std::vector& selAntiLambdaIndices, int v0TableOffset) + // precalculate this information so that a check is one mask operation, not many + { + bool passK0ShortSelections = false; + bool passLambdaSelections = false; + bool passAntiLambdaSelections = false; + + // machine learning is on, go for calculation of thresholds + // FIXME THIS NEEDS ADJUSTING + std::vector inputFeatures{pt, 0.0f, 0.0f, v0.v0radius(), v0.v0cosPA(), v0.dcaV0daughters(), v0.dcapostopv(), v0.dcanegtopv()}; + + if (mlConfigurations.useK0ShortScores) { + float k0shortScore = -1; + if (mlConfigurations.calculateK0ShortScores) { + // evaluate machine-learning scores + float* k0shortProbability = mlCustomModelK0Short.evalModel(inputFeatures); + k0shortScore = k0shortProbability[1]; + } else { + k0shortScore = v0.k0ShortBDTScore(); + } + if (k0shortScore > mlConfigurations.thresholdK0Short.value) { + passK0ShortSelections = true; + } + } else { + passK0ShortSelections = verifyMask(selMap, maskSelectionK0Short); + } + if (mlConfigurations.useLambdaScores) { + float lambdaScore = -1; + if (mlConfigurations.calculateLambdaScores) { + // evaluate machine-learning scores + float* lambdaProbability = mlCustomModelLambda.evalModel(inputFeatures); + lambdaScore = lambdaProbability[1]; + } else { + lambdaScore = v0.lambdaBDTScore(); + } + if (lambdaScore > mlConfigurations.thresholdK0Short.value) { + passLambdaSelections = true; + } + } else { + passLambdaSelections = verifyMask(selMap, maskSelectionLambda); + } + if (mlConfigurations.useLambdaScores) { + float antiLambdaScore = -1; + if (mlConfigurations.calculateAntiLambdaScores) { + // evaluate machine-learning scores + float* antilambdaProbability = mlCustomModelAntiLambda.evalModel(inputFeatures); + antiLambdaScore = antilambdaProbability[1]; + } else { + antiLambdaScore = v0.antiLambdaBDTScore(); + } + if (antiLambdaScore > mlConfigurations.thresholdK0Short.value) { + passAntiLambdaSelections = true; + } + } else { + passAntiLambdaSelections = verifyMask(selMap, maskSelectionAntiLambda); + } + + // need local index because of the grouping of collisions + selK0ShortIndices[v0.globalIndex() - v0TableOffset] = passK0ShortSelections; + selLambdaIndices[v0.globalIndex() - v0TableOffset] = passLambdaSelections; + selAntiLambdaIndices[v0.globalIndex() - v0TableOffset] = passAntiLambdaSelections; + } + + template + void fillQAplot(TCollision collision, THyperon hyperon, THyperon antiHyperon, int type) + { // fill QA information about hyperon - antihyperon pair + if (type == 0) { + if constexpr (requires { hyperon.mK0Short(); antiHyperon.mK0Short(); }) { // check if v0 information is available + auto posTrackExtraHyperon = hyperon.template posTrackExtra_as(); + auto negTrackExtraHyperon = hyperon.template negTrackExtra_as(); + + auto posTrackExtraAntiHyperon = antiHyperon.template posTrackExtra_as(); + auto negTrackExtraAntiHyperon = antiHyperon.template negTrackExtra_as(); + + float hyperonDecayLength = std::sqrt(std::pow(hyperon.x() - collision.posX(), 2) + std::pow(hyperon.y() - collision.posY(), 2) + std::pow(hyperon.z() - collision.posZ(), 2)) * o2::constants::physics::MassLambda0 / (hyperon.p() + 1E-10); + float antiHyperonDecayLength = std::sqrt(std::pow(antiHyperon.x() - collision.posX(), 2) + std::pow(antiHyperon.y() - collision.posY(), 2) + std::pow(antiHyperon.z() - collision.posZ(), 2)) * o2::constants::physics::MassLambda0 / (antiHyperon.p() + 1E-10); + + // Candidates after Lambda selections + histos.fill(HIST("LaLaBar/Lambda/hPosDCAToPV"), hyperon.dcapostopv()); + histos.fill(HIST("LaLaBar/Lambda/hNegDCAToPV"), hyperon.dcapostopv()); + histos.fill(HIST("LaLaBar/Lambda/hDCAV0Daughters"), hyperon.dcaV0daughters()); + histos.fill(HIST("LaLaBar/Lambda/hDCAV0ToPV"), hyperon.dcav0topv()); + histos.fill(HIST("LaLaBar/Lambda/hV0PointingAngle"), hyperon.v0cosPA()); + histos.fill(HIST("LaLaBar/Lambda/hV0Radius"), hyperon.v0radius()); + histos.fill(HIST("LaLaBar/Lambda/hV0DecayLength"), hyperonDecayLength); + histos.fill(HIST("LaLaBar/Lambda/hV0InvMassWindow"), hyperon.mLambda() - pdgDB->Mass(3122)); + histos.fill(HIST("LaLaBar/Lambda/h2dCompetingMassRej"), hyperon.mLambda(), hyperon.mK0Short()); + histos.fill(HIST("LaLaBar/Lambda/hPosTPCNsigma"), posTrackExtraHyperon.tpcNSigmaPr()); + histos.fill(HIST("LaLaBar/Lambda/hNegTPCNsigma"), negTrackExtraHyperon.tpcNSigmaPi()); + histos.fill(HIST("LaLaBar/Lambda/h2dPositiveITSvsTPCpts"), posTrackExtraHyperon.tpcCrossedRows(), posTrackExtraHyperon.itsNCls()); + histos.fill(HIST("LaLaBar/Lambda/h2dNegativeITSvsTPCpts"), negTrackExtraHyperon.tpcCrossedRows(), negTrackExtraHyperon.itsNCls()); + // Candidates after AntiLambda selections + histos.fill(HIST("LaLaBar/AntiLambda/hPosDCAToPV"), antiHyperon.dcapostopv()); + histos.fill(HIST("LaLaBar/AntiLambda/hNegDCAToPV"), antiHyperon.dcapostopv()); + histos.fill(HIST("LaLaBar/AntiLambda/hDCAV0Daughters"), antiHyperon.dcaV0daughters()); + histos.fill(HIST("LaLaBar/AntiLambda/hDCAV0ToPV"), antiHyperon.dcav0topv()); + histos.fill(HIST("LaLaBar/AntiLambda/hV0PointingAngle"), antiHyperon.v0cosPA()); + histos.fill(HIST("LaLaBar/AntiLambda/hV0Radius"), antiHyperon.v0radius()); + histos.fill(HIST("LaLaBar/AntiLambda/hV0DecayLength"), antiHyperonDecayLength); + histos.fill(HIST("LaLaBar/AntiLambda/hV0InvMassWindow"), antiHyperon.mLambda() - pdgDB->Mass(3122)); + histos.fill(HIST("LaLaBar/AntiLambda/h2dCompetingMassRej"), antiHyperon.mLambda(), antiHyperon.mK0Short()); + histos.fill(HIST("LaLaBar/AntiLambda/hPosTPCNsigma"), posTrackExtraAntiHyperon.tpcNSigmaPi()); + histos.fill(HIST("LaLaBar/AntiLambda/hNegTPCNsigma"), negTrackExtraAntiHyperon.tpcNSigmaPr()); + histos.fill(HIST("LaLaBar/AntiLambda/h2dPositiveITSvsTPCpts"), posTrackExtraAntiHyperon.tpcCrossedRows(), posTrackExtraAntiHyperon.itsNCls()); + histos.fill(HIST("LaLaBar/AntiLambda/h2dNegativeITSvsTPCpts"), negTrackExtraAntiHyperon.tpcCrossedRows(), negTrackExtraAntiHyperon.itsNCls()); + } + } + if (type == 1) { + if constexpr (requires { hyperon.dcabachtopv(); antiHyperon.dcabachtopv(); }) { // check if Cascade information is available + auto bachTrackExtraHyperon = hyperon.template bachTrackExtra_as(); + auto posTrackExtraHyperon = hyperon.template posTrackExtra_as(); + auto negTrackExtraHyperon = hyperon.template negTrackExtra_as(); + + auto bachTrackExtraAntiHyperon = antiHyperon.template bachTrackExtra_as(); + auto posTrackExtraAntiHyperon = antiHyperon.template posTrackExtra_as(); + auto negTrackExtraAntiHyperon = antiHyperon.template negTrackExtra_as(); + + float hyperonDecayLength = std::sqrt(std::pow(hyperon.x() - collision.posX(), 2) + std::pow(hyperon.y() - collision.posY(), 2) + std::pow(hyperon.z() - collision.posZ(), 2)) * o2::constants::physics::MassXiMinus / (hyperon.p() + 1E-10); + float antiHyperonDecayLength = std::sqrt(std::pow(antiHyperon.x() - collision.posX(), 2) + std::pow(antiHyperon.y() - collision.posY(), 2) + std::pow(antiHyperon.z() - collision.posZ(), 2)) * o2::constants::physics::MassXiMinus / (antiHyperon.p() + 1E-10); + + // Candidates after Xi selections + histos.fill(HIST("XiXiBar/Xi/hBachDCAToPV"), hyperon.dcabachtopv()); + histos.fill(HIST("XiXiBar/Xi/hPosDCAToPV"), hyperon.dcapostopv()); + histos.fill(HIST("XiXiBar/Xi/hNegDCAToPV"), hyperon.dcapostopv()); + histos.fill(HIST("XiXiBar/Xi/hDCACascDaughters"), hyperon.dcacascdaughters()); + histos.fill(HIST("XiXiBar/Xi/hDCAV0Daughters"), hyperon.dcaV0daughters()); + histos.fill(HIST("XiXiBar/Xi/hDCAV0ToPV"), hyperon.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("XiXiBar/Xi/hV0PointingAngle"), hyperon.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("XiXiBar/Xi/hV0Radius"), hyperon.v0radius()); + histos.fill(HIST("XiXiBar/Xi/hCascPointingAngle"), hyperon.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("XiXiBar/Xi/hCascRadius"), hyperon.cascradius()); + histos.fill(HIST("XiXiBar/Xi/hCascDecayLength"), hyperonDecayLength); + histos.fill(HIST("XiXiBar/Xi/hV0InvMassWindow"), hyperon.mLambda() - pdgDB->Mass(3122)); + histos.fill(HIST("XiXiBar/Xi/hCascInvMassWindow"), hyperon.mXi() - pdgDB->Mass(3312)); + histos.fill(HIST("XiXiBar/Xi/h2dCompetingMassRej"), hyperon.mXi(), hyperon.mOmega()); + histos.fill(HIST("XiXiBar/Xi/hBachTPCNsigma"), bachTrackExtraHyperon.tpcNSigmaPi()); + histos.fill(HIST("XiXiBar/Xi/hPosTPCNsigma"), posTrackExtraHyperon.tpcNSigmaPr()); + histos.fill(HIST("XiXiBar/Xi/hNegTPCNsigma"), negTrackExtraHyperon.tpcNSigmaPi()); + histos.fill(HIST("XiXiBar/Xi/h2dBachelorITSvsTPCpts"), bachTrackExtraHyperon.tpcCrossedRows(), bachTrackExtraHyperon.itsNCls()); + histos.fill(HIST("XiXiBar/Xi/h2dPositiveITSvsTPCpts"), posTrackExtraHyperon.tpcCrossedRows(), posTrackExtraHyperon.itsNCls()); + histos.fill(HIST("XiXiBar/Xi/h2dNegativeITSvsTPCpts"), negTrackExtraHyperon.tpcCrossedRows(), negTrackExtraHyperon.itsNCls()); + // Candidates after AntiXi selections + histos.fill(HIST("XiXiBar/AntiXi/hBachDCAToPV"), antiHyperon.dcabachtopv()); + histos.fill(HIST("XiXiBar/AntiXi/hPosDCAToPV"), antiHyperon.dcapostopv()); + histos.fill(HIST("XiXiBar/AntiXi/hNegDCAToPV"), antiHyperon.dcapostopv()); + histos.fill(HIST("XiXiBar/AntiXi/hDCACascDaughters"), antiHyperon.dcacascdaughters()); + histos.fill(HIST("XiXiBar/AntiXi/hDCAV0Daughters"), antiHyperon.dcaV0daughters()); + histos.fill(HIST("XiXiBar/AntiXi/hDCAV0ToPV"), antiHyperon.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("XiXiBar/AntiXi/hV0PointingAngle"), antiHyperon.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("XiXiBar/AntiXi/hV0Radius"), antiHyperon.v0radius()); + histos.fill(HIST("XiXiBar/AntiXi/hCascPointingAngle"), antiHyperon.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("XiXiBar/AntiXi/hCascRadius"), antiHyperon.cascradius()); + histos.fill(HIST("XiXiBar/AntiXi/hCascDecayLength"), antiHyperonDecayLength); + histos.fill(HIST("XiXiBar/AntiXi/hV0InvMassWindow"), antiHyperon.mLambda() - pdgDB->Mass(3122)); + histos.fill(HIST("XiXiBar/AntiXi/hCascInvMassWindow"), antiHyperon.mXi() - pdgDB->Mass(3312)); + histos.fill(HIST("XiXiBar/AntiXi/h2dCompetingMassRej"), antiHyperon.mXi(), antiHyperon.mOmega()); + histos.fill(HIST("XiXiBar/AntiXi/hBachTPCNsigma"), bachTrackExtraAntiHyperon.tpcNSigmaPi()); + histos.fill(HIST("XiXiBar/AntiXi/hPosTPCNsigma"), posTrackExtraAntiHyperon.tpcNSigmaPi()); + histos.fill(HIST("XiXiBar/AntiXi/hNegTPCNsigma"), negTrackExtraAntiHyperon.tpcNSigmaPr()); + histos.fill(HIST("XiXiBar/AntiXi/h2dBachelorITSvsTPCpts"), bachTrackExtraAntiHyperon.tpcCrossedRows(), bachTrackExtraAntiHyperon.itsNCls()); + histos.fill(HIST("XiXiBar/AntiXi/h2dPositiveITSvsTPCpts"), posTrackExtraAntiHyperon.tpcCrossedRows(), posTrackExtraAntiHyperon.itsNCls()); + histos.fill(HIST("XiXiBar/AntiXi/h2dNegativeITSvsTPCpts"), negTrackExtraAntiHyperon.tpcCrossedRows(), negTrackExtraAntiHyperon.itsNCls()); + } + } + if (type == 2) { + if constexpr (requires { hyperon.dcabachtopv(); antiHyperon.dcabachtopv(); }) { // check if Cascade information is available + auto bachTrackExtraHyperon = hyperon.template bachTrackExtra_as(); + auto posTrackExtraHyperon = hyperon.template posTrackExtra_as(); + auto negTrackExtraHyperon = hyperon.template negTrackExtra_as(); + + auto bachTrackExtraAntiHyperon = antiHyperon.template bachTrackExtra_as(); + auto posTrackExtraAntiHyperon = antiHyperon.template posTrackExtra_as(); + auto negTrackExtraAntiHyperon = antiHyperon.template negTrackExtra_as(); + + float hyperonDecayLength = std::sqrt(std::pow(hyperon.x() - collision.posX(), 2) + std::pow(hyperon.y() - collision.posY(), 2) + std::pow(hyperon.z() - collision.posZ(), 2)) * o2::constants::physics::MassOmegaMinus / (hyperon.p() + 1E-10); + float antiHyperonDecayLength = std::sqrt(std::pow(antiHyperon.x() - collision.posX(), 2) + std::pow(antiHyperon.y() - collision.posY(), 2) + std::pow(antiHyperon.z() - collision.posZ(), 2)) * o2::constants::physics::MassOmegaMinus / (antiHyperon.p() + 1E-10); + + // Candidates after Omega selections + histos.fill(HIST("OmOmBar/Omega/hBachDCAToPV"), hyperon.dcabachtopv()); + histos.fill(HIST("OmOmBar/Omega/hPosDCAToPV"), hyperon.dcapostopv()); + histos.fill(HIST("OmOmBar/Omega/hNegDCAToPV"), hyperon.dcapostopv()); + histos.fill(HIST("OmOmBar/Omega/hDCACascDaughters"), hyperon.dcacascdaughters()); + histos.fill(HIST("OmOmBar/Omega/hDCAV0Daughters"), hyperon.dcaV0daughters()); + histos.fill(HIST("OmOmBar/Omega/hDCAV0ToPV"), hyperon.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("OmOmBar/Omega/hV0PointingAngle"), hyperon.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("OmOmBar/Omega/hV0Radius"), hyperon.v0radius()); + histos.fill(HIST("OmOmBar/Omega/hCascPointingAngle"), hyperon.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("OmOmBar/Omega/hCascRadius"), hyperon.cascradius()); + histos.fill(HIST("OmOmBar/Omega/hCascDecayLength"), hyperonDecayLength); + histos.fill(HIST("OmOmBar/Omega/hV0InvMassWindow"), hyperon.mLambda() - pdgDB->Mass(3122)); + histos.fill(HIST("OmOmBar/Omega/hCascInvMassWindow"), hyperon.mOmega() - pdgDB->Mass(3334)); + histos.fill(HIST("OmOmBar/Omega/h2dCompetingMassRej"), hyperon.mXi(), hyperon.mOmega()); + histos.fill(HIST("OmOmBar/Omega/hBachTPCNsigma"), bachTrackExtraHyperon.tpcNSigmaKa()); + histos.fill(HIST("OmOmBar/Omega/hPosTPCNsigma"), posTrackExtraHyperon.tpcNSigmaPr()); + histos.fill(HIST("OmOmBar/Omega/hNegTPCNsigma"), negTrackExtraHyperon.tpcNSigmaPi()); + histos.fill(HIST("OmOmBar/Omega/h2dBachelorITSvsTPCpts"), bachTrackExtraHyperon.tpcCrossedRows(), bachTrackExtraHyperon.itsNCls()); + histos.fill(HIST("OmOmBar/Omega/h2dPositiveITSvsTPCpts"), posTrackExtraHyperon.tpcCrossedRows(), posTrackExtraHyperon.itsNCls()); + histos.fill(HIST("OmOmBar/Omega/h2dNegativeITSvsTPCpts"), negTrackExtraHyperon.tpcCrossedRows(), negTrackExtraHyperon.itsNCls()); + // Candidates after AntiOmega selections + histos.fill(HIST("OmOmBar/AntiOmega/hBachDCAToPV"), antiHyperon.dcabachtopv()); + histos.fill(HIST("OmOmBar/AntiOmega/hPosDCAToPV"), antiHyperon.dcapostopv()); + histos.fill(HIST("OmOmBar/AntiOmega/hNegDCAToPV"), antiHyperon.dcapostopv()); + histos.fill(HIST("OmOmBar/AntiOmega/hDCACascDaughters"), antiHyperon.dcacascdaughters()); + histos.fill(HIST("OmOmBar/AntiOmega/hDCAV0Daughters"), antiHyperon.dcaV0daughters()); + histos.fill(HIST("OmOmBar/AntiOmega/hDCAV0ToPV"), antiHyperon.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("OmOmBar/AntiOmega/hV0PointingAngle"), antiHyperon.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("OmOmBar/AntiOmega/hV0Radius"), antiHyperon.v0radius()); + histos.fill(HIST("OmOmBar/AntiOmega/hCascPointingAngle"), antiHyperon.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + histos.fill(HIST("OmOmBar/AntiOmega/hCascRadius"), antiHyperon.cascradius()); + histos.fill(HIST("OmOmBar/AntiOmega/hCascDecayLength"), antiHyperonDecayLength); + histos.fill(HIST("OmOmBar/AntiOmega/hV0InvMassWindow"), antiHyperon.mLambda() - pdgDB->Mass(3122)); + histos.fill(HIST("OmOmBar/AntiOmega/hCascInvMassWindow"), antiHyperon.mOmega() - pdgDB->Mass(3334)); + histos.fill(HIST("OmOmBar/AntiOmega/h2dCompetingMassRej"), antiHyperon.mXi(), antiHyperon.mOmega()); + histos.fill(HIST("OmOmBar/AntiOmega/hBachTPCNsigma"), bachTrackExtraAntiHyperon.tpcNSigmaKa()); + histos.fill(HIST("OmOmBar/AntiOmega/hPosTPCNsigma"), posTrackExtraAntiHyperon.tpcNSigmaPi()); + histos.fill(HIST("OmOmBar/AntiOmega/hNegTPCNsigma"), negTrackExtraAntiHyperon.tpcNSigmaPr()); + histos.fill(HIST("OmOmBar/AntiOmega/h2dBachelorITSvsTPCpts"), bachTrackExtraAntiHyperon.tpcCrossedRows(), bachTrackExtraAntiHyperon.itsNCls()); + histos.fill(HIST("OmOmBar/AntiOmega/h2dPositiveITSvsTPCpts"), posTrackExtraAntiHyperon.tpcCrossedRows(), posTrackExtraAntiHyperon.itsNCls()); + histos.fill(HIST("OmOmBar/AntiOmega/h2dNegativeITSvsTPCpts"), negTrackExtraAntiHyperon.tpcCrossedRows(), negTrackExtraAntiHyperon.itsNCls()); + } + } + } + + template + void analyseHyperonPairCandidate(TCollision collision, THyperon hyperon, THyperon antiHyperon, float centrality, uint8_t gapSide, int type) + // fill information related to the quarkonium mother + // type = 0 (Lambda), 1 (Xi), 2 (Omega) + { + float pt = RecoDecay::pt(hyperon.px() + antiHyperon.px(), hyperon.py() + antiHyperon.py()); + + float invmass = -1; + if (type == 0) + invmass = RecoDecay::m(std::array{std::array{hyperon.px(), hyperon.py(), hyperon.pz()}, std::array{antiHyperon.px(), antiHyperon.py(), antiHyperon.pz()}}, std::array{o2::constants::physics::MassLambda0, o2::constants::physics::MassLambda0Bar}); + if (type == 1) + invmass = RecoDecay::m(std::array{std::array{hyperon.px(), hyperon.py(), hyperon.pz()}, std::array{antiHyperon.px(), antiHyperon.py(), antiHyperon.pz()}}, std::array{o2::constants::physics::MassXiMinus, o2::constants::physics::MassXiPlusBar}); + if (type == 2) + invmass = RecoDecay::m(std::array{std::array{hyperon.px(), hyperon.py(), hyperon.pz()}, std::array{antiHyperon.px(), antiHyperon.py(), antiHyperon.pz()}}, std::array{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassOmegaPlusBar}); + + float rapidity = RecoDecay::y(std::array{hyperon.px() + antiHyperon.px(), hyperon.py() + antiHyperon.py(), hyperon.pz() + antiHyperon.pz()}, invmass); + + // rapidity cut on the quarkonium mother + if (!doMCAssociation && TMath::Abs(rapidity) > rapidityCut) + return; + + // fillV0sInfo(lambda, antiLambda, centrality); + + // __________________________________________ + // main analysis + if (type == 0) { + if (doMCAssociation) { + if constexpr (requires { hyperon.template v0MCCore_as>(); }) { // check if MC information is available + auto hyperonMC = hyperon.template v0MCCore_as>(); + auto antiHyperonMC = antiHyperon.template v0MCCore_as>(); + + if (hyperonMC.pdgCodeMother() != antiHyperonMC.pdgCodeMother()) { + return; + } + + float ptmc = RecoDecay::pt(hyperonMC.pxMC() + antiHyperonMC.pxMC(), hyperonMC.pyMC() + antiHyperonMC.pyMC()); + float rapiditymc = RecoDecay::y(std::array{hyperonMC.pxMC() + antiHyperonMC.pxMC(), hyperonMC.pyMC() + antiHyperonMC.pyMC(), hyperonMC.pzMC() + antiHyperonMC.pzMC()}, pdgDB->Mass(hyperonMC.pdgCodeMother())); + + if (TMath::Abs(rapiditymc) > rapidityCut) + return; + + if (hyperonMC.pdgCodeMother() == 441 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // EtaC(1S) + histos.fill(HIST("LaLaBar/h3dInvMassTrueEtaC1S"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // J/psi + histos.fill(HIST("LaLaBar/h3dInvMassTrueJPsi"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 10441 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // ChiC0 + histos.fill(HIST("LaLaBar/h3dInvMassTrueChiC0"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 20443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // ChiC1 + histos.fill(HIST("LaLaBar/h3dInvMassTrueChiC1"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 10443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // hC + histos.fill(HIST("LaLaBar/h3dInvMassTrueHC"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 445 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // ChiC2 + histos.fill(HIST("LaLaBar/h3dInvMassTrueChiC2"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 100441 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // EtaC(2S) + histos.fill(HIST("LaLaBar/h3dInvMassTrueEtaC2S"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 100443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // Psi(2S) + histos.fill(HIST("LaLaBar/h3dInvMassTruePsi2S"), centrality, ptmc, invmass); + } + } + } + + histos.fill(HIST("LaLaBar/h3dMassLaLabar"), centrality, pt, invmass); + if (!isPP) { // in case of PbPb data + if (gapSide == 0) + histos.fill(HIST("LaLaBar/h3dMassLaLabarSGA"), centrality, pt, invmass); + else if (gapSide == 1) + histos.fill(HIST("LaLaBar/h3dMassLaLabarSGC"), centrality, pt, invmass); + else if (gapSide == 2) + histos.fill(HIST("LaLaBar/h3dMassLaLabarDG"), centrality, pt, invmass); + else + histos.fill(HIST("LaLaBar/h3dMassLaLabarHadronic"), centrality, pt, invmass); + } + fillQAplot(collision, hyperon, antiHyperon, 0); + } + if (type == 1) { + if (doMCAssociation) { + if constexpr (requires { hyperon.template cascMCCore_as>(); }) { // check if MC information is available + auto hyperonMC = hyperon.template cascMCCore_as>(); + auto antiHyperonMC = antiHyperon.template cascMCCore_as>(); + + if (hyperonMC.pdgCodeMother() != antiHyperonMC.pdgCodeMother()) { + return; + } + + float ptmc = RecoDecay::pt(hyperonMC.pxMC() + antiHyperonMC.pxMC(), hyperonMC.pyMC() + antiHyperonMC.pyMC()); + float rapiditymc = RecoDecay::y(std::array{hyperonMC.pxMC() + antiHyperonMC.pxMC(), hyperonMC.pyMC() + antiHyperonMC.pyMC(), hyperonMC.pzMC() + antiHyperonMC.pzMC()}, pdgDB->Mass(hyperonMC.pdgCodeMother())); + + if (TMath::Abs(rapiditymc) > rapidityCut) + return; + + if (hyperonMC.pdgCodeMother() == 441 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // EtaC(1S) + histos.fill(HIST("XiXiBar/h3dInvMassTrueEtaC1S"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // J/psi + histos.fill(HIST("XiXiBar/h3dInvMassTrueJPsi"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 10441 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // ChiC0 + histos.fill(HIST("XiXiBar/h3dInvMassTrueChiC0"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 20443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // ChiC1 + histos.fill(HIST("XiXiBar/h3dInvMassTrueChiC1"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 10443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // hC + histos.fill(HIST("XiXiBar/h3dInvMassTrueHC"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 445 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // ChiC2 + histos.fill(HIST("XiXiBar/h3dInvMassTrueChiC2"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 100441 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // EtaC(2S) + histos.fill(HIST("XiXiBar/h3dInvMassTrueEtaC2S"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 100443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // Psi(2S) + histos.fill(HIST("XiXiBar/h3dInvMassTruePsi2S"), centrality, ptmc, invmass); + } + } + } + + histos.fill(HIST("XiXiBar/h3dMassXiXibar"), centrality, pt, invmass); + if (!isPP) { // in case of PbPb data + if (gapSide == 0) + histos.fill(HIST("XiXiBar/h3dMassXiXibarSGA"), centrality, pt, invmass); + else if (gapSide == 1) + histos.fill(HIST("XiXiBar/h3dMassXiXibarSGC"), centrality, pt, invmass); + else if (gapSide == 2) + histos.fill(HIST("XiXiBar/h3dMassXiXibarDG"), centrality, pt, invmass); + else + histos.fill(HIST("XiXiBar/h3dMassXiXibarHadronic"), centrality, pt, invmass); + } + fillQAplot(collision, hyperon, antiHyperon, 1); + } + if (type == 2) { + if (doMCAssociation) { + if constexpr (requires { hyperon.template cascMCCore_as>(); }) { // check if MC information is available + auto hyperonMC = hyperon.template cascMCCore_as>(); + auto antiHyperonMC = antiHyperon.template cascMCCore_as>(); + + if (hyperonMC.pdgCodeMother() != antiHyperonMC.pdgCodeMother()) { + return; + } + + float ptmc = RecoDecay::pt(hyperonMC.pxMC() + antiHyperonMC.pxMC(), hyperonMC.pyMC() + antiHyperonMC.pyMC()); + float rapiditymc = RecoDecay::y(std::array{hyperonMC.pxMC() + antiHyperonMC.pxMC(), hyperonMC.pyMC() + antiHyperonMC.pyMC(), hyperonMC.pzMC() + antiHyperonMC.pzMC()}, pdgDB->Mass(hyperonMC.pdgCodeMother())); + + if (TMath::Abs(rapiditymc) > rapidityCut) + return; + + if (hyperonMC.pdgCodeMother() == 100441 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // EtaC(2S) + histos.fill(HIST("OmOmBar/h3dInvMassTrueEtaC2S"), centrality, ptmc, invmass); + } + if (hyperonMC.pdgCodeMother() == 100443 && hyperonMC.pdgCodeMother() == antiHyperonMC.pdgCodeMother()) { // Psi(2S) + histos.fill(HIST("OmOmBar/h3dInvMassTruePsi2S"), centrality, ptmc, invmass); + } + } + } + + histos.fill(HIST("OmOmBar/h3dMassOmOmbar"), centrality, pt, invmass); + if (!isPP) { // in case of PbPb data + if (gapSide == 0) + histos.fill(HIST("OmOmBar/h3dMassOmOmbarSGA"), centrality, pt, invmass); + else if (gapSide == 1) + histos.fill(HIST("OmOmBar/h3dMassOmOmbarSGC"), centrality, pt, invmass); + else if (gapSide == 2) + histos.fill(HIST("OmOmBar/h3dMassOmOmbarDG"), centrality, pt, invmass); + else + histos.fill(HIST("OmOmBar/h3dMassOmOmbarHadronic"), centrality, pt, invmass); + } + fillQAplot(collision, hyperon, antiHyperon, 2); + } + } + + // function to check that the hyperon and antihyperon have different daughter tracks + template + bool checkTrackIndices(THyperon hyperon, THyperon antiHyperon) + { + if constexpr (requires { hyperon.template bachTrackExtra_as(); }) { // cascade case: check if bachelor information is available + // check that bachelor track from hyperon is different from daughter tracks of antiHyperon + if (hyperon.bachTrackExtraId() == antiHyperon.bachTrackExtraId() || + hyperon.bachTrackExtraId() == antiHyperon.posTrackExtraId() || + hyperon.bachTrackExtraId() == antiHyperon.negTrackExtraId()) + return false; + // check that positive track from hyperon is different from daughter tracks of antiHyperon + if (hyperon.posTrackExtraId() == antiHyperon.bachTrackExtraId() || + hyperon.posTrackExtraId() == antiHyperon.posTrackExtraId() || + hyperon.posTrackExtraId() == antiHyperon.negTrackExtraId()) + return false; + // check that negative track from hyperon is different from daughter tracks of antiHyperon + if (hyperon.negTrackExtraId() == antiHyperon.bachTrackExtraId() || + hyperon.negTrackExtraId() == antiHyperon.posTrackExtraId() || + hyperon.negTrackExtraId() == antiHyperon.negTrackExtraId()) + return false; + } else { // v0 case + // check that positive track from hyperon is different from daughter tracks of antiHyperon + if (hyperon.posTrackExtraId() == antiHyperon.posTrackExtraId() || + hyperon.posTrackExtraId() == antiHyperon.negTrackExtraId()) + return false; + // check that negative track from hyperon is different from daughter tracks of antiHyperon + if (hyperon.negTrackExtraId() == antiHyperon.posTrackExtraId() || + hyperon.negTrackExtraId() == antiHyperon.negTrackExtraId()) + return false; + } + return true; + } + + template + void buildHyperonAntiHyperonPairs(TCollision const& collision, THyperons const& fullHyperons, std::vector selHypIndices, std::vector selAntiHypIndices, float centrality, uint8_t gapSide, int type) + { + // 1st loop over all v0s/cascades + for (auto& hyperon : fullHyperons) { + // select only v0s matching Lambda selections + if (!selHypIndices[hyperon.globalIndex() - fullHyperons.offset()]) { // local index needed due to collisions grouping + continue; + } + + // 2nd loop over all v0s/cascade + for (auto& antiHyperon : fullHyperons) { + // select only v0s matching Anti-Lambda selections + if (!selAntiHypIndices[antiHyperon.globalIndex() - fullHyperons.offset()]) { // local index needed due to collisions grouping + continue; + } + + // check we don't look at the same v0s/cascades + if (hyperon.globalIndex() == antiHyperon.globalIndex()) { + continue; + } + + // check that the two hyperons have different daughter tracks + if (!checkTrackIndices(hyperon, antiHyperon)) { + continue; + } + + // form V0 pairs and fill histograms + analyseHyperonPairCandidate(collision, hyperon, antiHyperon, centrality, gapSide, type); + } // end antiHyperon loop + } // end hyperon loop + + return; + } + + // ______________________________________________________ + // Real data processing - no MC subscription + void processRealData(soa::Join::iterator const& collision, v0Candidates const& fullV0s, cascadeCandidates const& fullCascades, dauTracks const&) + { + // Fire up CCDB + if (cfgSkimmedProcessing || + (mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || + (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || + (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { + initCCDB(collision); + } + + if (!IsEventAccepted(collision, true)) { + return; + } + + if (cfgSkimmedProcessing) { + zorro.isSelected(collision.globalBC()); /// Just let Zorro do the accounting + } + + float centrality = -1; + int selGapSide = -1; // only useful in case one wants to use this task in Pb-Pb UPC + fillEventHistograms(collision, centrality, selGapSide); + + // __________________________________________ + // perform main analysis + // + if (buildLaLaBarPairs) { // Look at V0s + std::vector selK0ShortIndices(fullV0s.size()); + std::vector selLambdaIndices(fullV0s.size()); + std::vector selAntiLambdaIndices(fullV0s.size()); + for (auto& v0 : fullV0s) { + if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (v0.v0Type() != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1) + continue; // skip V0s that are not standard + + uint64_t selMap = computeReconstructionBitmap(v0, collision, v0.yLambda(), v0.yK0Short(), v0.pt()); + + // consider for histograms for all species + selMap = selMap | (uint64_t(1) << selConsiderK0Short) | (uint64_t(1) << selConsiderLambda) | (uint64_t(1) << selConsiderAntiLambda); + selMap = selMap | (uint64_t(1) << selPhysPrimK0Short) | (uint64_t(1) << selPhysPrimLambda) | (uint64_t(1) << selPhysPrimAntiLambda); + + analyseV0Candidate(v0, v0.pt(), selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices, fullV0s.offset()); + } // end v0 loop + + // count the number of K0s, Lambda and AntiLambdas passsing the selections + int nK0Shorts = std::count(selK0ShortIndices.begin(), selK0ShortIndices.end(), true); + int nLambdas = std::count(selLambdaIndices.begin(), selLambdaIndices.end(), true); + int nAntiLambdas = std::count(selAntiLambdaIndices.begin(), selAntiLambdaIndices.end(), true); + + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + histos.fill(HIST("LaLaBar/h2dNbrOfK0ShortVsCentrality"), centrality, nK0Shorts); + histos.fill(HIST("LaLaBar/h2dNbrOfLambdaVsCentrality"), centrality, nLambdas); + histos.fill(HIST("LaLaBar/h2dNbrOfAntiLambdaVsCentrality"), centrality, nAntiLambdas); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nLambdas >= 1 && nAntiLambdas >= 1) { // consider Lambda antiLambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 0); + } + if (buildSameSignPairs && nLambdas > 1) { // consider Lambda Lambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selLambdaIndices, centrality, selGapSide, 0); + } + if (buildSameSignPairs && nAntiLambdas > 1) { // consider antiLambda antiLambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selAntiLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 0); + } + } + + if (buildXiXiBarPairs || buildOmOmBarPairs) { // Look at Cascades + std::vector selXiIndices(fullCascades.size()); + std::vector selAntiXiIndices(fullCascades.size()); + std::vector selOmIndices(fullCascades.size()); + std::vector selAntiOmIndices(fullCascades.size()); + for (auto& cascade : fullCascades) { + if (std::abs(cascade.negativeeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.positiveeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (buildXiXiBarPairs) { + if (cascade.sign() < 0) { + selXiIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, cascade.yXi(), true); + } else { + selAntiXiIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, cascade.yXi(), true); + } + } + if (buildOmOmBarPairs) { + if (cascade.sign() < 0) { + selOmIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, cascade.yOmega(), false); + } else { + selAntiOmIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, cascade.yOmega(), false); + } + } + } // end cascade loop + + // count the number of Xi and antiXi passsing the selections + int nXis = std::count(selXiIndices.begin(), selXiIndices.end(), true); + int nAntiXis = std::count(selAntiXiIndices.begin(), selAntiXiIndices.end(), true); + int nOmegas = std::count(selOmIndices.begin(), selOmIndices.end(), true); + int nAntiOmegas = std::count(selAntiOmIndices.begin(), selAntiOmIndices.end(), true); + + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + if (buildXiXiBarPairs) { + histos.fill(HIST("XiXiBar/h2dNbrOfXiVsCentrality"), centrality, nXis); + histos.fill(HIST("XiXiBar/h2dNbrOfAntiXiVsCentrality"), centrality, nAntiXis); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nXis >= 1 && nAntiXis >= 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selAntiXiIndices, centrality, selGapSide, 1); + } + if (buildSameSignPairs && nXis > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selXiIndices, centrality, selGapSide, 1); + } + if (buildSameSignPairs && nAntiXis > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiXiIndices, selAntiXiIndices, centrality, selGapSide, 1); + } + } + if (buildOmOmBarPairs) { + histos.fill(HIST("OmOmBar/h2dNbrOfOmegaVsCentrality"), centrality, nOmegas); + histos.fill(HIST("OmOmBar/h2dNbrOfAntiOmegaVsCentrality"), centrality, nAntiOmegas); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nOmegas >= 1 && nAntiOmegas >= 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selAntiOmIndices, centrality, selGapSide, 2); + } + if (buildSameSignPairs && nOmegas > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selOmIndices, centrality, selGapSide, 2); + } + if (buildSameSignPairs && nAntiOmegas > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiOmIndices, selAntiOmIndices, centrality, selGapSide, 2); + } + } + } + } + + // ______________________________________________________ + // Simulated processing (subscribes to MC information too) + void processMonteCarlo(soa::Join::iterator const& collision, v0MCCandidates const& fullV0s, cascadeMCCandidates const& fullCascades, dauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&, soa::Join const&) + { + // Fire up CCDB + if (cfgSkimmedProcessing || + (mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || + (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || + (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { + initCCDB(collision); + } + + if (!IsEventAccepted(collision, true)) { + return; + } + + if (cfgSkimmedProcessing) { + zorro.isSelected(collision.globalBC()); /// Just let Zorro do the accounting + } + + float centrality = -1; + int selGapSide = -1; // only useful in case one wants to use this task in Pb-Pb UPC + fillEventHistograms(collision, centrality, selGapSide); + + // __________________________________________ + // perform main analysis + if (buildLaLaBarPairs) { // Look at V0s + std::vector selK0ShortIndices(fullV0s.size()); + std::vector selLambdaIndices(fullV0s.size()); + std::vector selAntiLambdaIndices(fullV0s.size()); + for (auto& v0 : fullV0s) { + if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (!v0.has_v0MCCore()) + continue; + + auto v0MC = v0.v0MCCore_as>(); + + float ptmc = RecoDecay::sqrtSumOfSquares(v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC()); + float ymc = 1e-3; + if (v0MC.pdgCode() == 310) + ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassKaonNeutral); + else if (TMath::Abs(v0MC.pdgCode()) == 3122) + ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassLambda); + + uint64_t selMap = computeReconstructionBitmap(v0, collision, ymc, ymc, ptmc); + selMap = selMap | computeMCAssociation(v0MC); + + // consider only associated candidates if asked to do so, disregard association + if (!doMCAssociation) { + selMap = selMap | (uint64_t(1) << selConsiderK0Short) | (uint64_t(1) << selConsiderLambda) | (uint64_t(1) << selConsiderAntiLambda); + selMap = selMap | (uint64_t(1) << selPhysPrimK0Short) | (uint64_t(1) << selPhysPrimLambda) | (uint64_t(1) << selPhysPrimAntiLambda); + } + + analyseV0Candidate(v0, ptmc, selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices, fullV0s.offset()); + } // end v0 loop + + /// count the number of K0s, Lambda and AntiLambdas passsing the selections + int nK0Shorts = std::count(selK0ShortIndices.begin(), selK0ShortIndices.end(), true); + int nLambdas = std::count(selLambdaIndices.begin(), selLambdaIndices.end(), true); + int nAntiLambdas = std::count(selAntiLambdaIndices.begin(), selAntiLambdaIndices.end(), true); + + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + histos.fill(HIST("LaLaBar/h2dNbrOfK0ShortVsCentrality"), centrality, nK0Shorts); + histos.fill(HIST("LaLaBar/h2dNbrOfLambdaVsCentrality"), centrality, nLambdas); + histos.fill(HIST("LaLaBar/h2dNbrOfAntiLambdaVsCentrality"), centrality, nAntiLambdas); + + if (!buildSameSignPairs && nLambdas >= 1 && nAntiLambdas >= 1) { // consider Lambda antiLambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 0); + } + if (buildSameSignPairs && nLambdas > 1) { // consider Lambda Lambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selLambdaIndices, centrality, selGapSide, 0); + } + if (buildSameSignPairs && nAntiLambdas > 1) { // consider antiLambda antiLambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selAntiLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 0); + } + } + + if (buildXiXiBarPairs || buildOmOmBarPairs) { // Look at Cascades + std::vector selXiIndices(fullCascades.size()); + std::vector selAntiXiIndices(fullCascades.size()); + std::vector selOmIndices(fullCascades.size()); + std::vector selAntiOmIndices(fullCascades.size()); + for (auto& cascade : fullCascades) { + if (std::abs(cascade.negativeeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.positiveeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (!cascade.has_cascMCCore()) + continue; + + auto cascadeMC = cascade.cascMCCore_as>(); + + float ymc = 1e-3; + if (TMath::Abs(cascadeMC.pdgCode()) == 3312) + ymc = RecoDecay::y(std::array{cascadeMC.pxMC(), cascadeMC.pyMC(), cascadeMC.pzMC()}, o2::constants::physics::MassXiMinus); + else if (TMath::Abs(cascadeMC.pdgCode()) == 3334) + ymc = RecoDecay::y(std::array{cascadeMC.pxMC(), cascadeMC.pyMC(), cascadeMC.pzMC()}, o2::constants::physics::MassOmegaMinus); + + if (buildXiXiBarPairs) { + if (cascade.sign() < 0) { + selXiIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, ymc, true); + } else { + selAntiXiIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, ymc, true); + } + } + if (buildOmOmBarPairs) { + if (cascade.sign() < 0) { + selOmIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, ymc, false); + } else { + selAntiOmIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, ymc, false); + } + } + } // end cascade loop + + // count the number of Xi and antiXi passsing the selections + int nXis = std::count(selXiIndices.begin(), selXiIndices.end(), true); + int nAntiXis = std::count(selAntiXiIndices.begin(), selAntiXiIndices.end(), true); + int nOmegas = std::count(selOmIndices.begin(), selOmIndices.end(), true); + int nAntiOmegas = std::count(selAntiOmIndices.begin(), selAntiOmIndices.end(), true); + + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + if (buildXiXiBarPairs) { + histos.fill(HIST("XiXiBar/h2dNbrOfXiVsCentrality"), centrality, nXis); + histos.fill(HIST("XiXiBar/h2dNbrOfAntiXiVsCentrality"), centrality, nAntiXis); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nXis >= 1 && nAntiXis >= 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selAntiXiIndices, centrality, selGapSide, 1); + } + if (buildSameSignPairs && nXis > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selXiIndices, centrality, selGapSide, 1); + } + if (buildSameSignPairs && nAntiXis > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiXiIndices, selAntiXiIndices, centrality, selGapSide, 1); + } + } + if (buildOmOmBarPairs) { + histos.fill(HIST("OmOmBar/h2dNbrOfOmegaVsCentrality"), centrality, nOmegas); + histos.fill(HIST("OmOmBar/h2dNbrOfAntiOmegaVsCentrality"), centrality, nAntiOmegas); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nOmegas >= 1 && nAntiOmegas >= 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selAntiOmIndices, centrality, selGapSide, 2); + } + if (buildSameSignPairs && nOmegas > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selOmIndices, centrality, selGapSide, 2); + } + if (buildSameSignPairs && nAntiOmegas > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiOmIndices, selAntiOmIndices, centrality, selGapSide, 2); + } + } + } + } + + PROCESS_SWITCH(quarkoniaToHyperons, processRealData, "process as if real data", true); + PROCESS_SWITCH(quarkoniaToHyperons, processMonteCarlo, "process as if MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGDQ/Tasks/tableReader.cxx b/PWGDQ/Tasks/tableReader.cxx index 16cefc2aaab..8ed3cd6eeef 100644 --- a/PWGDQ/Tasks/tableReader.cxx +++ b/PWGDQ/Tasks/tableReader.cxx @@ -14,6 +14,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -76,29 +79,6 @@ DECLARE_SOA_COLUMN(TauxyBcandidate, tauxyBcandidate, float); DECLARE_SOA_COLUMN(TauzBcandidate, tauzBcandidate, float); DECLARE_SOA_COLUMN(CosPBcandidate, cosPBcandidate, float); DECLARE_SOA_COLUMN(Chi2Bcandidate, chi2Bcandidate, float); - -// Xcandidate columns -DECLARE_SOA_COLUMN(massXcandidate, MXcandidate, float); -DECLARE_SOA_COLUMN(pTXcandidate, PtXcandidate, float); -DECLARE_SOA_COLUMN(rapidityXcandidate, YXcandidate, float); -DECLARE_SOA_COLUMN(etaXcandidate, EtaXcandidate, float); -DECLARE_SOA_COLUMN(massJpsicandidate, MJpsicandidate, float); -DECLARE_SOA_COLUMN(massDipioncandidate, MDipioncandidate, float); -DECLARE_SOA_COLUMN(pTJpsicandidate, PtJpsicandidate, float); -DECLARE_SOA_COLUMN(pTDipioncandidate, PtDipioncandidate, float); -DECLARE_SOA_COLUMN(massDiff, Q, float); -DECLARE_SOA_COLUMN(angDistPion1, DeltaR1, float); -DECLARE_SOA_COLUMN(angDistPion2, DeltaR2, float); -DECLARE_SOA_COLUMN(cosDileptonDipion, CosDileptonDipion, float); -DECLARE_SOA_COLUMN(dcaxyPion1, DcaXYPion1, float); -DECLARE_SOA_COLUMN(dcazPion1, DcaZPion1, float); -DECLARE_SOA_COLUMN(dcaxyPion2, DcaXYPion2, float); -DECLARE_SOA_COLUMN(dcazPion2, DcaZPion2, float); -DECLARE_SOA_COLUMN(pTPion1, PtPion1, float); -DECLARE_SOA_COLUMN(pTPion2, PtPion2, float); -DECLARE_SOA_COLUMN(dileptonSign, DileptonSign, int); -DECLARE_SOA_COLUMN(ditrackSign, DitrackSign, int); - } // namespace dqanalysisflags DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTS", dqanalysisflags::IsEventSelected); @@ -107,7 +87,6 @@ DECLARE_SOA_TABLE(BarrelTrackCuts, "AOD", "DQANATRKCUTS", dqanalysisflags::IsBar DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTS", dqanalysisflags::IsMuonSelected); DECLARE_SOA_TABLE(Prefilter, "AOD", "DQPREFILTER", dqanalysisflags::IsPrefilterVetoed); DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", dqanalysisflags::massBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate); -DECLARE_SOA_TABLE(XCandidates, "AOD", "DQX3872", dqanalysisflags::massXcandidate, dqanalysisflags::pTXcandidate, dqanalysisflags::rapidityXcandidate, dqanalysisflags::etaXcandidate, dqanalysisflags::massJpsicandidate, dqanalysisflags::massDipioncandidate, dqanalysisflags::pTJpsicandidate, dqanalysisflags::pTDipioncandidate, dqanalysisflags::massDiff, dqanalysisflags::angDistPion1, dqanalysisflags::angDistPion2, dqanalysisflags::cosDileptonDipion, dqanalysisflags::dcaxyPion1, dqanalysisflags::dcazPion1, dqanalysisflags::dcaxyPion2, dqanalysisflags::dcazPion2, dqanalysisflags::pTPion1, dqanalysisflags::pTPion2, dqanalysisflags::dileptonSign, dqanalysisflags::ditrackSign); } // namespace o2::aod // Declarations of various short names @@ -116,6 +95,7 @@ using MyEventsSelected = soa::Join; using MyEventsVtxCov = soa::Join; using MyEventsVtxCovSelected = soa::Join; +using MyEventsVtxCovSelectedMultExtra = soa::Join; using MyEventsVtxCovSelectedQvector = soa::Join; using MyEventsVtxCovSelectedQvectorExtraWithRefFlow = soa::Join; using MyEventsVtxCovSelectedQvectorCentr = soa::Join; @@ -146,6 +126,7 @@ using MyMftTracks = soa::Join; constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended; constexpr static uint32_t gkEventFillMapWithCov = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended | VarManager::ObjTypes::ReducedEventVtxCov; constexpr static uint32_t gkEventFillMapWithQvector = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended | VarManager::ObjTypes::ReducedEventQvector; +constexpr static uint32_t gkEventFillMapWithMultExtra = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended | VarManager::ObjTypes::ReducedEventMultExtra; constexpr static uint32_t gkEventFillMapWithQvectorMultExtra = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended | VarManager::ObjTypes::ReducedEventQvector | VarManager::ObjTypes::ReducedEventMultExtra; constexpr static uint32_t gkEventFillMapWithQvectorCentr = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended | VarManager::ObjTypes::CollisionQvect; constexpr static uint32_t gkEventFillMapWithQvectorCentrMultExtra = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended | VarManager::ObjTypes::CollisionQvect | VarManager::ObjTypes::ReducedEventMultExtra; @@ -421,7 +402,7 @@ struct AnalysisTrackSelection { for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, iCut++) { if ((*cut).IsSelected(VarManager::fgValues)) { if (iCut != fConfigPrefilterCutId) { - filterMap |= (uint32_t(1) << iCut); + filterMap |= (static_cast(1) << iCut); } if (iCut == fConfigPrefilterCutId) { prefilterSelected = true; @@ -517,7 +498,7 @@ struct AnalysisMuonSelection { iCut = 0; for (auto cut = fMuonCuts.begin(); cut != fMuonCuts.end(); cut++, iCut++) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << iCut); + filterMap |= (static_cast(1) << iCut); if (fConfigQA) { // TODO: make this compile time fHistMan->FillHistClass(Form("TrackMuon_%s", (*cut).GetName()), VarManager::fgValues); } @@ -656,11 +637,15 @@ struct AnalysisEventMixing { Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigAmbiguousHist{"cfgAmbiHist", false, "Enable Ambiguous histograms for time association studies"}; + Configurable ccdbPathFlow{"ccdb-path-flow", "Users/c/chizh/FlowResolution", "path to the ccdb object for flow resolution factors"}; + Configurable fConfigFlowReso{"cfgFlowReso", false, "Enable loading of flow resolution factors from CCDB"}; Service ccdb; o2::parameters::GRPMagField* grpmag = nullptr; - int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. + TH1D* ResoFlowSP = nullptr; // Resolution factors for flow analysis, this will be loaded from CCDB + TH1D* ResoFlowEP = nullptr; // Resolution factors for flow analysis, this will be loaded from CCDB + int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. Filter filterEventSelected = aod::dqanalysisflags::isEventSelected == 1; Filter filterTrackSelected = aod::dqanalysisflags::isBarrelSelected > 0; @@ -706,7 +691,7 @@ struct AnalysisEventMixing { Form("PairsBarrelMEMM_%s", objArray->At(icut)->GetName())}; histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fTrackHistNames.push_back(names); - fTwoTrackFilterMask |= (uint32_t(1) << icut); + fTwoTrackFilterMask |= (static_cast(1) << icut); } } } @@ -725,7 +710,7 @@ struct AnalysisEventMixing { histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); } fMuonHistNames.push_back(names); - fTwoMuonFilterMask |= (uint32_t(1) << icut); + fTwoMuonFilterMask |= (static_cast(1) << icut); } } } @@ -743,8 +728,8 @@ struct AnalysisEventMixing { Form("PairsEleMuMEMM_%s_%s", objArrayBarrel->At(icut)->GetName(), objArrayMuon->At(icut)->GetName())}; histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fTrackMuonHistNames.push_back(names); - fTwoTrackFilterMask |= (uint32_t(1) << icut); - fTwoMuonFilterMask |= (uint32_t(1) << icut); + fTwoTrackFilterMask |= (static_cast(1) << icut); + fTwoMuonFilterMask |= (static_cast(1) << icut); } } } @@ -774,31 +759,22 @@ struct AnalysisEventMixing { for (auto& track1 : tracks1) { for (auto& track2 : tracks2) { if constexpr (TPairType == VarManager::kDecayToEE) { - twoTrackFilter = uint32_t(track1.isBarrelSelected()) & uint32_t(track2.isBarrelSelected()) & fTwoTrackFilterMask; + twoTrackFilter = static_cast(track1.isBarrelSelected()) & static_cast(track2.isBarrelSelected()) & fTwoTrackFilterMask; } if constexpr (TPairType == VarManager::kDecayToMuMu) { - twoTrackFilter = uint32_t(track1.isMuonSelected()) & uint32_t(track2.isMuonSelected()) & fTwoMuonFilterMask; + twoTrackFilter = static_cast(track1.isMuonSelected()) & static_cast(track2.isMuonSelected()) & fTwoMuonFilterMask; } if constexpr (TPairType == VarManager::kElectronMuon) { - twoTrackFilter = uint32_t(track1.isBarrelSelected()) & uint32_t(track2.isMuonSelected()) & fTwoTrackFilterMask; + twoTrackFilter = static_cast(track1.isBarrelSelected()) & static_cast(track2.isMuonSelected()) & fTwoTrackFilterMask; } if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue continue; } - VarManager::FillPairME(track1, track2); - - constexpr bool eventHasQvector = (VarManager::ObjTypes::ReducedEventQvector > 0); - if constexpr (eventHasQvector) { - VarManager::FillPairVn(track1, track2); - } - constexpr bool eventHasQvectorCentr = (VarManager::ObjTypes::CollisionQvect > 0); - if constexpr (eventHasQvectorCentr) { - VarManager::FillPairVn(track1, track2); - } + VarManager::FillPairME(track1, track2); for (unsigned int icut = 0; icut < ncuts; icut++) { - if (twoTrackFilter & (uint32_t(1) << icut)) { + if (twoTrackFilter & (static_cast(1) << icut)) { if (track1.sign() * track2.sign() < 0) { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); if (fConfigAmbiguousHist && !(track1.isAmbiguous() || track2.isAmbiguous())) { @@ -818,9 +794,9 @@ struct AnalysisEventMixing { } } } // end if (filter bits) - } // end for (cuts) - } // end for (track2) - } // end for (track1) + } // end for (cuts) + } // end for (track2) + } // end for (track1) } // barrel-barrel and muon-muon event mixing @@ -834,6 +810,16 @@ struct AnalysisEventMixing { } else { LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); } + if (fConfigFlowReso) { + TString PathFlow = ccdbPathFlow.value; + TString ccdbPathFlowSP = Form("%s/ScalarProduct", PathFlow.Data()); + TString ccdbPathFlowEP = Form("%s/EventPlane", PathFlow.Data()); + ResoFlowSP = ccdb->getForTimeStamp(ccdbPathFlowSP.Data(), events.begin().timestamp()); + ResoFlowEP = ccdb->getForTimeStamp(ccdbPathFlowEP.Data(), events.begin().timestamp()); + if (ResoFlowSP == nullptr || ResoFlowEP == nullptr) { + LOGF(fatal, "Resolution factor is not available in CCDB at timestamp=%llu", events.begin().timestamp()); + } + } fCurrentRun = events.begin().runNumber(); } @@ -850,6 +836,9 @@ struct AnalysisEventMixing { tracks2.bindExternalIndices(&events); VarManager::FillTwoMixEvents(event1, event2, tracks1, tracks2); + if (fConfigFlowReso) { + VarManager::FillEventFlowResoFactor(ResoFlowSP, ResoFlowEP); + } runMixedPairing(tracks1, tracks2); } // end event loop } @@ -942,7 +931,9 @@ struct AnalysisSameEventPairing { float mMagField = 0.0; o2::parameters::GRPMagField* grpmag = nullptr; o2::base::MatLayerCylSet* lut = nullptr; - int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. + TH1D* ResoFlowSP = nullptr; // Resolution factors for flow analysis, this will be loaded from CCDB + TH1D* ResoFlowEP = nullptr; // Resolution factors for flow analysis, this will be loaded from CCDB + int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. OutputObj fOutputList{"output"}; Configurable fConfigTrackCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; @@ -950,6 +941,8 @@ struct AnalysisSameEventPairing { Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts"}; Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPath{"ccdb-path", "Users/lm", "base path to the ccdb object"}; + Configurable ccdbPathFlow{"ccdb-path-flow", "Users/c/chizh/FlowResolution", "path to the ccdb object for flow resolution factors"}; + Configurable fConfigFlowReso{"cfgFlowReso", false, "Enable loading of flow resolution factors from CCDB"}; Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"}; Configurable fConfigFlatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"}; @@ -1040,7 +1033,7 @@ struct AnalysisSameEventPairing { if (!cutNames.IsNull()) { // if track cuts std::unique_ptr objArray(cutNames.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { // loop over track cuts - fTwoTrackFilterMask |= (uint32_t(1) << icut); + fTwoTrackFilterMask |= (static_cast(1) << icut); // no pair cuts names = { Form("PairsBarrelSEPM_%s", objArray->At(icut)->GetName()), @@ -1064,17 +1057,17 @@ struct AnalysisSameEventPairing { } fTrackHistNames.push_back(names); } // end loop (pair cuts) - } // end if (pair cuts) - } // end loop (track cuts) - } // end if (track cuts) + } // end if (pair cuts) + } // end loop (track cuts) + } // end if (track cuts) } - if (context.mOptions.get("processDecayToMuMuSkimmed") || context.mOptions.get("processDecayToMuMuVertexingSkimmed") || context.mOptions.get("processDecayToMuMuSkimmedWithColl") || context.mOptions.get("processVnDecayToMuMuSkimmed") || context.mOptions.get("processVnDecayToMuMuSkimmedWithWeights") || context.mOptions.get("processVnDecayToMuMuSkimmedWithWeightsAndColl") || context.mOptions.get("processVnCentrDecayToMuMuSkimmed") || context.mOptions.get("processAllSkimmed")) { + if (context.mOptions.get("processDecayToMuMuSkimmed") || context.mOptions.get("processDecayToMuMuSkimmedWithMult") || context.mOptions.get("processDecayToMuMuVertexingSkimmed") || context.mOptions.get("processDecayToMuMuSkimmedWithColl") || context.mOptions.get("processVnDecayToMuMuSkimmed") || context.mOptions.get("processVnDecayToMuMuSkimmedWithWeights") || context.mOptions.get("processVnDecayToMuMuSkimmedWithWeightsAndColl") || context.mOptions.get("processVnCentrDecayToMuMuSkimmed") || context.mOptions.get("processAllSkimmed")) { TString cutNames = fConfigMuonCuts.value; if (!cutNames.IsNull()) { std::unique_ptr objArray(cutNames.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { // loop over track cuts - fTwoMuonFilterMask |= (uint32_t(1) << icut); + fTwoMuonFilterMask |= (static_cast(1) << icut); // no pair cuts names = { Form("PairsMuonSEPM_%s", objArray->At(icut)->GetName()), @@ -1098,9 +1091,9 @@ struct AnalysisSameEventPairing { histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fMuonHistNames.push_back(names); } // end loop (pair cuts) - } // end if (pair cuts) - } // end loop (track cuts) - } // end if (track cuts) + } // end if (pair cuts) + } // end loop (track cuts) + } // end if (track cuts) } if (context.mOptions.get("processElectronMuonSkimmed") || context.mOptions.get("processAllSkimmed")) { TString cutNamesBarrel = fConfigTrackCuts.value; @@ -1110,8 +1103,8 @@ struct AnalysisSameEventPairing { std::unique_ptr objArrayMuon(cutNamesMuon.Tokenize(",")); if (objArrayBarrel->GetEntries() == objArrayMuon->GetEntries()) { // one must specify equal number of barrel and muon cuts for (int icut = 0; icut < objArrayBarrel->GetEntries(); ++icut) { // loop over track cuts - fTwoTrackFilterMask |= (uint32_t(1) << icut); - fTwoMuonFilterMask |= (uint32_t(1) << icut); + fTwoTrackFilterMask |= (static_cast(1) << icut); + fTwoMuonFilterMask |= (static_cast(1) << icut); // no pair cuts names = { Form("PairsEleMuSEPM_%s_%s", objArrayBarrel->At(icut)->GetName(), objArrayMuon->At(icut)->GetName()), @@ -1131,10 +1124,10 @@ struct AnalysisSameEventPairing { histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fTrackMuonHistNames.push_back(names); } // end loop (pair cuts) - } // end if (pair cuts) - } // end loop (track cuts) - } // end if (equal number of cuts) - } // end if (track cuts) + } // end if (pair cuts) + } // end loop (track cuts) + } // end if (equal number of cuts) + } // end if (track cuts) } // Usage example of ccdb @@ -1182,6 +1175,16 @@ struct AnalysisSameEventPairing { } VarManager::SetMagneticField(fConfigMagField.value); } + if (fConfigFlowReso) { + TString PathFlow = ccdbPathFlow.value; + TString ccdbPathFlowSP = Form("%s/ScalarProduct", PathFlow.Data()); + TString ccdbPathFlowEP = Form("%s/EventPlane", PathFlow.Data()); + ResoFlowSP = ccdb->getForTimeStamp(ccdbPathFlowSP.Data(), event.timestamp()); + ResoFlowEP = ccdb->getForTimeStamp(ccdbPathFlowEP.Data(), event.timestamp()); + if (ResoFlowSP == nullptr || ResoFlowEP == nullptr) { + LOGF(fatal, "Resolution factor is not available in CCDB at timestamp=%llu", event.timestamp()); + } + } fCurrentRun = event.runNumber(); } @@ -1222,7 +1225,7 @@ struct AnalysisSameEventPairing { for (auto& [t1, t2] : combinations(tracks1, tracks2)) { if constexpr (TPairType == VarManager::kDecayToMuMu) { - twoTrackFilter = uint32_t(t1.isMuonSelected()) & uint32_t(t2.isMuonSelected()) & fTwoMuonFilterMask; + twoTrackFilter = static_cast(t1.isMuonSelected()) & static_cast(t2.isMuonSelected()) & fTwoMuonFilterMask; } if (twoTrackFilter && (t1.sign() != t2.sign())) { @@ -1232,16 +1235,21 @@ struct AnalysisSameEventPairing { VarManager::fgValues[VarManager::kMultDimuons] = mult_dimuons; } + + if (fConfigFlowReso) { + VarManager::FillEventFlowResoFactor(ResoFlowSP, ResoFlowEP); + } + bool isFirst = true; for (auto& [t1, t2] : combinations(tracks1, tracks2)) { if constexpr (TPairType == VarManager::kDecayToEE || TPairType == VarManager::kDecayToPiPi) { - twoTrackFilter = uint32_t(t1.isBarrelSelected()) & uint32_t(t2.isBarrelSelected()) & fTwoTrackFilterMask; + twoTrackFilter = static_cast(t1.isBarrelSelected()) & static_cast(t2.isBarrelSelected()) & fTwoTrackFilterMask; } if constexpr (TPairType == VarManager::kDecayToMuMu) { - twoTrackFilter = uint32_t(t1.isMuonSelected()) & uint32_t(t2.isMuonSelected()) & fTwoMuonFilterMask; + twoTrackFilter = static_cast(t1.isMuonSelected()) & static_cast(t2.isMuonSelected()) & fTwoMuonFilterMask; } if constexpr (TPairType == VarManager::kElectronMuon) { - twoTrackFilter = uint32_t(t1.isBarrelSelected()) & uint32_t(t2.isMuonSelected()) & fTwoTrackFilterMask; + twoTrackFilter = static_cast(t1.isBarrelSelected()) & static_cast(t2.isMuonSelected()) & fTwoTrackFilterMask; } if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue continue; @@ -1347,7 +1355,7 @@ struct AnalysisSameEventPairing { int iCut = 0; for (int icut = 0; icut < ncuts; icut++) { - if (twoTrackFilter & (uint32_t(1) << icut)) { + if (twoTrackFilter & (static_cast(1) << icut)) { if (t1.sign() * t2.sign() < 0) { fHistMan->FillHistClass(histNames[iCut][0].Data(), VarManager::fgValues); if (fConfigAmbiguousHist && !(t1.isAmbiguous() || t2.isAmbiguous())) { @@ -1399,12 +1407,12 @@ struct AnalysisSameEventPairing { } } } - } // end loop (pair cuts) + } // end loop (pair cuts) } else { // end if (filter bits) iCut = iCut + 1 + fPairCuts.size(); } } // end loop (cuts) - } // end loop over pairs + } // end loop over pairs } void processDecayToEESkimmed(soa::Filtered::iterator const& event, soa::Filtered const& tracks) @@ -1477,6 +1485,13 @@ struct AnalysisSameEventPairing { VarManager::FillEvent(event, VarManager::fgValues); runSameEventPairing(event, muons, muons); } + void processDecayToMuMuSkimmedWithMult(soa::Filtered::iterator const& event, soa::Filtered const& muons) + { + // Reset the fValues array + VarManager::ResetValues(0, VarManager::kNVars); + VarManager::FillEvent(event, VarManager::fgValues); + runSameEventPairing(event, muons, muons); + } void processDecayToMuMuVertexingSkimmed(soa::Filtered::iterator const& event, soa::Filtered const& muons) { // Reset the fValues array @@ -1567,6 +1582,7 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processDecayToEESkimmedWithColl, "Run electron-electron pairing, with skimmed tracks and with collision information", false); PROCESS_SWITCH(AnalysisSameEventPairing, processDecayToEESkimmedWithCollNoTwoProngFitter, "Run electron-electron pairing, with skimmed tracks and with collision information but no two prong fitter", false); PROCESS_SWITCH(AnalysisSameEventPairing, processDecayToMuMuSkimmed, "Run muon-muon pairing, with skimmed muons", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processDecayToMuMuSkimmedWithMult, "Run muon-muon pairing, with skimmed muons and multiplicity", false); PROCESS_SWITCH(AnalysisSameEventPairing, processDecayToMuMuVertexingSkimmed, "Run muon-muon pairing and vertexing, with skimmed muons", false); PROCESS_SWITCH(AnalysisSameEventPairing, processDecayToMuMuSkimmedWithColl, "Run muon-muon pairing keeping the info of AO2D collision, with skimmed muons", false); PROCESS_SWITCH(AnalysisSameEventPairing, processVnDecayToEESkimmed, "Run electron-electron pairing, with skimmed tracks for vn", false); @@ -1740,7 +1756,7 @@ struct AnalysisDileptonHadron { // loop over hadrons for (auto& hadron : tracks) { - if (!(uint32_t(hadron.isBarrelSelected()) & (uint32_t(1) << fNHadronCutBit))) { + if (!(static_cast(hadron.isBarrelSelected()) & (static_cast(1) << fNHadronCutBit))) { continue; } @@ -1786,7 +1802,7 @@ struct AnalysisDileptonHadron { for (auto dilepton : evDileptons) { for (auto& track : evTracks) { - if (!(uint32_t(track.isBarrelSelected()) & (uint32_t(1) << fNHadronCutBit))) { + if (!(static_cast(track.isBarrelSelected()) & (static_cast(1) << fNHadronCutBit))) { continue; } @@ -1794,7 +1810,7 @@ struct AnalysisDileptonHadron { fHistMan->FillHistClass("DileptonHadronInvMassME", VarManager::fgValues); fHistMan->FillHistClass("DileptonHadronCorrelationME", VarManager::fgValues); } // end for (track) - } // end for (dilepton) + } // end for (dilepton) } // end event loop } @@ -1812,18 +1828,17 @@ struct AnalysisDileptonHadron { struct AnalysisDileptonTrackTrack { OutputObj fOutputList{"output"}; - Configurable fConfigTrackCuts{"cfgTrackCuts", "pionPIDCut1", "Comma separated list of barrel track cuts"}; // used for select the tracks from SelectedTracks + Configurable fConfigTrackCut1{"cfgTrackCut1", "pionPIDCut1", "track1 cut"}; // used for select the tracks from SelectedTracks + Configurable fConfigTrackCut2{"cfgTrackCut2", "pionPIDCut2", "track2 cut"}; // used for select the tracks from SelectedTracks Configurable fConfigDileptonCut{"cfgDiLeptonCut", "pairJpsi2", "Dilepton cut"}; - Configurable fConfigDitrackCut{"cfgDiTrackCut", "DipionPairCut1", "Track-Track cut"}; - Configurable fConfigQuadrupletCut{"cfgQuadrupletCut", "pairX3872Cut1", "Dilepton-Track-Track cut"}; + Configurable fConfigQuadrupletCuts{"cfgQuadrupletCuts", "pairX3872Cut1", "Comma separated list of Dilepton-Track-Track cut"}; Configurable fConfigAddDileptonHistogram{"cfgAddDileptonHistogram", "barrel", "Comma separated list of histograms"}; - Configurable fConfigAddDitrackHistogram{"cfgAddDitrackHistogram", "barrel", "Comma separated list of histograms"}; Configurable fConfigAddQuadrupletHistogram{"cfgAddQuadrupletHistogram", "xtojpsipipi", "Comma separated list of histograms"}; - Produces XTable; + Produces DileptonTrackTrackTable; Filter eventFilter = aod::dqanalysisflags::isEventSelected == 1; - Filter dileptonFilter = aod::reducedpair::mass > 1.0f && aod::reducedpair::mass < 4.0f; + Filter dileptonFilter = aod::reducedpair::sign == 0; Filter filterBarrelTrackSelected = aod::dqanalysisflags::isBarrelSelected > 0; constexpr static uint32_t fgDileptonFillMap = VarManager::ObjTypes::ReducedTrack | VarManager::ObjTypes::Pair; // fill map @@ -1833,14 +1848,13 @@ struct AnalysisDileptonTrackTrack { float* fValuesQuadruplet; HistogramManager* fHistMan; - uint32_t fDileptonFilter = 0; - uint32_t fHadronFilter = 0; - int fIsUnlikeSignDilepton = 0; - int fIsUnlikeSignDitrack = 0; + // cut name setting + TString fTrackCutName1; + TString fTrackCutName2; + bool fIsSameTrackCut = false; AnalysisCompositeCut fDileptonCut; - AnalysisCompositeCut fDitrackCut; - AnalysisCompositeCut fQuadrupletCut; - std::vector fTrackCutNames; + std::vector fQuadrupletCutNames; + std::vector fQuadrupletCuts; void init(o2::framework::InitContext& context) { @@ -1848,7 +1862,6 @@ struct AnalysisDileptonTrackTrack { return; } - fValuesDitrack = new float[VarManager::kNVars]; fValuesQuadruplet = new float[VarManager::kNVars]; VarManager::SetDefaultVarNames(); fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); @@ -1856,29 +1869,34 @@ struct AnalysisDileptonTrackTrack { fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); // define cuts - TString configTrackCutNamesStr = fConfigTrackCuts.value; + fTrackCutName1 = fConfigTrackCut1.value; + fTrackCutName2 = fConfigTrackCut2.value; + if (fTrackCutName1 == fTrackCutName2) { + fIsSameTrackCut = true; + } TString configDileptonCutNamesStr = fConfigDileptonCut.value; fDileptonCut = *dqcuts::GetCompositeCut(configDileptonCutNamesStr.Data()); - TString configDitrackCutNamesStr = fConfigDitrackCut.value; - fDitrackCut = *dqcuts::GetCompositeCut(configDitrackCutNamesStr.Data()); - TString configQuadruletCutNamesStr = fConfigQuadrupletCut.value; - fQuadrupletCut = *dqcuts::GetCompositeCut(configQuadruletCutNamesStr.Data()); + TString configQuadruletCutNamesStr = fConfigQuadrupletCuts.value; + std::unique_ptr objArray(configQuadruletCutNamesStr.Tokenize(",")); + for (Int_t icut = 0; icut < objArray->GetEntries(); ++icut) { + TString cutName = objArray->At(icut)->GetName(); + fQuadrupletCutNames.push_back(cutName); + fQuadrupletCuts.push_back(*dqcuts::GetCompositeCut(cutName.Data())); + } if (!context.mOptions.get("processDummy")) { - // define histograms for dilepton - DefineHistograms(fHistMan, Form("DileptonsSelectedUS_%s", configDileptonCutNamesStr.Data()), fConfigAddDileptonHistogram); - DefineHistograms(fHistMan, Form("DileptonsSelectedLS_%s", configDileptonCutNamesStr.Data()), fConfigAddDileptonHistogram); - if (!configTrackCutNamesStr.IsNull()) { - std::unique_ptr objArray(configTrackCutNamesStr.Tokenize(",")); - for (Int_t icut = 0; icut < objArray->GetEntries(); ++icut) { - TString cutName = objArray->At(icut)->GetName(); - fTrackCutNames.push_back(cutName); - DefineHistograms(fHistMan, Form("DitrackSelected_%s_%s", configDitrackCutNamesStr.Data(), cutName.Data()), fConfigAddDitrackHistogram); - DefineHistograms(fHistMan, Form("QuadrupletSEUSUS_%s_%s_%s", configDileptonCutNamesStr.Data(), configDitrackCutNamesStr.Data(), cutName.Data()), fConfigAddQuadrupletHistogram); - DefineHistograms(fHistMan, Form("QuadrupletSEUSLS_%s_%s_%s", configDileptonCutNamesStr.Data(), configDitrackCutNamesStr.Data(), cutName.Data()), fConfigAddQuadrupletHistogram); - DefineHistograms(fHistMan, Form("QuadrupletSELSUS_%s_%s_%s", configDileptonCutNamesStr.Data(), configDitrackCutNamesStr.Data(), cutName.Data()), fConfigAddQuadrupletHistogram); - DefineHistograms(fHistMan, Form("QuadrupletSELSLS_%s_%s_%s", configDileptonCutNamesStr.Data(), configDitrackCutNamesStr.Data(), cutName.Data()), fConfigAddQuadrupletHistogram); - } // loop over track cuts + DefineHistograms(fHistMan, Form("Dileptons_%s", configDileptonCutNamesStr.Data()), fConfigAddDileptonHistogram); + if (!configQuadruletCutNamesStr.IsNull()) { + for (std::size_t icut = 0; icut < fQuadrupletCutNames.size(); ++icut) { + if (fIsSameTrackCut) { + DefineHistograms(fHistMan, Form("QuadrupletSEPM_%s", fQuadrupletCutNames[icut].Data()), fConfigAddQuadrupletHistogram); + } else { + DefineHistograms(fHistMan, Form("QuadrupletSEPM_%s", fQuadrupletCutNames[icut].Data()), fConfigAddQuadrupletHistogram); + DefineHistograms(fHistMan, Form("QuadrupletSEMP_%s", fQuadrupletCutNames[icut].Data()), fConfigAddQuadrupletHistogram); + } + DefineHistograms(fHistMan, Form("QuadrupletSEPP_%s", fQuadrupletCutNames[icut].Data()), fConfigAddQuadrupletHistogram); + DefineHistograms(fHistMan, Form("QuadrupletSEMM_%s", fQuadrupletCutNames[icut].Data()), fConfigAddQuadrupletHistogram); + } } } @@ -1889,8 +1907,6 @@ struct AnalysisDileptonTrackTrack { template void runDileptonTrackTrack(TEvent const& event, TTracks const& tracks, soa::Filtered const& dileptons) { - VarManager::ResetValues(0, VarManager::kNVars, fValuesDitrack); - VarManager::FillEvent(event, fValuesDitrack); VarManager::ResetValues(0, VarManager::kNVars, fValuesQuadruplet); VarManager::FillEvent(event, fValuesQuadruplet); @@ -1898,29 +1914,13 @@ struct AnalysisDileptonTrackTrack { // loop over dileptons for (auto dilepton : dileptons) { - fDileptonFilter = 0; - fIsUnlikeSignDilepton = 0; VarManager::FillTrack(dilepton, fValuesQuadruplet); - // Check that the dilepton has zero charge - if (dilepton.sign() == 0) { - fIsUnlikeSignDilepton = 1; - } - // apply the dilepton cut - if (fDileptonCut.IsSelected(fValuesQuadruplet)) { - fDileptonFilter = 1; - if (fIsUnlikeSignDilepton == 1) { - fHistMan->FillHistClass(Form("DileptonsSelectedUS_%s", fDileptonCut.GetName()), fValuesQuadruplet); - } else { - fHistMan->FillHistClass(Form("DileptonsSelectedLS_%s", fDileptonCut.GetName()), fValuesQuadruplet); - } - } - - // pass the dilepton without cut - if (fDileptonFilter == 0) { + if (!fDileptonCut.IsSelected(fValuesQuadruplet)) continue; - } + + fHistMan->FillHistClass(Form("Dileptons_%s", fDileptonCut.GetName()), fValuesQuadruplet); // get the index of the electron legs int indexLepton1 = dilepton.index0Id(); @@ -1933,47 +1933,53 @@ struct AnalysisDileptonTrackTrack { continue; } - // fill variables - VarManager::FillPair(t1, t2, fValuesDitrack); - if constexpr (TCandidateType == VarManager::kChictoJpsiEE) { - VarManager::FillPair(t1, t2, fValuesDitrack); - } - VarManager::FillDileptonTrackTrack(dilepton, t1, t2, fValuesQuadruplet); - - if (t1.sign() * t2.sign() > 0) { - fIsUnlikeSignDitrack = 0; + if (fIsSameTrackCut) { + if (!(static_cast(t1.isBarrelSelected()) & (static_cast(1) << 1)) || !(static_cast(t2.isBarrelSelected()) & (static_cast(1) << 1))) { + continue; + } } else { - fIsUnlikeSignDitrack = 1; + if (!(static_cast(t1.isBarrelSelected()) & (static_cast(1) << 1)) || !(static_cast(t2.isBarrelSelected()) & (static_cast(1) << 2))) { + continue; + } } - int iTrackCut = 0; - for (auto cutname = fTrackCutNames.begin(); cutname != fTrackCutNames.end(); cutname++, iTrackCut++) { - // apply the DiTrack cut - if (fDitrackCut.IsSelected(fValuesDitrack)) { - // apply the Track cut - if (t1.isBarrelSelected() & (uint32_t(1) << (iTrackCut + 1)) && t2.isBarrelSelected() & (uint32_t(1) << (iTrackCut + 1))) { - fHistMan->FillHistClass(Form("DitrackSelected_%s_%s", fDitrackCut.GetName(), (*cutname).Data()), fValuesDitrack); - if (fQuadrupletCut.IsSelected(fValuesQuadruplet)) { - XTable(fValuesQuadruplet[VarManager::kQuadMass], fValuesQuadruplet[VarManager::kQuadPt], fValuesQuadruplet[VarManager::kRap], fValuesQuadruplet[VarManager::kQuadEta], fValuesQuadruplet[VarManager::kPairMass], fValuesQuadruplet[VarManager::kDitrackMass], fValuesQuadruplet[VarManager::kPairPt], fValuesQuadruplet[VarManager::kDitrackPt], fValuesQuadruplet[VarManager::kQ], fValuesQuadruplet[VarManager::kDeltaR1], fValuesQuadruplet[VarManager::kDeltaR2], fValuesQuadruplet[VarManager::kCosthetaDileptonDitrack], fValuesQuadruplet[VarManager::kTrackDCAxyProng1], fValuesQuadruplet[VarManager::kTrackDCAzProng1], fValuesQuadruplet[VarManager::kTrackDCAxyProng2], fValuesQuadruplet[VarManager::kTrackDCAzProng2], fValuesQuadruplet[VarManager::kPt1], fValuesQuadruplet[VarManager::kPt2], dilepton.sign(), t1.sign() + t2.sign()); - if (fIsUnlikeSignDilepton) { - if (fIsUnlikeSignDitrack) { - fHistMan->FillHistClass(Form("QuadrupletSEUSUS_%s_%s_%s", fDileptonCut.GetName(), fDitrackCut.GetName(), (*cutname).Data()), fValuesQuadruplet); - } else { - fHistMan->FillHistClass(Form("QuadrupletSEUSLS_%s_%s_%s", fDileptonCut.GetName(), fDitrackCut.GetName(), (*cutname).Data()), fValuesQuadruplet); - } - } else { - if (fIsUnlikeSignDitrack) { - fHistMan->FillHistClass(Form("QuadrupletSELSUS_%s_%s_%s", fDileptonCut.GetName(), fDitrackCut.GetName(), (*cutname).Data()), fValuesQuadruplet); - } else { - fHistMan->FillHistClass(Form("QuadrupletSELSLS_%s_%s_%s", fDileptonCut.GetName(), fDitrackCut.GetName(), (*cutname).Data()), fValuesQuadruplet); - } - } + // fill variables + VarManager::FillDileptonTrackTrack(dilepton, t1, t2, fValuesQuadruplet); + + int iCut = 0; + uint32_t CutDecision = 0; + for (auto cutname = fQuadrupletCutNames.begin(); cutname != fQuadrupletCutNames.end(); cutname++, iCut++) { + // apply dilepton-track-track cut + if (fQuadrupletCuts[iCut].IsSelected(fValuesQuadruplet)) { + CutDecision |= (1 << iCut); + if (fIsSameTrackCut) { + if (t1.sign() * t2.sign() < 0) { + fHistMan->FillHistClass(Form("QuadrupletSEPM_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } + } else { + if ((t1.sign() < 0) && (t2.sign() > 0)) { + fHistMan->FillHistClass(Form("QuadrupletSEMP_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } else if ((t1.sign() > 0) && (t2.sign() < 0)) { + fHistMan->FillHistClass(Form("QuadrupletSEPM_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); } } - } // check if the Ditrack cut is selected - } // loop over hadron cuts - } - } + if ((t1.sign() > 0) && (t2.sign() > 0)) { + fHistMan->FillHistClass(Form("QuadrupletSEPP_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } else if ((t1.sign() < 0) && (t2.sign() < 0)) { + fHistMan->FillHistClass(Form("QuadrupletSEMM_%s", fQuadrupletCutNames[iCut].Data()), fValuesQuadruplet); + } + } + } // loop over dilepton-track-track cuts + + // table to be written out for ML analysis + if (!CutDecision) + continue; + DileptonTrackTrackTable(fValuesQuadruplet[VarManager::kQuadMass], fValuesQuadruplet[VarManager::kQuadPt], fValuesQuadruplet[VarManager::kQuadEta], fValuesQuadruplet[VarManager::kQuadPhi], fValuesQuadruplet[VarManager::kRap], + fValuesQuadruplet[VarManager::kQ], fValuesQuadruplet[VarManager::kDeltaR1], fValuesQuadruplet[VarManager::kDeltaR2], + dilepton.mass(), dilepton.pt(), dilepton.eta(), dilepton.phi(), dilepton.sign(), + fValuesQuadruplet[VarManager::kDitrackMass], fValuesQuadruplet[VarManager::kDitrackPt], t1.pt(), t2.pt(), t1.eta(), t2.eta(), t1.phi(), t2.phi(), t1.sign(), t2.sign()); + } // end loop over track-track pairs + } // end loop over dileptons } void processJpsiPiPi(soa::Filtered::iterator const& event, MyBarrelTracksSelectedWithCov const& tracks, soa::Filtered const& dileptons) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index ea7e384a409..739a9ff1957 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -19,6 +19,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -66,7 +70,7 @@ namespace o2::aod namespace dqanalysisflags { DECLARE_SOA_COLUMN(MixingHash, mixingHash, int); //! Hash used in event mixing -DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 32); //! Event decision +DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 8); //! Event decision DECLARE_SOA_BITMAP_COLUMN(IsBarrelSelected, isBarrelSelected, 32); //! Barrel track decisions DECLARE_SOA_COLUMN(BarrelAmbiguityInBunch, barrelAmbiguityInBunch, int8_t); //! Barrel track in-bunch ambiguity DECLARE_SOA_COLUMN(BarrelAmbiguityOutOfBunch, barrelAmbiguityOutOfBunch, int8_t); //! Barrel track out of bunch ambiguity @@ -86,14 +90,14 @@ DECLARE_SOA_COLUMN(CosPBcandidate, cosPBcandidate, float); DECLARE_SOA_COLUMN(Chi2Bcandidate, chi2Bcandidate, float); } // namespace dqanalysisflags -DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTS", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents -DECLARE_SOA_TABLE(MixingHashes, "AOD", "DQANAMIXHASH", dqanalysisflags::MixingHash); //! joinable to ReducedEvents -DECLARE_SOA_TABLE(BarrelTrackCuts, "AOD", "DQANATRKCUTS", dqanalysisflags::IsBarrelSelected); //! joinable to ReducedTracksAssoc -DECLARE_SOA_TABLE(BarrelAmbiguities, "AOD", "DQBARRELAMB", dqanalysisflags::BarrelAmbiguityInBunch, dqanalysisflags::BarrelAmbiguityOutOfBunch); //! joinable to ReducedBarrelTracks -DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTS", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc -DECLARE_SOA_TABLE(MuonAmbiguities, "AOD", "DQMUONAMB", dqanalysisflags::MuonAmbiguityInBunch, dqanalysisflags::MuonAmbiguityOutOfBunch); //! joinable to ReducedMuonTracks -DECLARE_SOA_TABLE(Prefilter, "AOD", "DQPREFILTER", dqanalysisflags::IsBarrelSelectedPrefilter); //! joinable to ReducedTracksAssoc -DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", dqanalysisflags::massBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate); +DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTSA", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents +DECLARE_SOA_TABLE(MixingHashes, "AOD", "DQANAMIXHASHA", dqanalysisflags::MixingHash); //! joinable to ReducedEvents +DECLARE_SOA_TABLE(BarrelTrackCuts, "AOD", "DQANATRKCUTSA", dqanalysisflags::IsBarrelSelected); //! joinable to ReducedTracksAssoc +DECLARE_SOA_TABLE(BarrelAmbiguities, "AOD", "DQBARRELAMBA", dqanalysisflags::BarrelAmbiguityInBunch, dqanalysisflags::BarrelAmbiguityOutOfBunch); //! joinable to ReducedBarrelTracks +DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc +DECLARE_SOA_TABLE(MuonAmbiguities, "AOD", "DQMUONAMBA", dqanalysisflags::MuonAmbiguityInBunch, dqanalysisflags::MuonAmbiguityOutOfBunch); //! joinable to ReducedMuonTracks +DECLARE_SOA_TABLE(Prefilter, "AOD", "DQPREFILTERA", dqanalysisflags::IsBarrelSelectedPrefilter); //! joinable to ReducedTracksAssoc +DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONSA", dqanalysisflags::massBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate); } // namespace o2::aod // Declarations of various short names @@ -154,17 +158,26 @@ void PrintBitMap(TMap map, int nbits) } } -// Analysis task that produces event decisions and the Hash table used in event mixing +// Analysis task that produces event decisions (analysis cut, in bunch pileup and split collision check) and the Hash table used in event mixing struct AnalysisEventSelection { Produces eventSel; Produces hash; OutputObj fOutputList{"output"}; + // TODO: Provide the mixing variables and binning directly via configurables (e.g. vectors of float) Configurable fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigITSROFrameStartBorderMargin{"ITSROFrameStartBorderMargin", -1, "Number of bcs at the start of ITS RO Frame border. Take from CCDB if -1"}; - Configurable fConfigITSROFrameEndBorderMargin{"ITSROFrameEndBorderMargin", -1, "Number of bcs at the end of ITS RO Frame border. Take from CCDB if -1"}; + Configurable fConfigQA{"cfgQA", true, "If true, QA histograms will be created and filled"}; + + Configurable fConfigITSROFrameStartBorderMargin{"cfgITSROFrameStartBorderMargin", -1, "Number of bcs at the start of ITS RO Frame border. Take from CCDB if -1"}; + Configurable fConfigITSROFrameEndBorderMargin{"cfgITSROFrameEndBorderMargin", -1, "Number of bcs at the end of ITS RO Frame border. Take from CCDB if -1"}; + + Configurable fConfigSplitCollisionsDeltaZ{"cfgSplitCollisionsDeltaZ", 1.0, "maximum delta-z (cm) between two collisions to consider them as split candidates"}; + Configurable fConfigSplitCollisionsDeltaBC{"cfgSplitCollisionsDeltaBC", 100, "maximum delta-BC between two collisions to consider them as split candidates; do not apply if value is negative"}; + Configurable fConfigCheckSplitCollisions{"cfgCheckSplitCollisions", false, "If true, run the split collision check and fill histograms"}; + + Configurable fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"}; Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -191,12 +204,17 @@ struct AnalysisEventSelection { VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill VarManager::SetDefaultVarNames(); - fHistMan = new HistogramManager("analysisHistos", "", VarManager::kNVars); - fHistMan->SetUseDefaultVariableNames(kTRUE); - fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); - DefineHistograms(fHistMan, "Event_BeforeCuts;Event_AfterCuts;SameBunchCorrelations", fConfigAddEventHistogram.value.data()); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill - fOutputList.setObject(fHistMan->GetMainHistogramList()); + if (fConfigQA) { + fHistMan = new HistogramManager("analysisHistos", "", VarManager::kNVars); + fHistMan->SetUseDefaultVariableNames(kTRUE); + fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); + DefineHistograms(fHistMan, "Event_BeforeCuts;Event_AfterCuts;", fConfigAddEventHistogram.value.data()); + if (fConfigCheckSplitCollisions) { + DefineHistograms(fHistMan, "SameBunchCorrelations;OutOfBunchCorrelations;", ""); + } + VarManager::SetUseVars(fHistMan->GetUsedVars()); + fOutputList.setObject(fHistMan->GetMainHistogramList()); + } TString mixVarsString = fConfigMixingVariables.value; std::unique_ptr objArray(mixVarsString.Tokenize(",")); @@ -225,15 +243,12 @@ struct AnalysisEventSelection { uint64_t sor = std::atol(header["SOR"].c_str()); uint64_t eor = std::atol(header["EOR"].c_str()); VarManager::SetSORandEOR(sor, eor); - LOG(info) << "============================= SOR / EOR :: " << sor << " / " << eor; auto alppar = fCCDB->getForTimeStamp>("ITS/Config/AlpideParam", events.begin().timestamp()); EventSelectionParams* par = fCCDB->getForTimeStamp("EventSelection/EventSelectionParams", events.begin().timestamp()); int itsROFrameStartBorderMargin = fConfigITSROFrameStartBorderMargin < 0 ? par->fITSROFrameStartBorderMargin : fConfigITSROFrameStartBorderMargin; int itsROFrameEndBorderMargin = fConfigITSROFrameEndBorderMargin < 0 ? par->fITSROFrameEndBorderMargin : fConfigITSROFrameEndBorderMargin; VarManager::SetITSROFBorderselection(alppar->roFrameBiasInBC, alppar->roFrameLengthInBC, itsROFrameStartBorderMargin, itsROFrameEndBorderMargin); - LOGP(debug, "==============++++++++++++========== roBias / roLength / start / end :: {} / {} / {} / {}", alppar->roFrameBiasInBC, alppar->roFrameLengthInBC, itsROFrameStartBorderMargin, itsROFrameEndBorderMargin); - fCurrentRun = events.begin().runNumber(); } @@ -246,12 +261,32 @@ struct AnalysisEventSelection { VarManager::FillEvent(event); bool decision = false; - fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); // automatically fill all the histograms in the class Event + // Fill histograms in the class Event, before cuts + if (fConfigQA) { + fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); + } + + // Apply event cuts and fill histograms after selection if (fEventCut->IsSelected(VarManager::fgValues)) { - fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); - decision = true; + if (fConfigRunZorro) { + if (event.tag_bit(56)) { // This is the bit used for the software trigger event selections [TO BE DONE: find a more clear way to use it] + if (fConfigQA) { + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + } + decision = true; + } + } else { + if (fConfigQA) { + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + } + decision = true; + } } + + // fill the event decision map fSelMap[event.globalIndex()] = decision; + + // Fill the BC map of events if (fBCCollMap.find(event.globalBC()) == fBCCollMap.end()) { std::vector evIndices = {event.globalIndex()}; fBCCollMap[event.globalBC()] = evIndices; @@ -260,6 +295,7 @@ struct AnalysisEventSelection { evIndices.push_back(event.globalIndex()); } + // create the mixing hash and publish it into the hash table if (fMixHandler != nullptr) { int hh = fMixHandler->FindEventCategory(VarManager::fgValues); hash(hh); @@ -270,49 +306,79 @@ struct AnalysisEventSelection { template void publishSelections(TEvents const& events) { + // Create a map for collisions which are candidate of being split + // key: event global index, value: whether pileup event is a possible splitting + std::map collisionSplittingMap; - std::map collisionSplittingMap; // key: event global index, value: whether pileup event is a possible splitting - - // Reset the fValues array and fill event observables - VarManager::ResetValues(0, VarManager::kNEventWiseVariables); - // loop over the BC map, find BCs with more than one collision and compute 2-event correlation quantities - for (auto& [bc, evIndices] : fBCCollMap) { - if (evIndices.size() < 2) { - continue; - } - for (auto ev1Idx = evIndices.begin(); ev1Idx != evIndices.end(); ++ev1Idx) { - if (!fSelMap[*ev1Idx]) { - continue; - } - auto ev1 = events.rawIteratorAt(*ev1Idx); - for (auto ev2Idx = std::next(ev1Idx); ev2Idx != evIndices.end(); ++ev2Idx) { - if (!fSelMap[*ev2Idx]) { - continue; + if (fConfigCheckSplitCollisions) { + // Reset the fValues array and fill event observables + VarManager::ResetValues(0, VarManager::kNEventWiseVariables); + // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations + for (auto bc1It = fBCCollMap.begin(); bc1It != fBCCollMap.end(); ++bc1It) { + uint64_t bc1 = bc1It->first; + auto bc1Events = bc1It->second; + + // same bunch event correlations, if more than 1 collisions in this bunch + if (bc1Events.size() > 1) { + for (auto ev1It = bc1Events.begin(); ev1It != bc1Events.end(); ++ev1It) { + auto ev1 = events.rawIteratorAt(*ev1It); + for (auto ev2It = std::next(ev1It); ev2It != bc1Events.end(); ++ev2It) { + auto ev2 = events.rawIteratorAt(*ev2It); + // compute 2-event quantities and mark the candidate split collisions + VarManager::FillTwoEvents(ev1, ev2); + if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split + collisionSplittingMap[*ev1It] = true; + collisionSplittingMap[*ev2It] = true; + } + if (fConfigQA) { + fHistMan->FillHistClass("SameBunchCorrelations", VarManager::fgValues); + } + } // end second event loop + } // end first event loop + } // end if BC1 events > 1 + + // loop over the following BCs in the TF + for (auto bc2It = std::next(bc1It); bc2It != fBCCollMap.end(); ++bc2It) { + uint64_t bc2 = bc2It->first; + if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > fConfigSplitCollisionsDeltaBC) { + break; } - auto ev2 = events.rawIteratorAt(*ev2Idx); - VarManager::FillTwoEvents(ev1, ev2); - if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < 1.0) { // this is a possible collision split - collisionSplittingMap[*ev1Idx] = true; - collisionSplittingMap[*ev2Idx] = true; + auto bc2Events = bc2It->second; + + // loop over events in the first BC + for (auto ev1It : bc1Events) { + auto ev1 = events.rawIteratorAt(ev1It); + // loop over events in the second BC + for (auto ev2It : bc2Events) { + auto ev2 = events.rawIteratorAt(ev2It); + // compute 2-event quantities and mark the candidate split collisions + VarManager::FillTwoEvents(ev1, ev2); + if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split + collisionSplittingMap[ev1It] = true; + collisionSplittingMap[ev2It] = true; + } + if (fConfigQA) { + fHistMan->FillHistClass("OutOfBunchCorrelations", VarManager::fgValues); + } + } } - fHistMan->FillHistClass("SameBunchCorrelations", VarManager::fgValues); } } } // publish the table - uint32_t evSel = 0; + uint8_t evSel = static_cast(0); for (auto& event : events) { evSel = 0; if (fSelMap[event.globalIndex()]) { // event passed the user cuts - evSel |= (uint32_t(1) << 0); + evSel |= (static_cast(1) << 0); } std::vector sameBunchEvents = fBCCollMap[event.globalBC()]; if (sameBunchEvents.size() > 1) { // event with in-bunch pileup - evSel |= (uint32_t(1) << 1); + evSel |= (static_cast(1) << 1); } if (collisionSplittingMap.find(event.globalIndex()) != collisionSplittingMap.end()) { // event with possible fake in-bunch pileup (collision splitting) - evSel |= (uint32_t(1) << 2); + evSel |= (static_cast(1) << 2); } eventSel(evSel); } @@ -352,11 +418,14 @@ struct AnalysisTrackSelection { OutputObj fOutputList{"output"}; Configurable fConfigCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; - Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; + Configurable fConfigPublishAmbiguity{"cfgPublishAmbiguity", true, "If true, publish ambiguity table and fill QA histograms"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigDummyRunlist{"cfgDummyRunlist", false, "If true, use dummy runlist"}; @@ -403,7 +472,9 @@ struct AnalysisTrackSelection { for (auto& cut : fTrackCuts) { histDirNames += Form("TrackBarrel_%s;", cut.GetName()); } - histDirNames += "TrackBarrel_AmbiguityInBunch;TrackBarrel_AmbiguityOutOfBunch;"; + if (fConfigPublishAmbiguity) { + histDirNames += "TrackBarrel_AmbiguityInBunch;TrackBarrel_AmbiguityOutOfBunch;"; + } DefineHistograms(fHistMan, histDirNames.Data(), fConfigAddTrackHistogram.value.data()); // define all histograms VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill @@ -412,12 +483,11 @@ struct AnalysisTrackSelection { if (fConfigDummyRunlist) { VarManager::SetDummyRunlist(fConfigInitRunNumber); } - if (fConfigComputeTPCpostCalib) { - fCCDB->setURL(fConfigCcdbUrl.value); - fCCDB->setCaching(true); - fCCDB->setLocalObjectValidityChecking(); - fCCDB->setCreatedNotAfter(fConfigNoLaterThan.value); - } + + fCCDB->setURL(fConfigCcdbUrl.value); + fCCDB->setCaching(true); + fCCDB->setLocalObjectValidityChecking(); + fCCDB->setCreatedNotAfter(fConfigNoLaterThan.value); fCCDBApi.init(fConfigCcdbUrl.value); } @@ -456,10 +526,12 @@ struct AnalysisTrackSelection { trackSel.reserve(assocs.size()); trackAmbiguities.reserve(tracks.size()); - uint32_t filterMap = 0; + uint32_t filterMap = static_cast(0); int iCut = 0; for (auto& assoc : assocs) { + + // if the event from this association is not selected, reject also the association auto event = assoc.template reducedevent_as(); if (!event.isEventSelected_bit(0)) { trackSel(0); @@ -470,7 +542,7 @@ struct AnalysisTrackSelection { VarManager::FillEvent(event); auto track = assoc.template reducedtrack_as(); - filterMap = 0; + filterMap = static_cast(0); VarManager::FillTrack(track); // compute quantities which depend on the associated collision, such as DCA if (fPropTrack) { @@ -482,17 +554,19 @@ struct AnalysisTrackSelection { iCut = 0; for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, iCut++) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << iCut); + filterMap |= (static_cast(1) << iCut); if (fConfigQA) { fHistMan->FillHistClass(Form("TrackBarrel_%s", (*cut).GetName()), VarManager::fgValues); } } } // end loop over cuts + // publish the decisions trackSel(filterMap); // count the number of associations per track - if (filterMap > 0) { + if (fConfigPublishAmbiguity && filterMap > 0) { + // for this track, count the number of associated collisions with in-bunch pileup and out of bunch associations if (event.isEventSelected_bit(1)) { if (fNAssocsInBunch.find(track.globalIndex()) == fNAssocsInBunch.end()) { std::vector evVector = {event.globalIndex()}; @@ -513,41 +587,47 @@ struct AnalysisTrackSelection { } } // end loop over associations - // QA the collision-track associations - for (auto& [trackIdx, evIndices] : fNAssocsInBunch) { - if (evIndices.size() == 1) { - continue; - } - auto track = tracks.rawIteratorAt(trackIdx); - VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); - VarManager::FillTrack(track); - VarManager::fgValues[VarManager::kBarrelNAssocsInBunch] = static_cast(evIndices.size()); - fHistMan->FillHistClass("TrackBarrel_AmbiguityInBunch", VarManager::fgValues); - } // end loop over in-bunch ambiguous tracks - - for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) { - if (evIndices.size() == 1) { - continue; - } - auto track = tracks.rawIteratorAt(trackIdx); - VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); - VarManager::FillTrack(track); - VarManager::fgValues[VarManager::kBarrelNAssocsOutOfBunch] = static_cast(evIndices.size()); - fHistMan->FillHistClass("TrackBarrel_AmbiguityOutOfBunch", VarManager::fgValues); - } // end loop over out-of-bunch ambiguous tracks - - // publish the ambiguity table - for (auto& track : tracks) { - int8_t nInBunch = 0; - if (fNAssocsInBunch.find(track.globalIndex()) != fNAssocsInBunch.end()) { - nInBunch = fNAssocsInBunch[track.globalIndex()].size(); - } - int8_t nOutOfBunch = 0; - if (fNAssocsOutOfBunch.find(track.globalIndex()) != fNAssocsOutOfBunch.end()) { - nOutOfBunch = fNAssocsOutOfBunch[track.globalIndex()].size(); + if (fConfigPublishAmbiguity) { + // QA the collision-track associations + if (fConfigQA) { + for (auto& [trackIdx, evIndices] : fNAssocsInBunch) { + if (evIndices.size() == 1) { + continue; + } + auto track = tracks.rawIteratorAt(trackIdx); + VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); + VarManager::FillTrack(track); + // Exceptionally, set the VarManager ambiguity number here, to be used in histograms + VarManager::fgValues[VarManager::kBarrelNAssocsInBunch] = static_cast(evIndices.size()); + fHistMan->FillHistClass("TrackBarrel_AmbiguityInBunch", VarManager::fgValues); + } // end loop over in-bunch ambiguous tracks + + for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) { + if (evIndices.size() == 1) { + continue; + } + auto track = tracks.rawIteratorAt(trackIdx); + VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); + VarManager::FillTrack(track); + // Exceptionally, set the VarManager ambiguity number here + VarManager::fgValues[VarManager::kBarrelNAssocsOutOfBunch] = static_cast(evIndices.size()); + fHistMan->FillHistClass("TrackBarrel_AmbiguityOutOfBunch", VarManager::fgValues); + } // end loop over out-of-bunch ambiguous tracks + } + + // publish the ambiguity table + for (auto& track : tracks) { + int8_t nInBunch = 0; + if (fNAssocsInBunch.find(track.globalIndex()) != fNAssocsInBunch.end()) { + nInBunch = fNAssocsInBunch[track.globalIndex()].size(); + } + int8_t nOutOfBunch = 0; + if (fNAssocsOutOfBunch.find(track.globalIndex()) != fNAssocsOutOfBunch.end()) { + nOutOfBunch = fNAssocsOutOfBunch[track.globalIndex()].size(); + } + trackAmbiguities(nInBunch, nOutOfBunch); } - trackAmbiguities(nInBunch, nOutOfBunch); - } + } // end if (fConfigPublishAmbiguity) } // end runTrackSelection() @@ -584,6 +664,8 @@ struct AnalysisMuonSelection { Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigPublishAmbiguity{"cfgPublishAmbiguity", true, "If true, publish ambiguity table and fill QA histograms"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -626,7 +708,9 @@ struct AnalysisMuonSelection { for (auto& cut : fMuonCuts) { histDirNames += Form("TrackMuon_%s;", cut.GetName()); } - histDirNames += "TrackMuon_AmbiguityInBunch;TrackMuon_AmbiguityOutOfBunch;"; + if (fConfigPublishAmbiguity) { + histDirNames += "TrackMuon_AmbiguityInBunch;TrackMuon_AmbiguityOutOfBunch;"; + } DefineHistograms(fHistMan, histDirNames.Data(), fConfigAddMuonHistogram.value.data()); // define all histograms VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill @@ -661,7 +745,7 @@ struct AnalysisMuonSelection { muonSel.reserve(assocs.size()); muonAmbiguities.reserve(muons.size()); - uint32_t filterMap = 0; + uint32_t filterMap = static_cast(0); int iCut = 0; for (auto& assoc : assocs) { @@ -675,7 +759,7 @@ struct AnalysisMuonSelection { VarManager::FillEvent(event); auto track = assoc.template reducedmuon_as(); - filterMap = 0; + filterMap = static_cast(0); VarManager::FillTrack(track); if (fConfigQA) { fHistMan->FillHistClass("TrackMuon_BeforeCuts", VarManager::fgValues); @@ -683,7 +767,7 @@ struct AnalysisMuonSelection { iCut = 0; for (auto cut = fMuonCuts.begin(); cut != fMuonCuts.end(); cut++, iCut++) { if ((*cut).IsSelected(VarManager::fgValues)) { - filterMap |= (uint32_t(1) << iCut); + filterMap |= (static_cast(1) << iCut); if (fConfigQA) { fHistMan->FillHistClass(Form("TrackMuon_%s", (*cut).GetName()), VarManager::fgValues); } @@ -692,7 +776,7 @@ struct AnalysisMuonSelection { muonSel(filterMap); // count the number of associations per track - if (filterMap > 0) { + if (fConfigPublishAmbiguity && filterMap > 0) { if (event.isEventSelected_bit(1)) { if (fNAssocsInBunch.find(track.globalIndex()) == fNAssocsInBunch.end()) { std::vector evVector = {event.globalIndex()}; @@ -710,45 +794,47 @@ struct AnalysisMuonSelection { evVector.push_back(event.globalIndex()); } } - } + } // end if (fConfigPublishAmbiguity) } // end loop over assocs - // QA the collision-track associations - if (fConfigQA) { - for (auto& [trackIdx, evIndices] : fNAssocsInBunch) { - if (evIndices.size() == 1) { - continue; + if (fConfigPublishAmbiguity) { + // QA the collision-track associations + if (fConfigQA) { + for (auto& [trackIdx, evIndices] : fNAssocsInBunch) { + if (evIndices.size() == 1) { + continue; + } + auto track = muons.rawIteratorAt(trackIdx); + VarManager::ResetValues(0, VarManager::kNMuonTrackVariables); + VarManager::FillTrack(track); + VarManager::fgValues[VarManager::kMuonNAssocsInBunch] = static_cast(evIndices.size()); + fHistMan->FillHistClass("TrackMuon_AmbiguityInBunch", VarManager::fgValues); + } // end loop over in-bunch ambiguous tracks + + for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) { + if (evIndices.size() == 1) { + continue; + } + auto track = muons.rawIteratorAt(trackIdx); + VarManager::ResetValues(0, VarManager::kNMuonTrackVariables); + VarManager::FillTrack(track); + VarManager::fgValues[VarManager::kMuonNAssocsOutOfBunch] = static_cast(evIndices.size()); + fHistMan->FillHistClass("TrackMuon_AmbiguityOutOfBunch", VarManager::fgValues); + } // end loop over out-of-bunch ambiguous tracks + } + + // publish the ambiguity table + for (auto& track : muons) { + int8_t nInBunch = 0; + if (fNAssocsInBunch.find(track.globalIndex()) != fNAssocsInBunch.end()) { + nInBunch = fNAssocsInBunch[track.globalIndex()].size(); } - auto track = muons.rawIteratorAt(trackIdx); - VarManager::ResetValues(0, VarManager::kNMuonTrackVariables); - VarManager::FillTrack(track); - VarManager::fgValues[VarManager::kMuonNAssocsInBunch] = static_cast(evIndices.size()); - fHistMan->FillHistClass("TrackMuon_AmbiguityInBunch", VarManager::fgValues); - } // end loop over in-bunch ambiguous tracks - - for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) { - if (evIndices.size() == 1) { - continue; + int8_t nOutOfBunch = 0; + if (fNAssocsOutOfBunch.find(track.globalIndex()) != fNAssocsOutOfBunch.end()) { + nOutOfBunch = fNAssocsOutOfBunch[track.globalIndex()].size(); } - auto track = muons.rawIteratorAt(trackIdx); - VarManager::ResetValues(0, VarManager::kNMuonTrackVariables); - VarManager::FillTrack(track); - VarManager::fgValues[VarManager::kMuonNAssocsOutOfBunch] = static_cast(evIndices.size()); - fHistMan->FillHistClass("TrackMuon_AmbiguityOutOfBunch", VarManager::fgValues); - } // end loop over out-of-bunch ambiguous tracks - } - - // publish the ambiguity table - for (auto& track : muons) { - int8_t nInBunch = 0; - if (fNAssocsInBunch.find(track.globalIndex()) != fNAssocsInBunch.end()) { - nInBunch = fNAssocsInBunch[track.globalIndex()].size(); - } - int8_t nOutOfBunch = 0; - if (fNAssocsOutOfBunch.find(track.globalIndex()) != fNAssocsOutOfBunch.end()) { - nOutOfBunch = fNAssocsOutOfBunch[track.globalIndex()].size(); + muonAmbiguities(nInBunch, nOutOfBunch); } - muonAmbiguities(nInBunch, nOutOfBunch); } } @@ -790,63 +876,75 @@ struct AnalysisPrefilterSelection { return; } + bool runPrefilter = true; // get the list of track cuts to be prefiltered TString trackCutsStr = fConfigTrackCuts.value; TObjArray* objArrayTrackCuts = nullptr; if (!trackCutsStr.IsNull()) { objArrayTrackCuts = trackCutsStr.Tokenize(","); + if (objArrayTrackCuts == nullptr) { + runPrefilter = false; + } + } else { + LOG(warn) << " No track cuts to prefilter! Prefilter will not be run"; + runPrefilter = false; } - if (objArrayTrackCuts->GetEntries() == 0) { - LOG(fatal) << " No track cuts to prefilter!"; + // get the cut to be used as loose selection + TString prefilterTrackCutStr = fConfigPrefilterTrackCut.value; + if (prefilterTrackCutStr.IsNull()) { + LOG(warn) << " No prefilter loose selection specified! Prefilter will not be run"; + runPrefilter = false; } - // get the list of cuts that were computed in the barrel track-selection task and create a bit mask - // to mark just the ones we want to apply a prefilter on - fPrefilterMask = 0; + fPrefilterMask = static_cast(0); fPrefilterCutBit = -1; - string trackCuts; - getTaskOptionValue(context, "analysis-track-selection", "cfgTrackCuts", trackCuts, false); - TString allTrackCutsStr = trackCuts; - TString prefilterTrackCutStr = fConfigPrefilterTrackCut.value; - if (!trackCutsStr.IsNull()) { + if (runPrefilter) { + // get the list of cuts that were computed in the barrel track-selection task and create a bit mask + // to mark just the ones we want to apply a prefilter on + string trackCuts; + getTaskOptionValue(context, "analysis-track-selection", "cfgTrackCuts", trackCuts, false); + TString allTrackCutsStr = trackCuts; + std::unique_ptr objArray(allTrackCutsStr.Tokenize(",")); + if (objArray == nullptr) { + LOG(fatal) << " Not getting any track cuts from the barrel-track-selection "; + } if (objArray->FindObject(prefilterTrackCutStr.Data()) == nullptr) { LOG(fatal) << " Prefilter track cut not among the cuts calculated by the track-selection task! "; } for (int icut = 0; icut < objArray->GetEntries(); ++icut) { TString tempStr = objArray->At(icut)->GetName(); if (objArrayTrackCuts->FindObject(tempStr.Data()) != nullptr) { - fPrefilterMask |= (uint32_t(1) << icut); + fPrefilterMask |= (static_cast(1) << icut); } if (tempStr.CompareTo(fConfigPrefilterTrackCut.value) == 0) { fPrefilterCutBit = icut; } } + // setup the prefilter pair cut + fPairCut = new AnalysisCompositeCut(true); + TString pairCutStr = fConfigPrefilterPairCut.value; + if (!pairCutStr.IsNull()) { + fPairCut = dqcuts::GetCompositeCut(pairCutStr.Data()); + } } - if (fPrefilterMask == 0) { - LOG(fatal) << "No specified track cuts for prefiltering"; - } - if (fPrefilterCutBit < 0) { - LOG(fatal) << "No or incorrectly specified loose track prefilter cut"; - } - - // setup the prefilter pair cut - fPairCut = new AnalysisCompositeCut(true); - TString pairCutStr = fConfigPrefilterPairCut.value; - if (!pairCutStr.IsNull()) { - fPairCut = dqcuts::GetCompositeCut(pairCutStr.Data()); + if (fPrefilterMask == static_cast(0) || fPrefilterCutBit < 0) { + LOG(warn) << "No specified loose cut or track cuts for prefiltering. This task will do nothing."; } VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill VarManager::SetDefaultVarNames(); VarManager::SetupTwoProngDCAFitter(5.0f, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, true); // TODO: get these parameters from Configurables - VarManager::SetupTwoProngFwdDCAFitter(5.0f, true, 200.0f, 1.0e-3f, 0.9f, true); + // VarManager::SetupTwoProngFwdDCAFitter(5.0f, true, 200.0f, 1.0e-3f, 0.9f, true); } template void runPrefilter(soa::Join const& assocs, TTracks const& /*tracks*/) { + if (fPrefilterCutBit < 0 || fPrefilterMask == 0) { + return; + } for (auto& [assoc1, assoc2] : o2::soa::combinations(assocs, assocs)) { auto track1 = assoc1.template reducedtrack_as(); @@ -864,6 +962,7 @@ struct AnalysisPrefilterSelection { bool track1Loose = assoc1.isBarrelSelected_bit(fPrefilterCutBit); bool track2Loose = assoc2.isBarrelSelected_bit(fPrefilterCutBit); + // Here we check if we should apply the prefilter for this pair if (!((track1Candidate > 0 && track2Loose) || (track2Candidate > 0 && track1Loose))) { continue; } @@ -884,7 +983,6 @@ struct AnalysisPrefilterSelection { void processBarrelSkimmed(MyEvents const& events, soa::Join const& assocs, MyBarrelTracks const& tracks) { - fPrefilterMap.clear(); for (auto& event : events) { @@ -893,15 +991,26 @@ struct AnalysisPrefilterSelection { runPrefilter(groupedAssocs, tracks); } } + uint32_t mymap = -1; - for (auto& assoc : assocs) { - auto track = assoc.template reducedtrack_as(); - mymap = -1; - if (fPrefilterMap.find(track.globalIndex()) != fPrefilterMap.end()) { - // NOTE: publish the bitwise negated bits (~), so there will be zeroes for cuts that failed the prefiltering and 1 everywhere else - mymap = ~fPrefilterMap[track.globalIndex()]; + // If cuts were not configured, then produce a map with all 1's and publish it for all associations + if (fPrefilterCutBit < 0 || fPrefilterMask == 0) { + for (int i = 0; i < assocs.size(); ++i) { + prefilter(mymap); + } + } else { + for (auto& assoc : assocs) { + // TODO: just use the index from the assoc (no need to cast the whole track) + auto track = assoc.template reducedtrack_as(); + mymap = -1; + if (fPrefilterMap.find(track.globalIndex()) != fPrefilterMap.end()) { + // NOTE: publish the bitwise negated bits (~), so there will be zeroes for cuts that failed the prefiltering and 1 everywhere else + mymap = ~fPrefilterMap[track.globalIndex()]; + prefilter(mymap); + } else { + prefilter(mymap); // track did not pass the prefilter selections, so publish just 1's + } } - prefilter(mymap); } } @@ -936,38 +1045,42 @@ struct AnalysisSameEventPairing { OutputObj fOutputList{"output"}; - Configurable fConfigTrackCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; - Configurable fConfigMuonCuts{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; - Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts"}; + struct : ConfigurableGroup { + Configurable track{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; + Configurable pair{"cfgPairCuts", "", "Comma separated list of pair cuts"}; + } fConfigCuts; Configurable fConfigMixingDepth{"cfgMixingDepth", 100, "Number of Events stored for event mixing"}; // Configurable fConfigAddEventMixingHistogram{"cfgAddEventMixingHistogram", "", "Comma separated list of histograms"}; - - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPath{"ccdb-path", "Users/lm", "base path to the ccdb object"}; - Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable fConfigGRPMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable fConfigUseRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"}; - Configurable fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"}; - Configurable fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigFlatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"}; - Configurable fConfigUseKFVertexing{"cfgUseKFVertexing", false, "Use KF Particle for secondary vertex reconstruction (DCAFitter is used by default)"}; - Configurable fConfigUseAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"}; - Configurable fConfigPropToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"}; - Configurable fConfigCorrFullGeo{"cfgCorrFullGeo", false, "Use full geometry to correct for MCS effects in track propagation"}; - Configurable fConfigNoCorr{"cfgNoCorrFwdProp", false, "Do not correct for MCS effects in track propagation"}; - Configurable fConfigLutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable fConfigCollisionSystem{"syst", "pp", "Collision system, pp or PbPb"}; - Configurable fConfigCenterMassEnergy{"energy", 13600, "Center of mass energy in GeV"}; - // Track related options - Configurable fPropTrack{"cfgPropTrack", true, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; + Configurable fConfigQA{"cfgQA", true, "If true, fill output histograms"}; + + struct : ConfigurableGroup { + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + } fConfigCCDB; + + struct : ConfigurableGroup { + Configurable useRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"}; + Configurable magField{"cfgMagField", 5.0f, "Manually set magnetic field"}; + Configurable flatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"}; + Configurable useKFVertexing{"cfgUseKFVertexing", false, "Use KF Particle for secondary vertex reconstruction (DCAFitter is used by default)"}; + Configurable useAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"}; + Configurable propToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"}; + Configurable corrFullGeo{"cfgCorrFullGeo", false, "Use full geometry to correct for MCS effects in track propagation"}; + Configurable noCorr{"cfgNoCorrFwdProp", false, "Do not correct for MCS effects in track propagation"}; + Configurable collisionSystem{"syst", "pp", "Collision system, pp or PbPb"}; + Configurable centerMassEnergy{"energy", 13600, "Center of mass energy in GeV"}; + Configurable propTrack{"cfgPropTrack", true, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; + } fConfigOptions; Service fCCDB; o2::ccdb::CcdbApi fCCDBApi; - Filter filterEventSelected = aod::dqanalysisflags::isEventSelected == uint32_t(1); + Filter filterEventSelected = aod::dqanalysisflags::isEventSelected > static_cast(1); HistogramManager* fHistMan; @@ -1008,7 +1121,7 @@ struct AnalysisSameEventPairing { TString histNames = ""; std::vector names; - TString cutNamesStr = fConfigPairCuts.value; + TString cutNamesStr = fConfigCuts.pair.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); for (int icut = 0; icut < objArray->GetEntries(); ++icut) { @@ -1018,12 +1131,12 @@ struct AnalysisSameEventPairing { // get the list of cuts for tracks/muons, check that they were played by the barrel/muon selection tasks // and make a mask for active cuts (barrel and muon selection tasks may run more cuts, needed for other analyses) - TString trackCutsStr = fConfigTrackCuts.value; + TString trackCutsStr = fConfigCuts.track.value; TObjArray* objArrayTrackCuts = nullptr; if (!trackCutsStr.IsNull()) { objArrayTrackCuts = trackCutsStr.Tokenize(","); } - TString muonCutsStr = fConfigMuonCuts.value; + TString muonCutsStr = fConfigCuts.muon.value; TObjArray* objArrayMuonCuts = nullptr; if (!muonCutsStr.IsNull()) { objArrayMuonCuts = muonCutsStr.Tokenize(","); @@ -1039,7 +1152,7 @@ struct AnalysisSameEventPairing { for (int icut = 0; icut < objArray->GetEntries(); ++icut) { TString tempStr = objArray->At(icut)->GetName(); if (objArrayTrackCuts->FindObject(tempStr.Data()) != nullptr) { - fTrackFilterMask |= (uint32_t(1) << icut); + fTrackFilterMask |= (static_cast(1) << icut); if (fEnableBarrelHistos) { names = { @@ -1063,7 +1176,7 @@ struct AnalysisSameEventPairing { histNames += Form("%s;%s;%s;", names[(fEnableBarrelMixingHistos ? 9 : 6)].Data(), names[(fEnableBarrelMixingHistos ? 10 : 7)].Data(), names[(fEnableBarrelMixingHistos ? 11 : 8)].Data()); fTrackHistNames[icut] = names; - TString cutNamesStr = fConfigPairCuts.value; + TString cutNamesStr = fConfigCuts.pair.value; if (!cutNamesStr.IsNull()) { // if pair cuts std::unique_ptr objArrayPair(cutNamesStr.Tokenize(",")); fNPairCuts = objArrayPair->GetEntries(); @@ -1075,8 +1188,8 @@ struct AnalysisSameEventPairing { histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fTrackHistNames[fNCutsBarrel + icut * fNPairCuts + iPairCut] = names; } // end loop (pair cuts) - } // end if (pair cuts) - } // end if enableBarrelHistos + } // end if (pair cuts) + } // end if enableBarrelHistos } } } @@ -1089,7 +1202,7 @@ struct AnalysisSameEventPairing { for (int icut = 0; icut < objArray->GetEntries(); ++icut) { TString tempStr = objArray->At(icut)->GetName(); if (objArrayMuonCuts->FindObject(tempStr.Data()) != nullptr) { - fMuonFilterMask |= (uint32_t(1) << icut); + fMuonFilterMask |= (static_cast(1) << icut); if (fEnableMuonHistos) { // no pair cuts @@ -1110,11 +1223,29 @@ struct AnalysisSameEventPairing { names.push_back(Form("PairsMuonSEPM_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); names.push_back(Form("PairsMuonSEPP_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); names.push_back(Form("PairsMuonSEMM_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonSEPM_unambiguous_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonSEPP_unambiguous_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonSEMM_unambiguous_%s", objArray->At(icut)->GetName())); histNames += Form("%s;%s;%s;", names[(fEnableMuonMixingHistos ? 6 : 3)].Data(), names[(fEnableMuonMixingHistos ? 7 : 4)].Data(), names[(fEnableMuonMixingHistos ? 8 : 5)].Data()); histNames += Form("%s;%s;%s;", names[(fEnableMuonMixingHistos ? 9 : 6)].Data(), names[(fEnableMuonMixingHistos ? 10 : 7)].Data(), names[(fEnableMuonMixingHistos ? 11 : 8)].Data()); + histNames += Form("%s;%s;%s;", names[(fEnableMuonMixingHistos ? 12 : 9)].Data(), names[(fEnableMuonMixingHistos ? 13 : 10)].Data(), names[(fEnableMuonMixingHistos ? 14 : 11)].Data()); + if (fEnableMuonMixingHistos) { + names.push_back(Form("PairsMuonMEPM_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonMEPP_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonMEMM_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonMEPM_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonMEPP_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonMEMM_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonMEPM_unambiguous_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonMEPP_unambiguous_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonMEMM_unambiguous_%s", objArray->At(icut)->GetName())); + histNames += Form("%s;%s;%s;", names[15].Data(), names[16].Data(), names[17].Data()); + histNames += Form("%s;%s;%s;", names[18].Data(), names[19].Data(), names[20].Data()); + histNames += Form("%s;%s;%s;", names[21].Data(), names[22].Data(), names[23].Data()); + } fMuonHistNames[icut] = names; - TString cutNamesStr = fConfigPairCuts.value; + TString cutNamesStr = fConfigCuts.pair.value; if (!cutNamesStr.IsNull()) { // if pair cuts std::unique_ptr objArrayPair(cutNamesStr.Tokenize(",")); fNPairCuts = objArrayPair->GetEntries(); @@ -1126,7 +1257,7 @@ struct AnalysisSameEventPairing { histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fMuonHistNames[fNCutsMuon + icut * fNCutsMuon + iPairCut] = names; } // end loop (pair cuts) - } // end if (pair cuts) + } // end if (pair cuts) } } } @@ -1134,30 +1265,25 @@ struct AnalysisSameEventPairing { fCurrentRun = 0; - fCCDB->setURL(fConfigCcdbUrl.value); + fCCDB->setURL(fConfigCCDB.url.value); fCCDB->setCaching(true); fCCDB->setLocalObjectValidityChecking(); - fCCDBApi.init(fConfigCcdbUrl.value); + fCCDBApi.init(fConfigCCDB.url.value); - if (fConfigNoCorr) { + if (fConfigOptions.noCorr) { VarManager::SetupFwdDCAFitterNoCorr(); - } else if (fConfigCorrFullGeo || (fConfigUseKFVertexing && fConfigPropToPCA)) { + } else if (fConfigOptions.corrFullGeo || (fConfigOptions.useKFVertexing && fConfigOptions.propToPCA)) { if (!o2::base::GeometryManager::isGeometryLoaded()) { - fCCDB->get(fConfigGeoPath); + fCCDB->get(fConfigCCDB.geoPath); } } else { - fLUT = o2::base::MatLayerCylSet::rectifyPtrFromFile(fCCDB->get(fConfigLutPath)); + fLUT = o2::base::MatLayerCylSet::rectifyPtrFromFile(fCCDB->get(fConfigCCDB.lutPath)); VarManager::SetupMatLUTFwdDCAFitter(fLUT); } - VarManager::SetDefaultVarNames(); - fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); - fHistMan->SetUseDefaultVariableNames(kTRUE); - fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); - /*if (context.mOptions.get("processElectronMuonSkimmed") || context.mOptions.get("processAllSkimmed")) { - TString cutNamesBarrel = fConfigTrackCuts.value; - TString cutNamesMuon = fConfigMuonCuts.value; + TString cutNamesBarrel = fConfigCuts.track.value; + TString cutNamesMuon = fConfigCuts.muon.value; if (!cutNamesBarrel.IsNull() && !cutNamesMuon.IsNull()) { std::unique_ptr objArrayBarrel(cutNamesBarrel.Tokenize(",")); std::unique_ptr objArrayMuon(cutNamesMuon.Tokenize(",")); @@ -1171,7 +1297,7 @@ struct AnalysisSameEventPairing { histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fTrackMuonHistNames.push_back(names); - TString cutNamesStr = fConfigPairCuts.value; + TString cutNamesStr = fConfigCuts.pair.value; if (!cutNamesStr.IsNull()) { // if pair cuts std::unique_ptr objArrayPair(cutNamesStr.Tokenize(",")); for (int iPairCut = 0; iPairCut < objArrayPair->GetEntries(); ++iPairCut) { // loop over pair cuts @@ -1188,18 +1314,23 @@ struct AnalysisSameEventPairing { } // end if (track cuts) }*/ - VarManager::SetCollisionSystem((TString)fConfigCollisionSystem, fConfigCenterMassEnergy); // set collision system and center of mass energy - - DefineHistograms(fHistMan, histNames.Data(), fConfigAddSEPHistogram.value.data()); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill - fOutputList.setObject(fHistMan->GetMainHistogramList()); + if (fConfigQA) { + VarManager::SetDefaultVarNames(); + fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); + fHistMan->SetUseDefaultVariableNames(true); + fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); + VarManager::SetCollisionSystem((TString)fConfigOptions.collisionSystem, fConfigOptions.centerMassEnergy); // set collision system and center of mass energy + DefineHistograms(fHistMan, histNames.Data(), fConfigAddSEPHistogram.value.data()); // define all histograms + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + fOutputList.setObject(fHistMan->GetMainHistogramList()); + } } void initParamsFromCCDB(uint64_t timestamp, int runNumber, bool withTwoProngFitter = true) { - if (fConfigUseRemoteField.value) { - o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(fConfigGRPMagPath, timestamp); + if (fConfigOptions.useRemoteField.value) { + o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(fConfigCCDB.grpMagPath, timestamp); float magField = 0.0; if (grpmag != nullptr) { magField = grpmag->getNominalL3Field(); @@ -1207,25 +1338,25 @@ struct AnalysisSameEventPairing { LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", timestamp); } if (withTwoProngFitter) { - if (fConfigUseKFVertexing.value) { + if (fConfigOptions.useKFVertexing.value) { VarManager::SetupTwoProngKFParticle(magField); } else { - VarManager::SetupTwoProngDCAFitter(magField, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); // TODO: get these parameters from Configurables - VarManager::SetupTwoProngFwdDCAFitter(magField, true, 200.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); + VarManager::SetupTwoProngDCAFitter(magField, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); // TODO: get these parameters from Configurables + VarManager::SetupTwoProngFwdDCAFitter(magField, true, 200.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); } } else { - VarManager::SetupTwoProngDCAFitter(magField, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); // needed because take in varmanager Bz from fgFitterTwoProngBarrel for PhiV calculations + VarManager::SetupTwoProngDCAFitter(magField, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); // needed because take in varmanager Bz from fgFitterTwoProngBarrel for PhiV calculations } } else { if (withTwoProngFitter) { - if (fConfigUseKFVertexing.value) { - VarManager::SetupTwoProngKFParticle(fConfigMagField.value); + if (fConfigOptions.useKFVertexing.value) { + VarManager::SetupTwoProngKFParticle(fConfigOptions.magField.value); } else { - VarManager::SetupTwoProngDCAFitter(fConfigMagField.value, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); // TODO: get these parameters from Configurables - VarManager::SetupTwoProngFwdDCAFitter(fConfigMagField.value, true, 200.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); + VarManager::SetupTwoProngDCAFitter(fConfigOptions.magField.value, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); // TODO: get these parameters from Configurables + VarManager::SetupTwoProngFwdDCAFitter(fConfigOptions.magField.value, true, 200.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); } } else { - VarManager::SetupTwoProngDCAFitter(fConfigMagField.value, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigUseAbsDCA.value); // needed because take in varmanager Bz from fgFitterTwoProngBarrel for PhiV calculations + VarManager::SetupTwoProngDCAFitter(fConfigOptions.magField.value, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, fConfigOptions.useAbsDCA.value); // needed because take in varmanager Bz from fgFitterTwoProngBarrel for PhiV calculations } } @@ -1247,12 +1378,12 @@ struct AnalysisSameEventPairing { } } - TString cutNames = fConfigTrackCuts.value; + TString cutNames = fConfigCuts.track.value; std::map> histNames = fTrackHistNames; int ncuts = fNCutsBarrel; int histIdxOffset = 0; if constexpr (TPairType == pairTypeMuMu) { - cutNames = fConfigMuonCuts.value; + cutNames = fConfigCuts.muon.value; histNames = fMuonHistNames; ncuts = fNCutsMuon; if (fEnableMuonMixingHistos) { @@ -1265,12 +1396,12 @@ struct AnalysisSameEventPairing { } } /*if constexpr (TPairType == pairTypeEMu) { - cutNames = fConfigMuonCuts.value; + cutNames = fConfigCuts.muon.value; histNames = fTrackMuonHistNames; }*/ - uint32_t twoTrackFilter = 0; - uint32_t dileptonMcDecision = 0; // placeholder, copy of the dqEfficiency.cxx one + uint32_t twoTrackFilter = static_cast(0); + uint32_t dileptonMcDecision = static_cast(0); // placeholder, copy of the dqEfficiency.cxx one int sign1 = 0; int sign2 = 0; dielectronList.reserve(1); @@ -1280,7 +1411,7 @@ struct AnalysisSameEventPairing { dimuonsExtraList.reserve(1); dileptonInfoList.reserve(1); dileptonFlowList.reserve(1); - if (fConfigFlatTables.value) { + if (fConfigOptions.flatTables.value) { dielectronAllList.reserve(1); dimuonAllList.reserve(1); } @@ -1315,26 +1446,27 @@ struct AnalysisSameEventPairing { sign1 = t1.sign(); sign2 = t2.sign(); // store the ambiguity number of the two dilepton legs in the last 4 digits of the two-track filter + // TODO: Make sure that we do not work with more than 28 track bits if (t1.barrelAmbiguityInBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 28); + twoTrackFilter |= (static_cast(1) << 28); } if (t2.barrelAmbiguityInBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 29); + twoTrackFilter |= (static_cast(1) << 29); } if (t1.barrelAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 30); + twoTrackFilter |= (static_cast(1) << 30); } if (t2.barrelAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 31); + twoTrackFilter |= (static_cast(1) << 31); } VarManager::FillPair(t1, t2); // compute quantities which depend on the associated collision, such as DCA - if (fPropTrack) { + if (fConfigOptions.propTrack) { VarManager::FillPairCollision(event, t1, t2); } if constexpr (TTwoProngFitter) { - VarManager::FillPairVertexing(event, t1, t2, fConfigPropToPCA); + VarManager::FillPairVertexing(event, t1, t2, fConfigOptions.propToPCA); } if constexpr (eventHasQvector) { VarManager::FillPairVn(t1, t2); @@ -1351,7 +1483,7 @@ struct AnalysisSameEventPairing { if constexpr (trackHasCov && TTwoProngFitter) { dielectronsExtraList(t1.globalIndex(), t2.globalIndex(), VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]); if constexpr ((TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelPID) > 0) { - if (fConfigFlatTables.value) { + if (fConfigOptions.flatTables.value) { dielectronAllList(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), twoTrackFilter, dileptonMcDecision, t1.pt(), t1.eta(), t1.phi(), t1.itsClusterMap(), t1.itsChi2NCl(), t1.tpcNClsCrossedRows(), t1.tpcNClsFound(), t1.tpcChi2NCl(), t1.dcaXY(), t1.dcaZ(), t1.tpcSignal(), t1.tpcNSigmaEl(), t1.tpcNSigmaPi(), t1.tpcNSigmaPr(), t1.beta(), t1.tofNSigmaEl(), t1.tofNSigmaPi(), t1.tofNSigmaPr(), t2.pt(), t2.eta(), t2.phi(), t2.itsClusterMap(), t2.itsChi2NCl(), t2.tpcNClsCrossedRows(), t2.tpcNClsFound(), t2.tpcChi2NCl(), t2.dcaXY(), t2.dcaZ(), t2.tpcSignal(), t2.tpcNSigmaEl(), t2.tpcNSigmaPi(), t2.tpcNSigmaPr(), t2.beta(), t2.tofNSigmaEl(), t2.tofNSigmaPi(), t2.tofNSigmaPr(), @@ -1381,25 +1513,25 @@ struct AnalysisSameEventPairing { sign2 = t2.sign(); // store the ambiguity number of the two dilepton legs in the last 4 digits of the two-track filter if (t1.muonAmbiguityInBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 28); + twoTrackFilter |= (static_cast(1) << 28); } if (t2.muonAmbiguityInBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 29); + twoTrackFilter |= (static_cast(1) << 29); } if (t1.muonAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 30); + twoTrackFilter |= (static_cast(1) << 30); } if (t2.muonAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 31); + twoTrackFilter |= (static_cast(1) << 31); } VarManager::FillPair(t1, t2); // compute quantities which depend on the associated collision, such as DCA - if (fPropTrack) { + if (fConfigOptions.propTrack) { VarManager::FillPairCollision(event, t1, t2); } if constexpr (TTwoProngFitter) { - VarManager::FillPairVertexing(event, t1, t2, fConfigPropToPCA); + VarManager::FillPairVertexing(event, t1, t2, fConfigOptions.propToPCA); } if constexpr (eventHasQvector) { VarManager::FillPairVn(t1, t2); @@ -1414,7 +1546,7 @@ struct AnalysisSameEventPairing { if constexpr (TTwoProngFitter) { dimuonsExtraList(t1.globalIndex(), t2.globalIndex(), VarManager::fgValues[VarManager::kVertexingTauz], VarManager::fgValues[VarManager::kVertexingLz], VarManager::fgValues[VarManager::kVertexingLxy]); - if (fConfigFlatTables.value) { + if (fConfigOptions.flatTables.value) { dimuonAllList(event.posX(), event.posY(), event.posZ(), event.numContrib(), -999., -999., -999., VarManager::fgValues[VarManager::kMass], @@ -1434,7 +1566,7 @@ struct AnalysisSameEventPairing { -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., - (twoTrackFilter & (uint32_t(1) << 28)) || (twoTrackFilter & (uint32_t(1) << 30)), (twoTrackFilter & (uint32_t(1) << 29)) || (twoTrackFilter & (uint32_t(1) << 31)), + (twoTrackFilter & (static_cast(1) << 28)) || (twoTrackFilter & (static_cast(1) << 30)), (twoTrackFilter & (static_cast(1) << 29)) || (twoTrackFilter & (static_cast(1) << 31)), VarManager::fgValues[VarManager::kU2Q2], VarManager::fgValues[VarManager::kU3Q3], VarManager::fgValues[VarManager::kR2EP_AB], VarManager::fgValues[VarManager::kR2SP_AB], VarManager::fgValues[VarManager::kCentFT0C], VarManager::fgValues[VarManager::kCos2DeltaPhi], VarManager::fgValues[VarManager::kCos3DeltaPhi], @@ -1467,10 +1599,12 @@ struct AnalysisSameEventPairing { // Fill histograms bool isAmbiInBunch = false; bool isAmbiOutOfBunch = false; + bool isUnambiguous = false; for (int icut = 0; icut < ncuts; icut++) { - if (twoTrackFilter & (uint32_t(1) << icut)) { - isAmbiInBunch = (twoTrackFilter & (uint32_t(1) << 28)) || (twoTrackFilter & (uint32_t(1) << 29)); - isAmbiOutOfBunch = (twoTrackFilter & (uint32_t(1) << 30)) || (twoTrackFilter & (uint32_t(1) << 31)); + if (twoTrackFilter & (static_cast(1) << icut)) { + isAmbiInBunch = (twoTrackFilter & (static_cast(1) << 28)) || (twoTrackFilter & (static_cast(1) << 29)); + isAmbiOutOfBunch = (twoTrackFilter & (static_cast(1) << 30)) || (twoTrackFilter & (static_cast(1) << 31)); + isUnambiguous = !(isAmbiInBunch || isAmbiOutOfBunch); if (sign1 * sign2 < 0) { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); if (isAmbiInBunch) { @@ -1479,6 +1613,11 @@ struct AnalysisSameEventPairing { if (isAmbiOutOfBunch) { fHistMan->FillHistClass(histNames[icut][3 + histIdxOffset + 3].Data(), VarManager::fgValues); } + if constexpr (TPairType == VarManager::kDecayToMuMu) { + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][3 + histIdxOffset + 6].Data(), VarManager::fgValues); + } + } } else { if (sign1 > 0) { fHistMan->FillHistClass(histNames[icut][1].Data(), VarManager::fgValues); @@ -1488,6 +1627,11 @@ struct AnalysisSameEventPairing { if (isAmbiOutOfBunch) { fHistMan->FillHistClass(histNames[icut][4 + histIdxOffset + 3].Data(), VarManager::fgValues); } + if constexpr (TPairType == VarManager::kDecayToMuMu) { + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][4 + histIdxOffset + 6].Data(), VarManager::fgValues); + } + } } else { fHistMan->FillHistClass(histNames[icut][2].Data(), VarManager::fgValues); if (isAmbiInBunch) { @@ -1496,6 +1640,11 @@ struct AnalysisSameEventPairing { if (isAmbiOutOfBunch) { fHistMan->FillHistClass(histNames[icut][5 + histIdxOffset + 3].Data(), VarManager::fgValues); } + if constexpr (TPairType == VarManager::kDecayToMuMu) { + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][5 + histIdxOffset + 6].Data(), VarManager::fgValues); + } + } } } for (unsigned int iPairCut = 0; iPairCut < fPairCuts.size(); iPairCut++) { @@ -1514,8 +1663,8 @@ struct AnalysisSameEventPairing { } // end loop (pair cuts) } } // end loop (cuts) - } // end loop over pairs of track associations - } // end loop over events + } // end loop over pairs of track associations + } // end loop over events } template @@ -1524,7 +1673,7 @@ struct AnalysisSameEventPairing { std::map> histNames = fTrackHistNames; int pairSign = 0; int ncuts = 0; - uint32_t twoTrackFilter = 0; + uint32_t twoTrackFilter = static_cast(0); for (auto& a1 : assocs1) { for (auto& a2 : assocs2) { if constexpr (TPairType == VarManager::kDecayToEE) { @@ -1534,9 +1683,9 @@ struct AnalysisSameEventPairing { } auto t1 = a1.template reducedtrack_as(); auto t2 = a2.template reducedtrack_as(); - VarManager::FillPairME(t1, t2); + VarManager::FillPairME(t1, t2); if constexpr ((TEventFillMap & VarManager::ObjTypes::ReducedEventQvector) > 0) { - VarManager::FillPairVn(t1, t2); + VarManager::FillPairVn(t1, t2); } pairSign = t1.sign() + t2.sign(); ncuts = fNCutsBarrel; @@ -1552,11 +1701,24 @@ struct AnalysisSameEventPairing { continue; if (t1.matchMFTTrackId() == t2.matchMFTTrackId()) continue; - VarManager::FillPairME(t1, t2); + VarManager::FillPairME(t1, t2); if constexpr ((TEventFillMap & VarManager::ObjTypes::ReducedEventQvector) > 0) { - VarManager::FillPairVn(t1, t2); + VarManager::FillPairVn(t1, t2); } pairSign = t1.sign() + t2.sign(); + // store the ambiguity number of the two dilepton legs in the last 4 digits of the two-track filter + if (t1.muonAmbiguityInBunch() > 1) { + twoTrackFilter |= (static_cast(1) << 28); + } + if (t2.muonAmbiguityInBunch() > 1) { + twoTrackFilter |= (static_cast(1) << 29); + } + if (t1.muonAmbiguityOutOfBunch() > 1) { + twoTrackFilter |= (static_cast(1) << 30); + } + if (t2.muonAmbiguityOutOfBunch() > 1) { + twoTrackFilter |= (static_cast(1) << 31); + } ncuts = fNCutsMuon; histNames = fMuonHistNames; } @@ -1564,22 +1726,55 @@ struct AnalysisSameEventPairing { twoTrackFilter = a1.isBarrelSelected_raw() & a1.isBarrelSelectedPrefilter_raw() & a2.isMuonSelected_raw() & fTrackFilterMask; }*/ + bool isAmbiInBunch = false; + bool isAmbiOutOfBunch = false; + bool isUnambiguous = false; for (int icut = 0; icut < ncuts; icut++) { - if (!(twoTrackFilter & (uint32_t(1) << icut))) { + if (!(twoTrackFilter & (static_cast(1) << icut))) { continue; // cut not passed } + isAmbiInBunch = (twoTrackFilter & (static_cast(1) << 28)) || (twoTrackFilter & (static_cast(1) << 29)); + isAmbiOutOfBunch = (twoTrackFilter & (static_cast(1) << 30)) || (twoTrackFilter & (static_cast(1) << 31)); + isUnambiguous = !((twoTrackFilter & (static_cast(1) << 28)) || (twoTrackFilter & (static_cast(1) << 29)) || (twoTrackFilter & (static_cast(1) << 30)) || (twoTrackFilter & (static_cast(1) << 31))); if (pairSign == 0) { fHistMan->FillHistClass(histNames[icut][3].Data(), VarManager::fgValues); + if (isAmbiInBunch) { + fHistMan->FillHistClass(histNames[icut][15].Data(), VarManager::fgValues); + } + if (isAmbiOutOfBunch) { + fHistMan->FillHistClass(histNames[icut][18].Data(), VarManager::fgValues); + } + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][21].Data(), VarManager::fgValues); + } } else { if (pairSign > 0) { fHistMan->FillHistClass(histNames[icut][4].Data(), VarManager::fgValues); + if (isAmbiInBunch) { + fHistMan->FillHistClass(histNames[icut][16].Data(), VarManager::fgValues); + } + if (isAmbiOutOfBunch) { + fHistMan->FillHistClass(histNames[icut][19].Data(), VarManager::fgValues); + } + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][22].Data(), VarManager::fgValues); + } } else { fHistMan->FillHistClass(histNames[icut][5].Data(), VarManager::fgValues); + if (isAmbiInBunch) { + fHistMan->FillHistClass(histNames[icut][17].Data(), VarManager::fgValues); + } + if (isAmbiOutOfBunch) { + fHistMan->FillHistClass(histNames[icut][20].Data(), VarManager::fgValues); + } + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][23].Data(), VarManager::fgValues); + } } } } // end for (cuts) - } // end for (track2) - } // end for (track1) + } // end for (track2) + } // end for (track1) } // barrel-barrel and muon-muon event mixing @@ -1640,7 +1835,7 @@ struct AnalysisSameEventPairing { void processMixingAllSkimmed(soa::Filtered& events, soa::Join const& trackAssocs, MyBarrelTracksWithCov const& tracks, - soa::Join const& muonAssocs, MyMuonTracksWithCov const& muons) + soa::Join const& muonAssocs, MyMuonTracksWithCovWithAmbiguities const& muons) { runSameSideMixing(events, trackAssocs, tracks, trackAssocsPerCollision); runSameSideMixing(events, muonAssocs, muons, muonAssocsPerCollision); @@ -1727,9 +1922,9 @@ struct AnalysisAsymmetricPairing { Preslice> trackAssocsPerCollision = aod::reducedtrack_association::reducedeventId; // Partitions for triplets and asymmetric pairs - Partition> legACandidateAssocs = (o2::aod::dqanalysisflags::isBarrelSelected & fConfigLegAFilterMask) > uint32_t(0); - Partition> legBCandidateAssocs = (o2::aod::dqanalysisflags::isBarrelSelected & fConfigLegBFilterMask) > uint32_t(0); - Partition> legCCandidateAssocs = (o2::aod::dqanalysisflags::isBarrelSelected & fConfigLegCFilterMask) > uint32_t(0); + Partition> legACandidateAssocs = (o2::aod::dqanalysisflags::isBarrelSelected & fConfigLegAFilterMask) > static_cast(0); + Partition> legBCandidateAssocs = (o2::aod::dqanalysisflags::isBarrelSelected & fConfigLegBFilterMask) > static_cast(0); + Partition> legCCandidateAssocs = (o2::aod::dqanalysisflags::isBarrelSelected & fConfigLegCFilterMask) > static_cast(0); void init(o2::framework::InitContext& context) { @@ -1766,8 +1961,8 @@ struct AnalysisAsymmetricPairing { for (int icut = 0; icut < fNCommonTrackCuts; ++icut) { commonCutIdx = objArray->IndexOf(objArrayCommon->At(icut)); if (commonCutIdx >= 0) { - fCommonTrackCutMask |= uint32_t(1) << objArray->IndexOf(objArrayCommon->At(icut)); - fCommonTrackCutFilterMasks[icut] = uint32_t(1) << objArray->IndexOf(objArrayCommon->At(icut)); + fCommonTrackCutMask |= static_cast(1) << objArray->IndexOf(objArrayCommon->At(icut)); + fCommonTrackCutFilterMasks[icut] = static_cast(1) << objArray->IndexOf(objArrayCommon->At(icut)); } else { LOGF(fatal, "Common track cut %s was not calculated upstream. Check the config!", objArrayCommon->At(icut)->GetName()); } @@ -1813,16 +2008,16 @@ struct AnalysisAsymmetricPairing { // Find leg cuts in the track selection cuts legAIdx = objArray->IndexOf(legs->At(0)); if (legAIdx >= 0) { - fConstructedLegAFilterMask |= (uint32_t(1) << legAIdx); - fTrackCutFilterMasks[icut] |= uint32_t(1) << legAIdx; + fConstructedLegAFilterMask |= (static_cast(1) << legAIdx); + fTrackCutFilterMasks[icut] |= static_cast(1) << legAIdx; } else { LOGF(fatal, "Leg A cut %s was not calculated upstream. Check the config!", legs->At(0)->GetName()); continue; } legBIdx = objArray->IndexOf(legs->At(1)); if (legBIdx >= 0) { - fConstructedLegBFilterMask |= (uint32_t(1) << legBIdx); - fTrackCutFilterMasks[icut] |= uint32_t(1) << legBIdx; + fConstructedLegBFilterMask |= (static_cast(1) << legBIdx); + fTrackCutFilterMasks[icut] |= static_cast(1) << legBIdx; } else { LOGF(fatal, "Leg B cut %s was not calculated upstream. Check the config!", legs->At(1)->GetName()); continue; @@ -1830,8 +2025,8 @@ struct AnalysisAsymmetricPairing { if (isThreeProng[icut]) { legCIdx = objArray->IndexOf(legs->At(2)); if (legCIdx >= 0) { - fConstructedLegCFilterMask |= (uint32_t(1) << legCIdx); - fTrackCutFilterMasks[icut] |= uint32_t(1) << legCIdx; + fConstructedLegCFilterMask |= (static_cast(1) << legCIdx); + fTrackCutFilterMasks[icut] |= static_cast(1) << legCIdx; } else { LOGF(fatal, "Leg C cut %s was not calculated upstream. Check the config!", legs->At(2)->GetName()); continue; @@ -1871,7 +2066,7 @@ struct AnalysisAsymmetricPairing { fTrackHistNames[(fNLegCuts * (fNCommonTrackCuts + 1) + fNLegCuts * fNPairCuts) + icut * (fNPairCuts * fNCommonTrackCuts + 1) + iCommonCut * (1 + fNPairCuts) + iPairCut] = names; } // end loop (common cuts) } // end loop (pair cuts) - } // end if (pair cuts) + } // end if (pair cuts) } else { names = {}; std::vector pairHistPrefixes = {"PairsBarrelSEPM"}; @@ -1922,7 +2117,7 @@ struct AnalysisAsymmetricPairing { fTrackHistNames[(fNLegCuts * (fNCommonTrackCuts + 1) + fNLegCuts * fNPairCuts) + icut * (fNPairCuts * fNCommonTrackCuts + 1) + iCommonCut * (1 + fNPairCuts) + iPairCut] = names; } // end loop (common cuts) } // end loop (pair cuts) - } // end if (pair cuts) + } // end if (pair cuts) } } // Make sure the leg cuts are covered by the configured filter masks @@ -2041,14 +2236,14 @@ struct AnalysisAsymmetricPairing { std::set> globIdxPairs; for (auto& [a1, a2] : combinations(soa::CombinationsFullIndexPolicy(groupedLegAAssocs, groupedLegBAssocs))) { - uint32_t twoTrackFilter = 0; - uint32_t twoTrackCommonFilter = 0; - uint32_t pairFilter = 0; + uint32_t twoTrackFilter = static_cast(0); + uint32_t twoTrackCommonFilter = static_cast(0); + uint32_t pairFilter = static_cast(0); bool isPairIdWrong = false; for (int icut = 0; icut < fNLegCuts; ++icut) { // Find leg pair definitions both candidates participate in if ((((a1.isBarrelSelected_raw() & fLegAFilterMask) | (a2.isBarrelSelected_raw() & fLegBFilterMask)) & fTrackCutFilterMasks[icut]) == fTrackCutFilterMasks[icut]) { - twoTrackFilter |= (uint32_t(1) << icut); + twoTrackFilter |= (static_cast(1) << icut); // If the supposed pion passes a kaon cut, this is a K+K-. Skip it. if (TPairType == VarManager::kDecayToKPi && fConfigSkipAmbiguousIdCombinations.value) { if (a2.isBarrelSelected_raw() & fLegAFilterMask) { @@ -2077,10 +2272,10 @@ struct AnalysisAsymmetricPairing { sign2 = t2.sign(); // store the ambiguity number of the two dilepton legs in the last 4 digits of the two-track filter if (t1.barrelAmbiguityInBunch() > 1 || t1.barrelAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 30); + twoTrackFilter |= (static_cast(1) << 30); } if (t2.barrelAmbiguityInBunch() > 1 || t2.barrelAmbiguityOutOfBunch() > 1) { - twoTrackFilter |= (uint32_t(1) << 31); + twoTrackFilter |= (static_cast(1) << 31); } VarManager::FillPair(t1, t2); @@ -2091,8 +2286,8 @@ struct AnalysisAsymmetricPairing { // Fill histograms bool isAmbi = false; for (int icut = 0; icut < fNLegCuts; icut++) { - if (twoTrackFilter & (uint32_t(1) << icut)) { - isAmbi = (twoTrackFilter & (uint32_t(1) << 30)) || (twoTrackFilter & (uint32_t(1) << 31)); + if (twoTrackFilter & (static_cast(1) << icut)) { + isAmbi = (twoTrackFilter & (static_cast(1) << 30)) || (twoTrackFilter & (static_cast(1) << 31)); if (sign1 * sign2 < 0) { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); if (isAmbi && fConfigAmbiguousHistograms.value) { @@ -2128,7 +2323,7 @@ struct AnalysisAsymmetricPairing { AnalysisCompositeCut cut = fPairCuts.at(iPairCut); if (!(cut.IsSelected(VarManager::fgValues))) // apply pair cuts continue; - pairFilter |= (uint32_t(1) << iPairCut); + pairFilter |= (static_cast(1) << iPairCut); // Histograms with pair cuts if (sign1 * sign2 < 0) { fHistMan->FillHistClass(histNames[fNLegCuts * (fNCommonTrackCuts + 1) + icut * fNPairCuts + iPairCut][0].Data(), VarManager::fgValues); @@ -2162,8 +2357,8 @@ struct AnalysisAsymmetricPairing { if constexpr (trackHasCov && TTwoProngFitter) { ditrackExtraList(t1.globalIndex(), t2.globalIndex(), VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]); } - } // end inner assoc loop (leg A) - } // end event loop + } // end inner assoc loop (leg A) + } // end event loop } // Template function to run same event triplets (e.g. D+->K-pi+pi+) @@ -2222,12 +2417,12 @@ struct AnalysisAsymmetricPairing { template void readTriplet(TTrackAssoc const& a1, TTrackAssoc const& a2, TTrackAssoc const& a3, TTracks const& /*tracks*/, TEvent const& event, VarManager::PairCandidateType tripletType, std::map> histNames) { - uint32_t threeTrackFilter = 0; - uint32_t threeTrackCommonFilter = 0; + uint32_t threeTrackFilter = static_cast(0); + uint32_t threeTrackCommonFilter = static_cast(0); for (int icut = 0; icut < fNLegCuts; ++icut) { // Find out which leg cut combination the triplet passes if ((((a1.isBarrelSelected_raw() & fLegAFilterMask) | (a2.isBarrelSelected_raw() & fLegBFilterMask) | (a3.isBarrelSelected_raw() & fLegCFilterMask)) & fTrackCutFilterMasks[icut]) == fTrackCutFilterMasks[icut]) { - threeTrackFilter |= (uint32_t(1) << icut); + threeTrackFilter |= (static_cast(1) << icut); if (tripletType == VarManager::kTripleCandidateToPKPi && fConfigSkipAmbiguousIdCombinations.value) { // Check if the supposed pion passes as a proton or kaon, if so, skip this triplet. It is pKp or pKK. if ((a3.isBarrelSelected_raw() & fLegAFilterMask) || (a3.isBarrelSelected_raw() & fLegBFilterMask)) { @@ -2264,13 +2459,13 @@ struct AnalysisAsymmetricPairing { // store the ambiguity of the three legs in the last 3 digits of the two-track filter if (t1.barrelAmbiguityInBunch() > 1 || t1.barrelAmbiguityOutOfBunch() > 1) { - threeTrackFilter |= (uint32_t(1) << 29); + threeTrackFilter |= (static_cast(1) << 29); } if (t2.barrelAmbiguityInBunch() > 1 || t2.barrelAmbiguityOutOfBunch() > 1) { - threeTrackFilter |= (uint32_t(1) << 30); + threeTrackFilter |= (static_cast(1) << 30); } if (t3.barrelAmbiguityInBunch() > 1 || t3.barrelAmbiguityOutOfBunch() > 1) { - threeTrackFilter |= (uint32_t(1) << 31); + threeTrackFilter |= (static_cast(1) << 31); } VarManager::FillTriple(t1, t2, t3, VarManager::fgValues, tripletType); @@ -2280,9 +2475,9 @@ struct AnalysisAsymmetricPairing { // Fill histograms for (int icut = 0; icut < fNLegCuts; icut++) { - if (threeTrackFilter & (uint32_t(1) << icut)) { + if (threeTrackFilter & (static_cast(1) << icut)) { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); - if (fConfigAmbiguousHistograms.value && ((threeTrackFilter & (uint32_t(1) << 29)) || (threeTrackFilter & (uint32_t(1) << 30)) || (threeTrackFilter & (uint32_t(1) << 31)))) { + if (fConfigAmbiguousHistograms.value && ((threeTrackFilter & (static_cast(1) << 29)) || (threeTrackFilter & (static_cast(1) << 30)) || (threeTrackFilter & (static_cast(1) << 31)))) { fHistMan->FillHistClass(histNames[icut][1].Data(), VarManager::fgValues); } for (int iCommonCut = 0; iCommonCut < fNCommonTrackCuts; iCommonCut++) { @@ -2382,10 +2577,10 @@ struct AnalysisDileptonTrack { Service fCCDB; // TODO: The filter expressions seem to always use the default value of configurables, not the values from the actual configuration file - Filter eventFilter = aod::dqanalysisflags::isEventSelected == uint32_t(1); + Filter eventFilter = aod::dqanalysisflags::isEventSelected > static_cast(1); Filter dileptonFilter = aod::reducedpair::pt > fConfigDileptonpTCut&& aod::reducedpair::mass > fConfigDileptonLowMass&& aod::reducedpair::mass fConfigDileptonLxyCut; - Filter filterBarrel = aod::dqanalysisflags::isBarrelSelected > uint32_t(0); - Filter filterMuon = aod::dqanalysisflags::isMuonSelected > uint32_t(0); + Filter filterBarrel = aod::dqanalysisflags::isBarrelSelected > static_cast(0); + Filter filterMuon = aod::dqanalysisflags::isMuonSelected > static_cast(0); constexpr static uint32_t fgDileptonFillMap = VarManager::ObjTypes::ReducedTrack | VarManager::ObjTypes::Pair; // fill map @@ -2407,7 +2602,6 @@ struct AnalysisDileptonTrack { bool isBarrelAsymmetric = context.mOptions.get("processDstarToD0Pi"); bool isMuon = context.mOptions.get("processMuonSkimmed"); bool isMuonME = context.mOptions.get("processMuonMixedEvent"); - bool isAnyProcessEnabled = isBarrel || isBarrelME || isMuon || isMuonME; fCurrentRun = 0; fValuesDilepton = new float[VarManager::kNVars]; @@ -2772,8 +2966,8 @@ struct AnalysisDileptonTrack { } } } // end for (dileptons) - } // end for (assocs) - } // end event loop + } // end for (assocs) + } // end event loop } void processMuonMixedEvent(soa::Filtered& events, @@ -2811,8 +3005,8 @@ struct AnalysisDileptonTrack { } } } // end for (dileptons) - } // end for (assocs) - } // end event loop + } // end for (assocs) + } // end event loop } void processDummy(MyEvents&) @@ -2858,7 +3052,7 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses, const char dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "event", histName); } - if (classStr.Contains("SameBunchCorrelations")) { + if (classStr.Contains("SameBunchCorrelations") || classStr.Contains("OutOfBunchCorrelations")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "two-collisions", histName); } @@ -2875,7 +3069,7 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses, const char dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "postcalib_proton"); } if (classStr.Contains("Ambiguity")) { - dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", Form("%s,ambiguity", histName.Data())); + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "ambiguity"); } } if (classStr.Contains("Muon")) { diff --git a/PWGDQ/Tasks/taskFwdTrackPid.cxx b/PWGDQ/Tasks/taskFwdTrackPid.cxx index 04d9756fc0a..7a135596d56 100644 --- a/PWGDQ/Tasks/taskFwdTrackPid.cxx +++ b/PWGDQ/Tasks/taskFwdTrackPid.cxx @@ -31,6 +31,8 @@ #include "PWGDQ/Core/VarManager.h" #include "PWGDQ/Core/HistogramManager.h" #include "PWGDQ/Core/MixingHandler.h" +#include "PWGDQ/Core/MCSignal.h" +#include "PWGDQ/Core/MCSignalLibrary.h" #include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" #include "PWGDQ/Core/HistogramsLibrary.h" @@ -50,46 +52,180 @@ using namespace o2::framework::expressions; using namespace o2::aod; using MyEvents = soa::Join; +using MyEventsMC = soa::Join; using MyMuonTracks = soa::Join; +using MyMuonTracksMC = soa::Join; using MyMftTracks = soa::Join; +using MyMftTracksMC = soa::Join; // bit maps used for the Fill functions of the VarManager constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended; +constexpr static uint32_t gkMCEventFillMap = VarManager::ObjTypes::ReducedEventMC; constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::ReducedMuonExtra; +void DefineHistograms(HistogramManager* histMan, TString histClasses); + struct taskFwdTrackPid { Produces fwdPidAllList; + HistogramManager* fHistMan; + OutputObj fOutputList{"output"}; + Configurable fConfigMaxDCA{"cfgMaxDCA", 0.5f, "Manually set maximum DCA of the track"}; + Configurable downSampleFactor{"downSampleFactor", 1., "Fraction of candidates to keep for ML"}; + Configurable fConfigMCGenSignals{"cfgMCGenSignals", "", "Comma separated list of MC signals (generated)"}; + Configurable fConfigMCRecSignals{"cfgMCRecSignals", "", "Comma separated list of MC signals (reconstructed)"}; + + std::vector fGenMCSignalsNames; + std::vector fRecMCSignalsNames; + std::vector fGenMCSignals; + std::vector fRecMCSignals; void init(o2::framework::InitContext& context) { if (context.mOptions.get("processDummy")) { return; } + + fHistMan = new HistogramManager("analysisHistos", "aa", VarManager::kNVars); + fHistMan->SetUseDefaultVariableNames(kTRUE); + fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); + + TString histNames = ""; + + TString sigGenNamesStr = fConfigMCGenSignals.value; + std::unique_ptr objGenSigArray(sigGenNamesStr.Tokenize(",")); + for (int isig = 0; isig < objGenSigArray->GetEntries(); isig++) { + MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objGenSigArray->At(isig)->GetName()); + if (sig) { + if (sig->GetNProngs() == 1) { // NOTE: 1-prong signals required + fGenMCSignals.push_back(*sig); + histNames += Form("MCTruthGen_%s;", sig->GetName()); // TODO: Add these names to a std::vector to avoid using Form in the process function + } + } + } + + DefineHistograms(fHistMan, histNames.Data()); // define all histograms + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + fOutputList.setObject(fHistMan->GetMainHistogramList()); + + TString sigNamesStr = fConfigMCRecSignals.value; + std::unique_ptr objRecSigArray(sigNamesStr.Tokenize(",")); + if (!sigNamesStr.IsNull()) { + for (int isig = 0; isig < objRecSigArray->GetEntries(); ++isig) { + MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objRecSigArray->At(isig)->GetName()); + if (sig) { + if (sig->GetNProngs() == 1) { + fRecMCSignals.push_back(*sig); + fRecMCSignalsNames.push_back(sig->GetName()); + } + } + } + } + // Setting the MC rec signal names + for (int isig = 0; isig < objRecSigArray->GetEntries(); ++isig) { + MCSignal* sig = o2::aod::dqmcsignals::GetMCSignal(objRecSigArray->At(isig)->GetName()); + if (sig) { + if (sig->GetNProngs() != 1) { // NOTE: 2-prong signals required + continue; + } + fRecMCSignals.push_back(*sig); + } + } } // Template function to pair mft tracks and muon tracks template void runFwdTrackPid(TEvent const& event, Muons const& muons, MftTracks const& mftTracks) { + uint32_t mcDecision = 0; + fwdPidAllList.reserve(1); for (const auto& muon : muons) { if (muon.has_matchMFTTrack() && muon.trackType() == 0 && TMath::Abs(muon.fwdDcaX()) < fConfigMaxDCA && TMath::Abs(muon.fwdDcaY()) < fConfigMaxDCA) { auto mftTrack = muon.template matchMFTTrack_as(); - fwdPidAllList(muon.trackType(), event.posX(), event.posY(), event.posZ(), event.numContrib(), muon.pt(), muon.eta(), muon.phi(), muon.sign(), mftTrack.mftClusterSizesAndTrackFlags(), muon.fwdDcaX(), muon.fwdDcaY(), muon.chi2MatchMCHMID(), muon.chi2MatchMCHMFT()); + fwdPidAllList(muon.trackType(), event.posX(), event.posY(), event.posZ(), event.numContrib(), muon.pt(), muon.eta(), muon.phi(), muon.sign(), mftTrack.mftClusterSizesAndTrackFlags(), muon.fwdDcaX(), muon.fwdDcaY(), muon.chi2MatchMCHMID(), muon.chi2MatchMCHMFT(), mcDecision); + } + } + if constexpr (TMatchedOnly == false) { + for (const auto& mftTrack : mftTracks) { + if (TMath::Abs(mftTrack.fwdDcaX()) < fConfigMaxDCA && TMath::Abs(mftTrack.fwdDcaY()) < fConfigMaxDCA) { + if (downSampleFactor < 1.) { + float pseudoRndm = mftTrack.pt() * 1000. - (int64_t)(mftTrack.pt() * 1000); + if (pseudoRndm >= downSampleFactor) { + continue; + } + } + fwdPidAllList(4, event.posX(), event.posY(), event.posZ(), event.numContrib(), mftTrack.pt(), mftTrack.eta(), mftTrack.phi(), mftTrack.sign(), mftTrack.mftClusterSizesAndTrackFlags(), mftTrack.fwdDcaX(), mftTrack.fwdDcaY(), -999, -999, mcDecision); + } + } + } + } + + // Template function to run over reconstructed tracks + template + void runFwdTrackPidMC(TEvent const& event, Muons const& muons, MftTracks const& mftTracks, TEventsMC const& /*eventsMC*/, TTracksMC const& /*tracksMC*/) + { + fwdPidAllList.reserve(1); + for (const auto& muon : muons) { + uint32_t mcDecision = 0; + int isig = 0; + for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { + if ((*sig).CheckSignal(false, muon.reducedMCTrack())) { + mcDecision |= (uint32_t(1) << isig); + } + } + + if (muon.has_matchMFTTrack() && muon.trackType() == 0 && TMath::Abs(muon.fwdDcaX()) < fConfigMaxDCA && TMath::Abs(muon.fwdDcaY()) < fConfigMaxDCA) { + auto mftTrack = muon.template matchMFTTrack_as(); + fwdPidAllList(muon.trackType(), event.posX(), event.posY(), event.posZ(), event.numContrib(), muon.pt(), muon.eta(), muon.phi(), muon.sign(), mftTrack.mftClusterSizesAndTrackFlags(), muon.fwdDcaX(), muon.fwdDcaY(), muon.chi2MatchMCHMID(), muon.chi2MatchMCHMFT(), mcDecision); } } + if constexpr (TMatchedOnly == false) { for (const auto& mftTrack : mftTracks) { + uint32_t mcDecision = 0; + int isig = 0; + for (auto sig = fRecMCSignals.begin(); sig != fRecMCSignals.end(); sig++, isig++) { + if ((*sig).CheckSignal(false, mftTrack.reducedMCTrack())) { + mcDecision |= (uint32_t(1) << isig); + } + } if (TMath::Abs(mftTrack.fwdDcaX()) < fConfigMaxDCA && TMath::Abs(mftTrack.fwdDcaY()) < fConfigMaxDCA) { - fwdPidAllList(4, event.posX(), event.posY(), event.posZ(), event.numContrib(), mftTrack.pt(), mftTrack.eta(), mftTrack.phi(), mftTrack.sign(), mftTrack.mftClusterSizesAndTrackFlags(), mftTrack.fwdDcaX(), mftTrack.fwdDcaY(), -999, -999); + fwdPidAllList(4, event.posX(), event.posY(), event.posZ(), event.numContrib(), mftTrack.pt(), mftTrack.eta(), mftTrack.phi(), mftTrack.sign(), mftTrack.mftClusterSizesAndTrackFlags(), mftTrack.fwdDcaX(), mftTrack.fwdDcaY(), -999, -999, mcDecision); + } + } + } + } + + // Template function to run over MC tracks + template + void runMCGen(TTracksMC& groupedMCTracks) + { + for (auto& mctrack : groupedMCTracks) { + VarManager::FillTrackMC(groupedMCTracks, mctrack); + + for (auto& sig : fGenMCSignals) { + if (sig.GetNProngs() != 1) { // NOTE: 1-prong signals required + continue; + } + bool checked = false; + if constexpr (soa::is_soa_filtered_v) { + auto mctrack_raw = groupedMCTracks.rawIteratorAt(mctrack.globalIndex()); + checked = sig.CheckSignal(false, mctrack_raw); + } else { + checked = sig.CheckSignal(false, mctrack); + } + if (checked) { + fHistMan->FillHistClass(Form("MCTruthGen_%s", sig.GetName()), VarManager::fgValues); } } } } + PresliceUnsorted perReducedMcEvent = aod::reducedtrackMC::reducedMCeventId; + void processFwdPidMatched(MyEvents::iterator const& event, MyMuonTracks const& muons, MyMftTracks const& mftTracks) { if (muons.size() > 0 && mftTracks.size() > 0) { @@ -104,6 +240,25 @@ struct taskFwdTrackPid { } } + void processFwdPidMatchedMC(MyEventsMC::iterator const& event, MyMuonTracksMC const& muons, MyMftTracksMC const& mftTracks, ReducedMCEvents const& eventsMC, ReducedMCTracks const& tracksMC) + { + if (muons.size() > 0 && mftTracks.size() > 0) { + runFwdTrackPidMC(event, muons, mftTracks, eventsMC, tracksMC); + } + auto groupedMCTracks = tracksMC.sliceBy(perReducedMcEvent, event.reducedMCevent().globalIndex()); + groupedMCTracks.bindInternalIndicesTo(&tracksMC); + runMCGen(groupedMCTracks); + } + void processFwdPidMatchedOnlyMC(MyEventsMC::iterator const& event, MyMuonTracksMC const& muons, MyMftTracksMC const& mftTracks, ReducedMCEvents const& eventsMC, ReducedMCTracks const& tracksMC) + { + if (muons.size() > 0) { + runFwdTrackPidMC(event, muons, mftTracks, eventsMC, tracksMC); + } + auto groupedMCTracks = tracksMC.sliceBy(perReducedMcEvent, event.reducedMCevent().globalIndex()); + groupedMCTracks.bindInternalIndicesTo(&tracksMC); + runMCGen(groupedMCTracks); + } + void processDummy(MyEvents&) { // do nothing @@ -111,6 +266,8 @@ struct taskFwdTrackPid { PROCESS_SWITCH(taskFwdTrackPid, processFwdPidMatched, "Run MFT - muon track pairing filling tree with MFT and global tracks", false); PROCESS_SWITCH(taskFwdTrackPid, processFwdPidMatchedOnly, "Run MFT - muon track pairing filling tree with global tracks only", false); + PROCESS_SWITCH(taskFwdTrackPid, processFwdPidMatchedMC, "Run MFT - muon track pairing filling tree with MFT and global tracks and MC info", false); + PROCESS_SWITCH(taskFwdTrackPid, processFwdPidMatchedOnlyMC, "Run MFT - muon track pairing filling tree with global tracks only and MC info", false); PROCESS_SWITCH(taskFwdTrackPid, processDummy, "Dummy function", false); }; // End of struct taskFwdTrackPid @@ -119,3 +276,21 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ adaptAnalysisTask(cfgc)}; } + +void DefineHistograms(HistogramManager* histMan, TString histClasses) +{ + std::unique_ptr objArray(histClasses.Tokenize(";")); + for (Int_t iclass = 0; iclass < objArray->GetEntries(); ++iclass) { + TString classStr = objArray->At(iclass)->GetName(); + histMan->AddHistClass(classStr.Data()); + + if (classStr.Contains("MCTruthGen")) { + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "mctruth"); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Pt_Rapidity", "MC generator p_{T}, y distribution", false, 120, 0.0, 30.0, VarManager::kMCPt, 150, 2.5, 4.0, VarManager::kMCY); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Eta", "MC generator #eta distribution", false, 200, 2.5, 4.0, VarManager::kMCEta); + // histMan->AddHistogram(objArray->At(iclass)->GetName(), "Rapidity", "MC generator y distribution", false, 150, 2.5, 4.0, VarManager::kMCY); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Phi", "MC generator #varphi distribution", false, 50, 0.0, 2. * TMath::Pi(), VarManager::kMCPhi); + } + + } // end loop over histogram classes +} diff --git a/PWGDQ/Tasks/taskJpsiHf.cxx b/PWGDQ/Tasks/taskJpsiHf.cxx index b8ee0b7e34e..79d9348940a 100644 --- a/PWGDQ/Tasks/taskJpsiHf.cxx +++ b/PWGDQ/Tasks/taskJpsiHf.cxx @@ -48,7 +48,7 @@ static const std::vector labelsCutsBdt = {"BDT background", "BDT pr // Declarations of various short names using MyRedEvents = aod::RedJpDmColls; using MyRedPairCandidatesSelected = aod::RedJpDmDileptons; -using MyRedD0CandidatesSelected = soa::Join; +using MyRedD0CandidatesSelected = soa::Join; struct taskJPsiHf { // @@ -60,7 +60,7 @@ struct taskJPsiHf { // HF configurables Configurable massHfCandMin{"massHfCandMin", 1.5f, "minimum HF mass"}; - Configurable massHfCandMax{"massHfCandMax", 2.1f, "maximum HF mass"}; + Configurable massHfCandMax{"massHfCandMax", 2.3f, "maximum HF mass"}; Configurable> binsPtDmesForBdt{"binsPtDmesForBdt", std::vector{bdtcuts::binsPt, bdtcuts::binsPt + bdtcuts::nBinsPt + 1}, "pT bin limits for BDT cuts"}; Configurable> cutsDmesBdt{"cutsDmesBdt", {bdtcuts::bdtCuts[0], bdtcuts::nBinsPt, 3, bdtcuts::labelsPt, bdtcuts::labelsCutsBdt}, "D-meson BDT selections per pT bin"}; @@ -112,6 +112,11 @@ struct taskJPsiHf { continue; } + auto minItsClsDmesDau = (dmeson.numItsClsDmesProng0() < dmeson.numItsClsDmesProng1()) ? dmeson.numItsClsDmesProng0() : dmeson.numItsClsDmesProng1(); + auto minTpcCrossRowsDmesDau = (dmeson.numTpcCrossedRowsDmesProng0() < dmeson.numTpcCrossedRowsDmesProng1()) ? dmeson.numTpcCrossedRowsDmesProng0() : dmeson.numTpcCrossedRowsDmesProng1(); + auto minPtDmesDau = (dmeson.ptDmesProng0() < dmeson.ptDmesProng1()) ? dmeson.ptDmesProng0() : dmeson.ptDmesProng1(); + auto minAbsEtaDmesDau = (std::abs(dmeson.etaDmesProng0()) < std::abs(dmeson.etaDmesProng1())) ? std::abs(dmeson.etaDmesProng0()) : std::abs(dmeson.etaDmesProng1()); + if (dmeson.massD0() > 0) { rapDmeson = RecoDecay::y(std::array{dmeson.px(), dmeson.py(), dmeson.pz()}, constants::physics::MassD0); deltaRap = rapDilepton - rapDmeson; @@ -119,7 +124,7 @@ struct taskJPsiHf { auto bdtPrompt = dmeson.bdtPromptMassHypo0(); auto bdtNonPrompt = dmeson.bdtNonpromptMassHypo0(); if ((dilepton.mass() > massDileptonCandMin && dilepton.mass() < massDileptonCandMax) && (dmeson.massD0() > massHfCandMin && dmeson.massD0() < massHfCandMax && bdtBkg < cutsDmesBdt->get(ptBinDmesForBdt, "BDT background") && bdtPrompt > cutsDmesBdt->get(ptBinDmesForBdt, "BDT prompt") && bdtNonPrompt > cutsDmesBdt->get(ptBinDmesForBdt, "BDT nonprompt"))) { - redDileptDimesAll(dilepton.mass(), dmeson.massD0(), ptDilepton, ptDmeson, rapDilepton, rapDmeson, phiDilepton, phiDmeson, deltaRap, deltaPhi, bdtBkg, bdtPrompt, bdtNonPrompt); + redDileptDimesAll(dilepton.mass(), dmeson.massD0(), ptDilepton, ptDmeson, rapDilepton, rapDmeson, phiDilepton, phiDmeson, deltaRap, deltaPhi, bdtBkg, bdtPrompt, bdtNonPrompt, minItsClsDmesDau, minTpcCrossRowsDmesDau, minPtDmesDau, minAbsEtaDmesDau); } } if (dmeson.massD0bar() > 0) { @@ -129,7 +134,7 @@ struct taskJPsiHf { auto bdtPrompt = dmeson.bdtPromptMassHypo1(); auto bdtNonPrompt = dmeson.bdtNonpromptMassHypo1(); if ((dilepton.mass() > massDileptonCandMin && dilepton.mass() < massDileptonCandMax) && (dmeson.massD0bar() > massHfCandMin && dmeson.massD0bar() < massHfCandMax && bdtBkg < cutsDmesBdt->get(ptBinDmesForBdt, "BDT background") && bdtPrompt > cutsDmesBdt->get(ptBinDmesForBdt, "BDT prompt") && bdtNonPrompt > cutsDmesBdt->get(ptBinDmesForBdt, "BDT nonprompt"))) { - redDileptDimesAll(dilepton.mass(), dmeson.massD0bar(), ptDilepton, ptDmeson, rapDilepton, rapDmeson, phiDilepton, phiDmeson, deltaRap, deltaPhi, bdtBkg, bdtPrompt, bdtNonPrompt); + redDileptDimesAll(dilepton.mass(), dmeson.massD0bar(), ptDilepton, ptDmeson, rapDilepton, rapDmeson, phiDilepton, phiDmeson, deltaRap, deltaPhi, bdtBkg, bdtPrompt, bdtNonPrompt, minItsClsDmesDau, minTpcCrossRowsDmesDau, minPtDmesDau, minAbsEtaDmesDau); } } } diff --git a/PWGDQ/Tasks/v0selector.cxx b/PWGDQ/Tasks/v0selector.cxx index cdb61eee77c..52068b44958 100644 --- a/PWGDQ/Tasks/v0selector.cxx +++ b/PWGDQ/Tasks/v0selector.cxx @@ -19,6 +19,8 @@ // #include #include +#include +#include #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -49,7 +51,10 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using FullTracksExt = soa::Join;*/ +using FullTracksExt = soa::Join; @@ -156,6 +161,10 @@ struct v0selector { Configurable mincrossedrows{"mincrossedrows", 70, "min crossed rows"}; Configurable maxchi2tpc{"maxchi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable fillhisto{"fillhisto", false, "flag to fill histograms"}; + // cutNsigmaElTPC, cutNsigmaPiTPC, cutNsigmaPrTPC + Configurable cutNsigmaElTPC{"cutNsigmaElTPC", 5.0, "cutNsigmaElTPC"}; + Configurable cutNsigmaPiTPC{"cutNsigmaPiTPC", 5.0, "cutNsigmaPiTPC"}; + Configurable cutNsigmaPrTPC{"cutNsigmaPrTPC", 5.0, "cutNsigmaPrTPC"}; HistogramRegistry registry{"registry"}; void init(o2::framework::InitContext&) @@ -301,7 +310,7 @@ struct v0selector { registry.fill(HIST("hMassGamma"), V0radius, mGamma); registry.fill(HIST("hV0Psi"), psipair, mGamma); } - if (mGamma < v0max_mee && TMath::Abs(V0.posTrack_as().tpcNSigmaEl()) < 5 && TMath::Abs(V0.negTrack_as().tpcNSigmaEl()) < 5 && psipair < maxpsipair) { + if (mGamma < v0max_mee && TMath::Abs(V0.posTrack_as().tpcNSigmaEl()) < cutNsigmaElTPC && TMath::Abs(V0.negTrack_as().tpcNSigmaEl()) < cutNsigmaElTPC && TMath::Abs(psipair) < maxpsipair) { pidmap[V0.posTrackId()] |= (uint8_t(1) << kGamma); pidmap[V0.negTrackId()] |= (uint8_t(1) << kGamma); if (fillhisto) { @@ -315,7 +324,7 @@ struct v0selector { registry.fill(HIST("hMassK0SEta"), V0.eta(), mK0S); registry.fill(HIST("hMassK0SPhi"), V0.phi(), mK0S); } - if ((0.48 < mK0S && mK0S < 0.51) && TMath::Abs(V0.posTrack_as().tpcNSigmaPi()) < 5 && TMath::Abs(V0.negTrack_as().tpcNSigmaPi()) < 5) { + if ((0.48 < mK0S && mK0S < 0.51) && TMath::Abs(V0.posTrack_as().tpcNSigmaPi()) < cutNsigmaPiTPC && TMath::Abs(V0.negTrack_as().tpcNSigmaPi()) < cutNsigmaPiTPC) { pidmap[V0.posTrackId()] |= (uint8_t(1) << kK0S); pidmap[V0.negTrackId()] |= (uint8_t(1) << kK0S); } @@ -323,7 +332,7 @@ struct v0selector { if (fillhisto) { registry.fill(HIST("hMassLambda"), V0radius, mLambda); } - if (v0id == kLambda && (1.110 < mLambda && mLambda < 1.120) && TMath::Abs(V0.posTrack_as().tpcNSigmaPr()) < 5 && TMath::Abs(V0.negTrack_as().tpcNSigmaPi()) < 5) { + if (v0id == kLambda && (1.110 < mLambda && mLambda < 1.120) && TMath::Abs(V0.posTrack_as().tpcNSigmaPr()) < cutNsigmaPrTPC && TMath::Abs(V0.negTrack_as().tpcNSigmaPi()) < cutNsigmaPiTPC) { pidmap[V0.posTrackId()] |= (uint8_t(1) << kLambda); pidmap[V0.negTrackId()] |= (uint8_t(1) << kLambda); } @@ -331,7 +340,7 @@ struct v0selector { if (fillhisto) { registry.fill(HIST("hMassAntiLambda"), V0radius, mAntiLambda); } - if ((1.110 < mAntiLambda && mAntiLambda < 1.120) && TMath::Abs(V0.posTrack_as().tpcNSigmaPi()) < 5 && TMath::Abs(V0.negTrack_as().tpcNSigmaPr()) < 5) { + if ((1.110 < mAntiLambda && mAntiLambda < 1.120) && TMath::Abs(V0.posTrack_as().tpcNSigmaPi()) < cutNsigmaPiTPC && TMath::Abs(V0.negTrack_as().tpcNSigmaPr()) < cutNsigmaPrTPC) { pidmap[V0.posTrackId()] |= (uint8_t(1) << kAntiLambda); pidmap[V0.negTrackId()] |= (uint8_t(1) << kAntiLambda); } diff --git a/PWGEM/Dilepton/Core/DielectronCut.cxx b/PWGEM/Dilepton/Core/DielectronCut.cxx index 2b0bfa066be..baeeda564ec 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.cxx +++ b/PWGEM/Dilepton/Core/DielectronCut.cxx @@ -10,9 +10,12 @@ // or submit itself to any jurisdiction. // -// Class for dilepton Cut +// Class for dielectron Cut // +#include +#include + #include "Framework/Logger.h" #include "PWGEM/Dilepton/Core/DielectronCut.h" @@ -45,34 +48,18 @@ void DielectronCut::SetMeeRange(float min, float max) mMaxMee = max; LOG(info) << "Dielectron Cut, set mee range: " << mMinMee << " - " << mMaxMee; } -void DielectronCut::SetPairDeltaEta(float minDeltaEta, float maxDeltaEta) -{ - mMinDeltaEta = minDeltaEta; - mMaxDeltaEta = maxDeltaEta; - LOG(info) << "Dielectron Cut, set pair delta eta range: " << mMinDeltaEta << " - " << mMaxDeltaEta; -} -void DielectronCut::SetPairDeltaPhi(float minDeltaPhi, float maxDeltaPhi) -{ - mMinDeltaPhi = minDeltaPhi; - mMaxDeltaPhi = maxDeltaPhi; - LOG(info) << "Dielectron Cut, set pair delta phi range: " << mMinDeltaEta << " - " << mMaxDeltaEta; -} void DielectronCut::SetPairOpAng(float minOpAng, float maxOpAng) { mMinOpAng = minOpAng; mMaxOpAng = maxOpAng; - LOG(info) << "Dielectron Cut, set pair opening angle range: " << mMinDeltaEta << " - " << mMaxDeltaEta; -} -void DielectronCut::SetMaxPhivPairMeeDep(std::function meeDepCut) -{ - mMaxPhivPairMeeDep = meeDepCut; - LOG(info) << "Dielectron Cut, set max phiv pair mee dep: " << mMaxPhivPairMeeDep(0.02); + LOG(info) << "Dielectron Cut, set pair opening angle range: " << mMinOpAng << " - " << mMaxOpAng; } -void DielectronCut::SetPhivPairRange(float min, float max) +void DielectronCut::SetMaxMeePhiVDep(std::function phivDepCut, float min_phiv, float max_phiv) { - mMinPhivPair = min; - mMaxPhivPair = max; - LOG(info) << "Dielectron Cut, set phiv range: " << mMinPhivPair << " - " << mMaxPhivPair; + mMaxMeePhiVDep = phivDepCut; + mMinPhivPair = min_phiv; + mMaxPhivPair = max_phiv; + LOG(info) << "Dielectron Cut, set max mee phiv dep: " << mMaxMeePhiVDep(2.5); } void DielectronCut::SelectPhotonConversion(bool flag) { @@ -86,6 +73,11 @@ void DielectronCut::SetMindEtadPhi(bool flag, float min_deta, float min_dphi) mMinDeltaPhi = min_dphi; LOG(info) << "Dielectron Cut, set apply deta-dphi cut: " << mApplydEtadPhi << " min_deta: " << mMinDeltaEta << " min_dphi: " << mMinDeltaPhi; } +void DielectronCut::SetRequireDifferentSides(bool flag) +{ + mRequireDiffSides = flag; + LOG(info) << "Dielectron Cut, require 2 tracks to be from different sides: " << mRequireDiffSides; +} void DielectronCut::SetTrackPtRange(float minPt, float maxPt) { mMinTrackPt = minPt; @@ -124,6 +116,12 @@ void DielectronCut::SetMaxFracSharedClustersTPC(float max) mMaxFracSharedClustersTPC = max; LOG(info) << "Dielectron Cut, set max fraction of shared clusters in TPC: " << mMaxFracSharedClustersTPC; } +void DielectronCut::SetRelDiffPin(float min, float max) +{ + mMinRelDiffPin = min; + mMaxRelDiffPin = max; + LOG(info) << "Dielectron Cut, set rel. diff. between Pin and Ppv range: " << mMinRelDiffPin << " - " << mMaxRelDiffPin; +} void DielectronCut::SetChi2PerClusterTPC(float min, float max) { mMinChi2PerClusterTPC = min; @@ -151,6 +149,13 @@ void DielectronCut::SetMeanClusterSizeITS(float min, float max, float minP, floa mMaxP_ITSClusterSize = maxP; LOG(info) << "Dielectron Cut, set mean cluster size ITS range: " << mMinMeanClusterSizeITS << " - " << mMaxMeanClusterSizeITS; } +void DielectronCut::SetChi2TOF(float min, float max) +{ + mMinChi2TOF = min; + mMaxChi2TOF = max; + LOG(info) << "Dielectron Cut, set chi2 TOF range: " << mMinChi2TOF << " - " << mMaxChi2TOF; +} + void DielectronCut::SetTrackDca3DRange(float min, float max) { mMinDca3D = min; diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index d22718dcbd2..5c533671795 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -24,8 +24,7 @@ #include "TNamed.h" #include "Math/Vector4D.h" -#include "Tools/ML/MlResponse.h" -#include "Tools/ML/model.h" +#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" #include "Framework/Logger.h" #include "Framework/DataTypes.h" @@ -34,6 +33,7 @@ #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; +using namespace o2::aod::pwgem::dilepton::utils::pairutil; class DielectronCut : public TNamed { @@ -57,6 +57,7 @@ class DielectronCut : public TNamed kTPCCrossedRows, kTPCCrossedRowsOverNCls, kTPCFracSharedClusters, + kRelDiffPin, kTPCChi2NDF, kTPCNsigmaEl, kTPCNsigmaMu, @@ -85,7 +86,8 @@ class DielectronCut : public TNamed kTPChadrejORTOFreq = 2, kTPConly = 3, kTOFif = 4, - kPIDML = 5 + kPIDML = 5, + kTPChadrejORTOFreq_woTOFif = 6 }; template @@ -106,34 +108,40 @@ class DielectronCut : public TNamed return true; } - template + template bool IsSelectedPair(TTrack1 const& t1, TTrack2 const& t2, const float bz) const { ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float dca_t1_3d = dca3DinSigma(t1); - float dca_t2_3d = dca3DinSigma(t2); - float dca_ee_3d = std::sqrt((dca_t1_3d * dca_t1_3d + dca_t2_3d * dca_t2_3d) / 2.); - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), bz); - float opAng = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); + float dca_ee_3d = pairDCAQuadSum(dca3DinSigma(t1), dca3DinSigma(t2)); + float phiv = getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), bz); + float opAng = getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); if (v12.M() < mMinMee || mMaxMee < v12.M()) { return false; } - if (v12.Rapidity() < mMinPairY || mMaxPairY < v12.Rapidity()) { + if (!dont_require_rapidity && (v12.Rapidity() < mMinPairY || mMaxPairY < v12.Rapidity())) { return false; } - if (mApplyPhiV && ((phiv < mMinPhivPair || (mMaxPhivPairMeeDep ? mMaxPhivPairMeeDep(v12.M()) : mMaxPhivPair) < phiv) ^ mSelectPC)) { - return false; + if (mApplyPhiV) { + if (((mMinPhivPair < phiv && phiv < mMaxPhivPair) && v12.M() < mMaxMeePhiVDep(phiv)) ^ mSelectPC) { + return false; + } } + if (dca_ee_3d < mMinPairDCA3D || mMaxPairDCA3D < dca_ee_3d) { // in sigma for pair return false; } - if (opAng < mMinOpAng || mMaxOpAng < opAng) { // in sigma for pair + + if (opAng < mMinOpAng || mMaxOpAng < opAng) { + return false; + } + + if (mRequireDiffSides && t1.eta() * t2.eta() > 0.0) { return false; } @@ -142,31 +150,27 @@ class DielectronCut : public TNamed o2::math_utils::bringToPMPi(dphi); if (mApplydEtadPhi && std::pow(deta / mMinDeltaEta, 2) + std::pow(dphi / mMinDeltaPhi, 2) < 1.f) { return false; - } else { - if (deta < mMinDeltaEta || deta > mMaxDeltaEta) { - return false; - } - if (deta < mMinDeltaPhi || deta > mMaxDeltaPhi) { - return false; - } } return true; } - template + template bool IsSelectedTrack(TTrack const& track, TCollision const& collision = 0) const { if (!track.hasITS() || !track.hasTPC()) { // track has to be ITS-TPC matched track return false; } - if (!IsSelectedTrack(track, DielectronCuts::kTrackPtRange)) { - return false; - } - if (!IsSelectedTrack(track, DielectronCuts::kTrackEtaRange)) { - return false; + if (!dont_require_pteta) { + if (!IsSelectedTrack(track, DielectronCuts::kTrackPtRange)) { + return false; + } + if (!IsSelectedTrack(track, DielectronCuts::kTrackEtaRange)) { + return false; + } } + if (!IsSelectedTrack(track, DielectronCuts::kTrackPhiRange)) { return false; } @@ -218,6 +222,9 @@ class DielectronCut : public TNamed if (!IsSelectedTrack(track, DielectronCuts::kTPCFracSharedClusters)) { return false; } + if (!IsSelectedTrack(track, DielectronCuts::kRelDiffPin)) { + return false; + } if (!IsSelectedTrack(track, DielectronCuts::kTPCChi2NDF)) { return false; } @@ -226,11 +233,6 @@ class DielectronCut : public TNamed return false; } - // // TOF beta cut - // if (track.hasTOF() && (track.beta() < mMinTOFbeta || mMaxTOFbeta < track.beta())) { - // return false; - // } - // PID cuts if constexpr (isML) { if (!PassPIDML(track, collision)) { @@ -248,19 +250,12 @@ class DielectronCut : public TNamed template bool PassPIDML(TTrack const& track, TCollision const& collision) const { - std::vector inputFeatures{static_cast(collision.numContrib()), track.p(), track.tgl(), - track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), - track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))}; - - // calculate classifier - float prob_ele = mPIDModel->evalModel(inputFeatures)[0]; - // LOGF(info, "prob_ele = %f", prob_ele); - if (prob_ele < 0.95) { + /*if (!PassTOFif(track)) { // Allows for pre-selection. But potentially dangerous if analyzers are not aware of it return false; - } else { - return true; - } + }*/ + std::vector inputFeatures = mPIDMlResponse->getInputFeatures(track, collision); + float binningFeature = mPIDMlResponse->getBinningFeature(track, collision); + return mPIDMlResponse->isSelectedMl(inputFeatures, binningFeature); } template @@ -285,6 +280,9 @@ class DielectronCut : public TNamed case static_cast(PIDSchemes::kPIDML): return true; // don't use kPIDML here. + case static_cast(PIDSchemes::kTPChadrejORTOFreq_woTOFif): + return PassTPConlyhadrej(track) || PassTOFreq(track); + case static_cast(PIDSchemes::kUnDef): return true; @@ -298,7 +296,7 @@ class DielectronCut : public TNamed { bool is_el_included_TPC = mMinTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < mMaxTPCNsigmaEl; bool is_pi_excluded_TPC = track.tpcInnerParam() < mMaxPinForPionRejectionTPC ? (track.tpcNSigmaPi() < mMinTPCNsigmaPi || mMaxTPCNsigmaPi < track.tpcNSigmaPi()) : true; - bool is_el_included_TOF = mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl; + bool is_el_included_TOF = (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl) && (track.hasTOF() && track.tofChi2() < mMaxChi2TOF); return is_el_included_TPC && is_pi_excluded_TPC && is_el_included_TOF; } @@ -310,7 +308,7 @@ class DielectronCut : public TNamed bool is_pi_excluded_TPC = track.tpcInnerParam() < mMaxPinForPionRejectionTPC ? (track.tpcNSigmaPi() < mMinTPCNsigmaPi || mMaxTPCNsigmaPi < track.tpcNSigmaPi()) : true; bool is_ka_excluded_TPC = track.tpcNSigmaKa() < mMinTPCNsigmaKa || mMaxTPCNsigmaKa < track.tpcNSigmaKa(); bool is_pr_excluded_TPC = track.tpcNSigmaPr() < mMinTPCNsigmaPr || mMaxTPCNsigmaPr < track.tpcNSigmaPr(); - bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl) : true; + bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl && track.tofChi2() < mMaxChi2TOF) : true; return is_el_included_TPC && is_mu_excluded_TPC && is_pi_excluded_TPC && is_ka_excluded_TPC && is_pr_excluded_TPC && is_el_included_TOF; } @@ -321,12 +319,23 @@ class DielectronCut : public TNamed return is_el_included_TPC; } + template + bool PassTPConlyhadrej(T const& track) const + { + bool is_el_included_TPC = mMinTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < mMaxTPCNsigmaEl; + bool is_mu_excluded_TPC = mMuonExclusionTPC ? track.tpcNSigmaMu() < mMinTPCNsigmaMu || mMaxTPCNsigmaMu < track.tpcNSigmaMu() : true; + bool is_pi_excluded_TPC = track.tpcInnerParam() < mMaxPinForPionRejectionTPC ? (track.tpcNSigmaPi() < mMinTPCNsigmaPi || mMaxTPCNsigmaPi < track.tpcNSigmaPi()) : true; + bool is_ka_excluded_TPC = track.tpcNSigmaKa() < mMinTPCNsigmaKa || mMaxTPCNsigmaKa < track.tpcNSigmaKa(); + bool is_pr_excluded_TPC = track.tpcNSigmaPr() < mMinTPCNsigmaPr || mMaxTPCNsigmaPr < track.tpcNSigmaPr(); + return is_el_included_TPC && is_mu_excluded_TPC && is_pi_excluded_TPC && is_ka_excluded_TPC && is_pr_excluded_TPC; + } + template bool PassTOFif(T const& track) const { bool is_el_included_TPC = mMinTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < mMaxTPCNsigmaEl; bool is_pi_excluded_TPC = track.tpcInnerParam() < mMaxPinForPionRejectionTPC ? (track.tpcNSigmaPi() < mMinTPCNsigmaPi || mMaxTPCNsigmaPi < track.tpcNSigmaPi()) : true; - bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl) : true; + bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl && track.tofChi2() < mMaxChi2TOF) : true; return is_el_included_TPC && is_pi_excluded_TPC && is_el_included_TOF; } @@ -355,6 +364,9 @@ class DielectronCut : public TNamed case DielectronCuts::kTPCFracSharedClusters: return track.tpcFractionSharedCls() <= mMaxFracSharedClustersTPC; + case DielectronCuts::kRelDiffPin: + return mMinRelDiffPin < (track.tpcInnerParam() - track.p()) / track.p() && (track.tpcInnerParam() - track.p()) / track.p() < mMaxRelDiffPin; + case DielectronCuts::kTPCChi2NDF: return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; @@ -389,13 +401,11 @@ class DielectronCut : public TNamed void SetPairYRange(float minY = -1e10f, float maxY = 1e10f); void SetPairDCARange(float min = 0.f, float max = 1e10f); // 3D DCA in sigma void SetMeeRange(float min = 0.f, float max = 0.5); - void SetPairDeltaEta(float minDeltaEta = 0.f, float maxDeltaEta = 1e10f); - void SetPairDeltaPhi(float minDeltaPhi = 0.f, float maxDeltaPhi = 1e10f); void SetPairOpAng(float minOpAng = 0.f, float maxOpAng = 1e10f); - void SetMaxPhivPairMeeDep(std::function meeDepCut); - void SetPhivPairRange(float min, float max); + void SetMaxMeePhiVDep(std::function phivDepCut, float min_phiv, float max_phiv); void SelectPhotonConversion(bool flag); void SetMindEtadPhi(bool flag, float min_deta, float min_dphi); + void SetRequireDifferentSides(bool flag); void SetTrackPtRange(float minPt = 0.f, float maxPt = 1e10f); void SetTrackEtaRange(float minEta = -1e10f, float maxEta = 1e10f); @@ -404,10 +414,12 @@ class DielectronCut : public TNamed void SetMinNCrossedRowsTPC(int minNCrossedRowsTPC); void SetMinNCrossedRowsOverFindableClustersTPC(float minNCrossedRowsOverFindableClustersTPC); void SetMaxFracSharedClustersTPC(float max); + void SetRelDiffPin(float min, float max); void SetChi2PerClusterTPC(float min, float max); void SetNClustersITS(int min, int max); void SetChi2PerClusterITS(float min, float max); void SetMeanClusterSizeITS(float min, float max, float minP = 0.f, float maxP = 0.f); + void SetChi2TOF(float min, float max); void SetPIDScheme(int scheme); void SetMinPinTOF(float min); @@ -435,9 +447,9 @@ class DielectronCut : public TNamed void ApplyPrefilter(bool flag); void ApplyPhiV(bool flag); - void SetPIDModel(o2::ml::OnnxModel* model) + void SetPIDMlResponse(o2::analysis::MlResponseDielectronSingleTrack* mlResponse) { - mPIDModel = model; + mPIDMlResponse = mlResponse; } // Getters @@ -452,12 +464,13 @@ class DielectronCut : public TNamed float mMinPairY{-1e10f}, mMaxPairY{1e10f}; // range in rapidity float mMinPairDCA3D{0.f}, mMaxPairDCA3D{1e10f}; // range in 3D DCA in sigma float mMinPhivPair{0.f}, mMaxPhivPair{+3.2}; - std::function mMaxPhivPairMeeDep{}; // max phiv as a function of mee - bool mSelectPC{false}; // flag to select photon conversion used in mMaxPhivPairMeeDep - bool mApplydEtadPhi{false}; // flag to apply deta, dphi cut between 2 tracks - float mMinDeltaEta{-1e10f}, mMaxDeltaEta{1e10f}; - float mMinDeltaPhi{-1e10f}, mMaxDeltaPhi{1e10f}; + std::function mMaxMeePhiVDep{}; // max mee as a function of phiv + bool mSelectPC{false}; // flag to select photon conversion used in mMaxPhivPairMeeDep + bool mApplydEtadPhi{false}; // flag to apply deta, dphi cut between 2 tracks + float mMinDeltaEta{0.f}; + float mMinDeltaPhi{0.f}; float mMinOpAng{0.f}, mMaxOpAng{1e10f}; + bool mRequireDiffSides{false}; // flag to require 2 tracks to be from different sides. (A-C combination). If one wants 2 tracks to be in the same side (A-A or C-C), one can simply use track eta cut. // kinematic cuts float mMinTrackPt{0.f}, mMaxTrackPt{1e10f}; // range in pT @@ -470,12 +483,14 @@ class DielectronCut : public TNamed float mMinChi2PerClusterTPC{-1e10f}, mMaxChi2PerClusterTPC{1e10f}; // max tpc fit chi2 per TPC cluster float mMinNCrossedRowsOverFindableClustersTPC{0.f}; // min ratio crossed rows / findable clusters float mMaxFracSharedClustersTPC{999.f}; // max ratio shared clusters / clusters in TPC + float mMinRelDiffPin{-1e10f}, mMaxRelDiffPin{1e10f}; // max relative difference between p at TPC inner wall and p at PV int mMinNClustersITS{0}, mMaxNClustersITS{7}; // range in number of ITS clusters float mMinChi2PerClusterITS{-1e10f}, mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster float mMaxPinMuonTPConly{0.2f}; // max pin cut for muon ID with TPConly float mMaxPinForPionRejectionTPC{1e10f}; // max pin cut for muon ID with TPConly bool mRequireITSibAny{true}; bool mRequireITSib1st{false}; + float mMinChi2TOF{-1e10f}, mMaxChi2TOF{1e10f}; // max tof chi2 per float mMinDca3D{0.0f}; // min dca in 3D in units of sigma float mMaxDca3D{1e+10}; // max dca in 3D in units of sigma @@ -503,7 +518,7 @@ class DielectronCut : public TNamed float mMinTOFNsigmaPi{-1e+10}, mMaxTOFNsigmaPi{+1e+10}; float mMinTOFNsigmaKa{-1e+10}, mMaxTOFNsigmaKa{+1e+10}; float mMinTOFNsigmaPr{-1e+10}, mMaxTOFNsigmaPr{+1e+10}; - o2::ml::OnnxModel* mPIDModel{nullptr}; + o2::analysis::MlResponseDielectronSingleTrack* mPIDMlResponse{nullptr}; ClassDef(DielectronCut, 1); }; diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 0c1424dcf84..757c8d04a56 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -39,13 +39,14 @@ #include "CommonConstants/LHCConstants.h" #include "DataFormatsParameters/GRPLHCIFData.h" #include "DataFormatsParameters/GRPECSObject.h" +#include "MathUtils/Utils.h" +#include "DetectorsBase/Propagator.h" #include "DetectorsBase/GeometryManager.h" #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" #include "Tools/ML/MlResponse.h" -#include "Tools/ML/model.h" #include "PWGEM/Dilepton/DataModel/dileptonTables.h" #include "PWGEM/Dilepton/Core/DielectronCut.h" @@ -57,6 +58,7 @@ #include "PWGEM/Dilepton/Utils/EventHistograms.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" using namespace o2; using namespace o2::aod; @@ -65,6 +67,7 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::pwgem::dilepton::utils; using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; +using namespace o2::aod::pwgem::dilepton::utils::pairutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; @@ -72,7 +75,7 @@ using MyCollision = MyCollisions::iterator; using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; -using MyElectrons = soa::Join; +using MyElectrons = soa::Join; using MyElectron = MyElectrons::iterator; using FilteredMyElectrons = soa::Filtered; using FilteredMyElectron = FilteredMyElectrons::iterator; @@ -102,6 +105,7 @@ struct Dilepton { Configurable cfgEP2Estimator_for_Mix{"cfgEP2Estimator_for_Mix", 3, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; @@ -115,7 +119,8 @@ struct Dilepton { Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; - Configurable cfgUseDCAxy{"cfgUseDCAxy", false, "flag to use DCAxy, instead of DCA3D"}; + Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; + Configurable cfgUseSignedDCA{"cfgUseSignedDCA", false, "flag to use signs in the DCA calculation"}; ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; ConfigurableAxis ConfPtllBins{"ConfPtllBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"}; @@ -137,9 +142,15 @@ struct Dilepton { Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; } eventcuts; DielectronCut fDielectronCut; @@ -153,19 +164,27 @@ struct Dilepton { Configurable cfg_max_pair_y{"cfg_max_pair_y", +0.8, "max pair rapidity"}; Configurable cfg_min_pair_dca3d{"cfg_min_pair_dca3d", 0.0, "min pair dca3d in sigma"}; Configurable cfg_max_pair_dca3d{"cfg_max_pair_dca3d", 1e+10, "max pair dca3d in sigma"}; - Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; Configurable cfg_apply_pf{"cfg_apply_pf", false, "flag to apply phiv prefilter"}; + Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; + Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; + Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut"}; - Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (also for elliptic cut)"}; - Configurable cfg_min_dphi{"cfg_min_dphi", 0.02, "min dphi between 2 electrons (also for elliptic cut)"}; - Configurable cfg_max_deta{"cfg_max_deta", 3.2, "max deta between 2 electrons"}; - Configurable cfg_max_dphi{"cfg_max_dphi", 3.2, "max dphi between 2 electrons"}; + Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; + Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; + Configurable cfg_apply_dzrdphi_geom{"cfg_apply_dzrdphi_geom", false, "flag to apply generator dz-rdphi elliptic cut"}; + Configurable cfg_min_dz_geom{"cfg_min_dz_geom", 5, "geometrical min dz between 2 electrons (elliptic cut) in cm"}; + Configurable cfg_min_rdphi_geom{"cfg_min_rdphi_geom", 20, "geometrical min rdphi between 2 electrons (elliptic cut) in cm"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; Configurable cfg_max_opang{"cfg_max_opang", 6.4, "max opening angle"}; + Configurable cfg_require_diff_sides{"cfg_require_diff_sides", false, "flag to require 2 tracks are from different sides."}; + + Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply phiv cut inherited from prefilter"}; + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8, kSplitOrMergedTrackLSGeom : 16, kSplitOrMergedTrackULSGeom : 32] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.8, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for single track"}; Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.f, "min phi for single track"}; @@ -176,6 +195,7 @@ struct Dilepton { Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.2, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.2, "max dca Z for single track in cm"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; @@ -184,8 +204,11 @@ struct Dilepton { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_p_its_cluster_size{"cfg_min_p_its_cluster_size", 0.0, "min p to apply ITS cluster size cut"}; Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.0, "max p to apply ITS cluster size cut"}; + Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; + Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfg_x_to_go{"cfg_x_to_go", -1, "x (cm) to be propagated in local coordinate"}; - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; Configurable cfg_min_TPCNsigmaMu{"cfg_min_TPCNsigmaMu", -0.0, "min. TPC n sigma for muon exclusion"}; @@ -200,9 +223,13 @@ struct Dilepton { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; - // CCDB configuration for PID ML - Configurable BDTLocalPathGamma{"BDTLocalPathGamma", "pid_ml_xgboost.onnx", "Path to the local .onnx file"}; - Configurable BDTPathCCDB{"BDTPathCCDB", "Users/d/dsekihat/pwgem/pidml/", "Path on CCDB"}; + // configuration for PID ML + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; @@ -223,8 +250,9 @@ struct Dilepton { Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 muons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.02, "min dphi between 2 muons (elliptic cut)"}; - Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; + Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -4.0, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", -2.5, "max eta for single track"}; Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.f, "min phi for single track"}; @@ -246,7 +274,7 @@ struct Dilepton { float d_bz; // o2::vertexing::DCAFitterN<2> fitter; // o2::vertexing::FwdDCAFitterN<2> fwdfitter; - // o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; @@ -331,6 +359,7 @@ struct Dilepton { } } + LOGF(info, "cfgOccupancyEstimator = %d", cfgOccupancyEstimator.value); if (ConfOccupancyBins.value[0] == VARIABLE_WIDTH) { occ_bin_edges = std::vector(ConfOccupancyBins.value.begin(), ConfOccupancyBins.value.end()); occ_bin_edges.erase(occ_bin_edges.begin()); @@ -380,7 +409,7 @@ struct Dilepton { } fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); - fRegistry.add("Pair/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{1001, -0.5, 1000.5}}, true); + fRegistry.add("Pair/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); if (doprocessTriggerAnalysis) { fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); } @@ -400,6 +429,7 @@ struct Dilepton { if (fabs(d_bz) > 1e-5) { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } + o2::base::Propagator::initFieldFromGRP(&grpmag); mRunNumber = collision.runNumber(); // fitter.setBz(d_bz); // fwdfitter.setBz(d_bz); @@ -412,6 +442,7 @@ struct Dilepton { if (!skipGRPOquery) grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; @@ -420,6 +451,7 @@ struct Dilepton { if (!grpmag) { LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; } + o2::base::Propagator::initFieldFromGRP(grpmag); // Fetch magnetic field from ccdb for current collision d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; @@ -461,17 +493,9 @@ struct Dilepton { delete emh_neg; emh_neg = 0x0; - // map_mixed_eventId_to_centrality.clear(); - // map_mixed_eventId_to_occupancy.clear(); - // map_mixed_eventId_to_qvector.clear(); - // map_mixed_eventId_to_globalBC.clear(); - used_trackIds.clear(); used_trackIds.shrink_to_fit(); - if (eid_bdt) { - delete eid_bdt; - } delete h2sp_resolution; } @@ -486,8 +510,13 @@ struct Dilepton { mass_axis_title = "m_{ee} (GeV/c^{2})"; pair_pt_axis_title = "p_{T,ee} (GeV/c)"; pair_dca_axis_title = "DCA_{ee}^{3D} (#sigma)"; - if (cfgUseDCAxy) { + if (cfgDCAType == 1) { pair_dca_axis_title = "DCA_{ee}^{XY} (#sigma)"; + } else if (cfgDCAType == 2) { + pair_dca_axis_title = "DCA_{ee}^{Z} (#sigma)"; + } + if (cfgUseSignedDCA) { + pair_dca_axis_title = "Signed " + pair_dca_axis_title; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { mass_axis_title = "m_{#mu#mu} (GeV/c^{2})"; @@ -502,10 +531,12 @@ struct Dilepton { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC)) { fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca}, true); - fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhi", "distance between 2 tracks in #eta-#varphi plane;#Delta#varphi (rad.);#Delta#eta", kTH2D, {{200, -0.5, +0.5}, {200, -0.5, 0.5}}, true); + fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhi", "#Delta#eta-#Delta#varphi between 2 tracks;#Delta#varphi (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {200, -1, +1}}, true); + fRegistry.add("Pair/same/uls/hGeomDeltaZRDeltaPhi", Form("difference in z-r#varphi plane between 2 tracks at r = %2.1f cm;r#Delta#varphi (cm);#Deltaz (cm);", dielectroncuts.cfg_x_to_go.value), kTH2D, {{200, -100, 100}, {200, -10, 10}}, true); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - fRegistry.add("Pair/same/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{90, 0, M_PI}, {100, 0.0f, 0.1f}}, true); // phiv is only for dielectron - fRegistry.add("Pair/same/uls/hMVsOpAng", "m_{ee} vs. angle between 2 tracks;#omega (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{200, 0, 4.0}, {100, 0.0f, 3.2}}, true); + fRegistry.add("Pair/same/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); // phiv is only for dielectron + fRegistry.add("Pair/same/uls/hMvsOpAng", "m_{ee} vs. angle between 2 tracks;#omega (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); + fRegistry.add("Pair/same/uls/hDCA1vsDCA2", "DCA of leg1 vs. DCA of leg2;DCA1(#sigma);DCA2 (#sigma)", kTH2D, {{100, 0, 10.0}, {100, 0, 10}}, true); } fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); @@ -529,14 +560,10 @@ struct Dilepton { const AxisSpec axis_sp{ConfSPBins, Form("#vec{u}_{%d,ll} #upoint #vec{Q}_{%d}^{%s}", nmod, nmod, qvec_det_names[cfgQvecEstimator].data())}; fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_sp}, true); - // fRegistry.add("Pair/same/uls/hPrfUQ", Form("dilepton <#vec{u}_{%d,ll} #upoint #vec{Q}_{%d}^{%s}>", nmod, nmod, qvec_det_names[cfgQvecEstimator].data()), kTProfile3D, {axis_mass, axis_pt, axis_dca}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.add("Pair/mix/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca}, true); - // fRegistry.add("Pair/mix/uls/hs_woEPmix", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca}, true); - // fRegistry.add("Pair/mix/uls/hPrfUQCosDPhi", Form("dilepton <#vec{u}_{%d,l1} #upoint #vec{Q}_{%d,ev1}^{%s} cos(%d(#varphi_{l1} - #varphi_{ll}))> + <#vec{u}_{%d,l2} #upoint #vec{Q}_{%d,ev2}^{%s} cos(%d(#varphi_{l2} - #varphi_{ll}))>", nmod, nmod, qvec_det_names[cfgQvecEstimator].data(), nmod, nmod, nmod, qvec_det_names[cfgQvecEstimator].data(), nmod), kTProfile3D, {axis_mass, axis_pt, axis_dca}, true); - // fRegistry.add("Pair/mix/uls/hPrf2UQ1UQ2CosDPhi12", Form("dilepton <2 #vec{u}_{%d,l1} #upoint #vec{Q}_{%d,ev1}^{%s} #vec{u}_{%d,l2} #upoint #vec{Q}_{%d,ev2}^{%s} cos(%d(#varphi_{l1} - #varphi_{l2}))>", nmod, nmod, qvec_det_names[cfgQvecEstimator].data(), nmod, nmod, qvec_det_names[cfgQvecEstimator].data(), nmod), kTProfile3D, {axis_mass, axis_pt, axis_dca}, true); fRegistry.addClone("Pair/mix/uls/", "Pair/mix/lspp/"); fRegistry.addClone("Pair/mix/uls/", "Pair/mix/lsmm/"); @@ -569,7 +596,7 @@ struct Dilepton { fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kHFll)) { - const AxisSpec axis_dphi_ee{36, M_PI / 2., 3. / .2 * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll + const AxisSpec axis_dphi_ee{36, -M_PI / 2., 3. / 2. * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll const AxisSpec axis_deta_ee{40, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_dphi_ee, axis_deta_ee}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); @@ -605,11 +632,13 @@ struct Dilepton { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); } - o2::ml::OnnxModel* eid_bdt = nullptr; + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; void DefineDielectronCut() { fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); @@ -619,16 +648,15 @@ struct Dilepton { fDielectronCut.SetPairPtRange(dielectroncuts.cfg_min_pair_pt, dielectroncuts.cfg_max_pair_pt); fDielectronCut.SetPairYRange(dielectroncuts.cfg_min_pair_y, dielectroncuts.cfg_max_pair_y); fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma - fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); fDielectronCut.ApplyPrefilter(dielectroncuts.cfg_apply_pf); fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); - fDielectronCut.SetPairDeltaEta(dielectroncuts.cfg_min_deta, dielectroncuts.cfg_max_deta); - fDielectronCut.SetPairDeltaPhi(dielectroncuts.cfg_min_dphi, dielectroncuts.cfg_max_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); + fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); // for track - fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); + fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, dielectroncuts.cfg_max_pt_track); fDielectronCut.SetTrackEtaRange(dielectroncuts.cfg_min_eta_track, dielectroncuts.cfg_max_eta_track); fDielectronCut.SetTrackPhiRange(dielectroncuts.cfg_min_phi_track, dielectroncuts.cfg_max_phi_track); fDielectronCut.SetMinNClustersTPC(dielectroncuts.cfg_min_ncluster_tpc); @@ -643,6 +671,8 @@ struct Dilepton { fDielectronCut.SetTrackMaxDcaZ(dielectroncuts.cfg_max_dcaz); fDielectronCut.RequireITSibAny(dielectroncuts.cfg_require_itsib_any); fDielectronCut.RequireITSib1st(dielectroncuts.cfg_require_itsib_1st); + fDielectronCut.SetChi2TOF(0, dielectroncuts.cfg_max_chi2tof); + fDielectronCut.SetRelDiffPin(dielectroncuts.cfg_min_rel_diff_pin, dielectroncuts.cfg_max_rel_diff_pin); // for eID fDielectronCut.SetPIDScheme(dielectroncuts.cfg_pid_scheme); @@ -654,21 +684,30 @@ struct Dilepton { fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - eid_bdt = new o2::ml::OnnxModel(); + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + const std::vector labelsClasses = {"Signal", "Background"}; + const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + cutsMlArr[i][1] = 0.; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); if (dielectroncuts.loadModelsFromCCDB) { ccdbApi.init(ccdburl); - std::map metadata; - bool retrieveSuccessGamma = ccdbApi.retrieveBlob(dielectroncuts.BDTPathCCDB.value, ".", metadata, dielectroncuts.timestampCCDB.value, false, dielectroncuts.BDTLocalPathGamma.value); - if (retrieveSuccessGamma) { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); - } else { - LOG(fatal) << "Error encountered while fetching/loading the Gamma model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; - } + mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); } else { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); + mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); } + mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - fDielectronCut.SetPIDModel(eid_bdt); + fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -685,7 +724,7 @@ struct Dilepton { // for track fDimuonCut.SetTrackType(dimuoncuts.cfg_track_type); - fDimuonCut.SetTrackPtRange(dimuoncuts.cfg_min_pt_track, 1e10f); + fDimuonCut.SetTrackPtRange(dimuoncuts.cfg_min_pt_track, dimuoncuts.cfg_max_pt_track); fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_eta_track, dimuoncuts.cfg_max_eta_track); fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_phi_track, dimuoncuts.cfg_max_phi_track); fDimuonCut.SetNClustersMFT(dimuoncuts.cfg_min_ncluster_mft, 10); @@ -736,6 +775,28 @@ struct Dilepton { } } + std::map, float> map_z_prop; // map -> geometrical z position at propagated point + std::map, float> map_phi_prop; // map -> geometrical phi position at propagated point + + template + void propagateElectron(TTracks const& tracks) + { + // this has to be called after initCCDB for bz. + for (auto& track : tracks) { + auto track_par_cov = getTrackParCov(track); + track_par_cov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToX(track_par_cov, dielectroncuts.cfg_x_to_go, d_bz, o2::base::PropagatorImpl::MAX_SIN_PHI, o2::base::PropagatorImpl::MAX_STEP, matCorr); + auto xyz = track_par_cov.getXYZGlo(); + // float eta = RecoDecay::eta(std::array{xyz.X(), xyz.Y(), xyz.Z()}); + float phi = RecoDecay::phi(std::array{xyz.X(), xyz.Y()}); + o2::math_utils::bringTo02Pi(phi); + map_z_prop[std::make_tuple(ndf, track.emeventId(), track.globalIndex())] = xyz.Z(); + map_phi_prop[std::make_tuple(ndf, track.emeventId(), track.globalIndex())] = phi; + // std::array pxpypz_prop = {0, 0, 0}; // px, py, pz + // getPxPyPz(track_par_cov, pxpypz_prop); + } + } + template bool fillPairInfo(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut) { @@ -766,11 +827,11 @@ struct Dilepton { if constexpr (ev_id == 0) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -781,10 +842,25 @@ struct Dilepton { } } + float dphi_geom = 999.f, dz_geom = 999.f, rdphi_geom = 999.f; if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (!cut.template IsSelectedPair(t1, t2, d_bz)) { return false; } + if constexpr (ev_id == 0) { + dz_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? map_z_prop[std::make_tuple(ndf, t1.emeventId(), t1.globalIndex())] - map_z_prop[std::make_tuple(ndf, t2.emeventId(), t2.globalIndex())] : map_z_prop[std::make_tuple(ndf, t2.emeventId(), t2.globalIndex())] - map_z_prop[std::make_tuple(ndf, t1.emeventId(), t1.globalIndex())]; + dphi_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? map_phi_prop[std::make_tuple(ndf, t1.emeventId(), t1.globalIndex())] - map_phi_prop[std::make_tuple(ndf, t2.emeventId(), t2.globalIndex())] : map_phi_prop[std::make_tuple(ndf, t2.emeventId(), t2.globalIndex())] - map_phi_prop[std::make_tuple(ndf, t1.emeventId(), t1.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + } else { // mixed event + dz_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? map_z_prop[std::make_tuple(t1.dfId(), t1.collisionId(), t1.globalIndex())] - map_z_prop[std::make_tuple(t2.dfId(), t2.collisionId(), t2.globalIndex())] : map_z_prop[std::make_tuple(t2.dfId(), t2.collisionId(), t2.globalIndex())] - map_z_prop[std::make_tuple(t1.dfId(), t1.collisionId(), t1.globalIndex())]; + dphi_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? map_phi_prop[std::make_tuple(t1.dfId(), t1.collisionId(), t1.globalIndex())] - map_phi_prop[std::make_tuple(t2.dfId(), t2.collisionId(), t2.globalIndex())] : map_phi_prop[std::make_tuple(t2.dfId(), t2.collisionId(), t2.globalIndex())] - map_phi_prop[std::make_tuple(t1.dfId(), t1.collisionId(), t1.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + } + if (dielectroncuts.cfg_x_to_go > 0.f && dielectroncuts.cfg_apply_dzrdphi_geom && std::pow(dz_geom / dielectroncuts.cfg_min_dz_geom, 2) + std::pow(rdphi_geom / dielectroncuts.cfg_min_rdphi_geom, 2) < 1.f) { + return false; + } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (!cut.template IsSelectedPair(t1, t2)) { return false; @@ -809,32 +885,42 @@ struct Dilepton { ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), leptonM2); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float dca_t1 = 999.f, dca_t2 = 999.f, pair_dca = 999.f; + float pair_dca = 999.f; if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - dca_t1 = dca3DinSigma(t1); - dca_t2 = dca3DinSigma(t2); - pair_dca = std::sqrt((dca_t1 * dca_t1 + dca_t2 * dca_t2) / 2.); - if (cfgUseDCAxy) { - dca_t1 = t1.dcaXY() / std::sqrt(t1.cYY()); - dca_t2 = t2.dcaXY() / std::sqrt(t2.cYY()); - pair_dca = std::sqrt((dca_t1 * dca_t1 + dca_t2 * dca_t2) / 2.); + if (cfgUseSignedDCA) { + pair_dca = pairDCASignQuadSum(dca3DinSigma(t1), dca3DinSigma(t2), t1.sign(), t2.sign()); + } else { + pair_dca = pairDCAQuadSum(dca3DinSigma(t1), dca3DinSigma(t2)); + } + if (cfgDCAType == 1) { + if (cfgUseSignedDCA) { + pair_dca = pairDCASignQuadSum(dcaXYinSigma(t1), dcaXYinSigma(t2), t1.sign(), t2.sign()); + } else { + pair_dca = pairDCAQuadSum(dcaXYinSigma(t1), dcaXYinSigma(t2)); + } + } else if (cfgDCAType == 2) { + if (cfgUseSignedDCA) { + pair_dca = pairDCASignQuadSum(dcaZinSigma(t1), dcaZinSigma(t2), t1.sign(), t2.sign()); + } else { + pair_dca = pairDCAQuadSum(dcaZinSigma(t1), dcaZinSigma(t2)); + } } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - dca_t1 = fwdDcaXYinSigma(t1); - dca_t2 = fwdDcaXYinSigma(t2); - pair_dca = std::sqrt((dca_t1 * dca_t1 + dca_t2 * dca_t2) / 2.); + pair_dca = pairDCAQuadSum(fwdDcaXYinSigma(t1), fwdDcaXYinSigma(t2)); } - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), d_bz); if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC)) { - float deta = v1.Eta() - v2.Eta(); - float dphi = v1.Phi() - v2.Phi(); + float deta = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? v1.Eta() - v2.Eta() : v2.Eta() - v1.Eta(); + float dphi = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), d_bz); float opAng = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); if (t1.sign() * t2.sign() < 0) { // ULS fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsOpAng"), opAng, v12.M(), weight); @@ -842,6 +928,7 @@ struct Dilepton { } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsOpAng"), opAng, v12.M(), weight); @@ -849,6 +936,7 @@ struct Dilepton { } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsOpAng"), opAng, v12.M(), weight); @@ -872,7 +960,6 @@ struct Dilepton { } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, abs(dphi_e_ee), abs(cos_thetaCS), weight); } - } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV2) || cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV3)) { std::array q2ft0m = {collision.q2xft0m(), collision.q2yft0m()}; std::array q2ft0a = {collision.q2xft0a(), collision.q2yft0a()}; @@ -900,13 +987,10 @@ struct Dilepton { float sp = RecoDecay::dotProd(std::array{static_cast(std::cos(nmod * v12.Phi())), static_cast(std::sin(nmod * v12.Phi()))}, qvectors[nmod][cfgQvecEstimator]) / getSPresolution(collision.centFT0C(), collision.trackOccupancyInTimeRange()); if (t1.sign() * t2.sign() < 0) { // ULS fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, sp, weight); - // fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hPrfUQ"), v12.M(), v12.Pt(), pair_dca, sp, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, sp, weight); - // fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hPrfUQ"), v12.M(), v12.Pt(), pair_dca, sp, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, sp, weight); - // fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hPrfUQ"), v12.M(), v12.Pt(), pair_dca, sp, weight); } } else if constexpr (ev_id == 1) { if (t1.sign() * t2.sign() < 0) { // ULS @@ -1041,7 +1125,8 @@ struct Dilepton { Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; - Filter collisionFilter_occupancy = eventcuts.cfgOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgOccupancyMax; + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; SliceCache cache; @@ -1049,6 +1134,15 @@ struct Dilepton { Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && dielectroncuts.cfg_min_phi_track < o2::aod::track::phi && o2::aod::track::phi < dielectroncuts.cfg_max_phi_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; Filter pidFilter_electron = (dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl) && (o2::aod::pidtpc::tpcNSigmaPi < dielectroncuts.cfg_min_TPCNsigmaPi || dielectroncuts.cfg_max_TPCNsigmaPi < o2::aod::pidtpc::tpcNSigmaPi); Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); + Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLSGeom))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLSGeom))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULSGeom))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULSGeom))) <= static_cast(0), true), + o2::aod::emprimaryelectron::pfbpi0 >= static_cast(0)); + Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); Partition negative_electrons = o2::aod::emprimaryelectron::sign < int8_t(0); @@ -1060,9 +1154,6 @@ struct Dilepton { TEMH* emh_pos = nullptr; TEMH* emh_neg = nullptr; - // std::map, std::vector>>> map_mixed_eventId_to_qvector; - // std::map, float> map_mixed_eventId_to_centrality; - // std::map, int> map_mixed_eventId_to_occupancy; std::map, uint64_t> map_mixed_eventId_to_globalBC; std::vector> used_trackIds; @@ -1144,6 +1235,13 @@ struct Dilepton { auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); // LOGF(info, "collision.globalIndex() = %d , collision.posZ() = %f , collision.numContrib() = %d, centrality = %f , posTracks_per_coll.size() = %d, negTracks_per_coll.size() = %d", collision.globalIndex(), collision.posZ(), collision.numContrib(), centralities[cfgCentEstimator], posTracks_per_coll.size(), negTracks_per_coll.size()); + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if (dielectroncuts.cfg_x_to_go > 0.f) { + propagateElectron(posTracks_per_coll); + propagateElectron(negTracks_per_coll); + } + } + int nuls = 0, nlspp = 0, nlsmm = 0; for (auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS bool is_pair_ok = fillPairInfo<0>(collision, pos, neg, cut); @@ -1190,7 +1288,15 @@ struct Dilepton { epbin = static_cast(ep_bin_edges.size()) - 2; } - int occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.trackOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + int occbin = -1; + if (cfgOccupancyEstimator == 0) { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.ft0cOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } else if (cfgOccupancyEstimator == 1) { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.trackOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } else { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.ft0cOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } + if (occbin < 0) { occbin = 0; } else if (static_cast(occ_bin_edges.size()) - 2 < occbin) { @@ -1253,68 +1359,7 @@ struct Dilepton { } } // end of loop over mixed event pool - // // run mixed event loop for flow measurement. Don't divide mixed-event categories by event planes, if you do flow measurement. - // if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV2) || cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV3)) { - // for (int epbin_tmp = 0; epbin_tmp < static_cast(ep_bin_edges.size()) - 1; epbin_tmp++) { - // std::tuple key_bin = std::make_tuple(zbin, centbin, epbin_tmp, occbin); - // auto collisionIds_in_mixing_pool = emh_pos->GetCollisionIdsFromEventPool(key_bin); // pos/neg does not matter. - // // LOGF(info, "collisionIds_in_mixing_pool.size() = %d", collisionIds_in_mixing_pool.size()); - - // for (auto& mix_dfId_collisionId : collisionIds_in_mixing_pool) { - // int mix_dfId = mix_dfId_collisionId.first; - // int mix_collisionId = mix_dfId_collisionId.second; - // if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection. - // continue; - // } - - // auto centrality_mix = map_mixed_eventId_to_centrality[mix_dfId_collisionId]; - // auto occupancy_mix = map_mixed_eventId_to_occupancy[mix_dfId_collisionId]; - // auto qvectors_mix = map_mixed_eventId_to_qvector[mix_dfId_collisionId]; - // auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; - // uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); - // if (diffBC < ndiff_bc_mix) { - // continue; - // } - - // auto posTracks_from_event_pool = emh_pos->GetTracksPerCollision(mix_dfId_collisionId); - // auto negTracks_from_event_pool = emh_neg->GetTracksPerCollision(mix_dfId_collisionId); - // // LOGF(info, "Do event mixing: current event (%d, %d) | event pool (%d, %d), npos = %d , nneg = %d", ndf, collision.globalIndex(), mix_dfId, mix_collisionId, posTracks_from_event_pool.size(), negTracks_from_event_pool.size()); - - // for (auto& pos : selected_posTracks_in_this_event) { // ULS mix - // for (auto& neg : negTracks_from_event_pool) { - // fillMixedPairInfoForFlow(pos, neg, cut, qvectors, qvectors_mix, collision.centFT0C(), centrality_mix, collision.trackOccupancyInTimeRange(), occupancy_mix); - // } - // } - - // for (auto& neg : selected_negTracks_in_this_event) { // ULS mix - // for (auto& pos : posTracks_from_event_pool) { - // fillMixedPairInfoForFlow(neg, pos, cut, qvectors, qvectors_mix, collision.centFT0C(), centrality_mix, collision.trackOccupancyInTimeRange(), occupancy_mix); - // } - // } - - // for (auto& pos1 : selected_posTracks_in_this_event) { // LS++ mix - // for (auto& pos2 : posTracks_from_event_pool) { - // fillMixedPairInfoForFlow(pos1, pos2, cut, qvectors, qvectors_mix, collision.centFT0C(), centrality_mix, collision.trackOccupancyInTimeRange(), occupancy_mix); - // } - // } - - // for (auto& neg1 : selected_negTracks_in_this_event) { // LS-- mix - // for (auto& neg2 : negTracks_from_event_pool) { - // fillMixedPairInfoForFlow(neg1, neg2, cut, qvectors, qvectors_mix, collision.centFT0C(), centrality_mix, collision.trackOccupancyInTimeRange(), occupancy_mix); - // } - // } - // } // end of loop over mixed event pool - - // } // end of ep bin loop - - // } // end of mixing loop for flow - if (nuls > 0 || nlspp > 0 || nlsmm > 0) { - // if (nmod > 0) { - // map_mixed_eventId_to_qvector[key_df_collision] = qvectors; - // map_mixed_eventId_to_centrality[key_df_collision] = collision.centFT0C(); - // map_mixed_eventId_to_occupancy[key_df_collision] = collision.trackOccupancyInTimeRange(); - // } map_mixed_eventId_to_globalBC[key_df_collision] = collision.globalBC(); emh_pos->AddCollisionIdAtLast(key_bin, key_df_collision); emh_neg->AddCollisionIdAtLast(key_bin, key_df_collision); @@ -1322,84 +1367,18 @@ struct Dilepton { } // end of collision loop - ndf++; } // end of DF - // template - // bool fillMixedPairInfoForFlow(TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TQvectors const& qvectors, TMixedQvectors const& qvectors_mix, const float centrality, const float centrality_mix, const int occupancy, const int occupancy_mix) - // { - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // auto v1ambIds = t1.ambiguousElectronsIds(); - // auto v2ambIds = t2.ambiguousElectronsIds(); - // if ((t1.dfId() == t2.dfId()) && std::find(v2ambIds.begin(), v2ambIds.end(), t1.globalIndex()) != v2ambIds.end() && std::find(v1ambIds.begin(), v1ambIds.end(), t2.globalIndex()) != v1ambIds.end()) { - // return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - // } - // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // auto v1ambIds = t1.ambiguousMuonsIds(); - // auto v2ambIds = t2.ambiguousMuonsIds(); - // if ((t1.dfId() == t2.dfId()) && std::find(v2ambIds.begin(), v2ambIds.end(), t1.globalIndex()) != v2ambIds.end() && std::find(v1ambIds.begin(), v1ambIds.end(), t2.globalIndex()) != v1ambIds.end()) { - // return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - // } - // } - - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // if (!cut.template IsSelectedPair(t1, t2, d_bz)) { - // return false; - // } - // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // if (!cut.template IsSelectedPair(t1, t2)) { - // return false; - // } - // } - - // ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), leptonM1); - // ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), leptonM2); - // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - // float dca_t1 = 999.f, dca_t2 = 999.f, pair_dca = 999.f; - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // dca_t1 = dca3DinSigma(t1); - // dca_t2 = dca3DinSigma(t2); - // pair_dca = std::sqrt((dca_t1 * dca_t1 + dca_t2 * dca_t2) / 2.); - // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // dca_t1 = fwdDcaXYinSigma(t1); - // dca_t2 = fwdDcaXYinSigma(t2); - // pair_dca = std::sqrt((dca_t1 * dca_t1 + dca_t2 * dca_t2) / 2.); - // } - - // float sp1 = RecoDecay::dotProd(std::array{static_cast(std::cos(nmod * v1.Phi())), static_cast(std::sin(nmod * v1.Phi()))}, qvectors[nmod][cfgQvecEstimator]) / getSPresolution(centrality, occupancy); - // float sp2 = RecoDecay::dotProd(std::array{static_cast(std::cos(nmod * v2.Phi())), static_cast(std::sin(nmod * v2.Phi()))}, qvectors_mix[nmod][cfgQvecEstimator]) / getSPresolution(centrality_mix, occupancy_mix); - // float cos_dphi1 = std::cos(nmod * (v1.Phi() - v12.Phi())); - // float cos_dphi2 = std::cos(nmod * (v2.Phi() - v12.Phi())); - // float cos_dphi12 = std::cos(nmod * (v1.Phi() - v2.Phi())); - // const float weight = 1.f; - - // if (t1.sign() * t2.sign() < 0) { // ULS - // fRegistry.fill(HIST("Pair/mix/uls/hs_woEPmix"), v12.M(), v12.Pt(), pair_dca, weight); - // fRegistry.fill(HIST("Pair/mix/uls/hPrfUQCosDPhi"), v12.M(), v12.Pt(), pair_dca, sp1 * cos_dphi1 + sp2 * cos_dphi2, weight); - // fRegistry.fill(HIST("Pair/mix/uls/hPrf2UQ1UQ2CosDPhi12"), v12.M(), v12.Pt(), pair_dca, 2.f * sp1 * sp2 * cos_dphi12, weight); - // } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - // fRegistry.fill(HIST("Pair/mix/lspp/hs_woEPmix"), v12.M(), v12.Pt(), pair_dca, weight); - // fRegistry.fill(HIST("Pair/mix/lspp/hPrfUQCosDPhi"), v12.M(), v12.Pt(), pair_dca, sp1 * cos_dphi1 + sp2 * cos_dphi2, weight); - // fRegistry.fill(HIST("Pair/mix/lspp/hPrf2UQ1UQ2CosDPhi12"), v12.M(), v12.Pt(), pair_dca, 2.f * sp1 * sp2 * cos_dphi12, weight); - // } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - // fRegistry.fill(HIST("Pair/mix/lsmm/hs_woEPmix"), v12.M(), v12.Pt(), pair_dca, weight); - // fRegistry.fill(HIST("Pair/mix/lsmm/hPrfUQCosDPhi"), v12.M(), v12.Pt(), pair_dca, sp1 * cos_dphi1 + sp2 * cos_dphi2, weight); - // fRegistry.fill(HIST("Pair/mix/lsmm/hPrf2UQ1UQ2CosDPhi12"), v12.M(), v12.Pt(), pair_dca, 2.f * sp1 * sp2 * cos_dphi12, weight); - // } - // return true; - // } - template bool isPairOK(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -1413,6 +1392,14 @@ struct Dilepton { if (!cut.template IsSelectedPair(t1, t2, d_bz)) { return false; } + float dz_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? map_z_prop[std::make_tuple(ndf, t1.emeventId(), t1.globalIndex())] - map_z_prop[std::make_tuple(ndf, t2.emeventId(), t2.globalIndex())] : map_z_prop[std::make_tuple(ndf, t2.emeventId(), t2.globalIndex())] - map_z_prop[std::make_tuple(ndf, t1.emeventId(), t1.globalIndex())]; + float dphi_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? map_phi_prop[std::make_tuple(ndf, t1.emeventId(), t1.globalIndex())] - map_phi_prop[std::make_tuple(ndf, t2.emeventId(), t2.globalIndex())] : map_phi_prop[std::make_tuple(ndf, t2.emeventId(), t2.globalIndex())] - map_phi_prop[std::make_tuple(ndf, t1.emeventId(), t1.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + + if (dielectroncuts.cfg_x_to_go > 0.f && dielectroncuts.cfg_apply_dzrdphi_geom && std::pow(dz_geom / dielectroncuts.cfg_min_dz_geom, 2) + std::pow(rdphi_geom / dielectroncuts.cfg_min_rdphi_geom, 2) < 1.f) { + return false; + } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (!cut.template IsSelectedPair(t1, t2)) { return false; @@ -1471,6 +1458,12 @@ struct Dilepton { auto posTracks_per_coll = posTracks.sliceByCached(perCollision, collision.globalIndex(), cache); auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if (dielectroncuts.cfg_x_to_go > 0.f) { + propagateElectron(posTracks_per_coll); + propagateElectron(negTracks_per_coll); + } + } for (auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS if (isPairOK(collision, pos, neg, cut)) { @@ -1541,6 +1534,7 @@ struct Dilepton { runPairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut); } map_weight.clear(); + ndf++; } PROCESS_SWITCH(Dilepton, processAnalysis, "run dilepton analysis", true); @@ -1561,6 +1555,7 @@ struct Dilepton { runPairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut); } map_weight.clear(); + ndf++; } PROCESS_SWITCH(Dilepton, processTriggerAnalysis, "run dilepton analysis on triggered data", false); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 3d6c67b6a93..d4291adb641 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -31,12 +31,12 @@ #include "DataFormatsParameters/GRPLHCIFData.h" #include "DataFormatsParameters/GRPECSObject.h" +#include "DetectorsBase/Propagator.h" #include "DetectorsBase/GeometryManager.h" #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" #include "Tools/ML/MlResponse.h" -#include "Tools/ML/model.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" @@ -51,6 +51,7 @@ #include "PWGEM/Dilepton/Utils/EventHistograms.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" using namespace o2; using namespace o2::aod; @@ -59,11 +60,12 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::pwgem::dilepton::utils::mcutil; using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; +using namespace o2::aod::pwgem::dilepton::utils::pairutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyMCElectrons = soa::Join; +using MyMCElectrons = soa::Join; using MyMCElectron = MyMCElectrons::iterator; using FilteredMyMCElectrons = soa::Filtered; using FilteredMyMCElectron = FilteredMyMCElectrons::iterator; @@ -97,7 +99,8 @@ struct DileptonMC { Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; - Configurable cfgUseDCAxy{"cfgUseDCAxy", false, "flag to use DCAxy, instead of DCA3D"}; + Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; + Configurable cfgFillUnfolding{"cfgFillUnfolding", false, "flag to fill histograms for unfolding"}; ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; ConfigurableAxis ConfPtllBins{"ConfPtllBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"}; @@ -117,9 +120,15 @@ struct DileptonMC { Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; } eventcuts; DielectronCut fDielectronCut; @@ -133,16 +142,27 @@ struct DileptonMC { Configurable cfg_max_pair_y{"cfg_max_pair_y", +0.8, "max pair rapidity"}; Configurable cfg_min_pair_dca3d{"cfg_min_pair_dca3d", 0.0, "min pair dca3d in sigma"}; Configurable cfg_max_pair_dca3d{"cfg_max_pair_dca3d", 1e+10, "max pair dca3d in sigma"}; - - Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; Configurable cfg_apply_pf{"cfg_apply_pf", false, "flag to apply phiv prefilter"}; + Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; + Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; + Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; - Configurable cfg_min_dphi{"cfg_min_dphi", 0.02, "min dphi between 2 electrons (elliptic cut)"}; + Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; + Configurable cfg_apply_dzrdphi_geom{"cfg_apply_dzrdphi_geom", false, "flag to apply generator dz-rdphi elliptic cut"}; + Configurable cfg_min_dz_geom{"cfg_min_dz_geom", 5, "geometrical min deta between 2 electrons (elliptic cut)"}; + Configurable cfg_min_rdphi_geom{"cfg_min_rdphi_geom", 20, "geometrical min dphi between 2 electrons (elliptic cut)"}; + Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; + Configurable cfg_max_opang{"cfg_max_opang", 6.4, "max opening angle"}; + Configurable cfg_require_diff_sides{"cfg_require_diff_sides", false, "flag to require 2 tracks are from different sides."}; + + Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply phiv cut inherited from prefilter"}; + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8, kSplitOrMergedTrackLSGeom : 16, kSplitOrMergedTrackULSGeom : 32] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.8, "max eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for single track"}; Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.f, "max phi for single track"}; @@ -153,6 +173,7 @@ struct DileptonMC { Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.2, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.2, "max dca Z for single track in cm"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; @@ -161,8 +182,11 @@ struct DileptonMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_p_its_cluster_size{"cfg_min_p_its_cluster_size", 0.0, "min p to apply ITS cluster size cut"}; Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.0, "max p to apply ITS cluster size cut"}; + Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; + Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfg_x_to_go{"cfg_x_to_go", -1, "x (cm) to be propagated in local coordinate"}; - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; Configurable cfg_min_TPCNsigmaMu{"cfg_min_TPCNsigmaMu", -0.0, "min. TPC n sigma for muon exclusion"}; @@ -177,9 +201,13 @@ struct DileptonMC { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; - // CCDB configuration for PID ML - Configurable BDTLocalPathGamma{"BDTLocalPathGamma", "pid_ml_xgboost.onnx", "Path to the local .onnx file"}; - Configurable BDTPathCCDB{"BDTPathCCDB", "Users/d/dsekihat/pwgem/pidml/", "Path on CCDB"}; + // configuration for PID ML + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; @@ -200,8 +228,9 @@ struct DileptonMC { Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 muons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.02, "min dphi between 2 muons (elliptic cut)"}; - Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; + Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -4.0, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", -2.5, "max eta for single track"}; Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.f, "max phi for single track"}; @@ -221,7 +250,7 @@ struct DileptonMC { Service ccdb; // o2::vertexing::DCAFitterN<2> fitter; // o2::vertexing::FwdDCAFitterN<2> fwdfitter; - // o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; int mRunNumber; float d_bz; @@ -236,12 +265,7 @@ struct DileptonMC { HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; - ~DileptonMC() - { - if (eid_bdt) { - delete eid_bdt; - } - } + ~DileptonMC() {} void addhistograms() { @@ -260,8 +284,10 @@ struct DileptonMC { pair_pt_axis_title = "p_{T,ee} (GeV/c)"; pair_y_axis_title = "y_{ee}"; pair_dca_axis_title = "DCA_{ee}^{3D} (#sigma)"; - if (cfgUseDCAxy) { + if (cfgDCAType == 1) { pair_dca_axis_title = "DCA_{ee}^{XY} (#sigma)"; + } else if (cfgDCAType == 2) { + pair_dca_axis_title = "DCA_{ee}^{Z} (#sigma)"; } nbin_y = 20; min_y = -1.0; @@ -284,13 +310,13 @@ struct DileptonMC { const AxisSpec axis_pt_meson{ConfPtllBins, "p_{T} (GeV/c)"}; // for omega, phi meson pT spectra const AxisSpec axis_y_meson{nbin_y, min_y, max_y, "y"}; // rapidity of meson - const AxisSpec axis_dphi_ee{36, M_PI / 2., 3. / .2 * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll - const AxisSpec axis_deta_ee{40, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; // for kHFll - const AxisSpec axis_cos_theta_cs{10, 0.f, 1.f, "|cos(#theta_{CS})|"}; // for kPolarization, kUPC - const AxisSpec axis_phi_cs{18, 0.f, M_PI, "|#varphi_{CS}| (rad.)"}; // for kPolarization - const AxisSpec axis_aco{10, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC - const AxisSpec axis_asym_pt{10, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC - const AxisSpec axis_dphi_e_ee{18, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC + const AxisSpec axis_dphi_ee{36, -M_PI / 2., 3. / 2. * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll + const AxisSpec axis_deta_ee{40, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; // for kHFll + const AxisSpec axis_cos_theta_cs{10, 0.f, 1.f, "|cos(#theta_{CS})|"}; // for kPolarization, kUPC + const AxisSpec axis_phi_cs{18, 0.f, M_PI, "|#varphi_{CS}| (rad.)"}; // for kPolarization + const AxisSpec axis_aco{10, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC + const AxisSpec axis_asym_pt{10, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC + const AxisSpec axis_dphi_e_ee{18, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC // generated info fRegistry.add("Generated/sm/Pi0/hs", "gen. dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); @@ -331,9 +357,11 @@ struct DileptonMC { fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/NonPromptJPsi/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/PromptPsi2S/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/NonPromptPsi2S/"); + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - fRegistry.add("Pair/sm/Photon/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 0.1f}}, true); - fRegistry.add("Pair/sm/Pi0/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 0.1f}}, true); + fRegistry.add("Pair/sm/Photon/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); + fRegistry.add("Pair/sm/Photon/hMvsRxy", "m_{ee} vs. r_{xy};r_{xy}^{true} (cm);m_{ee} (GeV/c^{2})", kTH2F, {{100, 0, 100}, {100, 0.0f, 1.0f}}, true); + fRegistry.add("Pair/sm/Pi0/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); } fRegistry.add("Pair/ccbar/c2l_c2l/hadron_hadron/hs", "hs pair", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); @@ -351,6 +379,24 @@ struct DileptonMC { fRegistry.addClone("Pair/corr_bkg_eh/uls/", "Pair/corr_bkg_eh/lsmm/"); fRegistry.addClone("Pair/corr_bkg_eh/", "Pair/corr_bkg_hh/"); fRegistry.addClone("Pair/corr_bkg_eh/", "Pair/comb_bkg/"); + + if (cfgFillUnfolding) { + // for 2D unfolding + const AxisSpec axis_mass_gen{ConfMllBins, "m_{ll}^{gen} (GeV/c^{2})"}; + const AxisSpec axis_pt_gen{ConfPtllBins, "p_{T,ll}^{gen} (GeV/c)"}; + const AxisSpec axis_mass_rec{ConfMllBins, "m_{ll}^{rec} (GeV/c^{2})"}; + const AxisSpec axis_pt_rec{ConfPtllBins, "p_{T,ll}^{rec} (GeV/c)"}; + fRegistry.add("Unfold/lf/hsRM", "response matrix for unfolding", kTHnSparseD, {axis_mass_gen, axis_pt_gen, axis_mass_rec, axis_pt_rec}, true); + fRegistry.add("Unfold/lf/hMiss", "missing dilepton for unfolding", kTH2D, {axis_mass_gen, axis_pt_gen}, true); // e.g. true eta is in acceptance, but reconstructed eta is out of acceptance. + fRegistry.add("Unfold/lf/hFake", "fake dilepton for unfolding", kTH2D, {axis_mass_rec, axis_pt_rec}, true); // e.g. true eta is out of acceptance, but reconstructed eta is in acceptance. + fRegistry.addClone("Unfold/lf/", "Unfold/PromptJPsi/"); + fRegistry.addClone("Unfold/lf/", "Unfold/NonPromptJPsi/"); + fRegistry.addClone("Unfold/lf/", "Unfold/PromptPsi2S/"); + fRegistry.addClone("Unfold/lf/", "Unfold/NonPromptPsi2S/"); + fRegistry.addClone("Unfold/lf/", "Unfold/ccbar_uls/"); + fRegistry.addClone("Unfold/lf/", "Unfold/bbbar_uls/"); + fRegistry.addClone("Unfold/lf/", "Unfold/bbbar_ls/"); + } } float beamM1 = o2::constants::physics::MassProton; // mass of beam @@ -424,6 +470,7 @@ struct DileptonMC { if (fabs(d_bz) > 1e-5) { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } + o2::base::Propagator::initFieldFromGRP(&grpmag); mRunNumber = collision.runNumber(); // fitter.setBz(d_bz); // fwdfitter.setBz(d_bz); @@ -436,6 +483,7 @@ struct DileptonMC { if (!skipGRPOquery) grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; @@ -444,6 +492,7 @@ struct DileptonMC { if (!grpmag) { LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; } + o2::base::Propagator::initFieldFromGRP(grpmag); // Fetch magnetic field from ccdb for current collision d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; @@ -484,11 +533,13 @@ struct DileptonMC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); } - o2::ml::OnnxModel* eid_bdt = nullptr; + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; void DefineDielectronCut() { fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); @@ -498,13 +549,15 @@ struct DileptonMC { fDielectronCut.SetPairPtRange(dielectroncuts.cfg_min_pair_pt, dielectroncuts.cfg_max_pair_pt); fDielectronCut.SetPairYRange(dielectroncuts.cfg_min_pair_y, dielectroncuts.cfg_max_pair_y); fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma - fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); fDielectronCut.ApplyPrefilter(dielectroncuts.cfg_apply_pf); fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); + fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); // for track - fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); + fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, dielectroncuts.cfg_max_pt_track); fDielectronCut.SetTrackEtaRange(-dielectroncuts.cfg_max_eta_track, +dielectroncuts.cfg_max_eta_track); fDielectronCut.SetTrackPhiRange(-dielectroncuts.cfg_max_phi_track, +dielectroncuts.cfg_max_phi_track); fDielectronCut.SetMinNClustersTPC(dielectroncuts.cfg_min_ncluster_tpc); @@ -519,6 +572,8 @@ struct DileptonMC { fDielectronCut.SetTrackMaxDcaZ(dielectroncuts.cfg_max_dcaz); fDielectronCut.RequireITSibAny(dielectroncuts.cfg_require_itsib_any); fDielectronCut.RequireITSib1st(dielectroncuts.cfg_require_itsib_1st); + fDielectronCut.SetChi2TOF(0.0, dielectroncuts.cfg_max_chi2tof); + fDielectronCut.SetRelDiffPin(dielectroncuts.cfg_min_rel_diff_pin, dielectroncuts.cfg_max_rel_diff_pin); // for eID fDielectronCut.SetPIDScheme(dielectroncuts.cfg_pid_scheme); @@ -529,23 +584,31 @@ struct DileptonMC { fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); - if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDielectronCut - // o2::ml::OnnxModel* eid_bdt = new o2::ml::OnnxModel(); - eid_bdt = new o2::ml::OnnxModel(); + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + const std::vector labelsClasses = {"Signal", "Background"}; + const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + cutsMlArr[i][1] = 0.; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); if (dielectroncuts.loadModelsFromCCDB) { ccdbApi.init(ccdburl); - std::map metadata; - bool retrieveSuccessGamma = ccdbApi.retrieveBlob(dielectroncuts.BDTPathCCDB.value, ".", metadata, dielectroncuts.timestampCCDB.value, false, dielectroncuts.BDTLocalPathGamma.value); - if (retrieveSuccessGamma) { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); - } else { - LOG(fatal) << "Error encountered while fetching/loading the Gamma model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; - } + mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); } else { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); + mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); } + mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - fDielectronCut.SetPIDModel(eid_bdt); + fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -562,7 +625,7 @@ struct DileptonMC { // for track fDimuonCut.SetTrackType(dimuoncuts.cfg_track_type); - fDimuonCut.SetTrackPtRange(dimuoncuts.cfg_min_pt_track, 1e10f); + fDimuonCut.SetTrackPtRange(dimuoncuts.cfg_min_pt_track, dimuoncuts.cfg_max_pt_track); fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_eta_track, dimuoncuts.cfg_max_eta_track); fDimuonCut.SetTrackPhiRange(dimuoncuts.cfg_min_phi_track, dimuoncuts.cfg_max_phi_track); fDimuonCut.SetNClustersMFT(dimuoncuts.cfg_min_ncluster_mft, 10); @@ -629,22 +692,66 @@ struct DileptonMC { } } - template - bool fillTruePairInfo(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TMCParticles const& mcparticles) + template + bool fillTruePairInfo(TCollision const& collision, TMCCollisions const&, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TMCParticles const& mcparticles) { + auto t1mc = mcparticles.iteratorAt(t1.emmcparticleId()); + auto t2mc = mcparticles.iteratorAt(t2.emmcparticleId()); + bool is_from_same_mcevent = t1mc.emmceventId() == t2mc.emmceventId(); + + auto mccollision1 = t1mc.template emmcevent_as(); + auto mccollision2 = t2mc.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision1.getSubGeneratorId() != cfgEventGeneratorType) { + return false; + } + if (cfgEventGeneratorType >= 0 && mccollision2.getSubGeneratorId() != cfgEventGeneratorType) { + return false; + } + if (!isInAcceptance(t1mc) || !isInAcceptance(t2mc)) { + return false; + } + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } if (!cut.template IsSelectedPair(t1, t2, d_bz)) { return false; } + + if (dielectroncuts.cfg_x_to_go > 0.f) { + auto track_par_cov1 = getTrackParCov(t1); + track_par_cov1.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToX(track_par_cov1, dielectroncuts.cfg_x_to_go, d_bz, o2::base::PropagatorImpl::MAX_SIN_PHI, o2::base::PropagatorImpl::MAX_STEP, matCorr); + auto xyz1 = track_par_cov1.getXYZGlo(); + float z1 = xyz1.Z(); + // float eta1 = RecoDecay::eta(std::array{xyz1.X(), xyz1.Y(), xyz1.Z()}); + float phi1 = RecoDecay::phi(std::array{xyz1.X(), xyz1.Y()}); + o2::math_utils::bringTo02Pi(phi1); + + auto track_par_cov2 = getTrackParCov(t2); + track_par_cov2.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToX(track_par_cov2, dielectroncuts.cfg_x_to_go, d_bz, o2::base::PropagatorImpl::MAX_SIN_PHI, o2::base::PropagatorImpl::MAX_STEP, matCorr); + auto xyz2 = track_par_cov2.getXYZGlo(); + float z2 = xyz2.Z(); + // float eta2 = RecoDecay::eta(std::array{xyz2.X(), xyz2.Y(), xyz2.Z()}); + float phi2 = RecoDecay::phi(std::array{xyz2.X(), xyz2.Y()}); + o2::math_utils::bringTo02Pi(phi2); + + float dz_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? z1 - z2 : z2 - z1; + float dphi_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? phi1 - phi2 : phi2 - phi1; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + if (dielectroncuts.cfg_apply_dzrdphi_geom && std::pow(dz_geom / dielectroncuts.cfg_min_dz_geom, 2) + std::pow(rdphi_geom / dielectroncuts.cfg_min_rdphi_geom, 2) < 1.f) { + return false; + } + } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; @@ -656,6 +763,61 @@ struct DileptonMC { // float pca = 999.f, lxy = 999.f; // in unit of cm // o2::aod::pwgem::dilepton::utils::pairutil::isSVFound(fitter, collision, t1, t2, pca, lxy); + float pt1 = 0.f, eta1 = 0.f, phi1 = 0.f, pt2 = 0.f, eta2 = 0.f, phi2 = 0.f; + if constexpr (isSmeared) { + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + pt1 = t1mc.ptSmeared(); + eta1 = t1mc.etaSmeared(); + phi1 = t1mc.phiSmeared(); + pt2 = t2mc.ptSmeared(); + eta2 = t2mc.etaSmeared(); + phi2 = t2mc.phiSmeared(); + } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) { + pt1 = t1mc.ptSmeared_sa_muon(); + eta1 = t1mc.etaSmeared_sa_muon(); + phi1 = t1mc.phiSmeared_sa_muon(); + pt2 = t2mc.ptSmeared_sa_muon(); + eta2 = t2mc.etaSmeared_sa_muon(); + phi2 = t2mc.phiSmeared_sa_muon(); + } else if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack)) { + pt1 = t1mc.ptSmeared_gl_muon(); + eta1 = t1mc.etaSmeared_gl_muon(); + phi1 = t1mc.phiSmeared_gl_muon(); + pt2 = t2mc.ptSmeared_gl_muon(); + eta2 = t2mc.etaSmeared_gl_muon(); + phi2 = t2mc.phiSmeared_gl_muon(); + } else { + pt1 = t1mc.pt(); + eta1 = t1mc.eta(); + phi1 = t1mc.phi(); + pt2 = t2mc.pt(); + eta2 = t2mc.eta(); + phi2 = t2mc.phi(); + } + } + } else { + pt1 = t1mc.pt(); + eta1 = t1mc.eta(); + phi1 = t1mc.phi(); + pt2 = t2mc.pt(); + eta2 = t2mc.eta(); + phi2 = t2mc.phi(); + } + + ROOT::Math::PtEtaPhiMVector v1mc(pt1, eta1, phi1, leptonM1); + ROOT::Math::PtEtaPhiMVector v2mc(pt2, eta2, phi2, leptonM2); + ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; + + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if (v12mc.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12mc.Rapidity()) { + return false; + } + } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + if (v12mc.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12mc.Rapidity()) { + return false; + } + } float weight = 1.f; if (cfgApplyWeightTTCA) { @@ -667,26 +829,22 @@ struct DileptonMC { ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), leptonM2); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float dca_t1 = 999.f, dca_t2 = 999.f, pair_dca = 999.f; + float pair_dca = 999.f; if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - dca_t1 = dca3DinSigma(t1); - dca_t2 = dca3DinSigma(t2); - pair_dca = std::sqrt((dca_t1 * dca_t1 + dca_t2 * dca_t2) / 2.); - if (cfgUseDCAxy) { - dca_t1 = t1.dcaXY() / std::sqrt(t1.cYY()); - dca_t2 = t2.dcaXY() / std::sqrt(t2.cYY()); - pair_dca = std::sqrt((dca_t1 * dca_t1 + dca_t2 * dca_t2) / 2.); + pair_dca = pairDCAQuadSum(dca3DinSigma(t1), dca3DinSigma(t2)); + if (cfgDCAType == 1) { + pair_dca = pairDCAQuadSum(dcaXYinSigma(t1), dcaXYinSigma(t2)); + } else if (cfgDCAType == 2) { + pair_dca = pairDCAQuadSum(dcaZinSigma(t1), dcaZinSigma(t2)); } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - dca_t1 = fwdDcaXYinSigma(t1); - dca_t2 = fwdDcaXYinSigma(t2); - pair_dca = std::sqrt((dca_t1 * dca_t1 + dca_t2 * dca_t2) / 2.); + pair_dca = pairDCAQuadSum(fwdDcaXYinSigma(t1), fwdDcaXYinSigma(t2)); } float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), d_bz); + float deta = v1.Eta() - v2.Eta(); float dphi = v1.Phi() - v2.Phi(); o2::math_utils::bringToPMPi(dphi); - float deta = v1.Eta() - v2.Eta(); float aco = 1.f - abs(dphi) / M_PI; float asym = abs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); @@ -697,10 +855,6 @@ struct DileptonMC { o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); o2::math_utils::bringToPMPi(phiCS); - auto t1mc = mcparticles.iteratorAt(t1.emmcparticleId()); - auto t2mc = mcparticles.iteratorAt(t2.emmcparticleId()); - bool is_from_same_mcevent = t1mc.emmceventId() == t2mc.emmceventId(); - if ((FindCommonMotherFrom2ProngsWithoutPDG(t1mc, t2mc) > 0 || IsHF(t1mc, t2mc, mcparticles) > 0) && is_from_same_mcevent) { // for bkg study if (abs(t1mc.pdgCode()) != pdg_lepton || abs(t2mc.pdgCode()) != pdg_lepton) { // hh or eh correlated bkg if (abs(t1mc.pdgCode()) != pdg_lepton && abs(t2mc.pdgCode()) != pdg_lepton) { // hh correlated bkg @@ -795,13 +949,14 @@ struct DileptonMC { default: break; } - } else if (!(t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && !(t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { switch (abs(mcmother.pdgCode())) { case 22: fRegistry.fill(HIST("Pair/sm/Photon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/Photon/hMvsPhiV"), phiv, v12.M()); + float rxy_gen = std::sqrt(std::pow(t1mc.vx(), 2) + std::pow(t1mc.vy(), 2)); + fRegistry.fill(HIST("Pair/sm/Photon/hMvsRxy"), rxy_gen, v12.M()); } break; default: @@ -901,21 +1056,30 @@ struct DileptonMC { SliceCache cache; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && dielectroncuts.cfg_min_phi_track < o2::aod::track::phi && o2::aod::track::phi < dielectroncuts.cfg_max_phi_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; + Filter trackFilter_electron = dielectroncuts.cfg_min_phi_track < o2::aod::track::phi && o2::aod::track::phi < dielectroncuts.cfg_max_phi_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; Filter pidFilter_electron = (dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl) && (o2::aod::pidtpc::tpcNSigmaPi < dielectroncuts.cfg_min_TPCNsigmaPi || dielectroncuts.cfg_max_TPCNsigmaPi < o2::aod::pidtpc::tpcNSigmaPi); Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); + Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLSGeom))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLSGeom))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULSGeom))) > static_cast(0), (o2::aod::emprimaryelectron::pfbpi0 & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULSGeom))) <= static_cast(0), true), + o2::aod::emprimaryelectron::pfbpi0 >= static_cast(0)); Preslice perCollision_muon = aod::emprimarymuon::emeventId; - Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_pt_track < o2::aod::fwdtrack::pt && dimuoncuts.cfg_min_eta_track < o2::aod::fwdtrack::eta && o2::aod::fwdtrack::eta < dimuoncuts.cfg_max_eta_track && dimuoncuts.cfg_min_phi_track < o2::aod::fwdtrack::phi && o2::aod::fwdtrack::phi < dimuoncuts.cfg_max_phi_track; + Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_phi_track < o2::aod::fwdtrack::phi && o2::aod::fwdtrack::phi < dimuoncuts.cfg_max_phi_track; Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; - Filter collisionFilter_occupancy = eventcuts.cfgOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgOccupancyMax; + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; - template - void runTruePairing(TCollisions const& collisions, TMCLeptons const& posTracks, TMCLeptons const& negTracks, TPreslice const& perCollision, TCut const& cut, TMCCollisions const&, TMCParticles const& mcparticles) + template + void runTruePairing(TCollisions const& collisions, TMCLeptons const& posTracks, TMCLeptons const& negTracks, TPreslice const& perCollision, TCut const& cut, TMCCollisions const& mccollisions, TMCParticles const& mcparticles) { for (auto& collision : collisions) { initCCDB(collision); @@ -924,99 +1088,63 @@ struct DileptonMC { continue; } - // auto mccollision = collision.template emmcevent_as(); - // if (cfgEventGeneratorType >= 0 && mccollision.getSubGeneratorId() != cfgEventGeneratorType) { - // continue; - // } - + o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<0, -1>(&fRegistry, collision); if (!fEMEventCut.IsSelected(collision)) { continue; } + o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<1, -1>(&fRegistry, collision); + fRegistry.fill(HIST("Event/before/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted + fRegistry.fill(HIST("Event/after/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted auto posTracks_per_coll = posTracks.sliceByCached(perCollision, collision.globalIndex(), cache); auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); // LOGF(info, "centrality = %f , posTracks_per_coll.size() = %d, negTracks_per_coll.size() = %d", centralities[cfgCentEstimator], posTracks_per_coll.size(), negTracks_per_coll.size()); for (auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS - auto mcpos = mcparticles.iteratorAt(pos.emmcparticleId()); - auto mccollision_from_pos = mcpos.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_pos.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - auto mcneg = mcparticles.iteratorAt(neg.emmcparticleId()); - auto mccollision_from_neg = mcneg.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_neg.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - - fillTruePairInfo(collision, pos, neg, cut, mcparticles); + fillTruePairInfo(collision, mccollisions, pos, neg, cut, mcparticles); } // end of ULS pair loop for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ - auto mcpos1 = mcparticles.iteratorAt(pos1.emmcparticleId()); - auto mccollision_from_pos1 = mcpos1.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_pos1.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - auto mcpos2 = mcparticles.iteratorAt(pos2.emmcparticleId()); - auto mccollision_from_pos2 = mcpos2.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_pos2.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - fillTruePairInfo(collision, pos1, pos2, cut, mcparticles); + fillTruePairInfo(collision, mccollisions, pos1, pos2, cut, mcparticles); } // end of LS++ pair loop for (auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- - auto mcneg1 = mcparticles.iteratorAt(neg1.emmcparticleId()); - auto mccollision_from_neg1 = mcneg1.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_neg1.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - auto mcneg2 = mcparticles.iteratorAt(neg2.emmcparticleId()); - auto mccollision_from_neg2 = mcneg2.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_neg2.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - fillTruePairInfo(collision, neg1, neg2, cut, mcparticles); + fillTruePairInfo(collision, mccollisions, neg1, neg2, cut, mcparticles); } // end of LS-- pair loop } // end of collision loop - - } // end of process + } template - void runGenInfo(TCollisions const& collisions, TMCCollisions const&, TMCLeptons const& posTracksMC, TMCLeptons const& negTracksMC, TMCParticles const& mcparticles) + void runGenInfo(TCollisions const& collisions, TMCCollisions const& mccollisions, TMCLeptons const& posTracksMC, TMCLeptons const& negTracksMC, TMCParticles const& mcparticles) { - // loop over mc stack and fill histograms for pure MC truth signals - // all MC tracks which belong to the MC event corresponding to the current reconstructed event + for (auto& mccollision : mccollisions) { + if (cfgEventGeneratorType >= 0 && mccollision.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } - std::vector used_mccollisionIds; // used mc collisionIds - used_mccollisionIds.reserve(collisions.size()); + auto rec_colls_per_mccoll = collisions.sliceBy(recColperMcCollision, mccollision.globalIndex()); + uint32_t maxNumContrib = 0; + int rec_col_globalIndex = -999; + for (auto& rec_col : rec_colls_per_mccoll) { + if (rec_col.numContrib() > maxNumContrib) { + rec_col_globalIndex = rec_col.globalIndex(); + maxNumContrib = rec_col.numContrib(); // assign mc collision to collision where the number of contibutor is lager. LF/MM recommendation + } + } - for (auto& collision : collisions) { - auto mccollision = collision.template emmcevent_as(); - if (std::find(used_mccollisionIds.begin(), used_mccollisionIds.end(), mccollision.globalIndex()) != used_mccollisionIds.end()) { - // LOGF(info, "same mc collision is repeated. continue;"); + if (rec_colls_per_mccoll.size() < 1) { continue; } - used_mccollisionIds.emplace_back(mccollision.globalIndex()); + auto collision = collisions.rawIteratorAt(rec_col_globalIndex); float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } - - if (cfgEventGeneratorType >= 0 && mccollision.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - - o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<0, -1>(&fRegistry, collision); if (!fEMEventCut.IsSelected(collision)) { continue; } - o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<1, -1>(&fRegistry, collision); - fRegistry.fill(HIST("Event/before/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted - fRegistry.fill(HIST("Event/after/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted auto posTracks_per_coll = posTracksMC.sliceByCachedUnsorted(aod::emmcparticle::emmceventId, mccollision.globalIndex(), cache); auto negTracks_per_coll = negTracksMC.sliceByCachedUnsorted(aod::emmcparticle::emmceventId, mccollision.globalIndex(), cache); @@ -1496,35 +1624,60 @@ struct DileptonMC { } } // end of true LS++ pair loop } // end of collision loop - used_mccollisionIds.clear(); - used_mccollisionIds.shrink_to_fit(); } - template + template bool isPairOK(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.template IsSelectedPair(t1, t2, d_bz)) { + if (!cut.template IsSelectedPair(t1, t2, d_bz)) { return false; } + if (dielectroncuts.cfg_x_to_go > 0.f) { + auto track_par_cov1 = getTrackParCov(t1); + track_par_cov1.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToX(track_par_cov1, dielectroncuts.cfg_x_to_go, d_bz, o2::base::PropagatorImpl::MAX_SIN_PHI, o2::base::PropagatorImpl::MAX_STEP, matCorr); + auto xyz1 = track_par_cov1.getXYZGlo(); + float z1 = xyz1.Z(); + // float eta1 = RecoDecay::eta(std::array{xyz1.X(), xyz1.Y(), xyz1.Z()}); + float phi1 = RecoDecay::phi(std::array{xyz1.X(), xyz1.Y()}); + o2::math_utils::bringTo02Pi(phi1); + + auto track_par_cov2 = getTrackParCov(t2); + track_par_cov2.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToX(track_par_cov2, dielectroncuts.cfg_x_to_go, d_bz, o2::base::PropagatorImpl::MAX_SIN_PHI, o2::base::PropagatorImpl::MAX_STEP, matCorr); + auto xyz2 = track_par_cov2.getXYZGlo(); + float z2 = xyz2.Z(); + // float eta2 = RecoDecay::eta(std::array{xyz2.X(), xyz2.Y(), xyz2.Z()}); + float phi2 = RecoDecay::phi(std::array{xyz2.X(), xyz2.Y()}); + o2::math_utils::bringTo02Pi(phi2); + + float dz_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? z1 - z2 : z2 - z1; + float dphi_geom = t1.sign() * t1.pt() > t2.sign() * t2.pt() ? phi1 - phi2 : phi2 - phi1; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + if (dielectroncuts.cfg_apply_dzrdphi_geom && std::pow(dz_geom / dielectroncuts.cfg_min_dz_geom, 2) + std::pow(rdphi_geom / dielectroncuts.cfg_min_rdphi_geom, 2) < 1.f) { + return false; + } + } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (!cut.template IsSelectedPair(t1, t2)) { + if (!cut.template IsSelectedPair(t1, t2)) { return false; } } @@ -1642,6 +1795,345 @@ struct DileptonMC { passed_pairIds.shrink_to_fit(); } + template + bool isPairInAcc(TTrack const& t1, TTrack const& t2) + { + ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if ((t1.pt() < dielectroncuts.cfg_min_pt_track || dielectroncuts.cfg_max_pt_track < t1.pt()) || (t2.pt() < dielectroncuts.cfg_min_pt_track || dielectroncuts.cfg_max_pt_track < t2.pt())) { + return false; + } + if ((t1.eta() < dielectroncuts.cfg_min_eta_track || dielectroncuts.cfg_max_eta_track < t1.eta()) || (t2.eta() < dielectroncuts.cfg_min_eta_track || dielectroncuts.cfg_max_eta_track < t2.eta())) { + return false; + } + if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { + return false; + } + return true; + } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + if ((t1.pt() < dimuoncuts.cfg_min_pt_track || dimuoncuts.cfg_max_pt_track < t1.pt()) || (t2.pt() < dimuoncuts.cfg_min_pt_track || dimuoncuts.cfg_max_pt_track < t2.pt())) { + return false; + } + if ((t1.eta() < dimuoncuts.cfg_min_eta_track || dimuoncuts.cfg_max_eta_track < t1.eta()) || (t2.eta() < dimuoncuts.cfg_min_eta_track || dimuoncuts.cfg_max_eta_track < t2.eta())) { + return false; + } + if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { + return false; + } + return true; + } else { + return false; + } + return true; + } + + template + void fillUnfolding(TCollisions const& collisions, TTracks1 const& posTracks, TTracks2 const& negTracks, TPresilce const& perCollision, TCut const& cut, TMCCollisions const&, TMCParticles const& mcparticles) + { + for (auto& collision : collisions) { + initCCDB(collision); + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + continue; + } + + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + + auto posTracks_per_coll = posTracks.sliceByCached(perCollision, collision.globalIndex(), cache); // reconstructed pos tracks + auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); // reconstructed neg tracks + + for (auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS + auto mcpos = mcparticles.iteratorAt(pos.emmcparticleId()); + auto mccollision_from_pos = mcpos.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_pos.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + + auto mcneg = mcparticles.iteratorAt(neg.emmcparticleId()); + auto mccollision_from_neg = mcneg.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_neg.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + + if ((abs(mcpos.pdgCode()) != pdg_lepton || abs(mcneg.pdgCode()) != pdg_lepton) || (mcpos.emmceventId() != mcneg.emmceventId())) { + continue; + } + if (mcpos.pdgCode() * mcneg.pdgCode() > 0) { // ULS + continue; + } + if (!((mcpos.isPhysicalPrimary() || mcpos.producedByGenerator()) && (mcneg.isPhysicalPrimary() || mcneg.producedByGenerator()))) { + continue; + } + int mother_id = FindLF(mcpos, mcneg, mcparticles); + int hfee_type = IsHF(mcpos, mcneg, mcparticles); + if (mother_id < 0 && hfee_type < 0) { + continue; + } + + if (!isPairOK(collision, pos, neg, cut)) { // without acceptance + continue; + } + + ROOT::Math::PtEtaPhiMVector v1rec(pos.pt(), pos.eta(), pos.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2rec(neg.pt(), neg.eta(), neg.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12rec = v1rec + v2rec; + + ROOT::Math::PtEtaPhiMVector v1mc(mcpos.pt(), mcpos.eta(), mcpos.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2mc(mcneg.pt(), mcneg.eta(), mcneg.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; + float weight = 1.f; + if (cfgApplyWeightTTCA) { + weight = map_weight[std::make_pair(pos.globalIndex(), neg.globalIndex())]; + } + + if (mother_id > -1) { + auto mcmother = mcparticles.iteratorAt(mother_id); + if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { + switch (abs(mcmother.pdgCode())) { + case 111: + case 221: + case 331: + case 113: + case 223: + case 333: { + if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/lf/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/lf/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/lf/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + break; + } + case 443: { + if (IsFromBeauty(mcmother, mcparticles) > 0) { + if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/NonPromptJPsi/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/NonPromptJPsi/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/NonPromptJPsi/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + } else { + if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/PromptJPsi/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/PromptJPsi/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/PromptJPsi/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + } + break; + } + case 100443: { + if (IsFromBeauty(mcmother, mcparticles) > 0) { + if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/NonPromptPsi2S/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/NonPromptPsi2S/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/NonPromptPsi2S/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + } else { + if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/PromptPsi2S/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/PromptPsi2S/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/PromptPsi2S/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + } + break; + } + default: + break; + } + } + } else if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): { + if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/ccbar_uls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/ccbar_uls/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/ccbar_uls/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + break; + } + case static_cast(EM_HFeeType::kBe_Be): + case static_cast(EM_HFeeType::kBCe_BCe): + case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS + if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/bbbar_uls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/bbbar_uls/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { + fRegistry.fill(HIST("Unfold/bbbar_uls/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + break; + } + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + LOGF(info, "You should not see kBCe_Be_DiffB in ULS. Good luck."); + break; + default: + break; + } + } + } // end of ULS pairing + + for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ + auto mcpos1 = mcparticles.iteratorAt(pos1.emmcparticleId()); + auto mccollision_from_pos1 = mcpos1.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_pos1.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + auto mcpos2 = mcparticles.iteratorAt(pos2.emmcparticleId()); + auto mccollision_from_pos2 = mcpos2.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_pos2.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + + if ((abs(mcpos1.pdgCode()) != pdg_lepton || abs(mcpos2.pdgCode()) != pdg_lepton) || (mcpos1.emmceventId() != mcpos2.emmceventId())) { + continue; + } + if (mcpos1.pdgCode() * mcpos2.pdgCode() < 0) { // LS + continue; + } + if (!((mcpos1.isPhysicalPrimary() || mcpos1.producedByGenerator()) && (mcpos2.isPhysicalPrimary() || mcpos2.producedByGenerator()))) { + continue; + } + int hfee_type = IsHF(mcpos1, mcpos2, mcparticles); + if (hfee_type < 0) { + continue; + } + + if (!isPairOK(collision, pos1, pos2, cut)) { // without acceptance + continue; + } + + ROOT::Math::PtEtaPhiMVector v1rec(pos1.pt(), pos1.eta(), pos1.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2rec(pos2.pt(), pos2.eta(), pos2.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12rec = v1rec + v2rec; + + ROOT::Math::PtEtaPhiMVector v1mc(mcpos1.pt(), mcpos1.eta(), mcpos1.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2mc(mcpos2.pt(), mcpos2.eta(), mcpos2.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; + float weight = 1.f; + if (cfgApplyWeightTTCA) { + weight = map_weight[std::make_pair(pos1.globalIndex(), pos2.globalIndex())]; + } + + if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + LOGF(info, "You should not see kCe_Ce in LS. Good luck."); + break; + case static_cast(EM_HFeeType::kBe_Be): + LOGF(info, "You should not see kBe_Be in LS. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + LOGF(info, "You should not see kBCe_BCe in LS. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS + LOGF(info, "You should not see kBCe_Be_SameB in LS. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS + if (isPairInAcc(pos1, pos2) && isPairInAcc(mcpos1, mcpos2)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/bbbar_ls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(pos1, pos2) && isPairInAcc(mcpos1, mcpos2)) { + fRegistry.fill(HIST("Unfold/bbbar_ls/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(pos1, pos2) && !isPairInAcc(mcpos1, mcpos2)) { + fRegistry.fill(HIST("Unfold/bbbar_ls/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + break; + } + default: + break; + } + } + } // end of LS++ pairing + + for (auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- + auto mcneg1 = mcparticles.iteratorAt(neg1.emmcparticleId()); + auto mccollision_from_neg1 = mcneg1.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_neg1.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + auto mcneg2 = mcparticles.iteratorAt(neg2.emmcparticleId()); + auto mccollision_from_neg2 = mcneg2.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_neg2.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + if (!isPairOK(collision, neg1, neg2, cut)) { // without acceptance + continue; + } + if ((abs(mcneg1.pdgCode()) != pdg_lepton || abs(mcneg2.pdgCode()) != pdg_lepton) || (mcneg1.emmceventId() != mcneg2.emmceventId())) { + continue; + } + if (mcneg1.pdgCode() * mcneg2.pdgCode() < 0) { // LS + continue; + } + if (!((mcneg1.isPhysicalPrimary() || mcneg1.producedByGenerator()) && (mcneg2.isPhysicalPrimary() || mcneg2.producedByGenerator()))) { + continue; + } + int hfee_type = IsHF(mcneg1, mcneg2, mcparticles); + if (hfee_type < 0) { + continue; + } + + if (!isPairOK(collision, neg1, neg2, cut)) { // without acceptance + continue; + } + + ROOT::Math::PtEtaPhiMVector v1rec(neg1.pt(), neg1.eta(), neg1.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2rec(neg2.pt(), neg2.eta(), neg2.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12rec = v1rec + v2rec; + + ROOT::Math::PtEtaPhiMVector v1mc(mcneg1.pt(), mcneg1.eta(), mcneg1.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2mc(mcneg2.pt(), mcneg2.eta(), mcneg2.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; + float weight = 1.f; + if (cfgApplyWeightTTCA) { + weight = map_weight[std::make_pair(neg1.globalIndex(), neg2.globalIndex())]; + } + + if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + LOGF(info, "You should not see kCe_Ce in LS. Good luck."); + break; + case static_cast(EM_HFeeType::kBe_Be): + LOGF(info, "You should not see kBe_Be in LS. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + LOGF(info, "You should not see kBCe_BCe in LS. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS + LOGF(info, "You should not see kBCe_Be_SameB in LS. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS + if (isPairInAcc(neg1, neg2) && isPairInAcc(mcneg1, mcneg2)) { // both rec and mc info are in acceptance. + fRegistry.fill(HIST("Unfold/bbbar_ls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (!isPairInAcc(neg1, neg2) && isPairInAcc(mcneg1, mcneg2)) { + fRegistry.fill(HIST("Unfold/bbbar_ls/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (isPairInAcc(neg1, neg2) && !isPairInAcc(mcneg1, mcneg2)) { + fRegistry.fill(HIST("Unfold/bbbar_ls/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + break; + } + default: + break; + } + } + } // end of LS-- pairing + } // end of collision loop + } + Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); // reconstructed tracks Partition negative_electrons = o2::aod::emprimaryelectron::sign < int8_t(0); // reconstructed tracks Partition positive_muons = o2::aod::emprimarymuon::sign > int8_t(0); // reconstructed tracks @@ -1653,6 +2145,7 @@ struct DileptonMC { Partition negative_muonsMC = o2::aod::mcparticle::pdgCode == 13; // mu- PresliceUnsorted perMcCollision = aod::emmcparticle::emmceventId; PresliceUnsorted perMcCollision_vm = aod::emmcgenvectormeson::emmceventId; + PresliceUnsorted recColperMcCollision = aod::emmceventlabel::emmceventId; void processAnalysis(FilteredMyCollisions const& collisions, aod::EMMCEvents const& mccollisions, aod::EMMCParticles const& mcparticles, TLeptons const& leptons) { @@ -1660,14 +2153,20 @@ struct DileptonMC { if (cfgApplyWeightTTCA) { fillPairWeightMap(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles); } - runTruePairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, mccollisions, mcparticles); + runTruePairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, mccollisions, mcparticles); runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); + if (cfgFillUnfolding) { + fillUnfolding(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, mccollisions, mcparticles); + } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (cfgApplyWeightTTCA) { fillPairWeightMap(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles); } - runTruePairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, mccollisions, mcparticles); + runTruePairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, mccollisions, mcparticles); runGenInfo(collisions, mccollisions, positive_muonsMC, negative_muonsMC, mcparticles); + if (cfgFillUnfolding) { + fillUnfolding(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, mccollisions, mcparticles); + } } map_weight.clear(); } @@ -1684,14 +2183,20 @@ struct DileptonMC { if (cfgApplyWeightTTCA) { fillPairWeightMap(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles_smeared); } - runTruePairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, mccollisions, mcparticles_smeared); + runTruePairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, mccollisions, mcparticles_smeared); runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); + if (cfgFillUnfolding) { + fillUnfolding(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, mccollisions, mcparticles_smeared); + } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (cfgApplyWeightTTCA) { fillPairWeightMap(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles_smeared); } - runTruePairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, mccollisions, mcparticles_smeared); + runTruePairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, mccollisions, mcparticles_smeared); runGenInfo(collisions, mccollisions, positive_muonsMC_smeared, negative_muonsMC_smeared, mcparticles_smeared); + if (cfgFillUnfolding) { + fillUnfolding(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, mccollisions, mcparticles_smeared); + } } map_weight.clear(); } diff --git a/PWGEM/Dilepton/Core/DimuonCut.h b/PWGEM/Dilepton/Core/DimuonCut.h index b6a1c1722b1..b13569387da 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.h +++ b/PWGEM/Dilepton/Core/DimuonCut.h @@ -79,7 +79,7 @@ class DimuonCut : public TNamed return true; } - template + template bool IsSelectedPair(TTrack1 const& t1, TTrack2 const& t2) const { ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon); @@ -94,11 +94,7 @@ class DimuonCut : public TNamed return false; } - if (v12.Pt() < mMinPairPt || mMaxPairPt < v12.Pt()) { - return false; - } - - if (v12.Rapidity() < mMinPairY || mMaxPairY < v12.Rapidity()) { + if (!dont_require_rapidity && (v12.Rapidity() < mMinPairY || mMaxPairY < v12.Rapidity())) { return false; } @@ -116,16 +112,56 @@ class DimuonCut : public TNamed return true; } - template + template bool IsSelectedTrack(TTrack const& track) const { if (!IsSelectedTrack(track, DimuonCuts::kTrackType)) { return false; } - if (!IsSelectedTrack(track, DimuonCuts::kTrackPtRange)) { + + if (!dont_require_pteta) { + if (!IsSelectedTrack(track, DimuonCuts::kTrackPtRange)) { + return false; + } + if (!IsSelectedTrack(track, DimuonCuts::kTrackEtaRange)) { + return false; + } + } + if (!IsSelectedTrack(track, DimuonCuts::kTrackPhiRange)) { + return false; + } + if (!IsSelectedTrack(track, DimuonCuts::kDCAxy)) { + return false; + } + if (track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && !IsSelectedTrack(track, DimuonCuts::kMFTNCls)) { + return false; + } + if (!IsSelectedTrack(track, DimuonCuts::kMCHMIDNCls)) { + return false; + } + if (!IsSelectedTrack(track, DimuonCuts::kChi2)) { + return false; + } + if (track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && !IsSelectedTrack(track, DimuonCuts::kMatchingChi2MCHMFT)) { + return false; + } + if (!IsSelectedTrack(track, DimuonCuts::kMatchingChi2MCHMID)) { + return false; + } + if (!IsSelectedTrack(track, DimuonCuts::kPDCA)) { return false; } - if (!IsSelectedTrack(track, DimuonCuts::kTrackEtaRange)) { + if (!IsSelectedTrack(track, DimuonCuts::kRabs)) { + return false; + } + + return true; + } + + template + bool IsSelectedTrackWoPtEta(TTrack const& track) const + { + if (!IsSelectedTrack(track, DimuonCuts::kTrackType)) { return false; } if (!IsSelectedTrack(track, DimuonCuts::kTrackPhiRange)) { diff --git a/PWGEM/Dilepton/Core/EMEventCut.cxx b/PWGEM/Dilepton/Core/EMEventCut.cxx index 64fef030c21..07bdaf8cb52 100644 --- a/PWGEM/Dilepton/Core/EMEventCut.cxx +++ b/PWGEM/Dilepton/Core/EMEventCut.cxx @@ -37,13 +37,6 @@ void EMEventCut::SetZvtxRange(float min, float max) LOG(info) << "EM Event Cut, set z vtx range: " << mMinZvtx << " - " << mMaxZvtx; } -void EMEventCut::SetOccupancyRange(int min, int max) -{ - mMinOccupancy = min; - mMaxOccupancy = max; - LOG(info) << "EM Event Cut, set occupancy range: " << mMinOccupancy << " - " << mMaxOccupancy; -} - void EMEventCut::SetRequireNoTFB(bool flag) { mRequireNoTFB = flag; @@ -79,8 +72,26 @@ void EMEventCut::SetRequireNoCollInTimeRangeStandard(bool flag) mRequireNoCollInTimeRangeStandard = flag; LOG(info) << "EM Event Cut, require No collision in time range standard: " << mRequireNoCollInTimeRangeStandard; } -void EMEventCut::SetRequireNoCollInTimeRangeNarrow(bool flag) + +void EMEventCut::SetRequireNoCollInTimeRangeStrict(bool flag) +{ + mRequireNoCollInTimeRangeStrict = flag; + LOG(info) << "EM Event Cut, require No collision in time range strict: " << mRequireNoCollInTimeRangeStrict; +} +void EMEventCut::SetRequireNoCollInITSROFStandard(bool flag) +{ + mRequireNoCollInITSROFStandard = flag; + LOG(info) << "EM Event Cut, require No collision in ITS TOF standard: " << mRequireNoCollInITSROFStandard; +} + +void EMEventCut::SetRequireNoCollInITSROFStrict(bool flag) +{ + mRequireNoCollInITSROFStrict = flag; + LOG(info) << "EM Event Cut, require No collision in ITS ROF strict: " << mRequireNoCollInITSROFStrict; +} + +void EMEventCut::SetRequireNoHighMultCollInPrevRof(bool flag) { - mRequireNoCollInTimeRangeNarrow = flag; - LOG(info) << "EM Event Cut, require No collision in time range narrow: " << mRequireNoCollInTimeRangeNarrow; + mRequireNoHighMultCollInPrevRof = flag; + LOG(info) << "EM Event Cut, require No HM collision in previous ITS ROF: " << mRequireNoHighMultCollInPrevRof; } diff --git a/PWGEM/Dilepton/Core/EMEventCut.h b/PWGEM/Dilepton/Core/EMEventCut.h index b8af681d3dc..a5636c13630 100644 --- a/PWGEM/Dilepton/Core/EMEventCut.h +++ b/PWGEM/Dilepton/Core/EMEventCut.h @@ -38,9 +38,11 @@ class EMEventCut : public TNamed kNoSameBunchPileup, kIsVertexITSTPC, kIsGoodZvtxFT0vsPV, - kOccupancy, kNoCollInTimeRangeStandard, - kNoCollInTimeRangeNarrow, + kNoCollInTimeRangeStrict, + kNoCollInITSROFStandard, + kNoCollInITSROFStrict, + kNoHighMultCollInPrevRof, kNCuts }; @@ -71,13 +73,19 @@ class EMEventCut : public TNamed if (mRequireGoodZvtxFT0vsPV && !IsSelected(collision, EMEventCuts::kIsGoodZvtxFT0vsPV)) { return false; } - if (!IsSelected(collision, EMEventCuts::kOccupancy)) { + if (mRequireNoCollInTimeRangeStandard && !IsSelected(collision, EMEventCuts::kNoCollInTimeRangeStandard)) { return false; } - if (mRequireNoCollInTimeRangeStandard && !IsSelected(collision, EMEventCuts::kNoCollInTimeRangeStandard)) { + if (mRequireNoCollInTimeRangeStrict && !IsSelected(collision, EMEventCuts::kNoCollInTimeRangeStrict)) { + return false; + } + if (mRequireNoCollInITSROFStandard && !IsSelected(collision, EMEventCuts::kNoCollInITSROFStandard)) { + return false; + } + if (mRequireNoCollInITSROFStrict && !IsSelected(collision, EMEventCuts::kNoCollInITSROFStrict)) { return false; } - if (mRequireNoCollInTimeRangeNarrow && !IsSelected(collision, EMEventCuts::kNoCollInTimeRangeNarrow)) { + if (mRequireNoHighMultCollInPrevRof && !IsSelected(collision, EMEventCuts::kNoHighMultCollInPrevRof)) { return false; } return true; @@ -111,14 +119,20 @@ class EMEventCut : public TNamed case EMEventCuts::kIsGoodZvtxFT0vsPV: return collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV); - case EMEventCuts::kOccupancy: - return mMinOccupancy <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < mMaxOccupancy; - case EMEventCuts::kNoCollInTimeRangeStandard: return collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard); - case EMEventCuts::kNoCollInTimeRangeNarrow: - return collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow); + case EMEventCuts::kNoCollInTimeRangeStrict: + return collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict); + + case EMEventCuts::kNoCollInITSROFStandard: + return collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard); + + case EMEventCuts::kNoCollInITSROFStrict: + return collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict); + + case EMEventCuts::kNoHighMultCollInPrevRof: + return collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof); default: return true; @@ -129,27 +143,31 @@ class EMEventCut : public TNamed void SetRequireSel8(bool flag); void SetRequireFT0AND(bool flag); void SetZvtxRange(float min, float max); - void SetOccupancyRange(int min, int max); void SetRequireNoTFB(bool flag); void SetRequireNoITSROFB(bool flag); void SetRequireNoSameBunchPileup(bool flag); void SetRequireVertexITSTPC(bool flag); void SetRequireGoodZvtxFT0vsPV(bool flag); void SetRequireNoCollInTimeRangeStandard(bool flag); - void SetRequireNoCollInTimeRangeNarrow(bool flag); + void SetRequireNoCollInTimeRangeStrict(bool flag); + void SetRequireNoCollInITSROFStandard(bool flag); + void SetRequireNoCollInITSROFStrict(bool flag); + void SetRequireNoHighMultCollInPrevRof(bool flag); private: - bool mRequireSel8{true}; + bool mRequireSel8{false}; bool mRequireFT0AND{true}; float mMinZvtx{-10.f}, mMaxZvtx{+10.f}; - int mMinOccupancy{static_cast(-1e+9)}, mMaxOccupancy{static_cast(+1e+9)}; - bool mRequireNoTFB{true}; - bool mRequireNoITSROFB{true}; + bool mRequireNoTFB{false}; + bool mRequireNoITSROFB{false}; bool mRequireNoSameBunchPileup{false}; bool mRequireVertexITSTPC{false}; bool mRequireGoodZvtxFT0vsPV{false}; bool mRequireNoCollInTimeRangeStandard{false}; - bool mRequireNoCollInTimeRangeNarrow{false}; + bool mRequireNoCollInTimeRangeStrict{false}; + bool mRequireNoCollInITSROFStandard{false}; + bool mRequireNoCollInITSROFStrict{false}; + bool mRequireNoHighMultCollInPrevRof{false}; ClassDef(EMEventCut, 1); }; diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 1cd1a7cbd3d..f52b2e626b3 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -41,7 +41,6 @@ #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" #include "Tools/ML/MlResponse.h" -#include "Tools/ML/model.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/Dilepton/Core/EMEventCut.h" @@ -51,6 +50,7 @@ #include "PWGEM/Dilepton/Utils/EventHistograms.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" namespace o2::aod::pwgem::dilepton::core::photonhbt { @@ -97,6 +97,7 @@ struct PhotonHBT { Configurable cfgDo3D{"cfgDo3D", false, "enable 3D analysis"}; Configurable cfgEP2Estimator_for_Mix{"cfgEP2Estimator_for_Mix", 3, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; // Configurable cfgSpherocityMin{"cfgSpherocityMin", -999.f, "min. spherocity"}; @@ -128,9 +129,14 @@ struct PhotonHBT { Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. track occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. track occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; } eventcuts; V0PhotonCut fV0PhotonCut; @@ -178,8 +184,11 @@ struct PhotonHBT { Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; - Configurable cfg_apply_phiv_meedep{"cfg_apply_phiv_meedep", false, "flag to apply mee-dependent phiv cut"}; + Configurable cfg_apply_phiv_meedep{"cfg_apply_phiv_meedep", true, "flag to apply mee-dependent phiv cut"}; + Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; + Configurable cfg_min_mee_for_phiv{"cfg_min_mee_for_phiv", 0.0, "min mee for phiv (constant)"}; + Configurable cfg_max_mee_for_phiv{"cfg_max_mee_for_phiv", 1e+10, "max mee for phiv (constant)"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.8, "max eta for single track"}; @@ -191,14 +200,17 @@ struct PhotonHBT { Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; Configurable cfg_min_its_cluster_size{"cfg_min_its_cluster_size", 0.f, "min ITS cluster size"}; Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; - Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.0, "max p to apply ITS cluster size cut"}; Configurable cfg_min_p_its_cluster_size{"cfg_min_p_its_cluster_size", 0.0, "min p to apply ITS cluster size cut"}; + Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.0, "max p to apply ITS cluster size cut"}; + Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; + Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; Configurable cfg_min_TPCNsigmaMu{"cfg_min_TPCNsigmaMu", -0.0, "min. TPC n sigma for muon exclusion"}; @@ -214,10 +226,13 @@ struct PhotonHBT { Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 0.5, "max. pin for pion rejection in TPC"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; - // CCDB configuration for PID ML - Configurable BDTLocalPathGamma{"BDTLocalPathGamma", "pid_ml_xgboost.onnx", "Path to the local .onnx file"}; - - Configurable BDTPathCCDB{"BDTPathCCDB", "Users/d/dsekihat/pwgem/pidml/", "Path on CCDB"}; + // configuration for PID ML + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; @@ -246,10 +261,6 @@ struct PhotonHBT { used_photonIds.shrink_to_fit(); used_dileptonIds.clear(); used_dileptonIds.shrink_to_fit(); - - if (eid_bdt) { - delete eid_bdt; - } } HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; @@ -322,6 +333,7 @@ struct PhotonHBT { } } + LOGF(info, "cfgOccupancyEstimator = %d", cfgOccupancyEstimator.value); if (ConfOccupancyBins.value[0] == VARIABLE_WIDTH) { occ_bin_edges = std::vector(ConfOccupancyBins.value.begin(), ConfOccupancyBins.value.end()); occ_bin_edges.erase(occ_bin_edges.begin()); @@ -452,8 +464,10 @@ struct PhotonHBT { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); } void DefinePCMCut() @@ -512,7 +526,7 @@ struct PhotonHBT { } } - o2::ml::OnnxModel* eid_bdt = nullptr; + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; void DefineDileptonCut() { fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); @@ -521,11 +535,7 @@ struct PhotonHBT { fDielectronCut.SetMeeRange(dielectroncuts.cfg_min_mass, dielectroncuts.cfg_max_mass); fDielectronCut.SetPairPtRange(dielectroncuts.cfg_min_pair_pt, dielectroncuts.cfg_max_pair_pt); fDielectronCut.SetPairYRange(dielectroncuts.cfg_min_pair_y, dielectroncuts.cfg_max_pair_y); - if (dielectroncuts.cfg_apply_phiv_meedep) { - fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); - } else { - fDielectronCut.SetPhivPairRange(0.f, dielectroncuts.cfg_max_phiv); - } + fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); fDielectronCut.ApplyPrefilter(dielectroncuts.cfg_apply_pf); @@ -546,6 +556,8 @@ struct PhotonHBT { fDielectronCut.SetMeanClusterSizeITS(dielectroncuts.cfg_min_its_cluster_size, dielectroncuts.cfg_max_its_cluster_size, dielectroncuts.cfg_min_p_its_cluster_size, dielectroncuts.cfg_max_p_its_cluster_size); fDielectronCut.SetTrackMaxDcaXY(dielectroncuts.cfg_max_dcaxy); fDielectronCut.SetTrackMaxDcaZ(dielectroncuts.cfg_max_dcaz); + fDielectronCut.SetChi2TOF(0.0, dielectroncuts.cfg_max_chi2tof); + fDielectronCut.SetRelDiffPin(dielectroncuts.cfg_min_rel_diff_pin, dielectroncuts.cfg_max_rel_diff_pin); // for eID fDielectronCut.SetPIDScheme(dielectroncuts.cfg_pid_scheme); @@ -558,21 +570,30 @@ struct PhotonHBT { fDielectronCut.SetMaxPinForPionRejectionTPC(dielectroncuts.cfg_max_pin_pirejTPC); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - eid_bdt = new o2::ml::OnnxModel(); + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + const std::vector labelsClasses = {"Signal", "Background"}; + const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + cutsMlArr[i][1] = 0.; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); if (dielectroncuts.loadModelsFromCCDB) { ccdbApi.init(ccdburl); - std::map metadata; - bool retrieveSuccessGamma = ccdbApi.retrieveBlob(dielectroncuts.BDTPathCCDB.value, ".", metadata, dielectroncuts.timestampCCDB.value, false, dielectroncuts.BDTLocalPathGamma.value); - if (retrieveSuccessGamma) { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); - } else { - LOG(fatal) << "Error encountered while fetching/loading the Gamma model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; - } + mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); } else { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); + mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); } + mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - fDielectronCut.SetPIDModel(eid_bdt); + fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -697,7 +718,15 @@ struct PhotonHBT { epbin = static_cast(ep_bin_edges.size()) - 2; } - int occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.trackOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + int occbin = -1; + if (cfgOccupancyEstimator == 0) { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.ft0cOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } else if (cfgOccupancyEstimator == 1) { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.trackOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } else { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.ft0cOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } + if (occbin < 0) { occbin = 0; } else if (static_cast(occ_bin_edges.size()) - 2 < occbin) { @@ -784,11 +813,11 @@ struct PhotonHBT { continue; } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut1.template IsSelectedTrack(pos1, collision) || !cut1.template IsSelectedTrack(ele1, collision)) { + if (!cut1.template IsSelectedTrack(pos1, collision) || !cut1.template IsSelectedTrack(ele1, collision)) { continue; } } else { // cut-based - if (!cut1.template IsSelectedTrack(pos1, collision) || !cut1.template IsSelectedTrack(ele1, collision)) { + if (!cut1.template IsSelectedTrack(pos1, collision) || !cut1.template IsSelectedTrack(ele1, collision)) { continue; } } @@ -812,11 +841,11 @@ struct PhotonHBT { continue; } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { continue; } } else { // cut-based - if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { continue; } } @@ -922,11 +951,11 @@ struct PhotonHBT { continue; } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { continue; } } else { // cut-based - if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { continue; } } @@ -1258,11 +1287,11 @@ struct PhotonHBT { continue; } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(pos, collision) || !cut.template IsSelectedTrack(ele, collision)) { + if (!cut.template IsSelectedTrack(pos, collision) || !cut.template IsSelectedTrack(ele, collision)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(pos, collision) || !cut.template IsSelectedTrack(ele, collision)) { + if (!cut.template IsSelectedTrack(pos, collision) || !cut.template IsSelectedTrack(ele, collision)) { continue; } } @@ -1315,7 +1344,8 @@ struct PhotonHBT { Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; - Filter collisionFilter_occupancy = eventcuts.cfgOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgOccupancyMax; + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; int ndf = 0; diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index f26af41ecee..b1efa7d026d 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -33,7 +33,6 @@ #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" #include "Tools/ML/MlResponse.h" -#include "Tools/ML/model.h" #include "PWGEM/Dilepton/DataModel/dileptonTables.h" #include "PWGEM/Dilepton/Core/DielectronCut.h" @@ -42,6 +41,7 @@ #include "PWGEM/Dilepton/Utils/EventHistograms.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" using namespace o2; using namespace o2::aod; @@ -79,7 +79,7 @@ struct SingleTrackQC { Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; - Configurable cfgUseDCAxy{"cfgUseDCAxy", false, "flag to use DCAxy, instead of DCA3D"}; + Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; ConfigurableAxis ConfPtlBins{"ConfPtlBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTl bins for output histograms"}; ConfigurableAxis ConfDCABins{"ConfDCABins", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCA bins for output histograms"}; @@ -96,9 +96,15 @@ struct SingleTrackQC { Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; } eventcuts; DielectronCut fDielectronCut; @@ -116,6 +122,7 @@ struct SingleTrackQC { Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.2, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.2, "max dca Z for single track in cm"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; @@ -124,8 +131,10 @@ struct SingleTrackQC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_p_its_cluster_size{"cfg_min_p_its_cluster_size", 0.0, "min p to apply ITS cluster size cut"}; Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.0, "max p to apply ITS cluster size cut"}; + Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; + Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; Configurable cfg_min_TPCNsigmaMu{"cfg_min_TPCNsigmaMu", -0.0, "min. TPC n sigma for muon exclusion"}; @@ -140,9 +149,13 @@ struct SingleTrackQC { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; - // CCDB configuration for PID ML - Configurable BDTLocalPathGamma{"BDTLocalPathGamma", "pid_ml_xgboost.onnx", "Path to the local .onnx file"}; - Configurable BDTPathCCDB{"BDTPathCCDB", "Users/d/dsekihat/pwgem/pidml/", "Path on CCDB"}; + // configuration for PID ML + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; @@ -151,14 +164,8 @@ struct SingleTrackQC { DimuonCut fDimuonCut; struct : ConfigurableGroup { std::string prefix = "dimuoncut_group"; - Configurable cfg_min_mass{"cfg_min_mass", 0.0, "min mass"}; - Configurable cfg_max_mass{"cfg_max_mass", 1e+10, "max mass"}; - Configurable cfg_min_pair_pt{"cfg_min_pair_pt", 0.0, "min pair pt"}; - Configurable cfg_max_pair_pt{"cfg_max_pair_pt", 1e+10, "max pair pt"}; - Configurable cfg_min_pair_dcaxy{"cfg_min_pair_dcaxy", 0.0, "min pair dca3d in sigma"}; - Configurable cfg_max_pair_dcaxy{"cfg_max_pair_dcaxy", 1e+10, "max pair dca3d in sigma"}; - - Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; + + Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -4.0, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", -2.5, "max eta for single track"}; @@ -181,12 +188,7 @@ struct SingleTrackQC { HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; // 1 HistogramRegistry can keep up to 512 histograms static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; - ~SingleTrackQC() - { - if (eid_bdt) { - delete eid_bdt; - } - } + ~SingleTrackQC() {} void addhistograms() { @@ -198,8 +200,10 @@ struct SingleTrackQC { const AxisSpec axis_eta{20, -1.0, +1.0, "#eta_{e}"}; const AxisSpec axis_phi{36, 0.0, 2 * M_PI, "#varphi_{e} (rad.)"}; std::string dca_axis_title = "DCA_{e}^{3D} (#sigma)"; - if (cfgUseDCAxy) { + if (cfgDCAType == 1) { dca_axis_title = "DCA_{e}^{XY} (#sigma)"; + } else if (cfgDCAType == 2) { + dca_axis_title = "DCA_{e}^{Z} (#sigma)"; } const AxisSpec axis_dca{ConfDCABins, dca_axis_title}; @@ -213,6 +217,7 @@ struct SingleTrackQC { fRegistry.add("Track/positive/hNclsTPC", "number of TPC clusters", kTH1F, {{161, -0.5, 160.5}}, false); fRegistry.add("Track/positive/hNcrTPC", "number of TPC crossed rows", kTH1F, {{161, -0.5, 160.5}}, false); fRegistry.add("Track/positive/hChi2TPC", "chi2/number of TPC clusters", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Track/positive/hDeltaPin", "p_{in} vs. p_{pv};p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", kTH2F, {{1000, 0, 10}, {200, -1, +1}}, false); fRegistry.add("Track/positive/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); fRegistry.add("Track/positive/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); fRegistry.add("Track/positive/hTPCNclsShared", "TPC Ncls shared/Ncls;p_{T} (GeV/c);N_{cls}^{shared}/N_{cls} in TPC", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); @@ -221,7 +226,10 @@ struct SingleTrackQC { fRegistry.add("Track/positive/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); fRegistry.add("Track/positive/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); fRegistry.add("Track/positive/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); + fRegistry.add("Track/positive/hChi2TOF", "TOF Chi2;p_{pv} (GeV/c);chi2", kTH2F, {{1000, 0, 10}, {100, 0, 10}}, false); fRegistry.add("Track/positive/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); + fRegistry.add("Track/positive/hMeanClusterSizeITSib", "mean cluster size ITS inner barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); + fRegistry.add("Track/positive/hMeanClusterSizeITSob", "mean cluster size ITS outer barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/positive/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/positive/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/positive/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); @@ -305,11 +313,13 @@ struct SingleTrackQC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); } - o2::ml::OnnxModel* eid_bdt = nullptr; + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; void DefineDielectronCut() { fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); @@ -330,6 +340,8 @@ struct SingleTrackQC { fDielectronCut.SetTrackMaxDcaZ(dielectroncuts.cfg_max_dcaz); fDielectronCut.RequireITSibAny(dielectroncuts.cfg_require_itsib_any); fDielectronCut.RequireITSib1st(dielectroncuts.cfg_require_itsib_1st); + fDielectronCut.SetChi2TOF(0.0, dielectroncuts.cfg_max_chi2tof); + fDielectronCut.SetRelDiffPin(dielectroncuts.cfg_min_rel_diff_pin, dielectroncuts.cfg_max_rel_diff_pin); // for eID fDielectronCut.SetPIDScheme(dielectroncuts.cfg_pid_scheme); @@ -340,22 +352,31 @@ struct SingleTrackQC { fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); - if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDielectronCut - eid_bdt = new o2::ml::OnnxModel(); + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + const std::vector labelsClasses = {"Signal", "Background"}; + const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + cutsMlArr[i][1] = 0.; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); if (dielectroncuts.loadModelsFromCCDB) { ccdbApi.init(ccdburl); - std::map metadata; - bool retrieveSuccessGamma = ccdbApi.retrieveBlob(dielectroncuts.BDTPathCCDB.value, ".", metadata, dielectroncuts.timestampCCDB.value, false, dielectroncuts.BDTLocalPathGamma.value); - if (retrieveSuccessGamma) { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); - } else { - LOG(fatal) << "Error encountered while fetching/loading the Gamma model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; - } + mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); } else { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); + mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); } + mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - fDielectronCut.SetPIDModel(eid_bdt); + fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -363,11 +384,6 @@ struct SingleTrackQC { { fDimuonCut = DimuonCut("fDimuonCut", "fDimuonCut"); - // for pair - fDimuonCut.SetMassRange(dimuoncuts.cfg_min_mass, dimuoncuts.cfg_max_mass); - fDimuonCut.SetPairPtRange(dimuoncuts.cfg_min_pair_pt, dimuoncuts.cfg_max_pair_pt); - fDimuonCut.SetPairDCAxyRange(dimuoncuts.cfg_min_pair_dcaxy, dimuoncuts.cfg_max_pair_dcaxy); // DCAxy in cm - // for track fDimuonCut.SetTrackType(dimuoncuts.cfg_track_type); fDimuonCut.SetTrackPtRange(dimuoncuts.cfg_min_pt_track, 1e10f); @@ -392,8 +408,10 @@ struct SingleTrackQC { } float dca = dca3DinSigma(track); - if (cfgUseDCAxy) { - dca = abs(track.dcaXY() / std::sqrt(track.cYY())); + if (cfgDCAType == 1) { + dca = dcaXYinSigma(track); + } else if (cfgDCAType == 2) { + dca = dcaZinSigma(track); } if (track.sign() > 0) { @@ -409,13 +427,17 @@ struct SingleTrackQC { fRegistry.fill(HIST("Track/positive/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); fRegistry.fill(HIST("Track/positive/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); fRegistry.fill(HIST("Track/positive/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); + fRegistry.fill(HIST("Track/positive/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); fRegistry.fill(HIST("Track/positive/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/positive/hChi2ITS"), track.itsChi2NCl()); fRegistry.fill(HIST("Track/positive/hITSClusterMap"), track.itsClusterMap()); + fRegistry.fill(HIST("Track/positive/hChi2TOF"), track.p(), track.tofChi2()); fRegistry.fill(HIST("Track/positive/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/positive/hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/positive/hMeanClusterSizeITS"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/positive/hMeanClusterSizeITSib"), track.p(), track.meanClusterSizeITSib() * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/positive/hMeanClusterSizeITSob"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/positive/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/positive/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); fRegistry.fill(HIST("Track/positive/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); @@ -439,13 +461,17 @@ struct SingleTrackQC { fRegistry.fill(HIST("Track/negative/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); fRegistry.fill(HIST("Track/negative/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); fRegistry.fill(HIST("Track/negative/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); + fRegistry.fill(HIST("Track/negative/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); fRegistry.fill(HIST("Track/negative/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/negative/hChi2ITS"), track.itsChi2NCl()); fRegistry.fill(HIST("Track/negative/hITSClusterMap"), track.itsClusterMap()); + fRegistry.fill(HIST("Track/negative/hChi2TOF"), track.p(), track.tofChi2()); fRegistry.fill(HIST("Track/negative/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/negative/hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/negative/hMeanClusterSizeITS"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/negative/hMeanClusterSizeITSib"), track.p(), track.meanClusterSizeITSib() * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/negative/hMeanClusterSizeITSob"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/negative/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/negative/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); fRegistry.fill(HIST("Track/negative/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); @@ -528,11 +554,11 @@ struct SingleTrackQC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { for (auto& track : tracks_per_coll) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(track, collision)) { + if (!cut.template IsSelectedTrack(track, collision)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(track)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } @@ -576,11 +602,11 @@ struct SingleTrackQC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { for (auto& track : tracks_per_coll) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(track, collision)) { + if (!cut.template IsSelectedTrack(track, collision)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(track)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } @@ -638,7 +664,8 @@ struct SingleTrackQC { Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; - Filter collisionFilter_occupancy = eventcuts.cfgOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgOccupancyMax; + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; void processQC(FilteredMyCollisions const& collisions, Types const&... args) diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 098cdc821d1..6082f774fc3 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -33,7 +33,6 @@ #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" #include "Tools/ML/MlResponse.h" -#include "Tools/ML/model.h" #include "PWGEM/Dilepton/DataModel/dileptonTables.h" #include "PWGEM/Dilepton/Core/DielectronCut.h" @@ -43,6 +42,7 @@ #include "PWGEM/Dilepton/Utils/EventHistograms.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" using namespace o2; using namespace o2::aod; @@ -83,7 +83,7 @@ struct SingleTrackQCMC { Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; Configurable cfgFillQA{"cfgFillQA", false, "flag to fill QA histograms"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; - Configurable cfgUseDCAxy{"cfgUseDCAxy", false, "flag to use DCAxy, instead of DCA3D"}; + Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; ConfigurableAxis ConfPtlBins{"ConfPtlBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTl bins for output histograms"}; ConfigurableAxis ConfDCABins{"ConfDCABins", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCA bins for output histograms"}; @@ -100,9 +100,15 @@ struct SingleTrackQCMC { Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; } eventcuts; DielectronCut fDielectronCut; @@ -119,6 +125,7 @@ struct SingleTrackQCMC { Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.2, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.2, "max dca Z for single track in cm"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; @@ -127,8 +134,10 @@ struct SingleTrackQCMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_p_its_cluster_size{"cfg_min_p_its_cluster_size", 0.0, "min p to apply ITS cluster size cut"}; Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.0, "max p to apply ITS cluster size cut"}; + Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; + Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; Configurable cfg_min_TPCNsigmaMu{"cfg_min_TPCNsigmaMu", -0.0, "min. TPC n sigma for muon exclusion"}; @@ -143,9 +152,13 @@ struct SingleTrackQCMC { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; - // CCDB configuration for PID ML - Configurable BDTLocalPathGamma{"BDTLocalPathGamma", "pid_ml_xgboost.onnx", "Path to the local .onnx file"}; - Configurable BDTPathCCDB{"BDTPathCCDB", "Users/d/dsekihat/pwgem/pidml/", "Path on CCDB"}; + // configuration for PID ML + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; @@ -154,7 +167,7 @@ struct SingleTrackQCMC { DimuonCut fDimuonCut; struct : ConfigurableGroup { std::string prefix = "dimuoncut_group"; - Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; + Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -4.0, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", -2.5, "max eta for single track"}; @@ -186,12 +199,7 @@ struct SingleTrackQCMC { static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; static constexpr std::string_view lepton_source_types[9] = {"lf/", "Photon/", "PromptJPsi/", "NonPromptJPsi/", "PromptPsi2S/", "NonPromptPsi2S/", "c2l/", "b2l/", "b2c2l/"}; - ~SingleTrackQCMC() - { - if (eid_bdt) { - delete eid_bdt; - } - } + ~SingleTrackQCMC() {} void addhistograms() { @@ -204,8 +212,10 @@ struct SingleTrackQCMC { const AxisSpec axis_phi{36, 0.0, 2 * M_PI, "#varphi_{e} (rad.)"}; const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true charge"}; std::string dca_axis_title = "DCA_{e}^{3D} (#sigma)"; - if (cfgUseDCAxy) { + if (cfgDCAType == 1) { dca_axis_title = "DCA_{e}^{XY} (#sigma)"; + } else if (cfgDCAType == 2) { + dca_axis_title = "DCA_{e}^{Z} (#sigma)"; } const AxisSpec axis_dca{ConfDCABins, dca_axis_title}; @@ -235,6 +245,8 @@ struct SingleTrackQCMC { fRegistry.add("Track/lf/positive/hTPCNclsShared", "TPC Ncls shared/Ncls;p_{T} (GeV/c);N_{cls}^{shared}/N_{cls} in TPC", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); fRegistry.add("Track/lf/positive/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); fRegistry.add("Track/lf/positive/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Track/lf/positive/hDeltaPin", "p_{in} vs. p_{pv};p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", kTH2F, {{1000, 0, 10}, {200, -1, +1}}, false); + fRegistry.add("Track/lf/positive/hChi2TOF", "TOF Chi2;p_{pv} (GeV/c);chi2", kTH2F, {{1000, 0, 10}, {100, 0, 10}}, false); fRegistry.add("Track/lf/positive/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); fRegistry.add("Track/lf/positive/hPtGen_DeltaPtOverPtGen", "electron p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{200, 0, 10}, {200, -1.0f, 1.0f}}, true); fRegistry.add("Track/lf/positive/hPtGen_DeltaEta", "electron #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", kTH2F, {{200, 0, 10}, {100, -0.05f, 0.05f}}, true); @@ -254,6 +266,8 @@ struct SingleTrackQCMC { fRegistry.add("Track/PID/positive/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); fRegistry.add("Track/PID/positive/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/PID/positive/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); + fRegistry.add("Track/PID/positive/hMeanClusterSizeITSib", "mean cluster size ITS inner barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); + fRegistry.add("Track/PID/positive/hMeanClusterSizeITSob", "mean cluster size ITS outer barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/PID/positive/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/PID/positive/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/PID/positive/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); @@ -351,11 +365,13 @@ struct SingleTrackQCMC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); } - o2::ml::OnnxModel* eid_bdt = nullptr; + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; void DefineDielectronCut() { fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); @@ -376,6 +392,8 @@ struct SingleTrackQCMC { fDielectronCut.SetTrackMaxDcaZ(dielectroncuts.cfg_max_dcaz); fDielectronCut.RequireITSibAny(dielectroncuts.cfg_require_itsib_any); fDielectronCut.RequireITSib1st(dielectroncuts.cfg_require_itsib_1st); + fDielectronCut.SetChi2TOF(0.0, dielectroncuts.cfg_max_chi2tof); + fDielectronCut.SetRelDiffPin(dielectroncuts.cfg_min_rel_diff_pin, dielectroncuts.cfg_max_rel_diff_pin); // for eID fDielectronCut.SetPIDScheme(dielectroncuts.cfg_pid_scheme); @@ -387,21 +405,30 @@ struct SingleTrackQCMC { fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - eid_bdt = new o2::ml::OnnxModel(); + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + const std::vector labelsClasses = {"Signal", "Background"}; + const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + cutsMlArr[i][1] = 0.; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); if (dielectroncuts.loadModelsFromCCDB) { ccdbApi.init(ccdburl); - std::map metadata; - bool retrieveSuccessGamma = ccdbApi.retrieveBlob(dielectroncuts.BDTPathCCDB.value, ".", metadata, dielectroncuts.timestampCCDB.value, false, dielectroncuts.BDTLocalPathGamma.value); - if (retrieveSuccessGamma) { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); - } else { - LOG(fatal) << "Error encountered while fetching/loading the Gamma model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; - } + mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); } else { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); + mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); } + mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - fDielectronCut.SetPIDModel(eid_bdt); + fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -471,8 +498,10 @@ struct SingleTrackQCMC { { auto mctrack = track.template emmcparticle_as(); float dca = dca3DinSigma(track); - if (cfgUseDCAxy) { - dca = abs(track.dcaXY() / std::sqrt(track.cYY())); + if (cfgDCAType == 1) { + dca = dcaXYinSigma(track); + } else if (cfgDCAType == 2) { + dca = dcaZinSigma(track); } float weight = 1.f; @@ -497,6 +526,8 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hChi2ITS"), track.itsChi2NCl()); + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hChi2TOF"), track.p(), track.tofChi2()); + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hITSClusterMap"), track.itsClusterMap()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hPtGen_DeltaPtOverPtGen"), mctrack.pt(), (track.pt() - mctrack.pt()) / mctrack.pt()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hPtGen_DeltaEta"), mctrack.pt(), track.eta() - mctrack.eta()); @@ -505,6 +536,8 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/PID/positive/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/PID/positive/hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/PID/positive/hMeanClusterSizeITS"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/PID/positive/hMeanClusterSizeITSib"), track.p(), track.meanClusterSizeITSib() * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/PID/positive/hMeanClusterSizeITSob"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/PID/positive/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/PID/positive/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); fRegistry.fill(HIST("Track/PID/positive/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); @@ -532,6 +565,8 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hChi2ITS"), track.itsChi2NCl()); + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hChi2TOF"), track.p(), track.tofChi2()); + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hITSClusterMap"), track.itsClusterMap()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hPtGen_DeltaPtOverPtGen"), mctrack.pt(), (track.pt() - mctrack.pt()) / mctrack.pt()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hPtGen_DeltaEta"), mctrack.pt(), track.eta() - mctrack.eta()); @@ -540,6 +575,8 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/PID/negative/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/PID/negative/hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/PID/negative/hMeanClusterSizeITS"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/PID/negative/hMeanClusterSizeITSib"), track.p(), track.meanClusterSizeITSib() * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/PID/negative/hMeanClusterSizeITSob"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/PID/negative/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/PID/negative/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); fRegistry.fill(HIST("Track/PID/negative/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); @@ -609,7 +646,7 @@ struct SingleTrackQCMC { } } - template + template void runQCMC(TCollisions const& collisions, TTracks const& tracks, TPreslice const& perCollision, TCut const& cut, TMCCollisions const&, TMCParticles const& mcparticles) { for (auto& collision : collisions) { @@ -623,9 +660,13 @@ struct SingleTrackQCMC { // continue; // } + o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<0, -1>(&fRegistry, collision); if (!fEMEventCut.IsSelected(collision)) { continue; } + o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<1, -1>(&fRegistry, collision); + fRegistry.fill(HIST("Event/before/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted + fRegistry.fill(HIST("Event/after/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted auto tracks_per_coll = tracks.sliceBy(perCollision, collision.globalIndex()); @@ -635,6 +676,10 @@ struct SingleTrackQCMC { continue; } + if (!isInAcceptance(mctrack)) { + continue; + } + auto mccollision_from_track = mctrack.template emmcevent_as(); if (cfgEventGeneratorType >= 0 && mccollision_from_track.getSubGeneratorId() != cfgEventGeneratorType) { continue; @@ -646,11 +691,11 @@ struct SingleTrackQCMC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(track, collision)) { + if (!cut.template IsSelectedTrack(track, collision)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(track)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } @@ -700,44 +745,39 @@ struct SingleTrackQCMC { } // end of process template - void runGenInfo(TCollisions const& collisions, TMCLeptons const& leptonsMC, TMCCollisions const&, TMCParticles const& mcparticles) + void runGenInfo(TCollisions const& collisions, TMCLeptons const& leptonsMC, TMCCollisions const& mccollisions, TMCParticles const& mcparticles) { - // loop over mc stack and fill histograms for pure MC truth signals - // all MC tracks which belong to the MC event corresponding to the current reconstructed event + for (auto& mccollision : mccollisions) { + if (cfgEventGeneratorType >= 0 && mccollision.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } - std::vector used_mccollisionIds; // used mc collisionIds - used_mccollisionIds.reserve(collisions.size()); + auto rec_colls_per_mccoll = collisions.sliceBy(recColperMcCollision, mccollision.globalIndex()); + uint32_t maxNumContrib = 0; + int rec_col_globalIndex = -999; + for (auto& rec_col : rec_colls_per_mccoll) { + if (rec_col.numContrib() > maxNumContrib) { + rec_col_globalIndex = rec_col.globalIndex(); + maxNumContrib = rec_col.numContrib(); // assign mc collision to collision where the number of contibutor is lager. LF/MM recommendation + } + } - for (auto& collision : collisions) { - auto mccollision = collision.template emmcevent_as(); - if (std::find(used_mccollisionIds.begin(), used_mccollisionIds.end(), mccollision.globalIndex()) != used_mccollisionIds.end()) { - // LOGF(info, "same mc collision is repeated. continue;"); + if (rec_colls_per_mccoll.size() < 1) { continue; } - used_mccollisionIds.emplace_back(mccollision.globalIndex()); + + auto collision = collisions.rawIteratorAt(rec_col_globalIndex); float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } - // LOGF(info, "mccollision.getGeneratorId() = %d", mccollision.getGeneratorId()); - // LOGF(info, "mccollision.getSubGeneratorId() = %d", mccollision.getSubGeneratorId()); - // LOGF(info, "mccollision.getSourceId() = %d", mccollision.getSourceId()); - if (cfgEventGeneratorType >= 0 && mccollision.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - - o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<0, -1>(&fRegistry, collision); if (!fEMEventCut.IsSelected(collision)) { continue; } - o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<1, -1>(&fRegistry, collision); - fRegistry.fill(HIST("Event/before/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted - fRegistry.fill(HIST("Event/after/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted auto leptonsMC_per_coll = leptonsMC.sliceByCachedUnsorted(o2::aod::emmcparticle::emmceventId, mccollision.globalIndex(), cache); - for (auto& lepton : leptonsMC_per_coll) { if (!(lepton.isPhysicalPrimary() || lepton.producedByGenerator())) { continue; @@ -801,11 +841,9 @@ struct SingleTrackQCMC { } else if (IsFromCharm(lepton, mcparticles) > 0) { // c is found in full decay chain. Not from b. fRegistry.fill(HIST("Generated/c2l/hs"), pt, eta, phi, -lepton.pdgCode() / pdg_lepton); } - } + } // end of mc lepton loop per collision - } // end of collision loop - used_mccollisionIds.clear(); - used_mccollisionIds.shrink_to_fit(); + } // end of mc collision loop } std::unordered_map map_weight; // map of track global index -> weight @@ -840,11 +878,11 @@ struct SingleTrackQCMC { } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(track, collision)) { + if (!cut.template IsSelectedTrack(track, collision)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(track)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } @@ -898,36 +936,39 @@ struct SingleTrackQCMC { SliceCache cache; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && dielectroncuts.cfg_min_phi_track < o2::aod::track::phi && o2::aod::track::phi < dielectroncuts.cfg_max_phi_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; + Filter trackFilter_electron = dielectroncuts.cfg_min_phi_track < o2::aod::track::phi && o2::aod::track::phi < dielectroncuts.cfg_max_phi_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; Filter pidFilter_electron = (dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl) && (o2::aod::pidtpc::tpcNSigmaPi < dielectroncuts.cfg_min_TPCNsigmaPi || dielectroncuts.cfg_max_TPCNsigmaPi < o2::aod::pidtpc::tpcNSigmaPi); Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); Preslice perCollision_muon = aod::emprimarymuon::emeventId; - Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_pt_track < o2::aod::fwdtrack::pt && dimuoncuts.cfg_min_eta_track < o2::aod::fwdtrack::eta && o2::aod::fwdtrack::eta < dimuoncuts.cfg_max_eta_track && dimuoncuts.cfg_min_phi_track < o2::aod::fwdtrack::phi && o2::aod::fwdtrack::phi < dimuoncuts.cfg_max_phi_track; + Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_phi_track < o2::aod::fwdtrack::phi && o2::aod::fwdtrack::phi < dimuoncuts.cfg_max_phi_track; Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; - Filter collisionFilter_occupancy = eventcuts.cfgOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgOccupancyMax; + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; Partition electronsMC = nabs(o2::aod::mcparticle::pdgCode) == 11; // e+, e- Partition muonsMC = nabs(o2::aod::mcparticle::pdgCode) == 13; // mu+, mu- PresliceUnsorted perMcCollision = aod::emmcparticle::emmceventId; + PresliceUnsorted recColperMcCollision = aod::emmceventlabel::emmceventId; + void processQCMC(FilteredMyCollisions const& collisions, aod::EMMCEvents const& mccollisions, aod::EMMCParticles const& mcparticles, TLeptons const& tracks) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (cfgApplyWeightTTCA) { fillTrackWeightMap(collisions, tracks, perCollision_electron, fDielectronCut, mccollisions, mcparticles); } - runQCMC(collisions, tracks, perCollision_electron, fDielectronCut, mccollisions, mcparticles); + runQCMC(collisions, tracks, perCollision_electron, fDielectronCut, mccollisions, mcparticles); runGenInfo(collisions, electronsMC, mccollisions, mcparticles); } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (cfgApplyWeightTTCA) { fillTrackWeightMap(collisions, tracks, perCollision_muon, fDimuonCut, mccollisions, mcparticles); } - runQCMC(collisions, tracks, perCollision_muon, fDimuonCut, mccollisions, mcparticles); + runQCMC(collisions, tracks, perCollision_muon, fDimuonCut, mccollisions, mcparticles); runGenInfo(collisions, muonsMC, mccollisions, mcparticles); } map_weight.clear(); @@ -943,13 +984,13 @@ struct SingleTrackQCMC { if (cfgApplyWeightTTCA) { fillTrackWeightMap(collisions, tracks, perCollision_electron, fDielectronCut, mccollisions, mcparticles_smeared); } - runQCMC(collisions, tracks, perCollision_electron, fDielectronCut, mccollisions, mcparticles_smeared); + runQCMC(collisions, tracks, perCollision_electron, fDielectronCut, mccollisions, mcparticles_smeared); runGenInfo(collisions, electronsMC_smeared, mccollisions, mcparticles_smeared); } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (cfgApplyWeightTTCA) { fillTrackWeightMap(collisions, tracks, perCollision_muon, fDimuonCut, mccollisions, mcparticles_smeared); } - runQCMC(collisions, tracks, perCollision_muon, fDimuonCut, mccollisions, mcparticles_smeared); + runQCMC(collisions, tracks, perCollision_muon, fDimuonCut, mccollisions, mcparticles_smeared); runGenInfo(collisions, muonsMC_smeared, mccollisions, mcparticles_smeared); } map_weight.clear(); diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index 7a487529341..7f252fc4f67 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -104,12 +104,10 @@ DECLARE_SOA_COLUMN(Q4yBTot, q4ybtot, float); //! DECLARE_SOA_COLUMN(SpherocityPtWeighted, spherocity_ptweighted, float); //! transverse spherocity DECLARE_SOA_COLUMN(SpherocityPtUnWeighted, spherocity_ptunweighted, float); //! transverse spherocity DECLARE_SOA_COLUMN(NtrackSpherocity, ntspherocity, int); -DECLARE_SOA_COLUMN(IsSelected, isSelected, bool); //! MB event selection info -DECLARE_SOA_COLUMN(IsEoI, isEoI, bool); //! lepton or photon exists in MB event (not for CEFP) -DECLARE_SOA_COLUMN(PosZint16, posZint16, int16_t); //! this is only to reduce data size -DECLARE_SOA_COLUMN(NumTracksInTimeRange_int16, trackOccupancyInTimeRange_int16, int16_t); //! this is only to reduce data size +DECLARE_SOA_COLUMN(IsSelected, isSelected, bool); //! MB event selection info +DECLARE_SOA_COLUMN(IsEoI, isEoI, bool); //! lepton or photon exists in MB event (not for CEFP) +DECLARE_SOA_COLUMN(PosZint16, posZint16, int16_t); //! this is only to reduce data size DECLARE_SOA_DYNAMIC_COLUMN(PosZ, posZ, [](int16_t posZint16) -> float { return static_cast(posZint16) * 0.1f; }); -DECLARE_SOA_DYNAMIC_COLUMN(NumTracksInTimeRange, trackOccupancyInTimeRange, [](int16_t trackOccupancyInTimeRange_int16) -> int { return (trackOccupancyInTimeRange_int16 < 0 ? -1 : static_cast(trackOccupancyInTimeRange_int16) * 100); }); DECLARE_SOA_DYNAMIC_COLUMN(Sel8, sel8, [](uint64_t selection_bit) -> bool { return (selection_bit & BIT(o2::aod::evsel::kIsTriggerTVX)) && (selection_bit & BIT(o2::aod::evsel::kNoTimeFrameBorder)) && (selection_bit & BIT(o2::aod::evsel::kNoITSROFrameBorder)); }); DECLARE_SOA_DYNAMIC_COLUMN(EP2FT0M, ep2ft0m, [](float q2x, float q2y) -> float { return std::atan2(q2y, q2x) / 2.0; }); @@ -132,10 +130,17 @@ DECLARE_SOA_DYNAMIC_COLUMN(EP4BNeg, ep4bneg, [](float q4x, float q4y) -> float { DECLARE_SOA_DYNAMIC_COLUMN(EP4BTot, ep4btot, [](float q4x, float q4y) -> float { return std::atan2(q4y, q4x) / 4.0; }); } // namespace emevent -DECLARE_SOA_TABLE(EMEvents, "AOD", "EMEVENT", //! Main event information table +DECLARE_SOA_TABLE(EMEvents_000, "AOD", "EMEVENT", //! Main event information table o2::soa::Index<>, emevent::CollisionId, bc::RunNumber, bc::GlobalBC, evsel::Alias, evsel::Selection, timestamp::Timestamp, collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, evsel::NumTracksInTimeRange, emevent::Sel8); + +DECLARE_SOA_TABLE_VERSIONED(EMEvents_001, "AOD", "EMEVENT", 1, //! Main event information table + o2::soa::Index<>, emevent::CollisionId, bc::RunNumber, bc::GlobalBC, evsel::Alias, evsel::Selection, timestamp::Timestamp, + collision::PosX, collision::PosY, collision::PosZ, + collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange, emevent::Sel8); + +using EMEvents = EMEvents_001; using EMEvent = EMEvents::iterator; DECLARE_SOA_TABLE(EMEventsCov, "AOD", "EMEVENTCOV", //! joinable to EMEvents @@ -207,7 +212,7 @@ DECLARE_SOA_TABLE(EMEoIs, "AOD", "EMEOI", //! joinable to aod::Collisions in cre using EMEoI = EMEoIs::iterator; DECLARE_SOA_TABLE(EMEventNormInfos, "AOD", "EMEVENTNORMINFO", //! event information for normalization - o2::soa::Index<>, evsel::Alias, evsel::Selection, emevent::PosZint16, emevent::NumTracksInTimeRange_int16, emevent::PosZ, emevent::Sel8, emevent::NumTracksInTimeRange); + o2::soa::Index<>, evsel::Alias, evsel::Selection, emevent::PosZint16, emevent::PosZ, emevent::Sel8); using EMEventNormInfo = EMEventNormInfos::iterator; namespace emmcevent @@ -362,6 +367,7 @@ DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(AmbiguousElectrons, ambiguousElectrons); DECLARE_SOA_COLUMN(IsAssociatedToMPC, isAssociatedToMPC, bool); //! is associated to most probable collision DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(PrefilterBit, pfb, uint8_t); //! +DECLARE_SOA_COLUMN(PrefilterBitPi0, pfbpi0, uint16_t); //! DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); @@ -414,7 +420,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32 } }); } // namespace emprimaryelectron -DECLARE_SOA_TABLE(EMPrimaryElectrons, "AOD", "EMPRIMARYEL", //! +DECLARE_SOA_TABLE(EMPrimaryElectrons_000, "AOD", "EMPRIMARYEL", //! o2::soa::Index<>, emprimaryelectron::CollisionId, emprimaryelectron::TrackId, emprimaryelectron::Sign, track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, @@ -442,6 +448,37 @@ DECLARE_SOA_TABLE(EMPrimaryElectrons, "AOD", "EMPRIMARYEL", //! emprimaryelectron::MeanClusterSizeITS, emprimaryelectron::MeanClusterSizeITSib, emprimaryelectron::MeanClusterSizeITSob); + +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectrons_001, "AOD", "EMPRIMARYEL", 1, //! + o2::soa::Index<>, emprimaryelectron::CollisionId, + emprimaryelectron::TrackId, emprimaryelectron::Sign, + track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, + track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, + track::TPCChi2NCl, track::TPCInnerParam, + track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaMu, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, + pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaMu, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, + track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, + track::X, track::Alpha, track::Y, track::Z, track::Snp, track::Tgl, emprimaryelectron::IsAssociatedToMPC, + + // dynamic column + track::TPCNClsFound, + track::TPCNClsCrossedRows, + track::TPCCrossedRowsOverFindableCls, + track::TPCFoundOverFindableCls, + track::TPCFractionSharedCls, + track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, + track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, + emprimaryelectron::Signed1Pt, + emprimaryelectron::P, + emprimaryelectron::Px, + emprimaryelectron::Py, + emprimaryelectron::Pz, + emprimaryelectron::Theta, + emprimaryelectron::MeanClusterSizeITS, + emprimaryelectron::MeanClusterSizeITSib, + emprimaryelectron::MeanClusterSizeITSob); + +using EMPrimaryElectrons = EMPrimaryElectrons_001; // iterators using EMPrimaryElectron = EMPrimaryElectrons::iterator; @@ -476,6 +513,10 @@ DECLARE_SOA_TABLE(EMAmbiguousElectronSelfIds, "AOD", "EMAMBELSELFID", emprimarye // iterators using EMAmbiguousElectronSelfId = EMAmbiguousElectronSelfIds::iterator; +DECLARE_SOA_TABLE(EMPrimaryElectronsPrefilterBitPi0, "AOD", "PRMELPFBPI0", emprimaryelectron::PrefilterBitPi0); // To be joined with EMPrimaryElectrons table at analysis level. +// iterators +using EMPrimaryElectronPrefilterBitPi0 = EMPrimaryElectronsPrefilterBitPi0::iterator; + namespace emprimarymuon { DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! diff --git a/PWGEM/Dilepton/DataModel/lmeeMLTables.h b/PWGEM/Dilepton/DataModel/lmeeMLTables.h index a42eba65846..1c925cf9bc7 100644 --- a/PWGEM/Dilepton/DataModel/lmeeMLTables.h +++ b/PWGEM/Dilepton/DataModel/lmeeMLTables.h @@ -76,7 +76,7 @@ DECLARE_SOA_TABLE(EMPrimaryTracks, "AOD", "EMPTRACK", //! track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaMu, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaMu, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, - track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, emprimarytrack::PIDLabel, emprimarytrack::TrackType, + track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, emprimarytrack::PIDLabel, emprimarytrack::TrackType, // dynamic column emprimarytrack::P, diff --git a/PWGEM/Dilepton/TableProducer/CMakeLists.txt b/PWGEM/Dilepton/TableProducer/CMakeLists.txt index a27e5b2674d..c95928b3eb1 100644 --- a/PWGEM/Dilepton/TableProducer/CMakeLists.txt +++ b/PWGEM/Dilepton/TableProducer/CMakeLists.txt @@ -20,16 +20,6 @@ o2physics_add_dpl_workflow(tree-creator-electron-ml-dda PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(dielectron-ml - SOURCES dielectronMl.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(tree-creator-single-electron-qa - SOURCES treeCreatorSingleElectronQA.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(skimmer-primary-electron SOURCES skimmerPrimaryElectron.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index 670e1b5705c..9684d394d46 100644 --- a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx @@ -14,6 +14,8 @@ // This code produces reduced events for photon analyses. // Please write to: daiki.sekihata@cern.ch +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -149,8 +151,7 @@ struct CreateEMEventDilepton { auto bc = collision.template foundBC_as(); initCCDB(bc); - int16_t occ_tmp = collision.trackOccupancyInTimeRange() < 0 ? -1 : static_cast(collision.trackOccupancyInTimeRange() / 100.f); - event_norm_info(collision.alias_raw(), collision.selection_raw(), static_cast(10.f * collision.posZ()), occ_tmp); + event_norm_info(collision.alias_raw(), collision.selection_raw(), static_cast(10.f * collision.posZ())); if (!collision.isSelected() || !collision.isEoI()) { continue; @@ -168,7 +169,7 @@ struct CreateEMEventDilepton { event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), bc.timestamp(), collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange()); + collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); // eventcov(collision.covXX(), collision.covXY(), collision.covXZ(), collision.covYY(), collision.covYZ(), collision.covZZ(), collision.chi2()); diff --git a/PWGEM/Dilepton/TableProducer/dielectronMl.cxx b/PWGEM/Dilepton/TableProducer/dielectronMl.cxx deleted file mode 100644 index 7ef2a8a4762..00000000000 --- a/PWGEM/Dilepton/TableProducer/dielectronMl.cxx +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -/// \file dielectronMl.cxx -/// \task for testing ML application for dielectron analyses -/// \author Daniel Samitz, , SMI Vienna -/// Elisa Meninno, , SMI Vienna - -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" -#include "PWGEM/Dilepton/Utils/MlResponseDielectronPair.h" - -using namespace o2; -using namespace o2::analysis; -using namespace o2::framework; -using namespace o2::aod; - -namespace o2::aod -{ - -namespace dielectronMlSelection -{ -DECLARE_SOA_COLUMN(IsSelMlSingleTrack, isSelMlSingleTrack, bool); -DECLARE_SOA_COLUMN(IsSelMlPair, isSelMlPair, bool); -DECLARE_SOA_COLUMN(MlScoreSingleTrack, mlScoreSingleTrack, std::vector); -DECLARE_SOA_COLUMN(MlScorePair, mlScorePair, std::vector); -} // namespace dielectronMlSelection - -DECLARE_SOA_TABLE(dielectronMlSelectionSingleTrack, "AOD", "DIELEMLSELST", //! - dielectronMlSelection::IsSelMlSingleTrack); -DECLARE_SOA_TABLE(dielectronMlScoreSingleTrack, "AOD", "DIELEMLSCOREST", //! - dielectronMlSelection::MlScoreSingleTrack); -DECLARE_SOA_TABLE(dielectronMlSelectionPair, "AOD", "DIELEMLSELP", //! - dielectronMlSelection::IsSelMlPair); -DECLARE_SOA_TABLE(dielectronMlScorePair, "AOD", "DIELEMLSCOREP", //! - dielectronMlSelection::MlScorePair); -} // namespace o2::aod - -using MySkimmedTracks = soa::Join; -using MySkimmedTracksWithPID = soa::Join; -using MyTracksWithPID = soa::Join; - -// define some default values for single track analysis -namespace dielectron_ml_cuts_single_track -{ -// direction of the cut -enum CutDirection { - CutGreater = 0, // require score < cut value - CutSmaller, // require score > cut value - CutNot // do not cut on score -}; - -static constexpr int nBinsPt = 1; -static constexpr int nCutScores = 2; -// default values for the pT bin edges, offset by 1 from the bin numbers in cuts array -constexpr double binsPt[nBinsPt + 1] = { - 0., - 999.}; -auto vecBinsPt = std::vector{binsPt, binsPt + nBinsPt + 1}; - -// default values for the ML model paths, one model per pT bin -static const std::vector modelPaths = { - ""}; - -// default values for the cut directions -constexpr int cutDir[nCutScores] = {CutSmaller, CutGreater}; -auto vecCutDir = std::vector{cutDir, cutDir + nCutScores}; - -// default values for the cuts -constexpr double cuts[nBinsPt][nCutScores] = { - {0.5, 0.5}}; - -// row labels -static const std::vector labelsPt = { - "pT bin 0"}; - -// column labels -static const std::vector labelsCutScore = {"Signal", "Background"}; -} // namespace dielectron_ml_cuts_single_track - -// define some default values for pair analysis -namespace dielectron_ml_cuts_pair -{ -// direction of the cut -enum CutDirection { - CutGreater = 0, // require score < cut value - CutSmaller, // require score > cut value - CutNot // do not cut on score -}; - -static constexpr int nBinsM = 1; -static constexpr int nCutScores = 2; -// default values for the mass bin edges, offset by 1 from the bin numbers in cuts array -constexpr double binsM[nBinsM + 1] = { - 0., - 999.}; -auto vecBinsM = std::vector{binsM, binsM + nBinsM + 1}; - -// default values for the ML model paths, one model per mass bin -static const std::vector modelPaths = { - ""}; - -// default values for the cut directions -constexpr int cutDir[nCutScores] = {CutSmaller, CutGreater}; -auto vecCutDir = std::vector{cutDir, cutDir + nCutScores}; - -// default values for the cuts -constexpr double cuts[nBinsM][nCutScores] = { - {0.5, 0.5}}; - -// row labels -static const std::vector labelsM = { - "mass bin 0"}; - -// column labels -static const std::vector labelsCutScore = {"Signal", "Background"}; -} // namespace dielectron_ml_cuts_pair - -struct DielectronMlSingleTrack { - Produces singleTrackSelection; - Produces singleTrackScore; - - // ML inference - Configurable> binsPtMl{"binsPtMl", std::vector{dielectron_ml_cuts_single_track::vecBinsPt}, "pT bin limits for ML application"}; - Configurable> cutDirMl{"cutDirMl", std::vector{dielectron_ml_cuts_single_track::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; - Configurable> cutsMl{"cutsMl", {dielectron_ml_cuts_single_track::cuts[0], dielectron_ml_cuts_single_track::nBinsPt, dielectron_ml_cuts_single_track::nCutScores, dielectron_ml_cuts_single_track::labelsPt, dielectron_ml_cuts_single_track::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", static_cast(dielectron_ml_cuts_single_track::nCutScores), "Number of classes in ML model"}; - Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; - // CCDB configuration - Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{""}, "Paths of models on CCDB"}; - Configurable> onnxFileNames{"onnxFileNames", std::vector{""}, "ONNX file names for each pT bin (if not from CCDB full path)"}; - Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; - Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - // preselection cuts (from treeCreatorElectronMl.cxx) - Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; - Configurable maxchi2tpc{"maxchi2tpc", 4.0, "max. chi2/NclsTPC"}; - Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; - // table output - Configurable fillScoreTable{"fillScoreTable", false, "fill table with scores from ML model"}; - - o2::analysis::MlResponseDielectronSingleTrack mlResponse; - o2::ccdb::CcdbApi ccdbApi; - std::vector> hModelScore; - std::vector> hModelScoreVsPt; - - HistogramRegistry registry{"registry", {}}; - - void init(InitContext&) - { - if (doprocessSkimmedSingleTrack || doprocessAO2DSingleTrack) { - mlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); - if (loadModelsFromCCDB) { - ccdbApi.init(ccdbUrl); - mlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); - } else { - mlResponse.setModelPathsLocal(onnxFileNames); - } - mlResponse.cacheInputFeaturesIndices(namesInputFeatures); - mlResponse.init(); - - // load histograms for ML score - AxisSpec axisScore = {100, 0, 1, "score"}; - AxisSpec axisBinsPt = {binsPtMl, "#it{p}_{T} (GeV/#it{c})"}; - for (int classMl = 0; classMl < nClassesMl; classMl++) { - hModelScore.push_back(registry.add("hMlScore" + TString(cutsMl->getLabelsCols()[classMl]), "Model score distribution;Model score;counts", HistType::kTH1F, {axisScore})); - hModelScoreVsPt.push_back(registry.add("hMlScore" + TString(cutsMl->getLabelsCols()[classMl]) + "VsPt", "Model score distribution;Model score;counts", HistType::kTH2F, {axisScore, axisBinsPt})); - } - } - } - - template - bool applyPreSelectionCuts(T const& track) - { - // consistent with treeCreatorElectronMl.cxx - if (!track.hasITS()) { - return false; - } - if (!track.hasTPC()) { - return false; - } - if (track.tpcNClsCrossedRows() < mincrossedrows) { - return false; - } - if (track.itsChi2NCl() < -1) { // if tracks are not reconstructed properly, chi2/ITSncls is set to -999; - return false; - } - if (abs(track.eta()) > maxeta) { - return false; - } - if (track.tpcChi2NCl() > maxchi2tpc) { - return false; - } - if (abs(track.dcaXY()) > 1.) { - return false; - } - if (abs(track.dcaZ()) > 1.) { - return false; - } - return true; - } - - template - void runSingleTracks(T const& tracks) - { - for (const auto& track : tracks) { - if (!applyPreSelectionCuts(track)) { - singleTrackSelection(false); - if (fillScoreTable) { - std::vector outputMl(nClassesMl, -1); - singleTrackScore(outputMl); - } - continue; - } - auto pt = track.pt(); - std::vector inputFeatures = mlResponse.getInputFeatures(track); - std::vector outputMl = {}; - - bool isSelected = mlResponse.isSelectedMl(inputFeatures, pt, outputMl); - for (int classMl = 0; classMl < nClassesMl; classMl++) { - hModelScore[classMl]->Fill(outputMl[classMl]); - hModelScoreVsPt[classMl]->Fill(outputMl[classMl], pt); - } - singleTrackSelection(isSelected); - if (fillScoreTable) { - singleTrackScore(outputMl); - } - } - } - - void processSkimmedSingleTrack(MySkimmedTracksWithPID const& tracks) - { - runSingleTracks(tracks); - } - PROCESS_SWITCH(DielectronMlSingleTrack, processSkimmedSingleTrack, "Apply ML selection on skimmed output on single tracks", true); - - void processAO2DSingleTrack(MyTracksWithPID const& tracks) - { - runSingleTracks(tracks); - } - PROCESS_SWITCH(DielectronMlSingleTrack, processAO2DSingleTrack, "Apply ML selection on skimmed output on single tracks", false); - - void processDummy(DielectronsExtra const&) - { - // dummy - } - PROCESS_SWITCH(DielectronMlSingleTrack, processDummy, "Dummy", false); -}; - -struct DielectronMlPair { - Produces pairSelection; - Produces pairScore; - - // ML inference - Configurable> binsMMl{"binsMMl", std::vector{dielectron_ml_cuts_pair::vecBinsM}, "Mass bin limits for ML application"}; - Configurable> cutDirMl{"cutDirMl", std::vector{dielectron_ml_cuts_pair::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; - Configurable> cutsMl{"cutsMl", {dielectron_ml_cuts_pair::cuts[0], dielectron_ml_cuts_pair::nBinsM, dielectron_ml_cuts_pair::nCutScores, dielectron_ml_cuts_pair::labelsM, dielectron_ml_cuts_pair::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", static_cast(dielectron_ml_cuts_pair::nCutScores), "Number of classes in ML model"}; - Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; - // CCDB configuration - Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{""}, "Paths of models on CCDB"}; - Configurable> onnxFileNames{"onnxFileNames", std::vector{""}, "ONNX file names for each pT bin (if not from CCDB full path)"}; - Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; - Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - // table output - Configurable fillScoreTable{"fillScoreTable", false, "fill table with scores from ML model"}; - - o2::analysis::MlResponseDielectronPair mlResponse; - o2::ccdb::CcdbApi ccdbApi; - std::vector> hModelScore; - std::vector> hModelScoreVsM; - - HistogramRegistry registry{"registry", {}}; - - void init(InitContext&) - { - if (doprocessPair) { - mlResponse.configure(binsMMl, cutsMl, cutDirMl, nClassesMl); - if (loadModelsFromCCDB) { - ccdbApi.init(ccdbUrl); - mlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); - } else { - mlResponse.setModelPathsLocal(onnxFileNames); - } - mlResponse.cacheInputFeaturesIndices(namesInputFeatures); - mlResponse.init(); - - // load histograms for ML score - AxisSpec axisScore = {100, 0, 1, "score"}; - AxisSpec axisBinsM = {binsMMl, "#it{M} (GeV/#it{c^{2}})"}; - for (int classMl = 0; classMl < nClassesMl; classMl++) { - hModelScore.push_back(registry.add("hMlScore" + TString(cutsMl->getLabelsCols()[classMl]), "Model score distribution;Model score;counts", HistType::kTH1F, {axisScore})); - hModelScoreVsM.push_back(registry.add("hMlScore" + TString(cutsMl->getLabelsCols()[classMl]) + "VsM", "Model score distribution;Model score;counts", HistType::kTH2F, {axisScore, axisBinsM})); - } - } - } - - void processPair(DielectronsExtra const& dielectrons, MySkimmedTracks const&) - { - // dummy value for magentic field. ToDo: take it from ccdb! - float d_bz = 1.; - mlResponse.setBz(d_bz); - for (const auto& dielectron : dielectrons) { - const auto& track1 = dielectron.index0_as(); - const auto& track2 = dielectron.index1_as(); - if (track1.sign() == track2.sign()) { - continue; - } - ROOT::Math::PtEtaPhiMVector v1(track1.pt(), track1.eta(), track1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(track2.pt(), track2.eta(), track2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - auto m = v12.M(); - std::vector inputFeatures = mlResponse.getInputFeatures(track1, track2); - std::vector outputMl = {}; - - bool isSelected = mlResponse.isSelectedMl(inputFeatures, m, outputMl); - for (int classMl = 0; classMl < nClassesMl; classMl++) { - hModelScore[classMl]->Fill(outputMl[classMl]); - hModelScoreVsM[classMl]->Fill(outputMl[classMl], m); - } - pairSelection(isSelected); - if (fillScoreTable) { - pairScore(outputMl); - } - } - } - PROCESS_SWITCH(DielectronMlPair, processPair, "Apply ML selection at pair level", false); - - void processDummyAO2D(MyTracksWithPID const&) - { - // dummy - } - PROCESS_SWITCH(DielectronMlPair, processDummyAO2D, "Dummy", false); - - void processDummySkimmed(MySkimmedTracks const&) - { - // dummy - } - PROCESS_SWITCH(DielectronMlPair, processDummySkimmed, "Dummy", true); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; -} diff --git a/PWGEM/Dilepton/TableProducer/eventSelection.cxx b/PWGEM/Dilepton/TableProducer/eventSelection.cxx index 2c804ddf2d4..dfe19f1a2e9 100644 --- a/PWGEM/Dilepton/TableProducer/eventSelection.cxx +++ b/PWGEM/Dilepton/TableProducer/eventSelection.cxx @@ -36,7 +36,7 @@ struct EMEventSelection { // Configurables Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", 0.f, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; @@ -46,8 +46,10 @@ struct EMEventSelection { Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", true, "require no ITS readout frame border in event cut"}; Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. track occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. track occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; void init(InitContext&) {} @@ -89,7 +91,11 @@ struct EMEventSelection { return false; } - if (!(cfgOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < cfgOccupancyMax)) { + if (!(cfgTrackOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < cfgTrackOccupancyMax)) { + return false; + } + + if (!(cfgFT0COccupancyMin < collision.ft0cOccupancyInTimeRange() && collision.ft0cOccupancyInTimeRange() < cfgFT0COccupancyMax)) { return false; } diff --git a/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx b/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx index 57808f5bdc2..7e9155c04bc 100644 --- a/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx +++ b/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx @@ -315,7 +315,7 @@ struct filterDielectronEvent { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), + track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), track_par_cov_recalc.getX(), track_par_cov_recalc.getAlpha(), track_par_cov_recalc.getY(), track_par_cov_recalc.getZ(), track_par_cov_recalc.getSnp(), track_par_cov_recalc.getTgl(), isAssociatedToMPC); emprimaryelectronscov( @@ -1214,7 +1214,7 @@ struct createEMEvent2VP { event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), bc.timestamp(), collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange()); + collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); // eventcov(collision.covXX(), collision.covXY(), collision.covXZ(), collision.covYY(), collision.covYZ(), collision.covZZ(), collision.chi2()); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index b075058edd5..e132db33c06 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -115,6 +115,7 @@ struct skimmerPrimaryElectron { fRegistry.add("Track/hNclsTPC", "number of TPC clusters", kTH1F, {{161, -0.5, 160.5}}, false); fRegistry.add("Track/hNcrTPC", "number of TPC crossed rows", kTH1F, {{161, -0.5, 160.5}}, false); fRegistry.add("Track/hChi2TPC", "chi2/number of TPC clusters", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Track/hChi2TOF", "chi2 of TOF", kTH1F, {{100, 0, 10}}, false); fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); @@ -333,7 +334,7 @@ struct skimmerPrimaryElectron { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), + track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), track_par_cov_recalc.getX(), track_par_cov_recalc.getAlpha(), track_par_cov_recalc.getY(), track_par_cov_recalc.getZ(), track_par_cov_recalc.getSnp(), track_par_cov_recalc.getTgl(), isAssociatedToMPC); emprimaryelectronscov( @@ -381,6 +382,7 @@ struct skimmerPrimaryElectron { fRegistry.fill(HIST("Track/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); fRegistry.fill(HIST("Track/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/hChi2ITS"), track.itsChi2NCl()); + fRegistry.fill(HIST("Track/hChi2TOF"), track.tofChi2()); fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); diff --git a/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx index b0209e842aa..1790c89c052 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx @@ -257,7 +257,7 @@ struct skimmerSecondaryElectron { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), + track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), track_par_cov_recalc.getX(), track_par_cov_recalc.getAlpha(), track_par_cov_recalc.getY(), track_par_cov_recalc.getZ(), track_par_cov_recalc.getSnp(), track_par_cov_recalc.getTgl(), isAssociatedToMPC); emprimaryelectronscov( @@ -378,7 +378,7 @@ struct skimmerSecondaryElectron { event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), bc.timestamp(), collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange()); + collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); } // end of collision loop @@ -439,7 +439,7 @@ struct skimmerSecondaryElectron { event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), bc.timestamp(), collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange()); + collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); } // end of collision loop diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx index c96afa13447..7643f79a984 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx @@ -14,6 +14,9 @@ // This code will create data table for inputs to machine learning for electrons. // Please write to: daiki.sekihata@cern.ch +#include +#include +#include #include #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" @@ -65,7 +68,7 @@ DECLARE_SOA_COLUMN(MCPosY, mcposY, float); //! DECLARE_SOA_COLUMN(MCPosZ, mcposZ, float); //! } // namespace mycollision DECLARE_SOA_TABLE(MyCollisions, "AOD", "MYCOLLISION", //! vertex information of collision - o2::soa::Index<>, bc::GlobalBC, bc::RunNumber, collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::Sel8, mycollision::Bz, + o2::soa::Index<>, bc::GlobalBC, bc::RunNumber, collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange, evsel::Sel8, mycollision::Bz, mccollision::GeneratorsID, mycollision::MCPosX, mycollision::MCPosY, mycollision::MCPosZ, mult::MultNTracksPV, cent::CentFT0M, cent::CentFT0A, cent::CentFT0C); using MyCollision = MyCollisions::iterator; @@ -181,7 +184,8 @@ struct TreeCreatorElectronML { // collision Configurable maxVtxZ{"maxVtxZ", 10.0, "max VtxZ [cm]"}; - Configurable maxOccupancy{"maxOccupancy", 999999, "max occupancy"}; + Configurable maxTrackOccupancy{"maxTrackOccupancy", 999999, "max. track occupancy"}; + Configurable maxFT0Occupancy{"maxFT0Occupancy", 999999., "max. FT0 occupancy"}; // track Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; @@ -192,8 +196,8 @@ struct TreeCreatorElectronML { Configurable minpt{"minpt", 0.2, "min. pT"}; Configurable maxDcaZ{"maxDcaZ", 1.0, "max DCA Z"}; Configurable maxDcaXY{"maxDcaXY", 1.0, "max DCA XY"}; - Configurable minITSClusters{"minITSLayers", 5, "min. of ITS clusters"}; - Configurable minITSClustersIB{"minITSClustersIB", 3, "min. number of ITS clusters in inner barrel"}; + Configurable minITSClusters{"minITSLayers", 5, "min. of ITS clusters"}; + Configurable minITSClustersIB{"minITSClustersIB", 3, "min. number of ITS clusters in inner barrel"}; Configurable downSampleEl{"downSampleEl", 1.0, "down scaling factor for electrons"}; Configurable downSamplePi{"downSamplePi", 1.0, "down scaling factor for pions"}; Configurable downSampleKa{"downSampleKa", 1.0, "down scaling factor for kaons"}; @@ -582,7 +586,7 @@ struct TreeCreatorElectronML { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - 0., track.itsChi2NCl(), track.itsClusterSizes(), // todo: add track.tofChi2() (currently a dummy 0.), once we have it in derived data + track.tofChi2(), track.itsChi2NCl(), track.itsClusterSizes(), mctrack.vx(), mctrack.vy(), mctrack.vz(), mctrack.pdgCode(), mctrack.isPhysicalPrimary(), mothers_id, mothers_pdg); @@ -595,7 +599,7 @@ struct TreeCreatorElectronML { void doCollision(TCollision& collision, TMCCollision& mccollision, uint64_t globalBC, int runNumber) { registry.fill(HIST("hEventCounter"), 1.5); - mycollision(globalBC, runNumber, collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.sel8(), d_bz, + mycollision(globalBC, runNumber, collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(), collision.sel8(), d_bz, mccollision.generatorsID(), mccollision.posX(), mccollision.posY(), mccollision.posZ(), collision.multNTracksPV(), collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); } @@ -610,7 +614,7 @@ struct TreeCreatorElectronML { using MyFilteredTracksMC = soa::Filtered; Preslice perCollision = aod::track::collisionId; - Filter collisionFilter = nabs(o2::aod::collision::posZ) < maxVtxZ && o2::aod::evsel::trackOccupancyInTimeRange < maxOccupancy; + Filter collisionFilter = nabs(o2::aod::collision::posZ) < maxVtxZ && o2::aod::evsel::trackOccupancyInTimeRange < maxTrackOccupancy && o2::aod::evsel::ft0cOccupancyInTimeRange < maxFT0Occupancy; using MyFilteredCollisions = soa::Filtered>; void processSingleTrack(MyFilteredCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks, aod::McParticles const& mctracks, aod::McCollisions const&) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index a3f25e08021..2e5e0164aec 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -469,7 +469,7 @@ struct TreeCreatorElectronMLDDA { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), pidlabel, tracktype); + track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), pidlabel, tracktype); stored_trackIds.emplace_back(track.globalIndex()); } } diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorSingleElectronQA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorSingleElectronQA.cxx deleted file mode 100644 index 5795468f082..00000000000 --- a/PWGEM/Dilepton/TableProducer/treeCreatorSingleElectronQA.cxx +++ /dev/null @@ -1,403 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \brief write relevant information for dalitz ee analysis to an AO2D.root file. This file is then the only necessary input to perform pcm analysis. -/// \author daiki.sekihata@cern.ch - -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" - -using namespace o2; -using namespace o2::soa; -using namespace o2::framework; -using namespace o2::framework::expressions; - -using MyBCs = soa::Join; - -using MyCollisions = soa::Join; -using MyCollisions_Cent = soa::Join; // centrality table has dependency on multiplicity table. - -using MyCollisionsMC = soa::Join; -using MyCollisionsMC_Cent = soa::Join; // centrality table has dependency on multiplicity table. - -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; -using MyTracksMC = soa::Join; -using MyTrackMC = MyTracksMC::iterator; - -struct TreeCreatorSingleElectronQA { - - Produces event; - Produces event_mult; - Produces event_cent; - Produces emprimaryelectrons; - Produces prmeleventid; - - // Configurables - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; - - // Operation and minimisation criteria - Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; - Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable minitsncls{"minitsncls", 4, "min. number of ITS clusters"}; - Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; - Configurable maxchi2its{"maxchi2its", 6.0, "max. chi2/NclsITS"}; - Configurable minpt{"minpt", 0.1, "min pt for track"}; - Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; - Configurable dca_xy_max{"dca_xy_max", 1.0f, "max DCAxy in cm"}; - Configurable dca_z_max{"dca_z_max", 1.0f, "max DCAz in cm"}; - Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -1e+10, "min. TPC n sigma for electron inclusion"}; - Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", +1e+10, "max. TPC n sigma for electron inclusion"}; - Configurable minTPCNsigmaPi{"minTPCNsigmaPi", 0.0, "min. TPC n sigma for pion exclusion"}; - Configurable maxTPCNsigmaPi{"maxTPCNsigmaPi", 0.0, "max. TPC n sigma for pion exclusion"}; - Configurable down_scaling{"down_scaling", 1e-3, "down scaling factor to store charged particles"}; - - std::pair> itsRequirement = {1, {0, 1, 2}}; // any hits on 3 ITS ib layers. - - int mRunNumber; - float d_bz; - Service ccdb; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - - HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - std::mt19937 engine; - std::uniform_real_distribution dist01; - - void init(InitContext&) - { - mRunNumber = 0; - d_bz = 0; - - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - - addHistograms(); - std::random_device seed_gen; - engine = std::mt19937(seed_gen()); - dist01 = std::uniform_real_distribution(0.0f, 1.0f); - } - - void addHistograms() - { - fRegistry.add("hCollisionCounter", "collision counter", kTH1F, {{2, -0.5f, 1.5}}, false); - // for track info - fRegistry.add("Track/positive/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); - fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); - fRegistry.add("Track/positive/hPtPhi", "pT vs. #varphi;#varphi (rad.);p_{T} (GeV/c)", kTH2F, {{360, 0, 2 * M_PI}, {1000, 0.0f, 10.f}}, false); - fRegistry.add("Track/positive/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{360, 0, 2 * M_PI}, {40, -2.0f, 2.0f}}, false); - fRegistry.add("Track/positive/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.0f, 1.0f}}, false); - fRegistry.add("Track/positive/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); - fRegistry.add("Track/positive/hDCAxyRes_Pt", "DCA_{xy} resolution vs. pT;p_{T} (GeV/c);DCA_{xy} resolution (#mum)", kTH2F, {{1000, 0, 10}, {100, 0., 1000}}, false); - fRegistry.add("Track/positive/hDCAzRes_Pt", "DCA_{z} resolution vs. pT;p_{T} (GeV/c);DCA_{z} resolution (#mum)", kTH2F, {{1000, 0, 10}, {100, 0., 1000}}, false); - fRegistry.add("Track/positive/hNclsTPC", "number of TPC clusters", kTH1F, {{161, -0.5, 160.5}}, false); - fRegistry.add("Track/positive/hNcrTPC", "number of TPC crossed rows", kTH1F, {{161, -0.5, 160.5}}, false); - fRegistry.add("Track/positive/hChi2TPC", "chi2/number of TPC clusters", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Track/positive/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); - fRegistry.add("Track/positive/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFbeta", "TOF beta;p_{in} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {600, 0, 1.2}}, false); - fRegistry.add("Track/positive/h1OverTOFbeta", "1/TOF beta;p_{in} (GeV/c);1/#beta", kTH2F, {{1000, 0, 10}, {1000, 0.8, 1.8}}, false); - fRegistry.add("Track/positive/hTOFNsigmaEl", "TOF n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaMu", "TOF n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaPi", "TOF n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaKa", "TOF n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaPr", "TOF n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); - fRegistry.add("Track/positive/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); - fRegistry.add("Track/positive/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); - fRegistry.add("Track/positive/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Track/positive/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); - fRegistry.addClone("Track/positive/", "Track/negative/"); - } - - template - void initCCDB(TBC const& bc) - { - if (mRunNumber == bc.runNumber()) { - return; - } - - // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; - o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); - } - o2::base::Propagator::initFieldFromGRP(&grpmag); - mRunNumber = bc.runNumber(); - return; - } - - auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - if (grpo) { - o2::base::Propagator::initFieldFromGRP(grpo); - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - o2::base::Propagator::initFieldFromGRP(grpmag); - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = bc.runNumber(); - } - - template - bool checkTrack(TTrack const& track) - { - if constexpr (isMC) { - if (!track.has_mcParticle()) { - return false; - } - } - - if (track.pt() < minpt || abs(track.eta()) > maxeta) { - return false; - } - - if (track.tpcChi2NCl() > maxchi2tpc) { - return false; - } - - if (track.itsChi2NCl() > maxchi2its) { - return false; - } - - if (!track.hasITS() || !track.hasTPC()) { - return false; - } - - if (track.itsNCls() < minitsncls) { - return false; - } - - auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); - if (hits < itsRequirement.first) { - return false; - } - - if (track.tpcNClsFound() < min_ncluster_tpc) { - return false; - } - - if (track.tpcNClsCrossedRows() < mincrossedrows) { - return false; - } - - if (track.tpcCrossedRowsOverFindableCls() < min_tpc_cr_findable_ratio) { - return false; - } - - if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { - return false; - } - if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi) { - return false; - } - - return true; - } - - template - void fillTrackHistograms(TTrack const& track) - { - if (track.sign() > 0) { - fRegistry.fill(HIST("Track/positive/hPt"), track.pt()); - fRegistry.fill(HIST("Track/positive/hQoverPt"), track.sign() / track.pt()); - fRegistry.fill(HIST("Track/positive/hEtaPhi"), track.phi(), track.eta()); - fRegistry.fill(HIST("Track/positive/hPtPhi"), track.phi(), track.pt()); - fRegistry.fill(HIST("Track/positive/hDCAxyz"), track.dcaXY(), track.dcaZ()); - fRegistry.fill(HIST("Track/positive/hDCAxyzSigma"), track.dcaXY() / sqrt(track.cYY()), track.dcaZ() / sqrt(track.cZZ())); - fRegistry.fill(HIST("Track/positive/hDCAxyRes_Pt"), track.pt(), sqrt(track.cYY()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/positive/hDCAzRes_Pt"), track.pt(), sqrt(track.cZZ()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/positive/hNclsITS"), track.itsNCls()); - fRegistry.fill(HIST("Track/positive/hNclsTPC"), track.tpcNClsFound()); - fRegistry.fill(HIST("Track/positive/hNcrTPC"), track.tpcNClsCrossedRows()); - fRegistry.fill(HIST("Track/positive/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); - fRegistry.fill(HIST("Track/positive/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); - fRegistry.fill(HIST("Track/positive/hChi2TPC"), track.tpcChi2NCl()); - fRegistry.fill(HIST("Track/positive/hChi2ITS"), track.itsChi2NCl()); - fRegistry.fill(HIST("Track/positive/hITSClusterMap"), track.itsClusterMap()); - fRegistry.fill(HIST("Track/positive/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST("Track/positive/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); - fRegistry.fill(HIST("Track/positive/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); - fRegistry.fill(HIST("Track/positive/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); - fRegistry.fill(HIST("Track/positive/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); - fRegistry.fill(HIST("Track/positive/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); - fRegistry.fill(HIST("Track/positive/hTOFbeta"), track.tpcInnerParam(), track.beta()); - fRegistry.fill(HIST("Track/positive/h1OverTOFbeta"), track.tpcInnerParam(), 1.f / track.beta()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaEl"), track.tpcInnerParam(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaMu"), track.tpcInnerParam(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaPi"), track.tpcInnerParam(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaKa"), track.tpcInnerParam(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaPr"), track.tpcInnerParam(), track.tofNSigmaPr()); - } else { - fRegistry.fill(HIST("Track/negative/hPt"), track.pt()); - fRegistry.fill(HIST("Track/negative/hQoverPt"), track.sign() / track.pt()); - fRegistry.fill(HIST("Track/negative/hEtaPhi"), track.phi(), track.eta()); - fRegistry.fill(HIST("Track/negative/hPtPhi"), track.phi(), track.pt()); - fRegistry.fill(HIST("Track/negative/hDCAxyz"), track.dcaXY(), track.dcaZ()); - fRegistry.fill(HIST("Track/negative/hDCAxyzSigma"), track.dcaXY() / sqrt(track.cYY()), track.dcaZ() / sqrt(track.cZZ())); - fRegistry.fill(HIST("Track/negative/hDCAxyRes_Pt"), track.pt(), sqrt(track.cYY()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/negative/hDCAzRes_Pt"), track.pt(), sqrt(track.cZZ()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/negative/hNclsITS"), track.itsNCls()); - fRegistry.fill(HIST("Track/negative/hNclsTPC"), track.tpcNClsFound()); - fRegistry.fill(HIST("Track/negative/hNcrTPC"), track.tpcNClsCrossedRows()); - fRegistry.fill(HIST("Track/negative/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); - fRegistry.fill(HIST("Track/negative/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); - fRegistry.fill(HIST("Track/negative/hChi2TPC"), track.tpcChi2NCl()); - fRegistry.fill(HIST("Track/negative/hChi2ITS"), track.itsChi2NCl()); - fRegistry.fill(HIST("Track/negative/hITSClusterMap"), track.itsClusterMap()); - fRegistry.fill(HIST("Track/negative/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST("Track/negative/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); - fRegistry.fill(HIST("Track/negative/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); - fRegistry.fill(HIST("Track/negative/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); - fRegistry.fill(HIST("Track/negative/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); - fRegistry.fill(HIST("Track/negative/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); - fRegistry.fill(HIST("Track/negative/hTOFbeta"), track.tpcInnerParam(), track.beta()); - fRegistry.fill(HIST("Track/negative/h1OverTOFbeta"), track.tpcInnerParam(), 1.f / track.beta()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaEl"), track.tpcInnerParam(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaMu"), track.tpcInnerParam(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaPi"), track.tpcInnerParam(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaKa"), track.tpcInnerParam(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaPr"), track.tpcInnerParam(), track.tofNSigmaPr()); - } - } - - template - void fillTrackTable(TTrack const& track) - { - emprimaryelectrons(track.collisionId(), track.globalIndex(), track.sign(), - track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - track.tpcChi2NCl(), track.tpcInnerParam(), - track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), - track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), track.x(), track.alpha(), track.y(), track.z(), track.snp(), track.tgl(), true); - } - - SliceCache cache; - Preslice perCollision_track = o2::aod::track::collisionId; - - Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& nabs(o2::aod::track::dcaXY) < dca_xy_max&& nabs(o2::aod::track::dcaZ) < dca_z_max&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; - Filter pidFilter = (minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl) && (o2::aod::pidtpc::tpcNSigmaPi < minTPCNsigmaPi || maxTPCNsigmaPi < o2::aod::pidtpc::tpcNSigmaPi); - using MyFilteredTracks = soa::Filtered; - - // ---------- for data ---------- - void processRec(MyCollisions_Cent const& collisions, MyBCs const&, MyFilteredTracks const& tracks) - { - for (auto& collision : collisions) { - auto bc = collision.bc_as(); - initCCDB(bc); - - fRegistry.fill(HIST("hCollisionCounter"), 0.f); - if (dist01(engine) > down_scaling) { - continue; - } - fRegistry.fill(HIST("hCollisionCounter"), 1.f); - - event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), bc.timestamp(), - collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange()); - event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); - - auto tracks_per_collision = tracks.sliceBy(perCollision_track, collision.globalIndex()); - - for (auto& track : tracks_per_collision) { - if (!checkTrack(track)) { - continue; - } - fillTrackTable(track); - prmeleventid(event.lastIndex()); - fillTrackHistograms(track); - } // end of track loop - - } // end of collision loop - } - PROCESS_SWITCH(TreeCreatorSingleElectronQA, processRec, "process reconstructed info only", true); // standalone - - // ---------- for MC ---------- - using MyFilteredTracksMC = soa::Filtered; - void processMC(MyCollisionsMC_Cent const& collisions, aod::McCollisions const&, MyBCs const&, MyFilteredTracksMC const& tracks) - { - for (auto& collision : collisions) { - if (!collision.has_mcCollision()) { - continue; - } - auto bc = collision.bc_as(); - initCCDB(bc); - - fRegistry.fill(HIST("hCollisionCounter"), 0.f); - if (dist01(engine) > down_scaling) { - continue; - } - fRegistry.fill(HIST("hCollisionCounter"), 1.f); - - event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), bc.timestamp(), - collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange()); - event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); - - auto tracks_per_collision = tracks.sliceBy(perCollision_track, collision.globalIndex()); - - for (auto& track : tracks_per_collision) { - if (!checkTrack(track)) { - continue; - } - fillTrackTable(track); - prmeleventid(event.lastIndex()); - fillTrackHistograms(track); - } // end of track loop - - } // end of collision loop - } - PROCESS_SWITCH(TreeCreatorSingleElectronQA, processMC, "process reconstructed and MC info ", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"tree-creator-single-electron-qa"}), - }; -} diff --git a/PWGEM/Dilepton/Tasks/CMakeLists.txt b/PWGEM/Dilepton/Tasks/CMakeLists.txt index 230d687ddcc..f84c8513ac9 100644 --- a/PWGEM/Dilepton/Tasks/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/CMakeLists.txt @@ -9,6 +9,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. +add_subdirectory(Converters) o2physics_add_dpl_workflow(efficiency-ee SOURCES emEfficiencyEE.cxx @@ -115,3 +116,8 @@ o2physics_add_dpl_workflow(photon-hbt-pcmee PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore O2Physics::MLCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(prefilter-dielectron + SOURCES prefilterDielectron.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::MLCore O2Physics::PWGEMDileptonCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt new file mode 100644 index 00000000000..b4c302a111e --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +# All rights not expressly granted are reserved. +# +# This software is distributed under the terms of the GNU General Public +# License v3 (GPL Version 3), copied verbatim in the file "COPYING". +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + + +o2physics_add_dpl_workflow(event-converter1 + SOURCES eventConverter1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(electron-converter1 + SOURCES electronConverter1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/Dilepton/Tasks/Converters/electronConverter1.cxx b/PWGEM/Dilepton/Tasks/Converters/electronConverter1.cxx new file mode 100644 index 00000000000..f908b6809b2 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/electronConverter1.cxx @@ -0,0 +1,78 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code runs loop over ULS ee pars for virtual photon QC. +// Please write to: daiki.sekihata@cern.ch + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct electronConverter1 { + Produces track_001; + + void process(aod::EMPrimaryElectrons_000 const& tracks) + { + for (auto& track : tracks) { + track_001(track.collisionId(), + track.trackId(), + track.sign(), + track.pt(), + track.eta(), + track.phi(), + track.dcaXY(), + track.dcaZ(), + track.tpcNClsFindable(), + track.tpcNClsFindableMinusFound(), + track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsShared(), + track.tpcChi2NCl(), + track.tpcInnerParam(), + track.tpcSignal(), + track.tpcNSigmaEl(), + track.tpcNSigmaMu(), + track.tpcNSigmaPi(), + track.tpcNSigmaKa(), + track.tpcNSigmaPr(), + track.beta(), + track.tofNSigmaEl(), + track.tofNSigmaMu(), + track.tofNSigmaPi(), + track.tofNSigmaKa(), + track.tofNSigmaPr(), + track.itsClusterSizes(), + track.itsChi2NCl(), + -1.f, + track.detectorMap(), + track.x(), + track.alpha(), + track.y(), + track.z(), + track.snp(), + track.tgl(), + track.isAssociatedToMPC()); + } // end of track loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"electron-converter1"})}; +} diff --git a/PWGEM/Dilepton/Tasks/Converters/eventConverter1.cxx b/PWGEM/Dilepton/Tasks/Converters/eventConverter1.cxx new file mode 100644 index 00000000000..148ff43bd88 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/eventConverter1.cxx @@ -0,0 +1,54 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code runs loop over ULS ee pars for virtual photon QC. +// Please write to: daiki.sekihata@cern.ch + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct eventConverter1 { + Produces event_001; + + void process(aod::EMEvents_000 const& collisions) + { + for (auto& collision : collisions) { + event_001( + collision.globalIndex(), + collision.runNumber(), + collision.globalBC(), + collision.alias_raw(), + collision.selection_raw(), + collision.timestamp(), + collision.posX(), + collision.posY(), + collision.posZ(), + collision.numContrib(), + collision.trackOccupancyInTimeRange(), + -1.f); + } // end of collision loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"event-converter1"})}; +} diff --git a/PWGEM/Dilepton/Tasks/MCtemplates.cxx b/PWGEM/Dilepton/Tasks/MCtemplates.cxx index c41d27f91d1..30b60856cb5 100644 --- a/PWGEM/Dilepton/Tasks/MCtemplates.cxx +++ b/PWGEM/Dilepton/Tasks/MCtemplates.cxx @@ -333,9 +333,9 @@ struct AnalysisTrackSelection { fHistMan->FillHistClass(fHistNamesMCMatched[j][i].Data(), VarManager::fgValues); } } // end loop over cuts - } // end loop over MC signals - } // end loop over tracks - } + } // end loop over MC signals + } // end loop over tracks + } // end runTrackSelection template void runMCGenTrack(TTracksMC const& groupedMCTracks) diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index 24efd7f232d..6df7af5c768 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -13,6 +13,12 @@ // Analysis task to produce resolution mapfor electrons/muons in dilepton analysis // Please write to: daiki.sekihata@cern.ch +#include +#include +#include +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -66,6 +72,16 @@ struct CreateResolutionMap { Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; + ConfigurableAxis ConfPtGenBins{"ConfPtGenBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.50, 6.00, 6.50, 7.00, 7.50, 8.00, 8.50, 9.00, 9.50, 10.00, 11.00, 12.00, 13.00, 14.00, 15.00, 16.00, 17.00, 18.00, 19.00, 20.00}, "gen. pT bins for output histograms"}; + + ConfigurableAxis ConfEtaCBGenBins{"ConfEtaCBGenBins", {30, -1.5, +1.5}, "gen. eta bins at midrapidity for output histograms"}; + ConfigurableAxis ConfEtaFWDGenBins{"ConfEtaFWDGenBins", {30, -5, -2.0}, "gen. eta bins at forward rapidity for output histograms"}; + ConfigurableAxis ConfPhiGenBins{"ConfPhiGenBins", {90, 0, 2.f * M_PI}, "gen. eta bins at forward rapidity for output histograms"}; + + ConfigurableAxis ConfRelDeltaPtBins{"ConfRelDeltaPtBins", {200, -1.f, +1.f}, "rel. dpt for output histograms"}; + ConfigurableAxis ConfDeltaEtaBins{"ConfDeltaEtaBins", {200, -0.1f, +0.1f}, "deta bins for output histograms"}; + ConfigurableAxis ConfDeltaPhiBins{"ConfDeltaPhiBins", {200, -0.1f, +0.1f}, "dphi bins for output histograms"}; + struct : ConfigurableGroup { std::string prefix = "electroncut_group"; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.01, "min pT for single track"}; @@ -84,7 +100,7 @@ struct CreateResolutionMap { struct : ConfigurableGroup { std::string prefix = "muoncut_group"; - Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; + Configurable cfg_track_type{"cfg_track_type", 3, "muon track type [0: MFT-MCH-MID, 3: MCH-MID]"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.01, "min pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -5.0, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", -1.5, "max eta for single track"}; @@ -113,10 +129,13 @@ struct CreateResolutionMap { ccdb->setFatalWhenNull(false); ccdbApi.init(ccdburl); - const AxisSpec axis_pt_gen{{0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.50, 6.00, 6.50, 7.00, 7.50, 8.00, 8.50, 9.00, 9.50, 10.00, 11.00, 12.00, 13.00, 14.00, 15.00, 16.00, 17.00, 18.00, 19.00, 20.00}, "p_{T,l}^{gen} (GeV/c)"}; - const AxisSpec axis_dpt{400, -1, 1, "(p_{T,l}^{gen.} - p_{T,l}^{rec.})/p_{T,l}^{gen.}"}; - const AxisSpec axis_deta{500, -0.5, +0.5, "#eta_{l}^{gen.} - #eta_{l}^{rec.}"}; - const AxisSpec axis_dphi{500, -0.5, +0.5, "#varphi_{l}^{gen.} - #varphi_{l}^{rec.} (rad.)"}; + const AxisSpec axis_pt_gen{ConfPtGenBins, "p_{T,l}^{gen} (GeV/c)"}; + const AxisSpec axis_eta_cb_gen{ConfEtaCBGenBins, "#eta_{l}^{gen}"}; + const AxisSpec axis_eta_fwd_gen{ConfEtaFWDGenBins, "#eta_{l}^{gen}"}; + const AxisSpec axis_phi_gen{ConfPhiGenBins, "#varphi_{l}^{gen} (rad.)"}; + const AxisSpec axis_dpt{ConfRelDeltaPtBins, "(p_{T,l}^{gen} - p_{T,l}^{rec})/p_{T,l}^{gen}"}; + const AxisSpec axis_deta{ConfDeltaEtaBins, "#eta_{l}^{gen} - #eta_{l}^{rec}"}; + const AxisSpec axis_dphi{ConfDeltaPhiBins, "#varphi_{l}^{gen} - #varphi_{l}^{rec} (rad.)"}; registry.add("Electron/Ptgen_RelDeltaPt", "resolution", kTH2F, {{axis_pt_gen}, {axis_dpt}}, true); registry.add("Electron/Ptgen_DeltaEta", "resolution", kTH2F, {{axis_pt_gen}, {axis_deta}}, true); @@ -124,6 +143,13 @@ struct CreateResolutionMap { registry.add("Electron/Ptgen_DeltaPhi_Neg", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); registry.addClone("Electron/", "StandaloneMuon/"); registry.addClone("Electron/", "GlobalMuon/"); + + registry.add("Electron/hs_reso_Pos", "6D resolution positive", kTHnSparseF, {axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("StandaloneMuon/hs_reso_Pos", "6D resolution positive", kTHnSparseF, {axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("GlobalMuon/hs_reso_Pos", "6D resolution positive", kTHnSparseF, {axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("Electron/hs_reso_Neg", "6D resolution negative", kTHnSparseF, {axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("StandaloneMuon/hs_reso_Neg", "6D resolution negative", kTHnSparseF, {axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("GlobalMuon/hs_reso_Neg", "6D resolution negative", kTHnSparseF, {axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_dpt, axis_deta, axis_dphi}, true); } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -292,16 +318,20 @@ struct CreateResolutionMap { registry.fill(HIST("StandaloneMuon/Ptgen_DeltaEta"), mctrack.pt(), mctrack.eta() - eta); if (mctrack.pdgCode() == -13) { // positive muon registry.fill(HIST("StandaloneMuon/Ptgen_DeltaPhi_Pos"), mctrack.pt(), mctrack.phi() - phi); + registry.fill(HIST("StandaloneMuon/hs_reso_Pos"), mctrack.pt(), mctrack.eta(), mctrack.phi(), (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi); } else if (mctrack.pdgCode() == 13) { // negative muon registry.fill(HIST("StandaloneMuon/Ptgen_DeltaPhi_Neg"), mctrack.pt(), mctrack.phi() - phi); + registry.fill(HIST("StandaloneMuon/hs_reso_Neg"), mctrack.pt(), mctrack.eta(), mctrack.phi(), (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi); } } else if (muon.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack)) { registry.fill(HIST("GlobalMuon/Ptgen_RelDeltaPt"), mctrack.pt(), (mctrack.pt() - pt) / mctrack.pt()); registry.fill(HIST("GlobalMuon/Ptgen_DeltaEta"), mctrack.pt(), mctrack.eta() - eta); if (mctrack.pdgCode() == -13) { // positive muon registry.fill(HIST("GlobalMuon/Ptgen_DeltaPhi_Pos"), mctrack.pt(), mctrack.phi() - phi); + registry.fill(HIST("GlobalMuon/hs_reso_Pos"), mctrack.pt(), mctrack.eta(), mctrack.phi(), (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi); } else if (mctrack.pdgCode() == 13) { // negative muon registry.fill(HIST("GlobalMuon/Ptgen_DeltaPhi_Neg"), mctrack.pt(), mctrack.phi() - phi); + registry.fill(HIST("GlobalMuon/hs_reso_Neg"), mctrack.pt(), mctrack.eta(), mctrack.phi(), (mctrack.pt() - pt) / mctrack.pt(), mctrack.eta() - eta, mctrack.phi() - phi); } } return true; @@ -355,8 +385,10 @@ struct CreateResolutionMap { registry.fill(HIST("Electron/Ptgen_DeltaEta"), mctrack.pt(), mctrack.eta() - track.eta()); if (mctrack.pdgCode() == -11) { // positron registry.fill(HIST("Electron/Ptgen_DeltaPhi_Pos"), mctrack.pt(), mctrack.phi() - track.phi()); + registry.fill(HIST("Electron/hs_reso_Pos"), mctrack.pt(), mctrack.eta(), mctrack.phi(), (mctrack.pt() - track.pt()) / mctrack.pt(), mctrack.eta() - track.eta(), mctrack.phi() - track.phi()); } else if (mctrack.pdgCode() == 11) { // electron registry.fill(HIST("Electron/Ptgen_DeltaPhi_Neg"), mctrack.pt(), mctrack.phi() - track.phi()); + registry.fill(HIST("Electron/hs_reso_Neg"), mctrack.pt(), mctrack.eta(), mctrack.phi(), (mctrack.pt() - track.pt()) / mctrack.pt(), mctrack.eta() - track.eta(), mctrack.phi() - track.phi()); } } // end of track loop diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index ab6f1587c2a..640038992dc 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -14,6 +14,7 @@ // This code is for event QC for PWG-EM. // Please write to: daiki.sekihata@cern.ch +#include #include #include #include @@ -23,6 +24,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" #include "Common/Core/RecoDecay.h" +#include "MathUtils/Utils.h" #include "Framework/AnalysisDataModel.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" @@ -41,9 +43,8 @@ using namespace o2::soa; using MyBCs = soa::Join; using MyQvectors = soa::Join; -using MyCollisions = soa::Join; -using MyCollisions_Cent = soa::Join; // centrality table has dependency on multiplicity table. -using MyCollisions_Cent_Qvec = soa::Join; +using MyCollisions = soa::Join; +using MyCollisions_Qvec = soa::Join; using MyTracks = soa::Join cfgRequireNoITSROFB{"cfgRequireNoITSROFB", true, "require no ITS readout frame border in event cut"}; Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgRequirekNoCollInRofStrict{"cfgRequirekNoCollInRofStrict", false, "require no other collisions in this Readout Frame"}; - Configurable cfgRequirekNoCollInRofStandard{"cfgRequirekNoCollInRofStandard", false, "require no other collisions in this Readout Frame with per-collision multiplicity above threshold"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. track occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. track occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequirekNoCollInRofStandard{"cfgRequirekNoCollInRofStandard", false, "require no other collisions in this Readout Frame with per-collision multiplicity above threshold"}; + Configurable cfgRequirekNoCollInRofStrict{"cfgRequirekNoCollInRofStrict", false, "require no other collisions in this Readout Frame"}; } eventcuts; struct : ConfigurableGroup { @@ -102,10 +106,6 @@ struct eventQC { Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", 0.0, "max n sigma pi in TPC for exclusion"}; Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -1e+10, "min n sigma e in TOF"}; Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +1e+10, "max n sigma e in TOF"}; - Configurable cfg_min_p_its_cluster_size{"cfg_min_p_its_cluster_size", 0.0, "min p to apply ITS cluster size cut"}; - Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.0, "max p to apply ITS cluster size cut"}; - Configurable cfg_slope_its_cluster_size{"cfg_slope_its_cluster_size", 0.4f, "slope for max ITS cluster size vs. p"}; - Configurable cfg_intercept_its_cluster_size{"cfg_intercept_its_cluster_size", 1.94f, "intercept for max ITS cluster size vs. p"}; Configurable cfg_requireTOF{"cfg_requireTOF", false, "require TOF hit"}; } trackcuts; @@ -158,6 +158,7 @@ struct eventQC { fRegistry.add("Event/before/hNTracksPVvsOccupancy", "hNTracksPVvsOccupancy;N_{track} to PV;N_{track} in time range", kTH2F, {{600, 0, 6000}, {200, 0, 20000}}, false); fRegistry.add("Event/before/hNGlobalTracksvsOccupancy", "hNGlobalTracksvsOccupancy;N_{track}^{global};N_{track} in time range", kTH2F, {{600, 0, 6000}, {200, 0, 20000}}, false); fRegistry.add("Event/before/hNGlobalTracksPVvsOccupancy", "hNGlobalTracksPVvsOccupancy;N_{track}^{global} to PV;N_{track} in time range", kTH2F, {{600, 0, 6000}, {200, 0, 20000}}, false); + fRegistry.add("Event/before/hCorrOccupancy", "occupancy correlation;FT0C occupancy;track-based occupancy", kTH2F, {{200, 0, 200000}, {200, 0, 20000}}, false); fRegistry.addClone("Event/before/", "Event/after/"); fRegistry.add("Event/after/hMultNGlobalTracks", "hMultNGlobalTracks; N_{track}^{global}", kTH1F, {{6001, -0.5, 6000.5}}, false); @@ -243,12 +244,14 @@ struct eventQC { fRegistry.add("Track/hNclsTPC", "number of TPC clusters", kTH1F, {{161, -0.5, 160.5}}, false); fRegistry.add("Track/hNcrTPC", "number of TPC crossed rows", kTH1F, {{161, -0.5, 160.5}}, false); fRegistry.add("Track/hChi2TPC", "chi2/number of TPC clusters", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Track/hDeltaPin", "p_{in} vs. p_{pv};p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", kTH2F, {{1000, 0, 10}, {200, -1, +1}}, false); fRegistry.add("Track/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); fRegistry.add("Track/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); fRegistry.add("Track/hTPCNclsShared", "TPC Ncls shared/Ncls;p_{T} (GeV/c);N_{cls}^{shared}/N_{cls} in TPC", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); fRegistry.add("Track/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); fRegistry.add("Track/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); fRegistry.add("Track/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); + fRegistry.add("Track/hChi2TOF", "chi2 of TOF", kTH1F, {{100, 0, 10}}, false); if (cfgFillPID) { fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{pv} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); @@ -284,8 +287,10 @@ struct eventQC { fRegistry.fill(HIST("Track/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); fRegistry.fill(HIST("Track/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); fRegistry.fill(HIST("Track/hChi2TPC"), track.tpcChi2NCl()); + fRegistry.fill(HIST("Track/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); fRegistry.fill(HIST("Track/hChi2ITS"), track.itsChi2NCl()); fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); + fRegistry.fill(HIST("Track/hChi2TOF"), track.tofChi2()); if (cfgFillPID) { int nsize = 0; @@ -353,15 +358,14 @@ struct eventQC { fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hNTracksPVvsOccupancy"), collision.multNTracksPV(), collision.trackOccupancyInTimeRange()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCorrOccupancy"), collision.ft0cOccupancyInTimeRange(), collision.trackOccupancyInTimeRange()); - if constexpr (std::is_same_v, FilteredMyCollision_Cent> || std::is_same_v, FilteredMyCollision_Cent_Qvec>) { - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0A"), collision.centFT0A()); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0C"), collision.centFT0C()); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0M"), collision.centFT0M()); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0CvsMultNTracksPV"), collision.centFT0C(), collision.multNTracksPV()); - } + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0A"), collision.centFT0A()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0C"), collision.centFT0C()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0M"), collision.centFT0M()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0CvsMultNTracksPV"), collision.centFT0C(), collision.multNTracksPV()); - if constexpr (ev_id == 1 && std::is_same_v, FilteredMyCollision_Cent_Qvec>) { + if constexpr (ev_id == 1 && std::is_same_v, FilteredMyCollision_Qvec>) { if (std::find(cfgnMods->begin(), cfgnMods->end(), 2) != cfgnMods->end()) { fillQvectorInfo(collision); } @@ -575,23 +579,6 @@ struct eventQC { return false; } - uint32_t itsClusterSizes = track.itsClusterSizes(); - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 0; layer < 7; layer++) { - int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; - } - - float clsize = static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl())); - float upper_edge = trackcuts.cfg_slope_its_cluster_size * track.p() + trackcuts.cfg_intercept_its_cluster_size; - - if ((trackcuts.cfg_min_p_its_cluster_size < track.p() && track.p() < trackcuts.cfg_max_p_its_cluster_size) && clsize > upper_edge) { - return false; - } - return true; } @@ -630,6 +617,10 @@ struct eventQC { return false; } + if (eventcuts.cfgRequireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + if (eventcuts.cfgRequirekNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { return false; } @@ -638,7 +629,11 @@ struct eventQC { return false; } - if (!(eventcuts.cfgOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgOccupancyMax)) { + if (!(eventcuts.cfgTrackOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgTrackOccupancyMax)) { + return false; + } + + if (!(eventcuts.cfgFT0COccupancyMin < collision.ft0cOccupancyInTimeRange() && collision.ft0cOccupancyInTimeRange() < eventcuts.cfgFT0COccupancyMax)) { return false; } @@ -647,14 +642,13 @@ struct eventQC { Filter collisionFilter_evsel = o2::aod::evsel::sel8 == true && nabs(o2::aod::collision::posZ) < eventcuts.cfgZvtxMax; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - Filter collisionFilter_occupancy = eventcuts.cfgOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgOccupancyMax; + Filter collisionFilter_track_occupancy = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_ft0c_occupancy = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; - using FilteredMyCollisions_Cent = soa::Filtered; - using FilteredMyCollisions_Cent_Qvec = soa::Filtered; + using FilteredMyCollisions_Qvec = soa::Filtered; using FilteredMyCollision = FilteredMyCollisions::iterator; - using FilteredMyCollision_Cent = FilteredMyCollisions_Cent::iterator; - using FilteredMyCollision_Cent_Qvec = FilteredMyCollisions_Cent_Qvec::iterator; + using FilteredMyCollision_Qvec = FilteredMyCollisions_Qvec::iterator; Filter trackFilter = (trackcuts.cfg_min_pt_track < o2::aod::track::pt && o2::aod::track::pt < trackcuts.cfg_max_pt_track) && (trackcuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < trackcuts.cfg_max_eta_track) && nabs(o2::aod::track::dcaXY) < trackcuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < trackcuts.cfg_max_dcaz && o2::aod::track::tpcChi2NCl < trackcuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < trackcuts.cfg_max_chi2its && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; using FilteredMyTracks = soa::Filtered; @@ -666,13 +660,9 @@ struct eventQC { void processQC(TCollisions const& collisions, FilteredMyTracks const& tracks) { for (auto& collision : collisions) { - if constexpr (std::is_same_v, FilteredMyCollisions_Cent> || std::is_same_v, FilteredMyCollisions_Cent_Qvec>) { - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; - if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { - continue; - } - if constexpr (std::is_same_v, FilteredMyCollisions_Cent_Qvec>) { - } + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + continue; } fillEventInfo<0>(collision); if (!isSelectedEvent(collision)) { @@ -694,7 +684,7 @@ struct eventQC { if (fabs(track.eta()) < 0.8) { nGlobalTracks++; - if constexpr (std::is_same_v, FilteredMyCollisions_Cent_Qvec>) { + if constexpr (std::is_same_v, FilteredMyCollisions_Qvec>) { for (int i = 0; i < static_cast(cfgnMods->size()); i++) { if (cfgnMods->at(i) == 2) { fillVn<2>(collision, track); @@ -716,17 +706,15 @@ struct eventQC { fRegistry.fill(HIST("Event/after/hMultFT0CvsMultNGlobalTracksPV"), collision.multFT0C(), nGlobalTracksPV); fRegistry.fill(HIST("Event/after/hNGlobalTracksvsOccupancy"), nGlobalTracks, collision.trackOccupancyInTimeRange()); fRegistry.fill(HIST("Event/after/hNGlobalTracksPVvsOccupancy"), nGlobalTracksPV, collision.trackOccupancyInTimeRange()); - if constexpr (std::is_same_v, FilteredMyCollisions_Cent> || std::is_same_v, FilteredMyCollisions_Cent_Qvec>) { + if constexpr (std::is_same_v, FilteredMyCollisions_Qvec>) { fRegistry.fill(HIST("Event/after/hCentFT0CvsMultNGlobalTracks"), collision.centFT0C(), nGlobalTracks); fRegistry.fill(HIST("Event/after/hCentFT0CvsMultNGlobalTracksPV"), collision.centFT0C(), nGlobalTracksPV); } } // end of collision loop - } // end of process PROCESS_SWITCH_FULL(eventQC, processQC, processEventQC, "event QC", true); - PROCESS_SWITCH_FULL(eventQC, processQC, processEventQC_Cent, "event QC + centrality", false); - PROCESS_SWITCH_FULL(eventQC, processQC, processEventQC_Cent_Qvec, "event QC + centrality + q vector", false); + PROCESS_SWITCH_FULL(eventQC, processQC, processEventQC_Cent_Qvec, "event QC + q vector", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGEM/Dilepton/Tasks/lmeeHFCocktail.cxx b/PWGEM/Dilepton/Tasks/lmeeHFCocktail.cxx index 69f556d778d..604f11ffde4 100644 --- a/PWGEM/Dilepton/Tasks/lmeeHFCocktail.cxx +++ b/PWGEM/Dilepton/Tasks/lmeeHFCocktail.cxx @@ -15,7 +15,10 @@ /// \author Daniel Samitz, , SMI Vienna /// Elisa Meninno, , SMI Vienna +#include + #include "Math/Vector4D.h" +#include "MathUtils/Utils.h" #include "Framework/Task.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -80,7 +83,7 @@ void doSingle(T& p, std::vector> hEta, std::vector -void doPair(T& p1, T& p2, std::vector> hMee, std::vector> hMeePtee, float ptMin, float etaMax) +void doPair(T& p1, T& p2, std::vector> hMee, std::vector> hMeePtee, float ptMin, float etaMax, bool apply_detadphi, float min_deta, float min_dphi) { ROOT::Math::PtEtaPhiMVector v1(p1.ptSmeared(), p1.etaSmeared(), p1.phiSmeared(), o2::constants::physics::MassElectron); @@ -100,6 +103,13 @@ void doPair(T& p1, T& p2, std::vector> hMee, std::vector cut_pt[i] && pt2[i] > cut_pt[i] && fabs(eta1[i]) < cut_eta[i] && fabs(eta2[i]) < cut_eta[i]) { hMee[i]->Fill(mass[i], weight[i]); @@ -115,6 +125,9 @@ struct MyConfigs : ConfigurableGroup { ConfigurableAxis fConfigEtaBins{"cfgEtaBins", {200, -10.f, 10.f}, "eta binning"}; ConfigurableAxis fConfigMeeBins{"cfgMeeBins", {800, 0.f, 8.f}, "Mee binning"}; ConfigurableAxis fConfigPteeBins{"cfgPteeBins", {400, 0.f, 10.f}, "pTee binning"}; + Configurable fConfigApplyDEtaDPhi{"cfgApplyDEtaDPhi", false, "flag to apply deta-phi cut"}; + Configurable fConfigMinDEta{"cfgMinDEta", 0.02, "minimum deta"}; + Configurable fConfigMinDPhi{"cfgMinDPhi", 0.2, "minimum dphi"}; }; struct lmeehfcocktailprefilter { @@ -272,11 +285,11 @@ struct lmeehfcocktailbeauty { LOG(error) << "Something is wrong here. There should not be dielectrons with same mother."; } - doPair(particle1, particle2, hULS_Mee, hULS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hULS_Mee, hULS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); if (particle1.bQuarkOriginId() < 0 || particle2.bQuarkOriginId() < 0 || particle1.bQuarkOriginId() != particle2.bQuarkOriginId()) continue; - doPair(particle1, particle2, hULS_Mee_wPartonicCheck, hULS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hULS_Mee_wPartonicCheck, hULS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); } // LS spectrum for (auto const& [particle1, particle2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(electronsGrouped, electronsGrouped))) { @@ -285,11 +298,11 @@ struct lmeehfcocktailbeauty { LOG(error) << "Something is wrong here. There should not be dielectrons with same mother."; } - doPair(particle1, particle2, hLS_Mee, hLS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hLS_Mee, hLS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); if (particle1.bQuarkOriginId() < 0 || particle2.bQuarkOriginId() < 0 || particle1.bQuarkOriginId() != particle2.bQuarkOriginId()) continue; - doPair(particle1, particle2, hLS_Mee_wPartonicCheck, hLS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hLS_Mee_wPartonicCheck, hLS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); } for (auto const& [particle1, particle2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(positronsGrouped, positronsGrouped))) { @@ -297,11 +310,11 @@ struct lmeehfcocktailbeauty { LOG(error) << "Something is wrong here. There should not be dielectrons with same mother."; } - doPair(particle1, particle2, hLS_Mee, hLS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hLS_Mee, hLS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); if (particle1.bQuarkOriginId() < 0 || particle2.bQuarkOriginId() < 0 || particle1.bQuarkOriginId() != particle2.bQuarkOriginId()) continue; - doPair(particle1, particle2, hLS_Mee_wPartonicCheck, hLS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hLS_Mee_wPartonicCheck, hLS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); } } } @@ -391,11 +404,11 @@ struct lmeehfcocktailcharm { LOG(error) << "Something is wrong here. There should not be dielectrons with same mother."; } - doPair(particle1, particle2, hULS_Mee, hULS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hULS_Mee, hULS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); if (particle1.cQuarkOriginId() < 0 || particle2.cQuarkOriginId() < 0 || particle1.cQuarkOriginId() != particle2.cQuarkOriginId()) continue; - doPair(particle1, particle2, hULS_Mee_wPartonicCheck, hULS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hULS_Mee_wPartonicCheck, hULS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); } // LS for (auto const& [particle1, particle2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(electronsGrouped, electronsGrouped))) { @@ -404,11 +417,11 @@ struct lmeehfcocktailcharm { LOG(error) << "Something is wrong here. There should not be dielectrons with same mother."; } - doPair(particle1, particle2, hLS_Mee, hLS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hLS_Mee, hLS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); if (particle1.cQuarkOriginId() < 0 || particle2.cQuarkOriginId() < 0 || particle1.cQuarkOriginId() != particle2.cQuarkOriginId()) continue; - doPair(particle1, particle2, hLS_Mee_wPartonicCheck, hLS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hLS_Mee_wPartonicCheck, hLS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); } for (auto const& [particle1, particle2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(positronsGrouped, positronsGrouped))) { @@ -416,11 +429,11 @@ struct lmeehfcocktailcharm { LOG(error) << "Something is wrong here. There should not be dielectrons with same mother."; } - doPair(particle1, particle2, hLS_Mee, hLS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hLS_Mee, hLS_MeePtee, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); if (particle1.cQuarkOriginId() < 0 || particle2.cQuarkOriginId() < 0 || particle1.cQuarkOriginId() != particle2.cQuarkOriginId()) continue; - doPair(particle1, particle2, hLS_Mee_wPartonicCheck, hLS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax); + doPair(particle1, particle2, hLS_Mee_wPartonicCheck, hLS_MeePtee_wPartonicCheck, myConfigs.fConfigPtMin, myConfigs.fConfigEtaMax, myConfigs.fConfigApplyDEtaDPhi, myConfigs.fConfigMinDEta, myConfigs.fConfigMinDPhi); } } } diff --git a/PWGEM/Dilepton/Tasks/lmeeLFCocktail.cxx b/PWGEM/Dilepton/Tasks/lmeeLFCocktail.cxx index 4629f70bc9c..86b69e3a78d 100644 --- a/PWGEM/Dilepton/Tasks/lmeeLFCocktail.cxx +++ b/PWGEM/Dilepton/Tasks/lmeeLFCocktail.cxx @@ -14,6 +14,10 @@ /// \analysis task for lmee light flavour cocktail /// \author Daniel Samitz, , SMI Vienna +#include +#include +#include + #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -62,6 +66,10 @@ struct lmeelfcocktail { HistogramRegistry registry{"registry", {}}; + Configurable fConfigApplyDEtaDPhi{"cfgApplyDEtaDPhi", false, "flag to apply deta-phi cut"}; + Configurable fConfigMinDEta{"cfgMinDEta", 0.02, "minimum deta"}; + Configurable fConfigMinDPhi{"cfgMinDPhi", 0.2, "minimum dphi"}; + Configurable fConfigMaxEta{"cfgMaxEta", 0.8, "maxium |eta|"}; Configurable fConfigMinPt{"cfgMinPt", 0.2, "minium pT"}; Configurable fConfigMaxPt{"cfgMaxPt", 8.0, "maximum pT"}; @@ -70,6 +78,7 @@ struct lmeelfcocktail { Configurable fConfigMaxRapee{"cfgMaxRapee", 999., "maximum pair rapidity"}; ConfigurableAxis fConfigMeeBins{"cfgMeeBins", {600, 0.f, 6.f}, "Mee binning"}; ConfigurableAxis fConfigPteeBins{"cfgPteeBins", {400, 0.f, 10.f}, "pTee binning"}; + ConfigurableAxis fConfigCos2DPhi{"cfgCos2DPhi", {200, -1.f, +1.f}, "cos(2x(phiee-PsiRP)) binning"}; // for dilepton v2. ConfigurableAxis fConfigPtBins{"cfgPtBins", {200, 0.f, 10.f}, "pT binning"}; ConfigurableAxis fConfigEtaBins{"cfgEtaBins", {200, -5.f, 5.f}, "eta binning"}; ConfigurableAxis fConfigPhiBins{"cfgPhiBins", {200, -TMath::Pi(), TMath::Pi()}, "phi binning"}; @@ -79,6 +88,7 @@ struct lmeelfcocktail { std::vector> histograms1D; std::vector> histograms2D; + std::vector> histogramsND; template bool from_primary(T& p1, U& mcParticles) @@ -113,12 +123,22 @@ struct lmeelfcocktail { return false; } ROOT::Math::PtEtaPhiMVector p12 = p1 + p2; - if (p12.Pt() < fConfigMinPtee) + if (p12.Pt() < fConfigMinPtee) { return false; - if (o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(p1.Px(), p1.Py(), p1.Pz(), p2.Px(), p2.Py(), p2.Pz()) < fConfigMinOpAng) + } + if (o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(p1.Px(), p1.Py(), p1.Pz(), p2.Px(), p2.Py(), p2.Pz()) < fConfigMinOpAng) { return false; - if (fabs(p12.Rapidity()) > fConfigMaxRapee) + } + if (fabs(p12.Rapidity()) > fConfigMaxRapee) { return false; + } + + float deta = p1.Eta() - p2.Eta(); + float dphi = p1.Phi() - p2.Phi(); + o2::math_utils::bringToPMPi(dphi); + if (fConfigApplyDEtaDPhi && std::pow(deta / fConfigMinDEta, 2) + std::pow(dphi / fConfigMinDPhi, 2) < 1.f) { + return false; + } return true; } @@ -205,6 +225,35 @@ struct lmeelfcocktail { } } + template + void addHistogramND_stage(TString histname, TAxes const& axes, int& i, TString s) + { + i++; + TString name = s + histname; + histogramId[name] = i; + histogramsND.push_back(registry.add(name, histname, HistType::kTHnSparseF, axes, true)); + for (auto const& [pdg, meson] : mesons) { + i++; + name = s + meson.name + histname; + histogramId[name] = i; + histogramsND.push_back(registry.add(name, histname, HistType::kTHnSparseF, axes, true)); + for (auto const& mode : meson.decayModes) { + i++; + name = s + meson.name + decays[mode] + histname; + histogramId[name] = i; + histogramsND.push_back(registry.add(name, histname, HistType::kTHnSparseF, axes, true)); + } + } + } + + template + void addHistogramND(TString histname, TAxes const& axes, int& i) + { + for (auto s : stage) { + addHistogramND_stage(histname, axes, i, s); + } + } + void fillHistogram1D(TString histname, int s, int pdg, int other_daughter_pdg, float value, float weight) { histograms1D[histogramId[stage[s] + histname]]->Fill(value, weight); @@ -225,10 +274,20 @@ struct lmeelfcocktail { histograms2D[histogramId[stage[s] + mesons[pdg].name + decays[other_daughter_pdg] + histname]]->Fill(value1, value2, weight); } + void fillHistogramND(TString histname, int s, int pdg, int other_daughter_pdg, double* values, double weight) + { + histogramsND[histogramId[stage[s] + histname]]->Fill(values, weight); + histogramsND[histogramId[stage[s] + mesons[pdg].name + histname]]->Fill(values, weight); + histogramsND[histogramId[stage[s] + mesons[pdg].name + decays[other_daughter_pdg] + histname]]->Fill(values, weight); + } + void init(InitContext& context) { + registry.add("NEvents", "NEvents", HistType::kTH1F, {{1, 0., 1.}}, false); + AxisSpec mass_axis = {fConfigMeeBins, "m_{ee} (GeV/#it{c}^{2})"}; AxisSpec ptee_axis = {fConfigPteeBins, "#it{p}_{T,ee} (GeV/#it{c})"}; + AxisSpec cos2dphi_axis = {fConfigCos2DPhi, "cos(2(#varphi_{ee} - #Psi_{RP}))"}; // PsiRP = 0 rad. in generator. AxisSpec eta_axis = {fConfigEtaBins, "#it{#eta}_{e}"}; AxisSpec pt_axis = {fConfigPtBins, "#it{p}_{T,e} (GeV/c)"}; AxisSpec phi_axis = {fConfigPhiBins, "#it{#varphi}_{e}"}; @@ -263,15 +322,18 @@ struct lmeelfcocktail { addHistogram1D_stage("Dca", dca_axis, i, "rec/"); addHistogram1D_stage("Dcaee", dcaee_axis, i, "rec/"); i = -1; - addHistogram2D("MeeVsPtee", mass_axis, ptee_axis, i); addHistogram2D_stage("DcaVsPt", dca_axis, pt_axis, i, "rec/"); addHistogram2D_stage("DcaeeVsPtee", dcaee_axis, ptee_axis, i, "rec/"); addHistogram2D_stage("DcaeeVsMee", dcaee_axis, mass_axis, i, "rec/"); + i = -1; + addHistogramND("MeeVsPteeVsCos2DPhiRP", std::vector{mass_axis, ptee_axis, cos2dphi_axis}, i); } } - void processCocktail(McParticlesSmeared const& mcParticles) + void processCocktail(aod::McCollision const&, McParticlesSmeared const& mcParticles) { + registry.fill(HIST("NEvents"), 0.5); + for (auto const& particle : mcParticles) { if (particle.has_mothers()) { continue; @@ -397,7 +459,9 @@ struct lmeelfcocktail { float opAng = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(pPos.Px(), pPos.Py(), pPos.Pz(), pEle.Px(), pEle.Py(), pEle.Pz()); float phiV = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pPos.Px(), pPos.Py(), pPos.Pz(), pEle.Px(), pEle.Py(), pEle.Pz(), 1, -1, 1); float dcaee = sqrt((pow(dcaEle, 2) + pow(dcaPos, 2)) / 2); - fillHistogram2D("MeeVsPtee", s, pdg, other_daughter_pdg, mee, ptee, pairWeight); + float cos2dphi = std::cos(2.f * p12.Phi()); // PsiRP = 0 rad. + double values[3] = {mee, ptee, cos2dphi}; + fillHistogramND("MeeVsPteeVsCos2DPhiRP", s, pdg, other_daughter_pdg, values, pairWeight); fillHistogram1D("Mee", s, pdg, other_daughter_pdg, mee, pairWeight); fillHistogram1D("Ptee", s, pdg, other_daughter_pdg, ptee, pairWeight); fillHistogram1D("PhiV", s, pdg, other_daughter_pdg, phiV, pairWeight); diff --git a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx new file mode 100644 index 00000000000..1a129a0d70b --- /dev/null +++ b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx @@ -0,0 +1,640 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code produces information on prefilter for dielectron. +// Please write to: daiki.sekihata@cern.ch + +#include +#include +#include +#include +#include + +#include "TString.h" +#include "Math/Vector4D.h" +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" + +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "CCDB/BasicCCDBManager.h" + +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" +#include "PWGEM/Dilepton/Core/DielectronCut.h" +#include "PWGEM/Dilepton/Core/EMEventCut.h" +#include "PWGEM/Dilepton/Utils/EMTrack.h" +#include "PWGEM/Dilepton/Utils/EventHistograms.h" +#include "PWGEM/Dilepton/Utils/PairUtilities.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; +using namespace o2::aod::pwgem::dilepton::utils::pairutil; + +using MyCollisions = soa::Join; +using MyCollision = MyCollisions::iterator; + +using MyTracks = soa::Join; +using MyTrack = MyTracks::iterator; + +struct prefilterDielectron { + Produces pfb_pi0; + + // Configurables + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; + Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; + + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; + Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; + + EMEventCut fEMEventCut; + struct : ConfigurableGroup { + std::string prefix = "eventcut_group"; + Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgRequireSel8{"cfgRequireSel8", false, "require sel8 in event cut"}; + Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; + Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; + Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; + Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; + Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; + } eventcuts; + + DielectronCut fDielectronCut; + struct : ConfigurableGroup { + std::string prefix = "dielectroncut_group"; + + // for mee prefilter + Configurable cfg_min_mass{"cfg_min_mass", 0.0, "min mass for prefilter ULS"}; // region to be rejected + Configurable cfg_max_mass{"cfg_max_mass", 0.0, "max mass for prefilter ULS"}; // region to be rejected + + // for phiv prefilter + Configurable cfg_apply_phiv{"cfg_apply_phiv", false, "flag to apply phiv cut"}; // region to be rejected + Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; // region to be rejected + Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; // region to be rejected + Configurable cfg_min_phiv{"cfg_min_phiv", -1.f, "min phiv"}; // region to be rejected + Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv"}; // region to be rejected + + // for deta-dphi prefilter + Configurable cfg_apply_detadphi_uls{"cfg_apply_detadphi_uls", false, "flag to apply generator deta-dphi elliptic cut in ULS"}; // region to be rejected + Configurable cfg_apply_detadphi_ls{"cfg_apply_detadphi_ls", false, "flag to apply generator deta-dphi elliptic cut in LS"}; // region to be rejected + Configurable cfg_min_deta_ls{"cfg_min_deta_ls", 0.04, "deta between 2 electrons (elliptic cut)"}; // region to be rejected + Configurable cfg_min_dphi_ls{"cfg_min_dphi_ls", 0.2, "dphi between 2 electrons (elliptic cut)"}; // region to be rejected + Configurable cfg_min_deta_uls{"cfg_min_deta_uls", 0.04, "deta between 2 electrons (elliptic cut)"}; // region to be rejected + Configurable cfg_min_dphi_uls{"cfg_min_dphi_uls", 0.2, "dphi between 2 electrons (elliptic cut)"}; // region to be rejected + + // for dz-rdphi prefilter + Configurable cfg_apply_dzrdphi_geom_uls{"cfg_apply_dzrdphi_geom_uls", false, "flag to apply generator dz-rdphi elliptic cut in ULS"}; // region to be rejected + Configurable cfg_apply_dzrdphi_geom_ls{"cfg_apply_dzrdphi_geom_ls", false, "flag to apply generator dz-rdphi elliptic cut in LS"}; // region to be rejected + Configurable cfg_min_dz_geom_ls{"cfg_min_dz_geom_ls", 3, "geometrical min dz between 2 electrons (elliptic cut) in cm"}; // region to be rejected + Configurable cfg_min_rdphi_geom_ls{"cfg_min_rdphi_geom_ls", 10, "geometrical min rdphi between 2 electrons (elliptic cut) in cm"}; // region to be rejected + Configurable cfg_min_dz_geom_uls{"cfg_min_dz_geom_uls", 3, "geometrical min dz between 2 electrons (elliptic cut) in cm"}; // region to be rejected + Configurable cfg_min_rdphi_geom_uls{"cfg_min_rdphi_geom_uls", 10, "geometrical min rdphi between 2 electrons (elliptic cut) in cm"}; // region to be rejected + + Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; + Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.9, "min eta for single track"}; + Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.9, "max eta for single track"}; + Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.f, "min phi for single track"}; + Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for single track"}; + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 100, "min ncrossed rows"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.3, "max dca XY for single track in cm"}; + Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.3, "max dca Z for single track in cm"}; + Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; + Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; + Configurable cfg_min_its_cluster_size{"cfg_min_its_cluster_size", 0.f, "min ITS cluster size"}; + Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; + Configurable cfg_min_p_its_cluster_size{"cfg_min_p_its_cluster_size", 0.0, "min p to apply ITS cluster size cut"}; + Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.0, "max p to apply ITS cluster size cut"}; + Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; + Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfg_x_to_go{"cfg_x_to_go", -1, "x (cm) to be propagated in local coordinate"}; + + Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; + Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; + Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; + Configurable cfg_min_TPCNsigmaMu{"cfg_min_TPCNsigmaMu", -0.0, "min. TPC n sigma for muon exclusion"}; + Configurable cfg_max_TPCNsigmaMu{"cfg_max_TPCNsigmaMu", +0.0, "max. TPC n sigma for muon exclusion"}; + Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -1e+10, "min. TPC n sigma for pion exclusion"}; + Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +3.0, "max. TPC n sigma for pion exclusion"}; + Configurable cfg_min_TPCNsigmaKa{"cfg_min_TPCNsigmaKa", -3.0, "min. TPC n sigma for kaon exclusion"}; + Configurable cfg_max_TPCNsigmaKa{"cfg_max_TPCNsigmaKa", +3.0, "max. TPC n sigma for kaon exclusion"}; + Configurable cfg_min_TPCNsigmaPr{"cfg_min_TPCNsigmaPr", -3.0, "min. TPC n sigma for proton exclusion"}; + Configurable cfg_max_TPCNsigmaPr{"cfg_max_TPCNsigmaPr", +3.0, "max. TPC n sigma for proton exclusion"}; + Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; + Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; + Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; + + // configuration for PID ML + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; + Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; + } dielectroncuts; + + o2::ccdb::CcdbApi ccdbApi; + Service ccdb; + int mRunNumber; + float d_bz; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + + HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + void init(InitContext& /*context*/) + { + DefineEMEventCut(); + DefineDielectronCut(); + addhistograms(); + + mRunNumber = 0; + d_bz = 0; + + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + } + + template + void initCCDB(TCollision const& collision) + { + if (mRunNumber == collision.runNumber()) { + return; + } + + // In case override, don't proceed, please - no CCDB access required + if (d_bz_input > -990) { + d_bz = d_bz_input; + o2::parameters::GRPMagField grpmag; + if (fabs(d_bz) > 1e-5) { + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + } + o2::base::Propagator::initFieldFromGRP(&grpmag); + mRunNumber = collision.runNumber(); + return; + } + + auto run3grp_timestamp = collision.timestamp(); + o2::parameters::GRPObject* grpo = 0x0; + o2::parameters::GRPMagField* grpmag = 0x0; + if (!skipGRPOquery) + grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } + mRunNumber = collision.runNumber(); + } + + ~prefilterDielectron() {} + + void addhistograms() + { + const AxisSpec axis_mass{400, 0, 4, "m_{ee} (GeV/c^{2})"}; + const AxisSpec axis_pair_pt{100, 0, 10, "p_{T,ee} (GeV/c)"}; + const AxisSpec axis_phiv{90, 0, M_PI, "#varphi_{V} (rad.)"}; + + // for pair + fRegistry.add("Pair/before/uls/hMvsPt", "m_{ee} vs. p_{T,ee}", kTH2D, {axis_mass, axis_pair_pt}, true); + fRegistry.add("Pair/before/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2D, {axis_phiv, {200, 0, 1}}, true); + fRegistry.add("Pair/before/uls/hDeltaEtaDeltaPhi", "#Delta#eta-#Delta#varphi between 2 tracks;#Delta#varphi (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {200, -1, +1}}, true); + fRegistry.add("Pair/before/uls/hGeomDeltaZRDeltaPhi", Form("difference in z-r#varphi plane between 2 tracks at r = %2.1f cm;r#Delta#varphi (cm);#Deltaz (cm);", dielectroncuts.cfg_x_to_go.value), kTH2D, {{200, -100, 100}, {200, -10, 10}}, true); + fRegistry.addClone("Pair/before/uls/", "Pair/before/lspp/"); + fRegistry.addClone("Pair/before/uls/", "Pair/before/lsmm/"); + fRegistry.addClone("Pair/before/", "Pair/after/"); + } + + void DefineEMEventCut() + { + fEMEventCut = EMEventCut("fEMEventCut", "fEMEventCut"); + fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); + fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); + fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); + fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); + fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); + fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); + } + + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; + void DefineDielectronCut() + { + fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); + + // for pair + fDielectronCut.SetMeeRange(0, 1e+10); + fDielectronCut.SetPairPtRange(0.f, 1e+10); + fDielectronCut.SetPairYRange(-1e+10, +1e+10); + fDielectronCut.SetPairDCARange(0.f, 1e+10); // in sigma + fDielectronCut.ApplyPhiV(false); + fDielectronCut.ApplyPrefilter(false); + fDielectronCut.SetMindEtadPhi(false, 1.f, 1.f); + fDielectronCut.SetPairOpAng(0.f, 3.2f); + fDielectronCut.SetRequireDifferentSides(false); + + // for track + fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, dielectroncuts.cfg_max_pt_track); + fDielectronCut.SetTrackEtaRange(dielectroncuts.cfg_min_eta_track, dielectroncuts.cfg_max_eta_track); + fDielectronCut.SetTrackPhiRange(dielectroncuts.cfg_min_phi_track, dielectroncuts.cfg_max_phi_track); + fDielectronCut.SetMinNClustersTPC(dielectroncuts.cfg_min_ncluster_tpc); + fDielectronCut.SetMinNCrossedRowsTPC(dielectroncuts.cfg_min_ncrossedrows); + fDielectronCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fDielectronCut.SetMaxFracSharedClustersTPC(dielectroncuts.cfg_max_frac_shared_clusters_tpc); + fDielectronCut.SetChi2PerClusterTPC(0.0, dielectroncuts.cfg_max_chi2tpc); + fDielectronCut.SetChi2PerClusterITS(0.0, dielectroncuts.cfg_max_chi2its); + fDielectronCut.SetNClustersITS(dielectroncuts.cfg_min_ncluster_its, 7); + fDielectronCut.SetMeanClusterSizeITS(dielectroncuts.cfg_min_its_cluster_size, dielectroncuts.cfg_max_its_cluster_size, dielectroncuts.cfg_min_p_its_cluster_size, dielectroncuts.cfg_max_p_its_cluster_size); + fDielectronCut.SetTrackMaxDcaXY(dielectroncuts.cfg_max_dcaxy); + fDielectronCut.SetTrackMaxDcaZ(dielectroncuts.cfg_max_dcaz); + fDielectronCut.RequireITSibAny(dielectroncuts.cfg_require_itsib_any); + fDielectronCut.RequireITSib1st(dielectroncuts.cfg_require_itsib_1st); + fDielectronCut.SetChi2TOF(0, dielectroncuts.cfg_max_chi2tof); + fDielectronCut.SetRelDiffPin(dielectroncuts.cfg_min_rel_diff_pin, dielectroncuts.cfg_max_rel_diff_pin); + + // for eID + fDielectronCut.SetPIDScheme(dielectroncuts.cfg_pid_scheme); + fDielectronCut.SetTPCNsigmaElRange(dielectroncuts.cfg_min_TPCNsigmaEl, dielectroncuts.cfg_max_TPCNsigmaEl); + fDielectronCut.SetTPCNsigmaMuRange(dielectroncuts.cfg_min_TPCNsigmaMu, dielectroncuts.cfg_max_TPCNsigmaMu); + fDielectronCut.SetTPCNsigmaPiRange(dielectroncuts.cfg_min_TPCNsigmaPi, dielectroncuts.cfg_max_TPCNsigmaPi); + fDielectronCut.SetTPCNsigmaKaRange(dielectroncuts.cfg_min_TPCNsigmaKa, dielectroncuts.cfg_max_TPCNsigmaKa); + fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); + fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); + + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + const std::vector labelsClasses = {"Signal", "Background"}; + const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + cutsMlArr[i][1] = 0.; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); + if (dielectroncuts.loadModelsFromCCDB) { + ccdbApi.init(ccdburl); + mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); + } else { + mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + } + mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); + + fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); + } // end of PID ML + } + + std::map, float> map_z_prop; // map -> geometrical z position at propagated point + std::map, float> map_phi_prop; // map -> geometrical phi position at propagated point + + template + void propagateElectron(TTracks const& tracks) + { + // this has to be called after initCCDB for bz. + for (auto& track : tracks) { + auto track_par_cov = getTrackParCov(track); + track_par_cov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToX(track_par_cov, dielectroncuts.cfg_x_to_go, d_bz, o2::base::PropagatorImpl::MAX_SIN_PHI, o2::base::PropagatorImpl::MAX_STEP, matCorr); + auto xyz = track_par_cov.getXYZGlo(); + // float eta = RecoDecay::eta(std::array{xyz.X(), xyz.Y(), xyz.Z()}); + float phi = RecoDecay::phi(std::array{xyz.X(), xyz.Y()}); + o2::math_utils::bringTo02Pi(phi); + map_z_prop[std::make_tuple(ndf, track.emeventId(), track.globalIndex())] = xyz.Z(); + map_phi_prop[std::make_tuple(ndf, track.emeventId(), track.globalIndex())] = phi; + } + } + + std::unordered_map map_pfb; // map track.globalIndex -> prefilter bit + + SliceCache cache; + Preslice perCollision_track = aod::emprimaryelectron::emeventId; + Partition posTracks = o2::aod::emprimaryelectron::sign > int8_t(0); + Partition negTracks = o2::aod::emprimaryelectron::sign < int8_t(0); + + Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; + using FilteredMyCollisions = soa::Filtered; + + int ndf = 0; + void processPFB(FilteredMyCollisions const& collisions, MyTracks const& tracks) + { + for (auto& track : tracks) { + map_pfb[track.globalIndex()] = 0; + } // end of track loop + + for (auto& collision : collisions) { + initCCDB(collision); + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + bool is_cent_ok = true; + if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + is_cent_ok = false; + } + + auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); + auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); + + if (!fEMEventCut.IsSelected(collision) || !is_cent_ok) { + for (auto& pos : posTracks_per_coll) { + map_pfb[pos.globalIndex()] = 0; + } + for (auto& neg : negTracks_per_coll) { + map_pfb[neg.globalIndex()] = 0; + } + continue; + } + + if (dielectroncuts.cfg_x_to_go > 0.f) { + propagateElectron(posTracks_per_coll); + propagateElectron(negTracks_per_coll); + } + + // LOGF(info, "centrality = %f , posTracks_per_coll.size() = %d, negTracks_per_coll.size() = %d", centralities[cfgCentEstimator], posTracks_per_coll.size(), negTracks_per_coll.size()); + + for (auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS + if (!fDielectronCut.IsSelectedTrack(pos) || !fDielectronCut.IsSelectedTrack(ele)) { + continue; + } + // don't apply pair cut when you produce prefilter bit. + + ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(v1.Px(), v1.Py(), v1.Pz(), v2.Px(), v2.Py(), v2.Pz(), pos.sign(), ele.sign(), d_bz); + float deta = pos.sign() * v1.Pt() > ele.sign() * v2.Pt() ? v1.Eta() - v2.Eta() : v2.Eta() - v1.Eta(); + float dphi = pos.sign() * v1.Pt() > ele.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); + o2::math_utils::bringToPMPi(dphi); + + float dz_geom = pos.sign() * pos.pt() > ele.sign() * ele.pt() ? map_z_prop[std::make_tuple(ndf, pos.emeventId(), pos.globalIndex())] - map_z_prop[std::make_tuple(ndf, ele.emeventId(), ele.globalIndex())] : map_z_prop[std::make_tuple(ndf, ele.emeventId(), ele.globalIndex())] - map_z_prop[std::make_tuple(ndf, pos.emeventId(), pos.globalIndex())]; + float dphi_geom = pos.sign() * pos.pt() > ele.sign() * ele.pt() ? map_phi_prop[std::make_tuple(ndf, pos.emeventId(), pos.globalIndex())] - map_phi_prop[std::make_tuple(ndf, ele.emeventId(), ele.globalIndex())] : map_phi_prop[std::make_tuple(ndf, ele.emeventId(), ele.globalIndex())] - map_phi_prop[std::make_tuple(ndf, pos.emeventId(), pos.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + + fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/before/uls/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/before/uls/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom); + + if (dielectroncuts.cfg_min_mass < v12.M() && v12.M() < dielectroncuts.cfg_max_mass) { + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kMee); + } + + if (dielectroncuts.cfg_apply_phiv && ((v12.M() < dielectroncuts.cfg_phiv_slope * phiv + dielectroncuts.cfg_phiv_intercept) && (dielectroncuts.cfg_min_phiv < phiv && phiv < dielectroncuts.cfg_max_phiv))) { + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kPhiV); + } + + if (dielectroncuts.cfg_apply_detadphi_uls && std::pow(deta / dielectroncuts.cfg_min_deta_uls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_uls, 2) < 1.f) { + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULS); + } + + if (dielectroncuts.cfg_x_to_go > 0.f && dielectroncuts.cfg_apply_dzrdphi_geom_uls && std::pow(dz_geom / dielectroncuts.cfg_min_dz_geom_uls, 2) + std::pow(rdphi_geom / dielectroncuts.cfg_min_rdphi_geom_uls, 2) < 1.f) { + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULSGeom); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackULSGeom); + } + } + + for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ + if (!fDielectronCut.IsSelectedTrack(pos1) || !fDielectronCut.IsSelectedTrack(pos2)) { + continue; + } + // don't apply pair cut when you produce prefilter bit. + + ROOT::Math::PtEtaPhiMVector v1(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(v1.Px(), v1.Py(), v1.Pz(), v2.Px(), v2.Py(), v2.Pz(), pos1.sign(), pos2.sign(), d_bz); + float deta = pos1.sign() * v1.Pt() > pos2.sign() * v2.Pt() ? v1.Eta() - v2.Eta() : v2.Eta() - v1.Eta(); + float dphi = pos1.sign() * v1.Pt() > pos2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); + o2::math_utils::bringToPMPi(dphi); + + float dz_geom = pos1.sign() * pos1.pt() > pos2.sign() * pos2.pt() ? map_z_prop[std::make_tuple(ndf, pos1.emeventId(), pos1.globalIndex())] - map_z_prop[std::make_tuple(ndf, pos2.emeventId(), pos2.globalIndex())] : map_z_prop[std::make_tuple(ndf, pos2.emeventId(), pos2.globalIndex())] - map_z_prop[std::make_tuple(ndf, pos1.emeventId(), pos1.globalIndex())]; + float dphi_geom = pos1.sign() * pos1.pt() > pos2.sign() * pos2.pt() ? map_phi_prop[std::make_tuple(ndf, pos1.emeventId(), pos1.globalIndex())] - map_phi_prop[std::make_tuple(ndf, pos2.emeventId(), pos2.globalIndex())] : map_phi_prop[std::make_tuple(ndf, pos2.emeventId(), pos2.globalIndex())] - map_phi_prop[std::make_tuple(ndf, pos1.emeventId(), pos1.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + + fRegistry.fill(HIST("Pair/before/lspp/hMvsPt"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/before/lspp/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/lspp/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/before/lspp/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom); + + if (dielectroncuts.cfg_apply_detadphi_ls && std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { + map_pfb[pos1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS); + map_pfb[pos2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS); + } + + if (dielectroncuts.cfg_x_to_go > 0.f && dielectroncuts.cfg_apply_dzrdphi_geom_ls && std::pow(dz_geom / dielectroncuts.cfg_min_dz_geom_ls, 2) + std::pow(rdphi_geom / dielectroncuts.cfg_min_rdphi_geom_ls, 2) < 1.f) { + map_pfb[pos1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLSGeom); + map_pfb[pos2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLSGeom); + } + } + + for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- + if (!fDielectronCut.IsSelectedTrack(ele1) || !fDielectronCut.IsSelectedTrack(ele2)) { + continue; + } + // don't apply pair cut when you produce prefilter bit. + + ROOT::Math::PtEtaPhiMVector v1(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(v1.Px(), v1.Py(), v1.Pz(), v2.Px(), v2.Py(), v2.Pz(), ele1.sign(), ele2.sign(), d_bz); + float deta = ele1.sign() * v1.Pt() > ele2.sign() * v2.Pt() ? v1.Eta() - v2.Eta() : v2.Eta() - v1.Eta(); + float dphi = ele1.sign() * v1.Pt() > ele2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); + o2::math_utils::bringToPMPi(dphi); + + float dz_geom = ele1.sign() * ele1.pt() > ele2.sign() * ele2.pt() ? map_z_prop[std::make_tuple(ndf, ele1.emeventId(), ele1.globalIndex())] - map_z_prop[std::make_tuple(ndf, ele2.emeventId(), ele2.globalIndex())] : map_z_prop[std::make_tuple(ndf, ele2.emeventId(), ele2.globalIndex())] - map_z_prop[std::make_tuple(ndf, ele1.emeventId(), ele1.globalIndex())]; + float dphi_geom = ele1.sign() * ele1.pt() > ele2.sign() * ele2.pt() ? map_phi_prop[std::make_tuple(ndf, ele1.emeventId(), ele1.globalIndex())] - map_phi_prop[std::make_tuple(ndf, ele2.emeventId(), ele2.globalIndex())] : map_phi_prop[std::make_tuple(ndf, ele2.emeventId(), ele2.globalIndex())] - map_phi_prop[std::make_tuple(ndf, ele1.emeventId(), ele1.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + + fRegistry.fill(HIST("Pair/before/lsmm/hMvsPt"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/before/lsmm/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/before/lsmm/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/before/lsmm/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom); + + if (dielectroncuts.cfg_apply_detadphi_ls && std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { + map_pfb[ele1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS); + map_pfb[ele2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLS); + } + + if (dielectroncuts.cfg_x_to_go > 0.f && dielectroncuts.cfg_apply_dzrdphi_geom_ls && std::pow(dz_geom / dielectroncuts.cfg_min_dz_geom_ls, 2) + std::pow(rdphi_geom / dielectroncuts.cfg_min_rdphi_geom_ls, 2) < 1.f) { + map_pfb[ele1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLSGeom); + map_pfb[ele2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kSplitOrMergedTrackLSGeom); + } + } + + } // end of collision loop + + for (auto& track : tracks) { + // LOGF(info, "map_pfb[%d] = %d", track.globalIndex(), map_pfb[track.globalIndex()]); + pfb_pi0(map_pfb[track.globalIndex()]); + } // end of track loop + + // check pfb. + for (auto& collision : collisions) { + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + continue; + } + + auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); + auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); + + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + + for (auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS + if (!fDielectronCut.IsSelectedTrack(pos) || !fDielectronCut.IsSelectedTrack(ele)) { + continue; + } + if (map_pfb[pos.globalIndex()] != 0 || map_pfb[ele.globalIndex()] != 0) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(v1.Px(), v1.Py(), v1.Pz(), v2.Px(), v2.Py(), v2.Pz(), pos.sign(), ele.sign(), d_bz); + float deta = pos.sign() * v1.Pt() > ele.sign() * v2.Pt() ? v1.Eta() - v2.Eta() : v2.Eta() - v1.Eta(); + float dphi = pos.sign() * v1.Pt() > ele.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); + o2::math_utils::bringToPMPi(dphi); + + float dz_geom = pos.sign() * pos.pt() > ele.sign() * ele.pt() ? map_z_prop[std::make_tuple(ndf, pos.emeventId(), pos.globalIndex())] - map_z_prop[std::make_tuple(ndf, ele.emeventId(), ele.globalIndex())] : map_z_prop[std::make_tuple(ndf, ele.emeventId(), ele.globalIndex())] - map_z_prop[std::make_tuple(ndf, pos.emeventId(), pos.globalIndex())]; + float dphi_geom = pos.sign() * pos.pt() > ele.sign() * ele.pt() ? map_phi_prop[std::make_tuple(ndf, pos.emeventId(), pos.globalIndex())] - map_phi_prop[std::make_tuple(ndf, ele.emeventId(), ele.globalIndex())] : map_phi_prop[std::make_tuple(ndf, ele.emeventId(), ele.globalIndex())] - map_phi_prop[std::make_tuple(ndf, pos.emeventId(), pos.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + + fRegistry.fill(HIST("Pair/after/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/after/uls/hMvsPt"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/after/uls/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/after/uls/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom); + } + + for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ + if (!fDielectronCut.IsSelectedTrack(pos1) || !fDielectronCut.IsSelectedTrack(pos2)) { + continue; + } + if (map_pfb[pos1.globalIndex()] != 0 || map_pfb[pos2.globalIndex()] != 0) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(v1.Px(), v1.Py(), v1.Pz(), v2.Px(), v2.Py(), v2.Pz(), pos1.sign(), pos2.sign(), d_bz); + float deta = pos1.sign() * v1.Pt() > pos2.sign() * v2.Pt() ? v1.Eta() - v2.Eta() : v2.Eta() - v1.Eta(); + float dphi = pos1.sign() * v1.Pt() > pos2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); + o2::math_utils::bringToPMPi(dphi); + + float dz_geom = pos1.sign() * pos1.pt() > pos2.sign() * pos2.pt() ? map_z_prop[std::make_tuple(ndf, pos1.emeventId(), pos1.globalIndex())] - map_z_prop[std::make_tuple(ndf, pos2.emeventId(), pos2.globalIndex())] : map_z_prop[std::make_tuple(ndf, pos2.emeventId(), pos2.globalIndex())] - map_z_prop[std::make_tuple(ndf, pos1.emeventId(), pos1.globalIndex())]; + float dphi_geom = pos1.sign() * pos1.pt() > pos2.sign() * pos2.pt() ? map_phi_prop[std::make_tuple(ndf, pos1.emeventId(), pos1.globalIndex())] - map_phi_prop[std::make_tuple(ndf, pos2.emeventId(), pos2.globalIndex())] : map_phi_prop[std::make_tuple(ndf, pos2.emeventId(), pos2.globalIndex())] - map_phi_prop[std::make_tuple(ndf, pos1.emeventId(), pos1.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + + fRegistry.fill(HIST("Pair/after/lspp/hMvsPt"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/after/lspp/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/after/lspp/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/after/lspp/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom); + } + + for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- + if (!fDielectronCut.IsSelectedTrack(ele1) || !fDielectronCut.IsSelectedTrack(ele2)) { + continue; + } + if (map_pfb[ele1.globalIndex()] != 0 || map_pfb[ele2.globalIndex()] != 0) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(v1.Px(), v1.Py(), v1.Pz(), v2.Px(), v2.Py(), v2.Pz(), ele1.sign(), ele2.sign(), d_bz); + float deta = ele1.sign() * v1.Pt() > ele2.sign() * v2.Pt() ? v1.Eta() - v2.Eta() : v2.Eta() - v1.Eta(); + float dphi = ele1.sign() * v1.Pt() > ele2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); + o2::math_utils::bringToPMPi(dphi); + + float dz_geom = ele1.sign() * ele1.pt() > ele2.sign() * ele2.pt() ? map_z_prop[std::make_tuple(ndf, ele1.emeventId(), ele1.globalIndex())] - map_z_prop[std::make_tuple(ndf, ele2.emeventId(), ele2.globalIndex())] : map_z_prop[std::make_tuple(ndf, ele2.emeventId(), ele2.globalIndex())] - map_z_prop[std::make_tuple(ndf, ele1.emeventId(), ele1.globalIndex())]; + float dphi_geom = ele1.sign() * ele1.pt() > ele2.sign() * ele2.pt() ? map_phi_prop[std::make_tuple(ndf, ele1.emeventId(), ele1.globalIndex())] - map_phi_prop[std::make_tuple(ndf, ele2.emeventId(), ele2.globalIndex())] : map_phi_prop[std::make_tuple(ndf, ele2.emeventId(), ele2.globalIndex())] - map_phi_prop[std::make_tuple(ndf, ele1.emeventId(), ele1.globalIndex())]; + o2::math_utils::bringToPMPi(dphi_geom); + float rdphi_geom = dielectroncuts.cfg_x_to_go * dphi_geom; + + fRegistry.fill(HIST("Pair/after/lsmm/hMvsPt"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/after/lsmm/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/after/lsmm/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/after/lsmm/hGeomDeltaZRDeltaPhi"), rdphi_geom, dz_geom); + } + + } // end of collision loop + ndf++; + map_pfb.clear(); + } // end of process + PROCESS_SWITCH(prefilterDielectron, processPFB, "produce prefilter bit", false); + + void processDummy(MyTracks const& tracks) + { + for (int i = 0; i < tracks.size(); i++) { + pfb_pi0(0); + } + } + PROCESS_SWITCH(prefilterDielectron, processDummy, "dummy", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"prefilter-dielectron"})}; +} diff --git a/PWGEM/Dilepton/Tasks/smearing.cxx b/PWGEM/Dilepton/Tasks/smearing.cxx index 655cedac2e7..82944dc48a0 100644 --- a/PWGEM/Dilepton/Tasks/smearing.cxx +++ b/PWGEM/Dilepton/Tasks/smearing.cxx @@ -13,8 +13,10 @@ // Analysis task to produce smeared pt, eta, phi for electrons/muons in dilepton analysis // Please write to: daiki.sekihata@cern.ch -#include +#include #include + +#include "CCDB/BasicCCDBManager.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -221,7 +223,21 @@ struct ApplySmearing { applySmearing(tracksMC); } - void processDummyCocktail(aod::McParticles const&) {} + void processDummyCocktail(aod::McParticles const& tracksMC) + { + // don't apply smearing + for (auto& mctrack : tracksMC) { + int pdgCode = mctrack.pdgCode(); + if (abs(pdgCode) == 11) { + smearedelectron(mctrack.pt(), mctrack.eta(), mctrack.phi(), 1.0, 0.0); + } else if (abs(pdgCode) == 13) { + smearedmuon(mctrack.pt(), mctrack.eta(), mctrack.phi(), 1.0, 0.0, mctrack.pt(), mctrack.eta(), mctrack.phi(), 1.0, 0.0); + } else { + smearedelectron(mctrack.pt(), mctrack.eta(), mctrack.eta(), 1.0, 0.0); + smearedmuon(mctrack.pt(), mctrack.eta(), mctrack.phi(), 1.0, 0.0, mctrack.pt(), mctrack.eta(), mctrack.phi(), 1.0, 0.0); + } + } + } void processDummyMCanalysis(ReducedMCTracks const&) {} diff --git a/PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx b/PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx index 227e070baca..d78ef01676c 100644 --- a/PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx +++ b/PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx @@ -11,6 +11,10 @@ // // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // + +#include +#include +#include #include #include #include @@ -137,8 +141,8 @@ struct AnalysisEventSelection { Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; Configurable cfgCentFT0CMin{"cfgCentralityMin", -1000000000.f, "min. centrality"}; Configurable cfgCentFT0CMax{"cfgCentralityMax", 1000000000.f, "max. centrality"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1000000000, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -1000000000, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; } eventcuts; HistogramManager* fHistMan = nullptr; @@ -233,7 +237,7 @@ struct AnalysisEventSelection { if (eventcuts.cfgRequireGoodZvtxFT0vsPV) cut->AddCut(VarManager::kIsGoodZvtxFT0vsPV, 0.5, 1.5); cut->AddCut(VarManager::kCentFT0C, eventcuts.cfgCentFT0CMin, eventcuts.cfgCentFT0CMax); - cut->AddCut(VarManager::kTrackOccupancyInTimeRange, eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); + cut->AddCut(VarManager::kTrackOccupancyInTimeRange, eventcuts.cfgTrackOccupancyMin, eventcuts.cfgTrackOccupancyMax); return cut; } @@ -289,7 +293,7 @@ struct AnalysisTrackSelection { Configurable fConfigRunPeriods{"cfgRunPeriods", "LHC22f", "run periods for used data"}; Configurable fConfigDummyRunlist{"cfgDummyRunlist", false, "If true, use dummy runlist"}; Configurable fConfigInitRunNumber{"cfgInitRunNumber", 543215, "Initial run number used in run by run checks"}; - Configurable fConfigNbTrackCut{"cfgNbTrackCut", 1, "Number of cuts including prefilter cut, need to be below 30"}; + Configurable fConfigNbTrackCut{"cfgNbTrackCut", 1, "Number of cuts including prefilter cut, need to be below 30"}; std::vector fTrackCuts; struct : ConfigurableGroup { @@ -341,10 +345,9 @@ struct AnalysisTrackSelection { { fCurrentRun = 0; - int nbofcuts = fConfigNbTrackCut; - if (nbofcuts > 0 && CheckSize()) { - for (unsigned int icut = 0; icut < nbofcuts; ++icut) { - AnalysisCompositeCut* cut = new AnalysisCompositeCut(Form("trackcut%d", icut), Form("trackcut%d", icut)); + if (fConfigNbTrackCut > 0 && CheckSize()) { + for (std::size_t icut = 0; icut < fConfigNbTrackCut; ++icut) { + AnalysisCompositeCut* cut = new AnalysisCompositeCut(Form("trackcut%zu", icut), Form("trackcut%zu", icut)); cut->AddCut(GetTrackCut(icut)); cut->AddCut(GetPIDCut(icut)); fTrackCuts.push_back(*cut); @@ -639,7 +642,7 @@ struct AnalysisTrackSelection { for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, iCut++) { if ((*cut).IsSelected(VarManager::fgValues)) { if (iCut != fConfigPrefilterCutId) { - filterMap |= (uint32_t(1) << iCut); + filterMap |= (static_cast(1) << iCut); } if (iCut == fConfigPrefilterCutId) { prefilterSelected = true; @@ -791,7 +794,7 @@ struct AnalysisEventMixing { // single particle selection tasks to preserve the correspondence between the track cut name and its // bit position in the cuts bitmap // TODO: Create a configurable to specify exactly on which of the bits one should run the event mixing - Configurable fConfigNbTrackCut{"cfgNbTrackCut", 1, "Number of cuts without prefilter cut, need to be consistent with the track selection"}; + Configurable fConfigNbTrackCut{"cfgNbTrackCut", 1, "Number of cuts without prefilter cut, need to be consistent with the track selection"}; Configurable fConfigMixingDepth{"cfgMixingDepth", 100, "Number of Events stored for event mixing"}; Configurable fConfigAddEventMixingHistogram{"cfgAddEventMixingHistogram", "", "Comma separated list of histograms"}; Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -828,14 +831,14 @@ struct AnalysisEventMixing { // Keep track of all the histogram class names to avoid composing strings in the event mixing pairing TString histNames = ""; if (fConfigNbTrackCut > 0 && fConfigNbTrackCut < 31) { - for (int icut = 0; icut < fConfigNbTrackCut; ++icut) { + for (std::size_t icut = 0; icut < fConfigNbTrackCut; ++icut) { std::vector names = { - Form("PairsBarrelMEPM_trackcut%d", icut), - Form("PairsBarrelMEPP_trackcut%d", icut), - Form("PairsBarrelMEMM_trackcut%d", icut)}; + Form("PairsBarrelMEPM_trackcut%zu", icut), + Form("PairsBarrelMEPP_trackcut%zu", icut), + Form("PairsBarrelMEMM_trackcut%zu", icut)}; histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fTrackHistNames.push_back(names); - fTwoTrackFilterMask |= (uint32_t(1) << icut); + fTwoTrackFilterMask |= (static_cast(1) << icut); } } @@ -854,12 +857,12 @@ struct AnalysisEventMixing { uint32_t twoTrackFilter = 0; for (auto& track1 : tracks1) { for (auto& track2 : tracks2) { - twoTrackFilter = uint32_t(track1.isBarrelSelected()) & uint32_t(track2.isBarrelSelected()) & fTwoTrackFilterMask; + twoTrackFilter = static_cast(track1.isBarrelSelected()) & static_cast(track2.isBarrelSelected()) & fTwoTrackFilterMask; if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue continue; } - VarManager::FillPairME(track1, track2); + VarManager::FillPairME(track1, track2); constexpr bool eventHasQvector = (VarManager::ObjTypes::ReducedEventQvector > 0); if constexpr (eventHasQvector) { @@ -871,7 +874,7 @@ struct AnalysisEventMixing { } for (unsigned int icut = 0; icut < ncuts; icut++) { - if (twoTrackFilter & (uint32_t(1) << icut)) { + if (twoTrackFilter & (static_cast(1) << icut)) { if (track1.sign() * track2.sign() < 0) { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); } else { @@ -882,9 +885,9 @@ struct AnalysisEventMixing { } } } // end if (filter bits) - } // end for (cuts) - } // end for (track2) - } // end for (track1) + } // end for (cuts) + } // end for (track2) + } // end for (track1) } // barrel-barrel and muon-muon event mixing @@ -948,8 +951,8 @@ struct AnalysisSameEventPairing { int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. OutputObj fOutputList{"output"}; - Configurable fConfigNbTrackCut{"cfgNbTrackCut", 1, "Number of track cuts without prefilter cut, need to be consistent with the track selection"}; - Configurable fConfigNbPairCut{"cfgNbPairCut", 1, "Number of pair cuts, need to be below 4 right now"}; + Configurable fConfigNbTrackCut{"cfgNbTrackCut", 1, "Number of track cuts without prefilter cut, need to be consistent with the track selection"}; + Configurable fConfigNbPairCut{"cfgNbPairCut", 1, "Number of pair cuts, need to be below 4 right now"}; Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPath{"ccdb-path", "Users/lm", "base path to the ccdb object"}; Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -1069,35 +1072,34 @@ struct AnalysisSameEventPairing { std::vector names; if (fConfigNbPairCut > 0 && CheckSize()) { - for (int icut = 0; icut < fConfigNbPairCut; ++icut) { + for (std::size_t icut = 0; icut < fConfigNbPairCut; ++icut) { fPairCuts.push_back(*GetPairCut(icut)); } } if (fConfigNbTrackCut > 0 && fConfigNbTrackCut < 31) { // if track cuts - for (int icut = 0; icut < fConfigNbTrackCut; ++icut) { // loop over track cuts - fTwoTrackFilterMask |= (uint32_t(1) << icut); + for (std::size_t icut = 0; icut < fConfigNbTrackCut; ++icut) { // loop over track cuts + fTwoTrackFilterMask |= (static_cast(1) << icut); // no pair cuts names = { - Form("PairsBarrelSEPM_trackcut%d", icut), - Form("PairsBarrelSEPP_trackcut%d", icut), - Form("PairsBarrelSEMM_trackcut%d", icut)}; + Form("PairsBarrelSEPM_trackcut%zu", icut), + Form("PairsBarrelSEPP_trackcut%zu", icut), + Form("PairsBarrelSEMM_trackcut%zu", icut)}; histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fTrackHistNames.push_back(names); - unsigned int npaircuts = fPairCuts.size(); - for (int iPairCut = 0; iPairCut < npaircuts; ++iPairCut) { // loop over pair cuts + for (std::size_t iPairCut = 0; iPairCut < fPairCuts.size(); ++iPairCut) { // loop over pair cuts names = { - Form("PairsBarrelSEPM_trackcut%d_paircut%d", icut, iPairCut), - Form("PairsBarrelSEPP_trackcut%d_paircut%d", icut, iPairCut), - Form("PairsBarrelSEMM_trackcut%d_paircut%d", icut, iPairCut)}; + Form("PairsBarrelSEPM_trackcut%zu_paircut%zu", icut, iPairCut), + Form("PairsBarrelSEPP_trackcut%zu_paircut%zu", icut, iPairCut), + Form("PairsBarrelSEMM_trackcut%zu_paircut%zu", icut, iPairCut)}; histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); fTrackHistNames.push_back(names); - } // end loop (pair cuts) - } // end loop (track cuts) - } // end if (track cuts) + } // end loop (pair cuts) + } // end loop (track cuts) + } // end if (track cuts) VarManager::SetCollisionSystem((TString)fCollisionSystem, fCenterMassEnergy); // set collision system and center of mass energy @@ -1125,7 +1127,7 @@ struct AnalysisSameEventPairing { uint32_t twoTrackFilter = 0; for (auto& [t1, t2] : combinations(tracks1, tracks2)) { - twoTrackFilter = uint32_t(t1.isBarrelSelected()) & uint32_t(t2.isBarrelSelected()) & fTwoTrackFilterMask; + twoTrackFilter = static_cast(t1.isBarrelSelected()) & static_cast(t2.isBarrelSelected()) & fTwoTrackFilterMask; if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue continue; @@ -1143,8 +1145,8 @@ struct AnalysisSameEventPairing { } int iCut = 0; - for (int icut = 0; icut < fConfigNbTrackCut; icut++) { - if (twoTrackFilter & (uint32_t(1) << icut)) { + for (std::size_t icut = 0; icut < fConfigNbTrackCut; icut++) { + if (twoTrackFilter & (static_cast(1) << icut)) { if (t1.sign() * t2.sign() < 0) { fHistMan->FillHistClass(histNames[iCut][0].Data(), VarManager::fgValues); } else { @@ -1168,12 +1170,12 @@ struct AnalysisSameEventPairing { fHistMan->FillHistClass(histNames[iCut][2].Data(), VarManager::fgValues); } } - } // end loop (pair cuts) + } // end loop (pair cuts) } else { // end if (filter bits) iCut = iCut + 1 + fPairCuts.size(); } } // end loop (cuts) - } // end loop over pairs + } // end loop over pairs } void processDecayToEESkimmed(soa::Filtered::iterator const& event, soa::Filtered const& tracks) diff --git a/PWGEM/Dilepton/Tasks/vpPairQC.cxx b/PWGEM/Dilepton/Tasks/vpPairQC.cxx index 162fe333430..29c0738f7f2 100644 --- a/PWGEM/Dilepton/Tasks/vpPairQC.cxx +++ b/PWGEM/Dilepton/Tasks/vpPairQC.cxx @@ -14,6 +14,10 @@ // This code runs loop over ULS ee pars for virtual photon QC. // Please write to: daiki.sekihata@cern.ch +#include +#include +#include + #include "TString.h" #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" @@ -33,6 +37,7 @@ #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/Dilepton/Utils/EventHistograms.h" #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" using namespace o2; using namespace o2::aod; @@ -71,9 +76,15 @@ struct vpPairQC { Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; } eventcuts; DielectronCut fDielectronCut; @@ -93,10 +104,11 @@ struct vpPairQC { Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; - Configurable cfg_apply_phiv_meedep{"cfg_apply_phiv_meedep", false, "flag to apply mee-dependent phiv cut"}; + Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.9, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.9, "max eta for single track"}; Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1e+10, "max DCA 3D in sigma"}; @@ -105,11 +117,14 @@ struct vpPairQC { Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 100, "min ncrossed rows"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; Configurable cfg_min_its_cluster_size{"cfg_min_its_cluster_size", 0.f, "min ITS cluster size"}; Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.2, "max p to apply ITS cluster size cut"}; + Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; + Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTOFif), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -127,9 +142,13 @@ struct vpPairQC { Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 0.5, "max. pin for pion rejection in TPC"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; - // CCDB configuration for PID ML - Configurable BDTLocalPathGamma{"BDTLocalPathGamma", "pid_ml_xgboost.onnx", "Path to the local .onnx file"}; - Configurable BDTPathCCDB{"BDTPathCCDB", "Users/d/dsekihat/pwgem/pidml/", "Path on CCDB"}; + // configuration for PID ML + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; @@ -197,12 +216,7 @@ struct vpPairQC { mRunNumber = collision.runNumber(); } - ~vpPairQC() - { - if (eid_bdt) { - delete eid_bdt; - } - } + ~vpPairQC() {} void addhistograms() { @@ -270,11 +284,13 @@ struct vpPairQC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); } - o2::ml::OnnxModel* eid_bdt = nullptr; + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; void DefineDielectronCut() { fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); @@ -284,18 +300,14 @@ struct vpPairQC { fDielectronCut.SetPairPtRange(dielectroncuts.cfg_min_pair_pt, dielectroncuts.cfg_max_pair_pt); fDielectronCut.SetPairYRange(dielectroncuts.cfg_min_pair_y, dielectroncuts.cfg_max_pair_y); fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma - if (dielectroncuts.cfg_apply_phiv_meedep) { - fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); - } else { - fDielectronCut.SetPhivPairRange(0.f, dielectroncuts.cfg_max_phiv); - } + fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); fDielectronCut.ApplyPrefilter(dielectroncuts.cfg_apply_pf); fDielectronCut.RequireITSibAny(dielectroncuts.cfg_require_itsib_any); fDielectronCut.RequireITSib1st(dielectroncuts.cfg_require_itsib_1st); // for track - fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); + fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, dielectroncuts.cfg_max_pt_track); fDielectronCut.SetTrackEtaRange(dielectroncuts.cfg_min_eta_track, dielectroncuts.cfg_max_eta_track); fDielectronCut.SetTrackDca3DRange(0.f, dielectroncuts.cfg_max_dca3dsigma_track); // in sigma fDielectronCut.SetMinNClustersTPC(dielectroncuts.cfg_min_ncluster_tpc); @@ -307,6 +319,8 @@ struct vpPairQC { fDielectronCut.SetMeanClusterSizeITS(dielectroncuts.cfg_min_its_cluster_size, dielectroncuts.cfg_max_its_cluster_size, dielectroncuts.cfg_max_p_its_cluster_size); fDielectronCut.SetTrackMaxDcaXY(dielectroncuts.cfg_max_dcaxy); fDielectronCut.SetTrackMaxDcaZ(dielectroncuts.cfg_max_dcaz); + fDielectronCut.SetChi2TOF(0.0, dielectroncuts.cfg_max_chi2tof); + fDielectronCut.SetRelDiffPin(dielectroncuts.cfg_min_rel_diff_pin, dielectroncuts.cfg_max_rel_diff_pin); // for eID fDielectronCut.SetPIDScheme(dielectroncuts.cfg_pid_scheme); @@ -319,21 +333,30 @@ struct vpPairQC { fDielectronCut.SetMaxPinForPionRejectionTPC(dielectroncuts.cfg_max_pin_pirejTPC); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - eid_bdt = new o2::ml::OnnxModel(); + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + const std::vector labelsClasses = {"Signal", "Background"}; + const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + cutsMlArr[i][1] = 0.; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); if (dielectroncuts.loadModelsFromCCDB) { ccdbApi.init(ccdburl); - std::map metadata; - bool retrieveSuccessGamma = ccdbApi.retrieveBlob(dielectroncuts.BDTPathCCDB.value, ".", metadata, dielectroncuts.timestampCCDB.value, false, dielectroncuts.BDTLocalPathGamma.value); - if (retrieveSuccessGamma) { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); - } else { - LOG(fatal) << "Error encountered while fetching/loading the Gamma model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; - } + mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); } else { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); + mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); } + mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - fDielectronCut.SetPIDModel(eid_bdt); + fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -455,6 +478,8 @@ struct vpPairQC { } } + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); using FilteredMyCollisions = soa::Filtered; diff --git a/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx b/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx index d036e6dee6a..a687e5469a2 100644 --- a/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx +++ b/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx @@ -14,6 +14,10 @@ // This code runs loop over ULS ee pars for virtual photon QC. // Please write to: daiki.sekihata@cern.ch +#include +#include +#include + #include "TString.h" #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" @@ -33,6 +37,7 @@ #include "PWGEM/Dilepton/Utils/EventHistograms.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h" using namespace o2; using namespace o2::aod; @@ -72,9 +77,15 @@ struct vpPairQCMC { Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; } eventcuts; DielectronCut fDielectronCut; @@ -94,8 +105,11 @@ struct vpPairQCMC { Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; + Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; + Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.9, "min eta for single track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.9, "max eta for single track"}; Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1e+10, "max DCA 3D in sigma"}; @@ -104,8 +118,14 @@ struct vpPairQCMC { Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 100, "min ncrossed rows"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; + Configurable cfg_min_its_cluster_size{"cfg_min_its_cluster_size", 0.f, "min ITS cluster size"}; + Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; + Configurable cfg_max_p_its_cluster_size{"cfg_max_p_its_cluster_size", 0.2, "max p to apply ITS cluster size cut"}; + Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; + Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTOFif), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -123,9 +143,13 @@ struct vpPairQCMC { Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 0.5, "max. pin for pion rejection in TPC"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; - // CCDB configuration for PID ML - Configurable BDTLocalPathGamma{"BDTLocalPathGamma", "pid_ml_xgboost.onnx", "Path to the local .onnx file"}; - Configurable BDTPathCCDB{"BDTPathCCDB", "Users/d/dsekihat/pwgem/pidml/", "Path on CCDB"}; + // configuration for PID ML + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; @@ -271,11 +295,13 @@ struct vpPairQCMC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); } - o2::ml::OnnxModel* eid_bdt = nullptr; + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; void DefineDielectronCut() { fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); @@ -285,14 +311,14 @@ struct vpPairQCMC { fDielectronCut.SetPairPtRange(dielectroncuts.cfg_min_pair_pt, dielectroncuts.cfg_max_pair_pt); fDielectronCut.SetPairYRange(dielectroncuts.cfg_min_pair_y, dielectroncuts.cfg_max_pair_y); fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma - fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); fDielectronCut.ApplyPrefilter(dielectroncuts.cfg_apply_pf); fDielectronCut.RequireITSibAny(dielectroncuts.cfg_require_itsib_any); fDielectronCut.RequireITSib1st(dielectroncuts.cfg_require_itsib_1st); // for track - fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); + fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, dielectroncuts.cfg_max_pt_track); fDielectronCut.SetTrackEtaRange(-dielectroncuts.cfg_max_eta_track, +dielectroncuts.cfg_max_eta_track); fDielectronCut.SetTrackDca3DRange(0.f, dielectroncuts.cfg_max_dca3dsigma_track); // in sigma fDielectronCut.SetMinNClustersTPC(dielectroncuts.cfg_min_ncluster_tpc); @@ -301,9 +327,11 @@ struct vpPairQCMC { fDielectronCut.SetChi2PerClusterTPC(0.0, dielectroncuts.cfg_max_chi2tpc); fDielectronCut.SetChi2PerClusterITS(0.0, dielectroncuts.cfg_max_chi2its); fDielectronCut.SetNClustersITS(dielectroncuts.cfg_min_ncluster_its, 7); - fDielectronCut.SetMeanClusterSizeITS(0, 16); + fDielectronCut.SetMeanClusterSizeITS(dielectroncuts.cfg_min_its_cluster_size, dielectroncuts.cfg_max_its_cluster_size, dielectroncuts.cfg_max_p_its_cluster_size); fDielectronCut.SetTrackMaxDcaXY(dielectroncuts.cfg_max_dcaxy); fDielectronCut.SetTrackMaxDcaZ(dielectroncuts.cfg_max_dcaz); + fDielectronCut.SetChi2TOF(0.0, dielectroncuts.cfg_max_chi2tof); + fDielectronCut.SetRelDiffPin(dielectroncuts.cfg_min_rel_diff_pin, dielectroncuts.cfg_max_rel_diff_pin); // for eID fDielectronCut.SetPIDScheme(dielectroncuts.cfg_pid_scheme); @@ -315,23 +343,31 @@ struct vpPairQCMC { fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); fDielectronCut.SetMaxPinForPionRejectionTPC(dielectroncuts.cfg_max_pin_pirejTPC); - if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDielectronCut - // o2::ml::OnnxModel* eid_bdt = new o2::ml::OnnxModel(); - eid_bdt = new o2::ml::OnnxModel(); + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + const std::vector labelsClasses = {"Signal", "Background"}; + const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + cutsMlArr[i][1] = 0.; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); if (dielectroncuts.loadModelsFromCCDB) { ccdbApi.init(ccdburl); - std::map metadata; - bool retrieveSuccessGamma = ccdbApi.retrieveBlob(dielectroncuts.BDTPathCCDB.value, ".", metadata, dielectroncuts.timestampCCDB.value, false, dielectroncuts.BDTLocalPathGamma.value); - if (retrieveSuccessGamma) { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); - } else { - LOG(fatal) << "Error encountered while fetching/loading the Gamma model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; - } + mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); } else { - eid_bdt->initModel(dielectroncuts.BDTLocalPathGamma.value, dielectroncuts.enableOptimizations.value); + mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); } + mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - fDielectronCut.SetPIDModel(eid_bdt); + fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -494,6 +530,8 @@ struct vpPairQCMC { Partition posTracks = o2::aod::emprimaryelectron::sign > int8_t(0); Partition negTracks = o2::aod::emprimaryelectron::sign < int8_t(0); + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin < o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); using FilteredMyCollisions = soa::Filtered; diff --git a/PWGEM/Dilepton/Utils/EMTrackUtilities.h b/PWGEM/Dilepton/Utils/EMTrackUtilities.h index 9e817a59630..e26e9760bab 100644 --- a/PWGEM/Dilepton/Utils/EMTrackUtilities.h +++ b/PWGEM/Dilepton/Utils/EMTrackUtilities.h @@ -40,6 +40,18 @@ float dca3DinSigma(T const& track) } //_______________________________________________________________________ template +float dcaXYinSigma(T const& track) +{ + return track.dcaXY() / std::sqrt(track.cYY()); +} +//_______________________________________________________________________ +template +float dcaZinSigma(T const& track) +{ + return track.dcaZ() / std::sqrt(track.cZZ()); +} +//_______________________________________________________________________ +template float fwdDcaXYinSigma(T const& track) { float cXX = track.cXX(); diff --git a/PWGEM/Dilepton/Utils/EventHistograms.h b/PWGEM/Dilepton/Utils/EventHistograms.h index ffb0329c41e..89609c336f8 100644 --- a/PWGEM/Dilepton/Utils/EventHistograms.h +++ b/PWGEM/Dilepton/Utils/EventHistograms.h @@ -53,7 +53,7 @@ void addEventHistograms(HistogramRegistry* fRegistry) fRegistry->add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); fRegistry->add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{60, 0, 60000}, {200, 0, 20000}}, false); fRegistry->add("Event/before/hNTracksPVvsOccupancy", "hNTracksPVvsOccupancy;N_{track} to PV;N_{track} in time range", kTH2F, {{600, 0, 6000}, {200, 0, 20000}}, false); - fRegistry->add("Event/before/hSpherocity", "hSpherocity;spherocity", kTH1F, {{100, 0, 1}}, false); + fRegistry->add("Event/before/hCorrOccupancy", "occupancy correlation;FT0C occupancy;track occupancy", kTH2F, {{200, 0, 200000}, {200, 0, 20000}}, false); if constexpr (nmod == 2) { // Q2 fRegistry->add("Event/before/hQ2xFT0M_CentFT0C", "hQ2xFT0M_CentFT0C;centrality FT0C (%);Q_{2,x}^{FT0M}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); @@ -118,38 +118,6 @@ void addEventHistograms(HistogramRegistry* fRegistry) fRegistry->add("Event/before/hPrfQ3FT0AQ3BTot_CentFT0C", "Q_{3}^{FT0A} #upoint Q_{3}^{BTot};centrality FT0C (%);Q_{3}^{FT0A} #upoint Q_{3}^{BTot}", kTProfile, {{100, 0, 100}}, false); fRegistry->add("Event/before/hPrfQ3FT0AQ3FT0C_CentFT0C", "Q_{3}^{FT0A} #upoint Q_{3}^{FT0C};centrality FT0C (%);Q_{3}^{FT0A} #upoint Q_{3}^{FT0C}", kTProfile, {{100, 0, 100}}, false); // this is necessary for dimuons } - // else if constexpr (nmod == 4) { // Q4 - // fRegistry->add("Event/before/hQ4xFT0M_CentFT0C", "hQ4xFT0M_CentFT0C;centrality FT0C (%);Q_{4,x}^{FT0M}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4yFT0M_CentFT0C", "hQ4yFT0M_CentFT0C;centrality FT0C (%);Q_{4,y}^{FT0M}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4xFT0A_CentFT0C", "hQ4xFT0A_CentFT0C;centrality FT0C (%);Q_{4,x}^{FT0A}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4yFT0A_CentFT0C", "hQ4yFT0A_CentFT0C;centrality FT0C (%);Q_{4,y}^{FT0A}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4xFT0C_CentFT0C", "hQ4xFT0C_CentFT0C;centrality FT0C (%);Q_{4,x}^{FT0C}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4yFT0C_CentFT0C", "hQ4yFT0C_CentFT0C;centrality FT0C (%);Q_{4,y}^{FT0C}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4xBPos_CentFT0C", "hQ4xBPos_CentFT0C;centrality FT0C (%);Q_{4,x}^{BPos}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4yBPos_CentFT0C", "hQ4yBPos_CentFT0C;centrality FT0C (%);Q_{4,y}^{BPos}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4xBNeg_CentFT0C", "hQ4xBNeg_CentFT0C;centrality FT0C (%);Q_{4,x}^{BNeg}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4yBNeg_CentFT0C", "hQ4yBNeg_CentFT0C;centrality FT0C (%);Q_{4,y}^{BNeg}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4xBTot_CentFT0C", "hQ4xBTot_CentFT0C;centrality FT0C (%);Q_{4,x}^{BTot}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - // fRegistry->add("Event/before/hQ4yBTot_CentFT0C", "hQ4yBTot_CentFT0C;centrality FT0C (%);Q_{4,y}^{BTot}", kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - - // fRegistry->add("Event/before/hEP4FT0M_CentFT0C", "4rd harmonics event plane FT0M;centrality FT0C (%);#Psi_{4}^{FT0M} (rad.)", kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - // fRegistry->add("Event/before/hEP4FT0A_CentFT0C", "4rd harmonics event plane FT0A;centrality FT0C (%);#Psi_{4}^{FT0A} (rad.)", kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - // fRegistry->add("Event/before/hEP4FT0C_CentFT0C", "4rd harmonics event plane FT0C;centrality FT0C (%);#Psi_{4}^{FT0C} (rad.)", kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - // fRegistry->add("Event/before/hEP4BPos_CentFT0C", "4rd harmonics event plane BPos;centrality FT0C (%);#Psi_{4}^{BPos} (rad.)", kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - // fRegistry->add("Event/before/hEP4BNeg_CentFT0C", "4rd harmonics event plane BNeg;centrality FT0C (%);#Psi_{4}^{BNeg} (rad.)", kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - // fRegistry->add("Event/before/hEP4BTot_CentFT0C", "4rd harmonics event plane BTot;centrality FT0C (%);#Psi_{4}^{BTot} (rad.)", kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - - // fRegistry->add("Event/before/hPrfQ4FT0MQ4BPos_CentFT0C", "Q_{4}^{FT0M} #upoint Q_{4}^{BPos};centrality FT0C (%);Q_{4}^{FT0M} #upoint Q_{4}^{BPos}", kTProfile, {{100, 0, 100}}, false); - // fRegistry->add("Event/before/hPrfQ4FT0MQ4BNeg_CentFT0C", "Q_{4}^{FT0M} #upoint Q_{4}^{BNeg};centrality FT0C (%);Q_{4}^{FT0M} #upoint Q_{4}^{BNeg}", kTProfile, {{100, 0, 100}}, false); - // fRegistry->add("Event/before/hPrfQ4BPosQ4BNeg_CentFT0C", "Q_{4}^{BPos} #upoint Q_{4}^{BNeg};centrality FT0C (%);Q_{4}^{BPos} #upoint Q_{4}^{BNeg}", kTProfile, {{100, 0, 100}}, false); // this is common for FT0M, FT0A, FT0C, FV0A resolution. - // fRegistry->add("Event/before/hPrfQ4FT0CQ4BPos_CentFT0C", "Q_{4}^{FT0C} #upoint Q_{4}^{BPos};centrality FT0C (%);Q_{4}^{FT0C} #upoint Q_{4}^{BPos}", kTProfile, {{100, 0, 100}}, false); - // fRegistry->add("Event/before/hPrfQ4FT0CQ4BNeg_CentFT0C", "Q_{4}^{FT0C} #upoint Q_{4}^{BNeg};centrality FT0C (%);Q_{4}^{FT0C} #upoint Q_{4}^{BNeg}", kTProfile, {{100, 0, 100}}, false); - // fRegistry->add("Event/before/hPrfQ4FT0CQ4BTot_CentFT0C", "Q_{4}^{FT0C} #upoint Q_{4}^{BTot};centrality FT0C (%);Q_{4}^{FT0C} #upoint Q_{4}^{BTot}", kTProfile, {{100, 0, 100}}, false); - // fRegistry->add("Event/before/hPrfQ4FT0AQ4BPos_CentFT0C", "Q_{4}^{FT0A} #upoint Q_{4}^{BPos};centrality FT0C (%);Q_{4}^{FT0A} #upoint Q_{4}^{BPos}", kTProfile, {{100, 0, 100}}, false); - // fRegistry->add("Event/before/hPrfQ4FT0AQ4BNeg_CentFT0C", "Q_{4}^{FT0A} #upoint Q_{4}^{BNeg};centrality FT0C (%);Q_{4}^{FT0A} #upoint Q_{4}^{BNeg}", kTProfile, {{100, 0, 100}}, false); - // fRegistry->add("Event/before/hPrfQ4FT0AQ4BTot_CentFT0C", "Q_{4}^{FT0A} #upoint Q_{4}^{BTot};centrality FT0C (%);Q_{4}^{FT0A} #upoint Q_{4}^{BTot}", kTProfile, {{100, 0, 100}}, false); - // fRegistry->add("Event/before/hPrfQ4FT0AQ4FT0C_CentFT0C", "Q_{4}^{FT0A} #upoint Q_{4}^{FT0C};centrality FT0C (%);Q_{4}^{FT0A} #upoint Q_{4}^{FT0C}", kTProfile, {{100, 0, 100}}, false); // this is necessary for dimuons - // } fRegistry->addClone("Event/before/", "Event/after/"); } @@ -206,6 +174,7 @@ void fillEventInfo(HistogramRegistry* fRegistry, TCollision const& collision, co fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV()); fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange()); fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hNTracksPVvsOccupancy"), collision.multNTracksPV(), collision.trackOccupancyInTimeRange()); + fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCorrOccupancy"), collision.ft0cOccupancyInTimeRange(), collision.trackOccupancyInTimeRange()); if constexpr (nmod == 2) { // Q2 std::array q2ft0m = {collision.q2xft0m(), collision.q2yft0m()}; @@ -284,47 +253,6 @@ void fillEventInfo(HistogramRegistry* fRegistry, TCollision const& collision, co fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ3FT0CQ3BTot_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q3ft0c, q3btot)); fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ3FT0AQ3FT0C_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q3ft0a, q3ft0c)); } - // else if constexpr (nmod == 4) { // Q4 - // std::array q4ft0m = {collision.q4xft0m(), collision.q4yft0m()}; - // std::array q4ft0a = {collision.q4xft0a(), collision.q4yft0a()}; - // std::array q4ft0c = {collision.q4xft0c(), collision.q4yft0c()}; - // std::array q4bpos = {collision.q4xbpos(), collision.q4ybpos()}; - // std::array q4bneg = {collision.q4xbneg(), collision.q4ybneg()}; - // std::array q4btot = {collision.q4xbtot(), collision.q4ybtot()}; - - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4xFT0M_CentFT0C"), collision.centFT0C(), collision.q4xft0m()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4yFT0M_CentFT0C"), collision.centFT0C(), collision.q4yft0m()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4xFT0A_CentFT0C"), collision.centFT0C(), collision.q4xft0a()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4yFT0A_CentFT0C"), collision.centFT0C(), collision.q4yft0a()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4xFT0C_CentFT0C"), collision.centFT0C(), collision.q4xft0c()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4yFT0C_CentFT0C"), collision.centFT0C(), collision.q4yft0c()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4xBPos_CentFT0C"), collision.centFT0C(), collision.q4xbpos()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4yBPos_CentFT0C"), collision.centFT0C(), collision.q4ybpos()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4xBNeg_CentFT0C"), collision.centFT0C(), collision.q4xbneg()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4yBNeg_CentFT0C"), collision.centFT0C(), collision.q4ybneg()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4xBTot_CentFT0C"), collision.centFT0C(), collision.q4xbtot()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hQ4yBTot_CentFT0C"), collision.centFT0C(), collision.q4ybtot()); - - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hEP4FT0M_CentFT0C"), collision.centFT0C(), collision.ep4ft0m()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hEP4FT0A_CentFT0C"), collision.centFT0C(), collision.ep4ft0a()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hEP4FT0C_CentFT0C"), collision.centFT0C(), collision.ep4ft0c()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hEP4BPos_CentFT0C"), collision.centFT0C(), collision.ep4bpos()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hEP4BNeg_CentFT0C"), collision.centFT0C(), collision.ep4bneg()); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hEP4BTot_CentFT0C"), collision.centFT0C(), collision.ep4btot()); - - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0MQ4BPos_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0m, q4bpos)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0MQ4BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0m, q4bneg)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4BPosQ4BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4bpos, q4bneg)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0AQ4BPos_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0a, q4bpos)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0AQ4BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0a, q4bneg)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0AQ4BTot_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0a, q4btot)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0CQ4BPos_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0c, q4bpos)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0CQ4BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0c, q4bneg)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0CQ4BTot_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0c, q4btot)); - // fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ4FT0AQ4FT0C_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q4ft0a, q4ft0c)); - // } } - } // namespace o2::aod::pwgem::dilepton::utils::eventhistogram - #endif // PWGEM_DILEPTON_UTILS_EVENTHISTOGRAMS_H_ diff --git a/PWGEM/Dilepton/Utils/MlResponseDielectronPair.h b/PWGEM/Dilepton/Utils/MlResponseDielectronPair.h deleted file mode 100644 index 40f97b67937..00000000000 --- a/PWGEM/Dilepton/Utils/MlResponseDielectronPair.h +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file MlResponseDiletponPair.h -/// \brief Class to compute the ML response for dielectron analyses at the pair level -/// \author Daniel Samitz , SMI Vienna -/// Elisa Meninno, , SMI Vienna - -#ifndef PWGEM_DILEPTON_UTILS_MLRESPONSEDIELECTRONPAIR_H_ -#define PWGEM_DILEPTON_UTILS_MLRESPONSEDIELECTRONPAIR_H_ - -#include -#include -#include - -#include "Math/Vector4D.h" -#include "Tools/ML/MlResponse.h" - -// Fill the map of available input features -// the key is the feature's name (std::string) -// the value is the corresponding value in EnumInputFeatures -#define FILL_MAP_DIELECTRON_PAIR(FEATURE) \ - { \ -#FEATURE, static_cast < uint8_t>(InputFeaturesDielectronPair::FEATURE) \ - } - -// Check if the index of mCachedIndices (index associated to a FEATURE) -// matches the entry in EnumInputFeatures associated to this FEATURE -// if so, the inputFeatures vector is filled with the FEATURE's value -// by calling the corresponding GETTER from pair fourmomentum v12 -#define CHECK_AND_FILL_VEC_DIELECTRON_PAIR(FEATURE, GETTER) \ - case static_cast(InputFeaturesDielectronPair::FEATURE): { \ - inputFeatures.emplace_back(v12.GETTER()); \ - break; \ - } - -// Check if the index of mCachedIndices (index associated to a FEATURE) -// matches the entry in EnumInputFeatures associated to this FEATURE -// if so, the inputFeatures vector is filled with the FEATURE's value -// by calling the corresponding FUNCTION on the tracks t1 and t2 -#define CHECK_AND_FILL_VEC_DIELECTRON_PAIR_FUNC(FEATURE, FUNCTION) \ - case static_cast(InputFeaturesDielectronPair::FEATURE): { \ - inputFeatures.emplace_back(FUNCTION(t1, t2)); \ - break; \ - } - -namespace o2::analysis -{ -// possible input features for ML -enum class InputFeaturesDielectronPair : uint8_t { - m, - pt, - eta, - phi, - phiv, - pairDcaXY, - pairDcaZ -}; - -template -class MlResponseDielectronPair : public MlResponse -{ - public: - /// Default constructor - MlResponseDielectronPair() = default; - /// Default destructor - virtual ~MlResponseDielectronPair() = default; - - template - float pair_dca_xy(T const& t1, T const& t2) - { - return sqrt((pow(t1.dcaXY() / sqrt(t1.cYY()), 2) + pow(t2.dcaXY() / sqrt(t2.cYY()), 2)) / 2.); - } - - template - float pair_dca_z(T const& t1, T const& t2) - { - return sqrt((pow(t1.dcaZ() / sqrt(t1.cZZ()), 2) + pow(t2.dcaZ() / sqrt(t2.cZZ()), 2)) / 2.); - } - - template - float get_phiv(T const& t1, T const& t2) - { - // cos(phiv) = w*a /|w||a| - // with w = u x v - // and a = u x z / |u x z| , unit vector perpendicular to v12 and z-direction (magnetic field) - // u = v12 / |v12| , the unit vector of v12 - // v = v1 x v2 / |v1 x v2| , unit vector perpendicular to v1 and v2 - - ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - bool swapTracks = false; - if (v1.Pt() < v2.Pt()) { // ordering of track, pt1 > pt2 - ROOT::Math::PtEtaPhiMVector v3 = v1; - v1 = v2; - v2 = v3; - swapTracks = true; - } - - // momentum of e+ and e- in (ax,ay,az) axis. Note that az=0 by definition. - // vector product of pep X pem - float vpx = 0, vpy = 0, vpz = 0; - if (t1.sign() * t2.sign() > 0) { // Like Sign - if (!swapTracks) { - if (d_bz * t1.sign() < 0) { - vpx = v1.Py() * v2.Pz() - v1.Pz() * v2.Py(); - vpy = v1.Pz() * v2.Px() - v1.Px() * v2.Pz(); - vpz = v1.Px() * v2.Py() - v1.Py() * v2.Px(); - } else { - vpx = v2.Py() * v1.Pz() - v2.Pz() * v1.Py(); - vpy = v2.Pz() * v1.Px() - v2.Px() * v1.Pz(); - vpz = v2.Px() * v1.Py() - v2.Py() * v1.Px(); - } - } else { // swaped tracks - if (d_bz * t2.sign() < 0) { - vpx = v1.Py() * v2.Pz() - v1.Pz() * v2.Py(); - vpy = v1.Pz() * v2.Px() - v1.Px() * v2.Pz(); - vpz = v1.Px() * v2.Py() - v1.Py() * v2.Px(); - } else { - vpx = v2.Py() * v1.Pz() - v2.Pz() * v1.Py(); - vpy = v2.Pz() * v1.Px() - v2.Px() * v1.Pz(); - vpz = v2.Px() * v1.Py() - v2.Py() * v1.Px(); - } - } - } else { // Unlike Sign - if (!swapTracks) { - if (d_bz * t1.sign() > 0) { - vpx = v1.Py() * v2.Pz() - v1.Pz() * v2.Py(); - vpy = v1.Pz() * v2.Px() - v1.Px() * v2.Pz(); - vpz = v1.Px() * v2.Py() - v1.Py() * v2.Px(); - } else { - vpx = v2.Py() * v1.Pz() - v2.Pz() * v1.Py(); - vpy = v2.Pz() * v1.Px() - v2.Px() * v1.Pz(); - vpz = v2.Px() * v1.Py() - v2.Py() * v1.Px(); - } - } else { // swaped tracks - if (d_bz * t2.sign() > 0) { - vpx = v1.Py() * v2.Pz() - v1.Pz() * v2.Py(); - vpy = v1.Pz() * v2.Px() - v1.Px() * v2.Pz(); - vpz = v1.Px() * v2.Py() - v1.Py() * v2.Px(); - } else { - vpx = v2.Py() * v1.Pz() - v2.Pz() * v1.Py(); - vpy = v2.Pz() * v1.Px() - v2.Px() * v1.Pz(); - vpz = v2.Px() * v1.Py() - v2.Py() * v1.Px(); - } - } - } - - // unit vector of pep X pem - float vx = vpx / TMath::Sqrt(vpx * vpx + vpy * vpy + vpz * vpz); - float vy = vpy / TMath::Sqrt(vpx * vpx + vpy * vpy + vpz * vpz); - float vz = vpz / TMath::Sqrt(vpx * vpx + vpy * vpy + vpz * vpz); - - float px = v12.Px(); - float py = v12.Py(); - float pz = v12.Pz(); - - // unit vector of (pep+pem) - float ux = px / TMath::Sqrt(px * px + py * py + pz * pz); - float uy = py / TMath::Sqrt(px * px + py * py + pz * pz); - float uz = pz / TMath::Sqrt(px * px + py * py + pz * pz); - float ax = uy / TMath::Sqrt(ux * ux + uy * uy); - float ay = -ux / TMath::Sqrt(ux * ux + uy * uy); - - // The third axis defined by vector product (ux,uy,uz)X(vx,vy,vz) - float wx = uy * vz - uz * vy; - float wy = uz * vx - ux * vz; - // by construction, (wx,wy,wz) must be a unit vector. Measure angle between (wx,wy,wz) and (ax,ay,0). - // The angle between them should be small if the pair is conversion. This function then returns values close to pi! - return TMath::ACos(wx * ax + wy * ay); // phiv in [0,pi] //cosPhiV = wx * ax + wy * ay; - } - - /// Method to get the input features vector needed for ML inference - /// \param t1 is the first track - /// \param t2 is the second track - /// \return inputFeatures vector - template - std::vector getInputFeatures(T const& t1, T const& t2) - { - std::vector inputFeatures; - ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - for (const auto& idx : MlResponse::mCachedIndices) { - switch (idx) { - CHECK_AND_FILL_VEC_DIELECTRON_PAIR(m, M); - CHECK_AND_FILL_VEC_DIELECTRON_PAIR(pt, Pt); - CHECK_AND_FILL_VEC_DIELECTRON_PAIR(eta, Eta); - CHECK_AND_FILL_VEC_DIELECTRON_PAIR(phi, Phi); - CHECK_AND_FILL_VEC_DIELECTRON_PAIR_FUNC(phiv, get_phiv); - CHECK_AND_FILL_VEC_DIELECTRON_PAIR_FUNC(pairDcaXY, pair_dca_xy); - CHECK_AND_FILL_VEC_DIELECTRON_PAIR_FUNC(pairDcaZ, pair_dca_z); - } - } - - return inputFeatures; - } - - void setBz(float bz) - { - d_bz = bz; - } - - protected: - /// Method to fill the map of available input features - void setAvailableInputFeatures() - { - MlResponse::mAvailableInputFeatures = { - FILL_MAP_DIELECTRON_PAIR(m), - FILL_MAP_DIELECTRON_PAIR(pt), - FILL_MAP_DIELECTRON_PAIR(eta), - FILL_MAP_DIELECTRON_PAIR(phi), - FILL_MAP_DIELECTRON_PAIR(phiv), - FILL_MAP_DIELECTRON_PAIR(pairDcaXY), - FILL_MAP_DIELECTRON_PAIR(pairDcaZ)}; - } - - float d_bz = 0.; -}; - -} // namespace o2::analysis - -#undef FILL_MAP_DIELECTRON_PAIR -#undef CHECK_AND_FILL_VEC_DIELECTRON_PAIR -#undef CHECK_AND_FILL_VEC_DIELECTRON_PAIR_FUNC - -#endif // PWGEM_DILEPTON_UTILS_MLRESPONSEDIELECTRONPAIR_H_ diff --git a/PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h b/PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h index d7217bb49d8..ef1c7b33474 100644 --- a/PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h +++ b/PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h @@ -26,31 +26,66 @@ // Fill the map of available input features // the key is the feature's name (std::string) // the value is the corresponding value in EnumInputFeatures -#define FILL_MAP_DIELECTRON_SINGLE_TRACK(FEATURE) \ - { \ -#FEATURE, static_cast < uint8_t>(InputFeaturesDielectronSingleTrack::FEATURE) \ +#define FILL_MAP_DIELECTRON_SINGLE_TRACK(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesDielectronSingleTrack::FEATURE) \ } // Check if the index of mCachedIndices (index associated to a FEATURE) // matches the entry in EnumInputFeatures associated to this FEATURE // if so, the inputFeatures vector is filled with the FEATURE's value // by calling the corresponding GETTER=FEATURE from track -#define CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(GETTER) \ +#define CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(GETTER) \ case static_cast(InputFeaturesDielectronSingleTrack::GETTER): { \ - inputFeatures.emplace_back(track.GETTER()); \ + inputFeature = track.GETTER(); \ break; \ } +// TPC+TOF combined nSigma +#define CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_TPCTOF(FEATURE, GETTER1, GETTER2, GETTER3) \ + case static_cast(InputFeaturesDielectronSingleTrack::FEATURE): { \ + if (!track.GETTER3()) { \ + inputFeature = track.GETTER1(); \ + } else { \ + if (track.GETTER1() > 0) { \ + inputFeature = sqrt((pow(track.GETTER1(), 2) + pow(track.GETTER2(), 2)) / 2.); \ + } else { \ + inputFeature = (-1) * sqrt((pow(track.GETTER1(), 2) + pow(track.GETTER2(), 2)) / 2.); \ + } \ + } \ + break; \ + } + // Check if the index of mCachedIndices (index associated to a FEATURE) // matches the entry in EnumInputFeatures associated to this FEATURE // if so, the inputFeatures vector is filled with the FEATURE's value -// by calling the corresponding GETTER form track and applying a sqrt -#define CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK_SQRT(FEATURE, GETTER) \ +// by calling the corresponding GETTER from track and applying a sqrt +#define CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_SQRT(FEATURE, GETTER) \ case static_cast(InputFeaturesDielectronSingleTrack::FEATURE): { \ - inputFeatures.emplace_back(sqrt(track.GETTER())); \ + inputFeature = sqrt(track.GETTER()); \ break; \ } +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER1 from track and multiplying with cos(atan(GETTER2)) +#define CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_COS(FEATURE, GETTER1, GETTER2) \ + case static_cast(InputFeaturesDielectronSingleTrack::FEATURE): { \ + inputFeature = track.GETTER1() * std::cos(std::atan(track.GETTER2())); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER=FEATURE from collision +#define CHECK_AND_FILL_DIELECTRON_COLLISION(GETTER) \ + case static_cast(InputFeaturesDielectronSingleTrack::GETTER): { \ + inputFeature = collision.GETTER(); \ + break; \ + } + namespace o2::analysis { // possible input features for ML @@ -64,8 +99,9 @@ enum class InputFeaturesDielectronSingleTrack : uint8_t { dcaResXY, dcaResZ, tpcNClsFindable, - tpcNClsFound, - tpcNClsCrossedRows, + tpcNClsFindableMinusFound, + tpcNClsFindableMinusCrossedRows, + tpcNClsShared, tpcChi2NCl, tpcInnerParam, tpcSignal, @@ -80,8 +116,85 @@ enum class InputFeaturesDielectronSingleTrack : uint8_t { tofNSigmaPi, tofNSigmaKa, tofNSigmaPr, + tpctofNSigmaEl, + tpctofNSigmaMu, + tpctofNSigmaPi, + tpctofNSigmaKa, + tpctofNSigmaPr, + itsClusterSizes, + itsChi2NCl, + tofChi2, + detectorMap, + x, + alpha, + y, + z, + snp, + tgl, + isAssociatedToMPC, + tpcNClsFound, + tpcNClsCrossedRows, + tpcCrossedRowsOverFindableCls, + tpcFoundOverFindableCls, + tpcFractionSharedCls, itsClusterMap, - itsChi2NCl + itsNCls, + itsNClsInnerBarrel, + hasITS, + hasTPC, + hasTRD, + hasTOF, + signed1Pt, + p, + px, + py, + pz, + theta, + meanClusterSizeITS, + meanClusterSizeITSib, + meanClusterSizeITSob, + meanClusterSizeITSCos, + meanClusterSizeITSibCos, + meanClusterSizeITSobCos, + cYY, + cZY, + cZZ, + cSnpY, + cSnpZ, + cSnpSnp, + cTglY, + cTglZ, + cTglSnp, + cTglTgl, + c1PtY, + c1PtZ, + c1PtSnp, + c1PtTgl, + c1Pt21Pt2, + posX, + posY, + posZ, + numContrib, + trackOccupancyInTimeRange, + ft0cOccupancyInTimeRange, + // covXX, + // covXY, + // covXZ, + // covYY, + // covYZ, + // covZZ, + // chi2, + multFT0A, + multFT0C, + multNTracksPV, + multNTracksPVeta1, + multNTracksPVetaHalf, + isInelGt0, + isInelGt1, + multFT0M, + centFT0M, + centFT0A, + centFT0C }; template @@ -93,49 +206,153 @@ class MlResponseDielectronSingleTrack : public MlResponse /// Default destructor virtual ~MlResponseDielectronSingleTrack() = default; + template + float return_feature(uint8_t idx, T const& track, U const& collision) + { + float inputFeature = 0.; + switch (idx) { + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(sign); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(pt); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(eta); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(phi); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(dcaXY); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(dcaZ); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_SQRT(dcaResXY, cYY); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_SQRT(dcaResZ, cZZ); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsFindable); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsFindableMinusFound); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsFindableMinusCrossedRows); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsShared); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcChi2NCl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcInnerParam); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcSignal); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNSigmaEl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNSigmaMu); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNSigmaPi); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNSigmaKa); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNSigmaPr); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(beta); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tofNSigmaEl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tofNSigmaMu); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tofNSigmaPi); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tofNSigmaKa); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tofNSigmaPr); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_TPCTOF(tpctofNSigmaEl, tpcNSigmaEl, tofNSigmaEl, hasTOF); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_TPCTOF(tpctofNSigmaMu, tpcNSigmaMu, tofNSigmaMu, hasTOF); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_TPCTOF(tpctofNSigmaPi, tpcNSigmaPi, tofNSigmaPi, hasTOF); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_TPCTOF(tpctofNSigmaKa, tpcNSigmaKa, tofNSigmaKa, hasTOF); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_TPCTOF(tpctofNSigmaPr, tpcNSigmaPr, tofNSigmaPr, hasTOF); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(itsClusterSizes); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(itsChi2NCl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tofChi2); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(detectorMap); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(x); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(alpha); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(y); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(z); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(snp); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tgl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(isAssociatedToMPC); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsFound); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsCrossedRows); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcCrossedRowsOverFindableCls); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcFoundOverFindableCls); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcFractionSharedCls); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(itsClusterMap); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(itsNCls); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(itsNClsInnerBarrel); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(hasITS); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(hasTPC); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(hasTRD); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(hasTOF); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(signed1Pt); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(p); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(px); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(py); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(pz); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(theta); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(meanClusterSizeITS); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(meanClusterSizeITSib); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(meanClusterSizeITSob); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_COS(meanClusterSizeITSCos, meanClusterSizeITS, tgl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_COS(meanClusterSizeITSibCos, meanClusterSizeITSib, tgl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_COS(meanClusterSizeITSobCos, meanClusterSizeITSob, tgl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cYY); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cZY); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cZZ); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cSnpY); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cSnpZ); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cSnpSnp); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cTglY); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cTglZ); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cTglSnp); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(cTglTgl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(c1PtY); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(c1PtZ); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(c1PtSnp); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(c1PtTgl); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(c1Pt21Pt2); + CHECK_AND_FILL_DIELECTRON_COLLISION(posX); + CHECK_AND_FILL_DIELECTRON_COLLISION(posY); + CHECK_AND_FILL_DIELECTRON_COLLISION(posZ); + CHECK_AND_FILL_DIELECTRON_COLLISION(numContrib); + CHECK_AND_FILL_DIELECTRON_COLLISION(trackOccupancyInTimeRange); + CHECK_AND_FILL_DIELECTRON_COLLISION(ft0cOccupancyInTimeRange); + // CHECK_AND_FILL_DIELECTRON_COLLISION(covXX); + // CHECK_AND_FILL_DIELECTRON_COLLISION(covXY); + // CHECK_AND_FILL_DIELECTRON_COLLISION(covXZ); + // CHECK_AND_FILL_DIELECTRON_COLLISION(covYY); + // CHECK_AND_FILL_DIELECTRON_COLLISION(covYZ); + // CHECK_AND_FILL_DIELECTRON_COLLISION(covZZ); + // CHECK_AND_FILL_DIELECTRON_COLLISION(chi2); + CHECK_AND_FILL_DIELECTRON_COLLISION(multFT0A); + CHECK_AND_FILL_DIELECTRON_COLLISION(multFT0C); + CHECK_AND_FILL_DIELECTRON_COLLISION(multNTracksPV); + CHECK_AND_FILL_DIELECTRON_COLLISION(multNTracksPVeta1); + CHECK_AND_FILL_DIELECTRON_COLLISION(multNTracksPVetaHalf); + CHECK_AND_FILL_DIELECTRON_COLLISION(isInelGt0); + CHECK_AND_FILL_DIELECTRON_COLLISION(isInelGt1); + CHECK_AND_FILL_DIELECTRON_COLLISION(multFT0M); + CHECK_AND_FILL_DIELECTRON_COLLISION(centFT0M); + CHECK_AND_FILL_DIELECTRON_COLLISION(centFT0A); + CHECK_AND_FILL_DIELECTRON_COLLISION(centFT0C); + } + return inputFeature; + } + /// Method to get the input features vector needed for ML inference - /// \param track is the single track + /// \param track is the single track, \param collision is the collision /// \return inputFeatures vector - template - std::vector getInputFeatures(T const& track) + template + std::vector getInputFeatures(T const& track, U const& collision) { std::vector inputFeatures; - for (const auto& idx : MlResponse::mCachedIndices) { - switch (idx) { - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(sign); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(pt); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(eta); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(phi); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(dcaXY); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(dcaZ); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK_SQRT(dcaResXY, cYY); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK_SQRT(dcaResZ, cZZ); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcNClsFindable); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcNClsFound); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcNClsCrossedRows); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcChi2NCl); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcInnerParam); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcSignal); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcNSigmaEl); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcNSigmaMu); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcNSigmaPi); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcNSigmaKa); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tpcNSigmaPr); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(beta); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tofNSigmaEl); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tofNSigmaMu); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tofNSigmaPi); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tofNSigmaKa); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(tofNSigmaPr); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(itsClusterMap); - CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK(itsChi2NCl); - } + float inputFeature = return_feature(idx, track, collision); + inputFeatures.emplace_back(inputFeature); } - return inputFeatures; } + /// Method to get the value of variable chosen for binning + /// \param track is the single track, \param collision is the collision + /// \return binning variable + template + float getBinningFeature(T const& track, U const& collision) + { + return return_feature(mCachedIndexBinning, track, collision); + } + + void cacheBinningIndex(std::string const& cfgBinningFeature) + { + setAvailableInputFeatures(); + if (MlResponse::mAvailableInputFeatures.count(cfgBinningFeature)) { + mCachedIndexBinning = MlResponse::mAvailableInputFeatures[cfgBinningFeature]; + } else { + LOG(fatal) << "Binning feature " << cfgBinningFeature << " not available! Please check your configurables."; + } + } + protected: /// Method to fill the map of available input features void setAvailableInputFeatures() @@ -150,8 +367,9 @@ class MlResponseDielectronSingleTrack : public MlResponse FILL_MAP_DIELECTRON_SINGLE_TRACK(dcaResXY), FILL_MAP_DIELECTRON_SINGLE_TRACK(dcaResZ), FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsFindable), - FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsFound), - FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsCrossedRows), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsFindableMinusFound), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsFindableMinusCrossedRows), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsShared), FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcChi2NCl), FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcInnerParam), FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcSignal), @@ -166,15 +384,97 @@ class MlResponseDielectronSingleTrack : public MlResponse FILL_MAP_DIELECTRON_SINGLE_TRACK(tofNSigmaPi), FILL_MAP_DIELECTRON_SINGLE_TRACK(tofNSigmaKa), FILL_MAP_DIELECTRON_SINGLE_TRACK(tofNSigmaPr), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpctofNSigmaEl), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpctofNSigmaMu), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpctofNSigmaPi), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpctofNSigmaKa), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpctofNSigmaPr), + FILL_MAP_DIELECTRON_SINGLE_TRACK(itsClusterSizes), + FILL_MAP_DIELECTRON_SINGLE_TRACK(itsChi2NCl), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tofChi2), + FILL_MAP_DIELECTRON_SINGLE_TRACK(detectorMap), + FILL_MAP_DIELECTRON_SINGLE_TRACK(x), + FILL_MAP_DIELECTRON_SINGLE_TRACK(alpha), + FILL_MAP_DIELECTRON_SINGLE_TRACK(y), + FILL_MAP_DIELECTRON_SINGLE_TRACK(z), + FILL_MAP_DIELECTRON_SINGLE_TRACK(snp), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tgl), + FILL_MAP_DIELECTRON_SINGLE_TRACK(isAssociatedToMPC), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsFound), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsCrossedRows), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcCrossedRowsOverFindableCls), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcFoundOverFindableCls), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcFractionSharedCls), FILL_MAP_DIELECTRON_SINGLE_TRACK(itsClusterMap), - FILL_MAP_DIELECTRON_SINGLE_TRACK(itsChi2NCl)}; + FILL_MAP_DIELECTRON_SINGLE_TRACK(itsNCls), + FILL_MAP_DIELECTRON_SINGLE_TRACK(itsNClsInnerBarrel), + FILL_MAP_DIELECTRON_SINGLE_TRACK(hasITS), + FILL_MAP_DIELECTRON_SINGLE_TRACK(hasTPC), + FILL_MAP_DIELECTRON_SINGLE_TRACK(hasTRD), + FILL_MAP_DIELECTRON_SINGLE_TRACK(hasTOF), + FILL_MAP_DIELECTRON_SINGLE_TRACK(signed1Pt), + FILL_MAP_DIELECTRON_SINGLE_TRACK(p), + FILL_MAP_DIELECTRON_SINGLE_TRACK(px), + FILL_MAP_DIELECTRON_SINGLE_TRACK(py), + FILL_MAP_DIELECTRON_SINGLE_TRACK(pz), + FILL_MAP_DIELECTRON_SINGLE_TRACK(theta), + FILL_MAP_DIELECTRON_SINGLE_TRACK(meanClusterSizeITS), + FILL_MAP_DIELECTRON_SINGLE_TRACK(meanClusterSizeITSib), + FILL_MAP_DIELECTRON_SINGLE_TRACK(meanClusterSizeITSob), + FILL_MAP_DIELECTRON_SINGLE_TRACK(meanClusterSizeITSCos), + FILL_MAP_DIELECTRON_SINGLE_TRACK(meanClusterSizeITSibCos), + FILL_MAP_DIELECTRON_SINGLE_TRACK(meanClusterSizeITSobCos), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cYY), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cZY), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cZZ), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cSnpY), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cSnpZ), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cSnpSnp), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cTglY), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cTglZ), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cTglSnp), + FILL_MAP_DIELECTRON_SINGLE_TRACK(cTglTgl), + FILL_MAP_DIELECTRON_SINGLE_TRACK(c1PtY), + FILL_MAP_DIELECTRON_SINGLE_TRACK(c1PtZ), + FILL_MAP_DIELECTRON_SINGLE_TRACK(c1PtSnp), + FILL_MAP_DIELECTRON_SINGLE_TRACK(c1PtTgl), + FILL_MAP_DIELECTRON_SINGLE_TRACK(c1Pt21Pt2), + FILL_MAP_DIELECTRON_SINGLE_TRACK(posX), + FILL_MAP_DIELECTRON_SINGLE_TRACK(posY), + FILL_MAP_DIELECTRON_SINGLE_TRACK(posZ), + FILL_MAP_DIELECTRON_SINGLE_TRACK(numContrib), + FILL_MAP_DIELECTRON_SINGLE_TRACK(trackOccupancyInTimeRange), + FILL_MAP_DIELECTRON_SINGLE_TRACK(ft0cOccupancyInTimeRange), + // FILL_MAP_DIELECTRON_SINGLE_TRACK(covXX), + // FILL_MAP_DIELECTRON_SINGLE_TRACK(covXY), + // FILL_MAP_DIELECTRON_SINGLE_TRACK(covXZ), + // FILL_MAP_DIELECTRON_SINGLE_TRACK(covYY), + // FILL_MAP_DIELECTRON_SINGLE_TRACK(covYZ), + // FILL_MAP_DIELECTRON_SINGLE_TRACK(covZZ), + // FILL_MAP_DIELECTRON_SINGLE_TRACK(chi2), + FILL_MAP_DIELECTRON_SINGLE_TRACK(multFT0A), + FILL_MAP_DIELECTRON_SINGLE_TRACK(multFT0C), + FILL_MAP_DIELECTRON_SINGLE_TRACK(multNTracksPV), + FILL_MAP_DIELECTRON_SINGLE_TRACK(multNTracksPVeta1), + FILL_MAP_DIELECTRON_SINGLE_TRACK(multNTracksPVetaHalf), + FILL_MAP_DIELECTRON_SINGLE_TRACK(isInelGt0), + FILL_MAP_DIELECTRON_SINGLE_TRACK(isInelGt1), + FILL_MAP_DIELECTRON_SINGLE_TRACK(multFT0M), + FILL_MAP_DIELECTRON_SINGLE_TRACK(centFT0M), + FILL_MAP_DIELECTRON_SINGLE_TRACK(centFT0A), + FILL_MAP_DIELECTRON_SINGLE_TRACK(centFT0C)}; } + + uint8_t mCachedIndexBinning; // index correspondance between configurable and available input features }; } // namespace o2::analysis #undef FILL_MAP_DIELECTRON_SINGLE_TRACK -#undef CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK -#undef CHECK_AND_FILL_VEC_DIELECTRON_SINGLE_TRACK_SQRT +#undef CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK +#undef CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_SQRT +#undef CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_COS +#undef CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK_TPCTOF +#undef CHECK_AND_FILL_DIELECTRON_COLLISION #endif // PWGEM_DILEPTON_UTILS_MLRESPONSEDIELECTRONSINGLETRACK_H_ diff --git a/PWGEM/Dilepton/Utils/PairUtilities.h b/PWGEM/Dilepton/Utils/PairUtilities.h index 77496d185c2..05c858a25ec 100644 --- a/PWGEM/Dilepton/Utils/PairUtilities.h +++ b/PWGEM/Dilepton/Utils/PairUtilities.h @@ -41,6 +41,14 @@ enum class DileptonAnalysisType : int { kVM = 5, kHFll = 6, }; +enum class DileptonPrefilterBit : int { + kMee = 0, // reject tracks from pi0 dalitz decays at very low mass where S/B > 1 + kPhiV = 1, // reject tracks from photon conversions + kSplitOrMergedTrackLS = 2, // reject split or marged tracks in LS pairs based on momentum deta-dphi at PV + kSplitOrMergedTrackULS = 3, // reject split or marged tracks in ULS pairs based on momentum deta-dphi at PV + kSplitOrMergedTrackLSGeom = 4, // reject split or marged tracks in LS pairs based on geometical distance at a certain propagated radius + kSplitOrMergedTrackULSGeom = 5, // reject split or marged tracks in ULS pairs based on geometical distance at a certain propagated radius +}; using SMatrix55 = ROOT::Math::SMatrix>; using SMatrix5 = ROOT::Math::SVector; @@ -231,16 +239,20 @@ inline float getPhivPair(float pxpos, float pypos, float pzpos, float pxneg, flo std::array arr_ele{pxneg, pyneg, pzneg}; std::array pos_x_ele{0, 0, 0}; // LOGF(info, "Q1 = %d , Q2 = %d", cpos, cneg); + float ptpos = std::sqrt(std::pow(pxpos, 2) + std::pow(pypos, 2)); + float ptneg = std::sqrt(std::pow(pxneg, 2) + std::pow(pyneg, 2)); if (cpos * cneg > 0) { // Like Sign if (bz < 0) { - if (cpos > 0) { + // if (cpos > 0) { + if (cpos * ptpos > cneg * ptneg) { pos_x_ele = RecoDecay::crossProd(arr_pos, arr_ele); } else { pos_x_ele = RecoDecay::crossProd(arr_ele, arr_pos); } } else { - if (cpos > 0) { + // if (cpos > 0) { + if (cpos * ptpos > cneg * ptneg) { pos_x_ele = RecoDecay::crossProd(arr_ele, arr_pos); } else { pos_x_ele = RecoDecay::crossProd(arr_pos, arr_ele); @@ -248,13 +260,15 @@ inline float getPhivPair(float pxpos, float pypos, float pzpos, float pxneg, flo } } else { // Unlike Sign if (bz > 0) { - if (cpos > 0) { + // if (cpos > 0) { + if (cpos * ptpos > cneg * ptneg) { pos_x_ele = RecoDecay::crossProd(arr_pos, arr_ele); } else { pos_x_ele = RecoDecay::crossProd(arr_ele, arr_pos); } } else { - if (cpos > 0) { + // if (cpos > 0) { + if (cpos * ptpos > cneg * ptneg) { pos_x_ele = RecoDecay::crossProd(arr_ele, arr_pos); } else { pos_x_ele = RecoDecay::crossProd(arr_pos, arr_ele); @@ -315,6 +329,18 @@ inline float getOpeningAngle(float pxpos, float pypos, float pzpos, float pxneg, float argcos = RecoDecay::dotProd(std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}) / std::sqrt(ptot2); return std::acos(clipToPM1(argcos)); } +//_______________________________________________________________________ +inline float pairDCAQuadSum(const float dca1, const float dca2) +{ + return std::sqrt((dca1 * dca1 + dca2 * dca2) / 2.); +} + +//_______________________________________________________________________ +inline float pairDCASignQuadSum(const float dca1, const float dca2, const float charge1, const float charge2) +{ + return charge1 * charge2 * TMath::Sign(1., dca1) * TMath::Sign(1., dca2) * std::sqrt((dca1 * dca1 + dca2 * dca2) / 2.); +} + //_______________________________________________________________________ } // namespace o2::aod::pwgem::dilepton::utils::pairutil #endif // PWGEM_DILEPTON_UTILS_PAIRUTILITIES_H_ diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx b/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx index 4fea46fe3cd..582b9754057 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx @@ -13,13 +13,20 @@ // Class for EMCal cluster selection // +#include #include "Framework/Logger.h" #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" +#include "PWGJE/DataModel/EMCALClusters.h" ClassImp(EMCPhotonCut); -const char* EMCPhotonCut::mCutNames[static_cast(EMCPhotonCut::EMCPhotonCuts::kNCuts)] = {"Energy", "NCell", "M02", "Timing", "TrackMatching", "Exotic"}; +const char* EMCPhotonCut::mCutNames[static_cast(EMCPhotonCut::EMCPhotonCuts::kNCuts)] = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "Exotic"}; +void EMCPhotonCut::SetClusterizer(std::string clusterDefinitionString) +{ + mDefinition = static_cast(o2::aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionString)); + LOG(info) << "EMCal Photon Cut, set cluster definition to: " << mDefinition << " (" << clusterDefinitionString << ")"; +} void EMCPhotonCut::SetMinE(float min) { mMinE = min; @@ -72,6 +79,9 @@ void EMCPhotonCut::print() const LOG(info) << "EMCal Photon Cut:"; for (int i = 0; i < static_cast(EMCPhotonCuts::kNCuts); i++) { switch (static_cast(i)) { + case EMCPhotonCuts::kDefinition: + LOG(info) << mCutNames[i] << " > " << mDefinition; + break; case EMCPhotonCuts::kEnergy: LOG(info) << mCutNames[i] << " > " << mMinE; break; diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h index 2ce3d91173c..8bfd8ca630f 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h @@ -34,7 +34,8 @@ class EMCPhotonCut : public TNamed enum class EMCPhotonCuts : int { // cluster cut - kEnergy = 0, + kDefinition = 0, + kEnergy, kNCell, kM02, kTiming, @@ -49,6 +50,9 @@ class EMCPhotonCut : public TNamed template bool IsSelected(Cluster const& cluster) const { + if (!IsSelectedEMCal(EMCPhotonCuts::kDefinition, cluster)) { + return false; + } if (!IsSelectedEMCal(EMCPhotonCuts::kEnergy, cluster)) { return false; } @@ -75,6 +79,9 @@ class EMCPhotonCut : public TNamed bool IsSelectedEMCal(const EMCPhotonCuts& cut, Cluster const& cluster) const { switch (cut) { + case EMCPhotonCuts::kDefinition: + return cluster.definition() == mDefinition; + case EMCPhotonCuts::kEnergy: return cluster.e() > mMinE; @@ -113,6 +120,7 @@ class EMCPhotonCut : public TNamed } // Setters + void SetClusterizer(std::string clusterDefinitionString = "kV3Default"); void SetMinE(float min = 0.7f); void SetMinNCell(int min = 1); void SetM02Range(float min = 0.1f, float max = 0.7f); @@ -128,6 +136,7 @@ class EMCPhotonCut : public TNamed private: // EMCal cluster cuts + int mDefinition{10}; ///< clusterizer definition float mMinE{0.7f}; ///< minimum energy int mMinNCell{1}; ///< minimum number of cells per cluster float mMinM02{0.1f}; ///< minimum M02 for a cluster diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 00475bd4885..b452030bc24 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -11,8 +11,10 @@ // // ======================== // -// This code loops over photons and makes pairs for neutral mesons analyses. -// Please write to: daiki.sekihata@cern.ch +/// \file Pi0EtaToGammaGamma.h +/// \brief This code loops over photons and makes pairs for neutral mesons analyses. +/// +/// \author D. Sekihata, daiki.sekihata@cern.ch #ifndef PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMA_H_ #define PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMA_H_ @@ -80,7 +82,7 @@ using MyEMCClusters = soa::Join; using MyEMCCluster = MyEMCClusters::iterator; using MyPHOSClusters = soa::Join; -using MyPHOSCluster = MyEMCClusters::iterator; +using MyPHOSCluster = MyPHOSClusters::iterator; template struct Pi0EtaToGammaGamma { @@ -178,6 +180,7 @@ struct Pi0EtaToGammaGamma { EMCPhotonCut fEMCCut; struct : ConfigurableGroup { std::string prefix = "emccut_group"; + Configurable clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"}; Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"}; Configurable EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"}; Configurable EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"}; @@ -189,6 +192,7 @@ struct Pi0EtaToGammaGamma { Configurable> EMC_TM_Phi{"EMC_TM_Phi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; Configurable EMC_Eoverp{"EMC_Eoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; Configurable EMC_UseExoticCut{"EMC_UseExoticCut", true, "FLag to use the EMCal exotic cluster cut"}; + Configurable cfgDistanceToEdge{"cfgDistanceToEdge", 1, "Distance to edge in cells required for rotated cluster to be accepted"}; } emccuts; PHOSPhotonCut fPHOSCut; @@ -210,6 +214,7 @@ struct Pi0EtaToGammaGamma { Service ccdb; int mRunNumber; float d_bz; + o2::emcal::Geometry* emcalGeom; void init(InitContext&) { @@ -244,7 +249,7 @@ struct Pi0EtaToGammaGamma { if constexpr (pairtype == kEMCEMC) { fRegistry.addClone("Pair/same/", "Pair/rotation/"); - o2::emcal::Geometry::GetInstanceFromRunNumber(300000); + emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber(300000); } mRunNumber = 0; @@ -267,7 +272,7 @@ struct Pi0EtaToGammaGamma { if (d_bz_input > -990) { d_bz = d_bz_input; o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { + if (std::fabs(d_bz) > 1e-5) { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } mRunNumber = collision.runNumber(); @@ -321,7 +326,6 @@ struct Pi0EtaToGammaGamma { fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } void DefinePCMCut() @@ -419,13 +423,14 @@ struct Pi0EtaToGammaGamma { fEMCCut = EMCPhotonCut("fEMCCut", "fEMCCut"); + fEMCCut.SetClusterizer(emccuts.clusterDefinition); fEMCCut.SetMinE(emccuts.EMC_minE); fEMCCut.SetMinNCell(emccuts.EMC_minNCell); fEMCCut.SetM02Range(emccuts.EMC_minM02, emccuts.EMC_maxM02); fEMCCut.SetTimeRange(emccuts.EMC_minTime, emccuts.EMC_maxTime); - fEMCCut.SetTrackMatchingEta([a, b, c](float pT) { return a + pow(pT + b, c); }); - fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); }); + fEMCCut.SetTrackMatchingEta([a, b, c](float pT) { return a + std::pow(pT + b, c); }); + fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + std::pow(pT + e, f); }); fEMCCut.SetMinEoverP(emccuts.EMC_Eoverp); fEMCCut.SetUseExoticCut(emccuts.EMC_UseExoticCut); @@ -436,6 +441,42 @@ struct Pi0EtaToGammaGamma { fPHOSCut.SetEnergyRange(phoscuts.cfg_min_Ecluster, 1e+10); } + /// \brief returns if cluster is too close to edge of EMCal (using rotation background method only for EMCal!) + bool IsTooCloseToEdge(const int cellID, const int DistanceToBorder = 1) + { + if (DistanceToBorder <= 0) { + return false; + } + if (cellID < 0) { + return true; + } + + int iBadCell = -1; + + // check distance to border in case the cell is okay + auto [iSupMod, iMod, iPhi, iEta] = emcalGeom->GetCellIndex(cellID); + auto [irow, icol] = emcalGeom->GetCellPhiEtaIndexInSModule(iSupMod, iMod, iPhi, iEta); + + // Check rows/phi + int iRowLast = 24; + if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_HALF) { + iRowLast /= 2; // 2/3 sm case + } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_THIRD) { + iRowLast /= 3; // 1/3 sm case + } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::DCAL_EXT) { + iRowLast /= 3; // 1/3 sm case + } + + if (irow < DistanceToBorder || (iRowLast - irow) <= DistanceToBorder) { + iBadCell = 1; + } + + if (iBadCell > 0) { + return true; + } + return false; + } + /// \brief Calculate background (using rotation background method only for EMCal!) template void RotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, float eventWeight) @@ -450,11 +491,37 @@ struct Pi0EtaToGammaGamma { photon1 = rotationMatrix * photon1; photon2 = rotationMatrix * photon2; - for (auto& photon : photons_coll) { + int iCellID_photon1 = 0; + int iCellID_photon2 = 0; + + try { + iCellID_photon1 = emcalGeom->GetAbsCellIdFromEtaPhi(photon1.Eta(), photon1.Phi()); + if (IsTooCloseToEdge(iCellID_photon1, emccuts.cfgDistanceToEdge.value)) { + iCellID_photon1 = -1; + } + } catch (o2::emcal::InvalidPositionException& e) { + iCellID_photon1 = -1; + } + try { + iCellID_photon2 = emcalGeom->GetAbsCellIdFromEtaPhi(photon2.Eta(), photon2.Phi()); + if (IsTooCloseToEdge(iCellID_photon2, emccuts.cfgDistanceToEdge.value)) { + iCellID_photon2 = -1; + } + } catch (o2::emcal::InvalidPositionException& e) { + iCellID_photon2 = -1; + } + if (iCellID_photon1 == -1 && iCellID_photon2 == -1) { + return; + } + + for (const auto& photon : photons_coll) { if (photon.globalIndex() == ig1 || photon.globalIndex() == ig2) { // only combine rotated photons with other photons continue; } + if (!(fEMCCut.IsSelected(photon))) { + continue; + } ROOT::Math::PtEtaPhiMVector photon3(photon.pt(), photon.eta(), photon.phi(), 0.); ROOT::Math::PtEtaPhiMVector mother1 = photon1 + photon3; @@ -463,27 +530,14 @@ struct Pi0EtaToGammaGamma { float openingAngle1 = std::acos(photon1.Vect().Dot(photon3.Vect()) / (photon1.P() * photon3.P())); float openingAngle2 = std::acos(photon2.Vect().Dot(photon3.Vect()) / (photon2.P() * photon3.P())); - int iCellID_photon1 = 0; - int iCellID_photon2 = 0; - - try { - iCellID_photon1 = o2::emcal::Geometry::GetInstance()->GetAbsCellIdFromEtaPhi(photon1.Eta(), photon1.Phi()); - } catch (o2::emcal::InvalidPositionException& e) { - iCellID_photon1 = -1; - } - try { - iCellID_photon2 = o2::emcal::Geometry::GetInstance()->GetAbsCellIdFromEtaPhi(photon2.Eta(), photon2.Phi()); - } catch (o2::emcal::InvalidPositionException& e) { - iCellID_photon2 = -1; - } - - if (openingAngle1 > emccuts.minOpenAngle && abs(mother1.Rapidity()) < maxY && iCellID_photon1 > 0) { + if (openingAngle1 > emccuts.minOpenAngle && std::abs(mother1.Rapidity()) < maxY && iCellID_photon1 > 0) { fRegistry.fill(HIST("Pair/rotation/hs"), mother1.M(), mother1.Pt(), eventWeight); } - if (openingAngle2 > emccuts.minOpenAngle && abs(mother2.Rapidity()) < maxY && iCellID_photon2 > 0) { + if (openingAngle2 > emccuts.minOpenAngle && std::abs(mother2.Rapidity()) < maxY && iCellID_photon2 > 0) { fRegistry.fill(HIST("Pair/rotation/hs"), mother2.M(), mother2.Pt(), eventWeight); } } + return; } SliceCache cache; @@ -508,14 +562,14 @@ struct Pi0EtaToGammaGamma { TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCut1 const& cut1, TCut2 const& cut2) { - for (auto& collision : collisions) { + for (const auto& collision : collisions) { initCCDB(collision); int ndiphoton = 0; if ((pairtype == PairType::kPHOSPHOS || pairtype == PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { continue; } - if (eventcuts.onlyKeepWeightedEvents && fabs(collision.weight() - 1.) < 1E-10) { + if (eventcuts.onlyKeepWeightedEvents && std::fabs(collision.weight() - 1.) < 1E-10) { continue; } @@ -571,7 +625,7 @@ struct Pi0EtaToGammaGamma { auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); - for (auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_per_collision, photons2_per_collision))) { + for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_per_collision, photons2_per_collision))) { if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { continue; } @@ -579,7 +633,7 @@ struct Pi0EtaToGammaGamma { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - if (abs(v12.Rapidity()) > maxY) { + if (std::abs(v12.Rapidity()) > maxY) { continue; } @@ -607,7 +661,7 @@ struct Pi0EtaToGammaGamma { auto positrons_per_collision = positrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); auto electrons_per_collision = electrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); - for (auto& g1 : photons1_per_collision) { + for (const auto& g1 : photons1_per_collision) { if (!cut1.template IsSelected(g1)) { continue; } @@ -615,7 +669,7 @@ struct Pi0EtaToGammaGamma { auto ele1 = g1.template negTrack_as(); ROOT::Math::PtEtaPhiMVector v_gamma(g1.pt(), g1.eta(), g1.phi(), 0.); - for (auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { + for (const auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { if (pos2.trackId() == ele2.trackId()) { // this is protection against pairing identical 2 tracks. continue; @@ -636,7 +690,7 @@ struct Pi0EtaToGammaGamma { ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ee = v_pos + v_ele; ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele; - if (abs(veeg.Rapidity()) > maxY) { + if (std::abs(veeg.Rapidity()) > maxY) { continue; } @@ -659,14 +713,14 @@ struct Pi0EtaToGammaGamma { auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); - for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_collision, photons2_per_collision))) { + for (const auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_collision, photons2_per_collision))) { if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { continue; } ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - if (abs(v12.Rapidity()) > maxY) { + if (std::abs(v12.Rapidity()) > maxY) { continue; } @@ -700,7 +754,7 @@ struct Pi0EtaToGammaGamma { auto collisionIds2_in_mixing_pool = emh2->GetCollisionIdsFromEventPool(key_bin); if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC) { // same kinds pairing - for (auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -711,12 +765,12 @@ struct Pi0EtaToGammaGamma { auto photons1_from_event_pool = emh1->GetTracksPerCollision(mix_dfId_collisionId); // LOGF(info, "Do event mixing: current event (%d, %d), ngamma = %d | event pool (%d, %d), ngamma = %d", ndf, collision.globalIndex(), selected_photons1_in_this_event.size(), mix_dfId, mix_collisionId, photons1_from_event_pool.size()); - for (auto& g1 : selected_photons1_in_this_event) { - for (auto& g2 : photons1_from_event_pool) { + for (const auto& g1 : selected_photons1_in_this_event) { + for (const auto& g2 : photons1_from_event_pool) { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - if (abs(v12.Rapidity()) > maxY) { + if (std::abs(v12.Rapidity()) > maxY) { continue; } @@ -726,7 +780,7 @@ struct Pi0EtaToGammaGamma { } // end of loop over mixed event pool } else { // [photon1 from event1, photon2 from event2] and [photon1 from event2, photon2 from event1] - for (auto& mix_dfId_collisionId : collisionIds2_in_mixing_pool) { + for (const auto& mix_dfId_collisionId : collisionIds2_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -737,22 +791,22 @@ struct Pi0EtaToGammaGamma { auto photons2_from_event_pool = emh2->GetTracksPerCollision(mix_dfId_collisionId); // LOGF(info, "Do event mixing: current event (%d, %d), ngamma = %d | event pool (%d, %d), nll = %d", ndf, collision.globalIndex(), selected_photons1_in_this_event.size(), mix_dfId, mix_collisionId, photons2_from_event_pool.size()); - for (auto& g1 : selected_photons1_in_this_event) { - for (auto& g2 : photons2_from_event_pool) { + for (const auto& g1 : selected_photons1_in_this_event) { + for (const auto& g2 : photons2_from_event_pool) { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); if constexpr (pairtype == PairType::kPCMDalitzEE || pairtype == PairType::kPCMDalitzMuMu) { //[photon from event1, dilepton from event2] and [photon from event2, dilepton from event1] v2.SetM(g2.mass()); } ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - if (abs(v12.Rapidity()) > maxY) { + if (std::abs(v12.Rapidity()) > maxY) { continue; } fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight()); } } } // end of loop over mixed event pool - for (auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -763,15 +817,15 @@ struct Pi0EtaToGammaGamma { auto photons1_from_event_pool = emh1->GetTracksPerCollision(mix_dfId_collisionId); // LOGF(info, "Do event mixing: current event (%d, %d), nll = %d | event pool (%d, %d), ngamma = %d", ndf, collision.globalIndex(), selected_photons2_in_this_event.size(), mix_dfId, mix_collisionId, photons1_from_event_pool.size()); - for (auto& g1 : selected_photons2_in_this_event) { - for (auto& g2 : photons1_from_event_pool) { + for (const auto& g1 : selected_photons2_in_this_event) { + for (const auto& g2 : photons1_from_event_pool) { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); if constexpr (pairtype == PairType::kPCMDalitzEE || pairtype == PairType::kPCMDalitzMuMu) { //[photon from event1, dilepton from event2] and [photon from event2, dilepton from event1] v1.SetM(g1.mass()); } ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - if (abs(v12.Rapidity()) > maxY) { + if (std::abs(v12.Rapidity()) > maxY) { continue; } fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight()); @@ -788,6 +842,7 @@ struct Pi0EtaToGammaGamma { } // end of collision loop } + Filter collisionFilter_occupancy = eventcuts.cfgOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgOccupancyMax; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); using FilteredMyCollisions = soa::Filtered; diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h index 0dda29e4d24..4ce009632dc 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h @@ -168,6 +168,7 @@ struct Pi0EtaToGammaGammaMC { EMCPhotonCut fEMCCut; struct : ConfigurableGroup { std::string prefix = "emccut_group"; + Configurable clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"}; Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"}; Configurable EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"}; Configurable EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"}; @@ -289,7 +290,6 @@ struct Pi0EtaToGammaGammaMC { fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } void DefinePCMCut() @@ -386,6 +386,7 @@ struct Pi0EtaToGammaGammaMC { fEMCCut = EMCPhotonCut("fEMCCut", "fEMCCut"); + fEMCCut.SetClusterizer(emccuts.clusterDefinition); fEMCCut.SetMinE(emccuts.EMC_minE); fEMCCut.SetMinNCell(emccuts.EMC_minNCell); fEMCCut.SetM02Range(emccuts.EMC_minM02, emccuts.EMC_maxM02); @@ -663,6 +664,7 @@ struct Pi0EtaToGammaGammaMC { } // end of collision loop } + Filter collisionFilter_occupancy = eventcuts.cfgOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgOccupancyMax; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); using FilteredMyCollisions = soa::Filtered; diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index 9b91eb0864f..5c366715b44 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -459,7 +459,7 @@ DECLARE_SOA_COLUMN(TrackPt, trackpt, std::vector); DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float e, float eta, float m = 0) -> float { return sqrt(e * e - m * m) / cosh(eta); }); //! cluster pt, mass to be given as argument when getter is called! } // namespace emccluster DECLARE_SOA_TABLE(SkimEMCClusters, "AOD", "SKIMEMCCLUSTERS", //! table of skimmed EMCal clusters - o2::soa::Index<>, skimmedcluster::CollisionId, skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi, + o2::soa::Index<>, skimmedcluster::CollisionId, emccluster::Definition, skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi, skimmedcluster::M02, skimmedcluster::NCells, skimmedcluster::Time, emccluster::IsExotic, emccluster::TrackEta, emccluster::TrackPhi, emccluster::TrackP, emccluster::TrackPt, emccluster::Pt); using SkimEMCCluster = SkimEMCClusters::iterator; diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index f6398d11929..1f1f3b17ead 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -14,6 +14,9 @@ // This code produces reduced events for photon analyses. // Please write to: daiki.sekihata@cern.ch +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -24,6 +27,7 @@ #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" +#include "Common/CCDB/TriggerAliases.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" @@ -65,6 +69,8 @@ struct CreateEMEvent { Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; Configurable applyEveSel_at_skimming{"applyEveSel_at_skimming", false, "flag to apply minimal event selection at the skimming level"}; + Configurable needEMCTrigger{"needEMCTrigger", false, "flag to only save events which have kTVXinEMC trigger bit. To reduce PbPb derived data size"}; + Configurable needPHSTrigger{"needPHSTrigger", false, "flag to only save events which have kTVXinPHOS trigger bit. To reduce PbPb derived data size"}; HistogramRegistry registry{"registry"}; void init(o2::framework::InitContext&) @@ -143,6 +149,12 @@ struct CreateEMEvent { if (applyEveSel_at_skimming && (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) { continue; } + if (needEMCTrigger && !collision.alias_bit(kTVXinEMC)) { + continue; + } + if (needPHSTrigger && !collision.alias_bit(kTVXinPHOS)) { + continue; + } // LOGF(info, "collision-loop | bc.globalIndex() = %d, ncolls_per_bc = %d", bc.globalIndex(), map_ncolls_per_bc[bc.globalIndex()]); registry.fill(HIST("hEventCounter"), 1); @@ -154,7 +166,7 @@ struct CreateEMEvent { // uint64_t tag = collision.selection_raw(); event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), bc.timestamp(), collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange()); + collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); eventcov(collision.covXX(), collision.covXY(), collision.covXZ(), collision.covYY(), collision.covYZ(), collision.covZZ(), collision.chi2()); diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx index aff407a83f3..c7da3fa270f 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx @@ -14,6 +14,7 @@ /// \author marvin.hemmer@cern.ch #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -137,7 +138,7 @@ struct skimmerGammaCalo { historeg.fill(HIST("hCaloClusterEOut"), emccluster.energy()); historeg.fill(HIST("hCaloClusterFilter"), 4); - tableGammaEMCReco(emccluster.collisionId(), emccluster.energy(), emccluster.eta(), emccluster.phi(), emccluster.m02(), + tableGammaEMCReco(emccluster.collisionId(), emccluster.definition(), emccluster.energy(), emccluster.eta(), emccluster.phi(), emccluster.m02(), emccluster.nCells(), emccluster.time(), emccluster.isExotic(), vEta, vPhi, vP, vPt); } } diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index 94cf6c71cb1..82dd5775d75 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -126,5 +126,5 @@ o2physics_add_dpl_workflow(check-mc-v0 o2physics_add_dpl_workflow(pi0-flow-emc SOURCES taskPi0FlowEMC.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore - COMPONENT_NAME Analysis) \ No newline at end of file + PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore + COMPONENT_NAME Analysis) diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx index e20116bc99f..5def3ca8e03 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx @@ -14,6 +14,9 @@ // This code runs loop over dalitz ee table for dalitz QC. // Please write to: daiki.sekihata@cern.ch +#include +#include + #include "TString.h" #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" @@ -219,7 +222,6 @@ struct DalitzEEQC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } void DefineDileptonCut() @@ -349,6 +351,9 @@ struct DalitzEEQC { if (!fEMEventCut.IsSelected(collision)) { continue; } + if (!(eventcuts.cfgOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgOccupancyMax)) { + continue; + } o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision); fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx index afa1bca2bd7..0f8e539f323 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx @@ -14,6 +14,9 @@ // This code runs loop over dalitz ee table for dalitz QC. // Please write to: daiki.sekihata@cern.ch +#include +#include + #include "TString.h" #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" @@ -246,7 +249,6 @@ struct DalitzEEQCMC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } void DefineDileptonCut() @@ -375,7 +377,7 @@ struct DalitzEEQCMC { break; } } // end of primary/secondary selection - } // end of primary selection for same mother + } // end of primary selection for same mother } // fill track info that belong to true pairs. @@ -454,6 +456,9 @@ struct DalitzEEQCMC { if (!fEMEventCut.IsSelected(collision)) { continue; } + if (!(eventcuts.cfgOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgOccupancyMax)) { + continue; + } o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision); fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted @@ -490,6 +495,9 @@ struct DalitzEEQCMC { if (!fEMEventCut.IsSelected(collision)) { continue; } + if (!(eventcuts.cfgOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgOccupancyMax)) { + continue; + } auto mccollision = collision.emmcevent_as(); auto posTracks_per_coll = posTracksMC->sliceByCachedUnsorted(o2::aod::emmcparticle::emmceventId, mccollision.globalIndex(), cache); @@ -551,7 +559,7 @@ struct DalitzEEQCMC { } } } // end of true ULS pair loop - } // end of collision loop + } // end of collision loop } PROCESS_SWITCH(DalitzEEQCMC, processGen, "run genrated info", true); diff --git a/PWGEM/PhotonMeson/Tasks/emcalQC.cxx b/PWGEM/PhotonMeson/Tasks/emcalQC.cxx index 0669017704c..fe81608516c 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalQC.cxx @@ -14,6 +14,8 @@ // This code runs loop over EMCal clusters for EMCal QC. // Please write to: nicolas.strangmann@cern.ch +#include +#include #include #include "TString.h" #include "THashList.h" @@ -74,6 +76,7 @@ struct emcalQC { EMCPhotonCut fEMCCut; struct : ConfigurableGroup { std::string prefix = "emccut_group"; + Configurable clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"}; Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"}; Configurable EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"}; Configurable EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"}; @@ -100,7 +103,6 @@ struct emcalQC { fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } void DefineEMCCut() @@ -114,6 +116,7 @@ struct emcalQC { const float f = emccuts.EMC_TM_Phi->at(2); LOGF(info, "EMCal track matching parameters : a = %f, b = %f, c = %f, d = %f, e = %f, f = %f", a, b, c, d, e, f); + fEMCCut.SetClusterizer(emccuts.clusterDefinition); fEMCCut.SetMinE(emccuts.EMC_minE); fEMCCut.SetMinNCell(emccuts.EMC_minNCell); fEMCCut.SetM02Range(emccuts.EMC_minM02, emccuts.EMC_maxM02); @@ -182,6 +185,9 @@ struct emcalQC { if (!fEMEventCut.IsSelected(collision)) { continue; } + if (!(eventcuts.cfgOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgOccupancyMax)) { + continue; + } o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision); fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted @@ -189,9 +195,13 @@ struct emcalQC { auto clusters_per_coll = clusters.sliceBy(perCollision, collision.collisionId()); fRegistry.fill(HIST("Cluster/before/hNgamma"), clusters_per_coll.size(), collision.weight()); - int ng = 0; + int ngBefore = 0; + int ngAfter = 0; for (auto& cluster : clusters_per_coll) { // Fill the cluster properties before applying any cuts + if (!fEMCCut.IsSelectedEMCal(EMCPhotonCut::EMCPhotonCuts::kDefinition, cluster)) + continue; + ngBefore++; o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<0>(&fRegistry, cluster, cfgDo2DQA, collision.weight()); // Apply cuts one by one and fill in hClusterQualityCuts histogram @@ -201,10 +211,10 @@ struct emcalQC { bool survivesIsSelectedEMCalCuts = true; // Survives "manual" cuts listed in this task bool survivesIsSelectedCuts = fEMCCut.IsSelected(cluster); // Survives the cutlist defines in EMCPhotonCut.h, which is also used in the Pi0Eta task - for (int icut = 0; icut < static_cast(EMCPhotonCut::EMCPhotonCuts::kNCuts); icut++) { // Loop through different cut observables + for (int icut = 1; icut < static_cast(EMCPhotonCut::EMCPhotonCuts::kNCuts); icut++) { // Loop through different cut observables, start at 1 to ignore ClusterDefinition EMCPhotonCut::EMCPhotonCuts specificcut = static_cast(icut); if (!fEMCCut.IsSelectedEMCal(specificcut, cluster)) { // Check whether cluster passes this cluster requirement, if not, fill why in the next row - fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), icut + 1, cluster.e(), collision.weight()); + fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), icut, cluster.e(), collision.weight()); survivesIsSelectedEMCalCuts = false; } } @@ -216,10 +226,11 @@ struct emcalQC { if (survivesIsSelectedCuts) { o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<1>(&fRegistry, cluster, cfgDo2DQA, collision.weight()); fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), 7., cluster.e(), collision.weight()); - ng++; + ngAfter++; } } - fRegistry.fill(HIST("Cluster/after/hNgamma"), ng, collision.weight()); + fRegistry.fill(HIST("Cluster/before/hNgamma"), ngBefore, collision.weight()); + fRegistry.fill(HIST("Cluster/after/hNgamma"), ngAfter, collision.weight()); } // end of collision loop } // end of process diff --git a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx index f5ab18bc572..aa034a2ec39 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx @@ -14,6 +14,9 @@ // This code runs loop over v0 photons for PCM QC. // Please write to: daiki.sekihata@cern.ch +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -181,7 +184,6 @@ struct PCMQC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); } diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index c0a6bfa5943..54ad5d116d1 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx @@ -14,6 +14,9 @@ // This code runs loop over v0 photons for PCM QC. // Please write to: daiki.sekihata@cern.ch +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -238,7 +241,6 @@ struct PCMQCMC { fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); } diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index 2bdeb316dd6..e99f1dba904 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -15,16 +15,36 @@ /// \author M. Hemmer, marvin.hemmer@cern.ch #include -#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Math/Vector4D.h" +#include "Math/Vector3D.h" +#include "Math/LorentzRotation.h" +#include "Math/Rotation3D.h" +#include "Math/AxisAngle.h" #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" #include "Common/Core/EventPlaneHelper.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Qvectors.h" +#include "CommonConstants/MathConstants.h" + +#include "DetectorsBase/GeometryManager.h" +#include "DataFormatsEMCAL/Constants.h" +#include "EMCALBase/Geometry.h" +#include "EMCALCalib/BadChannelMap.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" @@ -58,27 +78,32 @@ enum CentralityEstimator { None = 0, NCentralityEstimators }; -struct EMfTaskPi0Flow { +struct TaskPi0FlowEMC { // configurable for flow Configurable harmonic{"harmonic", 2, "harmonic number"}; Configurable qvecDetector{"qvecDetector", 0, "Detector for Q vector estimation (FT0M: 0, FT0A: 1, FT0C: 2, TPC Pos: 3, TPC Neg: 4, TPC Tot: 5)"}; + Configurable qvecSubADetector{"qvecSubADetector", 3, "Sub A Detector for Q vector estimation for resolution (FT0M: 0, FT0A: 1, FT0C: 2, TPC Pos: 3, TPC Neg: 4, TPC Tot: 5)"}; + Configurable qvecSubBDetector{"qvecSubBDetector", 4, "Sub B Detector for Q vector estimation for resolution (FT0M: 0, FT0A: 1, FT0C: 2, TPC Pos: 3, TPC Neg: 4, TPC Tot: 5)"}; Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3)"}; Configurable saveEpResoHisto{"saveEpResoHisto", false, "Flag to save event plane resolution histogram"}; Configurable saveSPResoHist{"saveSPResoHist", false, "Flag to save scalar product resolution histogram"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable cfgDoRotation{"cfgDoRotation", true, "Flag to enable rotation background method"}; + Configurable cfgDownsampling{"cfgDownsampling", 1, "Calculate rotation background only for every collision"}; + Configurable cfgRotAngle{"cfgRotAngle", M_PI / 2., "Angle used for the rotation method"}; + Configurable cfgDistanceToEdge{"cfgDistanceToEdge", 1, "Distance to edge in cells required for rotated cluster to be accepted"}; // configurable axis - ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {400, 0.0, 0.8}, ""}; + ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {200, 0.0, 0.4}, ""}; ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0., 20.}, ""}; - ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0., 100.}, ""}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {20, 0., 100.}, ""}; ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""}; ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {100, -1., 1.}, ""}; - ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, 0., 1.}, ""}; - ConfigurableAxis thConfigAxisTanThetaPhi{"thConfigAxisTanThetaPhi", {180, -90.f, 90.f}, ""}; + ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, -5., 5.}, ""}; EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { - std::string prefix = "eventcut_group"; + std::string prefix = "eventcuts"; Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; @@ -89,39 +114,79 @@ struct EMfTaskPi0Flow { Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; Configurable cfgRequireEMCReadoutInMB{"cfgRequireEMCReadoutInMB", true, "require the EMC to be read out in an MB collision (kTVXinEMC)"}; Configurable cfgRequireEMCHardwareTriggered{"cfgRequireEMCHardwareTriggered", false, "require the EMC to be hardware triggered (kEMC7 or kDMC7)"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -1, "min. occupancy"}; - Configurable cfgOccupancyMax{"cfgOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -1, "min. track occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. track occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -1, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; + Configurable cfgMinCent{"cfgMinCent", 0, "min. centrality (%)"}; + Configurable cfgMaxCent{"cfgMaxCent", 90, "max. centrality (%)"}; Configurable onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; + Configurable cfgEnableQA{"cfgEnableQA", false, "flag to turn QA plots on/off"}; } eventcuts; EMCPhotonCut fEMCCut; struct : ConfigurableGroup { - std::string prefix = "emccut_group"; - Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"}; - Configurable EMC_minTime{"EMC_minTime", -25., "Minimum cluster time for EMCal time cut"}; - Configurable EMC_maxTime{"EMC_maxTime", +30., "Maximum cluster time for EMCal time cut"}; - Configurable EMC_minM02{"EMC_minM02", 0.1, "Minimum M02 for EMCal M02 cut"}; - Configurable EMC_maxM02{"EMC_maxM02", 0.7, "Maximum M02 for EMCal M02 cut"}; - Configurable EMC_minE{"EMC_minE", 0.7, "Minimum cluster energy for EMCal energy cut"}; - Configurable EMC_minNCell{"EMC_minNCell", 1, "Minimum number of cells per cluster for EMCal NCell cut"}; - Configurable> EMC_TM_Eta{"EMC_TM_Eta", {0.01f, 4.07f, -2.5f}, "|eta| <= [0]+(pT+[1])^[2] for EMCal track matching"}; - Configurable> EMC_TM_Phi{"EMC_TM_Phi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; - Configurable EMC_Eoverp{"EMC_Eoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; - Configurable EMC_UseExoticCut{"EMC_UseExoticCut", true, "FLag to use the EMCal exotic cluster cut"}; - Configurable EMC_UseTM{"EMC_UseTM", false, "flag to use EMCal track matching cut or not"}; + std::string prefix = "emccuts"; + Configurable cfgEMCminTime{"cfgEMCminTime", -25., "Minimum cluster time for EMCal time cut"}; + Configurable cfgEMCmaxTime{"cfgEMCmaxTime", +30., "Maximum cluster time for EMCal time cut"}; + Configurable cfgEMCminM02{"cfgEMCminM02", 0.1, "Minimum M02 for EMCal M02 cut"}; + Configurable cfgEMCmaxM02{"cfgEMCmaxM02", 0.7, "Maximum M02 for EMCal M02 cut"}; + Configurable cfgEMCminE{"cfgEMCminE", 0.7, "Minimum cluster energy for EMCal energy cut"}; + Configurable cfgEMCminNCell{"cfgEMCminNCell", 1, "Minimum number of cells per cluster for EMCal NCell cut"}; + Configurable> cfgEMCTMEta{"cfgEMCTMEta", {0.01f, 4.07f, -2.5f}, "|eta| <= [0]+(pT+[1])^[2] for EMCal track matching"}; + Configurable> cfgEMCTMPhi{"cfgEMCTMPhi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; + Configurable cfgEMCEoverp{"cfgEMCEoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; + Configurable cfgEMCUseExoticCut{"cfgEMCUseExoticCut", true, "FLag to use the EMCal exotic cluster cut"}; + Configurable cfgEMCUseTM{"cfgEMCUseTM", false, "flag to use EMCal track matching cut or not"}; + Configurable cfgEnableQA{"cfgEnableQA", false, "flag to turn QA plots on/off"}; } emccuts; - using CollsWithQvecs = soa::Join; - using EMCalPhotons = soa::Join; + struct : ConfigurableGroup { + std::string prefix = "mesonConfig"; + Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle. Default value one EMCal cell"}; + Configurable enableTanThetadPhi{"enableTanThetadPhi", false, "flag to turn cut opening angle in delta theta delta phi on/off"}; + Configurable minTanThetadPhi{"minTanThetadPhi", 4., "apply min opening angle in delta theta delta phi to cut on late conversion"}; + Configurable maxEnergyAsymmetry{"maxEnergyAsymmetry", 1., "apply max energy asymmetry for meson candidate"}; + Configurable cfgEnableQA{"cfgEnableQA", false, "flag to turn QA plots on/off"}; + ConfigurableAxis thConfigAxisTanThetaPhi{"thConfigAxisTanThetaPhi", {180, -90.f, 90.f}, ""}; + } mesonConfig; + + struct : ConfigurableGroup { + std::string prefix = "mixingConfig"; + ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfgCentBins{"cfgCentBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f}, "Mixing bins - centrality"}; + ConfigurableAxis cfgEPBins{"cfgEPBins", {8, o2::constants::math::PIHalf, o2::constants::math::PIHalf}, "Mixing bins - event plane angle"}; + ConfigurableAxis cfgOccupancyBins{"cfgOccupancyBins", {VARIABLE_WIDTH, 0, 100, 500, 1000, 2000}, "Mixing bins - occupancy"}; + Configurable cfgMixingDepth{"cfgMixingDepth", 2, "Mixing depth"}; + } mixingConfig; + + struct : ConfigurableGroup { + std::string prefix = "correctionConfig"; + Configurable cfgSpresoPath{"cfgSpresoPath", "Users/m/mhemmer/EM/Flow/Resolution", "Path to SP resolution file"}; + Configurable cfgApplySPresolution{"cfgApplySPresolution", 0, "Apply resolution correction"}; + } correctionConfig; SliceCache cache; EventPlaneHelper epHelper; - Preslice perCollision_emc = aod::emccluster::emeventId; o2::framework::Service ccdb; + Filter clusterFilter = aod::skimmedcluster::time >= emccuts.cfgEMCminTime && aod::skimmedcluster::time <= emccuts.cfgEMCmaxTime && aod::skimmedcluster::m02 >= emccuts.cfgEMCminM02 && aod::skimmedcluster::m02 <= emccuts.cfgEMCmaxM02 && skimmedcluster::e >= emccuts.cfgEMCminE; + Filter collisionFilter = aod::evsel::sel8 && nabs(aod::collision::posZ) <= eventcuts.cfgZvtxMax && aod::evsel::trackOccupancyInTimeRange <= eventcuts.cfgTrackOccupancyMax && aod::evsel::trackOccupancyInTimeRange >= eventcuts.cfgTrackOccupancyMin && aod::evsel::ft0cOccupancyInTimeRange <= eventcuts.cfgFT0COccupancyMax && aod::evsel::ft0cOccupancyInTimeRange >= eventcuts.cfgFT0COccupancyMin; + using FilteredEMCalPhotons = soa::Filtered>; + using EMCalPhotons = soa::Join; + using FilteredCollsWithQvecs = soa::Filtered>; + using CollsWithQvecs = soa::Join; + + Preslice perCollisionEMC = aod::emccluster::emeventId; + Preslice perCollisionEMCFiltered = aod::emccluster::emeventId; + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - void DefineEMEventCut() + o2::emcal::Geometry* emcalGeom; + TH1D* h1SPResolution = nullptr; + float epsilon = 1.e-8; + + void defineEMEventCut() { fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); @@ -134,29 +199,28 @@ struct EMfTaskPi0Flow { fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } - void DefineEMCCut() + void defineEMCCut() { fEMCCut = EMCPhotonCut("fEMCCut", "fEMCCut"); - const float a = emccuts.EMC_TM_Eta->at(0); - const float b = emccuts.EMC_TM_Eta->at(1); - const float c = emccuts.EMC_TM_Eta->at(2); + const float a = emccuts.cfgEMCTMEta->at(0); + const float b = emccuts.cfgEMCTMEta->at(1); + const float c = emccuts.cfgEMCTMEta->at(2); - const float d = emccuts.EMC_TM_Phi->at(0); - const float e = emccuts.EMC_TM_Phi->at(1); - const float f = emccuts.EMC_TM_Phi->at(2); + const float d = emccuts.cfgEMCTMPhi->at(0); + const float e = emccuts.cfgEMCTMPhi->at(1); + const float f = emccuts.cfgEMCTMPhi->at(2); LOGF(info, "EMCal track matching parameters : a = %f, b = %f, c = %f, d = %f, e = %f, f = %f", a, b, c, d, e, f); - fEMCCut.SetTrackMatchingEta([a, b, c](float pT) { return a + pow(pT + b, c); }); - fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); }); - fEMCCut.SetMinEoverP(emccuts.EMC_Eoverp); - - fEMCCut.SetMinE(emccuts.EMC_minE); - fEMCCut.SetMinNCell(emccuts.EMC_minNCell); - fEMCCut.SetM02Range(emccuts.EMC_minM02, emccuts.EMC_maxM02); - fEMCCut.SetTimeRange(emccuts.EMC_minTime, emccuts.EMC_maxTime); - fEMCCut.SetUseExoticCut(emccuts.EMC_UseExoticCut); + fEMCCut.SetTrackMatchingEta([a, b, c](float pT) { return a + std::pow(pT + b, c); }); + fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + std::pow(pT + e, f); }); + fEMCCut.SetMinEoverP(emccuts.cfgEMCEoverp); + + fEMCCut.SetMinE(emccuts.cfgEMCminE); + fEMCCut.SetMinNCell(emccuts.cfgEMCminNCell); + fEMCCut.SetM02Range(emccuts.cfgEMCminM02, emccuts.cfgEMCmaxM02); + fEMCCut.SetTimeRange(emccuts.cfgEMCminTime, emccuts.cfgEMCmaxTime); + fEMCCut.SetUseExoticCut(emccuts.cfgEMCUseExoticCut); } void init(InitContext&) @@ -165,58 +229,128 @@ struct EMfTaskPi0Flow { LOG(info) << "Harmonic was set to " << harmonic << " but can only be 2 or 3!"; } - DefineEMEventCut(); - DefineEMCCut(); - fEMCCut.SetUseTM(emccuts.EMC_UseTM); // disables TM + defineEMEventCut(); + defineEMCCut(); + fEMCCut.SetUseTM(emccuts.cfgEMCUseTM); // disables TM o2::aod::pwgem::photonmeson::utils::eventhistogram::addEventHistograms(®istry); + // Load EMCal geometry + emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber(300000); + const AxisSpec thnAxisInvMass{thnConfigAxisInvMass, "#it{M}_{#gamma#gamma} (GeV/#it{c}^{2})"}; const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality (%)"}; const AxisSpec thnAxisCosNPhi{thnConfigAxisCosNPhi, Form("cos(%d#varphi)", harmonic.value)}; const AxisSpec thnAxisCosDeltaPhi{thnConfigAxisCosDeltaPhi, Form("cos(%d(#varphi - #Psi_{sub}))", harmonic.value)}; const AxisSpec thnAxisScalarProd{thnConfigAxisScalarProd, "SP"}; - const AxisSpec thAxisTanThetaPhi{thConfigAxisTanThetaPhi, "atan(#Delta#theta/#Delta#varphi)"}; + const AxisSpec thAxisTanThetaPhi{mesonConfig.thConfigAxisTanThetaPhi, "atan(#Delta#theta/#Delta#varphi)"}; const AxisSpec thAxisClusterEnergy{thnConfigAxisPt, "#it{E} (GeV)"}; + const AxisSpec thAxisAlpha{100, -1., +1, "#alpha"}; + const AxisSpec thAxisMult{1000, 0., +1000, "#it{N}_{ch}"}; + const AxisSpec thAxisEnergy{1000, 0., 100., "#it{E}_{clus} (GeV)"}; + const AxisSpec thAxisTime{1500, -600, 900, "#it{t}_{cl} (ns)"}; + const AxisSpec thAxisEta{160, -0.8, 0.8, "#eta"}; + const AxisSpec thAxisPhi{72, 0, 2 * 3.14159, "phi"}; + const AxisSpec thAxisNCell{17664, 0.5, +17664.5, "#it{N}_{cell}"}; + const AxisSpec thAxisPsi{360 / harmonic.value, -(1. / static_cast(harmonic.value)) * std::numbers::pi_v, (1. / static_cast(harmonic.value)) * std::numbers::pi_v, Form("#Psi_{%d}", harmonic.value)}; + const AxisSpec thAxisCN{8, 0.5, 8.5, "#it{c}_{n}"}; + const AxisSpec thAxisSN{8, 0.5, 8.5, "#it{s}_{n}"}; + + registry.add("hSparsePi0Flow", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd}); + registry.add("hSparseBkgFlow", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd}); + auto hClusterCuts = registry.add("hClusterCuts", "hClusterCuts;;Counts", kTH1D, {{6, 0.5, 6.5}}, false); + hClusterCuts->GetXaxis()->SetBinLabel(1, "in"); + hClusterCuts->GetXaxis()->SetBinLabel(2, "opening angle"); + hClusterCuts->GetXaxis()->SetBinLabel(3, "#it{M}_{#gamma#gamma}"); + hClusterCuts->GetXaxis()->SetBinLabel(4, "#it{p}_{T}"); + hClusterCuts->GetXaxis()->SetBinLabel(5, "conversion cut"); + hClusterCuts->GetXaxis()->SetBinLabel(6, "out"); - registry.add("hSparsePi0Flow", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisCosNPhi, thnAxisCosDeltaPhi, thnAxisScalarProd}); - registry.add("hEClusterBefore", "Histo for cluster energy before cuts", HistType::kTH1F, {thAxisClusterEnergy}); - registry.add("hEClusterAfter", "Histo for cluster energy after cuts", HistType::kTH1F, {thAxisClusterEnergy}); - registry.add("hInvMassPt", "Histo for inv pair mass vs pt", HistType::kTH2F, {thnAxisInvMass, thnAxisPt}); - registry.add("hTanThetaPhi", "Histo for identification of conversion cluster", HistType::kTH2F, {thnAxisInvMass, thAxisTanThetaPhi}); if (saveSPResoHist) { - registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0cTPCpos", "hSpResoFT0cTPCpos; centrality; Q_{FT0c} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0cTPCneg", "hSpResoFT0cTPCneg; centrality; Q_{FT0c} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0cTPCtot", "hSpResoFT0cTPCtot; centrality; Q_{FT0c} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0aTPCpos", "hSpResoFT0aTPCpos; centrality; Q_{FT0a} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0aTPCneg", "hSpResoFT0aTPCneg; centrality; Q_{FT0a} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0aTPCtot", "hSpResoFT0aTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0mTPCpos", "hSpResoFT0mTPCpos; centrality; Q_{FT0m} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0mTPCneg", "hSpResoFT0mTPCneg; centrality; Q_{FT0m} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0mTPCtot", "hSpResoFT0mTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoTPCposTPCneg", "hSpResoTPCposTPCneg; centrality; Q_{TPCpos} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0cTPCpos", "hSpResoFT0cTPCpos; centrality; Q_{FT0c} #bullet Q_{TPCpos}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0cTPCneg", "hSpResoFT0cTPCneg; centrality; Q_{FT0c} #bullet Q_{TPCneg}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0cTPCtot", "hSpResoFT0cTPCtot; centrality; Q_{FT0c} #bullet Q_{TPCtot}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0aTPCpos", "hSpResoFT0aTPCpos; centrality; Q_{FT0a} #bullet Q_{TPCpos}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0aTPCneg", "hSpResoFT0aTPCneg; centrality; Q_{FT0a} #bullet Q_{TPCneg}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0aTPCtot", "hSpResoFT0aTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0mTPCpos", "hSpResoFT0mTPCpos; centrality; Q_{FT0m} #bullet Q_{TPCpos}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0mTPCneg", "hSpResoFT0mTPCneg; centrality; Q_{FT0m} #bullet Q_{TPCneg}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0mTPCtot", "hSpResoFT0mTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoTPCposTPCneg", "hSpResoTPCposTPCneg; centrality; Q_{TPCpos} #bullet Q_{TPCneg}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); } if (saveEpResoHisto) { - registry.add("epReso/hEpResoFT0cFT0a", "hEpResoFT0cFT0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0cTPCpos", "hEpResoFT0cTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0cTPCneg", "hEpResoFT0cTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0cTPCtot", "hEpResoFT0cTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0aTPCpos", "hEpResoFT0aTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0aTPCneg", "hEpResoFT0aTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0aTPCtot", "hEpResoFT0aTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0mTPCpos", "hEpResoFT0mTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0mTPCneg", "hEpResoFT0mTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0mTPCtot", "hEpResoFT0mTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoTPCposTPCneg", "hEpResoTPCposTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("hEventPlaneAngleFT0M", "hEventPlaneAngleFT0M", HistType::kTH2D, {thnAxisCent, thAxisPsi}); + registry.add("hEventPlaneAngleTPCpos", "hEventPlaneAngleTPCpos", HistType::kTH2D, {thnAxisCent, thAxisPsi}); + registry.add("hEventPlaneAngleTPCneg", "hEventPlaneAngleTPCneg", HistType::kTH2D, {thnAxisCent, thAxisPsi}); + registry.add("epReso/hEpResoFT0cFT0a", "hEpResoFT0cFT0a; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0cTPCpos", "hEpResoFT0cTPCpos; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0cTPCneg", "hEpResoFT0cTPCneg; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0cTPCtot", "hEpResoFT0cTPCtot; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0aTPCpos", "hEpResoFT0aTPCpos; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0aTPCneg", "hEpResoFT0aTPCneg; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0aTPCtot", "hEpResoFT0aTPCtot; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0mTPCpos", "hEpResoFT0mTPCpos; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0mTPCneg", "hEpResoFT0mTPCneg; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoFT0mTPCtot", "hEpResoFT0mTPCtot; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpResoTPCposTPCneg", "hEpResoTPCposTPCneg; centrality; #Delta#Psi_{sub}", HistType::kTH2D, {thnAxisCent, thnAxisCosNPhi}); + registry.add("epReso/hEpCosCoefficientsFT0c", "hEpCosCoefficientsFT0c; centrality; c_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisCN}); + registry.add("epReso/hEpSinCoefficientsFT0c", "hEpSinCoefficientsFT0c; centrality; s_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisSN}); + registry.add("epReso/hEpCosCoefficientsFT0a", "hEpCosCoefficientsFT0a; centrality; c_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisCN}); + registry.add("epReso/hEpSinCoefficientsFT0a", "hEpSinCoefficientsFT0a; centrality; s_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisSN}); + registry.add("epReso/hEpCosCoefficientsFT0m", "hEpCosCoefficientsFT0m; centrality; c_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisCN}); + registry.add("epReso/hEpSinCoefficientsFT0m", "hEpSinCoefficientsFT0m; centrality; s_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisSN}); + registry.add("epReso/hEpCosCoefficientsTPCpos", "hEpCosCoefficientsTPCpos; centrality; c_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisCN}); + registry.add("epReso/hEpSinCoefficientsTPCpos", "hEpSinCoefficientsTPCpos; centrality; s_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisSN}); + registry.add("epReso/hEpCosCoefficientsTPCneg", "hEpCosCoefficientsTPCneg; centrality; c_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisCN}); + registry.add("epReso/hEpSinCoefficientsTPCneg", "hEpSinCoefficientsTPCneg; centrality; s_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisSN}); + registry.add("epReso/hEpCosCoefficientsTPCTots", "hEpCosCoefficientsTPCTots; centrality; c_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisCN}); + registry.add("epReso/hEpSinCoefficientsTPCTots", "hEpSinCoefficientsTPCTots; centrality; s_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisSN}); + } + if (eventcuts.cfgEnableQA) { + auto hCollisionEMCCheck = registry.add("hCollisionEMCCheck", "collision counter;;Counts", kTH1D, {{7, 0.5, 7.5}}, false); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(1, "all"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(2, "EMC MB Readout"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(3, "has clusters"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(4, "EMC MB Readout & has clusters"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(5, "EMC MB Readout but no clusters"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(6, "No EMC MB Readout but has clusters"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(7, "No EMC MB Readout and no clusters"); + registry.add("LED/hMult", "multiplicity in LED events", HistType::kTH1D, {thAxisMult}); + registry.add("LED/hClusterEtaPhi", "hClusterEtaPhi", HistType::kTH2D, {thAxisPhi, thAxisEta}); + registry.add("LED/clusterTimeVsE", "Cluster time vs energy", HistType::kTH2D, {thAxisTime, thAxisEnergy}); + registry.add("LED/hNCell", "hNCell", HistType::kTH1D, {thAxisNCell}); + } + + if (emccuts.cfgEnableQA) { + registry.add("hEClusterBefore", "Histo for cluster energy before cuts", HistType::kTH1D, {thAxisClusterEnergy}); + registry.add("hEClusterAfter", "Histo for cluster energy after cuts", HistType::kTH1D, {thAxisClusterEnergy}); + } + + if (mesonConfig.cfgEnableQA) { + registry.add("hInvMassPt", "Histo for inv pair mass vs pt", HistType::kTH2D, {thnAxisInvMass, thnAxisPt}); + registry.add("hTanThetaPhi", "Histo for identification of conversion cluster", HistType::kTH2D, {thnAxisInvMass, thAxisTanThetaPhi}); + registry.add("hAlphaPt", "Histo of meson asymmetry vs pT", HistType::kTH2D, {thAxisAlpha, thnAxisPt}); } ccdb->setURL(ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + LOG(info) << "thnConfigAxisInvMass.value[1] = " << thnConfigAxisInvMass.value[1] << " thnConfigAxisInvMass.value.back() = " << thnConfigAxisInvMass.value.back(); + LOG(info) << "thnConfigAxisPt.value[1] = " << thnConfigAxisPt.value[1] << " thnConfigAxisPt.value.back() = " << thnConfigAxisPt.value.back(); }; // end init + template + void initCCDB(TCollision const& collision) + { + if (correctionConfig.cfgApplySPresolution.value) { + h1SPResolution = ccdb->getForTimeStamp(correctionConfig.cfgSpresoPath.value, collision.timestamp()); + } + } + /// Change radians to degree /// \param angle in radians /// \return angle in degree @@ -244,17 +378,13 @@ struct EMfTaskPi0Flow { /// \param mass is the invariant mass of the candidate /// \param pt is the transverse momentum of the candidate /// \param cent is the centrality of the collision - /// \param cosNPhi is the cosine of the n*phi angle - /// \param cosDeltaPhi is the cosine of the n*(phi - evtPl) angle /// \param sp is the scalar product void fillThn(float& mass, float& pt, float& cent, - float& cosNPhi, - float& cosDeltaPhi, float& sp) { - registry.fill(HIST("hSparsePi0Flow"), mass, pt, cent, cosNPhi, cosDeltaPhi, sp); + registry.fill(HIST("hSparsePi0Flow"), mass, pt, cent, sp); } /// Get the centrality @@ -280,13 +410,26 @@ struct EMfTaskPi0Flow { return cent; } + /// Get all used Q vector + /// \param collision is the collision with the Q vector information + std::vector getAllQvec(CollsWithQvecs::iterator const& collision) + { + // Retrieve the Q vectors using the helper function for each detector + auto [xQVecMain, yQVecMain] = getQvec(collision, qvecDetector); + auto [xQVecSubA, yQVecSubA] = getQvec(collision, qvecSubADetector); + auto [xQVecSubB, yQVecSubB] = getQvec(collision, qvecSubBDetector); + + return {xQVecMain, yQVecMain, xQVecSubA, yQVecSubA, xQVecSubB, yQVecSubB}; + } + /// Get the Q vector /// \param collision is the collision with the Q vector information - std::vector getQvec(CollsWithQvecs::iterator const& collision) + std::pair getQvec(CollsWithQvecs::iterator const& collision, int detector) { - float xQVec = -999.; - float yQVec = -999.; - switch (qvecDetector) { + float xQVec = -999.f; + float yQVec = -999.f; + + switch (detector) { case QvecEstimator::FT0M: if (harmonic == 2) { xQVec = collision.q2xft0m(); @@ -342,7 +485,7 @@ struct EMfTaskPi0Flow { } break; default: - LOG(warning) << "Q vector estimator not valid. Please choose between FT0M, FT0A, FT0C, TPC Pos, TPC Neg. Fallback to FT0M"; + LOG(warning) << "Q vector estimator not valid. Falling back to FT0M"; if (harmonic == 2) { xQVec = collision.q2xft0m(); yQVec = collision.q2yft0m(); @@ -355,15 +498,159 @@ struct EMfTaskPi0Flow { return {xQVec, yQVec}; } + /// Check if the QVector values are within reasonable range + /// \param collision is the collision with the Q vector information + bool isQvecGood(std::vector const& QVecs) + { + bool isgood = true; + for (const auto& QVec : QVecs) { + if (std::fabs(QVec) > 20.f) { + isgood = false; + break; + } + } + return isgood; + } + + bool isTooCloseToEdge(const int cellID, const int DistanceToBorder = 1) + { + if (DistanceToBorder <= 0) { + return false; + } + if (cellID < 0) { + return true; + } + + int iBadCell = -1; + + // check distance to border in case the cell is okay + auto [iSupMod, iMod, iPhi, iEta] = emcalGeom->GetCellIndex(cellID); + auto [irow, icol] = emcalGeom->GetCellPhiEtaIndexInSModule(iSupMod, iMod, iPhi, iEta); + + // Check rows/phi + int iRowLast = 24; + if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_HALF) { + iRowLast /= 2; // 2/3 sm case + } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_THIRD) { + iRowLast /= 3; // 1/3 sm case + } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::DCAL_EXT) { + iRowLast /= 3; // 1/3 sm case + } + + if (irow < DistanceToBorder || (iRowLast - irow) <= DistanceToBorder) { + iBadCell = 1; + } + + if (iBadCell > 0) { + return true; + } + return false; + } + + /// \brief Calculate background using rotation background method + template + void rotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, CollsWithQvecs::iterator const& collision) + { + // if less than 3 clusters are present skip event since we need at least 3 clusters + if (photons_coll.size() < 3) { + return; + } + + auto [xQVec, yQVec] = getQvec(collision, qvecDetector); + float cent = getCentrality(collision); + int iCellIDPhoton1 = 0; + int iCellIDPhoton = 0; + + ROOT::Math::AxisAngle rotationAxis(meson.Vect(), cfgRotAngle.value); + ROOT::Math::Rotation3D rotationMatrix(rotationAxis); + photon1 = rotationMatrix * photon1; + photon2 = rotationMatrix * photon2; + + try { + iCellIDPhoton1 = emcalGeom->GetAbsCellIdFromEtaPhi(photon1.Eta(), photon1.Phi()); + if (isTooCloseToEdge(iCellIDPhoton1, cfgDistanceToEdge.value)) { + iCellIDPhoton1 = -1; + } + } catch (o2::emcal::InvalidPositionException& e) { + iCellIDPhoton1 = -1; + } + try { + iCellIDPhoton = emcalGeom->GetAbsCellIdFromEtaPhi(photon2.Eta(), photon2.Phi()); + if (isTooCloseToEdge(iCellIDPhoton, cfgDistanceToEdge.value)) { + iCellIDPhoton = -1; + } + } catch (o2::emcal::InvalidPositionException& e) { + iCellIDPhoton = -1; + } + + if (iCellIDPhoton1 == -1 && iCellIDPhoton == -1) { + return; + } + for (const auto& photon : photons_coll) { + if (photon.globalIndex() == ig1 || photon.globalIndex() == ig2) { + // only combine rotated photons with other photons + continue; + } + if (!(fEMCCut.IsSelected(photon))) { + continue; + } + ROOT::Math::PtEtaPhiMVector photon3(photon.pt(), photon.eta(), photon.phi(), 0.); + if (iCellIDPhoton1 > 0) { + ROOT::Math::PtEtaPhiMVector mother1 = photon1 + photon3; + float openingAngle1 = std::acos(photon1.Vect().Dot(photon3.Vect()) / (photon1.P() * photon3.P())); + float cosNPhi1 = std::cos(harmonic * mother1.Phi()); + float sinNPhi1 = std::sin(harmonic * mother1.Phi()); + float scalprodCand1 = cosNPhi1 * xQVec + sinNPhi1 * yQVec; + + if (correctionConfig.cfgApplySPresolution.value) { + scalprodCand1 = scalprodCand1 / h1SPResolution->GetBinContent(h1SPResolution->FindBin(cent + epsilon)); + } + + if (openingAngle1 > mesonConfig.minOpenAngle && thnConfigAxisInvMass.value[1] <= mother1.M() && thnConfigAxisInvMass.value.back() >= mother1.M() && thnConfigAxisPt.value[1] <= mother1.Pt() && thnConfigAxisPt.value.back() >= mother1.Pt()) { + if (mesonConfig.enableTanThetadPhi) { + float dTheta = photon1.Theta() - photon3.Theta(); + float dPhi = photon1.Phi() - photon3.Phi(); + if (mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hSparseBkgFlow"), mother1.M(), mother1.Pt(), cent, scalprodCand1); + } + } else { + registry.fill(HIST("hSparseBkgFlow"), mother1.M(), mother1.Pt(), cent, scalprodCand1); + } + } + } + if (iCellIDPhoton > 0) { + ROOT::Math::PtEtaPhiMVector mother2 = photon2 + photon3; + float openingAngle2 = std::acos(photon2.Vect().Dot(photon3.Vect()) / (photon2.P() * photon3.P())); + float cosNPhi2 = std::cos(harmonic * mother2.Phi()); + float sinNPhi2 = std::sin(harmonic * mother2.Phi()); + float scalprodCand2 = cosNPhi2 * xQVec + sinNPhi2 * yQVec; + + if (correctionConfig.cfgApplySPresolution.value) { + scalprodCand2 = scalprodCand2 / h1SPResolution->GetBinContent(h1SPResolution->FindBin(cent + epsilon)); + } + + if (openingAngle2 > mesonConfig.minOpenAngle && thnConfigAxisInvMass.value[1] <= mother2.M() && thnConfigAxisInvMass.value.back() >= mother2.M() && thnConfigAxisPt.value[1] <= mother2.Pt() && thnConfigAxisPt.value.back() >= mother2.Pt()) { + if (mesonConfig.enableTanThetadPhi) { + float dTheta = photon2.Theta() - photon3.Theta(); + float dPhi = photon2.Phi() - photon3.Phi(); + if (mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hSparseBkgFlow"), mother2.M(), mother2.Pt(), cent, scalprodCand2); + } + } else { + registry.fill(HIST("hSparseBkgFlow"), mother2.M(), mother2.Pt(), cent, scalprodCand2); + } + } + } + } // end of loop over third photon + return; + } + /// Compute the scalar product /// \param collision is the collision with the Q vector information and event plane /// \param meson are the selected candidates void runFlowAnalysis(CollsWithQvecs::iterator const& collision, ROOT::Math::PtEtaPhiMVector const& meson) { - std::vector qVecs = getQvec(collision); - float xQVec = qVecs[0]; - float yQVec = qVecs[1]; - float evtPl = epHelper.GetEventPlane(xQVec, yQVec, harmonic); + auto [xQVec, yQVec] = getQvec(collision, qvecDetector); float cent = getCentrality(collision); float massCand = meson.M(); @@ -373,32 +660,81 @@ struct EMfTaskPi0Flow { float cosNPhi = std::cos(harmonic * phiCand); float sinNPhi = std::sin(harmonic * phiCand); float scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec; - float cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl)); - fillThn(massCand, ptCand, cent, cosNPhi, cosDeltaPhi, scalprodCand); + if (correctionConfig.cfgApplySPresolution.value) { + scalprodCand = scalprodCand / h1SPResolution->GetBinContent(h1SPResolution->FindBin(cent + epsilon)); + } + + fillThn(massCand, ptCand, cent, scalprodCand); + return; } - // Ds with rectangular cuts + // Pi0 from EMCal void processEMCal(CollsWithQvecs const& collisions, EMCalPhotons const& clusters) { - for (auto& collision : collisions) { + int nColl = 1; + for (const auto& collision : collisions) { + auto photonsPerCollision = clusters.sliceBy(perCollisionEMC, collision.globalIndex()); + + if (eventcuts.cfgEnableQA) { + // TODO: check EMCal NCells in collisions without EMC Readout + registry.fill(HIST("hCollisionEMCCheck"), 1.); // all + if (collision.alias_bit(kTVXinEMC) == true) { + registry.fill(HIST("hCollisionEMCCheck"), 2.); // has EMC read out + if (photonsPerCollision.size() > 0) { + registry.fill(HIST("hCollisionEMCCheck"), 3.); // has EMC cluster + registry.fill(HIST("hCollisionEMCCheck"), 4.); // has EMC read out and clusters + } else { + registry.fill(HIST("hCollisionEMCCheck"), 5.); // has EMC read out but no clusters + } + } else { + if (photonsPerCollision.size() > 0) { + registry.fill(HIST("hCollisionEMCCheck"), 3.); // has EMC cluster + registry.fill(HIST("hCollisionEMCCheck"), 6.); // has no EMC read out and clusters + registry.fill(HIST("LED/hMult"), collision.multFT0C()); + for (const auto& photon : photonsPerCollision) { + registry.fill(HIST("LED/hClusterEtaPhi"), photon.phi(), photon.eta()); + registry.fill(HIST("LED/clusterTimeVsE"), photon.time(), photon.e()); + registry.fill(HIST("LED/hNCell"), photon.nCells()); + } + } else { + registry.fill(HIST("hCollisionEMCCheck"), 7.); // has no EMC read out and no clusters + } + } + } o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(®istry, collision); if (!(fEMEventCut.IsSelected(collision))) { - // no selection on the centrality is applied on purpose to allow for the resolution study in post-processing - return; + // general event selection + continue; + } + if (!(eventcuts.cfgTrackOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgTrackOccupancyMax)) { + // occupancy selection + continue; } + float cent = getCentrality(collision); + if (cent < eventcuts.cfgMinCent || cent > eventcuts.cfgMaxCent) { + // event selection + continue; + } + if (!isQvecGood(getAllQvec(collision))) { + // selection based on QVector + continue; + } + initCCDB(collision); o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(®istry, collision); registry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted registry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted - auto photons_per_collision = clusters.sliceBy(perCollision_emc, collision.globalIndex()); - for (auto& photon : photons_per_collision) { - registry.fill(HIST("hEClusterBefore"), photon.e()); // before cuts - if (!(fEMCCut.IsSelected(photon))) { - continue; + + if (emccuts.cfgEnableQA) { + for (const auto& photon : photonsPerCollision) { + registry.fill(HIST("hEClusterBefore"), photon.e()); // before cuts + if (!(fEMCCut.IsSelected(photon))) { + continue; + } + registry.fill(HIST("hEClusterAfter"), photon.e()); // accepted after cuts } - registry.fill(HIST("hEClusterAfter"), photon.e()); // accepted after cuts } - for (auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons_per_collision, photons_per_collision))) { + for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photonsPerCollision, photonsPerCollision))) { if (!(fEMCCut.IsSelected(g1)) || !(fEMCCut.IsSelected(g2))) { continue; } @@ -407,24 +743,142 @@ struct EMfTaskPi0Flow { ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; float dTheta = v1.Theta() - v2.Theta(); float dPhi = v1.Phi() - v2.Phi(); - registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); - registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(atan(dTheta / dPhi))); + float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); + registry.fill(HIST("hClusterCuts"), 1); + if (openingAngle <= mesonConfig.minOpenAngle) { + registry.fill(HIST("hClusterCuts"), 2); + continue; + } + if (cfgDoRotation) { + if (nColl % cfgDownsampling.value == 0) { + rotationBackground(vMeson, v1, v2, photonsPerCollision, g1.globalIndex(), g2.globalIndex(), collision); + } + } + if (thnConfigAxisInvMass.value[1] > vMeson.M() || thnConfigAxisInvMass.value.back() < vMeson.M()) { + registry.fill(HIST("hClusterCuts"), 3); + continue; + } + if (thnConfigAxisPt.value[1] > vMeson.Pt() || thnConfigAxisPt.value.back() < vMeson.Pt()) { + registry.fill(HIST("hClusterCuts"), 4); + continue; + } + if (mesonConfig.cfgEnableQA) { + registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + } + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hClusterCuts"), 5); + continue; + } + registry.fill(HIST("hClusterCuts"), 6); runFlowAnalysis(collision, vMeson); } + if (cfgDoRotation) { + if (nColl % cfgDownsampling.value == 0) { + nColl = 1; // reset counter + } else { + nColl++; + } + } + } + } + PROCESS_SWITCH(TaskPi0FlowEMC, processEMCal, "Process EMCal Pi0 candidates", true); + + // Pi0 from EMCal + void processEMCalMixed(FilteredCollsWithQvecs const& collisions, FilteredEMCalPhotons const& clusters) + { + auto getClustersSize = + [&clusters, this](FilteredCollsWithQvecs::iterator const& col) { + auto associatedClusters = clusters.sliceByCached(emccluster::emeventId, col.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once + return associatedClusters.size(); + }; + + using BinningType = FlexibleBinningPolicy, aod::collision::PosZ, aod::cent::CentFT0C, emevent::EP2FT0M>; + BinningType binningWithLambda{{getClustersSize}, {mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins, mixingConfig.cfgEPBins}, true}; + + auto clustersTuple = std::make_tuple(clusters); + SameKindPair pair{binningWithLambda, mixingConfig.cfgMixingDepth, -1, collisions, clustersTuple, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored + + for (const auto& [c1, clusters1, c2, clusters2] : pair) { + if (!(fEMEventCut.IsSelected(c1)) || !(fEMEventCut.IsSelected(c2))) { + // general event selection + continue; + } + if (!(eventcuts.cfgTrackOccupancyMin <= c1.trackOccupancyInTimeRange() && c1.trackOccupancyInTimeRange() < eventcuts.cfgTrackOccupancyMax) || !(eventcuts.cfgTrackOccupancyMin <= c2.trackOccupancyInTimeRange() && c2.trackOccupancyInTimeRange() < eventcuts.cfgTrackOccupancyMax)) { + // occupancy selection + continue; + } + if (getCentrality(c1) < eventcuts.cfgMinCent || getCentrality(c1) > eventcuts.cfgMaxCent || getCentrality(c2) < eventcuts.cfgMinCent || getCentrality(c2) > eventcuts.cfgMaxCent) { + // event selection + continue; + } + if (!isQvecGood(getAllQvec(c1)) || !isQvecGood(getAllQvec(c2))) { + // selection based on QVector + continue; + } + initCCDB(c1); + for (const auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(clusters1, clusters2))) { + if (!(fEMCCut.IsSelected(g1)) || !(fEMCCut.IsSelected(g2))) { + continue; + } + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; + + float dTheta = v1.Theta() - v2.Theta(); + float dPhi = v1.Phi() - v2.Phi(); + float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); + + registry.fill(HIST("hClusterCuts"), 1); + if (openingAngle <= mesonConfig.minOpenAngle) { + registry.fill(HIST("hClusterCuts"), 2); + continue; + } + if (thnConfigAxisInvMass.value[1] > vMeson.M() || thnConfigAxisInvMass.value.back() < vMeson.M()) { + registry.fill(HIST("hClusterCuts"), 3); + continue; + } + if (thnConfigAxisPt.value[1] > vMeson.Pt() || thnConfigAxisPt.value.back() < vMeson.Pt()) { + registry.fill(HIST("hClusterCuts"), 4); + continue; + } + if (mesonConfig.cfgEnableQA) { + registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + } + if (mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hClusterCuts"), 5); + continue; + } + registry.fill(HIST("hClusterCuts"), 6); + runFlowAnalysis(c1, vMeson); + } } } - PROCESS_SWITCH(EMfTaskPi0Flow, processEMCal, "Process EMCal Pi0 candidates", false); + PROCESS_SWITCH(TaskPi0FlowEMC, processEMCalMixed, "Process EMCal Pi0 mixed event candidates", false); // Resolution void processResolution(CollsWithQvecs::iterator const& collision) { - // we don't need to require EMCal readout for the resolution - fEMEventCut.SetRequireEMCReadoutInMB(false); o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(®istry, collision); if (!(fEMEventCut.IsSelected(collision))) { // no selection on the centrality is applied on purpose to allow for the resolution study in post-processing return; } + if (!(eventcuts.cfgTrackOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgTrackOccupancyMax)) { + return; + } + float cent = getCentrality(collision); + if (cent < eventcuts.cfgMinCent || cent > eventcuts.cfgMaxCent) { + // event selection + return; + } + if (!isQvecGood(getAllQvec(collision))) { + // selection based on QVector + return; + } o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(®istry, collision); registry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted registry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted @@ -492,6 +946,10 @@ struct EMfTaskPi0Flow { float epBNegs = epHelper.GetEventPlane(xQVecBNeg, yQVecBNeg, harmonic); float epBTots = epHelper.GetEventPlane(xQVecBTot, yQVecBTot, harmonic); + registry.fill(HIST("hEventPlaneAngleFT0M"), centrality, epFT0m); + registry.fill(HIST("hEventPlaneAngleTPCpos"), centrality, epBPoss); + registry.fill(HIST("hEventPlaneAngleTPCneg"), centrality, epBNegs); + registry.fill(HIST("epReso/hEpResoFT0cFT0a"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epFT0a))); registry.fill(HIST("epReso/hEpResoFT0cTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epBPoss))); registry.fill(HIST("epReso/hEpResoFT0cTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epBNegs))); @@ -503,13 +961,27 @@ struct EMfTaskPi0Flow { registry.fill(HIST("epReso/hEpResoFT0mTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epBNegs))); registry.fill(HIST("epReso/hEpResoFT0mTPCtot"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epBTots))); registry.fill(HIST("epReso/hEpResoTPCposTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epBPoss, epBNegs))); + for (int n = 1; n <= 8; n++) { + registry.fill(HIST("epReso/hEpCosCoefficientsFT0c"), centrality, n, std::cos(n * epFT0c)); + registry.fill(HIST("epReso/hEpSinCoefficientsFT0c"), centrality, n, std::sin(n * epFT0c)); + registry.fill(HIST("epReso/hEpCosCoefficientsFT0a"), centrality, n, std::cos(n * epFT0a)); + registry.fill(HIST("epReso/hEpSinCoefficientsFT0a"), centrality, n, std::sin(n * epFT0a)); + registry.fill(HIST("epReso/hEpCosCoefficientsFT0m"), centrality, n, std::cos(n * epFT0m)); + registry.fill(HIST("epReso/hEpSinCoefficientsFT0m"), centrality, n, std::sin(n * epFT0m)); + registry.fill(HIST("epReso/hEpCosCoefficientsTPCpos"), centrality, n, std::cos(n * epBPoss)); + registry.fill(HIST("epReso/hEpSinCoefficientsTPCpos"), centrality, n, std::sin(n * epBPoss)); + registry.fill(HIST("epReso/hEpCosCoefficientsTPCneg"), centrality, n, std::cos(n * epBNegs)); + registry.fill(HIST("epReso/hEpSinCoefficientsTPCneg"), centrality, n, std::sin(n * epBNegs)); + registry.fill(HIST("epReso/hEpCosCoefficientsTPCTots"), centrality, n, std::cos(n * epBTots)); + registry.fill(HIST("epReso/hEpSinCoefficientsTPCTots"), centrality, n, std::sin(n * epBTots)); + } } } - PROCESS_SWITCH(EMfTaskPi0Flow, processResolution, "Process resolution", false); + PROCESS_SWITCH(TaskPi0FlowEMC, processResolution, "Process resolution", false); -}; // End struct EMfTaskPi0Flow +}; // End struct TaskPi0FlowEMC WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h index 5efda67be1a..5df8ca93de1 100644 --- a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h +++ b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h @@ -25,18 +25,21 @@ void addClusterHistograms(HistogramRegistry* fRegistry, bool do2DQA) fRegistry->add("Cluster/before/hPt", "Transverse momenta of clusters;#it{p}_{T} (GeV/c);#it{N}_{cluster}", kTH1F, {{500, 0.0f, 50}}, true); fRegistry->add("Cluster/before/hNgamma", "Number of #gamma candidates per collision;#it{N}_{#gamma} per collision;#it{N}_{collisions}", kTH1F, {{51, -0.5f, 50.5f}}, true); fRegistry->add("Cluster/before/hEtaPhi", "#eta vs #varphi;#eta;#varphi (rad.)", kTH2F, {{280, -0.7f, 0.7f}, {180, 0, 2 * M_PI}}, true); - fRegistry->add("Cluster/before/hTrackEtaPhi", "d#eta vs. d#varphi of matched tracks;d#eta;d#varphi (rad.)", kTH2F, {{200, -0.2f, 0.2f}, {200, -0.2f, 0.2f}}, true); + fRegistry->add("Cluster/before/hNTracks", "Number of tracks considered for TM;#it{N}_{tracks};#it{N}_{cluster}", kTH1F, {{20, -0.5f, 19.5}}, true); + fRegistry->add("Cluster/before/hTrackdEtadPhi", "d#eta vs. d#varphi of matched tracks;d#eta;d#varphi (rad.)", kTH2F, {{200, -0.2f, 0.2f}, {200, -0.2f, 0.2f}}, true); if (do2DQA) { // Check if 2D QA histograms were selected in em-qc task fRegistry->add("Cluster/before/hNCell", "#it{N}_{cells};N_{cells} (GeV);#it{E}_{cluster} (GeV)", kTH2F, {{26, -0.5, 25.5}, {200, 0, 20}}, true); fRegistry->add("Cluster/before/hM02", "Long ellipse axis;#it{M}_{02} (cm);#it{E}_{cluster} (GeV)", kTH2F, {{200, 0, 2}, {200, 0, 20}}, true); fRegistry->add("Cluster/before/hTime", "Cluster time;#it{t}_{cls} (ns);#it{E}_{cluster} (GeV)", kTH2F, {{300, -150, 150}, {200, 0, 20}}, true); - fRegistry->add("Cluster/before/hCellTime", "Cell time;#it{t}_{cell} (ns);#it{E}_{cluster} (GeV)", kTH2F, {{100, -250, 250}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hTrackdEta", "d#eta vs. E of matched tracks;d#eta;#it{E}_{cluster} (GeV)", kTH2F, {{200, -0.2f, 0.2f}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hTrackdPhi", "d#phi vs. E of matched tracks;d#varphi (rad.);#it{E}_{cluster} (GeV)", kTH2F, {{200, -0.2f, 0.2f}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hTrackEOverP", "Energy of cluster divided by momentum of matched tracks;#it{E}_{cluster}/#it{p}_{track} (#it{c});#it{E}_{cluster} (GeV)", kTH2F, {{200, 0., 5.}, {200, 0, 20}}, true); } else { fRegistry->add("Cluster/before/hNCell", "#it{N}_{cells};N_{cells} (GeV);#it{N}_{cluster}", kTH1F, {{26, -0.5, 25.5}}, true); fRegistry->add("Cluster/before/hM02", "Long ellipse axis;#it{M}_{02} (cm);#it{N}_{cluster}", kTH1F, {{400, 0, 2}}, true); fRegistry->add("Cluster/before/hTime", "Cluster time;#it{t}_{cls} (ns);#it{N}_{cluster}", kTH1F, {{600, -150, 150}}, true); - fRegistry->add("Cluster/before/hCellTime", "Cluster time;#it{t}_{cell} (ns);#it{N}_{cluster}", kTH1F, {{500, -250, 250}}, true); + fRegistry->add("Cluster/before/hTrackEOverP", "Energy of cluster divided by momentum of matched tracks;#it{E}_{cluster}/#it{p}_{track} (#it{c})", kTH1F, {{200, 0., 5.}}, true); } auto hClusterQualityCuts = fRegistry->add("Cluster/hClusterQualityCuts", "Energy at which clusters are removed by a given cut;;#it{E} (GeV)", kTH2F, {{8, -0.5, 7.5}, {500, 0, 50}}, true); @@ -59,17 +62,26 @@ void fillClusterHistograms(HistogramRegistry* fRegistry, SkimEMCCluster cluster, fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hE"), cluster.e(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hPt"), cluster.pt(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hEtaPhi"), cluster.eta(), cluster.phi(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNTracks"), cluster.tracketa().size(), weight); for (size_t itrack = 0; itrack < cluster.tracketa().size(); itrack++) { // Fill TrackEtaPhi histogram with delta phi and delta eta of all tracks saved in the vectors in skimmerGammaCalo.cxx - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackEtaPhi"), cluster.tracketa()[itrack] - cluster.eta(), cluster.trackphi()[itrack] - cluster.phi(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdEtadPhi"), cluster.tracketa()[itrack] - cluster.eta(), cluster.trackphi()[itrack] - cluster.phi(), weight); } if (do2DQA) { fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNCell"), cluster.nCells(), cluster.e(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hM02"), cluster.m02(), cluster.e(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTime"), cluster.time(), cluster.e(), weight); + for (size_t itrack = 0; itrack < cluster.tracketa().size(); itrack++) { + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackEOverP"), cluster.e() / cluster.trackp()[itrack], cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdEta"), cluster.tracketa()[itrack] - cluster.eta(), cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdPhi"), cluster.trackphi()[itrack] - cluster.phi(), cluster.e(), weight); + } } else { fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNCell"), cluster.nCells(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hM02"), cluster.m02(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTime"), cluster.time(), weight); + for (size_t itrack = 0; itrack < cluster.tracketa().size(); itrack++) { + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackEOverP"), cluster.e() / cluster.trackp()[itrack], weight); + } } } diff --git a/PWGEM/Tasks/phosCellQA.cxx b/PWGEM/Tasks/phosCellQA.cxx index 911402a9782..710244c1a6d 100644 --- a/PWGEM/Tasks/phosCellQA.cxx +++ b/PWGEM/Tasks/phosCellQA.cxx @@ -14,9 +14,12 @@ #include #include #include +#include +#include "CCDB/BasicCCDBManager.h" #include "Common/DataModel/EventSelection.h" #include "DataFormatsPHOS/Cell.h" +#include "DataFormatsPHOS/CalibParams.h" #include "Framework/ConfigParamSpec.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -43,13 +46,17 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct phosCellQA { - ConfigurableAxis amplitudeAxisLarge{"amplitude", {1000, 0., 100.}, "Amplutude (GeV)"}; + + Service ccdb; + + ConfigurableAxis amplitudeAxisLarge{"amplitude", {1000, 0., 10.}, "Amplutude (GeV)"}; ConfigurableAxis timeAxisLarge{"celltime", {1000, -1500.e-9, 3500.e-9}, "cell time (ns)"}; Configurable mEvSelTrig{"mEvSelTrig", kTVXinPHOS, "Select events with this trigger"}; - Configurable mMinCellAmplitude{"minCellAmplitude", 0., "Minimum cell amplitude for histograms."}; + Configurable mMinCellAmplitude{"minCellAmplitude", 0.5, "Minimum cell energy for histograms (GeV)"}; Configurable mMinCellTimeMain{"minCellTimeMain", -50, "Min. cell time of main bunch selection"}; Configurable mMaxCellTimeMain{"maxCellTimeMain", 100, "Max. cell time of main bunch selection"}; Configurable mVetoBCID{"vetoBCID", -1, "BC ID to be excluded"}; + Configurable mCalibPath{"calibPath", "PHS/Calib/CalibParams", "path to Calibration snapshot"}; o2::framework::HistogramRegistry mHistManager{"phosCallQAHistograms"}; @@ -91,6 +98,15 @@ struct phosCellQA { void process(o2::aod::Calos const& cells, BCsWithBcSels const& bcs) { LOG(debug) << "Processing next event"; + + int64_t timestamp = 0; + if (bcs.begin() != bcs.end()) { + timestamp = bcs.begin().timestamp(); // timestamp for CCDB object retrieval + } else { + return; + } + const o2::phos::CalibParams* calibParams = ccdb->getForTimeStamp(mCalibPath, timestamp); + for (const auto& bc : bcs) { o2::InteractionRecord eventIR; eventIR.setFromLong(bc.globalBC()); @@ -110,45 +126,52 @@ struct phosCellQA { if (mVetoBCID >= 0 && cellIR.bc == mVetoBCID) continue; mHistManager.fill(HIST("cellBCSelected"), cellIR.bc); - // mHistManager.fill(HIST("cellAmplitude"), cell.amplitude(), cell.cellNumber()); if (!cell.bc_as().alias_bit(mEvSelTrig)) continue; - if (cell.amplitude() < mMinCellAmplitude) + // bool isHighGain = cell.cellType(); + double energy = calibParams->getGain(cell.cellNumber()) * cell.amplitude(); + // if (isHighGain) { + // energy = calibParams->getGain(cell.cellNumber()) * cell.amplitude(); + // } else { + // energy = calibParams->getGain(cell.cellNumber()) * cell.amplitude() * calibParams->getHGLGRatio(cell.cellNumber()); + // } + + if (energy < mMinCellAmplitude) continue; char relid[3]; o2::phos::Geometry::absToRelNumbering(cell.cellNumber(), relid); if (relid[0] == 1) { mHistManager.fill(HIST("cellOccM1"), relid[1] - 0.5, relid[2] - 0.5); - mHistManager.fill(HIST("cellAmpM1"), relid[1] - 0.5, relid[2] - 0.5, cell.amplitude()); + mHistManager.fill(HIST("cellAmpM1"), relid[1] - 0.5, relid[2] - 0.5, energy); mHistManager.fill(HIST("cellTimeM1"), relid[1] - 0.5, relid[2] - 0.5, cell.time()); if (cell.time() > mMinCellTimeMain && cell.time() < mMaxCellTimeMain) { - mHistManager.fill(HIST("cellAmpTimeM1"), cell.time(), cell.amplitude()); + mHistManager.fill(HIST("cellAmpTimeM1"), cell.time(), energy); } } if (relid[0] == 2) { mHistManager.fill(HIST("cellOccM2"), relid[1] - 0.5, relid[2] - 0.5); - mHistManager.fill(HIST("cellAmpM2"), relid[1] - 0.5, relid[2] - 0.5, cell.amplitude()); + mHistManager.fill(HIST("cellAmpM2"), relid[1] - 0.5, relid[2] - 0.5, energy); mHistManager.fill(HIST("cellTimeM2"), relid[1] - 0.5, relid[2] - 0.5, cell.time()); if (cell.time() > mMinCellTimeMain && cell.time() < mMaxCellTimeMain) { - mHistManager.fill(HIST("cellAmpTimeM2"), cell.time(), cell.amplitude()); + mHistManager.fill(HIST("cellAmpTimeM2"), cell.time(), energy); } } if (relid[0] == 3) { mHistManager.fill(HIST("cellOccM3"), relid[1] - 0.5, relid[2] - 0.5); - mHistManager.fill(HIST("cellAmpM3"), relid[1] - 0.5, relid[2] - 0.5, cell.amplitude()); + mHistManager.fill(HIST("cellAmpM3"), relid[1] - 0.5, relid[2] - 0.5, energy); mHistManager.fill(HIST("cellTimeM3"), relid[1] - 0.5, relid[2] - 0.5, cell.time()); if (cell.time() > mMinCellTimeMain && cell.time() < mMaxCellTimeMain) { - mHistManager.fill(HIST("cellAmpTimeM3"), cell.time(), cell.amplitude()); + mHistManager.fill(HIST("cellAmpTimeM3"), cell.time(), energy); } } if (relid[0] == 4) { mHistManager.fill(HIST("cellOccM4"), relid[1] - 0.5, relid[2] - 0.5); - mHistManager.fill(HIST("cellAmpM4"), relid[1] - 0.5, relid[2] - 0.5, cell.amplitude()); + mHistManager.fill(HIST("cellAmpM4"), relid[1] - 0.5, relid[2] - 0.5, energy); mHistManager.fill(HIST("cellTimeM4"), relid[1] - 0.5, relid[2] - 0.5, cell.time()); if (cell.time() > mMinCellTimeMain && cell.time() < mMaxCellTimeMain) { - mHistManager.fill(HIST("cellAmpTimeM4"), cell.time(), cell.amplitude()); + mHistManager.fill(HIST("cellAmpTimeM4"), cell.time(), energy); } } } diff --git a/PWGHF/Core/HfHelper.h b/PWGHF/Core/HfHelper.h index b610c194fe9..7714fd68165 100644 --- a/PWGHF/Core/HfHelper.h +++ b/PWGHF/Core/HfHelper.h @@ -947,34 +947,59 @@ class HfHelper } /// Apply selection on ML scores for charm-hadron daughter in b-hadron decays (common for all the beauty channels) - /// \param candB b-hadron candidates /// \param cuts ML score selection per bin of charm-hadron pT /// \param binsPtC pT bin limits of charm hadron + /// \param mlScores vector with ml scores of charm hadron (position 0:bkg 1:prompt 2:nonprompt) /// \return true if b-hadron candidate passes all selections - template - bool selectionDmesMlScoresForB(const T1& candB, const T2& cuts, const T3& binsPtC) + template + bool applySelectionDmesMlScoresForB(const T1& cuts, const T2& binsPtC, float ptC, std::vector mlScores) { - auto ptC = RecoDecay::pt(candB.pxProng0(), candB.pyProng0()); // the first daughter is the charm hadron int pTBin = o2::analysis::findBin(binsPtC, ptC); if (pTBin == -1) { return false; } - if (candB.prong0MlScoreBkg() > cuts->get(pTBin, "ML score charm bkg")) { + if (mlScores[0] > cuts->get(pTBin, "ML score charm bkg")) { return false; } - if (candB.prong0MlScorePrompt() > cuts->get(pTBin, "ML score charm prompt")) { // we want non-prompt for beauty + if (mlScores[1] > cuts->get(pTBin, "ML score charm prompt")) { // we want non-prompt for beauty return false; } - if (candB.prong0MlScoreNonprompt() < cuts->get(pTBin, "ML score charm nonprompt")) { // we want non-prompt for beauty + if (mlScores[2] < cuts->get(pTBin, "ML score charm nonprompt")) { // we want non-prompt for beauty return false; } return true; } + /// Apply selection on ML scores for charm-hadron daughter in b-hadron decays (could be common for all the beauty channels) + /// \param candB b-hadron candidates + /// \param cuts ML score selection per bin of charm-hadron pT + /// \param binsPtC pT bin limits of charm hadron + /// \return true if b-hadron candidate passes all selections + template + bool selectionDmesMlScoresForB(const T1& candD, const T2& cuts, const T3& binsPtC, const std::vector& mlScores) + { + return applySelectionDmesMlScoresForB(cuts, binsPtC, candD.pt(), mlScores); + } + + /// Apply selection on ML scores for charm-hadron daughter in b-hadron decays in reduced format (common for all the beauty channels) + /// \param candB b-hadron candidates + /// \param cuts ML score selection per bin of charm-hadron pT + /// \param binsPtC pT bin limits of charm hadron + /// \return true if b-hadron candidate passes all selections + template + bool selectionDmesMlScoresForBReduced(const T1& candB, const T2& cuts, const T3& binsPtC) + { + std::vector mlScores; + mlScores.push_back(candB.prong0MlScoreBkg()); + mlScores.push_back(candB.prong0MlScorePrompt()); + mlScores.push_back(candB.prong0MlScoreNonprompt()); // we want non-prompt for beauty + return applySelectionDmesMlScoresForB(cuts, binsPtC, RecoDecay::pt(candB.pxProng0(), candB.pyProng0()), mlScores); + } + private: }; diff --git a/PWGHF/Core/HfMlResponseBplusToD0Pi.h b/PWGHF/Core/HfMlResponseBplusToD0Pi.h index 8a3b3875dae..90fb0669675 100644 --- a/PWGHF/Core/HfMlResponseBplusToD0Pi.h +++ b/PWGHF/Core/HfMlResponseBplusToD0Pi.h @@ -26,9 +26,9 @@ // Fill the map of available input features // the key is the feature's name (std::string) // the value is the corresponding value in EnumInputFeatures -#define FILL_MAP_BPLUS(FEATURE) \ - { \ -#FEATURE, static_cast < uint8_t>(InputFeaturesBplusToD0Pi::FEATURE) \ +#define FILL_MAP_BPLUS(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesBplusToD0Pi::FEATURE) \ } // Check if the index of mCachedIndices (index associated to a FEATURE) @@ -59,6 +59,17 @@ break; \ } +// where OBJECT is named candidateD , FEATURE = GETTER and INDEX is the index of the vector +#define CHECK_AND_FILL_VEC_D0_INDEX(FEATURE, GETTER1, GETTER2, INDEX) \ + case static_cast(InputFeaturesBplusToD0Pi::FEATURE): { \ + if (pdgCode == o2::constants::physics::kD0) { \ + inputFeatures.emplace_back((candidateD0.GETTER1())[INDEX]); \ + } else { \ + inputFeatures.emplace_back((candidateD0.GETTER2())[INDEX]); \ + } \ + break; \ + } + namespace o2::analysis { @@ -76,9 +87,9 @@ enum class InputFeaturesBplusToD0Pi : uint8_t { cpa, cpaXY, maxNormalisedDeltaIP, - prong0MlScoreBkg, - prong0MlScorePrompt, - prong0MlScoreNonprompt, + prong0MlProbBkg, + prong0MlProbPrompt, + prong0MlProbNonPrompt, tpcNSigmaPi1, tofNSigmaPi1, tpcTofNSigmaPi1 @@ -97,9 +108,11 @@ class HfMlResponseBplusToD0Pi : public HfMlResponse /// \param candidate is the B+ candidate /// \param prong1 is the candidate's prong1 /// \return inputFeatures vector - template + template std::vector getInputFeatures(T1 const& candidate, - T2 const& prong1) + T2 const& candidateD0, + int const& pdgCode, + T3 const& prong1) { std::vector inputFeatures; @@ -119,9 +132,9 @@ class HfMlResponseBplusToD0Pi : public HfMlResponse CHECK_AND_FILL_VEC_BPLUS(cpa); CHECK_AND_FILL_VEC_BPLUS(cpaXY); CHECK_AND_FILL_VEC_BPLUS(maxNormalisedDeltaIP); - CHECK_AND_FILL_VEC_BPLUS(prong0MlScoreBkg); - CHECK_AND_FILL_VEC_BPLUS(prong0MlScorePrompt); - CHECK_AND_FILL_VEC_BPLUS(prong0MlScoreNonprompt); + CHECK_AND_FILL_VEC_D0_INDEX(prong0MlProbBkg, mlProbD0, mlProbD0bar, 0); + CHECK_AND_FILL_VEC_D0_INDEX(prong0MlProbPrompt, mlProbD0, mlProbD0bar, 1); + CHECK_AND_FILL_VEC_D0_INDEX(prong0MlProbNonPrompt, mlProbD0, mlProbD0bar, 2); // TPC PID variable CHECK_AND_FILL_VEC_BPLUS_FULL(prong1, tpcNSigmaPi1, tpcNSigmaPi); // TOF PID variable @@ -175,9 +188,9 @@ class HfMlResponseBplusToD0Pi : public HfMlResponse FILL_MAP_BPLUS(cpa), FILL_MAP_BPLUS(cpaXY), FILL_MAP_BPLUS(maxNormalisedDeltaIP), - FILL_MAP_BPLUS(prong0MlScoreBkg), - FILL_MAP_BPLUS(prong0MlScorePrompt), - FILL_MAP_BPLUS(prong0MlScoreNonprompt), + FILL_MAP_BPLUS(prong0MlProbBkg), + FILL_MAP_BPLUS(prong0MlProbPrompt), + FILL_MAP_BPLUS(prong0MlProbNonPrompt), // TPC PID variable FILL_MAP_BPLUS(tpcNSigmaPi1), // TOF PID variable diff --git a/PWGHF/Core/HfMlResponseBplusToD0PiReduced.h b/PWGHF/Core/HfMlResponseBplusToD0PiReduced.h new file mode 100644 index 00000000000..6f56cbce245 --- /dev/null +++ b/PWGHF/Core/HfMlResponseBplusToD0PiReduced.h @@ -0,0 +1,197 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file HfMlResponseBplusToD0PiReduced.h +/// \brief Class to compute the ML response for B± → D0(bar) π± analysis selections in the reduced format +/// \author Antonio Palasciano , INFN Bari + +#ifndef PWGHF_CORE_HFMLRESPONSEBPLUSTOD0PIREDUCED_H_ +#define PWGHF_CORE_HFMLRESPONSEBPLUSTOD0PIREDUCED_H_ + +#include +#include +#include + +#include "PWGHF/Core/HfMlResponse.h" +#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" + +// Fill the map of available input features +// the key is the feature's name (std::string) +// the value is the corresponding value in EnumInputFeatures +#define FILL_MAP_BPLUS(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesBplusToD0PiReduced::FEATURE) \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER from OBJECT +#define CHECK_AND_FILL_VEC_BPLUS_FULL(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesBplusToD0PiReduced::FEATURE): { \ + inputFeatures.emplace_back(OBJECT.GETTER()); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the GETTER function taking OBJECT in argument +#define CHECK_AND_FILL_VEC_BPLUS_FUNC(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesBplusToD0PiReduced::FEATURE): { \ + inputFeatures.emplace_back(GETTER(OBJECT)); \ + break; \ + } + +// Specific case of CHECK_AND_FILL_VEC_BPLUS_FULL(OBJECT, FEATURE, GETTER) +// where OBJECT is named candidate and FEATURE = GETTER +#define CHECK_AND_FILL_VEC_BPLUS(GETTER) \ + case static_cast(InputFeaturesBplusToD0PiReduced::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ + } + +namespace o2::analysis +{ + +enum class InputFeaturesBplusToD0PiReduced : uint8_t { + ptProng0 = 0, + ptProng1, + impactParameter0, + impactParameter1, + impactParameterProduct, + chi2PCA, + decayLength, + decayLengthXY, + decayLengthNormalised, + decayLengthXYNormalised, + cpa, + cpaXY, + maxNormalisedDeltaIP, + prong0MlScoreBkg, + prong0MlScorePrompt, + prong0MlScoreNonprompt, + tpcNSigmaPi1, + tofNSigmaPi1, + tpcTofNSigmaPi1 +}; + +template +class HfMlResponseBplusToD0PiReduced : public HfMlResponse +{ + public: + /// Default constructor + HfMlResponseBplusToD0PiReduced() = default; + /// Default destructor + virtual ~HfMlResponseBplusToD0PiReduced() = default; + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the B+ candidate + /// \param prong1 is the candidate's prong1 + /// \return inputFeatures vector + template + std::vector getInputFeatures(T1 const& candidate, + T2 const& prong1) + { + std::vector inputFeatures; + + for (const auto& idx : MlResponse::mCachedIndices) { + if constexpr (withDmesMl) { + switch (idx) { + CHECK_AND_FILL_VEC_BPLUS(ptProng0); + CHECK_AND_FILL_VEC_BPLUS(ptProng1); + CHECK_AND_FILL_VEC_BPLUS(impactParameter0); + CHECK_AND_FILL_VEC_BPLUS(impactParameter1); + CHECK_AND_FILL_VEC_BPLUS(impactParameterProduct); + CHECK_AND_FILL_VEC_BPLUS(chi2PCA); + CHECK_AND_FILL_VEC_BPLUS(decayLength); + CHECK_AND_FILL_VEC_BPLUS(decayLengthXY); + CHECK_AND_FILL_VEC_BPLUS(decayLengthNormalised); + CHECK_AND_FILL_VEC_BPLUS(decayLengthXYNormalised); + CHECK_AND_FILL_VEC_BPLUS(cpa); + CHECK_AND_FILL_VEC_BPLUS(cpaXY); + CHECK_AND_FILL_VEC_BPLUS(maxNormalisedDeltaIP); + CHECK_AND_FILL_VEC_BPLUS(prong0MlScoreBkg); + CHECK_AND_FILL_VEC_BPLUS(prong0MlScorePrompt); + CHECK_AND_FILL_VEC_BPLUS(prong0MlScoreNonprompt); + // TPC PID variable + CHECK_AND_FILL_VEC_BPLUS_FULL(prong1, tpcNSigmaPi1, tpcNSigmaPi); + // TOF PID variable + CHECK_AND_FILL_VEC_BPLUS_FULL(prong1, tofNSigmaPi1, tofNSigmaPi); + // Combined PID variables + CHECK_AND_FILL_VEC_BPLUS_FUNC(prong1, tpcTofNSigmaPi1, o2::pid_tpc_tof_utils::getTpcTofNSigmaPi1); + } + } else { + switch (idx) { + CHECK_AND_FILL_VEC_BPLUS(ptProng0); + CHECK_AND_FILL_VEC_BPLUS(ptProng1); + CHECK_AND_FILL_VEC_BPLUS(impactParameter0); + CHECK_AND_FILL_VEC_BPLUS(impactParameter1); + CHECK_AND_FILL_VEC_BPLUS(impactParameterProduct); + CHECK_AND_FILL_VEC_BPLUS(chi2PCA); + CHECK_AND_FILL_VEC_BPLUS(decayLength); + CHECK_AND_FILL_VEC_BPLUS(decayLengthXY); + CHECK_AND_FILL_VEC_BPLUS(decayLengthNormalised); + CHECK_AND_FILL_VEC_BPLUS(decayLengthXYNormalised); + CHECK_AND_FILL_VEC_BPLUS(cpa); + CHECK_AND_FILL_VEC_BPLUS(cpaXY); + CHECK_AND_FILL_VEC_BPLUS(maxNormalisedDeltaIP); + // TPC PID variable + CHECK_AND_FILL_VEC_BPLUS_FULL(prong1, tpcNSigmaPi1, tpcNSigmaPi); + // TOF PID variable + CHECK_AND_FILL_VEC_BPLUS_FULL(prong1, tofNSigmaPi1, tofNSigmaPi); + // Combined PID variables + CHECK_AND_FILL_VEC_BPLUS_FUNC(prong1, tpcTofNSigmaPi1, o2::pid_tpc_tof_utils::getTpcTofNSigmaPi1); + } + } + } + + return inputFeatures; + } + + protected: + /// Method to fill the map of available input features + void setAvailableInputFeatures() + { + MlResponse::mAvailableInputFeatures = { + FILL_MAP_BPLUS(ptProng0), + FILL_MAP_BPLUS(ptProng1), + FILL_MAP_BPLUS(impactParameter0), + FILL_MAP_BPLUS(impactParameter1), + FILL_MAP_BPLUS(impactParameterProduct), + FILL_MAP_BPLUS(chi2PCA), + FILL_MAP_BPLUS(decayLength), + FILL_MAP_BPLUS(decayLengthXY), + FILL_MAP_BPLUS(decayLengthNormalised), + FILL_MAP_BPLUS(decayLengthXYNormalised), + FILL_MAP_BPLUS(cpa), + FILL_MAP_BPLUS(cpaXY), + FILL_MAP_BPLUS(maxNormalisedDeltaIP), + FILL_MAP_BPLUS(prong0MlScoreBkg), + FILL_MAP_BPLUS(prong0MlScorePrompt), + FILL_MAP_BPLUS(prong0MlScoreNonprompt), + // TPC PID variable + FILL_MAP_BPLUS(tpcNSigmaPi1), + // TOF PID variable + FILL_MAP_BPLUS(tofNSigmaPi1), + // Combined PID variable + FILL_MAP_BPLUS(tpcTofNSigmaPi1)}; + } +}; + +} // namespace o2::analysis + +#undef FILL_MAP_BPLUS +#undef CHECK_AND_FILL_VEC_BPLUS_FULL +#undef CHECK_AND_FILL_VEC_BPLUS_FUNC +#undef CHECK_AND_FILL_VEC_BPLUS + +#endif // PWGHF_CORE_HFMLRESPONSEBPLUSTOD0PIREDUCED_H_ diff --git a/PWGHF/Core/HfMlResponseDstarToD0Pi.h b/PWGHF/Core/HfMlResponseDstarToD0Pi.h index b583d93ed88..66fc3a712d4 100644 --- a/PWGHF/Core/HfMlResponseDstarToD0Pi.h +++ b/PWGHF/Core/HfMlResponseDstarToD0Pi.h @@ -61,6 +61,18 @@ break; \ } +// Very specific case of CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(OBJECT, FEATURE, GETTER) +// Use for push back different value for D*+ or D*- candidate getting the correct feature from two different objects (tracks) +#define CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(OBJECTPOS, OBJECTNEG, FEATURENAME, GETTER) \ + case static_cast(InputFeaturesDstarToD0Pi::FEATURENAME): { \ + if (candidate.signSoftPi() > 0) { \ + inputFeatures.emplace_back(OBJECTPOS.GETTER()); \ + } else { \ + inputFeatures.emplace_back(OBJECTNEG.GETTER()); \ + } \ + break; \ + } + // Very specific case of CHECK_AND_FILL_VEC_DSTAR_FULL(OBJECT, FEATURE, GETTER) // Use for push back deltaMassD0 for D*+ or D*- candidate #define CHECK_AND_FILL_VEC_DSTAR_DELTA_MASS_D0(FEATURENAME) \ @@ -156,36 +168,36 @@ class HfMlResponseDstarToD0Pi : public HfMlResponse CHECK_AND_FILL_VEC_DSTAR(cpaXYD0); CHECK_AND_FILL_VEC_DSTAR(deltaIPNormalisedMaxD0); CHECK_AND_FILL_VEC_DSTAR(impactParameterProductD0); - CHECK_AND_FILL_VEC_DSTAR(ptProng0); - CHECK_AND_FILL_VEC_DSTAR(ptProng1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(ptProng0, ptProng1, ptProng0); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(ptProng1, ptProng0, ptProng1); CHECK_AND_FILL_VEC_DSTAR(ptSoftPi); - CHECK_AND_FILL_VEC_DSTAR(impactParameter0); - CHECK_AND_FILL_VEC_DSTAR(impactParameter1); - CHECK_AND_FILL_VEC_DSTAR(impactParameterZ0); - CHECK_AND_FILL_VEC_DSTAR(impactParameterZ1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameter0, impactParameter1, impactParameter0); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameter1, impactParameter0, impactParameter1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZ0, impactParameterZ1, impactParameterZ0); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZ1, impactParameterZ0, impactParameterZ1); CHECK_AND_FILL_VEC_DSTAR(impParamSoftPi); CHECK_AND_FILL_VEC_DSTAR(impParamZSoftPi); - CHECK_AND_FILL_VEC_DSTAR(impactParameterNormalised0); - CHECK_AND_FILL_VEC_DSTAR(impactParameterNormalised1); - CHECK_AND_FILL_VEC_DSTAR(impactParameterZNormalised0); - CHECK_AND_FILL_VEC_DSTAR(impactParameterZNormalised1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterNormalised0, impactParameterNormalised1, impactParameterNormalised0); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterNormalised1, impactParameterNormalised0, impactParameterNormalised1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZNormalised0, impactParameterZNormalised1, impactParameterZNormalised0); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZNormalised1, impactParameterZNormalised0, impactParameterZNormalised1); CHECK_AND_FILL_VEC_DSTAR(normalisedImpParamSoftPi); CHECK_AND_FILL_VEC_DSTAR(normalisedImpParamZSoftPi); CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(cosThetaStarD0, cosThetaStarD0Bar, cosThetaStarD0); CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(invMassD0, invMassD0Bar, massD0); CHECK_AND_FILL_VEC_DSTAR_DELTA_MASS_D0(deltaMassD0); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong0, nSigmaTPCPiPr0, tpcNSigmaPi); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong0, nSigmaTPCKaPr0, tpcNSigmaKa); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong0, nSigmaTOFPiPr0, tofNSigmaPi); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong0, nSigmaTOFKaPr0, tofNSigmaKa); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong0, nSigmaTPCTOFPiPr0, tpcTofNSigmaPi); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong0, nSigmaTPCTOFKaPr0, tpcTofNSigmaKa); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong1, nSigmaTPCPiPr1, tpcNSigmaPi); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong1, nSigmaTPCKaPr1, tpcNSigmaKa); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong1, nSigmaTOFPiPr1, tofNSigmaPi); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong1, nSigmaTOFKaPr1, tofNSigmaKa); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong1, nSigmaTPCTOFPiPr1, tpcTofNSigmaPi); - CHECK_AND_FILL_VEC_DSTAR_FULL(prong1, nSigmaTPCTOFKaPr1, tpcTofNSigmaKa); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong0, prong1, nSigmaTPCPiPr0, tpcNSigmaPi); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong0, prong1, nSigmaTPCKaPr0, tpcNSigmaKa); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong0, prong1, nSigmaTOFPiPr0, tofNSigmaPi); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong0, prong1, nSigmaTOFKaPr0, tofNSigmaKa); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong0, prong1, nSigmaTPCTOFPiPr0, tpcTofNSigmaPi); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong0, prong1, nSigmaTPCTOFKaPr0, tpcTofNSigmaKa); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong1, prong0, nSigmaTPCPiPr1, tpcNSigmaPi); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong1, prong0, nSigmaTPCKaPr1, tpcNSigmaKa); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong1, prong0, nSigmaTOFPiPr1, tofNSigmaPi); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong1, prong0, nSigmaTOFKaPr1, tofNSigmaKa); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong1, prong0, nSigmaTPCTOFPiPr1, tpcTofNSigmaPi); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(prong1, prong0, nSigmaTPCTOFKaPr1, tpcTofNSigmaKa); CHECK_AND_FILL_VEC_DSTAR_FULL(prongSoftPi, nSigmaTPCPiPrSoftPi, tpcNSigmaPi); CHECK_AND_FILL_VEC_DSTAR_FULL(prongSoftPi, nSigmaTPCKaPrSoftPi, tpcNSigmaKa); CHECK_AND_FILL_VEC_DSTAR_FULL(prongSoftPi, nSigmaTOFPiPrSoftPi, tofNSigmaPi); diff --git a/PWGHF/Core/HfMlResponseXicToXiPiPi.h b/PWGHF/Core/HfMlResponseXicToXiPiPi.h new file mode 100644 index 00000000000..0a290e14d1d --- /dev/null +++ b/PWGHF/Core/HfMlResponseXicToXiPiPi.h @@ -0,0 +1,147 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file HfMlResponseXicToXiPiPi.h +/// \brief Class to compute the ML response for Ξc± → Ξ∓ π± π± analysis selections +/// \author Jaeyoon Cho , Inha University + +#ifndef PWGHF_CORE_HFMLRESPONSEXICTOXIPIPI_H_ +#define PWGHF_CORE_HFMLRESPONSEXICTOXIPIPI_H_ + +#include +#include +#include + +#include "PWGHF/Core/HfMlResponse.h" + +// Fill the map of available input features +// the key is the feature's name (std::string) +// the value is the corresponding value in EnumInputFeatures +#define FILL_MAP_XICTOXIPIPI(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesXicToXiPiPi::FEATURE) \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER from OBJECT +#define CHECK_AND_FILL_VEC_XICTOXIPIPI_FULL(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesXicToXiPiPi::FEATURE): { \ + inputFeatures.emplace_back(OBJECT.GETTER()); \ + break; \ + } + +// Specific case of CHECK_AND_FILL_VEC_XICTOXIPIPI_FULL(OBJECT, FEATURE, GETTER) +// where OBJECT is named candidate and FEATURE = GETTER +#define CHECK_AND_FILL_VEC_XICTOXIPIPI(GETTER) \ + case static_cast(InputFeaturesXicToXiPiPi::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ + } + +namespace o2::analysis +{ + +enum class InputFeaturesXicToXiPiPi : uint8_t { + ptProng0 = 0, + ptProng1, + ptProng2, + chi2PCA, + decayLength, + decayLengthNormalised, + decayLengthXY, + decayLengthXYNormalised, + cpa, + cpaXY, + cosPaXi, + cosPaXYXi, + cosPaLambda, + cosPaXYLambda, + impactParameterXY0, + impactParameterXY1, + impactParameterXY2 +}; + +template +class HfMlResponseXicToXiPiPi : public HfMlResponse +{ + public: + /// Default constructor + HfMlResponseXicToXiPiPi() = default; + /// Default destructor + virtual ~HfMlResponseXicToXiPiPi() = default; + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the Xic candidate + /// \return inputFeatures vector + template + std::vector getInputFeatures(T1 const& candidate) + { + std::vector inputFeatures; + + for (const auto& idx : MlResponse::mCachedIndices) { + switch (idx) { + CHECK_AND_FILL_VEC_XICTOXIPIPI(ptProng0); + CHECK_AND_FILL_VEC_XICTOXIPIPI(ptProng1); + CHECK_AND_FILL_VEC_XICTOXIPIPI(ptProng2); + CHECK_AND_FILL_VEC_XICTOXIPIPI(chi2PCA); + CHECK_AND_FILL_VEC_XICTOXIPIPI(decayLength); + CHECK_AND_FILL_VEC_XICTOXIPIPI(decayLengthNormalised); + CHECK_AND_FILL_VEC_XICTOXIPIPI(decayLengthXY); + CHECK_AND_FILL_VEC_XICTOXIPIPI(decayLengthXYNormalised); + CHECK_AND_FILL_VEC_XICTOXIPIPI(cpa); + CHECK_AND_FILL_VEC_XICTOXIPIPI(cpaXY); + CHECK_AND_FILL_VEC_XICTOXIPIPI(cosPaXi); + CHECK_AND_FILL_VEC_XICTOXIPIPI(cosPaXYXi); + CHECK_AND_FILL_VEC_XICTOXIPIPI(cosPaLambda); + CHECK_AND_FILL_VEC_XICTOXIPIPI(cosPaXYLambda); + CHECK_AND_FILL_VEC_XICTOXIPIPI_FULL(candidate, impactParameterXY0, impactParameter0); + CHECK_AND_FILL_VEC_XICTOXIPIPI_FULL(candidate, impactParameterXY1, impactParameter1); + CHECK_AND_FILL_VEC_XICTOXIPIPI_FULL(candidate, impactParameterXY2, impactParameter2); + } + } + + return inputFeatures; + } + + protected: + /// Method to fill the map of available input features + void setAvailableInputFeatures() + { + MlResponse::mAvailableInputFeatures = { + FILL_MAP_XICTOXIPIPI(ptProng0), + FILL_MAP_XICTOXIPIPI(ptProng1), + FILL_MAP_XICTOXIPIPI(ptProng2), + FILL_MAP_XICTOXIPIPI(chi2PCA), + FILL_MAP_XICTOXIPIPI(decayLength), + FILL_MAP_XICTOXIPIPI(decayLengthNormalised), + FILL_MAP_XICTOXIPIPI(decayLengthXY), + FILL_MAP_XICTOXIPIPI(decayLengthXYNormalised), + FILL_MAP_XICTOXIPIPI(cpa), + FILL_MAP_XICTOXIPIPI(cpaXY), + FILL_MAP_XICTOXIPIPI(cosPaXi), + FILL_MAP_XICTOXIPIPI(cosPaXYXi), + FILL_MAP_XICTOXIPIPI(cosPaLambda), + FILL_MAP_XICTOXIPIPI(cosPaXYLambda), + FILL_MAP_XICTOXIPIPI(impactParameterXY0), + FILL_MAP_XICTOXIPIPI(impactParameterXY1), + FILL_MAP_XICTOXIPIPI(impactParameterXY2)}; + } +}; + +} // namespace o2::analysis + +#undef FILL_MAP_XICTOXIPIPI +#undef CHECK_AND_FILL_VEC_XICTOXIPIPI_FULL +#undef CHECK_AND_FILL_VEC_XICTOXIPIPI + +#endif // PWGHF_CORE_HFMLRESPONSEXICTOXIPIPI_H_ diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 906859de48e..d8c06e0d26f 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -17,6 +17,8 @@ /// \author Alexandre Bigot , IPHC Strasbourg /// \author Antonio Palasciano , Università degli Studi di Bari & INFN, Bari /// \author Fabio Catalano , CERN +/// \author Fabrizio Grosa , CERN +/// \author Luca Aglietta , Università degli Studi di Torino (UniTO) #ifndef PWGHF_D2H_DATAMODEL_REDUCEDDATAMODEL_H_ #define PWGHF_D2H_DATAMODEL_REDUCEDDATAMODEL_H_ @@ -30,6 +32,7 @@ #include "Common/DataModel/PIDResponse.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsPid.h" namespace o2 { @@ -130,10 +133,88 @@ DECLARE_SOA_COLUMN(TrackId, trackId, int); //! Original track ind DECLARE_SOA_COLUMN(Prong0Id, prong0Id, int); //! Original track index DECLARE_SOA_COLUMN(Prong1Id, prong1Id, int); //! Original track index DECLARE_SOA_COLUMN(Prong2Id, prong2Id, int); //! Original track index -DECLARE_SOA_COLUMN(HasTPC, hasTPC, bool); //! Flag to check if track has a TPC match -DECLARE_SOA_COLUMN(HasTOF, hasTOF, bool); //! Flag to check if track has a TOF match } // namespace hf_track_index_reduced +namespace hf_track_vars_reduced +{ +// CAREFUL: the getters names shall be the same as the ones of the getTrackParCov method in Common/Core/trackUtilities.h +DECLARE_SOA_COLUMN(Px, px, float); //! x-component of momentum +DECLARE_SOA_COLUMN(Py, py, float); //! y-component of momentum +DECLARE_SOA_COLUMN(Pz, pz, float); //! z-component of momentum +DECLARE_SOA_COLUMN(Sign, sign, uint8_t); //! charge sign +DECLARE_SOA_COLUMN(HasTPC, hasTPC, bool); //! Flag to check if track has a TPC match +DECLARE_SOA_COLUMN(HasTOF, hasTOF, bool); //! Flag to check if track has a TOF match +DECLARE_SOA_COLUMN(HasTPCProng0, hasTPCProng0, bool); //! Flag to check if prong0 has a TPC match +DECLARE_SOA_COLUMN(HasTOFProng0, hasTOFProng0, bool); //! Flag to check if prong0 has a TOF match +DECLARE_SOA_COLUMN(HasTPCProng1, hasTPCProng1, bool); //! Flag to check if prong1 has a TPC match +DECLARE_SOA_COLUMN(HasTOFProng1, hasTOFProng1, bool); //! Flag to check if prong1 has a TOF match +DECLARE_SOA_COLUMN(HasTPCProng2, hasTPCProng2, bool); //! Flag to check if prong2 has a TPC match +DECLARE_SOA_COLUMN(HasTOFProng2, hasTOFProng2, bool); //! Flag to check if prong2 has a TOF match +DECLARE_SOA_COLUMN(ItsNCls, itsNCls, int); //! Number of clusters in ITS +DECLARE_SOA_COLUMN(TpcNClsCrossedRows, tpcNClsCrossedRows, int); //! Number of TPC crossed rows +DECLARE_SOA_COLUMN(TpcChi2NCl, tpcChi2NCl, float); //! TPC chi2 +DECLARE_SOA_COLUMN(ItsNClsProngMin, itsNClsProngMin, int); //! minimum value of number of ITS clusters for the decay daughter tracks +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsProngMin, tpcNClsCrossedRowsProngMin, int); //! minimum value of number of TPC crossed rows for the decay daughter tracks +DECLARE_SOA_COLUMN(TpcChi2NClProngMax, tpcChi2NClProngMax, float); //! maximum value of TPC chi2 for the decay daughter tracks +DECLARE_SOA_COLUMN(PtProngMin, ptProngMin, float); //! minimum value of transverse momentum for the decay daughter tracks +DECLARE_SOA_COLUMN(AbsEtaProngMin, absEtaProngMin, float); //! minimum value of absolute pseudorapidity for the decay daughter tracks + +// dynamic columns +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! transverse momentum + [](float px, float py) -> float { return RecoDecay::pt(px, py); }); +DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, //! azimuthal angle + [](float px, float py) -> float { return RecoDecay::phi(px, py); }); +DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, //! pseudorapidity + [](float px, float py, float pz) -> float { return RecoDecay::eta(std::array{px, py, pz}); }); +DECLARE_SOA_DYNAMIC_COLUMN(PtProng0, ptProng0, //! + [](float pxProng0, float pyProng0) -> float { return RecoDecay::pt(pxProng0, pyProng0); }); +DECLARE_SOA_DYNAMIC_COLUMN(PtProng1, ptProng1, //! + [](float pxProng1, float pyProng1) -> float { return RecoDecay::pt(pxProng1, pyProng1); }); +DECLARE_SOA_DYNAMIC_COLUMN(PtProng2, ptProng2, //! + [](float pxProng2, float pyProng2) -> float { return RecoDecay::pt(pxProng2, pyProng2); }); +DECLARE_SOA_DYNAMIC_COLUMN(EtaProng0, etaProng0, //! + [](float pxProng0, float pyProng0, float pzProng0) -> float { return RecoDecay::eta(std::array{pxProng0, pyProng0, pzProng0}); }); +DECLARE_SOA_DYNAMIC_COLUMN(EtaProng1, etaProng1, //! + [](float pxProng1, float pyProng1, float pzProng1) -> float { return RecoDecay::eta(std::array{pxProng1, pyProng1, pzProng1}); }); +DECLARE_SOA_DYNAMIC_COLUMN(EtaProng2, etaProng2, //! + [](float pxProng2, float pyProng2, float pzProng2) -> float { return RecoDecay::eta(std::array{pxProng2, pyProng2, pzProng2}); }); +} // namespace hf_track_vars_reduced + +namespace hf_track_pid_reduced +{ +DECLARE_SOA_COLUMN(TPCNSigmaPiProng0, tpcNSigmaPiProng0, float); //! NsigmaTPCPi for prong0 +DECLARE_SOA_COLUMN(TPCNSigmaPiProng1, tpcNSigmaPiProng1, float); //! NsigmaTPCPi for prong1 +DECLARE_SOA_COLUMN(TPCNSigmaPiProng2, tpcNSigmaPiProng2, float); //! NsigmaTPCPi for prong2 +DECLARE_SOA_COLUMN(TPCNSigmaKaProng0, tpcNSigmaKaProng0, float); //! NsigmaTPCKa for prong0 +DECLARE_SOA_COLUMN(TPCNSigmaKaProng1, tpcNSigmaKaProng1, float); //! NsigmaTPCKa for prong1 +DECLARE_SOA_COLUMN(TPCNSigmaKaProng2, tpcNSigmaKaProng2, float); //! NsigmaTPCKa for prong2 +DECLARE_SOA_COLUMN(TOFNSigmaPiProng0, tofNSigmaPiProng0, float); //! NsigmaTOFPi for prong0 +DECLARE_SOA_COLUMN(TOFNSigmaPiProng1, tofNSigmaPiProng1, float); //! NsigmaTOFPi for prong1 +DECLARE_SOA_COLUMN(TOFNSigmaPiProng2, tofNSigmaPiProng2, float); //! NsigmaTOFPi for prong2 +DECLARE_SOA_COLUMN(TOFNSigmaKaProng0, tofNSigmaKaProng0, float); //! NsigmaTOFKa for prong0 +DECLARE_SOA_COLUMN(TOFNSigmaKaProng1, tofNSigmaKaProng1, float); //! NsigmaTOFKa for prong1 +DECLARE_SOA_COLUMN(TOFNSigmaKaProng2, tofNSigmaKaProng2, float); //! NsigmaTOFKa for prong2 +// dynamic columns +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaPi, tpcTofNSigmaPi, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaPi, float tofNSigmaPi) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi, tofNSigmaPi); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaKa, tpcTofNSigmaKa, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaPi, float tofNSigmaPi) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi, tofNSigmaPi); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaPr, tpcTofNSigmaPr, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaPi, float tofNSigmaPi) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi, tofNSigmaPi); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaPiProng0, tpcTofNSigmaPiProng0, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaPi, float tofNSigmaPi) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi, tofNSigmaPi); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaPiProng1, tpcTofNSigmaPiProng1, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaPi, float tofNSigmaPi) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi, tofNSigmaPi); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaPiProng2, tpcTofNSigmaPiProng2, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaPi, float tofNSigmaPi) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi, tofNSigmaPi); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaKaProng0, tpcTofNSigmaKaProng0, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaKa, float tofNSigmaKa) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa, tofNSigmaKa); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaKaProng1, tpcTofNSigmaKaProng1, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaKa, float tofNSigmaKa) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa, tofNSigmaKa); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaKaProng2, tpcTofNSigmaKaProng2, //! Combination of NsigmaTPC and NsigmaTOF + [](float tpcNSigmaKa, float tofNSigmaKa) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa, tofNSigmaKa); }); +} // namespace hf_track_pid_reduced + // CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) // to call DECLARE_SOA_INDEX_COLUMN_FULL later on DECLARE_SOA_TABLE(HfRedTrackBases, "AOD", "HFREDTRACKBASE", //! Table with track information for reduced workflow @@ -141,6 +222,9 @@ DECLARE_SOA_TABLE(HfRedTrackBases, "AOD", "HFREDTRACKBASE", //! Table with track hf_track_index_reduced::TrackId, hf_track_index_reduced::HfRedCollisionId, HFTRACKPAR_COLUMNS, + hf_track_vars_reduced::ItsNCls, + hf_track_vars_reduced::TpcNClsCrossedRows, + hf_track_vars_reduced::TpcChi2NCl, aod::track::Px, aod::track::Py, aod::track::Pz, @@ -153,10 +237,11 @@ DECLARE_SOA_TABLE(HfRedTracksCov, "AOD", "HFREDTRACKCOV", //! Table with track c // table with all attributes needed to call statusTpcAndTof() in the selector task DECLARE_SOA_TABLE(HfRedTracksPid, "AOD", "HFREDTRACKPID", //! Table with PID track information for reduced workflow o2::soa::Index<>, - hf_track_index_reduced::HasTPC, - hf_track_index_reduced::HasTOF, + hf_track_vars_reduced::HasTPC, + hf_track_vars_reduced::HasTOF, pidtpc::TPCNSigmaPi, - pidtof::TOFNSigmaPi); + pidtof::TOFNSigmaPi, + hf_track_pid_reduced::TPCTOFNSigmaPi); DECLARE_SOA_EXTENDED_TABLE_USER(HfRedTracksExt, HfRedTrackBases, "HFREDTRACKEXT", //! Track parameters at collision vertex aod::track::Pt); @@ -184,6 +269,8 @@ DECLARE_SOA_TABLE(HfRed2Prongs, "AOD", "HFRED2PRONG", //! Table with 2prong cand HFTRACKPAR_COLUMNS, hf_cand::XSecondaryVertex, hf_cand::YSecondaryVertex, hf_cand::ZSecondaryVertex, hf_charm_cand_reduced::InvMassHypo0, hf_charm_cand_reduced::InvMassHypo1, + hf_track_vars_reduced::PtProngMin, hf_track_vars_reduced::AbsEtaProngMin, + hf_track_vars_reduced::ItsNClsProngMin, hf_track_vars_reduced::TpcNClsCrossedRowsProngMin, hf_track_vars_reduced::TpcChi2NClProngMax, aod::track::Px, aod::track::Py, aod::track::Pz, @@ -211,6 +298,8 @@ DECLARE_SOA_TABLE(HfRed3Prongs, "AOD", "HFRED3PRONG", //! Table with 3prong cand HFTRACKPAR_COLUMNS, hf_cand::XSecondaryVertex, hf_cand::YSecondaryVertex, hf_cand::ZSecondaryVertex, hf_charm_cand_reduced::InvMassHypo0, hf_charm_cand_reduced::InvMassHypo1, + hf_track_vars_reduced::PtProngMin, hf_track_vars_reduced::AbsEtaProngMin, + hf_track_vars_reduced::ItsNClsProngMin, hf_track_vars_reduced::TpcNClsCrossedRowsProngMin, hf_track_vars_reduced::TpcChi2NClProngMax, aod::track::Px, aod::track::Py, aod::track::Pz, @@ -237,6 +326,36 @@ DECLARE_SOA_TABLE_VERSIONED(HfRed3ProngsMl_001, "AOD", "HFRED3PRONGML", 1, //! T using HfRed3ProngsMl = HfRed3ProngsMl_001; +DECLARE_SOA_TABLE(HfRedPidDau0s, "AOD", "HFREDPIDDAU0", //! + hf_track_pid_reduced::TPCNSigmaPiProng0, + hf_track_pid_reduced::TOFNSigmaPiProng0, + hf_track_pid_reduced::TPCNSigmaKaProng0, + hf_track_pid_reduced::TOFNSigmaKaProng0, + hf_track_vars_reduced::HasTOFProng0, + hf_track_vars_reduced::HasTPCProng0, + hf_track_pid_reduced::TPCTOFNSigmaPiProng0, + hf_track_pid_reduced::TPCTOFNSigmaKaProng0); + +DECLARE_SOA_TABLE(HfRedPidDau1s, "AOD", "HFREDPIDDAU1", //! + hf_track_pid_reduced::TPCNSigmaPiProng1, + hf_track_pid_reduced::TOFNSigmaPiProng1, + hf_track_pid_reduced::TPCNSigmaKaProng1, + hf_track_pid_reduced::TOFNSigmaKaProng1, + hf_track_vars_reduced::HasTOFProng1, + hf_track_vars_reduced::HasTPCProng1, + hf_track_pid_reduced::TPCTOFNSigmaPiProng1, + hf_track_pid_reduced::TPCTOFNSigmaKaProng1); + +DECLARE_SOA_TABLE(HfRedPidDau2s, "AOD", "HFREDPIDDAU2", //! + hf_track_pid_reduced::TPCNSigmaPiProng2, + hf_track_pid_reduced::TOFNSigmaPiProng2, + hf_track_pid_reduced::TPCNSigmaKaProng2, + hf_track_pid_reduced::TOFNSigmaKaProng2, + hf_track_vars_reduced::HasTOFProng2, + hf_track_vars_reduced::HasTPCProng2, + hf_track_pid_reduced::TPCTOFNSigmaPiProng2, + hf_track_pid_reduced::TPCTOFNSigmaKaProng2); + // Beauty candidates prongs namespace hf_cand_b0_reduced { @@ -557,12 +676,8 @@ DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! [](float pxProng0, float pxProng1, float pxProng2, float pyProng0, float pyProng1, float pyProng2) -> float { return RecoDecay::pt((1.f * pxProng0 + 1.f * pxProng1 + 1.f * pxProng2), (1.f * pyProng0 + 1.f * pyProng1 + 1.f * pyProng2)); }); DECLARE_SOA_DYNAMIC_COLUMN(InvMassDplus, invMassDplus, [](float px0, float py0, float pz0, float px1, float py1, float pz1, float px2, float py2, float pz2) -> float { return RecoDecay::m(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}, std::array{px2, py2, pz2}}, std::array{constants::physics::MassPiPlus, constants::physics::MassKPlus, constants::physics::MassPiPlus}); }); -DECLARE_SOA_DYNAMIC_COLUMN(InvMassDstar, invMassDstar, - [](float pxSoftPi, float pySoftPi, float pzSoftPi, float pxProng0, float pyProng0, float pzProng0, float pxProng1, float pyProng1, float pzProng1) - -> float { return RecoDecay::m(std::array{std::array{pxSoftPi, pySoftPi, pzSoftPi}, std::array{pxProng0, pyProng0, pzProng0}, std::array{pxProng1, pyProng1, pzProng1}}, std::array{constants::physics::MassPiPlus, constants::physics::MassPiPlus, constants::physics::MassKPlus}) - RecoDecay::m(std::array{std::array{pxProng0, pyProng0, pzProng0}, std::array{pxProng1, pyProng1, pzProng1}}, std::array{constants::physics::MassPiPlus, constants::physics::MassKPlus}); }); -DECLARE_SOA_DYNAMIC_COLUMN(InvMassAntiDstar, invMassAntiDstar, - [](float pxSoftPi, float pySoftPi, float pzSoftPi, float pxProng0, float pyProng0, float pzProng0, float pxProng1, float pyProng1, float pzProng1) - -> float { return RecoDecay::m(std::array{std::array{pxSoftPi, pySoftPi, pzSoftPi}, std::array{pxProng0, pyProng0, pzProng0}, std::array{pxProng1, pyProng1, pzProng1}}, std::array{constants::physics::MassPiPlus, constants::physics::MassKPlus, constants::physics::MassPiPlus}) - RecoDecay::m(std::array{std::array{pxProng0, pyProng0, pzProng0}, std::array{pxProng1, pyProng1, pzProng1}}, std::array{constants::physics::MassKPlus, constants::physics::MassPiPlus}); }); +DECLARE_SOA_DYNAMIC_COLUMN(PVector, pVector, + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float px2, float py2, float pz2) -> std::array { return std::array{px0 + px1 + px2, py0 + py1 + py2, pz0 + pz1 + pz2}; }); } // namespace hf_reso_3_prong namespace hf_reso_v0 @@ -571,6 +686,7 @@ DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine of Pointing Angle of V0 DECLARE_SOA_COLUMN(Dca, dca, float); //! DCA of V0 candidate DECLARE_SOA_COLUMN(Radius, radius, float); //! Radius of V0 candidate DECLARE_SOA_COLUMN(V0Type, v0Type, uint8_t); //! Bitmap with mass hypothesis of the V0 + DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! [](float pxProng0, float pxProng1) -> float { return 1.f * pxProng0 + 1.f * pxProng1; }); DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! @@ -587,30 +703,10 @@ DECLARE_SOA_DYNAMIC_COLUMN(InvMassAntiLambda, invMassAntiLambda, //! mass under [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); }); DECLARE_SOA_DYNAMIC_COLUMN(InvMassK0s, invMassK0s, //! mass under K0short hypothesis [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); }); +DECLARE_SOA_DYNAMIC_COLUMN(PVector, pVector, + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> std::array { return std::array{pxpos + pxneg, pypos + pyneg, pzpos + pzneg}; }); } // namespace hf_reso_v0 -namespace hf_reso_track -{ -DECLARE_SOA_COLUMN(Px, px, float); //! x-component of momentum -DECLARE_SOA_COLUMN(Py, py, float); //! y-component of momentum -DECLARE_SOA_COLUMN(Pz, pz, float); //! z-component of momentum -DECLARE_SOA_COLUMN(Sign, sign, uint8_t); //! charge sign -DECLARE_SOA_COLUMN(NSigmaTpcPi, nSigmaTpcPi, float); //! TPC Nsigma for pion hypothesis -DECLARE_SOA_COLUMN(NSigmaTpcKa, nSigmaTpcKa, float); //! TPC Nsigma for kaon hypothesis -DECLARE_SOA_COLUMN(NSigmaTpcPr, nSigmaTpcPr, float); //! TPC Nsigma for proton hypothesis -DECLARE_SOA_COLUMN(NSigmaTofPi, nSigmaTofPi, float); //! TOF Nsigma for pion hypothesis -DECLARE_SOA_COLUMN(NSigmaTofKa, nSigmaTofKa, float); //! TOF Nsigma for kaon hypothesis -DECLARE_SOA_COLUMN(NSigmaTofPr, nSigmaTofPr, float); //! TOF Nsigma for proton hypothesis -DECLARE_SOA_COLUMN(HasTof, hasTof, bool); //! flag for presence of TOF -DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! - [](float px, float py) -> float { return RecoDecay::pt(px, py); }); -DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, //! - [](float px, float py) -> float { return RecoDecay::phi(px, py); }); -DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, //! - [](float px, float py, float pz) -> float { return RecoDecay::eta(std::array{px, py, pz}); }); - -} // namespace hf_reso_track - DECLARE_SOA_TABLE(HfRedVzeros, "AOD", "HFREDVZERO", //! Table with V0 candidate information for resonances reduced workflow o2::soa::Index<>, // Indices @@ -620,39 +716,53 @@ DECLARE_SOA_TABLE(HfRedVzeros, "AOD", "HFREDVZERO", //! Table with V0 candidate hf_cand::XSecondaryVertex, hf_cand::YSecondaryVertex, hf_cand::ZSecondaryVertex, hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, - hf_reso_v0::Cpa, - hf_reso_v0::Dca, + hf_reso_v0::Cpa, hf_reso_v0::Dca, + hf_track_vars_reduced::ItsNClsProngMin, hf_track_vars_reduced::TpcNClsCrossedRowsProngMin, hf_track_vars_reduced::TpcChi2NClProngMax, hf_reso_v0::V0Type, // Dynamic hf_reso_v0::Px, hf_reso_v0::Py, hf_reso_v0::Pz, + hf_track_vars_reduced::PtProng0, + hf_track_vars_reduced::PtProng1, + hf_track_vars_reduced::EtaProng0, + hf_track_vars_reduced::EtaProng1, hf_reso_v0::InvMassK0s, hf_reso_v0::InvMassLambda, hf_reso_v0::InvMassAntiLambda, hf_reso_v0::V0Radius, - hf_reso_v0::Pt); + hf_reso_v0::Pt, + hf_cand::PVectorProng0, + hf_cand::PVectorProng1, + hf_reso_v0::PVector); DECLARE_SOA_TABLE(HfRedTrkNoParams, "AOD", "HFREDTRKNOPARAM", //! Table with tracks without track parameters for resonances reduced workflow o2::soa::Index<>, // Indices hf_track_index_reduced::HfRedCollisionId, // Static - hf_reso_track::Px, - hf_reso_track::Py, - hf_reso_track::Pz, - hf_reso_track::Sign, - hf_reso_track::NSigmaTpcPi, - hf_reso_track::NSigmaTpcKa, - hf_reso_track::NSigmaTpcPr, - hf_reso_track::NSigmaTofPi, - hf_reso_track::NSigmaTofKa, - hf_reso_track::NSigmaTofPr, - hf_reso_track::HasTof, + hf_track_vars_reduced::Px, + hf_track_vars_reduced::Py, + hf_track_vars_reduced::Pz, + hf_track_vars_reduced::Sign, + pidtpc::TPCNSigmaPi, + pidtpc::TPCNSigmaKa, + pidtpc::TPCNSigmaPr, + pidtof::TOFNSigmaPi, + pidtof::TOFNSigmaKa, + pidtof::TOFNSigmaPr, + hf_track_vars_reduced::HasTOF, + hf_track_vars_reduced::HasTPC, + hf_track_vars_reduced::ItsNCls, + hf_track_vars_reduced::TpcNClsCrossedRows, + hf_track_vars_reduced::TpcChi2NCl, // Dynamic - hf_reso_track::Pt, - hf_reso_track::Eta, - hf_reso_track::Phi); + hf_track_vars_reduced::Pt, + hf_track_vars_reduced::Eta, + hf_track_vars_reduced::Phi, + hf_track_pid_reduced::TPCTOFNSigmaPi, + hf_track_pid_reduced::TPCTOFNSigmaKa, + hf_track_pid_reduced::TPCTOFNSigmaPr); DECLARE_SOA_TABLE(HfRed3PrNoTrks, "AOD", "HFRED3PRNOTRK", //! Table with 3 prong candidate information for resonances reduced workflow o2::soa::Index<>, @@ -664,21 +774,36 @@ DECLARE_SOA_TABLE(HfRed3PrNoTrks, "AOD", "HFRED3PRNOTRK", //! Table with 3 prong hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, hf_cand::PxProng2, hf_cand::PyProng2, hf_cand::PzProng2, + hf_track_vars_reduced::ItsNClsProngMin, hf_track_vars_reduced::TpcNClsCrossedRowsProngMin, hf_track_vars_reduced::TpcChi2NClProngMax, hf_reso_3_prong::DType, // Dynamic hf_reso_3_prong::Px, hf_reso_3_prong::Py, hf_reso_3_prong::Pz, + hf_track_vars_reduced::PtProng0, + hf_track_vars_reduced::PtProng1, + hf_track_vars_reduced::PtProng2, + hf_track_vars_reduced::EtaProng0, + hf_track_vars_reduced::EtaProng1, + hf_track_vars_reduced::EtaProng2, hf_reso_3_prong::InvMassDplus, - hf_reso_3_prong::InvMassDstar, - hf_reso_3_prong::InvMassAntiDstar, - hf_reso_3_prong::Pt); + hf_cand_dstar::InvMassDstar, + hf_cand_dstar::InvMassAntiDstar, + hf_cand_dstar::InvMassD0, + hf_cand_dstar::InvMassD0Bar, + hf_reso_3_prong::Pt, + hf_cand::PVectorProng0, + hf_cand::PVectorProng1, + hf_cand::PVectorProng2, + hf_reso_3_prong::PVector); namespace hf_reso_cand_reduced { DECLARE_SOA_COLUMN(InvMass, invMass, float); //! Invariant mass in GeV/c2 DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassD0, invMassD0, float); //! Invariant Mass of potential D0 daughter + DECLARE_SOA_COLUMN(MlScoreBkgProng0, mlScoreBkgProng0, float); //! Bkg ML score of the D daughter DECLARE_SOA_COLUMN(MlScorePromptProng0, mlScorePromptProng0, float); //! Prompt ML score of the D daughter DECLARE_SOA_COLUMN(MlScoreNonpromptProng0, mlScoreNonpromptProng0, float); //! Nonprompt ML score of the D daughter @@ -689,6 +814,7 @@ DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // fla DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // flag for decay channel classification generator level DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association at reconstruction level DECLARE_SOA_COLUMN(Origin, origin, int8_t); // Flag for origin of MC particle 1=promt, 2=FD +DECLARE_SOA_COLUMN(SignD0, signD0, int8_t); // Sign of the D0 in the channels with D* -> D0 pi, needed in case of non-matched D* DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! [](float pxProng0, float pxProng1, float pyProng0, float pyProng1) -> float { return RecoDecay::pt((1.f * pxProng0 + 1.f * pxProng1), (1.f * pyProng0 + 1.f * pyProng1)); }); @@ -706,10 +832,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarXiC3055, cosThetaStarXiC3055, //! costhet DECLARE_SOA_TABLE(HfCandCharmReso, "AOD", "HFCANDCHARMRESO", //! Table with Resonance candidate information for resonances reduced workflow o2::soa::Index<>, - // Indices - hf_track_index_reduced::HfRedCollisionId, - hf_reso_cand_reduced::Prong0Id, - hf_reso_cand_reduced::Prong1Id, // Static hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, @@ -719,16 +841,25 @@ DECLARE_SOA_TABLE(HfCandCharmReso, "AOD", "HFCANDCHARMRESO", //! Table with Reso hf_reso_v0::Cpa, hf_reso_v0::Dca, hf_reso_v0::Radius, + hf_reso_cand_reduced::InvMassD0, // Dynamic hf_reso_cand_reduced::Pt, hf_reso_cand_reduced::PtProng0, hf_reso_cand_reduced::PtProng1, + hf_reso_v0::Px, + hf_reso_v0::Py, + hf_reso_v0::Pz, hf_cand::PVectorProng0, hf_cand::PVectorProng1, hf_reso_cand_reduced::CosThetaStarDs1, hf_reso_cand_reduced::CosThetaStarDs2Star, hf_reso_cand_reduced::CosThetaStarXiC3055); +DECLARE_SOA_TABLE(HfResoIndices, "AOD", "HFRESOINDICES", //! Table with Indices of resonance daughters for MC matching + hf_track_index_reduced::HfRedCollisionId, + hf_reso_cand_reduced::Prong0Id, + hf_reso_cand_reduced::Prong1Id); + DECLARE_SOA_TABLE(HfCharmResoMLs, "AOD", "HFCHARMRESOML", //! Table with ML scores for the D daughter hf_reso_cand_reduced::MlScoreBkgProng0, hf_reso_cand_reduced::MlScorePromptProng0, @@ -743,6 +874,7 @@ DECLARE_SOA_TABLE(HfMcRecRedDV0s, "AOD", "HFMCRECREDDV0", //! Table with reconst hf_reso_cand_reduced::FlagMcMatchRec, hf_reso_cand_reduced::DebugMcRec, hf_reso_cand_reduced::Origin, + hf_reso_cand_reduced::SignD0, hf_b0_mc::PtMother, o2::soa::Marker<1>); diff --git a/PWGHF/D2H/Macros/HFInvMassFitter.h b/PWGHF/D2H/Macros/HFInvMassFitter.h index 6ac9357c5c2..410450de273 100644 --- a/PWGHF/D2H/Macros/HFInvMassFitter.h +++ b/PWGHF/D2H/Macros/HFInvMassFitter.h @@ -20,7 +20,8 @@ #ifndef PWGHF_D2H_MACROS_HFINVMASSFITTER_H_ #define PWGHF_D2H_MACROS_HFINVMASSFITTER_H_ -#include // std::string +#include // std::cout +#include // std::string #include #include @@ -121,7 +122,7 @@ class HFInvMassFitter : public TNamed { if (mean < meanLowLimit || mean > meanUpLimit) { - cout << "Invalid Gaussian mean limmit!" << endl; + std::cout << "Invalid Gaussian mean limmit!" << std::endl; } setInitialGaussianMean(mean); mMassLowLimit = meanLowLimit; @@ -132,7 +133,7 @@ class HFInvMassFitter : public TNamed { if (mean < meanLowLimit || mean > meanUpLimit) { - cout << "Invalid Gaussian mean limmit for reflection!" << endl; + std::cout << "Invalid Gaussian mean limmit for reflection!" << std::endl; } setInitialGaussianMean(mean); mMassReflLowLimit = meanLowLimit; @@ -153,7 +154,7 @@ class HFInvMassFitter : public TNamed void setFixSecondGaussianSigma(Double_t sigma) { if (mTypeOfSgnPdf != DoubleGaus) { - cout << "Fit type should be 2Gaus!" << endl; + std::cout << "Fit type should be 2Gaus!" << std::endl; } setInitialSecondGaussianSigma(sigma); mFixedSigmaDoubleGaus = kTRUE; @@ -162,7 +163,7 @@ class HFInvMassFitter : public TNamed { if (mTypeOfSgnPdf != DoubleGaus && mTypeOfSgnPdf != DoubleGausSigmaRatioPar) { - cout << "Fit type should be 2Gaus or 2GausSigmaRatio!" << endl; + std::cout << "Fit type should be 2Gaus or 2GausSigmaRatio!" << std::endl; } setInitialFracDoubleGaus(frac); mFixedFracDoubleGaus = kTRUE; @@ -170,7 +171,7 @@ class HFInvMassFitter : public TNamed void setFixRatioToGausSigma(Double_t sigmaFrac) { if (mTypeOfSgnPdf != DoubleGausSigmaRatioPar) { - cout << "Fit type should be set to k2GausSigmaRatioPar!" << endl; + std::cout << "Fit type should be set to k2GausSigmaRatioPar!" << std::endl; } setInitialRatioDoubleGausSigma(sigmaFrac); mFixedRatioDoubleGausSigma = kTRUE; diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index 0e39a651880..062fb658128 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -13,6 +13,8 @@ /// \brief Reconstruction of Resonance candidates /// /// \author Luca Aglietta , Università degli Studi di Torino +#include +#include #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" @@ -33,6 +35,7 @@ using namespace o2::aod; using namespace o2::analysis; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants::physics; enum Selections : uint8_t { NoSel = 0, @@ -56,10 +59,13 @@ enum V0Type : uint8_t { }; enum DecayTypeMc : uint8_t { - Ds1ToDStarK0ToD0PiK0s = 0, + Ds1ToDStarK0ToD0PiK0s = 1, Ds2StarToDplusK0sToPiKaPiPiPi, Ds1ToDStarK0ToDPlusPi0K0s, - Ds1ToDStarK0ToDPlusGammaK0s + Ds1ToDStarK0ToD0PiK0sPart, + Ds1ToDStarK0ToD0NoPiK0sPart, + Ds1ToDStarK0ToD0PiK0sOneMu, + Ds2StarToDplusK0sOneMu }; const int nBinsPt = 7; @@ -80,6 +86,8 @@ struct HfCandidateCreatorCharmResoReduced { Produces rowCandidateResoTrack; // Optional daughter ML scores table Produces mlScores; + // Table with candidate indices for MC matching + Produces rowCandidateResoIndices; // Configurables Configurable rejectDV0PairsWithCommonDaughter{"rejectDV0PairsWithCommonDaughter", true, "flag to reject the pairs that share a daughter track if not done in the derived data creation"}; @@ -91,43 +99,48 @@ struct HfCandidateCreatorCharmResoReduced { Configurable> cutsD{"cutsDdaughter", {hf_cuts_d_daughter::cuts[0], hf_cuts_d_daughter::nBinsPt, hf_cuts_d_daughter::nCutVars, hf_cuts_d_daughter::labelsPt, hf_cuts_d_daughter::labelsCutVar}, "D daughter selections"}; Configurable> binsPtD{"binsPtD", std::vector{hf_cuts_d_daughter::vecBinsPt}, "pT bin limits for D daughter cuts"}; Configurable> cutsV0{"cutsV0daughter", {hf_cuts_v0_daughter::cuts[0], hf_cuts_v0_daughter::nBinsPt, hf_cuts_v0_daughter::nCutVars, hf_cuts_v0_daughter::labelsPt, hf_cuts_v0_daughter::labelsCutVar}, "V0 daughter selections"}; - Configurable> binsPtV0{"binsPtV0", std::vector{hf_cuts_v0_daughter::vecBinsPt}, "pT bin limits for V0 daughter cuts"}; - using reducedDWithMl = soa::Join; + // Configurables for ME + Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; + Configurable numberEventsToSkip{"numberEventsToSkip", -1, "Number of events to Skip in ME process"}; + ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0., 45., 60., 75., 95, 250}, "event multiplicity pools (PV contributors for now)"}; + ConfigurableAxis zPoolBins{"zPoolBins", {VARIABLE_WIDTH, -10.0, -4, -1, 1, 4, 10.0}, "z vertex position pools"}; + + using HfRed3PrNoTrksWithMl = soa::Join; // Partition of V0 candidates based on v0Type Partition candidatesK0s = aod::hf_reso_v0::v0Type == (uint8_t)1 || aod::hf_reso_v0::v0Type == (uint8_t)3 || aod::hf_reso_v0::v0Type == (uint8_t)5; Partition candidatesLambda = aod::hf_reso_v0::v0Type == (uint8_t)2 || aod::hf_reso_v0::v0Type == (uint8_t)4; + SliceCache cache; Preslice candsV0PerCollision = aod::hf_track_index_reduced::hfRedCollisionId; - Preslice candsTrackPerCollision = aod::hf_track_index_reduced::hfRedCollisionId; + Preslice candsTrackPerCollision = aod::hf_track_index_reduced::hfRedCollisionId; Preslice candsDPerCollision = hf_track_index_reduced::hfRedCollisionId; - - // Useful constants - double massK0{0.}; - double massLambda{0.}; - double massProton{0.}; - double massDplus{0.}; - double massDstar{0.}; - double massD0{0.}; + Preslice candsDPerCollisionWithMl = hf_track_index_reduced::hfRedCollisionId; HistogramRegistry registry{"registry"}; void init(InitContext const&) { // check that only one process function is enabled - std::array doprocess{doprocessDs2StarToDplusK0s, doprocessDs2StarToDplusK0sWithMl, doprocessDs1ToDstarK0s, doprocessDs1ToDstarK0sWithMl, doprocessXcToDplusLambda, doprocessXcToDplusLambdaWithMl, doprocessLambdaDminus, doprocessLambdaDminusWithMl, doprocessDstarTrack, doprocessDstarTrackWithMl}; + std::array doprocess{doprocessDs2StarToDplusK0s, doprocessDs2StarToDplusK0sWithMl, doprocessDs1ToDstarK0s, doprocessDs1ToDstarK0sWithMl, doprocessDs1ToDstarK0sMixedEvent, doprocessDs1ToDstarK0sMixedEventWithMl, doprocessDs2StarToDplusK0sMixedEventWithMl, + doprocessXcToDplusLambda, doprocessXcToDplusLambdaWithMl, doprocessLambdaDminus, doprocessLambdaDminusWithMl, doprocessDstarTrack, doprocessDstarTrackWithMl}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "Only one process function should be enabled! Please check your configuration!"); } // histograms const AxisSpec axisPt{(std::vector)vecBinsPt, "#it{p}_{T} (GeV/#it{c})"}; - registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2.5, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassDs2Star", "Ds^{*}2 candidates; m_Ds^{*}2 (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassXcRes", "XcRes candidates; m_XcRes (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassLambdaDminus", "LambdaDminus candidates; m_LambdaDminus (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + const AxisSpec axisMassDsj{400, 0.49f, 0.89f, ""}; + registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMassDsj, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDs2Star", "Ds^{*}2 candidates; m_Ds^{*}2 (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {axisMassDsj, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassXcRes", "XcRes candidates; m_XcRes (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{300, 1.1, 1.4}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassLambdaDminus", "LambdaDminus candidates; m_LambdaDminus (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{300, 1.1, 1.4}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hMassDstarTrack", "DstarTrack candidates; m_DstarTrack (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 0.9, 1.4}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + if (doprocessDs1ToDstarK0sMixedEvent) { + registry.add("hNPvContCorr", "Collision number of PV contributors ; N contrib ; N contrib", {HistType::kTH2F, {{100, 0, 250}, {100, 0, 250}}}); + registry.add("hZvertCorr", "Collision Z Vtx ; z PV [cm] ; z PV [cm]", {HistType::kTH2F, {{120, -12., 12.}, {120, -12., 12.}}}); + } if (activateQA) { constexpr int kNBinsSelections = Selections::NSelSteps; @@ -142,14 +155,8 @@ struct HfCandidateCreatorCharmResoReduced { registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } } - // mass constants - massK0 = o2::constants::physics::MassK0Short; - massLambda = o2::constants::physics::MassLambda; - massProton = o2::constants::physics::MassProton; - massDplus = o2::constants::physics::MassDPlus; - massDstar = o2::constants::physics::MassDStar; - massD0 = o2::constants::physics::MassD0; } + /// Basic selection of D candidates /// \param candD is the reduced D meson candidate /// \return true if selections are passed @@ -162,14 +169,13 @@ struct HfCandidateCreatorCharmResoReduced { if (ptBin == -1) { return false; } - // slection on D candidate mass if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::XcToDplusLambda || channel == DecayChannel::LambdaDminus) { invMassD = candD.invMassDplus(); } else if (channel == DecayChannel::Ds1ToDstarK0s || channel == DecayChannel::DstarTrack) { if (candD.dType() > 0) - invMassD = candD.invMassDstar(); + invMassD = candD.invMassDstar() - candD.invMassD0(); else - invMassD = candD.invMassAntiDstar(); + invMassD = candD.invMassAntiDstar() - candD.invMassD0Bar(); } // invariant mass selection if (!keepSideBands) { @@ -202,10 +208,10 @@ struct HfCandidateCreatorCharmResoReduced { return false; } if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::Ds1ToDstarK0s) { - massV0 = massK0; + massV0 = MassK0Short; invMassV0 = candV0.invMassK0s(); } else if (channel == DecayChannel::XcToDplusLambda || channel == DecayChannel::LambdaDminus) { - massV0 = massLambda; + massV0 = MassLambda; int wsFact{1}; if (channel == DecayChannel::LambdaDminus) wsFact = -1; @@ -251,14 +257,18 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hSelections"), 1 + Selections::DSel); } float invMassD{0.}; + float invMassD0{0.}; if (std::abs(candD.dType()) == 1) invMassD = candD.invMassDplus(); - if (candD.dType() == 2) + if (candD.dType() == 2) { invMassD = candD.invMassDstar(); - if (candD.dType() == -2) + invMassD0 = candD.invMassD0(); + } + if (candD.dType() == -2) { invMassD = candD.invMassAntiDstar(); + invMassD0 = candD.invMassD0Bar(); + } std::array pVecD = {candD.px(), candD.py(), candD.pz()}; - std::array dDaughtersIds = {candD.prong0Id(), candD.prong1Id(), candD.prong2Id()}; // loop on V0 or track candidates bool alreadyCounted{false}; @@ -288,21 +298,30 @@ struct HfCandidateCreatorCharmResoReduced { float invMassReso{0.}; float invMassV0{0.}; std::array pVecV0Tr = {candV0Tr.px(), candV0Tr.py(), candV0Tr.pz()}; + std::array, 3> pVectorCharmProngs = {candD.pVectorProng0(), candD.pVectorProng1(), candD.pVectorProng2()}; float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0Tr, pVecD)); if constexpr (channel == DecayChannel::DstarTrack) { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDstar, massProton}); - registry.fill(HIST("hMassDstarTrack"), invMassReso, ptReso); + if (candD.dType() > 0) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}); + } else { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}); + } + registry.fill(HIST("hMassDstarTrack"), invMassReso - invMassD, ptReso); } else { switch (channel) { case DecayChannel::Ds1ToDstarK0s: invMassV0 = candV0Tr.invMassK0s(); - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDstar, massK0}); + if (candD.dType() > 0) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; + } registry.fill(HIST("hMassDs1"), invMassReso, ptReso); break; case DecayChannel::Ds2StarToDplusK0s: invMassV0 = candV0Tr.invMassK0s(); - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massK0}); + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; registry.fill(HIST("hMassDs2Star"), invMassReso, ptReso); break; case DecayChannel::XcToDplusLambda: @@ -311,7 +330,7 @@ struct HfCandidateCreatorCharmResoReduced { } else { invMassV0 = candV0Tr.invMassAntiLambda(); } - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massLambda}); + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; registry.fill(HIST("hMassXcRes"), invMassReso, ptReso); break; case DecayChannel::LambdaDminus: @@ -320,7 +339,7 @@ struct HfCandidateCreatorCharmResoReduced { } else { invMassV0 = candV0Tr.invMassAntiLambda(); } - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massLambda}); + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; registry.fill(HIST("hMassLambdaDminus"), invMassReso, ptReso); break; default: @@ -332,19 +351,20 @@ struct HfCandidateCreatorCharmResoReduced { rowCandidateResoTrack(pVecD[0], pVecD[1], pVecD[2], candV0Tr.px(), candV0Tr.py(), candV0Tr.pz(), invMassReso, - invMassD); + invMassD - invMassD0); } else { - rowCandidateReso(collision.globalIndex(), - candD.globalIndex(), - candV0Tr.globalIndex(), - pVecD[0], pVecD[1], pVecD[2], + rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], invMassReso, invMassD, invMassV0, candV0Tr.cpa(), candV0Tr.dca(), - candV0Tr.v0Radius()); + candV0Tr.v0Radius(), + invMassD0); + rowCandidateResoIndices(collision.globalIndex(), + candD.globalIndex(), + candV0Tr.globalIndex()); } if constexpr (fillMl) { mlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); @@ -352,7 +372,100 @@ struct HfCandidateCreatorCharmResoReduced { } } } // main function + // Process data with Mixed Event + /// \tparam fillMl is a flag to Fill ML scores if present + /// \tparam channel is the decay channel of the Resonance + /// \param Coll is the reduced collisions table + /// \param DRedTable is the D bachelors table + /// \param V0TrRedTable is the V0/Track bachelors table + template + void runCandidateCreationMixedEvent(Coll const& collisions, + DRedTable const& candsD, + V0TrRedTable const& candsV0Tr) + { + using BinningType = ColumnBinningPolicy; + BinningType corrBinning{{zPoolBins, multPoolBins}, true}; + auto bachTuple = std::make_tuple(candsD, candsV0Tr); + Pair pairs{corrBinning, numberEventsMixed, numberEventsToSkip, collisions, bachTuple, &cache}; + for (const auto& [collision1, bachDs, collision2, bachV0Trs] : pairs) { + registry.fill(HIST("hNPvContCorr"), collision1.numContrib(), collision2.numContrib()); + registry.fill(HIST("hZvertCorr"), collision1.posZ(), collision2.posZ()); + for (const auto& [bachD, bachV0Tr] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(bachDs, bachV0Trs))) { + // Apply analysis selections on D and V0 bachelors + if (!isDSelected(bachD) || !isV0Selected(bachV0Tr, bachD)) { + continue; + } + // Retrieve D and V0 informations + float invMassD{0.}; + float invMassD0{0.}; + if (std::abs(bachD.dType()) == 1) + invMassD = bachD.invMassDplus(); + if (bachD.dType() == 2) { + invMassD = bachD.invMassDstar(); + invMassD0 = bachD.invMassD0(); + } + if (bachD.dType() == -2) { + invMassD = bachD.invMassAntiDstar(); + invMassD0 = bachD.invMassD0Bar(); + } + std::array pVecD = {bachD.px(), bachD.py(), bachD.pz()}; + float invMassReso{0.}; + float invMassV0{0.}; + std::array pVecV0Tr = {bachV0Tr.px(), bachV0Tr.py(), bachV0Tr.pz()}; + float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0Tr, pVecD)); + switch (channel) { + case DecayChannel::Ds1ToDstarK0s: + invMassV0 = bachV0Tr.invMassK0s(); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassK0Short}); + registry.fill(HIST("hMassDs1"), invMassReso, ptReso); + break; + case DecayChannel::Ds2StarToDplusK0s: + invMassV0 = bachV0Tr.invMassK0s(); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassK0Short}); + registry.fill(HIST("hMassDs2Star"), invMassReso, ptReso); + break; + case DecayChannel::XcToDplusLambda: + if (bachD.dType() > 0) { + invMassV0 = bachV0Tr.invMassLambda(); + } else { + invMassV0 = bachV0Tr.invMassAntiLambda(); + } + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassLambda}); + registry.fill(HIST("hMassXcRes"), invMassReso, ptReso); + break; + case DecayChannel::LambdaDminus: + if (bachD.dType() < 0) { + invMassV0 = bachV0Tr.invMassLambda(); + } else { + invMassV0 = bachV0Tr.invMassAntiLambda(); + } + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassLambda}); + registry.fill(HIST("hMassLambdaDminus"), invMassReso, ptReso); + break; + default: + break; + } + // Fill output table + rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], + pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], + invMassReso, + invMassD, + invMassV0, + bachV0Tr.cpa(), + bachV0Tr.dca(), + bachV0Tr.v0Radius(), + invMassD0); + rowCandidateResoIndices(collision1.globalIndex(), + bachD.globalIndex(), + bachV0Tr.globalIndex()); + if constexpr (fillMl) { + mlScores(bachD.mlScoreBkgMassHypo0(), bachD.mlScorePromptMassHypo0(), bachD.mlScoreNonpromptMassHypo0()); + } + } + } + } // runCandidateCreationMixedEvent + // List of Process Functions void processDs2StarToDplusK0s(aod::HfRedCollisions const& collisions, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const&) @@ -372,13 +485,29 @@ struct HfCandidateCreatorCharmResoReduced { { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto candsDThisColl = candsD.sliceBy(candsDPerCollisionWithMl, thisCollId); auto k0sThisColl = candidatesK0s.sliceBy(candsV0PerCollision, thisCollId); runCandidateCreation(collision, candsDThisColl, k0sThisColl); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0sWithMl, "Process Ds2* candidates with Ml info", false); + void processDs2StarToDplusK0sMixedEvent(aod::HfRedCollisions const& collisions, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreationMixedEvent(collisions, candsD, candsV0); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0sMixedEvent, "Process Ds2Star mixed Event without ML", false); + + void processDs2StarToDplusK0sMixedEventWithMl(aod::HfRedCollisions const& collisions, + HfRed3PrNoTrksWithMl const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreationMixedEvent(collisions, candsD, candsV0); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0sMixedEventWithMl, "Process Ds2Star mixed Event with ML", false); + void processDs1ToDstarK0s(aod::HfRedCollisions const& collisions, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const&) @@ -393,18 +522,34 @@ struct HfCandidateCreatorCharmResoReduced { PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0s, "Process Ds1 candidates without Ml info", false); void processDs1ToDstarK0sWithMl(aod::HfRedCollisions const& collisions, - reducedDWithMl const& candsD, + HfRed3PrNoTrksWithMl const& candsD, aod::HfRedVzeros const&) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto candsDThisColl = candsD.sliceBy(candsDPerCollisionWithMl, thisCollId); auto k0sThisColl = candidatesK0s.sliceBy(candsV0PerCollision, thisCollId); runCandidateCreation(collision, candsDThisColl, k0sThisColl); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0sWithMl, "Process Ds1 candidates with Ml info", false); + void processDs1ToDstarK0sMixedEvent(aod::HfRedCollisions const& collisions, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreationMixedEvent(collisions, candsD, candsV0); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0sMixedEvent, "Process Ds1 mixed Event without ML", false); + + void processDs1ToDstarK0sMixedEventWithMl(aod::HfRedCollisions const& collisions, + HfRed3PrNoTrksWithMl const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreationMixedEvent(collisions, candsD, candsV0); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0sMixedEventWithMl, "Process Ds1 mixed Event with ML", false); + void processXcToDplusLambda(aod::HfRedCollisions const& collisions, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const&) @@ -419,12 +564,12 @@ struct HfCandidateCreatorCharmResoReduced { PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processXcToDplusLambda, "Process Xc candidates without Ml info", false); void processXcToDplusLambdaWithMl(aod::HfRedCollisions const& collisions, - soa::Join const& candsD, + HfRed3PrNoTrksWithMl const& candsD, aod::HfRedVzeros const&) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto candsDThisColl = candsD.sliceBy(candsDPerCollisionWithMl, thisCollId); auto lambdaThisColl = candidatesLambda.sliceBy(candsV0PerCollision, thisCollId); runCandidateCreation(collision, candsDThisColl, lambdaThisColl); } @@ -445,12 +590,12 @@ struct HfCandidateCreatorCharmResoReduced { PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processLambdaDminus, "Process LambdaDminus candidates without Ml info", false); void processLambdaDminusWithMl(aod::HfRedCollisions const& collisions, - soa::Join const& candsD, + HfRed3PrNoTrksWithMl const& candsD, aod::HfRedVzeros const&) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto candsDThisColl = candsD.sliceBy(candsDPerCollisionWithMl, thisCollId); auto lambdaThisColl = candidatesLambda.sliceBy(candsV0PerCollision, thisCollId); runCandidateCreation(collision, candsDThisColl, lambdaThisColl); } @@ -458,7 +603,7 @@ struct HfCandidateCreatorCharmResoReduced { PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processLambdaDminusWithMl, "Process LambdaDminus candidates with Ml info", false); void processDstarTrack(aod::HfRedCollisions const& collisions, aod::HfRed3PrNoTrks const& candsD, - soa::Join const& candidatesTrack) + aod::HfRedTrkNoParams const& candidatesTrack) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); @@ -470,13 +615,12 @@ struct HfCandidateCreatorCharmResoReduced { PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDstarTrack, "Process DStar candidates without Ml info", false); void processDstarTrackWithMl(aod::HfRedCollisions const& collisions, - soa::Join const& candsD, - soa::Join const& candidatesTrack) - // aod::HfRedTracks const&) + HfRed3PrNoTrksWithMl const& candsD, + aod::HfRedTrkNoParams const& candidatesTrack) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto candsDThisColl = candsD.sliceBy(candsDPerCollisionWithMl, thisCollId); auto trackThisColl = candidatesTrack.sliceBy(candsTrackPerCollision, thisCollId); runCandidateCreation(collision, candsDThisColl, trackThisColl); } @@ -489,22 +633,39 @@ struct HfCandidateCreatorCharmResoReducedExpressions { Produces rowResoMcRec; + using CandResoWithIndices = soa::Join; + + // Configurable axis + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0., 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 8.f, 12.f, 24.f, 50.f}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis axisInvMassReso{"axisInvMassReso", {400, 0.49f, 0.89f}, "inv. mass (DV_{0}) (GeV/#it{c}^{2})"}; + ConfigurableAxis axisInvMassProng0{"axisInvMassProng0", {200, 0.14, 0.17}, "inv. mass (D) (GeV/#it{c}^{2})"}; + ConfigurableAxis axisInvMassProng1{"axisInvMassProng1", {200, 0.47, 0.53}, "inv. mass ({V}_{0}) (GeV/#it{c}^{2})"}; + ConfigurableAxis axisInvMassD0{"axisInvMassD0", {200, 1.65, 2.05}, "inv. mass ({V}_{0}) (GeV/#it{c}^{2})"}; + ConfigurableAxis axisDebug{"axisDebug", {16, -0.5, 15.5}, "MC debug flag"}; + ConfigurableAxis axisOrigin{"axisOrigin", {3, -0.5, 2.5}, "MC origin flag"}; HistogramRegistry registry{"registry"}; void init(InitContext const&) { - const AxisSpec axisPt{(std::vector)vecBinsPt, "#it{p}_{T} (GeV/#it{c})"}; - registry.add("hMassMcMatched", "Reso MC candidates Matched with generate particle;m (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2.5, 2.7}, {axisPt}}}); - registry.add("hMassMcMatchedIncomplete", "Reso MC candidates Matched with generate particle w. Invcomplete decay;m (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2.5, 2.7}, {axisPt}}}); - registry.add("hMassMcUnmatched", "Reso MC candidates NOT Matched with generate particle;m (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2.5, 2.7}, {axisPt}}}); - registry.add("hMassMcNoEntry", "Reso MC candidates w.o. entry in MC Reco table;m (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2.5, 2.7}, {axisPt}}}); + registry.add("hMassMcMatched", "Reso MC candidates Matched with generate particle;m (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisInvMassReso, axisPt}}); + registry.add("hMassMcMatchedIncomplete", "Reso MC candidates Matched with generate particle w. Invcomplete decay;m (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisInvMassReso, axisPt}}); + registry.add("hMassMcUnmatched", "Reso MC candidates NOT Matched with generate particle;m (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisInvMassReso, axisPt}}); + registry.add("hMassMcNoEntry", "Reso MC candidates w.o. entry in MC Reco table;m (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisInvMassReso, axisPt}}); + registry.add("hMassMcMatchedVsBach0Mass", "Reso MC candidates Matched with generate particle;m (GeV/#it{c}^{2}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {axisInvMassReso, axisInvMassProng0}}); + registry.add("hMassMcUnmatchedVsBach0Mass", "Reso MC candidates Matched with generate particle w. Invcomplete decay;m (GeV/#it{c}^{2}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {axisInvMassReso, axisInvMassProng0}}); + registry.add("hMassMcMatchedVsBach1Mass", "Reso MC candidates NOT Matched with generate particle;m (GeV/#it{c}^{2}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {axisInvMassReso, axisInvMassProng1}}); + registry.add("hMassMcUnmatchedVsBach1Mass", "Reso MC candidates Matched with generate particle w. Invcomplete decay;m (GeV/#it{c}^{2}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {axisInvMassReso, axisInvMassProng1}}); + registry.add("hMassMcMatchedVsD0Mass", "Reso MC candidates NOT Matched with generate particle;m (GeV/#it{c}^{2}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {axisInvMassReso, axisInvMassD0}}); + registry.add("hMassMcUnmatchedVsD0Mass", "Reso MC candidates Matched with generate particle w. Invcomplete decay;m (GeV/#it{c}^{2}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {axisInvMassReso, axisInvMassD0}}); + registry.add("hMassMcUnmatchedVsDebug", "Reso MC candidates NOT Matched with generate particle;m (GeV/#it{c}^{2});debug flag", {HistType::kTH2F, {axisInvMassReso, axisDebug}}); + registry.add("hSparseUnmatchedDebug", "THn for debug of MC matching and Correlated BKG study", HistType::kTHnSparseF, {axisInvMassReso, axisPt, axisInvMassProng0, axisInvMassProng1, axisInvMassD0, axisDebug, axisOrigin}); } /// Fill candidate information at MC reconstruction level /// \param rowsDV0McRec MC reco information on DPi pairs /// \param candsReso prong global indices of B0 candidates template - void fillResoMcRec(McRec const& rowsDV0McRec, aod::HfCandCharmReso const& candsReso) + void fillResoMcRec(McRec const& rowsDV0McRec, CandResoWithIndices const& candsReso) { for (const auto& candReso : candsReso) { bool filledMcInfo{false}; @@ -514,12 +675,22 @@ struct HfCandidateCreatorCharmResoReducedExpressions { } rowResoMcRec(rowDV0McRec.flagMcMatchRec(), rowDV0McRec.debugMcRec(), rowDV0McRec.origin(), rowDV0McRec.ptMother()); filledMcInfo = true; - if (TESTBIT(rowDV0McRec.flagMcMatchRec(), DecayTypeMc::Ds1ToDStarK0ToD0PiK0s) || TESTBIT(rowDV0McRec.flagMcMatchRec(), DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi)) { + if (std::abs(rowDV0McRec.flagMcMatchRec()) == DecayTypeMc::Ds1ToDStarK0ToD0PiK0s || std::abs(rowDV0McRec.flagMcMatchRec()) == DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi || + std::abs(rowDV0McRec.flagMcMatchRec()) == DecayTypeMc::Ds1ToDStarK0ToD0PiK0sOneMu || std::abs(rowDV0McRec.flagMcMatchRec()) == DecayTypeMc::Ds2StarToDplusK0sOneMu) { registry.fill(HIST("hMassMcMatched"), candReso.invMass(), candReso.pt()); - } else if (TESTBIT(rowDV0McRec.flagMcMatchRec(), DecayTypeMc::Ds1ToDStarK0ToDPlusGammaK0s) || TESTBIT(rowDV0McRec.flagMcMatchRec(), DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s)) { + registry.fill(HIST("hMassMcMatchedVsBach0Mass"), candReso.invMass(), candReso.invMassProng0() - candReso.invMassD0()); + registry.fill(HIST("hMassMcMatchedVsBach1Mass"), candReso.invMass(), candReso.invMassProng1()); + registry.fill(HIST("hMassMcMatchedVsD0Mass"), candReso.invMass(), candReso.invMassD0()); + + } else if (std::abs(rowDV0McRec.flagMcMatchRec()) == DecayTypeMc::Ds1ToDStarK0ToD0NoPiK0sPart || std::abs(rowDV0McRec.flagMcMatchRec()) == DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s) { registry.fill(HIST("hMassMcMatchedIncomplete"), candReso.invMass(), candReso.pt()); } else { registry.fill(HIST("hMassMcUnmatched"), candReso.invMass(), candReso.pt()); + registry.fill(HIST("hMassMcUnmatchedVsBach0Mass"), candReso.invMass(), candReso.invMassProng0() - candReso.invMassD0()); + registry.fill(HIST("hMassMcUnmatchedVsBach1Mass"), candReso.invMass(), candReso.invMassProng1()); + registry.fill(HIST("hMassMcUnmatchedVsD0Mass"), candReso.invMass(), candReso.invMassD0()); + registry.fill(HIST("hMassMcUnmatchedVsDebug"), candReso.invMass(), rowDV0McRec.debugMcRec()); + registry.fill(HIST("hSparseUnmatchedDebug"), candReso.invMass(), candReso.pt(), candReso.invMassProng0() - candReso.invMassD0(), candReso.invMassProng1(), candReso.invMassD0(), rowDV0McRec.debugMcRec(), rowDV0McRec.origin()); } break; @@ -531,12 +702,16 @@ struct HfCandidateCreatorCharmResoReducedExpressions { } } - void processMc(aod::HfMcRecRedDV0s const& rowsDV0McRec, aod::HfCandCharmReso const& candsReso) + void processMc(aod::HfMcRecRedDV0s const& rowsDV0McRec, CandResoWithIndices const& candsReso) { fillResoMcRec(rowsDV0McRec, candsReso); } PROCESS_SWITCH(HfCandidateCreatorCharmResoReducedExpressions, processMc, "Process MC", false); + + void processDummy(CandResoWithIndices const&) {} + PROCESS_SWITCH(HfCandidateCreatorCharmResoReducedExpressions, processDummy, "Process dummy", true); }; + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc), diff --git a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx index 02db4418680..c5ed599c244 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx @@ -15,6 +15,9 @@ /// \author Alexandre Bigot , IPHC Strasbourg /// \author Fabrizio Grosa , CERN +#include +#include + #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -64,7 +67,7 @@ struct HfCandidateSelectorB0ToDPiReduced { Configurable> binsPtB0Ml{"binsPtB0Ml", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirB0Ml{"cutDirB0Ml", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsB0Ml{"cutsB0Ml", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesB0Ml{"nClassesB0Ml", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesB0Ml{"nClassesB0Ml", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -170,7 +173,7 @@ struct HfCandidateSelectorB0ToDPiReduced { } if constexpr (withDmesMl) { // we include it in the topological selections - if (!hfHelper.selectionDmesMlScoresForB(hfCandB0, cutsDmesMl, binsPtDmesMl)) { + if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandB0, cutsDmesMl, binsPtDmesMl)) { hfSelB0ToDPiCandidate(statusB0ToDPi); if (applyB0Ml) { hfMlB0ToDPiCandidate(outputMlNotPreselected); diff --git a/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx index 5a45f7c3fab..60649b57fdd 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx @@ -14,13 +14,16 @@ /// /// \author Antonio Palasciano , Università degli Studi di Bari +#include +#include + #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Common/Core/TrackSelectorPID.h" #include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/HfMlResponseBplusToD0Pi.h" +#include "PWGHF/Core/HfMlResponseBplusToD0PiReduced.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -63,7 +66,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { Configurable> binsPtBpMl{"binsPtBpMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirBpMl{"cutDirBpMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsBpMl{"cutsBpMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesBpMl{"nClassesBpMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesBpMl{"nClassesBpMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -75,7 +78,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { int mySelectionFlagD0 = -1; int mySelectionFlagD0bar = -1; - o2::analysis::HfMlResponseBplusToD0Pi hfMlResponse; + o2::analysis::HfMlResponseBplusToD0PiReduced hfMlResponse; float outputMlNotPreselected = -1.; std::vector outputMl = {}; o2::ccdb::CcdbApi ccdbApi; @@ -171,7 +174,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { } if constexpr (withDmesMl) { // we include it in the topological selections - if (!hfHelper.selectionDmesMlScoresForB(hfCandBp, cutsDmesMl, binsPtDmesMl)) { + if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandBp, cutsDmesMl, binsPtDmesMl)) { hfSelBplusToD0PiCandidate(statusBplus); if (applyBplusMl) { hfMlBplusToD0PiCandidate(outputMlNotPreselected); diff --git a/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx index 2c26a329243..9a6c47fce58 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx @@ -14,6 +14,9 @@ /// /// \author Fabio Catalano , CERN +#include +#include + #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -63,7 +66,7 @@ struct HfCandidateSelectorBsToDsPiReduced { Configurable> binsPtBsMl{"binsPtBsMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirBsMl{"cutDirBsMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsBsMl{"cutsBsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesBsMl{"nClassesBsMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesBsMl{"nClassesBsMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -139,7 +142,7 @@ struct HfCandidateSelectorBsToDsPiReduced { template void runSelection(Cands const& hfCandsBs, TracksPion const&, - HfCandBsConfigs const& configs) + HfCandBsConfigs const&) { for (const auto& hfCandBs : hfCandsBs) { int statusBsToDsPi = 0; @@ -161,7 +164,7 @@ struct HfCandidateSelectorBsToDsPiReduced { } if constexpr (withDmesMl) { // we include it in the topological selections - if (!hfHelper.selectionDmesMlScoresForB(hfCandBs, cutsDmesMl, binsPtDmesMl)) { + if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandBs, cutsDmesMl, binsPtDmesMl)) { hfSelBsToDsPiCandidate(statusBsToDsPi); if (applyBsMl) { hfMlBsToDsPiCandidate(outputMl); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 2058ac86611..3a52b39387f 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -83,6 +83,11 @@ struct HfDataCreatorCharmHadPiReduced { Produces hfCand3Prong; Produces hfCand3ProngCov; Produces hfCand3ProngMl; + // PID tables for charm-hadron candidate daughter tracks + Produces hfCandPidProng0; + Produces hfCandPidProng1; + Produces hfCandPidProng2; + // B-hadron config and MC related tables Produces rowCandidateConfigB0; Produces rowHfDPiMcRecReduced; @@ -150,16 +155,16 @@ struct HfDataCreatorCharmHadPiReduced { o2::vertexing::DCAFitterN<3> df3; o2::vertexing::DCAFitterN<2> df2; - using TracksPidPi = soa::Join; - using TracksPidWithSel = soa::Join; + using TracksPid = soa::Join; // TODO: revert to pion only once the Nsigma variables for the charm-hadron candidate daughters are in the candidate table for 3 prongs too + using TracksPidWithSel = soa::Join; using TracksPidWithSelAndMc = soa::Join; using CandsDplusFiltered = soa::Filtered>; using CandsDplusFilteredWithMl = soa::Filtered>; using CandsDsFiltered = soa::Filtered>; using CandsDsFilteredWithMl = soa::Filtered>; - using CandsD0Filtered = soa::Filtered>; - using CandsD0FilteredWithMl = soa::Filtered>; + using CandsD0Filtered = soa::Filtered>; + using CandsD0FilteredWithMl = soa::Filtered>; using CollisionsWMcLabels = soa::Join; @@ -840,6 +845,26 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad.setAbsCharge(0); // to be sure } + float ptDauMin = 1.e6, etaDauMin = 999.f, chi2TpcDauMax = -1.f; + int nItsClsDauMin = 8, nTpcCrossRowsDauMin = 200; + for (const auto& charmHadTrack : charmHadDauTracks) { + if (charmHadTrack.pt() < ptDauMin) { + ptDauMin = charmHadTrack.pt(); + } + if (std::abs(charmHadTrack.eta()) < etaDauMin) { + etaDauMin = std::abs(charmHadTrack.eta()); + } + if (charmHadTrack.itsNCls() < nItsClsDauMin) { + nItsClsDauMin = charmHadTrack.itsNCls(); + } + if (charmHadTrack.tpcNClsCrossedRows() < nTpcCrossRowsDauMin) { + nTpcCrossRowsDauMin = charmHadTrack.tpcNClsCrossedRows(); + } + if (charmHadTrack.tpcChi2NCl() > chi2TpcDauMax) { + chi2TpcDauMax = charmHadTrack.tpcChi2NCl(); + } + } + for (const auto& trackId : trackIndices) { auto trackPion = trackId.template track_as(); @@ -881,7 +906,8 @@ struct HfDataCreatorCharmHadPiReduced { hfTrackPion(trackPion.globalIndex(), indexHfReducedCollision, trackParCovPion.getX(), trackParCovPion.getAlpha(), trackParCovPion.getY(), trackParCovPion.getZ(), trackParCovPion.getSnp(), - trackParCovPion.getTgl(), trackParCovPion.getQ2Pt()); + trackParCovPion.getTgl(), trackParCovPion.getQ2Pt(), + trackPion.itsNCls(), trackPion.tpcNClsCrossedRows(), trackPion.tpcChi2NCl()); hfTrackCovPion(trackParCovPion.getSigmaY2(), trackParCovPion.getSigmaZY(), trackParCovPion.getSigmaZ2(), trackParCovPion.getSigmaSnpY(), trackParCovPion.getSigmaSnpZ(), trackParCovPion.getSigmaSnp2(), trackParCovPion.getSigmaTglY(), trackParCovPion.getSigmaTglZ(), @@ -913,13 +939,17 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), - candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1); + candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, + ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); hfCand3ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); + hfCandPidProng0(charmHadDauTracks[0].tpcNSigmaPi(), charmHadDauTracks[0].tofNSigmaPi(), charmHadDauTracks[0].tpcNSigmaKa(), charmHadDauTracks[0].tofNSigmaKa(), charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); + hfCandPidProng1(charmHadDauTracks[1].tpcNSigmaPi(), charmHadDauTracks[1].tofNSigmaPi(), charmHadDauTracks[1].tpcNSigmaKa(), charmHadDauTracks[1].tofNSigmaKa(), charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); + hfCandPidProng2(charmHadDauTracks[2].tpcNSigmaPi(), charmHadDauTracks[2].tofNSigmaPi(), charmHadDauTracks[2].tpcNSigmaKa(), charmHadDauTracks[2].tofNSigmaKa(), charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); if constexpr (withMl) { if constexpr (decChannel == DecayChannel::B0ToDminusPi) { hfCand3ProngMl(candC.mlProbDplusToPiKPi()[0], candC.mlProbDplusToPiKPi()[1], candC.mlProbDplusToPiKPi()[2], -1., -1., -1.); @@ -940,13 +970,16 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), - candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1); + candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, + ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); hfCand2ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); + hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); + hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); if constexpr (withMl) { std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; if (candC.mlProbD0().size() == 3) { diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index f1cce927da1..e39e9eab1ff 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -15,8 +15,11 @@ /// \author Luca Aglietta , UniTO Turin /// \author Fabrizio Grosa , CERN +#include #include #include +#include +#include #include "DetectorsBase/Propagator.h" #include "CommonConstants/PhysicsConstants.h" @@ -74,17 +77,22 @@ enum DType : uint8_t { }; enum DecayTypeMc : uint8_t { - Ds1ToDStarK0ToD0PiK0s = 0, - Ds2StarToDplusK0s, + Ds1ToDStarK0ToD0PiK0s = 1, + Ds2StarToDplusK0sToPiKaPiPiPi, Ds1ToDStarK0ToDPlusPi0K0s, - Ds1ToDStarK0ToD0PiK0sPart + Ds1ToDStarK0ToD0PiK0sPart, + Ds1ToDStarK0ToD0NoPiK0sPart, + Ds1ToDStarK0ToD0PiK0sOneMu, + Ds2StarToDplusK0sOneMu }; enum PartialMatchMc : uint8_t { K0Matched = 0, D0Matched, DStarMatched, - DPlusMatched + DPlusMatched, + K0MuMatched, + DStarMuMatched }; /// Creation of D-V0 pairs @@ -109,7 +117,7 @@ struct HfDataCreatorCharmResoReduced { Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; Configurable propagateV0toPV{"propagateV0toPV", false, "Enable or disable V0 propagation to V0"}; - o2::framework::Configurable rejectBackground{"rejectBackground", true, "Reject particles from background events"}; + Configurable doMcRecQa{"doMcRecQa", true, "Fill QA histograms for Mc matching"}; int runNumber{0}; // needed to detect if the run changed and trigger update of calibrations etc. // selection D @@ -181,6 +189,13 @@ struct HfDataCreatorCharmResoReduced { uint8_t v0Type; } candidateV0; + struct { + float invMassD; + float ptD; + float invMassDdau; + float invMassKPiPiV0; + float ptReso; + } varUtils; using CandsDplusFiltered = soa::Filtered>; using CandsDplusFilteredWithMl = soa::Filtered>; using CandDstarFiltered = soa::Filtered>; @@ -222,6 +237,7 @@ struct HfDataCreatorCharmResoReduced { const AxisSpec axisMassDstar{200, 0.139f, 0.179f, ""}; const AxisSpec axisMassLambda{100, 1.05f, 1.35f, ""}; const AxisSpec axisMassKzero{100, 0.35f, 0.65f, ""}; + const AxisSpec axisMassDsj{400, 0.49f, 0.89f, ""}; registry.add("hMassVsPtDplusAll", "Dplus candidates (all, regardless the pairing with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDplus}}); registry.add("hMassVsPtDstarAll", "Dstar candidates (all, regardless the pairing with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDstar}}); @@ -232,8 +248,8 @@ struct HfDataCreatorCharmResoReduced { registry.add("hMassVsPtLambda", "Lambda candidates;#it{p}_{T} (GeV/#it{c});inv. mass (p #pi^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassLambda}}); registry.add("hdEdxVsP", "Tracks;#it{p} (GeV/#it{c});d#it{E}/d#it{x};entries", {HistType::kTH2F, {axisP, axisDeDx}}); - registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{400, 0.49, 0.89}}}); - registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{400, 0.49, 0.89}}}); + registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {axisMassDsj}}); + registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {axisMassDsj}}); registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{300, 1.1, 1.4}}}); registry.add("hMassDstarProton", "D^{*}-proton candidates;m_{D^{*}p} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0.9, 1.4}}}); registry.add("hDType", "D selection flag", {HistType::kTH1F, {{5, -2.5, 2.5}}}); @@ -247,6 +263,26 @@ struct HfDataCreatorCharmResoReduced { registry.add("hMCGenOrigin", "Origin of Generated particles", {HistType::kTH1F, {{3, -0.5, 2.5}}}); registry.add("hMCOriginCounterWrongDecay", "Origin of Generated particles in Wrong decay", {HistType::kTH1F, {{3, -0.5, 2.5}}}); + if (doMcRecQa) { + registry.add("hMassVsPtK0Matched", "K0s candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassKzero}}); + registry.add("hMassVsPtD0Matched", "D0 candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDstarMatched", "Dstar candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDstar}}); + registry.add("hMassVsPtDplusMatched", "Dplus candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDs1Matched", "Ds1 candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtDs2StarMatched", "Ds2Star candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtK0MatchedPiToMu", "K0s candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassKzero}}); + registry.add("hMassVsPtD0MatchedPiToMu", "D0 candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDstarMatchedPiToMu", "Dstar candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDstar}}); + registry.add("hMassVsPtDplusMatchedPiToMu", "Dplus candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDs1MatchedPiToMu", "Ds1 candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtDs2StarMatchedPiToMu", "Ds2Star candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtD0MatchedKaToPi", "D0 candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDstarMatchedKaToPi", "Dstar candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDstar}}); + registry.add("hMassVsPtDplusMatchedKaToPi", "Dplus candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDs1MatchedKaToPi", "Ds1 candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtDs2StarMatchedKaToPi", "Ds2Star candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPt, axisMassDsj}}); + } + // Configure CCDB access ccdb->setURL(url.value); ccdb->setCaching(true); @@ -510,59 +546,129 @@ struct HfDataCreatorCharmResoReduced { int8_t flag{0}; int8_t debug{0}; int8_t origin{0}; + int8_t nPiToMuReso{0}, nPiToMuV0, nPiToMuD0{0}, nPiToMuDstar{0}, nPiToMuDplus{0}; + int8_t nKaToPiReso{0}, nKaToPiV0, nKaToPiD0{0}, nKaToPiDstar{0}, nKaToPiDplus{0}; std::vector idxBhadMothers{}; float motherPt{-1.f}; + int indexRecReso{-1}, indexRecDstar{-1}, indexRecDplus{-1}, indexRecD0{-1}, indexRecK0{-1}, indexRecResoPartReco{-1}; if constexpr (decChannel == DecayChannel::DstarV0) { // Ds1 → D* K0 → (D0 π+) K0s → ((K-π+) π+)(π+π-) - auto indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); - if (indexRecReso > -1) { - // D* → π- K+ π- - auto indexRecDstar = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDStar, 2); - auto indexRecD0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 1); - auto indexRecK0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2); - if (indexRecDstar > -1 && indexRecD0 > -1 && indexRecK0 > -1) { - flag = sign * BIT(DecayTypeMc::Ds1ToDStarK0ToD0PiK0s); + indexRecD0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 1, &nPiToMuD0, &nKaToPiD0); + indexRecK0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2, &nPiToMuV0, &nKaToPiV0); + if (indexRecD0 > -1) { + indexRecDstar = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDStar, 2, &nPiToMuDstar, &nKaToPiDstar); + } + if (indexRecD0 > -1 && indexRecDstar > -1 && indexRecK0 > -1) { + indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3, &nPiToMuReso, &nKaToPiReso); + if (indexRecReso > -1 && nPiToMuReso == 0 && nKaToPiReso == 0) { + flag = sign * DecayTypeMc::Ds1ToDStarK0ToD0PiK0s; + } else if (indexRecReso > -1 && nPiToMuReso >= 1 && nKaToPiReso == 0) { + flag = sign * DecayTypeMc::Ds1ToDStarK0ToD0PiK0sOneMu; } - } else if (RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3) > -1) { // Verify partly reconstructed decay Ds1 -> D* K0s -> D+ π0 K0s - auto indexRecDstar = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDStar, 2); - auto indexRecK0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2); - if (indexRecDstar > -1 && indexRecK0 > -1) { - if (RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDPlus, 2) > -1) { - flag = sign * BIT(DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s); - } else if (RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 2) > -1) { - flag = sign * BIT(DecayTypeMc::Ds1ToDStarK0ToD0PiK0sPart); + } + + // Ds1+ not matched: we check if it is partially reco + if (indexRecReso < 0) { + indexRecResoPartReco = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); + indexRecDplus = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDPlus, 2); + if (indexRecResoPartReco > -1) { // we look for decays of D* or D0 with more daughters + if (indexRecDstar < 0 && indexRecK0 > -1) { + auto indexRecDstarPartReco = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDStar, 3); + if (indexRecDstarPartReco > -1) { + if (indexRecDplus > -1) { // Ds1 -> D* K0s -> D+ π0 K0s + flag = sign * DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s; + } else { + auto indexRecDzeroPartReco = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 2); + if (indexRecDzeroPartReco > -1) { // Ds1 -> D* K0s -> D0 π+ K0s -> K- π+ π0 π+ K0s + flag = sign * DecayTypeMc::Ds1ToDStarK0ToD0PiK0sPart; + } + } + } + } + } else { // we look for D* not matched, but all the other ones yes, we check if we only lost the soft pion + if (indexRecD0 > -1 && indexRecK0 > -1 && indexRecDstar < 0) { + indexRecResoPartReco = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); + if (indexRecResoPartReco > -1) { + flag = sign * DecayTypeMc::Ds1ToDStarK0ToD0NoPiK0sPart; + } } } } if (flag != 0) { - auto particleReso = particlesMc.iteratorAt(indexRecReso); + int indexParticle{-1}; + if (indexRecReso > -1) { + indexParticle = indexRecReso; + } else if (indexRecResoPartReco > -1) { + indexParticle = indexRecResoPartReco; + } + auto particleReso = particlesMc.iteratorAt(indexParticle); origin = RecoDecay::getCharmHadronOrigin(particlesMc, particleReso, false, &idxBhadMothers); + motherPt = particleReso.pt(); } - } else if constexpr (decChannel == DecayChannel::DplusV0) { - // Ds2Star → D+ K0 → (π+K-π+) K0s → (π+K-π+)(π+π-) - auto indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS2Star, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); - if (indexRecReso > -1) { - // D+ → π+ K- π+ - auto indexRecDplus = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDPlus, 2); - auto indexRecK0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2); - if (indexRecDplus > -1 && indexRecK0 > -1) { - flag = sign * BIT(DecayTypeMc::Ds2StarToDplusK0s); + if (doMcRecQa) { + if (indexRecReso > -1) { + if (nPiToMuReso == 0 && nKaToPiReso == 0) { + registry.fill(HIST("hMassVsPtDs1Matched"), varUtils.ptD, varUtils.invMassKPiPiV0 - varUtils.invMassD); + } + if (nPiToMuReso >= 1) { + registry.fill(HIST("hMassVsPtDs1MatchedPiToMu"), varUtils.ptD, varUtils.invMassKPiPiV0 - varUtils.invMassD); + } + if (nKaToPiReso >= 1) { + registry.fill(HIST("hMassVsPtDs1MatchedKaToPi"), varUtils.ptD, varUtils.invMassKPiPiV0 - varUtils.invMassD); + } } - auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersReso.back().template mcParticle_as(), Pdg::kDS2Star, true); - if (indexMother >= 0) { - auto particleMother = particlesMc.rawIteratorAt(indexMother); - motherPt = particleMother.pt(); + if (indexRecD0 > -1) { + if (nPiToMuD0 == 0 && nKaToPiD0 == 0) { + registry.fill(HIST("hMassVsPtD0Matched"), varUtils.ptD, varUtils.invMassDdau); + } + if (nPiToMuD0 >= 1) { + registry.fill(HIST("hMassVsPtD0MatchedPiToMu"), varUtils.ptD, varUtils.invMassDdau); + } + if (nKaToPiD0 >= 1) { + registry.fill(HIST("hMassVsPtD0MatchedKaToPi"), varUtils.ptD, varUtils.invMassDdau); + } } - } else { // Verify partly reconstructed decay Ds1 -> D* K0s -> D+ π0 K0s - indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); - if (indexRecReso > -1) { - auto indexRecDstar = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDStar, 2); - auto indexRecK0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2); - if (indexRecDstar > -1 && indexRecK0 > -1) { - auto indexRecDplus = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2); - if (indexRecDplus > -1) { - flag = sign * BIT(DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s); + if (indexRecDstar > -1) { + if (nPiToMuDstar == 0 && nKaToPiDstar == 0) { + registry.fill(HIST("hMassVsPtDstarMatched"), varUtils.ptD, varUtils.invMassD - varUtils.invMassDdau); + } + if (nPiToMuDstar >= 1) { + registry.fill(HIST("hMassVsPtDstarMatchedPiToMu"), varUtils.ptD, varUtils.invMassD - varUtils.invMassDdau); + } + if (nKaToPiDstar >= 1) { + registry.fill(HIST("hMassVsPtDstarMatchedKaToPi"), varUtils.ptD, varUtils.invMassD - varUtils.invMassDdau); + } + } + if (indexRecK0 > -1) { + if (nPiToMuV0 == 0 && nKaToPiV0 == 0) { + registry.fill(HIST("hMassVsPtK0Matched"), candidateV0.pT, candidateV0.mK0Short); + } + if (nPiToMuV0 >= 1) { + registry.fill(HIST("hMassVsPtK0MatchedPiToMu"), candidateV0.pT, candidateV0.mK0Short); + } + if (nKaToPiV0 >= 1) { + registry.fill(HIST("hMassVsPtK0MatchedKaToPi"), candidateV0.pT, candidateV0.mK0Short); + } + } + } + } else if constexpr (decChannel == DecayChannel::DplusV0) { + // Ds2Star → D+ K0 → (π+K-π+) K0s → (π+K-π+)(π+π-) + indexRecK0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2, &nPiToMuV0, &nKaToPiV0); + indexRecDplus = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDPlus, 2, &nPiToMuDplus, &nKaToPiDplus); + if (indexRecK0 > -1 && indexRecDplus > -1) { + indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS2Star, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3, &nPiToMuReso, &nKaToPiReso); + if (indexRecReso > -1 && nPiToMuReso == 0 && nKaToPiReso == 0) { + flag = sign * DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi; + } else if (indexRecReso > -1 && nPiToMuReso >= 1 && nKaToPiReso == 0) { + flag = sign * DecayTypeMc::Ds2StarToDplusK0sOneMu; + } else if (indexRecReso < 0) { + // Verify partly reconstructed decay Ds1 -> D* K0s -> D+ π0 K0s + indexRecDstar = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDStar, 2); + if (indexRecDstar > -1) { + indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); + if (indexRecReso > -1) { + flag = sign * DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s; } } } @@ -570,27 +676,63 @@ struct HfDataCreatorCharmResoReduced { if (flag != 0) { auto particleReso = particlesMc.iteratorAt(indexRecReso); origin = RecoDecay::getCharmHadronOrigin(particlesMc, particleReso, false, &idxBhadMothers); + motherPt = particleReso.pt(); } - } + if (doMcRecQa) { + if (indexRecReso > -1) { + if (nPiToMuReso == 0 && nKaToPiReso == 0) { + registry.fill(HIST("hMassVsPtDs2StarMatched"), varUtils.ptD, varUtils.invMassKPiPiV0 - varUtils.invMassD); + } + if (nPiToMuReso >= 1) { + registry.fill(HIST("hMassVsPtDs2StarMatchedPiToMu"), varUtils.ptD, varUtils.invMassKPiPiV0 - varUtils.invMassD); + } + if (nKaToPiReso >= 1) { + registry.fill(HIST("hMassVsPtDs2StarMatchedKaToPi"), varUtils.ptD, varUtils.invMassKPiPiV0 - varUtils.invMassD); + } + } + if (indexRecDplus > -1) { + if (nPiToMuDplus == 0 && nKaToPiDplus == 0) { + registry.fill(HIST("hMassVsPtDplusMatched"), varUtils.ptD, varUtils.invMassD); + } + if (nPiToMuDplus >= 1) { + registry.fill(HIST("hMassVsPtDplusMatchedPiToMu"), varUtils.ptD, varUtils.invMassD); + } + if (nKaToPiDplus >= 1) { + registry.fill(HIST("hMassVsPtDplusMatchedKaToPi"), varUtils.ptD, varUtils.invMassD); + } + } + if (indexRecK0 > -1) { + if (nPiToMuV0 == 0 && nKaToPiV0 == 0) { + registry.fill(HIST("hMassVsPtK0Matched"), candidateV0.pT, candidateV0.mK0Short); + } + if (nPiToMuV0 >= 1) { + registry.fill(HIST("hMassVsPtK0MatchedPiToMu"), candidateV0.pT, candidateV0.mK0Short); + } + if (nKaToPiV0 >= 1) { + registry.fill(HIST("hMassVsPtK0MatchedKaToPi"), candidateV0.pT, candidateV0.mK0Short); + } + } + } + } // DecayChannel::DplusV0 if (flag != 0) { registry.fill(HIST("hMCRecCounter"), flag); registry.fill(HIST("hMCRecOrigin"), origin); } else { - if (RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2) > -1) { + if (indexRecK0 > -1) { SETBIT(debug, PartialMatchMc::K0Matched); } - if (RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 1) > -1) { + if (indexRecD0 > -1) { SETBIT(debug, PartialMatchMc::D0Matched); } - if (RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDStar, 2) > -1) { + if (indexRecDstar > -1) { SETBIT(debug, PartialMatchMc::DStarMatched); } - if (RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDPlus, 2) > -1) { + if (indexRecDplus > -1) { SETBIT(debug, PartialMatchMc::DPlusMatched); } registry.fill(HIST("hMCRecDebug"), debug); } - rowHfDV0McRecReduced(indexHfCandCharm, indexCandV0, flag, debug, origin, motherPt); + rowHfDV0McRecReduced(indexHfCandCharm, indexCandV0, flag, debug, origin, signD0, motherPt); } template @@ -620,7 +762,6 @@ struct HfDataCreatorCharmResoReduced { for (const auto& candD : candsD) { // initialize variables depending on decay channel bool fillHfCandD = false; - float invMassD{0.f}, invMassDdau{0.f}; std::array pVecD; std::array pVecProng2; std::array secondaryVertexD; @@ -628,13 +769,14 @@ struct HfDataCreatorCharmResoReduced { int8_t dtype; std::array bdtScores; std::vector charmHadDauTracks{}; + varUtils.ptD = candD.pt(); if constexpr (DecayChannel == DecayChannel::DstarV0 || DecayChannel == DecayChannel::DstarTrack) { if (candD.signSoftPi() > 0) { - invMassD = candD.invMassDstar(); - invMassDdau = candD.invMassD0(); + varUtils.invMassD = candD.invMassDstar(); + varUtils.invMassDdau = candD.invMassD0(); } else { - invMassD = candD.invMassAntiDstar(); - invMassDdau = candD.invMassD0Bar(); + varUtils.invMassD = candD.invMassAntiDstar(); + varUtils.invMassDdau = candD.invMassD0Bar(); } pVecD = candD.pVector(); secondaryVertexD[0] = candD.xSecondaryVertexD0(); @@ -651,10 +793,10 @@ struct HfDataCreatorCharmResoReduced { if constexpr (withMl) { std::copy(candD.mlProbDstarToD0Pi().begin(), candD.mlProbDstarToD0Pi().end(), bdtScores.begin()); } - registry.fill(HIST("hMassVsPtDstarAll"), candD.pt(), invMassD - invMassDdau); + registry.fill(HIST("hMassVsPtDstarAll"), candD.pt(), varUtils.invMassD - varUtils.invMassDdau); } else if constexpr (DecayChannel == DecayChannel::DplusV0) { auto prong0 = candD.template prong0_as
(); - invMassD = hfHelper.invMassDplusToPiKPi(candD); + varUtils.invMassD = hfHelper.invMassDplusToPiKPi(candD); pVecD = candD.pVector(); secondaryVertexD[0] = candD.xSecondaryVertex(); secondaryVertexD[1] = candD.ySecondaryVertex(); @@ -668,19 +810,49 @@ struct HfDataCreatorCharmResoReduced { charmHadDauTracks.push_back(candD.template prong1_as
()); charmHadDauTracks.push_back(candD.template prong2_as
()); if constexpr (withMl) { - registry.fill(HIST("hMassVsPtDplusAll"), candD.pt(), invMassD); + registry.fill(HIST("hMassVsPtDplusAll"), candD.pt(), varUtils.invMassD); } } // else if + // Get single track variables + float chi2TpcDauMax = -1.f; + int nItsClsDauMin = 8, nTpcCrossRowsDauMin = 200; + for (const auto& charmHadTrack : charmHadDauTracks) { + if (charmHadTrack.itsNCls() < nItsClsDauMin) { + nItsClsDauMin = charmHadTrack.itsNCls(); + } + if (charmHadTrack.tpcNClsCrossedRows() < nTpcCrossRowsDauMin) { + nTpcCrossRowsDauMin = charmHadTrack.tpcNClsCrossedRows(); + } + if (charmHadTrack.tpcChi2NCl() > chi2TpcDauMax) { + chi2TpcDauMax = charmHadTrack.tpcChi2NCl(); + } + } + if constexpr (DecayChannel == DecayChannel::DplusV0 || DecayChannel == DecayChannel::DstarV0) { // Loop on V0 candidates for (const auto& v0 : bachelors) { auto trackPos = v0.template posTrack_as
(); auto trackNeg = v0.template negTrack_as
(); // Apply selsection - if (!buildAndSelectV0(collision, prongIdsD, std::array{trackPos, trackNeg})) { + auto v0DauTracks = std::array{trackPos, trackNeg}; + if (!buildAndSelectV0(collision, prongIdsD, v0DauTracks)) { continue; } + // Get single track variables + float chi2TpcDauV0Max = -1.f; + int nItsClsDauV0Min = 8, nTpcCrossRowsDauV0Min = 200; + for (const auto& v0Track : v0DauTracks) { + if (v0Track.itsNCls() < nItsClsDauV0Min) { + nItsClsDauV0Min = v0Track.itsNCls(); + } + if (v0Track.tpcNClsCrossedRows() < nTpcCrossRowsDauV0Min) { + nTpcCrossRowsDauV0Min = v0Track.tpcNClsCrossedRows(); + } + if (v0Track.tpcChi2NCl() > chi2TpcDauV0Max) { + chi2TpcDauV0Max = v0Track.tpcChi2NCl(); + } + } // propagate V0 to primary vertex (if enabled) if (propagateV0toPV) { std::array pVecV0Orig = {candidateV0.mom[0], candidateV0.mom[1], candidateV0.mom[2]}; @@ -691,42 +863,42 @@ struct HfDataCreatorCharmResoReduced { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParK0, 2.f, matCorr, &dcaInfo); getPxPyPz(trackParK0, candidateV0.mom); } - float invMassKPiPiV0{0.f}; if (TESTBIT(candidateV0.v0Type, K0s)) { if constexpr (DecayChannel == DecayChannel::DplusV0) { - invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVectorProng2(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + varUtils.invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVectorProng2(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + // varUtils.ptReso = RecoDecay::pt(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVectorProng2(), candidateV0.mom}); } else if (DecayChannel == DecayChannel::DstarV0) { + // varUtils.ptReso = RecoDecay::pt(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVecSoftPi(), candidateV0.mom}); if (candD.signSoftPi() > 0) { - invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVecSoftPi(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + varUtils.invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVecSoftPi(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); } else { - invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng1(), candD.pVectorProng0(), candD.pVecSoftPi(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + varUtils.invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng1(), candD.pVectorProng0(), candD.pVecSoftPi(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); } } - registry.fill(HIST("hMassVsPtK0s"), candidateV0.pT, candidateV0.mK0Short); if constexpr (DecayChannel == DecayChannel::DstarV0) { - registry.fill(HIST("hMassDs1"), invMassKPiPiV0 - invMassD); + registry.fill(HIST("hMassDs1"), varUtils.invMassKPiPiV0 - varUtils.invMassD); } else if constexpr (DecayChannel == DecayChannel::DplusV0) { - registry.fill(HIST("hMassDsStar2"), invMassKPiPiV0 - invMassD); + registry.fill(HIST("hMassDsStar2"), varUtils.invMassKPiPiV0 - varUtils.invMassD); } } bool isLambda = TESTBIT(candidateV0.v0Type, Lambda); bool isAntiLambda = TESTBIT(candidateV0.v0Type, AntiLambda); if (isLambda || isAntiLambda) { if constexpr (DecayChannel == DecayChannel::DplusV0) { - invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVectorProng2(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda0}); + varUtils.invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVectorProng2(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda0}); } else if (DecayChannel == DecayChannel::DstarV0) { if (candD.signSoftPi() > 0) { - invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVecSoftPi(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda0}); + varUtils.invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng0(), candD.pVectorProng1(), candD.pVecSoftPi(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda0}); } else { - invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng1(), candD.pVectorProng0(), candD.pVecSoftPi(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda0}); + varUtils.invMassKPiPiV0 = RecoDecay::m(std::array{candD.pVectorProng1(), candD.pVectorProng0(), candD.pVecSoftPi(), candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda0}); } } if (isLambda || isAntiLambda) { registry.fill(HIST("hMassVsPtLambda"), candidateV0.pT, candidateV0.mLambda); } if constexpr (DecayChannel == DecayChannel::DplusV0) { - registry.fill(HIST("hMassXcRes"), invMassKPiPiV0 - invMassD); + registry.fill(HIST("hMassXcRes"), varUtils.invMassKPiPiV0 - varUtils.invMassD); } } // fill V0 table @@ -739,6 +911,7 @@ struct HfDataCreatorCharmResoReduced { candidateV0.momNeg[0], candidateV0.momNeg[1], candidateV0.momNeg[2], candidateV0.cosPA, candidateV0.dcaV0ToPv, + nItsClsDauV0Min, nTpcCrossRowsDauV0Min, chi2TpcDauV0Max, candidateV0.v0Type); selectedV0s[v0.globalIndex()] = hfCandV0.lastIndex(); } @@ -779,13 +952,13 @@ struct HfDataCreatorCharmResoReduced { } else { invMassKPiPiP = RecoDecay::m(std::array{candD.pVectorProng1(), candD.pVectorProng0(), candD.pVecSoftPi(), pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}); } - registry.fill(HIST("hMassDstarProton"), invMassKPiPiP - invMassD); + registry.fill(HIST("hMassDstarProton"), invMassKPiPiP - varUtils.invMassD); if (!selectedTracks.count(track.globalIndex())) { hfTrackNoParam(indexHfReducedCollision, track.px(), track.py(), track.pz(), track.sign(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.hasTOF()); + track.hasTOF(), track.hasTPC(), track.itsNCls(), track.tpcNClsCrossedRows(), track.tpcChi2NCl()); selectedTracks[track.globalIndex()] = hfTrackNoParam.lastIndex(); } fillHfCandD = true; @@ -799,15 +972,15 @@ struct HfDataCreatorCharmResoReduced { candD.pxProng0(), candD.pyProng0(), candD.pzProng0(), candD.pxProng1(), candD.pyProng1(), candD.pzProng1(), pVecProng2[0], pVecProng2[1], pVecProng2[2], - dtype); + nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax, dtype); if constexpr (withMl) { hfCandDMl(bdtScores[0], bdtScores[1], bdtScores[2], -1., -1., -1.); } fillHfReducedCollision = true; if constexpr (DecayChannel == DecayChannel::DstarV0 || DecayChannel == DecayChannel::DstarTrack) { - registry.fill(HIST("hMassVsPtDstarPaired"), candD.pt(), invMassD - invMassDdau); + registry.fill(HIST("hMassVsPtDstarPaired"), candD.pt(), varUtils.invMassD - varUtils.invMassDdau); } else if constexpr (DecayChannel == DecayChannel::DplusV0) { - registry.fill(HIST("hMassVsPtDplusPaired"), candD.pt(), invMassD); + registry.fill(HIST("hMassVsPtDplusPaired"), candD.pt(), varUtils.invMassD); } registry.fill(HIST("hDType"), dtype); } @@ -844,17 +1017,17 @@ struct HfDataCreatorCharmResoReduced { origin = RecoDecay::getCharmHadronOrigin(particlesMc, particle, false, &idxBhadMothers); registry.fill(HIST("hMCGenOrigin"), origin); auto candV0MC = particlesMc.rawIteratorAt(particle.daughtersIds().back()); + auto candDStarMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); // K0 -> K0s -> π+π- if (RecoDecay::isMatchedMCGen(particlesMc, candV0MC, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2)) { - auto candDStarMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); // D* -> D0 π+ -> K-π+π+ if (RecoDecay::isMatchedMCGen(particlesMc, candDStarMC, Pdg::kDStar, std::array{static_cast(Pdg::kD0), +static_cast(kPiPlus)}, true, &signDStar, 1)) { auto candD0MC = particlesMc.rawIteratorAt(candDStarMC.daughtersIds().front()); if (RecoDecay::isMatchedMCGen(particlesMc, candDStarMC, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDStar, 2)) { - flag = signDStar * BIT(DecayTypeMc::Ds1ToDStarK0ToD0PiK0s); + flag = signDStar * DecayTypeMc::Ds1ToDStarK0ToD0PiK0s; } else if (RecoDecay::isMatchedMCGen(particlesMc, candD0MC, Pdg::kD0, std::array{-kKPlus, +kPiPlus, +kPiPlus, +kPi0}, true, &signDStar, 2) || RecoDecay::isMatchedMCGen(particlesMc, candD0MC, Pdg::kD0, std::array{-kKPlus, +kPiPlus, +kPiPlus, -kPi0}, true, &signDStar, 2)) { - flag = signDStar * BIT(DecayTypeMc::Ds1ToDStarK0ToD0PiK0sPart); + flag = signDStar * DecayTypeMc::Ds1ToDStarK0ToD0PiK0sPart; } } else if (RecoDecay::isMatchedMCGen(particlesMc, candDStarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), static_cast(kGamma)}, true, &signDStar, 1) || RecoDecay::isMatchedMCGen(particlesMc, candDStarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), -static_cast(kGamma)}, true, &signDStar, 1) || @@ -862,7 +1035,7 @@ struct HfDataCreatorCharmResoReduced { RecoDecay::isMatchedMCGen(particlesMc, candDStarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), -static_cast(kPi0)}, true, &signDStar, 1)) { auto candDPlusMC = particlesMc.rawIteratorAt(candDStarMC.daughtersIds().front()); if (RecoDecay::isMatchedMCGen(particlesMc, candDPlusMC, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDPlus, 2)) - flag = sign * BIT(DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s); + flag = sign * DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s; } } } else { @@ -872,7 +1045,7 @@ struct HfDataCreatorCharmResoReduced { } } // save information for task - if (!TESTBIT(std::abs(flag), DecayTypeMc::Ds1ToDStarK0ToD0PiK0s) && !TESTBIT(std::abs(flag), DecayTypeMc::Ds1ToDStarK0ToD0PiK0sPart) && !TESTBIT(std::abs(flag), DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s)) { + if (flag == 0) { continue; } @@ -905,7 +1078,7 @@ struct HfDataCreatorCharmResoReduced { if (RecoDecay::isMatchedMCGen(particlesMc, candV0MC, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2)) { // D* -> D0 π+ -> K-π+π+ if (RecoDecay::isMatchedMCGen(particlesMc, candDPlusMC, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDPlus, 2)) { - flag = sign * BIT(DecayTypeMc::Ds2StarToDplusK0s); + flag = sign * DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi; } } } else if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kDS1, std::array{static_cast(Pdg::kDStar), +kK0}, true, &sign, 1)) { @@ -920,7 +1093,7 @@ struct HfDataCreatorCharmResoReduced { RecoDecay::isMatchedMCGen(particlesMc, candDStarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), -static_cast(kPi0)}, true, &signDStar, 1)) { auto candDPlusMC = particlesMc.rawIteratorAt(candDStarMC.daughtersIds().front()); if (RecoDecay::isMatchedMCGen(particlesMc, candDPlusMC, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDPlus, 2)) - flag = sign * BIT(DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s); + flag = sign * DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s; } } } else { @@ -931,7 +1104,7 @@ struct HfDataCreatorCharmResoReduced { } } // save information for task - if (!TESTBIT(std::abs(flag), DecayTypeMc::Ds2StarToDplusK0s) && !TESTBIT(std::abs(flag), DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s)) { + if (flag == 0) { continue; } diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index da18464f72f..b2f78f68334 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -54,6 +54,11 @@ o2physics_add_dpl_workflow(task-d0 PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(task-directed-flow-charm-hadrons + SOURCES taskDirectedFlowCharmHadrons.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(task-dplus SOURCES taskDplus.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/D2H/Tasks/taskB0Reduced.cxx b/PWGHF/D2H/Tasks/taskB0Reduced.cxx index a0f5b14e5cc..d3f81aac980 100644 --- a/PWGHF/D2H/Tasks/taskB0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskB0Reduced.cxx @@ -36,58 +36,106 @@ namespace o2::aod { namespace hf_cand_b0_lite { -DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Transverse momentum of prong0 (GeV/c) -DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Transverse momentum of prong1 (GeV/c) -DECLARE_SOA_COLUMN(MProng0, mProng0, float); //! Invariant mass of prong0 (GeV/c) -DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) -DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate -DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate -DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate -DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) -DECLARE_SOA_COLUMN(NSigTpcPi1, nSigTpcPi1, float); //! TPC Nsigma separation for prong1 with pion mass hypothesis -DECLARE_SOA_COLUMN(NSigTofPi1, nSigTofPi1, float); //! TOF Nsigma separation for prong1 with pion mass hypothesis -DECLARE_SOA_COLUMN(DecayLength, decayLength, float); //! Decay length of candidate (cm) -DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); //! Transverse decay length of candidate (cm) -DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! Normalised decay length of candidate -DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); //! Normalised transverse decay length of candidate -DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float); //! Impact parameter product of candidate -DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate -DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane -DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! Maximum normalized difference between measured and expected impact parameter of candidate prongs -DECLARE_SOA_COLUMN(MlScoreSig, mlScoreSig, float); //! ML score for signal class -DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D-meson daughter candidate (GeV/c) +DECLARE_SOA_COLUMN(PtBach, ptBach, float); //! Transverse momentum of bachelor pion (GeV/c) +DECLARE_SOA_COLUMN(AbsEtaBach, absEtaBach, float); //! Absolute pseudorapidity of bachelor pion +DECLARE_SOA_COLUMN(ItsNClsBach, itsNClsBach, int); //! Number of ITS clusters of bachelor pion +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsBach, tpcNClsCrossedRowsBach, int); //! Number of TPC crossed rows of prongs of bachelor pion +DECLARE_SOA_COLUMN(TpcChi2NClBach, tpcChi2NClBach, float); //! Maximum TPC chi2 of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(PtDmesProngMin, ptProngDmesMin, float); //! Minimum pT of prongs of D-meson daughter candidate (GeV/c) +DECLARE_SOA_COLUMN(AbsEtaDmesProngMin, absEtaProngDmesMin, float); //! Minimum absolute pseudorapidity of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(ItsNClsDmesProngMin, itsNClsDmesProngMin, int); //! Minimum number of ITS clusters of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsDmesProngMin, tpcNClsCrossedRowsDmesProngMin, int); //! Minimum number of TPC crossed rows of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(TpcChi2NClDmesProngMax, tpcChi2NClDmesProngMax, float); //! Maximum TPC chi2 of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D-meson daughter candidates (GeV/c) +DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) +DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate +DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate +DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate +DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) +DECLARE_SOA_COLUMN(NSigTpcPiBachelor, nSigTpcPiBachelor, float); //! TPC Nsigma separation for bachelor with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPiBachelor, nSigTofPiBachelor, float); //! TOF Nsigma separation for bachelor with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPiBachelor, nSigTpcTofPiBachelor, float); //! Combined TPC and TOF Nsigma separation for bachelor with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcPiDmesProng0, nSigTpcPiDmesProng0, float); //! TPC Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPiDmesProng0, nSigTofPiDmesProng0, float); //! TOF Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPiDmesProng0, nSigTpcTofPiDmesProng0, float); //! Combined TPC and TOF Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcKaDmesProng1, nSigTpcKaDmesProng1, float); //! TPC Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofKaDmesProng1, nSigTofKaDmesProng1, float); //! TOF Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKaDmesProng1, nSigTpcTofKaDmesProng1, float); //! Combined TPC and TOF Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcPiDmesProng2, nSigTpcPiDmesProng2, float); //! TPC Nsigma separation for D-meson prong2 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPiDmesProng2, nSigTofPiDmesProng2, float); //! TOF Nsigma separation for D-meson prong2 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPiDmesProng2, nSigTpcTofPiDmesProng2, float); //! Combined TPC and TOF Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(DecayLength, decayLength, float); //! Decay length of candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); //! Transverse decay length of candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! Normalised decay length of candidate +DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); //! Normalised transverse decay length of candidate +DECLARE_SOA_COLUMN(DecayLengthD, decayLengthD, float); //! Decay length of D-meson daughter candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthXYD, decayLengthXYD, float); //! Transverse decay length of D-meson daughter candidate (cm) +DECLARE_SOA_COLUMN(ImpactParameterD, impactParameterD, float); //! Impact parameter product of D-meson daughter candidate +DECLARE_SOA_COLUMN(ImpactParameterBach, impactParameterBach, float); //! Impact parameter product of bachelor pion +DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float); //! Impact parameter product of daughters +DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate +DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane +DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! Maximum normalized difference between measured and expected impact parameter of candidate prongs +DECLARE_SOA_COLUMN(MlScoreSig, mlScoreSig, float); //! ML score for signal class +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision } // namespace hf_cand_b0_lite DECLARE_SOA_TABLE(HfRedCandB0Lites, "AOD", "HFREDCANDB0LITE", //! Table with some B0 properties + // B meson features hf_cand_b0_lite::M, + hf_cand_b0_lite::M, + hf_cand_b0_lite::Pt, + hf_cand_b0_lite::Eta, + hf_cand_b0_lite::Phi, + hf_cand_b0_lite::Y, + hf_cand_b0_lite::Cpa, + hf_cand_b0_lite::CpaXY, hf_cand::Chi2PCA, hf_cand_b0_lite::DecayLength, hf_cand_b0_lite::DecayLengthXY, hf_cand_b0_lite::DecayLengthNormalised, hf_cand_b0_lite::DecayLengthXYNormalised, - hf_cand_b0_lite::MProng0, - hf_cand_b0_lite::PtProng0, - hf_cand_b0_lite::PtProng1, - hf_cand::ImpactParameter0, - hf_cand::ImpactParameter1, hf_cand_b0_lite::ImpactParameterProduct, - hf_cand_b0_lite::NSigTpcPi1, - hf_cand_b0_lite::NSigTofPi1, + hf_cand_b0_lite::MaxNormalisedDeltaIP, + hf_cand_b0_lite::MlScoreSig, + hf_sel_candidate_b0::IsSelB0ToDPi, + // D meson features + hf_cand_b0_lite::MD, + hf_cand_b0_lite::PtD, + hf_cand_b0_lite::DecayLengthD, + hf_cand_b0_lite::DecayLengthXYD, + hf_cand_b0_lite::ImpactParameterD, + hf_cand_b0_lite::PtDmesProngMin, + hf_cand_b0_lite::AbsEtaDmesProngMin, + hf_cand_b0_lite::ItsNClsDmesProngMin, + hf_cand_b0_lite::TpcNClsCrossedRowsDmesProngMin, + hf_cand_b0_lite::TpcChi2NClDmesProngMax, + hf_cand_b0_lite::NSigTpcPiDmesProng0, + hf_cand_b0_lite::NSigTofPiDmesProng0, + hf_cand_b0_lite::NSigTpcTofPiDmesProng0, + hf_cand_b0_lite::NSigTpcKaDmesProng1, + hf_cand_b0_lite::NSigTofKaDmesProng1, + hf_cand_b0_lite::NSigTpcTofKaDmesProng1, + hf_cand_b0_lite::NSigTpcPiDmesProng2, + hf_cand_b0_lite::NSigTofPiDmesProng2, + hf_cand_b0_lite::NSigTpcTofPiDmesProng2, hf_cand_b0_reduced::Prong0MlScoreBkg, hf_cand_b0_reduced::Prong0MlScorePrompt, hf_cand_b0_reduced::Prong0MlScoreNonprompt, - hf_cand_b0_lite::MlScoreSig, - hf_sel_candidate_b0::IsSelB0ToDPi, - hf_cand_b0_lite::M, - hf_cand_b0_lite::Pt, - hf_cand_b0_lite::Cpa, - hf_cand_b0_lite::CpaXY, - hf_cand_b0_lite::MaxNormalisedDeltaIP, - hf_cand_b0_lite::Eta, - hf_cand_b0_lite::Phi, - hf_cand_b0_lite::Y, + // pion features + hf_cand_b0_lite::PtBach, + hf_cand_b0_lite::AbsEtaBach, + hf_cand_b0_lite::ItsNClsBach, + hf_cand_b0_lite::TpcNClsCrossedRowsBach, + hf_cand_b0_lite::TpcChi2NClBach, + hf_cand_b0_lite::ImpactParameterBach, + hf_cand_b0_lite::NSigTpcPiBachelor, + hf_cand_b0_lite::NSigTofPiBachelor, + hf_cand_b0_lite::NSigTpcTofPiBachelor, + // MC truth hf_cand_3prong::FlagMcMatchRec, hf_cand_3prong::OriginMcRec, hf_cand_b0_lite::FlagWrongCollision, @@ -96,8 +144,8 @@ DECLARE_SOA_TABLE(HfRedCandB0Lites, "AOD", "HFREDCANDB0LITE", //! Table with som DECLARE_SOA_TABLE(HfRedB0McCheck, "AOD", "HFREDB0MCCHECK", //! Table with MC decay type check hf_cand_3prong::FlagMcMatchRec, hf_cand_b0_lite::FlagWrongCollision, - hf_cand_b0_lite::MProng0, - hf_cand_b0_lite::PtProng0, + hf_cand_b0_lite::MD, + hf_cand_b0_lite::PtD, hf_cand_b0_lite::M, hf_cand_b0_lite::Pt, hf_cand_b0_lite::MlScoreSig, @@ -133,6 +181,7 @@ struct HfTaskB0Reduced { HistogramRegistry registry{"registry"}; using TracksPion = soa::Join; + using CandsDplus = soa::Join; void init(InitContext&) { @@ -326,13 +375,13 @@ struct HfTaskB0Reduced { /// \param withB0Ml is the flag to enable the filling with ML scores for the B0 candidate /// \param candidate is the B0 candidate /// \param candidatesD is the table with D- candidates - template + template void fillCand(Cand const& candidate, - aod::HfRed3Prongs const&) + CandsDmes const&) { auto ptCandB0 = candidate.pt(); auto invMassB0 = hfHelper.invMassB0ToDPi(candidate); - auto candD = candidate.template prong0_as(); + auto candD = candidate.template prong0_as(); auto ptD = candidate.ptProng0(); auto invMassD = candD.invMassHypo0(); std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; @@ -474,7 +523,7 @@ struct HfTaskB0Reduced { } } if (fillTree) { - float pseudoRndm = ptD * 1000. - (int64_t)(ptD * 1000); + float pseudoRndm = ptD * 1000. - static_cast(ptD * 1000); if (flagMcMatchRec != 0 || (((doMc && fillBackground) || !doMc) && (ptCandB0 >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { float prong0MlScoreBkg = -1.; float prong0MlScorePrompt = -1.; @@ -496,42 +545,63 @@ struct HfTaskB0Reduced { } hfRedCandB0Lite( + // B-meson features + invMassB0, + ptCandB0, + candidate.eta(), + candidate.phi(), + hfHelper.yB0(candidate), + candidate.cpa(), + candidate.cpaXY(), candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.decayLengthNormalised(), candidate.decayLengthXYNormalised(), + candidate.impactParameterProduct(), + candidate.maxNormalisedDeltaIP(), + candidateMlScoreSig, + candidate.isSelB0ToDPi(), + // D-meson features invMassD, ptD, - candidate.ptProng1(), + decLenD, + decLenXyD, candidate.impactParameter0(), - candidate.impactParameter1(), - candidate.impactParameterProduct(), - prong1.tpcNSigmaPi(), - prong1.tofNSigmaPi(), + candD.ptProngMin(), + candD.absEtaProngMin(), + candD.itsNClsProngMin(), + candD.tpcNClsCrossedRowsProngMin(), + candD.tpcChi2NClProngMax(), + candD.tpcNSigmaPiProng0(), + candD.tofNSigmaPiProng0(), + candD.tpcTofNSigmaPiProng0(), + candD.tpcNSigmaKaProng1(), + candD.tofNSigmaKaProng1(), + candD.tpcTofNSigmaKaProng1(), + candD.tpcNSigmaPiProng2(), + candD.tofNSigmaPiProng2(), + candD.tpcTofNSigmaPiProng2(), prong0MlScoreBkg, prong0MlScorePrompt, prong0MlScoreNonprompt, - candidateMlScoreSig, - candidate.isSelB0ToDPi(), - invMassB0, - ptCandB0, - candidate.cpa(), - candidate.cpaXY(), - candidate.maxNormalisedDeltaIP(), - candidate.eta(), - candidate.phi(), - hfHelper.yB0(candidate), + // pion features + candidate.ptProng1(), + std::abs(RecoDecay::eta(prong1.pVector())), + prong1.itsNCls(), + prong1.tpcNClsCrossedRows(), + prong1.tpcChi2NCl(), + candidate.impactParameter1(), + prong1.tpcNSigmaPi(), + prong1.tofNSigmaPi(), + prong1.tpcTofNSigmaPi(), + // MC truth flagMcMatchRec, isSignal, flagWrongCollision, ptMother); if constexpr (withDecayTypeCheck) { - float candidateMlScoreSig = -1; - if constexpr (withB0Ml) { - candidateMlScoreSig = candidate.mlProbB0ToDPi(); - } hfRedB0McCheck( flagMcMatchRec, flagWrongCollision, @@ -591,7 +661,7 @@ struct HfTaskB0Reduced { // Process functions void processData(soa::Filtered> const& candidates, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { for (const auto& candidate : candidates) { @@ -604,7 +674,7 @@ struct HfTaskB0Reduced { PROCESS_SWITCH(HfTaskB0Reduced, processData, "Process data without ML scores for B0 and D daughter", true); void processDataWithDmesMl(soa::Filtered> const& candidates, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { for (const auto& candidate : candidates) { @@ -617,7 +687,7 @@ struct HfTaskB0Reduced { PROCESS_SWITCH(HfTaskB0Reduced, processDataWithDmesMl, "Process data with(out) ML scores for D daughter (B0)", false); void processDataWithB0Ml(soa::Filtered> const& candidates, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { for (const auto& candidate : candidates) { @@ -631,7 +701,7 @@ struct HfTaskB0Reduced { void processMc(soa::Filtered> const& candidates, aod::HfMcGenRedB0s const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { // MC rec @@ -651,7 +721,7 @@ struct HfTaskB0Reduced { void processMcWithDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedB0s const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { // MC rec @@ -671,7 +741,7 @@ struct HfTaskB0Reduced { void processMcWithDmesMl(soa::Filtered> const& candidates, aod::HfMcGenRedB0s const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { // MC rec @@ -691,7 +761,7 @@ struct HfTaskB0Reduced { void processMcWithDmesMlAndDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedB0s const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { // MC rec @@ -711,7 +781,7 @@ struct HfTaskB0Reduced { void processMcWithB0Ml(soa::Filtered> const& candidates, aod::HfMcGenRedB0s const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { // MC rec @@ -731,7 +801,7 @@ struct HfTaskB0Reduced { void processMcWithB0MlAndDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedB0s const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDplus const& candidatesD, TracksPion const&) { // MC rec diff --git a/PWGHF/D2H/Tasks/taskBplus.cxx b/PWGHF/D2H/Tasks/taskBplus.cxx index 9586ebaa424..b98a2930258 100644 --- a/PWGHF/D2H/Tasks/taskBplus.cxx +++ b/PWGHF/D2H/Tasks/taskBplus.cxx @@ -18,6 +18,8 @@ /// \author Antonio Palasciano , Università degli Studi di Bari & INFN, Sezione di Bari /// \author Deepa Thomas , UT Austin +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -263,7 +265,7 @@ struct HfTaskBplus { float ptProngs[2], yProngs[2], etaProngs[2]; int counter = 0; - for (const auto& daught : particle.daughters_as()) { + for (const auto& daught : particle.daughters_as>()) { ptProngs[counter] = daught.pt(); etaProngs[counter] = daught.eta(); yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); diff --git a/PWGHF/D2H/Tasks/taskBplusReduced.cxx b/PWGHF/D2H/Tasks/taskBplusReduced.cxx index af95d1c8179..13544d2c369 100644 --- a/PWGHF/D2H/Tasks/taskBplusReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBplusReduced.cxx @@ -14,6 +14,8 @@ /// /// \author Antonio Palasciano , Università degli Studi di Bari & INFN, Sezione di Bari +#include + #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" @@ -35,58 +37,99 @@ namespace o2::aod { namespace hf_cand_bplus_lite { -DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Transverse momentum of prong0 (GeV/c) -DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Transverse momentum of prong1 (GeV/c) -DECLARE_SOA_COLUMN(MProng0, mProng0, float); //! Invariant mass of prong0 (GeV/c) -DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) -DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate -DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate -DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate -DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) -DECLARE_SOA_COLUMN(NSigTpcPi1, nSigTpcPi1, float); //! TPC Nsigma separation for prong1 with pion mass hypothesis -DECLARE_SOA_COLUMN(NSigTofPi1, nSigTofPi1, float); //! TOF Nsigma separation for prong1 with pion mass hypothesis -DECLARE_SOA_COLUMN(DecayLength, decayLength, float); //! Decay length of candidate (cm) -DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); //! Transverse decay length of candidate (cm) -DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! Normalised decay length of candidate -DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); //! Normalised transverse decay length of candidate -DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float); //! Impact parameter product of candidate -DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate -DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane -DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! Maximum normalized difference between measured and expected impact parameter of candidate prongs -DECLARE_SOA_COLUMN(MlScoreSig, mlScoreSig, float); //! ML score for signal class -DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D-meson daughter candidate (GeV/c) +DECLARE_SOA_COLUMN(PtBach, ptBach, float); //! Transverse momentum of bachelor pion (GeV/c) +DECLARE_SOA_COLUMN(AbsEtaBach, absEtaBach, float); //! Absolute pseudorapidity of bachelor pion +DECLARE_SOA_COLUMN(ItsNClsBach, itsNClsBach, int); //! Number of ITS clusters of bachelor pion +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsBach, tpcNClsCrossedRowsBach, int); //! Number of TPC crossed rows of prongs of bachelor pion +DECLARE_SOA_COLUMN(TpcChi2NClBach, tpcChi2NClBach, float); //! Maximum TPC chi2 of prongs of D0-meson daughter candidate +DECLARE_SOA_COLUMN(PtDmesProngMin, ptProngDmesMin, float); //! Minimum pT of prongs of D-meson daughter candidate (GeV/c) +DECLARE_SOA_COLUMN(AbsEtaDmesProngMin, absEtaProngDmesMin, float); //! Minimum absolute pseudorapidity of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(ItsNClsDmesProngMin, itsNClsDmesProngMin, int); //! Minimum number of ITS clusters of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsDmesProngMin, tpcNClsCrossedRowsDmesProngMin, int); //! Minimum number of TPC crossed rows of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(TpcChi2NClDmesProngMax, tpcChi2NClDmesProngMax, float); //! Maximum TPC chi2 of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D-meson daughter candidates (GeV/c) +DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) +DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate +DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate +DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate +DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) +DECLARE_SOA_COLUMN(NSigTpcPiBachelor, nSigTpcPiBachelor, float); //! TPC Nsigma separation for bachelor with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPiBachelor, nSigTofPiBachelor, float); //! TOF Nsigma separation for bachelor with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPiBachelor, nSigTpcTofPiBachelor, float); //! Combined TPC and TOF Nsigma separation for bachelor with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcPiDmesProng0, nSigTpcPiDmesProng0, float); //! TPC Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPiDmesProng0, nSigTofPiDmesProng0, float); //! TOF Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPiDmesProng0, nSigTpcTofPiDmesProng0, float); //! Combined TPC and TOF Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcKaDmesProng1, nSigTpcKaDmesProng1, float); //! TPC Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofKaDmesProng1, nSigTofKaDmesProng1, float); //! TOF Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKaDmesProng1, nSigTpcTofKaDmesProng1, float); //! Combined TPC and TOF Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(DecayLength, decayLength, float); //! Decay length of candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); //! Transverse decay length of candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! Normalised decay length of candidate +DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); //! Normalised transverse decay length of candidate +DECLARE_SOA_COLUMN(DecayLengthD, decayLengthD, float); //! Decay length of D-meson daughter candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthXYD, decayLengthXYD, float); //! Transverse decay length of D-meson daughter candidate (cm) +DECLARE_SOA_COLUMN(ImpactParameterD, impactParameterD, float); //! Impact parameter product of D-meson daughter candidate +DECLARE_SOA_COLUMN(ImpactParameterBach, impactParameterBach, float); //! Impact parameter product of bachelor pion +DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float); //! Impact parameter product of daughters +DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate +DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane +DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! Maximum normalized difference between measured and expected impact parameter of candidate prongs +DECLARE_SOA_COLUMN(MlScoreSig, mlScoreSig, float); //! ML score for signal class +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision } // namespace hf_cand_bplus_lite DECLARE_SOA_TABLE(HfRedCandBpLites, "AOD", "HFREDCANDBPLITE", //! Table with some B+ properties + hf_cand_bplus_lite::M, + hf_cand_bplus_lite::Pt, + hf_cand_bplus_lite::Eta, + hf_cand_bplus_lite::Phi, + hf_cand_bplus_lite::Y, + hf_cand_bplus_lite::Cpa, + hf_cand_bplus_lite::CpaXY, hf_cand::Chi2PCA, hf_cand_bplus_lite::DecayLength, hf_cand_bplus_lite::DecayLengthXY, hf_cand_bplus_lite::DecayLengthNormalised, hf_cand_bplus_lite::DecayLengthXYNormalised, - hf_cand_bplus_lite::MProng0, - hf_cand_bplus_lite::PtProng0, - hf_cand_bplus_lite::PtProng1, - hf_cand::ImpactParameter0, - hf_cand::ImpactParameter1, hf_cand_bplus_lite::ImpactParameterProduct, - hf_cand_bplus_lite::NSigTpcPi1, - hf_cand_bplus_lite::NSigTofPi1, + hf_cand_bplus_lite::MaxNormalisedDeltaIP, + hf_cand_bplus_lite::MlScoreSig, + hf_sel_candidate_bplus::IsSelBplusToD0Pi, + // D meson features + hf_cand_bplus_lite::MD, + hf_cand_bplus_lite::PtD, + hf_cand_bplus_lite::DecayLengthD, + hf_cand_bplus_lite::DecayLengthXYD, + hf_cand_bplus_lite::ImpactParameterD, + hf_cand_bplus_lite::PtDmesProngMin, + hf_cand_bplus_lite::AbsEtaDmesProngMin, + hf_cand_bplus_lite::ItsNClsDmesProngMin, + hf_cand_bplus_lite::TpcNClsCrossedRowsDmesProngMin, + hf_cand_bplus_lite::TpcChi2NClDmesProngMax, + hf_cand_bplus_lite::NSigTpcPiDmesProng0, + hf_cand_bplus_lite::NSigTofPiDmesProng0, + hf_cand_bplus_lite::NSigTpcTofPiDmesProng0, + hf_cand_bplus_lite::NSigTpcKaDmesProng1, + hf_cand_bplus_lite::NSigTofKaDmesProng1, + hf_cand_bplus_lite::NSigTpcTofKaDmesProng1, hf_cand_bplus_reduced::Prong0MlScoreBkg, hf_cand_bplus_reduced::Prong0MlScorePrompt, hf_cand_bplus_reduced::Prong0MlScoreNonprompt, - hf_cand_bplus_lite::MlScoreSig, - hf_sel_candidate_bplus::IsSelBplusToD0Pi, - hf_cand_bplus_lite::M, - hf_cand_bplus_lite::Pt, - hf_cand_bplus_lite::Cpa, - hf_cand_bplus_lite::CpaXY, - hf_cand_bplus_lite::MaxNormalisedDeltaIP, - hf_cand_bplus_lite::Eta, - hf_cand_bplus_lite::Phi, - hf_cand_bplus_lite::Y, + // pion features + hf_cand_bplus_lite::PtBach, + hf_cand_bplus_lite::AbsEtaBach, + hf_cand_bplus_lite::ItsNClsBach, + hf_cand_bplus_lite::TpcNClsCrossedRowsBach, + hf_cand_bplus_lite::TpcChi2NClBach, + hf_cand_bplus_lite::ImpactParameterBach, + hf_cand_bplus_lite::NSigTpcPiBachelor, + hf_cand_bplus_lite::NSigTofPiBachelor, + hf_cand_bplus_lite::NSigTpcTofPiBachelor, + // MC truth hf_cand_2prong::FlagMcMatchRec, hf_cand_2prong::OriginMcRec, hf_cand_bplus_lite::FlagWrongCollision, @@ -95,8 +138,8 @@ DECLARE_SOA_TABLE(HfRedCandBpLites, "AOD", "HFREDCANDBPLITE", //! Table with som DECLARE_SOA_TABLE(HfRedBpMcCheck, "AOD", "HFREDBPMCCHECK", //! Table with MC decay type check hf_cand_2prong::FlagMcMatchRec, hf_cand_bplus_lite::FlagWrongCollision, - hf_cand_bplus_lite::MProng0, - hf_cand_bplus_lite::PtProng0, + hf_cand_bplus_lite::MD, + hf_cand_bplus_lite::PtD, hf_cand_bplus_lite::M, hf_cand_bplus_lite::Pt, hf_cand_bplus_lite::MlScoreSig, @@ -140,6 +183,7 @@ struct HfTaskBplusReduced { HistogramRegistry registry{"registry"}; using TracksPion = soa::Join; + using CandsD0 = soa::Join; void init(InitContext&) { @@ -337,14 +381,14 @@ struct HfTaskBplusReduced { /// \param withBplusMl is the flag to enable the filling with ML scores for the B+ candidate /// \param candidate is the B+ candidate /// \param candidatesD is the table with D0 candidates - template + template void fillCand(Cand const& candidate, - aod::HfRed2Prongs const& /*candidatesD*/, + CandsDmes const& /*candidatesD*/, TracksPion const&) { auto ptCandBplus = candidate.pt(); auto invMassBplus = hfHelper.invMassBplusToD0Pi(candidate); - auto candD0 = candidate.template prong0_as(); + auto candD0 = candidate.template prong0_as(); auto candPi = candidate.template prong1_as(); auto ptD0 = candidate.ptProng0(); auto invMassD0 = (candPi.signed1Pt() < 0) ? candD0.invMassHypo0() : candD0.invMassHypo1(); @@ -489,7 +533,7 @@ struct HfTaskBplusReduced { } } if (fillTree) { - float pseudoRndm = ptD0 * 1000. - (int64_t)(ptD0 * 1000); + float pseudoRndm = ptD0 * 1000. - static_cast(ptD0 * 1000); if (ptCandBplus >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor) { float prong0MlScoreBkg = -1.; float prong0MlScorePrompt = -1.; @@ -504,6 +548,22 @@ struct HfTaskBplusReduced { candidateMlScoreSig = candidate.mlProbBplusToD0Pi(); } auto prong1 = candidate.template prong1_as(); + float tpcNSigmaPi, tofNSigmaPi, tpcTofNSigmaPi, tpcNSigmaKa, tofNSigmaKa, tpcTofNSigmaKa; + if (prong1.signed1Pt() < 0) { + tpcNSigmaPi = candD0.tpcNSigmaPiProng1(); + tofNSigmaPi = candD0.tofNSigmaPiProng1(); + tpcTofNSigmaPi = candD0.tpcTofNSigmaPiProng1(); + tpcNSigmaKa = candD0.tpcNSigmaKaProng0(); + tofNSigmaKa = candD0.tofNSigmaKaProng0(); + tpcTofNSigmaKa = candD0.tpcTofNSigmaKaProng0(); + } else { + tpcNSigmaPi = candD0.tpcNSigmaPiProng0(); + tofNSigmaPi = candD0.tofNSigmaPiProng0(); + tpcTofNSigmaPi = candD0.tpcTofNSigmaPiProng0(); + tpcNSigmaKa = candD0.tpcNSigmaKaProng1(); + tofNSigmaKa = candD0.tofNSigmaKaProng1(); + tpcTofNSigmaKa = candD0.tpcTofNSigmaKaProng1(); + } float ptMother = -1.; if constexpr (doMc) { @@ -511,54 +571,73 @@ struct HfTaskBplusReduced { } hfRedCandBpLite( + // B+ - meson features + invMassBplus, + ptCandBplus, + candidate.eta(), + candidate.phi(), + hfHelper.yBplus(candidate), + candidate.cpa(), + candidate.cpaXY(), candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.decayLengthNormalised(), candidate.decayLengthXYNormalised(), + candidate.impactParameterProduct(), + candidate.maxNormalisedDeltaIP(), + candidateMlScoreSig, + candidate.isSelBplusToD0Pi(), + // D-meson features invMassD0, ptD0, - candidate.ptProng1(), + decLenD0, + decLenXyD0, candidate.impactParameter0(), - candidate.impactParameter1(), - candidate.impactParameterProduct(), - prong1.tpcNSigmaPi(), - prong1.tofNSigmaPi(), + candD0.ptProngMin(), + candD0.absEtaProngMin(), + candD0.itsNClsProngMin(), + candD0.tpcNClsCrossedRowsProngMin(), + candD0.tpcChi2NClProngMax(), + tpcNSigmaPi, + tofNSigmaPi, + tpcTofNSigmaPi, + tpcNSigmaKa, + tofNSigmaKa, + tpcTofNSigmaKa, prong0MlScoreBkg, prong0MlScorePrompt, prong0MlScoreNonprompt, - candidateMlScoreSig, - candidate.isSelBplusToD0Pi(), - invMassBplus, - ptCandBplus, - candidate.cpa(), - candidate.cpaXY(), - candidate.maxNormalisedDeltaIP(), - candidate.eta(), - candidate.phi(), - hfHelper.yBplus(candidate), + // pion features + candidate.ptProng1(), + std::abs(RecoDecay::eta(prong1.pVector())), + prong1.itsNCls(), + prong1.tpcNClsCrossedRows(), + prong1.tpcChi2NCl(), + candidate.impactParameter1(), + prong1.tpcNSigmaPi(), + prong1.tofNSigmaPi(), + prong1.tpcTofNSigmaPi(), + // MC truth flagMcMatchRec, isSignal, flagWrongCollision, ptMother); - } - if constexpr (withDecayTypeCheck) { - float candidateMlScoreSig = -1; - if constexpr (withBplusMl) { - candidateMlScoreSig = candidate.mlProbBplusToD0Pi(); + + if constexpr (withDecayTypeCheck) { + hfRedBpMcCheck( + flagMcMatchRec, + flagWrongCollision, + invMassD0, + ptD0, + invMassBplus, + ptCandBplus, + candidateMlScoreSig, + candidate.pdgCodeBeautyMother(), + candidate.pdgCodeProng0(), + candidate.pdgCodeProng1(), + candidate.pdgCodeProng2()); } - hfRedBpMcCheck( - flagMcMatchRec, - flagWrongCollision, - invMassD0, - ptD0, - invMassBplus, - ptCandBplus, - candidateMlScoreSig, - candidate.pdgCodeBeautyMother(), - candidate.pdgCodeProng0(), - candidate.pdgCodeProng1(), - candidate.pdgCodeProng2()); } } } @@ -603,7 +682,7 @@ struct HfTaskBplusReduced { // Process functions void processData(soa::Filtered> const& candidates, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { for (const auto& candidate : candidates) { @@ -612,11 +691,11 @@ struct HfTaskBplusReduced { } fillCand(candidate, candidatesD, pionTracks); } // candidate loop - } // processData + } // processData PROCESS_SWITCH(HfTaskBplusReduced, processData, "Process data without ML scores for D0 daughter", true); void processDataWithDmesMl(soa::Filtered> const& candidates, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { for (const auto& candidate : candidates) { @@ -625,11 +704,11 @@ struct HfTaskBplusReduced { } fillCand(candidate, candidatesD, pionTracks); } // candidate loop - } // processDataWithDmesMl + } // processDataWithDmesMl PROCESS_SWITCH(HfTaskBplusReduced, processDataWithDmesMl, "Process data with ML scores for D0 daughter", false); void processDataWithBplusMl(soa::Filtered> const& candidates, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { for (const auto& candidate : candidates) { @@ -638,12 +717,12 @@ struct HfTaskBplusReduced { } fillCand(candidate, candidatesD, pionTracks); } // candidate loop - } // processDataWithBplusMl + } // processDataWithBplusMl PROCESS_SWITCH(HfTaskBplusReduced, processDataWithBplusMl, "Process data with(out) ML scores for B+ (D0 daughter)", false); void processMc(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { // MC rec @@ -658,12 +737,12 @@ struct HfTaskBplusReduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc + } // processMc PROCESS_SWITCH(HfTaskBplusReduced, processMc, "Process MC without ML scores for B+ and D0 daughter", false); void processMcWithDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { // MC rec @@ -678,12 +757,12 @@ struct HfTaskBplusReduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc + } // processMc PROCESS_SWITCH(HfTaskBplusReduced, processMcWithDecayTypeCheck, "Process MC with decay type check and without ML scores for B+ and D daughter", false); void processMcWithDmesMl(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { // MC rec @@ -698,12 +777,12 @@ struct HfTaskBplusReduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMcWithDmesMl + } // processMcWithDmesMl PROCESS_SWITCH(HfTaskBplusReduced, processMcWithDmesMl, "Process MC with(out) ML scores for D0 daughter (B+)", false); void processMcWithDmesMlAndDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { // MC rec @@ -723,7 +802,7 @@ struct HfTaskBplusReduced { void processMcWithBplusMl(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { // MC rec @@ -738,12 +817,12 @@ struct HfTaskBplusReduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMcWithBplusMl + } // processMcWithBplusMl PROCESS_SWITCH(HfTaskBplusReduced, processMcWithBplusMl, "Process MC with(out) ML scores for B+ (D0 daughter)", false); void processMcWithBplusMlAndDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, - aod::HfRed2Prongs const& candidatesD, + CandsD0 const& candidatesD, TracksPion const& pionTracks) { // MC rec @@ -758,7 +837,7 @@ struct HfTaskBplusReduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc + } // processMc PROCESS_SWITCH(HfTaskBplusReduced, processMcWithBplusMlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B+ (D0 daughter)", false); }; // struct diff --git a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx index cbcfb44a85b..8dc690b0be6 100644 --- a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx +++ b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx @@ -16,6 +16,8 @@ /// \author S. Kundu (CERN) sourav.kundu@cern.ch /// \author M. Faggin (CERN) mattia.faggin@cern.ch +#include + #include "TRandom3.h" #include "Math/Vector3D.h" #include "Math/Vector4D.h" @@ -189,6 +191,9 @@ struct TaskPolarisationCharmHadrons { Configurable activateTHnEulerPhiMonitor{"activateTHnEulerPhiMonitor", false, "Flag to switch on the monitoring THnSparse vs. Euler angle phi (Lc -> pKpi)"}; ConfigurableAxis configTHnAxisEulerPhi{"configTHnAxisEulerPhi", {24, -o2::constants::math::PI, o2::constants::math::PI}, "Euler polar angle #phi"}; + /// Application of rapidity cut for reconstructed candidates + Configurable rapidityCut{"rapidityCut", 999.f, "Max. value of reconstructed candidate rapidity (abs. value)"}; + Filter filterSelectDstarCandidates = aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == selectionFlagDstarToD0Pi; Filter filterSelectLcToPKPiCandidates = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLcToPKPi) || (aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLcToPKPi); @@ -283,6 +288,7 @@ struct TaskPolarisationCharmHadrons { const AxisSpec thnAxisNumPvContributors{configThnAxisNumPvContributors, "num PV contributors"}; const AxisSpec thnAxisPtB{configThnAxisPtB, "#it{p}_{T}(B mother) (GeV/#it{c})"}; const AxisSpec thnAxisDausAcc{2, -0.5f, 1.5f, "daughters in acceptance"}; + const AxisSpec thnAxisDauToMuons{4, -0.5f, 3.5f, "daughters decayed to muons"}; const AxisSpec thnAxisResoChannelLc{4, -0.5, 3.5, "0: direct 1,2,3: resonant"}; // 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π± const AxisSpec thnAxisAbsEtaTrackMin{configThnAxisAbsEtaTrackMin, "min |#it{#eta_{track}}|"}; const AxisSpec thnAxisNumItsClsMin{configThnAxisNumItsClsMin, "min #it{N}_{cls ITS}"}; @@ -318,20 +324,20 @@ struct TaskPolarisationCharmHadrons { } } else { if (activateTHnSparseCosThStarHelicity) { - registry.add("hRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarHelicity, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); - registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarHelicity, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisPtB}); + registry.add("hRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarHelicity, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons}); + registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarHelicity, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons, thnAxisPtB}); } if (activateTHnSparseCosThStarProduction) { - registry.add("hRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarProduction, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); - registry.add("hRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarProduction, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisPtB}); + registry.add("hRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarProduction, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons}); + registry.add("hRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarProduction, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons, thnAxisPtB}); } if (activateTHnSparseCosThStarBeam) { - registry.add("hRecoPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarBeam, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); - registry.add("hRecoNonPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarBeam, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisPtB}); + registry.add("hRecoPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarBeam, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons}); + registry.add("hRecoNonPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarBeam, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons, thnAxisPtB}); } if (activateTHnSparseCosThStarRandom) { - registry.add("hRecoPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarRandom, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); - registry.add("hRecoNonPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarRandom, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisPtB}); + registry.add("hRecoPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarRandom, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons}); + registry.add("hRecoNonPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarRandom, thnAxisMlBkg, thnAxisMlNonPrompt, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons, thnAxisPtB}); } } } else if (doprocessLcToPKPiWithMl || doprocessLcToPKPiMcWithMl || doprocessLcToPKPiBackgroundMcWithMl) { @@ -405,20 +411,20 @@ struct TaskPolarisationCharmHadrons { } } else { if (activateTHnSparseCosThStarHelicity) { - registry.add("hRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarHelicity, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); - registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarHelicity, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisPtB}); + registry.add("hRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarHelicity, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons}); + registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarHelicity, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons, thnAxisPtB}); } if (activateTHnSparseCosThStarProduction) { - registry.add("hRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarProduction, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); - registry.add("hRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarProduction, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisPtB}); + registry.add("hRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarProduction, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons}); + registry.add("hRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarProduction, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons, thnAxisPtB}); } if (activateTHnSparseCosThStarBeam) { - registry.add("hRecoPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarBeam, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); - registry.add("hRecoNonPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarBeam, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisPtB}); + registry.add("hRecoPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarBeam, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons}); + registry.add("hRecoNonPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarBeam, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons, thnAxisPtB}); } if (activateTHnSparseCosThStarRandom) { - registry.add("hRecoPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarRandom, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); - registry.add("hRecoNonPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarRandom, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisPtB}); + registry.add("hRecoPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis -- reco prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarRandom, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons}); + registry.add("hRecoNonPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis -- reco non-prompt signal", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStarRandom, thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin, thnAxisDauToMuons, thnAxisPtB}); } } } else if (doprocessLcToPKPi || doprocessLcToPKPiMc) { @@ -531,24 +537,24 @@ struct TaskPolarisationCharmHadrons { /// \param numItsClsMin is the minimum number of ITS clusters of the daughter tracks /// \param numTpcClsMin is the minimum number of TPC clusters of the daughter tracks template - void fillRecoHistos(float invMassCharmHad, float ptCharmHad, int numPvContributors, float rapCharmHad, float invMassD0, float invMassKPiLc, float cosThetaStar, float phiEuler, std::array outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, int8_t resoChannelLc, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t charge) + void fillRecoHistos(float invMassCharmHad, float ptCharmHad, int numPvContributors, float rapCharmHad, float invMassD0, float invMassKPiLc, float cosThetaStar, float phiEuler, std::array outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, int8_t resoChannelLc, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t charge, int8_t nMuons) { if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity if constexpr (!doMc) { // data if constexpr (withMl) { // with ML if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiHelicity"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], charge); } } } else { // without ML if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiHelicity"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, charge); } @@ -558,7 +564,7 @@ struct TaskPolarisationCharmHadrons { if constexpr (withMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -567,7 +573,7 @@ struct TaskPolarisationCharmHadrons { } } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother); + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -578,7 +584,7 @@ struct TaskPolarisationCharmHadrons { } else { // without ML if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -587,7 +593,7 @@ struct TaskPolarisationCharmHadrons { } } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother); + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -601,18 +607,18 @@ struct TaskPolarisationCharmHadrons { if constexpr (!doMc) { // data if constexpr (withMl) { // with ML if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiProduction"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], charge); } } } else { // without ML if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiProduction"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, charge); } @@ -622,7 +628,7 @@ struct TaskPolarisationCharmHadrons { if constexpr (withMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -631,7 +637,7 @@ struct TaskPolarisationCharmHadrons { } } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother); + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -642,7 +648,7 @@ struct TaskPolarisationCharmHadrons { } else { // without ML if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -651,7 +657,7 @@ struct TaskPolarisationCharmHadrons { } } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother); + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -665,18 +671,18 @@ struct TaskPolarisationCharmHadrons { if constexpr (!doMc) { // data if constexpr (withMl) { // with ML if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ - registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); + registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiBeam"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], charge); } } } else { // without ML if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ - registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); + registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiBeam"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, charge); } @@ -686,7 +692,7 @@ struct TaskPolarisationCharmHadrons { if constexpr (withMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -695,7 +701,7 @@ struct TaskPolarisationCharmHadrons { } } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother); + registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -706,7 +712,7 @@ struct TaskPolarisationCharmHadrons { } else { // without ML if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -715,7 +721,7 @@ struct TaskPolarisationCharmHadrons { } } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother); + registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { @@ -729,28 +735,28 @@ struct TaskPolarisationCharmHadrons { if constexpr (!doMc) { // data if constexpr (withMl) { // with ML if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ - registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); + registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); } } else { // without ML if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ - registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); + registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); } } } else { // MC --> no distinction among channels, since rotational bkg not supported if constexpr (withMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); } } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother); + registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); } @@ -758,13 +764,13 @@ struct TaskPolarisationCharmHadrons { } else { // without ML if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); } } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother); + registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); } @@ -1168,6 +1174,11 @@ struct TaskPolarisationCharmHadrons { continue; } + /// apply rapidity selection on the reconstructed candidate + if (std::abs(rapidity) > rapidityCut) { + continue; + } + float phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); float thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(pxDau, pyDau, pzDau, massDau); @@ -1212,29 +1223,34 @@ struct TaskPolarisationCharmHadrons { // random float cosThetaStarRandom = -10.f; + int8_t nMuons{0u}; + if constexpr (doMc) { + nMuons = candidate.nTracksDecayed(); + } + if (activateTHnSparseCosThStarHelicity) { // helicity cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); phiHelicity = std::atan2(beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()), normalVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(normalVec.Mag2()))); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarHelicity, phiHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarHelicity, phiHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons); } if (activateTHnSparseCosThStarProduction) { // production cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); phiProduction = std::atan2(normalVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(normalVec.Mag2())), helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2()))); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarProduction, phiProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarProduction, phiProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons); } if (activateTHnSparseCosThStarBeam) { // beam cosThetaStarBeam = beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); phiBeam = std::atan2(helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())), beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2())); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarBeam, phiBeam, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarBeam, phiBeam, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons); } if (activateTHnSparseCosThStarRandom) { // random ROOT::Math::XYZVector randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); cosThetaStarRandom = randomVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarRandom, -99.f, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarRandom, -99.f, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons); } /// Table for Lc->pKpi background studies diff --git a/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx b/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx index d50644fe55e..7126e02258f 100644 --- a/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx +++ b/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx @@ -29,6 +29,97 @@ using namespace o2::soa; using namespace o2::analysis; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants::physics; + +enum DecayTypeMc : uint8_t { + Ds1ToDStarK0ToD0PiK0s = 1, + Ds2StarToDplusK0sToPiKaPiPiPi, + Ds1ToDStarK0ToDPlusPi0K0s, + Ds1ToDStarK0ToD0PiK0sPart, + Ds1ToDStarK0ToD0NoPiK0sPart, + Ds1ToDStarK0ToD0PiK0sOneMu, + Ds2StarToDplusK0sOneMu +}; + +namespace o2::aod +{ +namespace hf_cand_reso_lite +{ +DECLARE_SOA_COLUMN(PtBach0, ptBach0, float); //! Transverse momentum of bachelor 0 (GeV/c) +DECLARE_SOA_COLUMN(PtBach1, ptBach1, float); //! Transverse momentum of bachelor 1 (GeV/c) +DECLARE_SOA_COLUMN(MBach0, mBach0, float); //! Invariant mass of bachelor 0 (GeV/c) +DECLARE_SOA_COLUMN(MBach1, mBach1, float); //! Invariant mass of bachelor 1 (GeV/c) +DECLARE_SOA_COLUMN(MBachD0, mBachD0, float); //! Invariant mass of D0 bachelor (of bachelor 0) (GeV/c) +DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) +DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate +DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate +DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate +DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) +DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of candidate +DECLARE_SOA_COLUMN(CosThetaStar, cosThetaStar, float); //! VosThetaStar of candidate (GeV) +DECLARE_SOA_COLUMN(MlScoreBkgBach0, mlScoreBkgBach0, float); //! ML score for background class of charm daughter +DECLARE_SOA_COLUMN(MlScorePromptBach0, mlScorePromptBach0, float); //! ML score for prompt class of charm daughter +DECLARE_SOA_COLUMN(MlScoreNonPromptBach0, mlScoreNonPromptBach0, float); //! ML score for non-prompt class of charm daughter +DECLARE_SOA_COLUMN(ItsNClsProngMinBach0, itsNClsProngMinBach0, int); //! minimum value of number of ITS clusters for the decay daughter tracks of bachelor 0 +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsProngMinBach0, tpcNClsCrossedRowsProngMinBach0, int); //! minimum value of number of TPC crossed rows for the decay daughter tracks of bachelor 0 +DECLARE_SOA_COLUMN(TpcChi2NClProngMaxBach0, tpcChi2NClProngMaxBach0, float); //! maximum value of TPC chi2 for the decay daughter tracks of bachelor 0 +DECLARE_SOA_COLUMN(ItsNClsProngMinBach1, itsNClsProngMinBach1, int); //! minimum value of number of ITS clusters for the decay daughter tracks of bachelor 1 +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsProngMinBach1, tpcNClsCrossedRowsProngMinBach1, int); //! minimum value of number of TPC crossed rows for the decay daughter tracks of bachelor 1 +DECLARE_SOA_COLUMN(TpcChi2NClProngMaxBach1, tpcChi2NClProngMaxBach1, float); //! maximum value of TPC chi2 for the decay daughter tracks of bachelor 1 +DECLARE_SOA_COLUMN(CpaBach1, cpaBach1, float); //! Cosine of Pointing Angle of bachelor 1 +DECLARE_SOA_COLUMN(DcaBach1, dcaBach1, float); //! DCA of bachelor 1 +DECLARE_SOA_COLUMN(RadiusBach1, radiusBach1, float); //! Radius of bachelor 1 +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! flag for decay channel classification reconstruction level +DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); //! debug flag for mis-association at reconstruction level +DECLARE_SOA_COLUMN(Origin, origin, int8_t); //! Flag for origin of MC particle 1=promt, 2=FD +DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(SignD0, signD0, float); //! Flag to distinguish D0 and D0Bar + +} // namespace hf_cand_reso_lite + +DECLARE_SOA_TABLE(HfCandResoLites, "AOD", "HFCANDRESOLITE", //! Table with some B0 properties + // Candidate Properties + hf_cand_reso_lite::M, + hf_cand_reso_lite::Pt, + hf_cand_reso_lite::P, + hf_cand_reso_lite::Y, + hf_cand_reso_lite::Eta, + hf_cand_reso_lite::Phi, + hf_cand_reso_lite::E, + hf_cand_reso_lite::CosThetaStar, + hf_cand_reso_lite::Sign, + // Bachelors Properties + hf_cand_reso_lite::MBach0, + hf_cand_reso_lite::PtBach0, + hf_cand_reso_lite::MlScoreBkgBach0, + hf_cand_reso_lite::MlScorePromptBach0, + hf_cand_reso_lite::MlScoreNonPromptBach0, + hf_cand_reso_lite::ItsNClsProngMinBach0, + hf_cand_reso_lite::TpcNClsCrossedRowsProngMinBach0, + hf_cand_reso_lite::TpcChi2NClProngMaxBach0, + hf_cand_reso_lite::MBach1, + hf_cand_reso_lite::PtBach1, + hf_cand_reso_lite::CpaBach1, + hf_cand_reso_lite::DcaBach1, + hf_cand_reso_lite::RadiusBach1, + hf_cand_reso_lite::ItsNClsProngMinBach1, + hf_cand_reso_lite::TpcNClsCrossedRowsProngMinBach1, + hf_cand_reso_lite::TpcChi2NClProngMaxBach1, + // MC + hf_cand_reso_lite::FlagMcMatchRec, + hf_cand_reso_lite::DebugMcRec, + hf_cand_reso_lite::Origin, + hf_cand_reso_lite::PtGen, + hf_cand_reso_lite::SignD0); + +DECLARE_SOA_TABLE(HfGenResoLites, "AOD", "HFGENRESOLITE", //! Table with some B0 properties + hf_cand_reso_lite::Pt, + hf_cand_reso_lite::Y, + hf_cand_reso_lite::Origin); + +} // namespace o2::aod enum DecayChannel : uint8_t { Ds1ToDstarK0s = 0, @@ -38,9 +129,17 @@ enum DecayChannel : uint8_t { }; struct HfTaskCharmResoReduced { - Configurable ptMinReso{"ptMinReso", 5, "Discard events with smaller pT"}; - Configurable cutBeforeMixing{"cutBeforeMixing", false, "Apply pT cut to candidates before event mixing"}; - Configurable cutAfterMixing{"cutAfterMixing", false, "Apply pT cut to candidates after event mixing"}; + Produces hfCandResoLite; + Produces hfGenResoLite; + Configurable ptMinReso{"ptMinReso", -1, "Discard events with smaller pT"}; + Configurable fillTrees{"fillTrees", false, "Fill output Trees"}; + Configurable fillSparses{"fillSparses", false, "Fill output Sparses"}; + Configurable useDeltaMass{"useDeltaMass", false, "Use Delta Mass for resonance invariant Mass calculation"}; + Configurable fillOnlySignal{"fillOnlySignal", false, "Flag to Fill only signal candidates (MC only)"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; + Configurable yCandRecoMax{"yCandRecoMax", -1, "max. cand. rapidity"}; + Configurable etaTrackMax{"etaTrackMax", 0.8, "max. track pseudo-rapidity for acceptance calculation"}; + Configurable ptTrackMin{"ptTrackMin", 0.1, "min. track transverse momentum for acceptance calculation"}; // Configurables axis for histos ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0., 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 8.f, 12.f, 24.f, 50.f}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis axisPtProng0{"axisPtProng0", {VARIABLE_WIDTH, 0., 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 8.f, 12.f, 24.f, 50.f}, "prong0 bach. #it{p}_{T} (GeV/#it{c})"}; @@ -51,16 +150,14 @@ struct HfTaskCharmResoReduced { ConfigurableAxis axisCosThetaStar{"axisCosThetaStar", {40, -1, 1}, "cos(#vartheta*)"}; ConfigurableAxis axisBkgBdtScore{"axisBkgBdtScore", {100, 0, 1}, "bkg BDT Score"}; ConfigurableAxis axisNonPromptBdtScore{"axisNonPromptBdtScore", {100, 0, 1}, "non-prompt BDT Score"}; - // Configurables for ME - Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; - Configurable numberEventsToSkip{"numberEventsToSkip", -1, "Number of events to Skip in ME process"}; - ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0., 45., 60., 75., 95, 250}, "event multiplicity pools (PV contributors for now)"}; - ConfigurableAxis zPoolBins{"zPoolBins", {VARIABLE_WIDTH, -10.0, -4, -1, 1, 4, 10.0}, "z vertex position pools"}; - // ConfigurableAxis bzPoolBins{"bzPoolBins", {2, -10, 10}, "Bz of collision"}; + ConfigurableAxis axisEta{"axisEta", {30, -1.5, 1.5}, "pseudorapidity"}; + ConfigurableAxis axisOrigin{"axisOrigin", {3, -0.5, 2.5}, "origin"}; + ConfigurableAxis axisFlag{"axisFlag", {65, -32.5, 32.5}, "mc flag"}; - using ReducedResoWithMl = soa::Join; - SliceCache cache; - Preslice resoPerCollision = aod::hf_track_index_reduced::hfRedCollisionId; + using ReducedReso = soa::Join; + using ReducedResoWithMl = soa::Join; + using ReducedResoMc = soa::Join; + using ReducedResoWithMlMc = soa::Join; // Histogram Registry HistogramRegistry registry; @@ -74,16 +171,23 @@ struct HfTaskCharmResoReduced { registry.add("hPt", "Charm resonance candidates pT", {HistType::kTH1F, {axisPt}}); registry.add("hPtProng0", "D daughters pT", {HistType::kTH1F, {axisPtProng0}}); registry.add("hPtProng1", "V0 daughter pT", {HistType::kTH1F, {axisPtProng1}}); - registry.add("hNPvCont", "Collision number of PV contributors ; N contrib ; entries", {HistType::kTH1F, {{100, 0, 250}}}); + registry.add("hNPvCont", "Collision number of PV contributors ; N contrib ; entries", {HistType::kTH1F, {{125, -0.5, 249.5}}}); registry.add("hZvert", "Collision Z Vtx ; z PV [cm] ; entries", {HistType::kTH1F, {{120, -12., 12.}}}); registry.add("hBz", "Collision Bz ; Bz [T] ; entries", {HistType::kTH1F, {{20, -10., 10.}}}); registry.add("hSparse", "THn for production studies with cosThStar and BDT scores", HistType::kTHnSparseF, {axisPt, axisPtProng0, axisPtProng1, axisInvMassReso, axisInvMassProng0, axisInvMassProng1, axisCosThetaStar, axisBkgBdtScore, axisNonPromptBdtScore}); - if (doprocessDs1DataMixedEvent || doprocessDs2StarDataMixedEvent) { - registry.add("hNPvContCorr", "Collision number of PV contributors ; N contrib ; N contrib", {HistType::kTH2F, {{100, 0, 250}, {100, 0, 250}}}); - registry.add("hZvertCorr", "Collision Z Vtx ; z PV [cm] ; z PV [cm]", {HistType::kTH2F, {{120, -12., 12.}, {120, -12., 12.}}}); - registry.add("hMassProng0Corr", "D daughters inv. mass", {HistType::kTH2F, {axisInvMassProng0, axisInvMassProng0}}); - registry.add("hMassProng1Corr", "V0 daughter inv. mass", {HistType::kTH2F, {axisInvMassProng1, axisInvMassProng1}}); + if (doprocessDs1Mc || doprocessDs2StarMc || doprocessDs1McWithMl || doprocessDs2StarMcWithMl) { + // gen histos + registry.add("hYRecPrompt", "Charm resonance candidates pT", {HistType::kTH2F, {axisPt, axisEta}}); + registry.add("hYRecNonPrompt", "Charm resonance candidates pT", {HistType::kTH2F, {axisPt, axisEta}}); + registry.add("hYGenPrompt", "Prompt {D_{S}}^j particles (generated);#it{p}_{T}^{gen}({D_{S}}^j) (GeV/#it{c});#it{y}^{gen}({D_{S}}^j);entries", {HistType::kTH2F, {axisPt, axisEta}}); + registry.add("hYGenPromptWithProngsInAcceptance", "Prompt {D_{S}}^j particles (generated-daughters in acceptance);#it{p}_{T}^{gen}({D_{S}}^j) (GeV/#it{c});#it{y}^{gen}({D_{S}}^j);entries", {HistType::kTH2F, {axisPt, axisEta}}); + registry.add("hYGenNonPrompt", "NonPrompt {D_{S}}^j particles (generated);#it{p}_{T}^{gen}({D_{S}}^j) (GeV/#it{c});#it{y}^{gen}({D_{S}}^j);entries", {HistType::kTH2F, {axisPt, axisEta}}); + registry.add("hYGenNonPromptWithProngsInAcceptance", "NonPrompt {D_{S}}^j particles (generated-daughters in acceptance);#it{p}_{T}^{gen}({D_{S}}^j) (GeV/#it{c});#it{y}^{gen}({D_{S}}^j);entries", {HistType::kTH2F, {axisPt, axisEta}}); + if (fillSparses) { + registry.add("hPtYGenSig", "{D_{S}}^j particles (generated);#it{p}_{T}({D_{S}}^j) (GeV/#it{c});#it{y}({D_{S}}^j)", {HistType::kTHnSparseF, {axisPt, axisEta, axisOrigin, axisFlag}}); + registry.add("hPtYWithProngsInAccepanceGenSig", "{D_{S}}^j particles (generated-daughters in acceptance);#it{p}_{T}({D_{S}}^j) (GeV/#it{c});#it{y}({D_{S}}^j)", {HistType::kTHnSparseF, {axisPt, axisEta, axisOrigin, axisFlag}}); + } } } @@ -91,145 +195,274 @@ struct HfTaskCharmResoReduced { /// \tparam channel is the decay channel of the Resonance /// \param candidate is a candidate /// \param coll is a reduced collision - template - void fillHisto(const Cand& candidate, const Coll& collision) + /// \param bach0 is a bachelor of the candidate + /// \param bach1 is a bachelor of the candidate + template + void fillCand(const Cand& candidate, const Coll& collision, const CharmBach& bach0, const V0Bach& bach1) { + // Compute quantities to be saved + float invMassReso{0}, pdgMassReso, invMassBach0, invMassBach1, pdgMassBach0, pdgMassBach1, sign, invMassD0, cosThetaStar; + if (channel == DecayChannel::Ds1ToDstarK0s) { + pdgMassReso = MassDS1; + pdgMassBach0 = MassDStar; + pdgMassBach1 = MassK0; + invMassBach1 = bach1.invMassK0s(); + cosThetaStar = candidate.cosThetaStarDs1(); + if (bach0.dType() > 0) { + invMassBach0 = bach0.invMassDstar(); + invMassD0 = bach0.invMassD0(); + sign = 1; + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{bach0.pVectorProng0(), bach0.pVectorProng1(), bach0.pVectorProng2(), bach1.pVector()}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + } + } else { + invMassBach0 = bach0.invMassAntiDstar(); + invMassD0 = bach0.invMassD0Bar(); + sign = -1; + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{bach0.pVectorProng1(), bach0.pVectorProng0(), bach0.pVectorProng2(), bach1.pVector()}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + } + } + } else if (channel == DecayChannel::Ds2StarToDplusK0s) { + pdgMassReso = MassDS2Star; + pdgMassBach0 = MassDPlus; + pdgMassBach1 = MassK0; + invMassBach0 = bach0.invMassDplus(); + invMassD0 = 0; + invMassBach1 = bach1.invMassK0s(); + cosThetaStar = candidate.cosThetaStarDs2Star(); + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{bach0.pVectorProng0(), bach0.pVectorProng1(), bach0.pVectorProng2(), bach1.pVector()}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + } + if (bach0.dType() > 0) { + sign = 1; + } else { + sign = -1; + } + } + float y = RecoDecay::y(std::array{candidate.px(), candidate.py(), candidate.pz()}, pdgMassReso); + float eta = RecoDecay::eta(std::array{candidate.px(), candidate.py(), candidate.pz()}); + float phi = RecoDecay::phi(candidate.px(), candidate.py()); + float p = RecoDecay::p(std::array{candidate.px(), candidate.py(), candidate.pz()}); + float e = RecoDecay::e(std::array{candidate.px(), candidate.py(), candidate.pz()}, pdgMassReso); + if (useDeltaMass) { + invMassReso = invMassReso - invMassBach0; + } else { + invMassReso = RecoDecay::m(std::array{bach0.pVector(), bach1.pVector()}, std::array{pdgMassBach0, pdgMassBach1}); + } + invMassBach0 = invMassBach0 - invMassD0; + float ptGen{-1.}; + int8_t origin{-1}, flagMcMatchRec{-1}, debugMcRec{-1}, signD0{0}; + if constexpr (doMc) { + ptGen = candidate.ptMother(); + origin = candidate.origin(); + flagMcMatchRec = candidate.flagMcMatchRec(); + debugMcRec = candidate.debugMcRec(); + if (fillOnlySignal) { + if (channel == DecayChannel::Ds1ToDstarK0s && !(std::abs(flagMcMatchRec) == DecayTypeMc::Ds1ToDStarK0ToD0PiK0s || std::abs(flagMcMatchRec) == DecayTypeMc::Ds1ToDStarK0ToD0PiK0sPart || std::abs(flagMcMatchRec) == DecayTypeMc::Ds1ToDStarK0ToD0NoPiK0sPart || std::abs(flagMcMatchRec) == DecayTypeMc::Ds1ToDStarK0ToD0PiK0sOneMu)) { + return; + } + if (channel == DecayChannel::Ds2StarToDplusK0s && !(std::abs(flagMcMatchRec) == DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi || std::abs(flagMcMatchRec) == DecayTypeMc::Ds2StarToDplusK0sOneMu)) { + return; + } + } + if (origin == 1) { + registry.fill(HIST("hYRecPrompt"), candidate.pt(), y); + } else if (origin == 2) { + registry.fill(HIST("hYRecNonPrompt"), candidate.pt(), y); + } + } + float mlScoreBkg{-1.}, mlScorePrompt{-1.}, mlScoreNonPrompt{-1.}; + if constexpr (withMl) { + mlScoreBkg = bach0.mlScoreBkgMassHypo0(); + mlScorePrompt = bach0.mlScorePromptMassHypo0(); + mlScoreNonPrompt = bach0.mlScoreNonpromptMassHypo0(); + } // Collision properties registry.fill(HIST("hNPvCont"), collision.numContrib()); registry.fill(HIST("hZvert"), collision.posZ()); registry.fill(HIST("hBz"), collision.bz()); // Candidate properties - registry.fill(HIST("hMass"), candidate.invMass()); - registry.fill(HIST("hMassProng0"), candidate.invMassProng0()); - registry.fill(HIST("hMassProng1"), candidate.invMassProng1()); + registry.fill(HIST("hMass"), invMassReso); + registry.fill(HIST("hMassProng0"), invMassBach0); + registry.fill(HIST("hMassProng1"), invMassBach1); registry.fill(HIST("hPt"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); - float cosThetaStar{0.}; - switch (channel) { - case DecayChannel::Ds1ToDstarK0s: - cosThetaStar = candidate.cosThetaStarDs1(); - break; - case DecayChannel::Ds2StarToDplusK0s: - cosThetaStar = candidate.cosThetaStarDs2Star(); - break; - default: - cosThetaStar = candidate.cosThetaStarXiC3055(); - break; + if (fillSparses) { + registry.fill(HIST("hSparse"), candidate.pt(), candidate.ptProng0(), candidate.ptProng1(), invMassReso, invMassBach0, invMassBach1, cosThetaStar, mlScoreBkg, mlScoreNonPrompt); + } + + if (fillTrees) { + hfCandResoLite( + invMassReso, + candidate.pt(), + p, + y, + eta, + phi, + e, + cosThetaStar, + sign, + // Bachelors Properties + invMassBach0, + bach0.pt(), + mlScoreBkg, + mlScorePrompt, + mlScoreNonPrompt, + bach0.itsNClsProngMin(), + bach0.tpcNClsCrossedRowsProngMin(), + bach0.tpcChi2NClProngMax(), + invMassBach1, + bach1.pt(), + bach1.cpa(), + bach1.dca(), + bach1.v0Radius(), + bach1.itsNClsProngMin(), + bach1.tpcNClsCrossedRowsProngMin(), + bach1.tpcChi2NClProngMax(), + // MC + flagMcMatchRec, + debugMcRec, + origin, + ptGen, + signD0); } - registry.fill(HIST("hSparse"), candidate.pt(), candidate.ptProng0(), candidate.ptProng1(), candidate.invMass(), candidate.invMassProng0(), candidate.invMassProng1(), cosThetaStar, candidate.mlScoreBkgProng0(), candidate.mlScoreNonpromptProng0()); - } // fillHisto + } // fillCand // Process data /// \tparam channel is the decay channel of the Resonance /// \param Coll is the reduced collisions table + /// \param CharmBach is the reduced 3 prong table + /// \param V0Bach is the reduced v0 table /// \param Cand is the candidates table - template - void processData(Coll const&, Candidates const& candidates) + template + void processData(Coll const&, Candidates const& candidates, CharmBach const&, aod::HfRedVzeros const&) { for (const auto& cand : candidates) { - if (cand.pt() < ptMinReso) { + if (ptMinReso >= 0 && cand.pt() < ptMinReso) { + continue; + } + float pdgMassReso{0}; + if (channel == DecayChannel::Ds1ToDstarK0s) { + pdgMassReso = MassDS1; + } else if (channel == DecayChannel::Ds2StarToDplusK0s) { + pdgMassReso = MassDS2Star; + } + if (yCandRecoMax >= 0. && std::abs(RecoDecay::y(std::array{cand.px(), cand.py(), cand.pz()}, pdgMassReso)) > yCandRecoMax) { continue; } auto coll = cand.template hfRedCollision_as(); - fillHisto(cand, coll); + auto bach0 = cand.template prong0_as(); + auto bach1 = cand.template prong1_as(); + fillCand(cand, coll, bach0, bach1); } } - // Process data with Mixed Event - /// \tparam channel is the decay channel of the Resonance - /// \param Coll is the reduced collisions table - /// \param Cand is the candidates table - template - void processDataMixedEvent(Coll const& collisions, Candidates const& candidates) + /// Selection of resonance daughters in geometrical acceptance + /// \param etaProng is the pseudorapidity of Resonance prong + /// \param ptProng is the pT of Resonance prong + /// \return true if prong is in geometrical acceptance + template + bool isProngInAcceptance(const T& etaProng, const T& ptProng) { - using BinningType = ColumnBinningPolicy; - BinningType corrBinning{{zPoolBins, multPoolBins}, true}; - auto candsTuple = std::make_tuple(candidates); - SameKindPair pairs{corrBinning, numberEventsMixed, numberEventsToSkip, collisions, candsTuple, &cache}; - for (const auto& [collision1, cands1, collision2, cands2] : pairs) { - // For each couple of candidate resonances I can make 2 mixed candidates by swithching daughters - for (const auto& [cand1, cand2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(cands1, cands2))) { - if (cutBeforeMixing && (cand1.pt() < ptMinReso || cand2.pt() < ptMinReso)) { - continue; - } - float ptME1 = RecoDecay::pt(cand1.pVectorProng0(), cand2.pVectorProng1()); - float invMassME1; - float cosThetaStarME1; - if (!cutAfterMixing || ptME1 > ptMinReso) { - switch (channel) { - case DecayChannel::Ds1ToDstarK0s: - invMassME1 = RecoDecay::m(std::array{cand1.pVectorProng0(), cand2.pVectorProng1()}, std::array{o2::constants::physics::MassDStar, o2::constants::physics::MassK0Short}); - cosThetaStarME1 = RecoDecay::cosThetaStar(std::array{cand1.pVectorProng0(), cand2.pVectorProng1()}, std::array{o2::constants::physics::MassDStar, o2::constants::physics::MassK0Short}, invMassME1, 1); - break; - case DecayChannel::Ds2StarToDplusK0s: - invMassME1 = RecoDecay::m(std::array{cand1.pVectorProng0(), cand2.pVectorProng1()}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassK0Short}); - cosThetaStarME1 = RecoDecay::cosThetaStar(std::array{cand1.pVectorProng0(), cand2.pVectorProng1()}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassK0Short}, invMassME1, 1); - break; - default: - invMassME1 = RecoDecay::m(std::array{cand1.pVectorProng0(), cand2.pVectorProng1()}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassLambda0}); - cosThetaStarME1 = RecoDecay::cosThetaStar(std::array{cand1.pVectorProng0(), cand2.pVectorProng1()}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassLambda0}, invMassME1, 1); - break; + return std::abs(etaProng) <= etaTrackMax && ptProng >= ptTrackMin; + } + + /// Fill particle histograms (gen MC truth) + template + void fillCandMcGen(aod::HfMcGenRedResos const& mcParticles) + { + for (const auto& particle : mcParticles) { + auto ptParticle = particle.ptTrack(); + auto yParticle = particle.yTrack(); + auto originParticle = particle.origin(); + auto flag = particle.flagMcMatchGen(); + if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { + continue; + } + std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; + std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; + bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + if ((channel == DecayChannel::Ds1ToDstarK0s && std::abs(flag) == DecayTypeMc::Ds1ToDStarK0ToD0PiK0s) || + (channel == DecayChannel::Ds2StarToDplusK0s && std::abs(flag) == DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi)) { + if (originParticle == 1) { // prompt particles + registry.fill(HIST("hYGenPrompt"), ptParticle, yParticle); + if (prongsInAcc) { + registry.fill(HIST("hYGenPromptWithProngsInAcceptance"), ptParticle, yParticle); } - registry.fill(HIST("hMass"), invMassME1); - registry.fill(HIST("hPt"), ptME1); - registry.fill(HIST("hNPvContCorr"), collision1.numContrib(), collision2.numContrib()); - registry.fill(HIST("hZvertCorr"), collision1.posZ(), collision2.posZ()); - registry.fill(HIST("hMassProng0Corr"), cand1.invMassProng0(), cand2.invMassProng0()); - registry.fill(HIST("hMassProng1Corr"), cand1.invMassProng1(), cand2.invMassProng1()); - registry.fill(HIST("hSparse"), ptME1, cand1.ptProng0(), cand2.ptProng1(), invMassME1, cand1.invMassProng0(), cand2.invMassProng1(), cosThetaStarME1, cand1.mlScoreBkgProng0(), cand1.mlScoreNonpromptProng0()); - } - float ptME2 = RecoDecay::pt(cand2.pVectorProng0(), cand1.pVectorProng1()); - float invMassME2; - float cosThetaStarME2; - if (!cutAfterMixing || ptME2 > ptMinReso) { - switch (channel) { - case DecayChannel::Ds1ToDstarK0s: - invMassME2 = RecoDecay::m(std::array{cand2.pVectorProng0(), cand1.pVectorProng1()}, std::array{o2::constants::physics::MassDStar, o2::constants::physics::MassK0Short}); - cosThetaStarME2 = RecoDecay::cosThetaStar(std::array{cand2.pVectorProng0(), cand1.pVectorProng1()}, std::array{o2::constants::physics::MassDStar, o2::constants::physics::MassK0Short}, invMassME2, 1); - break; - case DecayChannel::Ds2StarToDplusK0s: - invMassME2 = RecoDecay::m(std::array{cand2.pVectorProng0(), cand1.pVectorProng1()}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassK0Short}); - cosThetaStarME2 = RecoDecay::cosThetaStar(std::array{cand2.pVectorProng0(), cand1.pVectorProng1()}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassK0Short}, invMassME2, 1); - break; - default: - invMassME2 = RecoDecay::m(std::array{cand2.pVectorProng0(), cand1.pVectorProng1()}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassLambda0}); - cosThetaStarME2 = RecoDecay::cosThetaStar(std::array{cand2.pVectorProng0(), cand1.pVectorProng1()}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassLambda0}, invMassME2, 1); - break; + } else if (originParticle == 2) { + registry.fill(HIST("hYGenNonPrompt"), ptParticle, yParticle); + if (prongsInAcc) { + registry.fill(HIST("hYGenNonPromptWithProngsInAcceptance"), ptParticle, yParticle); } - registry.fill(HIST("hMass"), invMassME2); - registry.fill(HIST("hPt"), ptME2); - registry.fill(HIST("hSparse"), ptME2, cand2.ptProng0(), cand1.ptProng1(), invMassME2, cand2.invMassProng0(), cand1.invMassProng1(), cosThetaStarME2, cand2.mlScoreBkgProng0(), cand2.mlScoreNonpromptProng0()); } } + if (fillSparses) { + registry.fill(HIST("hPtYGenSig"), ptParticle, yParticle, originParticle, flag); + if (prongsInAcc) { + registry.fill(HIST("hPtYWithProngsInAccepanceGenSig"), ptParticle, yParticle, originParticle, flag); + } + } + if (fillTrees) { + hfGenResoLite(ptParticle, yParticle, originParticle); + } } - } + } // fillCandMcGen // process functions - void processDs1Data(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates) + void processDs1Data(aod::HfRedCollisions const& collisions, ReducedReso const& candidates, aod::HfRed3PrNoTrks const& charmBachs, aod::HfRedVzeros const& v0Bachs) + { + processData(collisions, candidates, charmBachs, v0Bachs); + } + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs1Data, "Process data for Ds1 analysis without Ml", true); + + void processDs1DataWithMl(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates, soa::Join const& charmBachs, aod::HfRedVzeros const& v0Bachs) + { + processData(collisions, candidates, charmBachs, v0Bachs); + } + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs1DataWithMl, "Process data for Ds1 analysis with Ml", false); + + void processDs2StarData(aod::HfRedCollisions const& collisions, ReducedReso const& candidates, aod::HfRed3PrNoTrks const& charmBachs, aod::HfRedVzeros const& v0Bachs) + { + processData(collisions, candidates, charmBachs, v0Bachs); + } + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs2StarData, "Process data Ds2Star analysis without Ml", false); + + void processDs2StarDataWithMl(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates, soa::Join const& charmBachs, aod::HfRedVzeros const& v0Bachs) + { + processData(collisions, candidates, charmBachs, v0Bachs); + } + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs2StarDataWithMl, "Process data Ds2Star analysis with Ml", false); + + void processDs1Mc(aod::HfRedCollisions const& collisions, ReducedResoMc const& candidates, aod::HfMcGenRedResos const& mcParticles, aod::HfRed3PrNoTrks const& charmBachs, aod::HfRedVzeros const& v0Bachs) { - processData(collisions, candidates); + processData(collisions, candidates, charmBachs, v0Bachs); + fillCandMcGen(mcParticles); } - PROCESS_SWITCH(HfTaskCharmResoReduced, processDs1Data, "Process data", true); + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs1Mc, "Process Mc for Ds1 analysis without Ml", false); - void processDs1DataMixedEvent(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates) + void processDs1McWithMl(aod::HfRedCollisions const& collisions, ReducedResoWithMlMc const& candidates, aod::HfMcGenRedResos const& mcParticles, soa::Join const& charmBachs, aod::HfRedVzeros const& v0Bachs) { - processDataMixedEvent(collisions, candidates); + processData(collisions, candidates, charmBachs, v0Bachs); + fillCandMcGen(mcParticles); } - PROCESS_SWITCH(HfTaskCharmResoReduced, processDs1DataMixedEvent, "Process data with Event Mixing", false); + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs1McWithMl, "Process Mc for Ds1 analysis with Ml", false); - void processDs2StarData(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates) + void processDs2StarMc(aod::HfRedCollisions const& collisions, ReducedResoMc const& candidates, aod::HfMcGenRedResos const& mcParticles, aod::HfRed3PrNoTrks const& charmBachs, aod::HfRedVzeros const& v0Bachs) { - processData(collisions, candidates); + processData(collisions, candidates, charmBachs, v0Bachs); + fillCandMcGen(mcParticles); } - PROCESS_SWITCH(HfTaskCharmResoReduced, processDs2StarData, "Process data", false); + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs2StarMc, "Process Mc for Ds2Star analysis without Ml", false); - void processDs2StarDataMixedEvent(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates) + void processDs2StarMcWithMl(aod::HfRedCollisions const& collisions, ReducedResoWithMlMc const& candidates, aod::HfMcGenRedResos const& mcParticles, soa::Join const& charmBachs, aod::HfRedVzeros const& v0Bachs) { - processDataMixedEvent(collisions, candidates); + processData(collisions, candidates, charmBachs, v0Bachs); + fillCandMcGen(mcParticles); } - PROCESS_SWITCH(HfTaskCharmResoReduced, processDs2StarDataMixedEvent, "Process data with Event Mixing", false); + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs2StarMcWithMl, "Process Mc for Ds2Star analysis with Ml", false); }; // struct HfTaskCharmResoReduced WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index e5e12298f3f..f76d9d7bfb8 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -15,6 +15,8 @@ /// \author Gian Michele Innocenti , CERN /// \author Vít Kučera , CERN +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -64,6 +66,7 @@ struct HfTaskD0 { ConfigurableAxis thnConfigAxisCandType{"thnConfigAxisCandType", {4, -0.5, 3.5}, "D0 type"}; ConfigurableAxis thnConfigAxisGenPtD{"thnConfigAxisGenPtD", {500, 0, 50}, "Gen Pt D"}; ConfigurableAxis thnConfigAxisGenPtB{"thnConfigAxisGenPtB", {1000, 0, 100}, "Gen Pt B"}; + ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "Number of PV contributors"}; HfHelper hfHelper; @@ -77,6 +80,10 @@ struct HfTaskD0 { using D0CandidatesMlKF = soa::Join; using D0CandidatesMlMcKF = soa::Join; + using CollisionsWithMcLabels = soa::Join; + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; + SliceCache cache; + Partition selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; Partition selectedD0CandidatesKF = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; Partition selectedD0CandidatesMc = aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf; @@ -220,19 +227,30 @@ struct HfTaskD0 { const AxisSpec thnAxisCandType{thnConfigAxisCandType, "D0 type"}; const AxisSpec thnAxisGenPtD{thnConfigAxisGenPtD, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisGenPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; + const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "Number of PV contributors"}; - registry.add("hSparseAcc", "Thn for generated D0 from charm and beauty", HistType::kTHnSparseD, {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin}); - registry.get(HIST("hSparseAcc"))->Sumw2(); + if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { + registry.add("hSparseAcc", "Thn for generated D0 from charm and beauty", HistType::kTHnSparseD, {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}); + registry.get(HIST("hSparseAcc"))->Sumw2(); + } if (applyMl) { const AxisSpec thnAxisBkgScore{thnConfigAxisBkgScore, "BDT score bkg."}; const AxisSpec thnAxisNonPromptScore{thnConfigAxisNonPromptScore, "BDT score non-prompt."}; const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt."}; - registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates with BDT scores", HistType::kTHnSparseD, {thnAxisBkgScore, thnAxisNonPromptScore, thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin, thnAxisCandType}); + if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { + registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates with BDT scores", HistType::kTHnSparseD, {thnAxisBkgScore, thnAxisNonPromptScore, thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType, thnAxisPtB, thnAxisOrigin, thnAxisNumPvContr}); + } else { + registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates with BDT scores", HistType::kTHnSparseD, {thnAxisBkgScore, thnAxisNonPromptScore, thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType}); + } registry.get(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2(); } else { - registry.add("hMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates without BDT scores", HistType::kTHnSparseD, {thnAxisMass, thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin, thnAxisCandType}); + if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { + registry.add("hMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates without BDT scores", HistType::kTHnSparseD, {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType, thnAxisPtB, thnAxisOrigin}); + } else { + registry.add("hMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates without BDT scores", HistType::kTHnSparseD, {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType}); + } registry.get(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2(); } } @@ -299,17 +317,17 @@ struct HfTaskD0 { if constexpr (applyMl) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); } } else { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); } } } @@ -341,7 +359,9 @@ struct HfTaskD0 { template void processMc(CandType const& candidates, soa::Join const& mcParticles, - aod::TracksWMc const&) + aod::TracksWMc const&, + CollisionsWithMcLabels const& collisions, + aod::McCollisions const&) { // MC rec. for (const auto& candidate : candidates) { @@ -351,6 +371,9 @@ struct HfTaskD0 { if (yCandRecoMax >= 0. && std::abs(hfHelper.yD0(candidate)) > yCandRecoMax) { continue; } + + auto collision = candidate.template collision_as(); + auto numPvContributors = collision.numContrib(); float massD0, massD0bar; if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { massD0 = candidate.kfGeoMassD0(); @@ -476,9 +499,9 @@ struct HfTaskD0 { registry.fill(HIST("hDecLengthxyVsPtSig"), declengthxyCandidate, ptCandidate); registry.fill(HIST("hMassSigD0"), massD0, ptCandidate, rapidityCandidate); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { registry.fill(HIST("hPtProng0Bkg"), ptProng0, rapidityCandidate); @@ -498,9 +521,9 @@ struct HfTaskD0 { if (candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassReflBkgD0"), massD0, ptCandidate, rapidityCandidate); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } @@ -510,18 +533,18 @@ struct HfTaskD0 { if (candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassSigD0bar"), massD0bar, ptCandidate, rapidityCandidate); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { registry.fill(HIST("hMassBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassReflBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } @@ -539,17 +562,23 @@ struct HfTaskD0 { registry.fill(HIST("hPtGen"), ptGen); registry.fill(HIST("hPtVsYGen"), ptGen, yGen); + unsigned maxNumContrib = 0; + const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); + for (const auto& recCol : recoCollsPerMcColl) { + maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; + } + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hPtGenPrompt"), ptGen); registry.fill(HIST("hYGenPrompt"), yGen); registry.fill(HIST("hPtVsYGenPrompt"), ptGen, yGen); - registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1); + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib); } else { ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); registry.fill(HIST("hPtGenNonPrompt"), ptGen); registry.fill(HIST("hYGenNonPrompt"), yGen); registry.fill(HIST("hPtVsYGenNonPrompt"), ptGen, yGen); - registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2); + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib); } registry.fill(HIST("hEtaGen"), particle.eta()); } @@ -558,33 +587,41 @@ struct HfTaskD0 { void processMcWithDCAFitterN(D0CandidatesMc const&, soa::Join const& mcParticles, - aod::TracksWMc const& tracks) + aod::TracksWMc const& tracks, + CollisionsWithMcLabels const& collisions, + aod::McCollisions const& mcCollisions) { - processMc(selectedD0CandidatesMc, mcParticles, tracks); + processMc(selectedD0CandidatesMc, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterN, "Process MC with DCAFitterN", false); void processMcWithKFParticle(D0CandidatesMcKF const&, soa::Join const& mcParticles, - aod::TracksWMc const& tracks) + aod::TracksWMc const& tracks, + CollisionsWithMcLabels const& collisions, + aod::McCollisions const& mcCollisions) { - processMc(selectedD0CandidatesMcKF, mcParticles, tracks); + processMc(selectedD0CandidatesMcKF, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticle, "Process MC with KFParticle", false); void processMcWithDCAFitterNMl(D0CandidatesMlMc const&, soa::Join const& mcParticles, - aod::TracksWMc const& tracks) + aod::TracksWMc const& tracks, + CollisionsWithMcLabels const& collisions, + aod::McCollisions const& mcCollisions) { - processMc(selectedD0CandidatesMlMc, mcParticles, tracks); + processMc(selectedD0CandidatesMlMc, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNMl, "Process MC with DCAFitterN and ML selection", false); void processMcWithKFParticleMl(D0CandidatesMlMcKF const&, soa::Join const& mcParticles, - aod::TracksWMc const& tracks) + aod::TracksWMc const& tracks, + CollisionsWithMcLabels const& collisions, + aod::McCollisions const& mcCollisions) { - processMc(selectedD0CandidatesMlMcKF, mcParticles, tracks); + processMc(selectedD0CandidatesMlMcKF, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); }; diff --git a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx new file mode 100644 index 00000000000..763a1292a52 --- /dev/null +++ b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx @@ -0,0 +1,407 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file taskDirectedFlowCharmHadrons.cxx +/// \brief Analysis task for charm hadron directed flow +/// +/// \author Prottay Das, prottay.das@cern.ch +/// \author Biao Zhang, biao.zhanng@cern.ch + +#include +#include +#include +#include + +#include "CCDB/BasicCCDBManager.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include "Common/Core/EventPlaneHelper.h" +#include "PWGLF/DataModel/SPCalibrationTables.h" + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::hf_centrality; +using namespace o2::hf_evsel; + +enum DecayChannel { DplusToPiKPi = 0, + D0ToPiK, + D0ToKPi, + DstarToD0Pi }; + +struct HfTaskDirectedFlowCharmHadrons { + Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)"}; + Configurable selectionFlagDstar{"selectionFlagDstar", false, "Selection Flag for Dstar"}; + Configurable selectionFlag{"selectionFlag", 1, "Selection Flag for hadron (e.g. 1 for skimming, 3 for topo. and kine., 7 for PID)"}; + Configurable centralityMin{"centralityMin", 0., "Minimum centrality accepted in SP computation"}; + Configurable centralityMax{"centralityMax", 100., "Maximum centrality accepted in SP computation"}; + Configurable storeMl{"storeMl", false, "Flag to store ML scores"}; + Configurable direct{"direct", false, "Flag to calculate direct v1 odd and even"}; + Configurable userap{"userap", false, "Flag to fill rapidity vs eta "}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable> classMl{"classMl", {0, 2}, "Indices of BDT scores to be stored. Two indexes max."}; + + ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {100, 1.78, 2.05}, ""}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0}, ""}; + ConfigurableAxis thnConfigAxisEta{"thnConfigAxisEta", {VARIABLE_WIDTH, -0.8, -0.4, 0, 0.4, 0.8}, ""}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {VARIABLE_WIDTH, 0.0, 10.0, 40.0, 80.0}, ""}; + ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {8000, -2.0, 2.0}, ""}; + ConfigurableAxis thnConfigAxisSign{"thnConfigAxisSign", {2, -2.0, 2.0}, ""}; + ConfigurableAxis thnConfigAxisMlOne{"thnConfigAxisMlOne", {1000, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisMlTwo{"thnConfigAxisMlTwo", {1000, 0., 1.}, ""}; + + using CandDplusDataWMl = soa::Filtered>; + using CandDplusData = soa::Filtered>; + using CandD0DataWMl = soa::Filtered>; + using CandD0Data = soa::Filtered>; + using CandDstarDataWMl = soa::Filtered>; + using CandDstarData = soa::Filtered>; + using CollsWithQvecs = soa::Join; + using TracksWithExtra = soa::Join; + + Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag; + Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; + Filter filterSelectDstarCandidates = aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == selectionFlagDstar; + + Partition selectedD0ToPiK = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag; + Partition selectedD0ToKPi = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; + Partition selectedD0ToPiKWMl = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag; + Partition selectedD0ToKPiWMl = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; + + SliceCache cache; + HfHelper hfHelper; + EventPlaneHelper epHelper; + HfEventSelection hfEvSel; // event selection and monitoring + o2::framework::Service ccdb; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + + /// check process functions + std::array processes = {doprocessDplusStd, doprocessDplusMl, doprocessD0Std, doprocessD0Ml, doprocessDstarStd, doprocessDstarMl}; + const int nProcesses = std::accumulate(processes.begin(), processes.end(), 0); + if (nProcesses > 1) { + LOGP(fatal, "Only one process function should be enabled at a time, please check your configuration"); + } else if (nProcesses == 0) { + LOGP(fatal, "No process function enabled"); + } + + const AxisSpec thnAxisInvMass{thnConfigAxisInvMass, "Inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec thnAxisEta{thnConfigAxisEta, "#it{#eta}"}; + const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; + const AxisSpec thnAxisScalarProd{thnConfigAxisScalarProd, "SP"}; + const AxisSpec thnAxisSign{thnConfigAxisSign, "Sign"}; + const AxisSpec thnAxisMlOne{thnConfigAxisMlOne, "Bkg score"}; + const AxisSpec thnAxisMlTwo{thnConfigAxisMlTwo, "FD score"}; + + std::vector axes = {thnAxisInvMass, thnAxisCent, thnAxisPt, thnAxisEta, thnAxisScalarProd, thnAxisSign}; + if (storeMl) { + axes.insert(axes.end(), {thnAxisMlOne, thnAxisMlTwo}); + } + + if (direct) { + registry.add("hpQxytpvscent", "hpQxytpvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpuxyQxypvscentpteta", "hpuxyQxypvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpuxyQxytvscentpteta", "hpuxyQxytvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpoddvscentpteta", "hpoddvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpevenvscentpteta", "hpevenvscentpteta", HistType::kTHnSparseF, axes, true); + + registry.add("hpQxpvscent", "hpQxpvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQypvscent", "hpQypvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQxtvscent", "hpQxtvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQytvscent", "hpQytvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpuxvscentpteta", "hpuxvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpuyvscentpteta", "hpuyvscentpteta", HistType::kTHnSparseF, axes, true); + } else { + registry.add("hpQxtQxpvscent", "hpQxtQxpvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQytQypvscent", "hpQytQypvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQxtQypvscent", "hpQxtQypvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQxpQytvscent", "hpQxpQytvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpuxQxpvscentpteta", "hpuxQxpvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpuyQypvscentpteta", "hpuyQypvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpuxQxtvscentpteta", "hpuxQxtvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpuyQytvscentpteta", "hpuyQytvscentpteta", HistType::kTHnSparseF, axes, true); + + registry.add("hpQxpvscent", "hpQxpvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQypvscent", "hpQypvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQxtvscent", "hpQxtvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQytvscent", "hpQytvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpuxvscentpteta", "hpuxvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpuyvscentpteta", "hpuyvscentpteta", HistType::kTHnSparseF, axes, true); + } + + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + }; // end init + + /// Get the centrality + /// \param collision is the collision with the centrality information + double getCentrality(CollsWithQvecs::iterator const& collision) + { + double cent = -999.; + switch (centEstimator) { + case CentralityEstimator::FV0A: + cent = collision.centFV0A(); + break; + case CentralityEstimator::FT0M: + cent = collision.centFT0M(); + break; + case CentralityEstimator::FT0A: + cent = collision.centFT0A(); + break; + case CentralityEstimator::FT0C: + cent = collision.centFT0C(); + break; + default: + LOG(warning) << "Centrality estimator not valid. Possible values are V0A, T0M, T0A, T0C. Fallback to V0A"; + cent = collision.centFV0A(); + break; + } + return cent; + } + + /// Compute the scalar product + /// \param collision is the collision with the Q vector information and event plane + /// \param candidates are the selected candidates + template + void runFlowAnalysis(CollsWithQvecs::iterator const& collision, + T1 const& candidates, + Trk const& /*tracks*/) + { + double cent = getCentrality(collision); + if (cent < centralityMin || cent > centralityMax) { + return; + } + + if (!collision.triggereventsp()) { // for selecting only callibrated events + return; + } + + auto qxZDCA = collision.qxZDCA(); + auto qyZDCA = collision.qyZDCA(); + auto qxZDCC = collision.qxZDCC(); // extracting q vectors of ZDC + auto qyZDCC = collision.qyZDCC(); + + auto QxtQxp = qxZDCC * qxZDCA; + auto QytQyp = qyZDCC * qyZDCA; + auto Qxytp = QxtQxp + QytQyp; + auto QxpQyt = qxZDCA * qyZDCC; + auto QxtQyp = qxZDCC * qyZDCA; + + // correlations in the denominators for SP calculation + if (direct) { + registry.fill(HIST("hpQxytpvscent"), cent, Qxytp); + registry.fill(HIST("hpQxpvscent"), cent, qxZDCA); + registry.fill(HIST("hpQxtvscent"), cent, qxZDCC); + registry.fill(HIST("hpQypvscent"), cent, qyZDCA); + registry.fill(HIST("hpQytvscent"), cent, qyZDCC); + } else { + registry.fill(HIST("hpQxtQxpvscent"), cent, QxtQxp); + registry.fill(HIST("hpQytQypvscent"), cent, QytQyp); + registry.fill(HIST("hpQxpQytvscent"), cent, QxpQyt); + registry.fill(HIST("hpQxtQypvscent"), cent, QxtQyp); + registry.fill(HIST("hpQxpvscent"), cent, qxZDCA); + registry.fill(HIST("hpQxtvscent"), cent, qxZDCC); + registry.fill(HIST("hpQypvscent"), cent, qyZDCA); + registry.fill(HIST("hpQytvscent"), cent, qyZDCC); + } + + for (const auto& candidate : candidates) { + double massCand = 0.; + double rapCand = 0.; + double signDstarCand = 0.0; + std::vector outputMl = {-999., -999.}; + if constexpr (std::is_same_v || std::is_same_v) { + massCand = hfHelper.invMassDplusToPiKPi(candidate); + rapCand = hfHelper.yDplus(candidate); + if constexpr (std::is_same_v) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; + } + } else if constexpr (std::is_same_v || std::is_same_v) { + switch (channel) { + case DecayChannel::D0ToPiK: + massCand = hfHelper.invMassD0ToPiK(candidate); + if constexpr (std::is_same_v) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; + } + break; + case DecayChannel::D0ToKPi: + massCand = hfHelper.invMassD0barToKPi(candidate); + if constexpr (std::is_same_v) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; + } + break; + default: + break; + } + } else if constexpr (std::is_same_v || std::is_same_v) { + signDstarCand = candidate.signSoftPi(); + if (candidate.signSoftPi() > 0) { + massCand = std::abs(candidate.invMassDstar() - candidate.invMassD0()); + rapCand = candidate.y(candidate.invMassDstar()); + } else if (candidate.signSoftPi() < 0) { + massCand = std::abs(candidate.invMassAntiDstar() - candidate.invMassD0Bar()); + rapCand = candidate.y(candidate.invMassAntiDstar()); + } + if constexpr (std::is_same_v) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + outputMl[iclass] = candidate.mlProbDstarToD0Pi()[classMl->at(iclass)]; + } + } + + auto trackprong0 = candidate.template prong0_as(); + double sign = trackprong0.sign(); // electric charge of the first daughter track to differentiate particle and antiparticle + + double ptCand = candidate.pt(); + double etaCand = candidate.eta(); + double phiCand = candidate.phi(); + double cosNPhi = std::cos(phiCand); + double sinNPhi = std::sin(phiCand); + + if (userap) + etaCand = rapCand; + + if (selectionFlagDstar) + sign = signDstarCand; + + auto ux = cosNPhi; // real part of candidate q vector + auto uy = sinNPhi; // imaginary part of candidate q vector + auto uxQxp = ux * qxZDCA; + auto uyQyp = uy * qyZDCA; // correlations of particle and ZDC q vectors + auto uxyQxyp = uxQxp + uyQyp; + auto uxQxt = ux * qxZDCC; + auto uyQyt = uy * qyZDCC; + auto uxyQxyt = uxQxt + uyQyt; + auto oddv1 = ux * (qxZDCA - qxZDCC) + uy * (qyZDCA - qyZDCC); + auto evenv1 = ux * (qxZDCA + qxZDCC) + uy * (qyZDCA + qyZDCC); + + if (storeMl) { + if (direct) { + registry.fill(HIST("hpuxyQxypvscentpteta"), massCand, cent, ptCand, etaCand, uxyQxyp, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpuxyQxytvscentpteta"), massCand, cent, ptCand, etaCand, uxyQxyt, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpoddvscentpteta"), massCand, cent, ptCand, etaCand, oddv1, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpevenvscentpteta"), massCand, cent, ptCand, etaCand, evenv1, sign, outputMl[0], outputMl[1]); + + registry.fill(HIST("hpuxvscentpteta"), massCand, cent, ptCand, etaCand, ux, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpuyvscentpteta"), massCand, cent, ptCand, etaCand, uy, sign, outputMl[0], outputMl[1]); + + } else { + registry.fill(HIST("hpuxQxpvscentpteta"), massCand, cent, ptCand, etaCand, uxQxp, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpuyQypvscentpteta"), massCand, cent, ptCand, etaCand, uyQyp, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpuxQxtvscentpteta"), massCand, cent, ptCand, etaCand, uxQxt, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpuyQytvscentpteta"), massCand, cent, ptCand, etaCand, uyQyt, sign, outputMl[0], outputMl[1]); + + registry.fill(HIST("hpuxvscentpteta"), massCand, cent, ptCand, etaCand, ux, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpuyvscentpteta"), massCand, cent, ptCand, etaCand, uy, sign, outputMl[0], outputMl[1]); + } + } else { + if (direct) { + registry.fill(HIST("hpuxyQxypvscentpteta"), massCand, cent, ptCand, etaCand, uxyQxyp, sign); + registry.fill(HIST("hpuxyQxytvscentpteta"), massCand, cent, ptCand, etaCand, uxyQxyt, sign); + registry.fill(HIST("hpoddvscentpteta"), massCand, cent, ptCand, etaCand, oddv1, sign); + registry.fill(HIST("hpevenvscentpteta"), massCand, cent, ptCand, etaCand, evenv1, sign); + + registry.fill(HIST("hpuxvscentpteta"), massCand, cent, ptCand, etaCand, ux, sign); + registry.fill(HIST("hpuyvscentpteta"), massCand, cent, ptCand, etaCand, uy, sign); + } else { + registry.fill(HIST("hpuxQxpvscentpteta"), massCand, cent, ptCand, etaCand, uxQxp, sign); + registry.fill(HIST("hpuyQypvscentpteta"), massCand, cent, ptCand, etaCand, uyQyp, sign); + registry.fill(HIST("hpuxQxtvscentpteta"), massCand, cent, ptCand, etaCand, uxQxt, sign); + registry.fill(HIST("hpuyQytvscentpteta"), massCand, cent, ptCand, etaCand, uyQyt, sign); + + registry.fill(HIST("hpuxvscentpteta"), massCand, cent, ptCand, etaCand, ux, sign); + registry.fill(HIST("hpuyvscentpteta"), massCand, cent, ptCand, etaCand, uy, sign); + } + } + } + } + // D0 with ML + void processD0Ml(CollsWithQvecs::iterator const& collision, + CandD0DataWMl const& /*candidatesD0*/, + TracksWithExtra const& tracks) + { + auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + runFlowAnalysis(collision, candsD0ToPiKWMl, tracks); + runFlowAnalysis(collision, candsD0ToKPiWMl, tracks); + } + PROCESS_SWITCH(HfTaskDirectedFlowCharmHadrons, processD0Ml, "Process D0 candidates with ML", false); + + // D0 with rectangular cuts + void processD0Std(CollsWithQvecs::iterator const& collision, + CandD0Data const& /*candidatesD0*/, + TracksWithExtra const& tracks) + { + auto candsD0ToPiK = selectedD0ToPiK->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + auto candsD0ToKPi = selectedD0ToKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + runFlowAnalysis(collision, candsD0ToPiK, tracks); + runFlowAnalysis(collision, candsD0ToKPi, tracks); + } + PROCESS_SWITCH(HfTaskDirectedFlowCharmHadrons, processD0Std, "Process D0 candidates with rectangular cuts", false); + + // Dplus with ML + void processDplusMl(CollsWithQvecs::iterator const& collision, + CandDplusDataWMl const& candidatesDplus, + TracksWithExtra const& tracks) + { + runFlowAnalysis(collision, candidatesDplus, tracks); + } + PROCESS_SWITCH(HfTaskDirectedFlowCharmHadrons, processDplusMl, "Process Dplus candidates with ML", false); + + // Dplus with rectangular cuts + void processDplusStd(CollsWithQvecs::iterator const& collision, + CandDplusData const& candidatesDplus, + TracksWithExtra const& tracks) + { + runFlowAnalysis(collision, candidatesDplus, tracks); + } + PROCESS_SWITCH(HfTaskDirectedFlowCharmHadrons, processDplusStd, "Process Dplus candidates with rectangular cuts", true); + + // Dstar with ML + void processDstarMl(CollsWithQvecs::iterator const& collision, + CandDstarDataWMl const& candidatesDstar, + TracksWithExtra const& tracks) + { + runFlowAnalysis(collision, candidatesDstar, tracks); + } + PROCESS_SWITCH(HfTaskDirectedFlowCharmHadrons, processDstarMl, "Process Dstar candidates with ML", false); + + // Dstar with rectangular cuts + void processDstarStd(CollsWithQvecs::iterator const& collision, + CandDstarData const& candidatesDstar, + TracksWithExtra const& tracks) + { + runFlowAnalysis(collision, candidatesDstar, tracks); + } + PROCESS_SWITCH(HfTaskDirectedFlowCharmHadrons, processDstarStd, "Process Dstar candidates with rectangular cuts", true); + +}; // End struct HfTaskDirectedFlowCharmHadrons + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/Tasks/taskDs.cxx b/PWGHF/D2H/Tasks/taskDs.cxx index 67fdf886491..e9c49d9fc86 100644 --- a/PWGHF/D2H/Tasks/taskDs.cxx +++ b/PWGHF/D2H/Tasks/taskDs.cxx @@ -17,10 +17,18 @@ /// \author Stefano Politanò , Politecnico & INFN Torino /// \author Fabrizio Chinu , Universita and INFN Torino +#include +#include +#include +#include +#include + +#include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "MetadataHelper.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/CentralityEstimation.h" @@ -32,6 +40,8 @@ using namespace o2::analysis; using namespace o2::framework; using namespace o2::framework::expressions; +MetadataHelper metadataInfo; // Metadata helper + enum FinalState { KKPi = 0, PiKK }; @@ -41,14 +51,10 @@ enum DataType { Data = 0, McDplusPrompt, McDplusNonPrompt, McDplusBkg, + McLcBkg, McBkg, kDataTypes }; -enum SpeciesAndDecay { DsToKKPi = 0, - DplusToKKPi, - DplusToPiKPi, - kSpeciesAndDecay }; - template concept hasDsMlInfo = requires(T candidate) { @@ -69,14 +75,23 @@ struct HfTaskDs { Configurable massDsSignalMax{"massDsSignalMax", 1.994, "max mass for Ds signal"}; Configurable massDplusSignalMin{"massDplusSignalMin", 1.866, "min mass for Dplus signal"}; Configurable massDplusSignalMax{"massDplusSignalMax", 1.906, "max mass for Dplus signal"}; + Configurable fillPercentiles{"fillPercentiles", true, "Wheter to fill multiplicity axis with percentiles or raw information"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 8.f, 12.f, 24.f}, "axis for pT"}; ConfigurableAxis axisNPvContributors{"axisNPvContributors", {200, -0.5f, 199.5f}, "axis for NPvContributors"}; ConfigurableAxis axisMlScore0{"axisMlScore0", {100, 0., 1.}, "axis for ML output score 0"}; ConfigurableAxis axisMlScore1{"axisMlScore1", {100, 0., 1.}, "axis for ML output score 1"}; ConfigurableAxis axisMlScore2{"axisMlScore2", {100, 0., 1.}, "axis for ML output score 2"}; + ConfigurableAxis axisCentrality{"axisCentrality", {100, 0., 1.}, "axis for centrality/multiplicity"}; + + struct : ConfigurableGroup { + Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "The CCDB endpoint url address"}; + Configurable ccdbPath{"ccdbpath", "Centrality/Calibration", "The CCDB path for centrality/multiplicity information"}; + Configurable reconstructionPass{"reconstructionPass", "", {"Apass to use when fetching the calibration tables. Empty (default) does not check for any pass. Use `metadata` to fetch it from the AO2D metadata. Otherwise it will override the metadata."}}; + } ccdbConfig; HfHelper hfHelper; + Service ccdb; using TH1_ptr = std::shared_ptr; using TH2_ptr = std::shared_ptr; @@ -85,14 +100,14 @@ struct HfTaskDs { template using MemberFunctionPointer = bool (HfTaskDs::*)(const CandDs&); - using CollisionsWithFT0C = soa::Join; - using CollisionsWithFT0M = soa::Join; - using CollisionsWithNTracksPV = soa::Join; + using CollisionsWithFT0C = soa::Join; + using CollisionsWithFT0M = soa::Join; + using CollisionsWithNTracksPV = soa::Join; using CollisionsMc = soa::Join; - using CollisionsMcWithFT0C = soa::Join; - using CollisionsMcWithFT0M = soa::Join; - using CollisionsMcWithNTracksPV = soa::Join; + using CollisionsMcWithFT0C = soa::Join; + using CollisionsMcWithFT0M = soa::Join; + using CollisionsMcWithNTracksPV = soa::Join; using CandDsData = soa::Filtered>; using CandDsDataWithMl = soa::Filtered>; @@ -105,12 +120,18 @@ struct HfTaskDs { SliceCache cache; int offsetDplusDecayChannel = aod::hf_cand_3prong::DecayChannelDToKKPi::DplusToPhiPi - aod::hf_cand_3prong::DecayChannelDToKKPi::DsToPhiPi; // Offset between Dplus and Ds to use the same decay channel. See aod::hf_cand_3prong::DecayChannelDToKKPi + int mRunNumber{0}; + bool lCalibLoaded; + TList* lCalibObjects; + TProfile* hVtxZFT0A; + TProfile* hVtxZFT0C; + TProfile* hVtxZNTracks; Filter filterDsFlag = (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi))) != static_cast(0); HistogramRegistry registry{"registry", {}}; - std::array folders = {"Data/", "MC/Ds/Prompt/", "MC/Ds/NonPrompt/", "MC/Dplus/Prompt/", "MC/Dplus/NonPrompt/", "MC/Dplus/Bkg/", "MC/Bkg/"}; + std::array folders = {"Data/", "MC/Ds/Prompt/", "MC/Ds/NonPrompt/", "MC/Dplus/Prompt/", "MC/Dplus/NonPrompt/", "MC/Dplus/Bkg/", "MC/Lc/", "MC/Bkg/"}; std::unordered_map dataHistograms = {}; std::unordered_map mcDsPromptHistograms = {}; @@ -118,9 +139,10 @@ struct HfTaskDs { std::unordered_map mcDplusPromptHistograms = {}; std::unordered_map mcDplusNonPromptHistograms = {}; std::unordered_map mcDplusBkgHistograms = {}; + std::unordered_map mcLcBkgHistograms = {}; std::unordered_map mcBkgHistograms = {}; - std::array, DataType::kDataTypes> histosPtr = {dataHistograms, mcDsPromptHistograms, mcDsNonPromptHistograms, mcDplusPromptHistograms, mcDplusNonPromptHistograms, mcDplusBkgHistograms, mcBkgHistograms}; + std::array, DataType::kDataTypes> histosPtr = {dataHistograms, mcDsPromptHistograms, mcDsNonPromptHistograms, mcDplusPromptHistograms, mcDplusNonPromptHistograms, mcDplusBkgHistograms, mcLcBkgHistograms, mcBkgHistograms}; void init(InitContext&) { @@ -188,7 +210,7 @@ struct HfTaskDs { doprocessMc || doprocessMcWithMl) { // processing MC for (auto i = 0; i < DataType::kDataTypes; ++i) { - if (i == DataType::McDsPrompt || i == DataType::McDsNonPrompt || i == DataType::McDplusPrompt || i == DataType::McDplusNonPrompt || i == DataType::McDplusBkg) { + if (i == DataType::McDsPrompt || i == DataType::McDsNonPrompt || i == DataType::McDplusPrompt || i == DataType::McDplusNonPrompt || i == DataType::McDplusBkg || i == DataType::McLcBkg) { histosPtr[i]["hEtaGen"] = registry.add((folders[i] + "hEtaGen").c_str(), "3-prong candidates (matched);#eta;entries", {HistType::kTH1F, {{100, -2., 2.}}}); histosPtr[i]["hPtGen"] = registry.add((folders[i] + "hPtGen").c_str(), "MC particles (unmatched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {ptbins}}); @@ -231,6 +253,12 @@ struct HfTaskDs { return std::abs(candidate.flagMcMatchRec()) == static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi)); } + template + bool isLcBkg(const CandDs& candidate) + { + return std::abs(candidate.flagMcMatchRec()) == static_cast(BIT(aod::hf_cand_3prong::DecayType::LcToPKPi)); + } + /// Checks whether the candidate is in the signal region of either the Ds or D+ decay /// \param candidate is the candidate /// \param isDs is true if we check for the Ds signal region, false for the D+ signal region @@ -249,13 +277,63 @@ struct HfTaskDs { return true; } + /// Evaluate centrality/multiplicity percentile using FT0M estimator + /// \param candidate is candidate + /// \return centrality/multiplicity percentile of the collision + template + float getZEqMultColl(const Coll& collision, uint8_t nProngsContributorsPV) + { + auto multFT0A = collision.multFT0A() - nProngsContributorsPV; + auto multFT0C = collision.multFT0C() - nProngsContributorsPV; + float multZeqFT0A = hVtxZFT0A->Interpolate(0.0) * multFT0A / hVtxZFT0A->Interpolate(collision.posZ()); + float multZeqFT0C = hVtxZFT0C->Interpolate(0.0) * multFT0C / hVtxZFT0C->Interpolate(collision.posZ()); + return multZeqFT0A + multZeqFT0C; + } + + /// Evaluate centrality/multiplicity percentile using NTracksPV estimator + /// \param candidate is candidate + /// \return centrality/multiplicity percentile of the collision + template + float getZEqMultColl(const Coll& collision, uint8_t nProngsContributorsPV) + { + auto multNTracksPV = collision.multNTracksPV() - nProngsContributorsPV; + float multZeqNTracksPV = hVtxZNTracks->Interpolate(0.0) * multNTracksPV / hVtxZNTracks->Interpolate(collision.posZ()); + return multZeqNTracksPV; + } + + /// Default case if no centrality/multiplicity estimator is provided + /// \param candidate is candidate + /// \return dummy value for centrality/multiplicity percentile of the collision + template + float getZEqMultColl(const Coll&, uint8_t) + { + return -1.f; + } + + /// Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table) + /// \param candidate is candidate + /// \return centrality/multiplicity percentile of the collision + template + float evaluateCentralityColl(const Coll& collision, const CandDs& candidate) + { + if (fillPercentiles) { + return o2::hf_centrality::getCentralityColl(collision); + } else { + return getZEqMultColl(collision, candidate.nProngsContributorsPV()); + } + } + /// Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table) /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision template float evaluateCentralityColl(const Coll& collision) { - return o2::hf_centrality::getCentralityColl(collision); + if (fillPercentiles) { + return o2::hf_centrality::getCentralityColl(collision); + } else { + return getZEqMultColl(collision, 0); + } } /// Evaluate centrality/multiplicity percentile @@ -264,7 +342,7 @@ struct HfTaskDs { template float evaluateCentralityCand(const T1& candidate) { - return evaluateCentralityColl(candidate.template collision_as()); + return evaluateCentralityColl(candidate.template collision_as(), candidate); } /// Fill histograms of quantities independent from the daugther-mass hypothesis @@ -389,19 +467,21 @@ struct HfTaskDs { void fillHistoMCRec(const T1& candidate, const CandDsMcGen& mcParticles, DataType dataType) { - SpeciesAndDecay whichSpeciesDecay = SpeciesAndDecay::DsToKKPi; - if (dataType == DataType::McDplusPrompt || dataType == DataType::McDplusNonPrompt) { - whichSpeciesDecay = SpeciesAndDecay::DplusToKKPi; - } else if (dataType == DataType::McDplusBkg) { - whichSpeciesDecay = SpeciesAndDecay::DplusToPiKPi; + int id = o2::constants::physics::Pdg::kDS; + auto yCand = hfHelper.yDs(candidate); + if (dataType == DataType::McDplusPrompt || dataType == DataType::McDplusNonPrompt || dataType == DataType::McDplusBkg) { + id = o2::constants::physics::Pdg::kDPlus; + yCand = hfHelper.yDplus(candidate); + } else if (dataType == DataType::McLcBkg) { + id = o2::constants::physics::Pdg::kLambdaCPlus; + yCand = hfHelper.yLc(candidate); } auto indexMother = RecoDecay::getMother(mcParticles, candidate.template prong0_as().template mcParticle_as(), - whichSpeciesDecay == SpeciesAndDecay::DsToKKPi ? o2::constants::physics::Pdg::kDS : o2::constants::physics::Pdg::kDPlus, true); + id, true); if (indexMother != -1) { - auto yCand = whichSpeciesDecay == SpeciesAndDecay::DsToKKPi ? hfHelper.yDs(candidate) : hfHelper.yDplus(candidate); if (yCandRecoMax >= 0. && std::abs(yCand) > yCandRecoMax) { return; } @@ -462,15 +542,16 @@ struct HfTaskDs { CandDsMcGen const& mcParticles) { // MC rec. - std::array, 5> isOfType = {// Contains the functions to check if the candidate is of a certain type + std::array, 6> isOfType = {// Contains the functions to check if the candidate is of a certain type &HfTaskDs::isDsPrompt, &HfTaskDs::isDsNonPrompt, &HfTaskDs::isDplusPrompt, &HfTaskDs::isDplusNonPrompt, - &HfTaskDs::isDplusBkg}; + &HfTaskDs::isDplusBkg, + &HfTaskDs::isLcBkg}; bool isBkg = true; - for (int i = DataType::McDsPrompt; i <= DataType::McDplusBkg; i++) { // Check what type of MC signal candidate it is, and fill the corresponding histograms + for (int i = DataType::McDsPrompt; i <= DataType::McLcBkg; i++) { // Check what type of MC signal candidate it is, and fill the corresponding histograms if ((this->*isOfType[i - DataType::McDsPrompt])(candidate)) { isBkg = false; fillHistoMCRec(candidate, mcParticles, static_cast(i)); @@ -577,6 +658,41 @@ struct HfTaskDs { void runDataAnalysisPerCollision(const Coll& collisions, const CandsDs& candsDs) { for (const auto& collision : collisions) { + /* check the previous run number */ + const auto& bc = collision.bc(); + if (bc.runNumber() != mRunNumber) { + mRunNumber = bc.runNumber(); // mark this run as at least tried + if (ccdbConfig.reconstructionPass.value == "") { + lCalibObjects = ccdb->getForRun(ccdbConfig.ccdbPath, mRunNumber); + } else if (ccdbConfig.reconstructionPass.value == "metadata") { + std::map metadata; + metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); + LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName")); + lCalibObjects = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, mRunNumber, metadata); + } else { + std::map metadata; + metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value; + LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value); + lCalibObjects = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, mRunNumber, metadata); + } + + if (lCalibObjects) { + LOG(info) << "CCDB objects loaded successfully"; + hVtxZFT0A = static_cast(lCalibObjects->FindObject("hVtxZFT0A")); + hVtxZFT0C = static_cast(lCalibObjects->FindObject("hVtxZFT0C")); + hVtxZNTracks = static_cast(lCalibObjects->FindObject("hVtxZNTracksPV")); + lCalibLoaded = true; + // Capture error + if (!hVtxZFT0A || !hVtxZFT0C || !hVtxZNTracks) { + LOGF(error, "Problem loading CCDB objects! Please check"); + lCalibLoaded = false; + } + } else { + LOGF(error, "Problem loading CCDB object! Please check"); + lCalibLoaded = false; + } + } + auto thisCollId = collision.globalIndex(); std::array nCandsPerType{0}; std::array nCandsInSignalRegionDsPerType{0}; @@ -607,6 +723,41 @@ struct HfTaskDs { const CandDsMcGen& mcParticles) { for (const auto& collision : collisions) { + /* check the previous run number */ + const auto& bc = collision.bc(); + if (bc.runNumber() != mRunNumber) { + mRunNumber = bc.runNumber(); // mark this run as at least tried + if (ccdbConfig.reconstructionPass.value == "") { + lCalibObjects = ccdb->getForRun(ccdbConfig.ccdbPath, mRunNumber); + } else if (ccdbConfig.reconstructionPass.value == "metadata") { + std::map metadata; + metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); + LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName")); + lCalibObjects = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, mRunNumber, metadata); + } else { + std::map metadata; + metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value; + LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value); + lCalibObjects = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, mRunNumber, metadata); + } + + if (lCalibObjects) { + LOG(info) << "CCDB objects loaded successfully"; + hVtxZFT0A = static_cast(lCalibObjects->FindObject("hVtxZFT0A")); + hVtxZFT0C = static_cast(lCalibObjects->FindObject("hVtxZFT0C")); + hVtxZNTracks = static_cast(lCalibObjects->FindObject("hVtxZNTracksPV")); + lCalibLoaded = true; + // Capture error + if (!hVtxZFT0A || !hVtxZFT0C || !hVtxZNTracks) { + LOGF(error, "Problem loading CCDB objects! Please check"); + lCalibLoaded = false; + } + } else { + LOGF(error, "Problem loading CCDB object! Please check"); + lCalibLoaded = false; + } + } + auto thisCollId = collision.globalIndex(); std::array nCandsPerType{0}; std::array nCandsInSignalRegionDsPerType{0}; @@ -663,6 +814,7 @@ struct HfTaskDs { void processDataWithCentFT0C(CollisionsWithFT0C const& collisions, CandDsData const& candsDs, + aod::BCs const&, aod::Tracks const&) { runDataAnalysisPerCollision(collisions, candsDs); @@ -671,6 +823,7 @@ struct HfTaskDs { void processDataWithCentFT0M(CollisionsWithFT0M const& collisions, CandDsData const& candsDs, + aod::BCs const&, aod::Tracks const&) { runDataAnalysisPerCollision(collisions, candsDs); @@ -679,6 +832,7 @@ struct HfTaskDs { void processDataWithCentNTracksPV(CollisionsWithNTracksPV const& collisions, CandDsData const& candsDs, + aod::BCs const&, aod::Tracks const&) { runDataAnalysisPerCollision(collisions, candsDs); @@ -687,6 +841,7 @@ struct HfTaskDs { void processData(soa::Join const& collisions, CandDsData const& candsDs, + aod::BCs const&, aod::Tracks const&) { runDataAnalysisPerCollision(collisions, candsDs); @@ -695,6 +850,7 @@ struct HfTaskDs { void processDataWithMlAndCentFT0C(CollisionsWithFT0C const& collisions, CandDsDataWithMl const& candsDs, + aod::BCs const&, aod::Tracks const&) { runDataAnalysisPerCollision(collisions, candsDs); @@ -703,6 +859,7 @@ struct HfTaskDs { void processDataWithMlAndCentFT0M(CollisionsWithFT0M const& collisions, CandDsDataWithMl const& candsDs, + aod::BCs const&, aod::Tracks const&) { runDataAnalysisPerCollision(collisions, candsDs); @@ -711,6 +868,7 @@ struct HfTaskDs { void processDataWithMlAndCentNTracksPV(CollisionsWithNTracksPV const& collisions, CandDsDataWithMl const& candsDs, + aod::BCs const&, aod::Tracks const&) { runDataAnalysisPerCollision(collisions, candsDs); @@ -719,6 +877,7 @@ struct HfTaskDs { void processDataWithMl(soa::Join const& collisions, CandDsDataWithMl const& candsDs, + aod::BCs const&, aod::Tracks const&) { runDataAnalysisPerCollision(collisions, candsDs); @@ -728,6 +887,7 @@ struct HfTaskDs { void processMcWithCentFT0C(CollisionsMcWithFT0C const& collisions, CandDsMcReco const& candsDs, CandDsMcGen const& mcParticles, + aod::BCs const&, aod::McCollisions const&, aod::TracksWMc const&) { @@ -738,6 +898,7 @@ struct HfTaskDs { void processMcWithCentFT0M(CollisionsMcWithFT0M const& collisions, CandDsMcReco const& candsDs, CandDsMcGen const& mcParticles, + aod::BCs const&, aod::McCollisions const&, aod::TracksWMc const&) { @@ -748,6 +909,7 @@ struct HfTaskDs { void processMcWithCentNTracksPV(CollisionsMcWithNTracksPV const& collisions, CandDsMcReco const& candsDs, CandDsMcGen const& mcParticles, + aod::BCs const&, aod::McCollisions const&, aod::TracksWMc const&) { @@ -758,6 +920,7 @@ struct HfTaskDs { void processMc(CollisionsMc const& collisions, CandDsMcReco const& candsDs, CandDsMcGen const& mcParticles, + aod::BCs const&, aod::McCollisions const&, aod::TracksWMc const&) { @@ -768,6 +931,7 @@ struct HfTaskDs { void processMcWithMlAndCentFT0C(CollisionsMcWithFT0C const& collisions, CandDsMcRecoWithMl const& candsDs, CandDsMcGen const& mcParticles, + aod::BCs const&, aod::McCollisions const&, aod::TracksWMc const&) { @@ -778,6 +942,7 @@ struct HfTaskDs { void processMcWithMlAndCentFT0M(CollisionsMcWithFT0M const& collisions, CandDsMcRecoWithMl const& candsDs, CandDsMcGen const& mcParticles, + aod::BCs const&, aod::McCollisions const&, aod::TracksWMc const&) { @@ -788,6 +953,7 @@ struct HfTaskDs { void processMcWithMlAndCentNTracksPV(CollisionsMcWithNTracksPV const& collisions, CandDsMcRecoWithMl const& candsDs, CandDsMcGen const& mcParticles, + aod::BCs const&, aod::McCollisions const&, aod::TracksWMc const&) { @@ -798,6 +964,7 @@ struct HfTaskDs { void processMcWithMl(CollisionsMc const& collisions, CandDsMcRecoWithMl const& candsDs, CandDsMcGen const& mcParticles, + aod::BCs const&, aod::McCollisions const&, aod::TracksWMc const&) { @@ -808,5 +975,7 @@ struct HfTaskDs { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + // Parse the metadata + metadataInfo.initMetadata(cfgc); return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index 968d2dc752c..522be398df6 100644 --- a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx +++ b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx @@ -15,6 +15,10 @@ /// \author Deependra Sharma , IITB /// \author Fabrizio Grosa , CERN +#include +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" @@ -39,6 +43,7 @@ struct HfTaskDstarToD0Pi { Configurable> ptBins{"ptBins", std::vector{hf_cuts_dstar_to_d0_pi::vecBinsPt}, "pT bin limits for Dstar"}; using CandDstarWSelFlag = soa::Join; + using CandDstarWSelFlagWMl = soa::Join; /// @brief specially for MC data // full reconstructed Dstar candidate using CandDstarWSelFlagMcRec = soa::Join; @@ -49,6 +54,7 @@ struct HfTaskDstarToD0Pi { Filter candFilter = aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == selectionFlagDstarToD0Pi; Preslice> preslicSelectedCandDstarPerCol = aod::hf_cand::collisionId; + Preslice> preslicSelectedCandDstarPerColWMl = aod::hf_cand::collisionId; PresliceUnsorted colsPerMcCollision = aod::mccollisionlabel::mcCollisionId; SliceCache cache; @@ -58,8 +64,10 @@ struct HfTaskDstarToD0Pi { ConfigurableAxis binningImpactParam{"binningImpactParam", {1000, 0.1, -0.1}, " Bins of Impact Parameter"}; ConfigurableAxis binningDecayLength{"binningDecayLength", {1000, 0.0, 0.7}, "Bins of Decay Length"}; ConfigurableAxis binningNormDecayLength{"binningNormDecayLength", {1000, 0.0, 40.0}, "Bins of Normalised Decay Length"}; - ConfigurableAxis binningCentrality{"binningCentrality", {VARIABLE_WIDTH, 0.0, 10.0, 20.0, 30.0, 60.0, 100.0}, "centrality binning"}; + ConfigurableAxis binningCentrality{"binningCentrality", {VARIABLE_WIDTH, 0.0, 1.0, 10.0, 30.0, 50.0, 70.0, 100.0}, "centrality binning"}; ConfigurableAxis binningDeltaInvMass{"binningDeltaInvMass", {100, 0.13, 0.16}, "Bins of Delta InvMass of Dstar"}; + ConfigurableAxis binningBkgBDTScore{"binningBkgBDTScore", {100, 0.0f, 1.0f}, "Bins for background BDT Score"}; + ConfigurableAxis binningSigBDTScore{"binningSigBDTScore", {100, 0.0f, 1.0f}, "Bins for Signal (Prompts + Non Prompt) BDT Score"}; HistogramRegistry registry{ "registry", @@ -81,6 +89,9 @@ struct HfTaskDstarToD0Pi { AxisSpec axisNormDecayLength = {binningNormDecayLength, "normalised decay length (cm)"}; AxisSpec axisCentrality = {binningCentrality, "centrality (%)"}; AxisSpec axisDeltaInvMass = {binningDeltaInvMass, "#Delta #it{M}_{inv} D*"}; + AxisSpec axisBDTScorePrompt = {binningSigBDTScore, "BDT Score for Prompt Cand"}; + AxisSpec axisBDTScoreNonPrompt = {binningSigBDTScore, "BDT Score for Non-Prompt Cand"}; + AxisSpec axisBDTScoreBackground = {binningBkgBDTScore, "BDT Score for Background Cand"}; registry.add("Yield/hDeltaInvMassDstar3D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c}); FT0M centrality", {HistType::kTH3F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); registry.add("Yield/hDeltaInvMassDstar2D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); @@ -116,6 +127,7 @@ struct HfTaskDstarToD0Pi { registry.add("QA/hPtVsYRecoTopolDstarRecSig", "MC Matched RecoTopol D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); registry.add("QA/hPtVsYRecoPidDstarRecSig", "MC Matched RecoPid D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); registry.add("QA/hPtFullRecoDstarRecSig", "MC Matched FullReco D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Efficiency/hPtVsCentFullRecoDstarRecSig", "MC Matched FullReco D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); Centrality (%)", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); // Only Prompt RecSig registry.add("QA/hPtVsYSkimPromptDstarRecSig", "MC Matched Skimed Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}; #it{y})", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); registry.add("QA/hPtVsYRecoTopolPromptDstarRecSig", "MC Matched RecoTopol Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); @@ -148,9 +160,13 @@ struct HfTaskDstarToD0Pi { registry.add("Efficiency/hNumPvContributorsAll", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{100, 0, 300}, {axisCentrality}}}, true); registry.add("Efficiency/hNumPvContributorsCand", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{100, 0, 300}, {axisCentrality}}}, true); registry.add("Efficiency/hNumPvContributorsCandInMass", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{100, 0, 300}, {axisCentrality}}}, true); + + // BDT Score (axisBDTScoreBackground, axisBDTScorePrompt, axisBDTScoreNonPrompt) + registry.add("Yield/hDeltaInvMassVsPtVsCentVsBDTScore", "#Delta #it{M}_{inv} Vs Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseL, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); } - void process(CollisionsWCent const& cols, soa::Filtered const& selectedCands) + template + void runTaskDstar(CollisionsWCent const& cols, T1 selectedCands, T2 preslice) { for (const auto& col : cols) { auto nPVContributors = col.numContrib(); @@ -158,7 +174,7 @@ struct HfTaskDstarToD0Pi { registry.fill(HIST("Efficiency/hNumPvContributorsAll"), nPVContributors, centrality); auto gIndexCol = col.globalIndex(); - auto selectedCandsCurrentCol = selectedCands.sliceBy(preslicSelectedCandDstarPerCol, gIndexCol); + auto selectedCandsCurrentCol = selectedCands.sliceBy(preslice, gIndexCol); auto nCandsCurrentCol = selectedCandsCurrentCol.size(); if (nCandsCurrentCol > 0) { @@ -207,6 +223,12 @@ struct HfTaskDstarToD0Pi { if (0.142f < deltaMDstar && deltaMDstar < 0.15f) { nCandsSignalRegion++; } + + if constexpr (applyMl) { + auto mlBdtScore = candDstar.mlProbDstarToD0Pi(); + registry.fill(HIST("Yield/hDeltaInvMassVsPtVsCentVsBDTScore"), deltaMDstar, candDstar.pt(), centrality, mlBdtScore[0], mlBdtScore[1], mlBdtScore[2]); + } + registry.fill(HIST("Yield/hDeltaInvMassDstar3D"), deltaMDstar, candDstar.pt(), centrality); registry.fill(HIST("Yield/hDeltaInvMassDstar2D"), deltaMDstar, candDstar.pt()); registry.fill(HIST("Yield/hInvMassD0"), invD0, candDstar.ptD0()); @@ -237,6 +259,20 @@ struct HfTaskDstarToD0Pi { } // collision loop ends } + // process function without susing ML + void processWoML(CollisionsWCent const& cols, soa::Filtered const& selectedCands) + { + runTaskDstar, Preslice>>(cols, selectedCands, preslicSelectedCandDstarPerCol); + } + PROCESS_SWITCH(HfTaskDstarToD0Pi, processWoML, "Process without ML", true); + + // process function with susing ML, Here we store BDT score as well + void processWML(CollisionsWCent const& cols, soa::Filtered const& selectedCands) + { + runTaskDstar, Preslice>>(cols, selectedCands, preslicSelectedCandDstarPerColWMl); + } + PROCESS_SWITCH(HfTaskDstarToD0Pi, processWML, "Process with ML", false); + void processMC(aod::McCollisions const&, CollisionsWCentMcLabel const& collisions, CandDstarWSelFlagMcRec const&, CandDstarMcGen const& rowsMcPartilces, aod::TracksWMc const&) @@ -259,6 +295,7 @@ struct HfTaskDstarToD0Pi { auto particleMother = rowsMcPartilces.rawIteratorAt(indexMother); // What is difference between rawIterator() or iteratorAt() methods? registry.fill(HIST("QA/hPtSkimDstarGenSig"), particleMother.pt()); // generator level pt registry.fill(HIST("Efficiency/hPtVsCentSkimDstarGenSig"), particleMother.pt(), centrality); + registry.fill(HIST("Efficiency/hPtVsCentFullRecoDstarRecSig"), ptDstarRecSig, centrality); // auto recCollision = candDstarMcRec.collision_as(); // float centFT0M = recCollision.centFT0M(); diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 7941890d40a..2e6544d684a 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -15,6 +15,9 @@ /// \author S. Politanò, INFN Torino, Italy /// \author Wu Chuntai, CUG, China +#include +#include + #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -57,7 +60,11 @@ struct HfTaskFlowCharmHadrons { Configurable qvecDetector{"qvecDetector", 3, "Detector for Q vector estimation (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3, TPC Pos: 4, TPC Neg: 5, TPC Tot: 6)"}; Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)"}; Configurable selectionFlag{"selectionFlag", 1, "Selection Flag for hadron (e.g. 1 for skimming, 3 for topo. and kine., 7 for PID)"}; + Configurable centralityMin{"centralityMin", 0., "Minimum centrality accepted in SP/EP computation (not applied in resolution process)"}; + Configurable centralityMax{"centralityMax", 100., "Maximum centrality accepted in SP/EP computation (not applied in resolution process)"}; + Configurable storeEP{"storeEP", false, "Flag to store EP-related axis"}; Configurable storeMl{"storeMl", false, "Flag to store ML scores"}; + Configurable occEstimator{"occEstimator", 0, "Occupancy estimation (0: None, 1: ITS, 2: FT0C)"}; Configurable saveEpResoHisto{"saveEpResoHisto", false, "Flag to save event plane resolution histogram"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> classMl{"classMl", {0, 2}, "Indexes of BDT scores to be stored. Two indexes max."}; @@ -70,6 +77,13 @@ struct HfTaskFlowCharmHadrons { ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, 0., 1.}, ""}; ConfigurableAxis thnConfigAxisMlOne{"thnConfigAxisMlOne", {1000, 0., 1.}, ""}; ConfigurableAxis thnConfigAxisMlTwo{"thnConfigAxisMlTwo", {1000, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisOccupancyITS{"thnConfigAxisOccupancyITS", {14, 0, 14000}, ""}; + ConfigurableAxis thnConfigAxisOccupancyFT0C{"thnConfigAxisOccupancyFT0C", {14, 0, 140000}, ""}; + ConfigurableAxis thnConfigAxisNoSameBunchPileup{"thnConfigAxisNoSameBunchPileup", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInTimeRangeNarrow{"thnConfigAxisNoCollInTimeRangeNarrow", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInTimeRangeStandard{"thnConfigAxisNoCollInTimeRangeStandard", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInRofStandard{"thnConfigAxisNoCollInRofStandard", {2, 0, 2}, ""}; using CandDsDataWMl = soa::Filtered>; using CandDsData = soa::Filtered>; @@ -117,54 +131,80 @@ struct HfTaskFlowCharmHadrons { const AxisSpec thnAxisScalarProd{thnConfigAxisScalarProd, "SP"}; const AxisSpec thnAxisMlOne{thnConfigAxisMlOne, "Bkg score"}; const AxisSpec thnAxisMlTwo{thnConfigAxisMlTwo, "FD score"}; - + const AxisSpec thnAxisOccupancyITS{thnConfigAxisOccupancyITS, "OccupancyITS"}; + const AxisSpec thnAxisOccupancyFT0C{thnConfigAxisOccupancyFT0C, "OccupancyFT0C"}; + const AxisSpec thnAxisNoSameBunchPileup{thnConfigAxisNoSameBunchPileup, "NoSameBunchPileup"}; + const AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; + const AxisSpec thnAxisNoCollInTimeRangeNarrow{thnConfigAxisNoCollInTimeRangeNarrow, "NoCollInTimeRangeNarrow"}; + const AxisSpec thnAxisNoCollInTimeRangeStandard{thnConfigAxisNoCollInTimeRangeStandard, "NoCollInTimeRangeStandard"}; + const AxisSpec thnAxisNoCollInRofStandard{thnConfigAxisNoCollInRofStandard, "NoCollInRofStandard"}; + + std::vector axes = {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd}; + if (storeEP) { + axes.insert(axes.end(), {thnAxisCosNPhi, thnAxisCosDeltaPhi}); + } if (storeMl) { - registry.add("hSparseFlowCharm", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisCosNPhi, thnAxisCosDeltaPhi, thnAxisScalarProd, thnAxisMlOne, thnAxisMlTwo}); - } else { - registry.add("hSparseFlowCharm", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisCosNPhi, thnAxisCosDeltaPhi, thnAxisScalarProd}); + axes.insert(axes.end(), {thnAxisMlOne, thnAxisMlTwo}); } - registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0cFV0a", "hSpResoFT0cFV0a; centrality; Q_{FT0c} #bullet Q_{FV0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0cTPCpos", "hSpResoFT0cTPCpos; centrality; Q_{FT0c} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0cTPCneg", "hSpResoFT0cTPCneg; centrality; Q_{FT0c} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0cTPCtot", "hSpResoFT0cTPCtot; centrality; Q_{FT0c} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0aFV0a", "hSpResoFT0aFV0a; centrality; Q_{FT0a} #bullet Q_{FV0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0aTPCpos", "hSpResoFT0aTPCpos; centrality; Q_{FT0a} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0aTPCneg", "hSpResoFT0aTPCneg; centrality; Q_{FT0a} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0aTPCtot", "hSpResoFT0aTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0mFV0a", "hSpResoFT0mFV0a; centrality; Q_{FT0m} #bullet Q_{FV0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0mTPCpos", "hSpResoFT0mTPCpos; centrality; Q_{FT0m} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0mTPCneg", "hSpResoFT0mTPCneg; centrality; Q_{FT0m} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFT0mTPCtot", "hSpResoFT0mTPCtot; centrality; Q_{FV0a} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFV0aTPCpos", "hSpResoFV0aTPCpos; centrality; Q_{FV0a} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFV0aTPCneg", "hSpResoFV0aTPCneg; centrality; Q_{FV0a} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoFV0aTPCtot", "hSpResoFV0aTPCtot; centrality; Q_{FV0a} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); - registry.add("spReso/hSpResoTPCposTPCneg", "hSpResoTPCposTPCneg; centrality; Q_{TPCpos} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + if (occEstimator != 0) { + if (occEstimator == 1) { + axes.insert(axes.end(), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisOccupancy, + thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); + } else { + axes.insert(axes.end(), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisOccupancy, + thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); + } + } + registry.add("hSparseFlowCharm", "THn for SP", HistType::kTHnSparseF, axes); - if (saveEpResoHisto) { - registry.add("epReso/hEpResoFT0cFT0a", "hEpResoFT0cFT0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0cFV0a", "hEpResoFT0cFV0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0cTPCpos", "hEpResoFT0cTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0cTPCneg", "hEpResoFT0cTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0cTPCtot", "hEpResoFT0cTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0aFV0a", "hEpResoFT0aFV0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0aTPCpos", "hEpResoFT0aTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0aTPCneg", "hEpResoFT0aTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0aTPCtot", "hEpResoFT0aTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0mFV0a", "hEpResoFT0mFV0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0mTPCpos", "hEpResoFT0mTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0mTPCneg", "hEpResoFT0mTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFT0mTPCtot", "hEpResoFT0mTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFV0aTPCpos", "hEpResoFV0aTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFV0aTPCneg", "hEpResoFV0aTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoFV0aTPCtot", "hEpResoFV0aTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); - registry.add("epReso/hEpResoTPCposTPCneg", "hEpResoTPCposTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + if (occEstimator != 0) { + registry.add("trackOccVsFT0COcc", "trackOccVsFT0COcc; trackOcc; FT0COcc", {HistType::kTH2F, {thnAxisOccupancyITS, thnAxisOccupancyFT0C}}); } - hfEvSel.addHistograms(registry); // collision monitoring - ccdb->setURL(ccdbUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); + if (doprocessResolution) { // enable resolution histograms only for resolution process + registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0cFV0a", "hSpResoFT0cFV0a; centrality; Q_{FT0c} #bullet Q_{FV0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0cTPCpos", "hSpResoFT0cTPCpos; centrality; Q_{FT0c} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0cTPCneg", "hSpResoFT0cTPCneg; centrality; Q_{FT0c} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0cTPCtot", "hSpResoFT0cTPCtot; centrality; Q_{FT0c} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0aFV0a", "hSpResoFT0aFV0a; centrality; Q_{FT0a} #bullet Q_{FV0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0aTPCpos", "hSpResoFT0aTPCpos; centrality; Q_{FT0a} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0aTPCneg", "hSpResoFT0aTPCneg; centrality; Q_{FT0a} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0aTPCtot", "hSpResoFT0aTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0mFV0a", "hSpResoFT0mFV0a; centrality; Q_{FT0m} #bullet Q_{FV0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0mTPCpos", "hSpResoFT0mTPCpos; centrality; Q_{FT0m} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0mTPCneg", "hSpResoFT0mTPCneg; centrality; Q_{FT0m} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFT0mTPCtot", "hSpResoFT0mTPCtot; centrality; Q_{FV0a} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFV0aTPCpos", "hSpResoFV0aTPCpos; centrality; Q_{FV0a} #bullet Q_{TPCpos}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFV0aTPCneg", "hSpResoFV0aTPCneg; centrality; Q_{FV0a} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoFV0aTPCtot", "hSpResoFV0aTPCtot; centrality; Q_{FV0a} #bullet Q_{TPCtot}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + registry.add("spReso/hSpResoTPCposTPCneg", "hSpResoTPCposTPCneg; centrality; Q_{TPCpos} #bullet Q_{TPCneg}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}}); + + if (saveEpResoHisto) { + registry.add("epReso/hEpResoFT0cFT0a", "hEpResoFT0cFT0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0cFV0a", "hEpResoFT0cFV0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0cTPCpos", "hEpResoFT0cTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0cTPCneg", "hEpResoFT0cTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0cTPCtot", "hEpResoFT0cTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0aFV0a", "hEpResoFT0aFV0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0aTPCpos", "hEpResoFT0aTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0aTPCneg", "hEpResoFT0aTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0aTPCtot", "hEpResoFT0aTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0mFV0a", "hEpResoFT0mFV0a; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0mTPCpos", "hEpResoFT0mTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0mTPCneg", "hEpResoFT0mTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFT0mTPCtot", "hEpResoFT0mTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFV0aTPCpos", "hEpResoFV0aTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFV0aTPCneg", "hEpResoFV0aTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoFV0aTPCtot", "hEpResoFV0aTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + registry.add("epReso/hEpResoTPCposTPCneg", "hEpResoTPCposTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTH2F, {thnAxisCent, thnAxisCosNPhi}}); + } + + hfEvSel.addHistograms(registry); // collision monitoring + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + } }; // end init /// Compute the Q vector for the candidate's tracks @@ -227,18 +267,66 @@ struct HfTaskFlowCharmHadrons { /// \param cosDeltaPhi is the cosine of the n*(phi - evtPl) angle /// \param sp is the scalar product /// \param outputMl are the ML scores + /// \param occupancy is the occupancy of the collision using the track estimator + /// \param hfevselflag flag of the collision associated to utilsEvSelHf.h void fillThn(float& mass, float& pt, float& cent, float& cosNPhi, float& cosDeltaPhi, float& sp, - std::vector& outputMl) + std::vector& outputMl, + float& occupancy, + uint16_t& hfevselflag) { - if (storeMl) { - registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, cosNPhi, cosDeltaPhi, sp, outputMl[0], outputMl[1]); + if (occEstimator != 0) { + if (storeMl) { + if (storeEP) { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, outputMl[0], outputMl[1], occupancy, + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::Occupancy), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard)); + } else { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, outputMl[0], outputMl[1], occupancy, + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::Occupancy), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard)); + } + } else { + if (storeEP) { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, occupancy, + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::Occupancy), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard)); + } else { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, occupancy, + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::Occupancy), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard), + TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard)); + } + } } else { - registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, cosNPhi, cosDeltaPhi, sp); + if (storeMl) { + if (storeEP) { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, outputMl[0], outputMl[1]); + } else { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, outputMl[0], outputMl[1]); + } + } else { + if (storeEP) { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi); + } else { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp); + } + } } } @@ -271,16 +359,20 @@ struct HfTaskFlowCharmHadrons { /// Check if the collision is selected /// \param collision is the collision with the Q vector information /// \param bc is the bunch crossing with timestamp information + /// \param centrality is the collision centrality /// \return true if the collision is selected, false otherwise template bool isCollSelected(CollsWithQvecs::iterator const& collision, - aod::BCsWithTimestamps const&) + aod::BCsWithTimestamps const&, + float& centrality) { - float centrality{-1.f}; + float occupancy = hfEvSel.getOccupancy(collision, occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + centrality = getCentrality(collision); /// monitor the satisfied event selections - hfEvSel.fillHistograms(collision, rejectionMask, centrality); + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); + registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); return rejectionMask == 0; } @@ -339,12 +431,23 @@ struct HfTaskFlowCharmHadrons { void runFlowAnalysis(CollsWithQvecs::iterator const& collision, T1 const& candidates) { + float cent = getCentrality(collision); + if (cent < centralityMin || cent > centralityMax) { + return; + } + float occupancy = 0.; + uint16_t hfevflag{}; + if (occEstimator != 0) { + occupancy = hfEvSel.getOccupancy(collision, occEstimator); + registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); + hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + } + std::vector qVecs = getQvec(collision); float xQVec = qVecs[0]; float yQVec = qVecs[1]; float amplQVec = qVecs[2]; float evtPl = epHelper.GetEventPlane(xQVec, yQVec, harmonic); - float cent = getCentrality(collision); int nProngs = 3; for (const auto& candidate : candidates) { @@ -438,7 +541,7 @@ struct HfTaskFlowCharmHadrons { float scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec; float cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl)); - fillThn(massCand, ptCand, cent, cosNPhi, cosDeltaPhi, scalprodCand, outputMl); + fillThn(massCand, ptCand, cent, cosNPhi, cosDeltaPhi, scalprodCand, outputMl, occupancy, hfevflag); } } @@ -528,12 +631,12 @@ struct HfTaskFlowCharmHadrons { void processResolution(CollsWithQvecs::iterator const& collision, aod::BCsWithTimestamps const& bcs) { - if (!isCollSelected(collision, bcs)) { + float centrality{-1.f}; + if (!isCollSelected(collision, bcs, centrality)) { // no selection on the centrality is applied on purpose to allow for the resolution study in post-processing return; } - float centrality = getCentrality(collision); // centrality not updated in the rejection mask function float xQVecFT0a = collision.qvecFT0ARe(); float yQVecFT0a = collision.qvecFT0AIm(); float xQVecFT0c = collision.qvecFT0CRe(); diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 55c8d852000..e844b07e7c2 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -18,6 +18,8 @@ /// \author Annalena Kalteyer , GSI Darmstadt /// \author Biao Zhang , Heidelberg University +#include // std::vector + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -40,7 +42,7 @@ struct HfTaskLc { Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits"}; // ThnSparse for ML outputScores and Vars - Configurable enableTHn{"enableTHn", false, "enable THn for Lc"}; + Configurable fillTHn{"fillTHn", false, "fill THn"}; ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {72, 0, 36}, ""}; ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {300, 1.98, 2.58}, ""}; ConfigurableAxis thnConfigAxisPtProng{"thnConfigAxisPtProng", {100, 0, 20}, ""}; @@ -51,22 +53,29 @@ struct HfTaskLc { ConfigurableAxis thnConfigAxisBdtScoreBkg{"thnConfigAxisBdtScoreBkg", {1000, 0., 1.}, ""}; ConfigurableAxis thnConfigAxisBdtScoreSignal{"thnConfigAxisBdtScoreSignal", {100, 0., 1.}, ""}; ConfigurableAxis thnConfigAxisCanType{"thnConfigAxisCanType", {5, 0., 5.}, ""}; + ConfigurableAxis thnAxisRapidity{"thnAxisRapidity", {20, -1, 1}, "Cand. rapidity bins"}; + ConfigurableAxis thnConfigAxisGenPtB{"thnConfigAxisGenPtB", {1000, 0, 100}, "Gen Pt B"}; + ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "Number of PV contributors"}; HfHelper hfHelper; - Filter filterSelectCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; - using Collisions = soa::Join::iterator; - using CollisionsMc = soa::Join::iterator; - using CollisionsWithFT0C = soa::Join::iterator; - using CollisionsMcWithFT0C = soa::Join::iterator; - using CollisionsWithFT0M = soa::Join::iterator; - using CollisionsMcWithFT0M = soa::Join::iterator; + using Collisions = soa::Join; + using CollisionsMc = soa::Join; + using CollisionsWithFT0C = soa::Join; + using CollisionsMcWithFT0C = soa::Join; + using CollisionsWithFT0M = soa::Join; + using CollisionsMcWithFT0M = soa::Join; using LcCandidates = soa::Filtered>; using LcCandidatesMl = soa::Filtered>; using LcCandidatesMc = soa::Filtered>; using LcCandidatesMlMc = soa::Filtered>; + using McParticles3ProngMatched = soa::Join; + Filter filterSelectCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; + PresliceUnsorted colPerMcCollision = aod::mcparticle::mcCollisionId; + Preslice candLcPerCollision = aod::hf_cand::collisionId; + SliceCache cache; HistogramRegistry registry{ "registry", @@ -96,7 +105,6 @@ struct HfTaskLc { {"MC/reconstructed/signal/hPtRecProng2Sig", "3-prong candidates (matched);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, {"MC/reconstructed/prompt/hPtRecProng2SigPrompt", "3-prong candidates (matched, prompt);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, {"MC/reconstructed/nonprompt/hPtRecProng2SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"Data/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, /// DCAxy to prim. vertex prongs {"Data/hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, {"MC/reconstructed/signal/hd0RecProng0Sig", "3-prong candidates (matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, @@ -169,7 +177,7 @@ struct HfTaskLc { auto vbins = (std::vector)binsPt; /// mass candidate - registry.add("Data/hMassVsPtVsMult", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}, {5000, 0., 10000.}}}); + registry.add("Data/hMassVsPtVsNPvContributors", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; Number of PV contributors", {HistType::kTH3F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}, {5000, 0., 10000.}}}); registry.add("Data/hMassVsPt", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("MC/reconstructed/signal/hMassVsPtRecSig", "3-prong candidates (matched);inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("MC/reconstructed/prompt/hMassVsPtRecSigPrompt", "3-prong candidates (matched, prompt);inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -267,7 +275,7 @@ struct HfTaskLc { registry.add("MC/reconstructed/prompt/hDecLenErrSigPrompt", "3-prong candidates (matched, prompt);decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("MC/reconstructed/nonprompt/hDecLenErrSigNonPrompt", "3-prong candidates (matched, non-prompt);decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - if (enableTHn) { + if (fillTHn) { const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T}(#Lambda_{c}^{+}) (GeV/#it{c})"}; const AxisSpec thnAxisPtProng0{thnConfigAxisPtProng, "#it{p}_{T}(prong0) (GeV/#it{c})"}; @@ -281,11 +289,25 @@ struct HfTaskLc { const AxisSpec thnAxisBdtScoreLcPrompt{thnConfigAxisBdtScoreSignal, "BDT prompt score (Lc)"}; const AxisSpec thnAxisBdtScoreLcNonPrompt{thnConfigAxisBdtScoreSignal, "BDT non-prompt score (Lc)"}; const AxisSpec thnAxisCanType{thnConfigAxisCanType, "candidates type"}; + const AxisSpec thnAxisY{thnAxisRapidity, "rapidity"}; + const AxisSpec thnAxisPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; + const AxisSpec thnAxisTracklets{thnConfigAxisNumPvContr, "Number of PV contributors"}; + + if (doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M) { + + registry.add("hnLcVarsWithBdt", "THn for Lambdac candidates with BDT scores for data with ML", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcPrompt, thnAxisBdtScoreLcNonPrompt, thnAxisTracklets}); + + } else if (doprocessMcWithMl || doprocessMcWithMlWithFT0C || doprocessMcWithMlWithFT0M) { + + registry.add("hnLcVarsWithBdt", "THn for Lambdac candidates with BDT scores for mc with ML", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcPrompt, thnAxisBdtScoreLcNonPrompt, thnAxisTracklets, thnAxisPtB, thnAxisCanType}); + registry.add("hnLcVarsGen", "THn for Generated Lambdac", HistType::kTHnSparseF, {thnAxisPt, thnAxisY, thnAxisTracklets, thnAxisPtB, thnAxisCanType}); + + } else if (doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M) { + registry.add("hnLcVars", "THn for Reconstructed Lambdac candidates for data without ML", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisTracklets}); - if (doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M || doprocessMcWithMl || doprocessMcWithMlWithFT0C || doprocessMcWithMlWithFT0M) { - registry.add("hnLcVarsWithBdt", "THn for Lambdac candidates with BDT scores", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcPrompt, thnAxisBdtScoreLcNonPrompt, thnAxisCanType}); } else { - registry.add("hnLcVars", "THn for Lambdac candidates", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisCanType}); + registry.add("hnLcVars", "THn for Reconstructed Lambdac candidates for mc without ML", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisTracklets, thnAxisPtB, thnAxisCanType}); + registry.add("hnLcVarsGen", "THn for Generated Lambdac", HistType::kTHnSparseF, {thnAxisPt, thnAxisY, thnAxisTracklets, thnAxisPtB, thnAxisCanType}); } } } @@ -299,183 +321,16 @@ struct HfTaskLc { return o2::hf_centrality::getCentralityColl(collision); } - template - void processData(CollType const& collision, - CandType const& candidates, - aod::TracksWDca const& tracks) + /// Fill MC histograms at reconstruction level + /// \tparam fillMl switch to fill ML histograms + template + void fillHistosMcRec(CollType const& collision, CandLcMcRec const& candidates, CandLcMcGen const& mcParticles) { - int nTracks = 0; - if (collision.numContrib() > 1) { - for (const auto& track : tracks) { - if (std::abs(track.eta()) > 4.0) { - continue; - } - if (std::abs(track.dcaXY()) > 0.0025 || std::abs(track.dcaZ()) > 0.0025) { - continue; - } - nTracks++; - } - } - registry.fill(HIST("Data/hMultiplicity"), nTracks); - for (const auto& candidate : candidates) { - if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { - continue; - } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandRecoMax) { - continue; - } - auto pt = candidate.pt(); - auto ptProng0 = candidate.ptProng0(); - auto ptProng1 = candidate.ptProng1(); - auto ptProng2 = candidate.ptProng2(); - auto decayLength = candidate.decayLength(); - auto decayLengthXY = candidate.decayLengthXY(); - auto chi2PCA = candidate.chi2PCA(); - auto cpa = candidate.cpa(); - auto cpaXY = candidate.cpaXY(); + auto thisCollId = collision.globalIndex(); + auto groupedLcCandidates = candidates.sliceBy(candLcPerCollision, thisCollId); - if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - registry.fill(HIST("Data/hMass"), hfHelper.invMassLcToPKPi(candidate)); - registry.fill(HIST("Data/hMassVsPtVsMult"), hfHelper.invMassLcToPKPi(candidate), pt, nTracks); - registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassLcToPKPi(candidate), pt); - } - if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - registry.fill(HIST("Data/hMass"), hfHelper.invMassLcToPiKP(candidate)); - registry.fill(HIST("Data/hMassVsPtVsMult"), hfHelper.invMassLcToPiKP(candidate), pt, nTracks); - registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassLcToPiKP(candidate), pt); - } - registry.fill(HIST("Data/hPt"), pt); - registry.fill(HIST("Data/hPtProng0"), ptProng0); - registry.fill(HIST("Data/hPtProng1"), ptProng1); - registry.fill(HIST("Data/hPtProng2"), ptProng2); - registry.fill(HIST("Data/hd0Prong0"), candidate.impactParameter0()); - registry.fill(HIST("Data/hd0Prong1"), candidate.impactParameter1()); - registry.fill(HIST("Data/hd0Prong2"), candidate.impactParameter2()); - registry.fill(HIST("Data/hd0VsPtProng0"), candidate.impactParameter0(), pt); - registry.fill(HIST("Data/hd0VsPtProng1"), candidate.impactParameter1(), pt); - registry.fill(HIST("Data/hd0VsPtProng2"), candidate.impactParameter2(), pt); - registry.fill(HIST("Data/hDecLength"), decayLength); - registry.fill(HIST("Data/hDecLengthVsPt"), decayLength, pt); - registry.fill(HIST("Data/hDecLengthxy"), decayLengthXY); - registry.fill(HIST("Data/hDecLengthxyVsPt"), decayLengthXY, pt); - registry.fill(HIST("Data/hCt"), hfHelper.ctLc(candidate)); - registry.fill(HIST("Data/hCtVsPt"), hfHelper.ctLc(candidate), pt); - registry.fill(HIST("Data/hCPA"), cpa); - registry.fill(HIST("Data/hCPAVsPt"), cpa, pt); - registry.fill(HIST("Data/hCPAxy"), cpaXY); - registry.fill(HIST("Data/hCPAxyVsPt"), cpaXY, pt); - registry.fill(HIST("Data/hDca2"), chi2PCA); - registry.fill(HIST("Data/hDca2VsPt"), chi2PCA, pt); - registry.fill(HIST("Data/hEta"), candidate.eta()); - registry.fill(HIST("Data/hEtaVsPt"), candidate.eta(), pt); - registry.fill(HIST("Data/hPhi"), candidate.phi()); - registry.fill(HIST("Data/hPhiVsPt"), candidate.phi(), pt); - registry.fill(HIST("hSelectionStatus"), candidate.isSelLcToPKPi(), pt); - registry.fill(HIST("hSelectionStatus"), candidate.isSelLcToPiKP(), pt); - registry.fill(HIST("Data/hImpParErrProng0"), candidate.errorImpactParameter0(), pt); - registry.fill(HIST("Data/hImpParErrProng1"), candidate.errorImpactParameter1(), pt); - registry.fill(HIST("Data/hImpParErrProng2"), candidate.errorImpactParameter2(), pt); - registry.fill(HIST("Data/hDecLenErr"), candidate.errorDecayLength(), pt); - - if (enableTHn) { - float cent = evaluateCentralityColl(collision); - double massLc(-1); - double outputBkg(-1), outputPrompt(-1), outputFD(-1); - if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - massLc = hfHelper.invMassLcToPKPi(candidate); - - if constexpr (fillMl) { - - if (candidate.mlProbLcToPKPi().size() == 3) { - - outputBkg = candidate.mlProbLcToPKPi()[0]; /// bkg score - outputPrompt = candidate.mlProbLcToPKPi()[1]; /// prompt score - outputFD = candidate.mlProbLcToPKPi()[2]; /// non-prompt score - } - /// Fill the ML outputScores and variables of candidate - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, 0); - } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, 0); - } - } - if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - massLc = hfHelper.invMassLcToPiKP(candidate); - - if constexpr (fillMl) { - - if (candidate.mlProbLcToPiKP().size() == 3) { - - outputBkg = candidate.mlProbLcToPiKP()[0]; /// bkg score - outputPrompt = candidate.mlProbLcToPiKP()[1]; /// prompt score - outputFD = candidate.mlProbLcToPiKP()[2]; /// non-prompt score - } - /// Fill the ML outputScores and variables of candidate - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, 0); - } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, 0); - } - } - } - } - } - - void processDataStd(Collisions const& collision, - LcCandidates const& selectedLcCandidates, - aod::TracksWDca const& tracks) - { - processData(collision, selectedLcCandidates, tracks); - } - PROCESS_SWITCH(HfTaskLc, processDataStd, "Process Data with the standard method", true); - - void processDataWithMl(Collisions const& collision, - LcCandidatesMl const& selectedLcCandidatesMl, - aod::TracksWDca const& tracks) - { - processData(collision, selectedLcCandidatesMl, tracks); - } - PROCESS_SWITCH(HfTaskLc, processDataWithMl, "Process Data with the ML method", false); - - void processDataStdWithFT0C(CollisionsWithFT0C const& collision, - LcCandidates const& selectedLcCandidates, - aod::TracksWDca const& tracks) - { - processData(collision, selectedLcCandidates, tracks); - } - PROCESS_SWITCH(HfTaskLc, processDataStdWithFT0C, "Process Data with the standard method", true); - - void processDataWithMlWithFT0C(CollisionsWithFT0C const& collision, - LcCandidatesMl const& selectedLcCandidatesMl, - aod::TracksWDca const& tracks) - { - processData(collision, selectedLcCandidatesMl, tracks); - } - PROCESS_SWITCH(HfTaskLc, processDataWithMlWithFT0C, "Process Data with the ML method", false); - - void processDataStdWithFT0M(CollisionsWithFT0M const& collision, - LcCandidates const& selectedLcCandidates, - aod::TracksWDca const& tracks) - { - processData(collision, selectedLcCandidates, tracks); - } - PROCESS_SWITCH(HfTaskLc, processDataStdWithFT0M, "Process Data with the standard method", true); - - void processDataWithMlWithFT0M(CollisionsWithFT0M const& collision, - LcCandidatesMl const& selectedLcCandidatesMl, - aod::TracksWDca const& tracks) - { - processData(collision, selectedLcCandidatesMl, tracks); - } - PROCESS_SWITCH(HfTaskLc, processDataWithMlWithFT0M, "Process Data with the ML method", false); - - /// Fills MC histograms. - template - void processMc(CollType const& collision, - CandType const& candidates, - soa::Join const& mcParticles, - aod::TracksWMc const&) - { - for (const auto& candidate : candidates) { + for (const auto& candidate : groupedLcCandidates) { /// Select Lc if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { continue; @@ -503,6 +358,9 @@ struct HfTaskLc { auto cpa = candidate.cpa(); auto cpaXY = candidate.cpaXY(); auto originType = candidate.originMcRec(); + auto numPvContributors = collision.numContrib(); + auto ptRecB = candidate.ptBhadMotherPart(); + /// MC reconstructed signal if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { registry.fill(HIST("MC/reconstructed/signal/hMassRecSig"), hfHelper.invMassLcToPKPi(candidate)); @@ -624,7 +482,7 @@ struct HfTaskLc { registry.fill(HIST("MC/reconstructed/nonprompt/hImpParErrProng2SigNonPrompt"), candidate.errorImpactParameter2(), pt); registry.fill(HIST("MC/reconstructed/nonprompt/hDecLenErrSigNonPrompt"), candidate.errorDecayLength(), pt); } - if (enableTHn) { + if (fillTHn) { float cent = evaluateCentralityColl(collision); double massLc(-1); double outputBkg(-1), outputPrompt(-1), outputFD(-1); @@ -632,40 +490,42 @@ struct HfTaskLc { massLc = hfHelper.invMassLcToPKPi(candidate); if constexpr (fillMl) { - if (candidate.mlProbLcToPKPi().size() == 3) { - outputBkg = candidate.mlProbLcToPKPi()[0]; /// bkg score outputPrompt = candidate.mlProbLcToPKPi()[1]; /// prompt score outputFD = candidate.mlProbLcToPKPi()[2]; /// non-prompt score } /// Fill the ML outputScores and variables of candidate - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, originType); + registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors, ptRecB, originType); } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, originType); + registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors, ptRecB, originType); } } if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { massLc = hfHelper.invMassLcToPiKP(candidate); if constexpr (fillMl) { - if (candidate.mlProbLcToPiKP().size() == 3) { - outputBkg = candidate.mlProbLcToPiKP()[0]; /// bkg score outputPrompt = candidate.mlProbLcToPiKP()[1]; /// prompt score outputFD = candidate.mlProbLcToPiKP()[2]; /// non-prompt score } /// Fill the ML outputScores and variables of candidate (todo: add multiplicity) - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, originType); + registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors, ptRecB, originType); } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, originType); + registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors, ptRecB, originType); } } } } } + } + /// Fill MC histograms at generated level + /// \tparam fillMl switch to fill ML histograms + template + void fillHistosMcGen(CandLcMcGen const& mcParticles, Coll const& recoCollisions) + { // MC gen. for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { @@ -674,6 +534,14 @@ struct HfTaskLc { continue; } auto ptGen = particle.pt(); + auto originType = particle.originMcGen(); + auto ptGenB = -1; + unsigned int numPvContributors = 0; + const auto& recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); + for (const auto& recCol : recoCollsPerMcColl) { + numPvContributors = recCol.numContrib() > numPvContributors ? recCol.numContrib() : numPvContributors; + } + registry.fill(HIST("MC/generated/signal/hPtGen"), ptGen); registry.fill(HIST("MC/generated/signal/hEtaGen"), particle.eta()); registry.fill(HIST("MC/generated/signal/hYGen"), yGen); @@ -683,6 +551,7 @@ struct HfTaskLc { registry.fill(HIST("MC/generated/signal/hPhiVsPtGenSig"), particle.phi(), ptGen); if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { + registry.get(HIST("hnLcVarsGen"))->Fill(ptGen, yGen, numPvContributors, ptGenB, originType); registry.fill(HIST("MC/generated/prompt/hPtGenPrompt"), ptGen); registry.fill(HIST("MC/generated/prompt/hEtaGenPrompt"), particle.eta()); registry.fill(HIST("MC/generated/prompt/hYGenPrompt"), yGen); @@ -692,6 +561,8 @@ struct HfTaskLc { registry.fill(HIST("MC/generated/prompt/hPhiVsPtGenSigPrompt"), particle.phi(), ptGen); } if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) { + ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + registry.get(HIST("hnLcVarsGen"))->Fill(ptGen, yGen, numPvContributors, ptGenB, originType); registry.fill(HIST("MC/generated/nonprompt/hPtGenNonPrompt"), ptGen); registry.fill(HIST("MC/generated/nonprompt/hEtaGenNonPrompt"), particle.eta()); registry.fill(HIST("MC/generated/nonprompt/hYGenNonPrompt"), yGen); @@ -704,59 +575,247 @@ struct HfTaskLc { } } - void processMcStd(CollisionsMc const& collision, + /// Fill histograms for real data + /// \tparam fillMl switch to fill ML histograms + template + void fillHistosData(CollType const& collision, CandType const& candidates) + { + auto thisCollId = collision.globalIndex(); + auto groupedLcCandidates = candidates.sliceBy(candLcPerCollision, thisCollId); + auto numPvContributors = collision.numContrib(); + + for (const auto& candidate : groupedLcCandidates) { + if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { + continue; + } + if (yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandRecoMax) { + continue; + } + auto pt = candidate.pt(); + auto ptProng0 = candidate.ptProng0(); + auto ptProng1 = candidate.ptProng1(); + auto ptProng2 = candidate.ptProng2(); + auto decayLength = candidate.decayLength(); + auto decayLengthXY = candidate.decayLengthXY(); + auto chi2PCA = candidate.chi2PCA(); + auto cpa = candidate.cpa(); + auto cpaXY = candidate.cpaXY(); + + if (candidate.isSelLcToPKPi() >= selectionFlagLc) { + registry.fill(HIST("Data/hMass"), hfHelper.invMassLcToPKPi(candidate)); + registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), hfHelper.invMassLcToPKPi(candidate), pt, numPvContributors); + registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassLcToPKPi(candidate), pt); + } + if (candidate.isSelLcToPiKP() >= selectionFlagLc) { + registry.fill(HIST("Data/hMass"), hfHelper.invMassLcToPiKP(candidate)); + registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), hfHelper.invMassLcToPiKP(candidate), pt, numPvContributors); + registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassLcToPiKP(candidate), pt); + } + registry.fill(HIST("Data/hPt"), pt); + registry.fill(HIST("Data/hPtProng0"), ptProng0); + registry.fill(HIST("Data/hPtProng1"), ptProng1); + registry.fill(HIST("Data/hPtProng2"), ptProng2); + registry.fill(HIST("Data/hd0Prong0"), candidate.impactParameter0()); + registry.fill(HIST("Data/hd0Prong1"), candidate.impactParameter1()); + registry.fill(HIST("Data/hd0Prong2"), candidate.impactParameter2()); + registry.fill(HIST("Data/hd0VsPtProng0"), candidate.impactParameter0(), pt); + registry.fill(HIST("Data/hd0VsPtProng1"), candidate.impactParameter1(), pt); + registry.fill(HIST("Data/hd0VsPtProng2"), candidate.impactParameter2(), pt); + registry.fill(HIST("Data/hDecLength"), decayLength); + registry.fill(HIST("Data/hDecLengthVsPt"), decayLength, pt); + registry.fill(HIST("Data/hDecLengthxy"), decayLengthXY); + registry.fill(HIST("Data/hDecLengthxyVsPt"), decayLengthXY, pt); + registry.fill(HIST("Data/hCt"), hfHelper.ctLc(candidate)); + registry.fill(HIST("Data/hCtVsPt"), hfHelper.ctLc(candidate), pt); + registry.fill(HIST("Data/hCPA"), cpa); + registry.fill(HIST("Data/hCPAVsPt"), cpa, pt); + registry.fill(HIST("Data/hCPAxy"), cpaXY); + registry.fill(HIST("Data/hCPAxyVsPt"), cpaXY, pt); + registry.fill(HIST("Data/hDca2"), chi2PCA); + registry.fill(HIST("Data/hDca2VsPt"), chi2PCA, pt); + registry.fill(HIST("Data/hEta"), candidate.eta()); + registry.fill(HIST("Data/hEtaVsPt"), candidate.eta(), pt); + registry.fill(HIST("Data/hPhi"), candidate.phi()); + registry.fill(HIST("Data/hPhiVsPt"), candidate.phi(), pt); + registry.fill(HIST("hSelectionStatus"), candidate.isSelLcToPKPi(), pt); + registry.fill(HIST("hSelectionStatus"), candidate.isSelLcToPiKP(), pt); + registry.fill(HIST("Data/hImpParErrProng0"), candidate.errorImpactParameter0(), pt); + registry.fill(HIST("Data/hImpParErrProng1"), candidate.errorImpactParameter1(), pt); + registry.fill(HIST("Data/hImpParErrProng2"), candidate.errorImpactParameter2(), pt); + registry.fill(HIST("Data/hDecLenErr"), candidate.errorDecayLength(), pt); + + if (fillTHn) { + float cent = evaluateCentralityColl(collision); + double massLc(-1); + double outputBkg(-1), outputPrompt(-1), outputFD(-1); + if (candidate.isSelLcToPKPi() >= selectionFlagLc) { + massLc = hfHelper.invMassLcToPKPi(candidate); + + if constexpr (fillMl) { + if (candidate.mlProbLcToPKPi().size() == 3) { + outputBkg = candidate.mlProbLcToPKPi()[0]; /// bkg score + outputPrompt = candidate.mlProbLcToPKPi()[1]; /// prompt score + outputFD = candidate.mlProbLcToPKPi()[2]; /// non-prompt score + } + /// Fill the ML outputScores and variables of candidate + registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors); + } else { + registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors); + } + } + if (candidate.isSelLcToPiKP() >= selectionFlagLc) { + massLc = hfHelper.invMassLcToPiKP(candidate); + + if constexpr (fillMl) { + if (candidate.mlProbLcToPiKP().size() == 3) { + outputBkg = candidate.mlProbLcToPiKP()[0]; /// bkg score + outputPrompt = candidate.mlProbLcToPiKP()[1]; /// prompt score + outputFD = candidate.mlProbLcToPiKP()[2]; /// non-prompt score + } + /// Fill the ML outputScores and variables of candidate + registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors); + } else { + registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors); + } + } + } + } + } + + /// Run the analysis on real data + /// \tparam fillMl switch to fill ML histograms + template + void runAnalysisPerCollisionData(CollType const& collisions, + CandType const& candidates) + { + + for (const auto& collision : collisions) { + fillHistosData(collision, candidates); + } + } + + /// Run the analysis on MC data + /// \tparam fillMl switch to fill ML histograms + template + void runAnalysisPerCollisionMc(CollType const& collisions, + CandType const& candidates, + CandLcMcGen const& mcParticles) + { + for (const auto& collision : collisions) { + // MC Rec. + fillHistosMcRec(collision, candidates, mcParticles); + } + // MC gen. + fillHistosMcGen(mcParticles, collisions); + } + + void processDataStd(Collisions const& collisions, + LcCandidates const& selectedLcCandidates, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedLcCandidates); + } + PROCESS_SWITCH(HfTaskLc, processDataStd, "Process Data with the standard method", true); + + void processDataWithMl(Collisions const& collisions, + LcCandidatesMl const& selectedLcCandidatesMl, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedLcCandidatesMl); + } + PROCESS_SWITCH(HfTaskLc, processDataWithMl, "Process real data with the ML method and without centrality", false); + + void processDataStdWithFT0C(CollisionsWithFT0C const& collisions, + LcCandidates const& selectedLcCandidates, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedLcCandidates); + } + PROCESS_SWITCH(HfTaskLc, processDataStdWithFT0C, "Process real data with the standard method and with FT0C centrality", false); + + void processDataWithMlWithFT0C(CollisionsWithFT0C const& collisions, + LcCandidatesMl const& selectedLcCandidatesMl, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedLcCandidatesMl); + } + PROCESS_SWITCH(HfTaskLc, processDataWithMlWithFT0C, "Process real data with the ML method and with FT0C centrality", false); + + void processDataStdWithFT0M(CollisionsWithFT0M const& collisions, + LcCandidates const& selectedLcCandidates, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedLcCandidates); + } + PROCESS_SWITCH(HfTaskLc, processDataStdWithFT0M, "Process real data with the standard method and with FT0M centrality", false); + + void processDataWithMlWithFT0M(CollisionsWithFT0M const& collisions, + LcCandidatesMl const& selectedLcCandidatesMl, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedLcCandidatesMl); + } + PROCESS_SWITCH(HfTaskLc, processDataWithMlWithFT0M, "Process real data with the ML method and with FT0M centrality", false); + + void processMcStd(CollisionsMc const& collisions, LcCandidatesMc const& selectedLcCandidatesMc, - soa::Join const& mcParticles, - aod::TracksWMc const& tracksWithMc) + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) { - processMc(collision, selectedLcCandidatesMc, mcParticles, tracksWithMc); + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMc, mcParticles); } PROCESS_SWITCH(HfTaskLc, processMcStd, "Process MC with the standard method", false); - void processMcWithMl(CollisionsMc const& collision, + void processMcWithMl(CollisionsMc const& collisions, LcCandidatesMlMc const& selectedLcCandidatesMlMc, - soa::Join const& mcParticles, - aod::TracksWMc const& tracksWithMc) + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) { - processMc(collision, selectedLcCandidatesMlMc, mcParticles, tracksWithMc); + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMlMc, mcParticles); } - PROCESS_SWITCH(HfTaskLc, processMcWithMl, "Process Mc with the ML method", false); + PROCESS_SWITCH(HfTaskLc, processMcWithMl, "Process Mc with the ML method and without centrality", false); - void processMcStdWithFT0C(CollisionsMcWithFT0C const& collision, + void processMcStdWithFT0C(CollisionsMcWithFT0C const& collisions, LcCandidatesMc const& selectedLcCandidatesMc, - soa::Join const& mcParticles, - aod::TracksWMc const& tracksWithMc) + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) { - processMc(collision, selectedLcCandidatesMc, mcParticles, tracksWithMc); + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMc, mcParticles); } - PROCESS_SWITCH(HfTaskLc, processMcStdWithFT0C, "Process MC with the standard method", false); + PROCESS_SWITCH(HfTaskLc, processMcStdWithFT0C, "Process MC with the standard method with FT0C centrality", false); - void processMcWithMlWithFT0C(CollisionsMcWithFT0C const& collision, + void processMcWithMlWithFT0C(CollisionsMcWithFT0C const& collisions, LcCandidatesMlMc const& selectedLcCandidatesMlMc, - soa::Join const& mcParticles, - aod::TracksWMc const& tracksWithMc) + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) { - processMc(collision, selectedLcCandidatesMlMc, mcParticles, tracksWithMc); + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMlMc, mcParticles); } - PROCESS_SWITCH(HfTaskLc, processMcWithMlWithFT0C, "Process Mc with the ML method", false); + PROCESS_SWITCH(HfTaskLc, processMcWithMlWithFT0C, "Process Mc with the ML method with FT0C centrality", false); - void processMcStdWithFT0M(CollisionsMcWithFT0M const& collision, + void processMcStdWithFT0M(CollisionsMcWithFT0M const& collisions, LcCandidatesMc const& selectedLcCandidatesMc, - soa::Join const& mcParticles, - aod::TracksWMc const& tracksWithMc) + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) { - processMc(collision, selectedLcCandidatesMc, mcParticles, tracksWithMc); + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMc, mcParticles); } - PROCESS_SWITCH(HfTaskLc, processMcStdWithFT0M, "Process MC with the standard method", false); + PROCESS_SWITCH(HfTaskLc, processMcStdWithFT0M, "Process MC with the standard method with FT0M centrality", false); - void processMcWithMlWithFT0M(CollisionsMcWithFT0M const& collision, + void processMcWithMlWithFT0M(CollisionsMcWithFT0M const& collisions, LcCandidatesMlMc const& selectedLcCandidatesMlMc, - soa::Join const& mcParticles, - aod::TracksWMc const& tracksWithMc) + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) { - processMc(collision, selectedLcCandidatesMlMc, mcParticles, tracksWithMc); + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMlMc, mcParticles); } - PROCESS_SWITCH(HfTaskLc, processMcWithMlWithFT0M, "Process Mc with the ML method", false); + PROCESS_SWITCH(HfTaskLc, processMcWithMlWithFT0M, "Process Mc with the ML method with FT0M centrality", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx b/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx index a5a14c734cc..58341c78b3d 100644 --- a/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx @@ -15,6 +15,9 @@ /// /// \author Phil Lennart Stahlhut , Heidelberg University /// \author Carolina Reetz , Heidelberg University +/// \author Jaeyoon Cho , Inha University + +#include #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" @@ -42,7 +45,17 @@ struct HfTaskXicToXiPiPi { Configurable> binsPt{"binsPt", std::vector{hf_cuts_xic_to_xi_pi_pi::vecBinsPt}, "pT bin limits"}; // MC checks Configurable checkDecayTypeMc{"checkDecayTypeMc", false, "Flag to enable DecayType histogram"}; - + // THnSparese for ML selection check + Configurable enableTHn{"enableTHn", false, "Fill THnSparse for Xic"}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {400, 0., 40.}, ""}; + ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {300, 1.8, 3.0}, ""}; + ConfigurableAxis thnConfigAxisPtProng{"thnConfigAxisPtProng", {300, 0., 30.}, ""}; + ConfigurableAxis thnConfigAxisChi2PCA{"thnConfigAxisChi2PCA", {200, 0., 20}, ""}; + ConfigurableAxis thnConfigAxisDecLength{"thnConfigAxisDecLength", {200, 0., 0.5}, ""}; + ConfigurableAxis thnConfigAxisDecLengthXY{"thnConfigAxisDecLengthXY", {200, 0., 0.5}, ""}; + ConfigurableAxis thnConfigAxisCPA{"thnConfigAxisCPA", {110, -1.1, 1.1}, ""}; + ConfigurableAxis thnConfigAxisBdtScoreBkg{"thnConfigAxisBdtScoreBkg", {100, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisBdtScoreSignal{"thnConfigAxisBdtScoreSignal", {100, 0., 1.}, ""}; // Axis ConfigurableAxis binsDecLength{"binsDecLength", {200, 0., 0.5}, ""}; ConfigurableAxis binsErrDecLength{"binsErrDecLength", {100, 0., 1.}, ""}; @@ -55,33 +68,23 @@ struct HfTaskXicToXiPiPi { Filter filterSelectCandidates = (aod::hf_sel_candidate_xic::isSelXicToXiPiPi >= selectionFlagXic); - HistogramRegistry registry{ - "registry", - {{"hPtCand", "#Xi^{#plus}_{c} candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{400, 0., 40.}}}}, - {"hPtProng0", "#Xi^{#plus}_{c} candidates;prong 0 (#Xi^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}}, - {"hPtProng1", "#Xi^{#plus}_{c} candidates;prong 1 (#pi^{#plus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 20.}}}}, - {"hPtProng2", "#Xi^{#plus}_{c} candidates;prong 2 (#pi^{#plus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 20.}}}}}}; + HistogramRegistry registry{"registry"}; void init(InitContext const&) { - if (!doprocessWithKFParticle && !doprocessWithDCAFitter && !doprocessMcWithKFParticle && !doprocessMcWithDCAFitter) { - LOGF(fatal, "No process function enabled. Please enable one."); - } - if (doprocessWithKFParticle && doprocessWithDCAFitter) { - LOGF(fatal, "Cannot enable doprocessWithKFParticle and doprocessWithDCAFitter at the same time. Please choose one."); + std::array doprocess{doprocessWithDCAFitter, doprocessWithKFParticle, doprocessWithDCAFitterAndML, doprocessWithKFParticleAndML, doprocessMcWithDCAFitter, doprocessMcWithKFParticle, doprocessMcWithDCAFitterAndML, doprocessMcWithKFParticleAndML}; + if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) == 0) { + LOGP(fatal, "No process function enabled. Please enable one."); } - if (doprocessMcWithKFParticle && doprocessMcWithDCAFitter) { - LOGF(fatal, "Cannot enable doprocessMcWithKFParticle and doprocessMcWithDCAFitter at the same time. Please choose one."); + if ((doprocessWithDCAFitter || doprocessWithDCAFitterAndML || doprocessMcWithDCAFitter || doprocessMcWithDCAFitterAndML) && (doprocessWithKFParticle || doprocessWithKFParticleAndML || doprocessMcWithKFParticle || doprocessMcWithKFParticleAndML)) { + LOGP(fatal, "Cannot enable DCAFitter and KFParticle at the same time. Please choose one."); } - if (doprocessWithKFParticle && doprocessMcWithDCAFitter) { - LOGF(fatal, "Cannot enable doprocessWithKFParticle and doprocessMcWithDCAFitter at the same time. Please choose one."); - } - if (doprocessWithDCAFitter && doprocessMcWithKFParticle) { - LOGF(fatal, "Cannot enable doprocessWithDCAFitter and doprocessMcWithKFParticle at the same time. Please choose one."); + if ((doprocessWithDCAFitter || doprocessWithKFParticle || doprocessMcWithDCAFitter || doprocessMcWithKFParticle) && (doprocessWithDCAFitterAndML || doprocessWithKFParticleAndML || doprocessMcWithDCAFitterAndML || doprocessMcWithKFParticleAndML)) { + LOGP(fatal, "Cannot enable process function with ML and process function without ML at the same time. Please choose one."); } static const AxisSpec axisMassXic = {300, 1.8, 3.0, "inv. mass (GeV/#it{c}^{2})"}; - static const AxisSpec axisMassXiRes = {300, 1.0, 2.0, "inv. mass (GeV/#it{c}^{2})"}; + static const AxisSpec axisMassXiRes = {300, 1.4, 2.7, "inv. mass (GeV/#it{c}^{2})"}; static const AxisSpec axisPt = {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}; static const AxisSpec axisDecLength = {binsDecLength}; static const AxisSpec axisErrDecLength = {binsErrDecLength}; @@ -90,44 +93,49 @@ struct HfTaskXicToXiPiPi { static const AxisSpec axisSV = {binsSV}; static const AxisSpec axisChi2 = {binsChi2}; - // candidate - registry.add("hPt", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 20.}}}); - registry.add("hEta", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); - registry.add("hRapidity", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); - registry.add("hCPA", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); - registry.add("hCPAxy", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); - registry.add("hMass", "#Xi^{#plus}_{c} candidates;inv. mass #Xi^{#mp} #pi^{#pm} #pi^{#pm} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisMassXic, axisPt}}); - registry.add("hDecLength", "#Xi^{#plus}_{c} candidates;decay length (cm);entries", {HistType::kTH2F, {axisDecLength, axisPt}}); - registry.add("hErrDecLength", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate decay length error (cm);entries", {HistType::kTH2F, {axisErrDecLength, axisPt}}); - registry.add("hDecLengthXY", "#Xi^{#plus}_{c} candidates;decay length xy (cm);entries", {HistType::kTH2F, {axisDecLength, axisPt}}); - registry.add("hErrDecLengthXY", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate decay length xy error (cm);entries", {HistType::kTH2F, {axisErrDecLength, axisPt}}); - registry.add("hSVx", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate secondary vertex position x (cm);entries", {HistType::kTH2F, {axisSV, axisPt}}); - registry.add("hSVy", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate secondary vertex position y (cm);entries", {HistType::kTH2F, {axisSV, axisPt}}); - registry.add("hSVz", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate secondary vertex position z (cm);entries", {HistType::kTH2F, {axisSV, axisPt}}); - // daughters - registry.add("hCPAXi", "#Xi^{#plus}_{c} candidates;#Xi^{#minus} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); - registry.add("hCPAxyXi", "#Xi^{#plus}_{c} candidates;#Xi^{#minus} candidate cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); - registry.add("hCPALambda", "#Xi^{#plus}_{c} candidates;#Lambda candidate cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); - registry.add("hCPAxyLambda", "#Xi^{#plus}_{c} candidates;#Lambda candidate cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); - registry.add("hPtProng0vsPt", "#Xi^{#plus}_{c} candidates;#Xi^{#mp} #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0., 20.}, axisPt}}); - registry.add("hPtProng1vsPt", "#Xi^{#plus}_{c} candidates;prong 1 (#pi^{#pm}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0., 20.}, axisPt}}); - registry.add("hPtProng2vsPt", "#Xi^{#plus}_{c} candidates;prong 2 (#pi^{#pm}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0., 20.}, axisPt}}); - registry.add("hd0Prong0", "#Xi^{#plus}_{c} candidates;prong 0 (#Xi^{#mp}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisDCA, axisPt}}); - registry.add("hd0Prong1", "#Xi^{#plus}_{c} candidates;prong 1 (#pi^{#pm}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisDCA, axisPt}}); - registry.add("hd0Prong2", "#Xi^{#plus}_{c} candidates;prong 2 (#pi^{#pm}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisDCA, axisPt}}); - registry.add("hImpParErr", "#Xi^{#plus}_{c} candidates;prongs impact parameter error (cm);entries", {HistType::kTH2F, {axisImpParErr, axisPt}}); - registry.add("hChi2PCA", "#Xi^{#plus}_{c} candidates (matched);sum of distances of the secondary vertex to its prongs;entries", {HistType::kTH2F, {{240, -0.01, 0.5}, axisPt}}); - registry.add("hMassXiPi1", "#Xi^{#plus}_{c} candidates;inv. mass #Xi^{#mp} #pi^{#pm} (prong 1) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisMassXiRes, axisPt}}); - registry.add("hMassXiPi2", "#Xi^{#plus}_{c} candidates;inv. mass #Xi^{#mp} #pi^{#pm} (prong 2) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisMassXiRes, axisPt}}); - - if (doprocessWithKFParticle) { - registry.add("hChi2geoXi", "#Xi^{#plus}_{c} candidates;#Xi^{#mp} #chi^{2}_{geo};entries", {HistType::kTH2F, {axisChi2, axisPt}}); - registry.add("hChi2geoLam", "#Xi^{#plus}_{c} candidates;#Lambda #chi^{2}_{geo};entries", {HistType::kTH2F, {axisChi2, axisPt}}); - registry.add("hChi2topoToPV", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate #chi^{2}_{topo} to PV;entries", {HistType::kTH2F, {axisChi2, axisPt}}); - registry.add("hChi2topoXiToXicPlus", "#Xi^{#plus}_{c} candidates;#Xi^{#mp} candidate #chi^{2}_{topo} to #Xi^{#plus}_{c};entries", {HistType::kTH2F, {axisChi2, axisPt}}); + if (doprocessWithDCAFitter || doprocessWithKFParticle || doprocessWithDCAFitterAndML || doprocessWithKFParticleAndML) { + // candidate + registry.add("hPt", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{400, 0., 40.}}}); + registry.add("hEta", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hRapidity", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hCPA", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); + registry.add("hCPAxy", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); + registry.add("hMass", "#Xi^{#plus}_{c} candidates;inv. mass #Xi^{#mp} #pi^{#pm} #pi^{#pm} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisMassXic, axisPt}}); + registry.add("hDecLength", "#Xi^{#plus}_{c} candidates;decay length (cm);entries", {HistType::kTH2F, {axisDecLength, axisPt}}); + registry.add("hErrDecLength", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate decay length error (cm);entries", {HistType::kTH2F, {axisErrDecLength, axisPt}}); + registry.add("hDecLengthXY", "#Xi^{#plus}_{c} candidates;decay length xy (cm);entries", {HistType::kTH2F, {axisDecLength, axisPt}}); + registry.add("hErrDecLengthXY", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate decay length xy error (cm);entries", {HistType::kTH2F, {axisErrDecLength, axisPt}}); + registry.add("hSVx", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate secondary vertex position x (cm);entries", {HistType::kTH2F, {axisSV, axisPt}}); + registry.add("hSVy", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate secondary vertex position y (cm);entries", {HistType::kTH2F, {axisSV, axisPt}}); + registry.add("hSVz", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate secondary vertex position z (cm);entries", {HistType::kTH2F, {axisSV, axisPt}}); + // daughters + registry.add("hPtProng0", "#Xi^{#plus}_{c} candidates;prong 0 (#Xi^{#mp}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 20.}}}); + registry.add("hPtProng1", "#Xi^{#plus}_{c} candidates;prong 1 (#pi^{#plus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 20.}}}); + registry.add("hPtProng2", "#Xi^{#plus}_{c} candidates;prong 2 (#pi^{#plus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 20.}}}); + registry.add("hPtProng0vsPt", "#Xi^{#plus}_{c} candidates;prong 0 (#Xi^{#mp}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0., 20.}, axisPt}}); + registry.add("hPtProng1vsPt", "#Xi^{#plus}_{c} candidates;prong 1 (#pi^{#pm}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0., 20.}, axisPt}}); + registry.add("hPtProng2vsPt", "#Xi^{#plus}_{c} candidates;prong 2 (#pi^{#pm}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0., 20.}, axisPt}}); + registry.add("hCPAXi", "#Xi^{#plus}_{c} candidates;#Xi^{#minus} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); + registry.add("hCPAxyXi", "#Xi^{#plus}_{c} candidates;#Xi^{#minus} candidate cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); + registry.add("hCPALambda", "#Xi^{#plus}_{c} candidates;#Lambda candidate cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); + registry.add("hCPAxyLambda", "#Xi^{#plus}_{c} candidates;#Lambda candidate cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); + registry.add("hd0Prong0", "#Xi^{#plus}_{c} candidates;prong 0 (#Xi^{#mp}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisDCA, axisPt}}); + registry.add("hd0Prong1", "#Xi^{#plus}_{c} candidates;prong 1 (#pi^{#pm}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisDCA, axisPt}}); + registry.add("hd0Prong2", "#Xi^{#plus}_{c} candidates;prong 2 (#pi^{#pm}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisDCA, axisPt}}); + registry.add("hImpParErr", "#Xi^{#plus}_{c} candidates;prongs impact parameter error (cm);entries", {HistType::kTH2F, {axisImpParErr, axisPt}}); + registry.add("hChi2PCA", "#Xi^{#plus}_{c} candidates (matched);sum of distances of the secondary vertex to its prongs;entries", {HistType::kTH2F, {{240, -0.01, 0.5}, axisPt}}); + registry.add("hMassXiPi1", "#Xi^{#plus}_{c} candidates;inv. mass #Xi^{#mp} #pi^{#pm} (prong 1) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisMassXiRes, axisPt}}); + registry.add("hMassXiPi2", "#Xi^{#plus}_{c} candidates;inv. mass #Xi^{#mp} #pi^{#pm} (prong 2) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisMassXiRes, axisPt}}); + // KFParticle + if (doprocessWithKFParticle || doprocessWithKFParticleAndML) { + registry.add("hChi2geoXi", "#Xi^{#plus}_{c} candidates;#Xi^{#mp} #chi^{2}_{geo};entries", {HistType::kTH2F, {axisChi2, axisPt}}); + registry.add("hChi2geoLam", "#Xi^{#plus}_{c} candidates;#Lambda #chi^{2}_{geo};entries", {HistType::kTH2F, {axisChi2, axisPt}}); + registry.add("hChi2topoToPV", "#Xi^{#plus}_{c} candidates;#Xi^{#plus}_{c} candidate #chi^{2}_{topo} to PV;entries", {HistType::kTH2F, {axisChi2, axisPt}}); + registry.add("hChi2topoXiToXicPlus", "#Xi^{#plus}_{c} candidates;#Xi^{#mp} candidate #chi^{2}_{topo} to #Xi^{#plus}_{c};entries", {HistType::kTH2F, {axisChi2, axisPt}}); + } } - if (doprocessMcWithKFParticle || doprocessMcWithDCAFitter) { + if (doprocessMcWithDCAFitter || doprocessMcWithKFParticle || doprocessMcWithDCAFitterAndML || doprocessMcWithKFParticleAndML) { // MC reconstructed registry.add("hPtGenSig", "#Xi^{#plus}_{c} candidates (gen+rec);candidate #it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); registry.add("hPtRecSig", "#Xi^{#plus}_{c} candidates (matched);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); @@ -190,8 +198,8 @@ struct HfTaskXicToXiPiPi { registry.add("hMassXiPi1RecBg", "#Xi^{#plus}_{c} candidates (unmatched);inv. mass #Xi^{#mp} #pi^{#pm} (prong 1) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{300, 1.0, 2.0}, axisPt}}); registry.add("hMassXiPi2RecSig", "#Xi^{#plus}_{c} candidates (matched);inv. mass #Xi^{#mp} #pi^{#pm} (prong 2) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{300, 1.0, 2.0}, axisPt}}); registry.add("hMassXiPi2RecBg", "#Xi^{#plus}_{c} candidates (unmatched);inv. mass #Xi^{#mp} #pi^{#pm} (prong 2) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{300, 1.0, 2.0}, axisPt}}); - - if (doprocessMcWithKFParticle) { + // MC reconstructed with KFParticle + if (doprocessMcWithKFParticle || doprocessMcWithKFParticleAndML) { registry.add("hChi2topoToPVRecSig", "#Xi^{#plus}_{c} candidates (matched);#Xi^{#plus}_{c} candidate #chi^{2}_{topo} to PV;entries", {HistType::kTH2F, {axisChi2, axisPt}}); registry.add("hChi2topoToPVRecBg", "#Xi^{#plus}_{c} candidates (unmatched);#Xi^{#plus}_{c} candidate #chi^{2}_{topo} to PV;entries", {HistType::kTH2F, {axisChi2, axisPt}}); registry.add("hChi2geoXiRecSig", "#Xi^{#plus}_{c} candidates (matched);#Xi^{#mp} #chi^{2}_{geo};entries", {HistType::kTH2F, {axisChi2, axisPt}}); @@ -201,7 +209,6 @@ struct HfTaskXicToXiPiPi { registry.add("hChi2topoXiToXicPlusRecSig", "#Xi^{#plus}_{c} candidates (matched);#Xi^{#mp} candidate #chi^{2}_{topo} to #Xi^{#plus}_{c};entries", {HistType::kTH2F, {axisChi2, axisPt}}); registry.add("hChi2topoXiToXicPlusRecBg", "#Xi^{#plus}_{c} candidates (unmatched);#Xi^{#mp} candidate #chi^{2}_{topo} to #Xi^{#plus}_{c};entries", {HistType::kTH2F, {axisChi2, axisPt}}); } - // MC generated registry.add("hPtProng0Gen", "MC particles (generated);prong 0 (#Xi^{#mp}) #it{p}_{T}^{gen} (GeV/#it{c});entries", {HistType::kTH2F, {{300, 0., 30.}, axisPt}}); registry.add("hPtProng1Gen", "MC particles (generated);prong 1 (#pi^{#pm}) #it{p}_{T}^{gen} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0., 20.}, axisPt}}); @@ -235,6 +242,49 @@ struct HfTaskXicToXiPiPi { registry.get(HIST("hDecayTypeMc"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin]); } } + + if (enableTHn) { + const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass #Xi^{#mp} #pi^{#pm} #pi^{#pm}"}; + const AxisSpec thnAxisChi2PCA{thnConfigAxisChi2PCA, "Chi2PCA to sec. vertex (cm)"}; + const AxisSpec thnAxisDecLength{thnConfigAxisDecLength, "decay length (cm)"}; + const AxisSpec thnAxisDecLengthXY{thnConfigAxisDecLengthXY, "decay length xy (cm)"}; + const AxisSpec thnAxisCPA{thnConfigAxisCPA, "#Xi^{#plus}_{c} candidate cosine of pointing angle"}; + const AxisSpec thnAxisBdtScoreBkg{thnConfigAxisBdtScoreBkg, "BDT score of background"}; + const AxisSpec thnAxisBdtScoreSignal{thnConfigAxisBdtScoreSignal, "BDT score of prompt Xic"}; + + if (doprocessWithKFParticleAndML || doprocessWithDCAFitterAndML || doprocessMcWithKFParticleAndML || doprocessMcWithDCAFitterAndML) { + // with ML information + registry.add("hXicToXiPiPiVarsWithML", "THnSparse for Xic with ML", HistType::kTHnSparseF, {thnAxisPt, thnAxisMass, thnAxisChi2PCA, thnAxisDecLength, thnAxisDecLengthXY, thnAxisCPA, thnAxisBdtScoreBkg, thnAxisBdtScoreSignal}); + } else { + // without ML information + registry.add("hXicToXiPiPiVars", "THnSparse for Xic", HistType::kTHnSparseF, {thnAxisPt, thnAxisMass, thnAxisChi2PCA, thnAxisDecLength, thnAxisDecLengthXY, thnAxisCPA}); + } + } // enable THnSpare + } // end init + + /// Fill THnSpare depending on whether ML selection is used + // \param candidate is candidate + template + void fillTHnSparse(const T1& candidate) + { + if (!enableTHn) { + return; + } + + if constexpr (useMl) { + // with ML information + double outputBkg = -99.; + double outputPrompt = -99.; + if (candidate.mlProbXicToXiPiPi().size() > 0) { + outputBkg = candidate.mlProbXicToXiPiPi()[0]; + outputPrompt = candidate.mlProbXicToXiPiPi()[1]; + } + registry.get(HIST("hXicToXiPiPiVarsWithML"))->Fill(candidate.pt(), candidate.invMassXicPlus(), candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.cpa(), outputBkg, outputPrompt); + } else { + // without ML information + registry.get(HIST("hXicToXiPiPiVars"))->Fill(candidate.pt(), candidate.invMassXicPlus(), candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.cpa()); + } } /// Selection of Xic daughter in geometrical acceptance @@ -248,7 +298,7 @@ struct HfTaskXicToXiPiPi { } /// Function to fill histograms - template + template void fillHistograms(TCanTable const& candidates) { for (const auto& candidate : candidates) { @@ -259,7 +309,7 @@ struct HfTaskXicToXiPiPi { auto ptCandXic = candidate.pt(); - registry.fill(HIST("hPtCand"), ptCandXic); + registry.fill(HIST("hPt"), ptCandXic); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); registry.fill(HIST("hPtProng2"), candidate.ptProng2()); @@ -267,7 +317,7 @@ struct HfTaskXicToXiPiPi { registry.fill(HIST("hRapidity"), yCandXic, ptCandXic); registry.fill(HIST("hCPA"), candidate.cpa(), ptCandXic); registry.fill(HIST("hCPAxy"), candidate.cpaXY(), ptCandXic); - registry.fill(HIST("hMass"), candidate.invMassXic(), ptCandXic); + registry.fill(HIST("hMass"), candidate.invMassXicPlus(), ptCandXic); registry.fill(HIST("hDecLength"), candidate.decayLength(), ptCandXic); registry.fill(HIST("hErrDecLength"), candidate.errorDecayLength(), ptCandXic); registry.fill(HIST("hDecLengthXY"), candidate.decayLengthXY(), ptCandXic); @@ -299,11 +349,20 @@ struct HfTaskXicToXiPiPi { registry.fill(HIST("hChi2geoXi"), candidate.kfCascadeChi2(), ptCandXic); registry.fill(HIST("hChi2geoLam"), candidate.kfV0Chi2(), ptCandXic); } + + // fill THnSparse + if (enableTHn) { + if constexpr (useMl) { + fillTHnSparse(candidate); + } else { + fillTHnSparse(candidate); + } + } } // candidate loop } /// Function for MC analysis and histogram filling - template + template void fillHistogramsMc(TCandTable const& candidates, soa::Join const& mcParticles, aod::TracksWMc const&) @@ -339,7 +398,7 @@ struct HfTaskXicToXiPiPi { registry.fill(HIST("hSVzRecSig"), candidate.zSecondaryVertex(), ptCandXic); registry.fill(HIST("hCPARecSig"), candidate.cpa(), ptCandXic); registry.fill(HIST("hCPAxyRecSig"), candidate.cpaXY(), ptCandXic); - registry.fill(HIST("hMassRecSig"), candidate.invMassXic(), ptCandXic); + registry.fill(HIST("hMassRecSig"), candidate.invMassXicPlus(), ptCandXic); registry.fill(HIST("hDecLengthRecSig"), candidate.decayLength(), ptCandXic); registry.fill(HIST("hErrDecLengthRecSig"), candidate.errorDecayLength(), ptCandXic); registry.fill(HIST("hDecLengthXYRecSig"), candidate.decayLengthXY(), ptCandXic); @@ -378,7 +437,7 @@ struct HfTaskXicToXiPiPi { registry.fill(HIST("hSVzRecBg"), candidate.zSecondaryVertex(), ptCandXic); registry.fill(HIST("hCPARecBg"), candidate.cpa(), ptCandXic); registry.fill(HIST("hCPAxyRecBg"), candidate.cpaXY(), ptCandXic); - registry.fill(HIST("hMassRecBg"), candidate.invMassXic(), ptCandXic); + registry.fill(HIST("hMassRecBg"), candidate.invMassXicPlus(), ptCandXic); registry.fill(HIST("hDecLengthRecBg"), candidate.decayLength(), ptCandXic); registry.fill(HIST("hErrDecLengthRecBg"), candidate.errorDecayLength(), ptCandXic); registry.fill(HIST("hDecLengthXYRecBg"), candidate.decayLengthXY(), ptCandXic); @@ -406,13 +465,22 @@ struct HfTaskXicToXiPiPi { if (checkDecayTypeMc) { if (TESTBIT(flagMcMatchRecXic, hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi)) { - registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi, candidate.invMassXic(), ptCandXic); + registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi, candidate.invMassXicPlus(), ptCandXic); } else if (TESTBIT(flagMcMatchRecXic, hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiResPiToXiPiPi)) { - registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiResPiToXiPiPi, candidate.invMassXic(), ptCandXic); + registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiResPiToXiPiPi, candidate.invMassXicPlus(), ptCandXic); } else { - registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_xic_to_xi_pi_pi::DecayType::NDecayType, candidate.invMassXic(), ptCandXic); + registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_xic_to_xi_pi_pi::DecayType::NDecayType, candidate.invMassXicPlus(), ptCandXic); } } + // fill THnSparse + if (enableTHn) { + if constexpr (useMl) { + fillTHnSparse(candidate); + } else { + fillTHnSparse(candidate); + } + } + } // rec // MC gen. level @@ -473,24 +541,38 @@ struct HfTaskXicToXiPiPi { } // gen } + /// Data analysis and fill histograms void processWithDCAFitter(soa::Filtered> const& candidates) { - fillHistograms(candidates); + fillHistograms(candidates); } PROCESS_SWITCH(HfTaskXicToXiPiPi, processWithDCAFitter, "Process data with DCAFitter", true); void processWithKFParticle(soa::Filtered> const& candidates) { - fillHistograms(candidates); + fillHistograms(candidates); } PROCESS_SWITCH(HfTaskXicToXiPiPi, processWithKFParticle, "Process data with KFParticle", false); + /// Data analysis and fill histograms with ML + void processWithDCAFitterAndML(soa::Filtered> const& candidates) + { + fillHistograms(candidates); + } + PROCESS_SWITCH(HfTaskXicToXiPiPi, processWithDCAFitterAndML, "Process data with DCAFitter and ML approach", false); + + void processWithKFParticleAndML(soa::Filtered> const& candidates) + { + fillHistograms(candidates); + } + PROCESS_SWITCH(HfTaskXicToXiPiPi, processWithKFParticleAndML, "Process data with KFParticle and ML approach", false); + /// MC analysis and fill histograms void processMcWithDCAFitter(soa::Filtered> const& candidates, soa::Join const& mcParticles, aod::TracksWMc const& tracksWMc) { - fillHistogramsMc(candidates, mcParticles, tracksWMc); + fillHistogramsMc(candidates, mcParticles, tracksWMc); } PROCESS_SWITCH(HfTaskXicToXiPiPi, processMcWithDCAFitter, "Process MC with DCAFitter", false); @@ -499,9 +581,27 @@ struct HfTaskXicToXiPiPi { soa::Join const& mcParticles, aod::TracksWMc const& tracksWMc) { - fillHistogramsMc(candidates, mcParticles, tracksWMc); + fillHistogramsMc(candidates, mcParticles, tracksWMc); } PROCESS_SWITCH(HfTaskXicToXiPiPi, processMcWithKFParticle, "Process MC with KFParticle", false); + + // MC analysis and fill histograms with ML + void processMcWithDCAFitterAndML(soa::Filtered> const& candidates, + soa::Join const& mcParticles, + aod::TracksWMc const& tracksWMc) + { + fillHistogramsMc(candidates, mcParticles, tracksWMc); + } + PROCESS_SWITCH(HfTaskXicToXiPiPi, processMcWithDCAFitterAndML, "Process MC with DCAFitter and ML approach", false); + + void processMcWithKFParticleAndML(soa::Filtered> const& candidates, + soa::Join const& mcParticles, + aod::TracksWMc const& tracksWMc) + { + fillHistogramsMc(candidates, mcParticles, tracksWMc); + } + PROCESS_SWITCH(HfTaskXicToXiPiPi, processMcWithKFParticleAndML, "Process MC with KFParticle and ML approach", false); + }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 3538b1d0b40..15647b2ca9a 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -339,11 +339,11 @@ DECLARE_SOA_TABLE(HfDstars_000, "AOD", "HFDSTAR", //! D* -> D0pi candidates (Run hf_track_index::Prong0Id, hf_track_index::ProngD0Id); -DECLARE_SOA_TABLE(HfDstars_001, "AOD", "HFDSTAR", //! D* -> D0pi candidates (Run 3 format) - o2::soa::Index<>, - hf_track_index::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::ProngD0Id); +DECLARE_SOA_TABLE_VERSIONED(HfDstars_001, "AOD", "HFDSTAR", 1, //! D* -> D0pi candidates (Run 3 format) + o2::soa::Index<>, + hf_track_index::CollisionId, + hf_track_index::Prong0Id, + hf_track_index::ProngD0Id); using HfDstars = HfDstars_001; using HfDstar = HfDstars::iterator; @@ -585,6 +585,8 @@ DECLARE_SOA_COLUMN(KfTopolChi2OverNdf, kfTopolChi2OverNdf, float); //! chi2overn DECLARE_SOA_COLUMN(PtBhadMotherPart, ptBhadMotherPart, float); //! pt of the first B-hadron mother particle (only in case of non-prompt) DECLARE_SOA_COLUMN(PdgBhadMotherPart, pdgBhadMotherPart, int); //! pdg of the first B-hadron mother particle (only in case of non-prompt) DECLARE_SOA_COLUMN(IdxBhadMotherPart, idxBhadMotherPart, int); //! index of the first B-hadron mother particle (only in case of non-prompt) +// Kink topology mc flag +DECLARE_SOA_COLUMN(NTracksDecayed, nTracksDecayed, int8_t); //! number of tracks matched with kinked decay topology // method of secondary-vertex reconstruction enum VertexerType { DCAFitter = 0, @@ -731,7 +733,8 @@ DECLARE_SOA_TABLE(HfCand2ProngMcRec, "AOD", "HFCAND2PMCREC", //! hf_cand_2prong::FlagMcMatchRec, hf_cand_2prong::OriginMcRec, hf_cand::PtBhadMotherPart, - hf_cand::PdgBhadMotherPart); + hf_cand::PdgBhadMotherPart, + hf_cand::NTracksDecayed); // table with results of generator level MC matching DECLARE_SOA_TABLE(HfCand2ProngMcGen, "AOD", "HFCAND2PMCGEN", //! @@ -1008,7 +1011,8 @@ DECLARE_SOA_TABLE(HfCand3ProngMcRec, "AOD", "HFCAND3PMCREC", //! hf_cand_3prong::IsCandidateSwapped, hf_cand_3prong::FlagMcDecayChanRec, hf_cand::PtBhadMotherPart, - hf_cand::PdgBhadMotherPart); + hf_cand::PdgBhadMotherPart, + hf_cand::NTracksDecayed); // table with results of generator level MC matching DECLARE_SOA_TABLE(HfCand3ProngMcGen, "AOD", "HFCAND3PMCGEN", //! @@ -1498,20 +1502,20 @@ DECLARE_SOA_COLUMN(ZPvErr, zPvErr, float); DECLARE_SOA_COLUMN(XSvErr, xSvErr, float); DECLARE_SOA_COLUMN(YSvErr, ySvErr, float); DECLARE_SOA_COLUMN(ZSvErr, zSvErr, float); -DECLARE_SOA_COLUMN(XDecayVtxXi, xDecayVtxXi, float); -DECLARE_SOA_COLUMN(YDecayVtxXi, yDecayVtxXi, float); -DECLARE_SOA_COLUMN(ZDecayVtxXi, zDecayVtxXi, float); -DECLARE_SOA_COLUMN(XDecayVtxLambda, xDecayVtxLambda, float); -DECLARE_SOA_COLUMN(YDecayVtxLambda, yDecayVtxLambda, float); -DECLARE_SOA_COLUMN(ZDecayVtxLambda, zDecayVtxLambda, float); DECLARE_SOA_COLUMN(CosPaXi, cosPaXi, float); DECLARE_SOA_COLUMN(CosPaXYXi, cosPaXYXi, float); DECLARE_SOA_COLUMN(CosPaLambda, cosPaLambda, float); DECLARE_SOA_COLUMN(CosPaXYLambda, cosPaXYLambda, float); -DECLARE_SOA_COLUMN(InvMassXic, invMassXic, float); +DECLARE_SOA_COLUMN(CosPaLambdaToXi, cosPaLambdaToXi, float); +DECLARE_SOA_COLUMN(CosPaXYLambdaToXi, cosPaXYLambdaToXi, float); +DECLARE_SOA_COLUMN(InvMassXicPlus, invMassXicPlus, float); +DECLARE_SOA_COLUMN(InvMassXi, invMassXi, float); DECLARE_SOA_COLUMN(Sign, sign, float); DECLARE_SOA_COLUMN(InvMassXiPi0, invMassXiPi0, float); DECLARE_SOA_COLUMN(InvMassXiPi1, invMassXiPi1, float); +DECLARE_SOA_COLUMN(PBachelorPi, pBachelorPi, float); +DECLARE_SOA_COLUMN(PPiFromLambda, pPiFromLambda, float); +DECLARE_SOA_COLUMN(PPrFrmoLambda, pPrFromLambda, float); // KF specific columns DECLARE_SOA_COLUMN(DcaXYPi0Pi1, dcaXYPi0Pi1, float); DECLARE_SOA_COLUMN(DcaXYPi0Xi, dcaXYPi0Xi, float); @@ -1520,7 +1524,20 @@ DECLARE_SOA_COLUMN(DcaPi0Pi1, dcaPi0Pi1, float); DECLARE_SOA_COLUMN(DcaPi0Xi, dcaPi0Xi, float); DECLARE_SOA_COLUMN(DcaPi1Xi, dcaPi1Xi, float); DECLARE_SOA_COLUMN(Chi2TopoXicPlusToPV, chi2TopoXicPlusToPV, float); +DECLARE_SOA_COLUMN(Chi2TopoXicPlusToPVBeforeConstraint, chi2TopoXicPlusToPVBeforeConstraint, float); DECLARE_SOA_COLUMN(Chi2TopoXiToXicPlus, chi2TopoXiToXicPlus, float); +DECLARE_SOA_COLUMN(Chi2TopoXiToXicPlusBeforeConstraint, chi2TopoXiToXicPlusBeforeConstraint, float); +// PID +DECLARE_SOA_COLUMN(NSigTpcPiFromXicPlus0, nSigTpcPiFromXicPlus0, float); +DECLARE_SOA_COLUMN(NSigTpcPiFromXicPlus1, nSigTpcPiFromXicPlus1, float); +DECLARE_SOA_COLUMN(NSigTpcBachelorPi, nSigTpcBachelorPi, float); +DECLARE_SOA_COLUMN(NSigTpcPiFromLambda, nSigTpcPiFromLambda, float); +DECLARE_SOA_COLUMN(NSigTpcPrFromLambda, nSigTpcPrFromLambda, float); +DECLARE_SOA_COLUMN(NSigTofPiFromXicPlus0, nSigTofPiFromXicPlus0, float); +DECLARE_SOA_COLUMN(NSigTofPiFromXicPlus1, nSigTofPiFromXicPlus1, float); +DECLARE_SOA_COLUMN(NSigTofBachelorPi, nSigTofBachelorPi, float); +DECLARE_SOA_COLUMN(NSigTofPiFromLambda, nSigTofPiFromLambda, float); +DECLARE_SOA_COLUMN(NSigTofPrFromLambda, nSigTofPrFromLambda, float); // MC matching result: DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level @@ -1528,6 +1545,13 @@ DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mi DECLARE_SOA_COLUMN(DebugMcGen, debugMcGen, int8_t); DECLARE_SOA_COLUMN(OriginRec, originRec, int8_t); DECLARE_SOA_COLUMN(OriginGen, originGen, int8_t); +// Dynamic columns +DECLARE_SOA_DYNAMIC_COLUMN(PProng0, pProng0, //! + [](float px, float py, float pz) -> float { return RecoDecay::p(px, py, pz); }); +DECLARE_SOA_DYNAMIC_COLUMN(PProng1, pProng1, //! + [](float px, float py, float pz) -> float { return RecoDecay::p(px, py, pz); }); +DECLARE_SOA_DYNAMIC_COLUMN(PProng2, pProng2, //! + [](float px, float py, float pz) -> float { return RecoDecay::p(px, py, pz); }); // mapping of decay types enum DecayType { XicToXiPiPi = 0, // Ξc± → Ξ∓ π± π± @@ -1546,19 +1570,20 @@ DECLARE_SOA_TABLE(HfCandXicBase, "AOD", "HFCANDXICBASE", hf_cand::XSecondaryVertex, hf_cand::YSecondaryVertex, hf_cand::ZSecondaryVertex, hf_cand_xic_to_xi_pi_pi::XSvErr, hf_cand_xic_to_xi_pi_pi::YSvErr, hf_cand_xic_to_xi_pi_pi::ZSvErr, hf_cand::ErrorDecayLength, hf_cand::ErrorDecayLengthXY, - hf_cand::Chi2PCA, hf_cand_xic_to_xi_pi_pi::InvMassXic, hf_cand_xic_to_xi_pi_pi::Sign, + hf_cand::Chi2PCA, hf_cand_xic_to_xi_pi_pi::InvMassXicPlus, hf_cand_xic_to_xi_pi_pi::Sign, hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, hf_cand::PxProng2, hf_cand::PyProng2, hf_cand::PzProng2, hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, // cascade specific columns - hf_cand_xic_to_xi_pi_pi::XDecayVtxXi, hf_cand_xic_to_xi_pi_pi::YDecayVtxXi, hf_cand_xic_to_xi_pi_pi::ZDecayVtxXi, - hf_cand_xic_to_xi_pi_pi::XDecayVtxLambda, hf_cand_xic_to_xi_pi_pi::YDecayVtxLambda, hf_cand_xic_to_xi_pi_pi::ZDecayVtxLambda, - hf_cand_xic_to_xi_pi_pi::CosPaXi, hf_cand_xic_to_xi_pi_pi::CosPaXYXi, hf_cand_xic_to_xi_pi_pi::CosPaLambda, hf_cand_xic_to_xi_pi_pi::CosPaXYLambda, - hf_cand_xic_to_xi_pi_pi::InvMassXiPi0, hf_cand_xic_to_xi_pi_pi::InvMassXiPi1, + hf_cand_xic_to_xi_pi_pi::PBachelorPi, hf_cand_xic_to_xi_pi_pi::PPiFromLambda, hf_cand_xic_to_xi_pi_pi::PPrFrmoLambda, + hf_cand_xic_to_xi_pi_pi::CosPaXi, hf_cand_xic_to_xi_pi_pi::CosPaXYXi, hf_cand_xic_to_xi_pi_pi::CosPaLambda, hf_cand_xic_to_xi_pi_pi::CosPaXYLambda, hf_cand_xic_to_xi_pi_pi::CosPaLambdaToXi, hf_cand_xic_to_xi_pi_pi::CosPaXYLambdaToXi, + hf_cand_xic_to_xi_pi_pi::InvMassXi, hf_cand_xic_to_xi_pi_pi::InvMassXiPi0, hf_cand_xic_to_xi_pi_pi::InvMassXiPi1, + // PID + hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromXicPlus0, hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromXicPlus1, hf_cand_xic_to_xi_pi_pi::NSigTpcBachelorPi, hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromLambda, hf_cand_xic_to_xi_pi_pi::NSigTpcPrFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTofPiFromXicPlus0, hf_cand_xic_to_xi_pi_pi::NSigTofPiFromXicPlus1, hf_cand_xic_to_xi_pi_pi::NSigTofBachelorPi, hf_cand_xic_to_xi_pi_pi::NSigTofPiFromLambda, hf_cand_xic_to_xi_pi_pi::NSigTofPrFromLambda, /* dynamic columns */ - hf_cand::RSecondaryVertex, hf_cand::DecayLength, hf_cand::DecayLengthXY, hf_cand::DecayLengthNormalised, @@ -1567,8 +1592,11 @@ DECLARE_SOA_TABLE(HfCandXicBase, "AOD", "HFCANDXICBASE", hf_cand::ImpactParameterNormalised1, hf_cand::ImpactParameterNormalised2, /* dynamic columns that use daughter momentum components */ + hf_cand_xic_to_xi_pi_pi::PProng0, hf_cand::PtProng0, + hf_cand_xic_to_xi_pi_pi::PProng1, hf_cand::PtProng1, + hf_cand_xic_to_xi_pi_pi::PProng2, hf_cand::PtProng2, /* dynamic columns that use candidate momentum components */ hf_cand::Pt, @@ -1581,8 +1609,7 @@ DECLARE_SOA_TABLE(HfCandXicBase, "AOD", "HFCANDXICBASE", hf_cand_3prong::MaxNormalisedDeltaIP, hf_cand::Eta, hf_cand::Phi, - hf_cand::Y, - hf_cand::E); + hf_cand::Y); // extended table with expression columns that can be used as arguments of dynamic columns DECLARE_SOA_EXTENDED_TABLE_USER(HfCandXicExt, HfCandXicBase, "HFCANDXICEXT", @@ -1591,7 +1618,8 @@ DECLARE_SOA_EXTENDED_TABLE_USER(HfCandXicExt, HfCandXicBase, "HFCANDXICEXT", using HfCandXic = HfCandXicExt; DECLARE_SOA_TABLE(HfCandXicKF, "AOD", "HFCANDXICKF", - cascdata::KFCascadeChi2, cascdata::KFV0Chi2, hf_cand_xic_to_xi_pi_pi::Chi2TopoXicPlusToPV, hf_cand_xic_to_xi_pi_pi::Chi2TopoXiToXicPlus, + cascdata::KFCascadeChi2, cascdata::KFV0Chi2, + hf_cand_xic_to_xi_pi_pi::Chi2TopoXicPlusToPVBeforeConstraint, hf_cand_xic_to_xi_pi_pi::Chi2TopoXicPlusToPV, hf_cand_xic_to_xi_pi_pi::Chi2TopoXiToXicPlusBeforeConstraint, hf_cand_xic_to_xi_pi_pi::Chi2TopoXiToXicPlus, hf_cand_xic_to_xi_pi_pi::DcaXYPi0Pi1, hf_cand_xic_to_xi_pi_pi::DcaXYPi0Xi, hf_cand_xic_to_xi_pi_pi::DcaXYPi1Xi, hf_cand_xic_to_xi_pi_pi::DcaPi0Pi1, hf_cand_xic_to_xi_pi_pi::DcaPi0Xi, hf_cand_xic_to_xi_pi_pi::DcaPi1Xi, cascdata::DCACascDaughters); @@ -2261,7 +2289,8 @@ DECLARE_SOA_TABLE(HfCandDstarMcRec, "AOD", "HFCANDDSTRMCREC", hf_cand_dstar::FlagMcMatchRec, hf_cand_dstar::OriginMcRec, hf_cand::PtBhadMotherPart, - hf_cand::PdgBhadMotherPart); + hf_cand::PdgBhadMotherPart, + hf_cand::NTracksDecayed); // table with results of generator level MC matching DECLARE_SOA_TABLE(HfCandDstarMcGen, "AOD", "HFCANDDSTRMCGEN", diff --git a/PWGHF/DataModel/CandidateSelectionTables.h b/PWGHF/DataModel/CandidateSelectionTables.h index 071ad7c0431..583c30a5de2 100644 --- a/PWGHF/DataModel/CandidateSelectionTables.h +++ b/PWGHF/DataModel/CandidateSelectionTables.h @@ -308,6 +308,7 @@ DECLARE_SOA_COLUMN(MlProbXicToPKPi, mlProbXicToPKPi, std::vector); //! DECLARE_SOA_COLUMN(MlProbXicToPiKP, mlProbXicToPiKP, std::vector); //! // XicPlus to Xi Pi Pi DECLARE_SOA_COLUMN(IsSelXicToXiPiPi, isSelXicToXiPiPi, int); //! +DECLARE_SOA_COLUMN(MlProbXicToXiPiPi, mlProbXicToXiPiPi, std::vector); //! } // namespace hf_sel_candidate_xic DECLARE_SOA_TABLE(HfSelXicToPKPi, "AOD", "HFSELXIC", //! @@ -317,6 +318,8 @@ DECLARE_SOA_TABLE(HfMlXicToPKPi, "AOD", "HFMLXIC", //! // XicPlus to Xi Pi Pi DECLARE_SOA_TABLE(HfSelXicToXiPiPi, "AOD", "HFSELXICTOXI2PI", //! hf_sel_candidate_xic::IsSelXicToXiPiPi); +DECLARE_SOA_TABLE(HfMlXicToXiPiPi, "AOD", "HFMLXICTOXI2PI", //! + hf_sel_candidate_xic::MlProbXicToXiPiPi); namespace hf_sel_candidate_xicc { diff --git a/PWGHF/DataModel/DerivedTables.h b/PWGHF/DataModel/DerivedTables.h index 30bc06c3bc6..179695e2787 100644 --- a/PWGHF/DataModel/DerivedTables.h +++ b/PWGHF/DataModel/DerivedTables.h @@ -18,19 +18,27 @@ #include -#include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoA.h" #include "Common/Core/RecoDecay.h" +#include "PWGLF/DataModel/mcCentrality.h" + #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" namespace o2::aod { -constexpr uint MarkerD0 = 1; -constexpr uint Marker3P = 2; +// basic species: +// D0 -> K- + pi+ (done) +// Lc -> pi+ K- p +// D+ -> K- + pi+ + pi+ (3P table with adapted PID columns) +// Ds+ -> K- + K+ + pi+ (3P table with adapted PID columns) +// composite species +// B0 -> D- + pi+ +// B+ -> D0 + pi+ (in progress) +// D*+ -> D0 + pi+ // ================ // Collision tables @@ -39,131 +47,76 @@ constexpr uint Marker3P = 2; // Basic collision properties namespace hf_coll_base { -DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int8_t); //! collision rejection flag -DECLARE_SOA_COLUMN(MultFT0M, multFT0M, float); //! FT0M multiplicity -DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); //! FT0A centrality percentile -DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); //! FT0C centrality percentile -DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); //! FT0M centrality percentile -DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float); //! FT0A centrality percentile -DECLARE_SOA_COLUMN(CentFDDM, centFDDM, float); //! FDDM centrality percentile +DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int8_t); //! collision rejection flag +DECLARE_SOA_COLUMN(MultFT0M, multFT0M, float); //! FT0M multiplicity +DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); //! FT0A centrality percentile +DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); //! FT0C centrality percentile +DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); //! FT0M centrality percentile +DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float); //! FV0A centrality percentile +DECLARE_SOA_COLUMN(CentFDDM, centFDDM, float); //! FDDM centrality percentile DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float); //! z-equalised barrel multiplicity } // namespace hf_coll_base -// D0 - -DECLARE_SOA_TABLE(HfD0CollBases, "AOD", "HFD0COLLBASE", //! Table with basic collision info - o2::soa::Index<>, - collision::PosX, - collision::PosY, - collision::PosZ, - collision::NumContrib, - hf_coll_base::CentFT0A, - hf_coll_base::CentFT0C, - hf_coll_base::CentFT0M, - hf_coll_base::CentFV0A, - hf_coll_base::MultZeqNTracksPV, - // hf_coll_base::IsEventReject, - // bc::RunNumber, - soa::Marker); - -using HfD0CollBase = HfD0CollBases::iterator; - -DECLARE_SOA_TABLE(HfD0CollIds, "AOD", "HFD0COLLID", //! Table with original global indices of collisions - hf_cand::CollisionId, - soa::Marker); - -// 3-prong decays - -DECLARE_SOA_TABLE(Hf3PCollBases, "AOD", "HF3PCOLLBASE", //! Table with basic collision info - o2::soa::Index<>, - collision::PosX, - collision::PosY, - collision::PosZ, - collision::NumContrib, - hf_coll_base::CentFT0A, - hf_coll_base::CentFT0C, - hf_coll_base::CentFT0M, - hf_coll_base::CentFV0A, - hf_coll_base::MultZeqNTracksPV, - // hf_coll_base::IsEventReject, - // bc::RunNumber, - soa::Marker); - -using Hf3PCollBase = Hf3PCollBases::iterator; - -DECLARE_SOA_TABLE(Hf3PCollIds, "AOD", "HF3PCOLLID", //! Table with original global indices of collisions - hf_cand::CollisionId, - soa::Marker); - -// =================== -// MC collision tables -// =================== - -// MC collision columns namespace hf_mc_coll { DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); //! original global index of the MC collision -namespace der_d0 -{ -DECLARE_SOA_ARRAY_INDEX_COLUMN(HfD0CollBase, hfCollBases); //! collision index array pointing to the derived reconstructed collisions for D0 candidates -} -namespace der_3p -{ -DECLARE_SOA_ARRAY_INDEX_COLUMN(Hf3PCollBase, hfCollBases); //! collision index array pointing to the derived reconstructed collisions for 3-prong candidates -} } // namespace hf_mc_coll -// DO - -DECLARE_SOA_TABLE(HfD0McCollBases, "AOD", "HFD0MCCOLLBASE", //! Table with basic MC collision info - o2::soa::Index<>, - mccollision::PosX, - mccollision::PosY, - mccollision::PosZ, - soa::Marker); - -using HfD0McCollBase = HfD0McCollBases::iterator; - -DECLARE_SOA_TABLE(HfD0McCollIds, "AOD", "HFD0MCCOLLID", //! Table with original global indices of MC collisions - hf_mc_coll::McCollisionId, - soa::Marker); - -DECLARE_SOA_TABLE(HfD0McRCollIds, "AOD", "HFD0MCRCOLLID", //! Table with indices pointing to the derived reconstructed-collision table - hf_mc_coll::der_d0::HfD0CollBaseIds); - -// 3-prong decays - -DECLARE_SOA_TABLE(Hf3PMcCollBases, "AOD", "HF3PMCCOLLBASE", //! Table with basic MC collision info - o2::soa::Index<>, - mccollision::PosX, - mccollision::PosY, - mccollision::PosZ, - soa::Marker); - -using Hf3PMcCollBase = Hf3PMcCollBases::iterator; +// Defines the collision table +#define DECLARE_COLL_TABLE(_hf_type_, _hf_description_) \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##CollBases, "HF" _hf_description_ "COLLBASE", \ + o2::soa::Index<>, \ + collision::PosX, \ + collision::PosY, \ + collision::PosZ, \ + collision::NumContrib, \ + hf_coll_base::CentFT0A, \ + hf_coll_base::CentFT0C, \ + hf_coll_base::CentFT0M, \ + hf_coll_base::CentFV0A, \ + hf_coll_base::MultZeqNTracksPV, \ + o2::soa::Marker); \ + \ + using Hf##_hf_type_##CollBase = Hf##_hf_type_##CollBases::iterator; \ + using StoredHf##_hf_type_##CollBase = StoredHf##_hf_type_##CollBases::iterator; \ + \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##CollIds, "HF" _hf_description_ "COLLID", \ + hf_cand::CollisionId, \ + o2::soa::Marker); + +// Defines the mc collision table +#define DECLARE_MCCOLL_TABLE(_hf_type_, _hf_description_, _hf_namespace_) \ + namespace hf_mc_coll \ + { \ + namespace der_##_hf_namespace_ \ + { \ + DECLARE_SOA_ARRAY_INDEX_COLUMN(Hf##_hf_type_##CollBase, hfCollBases); \ + } \ + } \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##McCollBases, "HF" _hf_description_ "MCCOLLBASE", \ + o2::soa::Index<>, \ + mccollision::PosX, \ + mccollision::PosY, \ + mccollision::PosZ, \ + cent::CentFT0M, \ + o2::soa::Marker); \ + \ + using Hf##_hf_type_##McCollBase = Hf##_hf_type_##McCollBases::iterator; \ + using StoredHf##_hf_type_##McCollBase = StoredHf##_hf_type_##McCollBases::iterator; \ + \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##McCollIds, "HF" _hf_description_ "MCCOLLID", \ + hf_mc_coll::McCollisionId, \ + o2::soa::Marker); \ + \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##McRCollIds, "HF" _hf_description_ "MCRCOLLID", \ + hf_mc_coll::der_##_hf_namespace_::Hf##_hf_type_##CollBaseIds); + +#define DECLARE_COLL_TABLES(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_COLL_TABLE(_hf_type_, _hf_description_) \ + DECLARE_MCCOLL_TABLE(_hf_type_, _hf_description_, _hf_namespace_) -DECLARE_SOA_TABLE(Hf3PMcCollIds, "AOD", "HF3PMCCOLLID", //! Table with original global indices of MC collisions - hf_mc_coll::McCollisionId, - soa::Marker); - -DECLARE_SOA_TABLE(Hf3PMcRCollIds, "AOD", "HF3PMCRCOLLID", //! Table with indices pointing to the derived reconstructed-collision table - hf_mc_coll::der_3p::Hf3PCollBaseIds); - -// ================ -// Candidate tables -// ================ - -// Basic candidate properties namespace hf_cand_base { -namespace der_d0 -{ -DECLARE_SOA_INDEX_COLUMN(HfD0CollBase, hfCollBase); //! collision index pointing to the derived collision table for D0 candidates -} -namespace der_3p -{ -DECLARE_SOA_INDEX_COLUMN(Hf3PCollBase, hfCollBase); //! collision index pointing to the derived collision table for 3-prong candidates -} DECLARE_SOA_COLUMN(Eta, eta, float); //! pseudorapidity DECLARE_SOA_COLUMN(M, m, float); //! invariant mass DECLARE_SOA_COLUMN(Phi, phi, float); //! azimuth @@ -179,6 +132,139 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! momentum [](float pt, float eta) -> float { return RecoDecayPtEtaPhi::p(pt, eta); }); } // namespace hf_cand_base +// Candidate selection flags +namespace hf_cand_sel +{ +DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); //! bitmap of the selected candidate type +} + +// Candidate MC columns +namespace hf_cand_mc +{ +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! flag for reconstruction level matching +DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); //! particle origin, reconstruction level +DECLARE_SOA_COLUMN(IsCandidateSwapped, isCandidateSwapped, int8_t); //! swapping of the prongs order +DECLARE_SOA_COLUMN(FlagMcDecayChanRec, flagMcDecayChanRec, int8_t); //! resonant decay channel flag, reconstruction level +DECLARE_SOA_COLUMN(MlScoreSig, mlScoreSig, float); //! ML score for signal class +DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML score for background class +DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML score for prompt class +DECLARE_SOA_COLUMN(MlScoreNonPrompt, mlScoreNonPrompt, float); //! ML score for non-prompt class +DECLARE_SOA_COLUMN(MlScores, mlScores, std::vector); //! vector of ML scores +} // namespace hf_cand_mc + +namespace hf_mc_particle +{ +DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); //! MC collision of this particle +DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle +DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); //! flag for generator level matching +DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); //! particle origin, generator level +DECLARE_SOA_COLUMN(FlagMcDecayChanGen, flagMcDecayChanGen, int8_t); //! resonant decay channel flag, generator level +} // namespace hf_mc_particle + +#define DECLARE_CAND_BASE_TABLE(_hf_type_, _hf_description_, _hf_namespace_) \ + namespace hf_cand_base \ + { \ + namespace der_##_hf_namespace_ \ + { \ + DECLARE_SOA_INDEX_COLUMN(Hf##_hf_type_##CollBase, hfCollBase); \ + } \ + } \ + \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##Bases, "HF" _hf_description_ "BASE", \ + o2::soa::Index<>, \ + hf_cand_base::der_##_hf_namespace_::Hf##_hf_type_##CollBaseId, \ + hf_cand_base::Pt, \ + hf_cand_base::Eta, \ + hf_cand_base::Phi, \ + hf_cand_base::M, \ + hf_cand_base::Y, \ + hf_cand_base::Px, \ + hf_cand_base::Py, \ + hf_cand_base::Pz, \ + hf_cand_base::P, \ + o2::soa::Marker); + +#define DECLARE_CAND_2P_ID_TABLE(_hf_type_, _hf_description_) \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##Ids, "HF" _hf_description_ "ID", \ + hf_cand::CollisionId, \ + hf_track_index::Prong0Id, \ + hf_track_index::Prong1Id, \ + o2::soa::Marker); + +#define DECLARE_CAND_3P_ID_TABLE(_hf_type_, _hf_description_) \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##Ids, "HF" _hf_description_ "ID", \ + hf_cand::CollisionId, \ + hf_track_index::Prong0Id, \ + hf_track_index::Prong1Id, \ + hf_track_index::Prong2Id, \ + o2::soa::Marker); + +#define DECLARE_CAND_SEL_TABLE(_hf_type_, _hf_description_) \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##Sels, "HF" _hf_description_ "SEL", \ + hf_cand_sel::CandidateSelFlag, \ + o2::soa::Marker); + +#define DECLARE_MCCAND_BASE_TABLE(_hf_type_, _hf_description_, _hf_namespace_) \ + namespace hf_mc_particle \ + { \ + namespace der_##_hf_namespace_ \ + { \ + DECLARE_SOA_INDEX_COLUMN(Hf##_hf_type_##McCollBase, hfMcCollBase); \ + } \ + } \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##PBases, "HF" _hf_description_ "PBASE", \ + o2::soa::Index<>, \ + hf_mc_particle::der_##_hf_namespace_::Hf##_hf_type_##McCollBaseId, \ + hf_cand_base::Pt, \ + hf_cand_base::Eta, \ + hf_cand_base::Phi, \ + hf_cand_base::Y, \ + hf_mc_particle::FlagMcMatchGen, \ + hf_mc_particle::OriginMcGen, \ + hf_cand_base::Px, \ + hf_cand_base::Py, \ + hf_cand_base::Pz, \ + hf_cand_base::P, \ + o2::soa::Marker); + +#define DECLARE_MCCAND_ID_TABLE(_hf_type_, _hf_description_) \ + DECLARE_SOA_TABLE_STAGED(Hf##_hf_type_##PIds, "HF" _hf_description_ "PID", \ + hf_mc_particle::McCollisionId, \ + hf_mc_particle::McParticleId, \ + o2::soa::Marker); + +#define DECLARE_CAND_TABLES(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_CAND_BASE_TABLE(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_CAND_SEL_TABLE(_hf_type_, _hf_description_) \ + DECLARE_MCCAND_BASE_TABLE(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_MCCAND_ID_TABLE(_hf_type_, _hf_description_) + +#define DECLARE_CAND_2P_TABLES(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_CAND_TABLES(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_CAND_2P_ID_TABLE(_hf_type_, _hf_description_) + +#define DECLARE_CAND_3P_TABLES(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_CAND_TABLES(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_CAND_3P_ID_TABLE(_hf_type_, _hf_description_) + +#define DECLARE_2P_TABLES(_hf_type_, _hf_description_, _hf_namespace_, _marker_number_) \ + constexpr uint Marker##_hf_type_ = _marker_number_; \ + DECLARE_COLL_TABLES(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_CAND_2P_TABLES(_hf_type_, _hf_description_, _hf_namespace_) + +#define DECLARE_3P_TABLES(_hf_type_, _hf_description_, _hf_namespace_, _marker_number_) \ + constexpr uint Marker##_hf_type_ = _marker_number_; \ + DECLARE_COLL_TABLES(_hf_type_, _hf_description_, _hf_namespace_) \ + DECLARE_CAND_3P_TABLES(_hf_type_, _hf_description_, _hf_namespace_) + +DECLARE_2P_TABLES(D0, "D0", d0, 2); +DECLARE_3P_TABLES(Lc, "LC", lc, 3); +DECLARE_3P_TABLES(Bplus, "BP", bplus, 4); + +// ================ +// Candidate tables +// ================ + // Candidate properties used for selection namespace hf_cand_par { @@ -246,282 +332,306 @@ DECLARE_SOA_COLUMN(NSigTpcTofPr1, nSigTpcTofPr1, float); DECLARE_SOA_COLUMN(NSigTpcTofPr2, nSigTpcTofPr2, float); } // namespace hf_cand_par -// Candidate selection flags -namespace hf_cand_sel +// Candidate properties of the charm daughter candidate used for selection of the beauty candidate +// Copy of hf_cand_par with "Charm" suffix to make it joinable with the beauty candidate table. +// We don't want to link the charm candidate table because we want to avoid producing it. +namespace hf_cand_par_charm { -DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); //! bitmap of the selected candidate type -} - -// Candidate MC columns -namespace hf_cand_mc +DECLARE_SOA_COLUMN(CosThetaStarCharm, cosThetaStarCharm, float); //! cosine of theta star +DECLARE_SOA_COLUMN(CpaCharm, cpaCharm, float); //! cosine of pointing angle +DECLARE_SOA_COLUMN(CpaXYCharm, cpaXYCharm, float); //! cosine of pointing angle in the transverse plane +DECLARE_SOA_COLUMN(CtCharm, ctCharm, float); //! proper lifetime times c +DECLARE_SOA_COLUMN(DecayLengthCharm, decayLengthCharm, float); //! decay length +DECLARE_SOA_COLUMN(DecayLengthNormalisedCharm, decayLengthNormalisedCharm, float); //! decay length divided by its uncertainty +DECLARE_SOA_COLUMN(DecayLengthXYCharm, decayLengthXYCharm, float); //! decay length in the transverse plane +DECLARE_SOA_COLUMN(DecayLengthXYNormalisedCharm, decayLengthXYNormalisedCharm, float); //! decay length in the transverse plane divided by its uncertainty +DECLARE_SOA_COLUMN(ImpactParameter0Charm, impactParameter0Charm, float); //! impact parameter of prong 0 +DECLARE_SOA_COLUMN(ImpactParameter1Charm, impactParameter1Charm, float); //! impact parameter of prong 1 +DECLARE_SOA_COLUMN(ImpactParameterNormalised0Charm, impactParameterNormalised0Charm, float); //! impact parameter of prong 0 divided by its uncertainty +DECLARE_SOA_COLUMN(ImpactParameterNormalised1Charm, impactParameterNormalised1Charm, float); //! impact parameter of prong 1 divided by its uncertainty +DECLARE_SOA_COLUMN(ImpactParameterNormalised2Charm, impactParameterNormalised2Charm, float); //! impact parameter of prong 2 divided by its uncertainty +DECLARE_SOA_COLUMN(ImpactParameterProductCharm, impactParameterProductCharm, float); //! product of impact parameters of prong 0 and prong 1 +DECLARE_SOA_COLUMN(MaxNormalisedDeltaIPCharm, maxNormalisedDeltaIPCharm, float); //! see RecoDecay::maxNormalisedDeltaIP +DECLARE_SOA_COLUMN(PProng0Charm, pProng0Charm, float); //! momentum magnitude of prong 0 +DECLARE_SOA_COLUMN(PProng1Charm, pProng1Charm, float); //! momentum magnitude of prong 1 +DECLARE_SOA_COLUMN(PProng2Charm, pProng2Charm, float); //! momentum magnitude of prong 2 +DECLARE_SOA_COLUMN(PtProng0Charm, ptProng0Charm, float); //! transverse momentum of prong 0 +DECLARE_SOA_COLUMN(PtProng1Charm, ptProng1Charm, float); //! transverse momentum of prong 1 +DECLARE_SOA_COLUMN(PtProng2Charm, ptProng2Charm, float); //! transverse momentum of prong 2 +DECLARE_SOA_COLUMN(RSecondaryVertexCharm, rSecondaryVertexCharm, float); //! distance of the secondary vertex from the z axis +// TOF +DECLARE_SOA_COLUMN(NSigTofKa0Charm, nSigTofKa0Charm, float); +DECLARE_SOA_COLUMN(NSigTofKa1Charm, nSigTofKa1Charm, float); +DECLARE_SOA_COLUMN(NSigTofKa2Charm, nSigTofKa2Charm, float); +DECLARE_SOA_COLUMN(NSigTofKaExpPiCharm, nSigTofKaExpPiCharm, float); +DECLARE_SOA_COLUMN(NSigTofKaExpKaCharm, nSigTofKaExpKaCharm, float); +DECLARE_SOA_COLUMN(NSigTofPi0Charm, nSigTofPi0Charm, float); +DECLARE_SOA_COLUMN(NSigTofPi1Charm, nSigTofPi1Charm, float); +DECLARE_SOA_COLUMN(NSigTofPi2Charm, nSigTofPi2Charm, float); +DECLARE_SOA_COLUMN(NSigTofPiExpPiCharm, nSigTofPiExpPiCharm, float); +DECLARE_SOA_COLUMN(NSigTofPiExpKaCharm, nSigTofPiExpKaCharm, float); +DECLARE_SOA_COLUMN(NSigTofPr0Charm, nSigTofPr0Charm, float); +DECLARE_SOA_COLUMN(NSigTofPr1Charm, nSigTofPr1Charm, float); +DECLARE_SOA_COLUMN(NSigTofPr2Charm, nSigTofPr2Charm, float); +// TPC +DECLARE_SOA_COLUMN(NSigTpcKa0Charm, nSigTpcKa0Charm, float); +DECLARE_SOA_COLUMN(NSigTpcKa1Charm, nSigTpcKa1Charm, float); +DECLARE_SOA_COLUMN(NSigTpcKa2Charm, nSigTpcKa2Charm, float); +DECLARE_SOA_COLUMN(NSigTpcKaExpPiCharm, nSigTpcKaExpPiCharm, float); +DECLARE_SOA_COLUMN(NSigTpcKaExpKaCharm, nSigTpcKaExpKaCharm, float); +DECLARE_SOA_COLUMN(NSigTpcPi0Charm, nSigTpcPi0Charm, float); +DECLARE_SOA_COLUMN(NSigTpcPi1Charm, nSigTpcPi1Charm, float); +DECLARE_SOA_COLUMN(NSigTpcPi2Charm, nSigTpcPi2Charm, float); +DECLARE_SOA_COLUMN(NSigTpcPiExpPiCharm, nSigTpcPiExpPiCharm, float); +DECLARE_SOA_COLUMN(NSigTpcPiExpKaCharm, nSigTpcPiExpKaCharm, float); +DECLARE_SOA_COLUMN(NSigTpcPr0Charm, nSigTpcPr0Charm, float); +DECLARE_SOA_COLUMN(NSigTpcPr1Charm, nSigTpcPr1Charm, float); +DECLARE_SOA_COLUMN(NSigTpcPr2Charm, nSigTpcPr2Charm, float); +// TPC+TOF +DECLARE_SOA_COLUMN(NSigTpcTofKa0Charm, nSigTpcTofKa0Charm, float); +DECLARE_SOA_COLUMN(NSigTpcTofKa1Charm, nSigTpcTofKa1Charm, float); +DECLARE_SOA_COLUMN(NSigTpcTofKa2Charm, nSigTpcTofKa2Charm, float); +DECLARE_SOA_COLUMN(NSigTpcTofKaExpPiCharm, nSigTpcTofKaExpPiCharm, float); +DECLARE_SOA_COLUMN(NSigTpcTofKaExpKaCharm, nSigTpcTofKaExpKaCharm, float); +DECLARE_SOA_COLUMN(NSigTpcTofPi0Charm, nSigTpcTofPi0Charm, float); +DECLARE_SOA_COLUMN(NSigTpcTofPi1Charm, nSigTpcTofPi1Charm, float); +DECLARE_SOA_COLUMN(NSigTpcTofPi2Charm, nSigTpcTofPi2Charm, float); +DECLARE_SOA_COLUMN(NSigTpcTofPiExpPiCharm, nSigTpcTofPiExpPiCharm, float); +DECLARE_SOA_COLUMN(NSigTpcTofPiExpKaCharm, nSigTpcTofPiExpKaCharm, float); +DECLARE_SOA_COLUMN(NSigTpcTofPr0Charm, nSigTpcTofPr0Charm, float); +DECLARE_SOA_COLUMN(NSigTpcTofPr1Charm, nSigTpcTofPr1Charm, float); +DECLARE_SOA_COLUMN(NSigTpcTofPr2Charm, nSigTpcTofPr2Charm, float); +} // namespace hf_cand_par_charm + +// Candidate MC columns of the charm daughter +namespace hf_cand_mc_charm { -DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! flag for reconstruction level matching -DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); //! particle origin, reconstruction level -DECLARE_SOA_COLUMN(IsCandidateSwapped, isCandidateSwapped, int8_t); //! swapping of the prongs order -DECLARE_SOA_COLUMN(FlagMcDecayChanRec, flagMcDecayChanRec, int8_t); //! resonant decay channel flag, reconstruction level -DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML score for background class -DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML score for prompt class -DECLARE_SOA_COLUMN(MlScoreNonPrompt, mlScoreNonPrompt, float); //! ML score for non-prompt class -DECLARE_SOA_COLUMN(MlScores, mlScores, std::vector); //! vector of ML scores -} // namespace hf_cand_mc +DECLARE_SOA_COLUMN(FlagMcMatchRecCharm, flagMcMatchRecCharm, int8_t); //! flag for reconstruction level matching +DECLARE_SOA_COLUMN(OriginMcRecCharm, originMcRecCharm, int8_t); //! particle origin, reconstruction level +DECLARE_SOA_COLUMN(IsCandidateSwappedCharm, isCandidateSwappedCharm, int8_t); //! swapping of the prongs order +DECLARE_SOA_COLUMN(FlagMcDecayChanRecCharm, flagMcDecayChanRecCharm, int8_t); //! resonant decay channel flag, reconstruction level +DECLARE_SOA_COLUMN(MlScoreSigCharm, mlScoreSigCharm, float); //! ML score for signal class +DECLARE_SOA_COLUMN(MlScoreBkgCharm, mlScoreBkgCharm, float); //! ML score for background class +DECLARE_SOA_COLUMN(MlScorePromptCharm, mlScorePromptCharm, float); //! ML score for prompt class +DECLARE_SOA_COLUMN(MlScoreNonPromptCharm, mlScoreNonPromptCharm, float); //! ML score for non-prompt class +DECLARE_SOA_COLUMN(MlScoresCharm, mlScoresCharm, std::vector); //! vector of ML scores +} // namespace hf_cand_mc_charm -// D0 - -DECLARE_SOA_TABLE(HfD0Bases, "AOD", "HFD0BASE", //! Table with basic candidate properties used in the analyses - o2::soa::Index<>, - hf_cand_base::der_d0::HfD0CollBaseId, - hf_cand_base::Pt, - hf_cand_base::Eta, - hf_cand_base::Phi, - hf_cand_base::M, - hf_cand_base::Y, - hf_cand_base::Px, - hf_cand_base::Py, - hf_cand_base::Pz, - hf_cand_base::P, - soa::Marker); +// candidates for removal: +// PxProng0, PyProng0, PzProng0,... (same for 1, 2), we can keep Pt, Eta, Phi instead +// XY: CpaXY, DecayLengthXY, ErrorDecayLengthXY +// normalised: DecayLengthNormalised, DecayLengthXYNormalised, ImpactParameterNormalised0 +DECLARE_SOA_TABLE_STAGED(HfD0Pars, "HFD0PAR", //! Table with candidate properties used for selection + hf_cand::Chi2PCA, + hf_cand_par::Cpa, + hf_cand_par::CpaXY, + hf_cand_par::DecayLength, + hf_cand_par::DecayLengthXY, + hf_cand_par::DecayLengthNormalised, + hf_cand_par::DecayLengthXYNormalised, + hf_cand_par::PtProng0, + hf_cand_par::PtProng1, + hf_cand::ImpactParameter0, + hf_cand::ImpactParameter1, + hf_cand_par::ImpactParameterNormalised0, + hf_cand_par::ImpactParameterNormalised1, + hf_cand_par::NSigTpcPiExpPi, + hf_cand_par::NSigTofPiExpPi, + hf_cand_par::NSigTpcTofPiExpPi, + hf_cand_par::NSigTpcKaExpPi, + hf_cand_par::NSigTofKaExpPi, + hf_cand_par::NSigTpcTofKaExpPi, + hf_cand_par::NSigTpcPiExpKa, + hf_cand_par::NSigTofPiExpKa, + hf_cand_par::NSigTpcTofPiExpKa, + hf_cand_par::NSigTpcKaExpKa, + hf_cand_par::NSigTofKaExpKa, + hf_cand_par::NSigTpcTofKaExpKa, + hf_cand_par::MaxNormalisedDeltaIP, + hf_cand_par::ImpactParameterProduct, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfD0ParEs, "HFD0PARE", //! Table with additional candidate properties used for selection + hf_cand::XSecondaryVertex, + hf_cand::YSecondaryVertex, + hf_cand::ZSecondaryVertex, + hf_cand::ErrorDecayLength, + hf_cand::ErrorDecayLengthXY, + hf_cand::KfTopolChi2OverNdf, + hf_cand_par::RSecondaryVertex, + hf_cand_par::PProng0, + hf_cand_par::PProng1, + hf_cand::PxProng0, + hf_cand::PyProng0, + hf_cand::PzProng0, + hf_cand::PxProng1, + hf_cand::PyProng1, + hf_cand::PzProng1, + hf_cand::ErrorImpactParameter0, + hf_cand::ErrorImpactParameter1, + hf_cand_par::CosThetaStar, + hf_cand_par::Ct, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfD0Mls, "HFD0ML", //! Table with candidate selection ML scores + hf_cand_mc::MlScores, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfD0Mcs, "HFD0MC", //! Table with MC candidate info + hf_cand_mc::FlagMcMatchRec, + hf_cand_mc::OriginMcRec, + o2::soa::Marker); // candidates for removal: // PxProng0, PyProng0, PzProng0,... (same for 1, 2), we can keep Pt, Eta, Phi instead // XY: CpaXY, DecayLengthXY, ErrorDecayLengthXY // normalised: DecayLengthNormalised, DecayLengthXYNormalised, ImpactParameterNormalised0 -DECLARE_SOA_TABLE(HfD0Pars, "AOD", "HFD0PAR", //! Table with candidate properties used for selection - hf_cand::Chi2PCA, - hf_cand_par::Cpa, - hf_cand_par::CpaXY, - hf_cand_par::DecayLength, - hf_cand_par::DecayLengthXY, - hf_cand_par::DecayLengthNormalised, - hf_cand_par::DecayLengthXYNormalised, - hf_cand_par::PtProng0, - hf_cand_par::PtProng1, - hf_cand::ImpactParameter0, - hf_cand::ImpactParameter1, - hf_cand_par::ImpactParameterNormalised0, - hf_cand_par::ImpactParameterNormalised1, - hf_cand_par::NSigTpcPiExpPi, - hf_cand_par::NSigTofPiExpPi, - hf_cand_par::NSigTpcTofPiExpPi, - hf_cand_par::NSigTpcKaExpPi, - hf_cand_par::NSigTofKaExpPi, - hf_cand_par::NSigTpcTofKaExpPi, - hf_cand_par::NSigTpcPiExpKa, - hf_cand_par::NSigTofPiExpKa, - hf_cand_par::NSigTpcTofPiExpKa, - hf_cand_par::NSigTpcKaExpKa, - hf_cand_par::NSigTofKaExpKa, - hf_cand_par::NSigTpcTofKaExpKa, - hf_cand_par::MaxNormalisedDeltaIP, - hf_cand_par::ImpactParameterProduct, - soa::Marker); - -DECLARE_SOA_TABLE(HfD0ParEs, "AOD", "HFD0PARE", //! Table with additional candidate properties used for selection - hf_cand::XSecondaryVertex, - hf_cand::YSecondaryVertex, - hf_cand::ZSecondaryVertex, - hf_cand::ErrorDecayLength, - hf_cand::ErrorDecayLengthXY, - hf_cand::KfTopolChi2OverNdf, - hf_cand_par::RSecondaryVertex, - hf_cand_par::PProng0, - hf_cand_par::PProng1, - hf_cand::PxProng0, - hf_cand::PyProng0, - hf_cand::PzProng0, - hf_cand::PxProng1, - hf_cand::PyProng1, - hf_cand::PzProng1, - hf_cand::ErrorImpactParameter0, - hf_cand::ErrorImpactParameter1, - hf_cand_par::CosThetaStar, - hf_cand_par::Ct, - soa::Marker); - -DECLARE_SOA_TABLE(HfD0Sels, "AOD", "HFD0SEL", //! Table with candidate selection flags - hf_cand_sel::CandidateSelFlag, - soa::Marker); - -DECLARE_SOA_TABLE(HfD0Mls, "AOD", "HFD0ML", //! Table with candidate selection ML scores - hf_cand_mc::MlScores, - soa::Marker); - -DECLARE_SOA_TABLE(HfD0Ids, "AOD", "HFD0ID", //! Table with original global indices for candidates - hf_cand::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id, - soa::Marker); - -DECLARE_SOA_TABLE(HfD0Mcs, "AOD", "HFD0MC", //! Table with MC candidate info - hf_cand_mc::FlagMcMatchRec, - hf_cand_mc::OriginMcRec, - soa::Marker); - -// 3-prong decays - -DECLARE_SOA_TABLE(Hf3PBases, "AOD", "HF3PBASE", //! Table with basic candidate properties used in the analyses - o2::soa::Index<>, - hf_cand_base::der_3p::Hf3PCollBaseId, - hf_cand_base::Pt, - hf_cand_base::Eta, - hf_cand_base::Phi, - hf_cand_base::M, - hf_cand_base::Y, - hf_cand_base::Px, - hf_cand_base::Py, - hf_cand_base::Pz, - hf_cand_base::P, - soa::Marker); +DECLARE_SOA_TABLE_STAGED(HfBplusPars, "HFBPPAR", //! Table with candidate properties used for selection + hf_cand::Chi2PCA, + hf_cand_par::Cpa, + hf_cand_par::CpaXY, + hf_cand_par::DecayLength, + hf_cand_par::DecayLengthXY, + hf_cand_par::DecayLengthNormalised, + hf_cand_par::DecayLengthXYNormalised, + hf_cand_par::PtProng0, + hf_cand_par::PtProng1, + hf_cand::ImpactParameter0, + hf_cand::ImpactParameter1, + hf_cand_par::ImpactParameterNormalised0, + hf_cand_par::ImpactParameterNormalised1, + hf_cand_par::NSigTpcPiExpPi, + hf_cand_par::NSigTofPiExpPi, + hf_cand_par::NSigTpcTofPiExpPi, + hf_cand_par::NSigTpcKaExpPi, + hf_cand_par::NSigTofKaExpPi, + hf_cand_par::NSigTpcTofKaExpPi, + hf_cand_par::MaxNormalisedDeltaIP, + hf_cand_par::ImpactParameterProduct, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfBplusParD0s, "HFBPPARD0", //! Table with D0 candidate properties used for selection of B+ + hf_cand_par_charm::CpaCharm, + hf_cand_par_charm::DecayLengthCharm, + hf_cand_par_charm::ImpactParameter0Charm, + hf_cand_par_charm::ImpactParameter1Charm, + hf_cand_par_charm::ImpactParameterProductCharm, + hf_cand_par_charm::NSigTpcPiExpPiCharm, + hf_cand_par_charm::NSigTofPiExpPiCharm, + hf_cand_par_charm::NSigTpcTofPiExpPiCharm, + hf_cand_par_charm::NSigTpcKaExpPiCharm, + hf_cand_par_charm::NSigTofKaExpPiCharm, + hf_cand_par_charm::NSigTpcTofKaExpPiCharm, + hf_cand_par_charm::NSigTpcPiExpKaCharm, + hf_cand_par_charm::NSigTofPiExpKaCharm, + hf_cand_par_charm::NSigTpcTofPiExpKaCharm, + hf_cand_par_charm::NSigTpcKaExpKaCharm, + hf_cand_par_charm::NSigTofKaExpKaCharm, + hf_cand_par_charm::NSigTpcTofKaExpKaCharm); + +DECLARE_SOA_TABLE_STAGED(HfBplusParEs, "HFBPPARE", //! Table with additional candidate properties used for selection + hf_cand::XSecondaryVertex, + hf_cand::YSecondaryVertex, + hf_cand::ZSecondaryVertex, + hf_cand::ErrorDecayLength, + hf_cand::ErrorDecayLengthXY, + hf_cand_par::RSecondaryVertex, + hf_cand_par::PProng1, + hf_cand::PxProng1, + hf_cand::PyProng1, + hf_cand::PzProng1, + hf_cand::ErrorImpactParameter1, + hf_cand_par::CosThetaStar, + hf_cand_par::Ct, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfBplusMls, "HFBPML", //! Table with candidate selection ML scores + hf_cand_mc::MlScoreSig, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfBplusMlD0s, "HFBPMLD0", //! Table with D0 candidate selection ML scores + hf_cand_mc_charm::MlScoresCharm, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfBplusMcs, "HFBPMC", //! Table with MC candidate info + hf_cand_mc::FlagMcMatchRec, + hf_cand_mc::OriginMcRec, + o2::soa::Marker); // candidates for removal: // PxProng0, PyProng0, PzProng0,... (same for 1, 2), we can keep Pt, Eta, Phi instead // XY: CpaXY, DecayLengthXY, ErrorDecayLengthXY // normalised: DecayLengthNormalised, DecayLengthXYNormalised, ImpactParameterNormalised0 -DECLARE_SOA_TABLE(Hf3PPars, "AOD", "HF3PPAR", //! Table with candidate properties used for selection - hf_cand::Chi2PCA, - hf_cand::NProngsContributorsPV, - hf_cand_par::Cpa, - hf_cand_par::CpaXY, - hf_cand_par::DecayLength, - hf_cand_par::DecayLengthXY, - hf_cand_par::DecayLengthNormalised, - hf_cand_par::DecayLengthXYNormalised, - hf_cand_par::PtProng0, - hf_cand_par::PtProng1, - hf_cand_par::PtProng2, - hf_cand::ImpactParameter0, - hf_cand::ImpactParameter1, - hf_cand::ImpactParameter2, - hf_cand_par::ImpactParameterNormalised0, - hf_cand_par::ImpactParameterNormalised1, - hf_cand_par::ImpactParameterNormalised2, - hf_cand_par::NSigTpcPi0, - hf_cand_par::NSigTpcPr0, - hf_cand_par::NSigTofPi0, - hf_cand_par::NSigTofPr0, - hf_cand_par::NSigTpcTofPi0, - hf_cand_par::NSigTpcTofPr0, - hf_cand_par::NSigTpcKa1, - hf_cand_par::NSigTofKa1, - hf_cand_par::NSigTpcTofKa1, - hf_cand_par::NSigTpcPi2, - hf_cand_par::NSigTpcPr2, - hf_cand_par::NSigTofPi2, - hf_cand_par::NSigTofPr2, - hf_cand_par::NSigTpcTofPi2, - hf_cand_par::NSigTpcTofPr2, - soa::Marker); - -DECLARE_SOA_TABLE(Hf3PParEs, "AOD", "HF3PPARE", //! Table with additional candidate properties used for selection - hf_cand::XSecondaryVertex, - hf_cand::YSecondaryVertex, - hf_cand::ZSecondaryVertex, - hf_cand::ErrorDecayLength, - hf_cand::ErrorDecayLengthXY, - hf_cand_par::RSecondaryVertex, - hf_cand_par::PProng0, - hf_cand_par::PProng1, - hf_cand_par::PProng2, - hf_cand::PxProng0, - hf_cand::PyProng0, - hf_cand::PzProng0, - hf_cand::PxProng1, - hf_cand::PyProng1, - hf_cand::PzProng1, - hf_cand::PxProng2, - hf_cand::PyProng2, - hf_cand::PzProng2, - hf_cand::ErrorImpactParameter0, - hf_cand::ErrorImpactParameter1, - hf_cand::ErrorImpactParameter2, - hf_cand_par::Ct, - soa::Marker); - -DECLARE_SOA_TABLE(Hf3PSels, "AOD", "HF3PSEL", //! Table with candidate selection flags - hf_cand_sel::CandidateSelFlag, - soa::Marker); - -DECLARE_SOA_TABLE(Hf3PMls, "AOD", "HF3PML", //! Table with candidate selection ML scores - hf_cand_mc::MlScores, - soa::Marker); - -DECLARE_SOA_TABLE(Hf3PIds, "AOD", "HF3PID", //! Table with original global indices for candidates - hf_cand::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id, - hf_track_index::Prong2Id, - soa::Marker); - -DECLARE_SOA_TABLE(Hf3PMcs, "AOD", "HF3PMC", //! Table with MC candidate info - hf_cand_mc::FlagMcMatchRec, - hf_cand_mc::OriginMcRec, - hf_cand_mc::IsCandidateSwapped, - soa::Marker); - -// ================== -// MC particle tables -// ================== - -// MC particle columns -namespace hf_mc_particle -{ -DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); //! MC collision of this particle -DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle -namespace der_d0 -{ -DECLARE_SOA_INDEX_COLUMN(HfD0McCollBase, hfMcCollBase); //! collision index pointing to the derived MC collision table for D0 candidates -} -namespace der_3p -{ -DECLARE_SOA_INDEX_COLUMN(Hf3PMcCollBase, hfMcCollBase); //! collision index pointing to the derived MC collision table for 3-prong candidates -} -DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); //! flag for generator level matching -DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); //! particle origin, generator level -DECLARE_SOA_COLUMN(FlagMcDecayChanGen, flagMcDecayChanGen, int8_t); //! resonant decay channel flag, generator level -} // namespace hf_mc_particle +DECLARE_SOA_TABLE_STAGED(HfLcPars, "HFLCPAR", //! Table with candidate properties used for selection + hf_cand::Chi2PCA, + hf_cand::NProngsContributorsPV, + hf_cand_par::Cpa, + hf_cand_par::CpaXY, + hf_cand_par::DecayLength, + hf_cand_par::DecayLengthXY, + hf_cand_par::DecayLengthNormalised, + hf_cand_par::DecayLengthXYNormalised, + hf_cand_par::PtProng0, + hf_cand_par::PtProng1, + hf_cand_par::PtProng2, + hf_cand::ImpactParameter0, + hf_cand::ImpactParameter1, + hf_cand::ImpactParameter2, + hf_cand_par::ImpactParameterNormalised0, + hf_cand_par::ImpactParameterNormalised1, + hf_cand_par::ImpactParameterNormalised2, + hf_cand_par::NSigTpcPi0, + hf_cand_par::NSigTpcPr0, + hf_cand_par::NSigTofPi0, + hf_cand_par::NSigTofPr0, + hf_cand_par::NSigTpcTofPi0, + hf_cand_par::NSigTpcTofPr0, + hf_cand_par::NSigTpcKa1, + hf_cand_par::NSigTofKa1, + hf_cand_par::NSigTpcTofKa1, + hf_cand_par::NSigTpcPi2, + hf_cand_par::NSigTpcPr2, + hf_cand_par::NSigTofPi2, + hf_cand_par::NSigTofPr2, + hf_cand_par::NSigTpcTofPi2, + hf_cand_par::NSigTpcTofPr2, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfLcParEs, "HFLCPARE", //! Table with additional candidate properties used for selection + hf_cand::XSecondaryVertex, + hf_cand::YSecondaryVertex, + hf_cand::ZSecondaryVertex, + hf_cand::ErrorDecayLength, + hf_cand::ErrorDecayLengthXY, + hf_cand_par::RSecondaryVertex, + hf_cand_par::PProng0, + hf_cand_par::PProng1, + hf_cand_par::PProng2, + hf_cand::PxProng0, + hf_cand::PyProng0, + hf_cand::PzProng0, + hf_cand::PxProng1, + hf_cand::PyProng1, + hf_cand::PzProng1, + hf_cand::PxProng2, + hf_cand::PyProng2, + hf_cand::PzProng2, + hf_cand::ErrorImpactParameter0, + hf_cand::ErrorImpactParameter1, + hf_cand::ErrorImpactParameter2, + hf_cand_par::Ct, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfLcMls, "HFLCML", //! Table with candidate selection ML scores + hf_cand_mc::MlScores, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfLcMcs, "HFLCMC", //! Table with MC candidate info + hf_cand_mc::FlagMcMatchRec, + hf_cand_mc::OriginMcRec, + hf_cand_mc::IsCandidateSwapped, + o2::soa::Marker); -// D0 - -DECLARE_SOA_TABLE(HfD0PBases, "AOD", "HFD0PBASE", //! Table with MC particle info - o2::soa::Index<>, - hf_mc_particle::der_d0::HfD0McCollBaseId, - hf_cand_base::Pt, - hf_cand_base::Eta, - hf_cand_base::Phi, - hf_cand_base::Y, - hf_mc_particle::FlagMcMatchGen, - hf_mc_particle::OriginMcGen, - hf_cand_base::Px, - hf_cand_base::Py, - hf_cand_base::Pz, - hf_cand_base::P, - soa::Marker); - -DECLARE_SOA_TABLE(HfD0PIds, "AOD", "HFD0PID", //! Table with original global indices for MC particles - hf_mc_particle::McCollisionId, - hf_mc_particle::McParticleId, - soa::Marker); - -// 3-prong decays - -DECLARE_SOA_TABLE(Hf3PPBases, "AOD", "HF3PPBASE", //! Table with MC particle info - o2::soa::Index<>, - hf_mc_particle::der_3p::Hf3PMcCollBaseId, - hf_cand_base::Pt, - hf_cand_base::Eta, - hf_cand_base::Phi, - hf_cand_base::Y, - hf_mc_particle::FlagMcMatchGen, - hf_mc_particle::OriginMcGen, - hf_cand_base::Px, - hf_cand_base::Py, - hf_cand_base::Pz, - hf_cand_base::P, - soa::Marker); - -DECLARE_SOA_TABLE(Hf3PPIds, "AOD", "HF3PPID", //! Table with original global indices for MC particles - hf_mc_particle::McCollisionId, - hf_mc_particle::McParticleId, - soa::Marker); } // namespace o2::aod #endif // PWGHF_DATAMODEL_DERIVEDTABLES_H_ diff --git a/PWGHF/DataModel/DerivedTablesStored.h b/PWGHF/DataModel/DerivedTablesStored.h deleted file mode 100644 index 991ef61a9b8..00000000000 --- a/PWGHF/DataModel/DerivedTablesStored.h +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file DerivedTablesStored.h -/// \brief Definitions of stored versions of derived tables produced by derived-data creators (defined in DerivedTables.h) -/// \author Vít Kučera , Inha University -/// \note Things to check when comparing with DerivedTables.h: -/// - Prefix "Stored" in table definitions -/// - Prefix "Stored" in names of index columns pointing to derived tables -/// - Suffix "Stored" in Marker name -/// - Prefix "der_stored_" in namespace names (if needed to avoid redefinitions in "der_") -/// - Origin AOD1 - -#ifndef PWGHF_DATAMODEL_DERIVEDTABLESSTORED_H_ -#define PWGHF_DATAMODEL_DERIVEDTABLESSTORED_H_ - -#include "PWGHF/DataModel/DerivedTables.h" - -namespace o2::aod -{ -constexpr uint MarkerD0Stored = 10; -constexpr uint Marker3PStored = 20; - -// ================ -// Collision tables -// ================ - -// D0 - -DECLARE_SOA_TABLE(StoredHfD0CollBases, "AOD1", "HFD0COLLBASE", //! Table with basic collision info - o2::soa::Index<>, - collision::PosX, - collision::PosY, - collision::PosZ, - collision::NumContrib, - hf_coll_base::CentFT0A, - hf_coll_base::CentFT0C, - hf_coll_base::CentFT0M, - hf_coll_base::CentFV0A, - hf_coll_base::MultZeqNTracksPV, - // hf_coll_base::IsEventReject, - // bc::RunNumber, - soa::Marker); - -using StoredHfD0CollBase = StoredHfD0CollBases::iterator; - -DECLARE_SOA_TABLE(StoredHfD0CollIds, "AOD1", "HFD0COLLID", //! Table with original global indices of collisions - hf_cand::CollisionId, - soa::Marker); - -// 3-prong decays - -DECLARE_SOA_TABLE(StoredHf3PCollBases, "AOD1", "HF3PCOLLBASE", //! Table with basic collision info - o2::soa::Index<>, - collision::PosX, - collision::PosY, - collision::PosZ, - collision::NumContrib, - hf_coll_base::CentFT0A, - hf_coll_base::CentFT0C, - hf_coll_base::CentFT0M, - hf_coll_base::CentFV0A, - hf_coll_base::MultZeqNTracksPV, - // hf_coll_base::IsEventReject, - // bc::RunNumber, - soa::Marker); - -using StoredHf3PCollBase = StoredHf3PCollBases::iterator; - -DECLARE_SOA_TABLE(StoredHf3PCollIds, "AOD1", "HF3PCOLLID", //! Table with original global indices of collisions - hf_cand::CollisionId, - soa::Marker); - -// =================== -// MC collision tables -// =================== - -// DO - -DECLARE_SOA_TABLE(StoredHfD0McCollBases, "AOD1", "HFD0MCCOLLBASE", //! Table with basic MC collision info - o2::soa::Index<>, - mccollision::PosX, - mccollision::PosY, - mccollision::PosZ, - soa::Marker); - -using StoredHfD0McCollBase = StoredHfD0McCollBases::iterator; - -DECLARE_SOA_TABLE(StoredHfD0McCollIds, "AOD1", "HFD0MCCOLLID", //! Table with original global indices of MC collisions - hf_mc_coll::McCollisionId, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHfD0McRCollIds, "AOD1", "HFD0MCRCOLLID", //! Table with indices pointing to the derived reconstructed-collision table - hf_mc_coll::der_d0::HfD0CollBaseIds, - soa::Marker); - -// 3-prong decays - -DECLARE_SOA_TABLE(StoredHf3PMcCollBases, "AOD1", "HF3PMCCOLLBASE", //! Table with basic MC collision info - o2::soa::Index<>, - mccollision::PosX, - mccollision::PosY, - mccollision::PosZ, - soa::Marker); - -using StoredHf3PMcCollBase = StoredHf3PMcCollBases::iterator; - -DECLARE_SOA_TABLE(StoredHf3PMcCollIds, "AOD1", "HF3PMCCOLLID", //! Table with original global indices of MC collisions - hf_mc_coll::McCollisionId, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHf3PMcRCollIds, "AOD1", "HF3PMCRCOLLID", //! Table with indices pointing to the derived reconstructed-collision table - hf_mc_coll::der_3p::Hf3PCollBaseIds, - soa::Marker); - -// ================ -// Candidate tables -// ================ - -// Basic candidate properties - -// D0 - -DECLARE_SOA_TABLE(StoredHfD0Bases, "AOD1", "HFD0BASE", //! Table with basic candidate properties used in the analyses - o2::soa::Index<>, - hf_cand_base::der_d0::HfD0CollBaseId, - hf_cand_base::Pt, - hf_cand_base::Eta, - hf_cand_base::Phi, - hf_cand_base::M, - hf_cand_base::Y, - hf_cand_base::Px, - hf_cand_base::Py, - hf_cand_base::Pz, - hf_cand_base::P, - soa::Marker); - -// candidates for removal: -// PxProng0, PyProng0, PzProng0,... (same for 1, 2), we can keep Pt, Eta, Phi instead -// XY: CpaXY, DecayLengthXY, ErrorDecayLengthXY -// normalised: DecayLengthNormalised, DecayLengthXYNormalised, ImpactParameterNormalised0 -DECLARE_SOA_TABLE(StoredHfD0Pars, "AOD1", "HFD0PAR", //! Table with candidate properties used for selection - hf_cand::Chi2PCA, - hf_cand_par::Cpa, - hf_cand_par::CpaXY, - hf_cand_par::DecayLength, - hf_cand_par::DecayLengthXY, - hf_cand_par::DecayLengthNormalised, - hf_cand_par::DecayLengthXYNormalised, - hf_cand_par::PtProng0, - hf_cand_par::PtProng1, - hf_cand::ImpactParameter0, - hf_cand::ImpactParameter1, - hf_cand_par::ImpactParameterNormalised0, - hf_cand_par::ImpactParameterNormalised1, - hf_cand_par::NSigTpcPiExpPi, - hf_cand_par::NSigTofPiExpPi, - hf_cand_par::NSigTpcTofPiExpPi, - hf_cand_par::NSigTpcKaExpPi, - hf_cand_par::NSigTofKaExpPi, - hf_cand_par::NSigTpcTofKaExpPi, - hf_cand_par::NSigTpcPiExpKa, - hf_cand_par::NSigTofPiExpKa, - hf_cand_par::NSigTpcTofPiExpKa, - hf_cand_par::NSigTpcKaExpKa, - hf_cand_par::NSigTofKaExpKa, - hf_cand_par::NSigTpcTofKaExpKa, - hf_cand_par::MaxNormalisedDeltaIP, - hf_cand_par::ImpactParameterProduct, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHfD0ParEs, "AOD1", "HFD0PARE", //! Table with additional candidate properties used for selection - hf_cand::XSecondaryVertex, - hf_cand::YSecondaryVertex, - hf_cand::ZSecondaryVertex, - hf_cand::ErrorDecayLength, - hf_cand::ErrorDecayLengthXY, - hf_cand::KfTopolChi2OverNdf, - hf_cand_par::RSecondaryVertex, - hf_cand_par::PProng0, - hf_cand_par::PProng1, - hf_cand::PxProng0, - hf_cand::PyProng0, - hf_cand::PzProng0, - hf_cand::PxProng1, - hf_cand::PyProng1, - hf_cand::PzProng1, - hf_cand::ErrorImpactParameter0, - hf_cand::ErrorImpactParameter1, - hf_cand_par::CosThetaStar, - hf_cand_par::Ct, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHfD0Sels, "AOD1", "HFD0SEL", //! Table with candidate selection flags - hf_cand_sel::CandidateSelFlag, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHfD0Mls, "AOD1", "HFD0ML", //! Table with candidate selection ML scores - hf_cand_mc::MlScores, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHfD0Ids, "AOD1", "HFD0ID", //! Table with original global indices for candidates - hf_cand::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHfD0Mcs, "AOD1", "HFD0MC", //! Table with MC candidate info - hf_cand_mc::FlagMcMatchRec, - hf_cand_mc::OriginMcRec, - soa::Marker); - -// 3-prong decays - -DECLARE_SOA_TABLE(StoredHf3PBases, "AOD1", "HF3PBASE", //! Table with basic candidate properties used in the analyses - o2::soa::Index<>, - hf_cand_base::der_3p::Hf3PCollBaseId, - hf_cand_base::Pt, - hf_cand_base::Eta, - hf_cand_base::Phi, - hf_cand_base::M, - hf_cand_base::Y, - hf_cand_base::Px, - hf_cand_base::Py, - hf_cand_base::Pz, - hf_cand_base::P, - soa::Marker); - -// candidates for removal: -// PxProng0, PyProng0, PzProng0,... (same for 1, 2), we can keep Pt, Eta, Phi instead -// XY: CpaXY, DecayLengthXY, ErrorDecayLengthXY -// normalised: DecayLengthNormalised, DecayLengthXYNormalised, ImpactParameterNormalised0 -DECLARE_SOA_TABLE(StoredHf3PPars, "AOD1", "HF3PPAR", //! Table with candidate properties used for selection - hf_cand::Chi2PCA, - hf_cand::NProngsContributorsPV, - hf_cand_par::Cpa, - hf_cand_par::CpaXY, - hf_cand_par::DecayLength, - hf_cand_par::DecayLengthXY, - hf_cand_par::DecayLengthNormalised, - hf_cand_par::DecayLengthXYNormalised, - hf_cand_par::PtProng0, - hf_cand_par::PtProng1, - hf_cand_par::PtProng2, - hf_cand::ImpactParameter0, - hf_cand::ImpactParameter1, - hf_cand::ImpactParameter2, - hf_cand_par::ImpactParameterNormalised0, - hf_cand_par::ImpactParameterNormalised1, - hf_cand_par::ImpactParameterNormalised2, - hf_cand_par::NSigTpcPi0, - hf_cand_par::NSigTpcPr0, - hf_cand_par::NSigTofPi0, - hf_cand_par::NSigTofPr0, - hf_cand_par::NSigTpcTofPi0, - hf_cand_par::NSigTpcTofPr0, - hf_cand_par::NSigTpcKa1, - hf_cand_par::NSigTofKa1, - hf_cand_par::NSigTpcTofKa1, - hf_cand_par::NSigTpcPi2, - hf_cand_par::NSigTpcPr2, - hf_cand_par::NSigTofPi2, - hf_cand_par::NSigTofPr2, - hf_cand_par::NSigTpcTofPi2, - hf_cand_par::NSigTpcTofPr2, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHf3PParEs, "AOD1", "HF3PPARE", //! Table with additional candidate properties used for selection - hf_cand::XSecondaryVertex, - hf_cand::YSecondaryVertex, - hf_cand::ZSecondaryVertex, - hf_cand::ErrorDecayLength, - hf_cand::ErrorDecayLengthXY, - hf_cand_par::RSecondaryVertex, - hf_cand_par::PProng0, - hf_cand_par::PProng1, - hf_cand_par::PProng2, - hf_cand::PxProng0, - hf_cand::PyProng0, - hf_cand::PzProng0, - hf_cand::PxProng1, - hf_cand::PyProng1, - hf_cand::PzProng1, - hf_cand::PxProng2, - hf_cand::PyProng2, - hf_cand::PzProng2, - hf_cand::ErrorImpactParameter0, - hf_cand::ErrorImpactParameter1, - hf_cand::ErrorImpactParameter2, - hf_cand_par::Ct, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHf3PSels, "AOD1", "HF3PSEL", //! Table with candidate selection flags - hf_cand_sel::CandidateSelFlag, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHf3PMls, "AOD1", "HF3PML", //! Table with candidate selection ML scores - hf_cand_mc::MlScores, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHf3PIds, "AOD1", "HF3PID", //! Table with original global indices for candidates - hf_cand::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id, - hf_track_index::Prong2Id, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHf3PMcs, "AOD1", "HF3PMC", //! Table with MC candidate info - hf_cand_mc::FlagMcMatchRec, - hf_cand_mc::OriginMcRec, - hf_cand_mc::IsCandidateSwapped, - soa::Marker); - -// ================== -// MC particle tables -// ================== - -// D0 - -DECLARE_SOA_TABLE(StoredHfD0PBases, "AOD1", "HFD0PBASE", //! Table with MC particle info - o2::soa::Index<>, - hf_mc_particle::der_d0::HfD0McCollBaseId, - hf_cand_base::Pt, - hf_cand_base::Eta, - hf_cand_base::Phi, - hf_cand_base::Y, - hf_mc_particle::FlagMcMatchGen, - hf_mc_particle::OriginMcGen, - hf_cand_base::Px, - hf_cand_base::Py, - hf_cand_base::Pz, - hf_cand_base::P, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHfD0PIds, "AOD1", "HFD0PID", //! Table with original global indices for MC particles - hf_mc_particle::McCollisionId, - hf_mc_particle::McParticleId, - soa::Marker); - -// 3-prong decays - -DECLARE_SOA_TABLE(StoredHf3PPBases, "AOD1", "HF3PPBASE", //! Table with MC particle info - o2::soa::Index<>, - hf_mc_particle::der_3p::Hf3PMcCollBaseId, - hf_cand_base::Pt, - hf_cand_base::Eta, - hf_cand_base::Phi, - hf_cand_base::Y, - hf_mc_particle::FlagMcMatchGen, - hf_mc_particle::OriginMcGen, - hf_cand_base::Px, - hf_cand_base::Py, - hf_cand_base::Pz, - hf_cand_base::P, - soa::Marker); - -DECLARE_SOA_TABLE(StoredHf3PPIds, "AOD1", "HF3PPID", //! Table with original global indices for MC particles - hf_mc_particle::McCollisionId, - hf_mc_particle::McParticleId, - soa::Marker); -} // namespace o2::aod - -#endif // PWGHF_DATAMODEL_DERIVEDTABLESSTORED_H_ diff --git a/PWGHF/HFC/DataModel/CorrelationTables.h b/PWGHF/HFC/DataModel/CorrelationTables.h index e486e7bb33b..178e3b30a0c 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -57,6 +57,12 @@ DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse mom DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar +DECLARE_SOA_COLUMN(MlScoreBkgD0, mlScoreBkgD0, float); //! ML background score for D0 selection +DECLARE_SOA_COLUMN(MlScoreNonPromptD0, mlScoreNonPromptD0, float); //! ML prompt score for D0 selection +DECLARE_SOA_COLUMN(MlScorePromptD0, mlScorePromptD0, float); //! ML prompt score for D0 selection +DECLARE_SOA_COLUMN(MlScoreBkgD0bar, mlScoreBkgD0bar, float); //! ML background score for D0 selection +DECLARE_SOA_COLUMN(MlScoreNonPromptD0bar, mlScoreNonPromptD0bar, float); //! ML prompt score for D0 selection +DECLARE_SOA_COLUMN(MlScorePromptD0bar, mlScorePromptD0bar, float); //! ML prompt score for D0 selection DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent DECLARE_SOA_COLUMN(IsAutoCorrelated, isAutoCorrelated, bool); //! Correlation Status @@ -81,7 +87,7 @@ enum ParticleTypeMcRec { }; } // namespace hf_correlation_d0_hadron -DECLARE_SOA_TABLE(DHadronPair, "AOD", "DHADRONPAIR", //! D0-Hadrons pairs Informations +DECLARE_SOA_TABLE(D0HadronPair, "AOD", "D0HPAIR", //! D0-Hadrons pairs Informations aod::hf_correlation_d0_hadron::DeltaPhi, aod::hf_correlation_d0_hadron::DeltaEta, aod::hf_correlation_d0_hadron::PtD, @@ -89,21 +95,54 @@ DECLARE_SOA_TABLE(DHadronPair, "AOD", "DHADRONPAIR", //! D0-Hadrons pairs Inform aod::hf_correlation_d0_hadron::PoolBin, aod::hf_correlation_d0_hadron::IsAutoCorrelated); -DECLARE_SOA_TABLE(DHadronRecoInfo, "AOD", "DHADRONRECOINFO", //! D0-Hadrons pairs Reconstructed Informations +DECLARE_SOA_TABLE(D0HadronRecoInfo, "AOD", "D0HRECOINFO", //! D0-Hadrons pairs Reconstructed Informations aod::hf_correlation_d0_hadron::MD, aod::hf_correlation_d0_hadron::MDbar, aod::hf_correlation_d0_hadron::SignalStatus); +DECLARE_SOA_TABLE(D0HadronMlInfo, "AOD", "D0HMLINFO", //! D0-Hadrons pairs Machine Learning Information + aod::hf_correlation_d0_hadron::MlScoreBkgD0, + aod::hf_correlation_d0_hadron::MlScoreNonPromptD0, + aod::hf_correlation_d0_hadron::MlScorePromptD0, + aod::hf_correlation_d0_hadron::MlScoreBkgD0bar, + aod::hf_correlation_d0_hadron::MlScoreNonPromptD0bar, + aod::hf_correlation_d0_hadron::MlScorePromptD0bar); + +DECLARE_SOA_TABLE(D0CandRecoInfo, "AOD", "D0CANDRECOINFO", //! Ds candidates Reconstructed Information + aod::hf_correlation_d0_hadron::MD, + aod::hf_correlation_d0_hadron::MDbar, + aod::hf_correlation_d0_hadron::PtD, + aod::hf_correlation_d0_hadron::MlScoreBkgD0, + aod::hf_correlation_d0_hadron::MlScorePromptD0, + aod::hf_correlation_d0_hadron::MlScoreBkgD0bar, + aod::hf_correlation_d0_hadron::MlScorePromptD0bar); + // Note: definition of columns and tables for Lc-Hadron correlation pairs namespace hf_correlation_lc_hadron { -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Lc and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Lc and Hadrons -DECLARE_SOA_COLUMN(PtLc, ptLc, float); //! Transverse momentum of Lc -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MLc, mLc, float); //! Invariant mass of Lc -DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for LcToPKPi/LcToPiKP -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Lc and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Lc and Hadrons +DECLARE_SOA_COLUMN(PtLc, ptLc, float); //! Transverse momentum of Lc +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MLc, mLc, float); //! Invariant mass of Lc +DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML background score for Lc selection +DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML prompt score for Lc selection +DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for LcToPKPi/LcToPiKP +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(TrackDcaXY, trackDcaXY, float); //! DCA xy of the track +DECLARE_SOA_COLUMN(TrackDcaZ, trackDcaZ, float); //! DCA z of the track +DECLARE_SOA_COLUMN(TrackTPCNClsCrossedRows, trackTPCNClsCrossedRows, int); //! Number of crossed TPC Rows +DECLARE_SOA_COLUMN(TrackOrigin, trackOrigin, int); //! Number of crossed TPC Rows +DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! Used in MC-Rec, Lc Signal +DECLARE_SOA_COLUMN(IsPrompt, isPrompt, bool); //! Used in MC-Rec, Lc Prompt or Non-Prompt +DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! Used in MC-Rec, primary associated particles +DECLARE_SOA_COLUMN(IsAutoCorrelated, isAutoCorrelated, bool); //! Correlation Status +DECLARE_SOA_COLUMN(PrNsigmTPC, prNsigmTPC, float); //! Associated Particle TPC nSigma proton +DECLARE_SOA_COLUMN(KaNsigmTPC, kaNsigmTPC, float); //! Associated Particle TPC nSigma Kaon +DECLARE_SOA_COLUMN(PiNsigmTPC, piNsigmTPC, float); //! Associated Particle TPC nSigma Pion +DECLARE_SOA_COLUMN(PrNsigmTOF, prNsigmTOF, float); //! Associated Particle TOF nSigma Proton +DECLARE_SOA_COLUMN(KaNsigmTOF, kaNsigmTOF, float); //! Associated Particle TOF nSigma Kaon +DECLARE_SOA_COLUMN(PiNsigmTOF, piNsigmTOF, float); //! Associated Particle TOF nSigma Pion } // namespace hf_correlation_lc_hadron DECLARE_SOA_TABLE(LcHadronPair, "AOD", "LCHPAIR", //! Lc-Hadrons pairs Informations @@ -111,11 +150,42 @@ DECLARE_SOA_TABLE(LcHadronPair, "AOD", "LCHPAIR", //! Lc-Hadrons pairs Informati aod::hf_correlation_lc_hadron::DeltaEta, aod::hf_correlation_lc_hadron::PtLc, aod::hf_correlation_lc_hadron::PtHadron, - aod::hf_correlation_lc_hadron::PoolBin); + aod::hf_correlation_lc_hadron::PoolBin, + aod::hf_correlation_lc_hadron::IsAutoCorrelated); DECLARE_SOA_TABLE(LcHadronRecoInfo, "AOD", "LCHRECOINFO", //! Lc-Hadrons pairs Reconstructed Informations aod::hf_correlation_lc_hadron::MLc, aod::hf_correlation_lc_hadron::SignalStatus); +DECLARE_SOA_TABLE(LcHadronPairTrkPID, "AOD", "LCHPAIRPID", //! Lc-proton details + aod::hf_correlation_lc_hadron::PrNsigmTPC, + aod::hf_correlation_lc_hadron::KaNsigmTPC, + aod::hf_correlation_lc_hadron::PiNsigmTPC, + aod::hf_correlation_lc_hadron::PrNsigmTOF, + aod::hf_correlation_lc_hadron::KaNsigmTOF, + aod::hf_correlation_lc_hadron::PiNsigmTOF); + +DECLARE_SOA_TABLE(LcHadronGenInfo, "AOD", "LCHGENINFO", //! Lc-Hadrons pairs Generated Information + aod::hf_correlation_lc_hadron::IsPrompt, + aod::hf_correlation_lc_hadron::IsPhysicalPrimary, + aod::hf_correlation_lc_hadron::TrackOrigin); + +DECLARE_SOA_TABLE(LcHadronMlInfo, "AOD", "LCHMLINFO", //! Lc-Hadrons pairs Machine Learning Information + aod::hf_correlation_lc_hadron::MlScoreBkg, + aod::hf_correlation_lc_hadron::MlScorePrompt); + +DECLARE_SOA_TABLE(LcRecoInfo, "AOD", "LCRECOINFO", //! Lc candidates Reconstructed Information + aod::hf_correlation_lc_hadron::MLc, + aod::hf_correlation_lc_hadron::PtLc, + aod::hf_correlation_lc_hadron::MlScoreBkg, + aod::hf_correlation_lc_hadron::MlScorePrompt); + +DECLARE_SOA_TABLE(LcGenInfo, "AOD", "LCGENOINFO", //! Lc candidates Generated Information + aod::hf_correlation_lc_hadron::IsPrompt); + +DECLARE_SOA_TABLE(TrkRecInfoLc, "AOD", "TRKRECINFOLC", //! Tracks Reconstructed Information + aod::hf_correlation_lc_hadron::TrackDcaXY, + aod::hf_correlation_lc_hadron::TrackDcaZ, + aod::hf_correlation_lc_hadron::TrackTPCNClsCrossedRows); // definition of columns and tables for Ds-Hadron correlation pairs namespace hf_correlation_ds_hadron @@ -333,7 +403,7 @@ DECLARE_SOA_TABLE(Dstar, "AOD", "DSTAR", // Only Dstar properties // Note: Table for selection of Lc in a collision namespace hf_selection_lc_collision { -DECLARE_SOA_COLUMN(LcSel, lcSel, int); //! Selection flag for Lc in a collision +DECLARE_SOA_COLUMN(LcSel, lcSel, bool); //! Selection flag for Lc in a collision } // namespace hf_selection_lc_collision DECLARE_SOA_TABLE(LcSelection, "AOD", "LCINCOLL", // Selection of Lc in collisions diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h new file mode 100644 index 00000000000..8bd3815df00 --- /dev/null +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -0,0 +1,71 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file DerivedDataCorrelations.h +/// \brief Tables for producing derived data for correlation analysis +/// \author Samuele Cattaruzzi + +#ifndef PWGHF_HFC_DATAMODEL_DERIVEDDATACORRELATIONTABLES_H_ +#define PWGHF_HFC_DATAMODEL_DERIVEDDATACORRELATIONTABLES_H_ + +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace hf_collisions_reduced +{ +DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); //! Event multiplicity +DECLARE_SOA_COLUMN(PosZ, posZ, float); //! Primary vertex z position + +} // namespace hf_collisions_reduced + +DECLARE_SOA_TABLE(HfcRedCollisions, "AOD", "HFCREDCOLLISION", //! Table with collision info + soa::Index<>, + aod::hf_collisions_reduced::Multiplicity, + aod::hf_collisions_reduced::PosZ); + +using HfcRedCollision = HfcRedCollisions::iterator; + +// DECLARE_SOA_TABLE(HfCandColCounts, "AOD", "HFCANDCOLCOUNT", //! Table with number of collisions which contain at least one candidate +// aod::hf_collisions_reduced::OriginalCollisionCount); + +namespace hf_candidate_reduced +{ +DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index +DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate +DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate +DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate +DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate +} // namespace hf_candidate_reduced +DECLARE_SOA_TABLE(DsCandReduceds, "AOD", "DSCANDREDUCED", //! Table with Ds candidate info (rectangular selection) + soa::Index<>, + aod::hf_candidate_reduced::HfcRedCollisionId, + aod::hf_candidate_reduced::PhiCand, + aod::hf_candidate_reduced::EtaCand, + aod::hf_candidate_reduced::PtCand, + aod::hf_candidate_reduced::InvMassDs); + +namespace hf_assoc_track_reduced +{ +DECLARE_SOA_COLUMN(TrackId, trackId, int); //! Original track index +DECLARE_SOA_COLUMN(EtaAssocTrack, etaAssocTrack, float); //! Eta of the track +DECLARE_SOA_COLUMN(PhiAssocTrack, phiAssocTrack, float); //! Phi of the track +DECLARE_SOA_COLUMN(PtAssocTrack, ptAssocTrack, float); //! Pt of the track +} // namespace hf_assoc_track_reduced +DECLARE_SOA_TABLE(AssocTrackReds, "AOD", "ASSOCTRACKRED", //! Table with associated track info + soa::Index<>, + aod::hf_candidate_reduced::HfcRedCollisionId, + aod::hf_assoc_track_reduced::PhiAssocTrack, + aod::hf_assoc_track_reduced::EtaAssocTrack, + aod::hf_assoc_track_reduced::PtAssocTrack) +} // namespace o2::aod + +#endif // PWGHF_HFC_DATAMODEL_DERIVEDDATACORRELATIONTABLES_H_ diff --git a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx index d203c6ee63f..7e5157bb752 100644 --- a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx @@ -14,6 +14,12 @@ /// \author Samuele Cattaruzzi /// \author Swapnesh Santosh Khade +#include "DhCorrelationFitter.h" + +#include +#include +#include + #include #include #include @@ -34,10 +40,10 @@ #include #include #include -#include #include #include -#include "DhCorrelationFitter.h" + +using namespace std; DhCorrelationFitter::DhCorrelationFitter() : // default constructor fIsReflected(kFALSE), diff --git a/PWGHF/HFC/TableProducer/CMakeLists.txt b/PWGHF/HFC/TableProducer/CMakeLists.txt index 2b01aad32c6..e3fc1bd5938 100644 --- a/PWGHF/HFC/TableProducer/CMakeLists.txt +++ b/PWGHF/HFC/TableProducer/CMakeLists.txt @@ -61,5 +61,5 @@ o2physics_add_dpl_workflow(correlator-lc-hadrons o2physics_add_dpl_workflow(femto-dream-producer SOURCES femtoDreamProducer.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 89465eb50b2..3500b09dc92 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -15,6 +15,8 @@ /// \author Samrangy Sadhu , INFN Bari /// \author Swapnesh Santosh Khade , IIT Indore +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -30,12 +32,14 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" +#include "PWGHF/HFC/Utils/utilsCorrelations.h" using namespace o2; using namespace o2::analysis; using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::analysis::hf_correlations; /// /// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies @@ -68,6 +72,7 @@ using BinningType = ColumnBinningPolicy>; using SelectedTracks = soa::Filtered>; using SelectedCandidatesData = soa::Filtered>; +using SelectedCandidatesDataMl = soa::Filtered>; using SelectedTracksMcRec = soa::Filtered>; using SelectedCandidatesMcRec = soa::Filtered>; using SelectedCollisionsMcGen = soa::Filtered>; @@ -75,8 +80,6 @@ using SelectedParticlesMcGen = soa::Join d0Sel; Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; @@ -85,8 +88,9 @@ struct HfCorrelatorD0HadronsSelection { Configurable ptCandMin{"ptCandMin", -1., "min. cand. pT"}; HfHelper hfHelper; - + SliceCache cache; Preslice perCol = aod::hf_cand::collisionId; + Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; Partition> selectedD0candidatesMc = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; @@ -157,10 +161,10 @@ struct HfCorrelatorD0HadronsSelection { /// D0-Hadron correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) struct HfCorrelatorD0Hadrons { - SliceCache cache; - - Produces entryD0HadronPair; - Produces entryD0HadronRecoInfo; + Produces entryD0HadronPair; + Produces entryD0HadronRecoInfo; + Produces entryD0HadronMlInfo; + Produces entryD0CandRecoInfo; Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; @@ -171,21 +175,16 @@ struct HfCorrelatorD0Hadrons { Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; Configurable ptTrackMin{"ptTrackMin", 0.3, "min. track pT"}; Configurable ptTrackMax{"ptTrackMax", 99., "max. track pT"}; - Configurable> bins{"ptBinsForMassAndEfficiency", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; + Configurable> bins{"bins", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; Configurable> efficiencyDmeson{"efficiencyDmeson", std::vector{vecEfficiencyDmeson}, "Efficiency values for D0 meson"}; - Configurable applyEfficiency{"efficiencyFlagD", 1, "Flag for applying D-meson efficiency weights"}; + Configurable applyEfficiency{"applyEfficiency", 1, "Flag for applying D-meson efficiency weights"}; Configurable multMin{"multMin", 0., "minimum multiplicity accepted"}; Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; - Configurable ptSoftPionMax{"ptSoftPionMax", 3 * 800. * pow(10., -6.), "max. pT cut for soft pion identification"}; + Configurable ptSoftPionMax{"ptSoftPionMax", 3.f * 800.f * std::pow(10.f, -6.f), "max. pT cut for soft pion identification"}; + Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; Configurable correlateD0WithLeadingParticle{"correlateD0WithLeadingParticle", false, "Switch for correlation of D0 mesons with leading particle only"}; Configurable storeAutoCorrelationFlag{"storeAutoCorrelationFlag", false, "Store flag that indicates if the track is paired to its D-meson mother instead of skipping it"}; Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; - ConfigurableAxis zPoolBins{"zPoolBins", {VARIABLE_WIDTH, -10.0f, -2.5f, 2.5f, 10.0f}, "z vertex position pools"}; - ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0.0f, 2000.0f, 6000.0f, 10000.0f}, "event multiplicity pools (FT0M)"}; - ConfigurableAxis multPoolBinsMcGen{"multPoolBinsMcGen", {VARIABLE_WIDTH, 0.0f, 20.0f, 50.0f, 500.0f}, "Mixing bins - MC multiplicity"}; // In MCGen multiplicity is defined by counting tracks - - HfHelper hfHelper; - BinningType corrBinning{{zPoolBins, multPoolBins}, true}; int leadingIndex = 0; double massD0{0.}; @@ -193,10 +192,8 @@ struct HfCorrelatorD0Hadrons { double massK{0.}; double softPiMass = 0.14543; // pion mass + Q-value of the D*->D0pi decay - Preslice perCol = aod::hf_cand::collisionId; - - Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - Partition> selectedD0candidatesMc = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + HfHelper hfHelper; + SliceCache cache; Filter collisionFilter = aod::hf_selection_dmeson_collision::dmesonSel == true; Filter trackFilter = requireGlobalTrackWoDCAInFilter() && (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax); @@ -204,6 +201,14 @@ struct HfCorrelatorD0Hadrons { Filter collisionFilterGen = aod::hf_selection_dmeson_collision::dmesonSel == true; Filter particlesFilter = nabs(aod::mcparticle::pdgCode) == static_cast(Pdg::kD0) || ((aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary); + Preslice perCol = aod::hf_cand::collisionId; + + ConfigurableAxis zPoolBins{"zPoolBins", {VARIABLE_WIDTH, -10.0f, -2.5f, 2.5f, 10.0f}, "z vertex position pools"}; + ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0.0f, 2000.0f, 6000.0f, 10000.0f}, "event multiplicity pools (FT0M)"}; + ConfigurableAxis multPoolBinsMcGen{"multPoolBinsMcGen", {VARIABLE_WIDTH, 0.0f, 20.0f, 50.0f, 500.0f}, "Mixing bins - MC multiplicity"}; // In MCGen multiplicity is defined by counting tracks + + BinningType corrBinning{{zPoolBins, multPoolBins}, true}; + HistogramRegistry registry{ "registry", // NOTE: use hMassD0 for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes @@ -264,58 +269,16 @@ struct HfCorrelatorD0Hadrons { registry.add("hCountD0TriggersGen", "D0 trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); } - // Find Leading Particle - template - int findLeadingParticle(TTracks const& tracks) - { - auto leadingParticle = tracks.begin(); - for (auto const& track : tracks) { - if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) { - continue; - } - if (track.pt() > leadingParticle.pt()) { - leadingParticle = track; - } - } - int leadingIndex = leadingParticle.globalIndex(); - return leadingIndex; - } - // ======= Find Leading Particle for McGen ============ - template - int findLeadingParticleMcGen(TMcParticles const& mcParticles) - { - auto leadingParticle = mcParticles.begin(); - for (auto const& mcParticle : mcParticles) { - if (std::abs(mcParticle.eta()) > etaTrackMax) { - continue; - } - if (mcParticle.pt() < ptTrackMin) { - continue; - } - if ((std::abs(mcParticle.pdgCode()) != kElectron) && (std::abs(mcParticle.pdgCode()) != kMuonMinus) && (std::abs(mcParticle.pdgCode()) != kPiPlus) && (std::abs(mcParticle.pdgCode()) != kKPlus) && (std::abs(mcParticle.pdgCode()) != kProton)) { - continue; - } - if (mcParticle.pt() > leadingParticle.pt()) { - leadingParticle = mcParticle; - } - } - int leadingIndex = leadingParticle.globalIndex(); - return leadingIndex; - } // ======= Process starts for Data, Same event ============ /// D0-h correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) void processData(SelectedCollisions::iterator const& collision, SelectedTracks const& tracks, - soa::Join const&) + SelectedCandidatesDataMl const& candidates) { - // protection against empty tables to be sliced - if (selectedD0Candidates.size() == 0) { - return; - } // find leading particle if (correlateD0WithLeadingParticle) { - leadingIndex = findLeadingParticle(tracks); + leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value, etaTrackMax.value); } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); @@ -338,46 +301,54 @@ struct HfCorrelatorD0Hadrons { return; } registry.fill(HIST("hMultiplicity"), nTracks); + std::vector outputMlD0 = {-1., -1., -1.}; + std::vector outputMlD0bar = {-1., -1., -1.}; - auto selectedD0CandidatesGrouped = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - - for (const auto& candidate1 : selectedD0CandidatesGrouped) { - if (std::abs(hfHelper.yD0(candidate1)) >= yCandMax || candidate1.pt() <= ptCandMin || candidate1.pt() >= ptTrackMax) { + for (const auto& candidate : candidates) { + if (std::abs(hfHelper.yD0(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptTrackMax) { continue; } - // check decay channel flag for candidate1 - if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { + // check decay channel flag for candidate + if (!TESTBIT(candidate.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } // ========================== Define parameters for soft pion removal ================================ - auto ePiK = RecoDecay::e(candidate1.pVectorProng0(), massPi) + RecoDecay::e(candidate1.pVectorProng1(), massK); - auto eKPi = RecoDecay::e(candidate1.pVectorProng0(), massK) + RecoDecay::e(candidate1.pVectorProng1(), massPi); + auto ePiK = RecoDecay::e(candidate.pVectorProng0(), massPi) + RecoDecay::e(candidate.pVectorProng1(), massK); + auto eKPi = RecoDecay::e(candidate.pVectorProng0(), massK) + RecoDecay::e(candidate.pVectorProng1(), massPi); // ========================== trigger efficiency ================================ double efficiencyWeight = 1.; if (applyEfficiency) { - efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(bins, candidate1.pt())); + efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(bins, candidate.pt())); } // ========================== Fill mass histo ================================ - if (candidate1.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMass1D"), hfHelper.invMassD0ToPiK(candidate1), efficiencyWeight); - registry.fill(HIST("hMassD01D"), hfHelper.invMassD0ToPiK(candidate1), efficiencyWeight); + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMass1D"), hfHelper.invMassD0ToPiK(candidate), efficiencyWeight); + registry.fill(HIST("hMassD01D"), hfHelper.invMassD0ToPiK(candidate), efficiencyWeight); + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMlD0[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; + } } - if (candidate1.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMass1D"), hfHelper.invMassD0barToKPi(candidate1), efficiencyWeight); - registry.fill(HIST("hMassD0bar1D"), hfHelper.invMassD0barToKPi(candidate1), efficiencyWeight); + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMass1D"), hfHelper.invMassD0barToKPi(candidate), efficiencyWeight); + registry.fill(HIST("hMassD0bar1D"), hfHelper.invMassD0barToKPi(candidate), efficiencyWeight); + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMlD0bar[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; + } } + entryD0CandRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), outputMlD0[0], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[2]); + // ========================== Fill general histos ================================ - registry.fill(HIST("hPtCand"), candidate1.pt()); - registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); - registry.fill(HIST("hPtProng1"), candidate1.ptProng1()); - registry.fill(HIST("hEta"), candidate1.eta()); - registry.fill(HIST("hPhi"), candidate1.phi()); - registry.fill(HIST("hY"), hfHelper.yD0(candidate1)); - registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); + registry.fill(HIST("hPtCand"), candidate.pt()); + registry.fill(HIST("hPtProng0"), candidate.ptProng0()); + registry.fill(HIST("hPtProng1"), candidate.ptProng1()); + registry.fill(HIST("hEta"), candidate.eta()); + registry.fill(HIST("hPhi"), candidate.phi()); + registry.fill(HIST("hY"), hfHelper.yD0(candidate)); + registry.fill(HIST("hSelectionStatus"), candidate.isSelD0bar() + (candidate.isSelD0() * 2)); registry.fill(HIST("hD0Bin"), poolBin); // ============ D-h correlation dedicated section ================================== @@ -387,7 +358,7 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hTrackCounter"), 1); // fill total no. of tracks // Remove D0 daughters by checking track indices bool correlationStatus = false; - if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { + if ((candidate.prong0Id() == track.globalIndex()) || (candidate.prong1Id() == track.globalIndex())) { if (!storeAutoCorrelationFlag) { continue; } @@ -399,20 +370,20 @@ struct HfCorrelatorD0Hadrons { // ========== soft pion removal =================================================== double invMassDstar1 = 0., invMassDstar2 = 0.; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); + auto pSum2 = RecoDecay::p2(candidate.pVector(), track.pVector()); auto ePion = track.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); - if (candidate1.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate1)) - softPiMass) < ptSoftPionMax) { + if (candidate.isSelD0() >= selectionFlagD0) { + if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { isSoftPiD0 = true; continue; } } - if (candidate1.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate1)) - softPiMass) < ptSoftPionMax) { + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { isSoftPiD0bar = true; continue; } @@ -420,10 +391,10 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hTrackCounter"), 3); // fill no. of tracks after soft pion removal int signalStatus = 0; - if ((candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + if ((candidate.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0Only; } - if ((candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + if ((candidate.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnly; } @@ -433,13 +404,14 @@ struct HfCorrelatorD0Hadrons { } registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle } - entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), - track.eta() - candidate1.eta(), - candidate1.pt(), + entryD0HadronPair(getDeltaPhi(track.phi(), candidate.phi()), + track.eta() - candidate.eta(), + candidate.pt(), track.pt(), poolBin, correlationStatus); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); + entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), signalStatus); + entryD0HadronMlInfo(outputMlD0[0], outputMlD0[1], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[1], outputMlD0bar[2]); } // end inner loop (tracks) @@ -451,15 +423,11 @@ struct HfCorrelatorD0Hadrons { void processMcRec(SelectedCollisions::iterator const& collision, SelectedTracksMcRec const& tracks, - soa::Join const&) + SelectedCandidatesMcRec const& candidates) { - // protection against empty tables to be sliced - if (selectedD0candidatesMc.size() == 0) { - return; - } // find leading particle if (correlateD0WithLeadingParticle) { - leadingIndex = findLeadingParticle(tracks); + leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value, etaTrackMax.value); } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); int nTracks = 0; @@ -480,63 +448,62 @@ struct HfCorrelatorD0Hadrons { } registry.fill(HIST("hMultiplicity"), nTracks); - auto selectedD0CandidatesGroupedMc = selectedD0candidatesMc->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); // MC reco level bool flagD0 = false; bool flagD0bar = false; - for (const auto& candidate1 : selectedD0CandidatesGroupedMc) { - // check decay channel flag for candidate1 - if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { + for (const auto& candidate : candidates) { + // check decay channel flag for candidate + if (!TESTBIT(candidate.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } - if (std::abs(hfHelper.yD0(candidate1)) >= yCandMax || candidate1.pt() <= ptCandMin || candidate1.pt() >= ptTrackMax) { + if (std::abs(hfHelper.yD0(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptTrackMax) { continue; } double efficiencyWeight = 1.; if (applyEfficiency) { - efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(bins, candidate1.pt())); + efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(bins, candidate.pt())); } - if (std::abs(candidate1.flagMcMatchRec()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { + if (std::abs(candidate.flagMcMatchRec()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { // fill per-candidate distributions from D0/D0bar true candidates - registry.fill(HIST("hPtCandRec"), candidate1.pt()); - registry.fill(HIST("hPtProng0Rec"), candidate1.ptProng0()); - registry.fill(HIST("hPtProng1Rec"), candidate1.ptProng1()); - registry.fill(HIST("hEtaRec"), candidate1.eta()); - registry.fill(HIST("hPhiRec"), candidate1.phi()); - registry.fill(HIST("hYRec"), hfHelper.yD0(candidate1)); - registry.fill(HIST("hSelectionStatusRec"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); + registry.fill(HIST("hPtCandRec"), candidate.pt()); + registry.fill(HIST("hPtProng0Rec"), candidate.ptProng0()); + registry.fill(HIST("hPtProng1Rec"), candidate.ptProng1()); + registry.fill(HIST("hEtaRec"), candidate.eta()); + registry.fill(HIST("hPhiRec"), candidate.phi()); + registry.fill(HIST("hYRec"), hfHelper.yD0(candidate)); + registry.fill(HIST("hSelectionStatusRec"), candidate.isSelD0bar() + (candidate.isSelD0() * 2)); } // fill invariant mass plots from D0/D0bar signal and background candidates - if (candidate1.isSelD0() >= selectionFlagD0) { // only reco as D0 - if (candidate1.flagMcMatchRec() == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { // also matched as D0 - registry.fill(HIST("hMassD0RecSig"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); - } else if (candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { - registry.fill(HIST("hMassD0RecRef"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + if (candidate.isSelD0() >= selectionFlagD0) { // only reco as D0 + if (candidate.flagMcMatchRec() == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { // also matched as D0 + registry.fill(HIST("hMassD0RecSig"), hfHelper.invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); + } else if (candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + registry.fill(HIST("hMassD0RecRef"), hfHelper.invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMassD0RecBg"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0RecBg"), hfHelper.invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); } } - if (candidate1.isSelD0bar() >= selectionFlagD0bar) { // only reco as D0bar - if (candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { // also matched as D0bar - registry.fill(HIST("hMassD0barRecSig"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); - } else if (candidate1.flagMcMatchRec() == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - registry.fill(HIST("hMassD0barRecRef"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + if (candidate.isSelD0bar() >= selectionFlagD0bar) { // only reco as D0bar + if (candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { // also matched as D0bar + registry.fill(HIST("hMassD0barRecSig"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); + } else if (candidate.flagMcMatchRec() == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { + registry.fill(HIST("hMassD0barRecRef"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMassD0barRecBg"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barRecBg"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); } } // ===================== Define parameters for soft pion removal ======================== - auto ePiK = RecoDecay::e(candidate1.pVectorProng0(), massPi) + RecoDecay::e(candidate1.pVectorProng1(), massK); - auto eKPi = RecoDecay::e(candidate1.pVectorProng0(), massK) + RecoDecay::e(candidate1.pVectorProng1(), massPi); + auto ePiK = RecoDecay::e(candidate.pVectorProng0(), massPi) + RecoDecay::e(candidate.pVectorProng1(), massK); + auto eKPi = RecoDecay::e(candidate.pVectorProng0(), massK) + RecoDecay::e(candidate.pVectorProng1(), massPi); // ============== D-h correlation dedicated section ==================================== - flagD0 = candidate1.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Signal 'true' if candidate1 matched to D0 (particle) - flagD0bar = candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Reflection 'true' if candidate1, selected as D0 (particle), is matched to D0bar (antiparticle) + flagD0 = candidate.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Signal 'true' if candidate matched to D0 (particle) + flagD0bar = candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Reflection 'true' if candidate, selected as D0 (particle), is matched to D0bar (antiparticle) // ========== track loop starts here ======================== @@ -545,7 +512,7 @@ struct HfCorrelatorD0Hadrons { // Removing D0 daughters by checking track indices bool correlationStatus = false; - if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { + if ((candidate.prong0Id() == track.globalIndex()) || (candidate.prong1Id() == track.globalIndex())) { if (!storeAutoCorrelationFlag) { continue; } @@ -556,20 +523,20 @@ struct HfCorrelatorD0Hadrons { // ===== soft pion removal =================================================== double invMassDstar1 = 0, invMassDstar2 = 0; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); + auto pSum2 = RecoDecay::p2(candidate.pVector(), track.pVector()); auto ePion = track.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); - if (candidate1.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate1)) - softPiMass) < ptSoftPionMax) { + if (candidate.isSelD0() >= selectionFlagD0) { + if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { isSoftPiD0 = true; continue; } } - if (candidate1.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate1)) - softPiMass) < ptSoftPionMax) { + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { isSoftPiD0bar = true; continue; } @@ -585,35 +552,35 @@ struct HfCorrelatorD0Hadrons { } int signalStatus = 0; - if (flagD0 && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + if (flagD0 && (candidate.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Sig); } // signal case D0 - if (flagD0bar && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + if (flagD0bar && (candidate.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Ref); } // reflection case D0 - if (!flagD0 && !flagD0bar && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + if (!flagD0 && !flagD0bar && (candidate.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Bg); } // background case D0 - if (flagD0bar && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + if (flagD0bar && (candidate.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barSig); } // signal case D0bar - if (flagD0 && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + if (flagD0 && (candidate.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barRef); } // reflection case D0bar - if (!flagD0 && !flagD0bar && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + if (!flagD0 && !flagD0bar && (candidate.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barBg); } // background case D0bar - entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), - track.eta() - candidate1.eta(), - candidate1.pt(), + entryD0HadronPair(getDeltaPhi(track.phi(), candidate.phi()), + track.eta() - candidate.eta(), + candidate.pt(), track.pt(), poolBin, correlationStatus); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); + entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), signalStatus); } // end inner loop (Tracks) - } // end of outer loop (D0) + } // end of outer loop (D0) registry.fill(HIST("hZvtx"), collision.posZ()); registry.fill(HIST("hMultV0M"), collision.multFT0M()); } @@ -629,7 +596,7 @@ struct HfCorrelatorD0Hadrons { // MC gen level // find leading particle if (correlateD0WithLeadingParticle) { - leadingIndex = findLeadingParticleMcGen(mcParticles); + leadingIndex = findLeadingParticleMcGen(mcParticles, etaTrackMax.value, ptTrackMin.value); } for (const auto& particle1 : mcParticles) { // check if the particle is D0 or D0bar (for general plot filling and selection, so both cases are fine) - NOTE: decay channel is not probed! @@ -718,7 +685,7 @@ struct HfCorrelatorD0Hadrons { // ====================== Implement Event mixing on Data =================================== void processDataMixedEvent(SelectedCollisions const& collisions, - SelectedCandidatesData const& candidates, + SelectedCandidatesDataMl const& candidates, SelectedTracks const& tracks) { for (const auto& collision : collisions) { @@ -727,7 +694,7 @@ struct HfCorrelatorD0Hadrons { } auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairData) { // LOGF(info, "Mixed event collisions: Index = (%d, %d), tracks Size: (%d, %d), Z Vertex: (%f, %f), Pool Bin: (%d, %d)", c1.globalIndex(), c2.globalIndex(), tracks1.size(), tracks2.size(), c1.posZ(), c2.posZ(), corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())),corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M()))); // For debug @@ -747,16 +714,24 @@ struct HfCorrelatorD0Hadrons { auto ePion = t2.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); + std::vector outputMlD0 = {-1., -1., -1.}; + std::vector outputMlD0bar = {-1., -1., -1.}; if (t1.isSelD0() >= selectionFlagD0) { if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(t1)) - softPiMass) < ptSoftPionMax) { isSoftPiD0 = true; } + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMlD0[iclass] = t1.mlProbD0()[classMl->at(iclass)]; + } } if (t1.isSelD0bar() >= selectionFlagD0bar) { if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(t1)) - softPiMass) < ptSoftPionMax) { isSoftPiD0bar = true; } + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMlD0bar[iclass] = t1.mlProbD0bar()[classMl->at(iclass)]; + } } int signalStatus = 0; @@ -777,6 +752,7 @@ struct HfCorrelatorD0Hadrons { bool correlationStatus = false; entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin, correlationStatus); entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); + entryD0HadronMlInfo(outputMlD0[0], outputMlD0[1], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[1], outputMlD0bar[2]); } } } @@ -823,8 +799,8 @@ struct HfCorrelatorD0Hadrons { } } - flagD0 = t1.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Signal 'true' if candidate1 matched to D0 (particle) - flagD0bar = t1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Reflection 'true' if candidate1, selected as D0 (particle), is matched to D0bar (antiparticle) + flagD0 = t1.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Signal 'true' if candidate matched to D0 (particle) + flagD0bar = t1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Reflection 'true' if candidate, selected as D0 (particle), is matched to D0bar (antiparticle) int signalStatus = 0; if (flagD0 && (t1.isSelD0() >= selectionFlagD0)) { diff --git a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx index 0ba872d67d5..45ad4877388 100644 --- a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx @@ -14,6 +14,9 @@ /// /// \author Andrea Tavira García , IJCLab Orsay +#include +#include + #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" @@ -79,9 +82,10 @@ struct HfCorrelatorDMesonPairs { HistogramConfigSpec hTH1Pt{HistType::kTH1F, {{180, 0., 36.}}}; HistogramConfigSpec hTH1Y{HistType::kTH1F, {{100, -5., 5.}}}; + HistogramConfigSpec hTH1NContrib{HistType::kTH1F, {{120, -0.5, 119.5}}}; HistogramConfigSpec hTH1Phi{HistType::kTH1F, {{32, 0., o2::constants::math::TwoPI}}}; HistogramConfigSpec hTH2Pid{HistType::kTH2F, {{500, 0., 10.}, {400, -20., 20.}}}; - HistogramConfigSpec hTH2PtVsY{HistType::kTH2F, {{360, 0., 36.}, {20, -1., 1.}}}; + HistogramConfigSpec hTH3PtVsYVsNContrib{HistType::kTH3F, {{360, 0., 36.}, {20, -1., 1.}, {120, -0.5, 119.5}}}; HistogramRegistry registry{ "registry", @@ -97,9 +101,11 @@ struct HfCorrelatorDMesonPairs { {"hPtCandAfterCutMcGen", "D meson candidates after pT cut;candidate #it{p}_{T} (GeV/#it{c});entries", hTH1Pt}, {"hEtaMcGen", "D meson candidates MC Gen;candidate #it{#eta};entries", hTH1Y}, {"hPhiMcGen", "D meson candidates MC Gen;candidate #it{#varphi};entries", hTH1Phi}, - {"hPtVsYMcGen", "D meson candidates MC Gen;candidate #it{p}_{T} (GeV/#it{c});#it{y}", hTH2PtVsY}, + {"hPtVsYVsNContribMcGen", "D meson candidates MC Gen;candidate #it{p}_{T} (GeV/#it{c});#it{y};Number of contributors", hTH3PtVsYVsNContrib}, + {"hNContribMcGen", "D meson candidates MC Gen;Number of contributors", hTH1NContrib}, // MC Rec plots - {"hPtVsYMcRec", "D meson candidates MC Rec;candidate #it{p}_{T} (GeV/#it{c});#it{y}", hTH2PtVsY}, + {"hPtVsYVsNContribMcRec", "D meson candidates MC Rec;candidate #it{p}_{T} (GeV/#it{c});#it{y};Number of contributors", hTH3PtVsYVsNContrib}, + {"hNContribMcRec", "D meson candidates MC Rec;Number of contributors", hTH1NContrib}, // PID plots ----- Not definitively here {"PID/hTofNSigmaPi", "(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid", hTH2Pid}, {"PID/hTofNSigmaKa", "(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid", hTH2Pid}, @@ -559,7 +565,8 @@ struct HfCorrelatorDMesonPairs { if (isDCand1) { if (isTrueDCand1) { registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); - registry.fill(HIST("hPtVsYMcRec"), candidate1.pt(), hfHelper.yD0(candidate1)); + registry.fill(HIST("hPtVsYVsNContribMcRec"), candidate1.pt(), hfHelper.yD0(candidate1), collision.numContrib()); + registry.fill(HIST("hNContribMcRec"), collision.numContrib()); if (originRec1 == 1) { registry.fill(HIST("hMassMcRecPrompt"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); } else if (originRec1 == 2) { @@ -572,7 +579,8 @@ struct HfCorrelatorDMesonPairs { if (isDbarCand1) { if (isTrueDbarCand1) { registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); - registry.fill(HIST("hPtVsYMcRec"), candidate1.pt(), hfHelper.yD0(candidate1)); + registry.fill(HIST("hPtVsYVsNContribMcRec"), candidate1.pt(), hfHelper.yD0(candidate1), collision.numContrib()); + registry.fill(HIST("hNContribMcRec"), collision.numContrib()); if (originRec1 == 1) { registry.fill(HIST("hMassMcRecPrompt"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); } else if (originRec1 == 2) { @@ -665,8 +673,16 @@ struct HfCorrelatorDMesonPairs { PROCESS_SWITCH(HfCorrelatorDMesonPairs, processMcRec, "Process Mc reco mode", false); - void processMcGen(aod::McCollision const&, McParticlesPlus2Prong const& mcParticles) + void processMcGen(aod::McCollision const&, soa::SmallGroups> const& collisions, McParticlesPlus2Prong const& mcParticles) { + int numPvContributorsGen{0}; + for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision + int numPvContributors = collision.numContrib(); + + if (numPvContributors > numPvContributorsGen) { // we take the associated reconstructed collision with higher number of PV contributors + numPvContributorsGen = numPvContributors; + } + } // Get counters per event int nDevent = 0, nDbarevent = 0, nDDbarevent = 0, nDorDbarevent = 0; for (const auto& particle : mcParticles) { @@ -750,7 +766,8 @@ struct HfCorrelatorDMesonPairs { registry.fill(HIST("hStatusSinglePartMcGen"), 4); } - registry.fill(HIST("hPtVsYMcGen"), particle1.pt(), particle1.y()); + registry.fill(HIST("hPtVsYVsNContribMcGen"), particle1.pt(), particle1.y(), numPvContributorsGen); + registry.fill(HIST("hNContribMcGen"), numPvContributorsGen); for (auto particle2 = particle1 + 1; particle2 != mcParticles.end(); ++particle2) { // check if the particle is D0 or D0bar diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 016c672f50e..6d85a17cb80 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -14,6 +14,8 @@ /// \author Grazia Luparello /// \author Samuele Cattaruzzi +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -29,6 +31,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" +#include "PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h" using namespace o2; using namespace o2::analysis; @@ -76,6 +79,7 @@ struct HfCorrelatorDsHadronsSelCollision { bool isSel8 = true; bool isNosameBunchPileUp = true; if (doSelDsCollision) { + isDsFound = false; // if candidate table is empty for-loop is not performed for (const auto& candidate : candidates) { if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin) { isDsFound = false; @@ -86,9 +90,11 @@ struct HfCorrelatorDsHadronsSelCollision { } } if (useSel8) { + isSel8 = false; isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { + isNosameBunchPileUp = false; isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); } isSelColl = isDsFound && isSel8 && isNosameBunchPileUp; @@ -135,6 +141,9 @@ struct HfCorrelatorDsHadrons { Produces entryDsCandRecoInfo; Produces entryDsCandGenInfo; Produces entryTrackRecoInfo; + Produces collReduced; + Produces candReduced; + Produces assocTrackReduced; Configurable fillHistoData{"fillHistoData", true, "Flag for filling histograms in data processes"}; Configurable fillHistoMcRec{"fillHistoMcRec", true, "Flag for filling histograms in MC Rec processes"}; @@ -680,6 +689,32 @@ struct HfCorrelatorDsHadrons { } PROCESS_SWITCH(HfCorrelatorDsHadrons, processMcGen, "Process MC Gen mode", false); + void processDerivedDataDs(SelCollisionsWithDs::iterator const& collision, + CandDsData const& candidates, + MyTracksData const& tracks) + { + collReduced(collision.multFT0M(), collision.posZ()); + + // Ds fill histograms and Ds candidates information stored + for (const auto& candidate : candidates) { + // candidate selected + if (candidate.isSelDsToKKPi() >= selectionFlagDs) { + candReduced(collReduced.lastIndex(), candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToKKPi(candidate)); + } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { + candReduced(collReduced.lastIndex(), candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToPiKK(candidate)); + } + } + + // tracks information + for (const auto& track : tracks) { + if (!track.isGlobalTrackWoDCA()) { + continue; + } + assocTrackReduced(collReduced.lastIndex(), track.phi(), track.eta(), track.pt()); + } + } + PROCESS_SWITCH(HfCorrelatorDsHadrons, processDerivedDataDs, "Process derived data Ds", false); + // Event Mixing void processDataME(SelCollisionsWithDs const& collisions, CandDsData const& candidates, diff --git a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx index a550bee58fc..2d9221f7190 100644 --- a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx @@ -158,7 +158,7 @@ struct HfCorrelatorHfeHadrons { // mix event electron-hadron correlation template - void fillMixCorrelation(CollisionType1 const& c1, CollisionType2 const& c2, ElectronType const& tracks1, TracksType const& tracks2) + void fillMixCorrelation(CollisionType1 const&, CollisionType2 const& c2, ElectronType const& tracks1, TracksType const& tracks2) { if (!(isRun3 ? c2.sel8() : (c2.sel7() && c2.alias_bit(kINT7)))) return; diff --git a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx index 141ad2e9b4c..97538f65ebc 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -14,10 +14,14 @@ /// /// \author Marianna Mazzilli /// \author Zhen Zhang +/// \author Ravindra Singh + +#include #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" #include "Common/Core/TrackSelection.h" @@ -30,54 +34,34 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" +#include "PWGHF/HFC/Utils/utilsCorrelations.h" using namespace o2; using namespace o2::analysis; using namespace o2::constants::physics; +using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; - +using namespace o2::analysis::hf_correlations; /// /// Returns deltaPhi values in range [-pi/2., 3.*pi/2.], typically used for correlation studies /// double getDeltaPhi(double phiLc, double phiHadron) { - return RecoDecay::constrainAngle(phiHadron - phiLc, -o2::constants::math::PIHalf); + return RecoDecay::constrainAngle(phiHadron - phiLc, -PIHalf); } -/// definition of variables for Lc hadron pairs (in data-like, Mc-reco and Mc-kine tasks) -const int nBinsPtMassAndEfficiency = o2::analysis::hf_cuts_lc_to_p_k_pi::nBinsPt; -const double efficiencyLcDefault[nBinsPtMassAndEfficiency] = {}; -auto vecEfficiencyLc = std::vector{efficiencyLcDefault, efficiencyLcDefault + nBinsPtMassAndEfficiency}; - -// histogram binning definition -const int massAxisBins = 120; -const double massAxisMin = 1.98; -const double massAxisMax = 2.58; -const int phiAxisBins = 32; -const double phiAxisMin = -o2::constants::math::PIHalf; -const double phiAxisMax = 3. * o2::constants::math::PIHalf; -const int yAxisBins = 100; -const double yAxisMin = -2.; -const double yAxisMax = 2.; -const int ptLcAxisBins = 180; -const double ptLcAxisMin = 0.; -const double ptLcAxisMax = 36.; - // definition of ME variables using BinningType = ColumnBinningPolicy>; - -using SelectedCollisions = soa::Filtered>; -using SelectedTracks = soa::Filtered; -using SelectedCandidatesData = soa::Filtered>; -using SelectedCandidatesMcRec = soa::Filtered>; -using SelectedCollisionsMcGen = soa::Filtered>; -using SelectedTracksMcGen = soa::Filtered; +using BinningTypeMcGen = ColumnBinningPolicy; // Code to select collisions with at least one Lambda_c struct HfCorrelatorLcHadronsSelection { Produces lcSel; + Configurable useSel8{"useSel8", true, "Flag for applying sel8 for collision selection"}; + Configurable selNoSameBunchPileUpColl{"selNoSameBunchPileUpColl", true, "Flag for rejecting the collisions associated with the same bunch crossing"}; + Configurable doSelLcCollision{"doSelLcCollision", true, "Select collisions with at least one Lc"}; Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; @@ -85,79 +69,86 @@ struct HfCorrelatorLcHadronsSelection { HfHelper hfHelper; SliceCache cache; - Partition> selectedLcCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; - Partition> selectedLcCandidatesMc = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; + using SelCollisions = soa::Join; + using CandidatesLcData = soa::Filtered>; + using CandidatesLcMcRec = soa::Filtered>; + using CandidatesLcMcGen = soa::Join; - // Returns false if the candidate does not pass cuts on decay type, y max, and pt min. Used for data and MC reco. - template - bool kinematicCuts(const T& candidate) - { - // check decay channel flag for candidate - if (!TESTBIT(candidate.hfflag(), aod::hf_cand_3prong::DecayType::LcToPKPi)) { - return false; - } - if (yCandMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandMax) { - return false; - } - if (ptCandMin >= 0. && candidate.pt() < ptCandMin) { - return false; - } - return true; - } + // filter on selection of Lc and decay channel Lc->PKPi + Filter lcFilter = ((o2::aod::hf_track_index::hfflag & static_cast(1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) != static_cast(0)) && (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); - void processLcSelectionData(aod::Collision const& collision, - soa::Join const&) + /// Code to select collisions with at least one Lc - for real data and data-like analysis + void processLcSelectionData(SelCollisions::iterator const& collision, + CandidatesLcData const& candidates) { - int isLcFound = 0; - if (selectedLcCandidates.size() > 0) { - auto selectedLcCandidatesGrouped = selectedLcCandidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - - for (const auto& candidate : selectedLcCandidatesGrouped) { - if (!kinematicCuts(candidate)) { + bool isSelColl = true; + bool isLcFound = true; + bool isSel8 = true; + bool isNosameBunchPileUp = true; + if (doSelLcCollision) { + for (const auto& candidate : candidates) { + if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + isLcFound = false; continue; } - isLcFound = 1; + isLcFound = true; break; } } - lcSel(isLcFound); + if (useSel8) { + isSel8 = collision.sel8(); + } + if (selNoSameBunchPileUpColl) { + isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + } + isSelColl = isLcFound && isSel8 && isNosameBunchPileUp; + lcSel(isSelColl); } PROCESS_SWITCH(HfCorrelatorLcHadronsSelection, processLcSelectionData, "Process Lc Collision Selection Data", true); - void processLcSelectionMcRec(aod::Collision const& collision, - soa::Join const&) + void processLcSelectionMcRec(SelCollisions::iterator const& collision, + CandidatesLcMcRec const& candidates) { - int isLcFound = 0; - if (selectedLcCandidatesMc.size() > 0) { - auto selectedLcCandidatesGroupedMc = selectedLcCandidatesMc->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - for (const auto& candidate : selectedLcCandidatesGroupedMc) { - if (!kinematicCuts(candidate)) { + bool isSelColl = true; + bool isLcFound = true; + bool isSel8 = true; + bool isNosameBunchPileUp = true; + if (doSelLcCollision) { + for (const auto& candidate : candidates) { + if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + isLcFound = false; continue; } - isLcFound = 1; + isLcFound = true; break; } } - lcSel(isLcFound); + if (useSel8) { + isSel8 = collision.sel8(); + } + if (selNoSameBunchPileUpColl) { + isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + } + isSelColl = isLcFound && isSel8 && isNosameBunchPileUp; + lcSel(isSelColl); } PROCESS_SWITCH(HfCorrelatorLcHadronsSelection, processLcSelectionMcRec, "Process Lc Selection McRec", false); void processLcSelectionMcGen(aod::McCollision const&, - aod::McParticles const& mcParticles) + CandidatesLcMcGen const& mcParticles) { - int isLcFound = 0; + bool isLcFound = true; for (const auto& particle : mcParticles) { if (std::abs(particle.pdgCode()) != Pdg::kLambdaCPlus) { + isLcFound = false; continue; } double yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); - if (yCandMax >= 0. && std::abs(yL) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && particle.pt() < ptCandMin) { + if (std::abs(yL) > yCandMax || particle.pt() < ptCandMin) { + isLcFound = false; continue; } - isLcFound = 1; + isLcFound = true; break; } lcSel(isLcFound); @@ -168,113 +159,177 @@ struct HfCorrelatorLcHadronsSelection { // Lc-Hadron correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via Mc truth) struct HfCorrelatorLcHadrons { Produces entryLcHadronPair; + Produces entryLcHadronPairTrkPID; Produces entryLcHadronRecoInfo; + Produces entryLcHadronMlInfo; + Produces entryLcCandRecoInfo; + Produces entryLcHadronGenInfo; + Produces entryLcCandGenInfo; + Produces entryTrackRecoInfo; Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; + Configurable numberEventsMixed{"numberEventsMixed", 5, "number of events mixed in ME process"}; Configurable applyEfficiency{"applyEfficiency", 1, "Flag for applying Lc efficiency weights"}; - Configurable filterFlagLc{"filterFlagLc", true, "Flag for applying Collision Filter with Lc"}; - Configurable filterFlagLcMc{"filterFlagLcMc", false, "Flag for applying Mc Collision Filter with Lc"}; - Configurable nEventForMixedEvent{"nEventForMixedEvent", 5, "number of event to be mixed"}; Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen. cand. rapidity"}; Configurable etaTrackMax{"etaTrackMax", 0.8, "max. eta of tracks"}; - Configurable dcaXYTrackMax{"dcaXYTrackMax", 0.0025, "max. DCAxy of tracks"}; - Configurable dcaZTrackMax{"dcaZTrackMax", 0.0025, "max. DCAz of tracks"}; + Configurable dcaXYTrackMax{"dcaXYTrackMax", 1., "max. DCAxy of tracks"}; + Configurable dcaZTrackMax{"dcaZTrackMax", 1., "max. DCAz of tracks"}; Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; + Configurable ptCandMax{"ptCandMax", 50., "max. cand. pT"}; Configurable ptTrackMin{"ptTrackMin", 0.3, "min. track pT"}; Configurable ptTrackMax{"ptTrackMax", 50., "max. track pT"}; Configurable multMin{"multMin", 0., "minimum multiplicity accepted"}; Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; - Configurable> binsPt{"binsPt", std::vector{o2::analysis::hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; - Configurable> efficiencyLc{"efficiencyLc", std::vector{vecEfficiencyLc}, "Efficiency values for Lc"}; - ConfigurableAxis binsMultiplicity{"binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 2000.0f, 6000.0f, 100000.0f}, "Mixing bins - multiplicity"}; - ConfigurableAxis binsZVtx{"binsZVtx", {VARIABLE_WIDTH, -10.0f, -2.5f, 2.5f, 10.0f}, "Mixing bins - z-vertex"}; - ConfigurableAxis binsMultiplicityMc{"binsMultiplicityMc", {VARIABLE_WIDTH, 0.0f, 20.0f, 50.0f, 500.0f}, "Mixing bins - MC multiplicity"}; // In MCGen multiplicity is defined by counting tracks + Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; + Configurable> binsPtLc{"binsPtLc", std::vector{o2::analysis::hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots"}; + Configurable> binsPtHadron{"binsPtHadron", std::vector{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for assoc particle"}; + Configurable> binsPtEfficiencyLc{"binsPtEfficiencyLc", std::vector{o2::analysis::hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits for efficiency"}; + Configurable> efficiencyLc{"efficiencyLc", {1., 1., 1., 1., 1., 1.}, "efficiency values for Lc"}; + Configurable storeAutoCorrelationFlag{"storeAutoCorrelationFlag", false, "Store flag that indicates if the track is paired to its Lc mother instead of skipping it"}; + Configurable correlateLcWithLeadingParticle{"correlateLcWithLeadingParticle", false, "Switch for correlation of Lc baryons with leading particle only"}; + Configurable> trkPIDspecies{"trkPIDspecies", std::vector{o2::track::PID::Proton, o2::track::PID::Pion, o2::track::PID::Kaon}, "Trk sel: Particles species for PID, proton, pion, kaon"}; + Configurable pidTrkApplied{"pidTrkApplied", false, "Apply PID selection for associated tracks"}; + Configurable> pidTPCMax{"pidTPCMax", std::vector{3., 0., 0.}, "maximum nSigma TPC"}; + Configurable> pidTOFMax{"pidTOFMax", std::vector{3., 0., 0.}, "maximum nSigma TOF"}; + Configurable tofPIDThreshold{"tofPIDThreshold", 0.80, "minimum pT after which TOF PID is applicable"}; + Configurable fillTrkPID{"fillTrkPID", false, "fill PID information for associated tracks"}; + Configurable forceTOF{"forceTOF", false, "fill PID information for associated tracks"}; HfHelper hfHelper; SliceCache cache; - BinningType corrBinning{{binsZVtx, binsMultiplicity}, true}; - + Service pdg; + int leadingIndex = 0; + bool correlationStatus = false; + + // Event Mixing for the Data Mode + using SelCollisionsWithLc = soa::Filtered>; + using SelCollisionsWithLcMc = soa::Filtered>; // collisionFilter applied + using CandidatesLcData = soa::Filtered>; + // Event Mixing for the MCRec Mode + using CandidatesLcMcRec = soa::Filtered>; + using CandidatesLcMcGen = soa::Join; // flagLcFilter applied + // Event Mixing for the MCGen Mode + using McCollisionsSel = soa::Filtered>; + using McParticlesSel = soa::Filtered; + // Tracks used in Data and MC + using TracksData = soa::Filtered>; // trackFilter applied + using TracksWithMc = soa::Filtered>; // trackFilter applied // Filters for ME - Filter collisionFilter = aod::hf_selection_lc_collision::lcSel >= filterFlagLc; + Filter collisionFilter = aod::hf_selection_lc_collision::lcSel == true; + Filter lcFilter = ((o2::aod::hf_track_index::hfflag & static_cast(1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) != static_cast(0)) && (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); Filter trackFilter = (nabs(aod::track::eta) < etaTrackMax) && (nabs(aod::track::pt) > ptTrackMin) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax); - Filter lcFilter = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= 1) || (aod::hf_sel_candidate_lc::isSelLcToPiKP >= 1); - Filter collisionFilterGen = aod::hf_selection_lc_collision::lcSel >= filterFlagLcMc; - Filter particlesFilter = nabs(aod::mcparticle::pdgCode) == 4122 || ((aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary); - - Preslice perCol = aod::hf_cand::collisionId; - - Partition> selectedLcCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; - Partition> selectedLcCandidatesMc = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; - - HistogramRegistry registry{ - "registry", - {{"hPtCand", "Lc,Hadron candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hPtProng0", "Lc,Hadron candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hPtProng1", "Lc,Hadron candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hPtProng2", "Lc,Hadron candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hSelectionStatusLcToPKPi", "Lc,Hadron candidates;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}}, - {"hSelectionStatusLcToPiKP", "Lc,Hadron candidates;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}}, - {"hEta", "Lc,Hadron candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{yAxisBins, yAxisMin, yAxisMax}}}}, - {"hPhi", "Lc,Hadron candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{phiAxisBins, phiAxisMin, phiAxisMax}}}}, - {"hY", "Lc,Hadron candidates;candidate #it{y};entries", {HistType::kTH1F, {{yAxisBins, yAxisMin, yAxisMax}}}}, - {"hPtCandMcRec", "Lc,Hadron candidates - Mc reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hPtProng0McRec", "Lc,Hadron candidates - Mc reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hPtProng1McRec", "Lc,Hadron candidates - Mc reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hPtProng2McRec", "Lc,Hadron candidates - Mc reco;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hSelectionStatusMcRec", "Lc,Hadron candidates - Mc reco;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}}, - {"hEtaMcRec", "Lc,Hadron candidates - Mc reco;candidate #it{#eta};entries", {HistType::kTH1F, {{yAxisBins, yAxisMin, yAxisMax}}}}, - {"hPhiMcRec", "Lc,Hadron candidates - Mc reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{phiAxisBins, phiAxisMin, phiAxisMax}}}}, - {"hYMcRec", "Lc,Hadron candidates - Mc reco;candidate #it{y};entries", {HistType::kTH1F, {{yAxisBins, yAxisMin, yAxisMax}}}}, - {"hMcEvtCount", "Event counter - Mc gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, - {"hPtCandMcGen", "Lc,Hadron particles - Mc gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hPtParticleAssocMcRec", "Associated Particles - Mc Rec;Hadron #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hPtParticleAssocMcGen", "Associated Particles - Mc Gen;Hadron #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptLcAxisBins, ptLcAxisMin, ptLcAxisMax}}}}, - {"hEtaMcGen", "Lc,Hadron particles - Mc Gen;particle #it{#varphi};entries", {HistType::kTH1F, {{yAxisBins, yAxisMin, yAxisMax}}}}, - {"hPhiMcGen", "Lc,Hadron particles - Mc Gen;particle #it{#varphi};entries", {HistType::kTH1F, {{phiAxisBins, phiAxisMin, phiAxisMax}}}}, - {"hYMcGen", "Lc,Hadron candidates - Mc Gen;candidate #it{y};entries", {HistType::kTH1F, {{yAxisBins, yAxisMin, yAxisMax}}}}, - {"hCountLcHadronPerEvent", "Lc,Hadron particles - Mc Gen;Number per event;entries", {HistType::kTH1F, {{21, -0.5, 20.5}}}}, - {"hMultiplicityPreSelection", "multiplicity prior to selection;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, - {"hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, - {"hMultT0M", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, - {"hZvtx", "z vertex;z vertex;entries", {HistType::kTH1F, {{200, -20., 20.}}}}, - {"hLcPoolBin", "Lc selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}}, - {"hTracksPoolBin", "Tracks selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}}}}; + // configurable axis definition + ConfigurableAxis binsMultiplicity{"binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 2000.0f, 6000.0f, 100000.0f}, "Mixing bins - multiplicity"}; + ConfigurableAxis binsZVtx{"binsZVtx", {VARIABLE_WIDTH, -10.0f, -2.5f, 2.5f, 10.0f}, "Mixing bins - z-vertex"}; + ConfigurableAxis binsMultiplicityMc{"binsMultiplicityMc", {VARIABLE_WIDTH, 0.0f, 20.0f, 50.0f, 500.0f}, "Mixing bins - MC multiplicity"}; // In MCGen multiplicity is defined by counting tracks + ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"}; + ConfigurableAxis binsEta{"binsEta", {50, -2., 2.}, "#it{#eta}"}; + ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"}; + ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; + ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 6000.}, "Multiplicity as FT0M signal amplitude"}; + ConfigurableAxis binsMassLc{"binsMassLc", {200, 1.98, 2.58}, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; + + BinningType corrBinning{{binsZVtx, binsMultiplicity}, true}; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext&) { - auto vbins = (std::vector)binsPt; - registry.add("hMassLcVsPt", "Lc candidates;inv. mass (p k #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassLcData", "Lc candidates;inv. mass (p k #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisBins, massAxisMin, massAxisMax}}}); - registry.add("hMassLcMcRec", "Lc candidates;inv. mass (p k #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisBins, massAxisMin, massAxisMax}}}); - registry.add("hMassLcVsPtMcRec", "Lc candidates;inv. mass (p k #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassLcMcRecSig", "Lc signal candidates - Mc reco;inv. mass (p k #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - // mass histogram for Lc background candidates only - registry.add("hMassLcMcRecBkg", "Lc background candidates - Mc reco;inv. mass (p k #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCountLctriggersMcGen", "Lc trigger particles - Mc gen;;N of trigger Lc", {HistType::kTH2F, {{1, -0.5, 0.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + AxisSpec axisMassLc = {binsMassLc, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; + AxisSpec axisEta = {binsEta, "#it{eta}"}; + AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; + AxisSpec axisPtLc = {(std::vector)binsPtLc, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T} Hadron (GeV/#it{c})"}; + AxisSpec axisMultiplicity = {binsMultiplicity, "Multiplicity"}; + AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + AxisSpec axisPosZ = {binsZVtx, "PosZ"}; + AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec axisRapidity = {100, -2, 2, "Rapidity"}; + + registry.add("hPtCand", "Lc,Hadron candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtProng0", "Lc,Hadron candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtProng1", "Lc,Hadron candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtProng2", "Lc,Hadron candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); + registry.add("hSelectionStatusLcToPKPi", "Lc,Hadron candidates;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}); + registry.add("hSelectionStatusLcToPiKP", "Lc,Hadron candidates;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}); + registry.add("hEta", "Lc,Hadron candidates;candidate #it{#eta};entries", {HistType::kTH1F, {axisEta}}); + registry.add("hPhi", "Lc,Hadron candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {axisPhi}}); + registry.add("hY", "Lc,Hadron candidates;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}}); + registry.add("hCountLcHadronPerEvent", "Lc,Hadron particles - MC gen;Number per event;entries", {HistType::kTH1F, {{21, -0.5, 20.5}}}); + registry.add("hMultiplicityPreSelection", "multiplicity prior to selection;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}); + registry.add("hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}); + registry.add("hMultFT0M", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}); + registry.add("hZvtx", "z vertex;z vertex;entries", {HistType::kTH1F, {{200, -20., 20.}}}); + registry.add("hLcBin", "Lc selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}); + registry.add("hTracksBin", "Tracks selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}); + registry.add("hMassLcVsPt", "Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); + registry.add("hMassLcData", "Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{axisMassLc}}}); + registry.add("hLcPoolBin", "Lc candidates pool bin", {HistType::kTH1F, {axisPoolBin}}); + registry.add("hTracksPoolBin", "Particles associated pool bin", {HistType::kTH1F, {axisPoolBin}}); + // Histograms for MC Reco analysis + registry.add("hSelectionStatusLcToPKPiMcRec", "Lc,Hadron candidates - MC reco;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}); + registry.add("hSelectionStatusLcToPiKPMcRec", "Lc,Hadron candidates - MC reco;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}); + registry.add("hMcEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}); + registry.add("hPtProng0McRec", "Lc,Hadron candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtProng1McRec", "Lc,Hadron candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtProng2McRec", "Lc,Hadron candidates - MC reco;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); + registry.add("hMassLcMcRec", "Lc candidates;inv. mass (P K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{axisMassLc}}}); + registry.add("hMassLcVsPtMcRec", "Lc candidates - MC Reco", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); + registry.add("hMassLcMcRecSig", "Lc signal candidates - MC reco;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); + registry.add("hMassLcMcRecBkg", "Lc background candidates - MC reco;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); + registry.add("hPtCandMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtCandMcRecSigPrompt", "Lc,Hadron candidates Prompt - MC Reco", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtCandMcRecSigNonPrompt", "Lc,Hadron candidates Non Prompt - MC Reco", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtCandMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisPtLc}}); + registry.add("hEtaMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisEta}}); + registry.add("hPhiMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisPhi}}); + registry.add("hYMcRecSig", "Lc,Hadron candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}}); + registry.add("hEtaMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisEta}}); + registry.add("hPhiMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisPhi}}); + registry.add("hYMcRecBkg", "Lc,Hadron candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}}); + registry.add("hFakeTracksMcRec", "Fake tracks - MC Rec", {HistType::kTH1F, {axisPtHadron}}); + registry.add("hPtParticleAssocVsCandMcRec", "Associated Particle - MC Rec", {HistType::kTH2F, {{axisPtHadron}, {axisPtLc}}}); + registry.add("hPtPrimaryParticleAssocVsCandMcRec", "Associated Particle - MC Rec", {HistType::kTH2F, {{axisPtHadron}, {axisPtLc}}}); + registry.add("hPtVsMultiplicityMcRecPrompt", "Multiplicity FT0M - MC Rec Prompt", {HistType::kTH2F, {{axisPtLc}, {axisMultFT0M}}}); + registry.add("hPtVsMultiplicityMcRecNonPrompt", "Multiplicity FT0M - MC Rec Non Prompt", {HistType::kTH2F, {{axisPtLc}, {axisMultFT0M}}}); + // Histograms for MC Gen analysis + registry.add("hcountLctriggersMcGen", "Lc trigger particles - MC gen;;N of trigger Lc", {HistType::kTH2F, {{1, -0.5, 0.5}, {axisPtLc}}}); + registry.add("hPtCandMcGen", "Lc,Hadron particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); + registry.add("hYMcGen", "Lc,Hadron candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}}); + registry.add("hPtCandMcGenPrompt", "Lc,Hadron particles - MC Gen Prompt", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtCandMcGenNonPrompt", "Lc,Hadron particles - MC Gen Non Prompt", {HistType::kTH1F, {axisPtLc}}); + registry.add("hPtParticleAssocMcGen", "Associated Particle - MC Gen", {HistType::kTH1F, {axisPtHadron}}); + registry.add("hEtaMcGen", "Lc,Hadron particles - MC Gen", {HistType::kTH1F, {axisEta}}); + registry.add("hPhiMcGen", "Lc,Hadron particles - MC Gen", {HistType::kTH1F, {axisPhi}}); + registry.add("hMultFT0AMcGen", "Lc,Hadron multiplicity FT0A - MC Gen", {HistType::kTH1F, {axisMultiplicity}}); + corrBinning = {{binsZVtx, binsMultiplicity}, true}; } - /// Lc-h correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via Mc truth) - void processData(soa::Join::iterator const& collision, - aod::TracksWDca const& tracks, - soa::Join const&) + /// Lc-hadron correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) + void processData(SelCollisionsWithLc::iterator const& collision, + TracksData const& tracks, + CandidatesLcData const& candidates) { - // protection against empty tables to be sliced - if (selectedLcCandidates.size() == 0) { + if (candidates.size() == 0) { return; } + + // find leading particle + if (correlateLcWithLeadingParticle) { + leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value, etaTrackMax.value); + } + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); int nTracks = 0; if (collision.numContrib() > 1) { for (const auto& track : tracks) { - if (std::abs(track.eta()) > etaTrackMax) { - continue; - } - if (std::abs(track.dcaXY()) > dcaXYTrackMax || std::abs(track.dcaZ()) > dcaZTrackMax) { + if (std::abs(track.eta()) > etaTrackMax || std::abs(track.dcaXY()) > dcaXYTrackMax || std::abs(track.dcaZ()) > dcaZTrackMax) { continue; } nTracks++; - registry.fill(HIST("hTracksPoolBin"), poolBin); } } registry.fill(HIST("hMultiplicityPreSelection"), nTracks); @@ -283,105 +338,133 @@ struct HfCorrelatorLcHadrons { } registry.fill(HIST("hMultiplicity"), nTracks); - auto selectedLcCandidatesGrouped = selectedLcCandidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + int cntLc = 0; + std::vector outputMl = {-1., -1., -1.}; - for (const auto& candidate : selectedLcCandidatesGrouped) { - if (yCandMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && candidate.pt() < ptCandMin) { - continue; - } - if (candidate.pt() > ptTrackMax) { + for (const auto& candidate : candidates) { + if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } - // check decay channel flag for candidate - if (!TESTBIT(candidate.hfflag(), aod::hf_cand_3prong::DecayType::LcToPKPi)) { - continue; - } - - double efficiencyWeight = 1.; + double efficiencyWeightLc = 1.; if (applyEfficiency) { - efficiencyWeight = 1. / efficiencyLc->at(o2::analysis::findBin(binsPt, candidate.pt())); + efficiencyWeightLc = 1. / efficiencyLc->at(o2::analysis::findBin(binsPtEfficiencyLc, candidate.pt())); } + auto trackPos1 = candidate.template prong0_as(); // positive daughter (negative for the antiparticles) + int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); registry.fill(HIST("hPtProng2"), candidate.ptProng2()); registry.fill(HIST("hEta"), candidate.eta()); - registry.fill(HIST("hPhi"), RecoDecay::constrainAngle(candidate.phi(), -o2::constants::math::PIHalf)); + registry.fill(HIST("hPhi"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); registry.fill(HIST("hY"), hfHelper.yLc(candidate)); - registry.fill(HIST("hLcPoolBin"), poolBin); + registry.fill(HIST("hLcBin"), poolBin); if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - registry.fill(HIST("hMassLcVsPt"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMassLcData"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeight); + registry.fill(HIST("hMassLcVsPt"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcData"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPKPi"), candidate.isSelLcToPKPi()); + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; + } + entryLcCandRecoInfo(hfHelper.invMassLcToPKPi(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - registry.fill(HIST("hMassLcVsPt"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMassLcData"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeight); + registry.fill(HIST("hMassLcVsPt"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcData"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPiKP"), candidate.isSelLcToPiKP()); + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; + } + entryLcCandRecoInfo(hfHelper.invMassLcToPiKP(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore } + // Lc-Hadron correlation dedicated section // if the candidate is a Lc, search for Hadrons and evaluate correlations - for (const auto& track : tracks) { - if (std::abs(track.eta()) > etaTrackMax) { - continue; + // Remove Lc daughters by checking track indices + if ((candidate.prong0Id() == track.globalIndex()) || (candidate.prong1Id() == track.globalIndex()) || (candidate.prong2Id() == track.globalIndex())) { + if (!storeAutoCorrelationFlag) { + continue; + } + correlationStatus = true; } - if (track.pt() < ptTrackMin) { + if (!track.isGlobalTrackWoDCA()) { continue; } - if (std::abs(track.dcaXY()) >= dcaXYTrackMax || std::abs(track.dcaZ()) >= dcaZTrackMax) { - continue; // Remove secondary tracks + if (pidTrkApplied) { + if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + continue; } - // Remove Lc daughters by checking track indices - if ((candidate.prong0Id() == track.globalIndex()) || (candidate.prong1Id() == track.globalIndex()) || (candidate.prong2Id() == track.globalIndex())) { - continue; + if (correlateLcWithLeadingParticle) { + if (track.globalIndex() != leadingIndex) { + continue; + } } if (candidate.isSelLcToPKPi() >= selectionFlagLc) { entryLcHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), - candidate.pt(), - track.pt(), - poolBin); + candidate.pt() * chargeLc, + track.pt() * track.sign(), + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), false); + entryLcHadronGenInfo(false, false, 0); + entryLcHadronMlInfo(outputMl[0], outputMl[1]); + entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); + if (fillTrkPID) { + entryLcHadronPairTrkPID(track.tpcNSigmaPr(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tofNSigmaPr(), track.tofNSigmaKa(), track.tofNSigmaPi()); + } } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { entryLcHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), - candidate.pt(), - track.pt(), - poolBin); + candidate.pt() * chargeLc, + track.pt() * track.sign(), + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), false); + entryLcHadronGenInfo(false, false, 0); + entryLcHadronMlInfo(outputMl[0], outputMl[1]); + entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); + if (fillTrkPID) { + entryLcHadronPairTrkPID(track.tpcNSigmaPr(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tofNSigmaPr(), track.tofNSigmaKa(), track.tofNSigmaPi()); + } + } + if (cntLc == 0) { + registry.fill(HIST("hTracksBin"), poolBin); } } // Hadron Tracks loop - } // end outer Lc loop + cntLc++; + } // end outer Lc loop registry.fill(HIST("hZvtx"), collision.posZ()); - registry.fill(HIST("hMultT0M"), collision.multFT0M()); + registry.fill(HIST("hMultFT0M"), collision.multFT0M()); } PROCESS_SWITCH(HfCorrelatorLcHadrons, processData, "Process data", true); /// Lc-Hadron correlation process starts for McRec - void processMcRec(soa::Join::iterator const& collision, - aod::TracksWDca const& tracks, - soa::Join const&) + void processMcRec(SelCollisionsWithLc::iterator const& collision, + TracksWithMc const& tracks, + CandidatesLcMcRec const& candidates, + aod::McParticles const& mcParticles) { - if (selectedLcCandidatesMc.size() == 0) { + if (candidates.size() == 0) { return; } + + // find leading particle + if (correlateLcWithLeadingParticle) { + leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value, etaTrackMax.value); + } + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); int nTracks = 0; if (collision.numContrib() > 1) { for (const auto& track : tracks) { - if (std::abs(track.eta()) > etaTrackMax) { - continue; - } - if (std::abs(track.dcaXY()) > dcaXYTrackMax || std::abs(track.dcaZ()) > dcaZTrackMax) { + if (std::abs(track.eta()) >= etaTrackMax || std::abs(track.dcaXY()) > dcaXYTrackMax || std::abs(track.dcaZ()) > dcaZTrackMax) { continue; } nTracks++; - registry.fill(HIST("hTracksPoolBin"), poolBin); } } registry.fill(HIST("hMultiplicityPreSelection"), nTracks); @@ -390,313 +473,524 @@ struct HfCorrelatorLcHadrons { } registry.fill(HIST("hMultiplicity"), nTracks); - auto selectedLcCandidatesGroupedMc = selectedLcCandidatesMc->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - + float multiplicityFT0M = collision.multFT0M(); // Mc reco level + bool isLcPrompt = false; + bool isLcNonPrompt = false; bool isLcSignal = false; - for (const auto& candidate : selectedLcCandidatesGroupedMc) { + for (const auto& candidate : candidates) { // check decay channel flag for candidate - if (!TESTBIT(candidate.hfflag(), aod::hf_cand_3prong::DecayType::LcToPKPi)) { + if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && candidate.pt() < ptCandMin) { - continue; - } - if (candidate.pt() >= ptTrackMax) { - continue; - } - double efficiencyWeight = 1.; + double efficiencyWeightLc = 1.; if (applyEfficiency) { - efficiencyWeight = 1. / efficiencyLc->at(o2::analysis::findBin(binsPt, candidate.pt())); + efficiencyWeightLc = 1. / efficiencyLc->at(o2::analysis::findBin(binsPtEfficiencyLc, candidate.pt())); } - isLcSignal = std::abs(candidate.flagMcMatchRec()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi; + auto trackPos1 = candidate.template prong0_as(); // positive daughter (negative for the antiparticles) + int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + isLcSignal = TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_3prong::DecayType::LcToPKPi); + isLcPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; + isLcNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; + std::vector outputMl = {-1., -1., -1.}; if (isLcSignal) { - registry.fill(HIST("hPtCandMcRec"), candidate.pt()); registry.fill(HIST("hPtProng0McRec"), candidate.ptProng0()); registry.fill(HIST("hPtProng1McRec"), candidate.ptProng1()); registry.fill(HIST("hPtProng2McRec"), candidate.ptProng2()); - registry.fill(HIST("hEtaMcRec"), candidate.eta()); - registry.fill(HIST("hPhiMcRec"), RecoDecay::constrainAngle(candidate.phi(), -o2::constants::math::PIHalf)); - registry.fill(HIST("hYMcRec"), hfHelper.yLc(candidate)); + registry.fill(HIST("hPtCandMcRecSig"), candidate.pt()); + registry.fill(HIST("hEtaMcRecSig"), candidate.eta()); + registry.fill(HIST("hPhiMcRecSig"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); + registry.fill(HIST("hYMcRecSig"), hfHelper.yLc(candidate)); // LcToPKPi and LcToPiKP division if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeight); - registry.fill(HIST("hMassLcMcRecSig"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hSelectionStatusMcRec"), candidate.isSelLcToPKPi()); + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; + } + // prompt and non-prompt division + if (isLcPrompt) { + registry.fill(HIST("hPtCandMcRecSigPrompt"), candidate.pt()); + registry.fill(HIST("hPtVsMultiplicityMcRecPrompt"), candidate.pt(), multiplicityFT0M); + } else if (isLcNonPrompt) { + registry.fill(HIST("hPtCandMcRecSigNonPrompt"), candidate.pt()); + registry.fill(HIST("hPtVsMultiplicityMcRecNonPrompt"), candidate.pt(), multiplicityFT0M); + } + registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRecSig"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hSelectionStatusLcToPKPiMcRec"), candidate.isSelLcToPKPi()); + entryLcCandRecoInfo(hfHelper.invMassLcToPKPi(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore + entryLcCandGenInfo(isLcPrompt); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeight); - registry.fill(HIST("hMassLcMcRecSig"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hSelectionStatusMcRec"), candidate.isSelLcToPiKP()); + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; + } + if (isLcPrompt) { + registry.fill(HIST("hPtCandMcRecSigPrompt"), candidate.pt()); + registry.fill(HIST("hPtVsMultiplicityMcRecPrompt"), candidate.pt(), multiplicityFT0M); + } else if (isLcNonPrompt) { + registry.fill(HIST("hPtCandMcRecSigNonPrompt"), candidate.pt()); + registry.fill(HIST("hPtVsMultiplicityMcRecNonPrompt"), candidate.pt(), multiplicityFT0M); + } + registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRecSig"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hSelectionStatusLcToPiKPMcRec"), candidate.isSelLcToPiKP()); + entryLcCandRecoInfo(hfHelper.invMassLcToPiKP(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore + entryLcCandGenInfo(isLcPrompt); } } else { - registry.fill(HIST("hPtCandMcRec"), candidate.pt()); - registry.fill(HIST("hPtProng0McRec"), candidate.ptProng0()); - registry.fill(HIST("hPtProng1McRec"), candidate.ptProng1()); - registry.fill(HIST("hPtProng2McRec"), candidate.ptProng2()); - registry.fill(HIST("hEtaMcRec"), candidate.eta()); - registry.fill(HIST("hPhiMcRec"), RecoDecay::constrainAngle(candidate.phi(), -o2::constants::math::PIHalf)); - registry.fill(HIST("hYMcRec"), hfHelper.yLc(candidate)); + registry.fill(HIST("hPtCandMcRecBkg"), candidate.pt()); + registry.fill(HIST("hEtaMcRecBkg"), candidate.eta()); + registry.fill(HIST("hPhiMcRecBkg"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); + registry.fill(HIST("hYMcRecBkg"), hfHelper.yLc(candidate)); // LcToPKPi and LcToPiKP division if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeight); - registry.fill(HIST("hMassLcMcRecBkg"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hSelectionStatusMcRec"), candidate.isSelLcToPKPi()); + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; + } + registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRecBkg"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hSelectionStatusLcToPKPiMcRec"), candidate.isSelLcToPKPi()); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeight); - registry.fill(HIST("hMassLcMcRecBkg"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hSelectionStatusMcRec"), candidate.isSelLcToPiKP()); + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; + } + registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRecBkg"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hSelectionStatusLcToPiKPMcRec"), candidate.isSelLcToPiKP()); } } - registry.fill(HIST("hLcPoolBin"), poolBin); + registry.fill(HIST("hLcBin"), poolBin); // Lc-Hadron correlation dedicated section // if the candidate is selected as Lc, search for Hadron ad evaluate correlations for (const auto& track : tracks) { - if (std::abs(track.eta()) > etaTrackMax) { - continue; - } - if (track.pt() < ptTrackMin) { + bool isPhysicalPrimary = false; + int trackOrigin = -1; + // apply track selection + if (!track.isGlobalTrackWoDCA()) { continue; } - if (std::abs(track.dcaXY()) >= dcaXYTrackMax || std::abs(track.dcaZ()) >= dcaZTrackMax) { - continue; // Remove secondary tracks + if (pidTrkApplied) { + if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + continue; } // Removing Lc daughters by checking track indices if ((candidate.prong0Id() == track.globalIndex()) || (candidate.prong1Id() == track.globalIndex()) || (candidate.prong2Id() == track.globalIndex())) { - continue; + if (!storeAutoCorrelationFlag) { + continue; + } + correlationStatus = true; + } + + if (correlateLcWithLeadingParticle) { + if (track.globalIndex() != leadingIndex) { + continue; + } } - registry.fill(HIST("hPtParticleAssocMcRec"), track.pt()); if (candidate.isSelLcToPKPi() >= selectionFlagLc) { entryLcHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), - candidate.pt(), - track.pt(), - poolBin); + candidate.pt() * chargeLc, + track.pt() * track.sign(), + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), isLcSignal); + if (fillTrkPID) { + entryLcHadronPairTrkPID(track.tpcNSigmaPr(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tofNSigmaPr(), track.tofNSigmaKa(), track.tofNSigmaPi()); + } + entryLcHadronMlInfo(outputMl[0], outputMl[1]); + if (track.has_mcParticle()) { + auto mcParticle = track.template mcParticle_as(); + isPhysicalPrimary = mcParticle.isPhysicalPrimary(); + trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); + entryLcHadronGenInfo(isLcPrompt, isPhysicalPrimary, trackOrigin); + } else { + entryLcHadronGenInfo(isLcPrompt, false, 0); + registry.fill(HIST("hFakeTracksMcRec"), track.pt()); + } + + // for secondary particle fraction estimation + registry.fill(HIST("hPtParticleAssocVsCandMcRec"), track.pt(), candidate.pt()); + if (isPhysicalPrimary) { + registry.fill(HIST("hPtPrimaryParticleAssocVsCandMcRec"), track.pt(), candidate.pt()); + } + entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { entryLcHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), - candidate.pt(), - track.pt(), - poolBin); + candidate.pt() * chargeLc, + track.pt() * track.sign(), + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), isLcSignal); + if (fillTrkPID) { + entryLcHadronPairTrkPID(track.tpcNSigmaPr(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tofNSigmaPr(), track.tofNSigmaKa(), track.tofNSigmaPi()); + } + entryLcHadronMlInfo(outputMl[0], outputMl[1]); + if (track.has_mcParticle()) { + auto mcParticle = track.template mcParticle_as(); + isPhysicalPrimary = mcParticle.isPhysicalPrimary(); + trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); + entryLcHadronGenInfo(isLcPrompt, isPhysicalPrimary, trackOrigin); + } else { + entryLcHadronGenInfo(isLcPrompt, false, 0); + registry.fill(HIST("hFakeTracksMcRec"), track.pt()); + } + // for secondary particle fraction estimation + registry.fill(HIST("hPtParticleAssocVsCandMcRec"), track.pt(), candidate.pt()); + if (isPhysicalPrimary) { + registry.fill(HIST("hPtPrimaryParticleAssocVsCandMcRec"), track.pt(), candidate.pt()); + } + entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); } } // end inner loop (Tracks) - } // end outer Lc loop + } // end outer Lc loop registry.fill(HIST("hZvtx"), collision.posZ()); - registry.fill(HIST("hMultT0M"), collision.multFT0M()); + registry.fill(HIST("hMultFT0M"), collision.multFT0M()); } PROCESS_SWITCH(HfCorrelatorLcHadrons, processMcRec, "Process Mc Reco mode", false); - /// Lc-Hadron correlation pair builder - for Mc gen-level analysis - void processMcGen(aod::McCollision const& mcCollision, - soa::Join const& mcParticles) + /// Lc-Hadron correlation pair builder - for Mc Gen-level analysis + void processMcGen(SelCollisionsWithLcMc::iterator const& mcCollision, + CandidatesLcMcGen const& mcParticles) { int counterLcHadron = 0; registry.fill(HIST("hMcEvtCount"), 0); - auto getTracksSize = [&mcParticles](aod::McCollision const& /*collision*/) { - int nTracks = 0; - for (const auto& track : mcParticles) { - if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { - nTracks++; - } - } - return nTracks; - }; - using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; - BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {binsZVtx, binsMultiplicityMc}, true}; + BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; + int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), mcCollision.multMCFT0A())); + registry.fill(HIST("hMultFT0AMcGen"), mcCollision.multMCFT0A()); + + bool isLcPrompt = false; + bool isLcNonPrompt = false; + + // find leading particle + if (correlateLcWithLeadingParticle) { + leadingIndex = findLeadingParticleMcGen(mcParticles, etaTrackMax.value, ptTrackMin.value); + } - // Mc gen level + // Mc Gen level for (const auto& particle : mcParticles) { if (std::abs(particle.pdgCode()) != Pdg::kLambdaCPlus) { continue; } - if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { - double yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); - if (yCandMax >= 0. && std::abs(yL) > yCandMax) { - continue; + if (!TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_3prong::DecayType::LcToPKPi)) { + continue; + } + double yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); + if (std::abs(yL) > yCandMax || particle.pt() < ptCandMin) { + continue; + } + registry.fill(HIST("hLcBin"), poolBin); + registry.fill(HIST("hPtCandMcGen"), particle.pt()); + registry.fill(HIST("hEtaMcGen"), particle.eta()); + registry.fill(HIST("hPhiMcGen"), RecoDecay::constrainAngle(particle.phi(), -PIHalf)); + registry.fill(HIST("hYMcGen"), yL); + + isLcPrompt = particle.originMcGen() == RecoDecay::OriginType::Prompt; + isLcNonPrompt = particle.originMcGen() == RecoDecay::OriginType::NonPrompt; + if (isLcPrompt) { + registry.fill(HIST("hPtCandMcGenPrompt"), particle.pt()); + } else if (isLcNonPrompt) { + registry.fill(HIST("hPtCandMcGenNonPrompt"), particle.pt()); + } + + // prompt and non-prompt division + std::vector listDaughters{}; + std::array arrDaughLcPDG = {kProton, -kKPlus, kPiPlus}; + std::array prongsId; + listDaughters.clear(); + RecoDecay::getDaughters(particle, &listDaughters, arrDaughLcPDG, 2); + int counterDaughters = 0; + if (listDaughters.size() == 3) { + for (const auto& dauIdx : listDaughters) { + auto daughI = mcParticles.rawIteratorAt(dauIdx - mcParticles.offset()); + counterDaughters += 1; + prongsId[counterDaughters - 1] = daughI.globalIndex(); } - if (ptCandMin >= 0. && particle.pt() < ptCandMin) { + } + counterLcHadron++; + // Lc Hadron correlation dedicated section + // if it's a Lc particle, search for Hadron and evalutate correlations + registry.fill(HIST("hcountLctriggersMcGen"), 0, particle.pt()); // to count trigger Lc for normalisation + for (const auto& particleAssoc : mcParticles) { + if (std::abs(particleAssoc.eta()) > etaTrackMax || particleAssoc.pt() < ptTrackMin || particleAssoc.pt() > ptTrackMax) { continue; } - registry.fill(HIST("hPtCandMcGen"), particle.pt()); - registry.fill(HIST("hEtaMcGen"), particle.eta()); - registry.fill(HIST("hPhiMcGen"), RecoDecay::constrainAngle(particle.phi(), -o2::constants::math::PIHalf)); - registry.fill(HIST("hYMcGen"), yL); - counterLcHadron++; - - for (const auto& particleAssoc : mcParticles) { - bool flagMotherFound = false; - for (const auto& m : particleAssoc.mothers_as()) { - if (m.globalIndex() == particle.globalIndex()) { - flagMotherFound = true; - break; - } - } - if (flagMotherFound) { - continue; - } - if (std::abs(particleAssoc.eta()) > etaTrackMax) { - continue; - } - if (particleAssoc.pt() < ptTrackMin) { + if (particleAssoc.globalIndex() == prongsId[0] || particleAssoc.globalIndex() == prongsId[1] || particleAssoc.globalIndex() == prongsId[2]) { + if (!storeAutoCorrelationFlag) { continue; } + correlationStatus = true; + } + + if ((std::abs(particleAssoc.pdgCode()) != kElectron) && (std::abs(particleAssoc.pdgCode()) != kMuonMinus) && (std::abs(particleAssoc.pdgCode()) != kPiPlus) && (std::abs(particle.pdgCode()) != kKPlus) && (std::abs(particleAssoc.pdgCode()) != kProton)) { + continue; + } + + if (pidTrkApplied && (std::abs(particleAssoc.pdgCode()) != kProton)) + continue; // proton PID + + if (!particleAssoc.isPhysicalPrimary()) { + continue; + } - if ((std::abs(particleAssoc.pdgCode()) != kElectron) && (std::abs(particleAssoc.pdgCode()) != kMuonMinus) && (std::abs(particleAssoc.pdgCode()) != kPiPlus) && (std::abs(particle.pdgCode()) != kKPlus) && (std::abs(particleAssoc.pdgCode()) != kProton)) { + if (correlateLcWithLeadingParticle) { + if (particleAssoc.globalIndex() != leadingIndex) { continue; } - int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), getTracksSize(mcCollision))); - registry.fill(HIST("hPtParticleAssocMcGen"), particleAssoc.pt()); - entryLcHadronPair(getDeltaPhi(particleAssoc.phi(), particle.phi()), - particleAssoc.eta() - particle.eta(), - particle.pt(), - particleAssoc.pt(), - poolBin); - entryLcHadronRecoInfo(MassLambdaCPlus, true); - } // end inner loop - } + } + + int8_t chargeLc = pdg->GetParticle(particle.pdgCode())->Charge(); // Retrieve charge + int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge + + int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, particleAssoc, true); + registry.fill(HIST("hPtParticleAssocMcGen"), particleAssoc.pt()); + entryLcHadronPair(getDeltaPhi(particleAssoc.phi(), particle.phi()), + particleAssoc.eta() - particle.eta(), + particle.pt() * chargeLc, + particleAssoc.pt() * chargeAssoc, + poolBin, + correlationStatus); + entryLcHadronRecoInfo(MassLambdaCPlus, true); + entryLcHadronGenInfo(isLcPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); + } // end inner loop } // end outer loop registry.fill(HIST("hCountLcHadronPerEvent"), counterLcHadron); registry.fill(HIST("hZvtx"), mcCollision.posZ()); - registry.fill(HIST("hMultiplicity"), getTracksSize(mcCollision)); } PROCESS_SWITCH(HfCorrelatorLcHadrons, processMcGen, "Process Mc Gen mode", false); - void processDataMixedEvent(SelectedCollisions const& collisions, - SelectedCandidatesData const& candidates, - SelectedTracks const& tracks) + void processDataMixedEvent(SelCollisionsWithLc const& collisions, + CandidatesLcData const& candidates, + TracksData const& tracks) { - if (candidates.size() == 0) { - return; - } auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, nEventForMixedEvent, -1, collisions, tracksTuple, &cache}; + Pair pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairData) { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (!TESTBIT(t1.hfflag(), aod::hf_cand_3prong::DecayType::LcToPKPi)) { + for (const auto& [trigLc, assocParticle] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (!assocParticle.isGlobalTrackWoDCA() || std::abs(hfHelper.yLc(trigLc)) > yCandMax) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yLc(t1)) > yCandMax) { - continue; + + if (pidTrkApplied) { + if (!passPIDSelection(assocParticle, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + continue; } + + auto trackPos1 = trigLc.template prong0_as(); // positive daughter (negative for the antiparticles) + int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + + std::vector outputMl = {-1., -1., -1.}; // LcToPKPi and LcToPiKP division - if (t1.isSelLcToPKPi() >= selectionFlagLc) { - entryLcHadronPair(getDeltaPhi(t1.phi(), t2.phi()), - t1.eta() - t2.eta(), - t1.pt(), - t2.pt(), - poolBin); - entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(t1), false); - } - if (t1.isSelLcToPiKP() >= selectionFlagLc) { - entryLcHadronPair(getDeltaPhi(t1.phi(), t2.phi()), - t1.eta() - t2.eta(), - t1.pt(), - t2.pt(), - poolBin); - entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(t1), false); + if (trigLc.isSelLcToPKPi() >= selectionFlagLc) { + entryLcHadronPair(getDeltaPhi(assocParticle.phi(), trigLc.phi()), + assocParticle.eta() - trigLc.eta(), + trigLc.pt() * chargeLc, + assocParticle.pt() * assocParticle.sign(), + poolBin, + correlationStatus); + entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(trigLc), false); + entryLcHadronGenInfo(false, false, 0); + if (fillTrkPID) { + entryLcHadronPairTrkPID(assocParticle.tpcNSigmaPr(), assocParticle.tpcNSigmaKa(), assocParticle.tpcNSigmaPi(), assocParticle.tofNSigmaPr(), assocParticle.tofNSigmaKa(), assocParticle.tofNSigmaPi()); + } + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = trigLc.mlProbLcToPKPi()[classMl->at(iclass)]; + } + entryLcHadronMlInfo(outputMl[0], outputMl[1]); + entryTrackRecoInfo(assocParticle.dcaXY(), assocParticle.dcaZ(), assocParticle.tpcNClsCrossedRows()); + } + if (trigLc.isSelLcToPiKP() >= selectionFlagLc) { + entryLcHadronPair(getDeltaPhi(assocParticle.phi(), trigLc.phi()), + assocParticle.eta() - trigLc.eta(), + trigLc.pt() * chargeLc, + assocParticle.pt() * assocParticle.sign(), + poolBin, + correlationStatus); + entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(trigLc), false); + entryLcHadronGenInfo(false, false, 0); + if (fillTrkPID) { + entryLcHadronPairTrkPID(assocParticle.tpcNSigmaPr(), assocParticle.tpcNSigmaKa(), assocParticle.tpcNSigmaPi(), assocParticle.tofNSigmaPr(), assocParticle.tofNSigmaKa(), assocParticle.tofNSigmaPi()); + } + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = trigLc.mlProbLcToPiKP()[classMl->at(iclass)]; + } + entryLcHadronMlInfo(outputMl[0], outputMl[1]); + entryTrackRecoInfo(assocParticle.dcaXY(), assocParticle.dcaZ(), assocParticle.tpcNClsCrossedRows()); } } } } PROCESS_SWITCH(HfCorrelatorLcHadrons, processDataMixedEvent, "Process Mixed Event Data", false); - void processMcRecMixedEvent(SelectedCollisions const& collisions, - SelectedCandidatesMcRec const& candidates, - SelectedTracks const& tracks) + void processMcRecMixedEvent(SelCollisionsWithLc const& collisions, + CandidatesLcMcRec const& candidates, + TracksWithMc const& tracks, + aod::McParticles const& mcParticles) { + BinningType corrBinning{{binsZVtx, binsMultiplicityMc}, true}; + for (const auto& candidate : candidates) { + if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + continue; + } + // Lc flag + bool isLcSignal = TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_3prong::DecayType::LcToPKPi); + // prompt and non-prompt division + bool isLcPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; + bool isLcNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; + if (isLcSignal) { + if (candidate.isSelLcToPKPi() >= selectionFlagLc) { + if (isLcPrompt) { + registry.fill(HIST("hPtCandMcRecSigPrompt"), candidate.pt()); + registry.fill(HIST("hPtVsMultiplicityMcRecPrompt"), candidate.pt(), 0); + } else if (isLcNonPrompt) { + registry.fill(HIST("hPtCandMcRecSigNonPrompt"), candidate.pt()); + registry.fill(HIST("hPtVsMultiplicityMcRecNonPrompt"), candidate.pt(), 0); + } + } + if (candidate.isSelLcToPiKP() >= selectionFlagLc) { + if (isLcPrompt) { + registry.fill(HIST("hPtCandMcRecSigPrompt"), candidate.pt()); + registry.fill(HIST("hPtVsMultiplicityMcRecPrompt"), candidate.pt(), 0); + } else if (isLcNonPrompt) { + registry.fill(HIST("hPtCandMcRecSigNonPrompt"), candidate.pt()); + registry.fill(HIST("hPtVsMultiplicityMcRecNonPrompt"), candidate.pt(), 0); + } + } + } else { + registry.fill(HIST("hPtCandMcRecBkg"), candidate.pt()); + registry.fill(HIST("hEtaMcRecBkg"), candidate.eta()); + registry.fill(HIST("hPhiMcRecBkg"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); + } + } auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairMcRec{corrBinning, nEventForMixedEvent, -1, collisions, tracksTuple, &cache}; + Pair pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (yCandMax >= 0. && std::abs(hfHelper.yLc(t1)) > yCandMax) { + int poolBinLc = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); + registry.fill(HIST("hMultFT0M"), c1.multFT0M()); + registry.fill(HIST("hZvtx"), c1.posZ()); + registry.fill(HIST("hTracksPoolBin"), poolBin); + registry.fill(HIST("hLcPoolBin"), poolBinLc); + for (const auto& [candidate, pAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } - if (t1.isSelLcToPKPi() >= selectionFlagLc) { - entryLcHadronPair(getDeltaPhi(t1.phi(), t2.phi()), - t1.eta() - t2.eta(), - t1.pt(), - t2.pt(), - poolBin); - entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(t1), false); - } - if (t1.isSelLcToPiKP() >= selectionFlagLc) { - entryLcHadronPair(getDeltaPhi(t1.phi(), t2.phi()), - t1.eta() - t2.eta(), - t1.pt(), - t2.pt(), - poolBin); - entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(t1), false); + if (!pAssoc.isGlobalTrackWoDCA()) { + continue; + } + std::vector outputMl = {-1., -1., -1.}; + bool isPhysicalPrimary = false; + int trackOrigin = -1; + bool isLcSignal = std::abs(candidate.flagMcMatchRec()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi; + bool isLcPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; + if (pidTrkApplied) { + if (!passPIDSelection(pAssoc, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + continue; + } + auto trackPos1 = candidate.template prong0_as(); // positive daughter (negative for the antiparticles) + int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + + if (pAssoc.has_mcParticle()) { + auto mcParticle = pAssoc.template mcParticle_as(); + isPhysicalPrimary = mcParticle.isPhysicalPrimary(); + trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); + } else { + registry.fill(HIST("hFakeTracksMcRec"), pAssoc.pt()); + } + if (candidate.isSelLcToPKPi() >= selectionFlagLc) { + entryLcHadronPair(getDeltaPhi(pAssoc.phi(), candidate.phi()), + pAssoc.eta() - candidate.eta(), + candidate.pt() * chargeLc, + pAssoc.pt() * pAssoc.sign(), + poolBin, + correlationStatus); + entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), isLcSignal); + entryLcHadronGenInfo(isLcPrompt, isPhysicalPrimary, trackOrigin); + if (fillTrkPID) { + entryLcHadronPairTrkPID(pAssoc.tpcNSigmaPr(), pAssoc.tpcNSigmaKa(), pAssoc.tpcNSigmaPi(), pAssoc.tofNSigmaPr(), pAssoc.tofNSigmaKa(), pAssoc.tofNSigmaPi()); + } + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; + } + entryLcHadronMlInfo(outputMl[0], outputMl[1]); + entryTrackRecoInfo(pAssoc.dcaXY(), pAssoc.dcaZ(), pAssoc.tpcNClsCrossedRows()); + } + if (candidate.isSelLcToPiKP() >= selectionFlagLc) { + entryLcHadronPair(getDeltaPhi(pAssoc.phi(), candidate.phi()), + pAssoc.eta() - candidate.eta(), + candidate.pt() * chargeLc, + pAssoc.pt() * pAssoc.sign(), + poolBin, + correlationStatus); + entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), isLcSignal); + entryLcHadronGenInfo(isLcPrompt, isPhysicalPrimary, trackOrigin); + if (fillTrkPID) { + entryLcHadronPairTrkPID(pAssoc.tpcNSigmaPr(), pAssoc.tpcNSigmaKa(), pAssoc.tpcNSigmaPi(), pAssoc.tofNSigmaPr(), pAssoc.tofNSigmaKa(), pAssoc.tofNSigmaPi()); + } + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; + } + entryLcHadronMlInfo(outputMl[0], outputMl[1]); + entryTrackRecoInfo(pAssoc.dcaXY(), pAssoc.dcaZ(), pAssoc.tpcNClsCrossedRows()); } } } } PROCESS_SWITCH(HfCorrelatorLcHadrons, processMcRecMixedEvent, "Process Mixed Event McRec", false); - void processMcGenMixedEvent(SelectedCollisionsMcGen const& collisions, - SelectedTracksMcGen const& mcParticles) + void processMcGenMixedEvent(SelCollisionsWithLcMc const& collisions, + CandidatesLcMcGen const& mcParticles) { - auto getTracksSize = [&mcParticles, this](SelectedCollisionsMcGen::iterator const& collision) { - int nTracks = 0; - auto associatedTracks = mcParticles.sliceByCached(o2::aod::mcparticle::mcCollisionId, collision.globalIndex(), this->cache); - for (const auto& track : associatedTracks) { - if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { - nTracks++; - } - } - return nTracks; - }; - - using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; - BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {binsZVtx, binsMultiplicityMc}, true}; - + BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pairMcGen{corrBinningMcGen, nEventForMixedEvent, -1, collisions, tracksTuple, &cache}; - + Pair pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcGen) { - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - // Check track t1 is Lc - if (std::abs(t1.pdgCode()) != Pdg::kLambdaCPlus) { + int poolBin = corrBinningMcGen.getBin(std::make_tuple(c1.posZ(), c1.multMCFT0A())); + for (const auto& [candidate, particleAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (std::abs(candidate.pdgCode()) != Pdg::kLambdaCPlus) { continue; } - - double yL = RecoDecay::y(t1.pVector(), MassLambdaCPlus); - if (yCandMax >= 0. && std::abs(yL) > yCandMax) { + double yL = RecoDecay::y(candidate.pVector(), MassLambdaCPlus); + if (std::abs(yL) > yCandGenMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } - if (ptCandMin >= 0. && t1.pt() < ptCandMin) { + if (std::abs(particleAssoc.eta()) > etaTrackMax || particleAssoc.pt() < ptTrackMin || particleAssoc.pt() > ptTrackMax) { continue; } - - if (std::abs(t2.eta()) > etaTrackMax) { + if ((std::abs(particleAssoc.pdgCode()) != kElectron) && (std::abs(particleAssoc.pdgCode()) != kMuonMinus) && (std::abs(particleAssoc.pdgCode()) != kPiPlus) && (std::abs(particleAssoc.pdgCode()) != kKPlus) && (std::abs(particleAssoc.pdgCode()) != kProton)) { continue; } - if (t2.pt() < ptTrackMin) { + if (!particleAssoc.isPhysicalPrimary()) { continue; } - int poolBin = corrBinningMcGen.getBin(std::make_tuple(c2.posZ(), getTracksSize(c2))); - entryLcHadronPair(getDeltaPhi(t1.phi(), t2.phi()), - t1.eta() - t2.eta(), - t1.pt(), - t2.pt(), - poolBin); + if (pidTrkApplied && (std::abs(particleAssoc.pdgCode()) != kProton)) { + continue; // proton PID + } + int8_t chargeLc = pdg->GetParticle(candidate.pdgCode())->Charge(); // Retrieve charge + int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge + + int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, particleAssoc, true); + bool isLcPrompt = candidate.originMcGen() == RecoDecay::OriginType::Prompt; + entryLcHadronPair(getDeltaPhi(particleAssoc.phi(), candidate.phi()), + particleAssoc.eta() - candidate.eta(), + candidate.pt() * chargeLc, + particleAssoc.pt() * chargeAssoc, + poolBin, + correlationStatus); + entryLcHadronRecoInfo(MassLambdaCPlus, true); + entryLcHadronGenInfo(isLcPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); } } } diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index e154e91854f..3ed86b564cf 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -12,7 +12,10 @@ /// \file femtoDreamProducer.cxx /// \brief Tasks that produces the track tables used for the pairing /// \author Ravindra Singh, GSI, ravindra.singh@cern.ch +/// \author Biao Zhang, Heidelberg University, biao.zhang@cern.ch +#include +#include #include "CCDB/BasicCCDBManager.h" #include "Common/Core/trackUtilities.h" @@ -37,11 +40,25 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Core/CentralityEstimation.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::femtoDream; +using namespace o2::hf_evsel; +using namespace o2::hf_centrality; + +// event types +enum Event : uint8_t { + kAll = 0, + kRejEveSel, + kRejNoTracksAndCharm, + kTrackSelected, + kCharmSelected, + kPairSelected +}; struct HfFemtoDreamProducer { @@ -67,19 +84,6 @@ struct HfFemtoDreamProducer { // Configurable isForceGRP{"isForceGRP", false, "Set true if the magnetic field configuration is not available in the usual CCDB directory (e.g. for Run 2 converted data or unanchorad Monte Carlo)"}; - /// Event selection - // Configurable evtZvtx{"evtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; - // Configurable evtTriggerCheck{"evtTriggerCheck", true, "Evt sel: check for trigger"}; - // Configurable evtTriggerSel{"evtTriggerSel", kINT7, "Evt sel: trigger"}; - // Configurable evtOfflineCheck{"evtOfflineCheck", false, "Evt sel: check for offline selection"}; - // Configurable evtAddOfflineCheck{"evtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"}; - - Configurable evtAddOfflineCheck{"evtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"}; - Configurable evtOfflineCheck{"evtOfflineCheck", false, "Evt sel: check for offline selection"}; - Configurable evtTriggerCheck{"evtTriggerCheck", true, "Evt sel: check for trigger"}; - Configurable evtTriggerSel{"evtTriggerSel", kINT7, "Evt sel: trigger"}; - Configurable evtZvtx{"evtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; - Configurable isDebug{"isDebug", true, "Enable Debug tables"}; Configurable isRun3{"isRun3", true, "Running on Run3 or pilot"}; @@ -112,14 +116,13 @@ struct HfFemtoDreamProducer { using FemtoFullCollisionMc = soa::Join::iterator; using FemtoFullMcgenCollisions = soa::Join; using FemtoFullMcgenCollision = FemtoFullMcgenCollisions::iterator; - using FemtoHFTracks = soa::Join; + using FemtoHFTracks = soa::Join; using FemtoHFTrack = FemtoHFTracks::iterator; using FemtoHFMcTracks = soa::Join; using FemtoHFMcTrack = FemtoHFMcTracks::iterator; using GeneratedMc = soa::Filtered>; - FemtoDreamCollisionSelection colCuts; FemtoDreamTrackSelection trackCuts; Filter filterSelectCandidateLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); @@ -128,6 +131,7 @@ struct HfFemtoDreamProducer { HistogramRegistry TrackRegistry{"Tracks", {}, OutputObjHandlingPolicy::AnalysisObject}; HfHelper hfHelper; + o2::hf_evsel::HfEventSelection hfEvSel; float magField; int runNumber; @@ -146,8 +150,21 @@ struct HfFemtoDreamProducer { int CutBits = 8 * sizeof(o2::aod::femtodreamparticle::cutContainerType); TrackRegistry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{CutBits + 1, -0.5, CutBits + 0.5}}); - colCuts.setCuts(evtZvtx.value, evtTriggerCheck.value, evtTriggerSel.value, evtOfflineCheck.value, evtAddOfflineCheck.value, isRun3.value); - colCuts.init(&qaRegistry); + // event QA histograms + constexpr int kEventTypes = kPairSelected + 1; + std::string labels[kEventTypes]; + labels[Event::kAll] = "All events"; + labels[Event::kRejEveSel] = "rejected by event selection"; + labels[Event::kRejNoTracksAndCharm] = "rejected by no tracks and charm"; + labels[Event::kTrackSelected] = "with tracks "; + labels[Event::kCharmSelected] = "with charm hadrons "; + labels[Event::kPairSelected] = "with pairs"; + + static const AxisSpec axisEvents = {kEventTypes, 0.5, kEventTypes + 0.5, ""}; + qaRegistry.add("hEventQA", "Events;;entries", HistType::kTH1F, {axisEvents}); + for (int iBin = 0; iBin < kEventTypes; iBin++) { + qaRegistry.get(HIST("hEventQA"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); + } trackCuts.setSelection(trkCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); trackCuts.setSelection(trkPtmin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); @@ -173,6 +190,8 @@ struct HfFemtoDreamProducer { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); + hfEvSel.addHistograms(qaRegistry); // collision monitoring + int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); ccdb->setCreatedNotAfter(now); } @@ -197,13 +216,21 @@ struct HfFemtoDreamProducer { particle.dcaXY(), particle.dcaZ(), particle.tpcSignal(), + -999., particle.tpcNSigmaPi(), particle.tpcNSigmaKa(), particle.tpcNSigmaPr(), + particle.tpcNSigmaDe(), + -999., + -999., + -999., particle.tofNSigmaPi(), particle.tofNSigmaKa(), particle.tofNSigmaPr(), - -999., -999., -999., -999., -999., -999., -999., -999., -999., -999.); + particle.tofNSigmaDe(), + -999., + -999., + -999., -999., -999., -999., -999., -999.); } template @@ -325,8 +352,7 @@ struct HfFemtoDreamProducer { { const auto vtxZ = col.posZ(); const auto sizeCand = candidates.size(); - - const auto spher = colCuts.computeSphericity(col, tracks); + const auto spher = 2.; // dummy value for the moment float mult = 0; int multNtr = 0; if (isRun3) { @@ -341,15 +367,20 @@ struct HfFemtoDreamProducer { multNtr = col.multTracklets(); } - colCuts.fillQA(col, mult); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry); + + qaRegistry.fill(HIST("hEventQA"), 1 + Event::kAll); - // check whether the basic event selection criteria are fulfilled - // that included checking if there is at least on usable track or V0 - if (!colCuts.isSelectedCollision(col)) { + /// monitor the satisfied event selections + hfEvSel.fillHistograms(col, rejectionMask, mult); + if (rejectionMask != 0) { + /// at least one event selection not satisfied --> reject the candidate + qaRegistry.fill(HIST("hEventQA"), 1 + Event::kRejEveSel); return; } - if (colCuts.isEmptyCollision(col, tracks, trackCuts)) { + if (isNoSelectedTracks(col, tracks, trackCuts) && sizeCand <= 0) { + qaRegistry.fill(HIST("hEventQA"), 1 + Event::kRejNoTracksAndCharm); return; } @@ -427,18 +458,39 @@ struct HfFemtoDreamProducer { aod::femtodreamcollision::BitMaskType bitTrack = 0; if (isTrackFilled) { bitTrack |= 1 << 0; + qaRegistry.fill(HIST("hEventQA"), 1 + Event::kTrackSelected); } aod::femtodreamcollision::BitMaskType bitCand = 0; if (sizeCand > 0) { bitCand |= 1 << 0; + qaRegistry.fill(HIST("hEventQA"), 1 + Event::kCharmSelected); } + if (isTrackFilled && (sizeCand > 0)) + qaRegistry.fill(HIST("hEventQA"), 1 + Event::kPairSelected); + rowMasks(static_cast(bitTrack), static_cast(bitCand), 0); } + // check if there is no selected track + /// \param C type of the collision + /// \param T type of the tracks + /// \param TC type of the femto track cuts + /// \return whether or not the tracks fulfills the all selections + template + bool isNoSelectedTracks(C const& /*col*/, T const& tracks, TC& trackCuts) + { + for (auto const& track : tracks) { + if (trackCuts.isSelectedMinimal(track)) { + return false; + } + } + return true; + } + template void fillCharmHadMcGen(ParticleType particles) { diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index 590c92f1208..f421bd35ff3 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -15,6 +15,7 @@ /// \author Biao Zhang, Heidelberg University, biao.zhang@cern.ch #include +#include #include "Framework/Expressions.h" #include "Framework/AnalysisTask.h" @@ -57,19 +58,27 @@ struct HfTaskCharmHadronsFemtoDream { ConfigurableAxis bin4DMult{"bin4Dmult", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "multiplicity Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; ConfigurableAxis bin4DmT{"bin4DmT", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; ConfigurableAxis bin4DmultPercentile{"bin4DmultPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; - ConfigurableAxis binInvMass{"binInvMass", {300, 2.15, 2.45}, "InvMass binning"}; + ConfigurableAxis binInvMass{"binInvMass", {400, 2.10, 2.50}, "InvMass binning"}; + ConfigurableAxis binpTCharm{"binpTCharm", {360, 0, 36}, "pT binning of charm hadron"}; ConfigurableAxis binTempFitVarTrack{"binTempFitVarTrack", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (Track)"}; ConfigurableAxis binmT{"binmT", {225, 0., 7.5}, "binning mT"}; ConfigurableAxis binmultTempFit{"binmultTempFit", {1, 0, 1}, "multiplicity Binning for the TempFitVar plot"}; - ConfigurableAxis binpT{"binpT", {20, 0.5, 4.05}, "pT binning"}; + ConfigurableAxis binMulPercentile{"binMulPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning"}; ConfigurableAxis binpTTrack{"binpTTrack", {50, 0.5, 10.05}, "pT binning of the pT vs. TempFitVar plot (Track)"}; + ConfigurableAxis binEta{"binEta", {{200, -1.5, 1.5}}, "eta binning"}; + ConfigurableAxis binPhi{"binPhi", {{200, 0, TMath::TwoPi()}}, "phi binning"}; ConfigurableAxis binkT{"binkT", {150, 0., 9.}, "binning kT"}; ConfigurableAxis binkstar{"binkstar", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis binNSigmaTPC{"binNSigmaTPC", {1600, -8, 8}, "Binning of Nsigma TPC plot"}; + ConfigurableAxis binNSigmaTOF{"binNSigmaTOF", {3000, -15, 15}, "Binning of the Nsigma TOF plot"}; + ConfigurableAxis binNSigmaTPCTOF{"binNSigmaTPCTOF", {3000, -15, 15}, "Binning of the Nsigma TPC+TOF plot"}; + ConfigurableAxis binTPCClusters{"binTPCClusters", {163, -0.5, 162.5}, "Binning of TPC found clusters plot"}; + Configurable ConfTempFitVarMomentum{"ConfTempFitVarMomentum", 0, "Momentum used for binning: 0 -> pt; 1 -> preco; 2 -> ptpc"}; /// Particle 2 (Charm Hadrons) Configurable charmHadBkgBDTmax{"charmHadBkgBDTmax", 1., "Maximum background bdt score for Charm Hadron (particle 2)"}; - Configurable charmHadCandSel{"charmHadCandSel", 1, "candidate selection for charm hadron"}; - Configurable charmHadMcSel{"charmHadMcSel", 2, "charm hadron selection for mc, partDplusToPiKPi (1), partLcToPKPi (2), partDsToKKPi (4), partXicToPKPi (8)"}; + Configurable charmHadCandSel{"charmHadCandSel", 1, "candidate selection for charm hadron"}; + Configurable charmHadMcSel{"charmHadMcSel", 2, "charm hadron selection for mc, partDplusToPiKPi (1), partLcToPKPi (2), partDsToKKPi (4), partXicToPKPi (8)"}; Configurable charmHadFdBDTmin{"charmHadFdBDTmin", 0., "Minimum feed-down bdt score Charm Hadron (particle 2)"}; Configurable charmHadFdBDTmax{"charmHadFdBDTmax", 1., "Maximum feed-down bdt score Charm Hadron (particle 2)"}; Configurable charmHadMaxInvMass{"charmHadMaxInvMass", 2.45, "Maximum invariant mass of Charm Hadron (particle 2)"}; @@ -130,8 +139,8 @@ struct HfTaskCharmHadronsFemtoDream { FemtoDreamDetaDphiStar pairCloseRejectionME; Filter eventMultiplicity = aod::femtodreamcollision::multNtr >= eventSel.multMin && aod::femtodreamcollision::multNtr <= eventSel.multMax; Filter eventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= eventSel.multPercentileMin && aod::femtodreamcollision::multV0M <= eventSel.multPercentileMax; - Filter hfCandSelFilter = aod::fdhf::candidateSelFlag >= charmHadCandSel.value; - Filter hfMcSelFilter = nabs(aod::fdhf::flagMc) == charmHadMcSel.value; + Filter hfCandSelFilter = aod::fdhf::candidateSelFlag >= static_cast(charmHadCandSel.value); + Filter hfMcSelFilter = nabs(aod::fdhf::flagMc) == static_cast(charmHadMcSel.value); Filter trackEtaFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::eta < etaTrack1Max, true); Filter trackEtaFilterUp = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::eta > etaTrack1Min, true); Filter trackPtFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::pt < ptTrack1Max, true); @@ -149,24 +158,27 @@ struct HfTaskCharmHadronsFemtoDream { using FilteredMcColisions = soa::Filtered>; using FilteredMcColision = FilteredMcColisions::iterator; - using FilteredFDMcParts = soa::Filtered>; + using FilteredFDMcParts = soa::Filtered>; using FilteredFDMcPart = FilteredFDMcParts::iterator; - using FilteredFDParticles = soa::Filtered>; + using FilteredFDParticles = soa::Filtered>; using FilteredFDParticle = FilteredFDParticles::iterator; femtodreamcollision::BitMaskType BitMask = 1 << 0; /// Histogramming for particle 1 - FemtoDreamParticleHisto trackHistoPartOne; + FemtoDreamParticleHisto allTrackHisto; + FemtoDreamParticleHisto selectedTrackHisto; + /// Histogramming for Event FemtoDreamEventHisto eventHisto; /// Histogram output HistogramRegistry registry{"CorrelationsAndQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry registryMixQa{"registryMixQa"}; + HistogramRegistry registryCharmHadronQa{"registryCharmHadronQa"}; /// Partition for particle 1 - Partition partitionTrk1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)); + Partition partitionTrk1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && (ncheckbit(aod::femtodreamparticle::cut, cutBitTrack1)) && ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= pidThresTrack1, ncheckbit(aod::femtodreamparticle::pidcut, tpcBitTrack1), ncheckbit(aod::femtodreamparticle::pidcut, tpcTofBitTrack1)); Partition partitionMcTrk1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && (ncheckbit(aod::femtodreamparticle::cut, cutBitTrack1)) && @@ -187,11 +199,16 @@ struct HfTaskCharmHadronsFemtoDream { void init(InitContext& /*context*/) { + // setup columnpolicy for binning + colBinningMult = {{mixingBinVztx, mixingBinMult}, true}; + colBinningMultPercentile = {{mixingBinVztx, mixingBinMultPercentile}, true}; + colBinningMultMultPercentile = {{mixingBinVztx, mixingBinMult, mixingBinMultPercentile}, true}; eventHisto.init(®istry); - trackHistoPartOne.init(®istry, binmultTempFit, dummy, binpTTrack, dummy, dummy, binTempFitVarTrack, dummy, dummy, dummy, dummy, dummy, isMc, pdgCodeTrack1); + allTrackHisto.init(®istry, binmultTempFit, binMulPercentile, binpTTrack, binEta, binPhi, binTempFitVarTrack, binNSigmaTPC, binNSigmaTOF, binNSigmaTPCTOF, binTPCClusters, dummy, isMc, pdgCodeTrack1, true); + selectedTrackHisto.init(®istry, binmultTempFit, binMulPercentile, binpTTrack, binEta, binPhi, binTempFitVarTrack, binNSigmaTPC, binNSigmaTOF, binNSigmaTPCTOF, binTPCClusters, dummy, isMc, pdgCodeTrack1, true); sameEventCont.init(®istry, - binkstar, binpT, binkT, binmT, mixingBinMult, mixingBinMultPercentile, + binkstar, binpTTrack, binkT, binmT, mixingBinMult, mixingBinMultPercentile, bin4Dkstar, bin4DmT, bin4DMult, bin4DmultPercentile, isMc, use4D, extendedPlots, highkstarCut, @@ -199,16 +216,18 @@ struct HfTaskCharmHadronsFemtoDream { sameEventCont.setPDGCodes(pdgCodeTrack1, charmHadPDGCode); mixedEventCont.init(®istry, - binkstar, binpT, binkT, binmT, mixingBinMult, mixingBinMultPercentile, + binkstar, binpTTrack, binkT, binmT, mixingBinMult, mixingBinMultPercentile, bin4Dkstar, bin4DmT, bin4DMult, bin4DmultPercentile, isMc, use4D, extendedPlots, highkstarCut, smearingByOrigin, binInvMass); mixedEventCont.setPDGCodes(pdgCodeTrack1, charmHadPDGCode); - registryMixQa.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - registryMixQa.add("MixingQA/hSECollisionPool", ";bin;Entries", kTH2F, {{100, -10, 10}, {2000, 0, 200}}); - registryMixQa.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + registryMixQa.add("MixingQA/hSECollisionBins", "; bin; Entries", kTH1F, {{120, -0.5, 119.5}}); + registryMixQa.add("MixingQA/hSECollisionPool", "; Vz (cm); Mul", kTH2F, {{100, -10, 10}, {200, 0, 200}}); + registryMixQa.add("MixingQA/hMECollisionBins", "; bin; Entries", kTH1F, {{120, -0.5, 119.5}}); + registryCharmHadronQa.add("CharmHadronQA/hPtVsMass", "; #it{p}_{T} (GeV/#it{c}); inv. mass (GeV/#it{c}^{2})", kTH2F, {binpTCharm, binInvMass}); + pairCleaner.init(®istry); if (useCPR.value) { pairCloseRejectionSE.init(®istry, ®istry, cprDeltaPhiMax.value, cprDeltaEtaMax.value, cprPlotPerRadii.value, 1); @@ -230,11 +249,6 @@ struct HfTaskCharmHadronsFemtoDream { fillCollision(col); processType = 1; // for same event - /// Histogramming same event - for (auto const& part : sliceTrk1) { - - trackHistoPartOne.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); - } for (auto const& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceTrk1, sliceCharmHad))) { @@ -291,6 +305,8 @@ struct HfTaskCharmHadronsFemtoDream { if (p2.pt() < charmHadMinPt || p2.pt() > charmHadMaxPt) { continue; } + /// Filling QA histograms of the selected tracks + selectedTrackHisto.fillQA(p1, static_cast(ConfTempFitVarMomentum.value), col.multNtr(), col.multV0M()); int charmHadMc = 0; int originType = 0; @@ -340,7 +356,6 @@ struct HfTaskCharmHadronsFemtoDream { } const int multiplicityCol = collision1.multNtr(); - registryMixQa.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), multiplicityCol})); auto sliceTrk1 = part1->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); @@ -415,12 +430,26 @@ struct HfTaskCharmHadronsFemtoDream { FilteredFDParticles const& parts, FilteredCharmCands const&) { - if ((col.bitmaskTrackOne() & BitMask) != BitMask || (col.bitmaskTrackTwo() & BitMask) != BitMask) { - return; - } eventHisto.fillQA(col); auto sliceTrk1 = partitionTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto sliceCharmHad = partitionCharmHadron->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + /// Filling QA histograms of the all tracks and all charm hadrons before pairing + for (auto const& part : sliceTrk1) { + allTrackHisto.fillQA(part, static_cast(ConfTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + } + for (auto const& part : sliceCharmHad) { + float invMass; + if (part.candidateSelFlag() == 1) { + invMass = part.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); + } else { + invMass = part.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); + } + registryCharmHadronQa.fill(HIST("CharmHadronQA/hPtVsMass"), part.pt(), invMass); + } + + if ((col.bitmaskTrackOne() & BitMask) != BitMask || (col.bitmaskTrackTwo() & BitMask) != BitMask) { + return; + } doSameEvent(sliceTrk1, sliceCharmHad, parts, col); } PROCESS_SWITCH(HfTaskCharmHadronsFemtoDream, processSameEvent, "Enable processing same event", false); @@ -452,17 +481,25 @@ struct HfTaskCharmHadronsFemtoDream { void processSameEventMc(FilteredMcColision const& col, FilteredFDMcParts const& parts, o2::aod::FDMCParticles const&, + o2::aod::FDExtMCParticles const&, FilteredCharmMcCands const&) { - if ((col.bitmaskTrackOne() & BitMask) != BitMask || (col.bitmaskTrackTwo() & BitMask) != BitMask) { - return; - } + eventHisto.fillQA(col); + auto sliceMcTrk1 = partitionMcTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto sliceMcCharmHad = partitionMcCharmHadron->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); if (sliceMcTrk1.size() == 0 && sliceMcCharmHad.size() == 0) { return; } + /// Filling QA histograms of the all mc tracks before pairing + for (auto const& part : sliceMcTrk1) { + allTrackHisto.fillQA(part, static_cast(ConfTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + } + + if ((col.bitmaskTrackOne() & BitMask) != BitMask || (col.bitmaskTrackTwo() & BitMask) != BitMask) { + return; + } doSameEvent(sliceMcTrk1, sliceMcCharmHad, parts, col); } PROCESS_SWITCH(HfTaskCharmHadronsFemtoDream, processSameEventMc, "Enable processing same event for Monte Carlo", false); @@ -474,6 +511,7 @@ struct HfTaskCharmHadronsFemtoDream { void processMixedEventMc(FilteredMcColisions const& cols, FilteredFDMcParts const& parts, o2::aod::FDMCParticles const&, + o2::aod::FDExtMCParticles const&, FilteredCharmMcCands const&) { switch (mixingBinPolicy.value) { diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index 23411030dfc..2654984c45a 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -16,6 +16,8 @@ /// \author Samrangy Sadhu , INFN Bari /// \author Swapnesh Santosh Khade , IIT Indore +#include + #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" @@ -24,15 +26,18 @@ #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" +#include "PWGHF/HFC/Utils/utilsCorrelations.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod::hf_correlation_d0_hadron; +using namespace o2::analysis::hf_correlations; namespace o2::aod { -using DHadronPairFull = soa::Join; +using D0HadronPairFull = soa::Join; +using D0HadronPairFullMl = soa::Join; } // namespace o2::aod // string definitions, used for histogram axis labels @@ -54,6 +59,8 @@ AxisSpec axisPtHadron = {11, 0., 11., ""}; AxisSpec axisPoolBin = {9, 0., 9., ""}; AxisSpec axisCorrelationState = {2, 0., 2., ""}; ConfigurableAxis axisMass{"axisMass", {250, 1.65f, 2.15f}, ""}; +ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"}; +AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; // definition of vectors for standard ptbin and invariant mass configurables const int nPtBinsCorrelations = 12; @@ -79,9 +86,14 @@ const double ptHadronMax = 10.0; struct HfTaskCorrelationD0Hadrons { // pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_to_pi_k (i.e. the mass pT bins), but can be redefined via json files - Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{vecPtBinsCorrelations}, "pT bin limits for correlation plots"}; + Configurable> binsCorrelations{"binsCorrelations", std::vector{vecPtBinsCorrelations}, "pT bin limits for correlation plots"}; // pT bins for effiencies: same as above - Configurable> binsEfficiency{"ptBinsForEfficiency", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for efficiency"}; + Configurable> binsEfficiency{"binsEfficiency", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for efficiency"}; + Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; + Configurable> mlOutputPromptD0{"mlOutputPromptD0", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for prompt"}; + Configurable> mlOutputBkgD0{"mlOutputBkgD0", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for bkg"}; + Configurable> mlOutputPromptD0bar{"mlOutputPromptD0bar", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for prompt"}; + Configurable> mlOutputBkgD0bar{"mlOutputBkgD0bar", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for bkg"}; // signal and sideband region edges, to be defined via json file (initialised to empty) Configurable> signalRegionLeft{"signalRegionLeft", std::vector{vecsignalRegionLeft}, "Inner values of signal region vs pT"}; Configurable> signalRegionRight{"signalRegionRight", std::vector{vecsignalRegionRight}, "Outer values of signal region vs pT"}; @@ -92,14 +104,7 @@ struct HfTaskCorrelationD0Hadrons { Configurable> efficiencyDmeson{"efficiencyDmeson", std::vector{vecEfficiencyDmeson}, "Efficiency values for D meson specie under study"}; Configurable isTowardTransverseAway{"isTowardTransverseAway", false, "Divide into three regions: toward, transverse, and away"}; Configurable leadingParticlePtMin{"leadingParticlePtMin", 0., "Min for leading particle pt"}; - Configurable applyEfficiency{"efficiencyFlagD", 1, "Flag for applying efficiency weights"}; - - enum Region { - Default = 0, // 默认值 - Toward, - Away, - Transverse - }; + Configurable applyEfficiency{"applyEfficiency", 1, "Flag for applying efficiency weights"}; HistogramRegistry registry{ "registry", @@ -194,6 +199,10 @@ struct HfTaskCorrelationD0Hadrons { { int nBinsPtAxis = binsCorrelations->size() - 1; const double* valuesPtAxis = binsCorrelations->data(); + registry.add("hBdtScorePromptD0", "D0 BDT prompt score", {HistType::kTH1F, {axisBdtScore}}); + registry.add("hBdtScoreBkgD0", "D0 BDT bkg score", {HistType::kTH1F, {axisBdtScore}}); + registry.add("hBdtScorePromptD0bar", "D0bar BDT prompt score", {HistType::kTH1F, {axisBdtScore}}); + registry.add("hBdtScoreBkgD0bar", "D0bar BDT bkg score", {HistType::kTH1F, {axisBdtScore}}); registry.get(HIST("hCorrel2DVsPtSignalRegion"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); registry.get(HIST("hCorrel2DVsPtSidebands"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); registry.get(HIST("hCorrel2DVsPtSignalRegion"))->Sumw2(); @@ -234,20 +243,28 @@ struct HfTaskCorrelationD0Hadrons { registry.get(HIST("hCorrel2DVsPtGen"))->Sumw2(); } - Region getRegion(double deltaPhi) - { - if (std::abs(deltaPhi) < o2::constants::math::PI / 3.) { - return Toward; - } else if (deltaPhi > 2. * o2::constants::math::PI / 3. && deltaPhi < 4. * o2::constants::math::PI / 3.) { - return Away; - } else { - return Transverse; - } - } /// D-h correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) /// Works on both USL and LS analyses pair tables - void processData(aod::DHadronPairFull const& pairEntries) + void processData(aod::D0HadronPairFullMl const& pairEntries, + aod::D0CandRecoInfo const& candidates) { + for (const auto& candidate : candidates) { + float ptD = candidate.ptD(); + float bdtScorePromptD0 = candidate.mlScorePromptD0(); + float bdtScoreBkgD0 = candidate.mlScoreBkgD0(); + float bdtScorePromptD0bar = candidate.mlScorePromptD0bar(); + float bdtScoreBkgD0bar = candidate.mlScoreBkgD0bar(); + int effBinD = o2::analysis::findBin(binsEfficiency, ptD); + if (bdtScorePromptD0 < mlOutputPromptD0->at(effBinD) || bdtScoreBkgD0 > mlOutputBkgD0->at(effBinD) || + bdtScorePromptD0bar < mlOutputPromptD0bar->at(effBinD) || bdtScoreBkgD0bar > mlOutputBkgD0bar->at(effBinD)) { + continue; + } + registry.fill(HIST("hBdtScorePromptD0"), bdtScorePromptD0); + registry.fill(HIST("hBdtScoreBkgD0"), bdtScoreBkgD0); + registry.fill(HIST("hBdtScorePromptD0bar"), bdtScorePromptD0bar); + registry.fill(HIST("hBdtScoreBkgD0bar"), bdtScoreBkgD0bar); + } + for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities double deltaPhi = pairEntry.deltaPhi(); @@ -261,6 +278,10 @@ struct HfTaskCorrelationD0Hadrons { int ptBinD = o2::analysis::findBin(binsCorrelations, ptD); int poolBin = pairEntry.poolBin(); bool isAutoCorrelated = pairEntry.isAutoCorrelated(); + float bdtScorePromptD0 = pairEntry.mlScorePromptD0(); + float bdtScoreBkgD0 = pairEntry.mlScoreBkgD0(); + float bdtScorePromptD0bar = pairEntry.mlScorePromptD0bar(); + float bdtScoreBkgD0bar = pairEntry.mlScoreBkgD0bar(); // reject entries outside pT ranges of interest if (ptBinD < 0 || effBinD < 0) { continue; @@ -268,7 +289,10 @@ struct HfTaskCorrelationD0Hadrons { if (ptHadron > ptHadronMax) { ptHadron = ptHadronMax + 0.5; } - + if (bdtScorePromptD0 < mlOutputPromptD0->at(ptBinD) || bdtScoreBkgD0 > mlOutputBkgD0->at(ptBinD) || + bdtScorePromptD0bar < mlOutputPromptD0bar->at(ptBinD) || bdtScoreBkgD0bar > mlOutputBkgD0bar->at(ptBinD)) { + continue; + } double efficiencyWeight = 1.; if (applyEfficiency) { efficiencyWeight = 1. / (efficiencyDmeson->at(o2::analysis::findBin(binsEfficiency, ptD))); // ***** track efficiency to be implemented ***** @@ -284,35 +308,19 @@ struct HfTaskCorrelationD0Hadrons { continue; } Region region = getRegion(deltaPhi); - if (signalStatus == ParticleTypeData::D0Only || signalStatus == ParticleTypeData::D0D0barBoth) { - switch (region) { - case Toward: - registry.fill(HIST("hToward"), massD, ptD, isAutoCorrelated, efficiencyWeight); - break; - case Away: - registry.fill(HIST("hAway"), massD, ptD, isAutoCorrelated, efficiencyWeight); - break; - case Transverse: - registry.fill(HIST("hTransverse"), massD, ptD, isAutoCorrelated, efficiencyWeight); - break; - default: - break; - } - } - if (signalStatus == ParticleTypeData::D0barOnly || signalStatus == ParticleTypeData::D0D0barBoth) { - switch (region) { - case Toward: - registry.fill(HIST("hToward"), massD, ptD, isAutoCorrelated, efficiencyWeight); - break; - case Away: - registry.fill(HIST("hAway"), massD, ptD, isAutoCorrelated, efficiencyWeight); - break; - case Transverse: - registry.fill(HIST("hTransverse"), massD, ptD, isAutoCorrelated, efficiencyWeight); - break; - default: - break; - } + + switch (region) { + case Toward: + registry.fill(HIST("hToward"), massD, ptD, isAutoCorrelated, efficiencyWeight); + break; + case Away: + registry.fill(HIST("hAway"), massD, ptD, isAutoCorrelated, efficiencyWeight); + break; + case Transverse: + registry.fill(HIST("hTransverse"), massD, ptD, isAutoCorrelated, efficiencyWeight); + break; + default: + break; } } // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots @@ -391,7 +399,7 @@ struct HfTaskCorrelationD0Hadrons { } PROCESS_SWITCH(HfTaskCorrelationD0Hadrons, processData, "Process data", false); - void processMcRec(aod::DHadronPairFull const& pairEntries) + void processMcRec(aod::D0HadronPairFull const& pairEntries) { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities @@ -609,7 +617,7 @@ struct HfTaskCorrelationD0Hadrons { PROCESS_SWITCH(HfTaskCorrelationD0Hadrons, processMcRec, "Process MC Reco mode", true); /// D-Hadron correlation pair filling task, from pair tables - for MC gen-level analysis (no filter/selection, only true signal) - void processMcGen(aod::DHadronPairFull const& pairEntries) + void processMcGen(aod::D0HadronPairFull const& pairEntries) { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities diff --git a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx index 7bbcc0dbcd2..a196c6fb9a8 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx @@ -11,7 +11,9 @@ /// \file taskCorrelationDplusHadrons.cxx /// \author Shyam Kumar - +#include // std::shared_ptr +#include +#include #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -162,6 +164,7 @@ struct HfTaskCorrelationDplusHadrons { registry.add("hBdtScorePrompt", "D+ BDT prompt score", {HistType::kTH1F, {axisBdtScore}}); registry.add("hBdtScoreBkg", "D+ BDT bkg score", {HistType::kTH1F, {axisBdtScore}}); registry.add("hMassDplusVsPt", "D+ candidates massVsPt", {HistType::kTH2F, {{axisMassD}, {axisPtD}}}); + registry.add("hMassDplusVsPtWoEff", "D+ candidates massVsPt without efficiency", {HistType::kTH2F, {{axisMassD}, {axisPtD}}}); if (fillHistoData) { registry.add("hDeltaEtaPtIntSignalRegion", stringDHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); registry.add("hDeltaPhiPtIntSignalRegion", stringDHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); @@ -313,6 +316,7 @@ struct HfTaskCorrelationDplusHadrons { } } registry.fill(HIST("hMassDplusVsPt"), massD, ptD, efficiencyWeightD); + registry.fill(HIST("hMassDplusVsPtWoEff"), massD, ptD); registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); } @@ -410,6 +414,7 @@ struct HfTaskCorrelationDplusHadrons { efficiencyWeightD = 1. / mEfficiencyPrompt->GetBinContent(mEfficiencyPrompt->FindBin(ptD)); } registry.fill(HIST("hMassDplusVsPt"), massD, ptD, efficiencyWeightD); + registry.fill(HIST("hMassDplusVsPtWoEff"), massD, ptD); registry.fill(HIST("hMassPromptDplusVsPt"), massD, ptD, efficiencyWeightD); registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); @@ -419,6 +424,7 @@ struct HfTaskCorrelationDplusHadrons { efficiencyWeightD = 1. / mEfficiencyFD->GetBinContent(mEfficiencyFD->FindBin(ptD)); } registry.fill(HIST("hMassDplusVsPt"), massD, ptD, efficiencyWeightD); + registry.fill(HIST("hMassDplusVsPtWoEff"), massD, ptD); registry.fill(HIST("hMassNonPromptDplusVsPt"), massD, ptD, efficiencyWeightD); registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); diff --git a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx index 889ded1486e..ede013d1f22 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx @@ -14,53 +14,45 @@ /// \author Marianna Mazzilli /// \author Zhen Zhang +#include // std::shared_ptr +#include +#include +#include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" +#include "PWGHF/HFC/Utils/utilsCorrelations.h" using namespace o2; +using namespace o2::constants::math; +using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; - -/// -/// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies -/// -double getDeltaPhi(double phiLc, double phiHadron) -{ - return RecoDecay::constrainAngle(phiHadron - phiLc, -o2::constants::math::PIHalf); -} - -/// -/// Returns phi of candidate/particle evaluated from x and y components of segment connecting primary and secondary vertices -/// -double evaluatePhiByVertex(double xVertex1, double xVertex2, double yVertex1, double yVertex2) -{ - return RecoDecay::phi(xVertex2 - xVertex1, yVertex2 - yVertex1); -} +using namespace o2::analysis::hf_correlations; // string definitions, used for histogram axis labels const TString stringPtLc = "#it{p}_{T}^{#Lambda_c} (GeV/#it{c});"; const TString stringPtHadron = "#it{p}_{T}^{Hadron} (GeV/#it{c});"; -const TString stringPoolBin = "poolBin;"; +const TString stringSign = "pairSign;"; +const TString stringMass = "M_{pK#pi} (GeV/#it{c^2});"; const TString stringDeltaEta = "#it{#eta}^{Hadron}-#it{#eta}^{#Lambda_c};"; const TString stringDeltaPhi = "#it{#varphi}^{Hadron}-#it{#varphi}^{#Lambda_c} (rad);"; const TString stringLcHadron = "#Lambda_c,Hadron candidates "; const TString stringSignal = "signal region;"; +const TString stringSignMass = "sign and invMass;"; const TString stringSideband = "sidebands;"; -const TString stringMcParticles = "Mc gen - #Lambda_c,Hadron particles;"; -const TString stringMcReco = "Mc reco - #Lambda_c,Hadron candidates "; - -// histogram axes definition -AxisSpec axisDeltaEta = {100, -2., 2.}; -AxisSpec axisDeltaPhi = {64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}; -AxisSpec axisPtLc = {10, 0., 10.}; -AxisSpec axisPtHadron = {11, 0., 11.}; -AxisSpec axisPoolBin = {9, 0., 9.}; +const TString stringMcParticles = "MC gen - #Lambda_c,Hadron particles;"; +const TString stringMcReco = "MC reco - #Lambda_c,Hadron candidates "; +const TString stringMcRecoLcPrompt = "MC reco, prompt #Lambda_c;"; +const TString stringMcGenLcPrompt = "MC gen, prompt #Lambda_c;"; +const TString stringMcRecoLcFd = "MC reco, non-prompt #Lambda_c;"; +const TString stringMcGenLcFd = "MC gen, non-prompt #Lambda_c;"; // definition of vectors for standard ptbin and invariant mass configurables const int nPtBinsCorrelations = 8; @@ -78,16 +70,28 @@ auto vecSidebandLeftInner = std::vector{sidebandLeftInnerDefault, sideba auto vecSidebandLeftOuter = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + nPtBinsCorrelations}; auto vecSidebandRightInner = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nPtBinsCorrelations}; auto vecSidebandRightOuter = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nPtBinsCorrelations}; -const int nPtBinsEfficiency = o2::analysis::hf_cuts_lc_to_p_k_pi::nBinsPt; -const double efficiencyLcDefault[nPtBinsEfficiency] = {}; -auto vecEfficiencyLc = std::vector{efficiencyLcDefault, efficiencyLcDefault + nPtBinsEfficiency}; /// Lc-Hadron correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via Mc truth) struct HfTaskCorrelationLcHadrons { - // Pt ranges for correlation plots: the default values are those embedded in hf_cuts_lc_to_p_k_pi (i.e. the mass Pt bins), but can be redefined via json files + Configurable fillHistoData{"fillHistoData", true, "Flag for filling histograms in data processes"}; + Configurable fillHistoMcRec{"fillHistoMcRec", true, "Flag for filling histograms in MC Rec processes"}; + Configurable fillHistoMcGen{"fillHistoMcGen", true, "Flag for filling histograms in MC Gen processes"}; + Configurable fillHistoMcEff{"fillHistoMcEff", true, "Flag for filling histograms in efficiency processes"}; Configurable applyEfficiency{"applyEfficiency", 1, "Flag for applying efficiency weights"}; + Configurable loadAccXEffFromCCDB{"loadAccXEffFromCCDB", false, "Flag for loading efficiency distributions from CCDB"}; + Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; + Configurable selNoSameBunchPileUpColl{"selNoSameBunchPileUpColl", true, "Flag for rejecting the collisions associated with the same bunch crossing"}; + Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; + Configurable> mlOutputPrompt{"mlOutputPrompt", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for prompt"}; + Configurable> mlOutputBkg{"mlOutputBkg", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for bkg"}; + // Pt ranges for correlation plots: the default values are those embedded in hf_cuts_lc_to_p_k_pi (i.e. the mass Pt bins), but can be redefined via json files Configurable> binsPtCorrelations{"binsPtCorrelations", std::vector{vecBinsPtCorrelations}, "Pt bin limits for correlation plots"}; - Configurable> binsPtEfficiency{"binsPtEfficiency", std::vector{o2::analysis::hf_cuts_lc_to_p_k_pi::vecBinsPt}, "Pt bin limits for efficiency"}; + Configurable> binsPtHadron{"binsPtHadron", std::vector{0.3, 2., 4., 8., 12., 50.}, "Pt bin limits for assoc particle efficiency"}; + Configurable> binsPtEfficiencyLc{"binsPtEfficiencyLc", std::vector{o2::analysis::hf_cuts_lc_to_p_k_pi::vecBinsPt}, "Pt bin limits for efficiency"}; + Configurable> binsPtEfficiencyHad{"binsPtEfficiencyHad", std::vector{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for associated particle efficiency"}; + Configurable> efficiencyLc{"efficiencyLc", {1., 1., 1., 1., 1., 1.}, "efficiency values for prompt Lc"}; + Configurable> efficiencyFdLc{"efficiencyFdLc", {1., 1., 1., 1., 1., 1.}, "efficiency values for beauty feed-down Lc"}; + Configurable> efficiencyHad{"efficiencyHad", {1., 1., 1., 1., 1., 1.}, "efficiency values for associated particles"}; // signal and sideband region edges, to be defined via json file (initialised to empty) Configurable> signalRegionInner{"signalRegionInner", std::vector{vecSignalRegionInner}, "Inner values of signal region vs Pt"}; Configurable> signalRegionOuter{"signalRegionOuter", std::vector{vecSignalRegionOuter}, "Outer values of signal region vs Pt"}; @@ -95,95 +99,417 @@ struct HfTaskCorrelationLcHadrons { Configurable> sidebandLeftOuter{"sidebandLeftOuter", std::vector{vecSidebandLeftOuter}, "Outer values of left sideband vs Pt"}; Configurable> sidebandRightInner{"sidebandRightInner", std::vector{vecSidebandRightInner}, "Inner values of right sideband vs Pt"}; Configurable> sidebandRightOuter{"sidebandRightOuter", std::vector{vecSidebandRightOuter}, "Outer values of right sideband vs Pt"}; - Configurable> efficiencyLc{"efficiencyLc", std::vector{vecEfficiencyLc}, "Efficiency values for Lc "}; - - using LcHadronPairFull = soa::Join; - - HistogramRegistry registry{ - "registry", - { - {"hDeltaEtaPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}}, - {"hDeltaPhiPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}}, - {"hCorrel2DPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}}, - {"hCorrel2DVsPtSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringPoolBin + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}}, // note: axes 3 and 4 (the Pt) are updated in the init() - {"hDeltaEtaPtIntSidebands", stringLcHadron + stringSideband + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}}, - {"hDeltaPhiPtIntSidebands", stringLcHadron + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}}, - {"hCorrel2DPtIntSidebands", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}}, - {"hCorrel2DVsPtSidebands", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringPoolBin + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}}, // note: axes 3 and 4 (the Pt) are updated in the init() - {"hDeltaEtaPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}}, - {"hDeltaPhiPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}}, - {"hCorrel2DPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}}, - {"hCorrel2DVsPtSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringPoolBin + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}}, - {"hCorrel2DVsPtSignalMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringPoolBin + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}}, - {"hCorrel2DVsPtBkgMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringPoolBin + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}}, - {"hDeltaEtaPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}}, - {"hDeltaPhiPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}}, - {"hCorrel2DPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}}, - {"hCorrel2DVsPtSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringPoolBin + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}}, - {"hDeltaEtaPtIntMcGen", stringMcParticles + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}}, - {"hDeltaPhiPtIntMcGen", stringMcParticles + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}}, - {"hCorrel2DPtIntMcGen", stringMcParticles + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}}, - {"hCorrel2DVsPtMcGen", stringMcParticles + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPoolBin + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}}, // note: axes 3 and 4 (the Pt) are updated in the init() - }}; + Configurable isTowardTransverseAway{"isTowardTransverseAway", false, "Divide into three regions: toward, transverse, and away"}; + Configurable leadingParticlePtMin{"leadingParticlePtMin", 0., "Min for leading particle pt"}; + Configurable dcaXYTrackMax{"dcaXYTrackMax", 1., "max. DCA_xy of tracks"}; + Configurable dcaZTrackMax{"dcaZTrackMax", 1., "max. DCA_z of tracks"}; + Configurable etaTrackMax{"etaTrackMax", 0.8, "max. eta of tracks"}; + Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; + Configurable ptCandMax{"ptCandMax", 50., "max. cand pT"}; + Configurable ptTrackMin{"ptTrackMin", 0.3, "min. track pT"}; + Configurable ptTrackMax{"ptTrackMax", 50., "max. track pT"}; + Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen. cand. rapidity"}; + Configurable ptDaughterMin{"ptDaughterMin", 0.1, "min. daughter pT"}; + Configurable activateQA{"activateQA", false, "Flag to enable debug histogram"}; + Configurable nTpcCrossedRaws{"nTpcCrossedRaws", 70, "Number of crossed TPC Rows"}; + // sign and invMasss + Configurable fillSignAndMass{"fillSignAndMass", false, "flag to select Lc-h corr with Lc invarient mass and sign of pairs"}; + Configurable calSign{"calSign", false, "flag to calculate sign of pairs"}; + Configurable fillSign{"fillSign", false, "flag to fill sign of pairs in ThnSparse"}; + + // CCDB configuration + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable associatedEffCcdbPath{"associatedEffCcdbPath", "", "CCDB path for associated efficiency"}; + Configurable promptEffCcdbPath{"promptEffCcdbPath", "", "CCDB path for trigger efficiency"}; + Configurable fdEffCcdbPath{"fdEffCcdbPath", "", "CCDB path for trigger efficiency"}; + Configurable timestampCcdb{"timestampCcdb", -1, "timestamp of the efficiency files used to query in CCDB"}; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + + std::shared_ptr mEfficiencyPrompt = nullptr; + std::shared_ptr mEfficiencyFD = nullptr; + std::shared_ptr mEfficiencyAssociated = nullptr; + + HfHelper hfHelper; + Service ccdb; + + enum CandidateStep { kCandidateStepMcGenAll = 0, + kCandidateStepMcGenLcToPKPi, + kCandidateStepMcCandInAcceptance, + kCandidateStepMcDaughtersInAcceptance, + kCandidateStepMcReco, + kCandidateStepMcRecoInAcceptance, + kCandidateNSteps }; + + using LcHadronPair = soa::Join; + using LcHadronPairFullWithMl = soa::Join; + using CandLcMcReco = soa::Filtered>; + using CandLcMcGen = soa::Join; + using TracksWithMc = soa::Filtered>; // trackFilter applied + + Filter lcFilter = ((o2::aod::hf_track_index::hfflag & static_cast(1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) != static_cast(0)) && (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); + Filter trackFilter = (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax); + + // configurable axis definition + ConfigurableAxis binsMassLc{"binsMassLc", {200, 1.98, 2.58}, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; + ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"}; + ConfigurableAxis binsEta{"binsEta", {100, -2., 2.}, "#it{#eta}"}; + ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"}; + ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 8000.}, "Multiplicity as FT0M signal amplitude"}; + ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext&) { - // redefinition of Pt axes for THnSparse holding correlation entries - int nBinsPtAxis = binsPtCorrelations->size() - 1; - const double* valuesPtAxis = binsPtCorrelations->data(); - - registry.get(HIST("hCorrel2DVsPtSignalRegion"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); - registry.get(HIST("hCorrel2DVsPtSidebands"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); - registry.get(HIST("hCorrel2DVsPtSignalRegion"))->Sumw2(); - registry.get(HIST("hCorrel2DVsPtSidebands"))->Sumw2(); - registry.get(HIST("hCorrel2DVsPtSignalRegionMcRec"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); - registry.get(HIST("hCorrel2DVsPtSidebandsMcRec"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); - registry.get(HIST("hCorrel2DVsPtSignalRegionMcRec"))->Sumw2(); - registry.get(HIST("hCorrel2DVsPtSidebandsMcRec"))->Sumw2(); - registry.get(HIST("hCorrel2DVsPtSignalMcRec"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); - registry.get(HIST("hCorrel2DVsPtSignalMcRec"))->Sumw2(); - registry.get(HIST("hCorrel2DVsPtBkgMcRec"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); - registry.get(HIST("hCorrel2DVsPtBkgMcRec"))->Sumw2(); - registry.get(HIST("hCorrel2DVsPtMcGen"))->GetAxis(2)->Set(nBinsPtAxis, valuesPtAxis); - registry.get(HIST("hCorrel2DVsPtMcGen"))->Sumw2(); + // Axis definition + AxisSpec axisMassLc = {binsMassLc, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; + AxisSpec axisPtCorr = {(std::vector)binsPtCorrelations, "#it{p}_{T}^{#Lambda_c} (GeV/#it{c})"}; + AxisSpec axisPtLc = {(std::vector)binsPtEfficiencyLc, "#it{p}_{T}^{#Lambda_c} (GeV/#it{c})"}; + AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + AxisSpec axisDeltaEta = {binsEta, "#it{#eta}^{Hadron}-#it{#eta}^{#Lambda_c}"}; + AxisSpec axisDeltaPhi = {binsPhi, "#it{#varphi}^{Hadron}-#it{#varphi}^{#Lambda_c} (rad)"}; + AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T}^{Hadron} (GeV/#it{c})"}; + AxisSpec axisPoolBin = {binsPoolBin, "poolBin"}; + AxisSpec axisLcPrompt = {2, -0.5, 1.5, "Prompt #Lambda_c"}; + AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec axisCorrelationState = {2, 0., 2., ""}; + AxisSpec axisSignPair = {4, 1., 5.}; + // Histograms for data analysis + registry.add("hBdtScorePrompt", "Lc BDT prompt score", {HistType::kTH1F, {axisBdtScore}}); + registry.add("hBdtScoreBkg", "Lc BDT bkg score", {HistType::kTH1F, {axisBdtScore}}); + registry.add("hMassLcVsPt", "Lc candidates massVsPt", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); + registry.add("hMassLcVsPtWoEff", "Lc candidates massVsPt without efficiency", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); + if (fillHistoData) { + registry.add("hDeltaEtaPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hCorrel2DPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); + registry.add("hDeltaEtaPtIntSidebands", stringLcHadron + stringSideband + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebands", stringLcHadron + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hCorrel2DPtIntSidebands", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); + registry.add("hCorrel2DVsPtSidebands", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hDeltaEtaPtIntSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaEta, {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaPhi, {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaEta, {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaPhi, {HistType::kTH1F, {axisDeltaPhi}}); + + if (!fillSign) { + registry.add("hCorrel2DVsPtSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); + registry.get(HIST("hCorrel2DVsPtSidebandLeft"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSidebandRight"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignalRegion"))->Sumw2(); + + } else { + registry.add("hCorrel2DVsPtSignSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.get(HIST("hCorrel2DVsPtSignSidebandLeft"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignSidebandRight"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignSignalRegion"))->Sumw2(); + } + // Toward Transverse Away + registry.add("hToward", "Toward invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + registry.add("hTransverse", "Transverse invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + registry.add("hAway", "Away invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + + registry.get(HIST("hCorrel2DVsPtSidebands"))->Sumw2(); + + if (fillSignAndMass) { + registry.add("hCorrel2DVsPtSignMass", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSignMass + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisMassLc}, {axisSignPair}, {axisPoolBin}}}); + registry.get(HIST("hCorrel2DVsPtSignMass"))->Sumw2(); + } + } + // Histograms for MC Reco analysis + if (fillHistoMcRec) { + registry.add("hMassPromptLcVsPt", "Lc prompt candidates mass Vs Pt", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); + registry.add("hMassNonPromptLcVsPt", "Lc non prompt candidates mass Vs Pt", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); + registry.add("hDeltaEtaPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hCorrel2DPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); + registry.add("hDeltaPhiPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hCorrel2DPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); + registry.add("hCorrel2DVsPtSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtPhysicalPrimaryMcRec", stringLcHadron + "(only true primary particles)" + stringSignal, {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisLcPrompt}, {axisPoolBin}}}); + registry.add("hDeltaEtaPtIntSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSidebandRightMcRec", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebandRightMcRec", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + + if (!fillSign) { + registry.add("hCorrel2DVsPtSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSidebandRightMcRec", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignalRegionPromptLcPromptHadronMcRec", stringLcHadron + "signal region PromptLc - Prompt Track MC reco", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignalRegionNonPromptLcNonPromptHadronMcRec", stringLcHadron + " signal region PromptLc - NonPrompt Track MC reco", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignalMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisLcPrompt}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtBkgMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); + + registry.get(HIST("hCorrel2DVsPtSidebandLeftMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSidebandRightMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignalMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignalRegionPromptLcPromptHadronMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignalRegionNonPromptLcNonPromptHadronMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignalRegionMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtBkgMcRec"))->Sumw2(); + + } else { + registry.add("hCorrel2DVsPtSignSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignSidebandRightMcRec", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignSignalRegionPromptLcPromptHadronMcRec", stringLcHadron + "signal region PromptLc - Prompt Track MC reco", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignSignalRegionNonPromptLcNonPromptHadronMcRec", stringLcHadron + " signal region PromptLc - NonPrompt Track MC reco", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignSignalMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignBkgMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + + registry.get(HIST("hCorrel2DVsPtSignSidebandLeftMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignSidebandRightMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignSignalMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignSignalRegionPromptLcPromptHadronMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignSignalRegionNonPromptLcNonPromptHadronMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignSignalRegionMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignBkgMcRec"))->Sumw2(); + } + + if (fillSignAndMass) { + registry.add("hCorrel2DVsPtSignMassMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSignMass + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisMassLc}, {axisSignPair}, {axisPoolBin}}}); + registry.get(HIST("hCorrel2DVsPtSignMassMcRec"))->Sumw2(); + } + + // Toward Transverse Away for McRec + registry.add("hTowardRec", "Toward invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + registry.add("hTransverseRec", "Transverse invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + registry.add("hAwayRec", "Away invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + + registry.get(HIST("hCorrel2DVsPtSidebandsMcRec"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtPhysicalPrimaryMcRec"))->Sumw2(); + } + // Histograms for MC Gen analysis + if (fillHistoMcGen) { + registry.add("hDeltaEtaPtIntMcGen", stringMcParticles + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntMcGen", stringMcParticles + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hCorrel2DPtIntMcGen", stringMcParticles + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); + + if (!fillSign) { + registry.add("hCorrel2DVsPtMcGen", stringMcParticles + stringDeltaPhi + stringDeltaEta + stringPtLc + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtMcGenPrompt", stringLcHadron + " Prompt MC Gen", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtMcGenPromptLcPromptHadron", stringLcHadron + "prompt Lc prompt h MC Gen", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtMcGenNonPromptLcNonPromptHadron", stringLcHadron + " non prompt Lc non prompt h MC Gen", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtMcGenNonPrompt", stringLcHadron + " NonPrompt MC Gen", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); + + registry.get(HIST("hCorrel2DVsPtMcGenPrompt"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtMcGenPromptLcPromptHadron"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtMcGenNonPromptLcNonPromptHadron"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtMcGenNonPrompt"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtMcGen"))->Sumw2(); + } else { + registry.add("hCorrel2DVsPtSignMcGenPrompt", stringLcHadron + " Prompt MC Gen", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignMcGenPromptLcPromptHadron", stringLcHadron + "prompt Lc prompt h MC Gen", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignMcGenNonPromptLcNonPromptHadron", stringLcHadron + " non prompt Lc non prompt h MC Gen", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignMcGenNonPrompt", stringLcHadron + " NonPrompt MC Gen", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSignMcGen", stringMcParticles + stringDeltaPhi + stringDeltaEta + stringPtLc + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); + + registry.get(HIST("hCorrel2DVsPtSignMcGenPrompt"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignMcGenPromptLcPromptHadron"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignMcGenNonPromptLcNonPromptHadron"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignMcGenNonPrompt"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSignMcGen"))->Sumw2(); + } + + // Toward Transverse Away for McGen + registry.add("hTowardGen", "Toward invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + registry.add("hTransverseGen", "Transverse invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + registry.add("hAwayGen", "Away invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); + } + // Histograms for efficiencies + registry.add("Efficiency/hPtCandMcRecPrompt", stringMcRecoLcPrompt + stringPtLc, {HistType::kTH1F, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcGenPrompt", stringMcGenLcPrompt + stringPtLc, {HistType::kTH1F, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcRecNonPrompt", stringMcRecoLcFd + stringPtLc, {HistType::kTH1F, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcGenNonPrompt", stringMcGenLcFd + stringPtLc, {HistType::kTH1F, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcGenDaughterInAcc", stringMcGenLcFd + stringPtLc, {HistType::kTH1F, {axisPtLc}}); + + auto hCandidates = registry.add("hCandidates", "Candidate count at different steps", {HistType::kStepTHnF, {axisPtLc, axisMultFT0M, {RecoDecay::OriginType::NonPrompt + 1, +RecoDecay::OriginType::None - 0.5, +RecoDecay::OriginType::NonPrompt + 0.5}}, kCandidateNSteps}); + hCandidates->GetAxis(0)->SetTitle("#it{p}_{T} (GeV/#it{c})"); + hCandidates->GetAxis(1)->SetTitle("multiplicity"); + hCandidates->GetAxis(2)->SetTitle("Charm hadron origin"); + + // Loading efficiency histograms from CCDB + if (applyEfficiency && loadAccXEffFromCCDB) { + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); + + mEfficiencyPrompt = std::shared_ptr(ccdb->getForTimeStamp(promptEffCcdbPath, timestampCcdb)); + if (mEfficiencyPrompt == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", promptEffCcdbPath.value.c_str()); + } + LOGF(info, "Loaded trigger efficiency (prompt Lc) histogram from %s", promptEffCcdbPath.value.c_str()); + + mEfficiencyFD = std::shared_ptr(ccdb->getForTimeStamp(fdEffCcdbPath, timestampCcdb)); + if (mEfficiencyFD == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", fdEffCcdbPath.value.c_str()); + } + LOGF(info, "Loaded feed-down Lc efficiency histogram from %s", fdEffCcdbPath.value.c_str()); + + mEfficiencyAssociated = std::shared_ptr(ccdb->getForTimeStamp(associatedEffCcdbPath, timestampCcdb)); + if (mEfficiencyAssociated == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for associated particles from %s", associatedEffCcdbPath.value.c_str()); + } + LOGF(info, "Loaded associated efficiency histogram from %s", associatedEffCcdbPath.value.c_str()); + } + + if (activateQA) { + const int regionLimits = 6; + std::string labels[regionLimits] = {"SigReg Left", "SigReg Right", "Left SB Low", "Left SB Up", "Right SB Low", "Right SB Up"}; + static const AxisSpec axisSidebandLimits = {regionLimits, 0.5, 6.5, ""}; + auto hSigSidebandLimits = registry.add("Inputs/hSigSidebandLimits", "Signal and Sideband Limits;;#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisSidebandLimits, {(std::vector)binsPtCorrelations, "#it{p}_{T} (GeV/#it{c})"}}}); + for (int iLim = 0; iLim < regionLimits; iLim++) { + hSigSidebandLimits->GetXaxis()->SetBinLabel(iLim + 1, labels[iLim].data()); + } + for (size_t iPtLc = 0; iPtLc < binsPtCorrelations->size() - 1; iPtLc++) { + hSigSidebandLimits->SetBinContent(1, iPtLc + 1, signalRegionInner->at(iPtLc)); + hSigSidebandLimits->SetBinContent(2, iPtLc + 1, signalRegionOuter->at(iPtLc)); + hSigSidebandLimits->SetBinContent(3, iPtLc + 1, sidebandLeftOuter->at(iPtLc)); + hSigSidebandLimits->SetBinContent(4, iPtLc + 1, sidebandLeftInner->at(iPtLc)); + hSigSidebandLimits->SetBinContent(5, iPtLc + 1, sidebandRightInner->at(iPtLc)); + hSigSidebandLimits->SetBinContent(6, iPtLc + 1, sidebandRightOuter->at(iPtLc)); + } + } } - void processData(LcHadronPairFull const& pairEntries) + void processData(LcHadronPairFullWithMl const& pairEntries, aod::LcRecoInfo const& candidates) { + for (const auto& candidate : candidates) { + float massLc = candidate.mLc(); + float ptLc = std::abs(candidate.ptLc()); + float bdtScorePrompt = candidate.mlScorePrompt(); + float bdtScoreBkg = candidate.mlScoreBkg(); + int effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); + + // reject entries outside Pt ranges of interest + if (ptLc < binsPtEfficiencyLc->front() || ptLc > binsPtEfficiencyLc->back()) { + continue; + } + + if (bdtScorePrompt < mlOutputPrompt->at(effBinLc) || bdtScoreBkg > mlOutputBkg->at(effBinLc)) { + continue; + } + double efficiencyWeightLc = 1.; + if (applyEfficiency) { + efficiencyWeightLc = 1. / efficiencyLc->at(o2::analysis::findBin(binsPtEfficiencyLc, ptLc)); + if (loadAccXEffFromCCDB) { + efficiencyWeightLc = 1. / mEfficiencyPrompt->GetBinContent(mEfficiencyPrompt->FindBin(ptLc)); + } + } + registry.fill(HIST("hMassLcVsPt"), massLc, ptLc, efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtWoEff"), massLc, ptLc); + registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); + registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); + } + for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptLc = pairEntry.ptLc(); - double ptHadron = pairEntry.ptHadron(); + float deltaPhi = pairEntry.deltaPhi(); + float deltaEta = pairEntry.deltaEta(); + double ptLc = std::abs(pairEntry.ptLc()); + double ptHadron = std::abs(pairEntry.ptHadron()); + float bdtScorePrompt = pairEntry.mlScorePrompt(); + float bdtScoreBkg = pairEntry.mlScoreBkg(); + float trackDcaXY = pairEntry.trackDcaXY(); + float trackDcaZ = pairEntry.trackDcaZ(); + int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int poolBin = pairEntry.poolBin(); double massLc = pairEntry.mLc(); - int effBinLc = o2::analysis::findBin(binsPtEfficiency, ptLc); + int effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); int ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); - int poolBin = pairEntry.poolBin(); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); + int signPair = 0; // reject entries outside Pt ranges of interest if (ptBinLc < 0 || effBinLc < 0) { continue; } - if (ptHadron > 10.0) { - ptHadron = 10.5; + + if (bdtScorePrompt < mlOutputPrompt->at(effBinLc) || bdtScoreBkg > mlOutputBkg->at(effBinLc)) { + continue; + } + if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) { + continue; } + double efficiencyWeight = 1.; - double efficiencyHadron = 1.; // Note: To be implemented later on if (applyEfficiency) { - efficiencyWeight = 1. / (efficiencyLc->at(effBinLc) * efficiencyHadron); + efficiencyWeight = 1. / (efficiencyLc->at(effBinLc) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); + if (loadAccXEffFromCCDB) { + efficiencyWeight = 1. / (mEfficiencyPrompt->GetBinContent(mEfficiencyPrompt->FindBin(ptLc)) * mEfficiencyAssociated->GetBinContent(mEfficiencyAssociated->FindBin(ptHadron))); + } + } + + // Divide into three regions: toward, transverse, and away + if (isTowardTransverseAway) { + if (ptHadron < leadingParticlePtMin) { + continue; + } + Region region = getRegion(deltaPhi); + switch (region) { + case Toward: + registry.fill(HIST("hToward"), massLc, ptLc, isAutoCorrelated, efficiencyWeight); + break; + case Away: + registry.fill(HIST("hAway"), massLc, ptLc, isAutoCorrelated, efficiencyWeight); + break; + case Transverse: + registry.fill(HIST("hTransverse"), massLc, ptLc, isAutoCorrelated, efficiencyWeight); + break; + default: + break; + } + } + + if (calSign) { + signPair = signCalulation(pairEntry.ptLc(), pairEntry.ptHadron()); } + if (fillSignAndMass) { + registry.fill(HIST("hCorrel2DVsPtSignMass"), deltaPhi, deltaEta, ptLc, ptHadron, massLc, signPair, poolBin, efficiencyWeight); + } + // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots if (massLc > signalRegionInner->at(ptBinLc) && massLc < signalRegionOuter->at(ptBinLc)) { // in signal region - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSignalRegion"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); } - - if ((massLc > sidebandLeftOuter->at(ptBinLc) && massLc < sidebandLeftInner->at(ptBinLc)) || - (massLc > sidebandRightInner->at(ptBinLc) && massLc < sidebandRightOuter->at(ptBinLc))) { - // in sideband region + // in sideband left region + if (massLc > sidebandLeftOuter->at(ptBinLc) && massLc < sidebandLeftInner->at(ptBinLc)) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSidebandLeft"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DPtIntSidebands"), deltaPhi, deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebands"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebands"), deltaPhi, efficiencyWeight); + } + // in sideband right region + if (massLc > sidebandRightInner->at(ptBinLc) && massLc < sidebandRightOuter->at(ptBinLc)) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSidebandRight"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSidebands"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebands"), deltaEta, efficiencyWeight); @@ -194,49 +520,192 @@ struct HfTaskCorrelationLcHadrons { PROCESS_SWITCH(HfTaskCorrelationLcHadrons, processData, "Process data", true); /// Lc-Hadron correlation pair filling task, from pair tables - for Mc reco-level analysis (candidates matched to true signal only, but also bkg sources are studied) - void processMcRec(LcHadronPairFull const& pairEntries) + void processMcRec(LcHadronPairFullWithMl const& pairEntries, + soa::Join const& candidates) { + for (const auto& candidate : candidates) { + float massLc = candidate.mLc(); + float ptLc = std::abs(candidate.ptLc()); + float bdtScorePrompt = candidate.mlScorePrompt(); + float bdtScoreBkg = candidate.mlScoreBkg(); + int effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); + bool isLcPrompt = candidate.isPrompt(); + + // reject entries outside pT ranges of interest + if (ptLc < binsPtEfficiencyLc->front() || ptLc > binsPtEfficiencyLc->back()) + continue; + + if (bdtScorePrompt < mlOutputPrompt->at(effBinLc) || bdtScoreBkg > mlOutputBkg->at(effBinLc)) { + continue; + } + double efficiencyWeightLc = 1.; + if (applyEfficiency) { + if (isLcPrompt) { + efficiencyWeightLc = 1. / efficiencyLc->at(effBinLc); + if (loadAccXEffFromCCDB) { + efficiencyWeightLc = 1. / mEfficiencyPrompt->GetBinContent(mEfficiencyPrompt->FindBin(ptLc)); + } + registry.fill(HIST("hMassLcVsPt"), massLc, ptLc, efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtWoEff"), massLc, ptLc); + registry.fill(HIST("hMassPromptLcVsPt"), massLc, ptLc, efficiencyWeightLc); + registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); + registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); + } else { + efficiencyWeightLc = 1. / efficiencyFdLc->at(effBinLc); + if (loadAccXEffFromCCDB) { + efficiencyWeightLc = 1. / mEfficiencyFD->GetBinContent(mEfficiencyFD->FindBin(ptLc)); + } + registry.fill(HIST("hMassLcVsPt"), massLc, ptLc, efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtWoEff"), massLc, ptLc); + registry.fill(HIST("hMassNonPromptLcVsPt"), massLc, ptLc, efficiencyWeightLc); + registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); + registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); + } + } + } + for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptLc = pairEntry.ptLc(); - double ptHadron = pairEntry.ptHadron(); - double massLc = pairEntry.mLc(); - double efficiencyWeight = 1.; - double efficiencyHadron = 1.; - int effBinLc = o2::analysis::findBin(binsPtEfficiency, ptLc); - int ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); + float deltaPhi = pairEntry.deltaPhi(); + float deltaEta = pairEntry.deltaEta(); + float ptLc = std::abs(pairEntry.ptLc()); + float ptHadron = std::abs(pairEntry.ptHadron()); + float massLc = pairEntry.mLc(); + float bdtScorePrompt = pairEntry.mlScorePrompt(); + float bdtScoreBkg = pairEntry.mlScoreBkg(); + bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); + float trackDcaXY = pairEntry.trackDcaXY(); + float trackDcaZ = pairEntry.trackDcaZ(); + int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int statusLcPrompt = static_cast(pairEntry.isPrompt()); + int statusPromptHadron = pairEntry.trackOrigin(); int poolBin = pairEntry.poolBin(); - if (ptBinLc < 0 || effBinLc < 0) { + int effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); + int ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); + int signPair = 0; + + // reject entries outside pT ranges of interest + if (ptLc < binsPtEfficiencyLc->front() || ptLc > binsPtEfficiencyLc->back()) + continue; + + if (bdtScorePrompt < mlOutputPrompt->at(effBinLc) || bdtScoreBkg > mlOutputBkg->at(effBinLc)) { continue; } - if (ptHadron > 10.0) { - ptHadron = 10.5; + if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) { + continue; } + double efficiencyWeight = 1.; + if (applyEfficiency) { - efficiencyWeight = 1. / (efficiencyLc->at(effBinLc) * efficiencyHadron); + if (statusLcPrompt) { + efficiencyWeight = 1. / (efficiencyLc->at(effBinLc) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); + if (loadAccXEffFromCCDB) { + efficiencyWeight = 1. / (mEfficiencyPrompt->GetBinContent(mEfficiencyPrompt->FindBin(ptLc)) * mEfficiencyAssociated->GetBinContent(mEfficiencyAssociated->FindBin(ptHadron))); + } + } else { + efficiencyWeight = 1. / (efficiencyFdLc->at(effBinLc) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); + if (loadAccXEffFromCCDB) { + efficiencyWeight = 1. / (mEfficiencyFD->GetBinContent(mEfficiencyFD->FindBin(ptLc)) * mEfficiencyAssociated->GetBinContent(mEfficiencyAssociated->FindBin(ptHadron))); + } + } + } + + // Divide into three regions: toward, transverse, and away + if (isTowardTransverseAway) { + if (ptHadron < leadingParticlePtMin) { + continue; + } + Region region = getRegion(deltaPhi); + switch (region) { + case Toward: + registry.fill(HIST("hTowardRec"), massLc, ptLc, isAutoCorrelated, efficiencyWeight); + break; + case Away: + registry.fill(HIST("hAwayRec"), massLc, ptLc, isAutoCorrelated, efficiencyWeight); + break; + case Transverse: + registry.fill(HIST("hTransverseRec"), massLc, ptLc, isAutoCorrelated, efficiencyWeight); + break; + default: + break; + } } + + if (calSign) { + signPair = signCalulation(pairEntry.ptLc(), pairEntry.ptHadron()); + } + if (fillSignAndMass) { + registry.fill(HIST("hCorrel2DVsPtSignMassMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, massLc, signPair, poolBin, efficiencyWeight); + } + // fill correlation plots for signal/bagkground correlations if (pairEntry.signalStatus()) { - registry.fill(HIST("hCorrel2DVsPtSignalMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSignalMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSignalMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } } else { - registry.fill(HIST("hCorrel2DVsPtBkgMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignBkgMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtBkgMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } } // reject entries outside Pt ranges of interest // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots if (massLc > signalRegionInner->at(ptBinLc) && massLc < signalRegionOuter->at(ptBinLc)) { // in signal region - registry.fill(HIST("hCorrel2DVsPtSignalRegionMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSignalRegionMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSignalRegionMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } registry.fill(HIST("hCorrel2DPtIntSignalRegionMcRec"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegionMcRec"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegionMcRec"), deltaPhi, efficiencyWeight); + if (isPhysicalPrimary) { + registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, statusLcPrompt, poolBin, efficiencyWeight); + if (statusLcPrompt == 1 && statusPromptHadron == 1) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSignalRegionPromptLcPromptHadronMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSignalRegionPromptLcPromptHadronMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } + } else if (statusLcPrompt == 0 && statusPromptHadron == 2) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSignalRegionNonPromptLcNonPromptHadronMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSignalRegionNonPromptLcNonPromptHadronMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } + } + } } - - if (((massLc > sidebandLeftOuter->at(ptBinLc)) && (massLc < sidebandLeftInner->at(ptBinLc))) || - ((massLc > sidebandRightInner->at(ptBinLc) && massLc < sidebandRightOuter->at(ptBinLc)))) { - // in sideband region + // in sideband left region + if (massLc > sidebandLeftOuter->at(ptBinLc) && massLc < sidebandLeftInner->at(ptBinLc)) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSidebandLeftMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSidebandLeftMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } + registry.fill(HIST("hDeltaEtaPtIntSidebandLeftMcRec"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeftMcRec"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandsMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DPtIntSidebandsMcRec"), deltaPhi, deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandsMcRec"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandsMcRec"), deltaPhi, efficiencyWeight); + } + // in sideband right region + if (massLc > sidebandRightInner->at(ptBinLc) && massLc < sidebandRightOuter->at(ptBinLc)) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignSidebandRightMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); + } else { + registry.fill(HIST("hCorrel2DVsPtSidebandRightMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + } + registry.fill(HIST("hDeltaEtaPtIntSidebandRightMcRec"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRightMcRec"), deltaPhi, efficiencyWeight); registry.fill(HIST("hCorrel2DVsPtSidebandsMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSidebandsMcRec"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandsMcRec"), deltaEta, efficiencyWeight); @@ -247,30 +716,165 @@ struct HfTaskCorrelationLcHadrons { PROCESS_SWITCH(HfTaskCorrelationLcHadrons, processMcRec, "Process Mc Reco mode", false); /// Lc-Hadron correlation pair filling task, from pair tables - for Mc gen-level analysis (no filter/selection, only true signal) - void processMcGen(aod::LcHadronPair const& pairEntries) + void processMcGen(LcHadronPair const& pairEntries) { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptLc = pairEntry.ptLc(); - double ptHadron = pairEntry.ptHadron(); + float deltaPhi = pairEntry.deltaPhi(); + float deltaEta = pairEntry.deltaEta(); + float ptLc = std::abs(pairEntry.ptLc()); + float ptHadron = std::abs(pairEntry.ptHadron()); int poolBin = pairEntry.poolBin(); - // reject entries outside Pt ranges of interest - if (o2::analysis::findBin(binsPtCorrelations, ptLc) < 0) { - continue; + int statusPromptHadron = pairEntry.trackOrigin(); + bool isLcPrompt = pairEntry.isPrompt(); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); + int signPair = 0; + + if (isTowardTransverseAway) { + // Divide into three regions: toward, transverse, and away + if (ptHadron < leadingParticlePtMin) { + continue; + } + Region region = getRegion(deltaPhi); + switch (region) { + case Toward: + registry.fill(HIST("hTowardRec"), o2::constants::physics::MassLambdaCPlus, ptLc, isAutoCorrelated); + break; + case Away: + registry.fill(HIST("hAwayRec"), o2::constants::physics::MassLambdaCPlus, ptLc, isAutoCorrelated); + break; + case Transverse: + registry.fill(HIST("hTransverseRec"), o2::constants::physics::MassLambdaCPlus, ptLc, isAutoCorrelated); + break; + default: + break; + } } - if (ptHadron > 10.0) { - ptHadron = 10.5; + if (calSign) { + signPair = signCalulation(pairEntry.ptLc(), pairEntry.ptHadron()); + } + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignMcGen"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin); + } else { + registry.fill(HIST("hCorrel2DVsPtMcGen"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); } - - registry.fill(HIST("hCorrel2DVsPtMcGen"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); registry.fill(HIST("hCorrel2DPtIntMcGen"), deltaPhi, deltaEta); registry.fill(HIST("hDeltaEtaPtIntMcGen"), deltaEta); registry.fill(HIST("hDeltaPhiPtIntMcGen"), deltaPhi); + if (isLcPrompt) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignMcGenPrompt"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin); + } else { + registry.fill(HIST("hCorrel2DVsPtMcGenPrompt"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); + } + if (statusPromptHadron == 1) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignMcGenPromptLcPromptHadron"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin); + } else { + registry.fill(HIST("hCorrel2DVsPtMcGenPromptLcPromptHadron"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); + } + } + } else { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignMcGenNonPrompt"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin); + } else { + registry.fill(HIST("hCorrel2DVsPtMcGenNonPrompt"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); + } + if (statusPromptHadron == 2) { + if (fillSign) { + registry.fill(HIST("hCorrel2DVsPtSignMcGenNonPromptLcNonPromptHadron"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin); + } else { + registry.fill(HIST("hCorrel2DVsPtMcGenNonPromptLcNonPromptHadron"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); + } + } + } } // end loop } PROCESS_SWITCH(HfTaskCorrelationLcHadrons, processMcGen, "Process Mc Gen mode", false); + + /// Lc-Hadron correlation - reconstruction and selection efficiency + void processMcCandEfficiency(soa::Join const&, + soa::Join const&, + CandLcMcGen const& mcParticles, + CandLcMcReco const& candidates, + aod::TracksWMc const&) + { + auto hCandidates = registry.get(HIST("hCandidates")); + + /// Gen loop + float multiplicity = -1.; + for (const auto& mcParticle : mcParticles) { + // generated candidates + if (std::abs(mcParticle.pdgCode()) == Pdg::kLambdaCPlus) { + auto mcCollision = mcParticle.template mcCollision_as>(); + multiplicity = mcCollision.multMCFT0A() + mcCollision.multMCFT0C(); // multFT0M = multFt0A + multFT0C + hCandidates->Fill(kCandidateStepMcGenAll, mcParticle.pt(), multiplicity, mcParticle.originMcGen()); + if (std::abs(mcParticle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { + hCandidates->Fill(kCandidateStepMcGenLcToPKPi, mcParticle.pt(), multiplicity, mcParticle.originMcGen()); + auto yL = RecoDecay::y(mcParticle.pVector(), o2::constants::physics::MassLambdaCPlus); + if (std::abs(yL) <= yCandGenMax) { + hCandidates->Fill(kCandidateStepMcCandInAcceptance, mcParticle.pt(), multiplicity, mcParticle.originMcGen()); + if (mcParticle.originMcGen() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("Efficiency/hPtCandMcGenPrompt"), mcParticle.pt()); + } + if (mcParticle.originMcGen() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("Efficiency/hPtCandMcGenNonPrompt"), mcParticle.pt()); + } + } + bool isDaughterInAcceptance = true; + auto daughters = mcParticle.template daughters_as(); + for (const auto& daughter : daughters) { + if (daughter.pt() < ptDaughterMin || std::abs(daughter.eta()) > etaTrackMax) { + isDaughterInAcceptance = false; + } + } + if (isDaughterInAcceptance) { + hCandidates->Fill(kCandidateStepMcDaughtersInAcceptance, mcParticle.pt(), multiplicity, mcParticle.originMcGen()); + registry.fill(HIST("Efficiency/hPtCandMcGenDaughterInAcc"), mcParticle.pt()); + } + } + } + } + + // recontructed candidates loop + for (const auto& candidate : candidates) { + if (candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + continue; + } + std::vector outputMl = {-1., -1., -1.}; + if (candidate.isSelLcToPKPi() >= selectionFlagLc) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; + } + } + if (candidate.isSelLcToPiKP() >= selectionFlagLc) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; + } + } + if (outputMl[0] > mlOutputBkg->at(o2::analysis::findBin(binsPtEfficiencyLc, candidate.pt())) || outputMl[1] < mlOutputPrompt->at(o2::analysis::findBin(binsPtEfficiencyLc, candidate.pt()))) { + continue; + } + auto collision = candidate.template collision_as>(); + if (selNoSameBunchPileUpColl && !(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup))) { + continue; + } + multiplicity = collision.multFT0M(); + if (std::abs(candidate.flagMcMatchRec()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { + hCandidates->Fill(kCandidateStepMcReco, candidate.pt(), multiplicity, candidate.originMcRec()); + if (std::abs(hfHelper.yLc(candidate)) <= yCandMax) { + hCandidates->Fill(kCandidateStepMcRecoInAcceptance, candidate.pt(), multiplicity, candidate.originMcRec()); + if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("Efficiency/hPtCandMcRecPrompt"), candidate.pt()); + } + if (candidate.originMcRec() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("Efficiency/hPtCandMcRecNonPrompt"), candidate.pt()); + } + } + } + } + } + PROCESS_SWITCH(HfTaskCorrelationLcHadrons, processMcCandEfficiency, "Process MC for calculating candidate reconstruction efficiency", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 7ccbb83faa4..bd84b6982b1 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -10,9 +10,14 @@ // or submit itself to any jurisdiction. /// \file taskFlow.cxx +/// \brief HF-h correlations in TPC-TPC and TPC-MFT +/// \author Alexian Lejeune , Czech Technical University in Prague /// \author Katarina Krizkova Gajdosova , CERN /// \author Maja Kabus , CERN +#include +#include + #include #include #include @@ -23,6 +28,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" +#include "Framework/Logger.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" @@ -61,10 +67,17 @@ struct HfTaskFlow { Configurable etaTrackAssocMax{"etaTrackAssocMax", 0.8f, "max. eta of associated tracks"}; Configurable ptTrackAssocMin{"ptTrackAssocMin", 0.5f, "min. pT of associated tracks"}; // configurables for HF candidates + Configurable etaCandidateMax{"etaCandidateMax", 0.8f, "max. eta of HF candidate"}; Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable selectionFlagLcToPKPi{"selectionFlagLcToPKPi", 1, "Selection Flag for LambdaC"}; + Configurable selectionFlagLcToPiKP{"selectionFlagLcToPiKP", 1, "Selection Flag for LambdaC bar"}; Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"}; + // configurables for MFT tracks + Configurable etaMftTrackMax{"etaMftTrackMax", 0, "Maximum value for the eta of MFT tracks"}; + Configurable etaMftTrackMin{"etaMftTrackMin", -5, "Minimum value for the eta of MFT tracks"}; + Configurable nClustersMftTrack{"nClustersMftTrack", 5, "Minimum number of clusters for the reconstruction of MFT tracks"}; Service pdg; HfHelper hfHelper; @@ -75,7 +88,8 @@ struct HfTaskFlow { // ========================= using FilteredCollisionsWSelMult = soa::Filtered>; - using HfCandidatesSel = soa::Filtered>; + using HfCandidatesSelD0 = soa::Filtered>; + using HfCandidatesSelLc = soa::Filtered>; using TracksWDcaSel = soa::Filtered>; // ========================= @@ -100,8 +114,11 @@ struct HfTaskFlow { // HF candidate filter // TODO: use Partition instead of filter - Filter candidateFilter = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || - aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + Filter candidateFilterD0 = (aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0) || + (aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar); + + Filter candidateFilterLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLcToPKPi) || + (aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLcToPiKP); // Collision filters // FIXME: The filter is applied also on the candidates! Beware! @@ -111,12 +128,6 @@ struct HfTaskFlow { (aod::track::pt > ptTrackAssocMin) && requireGlobalTrackWoPtEtaInFilter(); - // Katarina had this in her code : - // Charged track filters - // Filter trackFilter = (nabs(aod::track::eta) < etaTrackAssocMax) && - // (aod::track::pt > ptTrackAssocMin) && - // requireGlobalTrackWoPtEtaInFilter(); - // ========================= // Filters & partitions : MC // ========================= @@ -163,12 +174,12 @@ struct HfTaskFlow { // Correlation containers used for data OutputObj sameTPCTPCChCh{"sameTPCTPCChCh"}; OutputObj mixedTPCTPCChCh{"mixedTPCTPCChCh"}; - OutputObj sameTPCTPCHfCh{"sameTPCTPCHfCh"}; - OutputObj mixedTPCTPCHfCh{"mixedTPCTPCHfCh"}; + OutputObj sameTPCTPCHfCh{"sameTPCTPCHfCh"}; // I still keep only one Correlation Container for HF, whether is D0 or Lc + OutputObj mixedTPCTPCHfCh{"mixedTPCTPCHfCh"}; // Because only one should be run at the same time OutputObj sameTPCMFTChCh{"sameTPCMFTChCh"}; OutputObj mixedTPCMFTChCh{"mixedTPCMFTChCh"}; - OutputObj sameTPCMFTHfCh{"sameTPCMFTHfCh"}; - OutputObj mixedTPCMFTHfCh{"mixedTPCMFTHfCh"}; + OutputObj sameTPCMFTHfCh{"sameTPCMFTHfCh"}; // I still keep only one Correlation Container for HF, whether is D0 or Lc + OutputObj mixedTPCMFTHfCh{"mixedTPCMFTHfCh"}; // Because only one should be run at the same time // Correlation containers used for Monte-Carlo OutputObj sameTPCTPCChChMC{"sameTPCTPCChChMC"}; @@ -212,7 +223,7 @@ struct HfTaskFlow { registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); registry.add("Data/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + // registry.add("Data/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); // Katarina had this : registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVzEta", "eta vs. Vz", {HistType::kTH2F, {{100, -4, 4, "#eta"}, {20, -10, 10, "Vz"}}}); @@ -229,10 +240,20 @@ struct HfTaskFlow { registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); // ========================= - // DATA : histograms for TPC-TPC HF-h case + // DATA : histograms for TPC-TPC HF-h case for 2PRONG // ========================= // DATA : event histograms for TPC-TPC HF-h same event + registry.add("Data/TpcTpc/HfHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}); registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); registry.add("Data/TpcTpc/HfHadron/MixedEvent/hMultiplicityHFMixing", "hMultiplicityHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); registry.add("Data/TpcTpc/HfHadron/MixedEvent/hVtxZHFMixing", "hVtxZHFMixing", {HistType::kTH1F, {{100, -10, 10}}}); @@ -240,49 +261,92 @@ struct HfTaskFlow { // DATA : trigger particles (candidates) histograms for TPC-TPC h-h same event auto vbins = (std::vector)binsPt; - registry.add("Data/TpcTpc/HfHadron/SameEvent/hPtCandidate", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtCandidate", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); // DATA : trigger particles (candidates) histograms for TPC-TPC h-h mixed event registry.add("Data/TpcTpc/HfHadron/MixedEvent/hPtHFMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEtaHFMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); registry.add("Data/TpcTpc/HfHadron/MixedEvent/hPhiHFMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + // ========================= + // DATA : histograms for TPC-TPC HF-h case for 3PRONG + // =================== + + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPt", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMass", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPtVsMult", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}, {5000, 0., 10000.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0VsPtProng0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0VsPtProng1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0VsPtProng2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0Prong2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLength", "3-prong candidates;decay length (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCt", "3-prong candidates;proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH1F, {{100, 0., 0.2}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCPAxy", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDca2", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH1F, {{400, 0., 20.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLengthVsPt", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLengthxyVsPt", "3-prong candidates;decay length xy(cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCtVsPt", "3-prong candidates;proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.2}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCPAVsPt", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCPAxyVsPt", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDca2VsPt", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH2F, {{400, 0., 20.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhiVsPt", "3-prong candidates;candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hSelectionStatus", "3-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hImpParErrProng0", "3-prong candidates;prong 0 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hImpParErrProng1", "3-prong candidates;prong 1 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hImpParErrProng2", "3-prong candidates;prong 2 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLenErr", "3-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // ========================= // DATA : histograms for TPC-MFT h-h case // ========================= // DATA : trigger particles (TPC tracks) histograms for TPC-MFT h-h same event + registry.add("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiTPC", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC", "etaTPC", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC", "phiTPC", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hPtTPC", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsTPC", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hNtracksTPC", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + // registry.add("Data/TpcMft/HadronHadron/SameEvent/hNtracksTPC", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hMultiplicityTPC", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{500, 0, 500}}}); // DATA : associated particles (MFT tracks) histograms for TPC-MFT h-h same event registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hPtMFT", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hNtracksMFT", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -5, 0, "#eta"}}}); + // registry.add("Data/TpcMft/HadronHadron/SameEvent/hNtracksMFT", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); // DATA : histograms for TPC-MFT h-h event mixing for TPC tracks registry.add("Data/TpcMft/HadronHadron/MixedEvent/hMultiplicityMixingTPC", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); @@ -304,43 +368,45 @@ struct HfTaskFlow { registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // ========================= - // DATA : histograms for TPC-MFT HF-h case + // DATA : histograms for TPC-MFT HF-h case FOR 2PRONG // ========================= // DATA : trigger particles (candidates) histograms for TPC-MFT HF-h same event - registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaCandidate", "etaTPC", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hPhiCandidate", "phiTPC", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hNtracksCandidate", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandidate", "etaTPC", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPhiCandidate", "phiTPC", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMultiplicityCandidate", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{500, 0, 500}}}); + // registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hNtracksCandidate", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); // DATA : trigger particles (candidates) histograms for TPC-MFT HF-h same event - registry.add("Data/TpcMft/HfHadron/SameEvent/hPtCandidate", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtCandidate", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); // DATA : associated particles (MFT tracks) histograms for TPC-MFT h-h same event registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); registry.add("Data/TpcMft/HfHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); registry.add("Data/TpcMft/HfHadron/SameEvent/hPtMFT", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hNtracksMFT", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -5, 0, "#eta"}}}); + // registry.add("Data/TpcMft/HfHadron/SameEvent/hNtracksMFT", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); // DATA : histograms for TPC-MFT h-h event mixing for candidates registry.add("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingCandidate", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); @@ -362,14 +428,58 @@ struct HfTaskFlow { registry.add("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // ========================= - // MC : histograms for TPC-MFT h-h case + // DATA : histograms for TPC-MFT HF-h case FOR 3PRONG + // ========================= + + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMultiplicityCandidate", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{500, 0, 500}}}); + // registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hNtracksCandidate", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPt", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMass", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPtVsMult", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}, {5000, 0., 10000.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0VsPtProng0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0VsPtProng1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0VsPtProng2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0Prong2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLength", "3-prong candidates;decay length (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hCt", "3-prong candidates;proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH1F, {{100, 0., 0.2}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hCPAxy", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hDca2", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH1F, {{400, 0., 20.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLengthVsPt", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLengthxyVsPt", "3-prong candidates;decay length xy(cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hCtVsPt", "3-prong candidates;proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.2}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hCPAVsPt", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hCPAxyVsPt", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hDca2VsPt", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH2F, {{400, 0., 20.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhiVsPt", "3-prong candidates;candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hSelectionStatus", "3-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hImpParErrProng0", "3-prong candidates;prong 0 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hImpParErrProng1", "3-prong candidates;prong 1 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hImpParErrProng2", "3-prong candidates;prong 2 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLenErr", "3-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + + // ========================= + // MC : histograms for TPC-TPC h-h case // ========================= // MC reconstructed registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {{500, 0, 500}}}); registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {{400, -50, 50}}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // Katarina had this : registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary", "hMultiplicityPrimary", {HistType::kTH1F, {{500, 0, 500}}}); // histograms for MC associated particles @@ -392,7 +502,7 @@ struct HfTaskFlow { registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {{500, 0, 500}}}); registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {{400, -50, 50}}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // Katarina had this : registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary", "hMultiplicityPrimary", {HistType::kTH1F, {{500, 0, 500}}}); // histograms for MC associated particles @@ -442,44 +552,28 @@ struct HfTaskFlow { } // End of init() function // ========================= - // templates - // FIXME: Some collisions are rejected here, what causes (part of) differences with the D0 task + // Quality Assesment plots for Same Event // ========================= - template - bool isCollisionSelected(TCollision const& collision, bool fillHistograms = false) - { - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 1); - - if (processMc == false) { - if (!collision.sel8()) { - return false; - } - } - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 3); - - return true; + // ---- DATA : TPC-TPC h-h Same Event QA ---- + template + void fillTpcTpcChChSameEventQa(float multiplicity, TTrack const& track) + { + registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hPt"), track.pt()); + registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEta"), track.eta()); + registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hPhi"), track.phi()); + registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track.eta(), track.phi()); } - // ========================= - // Quality Assesment plots - // ========================= - - // ---- DATA : TPC-TPC h-h Same Event QA ---- - template - void fillTpcTpcChChSameEventQa(float multiplicity, TTracks const& tracks) + template + void fillTpcTpcHfChSameEventQa(float multiplicity, TTrack const& track) { - int nTracks = tracks.size(); - for (const auto& track1 : tracks) { - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hPt"), track1.pt()); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEta"), track1.eta()); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hPhi"), track1.phi()); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track1.pt(), track1.eta()); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track1.eta(), track1.phi()); - } - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hNtracks"), nTracks); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPt"), track.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hEta"), track.eta()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPhi"), track.phi()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hYields"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hEtaPhi"), multiplicity, track.eta(), track.phi()); } // ---- MC : TPC-TPC h-h Same Event QA ---- @@ -522,6 +616,266 @@ struct HfTaskFlow { return nTracks; } + // ---- DATA : TPC-MFT h-h Same Event QA ---- + template + void fillTpcMftChChSameEventQa(float multiplicity, TTrack const& track, bool isTPC) + { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + + if (isTPC) { // trigger hadron from TPC + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC"), track.eta()); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC"), phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiTPC"), multiplicity, track.eta(), phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPtTPC"), track.pt()); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hYieldsTPC"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hMultiplicityTPC"), multiplicity); + // add multiplicity plot? + } else { // associated hadron from MFT + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT"), track.eta()); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT"), phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiMFT"), multiplicity, track.eta(), phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPtMFT"), track.pt()); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT"), multiplicity, track.pt(), track.eta()); + } + } + + // ---- DATA : TPC-MFT HF-h Same Event QA ---- + + template + void fillTpcMftHfChSameEventQa(float multiplicity, TTrack const& track) + { + // Used to fill QA plots for associated track from MFT when doing TPC-MFT HF-h correlations + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaMFT"), track.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPhiMFT"), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaPhiMFT"), multiplicity, track.eta(), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtMFT"), track.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hYieldsMFT"), multiplicity, track.pt(), track.eta()); + // add plot for multiplicity ? + } + + // ---- DATA : TPC-TPC HF-h Same Event (Candidates) QA ---- + // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + + // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + template + void fillTpcTpcD0CandidateQa(float multiplicity, TTrack const& candidate) + { + float phi = candidate.phi(); + o2::math_utils::bringTo02Pi(phi); + + auto pt = candidate.pt(); + + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0ToPiK(candidate)); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0barToKPi(candidate)); + } + + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMultiplicity"), multiplicity); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEta"), candidate.eta()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPhi"), phi); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtCandidate"), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng0"), candidate.ptProng0()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng1"), candidate.ptProng1()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLength"), candidate.decayLength(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLengthXY"), candidate.decayLengthXY(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0Prong0"), candidate.impactParameter0(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0Prong1"), candidate.impactParameter1(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0d0"), candidate.impactParameterProduct(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCTS"), hfHelper.cosThetaStarD0(candidate), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCt"), hfHelper.ctD0(candidate), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCPA"), candidate.cpa(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEtaCandVsPt"), candidate.eta(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hImpParErr"), candidate.errorImpactParameter0(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hImpParErr"), candidate.errorImpactParameter1(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLenErr"), candidate.errorDecayLength(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLenXYErr"), candidate.errorDecayLengthXY(), pt); + } + + // ---- DATA : TPC-TPC HF-h Same Event (Candidates) QA ---- + // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + template + void fillTpcTpcLcCandidateQa(float multiplicity, TTrack const& candidate) + { + float phi = candidate.phi(); + o2::math_utils::bringTo02Pi(phi); + + auto pt = candidate.pt(); + auto ptProng0 = candidate.ptProng0(); + auto ptProng1 = candidate.ptProng1(); + auto ptProng2 = candidate.ptProng2(); + auto decayLength = candidate.decayLength(); + auto decayLengthXY = candidate.decayLengthXY(); + auto chi2PCA = candidate.chi2PCA(); + auto cpa = candidate.cpa(); + auto cpaXY = candidate.cpaXY(); + + if (candidate.isSelLcToPKPi() >= selectionFlagLcToPKPi) { + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMass"), hfHelper.invMassLcToPKPi(candidate)); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPtVsMult"), hfHelper.invMassLcToPKPi(candidate), pt, multiplicity); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPKPi(candidate), pt); + } + if (candidate.isSelLcToPiKP() >= selectionFlagLcToPiKP) { + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMass"), hfHelper.invMassLcToPiKP(candidate)); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPtVsMult"), hfHelper.invMassLcToPiKP(candidate), pt, multiplicity); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPiKP(candidate), pt); + } + + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMultiplicity"), multiplicity); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPt"), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng0"), ptProng0); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng1"), ptProng1); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng2"), ptProng2); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0Prong0"), candidate.impactParameter0()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0Prong1"), candidate.impactParameter1()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0Prong2"), candidate.impactParameter2()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0VsPtProng0"), candidate.impactParameter0(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0VsPtProng1"), candidate.impactParameter1(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hd0VsPtProng2"), candidate.impactParameter2(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLength"), decayLength); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLengthVsPt"), decayLength, pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLengthxy"), decayLengthXY); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLengthxyVsPt"), decayLengthXY, pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCt"), hfHelper.ctLc(candidate)); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCtVsPt"), hfHelper.ctLc(candidate), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCPA"), cpa); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCPAVsPt"), cpa, pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCPAxy"), cpaXY); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hCPAxyVsPt"), cpaXY, pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDca2"), chi2PCA); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDca2VsPt"), chi2PCA, pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEta"), candidate.eta()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEtaVsPt"), candidate.eta(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhi"), phi); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhiVsPt"), phi, pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hSelectionStatus"), candidate.isSelLcToPKPi(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hSelectionStatus"), candidate.isSelLcToPiKP(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hImpParErrProng0"), candidate.errorImpactParameter0(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hImpParErrProng1"), candidate.errorImpactParameter1(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hImpParErrProng2"), candidate.errorImpactParameter2(), pt); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hDecLenErr"), candidate.errorDecayLength(), pt); + } + + // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- + // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + template + void fillTpcMftD0CandidateQa(float multiplicity, TTrack const& candidate) + { + float phi = candidate.phi(); + auto pt = candidate.pt(); + o2::math_utils::bringTo02Pi(phi); + + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0ToPiK(candidate)); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0barToKPi(candidate)); + } + + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandidate"), candidate.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPhiCandidate"), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMultiplicityCandidate"), multiplicity); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaPhiCandidate"), multiplicity, candidate.eta(), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hYieldsCandidate"), multiplicity, pt, candidate.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtCandidate"), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng0"), candidate.ptProng0()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng1"), candidate.ptProng1()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLength"), candidate.decayLength(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLengthXY"), candidate.decayLengthXY(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0Prong0"), candidate.impactParameter0(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0Prong1"), candidate.impactParameter1(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0d0"), candidate.impactParameterProduct(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hCTS"), hfHelper.cosThetaStarD0(candidate), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hCt"), hfHelper.ctD0(candidate), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hCPA"), candidate.cpa(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandVsPt"), candidate.eta(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hImpParErr"), candidate.errorImpactParameter0(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hImpParErr"), candidate.errorImpactParameter1(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLenErr"), candidate.errorDecayLength(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLenXYErr"), candidate.errorDecayLengthXY(), pt); + } + + // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- + // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + + template + void fillTpcMftLcCandidateQa(float multiplicity, TTrack const& candidate) + { + auto pt = candidate.pt(); + auto ptProng0 = candidate.ptProng0(); + auto ptProng1 = candidate.ptProng1(); + auto ptProng2 = candidate.ptProng2(); + auto decayLength = candidate.decayLength(); + auto decayLengthXY = candidate.decayLengthXY(); + auto chi2PCA = candidate.chi2PCA(); + auto cpa = candidate.cpa(); + auto cpaXY = candidate.cpaXY(); + float phi = candidate.phi(); + o2::math_utils::bringTo02Pi(phi); + + if (candidate.isSelLcToPKPi() >= selectionFlagLcToPKPi) { + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMass"), hfHelper.invMassLcToPKPi(candidate)); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPtVsMult"), hfHelper.invMassLcToPKPi(candidate), pt, multiplicity); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPKPi(candidate), pt); + } + if (candidate.isSelLcToPiKP() >= selectionFlagLcToPiKP) { + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMass"), hfHelper.invMassLcToPiKP(candidate)); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPtVsMult"), hfHelper.invMassLcToPiKP(candidate), pt, multiplicity); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPiKP(candidate), pt); + } + + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hYieldsCandidate"), multiplicity, pt, candidate.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaPhiCandidate"), multiplicity, candidate.eta(), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMultiplicityCandidate"), multiplicity); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPt"), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng0"), ptProng0); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng1"), ptProng1); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng2"), ptProng2); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0Prong0"), candidate.impactParameter0()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0Prong1"), candidate.impactParameter1()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0Prong2"), candidate.impactParameter2()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0VsPtProng0"), candidate.impactParameter0(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0VsPtProng1"), candidate.impactParameter1(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hd0VsPtProng2"), candidate.impactParameter2(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLength"), decayLength); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLengthVsPt"), decayLength, pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLengthxy"), decayLengthXY); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLengthxyVsPt"), decayLengthXY, pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hCt"), hfHelper.ctLc(candidate)); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hCtVsPt"), hfHelper.ctLc(candidate), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hCPA"), cpa); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hCPAVsPt"), cpa, pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hCPAxy"), cpaXY); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hCPAxyVsPt"), cpaXY, pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hDca2"), chi2PCA); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hDca2VsPt"), chi2PCA, pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEta"), candidate.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaVsPt"), candidate.eta(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhi"), candidate.phi()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhiVsPt"), candidate.phi(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hSelectionStatus"), candidate.isSelLcToPKPi(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hSelectionStatus"), candidate.isSelLcToPiKP(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hImpParErrProng0"), candidate.errorImpactParameter0(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hImpParErrProng1"), candidate.errorImpactParameter1(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hImpParErrProng2"), candidate.errorImpactParameter2(), pt); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hDecLenErr"), candidate.errorDecayLength(), pt); + } + + // ========================= + // Quality Assesment plots for Mixed Event + // ========================= + // ---- DATA : TPC-TPC h-h Mixed Event QA ---- template void fillTpcTpcChChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) @@ -573,11 +927,19 @@ struct HfTaskFlow { template void fillTpcTpcHfChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) { + // This function is only called with HF candidates + registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hMultiplicityHFMixing"), multiplicity); registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hVtxZHFMixing"), vz); int nTracks = tracks.size(); for (const auto& track1 : tracks) { + + // apply candidate cuts + if (!isAcceptedCandidate(track1)) { + continue; + } + registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hPtHFMixing"), track1.pt()); registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEtaHFMixing"), track1.eta()); registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hPhiHFMixing"), track1.phi()); @@ -585,80 +947,37 @@ struct HfTaskFlow { registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing"), nTracks); } - // ---- DATA : TPC-MFT h-h Same Event QA ---- - template - void fillTpcMftChChSameEventQa(float multiplicity, TTracks const& tracks) - { - int nTracks = tracks.size(); - bool isMFT = false; - for (const auto& track1 : tracks) { - if constexpr (std::is_same_v) { // if MFT tracks - isMFT = true; - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT"), track1.eta()); - float phi = track1.phi(); - o2::math_utils::bringTo02Pi(phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT"), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiMFT"), multiplicity, track1.eta(), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPtMFT"), track1.pt()); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT"), multiplicity, track1.pt(), track1.eta()); - } else { // if TPC tracks - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC"), track1.eta()); - float phi = track1.phi(); - o2::math_utils::bringTo02Pi(phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC"), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiTPC"), multiplicity, track1.eta(), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPtTPC"), track1.pt()); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hYieldsTPC"), multiplicity, track1.pt(), track1.eta()); - } - if (isMFT) { - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hNtracksMFT"), nTracks); - } else { - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hNtracksTPC"), nTracks); - } - } - } - - // ---- DATA : TPC-MFT HF-h Same Event QA ---- - template - void fillTpcMftHfChSameEventQa(float multiplicity, TTracks const& tracks) - { - // This is only called with MFT tracks, so no TPC case here - int nTracks = tracks.size(); - for (const auto& track1 : tracks) { - if constexpr (std::is_same_v) { // if MFT tracks - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaMFT"), track1.eta()); - float phi = track1.phi(); - o2::math_utils::bringTo02Pi(phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPhiMFT"), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaPhiMFT"), multiplicity, track1.eta(), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtMFT"), track1.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hYieldsMFT"), multiplicity, track1.pt(), track1.eta()); - } - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hNtracksMFT"), nTracks); - } - } - // ---- DATA : TPC-MFT h-h Mixed Event QA ---- template void fillTpcMftChChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) { if constexpr (std::is_same_v) { // if MFT tracks + int nTracks = tracks.size(); + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hMultiplicityMixingMFT"), multiplicity); registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hVtxZMixingMFT"), vz); - int nTracks = tracks.size(); for (const auto& track1 : tracks) { + + // apply cuts for MFT tracks + if (!isAcceptedMftTrack(track1)) { + continue; + } + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hPtMixingMFT"), track1.pt()); registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEtaMixingMFT"), track1.eta()); registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hPhiMixingMFT"), track1.phi()); } registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hNtracksMixingMFT"), nTracks); } else { // if TPC tracks + + int nTracks = tracks.size(); + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hMultiplicityMixingTPC"), multiplicity); registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hVtxZMixingTPC"), vz); - int nTracks = tracks.size(); for (const auto& track1 : tracks) { + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hPtMixingTPC"), track1.pt()); registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEtaMixingTPC"), track1.eta()); registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hPhiMixingTPC"), track1.phi()); @@ -677,6 +996,12 @@ struct HfTaskFlow { int nTracks = tracks.size(); for (const auto& track1 : tracks) { + + // apply cuts for MFT tracks + if (!isAcceptedMftTrack(track1)) { + continue; + } + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hPtMixingMFT"), track1.pt()); registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEtaMixingMFT"), track1.eta()); registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hPhiMixingMFT"), track1.phi()); @@ -688,6 +1013,12 @@ struct HfTaskFlow { int nTracks = tracks.size(); for (const auto& track1 : tracks) { + + // apply candidate cuts + if (!isAcceptedCandidate(track1)) { + continue; + } + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hPtMixingCandidate"), track1.pt()); registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEtaMixingCandidate"), track1.eta()); registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hPhiMixingCandidate"), track1.phi()); @@ -696,16 +1027,76 @@ struct HfTaskFlow { } } + // ========================= + // Cuts with functions + // ========================= + + // FIXME: Some collisions are rejected here, what causes (part of) differences with the D0 task + template + bool isCollisionSelected(TCollision const& collision, bool fillHistograms = false) + { + if (fillHistograms) + registry.fill(HIST("Data/hEventCounter"), 1); + + if (processMc == false) { + if (!collision.sel8()) { + return false; + } + } + + if (fillHistograms) + registry.fill(HIST("Data/hEventCounter"), 3); + + return true; + } + // TODO: Check how to put this into a Filter template bool isAcceptedCandidate(TTrack const& candidate) { - if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + auto etaCandidate = candidate.eta(); + + if constexpr (std::is_same_v) { // For now, that means we do LambdaC + if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { + return false; + } + if (yCandMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandMax) { + return false; + } + if (etaCandidateMax >= 0. && std::abs(etaCandidate) > etaCandidateMax) { + return false; + } + return true; + } else { // For now, that means we do D0 + if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + return false; + } + if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate)) > yCandMax) { + return false; + } + if (etaCandidateMax >= 0. && std::abs(etaCandidate) > etaCandidateMax) { + return false; + } + return true; + } + } + + // TODO: Check how to put this into a Filter + // I tried to put it as a filter, but filters for normal TPC tracks also apply to MFT tracks I think + // and it seems that they are not compatible + template + bool isAcceptedMftTrack(TTrack const& mftTrack) + { + // cut on the eta of MFT tracks + if (mftTrack.eta() > etaMftTrackMax || mftTrack.eta() < etaMftTrackMin) { return false; } - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate)) > yCandMax) { + + // cut on the number of clusters of the reconstructed MFT track + if (mftTrack.nClusters() < nClustersMftTrack) { return false; } + return true; } @@ -728,103 +1119,24 @@ struct HfTaskFlow { return true; } - // ---- DATA : TPC-TPC HF-h Same Event (Candidates) QA ---- - // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works - template - void fillTpcTpcCandidateQa(TTracks const& candidates) - { - for (const auto& candidate : candidates) { - if (!isAcceptedCandidate(candidate)) { - continue; - } - - if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hMass"), hfHelper.invMassD0ToPiK(candidate)); - } - if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hMass"), hfHelper.invMassD0barToKPi(candidate)); - } - - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPtCandidate"), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPtProng0"), candidate.ptProng0()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPtProng1"), candidate.ptProng1()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hDecLength"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hCt"), hfHelper.ctD0(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hCPA"), candidate.cpa(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hEtaCandVsPt"), candidate.eta(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); - } - } - - // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- - // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works - template - void fillTpcMftCandidateQa(TTracks const& candidates, float multiplicity) - { - int nTracks = candidates.size(); - for (const auto& candidate : candidates) { - if (!isAcceptedCandidate(candidate)) { - continue; - } - - if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hMass"), hfHelper.invMassD0ToPiK(candidate)); - } - if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hMass"), hfHelper.invMassD0barToKPi(candidate)); - } - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaCandidate"), candidate.eta()); - float phi = candidate.phi(); - o2::math_utils::bringTo02Pi(phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPhiCandidate"), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaPhiCandidate"), multiplicity, candidate.eta(), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hYieldsCandidate"), multiplicity, candidate.pt(), candidate.eta()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hNtracksCandidate"), nTracks); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtCandidate"), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtProng0"), candidate.ptProng0()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtProng1"), candidate.ptProng1()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hDecLength"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hCt"), hfHelper.ctD0(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hCPA"), candidate.cpa(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaCandVsPt"), candidate.eta(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); - } - } - // ========================= // Correlation functions // ========================= template - void fillCorrelations(TTarget target, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, float multiplicity, float posZ) + void fillCorrelations(TTarget target, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, float multiplicity, float posZ, bool sameEvent) { auto triggerWeight = 1; auto associatedWeight = 1; + // To avoid filling associated tracks QA many times + // I fill it only for the first trigger track of the collision + auto loopCounter = 0; + for (const auto& track1 : tracks1) { + loopCounter++; + float eta1 = track1.eta(); float pt1 = track1.pt(); float phi1 = track1.phi(); @@ -837,13 +1149,19 @@ struct HfTaskFlow { // TO DO ? Add one more if condition if its MC ? bool fillingHFcontainer = false; double invmass = 0; - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v || std::is_same_v) { // TODO: Check how to put this into a Filter if (!isAcceptedCandidate(track1)) { continue; } fillingHFcontainer = true; - invmass = hfHelper.invMassD0ToPiK(track1); + if constexpr (std::is_same_v) { // If D0 + invmass = hfHelper.invMassD0ToPiK(track1); + // Should add D0 bar ? + } else { // If Lc + invmass = hfHelper.invMassLcToPKPi(track1); + // Should add Lc bar ? (maybe not its the same mass right ?) + } } // From Katarina's code @@ -864,8 +1182,41 @@ struct HfTaskFlow { target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, invmass, triggerWeight); } + // FILL QA PLOTS for trigger particle + if (sameEvent) { + // if constexpr (std::is_same_v) { // If DATA + if constexpr (!std::is_same_v) { // IF TPC-TPC case + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h + fillTpcTpcD0CandidateQa(multiplicity, track1); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h + fillTpcTpcLcCandidateQa(multiplicity, track1); + } else { // IF NEITHER D0 NOR LC -> TPC-TPC h-h + fillTpcTpcChChSameEventQa(multiplicity, track1); + } + } else { // IF TPC-MFT case + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h + fillTpcMftD0CandidateQa(multiplicity, track1); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h + fillTpcMftLcCandidateQa(multiplicity, track1); + } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h + fillTpcMftChChSameEventQa(multiplicity, track1, true); + } // end of if condition for TPC-TPC or TPC-MFT case + } + // Maybe I won't need it for MC (first files are way lighter in MC, but also I need to loop over all tracks in MC GEN) + //} else { // If MC (add cases later) + // fillTpcTpcChChSameEventQaMc(multiplicityTracks2, vz, tracks1); + //} + } + for (const auto& track2 : tracks2) { + // apply cuts for MFT tracks + if constexpr (std::is_same_v) { + if (!isAcceptedMftTrack(track2)) { + continue; + } + } + // case of h-h correlations where the two types of tracks are the same // this avoids autocorrelations and double counting of particle pairs if constexpr (std::is_same_v) { @@ -876,12 +1227,17 @@ struct HfTaskFlow { // in case of HF-h correlations, remove candidate daughters from the pool of associated hadrons // with which the candidate is being correlated (will not have to do it for TPC-MFT case) - if constexpr (!std::is_same_v) { // if NOT TPC-MFT case -> TPC-TPC case - if constexpr (std::is_same_v) { + if constexpr (!std::is_same_v) { // if NOT TPC-MFT case -> TPC-TPC case + if constexpr (std::is_same_v) { // Remove the 2 prong daughters if ((track1.prong0Id() == track2.globalIndex()) || (track1.prong1Id() == track2.globalIndex())) { continue; } } + if constexpr (std::is_same_v) { // Remove the 3 prong daughters + if ((track1.prong0Id() == track2.globalIndex()) || (track1.prong1Id() == track2.globalIndex()) || (track1.prong2Id() == track2.globalIndex())) { + continue; + } + } } // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary @@ -914,12 +1270,35 @@ struct HfTaskFlow { target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, triggerWeight * associatedWeight); } - } - } + + // FILL QA PLOTS for associated particle + if (sameEvent && (loopCounter == 1)) { + // if constexpr (std::is_same_v) { // If DATA + if constexpr (!std::is_same_v) { // IF TPC-TPC case + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h + fillTpcTpcHfChSameEventQa(multiplicity, track2); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h + fillTpcTpcHfChSameEventQa(multiplicity, track2); + } + // No if condition if it is h-h, because it would be the same plots than for the trigger particle + } else { // IF TPC-MFT case + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h + fillTpcMftHfChSameEventQa(multiplicity, track2); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h + fillTpcMftHfChSameEventQa(multiplicity, track2); + } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h + fillTpcMftChChSameEventQa(multiplicity, track2, false); + } // end of if condition for TPC-TPC or TPC-MFT case + } + //} else { // If MC (add cases later) + // fillTpcTpcChChSameEventQaMc(multiplicityTracks2, vz, tracks1); + //} + } + + } // end of loop over tracks2 + } // end of loop over tracks 1 } - // template - // void mixCollisions(FilteredCollisionsWSelMult const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) template void mixCollisions(TCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) { @@ -944,17 +1323,17 @@ struct HfTaskFlow { auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); int bin = binningWithTracksSize.getBin(binningValues); - // const auto multiplicityTracks1 = getPartsSize(collision1); - // const auto multiplicityTracks2 = getPartsSize(collision2); - const auto multiplicityTracks1 = tracks1.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing - const auto multiplicityTracks2 = tracks2.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing + const auto multiplicityTracks1 = getPartsSize(collision1); + const auto multiplicityTracks2 = getPartsSize(collision2); + // const auto multiplicityTracks1 = tracks1.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing + // const auto multiplicityTracks2 = tracks2.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing const auto vz = collision1.posZ(); if constexpr (std::is_same_v) { // If MC registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); - fillTpcTpcChChMixedEventQaMc(multiplicityTracks2, vz, tracks1); + // fillTpcTpcChChMixedEventQaMc(multiplicityTracks2, vz, tracks1); - // if constexpr (std::is_same_v) { + // if constexpr (std::is_same_v || std::is_same_v) { // registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); // fillHFMixingQA(multiplicity, vz, tracks1); // } else { @@ -962,9 +1341,9 @@ struct HfTaskFlow { // fillMixingQA(multiplicity, vz, tracks1); // } - } else { // If not MC - if constexpr (std::is_same_v) { // IF TPC-MFT case - if constexpr (std::is_same_v) { // IF HF-h case -> TPC-MFT HF-h + } else { // If not MC + if constexpr (std::is_same_v) { // IF TPC-MFT case + if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-MFT HF-h registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing"), bin); fillTpcMftHfChMixedEventQa(multiplicityTracks1, vz, tracks1); // Candidates fillTpcMftHfChMixedEventQa(multiplicityTracks2, vz, tracks2); // MFT tracks @@ -973,8 +1352,8 @@ struct HfTaskFlow { fillTpcMftChChMixedEventQa(multiplicityTracks1, vz, tracks1); // TPC tracks fillTpcMftChChMixedEventQa(multiplicityTracks2, vz, tracks2); // MFT tracks } - } else { // IF TPC-TPC case - if constexpr (std::is_same_v) { // IF HF-h case -> TPC-TPC HF-h + } else { // IF TPC-TPC case + if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-TPC HF-h registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); fillTpcTpcHfChMixedEventQa(multiplicityTracks2, vz, tracks1); } else { // IF h-h case -> TPC-TPC h-h case @@ -984,8 +1363,8 @@ struct HfTaskFlow { } // end of if condition for TPC-TPC or TPC-MFT case } - corrContainer->fillEvent(multiplicityTracks2, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(corrContainer, tracks1, tracks2, multiplicityTracks1, collision1.posZ()); + corrContainer->fillEvent(multiplicityTracks1, CorrelationContainer::kCFStepReconstructed); + fillCorrelations(corrContainer, tracks1, tracks2, multiplicityTracks1, collision1.posZ(), false); } } @@ -1017,14 +1396,14 @@ struct HfTaskFlow { int bin = binningWithTracksSize.getBin(binningValues); const auto multiplicity = tracks2.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing - const auto vz = collision1.posZ(); + // const auto vz = collision1.posZ(); // TO BE DONE : ADD ONE MORE IF CONDITION TO FILL THE MC CASE // TODO : FILL NEW PLOTS FOR MCTRUTH ONLY registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); - fillTpcTpcChChMixedEventQaMc(multiplicity, vz, tracks1); + // fillTpcTpcChChMixedEventQaMc(multiplicity, vz, tracks1); - // if constexpr (std::is_same_v) { + // if constexpr (std::is_same_v || std::is_same_v) { // registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); // fillHFMixingQA(multiplicity, vz, tracks1); // } else { @@ -1033,7 +1412,7 @@ struct HfTaskFlow { // } corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(corrContainer, tracks1, tracks2, multiplicity, collision1.posZ()); + fillCorrelations(corrContainer, tracks1, tracks2, multiplicity, collision1.posZ(), false); } } @@ -1053,7 +1432,8 @@ struct HfTaskFlow { // options are ran at the same time // temporary solution, since other correlation options always have to be ran with h-h, too // TODO: rewrite it in a more intelligent way - const auto multiplicity = tracks.size(); + // const auto multiplicity = tracks.size(); + const auto multiplicity = collision.multNTracksPV(); registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hMultiplicity"), multiplicity); registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hVtxZ"), collision.posZ()); @@ -1063,19 +1443,47 @@ struct HfTaskFlow { sameTPCTPCChCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillTpcTpcChChSameEventQa(multiplicity, tracks); // TO-DO : add if condition for when we will implant corrected correlations (kCFStepReconstructed -> kCFStepCorrected) - fillCorrelations(sameTPCTPCChCh, tracks, tracks, multiplicity, collision.posZ()); + fillCorrelations(sameTPCTPCChCh, tracks, tracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChCh, "DATA : Process same-event correlations for TPC-TPC h-h case", false); // ===================================== - // DATA : process same event correlations: TPC-TPC HF-h case + // DATA : process same event correlations: TPC-TPC HF-h case for D0 + // ===================================== + + void processSameTpcTpcD0Ch(FilteredCollisionsWSelMult::iterator const& collision, + TracksWDcaSel const& tracks, + HfCandidatesSelD0 const& candidates) + { + auto fillEventSelectionPlots = true; + + // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice + if (doReferenceFlow) + fillEventSelectionPlots = false; + + if (!(isCollisionSelected(collision, fillEventSelectionPlots))) { + return; + } + + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); + + sameTPCTPCHfCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + + fillCorrelations(sameTPCTPCHfCh, candidates, tracks, multiplicity, collision.posZ(), true); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcD0Ch, "DATA : Process same-event correlations for TPC-TPC D0-h case", false); + + // ===================================== + // DATA : process same event correlations: TPC-TPC HF-h case for Lc // ===================================== - void processSameTpcTpcHfCh(FilteredCollisionsWSelMult::iterator const& collision, + void processSameTpcTpcLcCh(FilteredCollisionsWSelMult::iterator const& collision, TracksWDcaSel const& tracks, - HfCandidatesSel const& candidates) + HfCandidatesSelLc const& candidates) { auto fillEventSelectionPlots = true; @@ -1086,14 +1494,17 @@ struct HfTaskFlow { if (!(isCollisionSelected(collision, fillEventSelectionPlots))) { return; } - const auto multiplicity = tracks.size(); + + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEventCountSame"), bin); sameTPCTPCHfCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillTpcTpcCandidateQa(candidates); - fillCorrelations(sameTPCTPCHfCh, candidates, tracks, multiplicity, collision.posZ()); + fillCorrelations(sameTPCTPCHfCh, candidates, tracks, multiplicity, collision.posZ(), true); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcHfCh, "DATA : Process same-event correlations for TPC-TPC HF-h case", false); + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcLcCh, "DATA : Process same-event correlations for TPC-TPC Lc-h case", false); // ===================================== // DATA : process same event correlations: TPC-MFT h-h case @@ -1107,22 +1518,24 @@ struct HfTaskFlow { return; } - const auto multiplicityTPC = tracks.size(); - const auto multiplicityMFT = mftTracks.size(); + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); + + sameTPCMFTChCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - sameTPCMFTChCh->fillEvent(multiplicityTPC, CorrelationContainer::kCFStepReconstructed); - fillTpcMftChChSameEventQa(multiplicityTPC, tracks); - fillTpcMftChChSameEventQa(multiplicityMFT, mftTracks); - fillCorrelations(sameTPCMFTChCh, tracks, mftTracks, multiplicityTPC, collision.posZ()); + fillCorrelations(sameTPCMFTChCh, tracks, mftTracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChCh, "DATA : Process same-event correlations for TPC-MFT h-h case", false); // ===================================== - // DATA : process same event correlations: TPC-MFT HF-h case + // DATA : process same event correlations: TPC-MFT HF-h case for D0 // ===================================== - void processSameTpcMftHfCh(FilteredCollisionsWSelMult::iterator const& collision, - HfCandidatesSel const& candidates, + void processSameTpcMftD0Ch(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelD0 const& candidates, + TracksWDcaSel const& /*tracks*/, aod::MFTTracks const& mftTracks) { auto fillEventSelectionPlots = true; @@ -1135,15 +1548,46 @@ struct HfTaskFlow { return; } - const auto multiplicityCandidates = candidates.size(); - const auto multiplicityMFT = mftTracks.size(); + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); + + sameTPCMFTHfCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - sameTPCMFTHfCh->fillEvent(multiplicityCandidates, CorrelationContainer::kCFStepReconstructed); - fillTpcMftCandidateQa(candidates, multiplicityCandidates); - fillTpcMftHfChSameEventQa(multiplicityMFT, mftTracks); - fillCorrelations(sameTPCMFTHfCh, candidates, mftTracks, multiplicityCandidates, collision.posZ()); + fillCorrelations(sameTPCMFTHfCh, candidates, mftTracks, multiplicity, collision.posZ(), true); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcMftHfCh, "DATA : Process same-event correlations for TPC-MFT HF-h case", false); + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftD0Ch, "DATA : Process same-event correlations for TPC-MFT D0-h case", false); + + // ===================================== + // DATA : process same event correlations: TPC-MFT HF-h case for Lc + // ===================================== + + void processSameTpcMftLcCh(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelLc const& candidates, + TracksWDcaSel const& /*tracks*/, + aod::MFTTracks const& mftTracks) + { + auto fillEventSelectionPlots = true; + + // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice + if (doReferenceFlow) + fillEventSelectionPlots = false; + + if (!(isCollisionSelected(collision, fillEventSelectionPlots))) { + return; + } + + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEventCountSame"), bin); + + sameTPCMFTHfCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + + fillCorrelations(sameTPCMFTHfCh, candidates, mftTracks, multiplicity, collision.posZ(), true); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftLcCh, "DATA : Process same-event correlations for TPC-MFT Lc-h case", false); // ===================================== // MONTE-CARLO : process same event correlations: TPC-TPC h-h case @@ -1158,7 +1602,7 @@ struct HfTaskFlow { // return; //} - const auto multiplicity = mcTracks.size(); + const auto multiplicity = mcCollision.multNTracksPV(); registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicity"), multiplicity); registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hVtxZ"), mcCollision.posZ()); @@ -1169,7 +1613,7 @@ struct HfTaskFlow { sameTPCTPCChChMC->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillTpcTpcChChSameEventQaMc(multiplicity, mcTracks); - fillCorrelations(sameTPCTPCChChMC, mcTracks, mcTracks, multiplicity, mcCollision.posZ()); + fillCorrelations(sameTPCTPCChChMC, mcTracks, mcTracks, multiplicity, mcCollision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChChmcREC, "MONTE-CARLO : Process same-event correlations for TPC-TPC h-h case", false); @@ -1188,11 +1632,13 @@ struct HfTaskFlow { //} // if (!collision.has_mcCollision()) { - // LOGF(warning, "No MC collision for this collision, skip..."); + // LOGF(info, "No MC collision for this collision, skip..."); // return; // } + // TODO : check if I have to get my multiplicity based on multNTracksPV or mcParticles.size() const auto multiplicity = mcParticles.size(); // Note: these are all MC particles after selection (not only primary) + // const auto multiplicity = collision.multNTracksPV(); registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicity"), multiplicity); registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hVtxZ"), mcCollision.posZ()); @@ -1200,7 +1646,7 @@ struct HfTaskFlow { // In Katka's code, the first time doing this does not fill the histograms, right now will be filled two times.. auto multPrimaryCharge0 = fillTpcTpcChChSameEventQaMc(multiplicity, mcParticles); sameTPCTPCChChMC->fillEvent(multPrimaryCharge0, CorrelationContainer::kCFStepAll); - fillCorrelations(sameTPCTPCChChMC, mcParticles, mcParticles, multPrimaryCharge0, mcCollision.posZ()); + fillCorrelations(sameTPCTPCChChMC, mcParticles, mcParticles, multPrimaryCharge0, mcCollision.posZ(), true); // NOT USED BY KATARINA APPARENTLY // BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; @@ -1212,7 +1658,7 @@ struct HfTaskFlow { // This line below for sure induce that some plots are filled two times // multPrimaryCharge0 = fillTpcTpcChChSameEventQaMc(multiplicity, mcParticles); // sameTPCTPCChChMC->fillEvent(multPrimaryCharge0, CorrelationContainer::kCFStepVertex); - // fillCorrelations(sameTPCTPCChChMC, mcParticles, mcParticles, multPrimaryCharge0, mcCollision.posZ()); + // fillCorrelations(sameTPCTPCChChMC, mcParticles, mcParticles, multPrimaryCharge0, mcCollision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChChmcGEN, "MONTE-CARLO : Process same-event correlations for TPC-TPC h-h case", false); @@ -1225,35 +1671,59 @@ struct HfTaskFlow { TracksWDcaSel const& tracks) { // we want to group collisions based on charged-track multiplicity - auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { - auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once - auto size = associatedTracks.size(); - return size; + // auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { + // auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once + // auto size = associatedTracks.size(); + // return size; + // }; + + auto getMultiplicity = [&collisions, this](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; }; - mixCollisions(collisions, tracks, tracks, getTracksSize, mixedTPCTPCChCh); + // mixCollisions(collisions, tracks, tracks, getTracksSize, mixedTPCTPCChCh); + mixCollisions(collisions, tracks, tracks, getMultiplicity, mixedTPCTPCChCh); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChCh, "DATA : Process mixed-event correlations for TPC-TPC h-h case", false); // ===================================== - // DATA : process mixed event correlations: TPC-TPC HF-h case + // DATA : process mixed event correlations: TPC-TPC HF-h case for D0 + // ===================================== + + void processMixedTpcTpcD0Ch(FilteredCollisionsWSelMult const& collisions, + TracksWDcaSel const& tracks, + HfCandidatesSelD0 const& candidates) + { + // we want to group collisions based on charged-track multiplicity + auto getMultiplicity = [&collisions, this](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; + }; + + mixCollisions(collisions, candidates, tracks, getMultiplicity, mixedTPCTPCHfCh); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcD0Ch, "DATA : Process mixed-event correlations for TPC-TPC D0-h case", false); + + // ===================================== + // DATA : process mixed event correlations: TPC-TPC HF-h case for Lc // ===================================== - void processMixedTpcTpcHfCh(FilteredCollisionsWSelMult const& collisions, + void processMixedTpcTpcLcCh(FilteredCollisionsWSelMult const& collisions, TracksWDcaSel const& tracks, - HfCandidatesSel const& candidates) + HfCandidatesSelLc const& candidates) { // we want to group collisions based on charged-track multiplicity - auto getTracksSize = [&candidates, this](FilteredCollisionsWSelMult::iterator const& col) { + auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { // Still o2::aod::track::collisionId with HF ??? -> I don't think so - auto associatedTracks = candidates.sliceByCached(o2::aod::hf_cand::collisionId, col.globalIndex(), this->cache); + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); auto size = associatedTracks.size(); return size; }; mixCollisions(collisions, candidates, tracks, getTracksSize, mixedTPCTPCHfCh); } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcHfCh, "DATA : Process mixed-event correlations for TPC-TPC HF-h case", false); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcLcCh, "DATA : Process mixed-event correlations for TPC-TPC Lc-h case", false); // ===================================== // DATA : process mixed event correlations: TPC-MFT h-h case @@ -1264,35 +1734,58 @@ struct HfTaskFlow { aod::MFTTracks const& mftTracks) { // we want to group collisions based on charged-track multiplicity - auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { - auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); - auto size = associatedTracks.size(); - return size; + // auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { + // auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); + // auto size = associatedTracks.size(); + // return size; + // }; + + auto getMultiplicity = [&collisions, this](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; }; - mixCollisions(collisions, tracks, mftTracks, getTracksSize, mixedTPCMFTChCh); + mixCollisions(collisions, tracks, mftTracks, getMultiplicity, mixedTPCMFTChCh); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftChCh, "DATA : Process mixed-event correlations for TPC-MFT h-h case", false); + // ===================================== + // DATA : process mixed event correlations: TPC-MFT HF-h case for D0 + // ===================================== + + void processMixedTpcMftD0Ch(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSelD0 const& candidates, + aod::MFTTracks const& mftTracks, + TracksWDcaSel const& /*tracks*/) + { + // we want to group collisions based on charged-track multiplicity + auto getMultiplicity = [&collisions, this](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; + }; + + mixCollisions(collisions, candidates, mftTracks, getMultiplicity, mixedTPCMFTHfCh); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftD0Ch, "DATA : Process mixed-event correlations for TPC-MFT D0-h case", false); + // ===================================== // DATA : process mixed event correlations: TPC-MFT HF-h case // ===================================== - void processMixedTpcMftHfCh(FilteredCollisionsWSelMult const& collisions, - HfCandidatesSel const& candidates, + void processMixedTpcMftLcCh(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSelLc const& candidates, aod::MFTTracks const& mftTracks) { + // we want to group collisions based on charged-track multiplicity - auto getTracksSize = [&candidates, this](FilteredCollisionsWSelMult::iterator const& col) { - // Still o2::aod::track::collisionId with HF ??? -> I don't think so - auto associatedTracks = candidates.sliceByCached(o2::aod::hf_cand::collisionId, col.globalIndex(), this->cache); - auto size = associatedTracks.size(); - return size; + auto getMultiplicity = [&collisions, this](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; }; - mixCollisions(collisions, candidates, mftTracks, getTracksSize, mixedTPCMFTHfCh); + mixCollisions(collisions, candidates, mftTracks, getMultiplicity, mixedTPCMFTHfCh); } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftHfCh, "DATA : Process mixed-event correlations for TPC-MFT HF-h case", false); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftLcCh, "DATA : Process mixed-event correlations for TPC-MFT Lc-h case", false); // ===================================== // MONTE-CARLO : process mixed event correlations: TPC-TPC h-h case diff --git a/PWGHF/HFC/Utils/utilsCorrelations.h b/PWGHF/HFC/Utils/utilsCorrelations.h new file mode 100644 index 00000000000..20d007b3e29 --- /dev/null +++ b/PWGHF/HFC/Utils/utilsCorrelations.h @@ -0,0 +1,156 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file utilsCorrelations.h +/// \brief Utilities for HFC analyses +/// \author Xu Wang + +#ifndef PWGHF_HFC_UTILS_UTILSCORRELATIONS_H_ +#define PWGHF_HFC_UTILS_UTILSCORRELATIONS_H_ + +#include +#include + +#include "CommonConstants/PhysicsConstants.h" + +namespace o2::analysis::hf_correlations +{ +enum Region { + Default = 0, + Toward, + Away, + Transverse +}; + +enum PairSign { + SignNotDefined = 0, + LcPosTrkPos, + LcPosTrkNeg, + LcNegTrkPos, + LcNegTrkNeg +}; + +template +Region getRegion(T const deltaPhi) +{ + if (std::abs(deltaPhi) < o2::constants::math::PIThird) { + return Toward; + } else if (deltaPhi > 2. * o2::constants::math::PIThird && deltaPhi < 4. * o2::constants::math::PIThird) { + return Away; + } else { + return Transverse; + } +} + +// Pair Sign Calculation +template +int signCalulation(TrgPt const& trigPt, TrkPt const& assocPt) +{ + int sign = 0; + if (trigPt > 0. && assocPt > 0.) { + sign = LcPosTrkPos; + } else if (trigPt > 0. && assocPt < 0.) { + sign = LcPosTrkNeg; + } else if (trigPt < 0. && assocPt > 0.) { + sign = LcNegTrkPos; + } else if (trigPt < 0. && assocPt < 0.) { + sign = LcNegTrkNeg; + } else { + sign = SignNotDefined; + } + return sign; +} + +template +bool passPIDSelection(Atrack const& track, SpeciesContainer const mPIDspecies, + T1 const maxTPC, T2 const maxTOF, double ptThreshold = 0.75, bool tofForced = false) +{ + // Ensure size consistency + if (mPIDspecies.value.size() != maxTPC.value.size() || mPIDspecies.value.size() != maxTOF.value.size()) { + LOGF(error, "Size of particle species and corresponding nSigma selection arrays should be the same"); + return false; // Early exit on error + } + + for (size_t speciesIndex = 0; speciesIndex < mPIDspecies.value.size(); ++speciesIndex) { + auto const& pid = mPIDspecies->at(speciesIndex); + auto nSigmaTPC = o2::aod::pidutils::tpcNSigma(pid, track); + + if (tofForced && !track.hasTOF()) + return false; + + if (speciesIndex == 0) { // First species logic + if (std::abs(nSigmaTPC) > maxTPC->at(speciesIndex)) { + return false; // TPC check failed + } + if (tofForced || (track.pt() > ptThreshold && track.hasTOF())) { + auto nSigmaTOF = o2::aod::pidutils::tofNSigma(pid, track); + if (std::abs(nSigmaTOF) > maxTOF->at(speciesIndex)) { + return false; // TOF check failed + } + } + } else { // Other species logic + if (std::abs(nSigmaTPC) < maxTPC->at(speciesIndex)) { // Check TPC nSigma first + if (track.hasTOF()) { + auto nSigmaTOF = o2::aod::pidutils::tofNSigma(pid, track); + if (std::abs(nSigmaTOF) < maxTOF->at(speciesIndex)) { + return false; // Reject if both TPC and TOF are within thresholds + } + } else { + return false; // Reject if only TPC is within threshold and TOF is unavailable + } + } + } + } + return true; // Passed all checks +} + +// ========= Find Leading Particle ============== +template +int findLeadingParticle(TTracks const& tracks, T1 const dcaXYTrackMax, T2 const dcaZTrackMax, T3 const etaTrackMax) +{ + auto leadingParticle = tracks.begin(); + for (auto const& track : tracks) { + if (std::abs(track.dcaXY()) >= dcaXYTrackMax || std::abs(track.dcaZ()) >= dcaZTrackMax) { + continue; + } + if (std::abs(track.eta()) > etaTrackMax) { + continue; + } + if (track.pt() > leadingParticle.pt()) { + leadingParticle = track; + } + } + return leadingParticle.globalIndex(); +} + +// ======= Find Leading Particle for McGen ============ +template +int findLeadingParticleMcGen(TMcParticles const& mcParticles, T1 const etaTrackMax, T2 const ptTrackMin) +{ + auto leadingParticle = mcParticles.begin(); + for (auto const& mcParticle : mcParticles) { + if (std::abs(mcParticle.eta()) > etaTrackMax) { + continue; + } + if (mcParticle.pt() < ptTrackMin) { + continue; + } + if ((std::abs(mcParticle.pdgCode()) != kElectron) && (std::abs(mcParticle.pdgCode()) != kMuonMinus) && (std::abs(mcParticle.pdgCode()) != kPiPlus) && (std::abs(mcParticle.pdgCode()) != kKPlus) && (std::abs(mcParticle.pdgCode()) != kProton)) { + continue; + } + if (mcParticle.pt() > leadingParticle.pt()) { + leadingParticle = mcParticle; + } + } + return leadingParticle.globalIndex(); +} +} // namespace o2::analysis::hf_correlations +#endif // PWGHF_HFC_UTILS_UTILSCORRELATIONS_H_ diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index fe6bb764573..e86fe36813f 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -135,7 +135,7 @@ struct HfTaskElectronWeakBoson { } void process(soa::Filtered::iterator const& collision, - SelectedClusters const& emcClusters, + SelectedClusters const&, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) { @@ -206,8 +206,8 @@ struct HfTaskElectronWeakBoson { // LOG(info) << "tr phi1 = " << track.phi(); // LOG(info) << "emc phi = " << phiEmc; if (nMatch == 0) { - double dEta = match.track_as().eta() - etaEmc; - double dPhi = match.track_as().phi() - phiEmc; + double dEta = match.track_as().trackEtaEmcal() - etaEmc; + double dPhi = match.track_as().trackPhiEmcal() - phiEmc; dPhi = RecoDecay::constrainAngle(dPhi, -o2::constants::math::PI); registry.fill(HIST("hMatchPhi"), phiEmc, match.track_as().phi()); diff --git a/PWGHF/HFL/Tasks/taskSingleMuon.cxx b/PWGHF/HFL/Tasks/taskSingleMuon.cxx index fc70cfecc35..73445124ae9 100644 --- a/PWGHF/HFL/Tasks/taskSingleMuon.cxx +++ b/PWGHF/HFL/Tasks/taskSingleMuon.cxx @@ -56,8 +56,8 @@ struct HfTaskSingleMuonSelectionAmbiguousMftIndexBuilder { }; struct HfTaskSingleMuon { - Configurable trkType{"trkType", 0, "Muon track type, valid values are 0, 1, 2, 3 and 4"}; - Configurable mcMaskSelection{"mcMaskSelection", 0, "McMask for correct match, valid values are 0 and 128"}; + Configurable trkType{"trkType", 0u, "Muon track type, valid values are 0, 1, 2, 3 and 4"}; + Configurable mcMaskSelection{"mcMaskSelection", 0u, "McMask for correct match, valid values are 0 and 128"}; Configurable etaMin{"etaMin", -3.6, "eta minimum value"}; Configurable etaMax{"etaMax", -2.5, "eta maximum value"}; Configurable pDcaMin{"pDcaMin", 324., "p*DCA maximum value for small Rabs"}; diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index 4f8f1ba49cf..f1ac9e9087a 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -109,7 +109,7 @@ o2physics_add_dpl_workflow(candidate-selector-b0-to-d-pi o2physics_add_dpl_workflow(candidate-selector-bplus-to-d0-pi SOURCES candidateSelectorBplusToD0Pi.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-selector-bs-to-ds-pi @@ -276,6 +276,11 @@ o2physics_add_dpl_workflow(tree-creator-dstar-to-d0-pi # Derived-data creators +o2physics_add_dpl_workflow(derived-data-creator-bplus-to-d0-pi + SOURCES derivedDataCreatorBplusToD0Pi.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(derived-data-creator-d0-to-k-pi SOURCES derivedDataCreatorD0ToKPi.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -285,3 +290,10 @@ o2physics_add_dpl_workflow(derived-data-creator-lc-to-p-k-pi SOURCES derivedDataCreatorLcToPKPi.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +# Converters + +o2physics_add_dpl_workflow(converter-dstar-indices + SOURCES converterDstarIndices.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index 59426b210bb..8b464257ce6 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -20,6 +20,10 @@ #define HomogeneousField #endif +#include +#include +#include + #include #include #include @@ -78,15 +82,12 @@ struct HfCandidateCreator2Prong { // magnetic field setting from CCDB Configurable isRun2{"isRun2", false, "enable Run 2 or Run 3 GRP objects for magnetic field"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable ccdbPathLut{"ccdbPathLut", "GLO/Param/MatLUT", "Path for LUT parametrization"}; Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; HfEventSelection hfEvSel; // event selection and monitoring o2::vertexing::DCAFitterN<2> df; // 2-prong vertex fitter Service ccdb; - o2::base::MatLayerCylSet* lut; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; using TracksWCovExtraPidPiKa = soa::Join; @@ -168,7 +169,6 @@ struct HfCandidateCreator2Prong { ccdb->setURL(ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(ccdbPathLut)); runNumber = 0; /// candidate monitoring @@ -204,7 +204,7 @@ struct HfCandidateCreator2Prong { auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; - initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); + initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); bz = o2::base::Propagator::Instance()->getNominalBz(); LOG(info) << ">>>>>>>>>>>> Magnetic field: " << bz; // df.setBz(bz); /// put it outside the 'if'! Otherwise we have a difference wrt bz Configurable (< 1 permille) in Run2 conv. data @@ -349,7 +349,7 @@ struct HfCandidateCreator2Prong { auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; - initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); + initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); bz = o2::base::Propagator::Instance()->getNominalBz(); LOG(info) << ">>>>>>>>>>>> Magnetic field: " << bz; // df.setBz(bz); /// put it outside the 'if'! Otherwise we have a difference wrt bz Configurable (< 1 permille) in Run2 conv. data @@ -625,10 +625,11 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; + float occupancy = hfEvSel.getOccupancy(collision); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections - hfEvSel.fillHistograms(collision, rejectionMask, centrality); + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); } /// end loop over collisions } @@ -642,10 +643,11 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; + float occupancy = hfEvSel.getOccupancy(collision); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections - hfEvSel.fillHistograms(collision, rejectionMask, centrality); + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); } /// end loop over collisions } @@ -659,10 +661,11 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; + float occupancy = hfEvSel.getOccupancy(collision); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections - hfEvSel.fillHistograms(collision, rejectionMask, centrality); + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); } /// end loop over collisions } @@ -677,6 +680,7 @@ struct HfCandidateCreator2ProngExpressions { // Configuration o2::framework::Configurable rejectBackground{"rejectBackground", true, "Reject particles from background events"}; + o2::framework::Configurable matchKinkedDecayTopology{"matchKinkedDecayTopology", false, "Match also candidates with tracks that decay with kinked topology"}; HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring @@ -723,6 +727,7 @@ struct HfCandidateCreator2ProngExpressions { int8_t sign = 0; int8_t flag = 0; int8_t origin = 0; + int8_t nKinkedTracks = 0; // Match reconstructed candidates. // Spawned table can be used directly @@ -744,14 +749,18 @@ struct HfCandidateCreator2ProngExpressions { } } if (fromBkg) { - rowMcMatchRec(flag, origin, -1.f, 0); + rowMcMatchRec(flag, origin, -1.f, 0, 0); continue; } } std::vector idxBhadMothers{}; // D0(bar) → π± K∓ - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign); + if (matchKinkedDecayTopology) { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign, 1, &nKinkedTracks); + } else { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign); + } if (indexRec > -1) { flag = sign * (1 << DecayType::D0ToPiK); } @@ -779,9 +788,9 @@ struct HfCandidateCreator2ProngExpressions { } if (origin == RecoDecay::OriginType::NonPrompt) { auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]); - rowMcMatchRec(flag, origin, bHadMother.pt(), bHadMother.pdgCode()); + rowMcMatchRec(flag, origin, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracks); } else { - rowMcMatchRec(flag, origin, -1.f, 0); + rowMcMatchRec(flag, origin, -1.f, 0, nKinkedTracks); } } diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 4e1349786e5..e7c464efa72 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -15,6 +15,11 @@ /// /// \author Vít Kučera , CERN +#include +#include +#include +#include + #include #include "CommonConstants/PhysicsConstants.h" @@ -59,7 +64,6 @@ struct HfCandidateCreator3Prong { // magnetic field setting from CCDB Configurable isRun2{"isRun2", false, "enable Run 2 or Run 3 GRP objects for magnetic field"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable ccdbPathLut{"ccdbPathLut", "GLO/Param/MatLUT", "Path for LUT parametrization"}; Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; // flags to enable creation for different particle species separately @@ -71,8 +75,6 @@ struct HfCandidateCreator3Prong { HfEventSelection hfEvSel; // event selection and monitoring o2::vertexing::DCAFitterN<3> df; // 3-prong vertex fitter Service ccdb; - o2::base::MatLayerCylSet* lut; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; int runNumber{0}; float toMicrometers = 10000.; // from cm to µm @@ -152,7 +154,6 @@ struct HfCandidateCreator3Prong { ccdb->setURL(ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(ccdbPathLut)); runNumber = 0; /// candidate monitoring @@ -190,7 +191,7 @@ struct HfCandidateCreator3Prong { auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; - initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); + initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); bz = o2::base::Propagator::Instance()->getNominalBz(); LOG(info) << ">>>>>>>>>>>> Magnetic field: " << bz; // df.setBz(bz); /// put it outside the 'if'! Otherwise we have a difference wrt bz Configurable (< 1 permille) in Run2 conv. data @@ -403,10 +404,11 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; + float occupancy = hfEvSel.getOccupancy(collision); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections - hfEvSel.fillHistograms(collision, rejectionMask, centrality); + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); } /// end loop over collisions } @@ -420,10 +422,11 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; + float occupancy = hfEvSel.getOccupancy(collision); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections - hfEvSel.fillHistograms(collision, rejectionMask, centrality); + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); } /// end loop over collisions } @@ -437,10 +440,11 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; + float occupancy = hfEvSel.getOccupancy(collision); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections - hfEvSel.fillHistograms(collision, rejectionMask, centrality); + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); } /// end loop over collisions } @@ -455,6 +459,7 @@ struct HfCandidateCreator3ProngExpressions { // Configuration o2::framework::Configurable rejectBackground{"rejectBackground", true, "Reject particles from background events"}; + o2::framework::Configurable matchKinkedDecayTopology{"matchKinkedDecayTopology", false, "Match also candidates with tracks that decay with kinked topology"}; bool createDplus{false}; bool createDs{false}; @@ -525,6 +530,7 @@ struct HfCandidateCreator3ProngExpressions { int8_t origin = 0; int8_t swapping = 0; int8_t channel = 0; + int8_t nKinkedTracks = 0; std::vector arrDaughIndex; std::array arrPDGDaugh; std::array arrPDGResonant1 = {kProton, 313}; // Λc± → p± K* @@ -557,14 +563,18 @@ struct HfCandidateCreator3ProngExpressions { } } if (fromBkg) { - rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0); + rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0, 0); continue; } } // D± → π± K∓ π± if (createDplus) { - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2); + if (matchKinkedDecayTopology) { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks); + } else { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2); + } if (indexRec > -1) { flag = sign * (1 << DecayType::DplusToPiKPi); } @@ -573,10 +583,18 @@ struct HfCandidateCreator3ProngExpressions { // Ds± → K± K∓ π± and D± → K± K∓ π± if (flag == 0 && createDs) { bool isDplus = false; - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2); + if (matchKinkedDecayTopology) { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks); + } else { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2); + } if (indexRec == -1) { isDplus = true; - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2); + if (matchKinkedDecayTopology) { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks); + } else { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2); + } } if (indexRec > -1) { // DecayType::DsToKKPi is used to flag both Ds± → K± K∓ π± and D± → K± K∓ π± @@ -602,7 +620,11 @@ struct HfCandidateCreator3ProngExpressions { // Λc± → p± K∓ π± if (flag == 0 && createLc) { - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); + if (matchKinkedDecayTopology) { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks); + } else { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); + } if (indexRec > -1) { flag = sign * (1 << DecayType::LcToPKPi); @@ -629,7 +651,11 @@ struct HfCandidateCreator3ProngExpressions { // Ξc± → p± K∓ π± if (flag == 0 && createXic) { - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); + if (matchKinkedDecayTopology) { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks); + } else { + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); + } if (indexRec > -1) { flag = sign * (1 << DecayType::XicToPKPi); } @@ -642,9 +668,9 @@ struct HfCandidateCreator3ProngExpressions { } if (origin == RecoDecay::OriginType::NonPrompt) { auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]); - rowMcMatchRec(flag, origin, swapping, channel, bHadMother.pt(), bHadMother.pdgCode()); + rowMcMatchRec(flag, origin, swapping, channel, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracks); } else { - rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0); + rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0, nKinkedTracks); } } diff --git a/PWGHF/TableProducer/candidateCreatorBplus.cxx b/PWGHF/TableProducer/candidateCreatorBplus.cxx index b8845945df9..0d4753c6c98 100644 --- a/PWGHF/TableProducer/candidateCreatorBplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorBplus.cxx @@ -18,6 +18,10 @@ /// \author Deepa Thomas , UT Austin /// \author Antonio Palasciano , Università degli Studi di Bari & INFN, Sezione di Bari +#include +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisTask.h" @@ -79,9 +83,6 @@ struct HfCandidateCreatorBplus { o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; int runNumber; - double massPi{0.}; - double massD0{0.}; - double massBplus{0.}; double invMass2D0PiMin{0.}; double invMass2D0PiMax{0.}; double bz{0.}; @@ -110,11 +111,8 @@ struct HfCandidateCreatorBplus { void init(InitContext const&) { // invariant-mass window cut - massPi = MassPiPlus; - massD0 = MassD0; - massBplus = MassBPlus; - invMass2D0PiMin = (massBplus - invMassWindowBplus) * (massBplus - invMassWindowBplus); - invMass2D0PiMax = (massBplus + invMassWindowBplus) * (massBplus + invMassWindowBplus); + invMass2D0PiMin = (MassBPlus - invMassWindowBplus) * (MassBPlus - invMassWindowBplus); + invMass2D0PiMax = (MassBPlus + invMassWindowBplus) * (MassBPlus + invMassWindowBplus); // Initialise fitter for B vertex dfB.setPropagateToPCA(propagateToPCA); @@ -173,16 +171,8 @@ struct HfCandidateCreatorBplus { aod::BCsWithTimestamps const&) { - static int nCol = 0; - for (const auto& collision : collisions) { auto primaryVertex = getPrimaryVertex(collision); - - if (nCol % 10000 == 0) { - LOG(debug) << nCol << " collisions parsed"; - } - nCol++; - /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. @@ -294,7 +284,6 @@ struct HfCandidateCreatorBplus { auto trackParCovPi = getTrackParCov(trackPion); std::array pVecD0 = {0., 0., 0.}; std::array pVecBach = {0., 0., 0.}; - std::array pVecBCand = {0., 0., 0.}; // find the DCA between the D0 and the bachelor track, for B+ hCandidatesB->Fill(SVFitting::BeforeFit); @@ -318,8 +307,6 @@ struct HfCandidateCreatorBplus { auto covMatrixPCA = dfB.calcPCACovMatrixFlat(); hCovSVXX->Fill(covMatrixPCA[0]); // FIXME: Calculation of errorDecayLength(XY) gives wrong values without this line. - pVecBCand = RecoDecay::pVec(pVecD0, pVecBach); - // get track impact parameters // This modifies track momenta! auto covMatrixPV = primaryVertex.getCov(); @@ -336,7 +323,7 @@ struct HfCandidateCreatorBplus { auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); // compute invariant mass square and apply selection - auto invMass2D0Pi = RecoDecay::m2(std::array{pVecD0, pVecBach}, std::array{massD0, massPi}); + auto invMass2D0Pi = RecoDecay::m2(std::array{pVecD0, pVecBach}, std::array{MassD0, MassPiPlus}); if ((invMass2D0Pi < invMass2D0PiMin) || (invMass2D0Pi > invMass2D0PiMax)) { continue; } diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index c343d8ce526..fc54575df75 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -15,7 +15,10 @@ /// \author Vít Kučera , CERN /// \author Deependra Sharma , IITB /// \author Fabrizio Grosa , CERN - +// std +#include +#include +#include // ROOT #include // O2 @@ -506,6 +509,7 @@ struct HfCandidateCreatorDstarExpressions { // Configuration o2::framework::Configurable rejectBackground{"rejectBackground", true, "Reject particles from background events"}; + o2::framework::Configurable matchKinkedDecayTopology{"matchKinkedDecayTopology", false, "Match also candidates with tracks that decay with kinked topology"}; using McCollisionsNoCents = soa::Join; using McCollisionsFT0Cs = soa::Join; @@ -552,6 +556,7 @@ struct HfCandidateCreatorDstarExpressions { int8_t signDstar = 0, signD0 = 0; int8_t flagDstar = 0, flagD0 = 0; int8_t originDstar = 0, originD0 = 0; + int8_t nKinkedTracksDstar = 0, nKinkedTracksD0 = 0; // Match reconstructed candidates. for (const auto& rowCandidateDstar : *rowsCandidateDstar) { @@ -581,15 +586,22 @@ struct HfCandidateCreatorDstarExpressions { } } if (fromBkg) { - rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0); + rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0, 0); continue; } } - // D*± → D0(bar) π± - indexRecDstar = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersDstar, Pdg::kDStar, std::array{+kPiPlus, +kPiPlus, -kKPlus}, true, &signDstar, 2); - // D0(bar) → π± K∓ - indexRecD0 = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersofD0, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0); + if (matchKinkedDecayTopology) { + // D*± → D0(bar) π± + indexRecDstar = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersDstar, Pdg::kDStar, std::array{+kPiPlus, +kPiPlus, -kKPlus}, true, &signDstar, 2, &nKinkedTracksDstar); + // D0(bar) → π± K∓ + indexRecD0 = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersofD0, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 1, &nKinkedTracksD0); + } else { + // D*± → D0(bar) π± + indexRecDstar = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersDstar, Pdg::kDStar, std::array{+kPiPlus, +kPiPlus, -kKPlus}, true, &signDstar, 2); + // D0(bar) → π± K∓ + indexRecD0 = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersofD0, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0); + } if (indexRecDstar > -1) { flagDstar = signDstar * (BIT(aod::hf_cand_dstar::DecayType::DstarToD0Pi)); @@ -609,11 +621,11 @@ struct HfCandidateCreatorDstarExpressions { } if (originDstar == RecoDecay::OriginType::NonPrompt) { auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]); - rowsMcMatchRecDstar(flagDstar, originDstar, bHadMother.pt(), bHadMother.pdgCode()); + rowsMcMatchRecDstar(flagDstar, originDstar, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracksDstar); } else { - rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0); + rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0, nKinkedTracksDstar); } - rowsMcMatchRecD0(flagD0, originD0, -1.f, 0); + rowsMcMatchRecD0(flagD0, originD0, -1.f, 0, nKinkedTracksD0); } for (const auto& mcCollision : mcCollisions) { diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 2af61fd214b..199dc5c7477 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -18,6 +18,11 @@ #define HomogeneousField #endif +#include +#include +#include +#include + /// includes KFParticle #include "KFParticle.h" #include "KFParticleBase.h" @@ -112,8 +117,10 @@ struct HfCandidateCreatorXic0Omegac0 { int runNumber{-1}; double magneticField{0.}; - using MyCascTable = soa::Join; // to use strangeness tracking, use aod::TraCascDatas instead of aod::CascDatas + using MyCascTable = soa::Join; + using MyTraCascTable = soa::Join; // to use strangeness tracking using CascadesLinked = soa::Join; + using TraCascadesLinked = soa::Join; using MyV0Table = soa::Join; using MyLFTracksWCov = soa::Join; @@ -172,12 +179,12 @@ struct HfCandidateCreatorXic0Omegac0 { } kfOmegac0Candidate; void init(InitContext const&) { - std::array allProcesses = {doprocessNoCentToXiPi, doprocessCentFT0CToXiPi, doprocessCentFT0MToXiPi, doprocessNoCentToOmegaPi, doprocessOmegacToOmegaPiWithKFParticle, doprocessCentFT0CToOmegaPi, doprocessCentFT0MToOmegaPi, doprocessNoCentToOmegaK, doprocessCentFT0CToOmegaK, doprocessCentFT0MToOmegaK}; + std::array allProcesses = {doprocessNoCentToXiPi, doprocessNoCentToXiPiTraCasc, doprocessCentFT0CToXiPi, doprocessCentFT0MToXiPi, doprocessNoCentToOmegaPi, doprocessOmegacToOmegaPiWithKFParticle, doprocessCentFT0CToOmegaPi, doprocessCentFT0MToOmegaPi, doprocessNoCentToOmegaK, doprocessCentFT0CToOmegaK, doprocessCentFT0MToOmegaK}; if (std::accumulate(allProcesses.begin(), allProcesses.end(), 0) == 0) { LOGP(fatal, "No process function enabled, please select one for at least one channel."); } - std::array processesToXiPi = {doprocessNoCentToXiPi, doprocessCentFT0CToXiPi, doprocessCentFT0MToXiPi}; + std::array processesToXiPi = {doprocessNoCentToXiPi, doprocessNoCentToXiPiTraCasc, doprocessCentFT0CToXiPi, doprocessCentFT0MToXiPi}; if (std::accumulate(processesToXiPi.begin(), processesToXiPi.end(), 0) > 1) { LOGP(fatal, "One and only one ToXiPi process function must be enabled at a time."); } @@ -196,7 +203,7 @@ struct HfCandidateCreatorXic0Omegac0 { LOGP(fatal, "At most one process function for collision monitoring can be enabled at a time."); } if (nProcessesCollisions == 1) { - if ((doprocessNoCentToXiPi && !doprocessCollisions) || (doprocessNoCentToOmegaPi && !doprocessCollisions) || (doprocessNoCentToOmegaK && !doprocessCollisions) || (doprocessOmegacToOmegaPiWithKFParticle && !doprocessCollisions)) { + if ((doprocessNoCentToXiPi && !doprocessCollisions) || (doprocessNoCentToXiPiTraCasc && !doprocessCollisions) || (doprocessNoCentToOmegaPi && !doprocessCollisions) || (doprocessNoCentToOmegaK && !doprocessCollisions) || (doprocessOmegacToOmegaPiWithKFParticle && !doprocessCollisions)) { LOGP(fatal, "Process function for collision monitoring not correctly enabled. Did you enable \"processCollisions\"?"); } if ((doprocessCentFT0CToXiPi && !doprocessCollisionsCentFT0C) || (doprocessCentFT0CToOmegaPi && !doprocessCollisionsCentFT0C) || (doprocessCentFT0CToOmegaK && !doprocessCollisionsCentFT0C)) { @@ -253,12 +260,12 @@ struct HfCandidateCreatorXic0Omegac0 { runNumber = 0; } - template + template void runXic0Omegac0Creator(Coll const&, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, MyLFTracksWCov const& lfTracks, TracksWCovDca const& tracks, - MyCascTable const&, CascadesLinked const&, + TCascTable const&, TCascLinkTable const&, aod::HfCascLf2Prongs const& candidates, Hist& hInvMassCharmBaryon, Hist& hFitterStatus, @@ -312,13 +319,34 @@ struct HfCandidateCreatorXic0Omegac0 { auto trackCharmBachelorId = cand.prong0Id(); auto trackCharmBachelor = tracks.rawIteratorAt(trackCharmBachelorId); - auto cascAodElement = cand.cascade_as(); + auto cascAodElement = cand.template cascade_as(); hCascadesCounter->Fill(0); int v0index = cascAodElement.v0Id(); - if (!cascAodElement.has_cascData()) { + + // check if the cascade from AO2D has data + bool hasData = false; + if constexpr (requires { cascAodElement.cascDataId(); }) { // check if it's the CascDataLink + if (cascAodElement.has_cascData()) { + hasData = true; + } + } + if constexpr (requires { cascAodElement.traCascDataId(); }) { // check if it's the TraCascDataLink + if (cascAodElement.has_traCascData()) { + hasData = true; + } + } + if (!hasData) { continue; } - auto casc = cascAodElement.cascData_as(); + + typename TCascTable::iterator casc; + if constexpr (requires { cascAodElement.cascDataId(); }) { // check if it's the CascDataLink + casc = cascAodElement.template cascData_as(); + } + if constexpr (requires { cascAodElement.traCascDataId(); }) { // check if it's the TraCascDataLink + casc = cascAodElement.template traCascData_as(); + } + hCascadesCounter->Fill(1); auto trackCascDauChargedId = casc.bachelorId(); // pion <- xi track auto trackV0Dau0Id = casc.posTrackId(); // V0 positive daughter track @@ -910,15 +938,15 @@ struct HfCandidateCreatorXic0Omegac0 { // KF decay length float DecayLxy_Lam, err_DecayLxy_Lam; - kfV0.GetDecayLengthXY(DecayLxy_Lam, err_DecayLxy_Lam); + kfV0ToCasc.GetDecayLengthXY(DecayLxy_Lam, err_DecayLxy_Lam); kfOmegac0Candidate.decayLenXYLambda = DecayLxy_Lam; float DecayLxy_Casc, err_DecayLxy_Casc; - kfOmega.GetDecayLengthXY(DecayLxy_Casc, err_DecayLxy_Casc); + kfOmegaToOmegaC.GetDecayLengthXY(DecayLxy_Casc, err_DecayLxy_Casc); kfOmegac0Candidate.decayLenXYCasc = DecayLxy_Casc; float DecayLxy_Omegac0, err_DecayLxy_Omegac0; - kfOmegaC0.GetDecayLengthXY(DecayLxy_Omegac0, err_DecayLxy_Omegac0); + kfOmegac0ToPv.GetDecayLengthXY(DecayLxy_Omegac0, err_DecayLxy_Omegac0); kfOmegac0Candidate.decayLenXYOmegac = DecayLxy_Omegac0; // KF cosPA @@ -1026,6 +1054,18 @@ struct HfCandidateCreatorXic0Omegac0 { } PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToXiPi, "Run candidate creator w/o centrality selections for xi pi decay channel", true); + void processNoCentToXiPiTraCasc(soa::Join const& collisions, + aod::BCsWithTimestamps const& bcWithTimeStamps, + TracksWCovDca const& tracks, + MyLFTracksWCov const& lfTracks, + MyTraCascTable const& traCascades, + TraCascadesLinked const& traCascadeLinks, + aod::HfCascLf2Prongs const& candidates) + { + runXic0Omegac0Creator(collisions, bcWithTimeStamps, lfTracks, tracks, traCascades, traCascadeLinks, candidates, hInvMassCharmBaryonToXiPi, hFitterStatusToXiPi, hCandidateCounterToXiPi, hCascadesCounterToXiPi); + } + PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToXiPiTraCasc, "Run candidate creator w/o centrality selections for xi pi decay channel with tracked cascades", false); + void processNoCentToOmegaPi(soa::Join const& collisions, aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 207159a6f25..4eb5856b6f6 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -20,6 +20,10 @@ #define HomogeneousField #endif +#include +#include +#include + #include #include #include @@ -91,11 +95,16 @@ struct HfCandidateCreatorXicToXiPiPi { float massXiPi0{0.}; float massXiPi1{0.}; double bz{0.}; + enum XicCandCounter { AllIdTriplets = 0, + CascPreSel, + VertexFit }; using CascadesLinked = soa::Join; using CascFull = soa::Join; using KFCascadesLinked = soa::Join; using KFCascFull = soa::Join; + using TracksWCovDcaPidPrPi = soa::Join; + using TracksWCovExtraPidPrPi = soa::Join; HistogramRegistry registry{"registry"}; @@ -107,6 +116,13 @@ struct HfCandidateCreatorXicToXiPiPi { // add histograms to registry if (fillHistograms) { + // counter + registry.add("hVertexerType", "Use KF or DCAFitterN;Vertexer type;entries", {HistType::kTH1F, {{2, -0.5, 1.5}}}); // See o2::aod::hf_cand::VertexerType + registry.add("hCandCounter", "hCandCounter", {HistType::kTH1F, {{3, 0.f, 0.3}}}); + registry.get(HIST("hCandCounter"))->GetXaxis()->SetBinLabel(1 + AllIdTriplets, "total"); + registry.get(HIST("hCandCounter"))->GetXaxis()->SetBinLabel(1 + CascPreSel, "Cascade preselection"); + registry.get(HIST("hCandCounter"))->GetXaxis()->SetBinLabel(1 + VertexFit, "Successful vertex fit"); + // physical variables registry.add("hMass3", "3-prong candidates;inv. mass (#Xi #pi #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 2.3, 2.7}}}); registry.add("hCovPVXX", "3-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1D, {{100, 0., 1.e-4}}}); registry.add("hCovSVXX", "3-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1D, {{100, 0., 0.2}}}); @@ -116,7 +132,6 @@ struct HfCandidateCreatorXicToXiPiPi { registry.add("hCovSVXZ", "3-prong candidates;XZ element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1D, {{100, -1.e-4, 0.2}}}); registry.add("hCovPVZZ", "3-prong candidates;ZZ element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1D, {{100, 0., 1.e-4}}}); registry.add("hCovSVZZ", "3-prong candidates;ZZ element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1D, {{100, 0., 0.2}}}); - registry.add("hVertexerType", "Use KF or DCAFitterN;Vertexer type;entries", {HistType::kTH1F, {{2, -0.5, 1.5}}}); // See o2::aod::hf_cand::VertexerType registry.add("hDcaXYProngs", "DCAxy of 3-prong candidates;#it{p}_{T} (GeV/#it{c};#it{d}_{xy}) (#mum);entries", {HistType::kTH2D, {{100, 0., 20.}, {200, -500., 500.}}}); registry.add("hDcaZProngs", "DCAz of 3-prong candidates;#it{p}_{T} (GeV/#it{c};#it{d}_{z}) (#mum);entries", {HistType::kTH2D, {{100, 0., 20.}, {200, -500., 500.}}}); } @@ -150,7 +165,7 @@ struct HfCandidateCreatorXicToXiPiPi { aod::HfCascLf3Prongs const& rowsTrackIndexXicPlus, CascadesLinked const&, CascFull const&, - aod::TracksWCovDca const&, + TracksWCovDcaPidPrPi const&, aod::BCsWithTimestamps const&) { // loop over triplets of track indices @@ -160,9 +175,10 @@ struct HfCandidateCreatorXicToXiPiPi { continue; } auto casc = cascAodElement.cascData_as(); - auto trackCharmBachelor0 = rowTrackIndexXicPlus.prong0_as(); - auto trackCharmBachelor1 = rowTrackIndexXicPlus.prong1_as(); + auto trackCharmBachelor0 = rowTrackIndexXicPlus.prong0_as(); + auto trackCharmBachelor1 = rowTrackIndexXicPlus.prong1_as(); auto collision = rowTrackIndexXicPlus.collision(); + registry.fill(HIST("hCandCounter"), 1 + AllIdTriplets); // preselect cascade candidates if (doCascadePreselection) { @@ -173,6 +189,7 @@ struct HfCandidateCreatorXicToXiPiPi { continue; } } + registry.fill(HIST("hCandCounter"), 1 + CascPreSel); //----------------------Set the magnetic field from ccdb--------------------------------------- /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, @@ -186,9 +203,6 @@ struct HfCandidateCreatorXicToXiPiPi { } df.setBz(bz); - //----------------accessing particles in the decay chain------------- - auto trackPionFromXi = casc.bachelor_as(); // pion <- xi track from TracksWCovDca table - //--------------------------info of V0 and cascades track from LF-tables--------------------------- std::array vertexV0 = {casc.xlambda(), casc.ylambda(), casc.zlambda()}; std::array pVecV0 = {casc.pxlambda(), casc.pylambda(), casc.pzlambda()}; @@ -204,9 +218,9 @@ struct HfCandidateCreatorXicToXiPiPi { } // create cascade track o2::track::TrackParCov trackCasc; - if (trackPionFromXi.sign() > 0) { + if (casc.sign() > 0) { trackCasc = o2::track::TrackParCov(vertexCasc, pVecCasc, covCasc, 1, true); - } else if (trackPionFromXi.sign() < 0) { + } else if (casc.sign() < 0) { trackCasc = o2::track::TrackParCov(vertexCasc, pVecCasc, covCasc, -1, true); } else { continue; @@ -227,6 +241,7 @@ struct HfCandidateCreatorXicToXiPiPi { LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; continue; } + registry.fill(HIST("hCandCounter"), 1 + VertexFit); //----------------------------calculate physical properties----------------------- // Charge of charm baryon @@ -266,10 +281,12 @@ struct HfCandidateCreatorXicToXiPiPi { // calculate cosine of pointing angle std::array pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; - double cpaLambda = casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()); - double cpaXYLambda = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); - double cpaXi = casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); - double cpaXYXi = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); + float cpaLambda = casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()); + float cpaXYLambda = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); + float cpaXi = casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); + float cpaXYXi = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); + float cpaLambdaToXi = RecoDecay::cpa(vertexCasc, vertexV0, pVecV0); + float cpaXYLambdaToXi = RecoDecay::cpaXY(vertexCasc, vertexV0, pVecV0); // get invariant mass of Xi-pi pairs auto arrayMomentaXiPi0 = std::array{pVecXi, pVecPi0}; @@ -278,11 +295,40 @@ struct HfCandidateCreatorXicToXiPiPi { massXiPi1 = RecoDecay::m(std::move(arrayMomentaXiPi1), std::array{MassXiMinus, MassPiPlus}); // get uncertainty of the decay length - double phi, theta; + float phi, theta; getPointDirection(std::array{primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}, secondaryVertex, phi, theta); auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixSV, phi, theta)); auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixSV, phi, 0.)); + //--------------------- get PID information----------------------- + float nSigTpcPiFromXicPlus0 = trackCharmBachelor0.tpcNSigmaPi(); + float nSigTofPiFromXicPlus0 = trackCharmBachelor0.tofNSigmaPi(); + float nSigTpcPiFromXicPlus1 = trackCharmBachelor1.tpcNSigmaPi(); + float nSigTofPiFromXicPlus1 = trackCharmBachelor1.tofNSigmaPi(); + // Bachelor pion + auto trackPionFromXi = casc.bachelor_as(); + float nSigTpcBachelorPi = trackPionFromXi.tpcNSigmaPi(); + float nSigTofBachelorPi = trackPionFromXi.tofNSigmaPi(); + // Lambda daughters + auto trackPosLambdaDaughter = casc.posTrack_as(); + auto trackNegLambdaDaughter = casc.negTrack_as(); + float pPiFromLambda, pPrFromLambda, nSigTpcPiFromLambda, nSigTofPiFromLambda, nSigTpcPrFromLambda, nSigTofPrFromLambda; + if (signXic == +1) { + pPiFromLambda = trackNegLambdaDaughter.p(); + nSigTpcPiFromLambda = trackNegLambdaDaughter.tpcNSigmaPi(); + nSigTofPiFromLambda = trackNegLambdaDaughter.tofNSigmaPi(); + pPrFromLambda = trackPosLambdaDaughter.p(); + nSigTpcPrFromLambda = trackPosLambdaDaughter.tpcNSigmaPr(); + nSigTofPrFromLambda = trackPosLambdaDaughter.tofNSigmaPr(); + } else { + pPiFromLambda = trackPosLambdaDaughter.p(); + nSigTpcPiFromLambda = trackPosLambdaDaughter.tpcNSigmaPi(); + nSigTofPiFromLambda = trackPosLambdaDaughter.tofNSigmaPi(); + pPrFromLambda = trackNegLambdaDaughter.p(); + nSigTpcPrFromLambda = trackNegLambdaDaughter.tpcNSigmaPr(); + nSigTofPrFromLambda = trackNegLambdaDaughter.tofNSigmaPr(); + } + //--------------------------------------------fill histograms---------------------------------------------------------------- if (fillHistograms) { // invariant mass @@ -309,12 +355,12 @@ struct HfCandidateCreatorXicToXiPiPi { //---------------------------------fill candidate table rows------------------------------------------------------------------------------------------- rowCandidateBase(collision.globalIndex(), primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), - covMatrixPV[0], covMatrixPV[2], covMatrixPV[5], + std::sqrt(covMatrixPV[0]), std::sqrt(covMatrixPV[2]), std::sqrt(covMatrixPV[5]), /*3-prong specific columns*/ rowTrackIndexXicPlus.cascadeId(), rowTrackIndexXicPlus.prong0Id(), rowTrackIndexXicPlus.prong1Id(), casc.bachelorId(), casc.posTrackId(), casc.negTrackId(), secondaryVertex[0], secondaryVertex[1], secondaryVertex[2], - covMatrixSV[0], covMatrixSV[2], covMatrixSV[5], + std::sqrt(covMatrixSV[0]), std::sqrt(covMatrixSV[2]), std::sqrt(covMatrixSV[5]), errorDecayLength, errorDecayLengthXY, chi2SV, massXiPiPi, signXic, pVecXi[0], pVecXi[1], pVecXi[2], @@ -323,10 +369,12 @@ struct HfCandidateCreatorXicToXiPiPi { impactParameterCasc.getY(), impactParameter0.getY(), impactParameter1.getY(), std::sqrt(impactParameterCasc.getSigmaY2()), std::sqrt(impactParameter0.getSigmaY2()), std::sqrt(impactParameter1.getSigmaY2()), /*cascade specific columns*/ - vertexCasc[0], vertexCasc[1], vertexCasc[2], - vertexV0[0], vertexV0[1], vertexV0[2], - cpaXi, cpaXYXi, cpaLambda, cpaXYLambda, - massXiPi0, massXiPi1); + trackPionFromXi.p(), pPiFromLambda, pPrFromLambda, + cpaXi, cpaXYXi, cpaLambda, cpaXYLambda, cpaLambdaToXi, cpaXYLambdaToXi, + casc.mXi(), massXiPi0, massXiPi1, + /*PID information*/ + nSigTpcPiFromXicPlus0, nSigTpcPiFromXicPlus1, nSigTpcBachelorPi, nSigTpcPiFromLambda, nSigTpcPrFromLambda, + nSigTofPiFromXicPlus0, nSigTofPiFromXicPlus1, nSigTofBachelorPi, nSigTofPiFromLambda, nSigTofPrFromLambda); } // loop over track triplets } PROCESS_SWITCH(HfCandidateCreatorXicToXiPiPi, processXicplusWithDcaFitter, "Run candidate creator with DCAFitter.", true); @@ -335,7 +383,7 @@ struct HfCandidateCreatorXicToXiPiPi { aod::HfCascLf3Prongs const& rowsTrackIndexXicPlus, KFCascadesLinked const&, KFCascFull const&, - aod::TracksWCovExtra const&, + TracksWCovExtraPidPrPi const&, aod::BCsWithTimestamps const&) { // loop over triplets of track indices @@ -345,9 +393,10 @@ struct HfCandidateCreatorXicToXiPiPi { continue; } auto casc = cascAodElement.kfCascData_as(); - auto trackCharmBachelor0 = rowTrackIndexXicPlus.prong0_as(); - auto trackCharmBachelor1 = rowTrackIndexXicPlus.prong1_as(); + auto trackCharmBachelor0 = rowTrackIndexXicPlus.prong0_as(); + auto trackCharmBachelor1 = rowTrackIndexXicPlus.prong1_as(); auto collision = rowTrackIndexXicPlus.collision(); + registry.fill(HIST("hCandCounter"), 1 + AllIdTriplets); //-------------------preselect cascade candidates-------------------------------------- if (doCascadePreselection) { @@ -358,6 +407,7 @@ struct HfCandidateCreatorXicToXiPiPi { continue; } } + registry.fill(HIST("hCandCounter"), 1 + CascPreSel); //----------------------Set the magnetic field from ccdb----------------------------- /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, @@ -411,20 +461,23 @@ struct HfCandidateCreatorXicToXiPiPi { LOG(debug) << "Failed to construct XicPlus : " << e.what(); continue; } + registry.fill(HIST("hCandCounter"), 1 + VertexFit); // get geometrical chi2 of XicPlus float chi2GeoXicPlus = kfXicPlus.GetChi2() / kfXicPlus.GetNDF(); // topological constraint of Xic to PV + float chi2topoXicPlusToPVBeforeConstraint = kfXicPlus.GetDeviationFromVertex(KFPV); KFParticle kfXicPlusToPV = kfXicPlus; kfXicPlusToPV.SetProductionVertex(KFPV); - float chi2topoXicPlusPV = kfXicPlusToPV.GetChi2() / kfXicPlusToPV.GetNDF(); + float chi2topoXicPlusToPV = kfXicPlusToPV.GetChi2() / kfXicPlusToPV.GetNDF(); if (constrainXicPlusToPv) { kfXicPlus = kfXicPlusToPV; kfXicPlus.TransportToDecayVertex(); } // topological constraint of Xi to XicPlus + float chi2topoXiToXicPlusBeforeConstraint = kfXi.GetDeviationFromVertex(kfXicPlus); KFParticle kfXiToXicPlus = kfXi; kfXiToXicPlus.SetProductionVertex(kfXicPlus); float chi2topoXiToXicPlus = kfXiToXicPlus.GetChi2() / kfXiToXicPlus.GetNDF(); @@ -449,37 +502,39 @@ struct HfCandidateCreatorXicToXiPiPi { // sign of charm baryon int signXic = casc.sign() < 0 ? +1 : -1; - // get updated daughter tracks after vertex fit - // after production vertex constraint the parameters of the particle are stored at the position of the production vertex - KFParticle kfCharmBachelor0Upd = kfCharmBachelor0; - KFParticle kfCharmBachelor1Upd = kfCharmBachelor1; - KFParticle kfXiUpd = kfXi; - kfCharmBachelor0Upd.SetProductionVertex(kfXicPlus); - kfCharmBachelor1Upd.SetProductionVertex(kfXicPlus); - kfXiUpd.SetProductionVertex(kfXicPlus); + // transport XicPlus daughters to XicPlus decay vertex (secondary vertex) + float secondaryVertex[3] = {0.}; + secondaryVertex[0] = kfXicPlus.GetX(); + secondaryVertex[1] = kfXicPlus.GetY(); + secondaryVertex[2] = kfXicPlus.GetZ(); + kfXi.TransportToPoint(secondaryVertex); + kfCharmBachelor0.TransportToPoint(secondaryVertex); + kfCharmBachelor1.TransportToPoint(secondaryVertex); - // get impact parameters of updated XicPlus daughters + // get impact parameters of XicPlus daughters float impactParameterPi0XY = 0., errImpactParameterPi0XY = 0.; float impactParameterPi1XY = 0., errImpactParameterPi1XY = 0.; float impactParameterXiXY = 0., errImpactParameterXiXY = 0.; - kfCharmBachelor0Upd.GetDistanceFromVertexXY(KFPV, impactParameterPi0XY, errImpactParameterPi0XY); - kfCharmBachelor1Upd.GetDistanceFromVertexXY(KFPV, impactParameterPi1XY, errImpactParameterPi1XY); - kfXiUpd.GetDistanceFromVertexXY(KFPV, impactParameterXiXY, errImpactParameterXiXY); + kfCharmBachelor0.GetDistanceFromVertexXY(KFPV, impactParameterPi0XY, errImpactParameterPi0XY); + kfCharmBachelor1.GetDistanceFromVertexXY(KFPV, impactParameterPi1XY, errImpactParameterPi1XY); + kfXi.GetDistanceFromVertexXY(KFPV, impactParameterXiXY, errImpactParameterXiXY); // calculate cosine of pointing angle std::array pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; - double cpaLambda = casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()); - double cpaXYLambda = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); - double cpaXi = casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); - double cpaXYXi = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); + float cpaLambda = casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()); + float cpaXYLambda = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); + float cpaXi = casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); + float cpaXYXi = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); + float cpaLambdaToXi = RecoDecay::cpa(vertexCasc, vertexV0, pVecV0); + float cpaXYLambdaToXi = RecoDecay::cpaXY(vertexCasc, vertexV0, pVecV0); // get DCAs of Pi0-Pi1, Pi0-Xi, Pi1-Xi - float dcaXYPi0Pi1 = kfCharmBachelor0Upd.GetDistanceFromParticleXY(kfCharmBachelor1Upd); - float dcaXYPi0Xi = kfCharmBachelor0Upd.GetDistanceFromParticleXY(kfXiUpd); - float dcaXYPi1Xi = kfCharmBachelor1Upd.GetDistanceFromParticleXY(kfXiUpd); - float dcaPi0Pi1 = kfCharmBachelor0Upd.GetDistanceFromParticle(kfCharmBachelor1Upd); - float dcaPi0Xi = kfCharmBachelor0Upd.GetDistanceFromParticle(kfXiUpd); - float dcaPi1Xi = kfCharmBachelor1Upd.GetDistanceFromParticle(kfXiUpd); + float dcaXYPi0Pi1 = kfCharmBachelor0.GetDistanceFromParticleXY(kfCharmBachelor1); + float dcaXYPi0Xi = kfCharmBachelor0.GetDistanceFromParticleXY(kfXi); + float dcaXYPi1Xi = kfCharmBachelor1.GetDistanceFromParticleXY(kfXi); + float dcaPi0Pi1 = kfCharmBachelor0.GetDistanceFromParticle(kfCharmBachelor1); + float dcaPi0Xi = kfCharmBachelor0.GetDistanceFromParticle(kfXi); + float dcaPi1Xi = kfCharmBachelor1.GetDistanceFromParticle(kfXi); // mass of Xi-Pi0 pair KFParticle kfXiPi0; @@ -509,6 +564,35 @@ struct HfCandidateCreatorXicToXiPiPi { float errMassXiPiPi; kfXicPlus.GetMass(massXiPiPi, errMassXiPiPi); + //--------------------- get PID information----------------------- + float nSigTpcPiFromXicPlus0 = trackCharmBachelor0.tpcNSigmaPi(); + float nSigTofPiFromXicPlus0 = trackCharmBachelor0.tofNSigmaPi(); + float nSigTpcPiFromXicPlus1 = trackCharmBachelor1.tpcNSigmaPi(); + float nSigTofPiFromXicPlus1 = trackCharmBachelor1.tofNSigmaPi(); + // Bachelor pion + auto trackPionFromXi = casc.bachelor_as(); + float nSigTpcBachelorPi = trackPionFromXi.tpcNSigmaPi(); + float nSigTofBachelorPi = trackPionFromXi.tofNSigmaPi(); + // Lambda daughters + auto trackPosLambdaDaughter = casc.posTrack_as(); + auto trackNegLambdaDaughter = casc.negTrack_as(); + float pPiFromLambda, pPrFromLambda, nSigTpcPiFromLambda, nSigTofPiFromLambda, nSigTpcPrFromLambda, nSigTofPrFromLambda; + if (signXic == +1) { + pPiFromLambda = trackNegLambdaDaughter.p(); + nSigTpcPiFromLambda = trackNegLambdaDaughter.tpcNSigmaPi(); + nSigTofPiFromLambda = trackNegLambdaDaughter.tofNSigmaPi(); + pPrFromLambda = trackPosLambdaDaughter.p(); + nSigTpcPrFromLambda = trackPosLambdaDaughter.tpcNSigmaPr(); + nSigTofPrFromLambda = trackPosLambdaDaughter.tofNSigmaPr(); + } else { + pPiFromLambda = trackPosLambdaDaughter.p(); + nSigTpcPiFromLambda = trackPosLambdaDaughter.tpcNSigmaPi(); + nSigTofPiFromLambda = trackPosLambdaDaughter.tofNSigmaPi(); + pPrFromLambda = trackNegLambdaDaughter.p(); + nSigTpcPrFromLambda = trackNegLambdaDaughter.tpcNSigmaPr(); + nSigTofPrFromLambda = trackNegLambdaDaughter.tofNSigmaPr(); + } + //-------------------------------fill histograms-------------------------------------------- if (fillHistograms) { // invariant mass @@ -532,11 +616,11 @@ struct HfCandidateCreatorXicToXiPiPi { //------------------------------fill candidate table rows-------------------------------------- rowCandidateBase(collision.globalIndex(), KFPV.GetX(), KFPV.GetY(), KFPV.GetZ(), - covMatrixPV[0], covMatrixPV[2], covMatrixPV[5], + std::sqrt(covMatrixPV[0]), std::sqrt(covMatrixPV[2]), std::sqrt(covMatrixPV[5]), /*3-prong specific columns*/ rowTrackIndexXicPlus.cascadeId(), rowTrackIndexXicPlus.prong0Id(), rowTrackIndexXicPlus.prong1Id(), casc.bachelorId(), casc.posTrackId(), casc.negTrackId(), - kfXicPlus.GetX(), kfXicPlus.GetY(), kfXicPlus.GetZ(), + secondaryVertex[0], secondaryVertex[1], secondaryVertex[2], kfXicPlus.GetErrX(), kfXicPlus.GetErrY(), kfXicPlus.GetErrZ(), kfXicPlus.GetErrDecayLength(), kfXicPlus.GetErrDecayLengthXY(), chi2GeoXicPlus, massXiPiPi, signXic, @@ -546,11 +630,14 @@ struct HfCandidateCreatorXicToXiPiPi { impactParameterXiXY, impactParameterPi0XY, impactParameterPi1XY, errImpactParameterXiXY, errImpactParameterPi0XY, errImpactParameterPi1XY, /*cascade specific columns*/ - casc.x(), casc.y(), casc.z(), - casc.xlambda(), casc.ylambda(), casc.zlambda(), - cpaXi, cpaXYXi, cpaLambda, cpaXYLambda, - massXiPi0, massXiPi1); - rowCandidateKF(casc.kfCascadeChi2(), casc.kfV0Chi2(), chi2topoXicPlusPV, chi2topoXiToXicPlus, + trackPionFromXi.p(), pPiFromLambda, pPrFromLambda, + cpaXi, cpaXYXi, cpaLambda, cpaXYLambda, cpaLambdaToXi, cpaXYLambdaToXi, + casc.mXi(), massXiPi0, massXiPi1, + /*PID information*/ + nSigTpcPiFromXicPlus0, nSigTpcPiFromXicPlus1, nSigTpcBachelorPi, nSigTpcPiFromLambda, nSigTpcPrFromLambda, + nSigTofPiFromXicPlus0, nSigTofPiFromXicPlus1, nSigTofBachelorPi, nSigTofPiFromLambda, nSigTofPrFromLambda); + rowCandidateKF(casc.kfCascadeChi2(), casc.kfV0Chi2(), + chi2topoXicPlusToPVBeforeConstraint, chi2topoXicPlusToPV, chi2topoXiToXicPlusBeforeConstraint, chi2topoXiToXicPlus, dcaXYPi0Pi1, dcaXYPi0Xi, dcaXYPi1Xi, dcaPi0Pi1, dcaPi0Xi, dcaPi1Xi, casc.dcacascdaughters()); @@ -693,7 +780,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { rowMcMatchGen(flag, debug, origin); } // close loop over generated particles - } // close process + } // close process PROCESS_SWITCH(HfCandidateCreatorXicToXiPiPiExpressions, processMc, "Process MC", false); }; // close struct diff --git a/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx index e8589833f9e..11188cbe117 100644 --- a/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx @@ -10,10 +10,14 @@ // or submit itself to any jurisdiction. /// \file candidateSelectorBplusToD0Pi.cxx -/// \brief B± → D0bar(D0) π± candidate selector +/// \brief B ± → D0bar (D0) π± candidate selector /// -/// \author Antonio Palasciano , Università degli Studi di Bari & INFN, Sezione di Bari +/// \author Antonio Palasciano , Università degli Studi di Bari /// \author Deepa Thomas , UT Austin +/// \author Nima Zardoshti , CERN + +#include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -22,6 +26,7 @@ #include "Common/Core/TrackSelectorPID.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/HfMlResponseBplusToD0Pi.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -32,41 +37,70 @@ using namespace o2::framework; using namespace o2::analysis; struct HfCandidateSelectorBplusToD0Pi { - Produces hfSelBplusToD0PiCandidate; + Produces hfSelBplusToD0PiCandidate; // table defined in CandidateSelectionTables.h + Produces hfMlBplusToD0PiCandidate; // table defined in CandidateSelectionTables.h - // Configurable ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"}; - // Configurable ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"}; + Configurable ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"}; + Configurable ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"}; // Enable PID - Configurable usePid{"usePid", true, "Bool to use or not the PID at filtering level"}; + Configurable pionPidMethod{"pionPidMethod", 1, "PID selection method for the bachelor pion (0: none, 1: TPC or TOF, 2: TPC and TOF)"}; Configurable acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"}; // TPC PID - Configurable ptPidTpcMin{"ptPidTpcMin", 999, "Lower bound of track pT for TPC PID"}; - Configurable ptPidTpcMax{"ptPidTpcMax", 9999, "Upper bound of track pT for TPC PID"}; + Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; + Configurable ptPidTpcMax{"ptPidTpcMax", 20., "Upper bound of track pT for TPC PID"}; Configurable nSigmaTpcMax{"nSigmaTpcMax", 5., "Nsigma cut on TPC only"}; Configurable nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 5., "Nsigma cut on TPC combined with TOF"}; // TOF PID Configurable ptPidTofMin{"ptPidTofMin", 0.15, "Lower bound of track pT for TOF PID"}; - Configurable ptPidTofMax{"ptPidTofMax", 50., "Upper bound of track pT for TOF PID"}; + Configurable ptPidTofMax{"ptPidTofMax", 20., "Upper bound of track pT for TOF PID"}; Configurable nSigmaTofMax{"nSigmaTofMax", 5., "Nsigma cut on TOF only"}; - Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 999., "Nsigma cut on TOF combined with TPC"}; + Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"}; // topological cuts Configurable> binsPt{"binsPt", std::vector{hf_cuts_bplus_to_d0_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_bplus_to_d0_pi::cuts[0], hf_cuts_bplus_to_d0_pi::nBinsPt, hf_cuts_bplus_to_d0_pi::nCutVars, hf_cuts_bplus_to_d0_pi::labelsPt, hf_cuts_bplus_to_d0_pi::labelsCutVar}, "B+ candidate selection per pT bin"}; + // D0-meson ML cuts + Configurable> binsPtDmesMl{"binsPtDmesMl", std::vector{hf_cuts_ml::vecBinsPt}, "D0-meson pT bin limits for ML cuts"}; + Configurable> cutsDmesMl{"cutsDmesMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsDmesCutScore}, "D0-meson ML cuts per pT bin"}; // QA switch Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; + // B+ ML inference + Configurable applyBplusMl{"applyBplusMl", false, "Flag to apply ML selections"}; + Configurable> binsPtBpMl{"binsPtBpMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; + Configurable> cutDirBpMl{"cutDirBpMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; + Configurable> cutsBpMl{"cutsBpMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; + Configurable nClassesBpMl{"nClassesBpMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; + // CCDB configuration + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"path_ccdb/BDT_BPLUS/"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_BPLUSToD0Pi.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - // check if selectionFlagD (defined in candidateCreatorBplus.cxx) and usePid configurables are in sync - bool selectionFlagDAndUsePidInSync = true; - TrackSelectorPi selectorPion; - HfHelper hfHelper; + o2::analysis::HfMlResponseBplusToD0Pi hfMlResponse; + float outputMlNotPreselected = -1.; + std::vector outputMl = {}; + o2::ccdb::CcdbApi ccdbApi; - using TracksPidWithSel = soa::Join; + HfHelper hfHelper; + TrackSelectorPi selectorPion; HistogramRegistry registry{"registry"}; - void init(InitContext& initContext) + using TracksPion = soa::Join; + + void init(InitContext const&) { - if (usePid) { + std::array doprocess{doprocessSelection, doprocessSelectionWithDmesMl}; + if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { + LOGP(fatal, "Only one process function for data should be enabled at a time."); + } + + if (pionPidMethod < 0 || pionPidMethod > 2) { + LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)"); + } + + if (pionPidMethod != 0) { selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax); @@ -82,6 +116,7 @@ struct HfCandidateSelectorBplusToD0Pi { labels[1 + SelectionStep::RecoSkims] = "Skims selection"; labels[1 + SelectionStep::RecoTopol] = "Skims & Topological selections"; labels[1 + SelectionStep::RecoPID] = "Skims & Topological & PID selections"; + labels[1 + aod::SelectionStep::RecoMl] = "ML selection"; static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""}; registry.add("hSelections", "Selections;;#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisSelections, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); for (int iBin = 0; iBin < kNBinsSelections; ++iBin) { @@ -89,104 +124,140 @@ struct HfCandidateSelectorBplusToD0Pi { } } - int selectionFlagD0 = -1; - int selectionFlagD0bar = -1; - auto& workflows = initContext.services().get(); - for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-candidate-creator-bplus") == 0) { - for (const auto& option : device.options) { - if (option.name.compare("selectionFlagD0") == 0) { - selectionFlagD0 = option.defaultValue.get(); - LOGF(info, "selectionFlagD0 = %d", selectionFlagD0); - } - if (option.name.compare("selectionFlagD0bar") == 0) { - selectionFlagD0bar = option.defaultValue.get(); - LOGF(info, "selectionFlagD0bar = %d", selectionFlagD0bar); - } - } + if (applyBplusMl) { + hfMlResponse.configure(binsPtBpMl, cutsBpMl, cutDirBpMl, nClassesBpMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponse.setModelPathsLocal(onnxFileNames); } + hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponse.init(); } - if ((usePid && !selectionFlagD0) || (usePid && !selectionFlagD0bar)) { - selectionFlagDAndUsePidInSync = false; - LOG(warning) << "PID selections required on B+ daughters (usePid=true) but no PID selections on D candidates were required a priori."; - } - if ((!usePid && selectionFlagD0) || (!usePid && selectionFlagD0bar)) { - selectionFlagDAndUsePidInSync = false; - LOG(warning) << "No PID selections required on Bp daughters (usePid=false) but PID selections on D candidates were required a priori."; - } - } - - /// Apply PID selection - /// \param pidTrackPi is the PID status of trackPi (prong1 of B+ candidate) - /// \return true if prong1 of B+ candidate passes all selections - template - bool selectionPID(const T& pidTrackPi) - { - if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { - return false; - } - if (acceptPIDNotApplicable && pidTrackPi == TrackSelectorPID::Rejected) { - return false; - } - - return true; } - void process(aod::HfCandBplus const& hfCandBs, - soa::Join const&, - TracksPidWithSel const&) + /// Main function to perform B+ candidate creation + /// \param withDmesMl is the flag to use the table with ML scores for the D- daughter (only possible if present in the derived data) + /// \param hfCandsBp B+ candidates + /// \param pionTracks pion tracks + template + void runSelection(Cands const& hfCandsBp, + CandsDmes const& /*hfCandsD0*/, + TracksPion const& /*pionTracks*/) { - for (const auto& hfCandB : hfCandBs) { // looping over Bplus candidates - + for (const auto& hfCandBp : hfCandsBp) { int statusBplus = 0; - auto ptCandB = hfCandB.pt(); + auto ptCandBplus = hfCandBp.pt(); SETBIT(statusBplus, SelectionStep::RecoSkims); // RecoSkims = 0 --> statusBplus = 1 if (activateQA) { - registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoSkims, ptCandB); + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoSkims, ptCandBplus); } - // D0 is always index0 and pi is index1 by default - auto trackPi = hfCandB.prong1_as(); - // topological cuts - if (!hfHelper.selectionBplusToD0PiTopol(hfCandB, cuts, binsPt)) { + if (!hfHelper.selectionBplusToD0PiTopol(hfCandBp, cuts, binsPt)) { hfSelBplusToD0PiCandidate(statusBplus); - // LOGF(debug, "B+ candidate selection failed at topology selection"); + if (applyBplusMl) { + hfMlBplusToD0PiCandidate(outputMlNotPreselected); + } + // LOGF(info, "B+ candidate selection failed at topology selection"); continue; } + + auto trackPi = hfCandBp.template prong1_as(); + auto hfCandD = hfCandBp.template prong0_as(); + + if constexpr (withDmesMl) { + std::vector mlScoresD; + if (trackPi.sign() < 0) { + std::copy(hfCandD.mlProbD0().begin(), hfCandD.mlProbD0().end(), std::back_inserter(mlScoresD)); + } else { + std::copy(hfCandD.mlProbD0bar().begin(), hfCandD.mlProbD0bar().end(), std::back_inserter(mlScoresD)); + } + + if (!hfHelper.selectionDmesMlScoresForB(hfCandD, cutsDmesMl, binsPtDmesMl, mlScoresD)) { + hfSelBplusToD0PiCandidate(statusBplus); + if (applyBplusMl) { + hfMlBplusToD0PiCandidate(outputMlNotPreselected); + } + // LOGF(info, "B+ candidate selection failed at D0-meson ML selection"); + continue; + } + } + SETBIT(statusBplus, SelectionStep::RecoTopol); // RecoTopol = 1 --> statusBplus = 3 if (activateQA) { - registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoTopol, ptCandB); + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoTopol, ptCandBplus); } - // checking if selectionFlagD0(D0bar) and usePid are in sync - if (!selectionFlagDAndUsePidInSync) { - hfSelBplusToD0PiCandidate(statusBplus); - continue; - } // track-level PID selection - if (usePid) { - int pidTrackPi = selectorPion.statusTpcAndTof(trackPi); - if (!selectionPID(pidTrackPi)) { // FIXME use helper function + if (pionPidMethod) { + int pidTrackPi{TrackSelectorPID::Status::NotApplicable}; + if (pionPidMethod == 1) { + pidTrackPi = selectorPion.statusTpcOrTof(trackPi); + } else { + pidTrackPi = selectorPion.statusTpcAndTof(trackPi); + } + if (!hfHelper.selectionBplusToD0PiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + // LOGF(info, "B+ candidate selection failed at PID selection"); hfSelBplusToD0PiCandidate(statusBplus); + if (applyBplusMl) { + hfMlBplusToD0PiCandidate(outputMlNotPreselected); + } continue; } SETBIT(statusBplus, SelectionStep::RecoPID); // RecoPID = 2 --> statusBplus = 7 if (activateQA) { - registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoPID, ptCandB); + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoPID, ptCandBplus); + } + } + if (applyBplusMl) { + // B+ ML selections + int pdgCode = o2::constants::physics::kD0; + if (trackPi.sign() > 0) { + pdgCode = -1 * pdgCode; + } + std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandBp, hfCandD, pdgCode, trackPi); + bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBplus, outputMl); + hfMlBplusToD0PiCandidate(outputMl[1]); // storing ML score for signal class + + if (!isSelectedMl) { + hfSelBplusToD0PiCandidate(statusBplus); + continue; + } + SETBIT(statusBplus, SelectionStep::RecoMl); // RecoML = 3 --> statusBplus = 15 if pionPidMethod, 11 otherwise + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoMl, ptCandBplus); } } hfSelBplusToD0PiCandidate(statusBplus); - // LOGF(info, "Successful B+ candidate selection"); + // LOGF(info, "B+ candidate selection passed all selections"); } } + + void processSelection(HfCandBplus const& hfCandsBp, + aod::HfCand2ProngWPid const& hfCandsD0, + TracksPion const& pionTracks) + { + runSelection(hfCandsBp, hfCandsD0, pionTracks); + } // processSelection + + PROCESS_SWITCH(HfCandidateSelectorBplusToD0Pi, processSelection, "Process selection without ML scores of D mesons", true); + + void processSelectionWithDmesMl(HfCandBplus const& hfCandsBp, + soa::Join const& hfCandsD0, + TracksPion const& pionTracks) + { + runSelection(hfCandsBp, hfCandsD0, pionTracks); + } // processSelectionWithDmesMl + + PROCESS_SWITCH(HfCandidateSelectorBplusToD0Pi, processSelectionWithDmesMl, "Process selection with ML scores of D mesons", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx index d17f0ada8a0..9fc9fc8bdfc 100644 --- a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx @@ -15,6 +15,9 @@ /// /// \author Phil Stahlhut +#include +#include + #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" @@ -59,7 +62,7 @@ struct HfCandidateSelectorBsToDsPi { Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTBs"}, "Paths of models on CCDB"}; diff --git a/PWGHF/TableProducer/candidateSelectorD0.cxx b/PWGHF/TableProducer/candidateSelectorD0.cxx index fd249a91e3f..88a8fb017b3 100644 --- a/PWGHF/TableProducer/candidateSelectorD0.cxx +++ b/PWGHF/TableProducer/candidateSelectorD0.cxx @@ -15,6 +15,9 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -64,7 +67,7 @@ struct HfCandidateSelectorD0 { Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable enableDebugMl{"enableDebugMl", false, "Flag to enable histograms to monitor BDT application"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration diff --git a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx index 638a25aaf7c..d6d607ba9c4 100644 --- a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx @@ -15,6 +15,9 @@ /// \author Fabio Catalano , Politecnico and INFN Torino /// \author Vít Kučera , CERN +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -67,7 +70,7 @@ struct HfCandidateSelectorDplusToPiKPi { Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index 91df36d441c..6d00e6daee9 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -15,6 +15,9 @@ /// \author Fabio Catalano , Universita and INFN Torino /// \author Stefano Politano , Politecnico and INFN Torino +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -66,7 +69,7 @@ struct HfCandidateSelectorDsToKKPi { Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index 777b095fcbb..6445241d318 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -15,6 +15,10 @@ /// \author Deependra Sharma , IITB /// \author Fabrizio Grosa , CERN +#include +#include +#include + // O2 #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisDataModel.h" @@ -81,7 +85,7 @@ struct HfCandidateSelectorDstarToD0Pi { Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration diff --git a/PWGHF/TableProducer/candidateSelectorLc.cxx b/PWGHF/TableProducer/candidateSelectorLc.cxx index 6e50e1262a9..818d65bb269 100644 --- a/PWGHF/TableProducer/candidateSelectorLc.cxx +++ b/PWGHF/TableProducer/candidateSelectorLc.cxx @@ -17,6 +17,9 @@ /// \author Vít Kučera , CERN /// \author Grazia Luparello , INFN Trieste +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -77,7 +80,7 @@ struct HfCandidateSelectorLc { Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; diff --git a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx index 7e8d48085f0..c7b17972b8f 100644 --- a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx @@ -17,6 +17,9 @@ /// Daniel Samitz, , Vienna /// Elisa Meninno, , Vienna +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -62,7 +65,7 @@ struct HfCandidateSelectorLcToK0sP { Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; diff --git a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx index cb032518305..64ecd5cf65e 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx @@ -17,6 +17,9 @@ /// \author Vít Kučera , CERN /// \author Cristina Terrevoli , INFN BARI +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -60,7 +63,7 @@ struct HfCandidateSelectorXicToPKPi { Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::nCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; diff --git a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx index a1a76ac86ea..a2191501706 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx @@ -13,12 +13,17 @@ /// \brief Ξc± → Ξ∓ π± π± candidate selector /// /// \author Phil Lennart Stahlhut , Heidelberg University +/// \author Jaeyoon Cho , Inha University + +#include +#include #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Common/Core/TrackSelectorPID.h" +#include "PWGHF/Core/HfMlResponseXicToXiPiPi.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -31,6 +36,7 @@ using namespace o2::analysis; struct HfCandidateSelectorXicToXiPiPi { Produces hfSelXicToXiPiPiCandidate; + Produces hfMlXicToXiPiPiCandidate; Configurable ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"}; Configurable ptCandMax{"ptCandMax", 36., "Upper bound of candidate pT"}; @@ -52,7 +58,23 @@ struct HfCandidateSelectorXicToXiPiPi { Configurable ptPidTofMax{"ptPidTofMax", 20., "Upper bound of track pT for TOF PID"}; Configurable nSigmaTofMax{"nSigmaTofMax", 5., "Nsigma cut on TOF only"}; Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"}; - + // ML inference + Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; + Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; + Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; + Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; + Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; + // CCDB configuration + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXicToXiPiPi"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_XicToXiPiPi.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; + + o2::analysis::HfMlResponseXicToXiPiPi hfMlResponse; + std::vector outputMlXicToXiPiPi = {}; + o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorPr selectorProton; @@ -93,6 +115,18 @@ struct HfCandidateSelectorXicToXiPiPi { registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } } + + if (applyMl) { + hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponse.setModelPathsLocal(onnxFileNames); + } + hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponse.init(); + } } /// Conjugate-independent topological cuts @@ -113,7 +147,7 @@ struct HfCandidateSelectorXicToXiPiPi { } // check candidate mass is within a defined mass window - if (std::abs(hfCandXic.invMassXic() - o2::constants::physics::MassXiCPlus) > cuts->get(pTBin, "m")) { + if (std::abs(hfCandXic.invMassXicPlus() - o2::constants::physics::MassXiCPlus) > cuts->get(pTBin, "m")) { return false; } @@ -188,6 +222,9 @@ struct HfCandidateSelectorXicToXiPiPi { { for (const auto& hfCandXic : hfCandsXic) { int statusXicToXiPiPi = 0; + + outputMlXicToXiPiPi.clear(); + auto ptCandXic = hfCandXic.pt(); if (activateQA) { @@ -203,6 +240,9 @@ struct HfCandidateSelectorXicToXiPiPi { // topological cuts if (!selectionTopol(hfCandXic)) { hfSelXicToXiPiPiCandidate(statusXicToXiPiPi); + if (applyMl) { + hfMlXicToXiPiPiCandidate(outputMlXicToXiPiPi); + } continue; } SETBIT(statusXicToXiPiPi, SelectionStep::RecoTopol); // RecoTopol = 1 --> statusXicToXiPiPi = 3 @@ -233,6 +273,9 @@ struct HfCandidateSelectorXicToXiPiPi { if (!selectionPid(pidTrackPi0, pidTrackPi1, pidTrackPr, pidTrackPiLam, pidTrackPiXi, acceptPIDNotApplicable.value)) { hfSelXicToXiPiPiCandidate(statusXicToXiPiPi); + if (applyMl) { + hfMlXicToXiPiPiCandidate(outputMlXicToXiPiPi); + } continue; } SETBIT(statusXicToXiPiPi, SelectionStep::RecoPID); // RecoPID = 2 --> statusXicToXiPiPi = 7 @@ -241,6 +284,25 @@ struct HfCandidateSelectorXicToXiPiPi { } } + // ML selection + if (applyMl) { + bool isSelectedMlXicToXiPiPi = false; + std::vector inputFeaturesXicToXiPiPi = hfMlResponse.getInputFeatures(hfCandXic); + + isSelectedMlXicToXiPiPi = hfMlResponse.isSelectedMl(inputFeaturesXicToXiPiPi, ptCandXic, outputMlXicToXiPiPi); + + hfMlXicToXiPiPiCandidate(outputMlXicToXiPiPi); + + if (!isSelectedMlXicToXiPiPi) { + hfSelXicToXiPiPiCandidate(statusXicToXiPiPi); + continue; + } + SETBIT(statusXicToXiPiPi, aod::SelectionStep::RecoMl); + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoMl, ptCandXic); + } + } + hfSelXicToXiPiPiCandidate(statusXicToXiPiPi); } } diff --git a/PWGHF/TableProducer/converterDstarIndices.cxx b/PWGHF/TableProducer/converterDstarIndices.cxx new file mode 100644 index 00000000000..9596a571498 --- /dev/null +++ b/PWGHF/TableProducer/converterDstarIndices.cxx @@ -0,0 +1,42 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file converterDstarIndices.cxx +/// \brief Task for conversion of HfDstars to version 001, using the collision index from the D0 daughter +/// +/// \author Fabrizio Grosa , CERN + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" + +#include "PWGHF/DataModel/CandidateReconstructionTables.h" + +using namespace o2; +using namespace o2::framework; + +struct HfConverterDstarIndices { + Produces dstarIndices; + + void process(aod::HfDstars_000::iterator const& candDstar, + aod::Hf2Prongs const&) + { + auto candDzero = candDstar.prongD0_as(); + dstarIndices(candDzero.collisionId(), candDstar.prong0Id(), candDstar.prongD0Id()); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx new file mode 100644 index 00000000000..894acd0a3f9 --- /dev/null +++ b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx @@ -0,0 +1,567 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file derivedDataCreatorBplusToD0Pi.cxx +/// \brief Producer of derived tables of B+ candidates, collisions and MC particles +/// \note Based on derivedDataCreatorLcToPKPi.cxx +/// +/// \author Vít Kučera , Inha University + +#include +#include +#include + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" + +#include "PWGLF/DataModel/mcCentrality.h" + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/DerivedTables.h" +#include "PWGHF/Utils/utilsDerivedData.h" +#include "PWGHF/Utils/utilsPid.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::pid_tpc_tof_utils; +using namespace o2::analysis::hf_derived; + +/// Writes the full information in an output TTree +struct HfDerivedDataCreatorBplusToD0Pi { + // Candidates + Produces rowCandidateBase; + Produces rowCandidatePar; + Produces rowCandidateParD0; + Produces rowCandidateParE; + Produces rowCandidateSel; + Produces rowCandidateMl; + Produces rowCandidateMlD0; + Produces rowCandidateId; + Produces rowCandidateMc; + // Collisions + Produces rowCollBase; + Produces rowCollId; + // MC collisions + Produces rowMcCollBase; + Produces rowMcCollId; + Produces rowMcRCollId; + // MC particles + Produces rowParticleBase; + Produces rowParticleId; + + // Switches for filling tables + Configurable fillCandidateBase{"fillCandidateBase", true, "Fill candidate base properties"}; + Configurable fillCandidatePar{"fillCandidatePar", true, "Fill candidate parameters"}; + Configurable fillCandidateParD0{"fillCandidateParD0", true, "Fill D0 candidate parameters"}; + Configurable fillCandidateParE{"fillCandidateParE", true, "Fill candidate extended parameters"}; + Configurable fillCandidateSel{"fillCandidateSel", true, "Fill candidate selection flags"}; + Configurable fillCandidateMl{"fillCandidateMl", true, "Fill candidate selection ML scores"}; + Configurable fillCandidateMlD0{"fillCandidateMlD0", true, "Fill D0 candidate selection ML scores"}; + Configurable fillCandidateId{"fillCandidateId", true, "Fill original indices from the candidate table"}; + Configurable fillCandidateMc{"fillCandidateMc", true, "Fill candidate MC info"}; + Configurable fillCollBase{"fillCollBase", true, "Fill collision base properties"}; + Configurable fillCollId{"fillCollId", true, "Fill original collision indices"}; + Configurable fillMcCollBase{"fillMcCollBase", true, "Fill MC collision base properties"}; + Configurable fillMcCollId{"fillMcCollId", true, "Fill original MC collision indices"}; + Configurable fillMcRCollId{"fillMcRCollId", true, "Fill indices of saved derived reconstructed collisions matched to saved derived MC collisions"}; + Configurable fillParticleBase{"fillParticleBase", true, "Fill MC particle properties"}; + Configurable fillParticleId{"fillParticleId", true, "Fill original MC indices"}; + // Parameters for production of training samples + Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; + Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; + + HfHelper hfHelper; + SliceCache cache; + std::map> matchedCollisions; // indices of derived reconstructed collisions matched to the global indices of MC collisions + std::map hasMcParticles; // flags for MC collisions with HF particles + + using CollisionsWCentMult = soa::Join; + using CollisionsWMcCentMult = soa::Join; + using TracksWPid = soa::Join; + using SelectedCandidates = soa::Filtered>; + using SelectedCandidatesMc = soa::Filtered>; + using SelectedCandidatesMl = soa::Filtered>; + using SelectedCandidatesMcMl = soa::Filtered>; + using MatchedGenCandidatesMc = soa::Filtered>; + using TypeMcCollisions = soa::Join; + using THfCandDaughters = aod::HfCand2ProngWPid; + using THfCandDaughtersMl = soa::Join; + + Filter filterSelectCandidates = aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= 1; + Filter filterMcGenMatching = nabs(aod::hf_cand_bplus::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_bplus::DecayType::BplusToD0Pi)); + + Preslice candidatesPerCollision = aod::hf_cand::collisionId; + Preslice candidatesMcPerCollision = aod::hf_cand::collisionId; + Preslice candidatesMlPerCollision = aod::hf_cand::collisionId; + Preslice candidatesMcMlPerCollision = aod::hf_cand::collisionId; + Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; + + // trivial partitions for all candidates to allow "->sliceByCached" inside processCandidates + Partition candidatesAll = aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= 0; + Partition candidatesMcAll = aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= 0; + Partition candidatesMlAll = aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= 0; + Partition candidatesMcMlAll = aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= 0; + // partitions for signal and background + Partition candidatesMcSig = nabs(aod::hf_cand_bplus::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_bplus::DecayType::BplusToD0Pi)); + Partition candidatesMcBkg = nabs(aod::hf_cand_bplus::flagMcMatchRec) != static_cast(BIT(aod::hf_cand_bplus::DecayType::BplusToD0Pi)); + Partition candidatesMcMlSig = nabs(aod::hf_cand_bplus::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_bplus::DecayType::BplusToD0Pi)); + Partition candidatesMcMlBkg = nabs(aod::hf_cand_bplus::flagMcMatchRec) != static_cast(BIT(aod::hf_cand_bplus::DecayType::BplusToD0Pi)); + + void init(InitContext const&) + { + std::array doprocess{doprocessData, doprocessMcSig, doprocessMcBkg, doprocessMcAll, doprocessDataMl, doprocessMcMlSig, doprocessMcMlBkg, doprocessMcMlAll}; + if (std::accumulate(doprocess.begin(), doprocess.end(), 0) != 1) { + LOGP(fatal, "Only one process function can be enabled at a time."); + } + } + + template + // void fillTablesCollision(const T& collision, int isEventReject, int runNumber) + void fillTablesCollision(const T& collision) + { + if (fillCollBase) { + rowCollBase( + collision.posX(), + collision.posY(), + collision.posZ(), + collision.numContrib(), + collision.centFT0A(), + collision.centFT0C(), + collision.centFT0M(), + collision.centFV0A(), + collision.multZeqNTracksPV()); + // isEventReject, + // runNumber); + } + if (fillCollId) { + rowCollId( + collision.globalIndex()); + } + if constexpr (isMC) { + if (fillMcRCollId && collision.has_mcCollision()) { + // Save rowCollBase.lastIndex() at key collision.mcCollisionId() + LOGF(debug, "Rec. collision %d: Filling derived-collision index %d for MC collision %d", collision.globalIndex(), rowCollBase.lastIndex(), collision.mcCollisionId()); + matchedCollisions[collision.mcCollisionId()].push_back(rowCollBase.lastIndex()); // [] inserts an empty element if it does not exist + } + } + } + + template + void fillTablesMcCollision(const T& mcCollision) + { + if (fillMcCollBase) { + rowMcCollBase( + mcCollision.posX(), + mcCollision.posY(), + mcCollision.posZ(), + mcCollision.centFT0M()); + } + if (fillMcCollId) { + rowMcCollId( + mcCollision.globalIndex()); + } + if (fillMcRCollId) { + // Fill the table with the vector of indices of derived reconstructed collisions matched to mcCollision.globalIndex() + rowMcRCollId( + matchedCollisions[mcCollision.globalIndex()]); + } + } + + template + void fillTablesCandidate(const T& candidate, const U& prongCharm, const V& prongBachelor, int candFlag, double invMass, + double ct, double y, int8_t flagMc, int8_t origin, float mlScore, const std::vector& mlScoresCharm) + { + if (fillCandidateBase) { + rowCandidateBase( + rowCollBase.lastIndex(), + candidate.pt(), + candidate.eta(), + candidate.phi(), + invMass, + y); + } + if (fillCandidatePar) { + rowCandidatePar( + candidate.chi2PCA(), + candidate.cpa(), + candidate.cpaXY(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameterNormalised0(), + candidate.impactParameterNormalised1(), + prongBachelor.tpcNSigmaPi(), + prongBachelor.tofNSigmaPi(), + prongBachelor.tpcTofNSigmaPi(), + prongBachelor.tpcNSigmaKa(), + prongBachelor.tofNSigmaKa(), + prongBachelor.tpcTofNSigmaKa(), + candidate.maxNormalisedDeltaIP(), + candidate.impactParameterProduct()); + } + if (fillCandidateParD0) { + std::array, 2>, 2> sigmas{}; // PID nSigma [Expected][Hypothesis][TPC/TOF/TPC+TOF] + if (candFlag == 0) { + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion], prongCharm, 0, Pi) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon], prongCharm, 0, Ka) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion], prongCharm, 1, Pi) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon], prongCharm, 1, Ka) + } else if (candFlag == 1) { + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion], prongCharm, 1, Pi) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon], prongCharm, 1, Ka) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion], prongCharm, 0, Pi) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon], prongCharm, 0, Ka) + } + rowCandidateParD0( + prongCharm.cpa(), + prongCharm.decayLength(), + prongCharm.impactParameter0(), + prongCharm.impactParameter1(), + prongCharm.impactParameterProduct(), + sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion][0], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion][1], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion][2], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon][0], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon][1], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon][2], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion][0], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion][1], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion][2], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon][0], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon][1], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon][2]); + } + if (fillCandidateParE) { + rowCandidateParE( + candidate.xSecondaryVertex(), + candidate.ySecondaryVertex(), + candidate.zSecondaryVertex(), + candidate.errorDecayLength(), + candidate.errorDecayLengthXY(), + candidate.rSecondaryVertex(), + RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), + candidate.pxProng1(), + candidate.pyProng1(), + candidate.pzProng1(), + candidate.errorImpactParameter1(), + hfHelper.cosThetaStarBplus(candidate), + ct); + } + if (fillCandidateSel) { + rowCandidateSel( + BIT(candFlag)); + } + if (fillCandidateMl) { + rowCandidateMl( + mlScore); + } + if (fillCandidateMlD0) { + rowCandidateMlD0( + mlScoresCharm); + } + if (fillCandidateId) { + rowCandidateId( + candidate.collisionId(), + prongCharm.prong0Id(), + prongCharm.prong1Id(), + candidate.prong1Id()); + } + if (fillCandidateMc) { + rowCandidateMc( + flagMc, + origin); + } + } + + template + void fillTablesParticle(const T& particle, U mass) + { + if (fillParticleBase) { + rowParticleBase( + rowMcCollBase.lastIndex(), + particle.pt(), + particle.eta(), + particle.phi(), + RecoDecayPtEtaPhi::y(particle.pt(), particle.eta(), mass), + particle.flagMcMatchGen(), + particle.originMcGen()); + } + if (fillParticleId) { + rowParticleId( + particle.mcCollisionId(), + particle.globalIndex()); + } + } + + template + void processCandidates(CollType const& collisions, + Partition& candidates, + CandCharmType const&, + TracksWPid const&, + aod::BCs const&) + { + // Fill collision properties + if constexpr (isMc) { + if (fillMcRCollId) { + matchedCollisions.clear(); + } + } + auto sizeTableColl = collisions.size(); + reserveTable(rowCollBase, fillCollBase, sizeTableColl); + reserveTable(rowCollId, fillCollId, sizeTableColl); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + auto sizeTableCand = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) + bool mcCollisionHasMcParticles{false}; + if constexpr (isMc) { + mcCollisionHasMcParticles = fillMcRCollId && collision.has_mcCollision() && hasMcParticles[collision.mcCollisionId()]; + LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); + } + if (sizeTableCand == 0 && (!fillMcRCollId || !mcCollisionHasMcParticles)) { + LOGF(debug, "Skipping rec. collision %d", thisCollId); + continue; + } + LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowCollBase.lastIndex() + 1); + // fillTablesCollision(collision, 0, collision.bc().runNumber()); + fillTablesCollision(collision); + + // Fill candidate properties + reserveTable(rowCandidateBase, fillCandidateBase, sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParD0, fillCandidateParD0, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateMlD0, fillCandidateMlD0, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (isMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } + int8_t flagMcRec = 0, origin = 0; + for (const auto& candidate : candidatesThisColl) { + if constexpr (isMc) { + flagMcRec = candidate.flagMcMatchRec(); + origin = candidate.originMcRec(); + if constexpr (onlyBkg) { + if (TESTBIT(std::abs(flagMcRec), aod::hf_cand_bplus::DecayType::BplusToD0Pi)) { + continue; + } + if (downSampleBkgFactor < 1.) { + float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { + continue; + } + } + } + if constexpr (onlySig) { + if (!TESTBIT(std::abs(flagMcRec), aod::hf_cand_bplus::DecayType::BplusToD0Pi)) { + continue; + } + } + } + auto prongCharm = candidate.template prong0_as(); + auto prongBachelor = candidate.template prong1_as(); + double ct = hfHelper.ctBplus(candidate); + double y = hfHelper.yBplus(candidate); + float massBplusToD0Pi = hfHelper.invMassBplusToD0Pi(candidate); + float mlScoreBplusToD0Pi{-1.f}; + std::vector mlScoresD0; + bool isD0 = prongBachelor.sign() < 0; // D0 or D0bar + if constexpr (isMl) { + mlScoreBplusToD0Pi = candidate.mlProbBplusToD0Pi(); + if (isD0) { + std::copy(prongCharm.mlProbD0().begin(), prongCharm.mlProbD0().end(), std::back_inserter(mlScoresD0)); + } else { + std::copy(prongCharm.mlProbD0bar().begin(), prongCharm.mlProbD0bar().end(), std::back_inserter(mlScoresD0)); + } + } + // flag = 0 for D0 pi-, flag = 1 for D0bar pi+ + fillTablesCandidate(candidate, prongCharm, prongBachelor, isD0 ? 0 : 1, massBplusToD0Pi, ct, y, flagMcRec, origin, mlScoreBplusToD0Pi, mlScoresD0); + } + } + } + + template + void preProcessMcCollisions(CollisionType const& mcCollisions, + ParticleType const& mcParticles) + { + if (!fillMcRCollId) { + return; + } + hasMcParticles.clear(); + // Fill MC collision flags + for (const auto& mcCollision : mcCollisions) { + auto thisMcCollId = mcCollision.globalIndex(); + auto particlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, thisMcCollId); + LOGF(debug, "MC collision %d has %d MC particles (preprocess)", thisMcCollId, particlesThisMcColl.size()); + hasMcParticles[thisMcCollId] = (particlesThisMcColl.size() > 0); + } + } + + template + void processMcParticles(CollisionType const& mcCollisions, + ParticleType const& mcParticles) + { + // Fill MC collision properties + auto sizeTableMcColl = mcCollisions.size(); + reserveTable(rowMcCollBase, fillMcCollBase, sizeTableMcColl); + reserveTable(rowMcCollId, fillMcCollId, sizeTableMcColl); + reserveTable(rowMcRCollId, fillMcRCollId, sizeTableMcColl); + for (const auto& mcCollision : mcCollisions) { + auto thisMcCollId = mcCollision.globalIndex(); + auto particlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, thisMcCollId); + auto sizeTablePart = particlesThisMcColl.size(); + LOGF(debug, "MC collision %d has %d MC particles", thisMcCollId, sizeTablePart); + // Skip MC collisions without HF particles (and without HF candidates in matched reconstructed collisions if saving indices of reconstructed collisions matched to MC collisions) + LOGF(debug, "MC collision %d has %d saved derived rec. collisions", thisMcCollId, matchedCollisions[thisMcCollId].size()); + if (sizeTablePart == 0 && (!fillMcRCollId || matchedCollisions[thisMcCollId].empty())) { + LOGF(debug, "Skipping MC collision %d", thisMcCollId); + continue; + } + LOGF(debug, "Filling MC collision %d at derived index %d", thisMcCollId, rowMcCollBase.lastIndex() + 1); + fillTablesMcCollision(mcCollision); + + // Fill MC particle properties + reserveTable(rowParticleBase, fillParticleBase, sizeTablePart); + reserveTable(rowParticleId, fillParticleId, sizeTablePart); + for (const auto& particle : particlesThisMcColl) { + fillTablesParticle(particle, o2::constants::physics::MassBPlus); + } + } + } + + void processData(CollisionsWCentMult const& collisions, + SelectedCandidates const&, + THfCandDaughters const& candidatesDaughters, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + processCandidates(collisions, candidatesAll, candidatesDaughters, tracks, bcs); + } + PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processData, "Process data", true); + + void processMcSig(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMc const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + THfCandDaughters const& candidatesDaughters, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + preProcessMcCollisions(mcCollisions, mcParticles); + processCandidates(collisions, candidatesMcSig, candidatesDaughters, tracks, bcs); + processMcParticles(mcCollisions, mcParticles); + } + PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcSig, "Process MC only for signals", false); + + void processMcBkg(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMc const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + THfCandDaughters const& candidatesDaughters, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + preProcessMcCollisions(mcCollisions, mcParticles); + processCandidates(collisions, candidatesMcBkg, candidatesDaughters, tracks, bcs); + processMcParticles(mcCollisions, mcParticles); + } + PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcBkg, "Process MC only for background", false); + + void processMcAll(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMc const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + THfCandDaughters const& candidatesDaughters, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + preProcessMcCollisions(mcCollisions, mcParticles); + processCandidates(collisions, candidatesMcAll, candidatesDaughters, tracks, bcs); + processMcParticles(mcCollisions, mcParticles); + } + PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcAll, "Process MC", false); + + // ML versions + + void processDataMl(CollisionsWCentMult const& collisions, + SelectedCandidatesMl const&, + THfCandDaughtersMl const& candidatesDaughters, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + processCandidates(collisions, candidatesMlAll, candidatesDaughters, tracks, bcs); + } + PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processDataMl, "Process data with ML", false); + + void processMcMlSig(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMcMl const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + THfCandDaughtersMl const& candidatesDaughters, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + preProcessMcCollisions(mcCollisions, mcParticles); + processCandidates(collisions, candidatesMcMlSig, candidatesDaughters, tracks, bcs); + processMcParticles(mcCollisions, mcParticles); + } + PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcMlSig, "Process MC with ML only for signals", false); + + void processMcMlBkg(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMcMl const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + THfCandDaughtersMl const& candidatesDaughters, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + preProcessMcCollisions(mcCollisions, mcParticles); + processCandidates(collisions, candidatesMcMlBkg, candidatesDaughters, tracks, bcs); + processMcParticles(mcCollisions, mcParticles); + } + PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcMlBkg, "Process MC with ML only for background", false); + + void processMcMlAll(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMcMl const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + THfCandDaughtersMl const& candidatesDaughters, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + preProcessMcCollisions(mcCollisions, mcParticles); + processCandidates(collisions, candidatesMcMlAll, candidatesDaughters, tracks, bcs); + processMcParticles(mcCollisions, mcParticles); + } + PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcMlAll, "Process MC with ML", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx index 59480f3b50a..212916981d7 100644 --- a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx @@ -15,6 +15,10 @@ /// /// \author Vít Kučera , Inha University +#include +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -23,14 +27,20 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" +#include "PWGLF/DataModel/mcCentrality.h" + #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" +#include "PWGHF/Utils/utilsDerivedData.h" +#include "PWGHF/Utils/utilsPid.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::aod::pid_tpc_tof_utils; +using namespace o2::analysis::hf_derived; /// Writes the full information in an output TTree struct HfDerivedDataCreatorD0ToKPi { @@ -89,7 +99,7 @@ struct HfDerivedDataCreatorD0ToKPi { using SelectedCandidatesMcMl = soa::Filtered>; using SelectedCandidatesMcKfMl = soa::Filtered>; using MatchedGenCandidatesMc = soa::Filtered>; - using TypeMcCollisions = aod::McCollisions; + using TypeMcCollisions = soa::Join; Filter filterSelectCandidates = aod::hf_sel_candidate_d0::isSelD0 >= 1 || aod::hf_sel_candidate_d0::isSelD0bar >= 1; Filter filterMcGenMatching = nabs(aod::hf_cand_2prong::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK)); @@ -132,14 +142,6 @@ struct HfDerivedDataCreatorD0ToKPi { } } - template - void reserveTable(T& table, const Configurable& enabled, const uint64_t size) - { - if (enabled.value) { - table.reserve(size); - } - }; - template // void fillTablesCollision(const T& collision, int isEventReject, int runNumber) void fillTablesCollision(const T& collision) @@ -178,7 +180,8 @@ struct HfDerivedDataCreatorD0ToKPi { rowMcCollBase( mcCollision.posX(), mcCollision.posY(), - mcCollision.posZ()); + mcCollision.posZ(), + mcCollision.centFT0M()); } if (fillMcCollId) { rowMcCollId( @@ -204,33 +207,18 @@ struct HfDerivedDataCreatorD0ToKPi { invMass, y); } - if (fillCandidatePar) { - float tpcNSigmaPiExpPi = candidate.nSigTpcPi0(); - float tofNSigmaPiExpPi = candidate.nSigTofPi0(); - float tpcTofNSigmaPiExpPi = candidate.tpcTofNSigmaPi0(); - float tpcNSigmaKaExpPi = candidate.nSigTpcKa0(); - float tofNSigmaKaExpPi = candidate.nSigTofKa0(); - float tpcTofNSigmaKaExpPi = candidate.tpcTofNSigmaKa0(); - float tpcNSigmaPiExpKa = candidate.nSigTpcPi1(); - float tofNSigmaPiExpKa = candidate.nSigTofPi1(); - float tpcTofNSigmaPiExpKa = candidate.tpcTofNSigmaPi1(); - float tpcNSigmaKaExpKa = candidate.nSigTpcKa1(); - float tofNSigmaKaExpKa = candidate.nSigTofKa1(); - float tpcTofNSigmaKaExpKa = candidate.tpcTofNSigmaKa1(); - if (candFlag == 1) { - tpcNSigmaPiExpPi = candidate.nSigTpcPi1(); - tofNSigmaPiExpPi = candidate.nSigTofPi1(); - tpcTofNSigmaPiExpPi = candidate.tpcTofNSigmaPi1(); - tpcNSigmaKaExpPi = candidate.nSigTpcKa1(); - tofNSigmaKaExpPi = candidate.nSigTofKa1(); - tpcTofNSigmaKaExpPi = candidate.tpcTofNSigmaKa1(); - tpcNSigmaPiExpKa = candidate.nSigTpcPi0(); - tofNSigmaPiExpKa = candidate.nSigTofPi0(); - tpcTofNSigmaPiExpKa = candidate.tpcTofNSigmaPi0(); - tpcNSigmaKaExpKa = candidate.nSigTpcKa0(); - tofNSigmaKaExpKa = candidate.nSigTofKa0(); - tpcTofNSigmaKaExpKa = candidate.tpcTofNSigmaKa0(); + std::array, 2>, 2> sigmas{}; // PID nSigma [Expected][Hypothesis][TPC/TOF/TPC+TOF] + if (candFlag == 0) { + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion], candidate, 0, Pi) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon], candidate, 0, Ka) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion], candidate, 1, Pi) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon], candidate, 1, Ka) + } else if (candFlag == 1) { + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion], candidate, 1, Pi) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon], candidate, 1, Ka) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion], candidate, 0, Pi) + GET_N_SIGMA_PRONG(sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon], candidate, 0, Ka) } rowCandidatePar( candidate.chi2PCA(), @@ -246,18 +234,18 @@ struct HfDerivedDataCreatorD0ToKPi { candidate.impactParameter1(), candidate.impactParameterNormalised0(), candidate.impactParameterNormalised1(), - tpcNSigmaPiExpPi, - tofNSigmaPiExpPi, - tpcTofNSigmaPiExpPi, - tpcNSigmaKaExpPi, - tofNSigmaKaExpPi, - tpcTofNSigmaKaExpPi, - tpcNSigmaPiExpKa, - tofNSigmaPiExpKa, - tpcTofNSigmaPiExpKa, - tpcNSigmaKaExpKa, - tofNSigmaKaExpKa, - tpcTofNSigmaKaExpKa, + sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion][0], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion][1], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Pion][2], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon][0], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon][1], + sigmas[HfProngSpecies::Pion][HfProngSpecies::Kaon][2], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion][0], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion][1], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Pion][2], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon][0], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon][1], + sigmas[HfProngSpecies::Kaon][HfProngSpecies::Kaon][2], candidate.maxNormalisedDeltaIP(), candidate.impactParameterProduct()); } @@ -363,6 +351,7 @@ struct HfDerivedDataCreatorD0ToKPi { reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); if constexpr (isMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); @@ -377,7 +366,7 @@ struct HfDerivedDataCreatorD0ToKPi { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - (int64_t)(candidate.ptProng0() * 1000); + float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -390,7 +379,7 @@ struct HfDerivedDataCreatorD0ToKPi { } } else { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - (int64_t)(candidate.ptProng0() * 1000); + float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -448,6 +437,7 @@ struct HfDerivedDataCreatorD0ToKPi { // Fill MC collision properties auto sizeTableMcColl = mcCollisions.size(); reserveTable(rowMcCollBase, fillMcCollBase, sizeTableMcColl); + reserveTable(rowMcCollId, fillMcCollId, sizeTableMcColl); reserveTable(rowMcRCollId, fillMcRCollId, sizeTableMcColl); for (const auto& mcCollision : mcCollisions) { auto thisMcCollId = mcCollision.globalIndex(); diff --git a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx index 645deab1c39..6353241bc38 100644 --- a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx @@ -15,6 +15,10 @@ /// /// \author Vít Kučera , Inha University +#include +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -23,35 +27,39 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" +#include "PWGLF/DataModel/mcCentrality.h" + #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" +#include "PWGHF/Utils/utilsDerivedData.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::analysis::hf_derived; /// Writes the full information in an output TTree struct HfDerivedDataCreatorLcToPKPi { // Candidates - Produces rowCandidateBase; - Produces rowCandidatePar; - Produces rowCandidateParE; - Produces rowCandidateSel; - Produces rowCandidateMl; - Produces rowCandidateId; - Produces rowCandidateMc; + Produces rowCandidateBase; + Produces rowCandidatePar; + Produces rowCandidateParE; + Produces rowCandidateSel; + Produces rowCandidateMl; + Produces rowCandidateId; + Produces rowCandidateMc; // Collisions - Produces rowCollBase; - Produces rowCollId; + Produces rowCollBase; + Produces rowCollId; // MC collisions - Produces rowMcCollBase; - Produces rowMcCollId; - Produces rowMcRCollId; + Produces rowMcCollBase; + Produces rowMcCollId; + Produces rowMcRCollId; // MC particles - Produces rowParticleBase; - Produces rowParticleId; + Produces rowParticleBase; + Produces rowParticleId; // Switches for filling tables Configurable fillCandidateBase{"fillCandidateBase", true, "Fill candidate base properties"}; @@ -85,7 +93,7 @@ struct HfDerivedDataCreatorLcToPKPi { using SelectedCandidatesMl = soa::Filtered>; using SelectedCandidatesMcMl = soa::Filtered>; using MatchedGenCandidatesMc = soa::Filtered>; - using TypeMcCollisions = aod::McCollisions; + using TypeMcCollisions = soa::Join; Filter filterSelectCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= 1 || aod::hf_sel_candidate_lc::isSelLcToPiKP >= 1; Filter filterMcGenMatching = nabs(aod::hf_cand_3prong::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_3prong::DecayType::LcToPKPi)); @@ -115,14 +123,6 @@ struct HfDerivedDataCreatorLcToPKPi { } } - template - void reserveTable(T& table, const Configurable& enabled, const uint64_t size) - { - if (enabled.value) { - table.reserve(size); - } - }; - template // void fillTablesCollision(const T& collision, int isEventReject, int runNumber) void fillTablesCollision(const T& collision) @@ -161,7 +161,8 @@ struct HfDerivedDataCreatorLcToPKPi { rowMcCollBase( mcCollision.posX(), mcCollision.posY(), - mcCollision.posZ()); + mcCollision.posZ(), + mcCollision.centFT0M()); } if (fillMcCollId) { rowMcCollId( @@ -329,6 +330,7 @@ struct HfDerivedDataCreatorLcToPKPi { reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); if constexpr (isMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); @@ -344,7 +346,7 @@ struct HfDerivedDataCreatorLcToPKPi { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - (int64_t)(candidate.ptProng0() * 1000); + float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -402,6 +404,7 @@ struct HfDerivedDataCreatorLcToPKPi { // Fill MC collision properties auto sizeTableMcColl = mcCollisions.size(); reserveTable(rowMcCollBase, fillMcCollBase, sizeTableMcColl); + reserveTable(rowMcCollId, fillMcCollId, sizeTableMcColl); reserveTable(rowMcRCollId, fillMcRCollId, sizeTableMcColl); for (const auto& mcCollision : mcCollisions) { auto thisMcCollId = mcCollision.globalIndex(); diff --git a/PWGHF/TableProducer/mcPidTof.cxx b/PWGHF/TableProducer/mcPidTof.cxx index 98ac908f4c5..68429424b77 100644 --- a/PWGHF/TableProducer/mcPidTof.cxx +++ b/PWGHF/TableProducer/mcPidTof.cxx @@ -12,20 +12,34 @@ /// /// \file mcPidTof.cxx /// \author Fabrizio Grosa fabrizio.grosa@cern.ch -/// \brief Task to produce PID tables for TOF split for pi, K, p, copied from https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/PID/pidTOFFull.cxx +/// \brief Task to produce PID tables for TOF split for pi, K, p, copied from https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/PID/pidTofMerge.cxx /// It works only for MC and adds the possibility to apply postcalibrations for MC. /// +#include +#include +#include +#include +#include + #include // O2 includes -#include -#include "TOFBase/EventTimeMaker.h" +#include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" #include "ReconstructionDataFormats/Track.h" +#include "CCDB/BasicCCDBManager.h" +#include "TOFBase/EventTimeMaker.h" // O2Physics includes #include "TableHelper.h" +#include "MetadataHelper.h" +#include "CollisionTypeHelper.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/TableProducer/PID/pidTOFBase.h" using namespace o2; @@ -34,35 +48,685 @@ using namespace o2::pid; using namespace o2::framework::expressions; using namespace o2::track; -void customize(std::vector& workflowOptions) +MetadataHelper metadataInfo; + +// Input data types +using Trks = o2::soa::Join; +using Cols = aod::Collisions; +using TrksWtof = soa::Join; +using TrksWtofWevTime = soa::Join; + +using EvTimeCollisions = soa::Join; +using EvTimeCollisionsFT0 = soa::Join; + +// Configuration common to all tasks +struct TOFCalibConfig { + template + void init(const CfgType& opt) + { + mUrl = opt.cfgUrl.value; + mPathGrpLhcIf = opt.cfgPathGrpLhcIf.value; + mTimestamp = opt.cfgTimestamp.value; + mTimeShiftCCDBPathPos = opt.cfgTimeShiftCCDBPathPos.value; + mTimeShiftCCDBPathNeg = opt.cfgTimeShiftCCDBPathNeg.value; + mTimeShiftCCDBPathPosMC = opt.cfgTimeShiftCCDBPathPosMC.value; + mTimeShiftCCDBPathNegMC = opt.cfgTimeShiftCCDBPathNegMC.value; + mParamFileName = opt.cfgParamFileName.value; + mParametrizationPath = opt.cfgParametrizationPath.value; + mReconstructionPass = opt.cfgReconstructionPass.value; + mReconstructionPassDefault = opt.cfgReconstructionPassDefault.value; + mFatalOnPassNotAvailable = opt.cfgFatalOnPassNotAvailable.value; + mEnableTimeDependentResponse = opt.cfgEnableTimeDependentResponse.value; + mCollisionSystem = opt.cfgCollisionSystem.value; + mAutoSetProcessFunctions = opt.cfgAutoSetProcessFunctions.value; + } + + template + void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) + { + if (!getTaskOptionValue(initContext, task, name, v, false)) { + LOG(fatal) << "Could not get " << name << " from " << task << " task"; + } + } + + void inheritFromBaseTask(o2::framework::InitContext& initContext, const std::string task = "tof-signal") + { + mInitMode = 2; + getCfg(initContext, "ccdb-url", mUrl, task); + getCfg(initContext, "ccdb-path-grplhcif", mPathGrpLhcIf, task); + getCfg(initContext, "ccdb-timestamp", mTimestamp, task); + getCfg(initContext, "timeShiftCCDBPathPos", mTimeShiftCCDBPathPos, task); + getCfg(initContext, "timeShiftCCDBPathNeg", mTimeShiftCCDBPathNeg, task); + getCfg(initContext, "timeShiftCCDBPathPosMC", mTimeShiftCCDBPathPosMC, task); + getCfg(initContext, "timeShiftCCDBPathNegMC", mTimeShiftCCDBPathNegMC, task); + getCfg(initContext, "paramFileName", mParamFileName, task); + getCfg(initContext, "parametrizationPath", mParametrizationPath, task); + getCfg(initContext, "reconstructionPass", mReconstructionPass, task); + getCfg(initContext, "reconstructionPassDefault", mReconstructionPassDefault, task); + getCfg(initContext, "fatalOnPassNotAvailable", mFatalOnPassNotAvailable, task); + getCfg(initContext, "enableTimeDependentResponse", mEnableTimeDependentResponse, task); + getCfg(initContext, "collisionSystem", mCollisionSystem, task); + getCfg(initContext, "autoSetProcessFunctions", mAutoSetProcessFunctions, task); + } + // @brief Set up the configuration from the calibration object from the init function of the task + template + void initSetup(o2::pid::tof::TOFResoParamsV3& mRespParamsV3, + CCDBObject ccdb) + { + mInitMode = 1; + // First we set the CCDB manager + ccdb->setURL(mUrl); + ccdb->setTimestamp(mTimestamp); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + // Not later than now objects + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + + // Then the information about the metadata + if (mReconstructionPass == "metadata") { + LOG(info) << "Getting pass from metadata"; + if (metadataInfo.isMC()) { + mReconstructionPass = metadataInfo.get("AnchorPassName"); + } else { + LOG(fatal) << "This task works only for MC"; + } + LOG(info) << "Passed autodetect mode for pass. Taking '" << mReconstructionPass << "'"; + } + LOG(info) << "Using parameter collection, starting from pass '" << mReconstructionPass << "'"; + + if (!mParamFileName.empty()) { // Loading the parametrization from file + LOG(info) << "Loading exp. sigma parametrization from file " << mParamFileName << ", using param: " << mParametrizationPath << " and pass " << mReconstructionPass; + o2::tof::ParameterCollection paramCollection; + paramCollection.loadParamFromFile(mParamFileName, mParametrizationPath); + LOG(info) << "+++ Loaded parameter collection from file +++"; + if (!paramCollection.retrieveParameters(mRespParamsV3, mReconstructionPass)) { + if (mFatalOnPassNotAvailable) { + LOG(fatal) << "Pass '" << mReconstructionPass << "' not available in the retrieved object from file"; + } else { + LOG(warning) << "Pass '" << mReconstructionPass << "' not available in the retrieved object from file, fetching '" << mReconstructionPassDefault << "'"; + if (!paramCollection.retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection.print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { + mRespParamsV3.setResolutionParametrization(paramCollection.getPars(mReconstructionPassDefault)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPassDefault)); + } + } + } else { // Pass is available, load non standard parameters + mRespParamsV3.setResolutionParametrization(paramCollection.getPars(mReconstructionPass)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPass)); + } + } else if (!mEnableTimeDependentResponse) { // Loading it from CCDB + LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << mParametrizationPath << " for timestamp " << mTimestamp; + o2::tof::ParameterCollection* paramCollection = ccdb->template getForTimeStamp(mParametrizationPath, mTimestamp); + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPass)) { // Attempt at loading the parameters with the pass defined + if (mFatalOnPassNotAvailable) { + LOG(fatal) << "Pass '" << mReconstructionPass << "' not available in the retrieved CCDB object"; + } else { + LOG(warning) << "Pass '" << mReconstructionPass << "' not available in the retrieved CCDB object, fetching '" << mReconstructionPassDefault << "'"; + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection->print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPassDefault)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPassDefault)); + } + } + } else { // Pass is available, load non standard parameters + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPass)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPass)); + } + } + + // Loading additional calibration objects + std::map metadata; + if (!mReconstructionPass.empty()) { + metadata["RecoPassName"] = mReconstructionPass; + } + auto updateTimeShift = [&](const std::string& nameShift, bool isPositive) { + if (nameShift.empty()) { + return; + } + const bool isFromFile = nameShift.find(".root") != std::string::npos; + if (isFromFile) { + LOG(info) << "Initializing the time shift for " << (isPositive ? "positive" : "negative") << " from file '" << nameShift << "'"; + mRespParamsV3.setTimeShiftParameters(nameShift, "ccdb_object", isPositive); + } else if (!mEnableTimeDependentResponse) { // If the response is fixed fetch it at the init time + LOG(info) << "Initializing the time shift for " << (isPositive ? "positive" : "negative") + << " from ccdb '" << nameShift << "' and timestamp " << mTimestamp + << " and pass '" << mReconstructionPass << "'"; + mRespParamsV3.setTimeShiftParameters(ccdb->template getSpecific(nameShift, mTimestamp, metadata), isPositive); + } + LOG(info) << " test getTimeShift at 0 " << (isPositive ? "pos" : "neg") << ": " + << mRespParamsV3.getTimeShift(0, isPositive); + }; + + const std::string nameShiftPos = metadataInfo.isMC() ? mTimeShiftCCDBPathPosMC : mTimeShiftCCDBPathPos; + updateTimeShift(nameShiftPos, true); + const std::string nameShiftNeg = metadataInfo.isMC() ? mTimeShiftCCDBPathNegMC : mTimeShiftCCDBPathNeg; + updateTimeShift(nameShiftNeg, true); + + // Calibration object is defined + LOG(info) << "Parametrization at init time:"; + mRespParamsV3.printFullConfig(); + } + + template + void processSetup(o2::pid::tof::TOFResoParamsV3& mRespParamsV3, + CCDBObject ccdb, + const BcType& bc) + { + LOG(debug) << "Processing setup for run number " << bc.runNumber() << " from run " << mLastRunNumber; + // First we check if this run number was already processed + if (mLastRunNumber == bc.runNumber()) { + return; + } + mLastRunNumber = bc.runNumber(); + mTimestamp = bc.timestamp(); + + // Check the beam type + if (mCollisionSystem == -1) { + o2::parameters::GRPLHCIFData* grpo = ccdb->template getSpecific(mPathGrpLhcIf, + mTimestamp); + mCollisionSystem = CollisionSystemType::getCollisionTypeFromGrp(grpo); + } else { + LOG(debug) << "Not setting collisions system as already set to " << mCollisionSystem << " " << CollisionSystemType::getCollisionSystemName(mCollisionSystem); + } + + if (!mEnableTimeDependentResponse) { + return; + } + LOG(info) << "Updating parametrization from path '" << mParametrizationPath << "' and timestamp " << mTimestamp << " and reconstruction pass '" << mReconstructionPass << "' for run number " << bc.runNumber(); + if (mParamFileName.empty()) { // Not loading if parametrization was taken from file + LOG(info) << "Updating parametrization from ccdb"; + const o2::tof::ParameterCollection* paramCollection = ccdb->template getSpecific(mParametrizationPath, mTimestamp); + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPass)) { + if (mFatalOnPassNotAvailable) { + LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + } else { + LOGF(warning, "Pass '%s' not available in the retrieved CCDB object, fetching '%s'", mReconstructionPass.data(), mReconstructionPassDefault.data()); + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection->print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { // Found the default case + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPassDefault)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPassDefault)); + } + } + } else { // Found the non default case + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPass)); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPass)); + } + } + + // Loading additional calibration objects + std::map metadata; + if (!mReconstructionPass.empty()) { + metadata["RecoPassName"] = mReconstructionPass; + } + auto updateTimeShift = [&](const std::string& nameShift, bool isPositive) { + if (nameShift.empty()) { + return; + } + const bool isFromFile = nameShift.find(".root") != std::string::npos; + if (isFromFile) { + return; + } + LOG(info) << "Updating the time shift for " << (isPositive ? "positive" : "negative") + << " from ccdb '" << nameShift << "' and timestamp " << mTimestamp + << " and pass '" << mReconstructionPass << "'"; + mRespParamsV3.setTimeShiftParameters(ccdb->template getSpecific(nameShift, mTimestamp, metadata), isPositive); + LOG(info) << " test getTimeShift at 0 " << (isPositive ? "pos" : "neg") << ": " + << mRespParamsV3.getTimeShift(0, isPositive); + }; + + updateTimeShift(metadataInfo.isMC() ? mTimeShiftCCDBPathPosMC : mTimeShiftCCDBPathPos, true); + updateTimeShift(metadataInfo.isMC() ? mTimeShiftCCDBPathNegMC : mTimeShiftCCDBPathNeg, false); + + LOG(info) << "Parametrization at setup time:"; + mRespParamsV3.printFullConfig(); + } + + bool autoSetProcessFunctions() const { return mAutoSetProcessFunctions; } + int collisionSystem() const { return mCollisionSystem; } + + private: + int mLastRunNumber = -1; // Last run number for which the calibration was loaded + int mInitMode = 0; // 0: no init, 1: init, 2: inherit + + // Configurable options + std::string mUrl; + std::string mPathGrpLhcIf; + int64_t mTimestamp; + std::string mTimeShiftCCDBPathPos; + std::string mTimeShiftCCDBPathNeg; + std::string mTimeShiftCCDBPathPosMC; + std::string mTimeShiftCCDBPathNegMC; + std::string mParamFileName; + std::string mParametrizationPath; + std::string mReconstructionPass; + std::string mReconstructionPassDefault; + bool mFatalOnPassNotAvailable; + bool mEnableTimeDependentResponse; + int mCollisionSystem; + bool mAutoSetProcessFunctions; +}; + +// Part 1 TOF signal definition + +/// Selection criteria for tracks used for TOF event time +bool isTrackGoodMatchForTOFPID(const Trks::iterator& tr) { - std::vector options{{"add-qa", VariantType::Int, 0, {"Legacy. No effect."}}}; - std::swap(workflowOptions, options); + if (!tr.hasTOF()) { + return false; + } + return true; } -#include "Framework/runDataProcessing.h" +/// Task to produce the TOF signal from the trackTime information +struct tofSignal { + // Tables to produce + o2::framework::Produces table; + o2::framework::Produces tableFlags; + // Running flags + bool enableTableTOFSignal = false; // Flag to check if the TOF signal table is requested or not + bool enableTablepidTOFFlags = false; // Flag to check if the TOF signal flags table is requested or not + // Output histograms + Configurable enableQaHistograms{"enableQaHistograms", false, "Flag to enable the QA histograms"}; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // Detector response and input parameters + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + Service ccdb; + struct : ConfigurableGroup { + Configurable cfgUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable cfgPathGrpLhcIf{"ccdb-path-grplhcif", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"}; + Configurable cfgTimestamp{"ccdb-timestamp", -1, "timestamp of the object"}; + Configurable cfgTimeShiftCCDBPathPos{"timeShiftCCDBPathPos", "", "Path of the TOF time shift vs eta for pos. tracks. If empty none is taken"}; + Configurable cfgTimeShiftCCDBPathNeg{"timeShiftCCDBPathNeg", "", "Path of the TOF time shift vs eta for neg. tracks. If empty none is taken"}; + Configurable cfgTimeShiftCCDBPathPosMC{"timeShiftCCDBPathPosMC", "", "Path of the TOF time shift for MC vs eta for pos. tracks. If empty none is taken"}; + Configurable cfgTimeShiftCCDBPathNegMC{"timeShiftCCDBPathNegMC", "", "Path of the TOF time shift for MC vs eta for neg. tracks. If empty none is taken"}; + Configurable cfgParamFileName{"paramFileName", "", "Path to the parametrization object. If empty the parametrization is not taken from file"}; + Configurable cfgParametrizationPath{"parametrizationPath", "TOF/Calib/Params", "Path of the TOF parametrization on the CCDB or in the file, if the paramFileName is not empty"}; + Configurable cfgReconstructionPass{"reconstructionPass", "", {"Apass to use when fetching the calibration tables. Empty (default) does not check for any pass. Use `metadata` to fetch it from the AO2D metadata. Otherwise it will override the metadata."}}; + Configurable cfgReconstructionPassDefault{"reconstructionPassDefault", "unanchored", {"Default pass to get if the standard one is not found"}}; + Configurable cfgFatalOnPassNotAvailable{"fatalOnPassNotAvailable", true, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; + Configurable cfgEnableTimeDependentResponse{"enableTimeDependentResponse", false, "Flag to use the collision timestamp to fetch the PID Response"}; + Configurable cfgCollisionSystem{"collisionSystem", -1, "Collision system: -1 (autoset), 0 (pp), 1 (PbPb), 2 (XeXe), 3 (pPb)"}; + Configurable cfgAutoSetProcessFunctions{"autoSetProcessFunctions", true, "Flag to autodetect the process functions to use"}; + } cfg; // Configurables (only defined here and inherited from other tasks) + + TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration + + void init(o2::framework::InitContext& initContext) + { + mTOFCalibConfig.init(cfg); + // Checking that the table is requested in the workflow and enabling it + enableTableTOFSignal = isTableRequiredInWorkflow(initContext, "TOFSignal"); + if (enableTableTOFSignal) { + LOG(info) << "Table TOFSignal enabled!"; + } + enableTablepidTOFFlags = isTableRequiredInWorkflow(initContext, "pidTOFFlags"); + if (enableTablepidTOFFlags) { + LOG(info) << "Table pidTOFFlags enabled!"; + } + + // If the table is not requested, disable the task. Uless a process function is enabled from the workflow configuration + if (!enableTableTOFSignal && !enableTablepidTOFFlags) { + LOG(info) << "No table or process is enabled. Disabling task"; + return; + } + + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters + if (!enableQaHistograms) { + return; + } + histos.add("tofSignal", "tofSignal", kTH1D, {{1000, -1000, 1000000, "tofSignal (ps)"}}); + if (enableTablepidTOFFlags) { + histos.add("goodForPIDFlags", "goodForPIDFlags", kTH1D, {{3, 0, 3, "flags"}}); + } + } + + void process(Trks const& tracks) + { + if (!enableTableTOFSignal) { + return; + } + table.reserve(tracks.size()); + if (enableTablepidTOFFlags) { + tableFlags.reserve(tracks.size()); + } + for (auto& trk : tracks) { + const float& sig = o2::pid::tof::TOFSignal::GetTOFSignal(trk); + if (enableQaHistograms) { + histos.fill(HIST("tofSignal"), sig); + } + table(sig); + if (!enableTablepidTOFFlags) { + continue; + } + const auto& b = isTrackGoodMatchForTOFPID(trk); + if (enableQaHistograms) { + histos.fill(HIST("goodForPIDFlags"), sig); + } + tableFlags(b); + } + } +}; + +/// Selection criteria for tracks used for TOF event time +float trackSampleMinMomentum = 0.5f; +float trackSampleMaxMomentum = 2.f; +template +bool filterForTOFEventTime(const trackType& tr) +{ + return (tr.hasTOF() && + tr.p() > trackSampleMinMomentum && tr.p() < trackSampleMaxMomentum && + tr.hasITS() && + tr.hasTPC() && + (tr.trackType() == o2::aod::track::TrackTypeEnum::Track || tr.trackType() == o2::aod::track::TrackTypeEnum::TrackIU)); +} // accept all + +/// Specialization of TOF event time maker +template typename response, + typename trackTypeContainer, + typename responseParametersType> +o2::tof::eventTimeContainer evTimeMakerForTracks(const trackTypeContainer& tracks, + const responseParametersType& responseParameters, + const float& diamond = 6.0) +{ + return o2::tof::evTimeMakerFromParam(tracks, responseParameters, diamond); +} + +// Part 2 event time definition + +/// Task to produce the TOF event time table +struct tofEventTime { + // Tables to produce + Produces tableEvTime; + Produces tableEvTimeTOFOnly; + Produces tableFlags; + static constexpr bool removeTOFEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF + static constexpr float diamond = 6.0; // Collision diamond used in the estimation of the TOF event time + static constexpr float errDiamond = diamond * 33.356409f; + static constexpr float weightDiamond = 1.f / (errDiamond * errDiamond); + + bool enableTableTOFEvTime = false; + bool enableTableEvTimeTOFOnly = false; + // Detector response and input parameters + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + Service ccdb; + TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration + + // Event time configurations + Configurable minMomentum{"minMomentum", 0.5f, "Minimum momentum to select track sample for TOF event time"}; + Configurable maxMomentum{"maxMomentum", 2.0f, "Maximum momentum to select track sample for TOF event time"}; + Configurable maxEvTimeTOF{"maxEvTimeTOF", 100000.0f, "Maximum value of the TOF event time"}; + Configurable sel8TOFEvTime{"sel8TOFEvTime", false, "Flag to compute the ev. time only for events that pass the sel8 ev. selection"}; + Configurable mComputeEvTimeWithTOF{"computeEvTimeWithTOF", -1, "Compute ev. time with TOF. -1 (autoset), 0 no, 1 yes"}; + Configurable mComputeEvTimeWithFT0{"computeEvTimeWithFT0", -1, "Compute ev. time with FT0. -1 (autoset), 0 no, 1 yes"}; + Configurable maxNtracksInSet{"maxNtracksInSet", 10, "Size of the set to consider for the TOF ev. time computation"}; + + void init(o2::framework::InitContext& initContext) + { + mTOFCalibConfig.inheritFromBaseTask(initContext); + // Checking that the table is requested in the workflow and enabling it + enableTableTOFEvTime = isTableRequiredInWorkflow(initContext, "TOFEvTime"); + + if (!enableTableTOFEvTime) { + LOG(info) << "Table for TOF Event time (TOFEvTime) is not required, disabling it"; + } + LOG(info) << "Table TOFEvTime enabled!"; + + enableTableEvTimeTOFOnly = isTableRequiredInWorkflow(initContext, "EvTimeTOFOnly"); + if (enableTableEvTimeTOFOnly) { + LOG(info) << "Table EvTimeTOFOnly enabled!"; + } + + if (!enableTableTOFEvTime && !enableTableEvTimeTOFOnly) { + LOG(info) << "No table is enabled. Disabling task"; + return; + } + + if (metadataInfo.isFullyDefined()) { + if (!metadataInfo.isRun3()) { + LOG(fatal) << "Metadata says it is Run2, but this task supports only Run3"; + } + } + + trackSampleMinMomentum = minMomentum; + trackSampleMaxMomentum = maxMomentum; + LOG(info) << "Configuring track sample for TOF ev. time: " << trackSampleMinMomentum << " < p < " << trackSampleMaxMomentum; + + if (sel8TOFEvTime.value == true) { + LOG(info) << "TOF event time will be computed for collisions that pass the event selection only!"; + } + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters + + o2::tof::eventTimeContainer::setMaxNtracksInSet(maxNtracksInSet.value); + o2::tof::eventTimeContainer::printConfig(); + } + + /// + /// Process function to prepare the event for each track on Run 3 data without the FT0 + // Define slice per collision + Preslice perCollision = aod::track::collisionId; + template + using ResponseImplementationEvTime = o2::pid::tof::ExpTimes; + void process(TrksWtof& tracks, + aod::FT0s const&, + EvTimeCollisionsFT0 const&, + aod::BCsWithTimestamps const& bcs) + { + if (!enableTableTOFEvTime) { + return; + } + LOG(debug) << "Processing data for TOF event time"; + + tableEvTime.reserve(tracks.size()); + tableFlags.reserve(tracks.size()); + if (enableTableEvTimeTOFOnly) { + tableEvTimeTOFOnly.reserve(tracks.size()); + } + + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters + + // Autoset the processing mode for the event time computation + if (mComputeEvTimeWithTOF == -1 || mComputeEvTimeWithFT0 == -1) { + switch (mTOFCalibConfig.collisionSystem()) { + case CollisionSystemType::kCollSyspp: // pp + mComputeEvTimeWithTOF.value = ((mComputeEvTimeWithTOF == -1) ? 0 : mComputeEvTimeWithTOF.value); + mComputeEvTimeWithFT0.value = ((mComputeEvTimeWithFT0 == -1) ? 1 : mComputeEvTimeWithFT0.value); + break; + case CollisionSystemType::kCollSysPbPb: // PbPb + mComputeEvTimeWithTOF.value = ((mComputeEvTimeWithTOF == -1) ? 1 : mComputeEvTimeWithTOF.value); + mComputeEvTimeWithFT0.value = ((mComputeEvTimeWithFT0 == -1) ? 0 : mComputeEvTimeWithFT0.value); + break; + default: + LOG(fatal) << "Collision system " << mTOFCalibConfig.collisionSystem() << " " << CollisionSystemType::getCollisionSystemName(mTOFCalibConfig.collisionSystem()) << " not supported for TOF event time computation"; + break; + } + } + LOG(debug) << "Running on " << CollisionSystemType::getCollisionSystemName(mTOFCalibConfig.collisionSystem()) << " mComputeEvTimeWithTOF " << mComputeEvTimeWithTOF.value << " mComputeEvTimeWithFT0 " << mComputeEvTimeWithFT0.value; + + if (mComputeEvTimeWithTOF == 1 && mComputeEvTimeWithFT0 == 1) { + int lastCollisionId = -1; // Last collision ID analysed + for (auto const& t : tracks) { // Loop on collisions + if (!t.has_collision() || ((sel8TOFEvTime.value == true) && !t.collision_as().sel8())) { // Track was not assigned, cannot compute event time or event did not pass the event selection + tableFlags(0); + tableEvTime(0.f, 999.f); + if (enableTableEvTimeTOFOnly) { + tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1); + } + continue; + } + if (t.collisionId() == lastCollisionId) { // Event time from this collision is already in the table + continue; + } + /// Create new table for the tracks in a collision + lastCollisionId = t.collisionId(); /// Cache last collision ID + + const auto& tracksInCollision = tracks.sliceBy(perCollision, lastCollisionId); + const auto& collision = t.collision_as(); + + // Compute the TOF event time + const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, diamond); + + float t0AC[2] = {.0f, 999.f}; // Value and error of T0A or T0C or T0AC + float t0TOF[2] = {static_cast(evTimeMakerTOF.mEventTime), static_cast(evTimeMakerTOF.mEventTimeError)}; // Value and error of TOF + + uint8_t flags = 0; + int nGoodTracksForTOF = 0; + float eventTime = 0.f; + float sumOfWeights = 0.f; + float weight = 0.f; + + for (auto const& trk : tracksInCollision) { // Loop on Tracks + // Reset the flag + flags = 0; + // Reset the event time + eventTime = 0.f; + sumOfWeights = 0.f; + weight = 0.f; + // Remove the bias on TOF ev. time + if constexpr (removeTOFEvTimeBias) { + evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); + } + if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || abs(t0TOF[0]) < maxEvTimeTOF)) { + flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; + + weight = 1.f / (t0TOF[1] * t0TOF[1]); + eventTime += t0TOF[0] * weight; + sumOfWeights += weight; + } + + if (collision.has_foundFT0()) { // T0 measurement is available + // const auto& ft0 = collision.foundFT0(); + if (collision.t0ACValid()) { + t0AC[0] = collision.t0AC() * 1000.f; + t0AC[1] = collision.t0resolution() * 1000.f; + flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeT0AC; + } + + weight = 1.f / (t0AC[1] * t0AC[1]); + eventTime += t0AC[0] * weight; + sumOfWeights += weight; + } + + if (sumOfWeights < weightDiamond) { // avoiding sumOfWeights = 0 or worse that diamond + eventTime = 0; + sumOfWeights = weightDiamond; + tableFlags(0); + } else { + tableFlags(flags); + } + tableEvTime(eventTime / sumOfWeights, sqrt(1. / sumOfWeights)); + if (enableTableEvTimeTOFOnly) { + tableEvTimeTOFOnly((uint8_t)filterForTOFEventTime(trk), t0TOF[0], t0TOF[1], evTimeMakerTOF.mEventTimeMultiplicity); + } + } + } + } else if (mComputeEvTimeWithTOF == 1 && mComputeEvTimeWithFT0 == 0) { + int lastCollisionId = -1; // Last collision ID analysed + for (auto const& t : tracks) { // Loop on collisions + if (!t.has_collision() || ((sel8TOFEvTime.value == true) && !t.collision_as().sel8())) { // Track was not assigned, cannot compute event time or event did not pass the event selection + tableFlags(0); + tableEvTime(0.f, 999.f); + if (enableTableEvTimeTOFOnly) { + tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1); + } + continue; + } + if (t.collisionId() == lastCollisionId) { // Event time from this collision is already in the table + continue; + } + /// Create new table for the tracks in a collision + lastCollisionId = t.collisionId(); /// Cache last collision ID + + const auto& tracksInCollision = tracks.sliceBy(perCollision, lastCollisionId); + + // First make table for event time + const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, diamond); + int nGoodTracksForTOF = 0; + float et = evTimeMakerTOF.mEventTime; + float erret = evTimeMakerTOF.mEventTimeError; + + for (auto const& trk : tracksInCollision) { // Loop on Tracks + if constexpr (removeTOFEvTimeBias) { + evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, et, erret, 2); + } + uint8_t flags = 0; + if (erret < errDiamond && (maxEvTimeTOF <= 0.f || abs(et) < maxEvTimeTOF)) { + flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; + } else { + et = 0.f; + erret = errDiamond; + } + tableFlags(flags); + tableEvTime(et, erret); + if (enableTableEvTimeTOFOnly) { + tableEvTimeTOFOnly((uint8_t)filterForTOFEventTime(trk), et, erret, evTimeMakerTOF.mEventTimeMultiplicity); + } + } + } + } else if (mComputeEvTimeWithTOF == 0 && mComputeEvTimeWithFT0 == 1) { + for (auto const& t : tracks) { // Loop on collisions + if (enableTableEvTimeTOFOnly) { + tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1); + } + if (!t.has_collision()) { // Track was not assigned, cannot compute event time + tableFlags(0); + tableEvTime(0.f, 999.f); + continue; + } + const auto& collision = t.collision_as(); + + if (collision.has_foundFT0()) { // T0 measurement is available + // const auto& ft0 = collision.foundFT0(); + if (collision.t0ACValid()) { + tableFlags(o2::aod::pidflags::enums::PIDFlags::EvTimeT0AC); + tableEvTime(collision.t0AC() * 1000.f, collision.t0resolution() * 1000.f); + continue; + } + } + tableFlags(0); + tableEvTime(0.f, 999.f); + } + } else { + LOG(fatal) << "Invalid configuration for TOF event time computation"; + } + } +}; + +// Part 3 Nsigma computation + +static constexpr int idxPi = 2; +static constexpr int idxKa = 3; +static constexpr int idxPr = 4; /// Task to produce the response table struct mcPidTof { // Tables to produce - Produces tablePIDPi; - Produces tablePIDKa; - Produces tablePIDPr; + Produces tablePIDPi; + Produces tablePIDKa; + Produces tablePIDPr; + + // Tables to produce (full) + Produces tablePIDFullPi; + Produces tablePIDFullKa; + Produces tablePIDFullPr; + // Detector response parameters - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; Service ccdb; - Configurable inheritFromBaseTask{"inheritFromBaseTask", true, "Flag to iherit all common configurables from the TOF base task"}; - // CCDB configuration (inherited from TOF base task) - Configurable url{"ccdb-url", "", "url of the ccdb repository"}; - Configurable timestamp{"ccdb-timestamp", -1, "timestamp of the object"}; - // TOF Calib configuration (inherited from TOF base task) - Configurable paramFileName{"paramFileName", "", "Path to the parametrization object. If empty the parametrization is not taken from file"}; - Configurable parametrizationPath{"parametrizationPath", "", "Path of the TOF parametrization on the CCDB or in the file, if the paramFileName is not empty"}; - Configurable passName{"passName", "", "Name of the pass inside of the CCDB parameter collection. If empty, the automatically deceted from metadata (to be implemented!!!)"}; - Configurable timeShiftCCDBPath{"timeShiftCCDBPath", "", "Path of the TOF time shift vs eta. If empty none is taken"}; - Configurable loadResponseFromCCDB{"loadResponseFromCCDB", false, "Flag to load the response from the CCDB"}; - Configurable enableTimeDependentResponse{"enableTimeDependentResponse", false, "Flag to use the collision timestamp to fetch the PID Response"}; - Configurable fatalOnPassNotAvailable{"fatalOnPassNotAvailable", true, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; + TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration + Configurable enableQaHistograms{"enableQaHistograms", false, "Flag to enable the QA histograms"}; + + // Histograms for QA + std::array, nSpecies> hnSigma; + std::array, nSpecies> hnSigmaFull; + // postcalibrations to overcome MC FT0 timing issue std::map gMcPostCalibMean{}; std::map gMcPostCalibSigma{}; @@ -70,163 +734,131 @@ struct mcPidTof { struct : ConfigurableGroup { std::string prefix = "mcRecalib"; Configurable enable{"enable", false, "enable MC recalibration for Pi/Ka/Pr"}; - Configurable ccdbPath{"ccdbPath", "Users/f/fgrosa/RecalibMcPidTOF/", "path for MC recalibration objects in CCDB"}; - Configurable passName{"passName", "apass6", "reco pass of MC anchoring"}; + Configurable ccdbPath{"ccdbPath", "Users/f/fgrosa/RecalibmcPidTof/", "path for MC recalibration objects in CCDB"}; } mcRecalib; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // Running variables - std::vector mEnabledParticles; // Vector of enabled PID hypotheses to loop on when making tables - int mLastCollisionId = -1; // Last collision ID analysed + std::vector mEnabledParticles; // Vector of enabled PID hypotheses to loop on when making tables + std::vector mEnabledParticlesFull; // Vector of enabled PID hypotheses to loop on when making full tables void init(o2::framework::InitContext& initContext) { - if (inheritFromBaseTask.value) { // Inheriting from base task - if (!getTaskOptionValue(initContext, "tof-signal", "ccdb-url", url.value, true)) { - LOG(fatal) << "Could not get ccdb-url from tof-signal task"; - } - if (!getTaskOptionValue(initContext, "tof-signal", "ccdb-timestamp", timestamp.value, true)) { - LOG(fatal) << "Could not get ccdb-timestamp from tof-signal task"; - } - if (!getTaskOptionValue(initContext, "tof-event-time", "paramFileName", paramFileName.value, true)) { - LOG(fatal) << "Could not get paramFileName from tof-event-time task"; - } - if (!getTaskOptionValue(initContext, "tof-event-time", "parametrizationPath", parametrizationPath.value, true)) { - LOG(fatal) << "Could not get parametrizationPath from tof-event-time task"; - } - if (!getTaskOptionValue(initContext, "tof-event-time", "passName", passName.value, true)) { - LOG(fatal) << "Could not get passName from tof-event-time task"; - } - if (!getTaskOptionValue(initContext, "tof-signal", "timeShiftCCDBPath", timeShiftCCDBPath.value, true)) { - LOG(fatal) << "Could not get timeShiftCCDBPath from tof-signal task"; - } - if (!getTaskOptionValue(initContext, "tof-event-time", "loadResponseFromCCDB", loadResponseFromCCDB.value, true)) { - LOG(fatal) << "Could not get loadResponseFromCCDB from tof-event-time task"; - } - if (!getTaskOptionValue(initContext, "tof-event-time", "enableTimeDependentResponse", enableTimeDependentResponse.value, true)) { - LOG(fatal) << "Could not get enableTimeDependentResponse from tof-event-time task"; - } - if (!getTaskOptionValue(initContext, "tof-event-time", "fatalOnPassNotAvailable", fatalOnPassNotAvailable.value, true)) { - LOG(fatal) << "Could not get fatalOnPassNotAvailable from tof-event-time task"; - } - } - if (doprocessWSlice == true && doprocessWoSlice == true) { - LOGF(fatal, "Cannot enable processWoSlice and processWSlice at the same time. Please choose one."); - } - if (doprocessWSlice == false && doprocessWoSlice == false) { - LOGF(fatal, "Cannot run without any of processWoSlice and processWSlice enabled. Please choose one."); - } - + mTOFCalibConfig.inheritFromBaseTask(initContext); // Checking the tables are requested in the workflow and enabling them (only pi, K, p) - std::array supportedSpecies = {2, 3, 4}; + std::array supportedSpecies = {idxPi, idxKa, idxPr}; for (auto iSpecie{0u}; iSpecie < supportedSpecies.size(); ++iSpecie) { + // First checking tiny int flag = -1; - enableFlagIfTableRequired(initContext, "pidTOFFull" + particleNames[supportedSpecies[iSpecie]], flag); + enableFlagIfTableRequired(initContext, "pidTOF" + particleNames[supportedSpecies[iSpecie]], flag); if (flag == 1) { mEnabledParticles.push_back(supportedSpecies[iSpecie]); } + + // Then check full + flag = -1; + enableFlagIfTableRequired(initContext, "pidTOFFull" + particleNames[supportedSpecies[iSpecie]], flag); + if (flag == 1) { + mEnabledParticlesFull.push_back(supportedSpecies[iSpecie]); + } } - // Printing enabled tables - LOG(info) << "++ Enabled tables:"; - for (const int& pidId : mEnabledParticles) { - LOG(info) << "++ pidTOFFull" << particleNames[pidId] << " is enabled"; + if (mEnabledParticlesFull.size() == 0 && mEnabledParticles.size() == 0) { + LOG(info) << "No PID tables are required, disabling process function"; + doprocessFillTables.value = false; + doprocessDummy.value = true; + return; } - - // Getting the parametrization parameters - ccdb->setURL(url.value); - ccdb->setTimestamp(timestamp.value); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - // Not later than now objects - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - // - - // TODO: implement the automatic pass name detection from metadata - if (passName.value == "") { - passName.value = "unanchored"; // temporary default - LOG(warning) << "Passed autodetect mode for pass, not implemented yet, waiting for metadata. Taking '" << passName.value << "'"; - } - LOG(info) << "Using parameter collection, starting from pass '" << passName.value << "'"; - - const std::string fname = paramFileName.value; - if (!fname.empty()) { // Loading the parametrization from file - LOG(info) << "Loading exp. sigma parametrization from file " << fname << ", using param: " << parametrizationPath.value; - if (1) { - o2::tof::ParameterCollection paramCollection; - paramCollection.loadParamFromFile(fname, parametrizationPath.value); - LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV2, passName.value)) { - if (fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } - } else { - mRespParamsV2.setShiftParameters(paramCollection.getPars(passName.value)); - mRespParamsV2.printShiftParameters(); - } - } else { - mRespParamsV2.loadParamFromFile(fname.data(), parametrizationPath.value); + if (metadataInfo.isFullyDefined()) { + if (!metadataInfo.isRun3()) { + LOG(fatal) << "Metadata says it is Run2, but this task supports only Run3 data"; } - } else if (loadResponseFromCCDB) { // Loading it from CCDB - LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << parametrizationPath.value << " for timestamp " << timestamp.value; - o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value); - paramCollection->print(); - if (!paramCollection->retrieveParameters(mRespParamsV2, passName.value)) { // Attempt at loading the parameters with the pass defined - if (fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } - } else { // Pass is available, load non standard parameters - mRespParamsV2.setShiftParameters(paramCollection->getPars(passName.value)); - mRespParamsV2.printShiftParameters(); + } + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters + + // Printing enabled tables and enabling QA histograms if needed + LOG(info) << "++ Enabled tables:"; + const AxisSpec pAxis{100, 0, 5, "#it{p} (GeV/#it{c})"}; + const AxisSpec nSigmaAxis{100, -10, 10, "N_{#sigma}^{TOF}"}; + for (const int& iSpecie : mEnabledParticles) { + LOG(info) << "++ pidTOF" << particleNames[iSpecie] << " is enabled"; + if (!enableQaHistograms) { + continue; } + hnSigma[iSpecie] = histos.add(Form("nSigma/%s", particleNames[iSpecie].c_str()), Form("N_{#sigma}^{TOF}(%s)", particleNames[iSpecie].c_str()), kTH2F, {pAxis, nSigmaAxis}); } - mRespParamsV2.print(); - if (timeShiftCCDBPath.value != "") { - if (timeShiftCCDBPath.value.find(".root") != std::string::npos) { - mRespParamsV2.setTimeShiftParameters(timeShiftCCDBPath.value, "gmean_Pos", true); - mRespParamsV2.setTimeShiftParameters(timeShiftCCDBPath.value, "gmean_Neg", false); - } else { - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/pos", timeShiftCCDBPath.value.c_str()), timestamp.value), true); - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/neg", timeShiftCCDBPath.value.c_str()), timestamp.value), false); + for (const int& iSpecie : mEnabledParticlesFull) { + LOG(info) << "++ pidTOFFull" << particleNames[iSpecie] << " is enabled"; + if (!enableQaHistograms) { + continue; } + hnSigmaFull[iSpecie] = histos.add(Form("nSigmaFull/%s", particleNames[iSpecie].c_str()), Form("N_{#sigma}^{TOF}(%s)", particleNames[iSpecie].c_str()), kTH2F, {pAxis, nSigmaAxis}); } } // Reserves an empty table for the given particle ID with size of the given track table - void reserveTable(const int id, const int64_t& size) + void reserveTable(const int id, const int64_t& size, const bool fullTable = false) { switch (id) { - case 2: - tablePIDPi.reserve(size); + case idxPi: { + if (fullTable) { + tablePIDFullPi.reserve(size); + } else { + tablePIDPi.reserve(size); + } break; - case 3: - tablePIDKa.reserve(size); + } + case idxKa: { + if (fullTable) { + tablePIDFullKa.reserve(size); + } else { + tablePIDKa.reserve(size); + } break; - case 4: - tablePIDPr.reserve(size); + } + case idxPr: { + if (fullTable) { + tablePIDFullPr.reserve(size); + } else { + tablePIDPr.reserve(size); + } break; + } default: - LOG(fatal) << "Wrong particle ID in reserveTable()"; + LOG(fatal) << "Wrong particle ID in reserveTable() for " << (fullTable ? "full" : "tiny") << " tables"; break; } } // Makes the table empty for the given particle ID, filling it with dummy values - void makeTableEmpty(const int id) + void makeTableEmpty(const int id, bool fullTable = false) { switch (id) { - case 2: - tablePIDPi(-999.f, -999.f); + case idxPi: + if (fullTable) { + tablePIDFullPi(-999.f, -999.f); + } else { + aod::pidutils::packInTable(-999.f, + tablePIDPi); + } break; - case 3: - tablePIDKa(-999.f, -999.f); + case idxKa: + if (fullTable) { + tablePIDFullKa(-999.f, -999.f); + } else { + aod::pidutils::packInTable(-999.f, + tablePIDKa); + } break; - case 4: - tablePIDPr(-999.f, -999.f); + case idxPr: + if (fullTable) { + tablePIDFullPr(-999.f, -999.f); + } else { + aod::pidutils::packInTable(-999.f, + tablePIDPr); + } break; default: - LOG(fatal) << "Wrong particle ID in makeTableEmpty()"; + LOG(fatal) << "Wrong particle ID in makeTableEmpty() for " << (fullTable ? "full" : "tiny") << " tables"; break; } } @@ -236,9 +868,23 @@ struct mcPidTof { void retrieveMcPostCalibFromCcdb(int64_t timestamp) { std::map metadata; - metadata["RecoPassName"] = mcRecalib.passName; + if (metadataInfo.isFullyDefined()) { + metadata["RecoPassName"] = metadataInfo.get("AnchorPassName"); + } else { + LOGP(error, "Impossible to read metadata! Using default calibrations (2022 apass7)"); + metadata["RecoPassName"] = ""; + } auto calibList = ccdb->getSpecific(mcRecalib.ccdbPath, timestamp, metadata); - for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses + std::vector updatedSpecies{}; + for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses (tiny) + gMcPostCalibMean[pidId] = reinterpret_cast(calibList->FindObject(Form("Mean%s", particleNames[pidId].data()))); + gMcPostCalibSigma[pidId] = reinterpret_cast(calibList->FindObject(Form("Sigma%s", particleNames[pidId].data()))); + updatedSpecies.push_back(pidId); + } + for (auto const& pidId : mEnabledParticlesFull) { // Loop on enabled particle hypotheses (full) + if (std::find(updatedSpecies.begin(), updatedSpecies.end(), pidId) != updatedSpecies.end()) { + continue; + } gMcPostCalibMean[pidId] = reinterpret_cast(calibList->FindObject(Form("Mean%s", particleNames[pidId].data()))); gMcPostCalibSigma[pidId] = reinterpret_cast(calibList->FindObject(Form("Sigma%s", particleNames[pidId].data()))); } @@ -273,189 +919,148 @@ struct mcPidTof { return nSigmaCorr; } - using Trks = soa::Join; - // Define slice per collision - Preslice perCollision = aod::track::collisionId; + void processDummy(Trks const&) {} + PROCESS_SWITCH(mcPidTof, processDummy, "Dummy process function", false); + template - using ResponseImplementation = o2::pid::tof::ExpTimes; - void processWSlice(Trks const& tracks, aod::Collisions const&, aod::BCsWithTimestamps const&, aod::McParticles const&) + using ResponseImplementation = o2::pid::tof::ExpTimes; + void processFillTables(TrksWtofWevTime const& tracks, + Cols const&, + aod::BCsWithTimestamps const& bcs, + aod::McParticles const&) { constexpr auto responsePi = ResponseImplementation(); constexpr auto responseKa = ResponseImplementation(); constexpr auto responsePr = ResponseImplementation(); + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters + for (auto const& pidId : mEnabledParticles) { - reserveTable(pidId, tracks.size()); + reserveTable(pidId, tracks.size(), false); + } + + for (auto const& pidId : mEnabledParticlesFull) { + reserveTable(pidId, tracks.size(), true); } - int lastCollisionId = -1; // Last collision ID analysed - float resolution = 1.f; // Last resolution assigned - for (auto const& track : tracks) { // Loop on all tracks - if (!track.has_collision()) { // Track was not assigned, cannot compute NSigma (no event time) -> filling with empty table + float resolution = 1.f; // Last resolution assigned + float nSigma = 0; + for (auto const& trk : tracks) { // Loop on all tracks + if (!trk.has_collision()) { // Track was not assigned, cannot compute NSigma (no event time) -> filling with empty table for (auto const& pidId : mEnabledParticles) { - makeTableEmpty(pidId); + makeTableEmpty(pidId, false); } - continue; - } - - if (track.collisionId() == lastCollisionId) { // Tracks from last collision already processed - continue; - } - - // Fill new table for the tracks in a collision - lastCollisionId = track.collisionId(); // Cache last collision ID - timestamp.value = track.collision().bc_as().timestamp(); - if (enableTimeDependentResponse) { - LOG(debug) << "Updating parametrization from path '" << parametrizationPath.value << "' and timestamp " << timestamp.value; - if (!ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value)->retrieveParameters(mRespParamsV2, passName.value)) { - if (fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } + for (auto const& pidId : mEnabledParticlesFull) { + makeTableEmpty(pidId, true); } + continue; } - // in case of MC recalibrations, check if the objects from CCDB has to be updated if (mcRecalib.enable) { - int runNumber = track.collision().bc_as().runNumber(); + auto runNumber = trk.collision().bc_as().runNumber(); if (runNumber != currentRun) { // update postcalibration files + auto timestamp = trk.collision().bc_as().timestamp(); retrieveMcPostCalibFromCcdb(timestamp); } currentRun = runNumber; } - const auto& tracksInCollision = tracks.sliceBy(perCollision, lastCollisionId); - for (auto const& trkInColl : tracksInCollision) { // Loop on tracks - for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses - float nSigma{-999.f}; - switch (pidId) { - case 2: - resolution = responsePi.GetExpectedSigma(mRespParamsV2, trkInColl); - nSigma = responsePi.GetSeparation(mRespParamsV2, trkInColl, resolution); - if (mcRecalib.enable && trkInColl.has_mcParticle()) { - if (std::abs(trkInColl.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal - nSigma = applyMcRecalib(pidId, trkInColl.pt(), nSigma); - } - } - tablePIDPi(resolution, nSigma); - break; - case 3: - resolution = responseKa.GetExpectedSigma(mRespParamsV2, trkInColl); - nSigma = responseKa.GetSeparation(mRespParamsV2, trkInColl, resolution); - if (mcRecalib.enable && trkInColl.has_mcParticle()) { - if (std::abs(trkInColl.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal - nSigma = applyMcRecalib(pidId, trkInColl.pt(), nSigma); - } + for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses + switch (pidId) { + case idxPi: { + nSigma = responsePi.GetSeparation(mRespParamsV3, trk); + if (mcRecalib.enable && trk.has_mcParticle()) { + if (std::abs(trk.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal + nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); } - tablePIDKa(resolution, nSigma); - break; - case 4: - resolution = responsePr.GetExpectedSigma(mRespParamsV2, trkInColl); - nSigma = responsePr.GetSeparation(mRespParamsV2, trkInColl, resolution); - if (mcRecalib.enable && trkInColl.has_mcParticle()) { - if (std::abs(trkInColl.mcParticle().pdgCode()) == kProton) { // we rescale only true signal - nSigma = applyMcRecalib(pidId, trkInColl.pt(), nSigma); - } + } + aod::pidutils::packInTable(nSigma, tablePIDPi); + break; + } + case idxKa: { + nSigma = responseKa.GetSeparation(mRespParamsV3, trk); + if (mcRecalib.enable && trk.has_mcParticle()) { + if (std::abs(trk.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal + nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); } - tablePIDPr(resolution, nSigma); - break; - default: - LOG(fatal) << "Wrong particle ID in processWSlice()"; - break; + } + aod::pidutils::packInTable(nSigma, tablePIDKa); + break; } - } - } - } - } - PROCESS_SWITCH(mcPidTof, processWSlice, "Process with track slices", true); - - using TrksIU = soa::Join; - template - using ResponseImplementationIU = o2::pid::tof::ExpTimes; - void processWoSlice(TrksIU const& tracks, aod::Collisions const&, aod::BCsWithTimestamps const&, aod::McParticles const&) - { - constexpr auto responsePi = ResponseImplementationIU(); - constexpr auto responseKa = ResponseImplementationIU(); - constexpr auto responsePr = ResponseImplementationIU(); - - for (auto const& pidId : mEnabledParticles) { - reserveTable(pidId, tracks.size()); - } - float resolution = 1.f; // Last resolution assigned - for (auto const& track : tracks) { // Loop on all tracks - if (!track.has_collision()) { // Track was not assigned, cannot compute NSigma (no event time) -> filling with empty table - for (auto const& pidId : mEnabledParticles) { - makeTableEmpty(pidId); - } - continue; - } - - if (enableTimeDependentResponse && (track.collisionId() != mLastCollisionId)) { // Time dependent calib is enabled and this is a new collision - mLastCollisionId = track.collisionId(); // Cache last collision ID - timestamp.value = track.collision().bc_as().timestamp(); - LOG(debug) << "Updating parametrization from path '" << parametrizationPath.value << "' and timestamp " << timestamp.value; - if (!ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value)->retrieveParameters(mRespParamsV2, passName.value)) { - if (fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); + case idxPr: { + nSigma = responsePr.GetSeparation(mRespParamsV3, trk); + if (mcRecalib.enable && trk.has_mcParticle()) { + if (std::abs(trk.mcParticle().pdgCode()) == kProton) { // we rescale only true signal + nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); + } + } + aod::pidutils::packInTable(nSigma, tablePIDPr); + break; } + default: + LOG(fatal) << "Wrong particle ID for standard tables"; + break; } - } - - // in case of MC recalibrations, check if the objects from CCDB has to be updated - if (mcRecalib.enable) { - int runNumber = track.collision().bc_as().runNumber(); - if (runNumber != currentRun) { - // update postcalibration files - retrieveMcPostCalibFromCcdb(timestamp); + if (enableQaHistograms) { + hnSigma[pidId]->Fill(trk.p(), nSigma); } - currentRun = runNumber; } - float nSigma{-999.f}; - for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses + for (auto const& pidId : mEnabledParticlesFull) { // Loop on enabled particle hypotheses with full tables switch (pidId) { - case 2: - resolution = responsePi.GetExpectedSigma(mRespParamsV2, track); - nSigma = responsePi.GetSeparation(mRespParamsV2, track, resolution); - if (mcRecalib.enable && track.has_mcParticle()) { - if (std::abs(track.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal - nSigma = applyMcRecalib(pidId, track.pt(), nSigma); + case idxPi: { + resolution = responsePi.GetExpectedSigma(mRespParamsV3, trk); + nSigma = responsePi.GetSeparation(mRespParamsV3, trk); + if (mcRecalib.enable && trk.has_mcParticle()) { + if (std::abs(trk.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal + nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); } } - tablePIDPi(resolution, nSigma); + tablePIDFullPi(resolution, nSigma); break; - case 3: - resolution = responseKa.GetExpectedSigma(mRespParamsV2, track); - nSigma = responseKa.GetSeparation(mRespParamsV2, track, resolution); - if (mcRecalib.enable && track.has_mcParticle()) { - if (std::abs(track.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal - nSigma = applyMcRecalib(pidId, track.pt(), nSigma); + } + case idxKa: { + resolution = responseKa.GetExpectedSigma(mRespParamsV3, trk); + nSigma = responseKa.GetSeparation(mRespParamsV3, trk, resolution); + if (mcRecalib.enable && trk.has_mcParticle()) { + if (std::abs(trk.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal + nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); } } - tablePIDKa(resolution, nSigma); + tablePIDFullKa(resolution, nSigma); break; - case 4: - resolution = responsePr.GetExpectedSigma(mRespParamsV2, track); - nSigma = responsePr.GetSeparation(mRespParamsV2, track, resolution); - if (mcRecalib.enable && track.has_mcParticle()) { - if (std::abs(track.mcParticle().pdgCode()) == kProton) { // we rescale only true signal - nSigma = applyMcRecalib(pidId, track.pt(), nSigma); + } + case idxPr: { + resolution = responsePr.GetExpectedSigma(mRespParamsV3, trk); + nSigma = responsePr.GetSeparation(mRespParamsV3, trk, resolution); + if (mcRecalib.enable && trk.has_mcParticle()) { + if (std::abs(trk.mcParticle().pdgCode()) == kProton) { // we rescale only true signal + nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); } } - tablePIDPr(resolution, nSigma); + tablePIDFullPr(resolution, nSigma); break; + } default: - LOG(fatal) << "Wrong particle ID in processWoSlice()"; + LOG(fatal) << "Wrong particle ID for full tables"; break; } + if (enableQaHistograms) { + hnSigmaFull[pidId]->Fill(trk.p(), nSigma); + } } } } - PROCESS_SWITCH(mcPidTof, processWoSlice, "Process without track slices and on TrackIU (faster but only Run3)", false); + PROCESS_SWITCH(mcPidTof, processFillTables, "Process with table filling", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + // Parse the metadata + metadataInfo.initMetadata(cfgc); + auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc)}; + workflow.push_back(adaptAnalysisTask(cfgc)); + workflow.push_back(adaptAnalysisTask(cfgc)); + return workflow; +} diff --git a/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx index dd863781594..fd11fad78b1 100644 --- a/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx @@ -293,21 +293,50 @@ struct HfTreeCreatorDstarToD0Pi { originMc = candidate.originMcRec(); } - auto prong0 = candidate.template prong0_as(); - auto prong1 = candidate.template prong1_as(); + TracksWPid::iterator prong0; + TracksWPid::iterator prong1; auto prongSoftPi = candidate.template prongPi_as(); float massD0{-1.f}; float massDStar{-1.f}; float cosThetaD0{-1.f}; + float impParameterProng0{-999.}, impParameterProng1{-999.}; + // float errorImpParameterProng0{-999.}, errorImpParameterProng1{-999.}; + float impParameterNormalisedProng0{-999.}, impParameterNormalisedProng1{-999.}; + float ptProng0{-999.}, ptProng1{-999.}; + float pProng0{-999.}, pProng1{-999.}; if (candidate.signSoftPi() > 0) { massD0 = candidate.invMassD0(); massDStar = candidate.invMassDstar(); cosThetaD0 = candidate.cosThetaStarD0(); + prong0 = candidate.template prong0_as(); // pion + prong1 = candidate.template prong1_as(); // kaon + ptProng0 = candidate.ptProng0(); + ptProng1 = candidate.ptProng1(); + impParameterProng0 = candidate.impactParameter0(); + impParameterProng1 = candidate.impactParameter1(); + // errorImpParameterProng0 = candidate.errorImpactParameter0(); + // errorImpParameterProng1 = candidate.errorImpactParameter1(); + impParameterNormalisedProng0 = candidate.impactParameterNormalised0(); + impParameterNormalisedProng1 = candidate.impactParameterNormalised1(); + pProng0 = RecoDecay::p(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()); + pProng1 = RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()); } else { massD0 = candidate.invMassD0Bar(); massDStar = candidate.invMassAntiDstar(); cosThetaD0 = candidate.cosThetaStarD0Bar(); + prong0 = candidate.template prong1_as(); // pion + prong1 = candidate.template prong0_as(); // kaon + ptProng0 = candidate.ptProng1(); + ptProng1 = candidate.ptProng0(); + impParameterProng0 = candidate.impactParameter1(); + impParameterProng1 = candidate.impactParameter0(); + // errorImpParameterProng0 = candidate.errorImpactParameter1(); + // errorImpParameterProng1 = candidate.errorImpactParameter0(); + impParameterNormalisedProng0 = candidate.impactParameterNormalised1(); + impParameterNormalisedProng1 = candidate.impactParameterNormalised0(); + pProng0 = RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()); + pProng1 = RecoDecay::p(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()); } if (fillCandidateLiteTable) { @@ -322,14 +351,14 @@ struct HfTreeCreatorDstarToD0Pi { candidate.deltaIPNormalisedMaxD0(), candidate.impactParameterProductD0(), cosThetaD0, - candidate.ptProng0(), - candidate.ptProng1(), + ptProng0, + ptProng1, candidate.ptSoftPi(), - candidate.impactParameter0(), - candidate.impactParameter1(), + impParameterProng0, + impParameterProng1, candidate.impParamSoftPi(), - candidate.impactParameterNormalised0(), - candidate.impactParameterNormalised1(), + impParameterNormalisedProng0, + impParameterNormalisedProng1, candidate.normalisedImpParamSoftPi(), prong0.tpcNSigmaPi(), prong0.tpcNSigmaKa(), @@ -385,17 +414,17 @@ struct HfTreeCreatorDstarToD0Pi { candidate.deltaIPNormalisedMaxD0(), candidate.impactParameterProductD0(), cosThetaD0, - RecoDecay::p(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()), - RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), + pProng0, + pProng1, RecoDecay::p(candidate.pxSoftPi(), candidate.pySoftPi(), candidate.pzSoftPi()), - candidate.ptProng0(), - candidate.ptProng1(), + ptProng0, + ptProng1, candidate.ptSoftPi(), - candidate.impactParameter0(), - candidate.impactParameter1(), + impParameterProng0, + impParameterProng1, candidate.impParamSoftPi(), - candidate.impactParameterNormalised0(), - candidate.impactParameterNormalised1(), + impParameterNormalisedProng0, + impParameterNormalisedProng1, candidate.normalisedImpParamSoftPi(), candidate.errorImpactParameter0(), candidate.errorImpactParameter1(), @@ -457,7 +486,7 @@ struct HfTreeCreatorDstarToD0Pi { } for (const auto& candidate : candidates) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - (int64_t)(candidate.ptProng0() * 1000); + float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -498,7 +527,7 @@ struct HfTreeCreatorDstarToD0Pi { } for (const auto& candidate : reconstructedCandBkg) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - (int64_t)(candidate.ptProng0() * 1000); + float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx b/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx index 42e8001022f..d69de17d4e8 100644 --- a/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx @@ -21,8 +21,6 @@ #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "ALICE3/DataModel/RICH.h" - #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -34,6 +32,7 @@ namespace o2::aod { namespace full { +DECLARE_SOA_COLUMN(ImpactParameterXY, impactParameterXY, float); DECLARE_SOA_COLUMN(RSecondaryVertex, rSecondaryVertex, float); DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); DECLARE_SOA_COLUMN(PProng0, pProng0, float); @@ -52,20 +51,23 @@ DECLARE_SOA_COLUMN(DecayLength, decayLength, float); DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); -DECLARE_SOA_COLUMN(CPA, cpa, float); -DECLARE_SOA_COLUMN(CPAXY, cpaXY, float); +DECLARE_SOA_COLUMN(CPA, cPA, float); +DECLARE_SOA_COLUMN(CPAXY, cPAXY, float); DECLARE_SOA_COLUMN(Ct, ct, float); -DECLARE_SOA_COLUMN(MCflag, mcflag, int8_t); +DECLARE_SOA_COLUMN(McFlag, mcFlag, int8_t); DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); -DECLARE_SOA_COLUMN(NSigRICHTrk0Pi, nsigRICHTrk0Pi, float); -DECLARE_SOA_COLUMN(NSigfRICHTrk0Pi, nsigfRICHTrk0Pi, float); -DECLARE_SOA_COLUMN(NSigTOFTrk0Pi, nsigTOFTrk0Pi, float); +DECLARE_SOA_COLUMN(SignTrk0, signTrk0, int16_t); +DECLARE_SOA_COLUMN(NSigTOFTrk0Pi, nSigTOFTrk0Pi, float); +DECLARE_SOA_COLUMN(NSigTPCTrk0Pi, nSigTPCTrk0Pi, float); // Lc selection parameters DECLARE_SOA_COLUMN(LcM, lcM, float); DECLARE_SOA_COLUMN(LcCt, lcCt, float); DECLARE_SOA_COLUMN(LcY, lcY, float); DECLARE_SOA_COLUMN(LcE, lcE, float); DECLARE_SOA_COLUMN(LcEta, lcEta, float); +DECLARE_SOA_COLUMN(LcVertexX, lcVertexX, float); +DECLARE_SOA_COLUMN(LcVertexY, lcVertexY, float); +DECLARE_SOA_COLUMN(LcVertexZ, lcVertexZ, float); DECLARE_SOA_COLUMN(LcCPA, lcCPA, float); DECLARE_SOA_COLUMN(LcCPAXY, lcCPAXY, float); DECLARE_SOA_COLUMN(LcChi2PCA, lcChi2PCA, float); @@ -73,39 +75,58 @@ DECLARE_SOA_COLUMN(LcDecayLength, lcDecayLength, float); DECLARE_SOA_COLUMN(LcDecayLengthXY, lcDecayLengthXY, float); DECLARE_SOA_COLUMN(LcDecayLengthNormalised, lcDecayLengthNormalised, float); DECLARE_SOA_COLUMN(LcImpactParameter0, lcImpactParameter0, float); +DECLARE_SOA_COLUMN(LcImpactParameterError0, lcImpactParameterError0, float); DECLARE_SOA_COLUMN(LcImpactParameter1, lcImpactParameter1, float); +DECLARE_SOA_COLUMN(LcImpactParameterError1, lcImpactParameterError1, float); DECLARE_SOA_COLUMN(LcImpactParameter2, lcImpactParameter2, float); -DECLARE_SOA_COLUMN(NSigRICHTrk1Pi, nSigRICHTrk1Pi, float); -DECLARE_SOA_COLUMN(NSigRICHTrk1Pr, nSigRICHTrk1Pr, float); -DECLARE_SOA_COLUMN(NSigRICHTrk2Ka, nSigRICHTrk2Ka, float); -DECLARE_SOA_COLUMN(NSigRICHTrk3Pi, nSigRICHTrk3Pi, float); -DECLARE_SOA_COLUMN(NSigRICHTrk3Pr, nSigRICHTrk3Pr, float); -DECLARE_SOA_COLUMN(NSigfRICHTrk1Pi, nSigfRICHTrk1Pi, float); -DECLARE_SOA_COLUMN(NSigfRICHTrk1Pr, nSigfRICHTrk1Pr, float); -DECLARE_SOA_COLUMN(NSigfRICHTrk2Ka, nSigfRICHTrk2Ka, float); -DECLARE_SOA_COLUMN(NSigfRICHTrk3Pi, nSigfRICHTrk3Pi, float); -DECLARE_SOA_COLUMN(NSigfRICHTrk3Pr, nSigfRICHTrk3Pr, float); -DECLARE_SOA_COLUMN(NSigTOFTrk1Pi, nSigTOFrk1Pi, float); -DECLARE_SOA_COLUMN(NSigTOFTrk1Pr, nSigTOFrk1Pr, float); -DECLARE_SOA_COLUMN(NSigTOFTrk2Ka, nSigTOFrk2Ka, float); -DECLARE_SOA_COLUMN(NSigTOFTrk3Pi, nSigTOFrk3Pi, float); -DECLARE_SOA_COLUMN(NSigTOFTrk3Pr, nSigTOFrk3Pr, float); +DECLARE_SOA_COLUMN(LcImpactParameterError2, lcImpactParameterError2, float); +DECLARE_SOA_COLUMN(LcPx0, lcPx0, float); +DECLARE_SOA_COLUMN(LcPy0, lcPy0, float); +DECLARE_SOA_COLUMN(LcPz0, lcPz0, float); +DECLARE_SOA_COLUMN(LcPx1, lcPx1, float); +DECLARE_SOA_COLUMN(LcPy1, lcPy1, float); +DECLARE_SOA_COLUMN(LcPz1, lcPz1, float); +DECLARE_SOA_COLUMN(LcPx2, lcPx2, float); +DECLARE_SOA_COLUMN(LcPy2, lcPy2, float); +DECLARE_SOA_COLUMN(LcPz2, lcPz2, float); +DECLARE_SOA_COLUMN(LcSignProng0, lcSignProng0, int16_t); +DECLARE_SOA_COLUMN(LcSignProng1, lcSignProng1, int16_t); +DECLARE_SOA_COLUMN(LcSignProng2, lcSignProng2, int16_t); +DECLARE_SOA_COLUMN(LcNSigTPCPi0, lcNSigTPCPi0, float); +DECLARE_SOA_COLUMN(LcNSigTPCK0, lcNSigTPCK0, float); +DECLARE_SOA_COLUMN(LcNSigTPCPr0, lcNSigTPCPr0, float); +DECLARE_SOA_COLUMN(LcNSigTPCPi1, lcNSigTPCPi1, float); +DECLARE_SOA_COLUMN(LcNSigTPCK1, lcNSigTPCK1, float); +DECLARE_SOA_COLUMN(LcNSigTPCPr1, lcNSigTPCPr1, float); +DECLARE_SOA_COLUMN(LcNSigTPCPi2, lcNSigTPCPi2, float); +DECLARE_SOA_COLUMN(LcNSigTPCK2, lcNSigTPCK2, float); +DECLARE_SOA_COLUMN(LcNSigTPCPr2, lcNSigTPCPr2, float); +DECLARE_SOA_COLUMN(LcNSigTOFPr0, lcNSigTOFPr0, float); +DECLARE_SOA_COLUMN(LcNSigTOFK1, lcNSigTOFK1, float); +DECLARE_SOA_COLUMN(LcNSigTOFPi2, lcNSigTOFPi2, float); } // namespace full // put the arguments into the table DECLARE_SOA_TABLE(HfCandLbFulls, "AOD", "HFCANDLBFULL", + collision::PosX, collision::PosY, collision::PosZ, + hf_cand::XSecondaryVertex, hf_cand::YSecondaryVertex, hf_cand::ZSecondaryVertex, + hf_cand::ErrorDecayLength, hf_cand::ErrorDecayLengthXY, + hf_cand::Chi2PCA, + full::ImpactParameterXY, full::RSecondaryVertex, full::DecayLength, full::DecayLengthXY, full::DecayLengthNormalised, full::DecayLengthXYNormalised, - hf_cand::Chi2PCA, full::ImpactParameterNormalised0, full::PtProng0, full::PProng0, full::ImpactParameterNormalised1, full::PtProng1, full::PProng1, + full::SignTrk0, + full::NSigTOFTrk0Pi, + full::NSigTPCTrk0Pi, hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, @@ -116,29 +137,20 @@ DECLARE_SOA_TABLE(HfCandLbFulls, "AOD", "HFCANDLBFULL", hf_cand::ImpactParameter1, hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, - full::NSigTOFTrk0Pi, - full::NSigRICHTrk0Pi, - full::NSigRICHTrk1Pi, - full::NSigRICHTrk1Pr, - full::NSigRICHTrk2Ka, - full::NSigRICHTrk3Pi, - full::NSigRICHTrk3Pr, - full::NSigfRICHTrk0Pi, - full::NSigfRICHTrk1Pi, - full::NSigfRICHTrk1Pr, - full::NSigfRICHTrk2Ka, - full::NSigfRICHTrk3Pi, - full::NSigfRICHTrk3Pr, - full::NSigTOFTrk1Pi, - full::NSigTOFTrk1Pr, - full::NSigTOFTrk2Ka, - full::NSigTOFTrk3Pi, - full::NSigTOFTrk3Pr, + full::LcNSigTPCPi0, full::LcNSigTPCK0, full::LcNSigTPCPr0, + full::LcNSigTPCPi1, full::LcNSigTPCK1, full::LcNSigTPCPr1, + full::LcNSigTPCPi2, full::LcNSigTPCK2, full::LcNSigTPCPr2, + full::LcNSigTOFPr0, + full::LcNSigTOFK1, + full::LcNSigTOFPi2, full::LcM, full::LcCt, full::LcY, full::LcE, full::LcEta, + full::LcVertexX, + full::LcVertexY, + full::LcVertexZ, full::LcCPA, full::LcCPAXY, full::LcChi2PCA, @@ -146,8 +158,17 @@ DECLARE_SOA_TABLE(HfCandLbFulls, "AOD", "HFCANDLBFULL", full::LcDecayLengthXY, full::LcDecayLengthNormalised, full::LcImpactParameter0, + full::LcImpactParameterError0, full::LcImpactParameter1, + full::LcImpactParameterError1, full::LcImpactParameter2, + full::LcImpactParameterError2, + full::LcPx0, full::LcPy0, full::LcPz0, + full::LcPx1, full::LcPy1, full::LcPz1, + full::LcPx2, full::LcPy2, full::LcPz2, + full::LcSignProng0, + full::LcSignProng1, + full::LcSignProng2, full::CandidateSelFlag, full::M, full::Pt, @@ -158,47 +179,22 @@ DECLARE_SOA_TABLE(HfCandLbFulls, "AOD", "HFCANDLBFULL", full::Eta, full::Phi, full::Y, - full::MCflag, + full::McFlag, full::OriginMcRec); } // namespace o2::aod -namespace o2::aod -{ -namespace hf_track_index_alice3_pid -{ -DECLARE_SOA_INDEX_COLUMN(Track, track); //! -DECLARE_SOA_INDEX_COLUMN(RICH, rich); //! -DECLARE_SOA_INDEX_COLUMN(FRICH, frich); //! -} // namespace hf_track_index_alice3_pid - -DECLARE_SOA_INDEX_TABLE_USER(HfTrackIndexALICE3PID, Tracks, "HFTRKIDXA3PID", //! - hf_track_index_alice3_pid::TrackId, - hf_track_index_alice3_pid::RICHId, - hf_track_index_alice3_pid::FRICHId); -} // namespace o2::aod - -struct HfTreeCreatorLbToLcPiAlice3PidIndexBuilder { - Builds index; - - void init(InitContext&) {} -}; - /// Writes the full information in an output TTree struct HfTreeCreatorLbToLcPi { Produces rowCandidateFull; - HfHelper hfHelper; - using TracksWPid = soa::Join; + using TracksWPid = soa::Join; - void process(soa::Join const& candidates, - soa::Join const&, - TracksWPid const&, - aod::FRICHs const&, - aod::RICHs const&) + void process(soa::Join const& candidates, + soa::Join const&, + TracksWPid const&) { - // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { @@ -206,121 +202,97 @@ struct HfTreeCreatorLbToLcPi { float FunctionInvMass, float FunctionCt, float FunctionY) { - if (FunctionSelection >= 1) { - auto candLc = candidate.prong0_as>(); - auto track0 = candidate.prong1_as(); // daughter pion track - auto track1 = candLc.prong0_as(); // granddaughter tracks (lc decay particles) - auto track2 = candLc.prong1_as(); - auto track3 = candLc.prong2_as(); - - auto RICHTrk0Pi = -5000.0; - auto RICHTrk1Pi = -5000.0; - auto RICHTrk1P = -5000.0; - auto RICHTrk2K = -5000.0; - auto RICHTrk3Pi = -5000.0; - auto RICHTrk3P = -5000.0; - - auto fRICHTrk0Pi = -5000.0; - auto fRICHTrk1Pi = -5000.0; - auto fRICHTrk1P = -5000.0; - auto fRICHTrk2K = -5000.0; - auto fRICHTrk3Pi = -5000.0; - auto fRICHTrk3P = -5000.0; - - if (track0.has_rich()) - RICHTrk0Pi = track0.rich().richNsigmaPi(); - if (track1.has_rich()) { - RICHTrk1Pi = track1.rich().richNsigmaPi(); - RICHTrk1P = track1.rich().richNsigmaPr(); - } - if (track2.has_rich()) - RICHTrk2K = track2.rich().richNsigmaKa(); - if (track3.has_rich()) { - RICHTrk3Pi = track3.rich().richNsigmaPi(); - RICHTrk3P = track3.rich().richNsigmaPr(); - } + auto candLc = candidate.prong0_as>(); + auto track0 = candidate.prong1_as(); // daughter pion track + auto track1 = candLc.prong0_as(); // granddaughter tracks (lc decay particles) + auto track2 = candLc.prong1_as(); + auto track3 = candLc.prong2_as(); - if (track0.has_frich()) - fRICHTrk0Pi = track0.frich().frichNsigmaPi(); - if (track1.has_frich()) { - fRICHTrk1Pi = track1.frich().frichNsigmaPi(); - fRICHTrk1P = track1.frich().frichNsigmaPr(); - } - if (track2.has_frich()) - fRICHTrk2K = track2.frich().frichNsigmaKa(); - if (track3.has_frich()) { - fRICHTrk3Pi = track3.frich().frichNsigmaPi(); - fRICHTrk3P = track3.frich().frichNsigmaPr(); - } + auto tempConst = -1; // For data - rowCandidateFull( - candidate.rSecondaryVertex(), - candidate.decayLength(), - candidate.decayLengthXY(), - candidate.decayLengthNormalised(), - candidate.decayLengthXYNormalised(), - candidate.chi2PCA(), - candidate.impactParameterNormalised0(), - candidate.ptProng0(), - RecoDecay::p(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()), - candidate.impactParameterNormalised1(), - candidate.ptProng1(), - RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), - candidate.pxProng0(), - candidate.pyProng0(), - candidate.pzProng0(), - candidate.pxProng1(), - candidate.pyProng1(), - candidate.pzProng1(), - candidate.impactParameter0(), - candidate.impactParameter1(), - candidate.errorImpactParameter0(), - candidate.errorImpactParameter1(), - track0.tofNSigmaPi(), - RICHTrk0Pi, - RICHTrk1Pi, - RICHTrk1P, - RICHTrk2K, - RICHTrk3Pi, - RICHTrk3P, - fRICHTrk0Pi, - fRICHTrk1Pi, - fRICHTrk1P, - fRICHTrk2K, - fRICHTrk3Pi, - fRICHTrk3P, - track1.tofNSigmaPi(), - track1.tofNSigmaPr(), - track2.tofNSigmaKa(), - track3.tofNSigmaPi(), - track3.tofNSigmaPr(), - hfHelper.invMassLcToPKPi(candLc), - hfHelper.ctLc(candLc), - hfHelper.yLc(candLc), - hfHelper.eLc(candLc), - candLc.eta(), - candLc.cpa(), - candLc.cpaXY(), - candLc.chi2PCA(), - candLc.decayLength(), - candLc.decayLengthXY(), - candLc.decayLengthXYNormalised(), - candLc.impactParameter0(), - candLc.impactParameter1(), - candLc.impactParameter2(), - FunctionSelection, - FunctionInvMass, - candidate.pt(), - candidate.p(), - candidate.cpa(), - candidate.cpaXY(), - FunctionCt, - candidate.eta(), - candidate.phi(), - FunctionY, - candidate.flagMcMatchRec(), - candidate.originMcRec()); - } + rowCandidateFull( + candidate.posX(), + candidate.posY(), + candidate.posZ(), + candidate.xSecondaryVertex(), + candidate.ySecondaryVertex(), + candidate.zSecondaryVertex(), + candidate.errorDecayLength(), + candidate.errorDecayLengthXY(), + candidate.chi2PCA(), + candidate.impactParameterXY(), + candidate.rSecondaryVertex(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.impactParameterNormalised0(), + candidate.ptProng0(), + RecoDecay::p(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()), + candidate.impactParameterNormalised1(), + candidate.ptProng1(), + RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), + track0.sign(), + track0.tofNSigmaPi(), + track0.tpcNSigmaPi(), + candidate.pxProng0(), + candidate.pyProng0(), + candidate.pzProng0(), + candidate.pxProng1(), + candidate.pyProng1(), + candidate.pzProng1(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.errorImpactParameter0(), + candidate.errorImpactParameter1(), + track1.tpcNSigmaPi(), + track1.tpcNSigmaKa(), + track1.tpcNSigmaPr(), + track2.tpcNSigmaPi(), + track2.tpcNSigmaKa(), + track2.tpcNSigmaPr(), + track3.tpcNSigmaPi(), + track3.tpcNSigmaKa(), + track3.tpcNSigmaPr(), + track1.tofNSigmaPr(), + track2.tofNSigmaKa(), + track3.tofNSigmaPi(), + hfHelper.invMassLcToPKPi(candLc), + hfHelper.ctLc(candLc), + hfHelper.yLc(candLc), + hfHelper.eLc(candLc), + candLc.eta(), + candLc.xSecondaryVertex(), + candLc.ySecondaryVertex(), + candLc.zSecondaryVertex(), + candLc.cpa(), + candLc.cpaXY(), + candLc.chi2PCA(), + candLc.decayLength(), + candLc.decayLengthXY(), + candLc.decayLengthXYNormalised(), + candLc.impactParameter0(), + candLc.errorImpactParameter0(), + candLc.impactParameter1(), + candLc.errorImpactParameter1(), + candLc.impactParameter2(), + candLc.errorImpactParameter2(), + track1.px(), track1.py(), track1.pz(), + track2.px(), track2.py(), track2.pz(), + track3.px(), track3.py(), track3.pz(), + track1.sign(), track2.sign(), track3.sign(), + FunctionSelection, + FunctionInvMass, + candidate.pt(), + candidate.p(), + candidate.cpa(), + candidate.cpaXY(), + FunctionCt, + candidate.eta(), + candidate.phi(), + FunctionY, + tempConst, + tempConst); }; fillTable(candidate.isSelLbToLcPi(), hfHelper.invMassLbToLcPi(candidate), hfHelper.ctLb(candidate), hfHelper.yLb(candidate)); } @@ -330,7 +302,6 @@ struct HfTreeCreatorLbToLcPi { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow; - workflow.push_back(adaptAnalysisTask(cfgc)); workflow.push_back(adaptAnalysisTask(cfgc)); return workflow; } diff --git a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx index 95e94895672..649bd742592 100644 --- a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx @@ -15,6 +15,8 @@ /// \author Phil Lennart Stahlhut , Heidelberg University /// \author Carolina Reetz , Heidelberg University +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -33,32 +35,14 @@ namespace full { DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int); //! Selection flag of candidate (output of candidateSelector) // vertices -DECLARE_SOA_COLUMN(XPv, xPv, float); -DECLARE_SOA_COLUMN(YPv, yPv, float); -DECLARE_SOA_COLUMN(ZPv, zPv, float); DECLARE_SOA_COLUMN(XPvErr, xPvErr, float); DECLARE_SOA_COLUMN(YPvErr, yPvErr, float); DECLARE_SOA_COLUMN(ZPvErr, zPvErr, float); -DECLARE_SOA_COLUMN(XPvGen, xPvGen, float); -DECLARE_SOA_COLUMN(YPvGen, yPvGen, float); -DECLARE_SOA_COLUMN(ZPvGen, zPvGen, float); -DECLARE_SOA_COLUMN(XSv, xSv, float); -DECLARE_SOA_COLUMN(YSv, ySv, float); -DECLARE_SOA_COLUMN(ZSv, zSv, float); DECLARE_SOA_COLUMN(XSvErr, xSvErr, float); DECLARE_SOA_COLUMN(YSvErr, ySvErr, float); DECLARE_SOA_COLUMN(ZSvErr, zSvErr, float); DECLARE_SOA_COLUMN(Chi2Sv, chi2Sv, float); -DECLARE_SOA_COLUMN(XSvGen, xSvGen, float); -DECLARE_SOA_COLUMN(YSvGen, ySvGen, float); -DECLARE_SOA_COLUMN(ZSvGen, zSvGen, float); -DECLARE_SOA_COLUMN(XDecVtxXi, xDecVtxXi, float); -DECLARE_SOA_COLUMN(YDecVtxXi, yDecVtxXi, float); -DECLARE_SOA_COLUMN(ZDecVtxXi, zDecVtxXi, float); DECLARE_SOA_COLUMN(Chi2XiVtx, chi2XiVtx, float); -DECLARE_SOA_COLUMN(XDecVtxLam, xDecVtxLam, float); -DECLARE_SOA_COLUMN(YDecVtxLam, yDecVtxLam, float); -DECLARE_SOA_COLUMN(ZDecVtxLam, zDecVtxLam, float); DECLARE_SOA_COLUMN(Chi2LamVtx, chi2LamVtx, float); // properties of XicPlus DECLARE_SOA_COLUMN(Sign, sign, float); @@ -76,15 +60,19 @@ DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); //! Normalised transverse decay length of candidate DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane -DECLARE_SOA_COLUMN(Chi2XicPlusTopoToPV, chi2XicPlusTopoToPV, float); -DECLARE_SOA_COLUMN(Chi2XicPlusTopoXiToXicPlus, chi2XicPlusTopoXiToXicPlus, float); +DECLARE_SOA_COLUMN(Chi2TopoXicPlusToPVBeforeConstraint, chi2TopoXicPlusToPVBeforeConstraint, float); +DECLARE_SOA_COLUMN(Chi2TopoXicPlusToPV, chi2TopoXicPlusToPV, float); +DECLARE_SOA_COLUMN(Chi2TopoXiToXicPlusBeforeConstraint, chi2TopoXiToXicPlusBeforeConstraint, float); +DECLARE_SOA_COLUMN(Chi2TopoXiToXicPlus, chi2TopoXiToXicPlus, float); // properties of daughter tracks -DECLARE_SOA_COLUMN(PtXi, ptXi, float); //! Transverse momentum of Xi (prong0) (GeV/c) -DECLARE_SOA_COLUMN(ImpactParameterXi, impactParameterXi, float); //! Impact parameter of Xi (prong0) -DECLARE_SOA_COLUMN(ImpactParameterNormalisedXi, impactParameterNormalisedXi, float); //! Normalised impact parameter of Xi (prong0) +DECLARE_SOA_COLUMN(PtXi, ptXi, float); //! Transverse momentum of Xi (prong0) (GeV/c) +DECLARE_SOA_COLUMN(ImpactParameterXi, impactParameterXi, float); //! Impact parameter of Xi (prong0) +DECLARE_SOA_COLUMN(ImpactParameterNormalisedXi, impactParameterNormalisedXi, float); //! Normalised impact parameter of Xi (prong0) +DECLARE_SOA_COLUMN(PPi0, pPi0, float); DECLARE_SOA_COLUMN(PtPi0, ptPi0, float); //! Transverse momentum of Pi0 (prong1) (GeV/c) DECLARE_SOA_COLUMN(ImpactParameterPi0, impactParameterPi0, float); //! Impact parameter of Pi0 (prong1) DECLARE_SOA_COLUMN(ImpactParameterNormalisedPi0, impactParameterNormalisedPi0, float); //! Normalised impact parameter of Pi0 (prong1) +DECLARE_SOA_COLUMN(PPi1, pPi1, float); DECLARE_SOA_COLUMN(PtPi1, ptPi1, float); //! Transverse momentum of Pi1 (prong2) (GeV/c) DECLARE_SOA_COLUMN(ImpactParameterPi1, impactParameterPi1, float); //! Normalised impact parameter of Pi1 (prong2) DECLARE_SOA_COLUMN(ImpactParameterNormalisedPi1, impactParameterNormalisedPi1, float); //! Normalised impact parameter of Pi1 (prong2) @@ -93,6 +81,8 @@ DECLARE_SOA_COLUMN(CpaXi, cpaXi, float); DECLARE_SOA_COLUMN(CpaXYXi, cpaXYXi, float); DECLARE_SOA_COLUMN(CpaLam, cpaLam, float); DECLARE_SOA_COLUMN(CpaXYLam, cpaXYLam, float); +DECLARE_SOA_COLUMN(CpaLamToXi, cpaLamToXi, float); +DECLARE_SOA_COLUMN(CpaXYLamToXi, cpaXYLamToXi, float); DECLARE_SOA_COLUMN(DcaXYPi0Pi1, dcaXYPi0Pi1, float); DECLARE_SOA_COLUMN(DcaXYPi0Xi, dcaXYPi0Xi, float); DECLARE_SOA_COLUMN(DcaXYPi1Xi, dcaXYPi1Xi, float); @@ -100,8 +90,12 @@ DECLARE_SOA_COLUMN(DcaPi0Pi1, dcaPi0Pi1, float); DECLARE_SOA_COLUMN(DcaPi0Xi, dcaPi0Xi, float); DECLARE_SOA_COLUMN(DcaPi1Xi, dcaPi1Xi, float); DECLARE_SOA_COLUMN(DcaXiDaughters, dcaXiDaughters, float); +DECLARE_SOA_COLUMN(InvMassXi, invMassXi, float); DECLARE_SOA_COLUMN(InvMassXiPi0, invMassXiPi0, float); DECLARE_SOA_COLUMN(InvMassXiPi1, invMassXiPi1, float); +DECLARE_SOA_COLUMN(PBachelorPi, pBachelorPi, float); +DECLARE_SOA_COLUMN(PPiFromLambda, pPiFromLambda, float); +DECLARE_SOA_COLUMN(PPrFromLambda, pPrFromLambda, float); // residuals and pulls DECLARE_SOA_COLUMN(PtResidual, ptResidual, float); DECLARE_SOA_COLUMN(PResidual, pResidual, float); @@ -121,6 +115,8 @@ DECLARE_SOA_COLUMN(ZSvPull, zSvPull, float); DECLARE_SOA_TABLE(HfCandXicToXiPiPiLites, "AOD", "HFXICXI2PILITE", hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec, + hf_cand_xic_to_xi_pi_pi::DebugMcRec, + hf_cand_xic_to_xi_pi_pi::OriginRec, full::CandidateSelFlag, full::Sign, full::Y, @@ -132,6 +128,7 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiLites, "AOD", "HFXICXI2PILITE", full::PtPi0, full::PtPi1, full::M, + full::InvMassXi, full::InvMassXiPi0, full::InvMassXiPi1, full::Chi2Sv, @@ -156,6 +153,8 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiLites, "AOD", "HFXICXI2PILITE", DECLARE_SOA_TABLE(HfCandXicToXiPiPiLiteKfs, "AOD", "HFXICXI2PILITKF", hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec, + hf_cand_xic_to_xi_pi_pi::DebugMcRec, + hf_cand_xic_to_xi_pi_pi::OriginRec, full::CandidateSelFlag, full::Sign, full::Y, @@ -167,6 +166,7 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiLiteKfs, "AOD", "HFXICXI2PILITKF", full::PtPi0, full::PtPi1, full::M, + full::InvMassXi, full::InvMassXiPi0, full::InvMassXiPi1, full::Chi2Sv, @@ -191,8 +191,10 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiLiteKfs, "AOD", "HFXICXI2PILITKF", // KF specific columns full::Chi2XiVtx, full::Chi2LamVtx, - full::Chi2XicPlusTopoToPV, - full::Chi2XicPlusTopoXiToXicPlus, + full::Chi2TopoXicPlusToPVBeforeConstraint, + full::Chi2TopoXicPlusToPV, + full::Chi2TopoXiToXicPlusBeforeConstraint, + full::Chi2TopoXiToXicPlus, full::DcaXYPi0Pi1, full::DcaXYPi0Xi, full::DcaXYPi1Xi, @@ -203,6 +205,8 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiLiteKfs, "AOD", "HFXICXI2PILITKF", DECLARE_SOA_TABLE(HfCandXicToXiPiPiFulls, "AOD", "HFXICXI2PIFULL", hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec, + hf_cand_xic_to_xi_pi_pi::DebugMcRec, + hf_cand_xic_to_xi_pi_pi::OriginRec, full::CandidateSelFlag, full::Sign, full::Y, @@ -214,6 +218,7 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFulls, "AOD", "HFXICXI2PIFULL", full::PtPi0, full::PtPi1, full::M, + full::InvMassXi, full::InvMassXiPi0, full::InvMassXiPi1, full::Chi2Sv, @@ -236,28 +241,34 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFulls, "AOD", "HFXICXI2PIFULL", full::ImpactParameterNormalisedPi1, full::MaxNormalisedDeltaIP, // additional columns only stored in the full candidate table - full::E, - full::XPv, - full::YPv, - full::ZPv, full::XPvErr, full::YPvErr, full::ZPvErr, - full::XSv, - full::YSv, - full::ZSv, full::XSvErr, full::YSvErr, full::ZSvErr, - full::XDecVtxXi, - full::YDecVtxXi, - full::ZDecVtxXi, - full::XDecVtxLam, - full::YDecVtxLam, - full::ZDecVtxLam); + full::CpaLamToXi, + full::CpaXYLamToXi, + full::PPi0, + full::PPi1, + full::PBachelorPi, + full::PPiFromLambda, + full::PPrFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromXicPlus0, + hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromXicPlus1, + hf_cand_xic_to_xi_pi_pi::NSigTpcBachelorPi, + hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTpcPrFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTofPiFromXicPlus0, + hf_cand_xic_to_xi_pi_pi::NSigTofPiFromXicPlus1, + hf_cand_xic_to_xi_pi_pi::NSigTofBachelorPi, + hf_cand_xic_to_xi_pi_pi::NSigTofPiFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTofPrFromLambda); DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec, + hf_cand_xic_to_xi_pi_pi::DebugMcRec, + hf_cand_xic_to_xi_pi_pi::OriginRec, full::CandidateSelFlag, full::Sign, full::Y, @@ -269,6 +280,7 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", full::PtPi0, full::PtPi1, full::M, + full::InvMassXi, full::InvMassXiPi0, full::InvMassXiPi1, full::Chi2Sv, @@ -291,30 +303,36 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", full::ImpactParameterNormalisedPi1, full::MaxNormalisedDeltaIP, // additional columns only stored in the full candidate table - full::E, - full::XPv, - full::YPv, - full::ZPv, full::XPvErr, full::YPvErr, full::ZPvErr, - full::XSv, - full::YSv, - full::ZSv, full::XSvErr, full::YSvErr, full::ZSvErr, - full::XDecVtxXi, - full::YDecVtxXi, - full::ZDecVtxXi, - full::XDecVtxLam, - full::YDecVtxLam, - full::ZDecVtxLam, + full::CpaLamToXi, + full::CpaXYLamToXi, + full::PPi0, + full::PPi1, + full::PBachelorPi, + full::PPiFromLambda, + full::PPrFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromXicPlus0, + hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromXicPlus1, + hf_cand_xic_to_xi_pi_pi::NSigTpcBachelorPi, + hf_cand_xic_to_xi_pi_pi::NSigTpcPiFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTpcPrFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTofPiFromXicPlus0, + hf_cand_xic_to_xi_pi_pi::NSigTofPiFromXicPlus1, + hf_cand_xic_to_xi_pi_pi::NSigTofBachelorPi, + hf_cand_xic_to_xi_pi_pi::NSigTofPiFromLambda, + hf_cand_xic_to_xi_pi_pi::NSigTofPrFromLambda, // KF-specific columns full::Chi2XiVtx, full::Chi2LamVtx, - full::Chi2XicPlusTopoToPV, - full::Chi2XicPlusTopoXiToXicPlus, + full::Chi2TopoXicPlusToPVBeforeConstraint, + full::Chi2TopoXicPlusToPV, + full::Chi2TopoXiToXicPlusBeforeConstraint, + full::Chi2TopoXiToXicPlus, full::DcaXYPi0Pi1, full::DcaXYPi0Xi, full::DcaXYPi1Xi, @@ -324,19 +342,16 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", full::DcaXiDaughters); DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullPs, "AOD", "HFXICXI2PIFULLP", + hf_cand_xic_to_xi_pi_pi::FlagMcMatchGen, + hf_cand_xic_to_xi_pi_pi::DebugMcGen, + hf_cand_xic_to_xi_pi_pi::OriginGen, full::Pt, full::Eta, full::Phi, - full::Y, - full::XPvGen, - full::YPvGen, - full::ZPvGen, - full::XSvGen, - full::YSvGen, - full::ZSvGen, - hf_cand_xic_to_xi_pi_pi::FlagMcMatchGen); + full::Y); DECLARE_SOA_TABLE(HfCandXicToXiPiPiResiduals, "AOD", "HFXICXI2PIRESID", + hf_cand_xic_to_xi_pi_pi::OriginGen, full::PResidual, full::PtResidual, full::XPvResidual, @@ -391,13 +406,19 @@ struct HfTreeCreatorXicToXiPiPi { void fillCandidateTable(const T& candidate) { int8_t flagMc = 0; + int8_t debugMc = 0; + int8_t originMc = 0; if constexpr (doMc) { flagMc = candidate.flagMcMatchRec(); + debugMc = candidate.debugMcRec(); + originMc = candidate.originRec(); } if constexpr (!doKf) { if (fillCandidateLiteTable) { rowCandidateLite( flagMc, + debugMc, + originMc, candidate.isSelXicToXiPiPi(), candidate.sign(), candidate.y(o2::constants::physics::MassXiCPlus), @@ -408,7 +429,8 @@ struct HfTreeCreatorXicToXiPiPi { candidate.ptProng0(), candidate.ptProng1(), candidate.ptProng2(), - candidate.invMassXic(), + candidate.invMassXicPlus(), + candidate.invMassXi(), candidate.invMassXiPi0(), candidate.invMassXiPi1(), candidate.chi2PCA(), @@ -433,6 +455,8 @@ struct HfTreeCreatorXicToXiPiPi { } else { rowCandidateFull( flagMc, + debugMc, + originMc, candidate.isSelXicToXiPiPi(), candidate.sign(), candidate.y(o2::constants::physics::MassXiCPlus), @@ -443,7 +467,8 @@ struct HfTreeCreatorXicToXiPiPi { candidate.ptProng0(), candidate.ptProng1(), candidate.ptProng2(), - candidate.invMassXic(), + candidate.invMassXicPlus(), + candidate.invMassXi(), candidate.invMassXiPi0(), candidate.invMassXiPi1(), candidate.chi2PCA(), @@ -466,30 +491,36 @@ struct HfTreeCreatorXicToXiPiPi { candidate.impactParameterNormalised2(), candidate.maxNormalisedDeltaIP(), // additional columns only stored in the full candidate table - candidate.e(o2::constants::physics::MassXiCPlus), - candidate.posX(), - candidate.posY(), - candidate.posZ(), candidate.xPvErr(), candidate.yPvErr(), candidate.zPvErr(), - candidate.xSecondaryVertex(), - candidate.ySecondaryVertex(), - candidate.zSecondaryVertex(), candidate.xSvErr(), candidate.ySvErr(), candidate.zSvErr(), - candidate.xDecayVtxXi(), - candidate.yDecayVtxXi(), - candidate.zDecayVtxXi(), - candidate.xDecayVtxLambda(), - candidate.yDecayVtxLambda(), - candidate.zDecayVtxLambda()); + candidate.cosPaLambdaToXi(), + candidate.cosPaXYLambdaToXi(), + candidate.pProng1(), + candidate.pProng2(), + candidate.pBachelorPi(), + candidate.pPiFromLambda(), + candidate.pPrFromLambda(), + candidate.nSigTpcPiFromXicPlus0(), + candidate.nSigTpcPiFromXicPlus1(), + candidate.nSigTpcBachelorPi(), + candidate.nSigTpcPiFromLambda(), + candidate.nSigTpcPrFromLambda(), + candidate.nSigTofPiFromXicPlus0(), + candidate.nSigTofPiFromXicPlus1(), + candidate.nSigTofBachelorPi(), + candidate.nSigTofPiFromLambda(), + candidate.nSigTofPrFromLambda()); } } else { if (fillCandidateLiteTable) { rowCandidateLiteKf( flagMc, + debugMc, + originMc, candidate.isSelXicToXiPiPi(), candidate.sign(), candidate.y(o2::constants::physics::MassXiCPlus), @@ -500,7 +531,8 @@ struct HfTreeCreatorXicToXiPiPi { candidate.ptProng0(), candidate.ptProng1(), candidate.ptProng2(), - candidate.invMassXic(), + candidate.invMassXicPlus(), + candidate.invMassXi(), candidate.invMassXiPi0(), candidate.invMassXiPi1(), candidate.chi2PCA(), @@ -525,7 +557,9 @@ struct HfTreeCreatorXicToXiPiPi { // KF-specific columns candidate.kfCascadeChi2(), candidate.kfV0Chi2(), + candidate.chi2TopoXicPlusToPVBeforeConstraint(), candidate.chi2TopoXicPlusToPV(), + candidate.chi2TopoXiToXicPlusBeforeConstraint(), candidate.chi2TopoXiToXicPlus(), candidate.dcaXYPi0Pi1(), candidate.dcaXYPi0Xi(), @@ -537,6 +571,8 @@ struct HfTreeCreatorXicToXiPiPi { } else { rowCandidateFullKf( flagMc, + debugMc, + originMc, candidate.isSelXicToXiPiPi(), candidate.sign(), candidate.y(o2::constants::physics::MassXiCPlus), @@ -547,7 +583,8 @@ struct HfTreeCreatorXicToXiPiPi { candidate.ptProng0(), candidate.ptProng1(), candidate.ptProng2(), - candidate.invMassXic(), + candidate.invMassXicPlus(), + candidate.invMassXi(), candidate.invMassXiPi0(), candidate.invMassXiPi1(), candidate.chi2PCA(), @@ -570,29 +607,35 @@ struct HfTreeCreatorXicToXiPiPi { candidate.impactParameterNormalised2(), candidate.maxNormalisedDeltaIP(), // additional columns only stored in the full candidate table - candidate.e(o2::constants::physics::MassXiCPlus), - candidate.posX(), - candidate.posY(), - candidate.posZ(), candidate.xPvErr(), candidate.yPvErr(), candidate.zPvErr(), - candidate.xSecondaryVertex(), - candidate.ySecondaryVertex(), - candidate.zSecondaryVertex(), candidate.xSvErr(), candidate.ySvErr(), candidate.zSvErr(), - candidate.xDecayVtxXi(), - candidate.yDecayVtxXi(), - candidate.zDecayVtxXi(), - candidate.xDecayVtxLambda(), - candidate.yDecayVtxLambda(), - candidate.zDecayVtxLambda(), + candidate.cosPaLambdaToXi(), + candidate.cosPaXYLambdaToXi(), + candidate.pProng1(), + candidate.pProng2(), + candidate.pBachelorPi(), + candidate.pPiFromLambda(), + candidate.pPrFromLambda(), + candidate.nSigTpcPiFromXicPlus0(), + candidate.nSigTpcPiFromXicPlus1(), + candidate.nSigTpcBachelorPi(), + candidate.nSigTpcPiFromLambda(), + candidate.nSigTpcPrFromLambda(), + candidate.nSigTofPiFromXicPlus0(), + candidate.nSigTofPiFromXicPlus1(), + candidate.nSigTofBachelorPi(), + candidate.nSigTofPiFromLambda(), + candidate.nSigTofPrFromLambda(), // KF-specific columns candidate.kfCascadeChi2(), candidate.kfV0Chi2(), + candidate.chi2TopoXicPlusToPVBeforeConstraint(), candidate.chi2TopoXicPlusToPV(), + candidate.chi2TopoXiToXicPlusBeforeConstraint(), candidate.chi2TopoXiToXicPlus(), candidate.dcaXYPi0Pi1(), candidate.dcaXYPi0Xi(), @@ -615,7 +658,7 @@ struct HfTreeCreatorXicToXiPiPi { } for (const auto& candidate : candidates) { if (fillOnlyBackground && downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng1() * 1000. - (int64_t)(candidate.ptProng1() * 1000); + float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (pseudoRndm >= downSampleBkgFactor && candidate.pt() < ptMaxForDownSample) { continue; } @@ -635,7 +678,7 @@ struct HfTreeCreatorXicToXiPiPi { } for (const auto& candidate : candidates) { if (fillOnlyBackground && downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng1() * 1000. - (int64_t)(candidate.ptProng1() * 1000); + float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (pseudoRndm >= downSampleBkgFactor && candidate.pt() < ptMaxForDownSample) { continue; } @@ -648,8 +691,6 @@ struct HfTreeCreatorXicToXiPiPi { void processMc(SelectedCandidatesMc const& candidates, soa::Join const& particles) { - std::vector arrDaughIndex; - // Filling candidate properties if (fillOnlySignal) { if (fillCandidateLiteTable) { @@ -667,7 +708,7 @@ struct HfTreeCreatorXicToXiPiPi { rowCandidateFull.reserve(recBg.size()); } for (const auto& candidate : recBg) { - float pseudoRndm = candidate.ptProng1() * 1000. - (int64_t)(candidate.ptProng1() * 1000); + float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -689,22 +730,14 @@ struct HfTreeCreatorXicToXiPiPi { for (const auto& particle : particles) { if (TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi) || TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiResPiToXiPiPi)) { - arrDaughIndex.clear(); - RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{+kXiMinus, +kPiPlus, +kPiPlus}, 2); - auto XicDaugh0 = particles.rawIteratorAt(arrDaughIndex[0]); - rowCandidateFullParticles( + particle.flagMcMatchGen(), + particle.debugMcGen(), + particle.originGen(), particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus), - particle.vx(), - particle.vy(), - particle.vz(), - XicDaugh0.vx(), - XicDaugh0.vx(), - XicDaugh0.vz(), - particle.flagMcMatchGen()); + RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus)); } } // loop over generated particles } @@ -714,8 +747,6 @@ struct HfTreeCreatorXicToXiPiPi { void processMcKf(SelectedCandidatesKfMc const& candidates, soa::Join const& particles) { - std::vector arrDaughIndex; - // Filling candidate properties if (fillOnlySignal) { if (fillCandidateLiteTable) { @@ -733,7 +764,7 @@ struct HfTreeCreatorXicToXiPiPi { rowCandidateFull.reserve(recBgKf.size()); } for (const auto& candidate : recBgKf) { - float pseudoRndm = candidate.ptProng1() * 1000. - (int64_t)(candidate.ptProng1() * 1000); + float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -754,29 +785,21 @@ struct HfTreeCreatorXicToXiPiPi { rowCandidateFullParticles.reserve(particles.size()); for (const auto& particle : particles) { if (TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi) || TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiResPiToXiPiPi)) { - arrDaughIndex.clear(); - RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{+kXiMinus, +kPiPlus, +kPiPlus}, 2); - auto XicDaugh0 = particles.rawIteratorAt(arrDaughIndex[0]); - rowCandidateFullParticles( + particle.flagMcMatchGen(), + particle.debugMcGen(), + particle.originGen(), particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus), - particle.vx(), - particle.vy(), - particle.vz(), - XicDaugh0.vx(), - XicDaugh0.vx(), - XicDaugh0.vz(), - particle.flagMcMatchGen()); + RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus)); } } // loop over generated particles } } PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processMcKf, "Process MC with KF Particle reconstruction", false); - void processResiduals(SelectedCandidatesMc const& candidates, + void processResiduals(SelectedCandidatesMc const&, aod::TracksWMc const& tracks, aod::McParticles const& particles) { @@ -785,8 +808,9 @@ struct HfTreeCreatorXicToXiPiPi { recSig->bindExternalIndices(&tracks); std::vector arrDaughIndex; - int indexRecXic; + int indexRecXicPlus; int8_t sign; + int8_t origin; std::array pvResiduals; std::array svResiduals; std::array pvPulls; @@ -794,8 +818,9 @@ struct HfTreeCreatorXicToXiPiPi { for (const auto& candidate : recSig) { arrDaughIndex.clear(); - indexRecXic = -1; + indexRecXicPlus = -1; sign = 0; + origin = 0; pvResiduals = {-9999.9}; svResiduals = {-9999.9}; pvPulls = {-9999.9}; @@ -807,24 +832,30 @@ struct HfTreeCreatorXicToXiPiPi { candidate.posTrack_as(), // p <- lambda candidate.negTrack_as()}; // pi <- lambda - // get Xic and daughters as MC particle - indexRecXic = RecoDecay::getMatchedMCRec(particles, arrayDaughters, Pdg::kXiCPlus, std::array{+kPiPlus, +kPiPlus, +kPiMinus, +kProton, +kPiMinus}, true, &sign, 4); - if (indexRecXic == -1) { + // get XicPlus as MC particle + indexRecXicPlus = RecoDecay::getMatchedMCRec(particles, arrayDaughters, Pdg::kXiCPlus, std::array{+kPiPlus, +kPiPlus, +kPiMinus, +kProton, +kPiMinus}, true, &sign, 4); + if (indexRecXicPlus == -1) { continue; } - auto XicGen = particles.rawIteratorAt(indexRecXic); - RecoDecay::getDaughters(XicGen, &arrDaughIndex, std::array{+kXiMinus, +kPiPlus, +kPiPlus}, 2); - auto XicDaugh0 = particles.rawIteratorAt(arrDaughIndex[0]); + auto XicPlusGen = particles.rawIteratorAt(indexRecXicPlus); + origin = RecoDecay::getCharmHadronOrigin(particles, XicPlusGen, true); + + // get MC collision + auto mcCollision = XicPlusGen.mcCollision_as(); + + // get XicPlus daughters as MC particle + RecoDecay::getDaughters(XicPlusGen, &arrDaughIndex, std::array{+kXiMinus, +kPiPlus, +kPiPlus}, 2); + auto XicPlusDaugh0 = particles.rawIteratorAt(arrDaughIndex[0]); // calculate residuals and pulls - float pResidual = candidate.p() - XicGen.p(); - float ptResidual = candidate.pt() - XicGen.pt(); - pvResiduals[0] = candidate.posX() - XicGen.vx(); - pvResiduals[1] = candidate.posY() - XicGen.vy(); - pvResiduals[2] = candidate.posZ() - XicGen.vz(); - svResiduals[0] = candidate.xSecondaryVertex() - XicDaugh0.vx(); - svResiduals[1] = candidate.ySecondaryVertex() - XicDaugh0.vy(); - svResiduals[2] = candidate.zSecondaryVertex() - XicDaugh0.vz(); + float pResidual = candidate.p() - XicPlusGen.p(); + float ptResidual = candidate.pt() - XicPlusGen.pt(); + pvResiduals[0] = candidate.posX() - mcCollision.posX(); + pvResiduals[1] = candidate.posY() - mcCollision.posY(); + pvResiduals[2] = candidate.posZ() - mcCollision.posZ(); + svResiduals[0] = candidate.xSecondaryVertex() - XicPlusDaugh0.vx(); + svResiduals[1] = candidate.ySecondaryVertex() - XicPlusDaugh0.vy(); + svResiduals[2] = candidate.zSecondaryVertex() - XicPlusDaugh0.vz(); try { pvPulls[0] = pvResiduals[0] / candidate.xPvErr(); pvPulls[1] = pvResiduals[1] / candidate.yPvErr(); @@ -838,6 +869,7 @@ struct HfTreeCreatorXicToXiPiPi { // fill table rowCandidateResiduals( + origin, pResidual, ptResidual, pvResiduals[0], diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index 00878e48a2c..9a46eeba773 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -39,6 +39,16 @@ o2physics_add_dpl_workflow(task-mc-validation PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation + SOURCES taskMultiplicityEstimatorCorrelation.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(task-pid-studies + SOURCES taskPidStudies.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + # o2physics_add_dpl_workflow(task-sel-optimisation # SOURCES taskSelOptimisation.cxx # PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index e342231bbab..6c18108bce9 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -18,6 +18,10 @@ /// \author Fabrizio Grosa , CERN /// \author Fabio Catalano , CERN +#include +#include +#include + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -53,6 +57,7 @@ enum DecayChannels { DzeroToKPi = 0, Ds2StarToDPlusK0s, D10ToDStarPi, D2Star0ToDPlusPi, + B0ToDminusPi, LcToPKPi, LcToPiK0s, XiCplusToPKPi, @@ -60,27 +65,35 @@ enum DecayChannels { DzeroToKPi = 0, XiCzeroToXiPi, OmegaCToOmegaPi, OmegaCToXiPi, - nChannels }; // always keep nChannels at the end - -static constexpr int nMesonChannels = 10; // number of meson channels -static constexpr int nOriginTypes = 2; // number of origin types (prompt, non-prompt) -static constexpr std::array PDGArrayParticle = {o2::constants::physics::Pdg::kD0, o2::constants::physics::Pdg::kDStar, o2::constants::physics::Pdg::kDPlus, o2::constants::physics::Pdg::kDPlus, + nChannels +}; // always keep nChannels at the end + +static constexpr int nCharmMesonChannels = 10; // number of charm meson channels +static constexpr int nBeautyChannels = 1; // number of beauty hadron channels +static constexpr int nCharmBaryonChannels = nChannels - nCharmMesonChannels - nBeautyChannels; // number of charm baryon channels +static constexpr int nOriginTypes = 2; // number of origin types (prompt, non-prompt; only for charm hadrons) +static constexpr std::array PDGArrayParticle = {o2::constants::physics::Pdg::kD0, o2::constants::physics::Pdg::kDStar, + o2::constants::physics::Pdg::kDPlus, o2::constants::physics::Pdg::kDPlus, o2::constants::physics::Pdg::kDS, o2::constants::physics::Pdg::kDS, o2::constants::physics::Pdg::kDS1, o2::constants::physics::Pdg::kDS2Star, - o2::constants::physics::Pdg::kD10, o2::constants::physics::Pdg::kD2Star0, o2::constants::physics::Pdg::kLambdaCPlus, o2::constants::physics::Pdg::kLambdaCPlus, - o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiC0, o2::constants::physics::Pdg::kOmegaC0, o2::constants::physics::Pdg::kOmegaC0}; -static constexpr std::array nDaughters = {2, 3, 3, 3, 3, 3, 5, 5, 4, 4, 3, 3, 3, 5, 4, 4, 4}; -static constexpr std::array maxDepthForSearch = {1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 3, 2, 4, 3, 3, 3}; + o2::constants::physics::Pdg::kD10, o2::constants::physics::Pdg::kD2Star0, o2::constants::physics::Pdg::kB0, o2::constants::physics::Pdg::kLambdaCPlus, + o2::constants::physics::Pdg::kLambdaCPlus, o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiC0, + o2::constants::physics::Pdg::kOmegaC0, o2::constants::physics::Pdg::kOmegaC0}; +static constexpr std::array nDaughters = {2, 3, 3, 3, 3, 3, 5, 5, 4, 4, 4, 3, 3, 3, 5, 4, 4, 4}; +static constexpr std::array maxDepthForSearch = {1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 3, 2, 4, 3, 3, 3}; // keep coherent indexing with PDGArrayParticle // FIXME: look for a better solution -static constexpr std::array, nChannels> arrPDGFinal2Prong = {{{+kPiPlus, -kKPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}}}; -static constexpr std::array, nChannels> arrPDGFinal3Prong = {{{}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {}, {}, {}, {}, {+kProton, -kKPlus, +kPiPlus}, {+kProton, -kPiPlus, +kPiPlus}, {+kProton, -kKPlus, +kPiPlus}, {}, {}, {}, {}}}; -static constexpr std::array, nChannels> arrPDGFinal4Prong = {{{}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {}, {}, {}, {}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {+kPiPlus, -kKPlus, -kPiPlus, +kProton}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}}}; -static constexpr std::array, nChannels> arrPDGFinal5Prong = {{{}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {}, {}, {}, {}, {}, {+kPiPlus, +kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {}, {}, {}}}; +static constexpr std::array, nChannels> arrPDGFinal2Prong = {{{+kPiPlus, -kKPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}}}; +static constexpr std::array, nChannels> arrPDGFinal3Prong = {{{}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {}, {}, {}, {}, {}, {+kProton, -kKPlus, +kPiPlus}, {+kProton, -kPiPlus, +kPiPlus}, {+kProton, -kKPlus, +kPiPlus}, {}, {}, {}, {}}}; +static constexpr std::array, nChannels> arrPDGFinal4Prong = {{{}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, {}, {}, {}, {}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {+kPiPlus, -kKPlus, -kPiPlus, +kProton}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}}}; +static constexpr std::array, nChannels> arrPDGFinal5Prong = {{{}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {}, {}, {}, {}, {}, {}, {+kPiPlus, +kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {}, {}, {}}}; static constexpr std::string_view labels[nChannels] = {"D^{0} #rightarrow K#pi", "D*^{+} #rightarrow D^{0}#pi", "D^{+} #rightarrow K#pi#pi", "D^{+} #rightarrow KK#pi", "D_{s}^{+} #rightarrow #Phi#pi #rightarrow KK#pi", "D_{s}^{+} #rightarrow #bar{K}^{*0}K #rightarrow KK#pi", "D_{s}1 #rightarrow D*^{+}K^{0}_{s}", "D_{s}2* #rightarrow D^{+}K^{0}_{s}", "D1^{0} #rightarrow D*^{+}#pi", - "D2^{*} #rightarrow D^{+}#pi", "#Lambda_{c}^{+} #rightarrow pK#pi", "#Lambda_{c}^{+} #rightarrow pK^{0}_{s}", "#Xi_{c}^{+} #rightarrow pK#pi", + "D2^{*} #rightarrow D^{+}#pi", + "B^{0} #rightarrow D^{-}#pi", + "#Lambda_{c}^{+} #rightarrow pK#pi", + "#Lambda_{c}^{+} #rightarrow pK^{0}_{s}", "#Xi_{c}^{+} #rightarrow pK#pi", "#Xi_{c}^{+} #rightarrow #Xi#pi#pi", "#Xi_{c}^{0} #rightarrow #Xi#pi", "#Omega_{c}^{0} #rightarrow #Omega#pi", "#Omega_{c}^{0} #rightarrow #Xi#pi"}; -static constexpr std::string_view particleNames[nChannels] = {"DzeroToKPi", "DstarToDzeroPi", "DplusToPiKPi", "DplusToPhiPiToKKPi", "DsToPhiPiToKKPi", "DsToK0starKToKKPi", "Ds1ToDStarK0s", "Ds2StarToDPlusK0s", "D10ToDStarPi", "D2Star0ToDPlusPi", +static constexpr std::string_view particleNames[nChannels] = {"DzeroToKPi", "DstarToDzeroPi", "DplusToPiKPi", "DplusToPhiPiToKKPi", "DsToPhiPiToKKPi", "DsToK0starKToKKPi", "Ds1ToDStarK0s", "Ds2StarToDPlusK0s", "D10ToDStarPi", "D2Star0ToDPlusPi", "B0ToDminusPi", "LcToPKPi", "LcToPiK0s", "XiCplusToPKPi", "XiCplusToXiPiPi", "XiCzeroToXiPi", "OmegaCToOmegaPi", "OmegaCToXiPi"}; static constexpr std::string_view originNames[nOriginTypes] = {"Prompt", "NonPrompt"}; } // namespace @@ -103,6 +116,7 @@ struct HfTaskMcValidationGen { Configurable eventGeneratorType{"eventGeneratorType", -1, "If positive, enable event selection using subGeneratorId information. The value indicates which events to keep (0 = MB, 4 = charm triggered, 5 = beauty triggered)"}; Configurable rejectParticlesFromBkgEvent{"rejectParticlesFromBkgEvent", true, "Reject particles"}; + Configurable storeOccupancy{"storeOccupancy", false, "Store collision occupancy for dedicated studies"}; HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring @@ -112,8 +126,10 @@ struct HfTaskMcValidationGen { AxisSpec axisPt{100, 0., 50.}; AxisSpec axisY{100, -5., 5.}; AxisSpec axisCent{110, 0., 110.}; - AxisSpec axisMesonSpecies{nMesonChannels, -0.5, static_cast(nMesonChannels) - 0.5}; - AxisSpec axisBaryonSpecies{nChannels - nMesonChannels, -0.5, static_cast(nChannels - nMesonChannels) - 0.5}; + AxisSpec axisOcc{3000, 0., 15000.}; + AxisSpec axisCharmMesonSpecies{nCharmMesonChannels, -0.5, static_cast(nCharmMesonChannels) - 0.5}; + AxisSpec axisBeautySpecies{nBeautyChannels, -0.5, static_cast(nBeautyChannels) - 0.5}; + AxisSpec axisCharmBaryonSpecies{nCharmBaryonChannels, -0.5, static_cast(nCharmBaryonChannels) - 0.5}; AxisSpec axisDecLen{100, 0., 10000.}; HistogramRegistry registry{ @@ -131,22 +147,31 @@ struct HfTaskMcValidationGen { {"Quarks/hCountBbar", "Event counter - Number of anti-beauty quarks; Events Per Collision; entries", {HistType::kTH1F, {axisNquarks}}}, {"Quarks/hPtVsYCharmQuark", "Y vs. Pt - charm quarks ; #it{p}_{T}^{gen} (GeV/#it{c}); #it{y}^{gen}", {HistType::kTH2F, {axisPt, axisY}}}, {"Quarks/hPtVsYBeautyQuark", "Y vs. Pt - beauty quarks ; #it{p}_{T}^{gen} (GeV/#it{c}); #it{y}^{gen}", {HistType::kTH2F, {axisPt, axisY}}}, - {"PromptCharmMesons/hPromptMesonsPtDistr", "Pt distribution vs prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisMesonSpecies, axisPt}}}, - {"PromptCharmMesons/hPromptMesonsPtCentDistr", "Pt vs Cent vs distribution vs prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisMesonSpecies, axisPt, axisCent}}}, - {"PromptCharmMesons/hPromptMesonsYDistr", "Y distribution vs prompt charm meson; ; #it{y}^{gen}", {HistType::kTH2F, {axisMesonSpecies, axisY}}}, - {"PromptCharmMesons/hPromptMesonsDecLenDistr", "Decay length distribution vs prompt charm meson; ; decay length (#mum)", {HistType::kTH2F, {axisMesonSpecies, axisDecLen}}}, - {"NonPromptCharmMesons/hNonPromptMesonsPtDistr", "Pt distribution vs non-prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisMesonSpecies, axisPt}}}, - {"NonPromptCharmMesons/hNonPromptMesonsPtCentDistr", "Pt vs Cent vs distribution vs non-prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisMesonSpecies, axisPt, axisCent}}}, - {"NonPromptCharmMesons/hNonPromptMesonsYDistr", "Y distribution vs non-prompt charm meson; ; #it{y}^{gen}", {HistType::kTH2F, {axisMesonSpecies, axisY}}}, - {"NonPromptCharmMesons/hNonPromptMesonsDecLenDistr", "Decay length distribution vs non-prompt charm meson; ; decay length (#mum)", {HistType::kTH2F, {axisMesonSpecies, axisDecLen}}}, - {"PromptCharmBaryons/hPromptBaryonsPtDistr", "Pt distribution vs prompt charm baryon in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisBaryonSpecies, axisPt}}}, - {"PromptCharmBaryons/hPromptBaryonsPtCentDistr", "Pt vs Cent vs distribution vs prompt charm baryons in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisBaryonSpecies, axisPt, axisCent}}}, - {"PromptCharmBaryons/hPromptBaryonsYDistr", "Y distribution vs prompt charm baryon; ; #it{y}^{gen}", {HistType::kTH2F, {axisBaryonSpecies, axisY}}}, - {"PromptCharmBaryons/hPromptBaryonsDecLenDistr", "Decay length distribution vs prompt charm baryon; ; decay length (#mum)", {HistType::kTH2F, {axisBaryonSpecies, axisDecLen}}}, - {"NonPromptCharmBaryons/hNonPromptBaryonsPtDistr", "Pt distribution vs non-prompt charm baryon in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisBaryonSpecies, axisPt}}}, - {"NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr", "Pt vs Cent vs distribution vs prompt charm baryons in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisBaryonSpecies, axisPt, axisCent}}}, - {"NonPromptCharmBaryons/hNonPromptBaryonsYDistr", "Y distribution vs non-prompt charm baryon; ; #it{y}^{gen}", {HistType::kTH2F, {axisBaryonSpecies, axisY}}}, - {"NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr", "Decay length distribution vs non-prompt charm baryon; ; decay length (#mum)", {HistType::kTH2F, {axisBaryonSpecies, axisDecLen}}}}}; + {"PromptCharmMesons/hPromptMesonsPtDistr", "Pt distribution vs prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisCharmMesonSpecies, axisPt}}}, + {"PromptCharmMesons/hPromptMesonsPtCentDistr", "Pt vs Cent distribution vs prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisCharmMesonSpecies, axisPt, axisCent}}}, + {"PromptCharmMesons/hPromptMesonsPtOccDistr", "Pt vs Occ distribution vs prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Occupancy", {HistType::kTH3F, {axisCharmMesonSpecies, axisPt, axisOcc}}}, + {"PromptCharmMesons/hPromptMesonsYDistr", "Y distribution vs prompt charm meson; ; #it{y}^{gen}", {HistType::kTH2F, {axisCharmMesonSpecies, axisY}}}, + {"PromptCharmMesons/hPromptMesonsDecLenDistr", "Decay length distribution vs prompt charm meson; ; decay length (#mum)", {HistType::kTH2F, {axisCharmMesonSpecies, axisDecLen}}}, + {"NonPromptCharmMesons/hNonPromptMesonsPtDistr", "Pt distribution vs non-prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisCharmMesonSpecies, axisPt}}}, + {"NonPromptCharmMesons/hNonPromptMesonsPtCentDistr", "Pt vs Cent distribution vs non-prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisCharmMesonSpecies, axisPt, axisCent}}}, + {"NonPromptCharmMesons/hNonPromptMesonsPtOccDistr", "Pt vs Occ distribution vs non-prompt charm meson in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Occupancy", {HistType::kTH3F, {axisCharmMesonSpecies, axisPt, axisOcc}}}, + {"NonPromptCharmMesons/hNonPromptMesonsYDistr", "Y distribution vs non-prompt charm meson; ; #it{y}^{gen}", {HistType::kTH2F, {axisCharmMesonSpecies, axisY}}}, + {"NonPromptCharmMesons/hNonPromptMesonsDecLenDistr", "Decay length distribution vs non-prompt charm meson; ; decay length (#mum)", {HistType::kTH2F, {axisCharmMesonSpecies, axisDecLen}}}, + {"Beauty/hPtDistr", "Pt distribution vs beauty hadron in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisBeautySpecies, axisPt}}}, + {"Beauty/hPtCentDistr", "Pt vs Cent distribution vs beauty hadron in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisBeautySpecies, axisPt, axisCent}}}, + {"Beauty/hPtOccDistr", "Pt vs Occ distribution vs beauty hadron in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Occupancy", {HistType::kTH3F, {axisBeautySpecies, axisPt, axisOcc}}}, + {"Beauty/hYDistr", "Y distribution vs beauty hadron; ; #it{y}^{gen}", {HistType::kTH2F, {axisBeautySpecies, axisY}}}, + {"Beauty/hDecLenDistr", "Decay length distribution vs beauty hadron; ; decay length (#mum)", {HistType::kTH2F, {axisBeautySpecies, axisDecLen}}}, + {"PromptCharmBaryons/hPromptBaryonsPtDistr", "Pt distribution vs prompt charm baryon in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisCharmBaryonSpecies, axisPt}}}, + {"PromptCharmBaryons/hPromptBaryonsPtCentDistr", "Pt vs Cent distribution vs prompt charm baryons in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisCharmBaryonSpecies, axisPt, axisCent}}}, + {"PromptCharmBaryons/hPromptBaryonsYDistr", "Y distribution vs prompt charm baryon; ; #it{y}^{gen}", {HistType::kTH2F, {axisCharmBaryonSpecies, axisY}}}, + {"PromptCharmBaryons/hPromptBaryonsPtOccDistr", "Pt vs Occ distribution vs prompt charm baryons in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Occupancy", {HistType::kTH3F, {axisCharmBaryonSpecies, axisPt, axisOcc}}}, + {"PromptCharmBaryons/hPromptBaryonsDecLenDistr", "Decay length distribution vs prompt charm baryon; ; decay length (#mum)", {HistType::kTH2F, {axisCharmBaryonSpecies, axisDecLen}}}, + {"NonPromptCharmBaryons/hNonPromptBaryonsPtDistr", "Pt distribution vs non-prompt charm baryon in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c})", {HistType::kTH2F, {axisCharmBaryonSpecies, axisPt}}}, + {"NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr", "Pt vs Cent distribution vs prompt charm baryons in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Centrality (%)", {HistType::kTH3F, {axisCharmBaryonSpecies, axisPt, axisCent}}}, + {"NonPromptCharmBaryons/hNonPromptBaryonsPtOccDistr", "Pt vs Occ distribution vs prompt charm baryons in |#it{y}^{gen}|<0.5; ; #it{p}_{T}^{gen} (GeV/#it{c}); Occupancy", {HistType::kTH3F, {axisCharmBaryonSpecies, axisPt, axisOcc}}}, + {"NonPromptCharmBaryons/hNonPromptBaryonsYDistr", "Y distribution vs non-prompt charm baryon; ; #it{y}^{gen}", {HistType::kTH2F, {axisCharmBaryonSpecies, axisY}}}, + {"NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr", "Decay length distribution vs non-prompt charm baryon; ; decay length (#mum)", {HistType::kTH2F, {axisCharmBaryonSpecies, axisDecLen}}}}}; void init(InitContext& initContext) { @@ -158,35 +183,50 @@ struct HfTaskMcValidationGen { // add per species histograms for (size_t iOrigin = 0; iOrigin < nOriginTypes; iOrigin++) { - for (int iChannel = 0; iChannel < nMesonChannels; iChannel++) { + for (int iChannel = 0; iChannel < nCharmMesonChannels; iChannel++) { // Charm mesons registry.add(Form("%sCharmMesons/hCount%s%s", originNames[iOrigin].data(), originNames[iOrigin].data(), particleNames[iChannel].data()), Form("Event counter - %s %s; Events Per Collision; entries", originNames[iOrigin].data(), labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); } - for (int iChannel = nMesonChannels; iChannel < nChannels; iChannel++) { + for (int iChannel = nCharmMesonChannels + nBeautyChannels; iChannel < nChannels; iChannel++) { // Charm baryons registry.add(Form("%sCharmBaryons/hCount%s%s", originNames[iOrigin].data(), originNames[iOrigin].data(), particleNames[iChannel].data()), Form("Event counter - %s %s; Events Per Collision; entries", originNames[iOrigin].data(), labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); } } + for (int iChannel = nCharmMesonChannels; iChannel < nCharmMesonChannels + nBeautyChannels; iChannel++) { // Beauty mesons + registry.add(Form("Beauty/hCount%s", particleNames[iChannel].data()), + Form("Event counter - %s; Events Per Collision; entries", labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); + } - for (auto iBin = 1; iBin <= nMesonChannels; ++iBin) { + for (auto iBin = 1; iBin <= nCharmMesonChannels; ++iBin) { registry.get(HIST("PromptCharmMesons/hPromptMesonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); registry.get(HIST("PromptCharmMesons/hPromptMesonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); + registry.get(HIST("PromptCharmMesons/hPromptMesonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); registry.get(HIST("PromptCharmMesons/hPromptMesonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); registry.get(HIST("PromptCharmMesons/hPromptMesonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); + registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); } - for (auto iBin = 1; iBin <= nChannels - nMesonChannels; ++iBin) { - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nMesonChannels - 1].data()); - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nMesonChannels - 1].data()); - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nMesonChannels - 1].data()); - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nMesonChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nMesonChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nMesonChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nMesonChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nMesonChannels - 1].data()); + for (auto iBin = 1; iBin <= nBeautyChannels; ++iBin) { + registry.get(HIST("Beauty/hPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); + registry.get(HIST("Beauty/hPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); + registry.get(HIST("Beauty/hPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); + registry.get(HIST("Beauty/hYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); + registry.get(HIST("Beauty/hDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); + } + for (auto iBin = 1; iBin <= nCharmBaryonChannels; ++iBin) { + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); } // inspect for which particle species the candidates were created and which zPvPosMax cut was set for reconstructed @@ -201,6 +241,27 @@ struct HfTaskMcValidationGen { hfEvSelMc.addHistograms(registry); // particles monitoring } + /// \brief Function to get MC collision occupancy + /// \param collSlice collection of reconstructed collisions + /// \return collision occupancy + template + int getOccupancyColl(CCs const& collSlice) + { + float multiplicity{0.f}; + int occupancy = 0; + for (const auto& collision : collSlice) { + float collMult{0.f}; + collMult = collision.numContrib(); + + if (collMult > multiplicity) { + occupancy = collision.trackOccupancyInTimeRange(); + multiplicity = collMult; + } + } // end loop over collisions + + return occupancy; + } + template void runCheckGenParticles(GenColl const& mcCollision, Particles const& mcParticles, RecoColls const& recoCollisions, BCsInfo const&, std::array& counterPrompt, std::array& counterNonPrompt) { @@ -211,6 +272,10 @@ struct HfTaskMcValidationGen { // Slice the collisions table to get the collision info for the current MC collision float centrality{105.f}; + int occupancy = 0; + if (storeOccupancy) { + occupancy = getOccupancyColl(recoCollisions); + } uint16_t rejectionMask{0}; if constexpr (centEstimator == CentralityEstimator::FT0C) { rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); @@ -308,8 +373,14 @@ struct HfTaskMcValidationGen { } if (nDaughters[iD] == 4) { - if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal4Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) { - continue; + if (iD != B0ToDminusPi) { + if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal4Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) { + continue; + } + } else { // For B0 we consider flavour oscillations + if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal4Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) { + continue; + } } if (iD == D10ToDStarPi && !RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], std::array{+o2::constants::physics::Pdg::kDStar, -kPiPlus}, true)) { @@ -327,6 +398,10 @@ struct HfTaskMcValidationGen { !RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], std::array{+kOmegaMinus, +kPiPlus}, true)) { continue; } + if (iD == B0ToDminusPi && + !RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], std::array{-o2::constants::physics::Pdg::kDPlus, +kPiPlus}, true)) { + continue; + } } if (nDaughters[iD] == 5) { @@ -375,22 +450,28 @@ struct HfTaskMcValidationGen { registry.fill(HIST("hPDiffMotherDaughterGen"), pDiff); registry.fill(HIST("hPtDiffMotherDaughterGen"), ptDiff); - int origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle); - if (origin == RecoDecay::OriginType::Prompt) { - counterPrompt[iD]++; - } else if (origin == RecoDecay::OriginType::NonPrompt) { - counterNonPrompt[iD]++; + int origin{0}; + if (iD < nCharmMesonChannels || iD >= nCharmMesonChannels + nBeautyChannels) { // Charm hadrons + origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle); + if (origin == RecoDecay::OriginType::Prompt) { + counterPrompt[iD]++; + } else if (origin == RecoDecay::OriginType::NonPrompt) { + counterNonPrompt[iD]++; + } } auto daughter0 = particle.template daughters_as().begin(); double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; double vertexPrimary[3] = {mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()}; auto decayLength = RecoDecay::distance(vertexPrimary, vertexDau); - if (iD < nMesonChannels) { - if (origin == RecoDecay::OriginType::Prompt) { + if (iD < nCharmMesonChannels) { + if (origin == RecoDecay::OriginType::Prompt) { // Prompt charm mesons if (std::abs(particle.y()) < 0.5) { registry.fill(HIST("PromptCharmMesons/hPromptMesonsPtDistr"), iD, particle.pt()); registry.fill(HIST("PromptCharmMesons/hPromptMesonsPtCentDistr"), iD, particle.pt(), centrality); + if (storeOccupancy) { + registry.fill(HIST("PromptCharmMesons/hPromptMesonsPtOccDistr"), iD, particle.pt(), occupancy); + } } registry.fill(HIST("PromptCharmMesons/hPromptMesonsYDistr"), iD, particle.y()); registry.fill(HIST("PromptCharmMesons/hPromptMesonsDecLenDistr"), iD, decayLength * 10000); @@ -398,25 +479,41 @@ struct HfTaskMcValidationGen { if (std::abs(particle.y()) < 0.5) { registry.fill(HIST("NonPromptCharmMesons/hNonPromptMesonsPtDistr"), iD, particle.pt()); registry.fill(HIST("NonPromptCharmMesons/hNonPromptMesonsPtCentDistr"), iD, particle.pt(), centrality); + if (storeOccupancy) { + registry.fill(HIST("NonPromptCharmMesons/hNonPromptMesonsPtOccDistr"), iD, particle.pt(), occupancy); + } } registry.fill(HIST("NonPromptCharmMesons/hNonPromptMesonsYDistr"), iD, particle.y()); registry.fill(HIST("NonPromptCharmMesons/hNonPromptMesonsDecLenDistr"), iD, decayLength * 10000); } - } else { + } else if (iD < nCharmMesonChannels + nBeautyChannels) { // Beauty mesons + if (std::abs(particle.y()) < 0.5) { + registry.fill(HIST("Beauty/hPtDistr"), iD - nCharmMesonChannels, particle.pt()); + registry.fill(HIST("Beauty/hPtCentDistr"), iD - nCharmMesonChannels, particle.pt(), centrality); + } + registry.fill(HIST("Beauty/hYDistr"), iD - nCharmMesonChannels, particle.y()); + registry.fill(HIST("Beauty/hDecLenDistr"), iD - nCharmMesonChannels, decayLength * 10000); + } else { // Charm baryons if (origin == RecoDecay::OriginType::Prompt) { if (std::abs(particle.y()) < 0.5) { - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtDistr"), iD - nMesonChannels, particle.pt()); - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtCentDistr"), iD - nMesonChannels, particle.pt(), centrality); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt()); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtCentDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt(), centrality); + if (storeOccupancy) { + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtOccDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt(), occupancy); + } } - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsYDistr"), iD - nMesonChannels, particle.y()); - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsDecLenDistr"), iD - nMesonChannels, decayLength * 10000); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsYDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.y()); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsDecLenDistr"), iD - nCharmMesonChannels - nBeautyChannels, decayLength * 10000); } else if (origin == RecoDecay::OriginType::NonPrompt) { if (std::abs(particle.y()) < 0.5) { - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtDistr"), iD - nMesonChannels, particle.pt()); - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr"), iD - nMesonChannels, particle.pt(), centrality); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt()); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt(), centrality); + if (storeOccupancy) { + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtOccDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt(), occupancy); + } } - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsYDistr"), iD - nMesonChannels, particle.y()); - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr"), iD - nMesonChannels, decayLength * 10000); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsYDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.y()); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr"), iD - nCharmMesonChannels - nBeautyChannels, decayLength * 10000); } } } @@ -438,12 +535,16 @@ struct HfTaskMcValidationGen { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); std::array counterPrompt{0}, counterNonPrompt{0}; runCheckGenParticles(mcCollision, mcParticlesPerMcColl, recoCollsPerMcColl, bcInfo, counterPrompt, counterNonPrompt); - static_for<0, nMesonChannels - 1>([&](auto i) { + static_for<0, nCharmMesonChannels - 1>([&](auto i) { // Charm mesons constexpr int index = i.value; registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); }); - static_for([&](auto i) { + static_for([&](auto i) { // Beauty hadrons + constexpr int index = i.value; + registry.fill(HIST("Beauty/hCount") + HIST(particleNames[index]), counterPrompt[index]); + }); + static_for([&](auto i) { // Charm baryons constexpr int index = i.value; registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); @@ -462,12 +563,16 @@ struct HfTaskMcValidationGen { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); std::array counterPrompt{0}, counterNonPrompt{0}; runCheckGenParticles(mcCollision, mcParticlesPerMcColl, recoCollsPerMcColl, bcInfo, counterPrompt, counterNonPrompt); - static_for<0, nMesonChannels - 1>([&](auto i) { + static_for<0, nCharmMesonChannels - 1>([&](auto i) { // Charm mesons constexpr int index = i.value; registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); }); - static_for([&](auto i) { + static_for([&](auto i) { // Beauty + constexpr int index = i.value; + registry.fill(HIST("Beauty/hCount") + HIST(particleNames[index]), counterPrompt[index]); + }); + static_for([&](auto i) { // Charm baryons constexpr int index = i.value; registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); @@ -486,12 +591,16 @@ struct HfTaskMcValidationGen { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); std::array counterPrompt{0}, counterNonPrompt{0}; runCheckGenParticles(mcCollision, mcParticlesPerMcColl, recoCollsPerMcColl, bcInfo, counterPrompt, counterNonPrompt); - static_for<0, nMesonChannels - 1>([&](auto i) { + static_for<0, nCharmMesonChannels - 1>([&](auto i) { // Charm mesons constexpr int index = i.value; registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); }); - static_for([&](auto i) { + static_for([&](auto i) { // Beauty mesons + constexpr int index = i.value; + registry.fill(HIST("Beauty/hCount") + HIST(particleNames[index]), counterPrompt[index]); + }); + static_for([&](auto i) { // Charm baryons constexpr int index = i.value; registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); @@ -510,9 +619,11 @@ struct HfTaskMcValidationRec { Preslice perCol = aod::track::collisionId; Configurable eventGeneratorType{"eventGeneratorType", -1, "If positive, enable event selection using subGeneratorId information. The value indicates which events to keep (0 = MB, 4 = charm triggered, 5 = beauty triggered)"}; + Configurable storeOccupancy{"storeOccupancy", false, "Store collision occupancy for dedicated studies"}; std::array, nChannels> histDeltaPt, histDeltaPx, histDeltaPy, histDeltaPz, histDeltaSecondaryVertexX, histDeltaSecondaryVertexY, histDeltaSecondaryVertexZ, histDeltaDecayLength; std::array, 2>, nChannels> histPtCentReco; + std::array, 2>, nChannels> histPtOccReco; std::array, 5>, 2>, nChannels> histPtDau, histEtaDau, histImpactParameterDau; std::array, 4> histOriginTracks; std::shared_ptr histAmbiguousTracks, histTracks; @@ -541,6 +652,7 @@ struct HfTaskMcValidationRec { AxisSpec axisPt{50, 0., 10.}; AxisSpec axisPtD{100, 0., 50.}; AxisSpec axisCent{110, 0., 110.}; + AxisSpec axisOcc{3000, 0., 15000.}; AxisSpec axisDeltaVtx{200, -1, 1.}; AxisSpec axisDecision{2, -0.5, 1.5}; AxisSpec axisITShits{8, -0.5, 7.5}; @@ -585,8 +697,9 @@ struct HfTaskMcValidationRec { /// \param whichHad int indicating charm-hadron and decay channel, see enum DecayChannels /// \param whichOrigin int indicating origin: prompt or non-prompt /// \param centrality is collision centrality + /// \param occupancy is collision occupancy template - void fillHisto(const T& candidate, const U& mother, int whichHad, int whichOrigin, float centrality) + void fillHisto(const T& candidate, const U& mother, int whichHad, int whichOrigin, float centrality, int occupancy) { histDeltaPt[whichHad]->Fill(candidate.pt() - mother.pt()); histDeltaPx[whichHad]->Fill(candidate.px() - mother.px()); @@ -609,6 +722,9 @@ struct HfTaskMcValidationRec { candidate.pyProng1(), candidate.pzProng1()}; histPtCentReco[whichHad][whichOrigin]->Fill(candidate.pt(), centrality); + if (storeOccupancy) { + histPtOccReco[whichHad][whichOrigin]->Fill(candidate.pt(), occupancy); + } histPtDau[whichHad][whichOrigin][0]->Fill(RecoDecay::pt(momDau0)); histEtaDau[whichHad][whichOrigin][0]->Fill(RecoDecay::eta(momDau0)); histImpactParameterDau[whichHad][whichOrigin][0]->Fill(candidate.impactParameter0()); @@ -650,7 +766,7 @@ struct HfTaskMcValidationRec { histAmbiguousTracks->GetXaxis()->SetBinLabel(3, "charm"); histAmbiguousTracks->GetXaxis()->SetBinLabel(4, "beauty"); for (auto iHad = 0; iHad < nChannels; ++iHad) { - if (iHad < nMesonChannels) { + if (iHad < nCharmMesonChannels) { histDeltaPt[iHad] = registryMesons.add(Form("%s/histDeltaPt", particleNames[iHad].data()), Form("Pt difference reco - MC %s; #it{p}_{T}^{reco} - #it{p}_{T}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); histDeltaPx[iHad] = registryMesons.add(Form("%s/histDeltaPx", particleNames[iHad].data()), Form("Px difference reco - MC %s; #it{p}_{x}^{reco} - #it{p}_{x}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); histDeltaPy[iHad] = registryMesons.add(Form("%s/histDeltaPy", particleNames[iHad].data()), Form("Py difference reco - MC %s; #it{p}_{y}^{reco} - #it{p}_{y}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); @@ -660,14 +776,17 @@ struct HfTaskMcValidationRec { histDeltaSecondaryVertexZ[iHad] = registryMesons.add(Form("%s/histDeltaSecondaryVertexZ", particleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta z (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); histDeltaDecayLength[iHad] = registryMesons.add(Form("%s/histDeltaDecayLength", particleNames[iHad].data()), Form("Decay length difference reco - MC (%s); #Delta L (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); for (auto iOrigin = 0; iOrigin < 2; ++iOrigin) { - histPtCentReco[iHad][iOrigin] = registryMesons.add(Form("%s/histPtCentReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Centrality (%); entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisCent}); + histPtCentReco[iHad][iOrigin] = registryMesons.add(Form("%s/histPtCentReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Centrality (%%); entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisCent}); + if (storeOccupancy) { + histPtOccReco[iHad][iOrigin] = registryMesons.add(Form("%s/histPtOccReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Occupancy; entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisOcc}); + } for (unsigned int iDau = 0; iDau < nDaughters[iHad]; ++iDau) { histPtDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histPtDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d Pt reco - %s %s; #it{p}_{T}^{dau, reco} (GeV/#it{c}); entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisPt}); histEtaDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histEtaDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d Eta reco - %s %s; #it{#eta}^{dau, reco}; entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {{100, -1., 1.}}); histImpactParameterDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histImpactParameterDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d DCAxy reco - %s %s; DCAxy (cm); entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); } } - } else { + } else if (iHad >= nCharmMesonChannels + nBeautyChannels) { histDeltaPt[iHad] = registryBaryons.add(Form("%s/histDeltaPt", particleNames[iHad].data()), Form("Pt difference reco - MC %s; #it{p}_{T}^{reco} - #it{p}_{T}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); histDeltaPx[iHad] = registryBaryons.add(Form("%s/histDeltaPx", particleNames[iHad].data()), Form("Px difference reco - MC %s; #it{p}_{x}^{reco} - #it{p}_{x}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); histDeltaPy[iHad] = registryBaryons.add(Form("%s/histDeltaPy", particleNames[iHad].data()), Form("Py difference reco - MC %s; #it{p}_{y}^{reco} - #it{p}_{y}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); @@ -677,7 +796,10 @@ struct HfTaskMcValidationRec { histDeltaSecondaryVertexZ[iHad] = registryBaryons.add(Form("%s/histDeltaSecondaryVertexZ", particleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta z (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); histDeltaDecayLength[iHad] = registryBaryons.add(Form("%s/histDeltaDecayLength", particleNames[iHad].data()), Form("Decay length difference reco - MC (%s); #Delta L (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); for (auto iOrigin = 0; iOrigin < 2; ++iOrigin) { - histPtCentReco[iHad][iOrigin] = registryBaryons.add(Form("%s/histPtCentReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Centrality (%); entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisCent}); + histPtCentReco[iHad][iOrigin] = registryBaryons.add(Form("%s/histPtCentReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Centrality (%%); entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisCent}); + if (storeOccupancy) { + histPtOccReco[iHad][iOrigin] = registryBaryons.add(Form("%s/histPtOccReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Occupancy; entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisOcc}); + } for (unsigned int iDau = 0; iDau < nDaughters[iHad]; ++iDau) { histPtDau[iHad][iOrigin][iDau] = registryBaryons.add(Form("%s/histPtDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d Pt reco - %s %s; #it{p}_{T}^{dau, reco} (GeV/#it{c}); entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisPt}); histEtaDau[iHad][iOrigin][iDau] = registryBaryons.add(Form("%s/histEtaDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d Eta reco - %s %s; #it{#eta}^{dau, reco}; entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {{100, -1., 1.}}); @@ -937,7 +1059,8 @@ struct HfTaskMcValidationRec { for (const auto& collision : collisions) { // apply event selection float centrality{105.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied + int occupancy = collision.trackOccupancyInTimeRange(); + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied if (!collision.has_mcCollision()) { return; } @@ -977,7 +1100,7 @@ struct HfTaskMcValidationRec { continue; } auto mother = mcParticles.rawIteratorAt(indexParticle); - fillHisto(cand2Prong, mother, whichHad, whichOrigin, centrality); + fillHisto(cand2Prong, mother, whichHad, whichOrigin, centrality, occupancy); } } // end loop on 2-prong candidates @@ -1027,7 +1150,7 @@ struct HfTaskMcValidationRec { continue; } auto mother = mcParticles.rawIteratorAt(indexParticle); - fillHisto(cand3Prong, mother, whichHad, whichOrigin, centrality); + fillHisto(cand3Prong, mother, whichHad, whichOrigin, centrality, occupancy); std::array momDau2 = {cand3Prong.pxProng2(), cand3Prong.pyProng2(), cand3Prong.pzProng2()}; diff --git a/PWGHF/Tasks/taskMultiplicityEstimatorCorrelation.cxx b/PWGHF/Tasks/taskMultiplicityEstimatorCorrelation.cxx new file mode 100644 index 00000000000..a7e0515eb2f --- /dev/null +++ b/PWGHF/Tasks/taskMultiplicityEstimatorCorrelation.cxx @@ -0,0 +1,137 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file taskMultiplicityEstimatorCorrelation.cxx +/// \brief Task for correlating the multiplicity estimator with generated dN/deta +/// +/// \author Fabrizio Chinu , Università and INFN Torino + +#include +#include +#include + +#include "TPDGCode.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "Framework/StaticFor.h" +#include "Common/DataModel/Multiplicity.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct HfTaskMultiplicityEstimatorCorrelation { + HistogramRegistry registry{"registry", {}}; + static constexpr int8_t nEstimators = 8; + static constexpr std::array estimatorsNames = {"FV0A", "FT0A", "FT0C", "FT0M", "FDDA", "FDDC", "FDDM", "NTPV"}; + + std::vector consideredParticles = { + kElectron, + kMuonMinus, + kPiPlus, + kKPlus, + kProton}; + + ConfigurableAxis axisFV0A = {"axisFV0A", {100, 0., 20000.}, "axis for FV0A estimator"}; + ConfigurableAxis axisFT0A = {"axisFT0A", {100, 0., 10000.}, "axis for FT0A estimator"}; + ConfigurableAxis axisFT0C = {"axisFT0C", {100, 0., 5000.}, "axis for FT0C estimator"}; + ConfigurableAxis axisFT0M = {"axisFT0M", {100, 0., 10000.}, "axis for FT0M estimator"}; + ConfigurableAxis axisFDDA = {"axisFDDA", {100, 0., 20000.}, "axis for FDDA estimator"}; + ConfigurableAxis axisFDDC = {"axisFDDC", {100, 0., 5000.}, "axis for FDDC estimator"}; + ConfigurableAxis axisFDDM = {"axisFDDM", {100, 0., 20000.}, "axis for FDDM estimator"}; + ConfigurableAxis axisNTPV = {"axisNTPV", {100, 0., 100.}, "axis for NTPV estimator"}; + ConfigurableAxis axisdNdEta = {"axisdNdEta", {100, 0., 100.}, "axis for dN/deta"}; + + std::vector estimatorsAxes = {&axisFV0A, &axisFT0A, &axisFT0C, &axisFT0M, &axisFDDA, &axisFDDC, &axisFDDM, &axisNTPV}; + + Preslice particlesPerCollision = o2::aod::mcparticle::mcCollisionId; + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; + + using CollisionsWithMult = soa::Join; + + void init(InitContext&) + { + for (int8_t i = 0; i < nEstimators; i++) { + registry.add(("etaPFive/" + std::string(estimatorsNames[i]) + "VsdNdeta").c_str(), (std::string(estimatorsNames[i]) + "VsdNdeta;" + std::string(estimatorsNames[i]) + ";").c_str(), HistType::kTH2F, {*(estimatorsAxes[i]), axisdNdEta}); + registry.add(("etaOne/" + std::string(estimatorsNames[i]) + "VsdNdeta").c_str(), (std::string(estimatorsNames[i]) + "VsdNdeta;" + std::string(estimatorsNames[i]) + ";").c_str(), HistType::kTH2F, {*(estimatorsAxes[i]), axisdNdEta}); + } + } + + void process(CollisionsWithMult const& collisions, + aod::McCollisions const& mcCollisions, + aod::McParticles const& particles, + soa::Join const&) + { + for (auto const& collision : mcCollisions) { + + // Get multiplicity for the reconstructed collision with the highest number of contributors + unsigned maxNumContrib = 0; + CollisionsWithMult::iterator collisionMaxNumContrib; + const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, collision.globalIndex()); + for (const auto& recCol : recoCollsPerMcColl) { + if (recCol.numContrib() > maxNumContrib) { + maxNumContrib = recCol.numContrib(); + collisionMaxNumContrib = recCol; + } + } + std::vector multiplicity = { + collisionMaxNumContrib.multZeqFV0A(), + collisionMaxNumContrib.multZeqFT0A(), + collisionMaxNumContrib.multZeqFT0C(), + collisionMaxNumContrib.multZeqFT0A() + collisionMaxNumContrib.multZeqFT0C(), + collisionMaxNumContrib.multZeqFDDA(), + collisionMaxNumContrib.multZeqFDDC(), + collisionMaxNumContrib.multZeqFDDA() + collisionMaxNumContrib.multZeqFDDC(), + collisionMaxNumContrib.multZeqNTracksPV()}; + + // Get the dN/deta for the generated collision + unsigned nChargedInEtaFive = 0; + unsigned nChargedInEtaOne = 0; + const auto& particlesPerMcColl = particles.sliceBy(particlesPerCollision, collision.globalIndex()); + for (auto const& particle : particlesPerMcColl) { + if (particle.isPhysicalPrimary()) { + bool isCharged = false; + for (auto const& consideredParticle : consideredParticles) { + if (static_cast(std::abs(particle.pdgCode())) == consideredParticle) { + isCharged = true; + break; + } + } + if (!isCharged) { + continue; + } + if (std::abs(particle.eta()) < 0.5) { + nChargedInEtaFive++; + } + if (std::abs(particle.eta()) < 1.0) { + nChargedInEtaOne++; + } + } + } + + float dNdetaFive = nChargedInEtaFive; + float dNdetaOne = nChargedInEtaOne / 2.0; + for (int i = 0; i < nEstimators; i++) { + static_for<0, nEstimators - 1>([&](auto j) { + constexpr int index = j.value; + registry.fill(HIST("etaPFive/") + HIST(estimatorsNames[index]) + HIST("VsdNdeta"), multiplicity[index], dNdetaFive); + registry.fill(HIST("etaOne/") + HIST(estimatorsNames[index]) + HIST("VsdNdeta"), multiplicity[index], dNdetaOne); + }); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx new file mode 100644 index 00000000000..8516963bafc --- /dev/null +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -0,0 +1,367 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file taskPidStudies.cxx +/// \brief task for studies of PID performance +/// +/// \author Fabrizio Chinu , Università and INFN Torino +/// \author Stefano Politanò , INFN Torino +/// \author Marcello Di Costanzo , Politecnico and INFN Torino +/// \author Luca Aglietta , Università and INFN Torino + +#include "TPDGCode.h" + +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace pid_studies +{ +enum Particle { NotMatched = 0, + K0s, + Lambda, + Omega }; +// V0s +DECLARE_SOA_COLUMN(MassK0, massK0, float); //! Candidate mass +DECLARE_SOA_COLUMN(MassLambda, massLambda, float); //! Candidate mass +DECLARE_SOA_COLUMN(MassAntiLambda, massAntiLambda, float); //! Candidate mass +DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of the candidate (GeV/c) +DECLARE_SOA_COLUMN(PtPos, ptPos, float); //! Transverse momentum of positive track (GeV/c) +DECLARE_SOA_COLUMN(PtNeg, ptNeg, float); //! Transverse momentum of negative track (GeV/c) +DECLARE_SOA_COLUMN(TpcInnerParPos, tpcInnerParPos, float); //! Momentum of positive track at inner wall of TPC (GeV/c) +DECLARE_SOA_COLUMN(TpcInnerParNeg, tpcInnerParNeg, float); //! Momentum of negative track at inner wall of TPC (GeV/c) +DECLARE_SOA_COLUMN(Radius, radius, float); //! Radius +DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine of pointing angle +DECLARE_SOA_COLUMN(DcaV0Daughters, dcaV0Daughters, float); //! DCA between V0 daughters +DECLARE_SOA_COLUMN(DcaV0ToPv, dcaV0ToPv, float); //! DCA V0 to PV +DECLARE_SOA_COLUMN(NSigmaTpcPosPi, nSigmaTpcPosPi, float); //! nSigmaTPC of positive track with pion hypothesis +DECLARE_SOA_COLUMN(NSigmaTpcNegPi, nSigmaTpcNegPi, float); //! nSigmaTPC of negative track with pion hypothesis +DECLARE_SOA_COLUMN(NSigmaTpcPosPr, nSigmaTpcPosPr, float); //! nSigmaTPC of positive track with proton hypothesis +DECLARE_SOA_COLUMN(NSigmaTpcNegPr, nSigmaTpcNegPr, float); //! nSigmaTPC of negative track with proton hypothesis +DECLARE_SOA_COLUMN(NSigmaTofPosPi, nSigmaTofPosPi, float); //! nSigmaTOF of positive track with pion hypothesis +DECLARE_SOA_COLUMN(NSigmaTofNegPi, nSigmaTofNegPi, float); //! nSigmaTOF of negative track with pion hypothesis +DECLARE_SOA_COLUMN(NSigmaTofPosPr, nSigmaTofPosPr, float); //! nSigmaTOF of positive track with proton hypothesis +DECLARE_SOA_COLUMN(NSigmaTofNegPr, nSigmaTofNegPr, float); //! nSigmaTOF of negative track with proton hypothesis +DECLARE_SOA_COLUMN(AlphaArm, alphaArm, float); //! Armenteros alpha +DECLARE_SOA_COLUMN(QtArm, qtArm, float); //! Armenteros Qt + +// Cascades +DECLARE_SOA_COLUMN(MassOmega, massOmega, float); //! Candidate mass +DECLARE_SOA_COLUMN(MassXi, massXi, float); //! Candidate mass +DECLARE_SOA_COLUMN(BachPt, bachPt, float); //! Transverse momentum of the bachelor (GeV/c) +DECLARE_SOA_COLUMN(TpcInnerParBach, tpcInnerParBach, float); //! Transverse momentum of the bachelor (GeV/c) +DECLARE_SOA_COLUMN(MLambda, mLambda, float); //! Daughter lambda mass (GeV/c^2) +DECLARE_SOA_COLUMN(V0cosPA, v0cosPA, float); //! V0 CPA +DECLARE_SOA_COLUMN(CascCosPa, cascCosPa, float); //! Cascade CPA +DECLARE_SOA_COLUMN(NSigmaTpcBachKa, nSigmaTpcBachKa, float); //! nSigmaTPC of bachelor with kaon hypothesis +DECLARE_SOA_COLUMN(NSigmaTofBachKa, nSigmaTofBachKa, float); //! nSigmaTOF of bachelor with kaon hypothesis + +// Common columns +DECLARE_SOA_COLUMN(OccupancyFt0c, occupancyFt0c, float); //! Occupancy from FT0C +DECLARE_SOA_COLUMN(OccupancyIts, occupancyIts, float); //! Occupancy from ITS +DECLARE_SOA_COLUMN(CentralityFT0C, centralityFT0C, float); //! Centrality from FT0C +DECLARE_SOA_COLUMN(CentralityFT0M, centralityFT0M, float); //! Centrality from FT0M +DECLARE_SOA_COLUMN(CandFlag, candFlag, int); //! Flag for MC matching +} // namespace pid_studies + +DECLARE_SOA_TABLE(PidV0s, "AOD", "PIDV0S", //! Table with PID information + pid_studies::MassK0, + pid_studies::MassLambda, + pid_studies::MassAntiLambda, + pid_studies::Pt, + pid_studies::PtPos, + pid_studies::PtNeg, + pid_studies::TpcInnerParPos, + pid_studies::TpcInnerParNeg, + pid_studies::Radius, + pid_studies::Cpa, + pid_studies::DcaV0Daughters, + pid_studies::DcaV0ToPv, + pid_studies::NSigmaTpcPosPi, + pid_studies::NSigmaTpcNegPi, + pid_studies::NSigmaTpcPosPr, + pid_studies::NSigmaTpcNegPr, + pid_studies::NSigmaTofPosPi, + pid_studies::NSigmaTofNegPi, + pid_studies::NSigmaTofPosPr, + pid_studies::NSigmaTofNegPr, + pid_studies::AlphaArm, + pid_studies::QtArm, + pid_studies::OccupancyFt0c, + pid_studies::OccupancyIts, + pid_studies::CentralityFT0C, + pid_studies::CentralityFT0M, + pid_studies::CandFlag); + +DECLARE_SOA_TABLE(PidCascades, "AOD", "PIDCASCADES", //! Table with PID information + pid_studies::MassOmega, + pid_studies::Pt, + pid_studies::BachPt, + pid_studies::TpcInnerParBach, + pid_studies::MLambda, + pid_studies::V0cosPA, + pid_studies::MassXi, + pid_studies::CascCosPa, + pid_studies::DcaV0Daughters, + pid_studies::DcaV0ToPv, + pid_studies::NSigmaTpcBachKa, + pid_studies::NSigmaTofBachKa, + pid_studies::OccupancyFt0c, + pid_studies::OccupancyIts, + pid_studies::CentralityFT0C, + pid_studies::CentralityFT0M, + pid_studies::CandFlag); +} // namespace o2::aod + +struct HfTaskPidStudies { + Produces pidV0; + Produces pidCascade; + + Configurable massK0Min{"massK0Min", 0.4, "Minimum mass for K0"}; + Configurable massK0Max{"massK0Max", 0.6, "Maximum mass for K0"}; + Configurable massLambdaMin{"massLambdaMin", 1.0, "Minimum mass for lambda"}; + Configurable massLambdaMax{"massLambdaMax", 1.3, "Maximum mass for lambda"}; + Configurable massOmegaMin{"massOmegaMin", 1.5, "Minimum mass for omega"}; + Configurable massOmegaMax{"massOmegaMax", 1.8, "Maximum mass for omega"}; + Configurable qtArmenterosMinForK0{"qtArmenterosMinForK0", 0.12, "Minimum Armenteros' qt for K0"}; + Configurable qtArmenterosMaxForLambda{"qtArmenterosMaxForLambda", 0.12, "Minimum Armenteros' qt for (anti)Lambda"}; + Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of candidates to keep"}; + Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; + + using PidTracks = soa::Join; + using CollSels = soa::Join; + using V0sMcRec = soa::Join; + using CascsMcRec = soa::Join; + + void init(InitContext&) + { + if ((doprocessV0Mc && doprocessV0Data) || (doprocessCascMc && doprocessCascData)) { + LOGP(fatal, "Both data and MC process functions were enabled! Please check your configuration!"); + } + } + + template + void fillTree(Cand const& candidate, const int flag) + { + float pseudoRndm = candidate.pt() * 1000. - static_cast(candidate.pt() * 1000); + if (candidate.pt() < ptMaxForDownSample && pseudoRndm > downSampleBkgFactor) { + return; + } + + const auto& coll = candidate.template collision_as(); + if constexpr (isV0) { + const auto& posTrack = candidate.template posTrack_as(); + const auto& negTrack = candidate.template negTrack_as(); + pidV0( + candidate.mK0Short(), + candidate.mLambda(), + candidate.mAntiLambda(), + candidate.pt(), + posTrack.pt(), + negTrack.pt(), + posTrack.tpcInnerParam(), + negTrack.tpcInnerParam(), + candidate.v0radius(), + candidate.v0cosPA(), + candidate.dcaV0daughters(), + candidate.dcav0topv(), + posTrack.tofNSigmaPi(), + negTrack.tofNSigmaPi(), + posTrack.tofNSigmaPr(), + negTrack.tofNSigmaPr(), + posTrack.tpcNSigmaPi(), + negTrack.tpcNSigmaPi(), + posTrack.tpcNSigmaPr(), + negTrack.tpcNSigmaPr(), + candidate.alpha(), + candidate.qtarm(), + coll.ft0cOccupancyInTimeRange(), + coll.trackOccupancyInTimeRange(), + coll.centFT0C(), + coll.centFT0M(), + flag); + } else { + const auto& bachTrack = candidate.template bachelor_as(); + pidCascade( + candidate.mOmega(), + candidate.pt(), + candidate.bachelorpt(), + bachTrack.tpcInnerParam(), + candidate.mLambda(), + candidate.v0cosPA(coll.posX(), coll.posY(), coll.posZ()), + candidate.mXi(), + candidate.casccosPA(coll.posX(), coll.posY(), coll.posZ()), + candidate.dcaV0daughters(), + candidate.dcav0topv(coll.posX(), coll.posY(), coll.posZ()), + bachTrack.tpcNSigmaKa(), + bachTrack.tofNSigmaKa(), + coll.ft0cOccupancyInTimeRange(), + coll.trackOccupancyInTimeRange(), + coll.centFT0C(), + coll.centFT0M(), + flag); + } + } + + template + int isMatched(const T1& cand) + { + if constexpr (std::is_same::value) { + if (!cand.has_v0MCCore()) { + return aod::pid_studies::Particle::NotMatched; + } + auto v0MC = cand.template v0MCCore_as(); + if (v0MC.pdgCode() == kK0Short && v0MC.pdgCodeNegative() == -kPiPlus && v0MC.pdgCodePositive() == kPiPlus) { + return aod::pid_studies::Particle::K0s; + } + if (v0MC.pdgCode() == kLambda0 && v0MC.pdgCodeNegative() == -kPiPlus && v0MC.pdgCodePositive() == kProton) { + return aod::pid_studies::Particle::Lambda; + } + if (v0MC.pdgCode() == -kLambda0 && v0MC.pdgCodeNegative() == -kProton && v0MC.pdgCodePositive() == kPiPlus) { + return -aod::pid_studies::Particle::Lambda; + } + } + if constexpr (std::is_same::value) { + if (!cand.has_cascMCCore()) { + return aod::pid_studies::Particle::NotMatched; + } + auto cascMC = cand.template cascMCCore_as(); + if (cascMC.pdgCode() == kOmegaMinus && + cascMC.pdgCodeBachelor() == -kKPlus && + cascMC.pdgCodeV0() == kLambda0 && + cascMC.pdgCodePositive() == kProton && + cascMC.pdgCodeNegative() == -kPiPlus) { + return aod::pid_studies::Particle::Omega; + } + if (cascMC.pdgCode() == -kOmegaMinus && + cascMC.pdgCodeBachelor() == kKPlus && + cascMC.pdgCodeV0() == -kLambda0 && + cascMC.pdgCodePositive() == kPiPlus && + cascMC.pdgCodeNegative() == -kProton) { + return -aod::pid_studies::Particle::Omega; + } + } + return aod::pid_studies::Particle::NotMatched; + } + + template + bool isSelectedV0AsK0s(const V0Cand& v0) + { + if (v0.mK0Short() < massK0Min || v0.mK0Short() > massK0Max) { + return false; + } + if (v0.qtarm() < qtArmenterosMinForK0) { + return false; + } + return true; + } + + template + bool isSelectedV0AsLambda(const V0Cand& v0) + { + if ((v0.mLambda() < massLambdaMin || v0.mLambda() > massLambdaMax) && + (v0.mAntiLambda() < massLambdaMin || v0.mAntiLambda() > massLambdaMax)) { + return false; + } + if (v0.qtarm() > qtArmenterosMaxForLambda) { + return false; + } + return true; + } + + template + bool isSelectedCascAsOmega(const CascCand& casc) + { + if (casc.mOmega() < massOmegaMin || casc.mOmega() > massOmegaMax) { + return false; + } + if (casc.mLambda() < massLambdaMin || casc.mLambda() > massLambdaMax) { + return false; + } + return true; + } + + void processV0Mc(V0sMcRec const& V0s, + aod::V0MCCores const&, + CollSels const&, + PidTracks const&) + { + for (const auto& v0 : V0s) { + if (isSelectedV0AsK0s(v0) || isSelectedV0AsLambda(v0)) { + int matched = isMatched(v0); + if (matched != aod::pid_studies::Particle::NotMatched) { + fillTree(v0, matched); + } + } + } + } + PROCESS_SWITCH(HfTaskPidStudies, processV0Mc, "Process MC", true); + + void processV0Data(aod::V0Datas const& V0s, + CollSels const&, + PidTracks const&) + { + for (const auto& v0 : V0s) { + if (isSelectedV0AsK0s(v0) || isSelectedV0AsLambda(v0)) { + fillTree(v0, aod::pid_studies::Particle::NotMatched); + } + } + } + PROCESS_SWITCH(HfTaskPidStudies, processV0Data, "Process data", false); + + void processCascMc(CascsMcRec const& cascades, + aod::CascMCCores const&, + CollSels const&, + PidTracks const&) + { + for (const auto& casc : cascades) { + if (isSelectedCascAsOmega(casc)) { + int matched = isMatched(casc); + if (matched != aod::pid_studies::Particle::NotMatched) { + fillTree(casc, matched); + } + } + } + } + PROCESS_SWITCH(HfTaskPidStudies, processCascMc, "Process MC", true); + + void processCascData(aod::CascDatas const& cascades, + CollSels const&, + PidTracks const&) + { + for (const auto& casc : cascades) { + if (isSelectedCascAsOmega(casc)) { + fillTree(casc, aod::pid_studies::Particle::NotMatched); + } + } + } + PROCESS_SWITCH(HfTaskPidStudies, processCascData, "Process data", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/Utils/utilsDerivedData.h b/PWGHF/Utils/utilsDerivedData.h new file mode 100644 index 00000000000..ad3bf57e25e --- /dev/null +++ b/PWGHF/Utils/utilsDerivedData.h @@ -0,0 +1,42 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file utilsDerivedData.h +/// \brief Utilities for derived-data creators +/// \author Vít Kučera , Inha University + +#ifndef PWGHF_UTILS_UTILSDERIVEDDATA_H_ +#define PWGHF_UTILS_UTILSDERIVEDDATA_H_ + +#include + +// Macro to store nSigma for prong _id_ with PID hypothesis _hyp_ in an array +#define GET_N_SIGMA_PRONG(_array_, _candidate_, _id_, _hyp_) \ + _array_[0] = _candidate_.nSigTpc##_hyp_##_id_(); \ + _array_[1] = _candidate_.nSigTof##_hyp_##_id_(); \ + _array_[2] = _candidate_.tpcTofNSigma##_hyp_##_id_(); + +namespace o2::analysis::hf_derived +{ +/// Reserve space in the filled table for all entries in the source table. +/// \param cursor cursor of the filled table +/// \param enabled switch for filling the table +/// \param size size of the source table +template +void reserveTable(T& cursor, const o2::framework::Configurable& enabled, const uint64_t size) +{ + if (enabled.value) { + cursor.reserve(size); + } +}; +} // namespace o2::analysis::hf_derived + +#endif // PWGHF_UTILS_UTILSDERIVEDDATA_H_ diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index d1ffe2038e2..f6f713b9914 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -44,10 +44,13 @@ enum EventRejection { ItsRofBorderCut, IsGoodZvtxFT0vsPV, NoSameBunchPileup, - NumTracksInTimeRange, + Occupancy, NContrib, Chi2, PositionZ, + NoCollInTimeRangeNarrow, + NoCollInTimeRangeStandard, + NoCollInRofStandard, NEventRejection }; @@ -69,10 +72,13 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel hRejection->GetXaxis()->SetBinLabel(EventRejection::ItsRofBorderCut + 1, "ITS ROF border"); hRejection->GetXaxis()->SetBinLabel(EventRejection::IsGoodZvtxFT0vsPV + 1, "PV #it{z} consistency FT0 timing"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoSameBunchPileup + 1, "No same-bunch pile-up"); // POTENTIALLY BAD FOR BEAUTY ANALYSES - hRejection->GetXaxis()->SetBinLabel(EventRejection::NumTracksInTimeRange + 1, "Occupancy"); + hRejection->GetXaxis()->SetBinLabel(EventRejection::Occupancy + 1, "Occupancy"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NContrib + 1, "# of PV contributors"); hRejection->GetXaxis()->SetBinLabel(EventRejection::Chi2 + 1, "PV #it{#chi}^{2}"); hRejection->GetXaxis()->SetBinLabel(EventRejection::PositionZ + 1, "PV #it{z}"); + hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeNarrow + 1, "No coll timerange narrow"); + hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeStandard + 1, "No coll timerange strict"); + hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInRofStandard + 1, "No coll in ROF std"); } struct HfEventSelection : o2::framework::ConfigurableGroup { @@ -87,16 +93,22 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable useItsRofBorderCut{"useItsRofBorderCut", true, "Apply ITS ROF border cut"}; o2::framework::Configurable useIsGoodZvtxFT0vsPV{"useIsGoodZvtxFT0vsPV", false, "Check consistency between PVz from central barrel with that from FT0 timing"}; o2::framework::Configurable useNoSameBunchPileup{"useNoSameBunchPileup", false, "Exclude collisions in bunches with more than 1 reco. PV"}; // POTENTIALLY BAD FOR BEAUTY ANALYSES - o2::framework::Configurable useNumTracksInTimeRange{"useNumTracksInTimeRange", false, "Apply occupancy selection (num. ITS tracks with at least 5 clusters in +-100us from current collision)"}; - o2::framework::Configurable numTracksInTimeRangeMin{"numTracksInTimeRangeMin", 0, "Minimum occupancy"}; - o2::framework::Configurable numTracksInTimeRangeMax{"numTracksInTimeRangeMax", 1000000, "Maximum occupancy"}; + o2::framework::Configurable useOccupancyCut{"useOccupancyCut", false, "Apply occupancy selection (num. ITS tracks with at least 5 clusters or num. of signals in FT0c in +-100us from current collision)"}; + o2::framework::Configurable occEstimator{"occEstimator", 1, "Occupancy estimation (1: ITS, 2: FT0C)"}; + o2::framework::Configurable occupancyMin{"occupancyMin", 0, "Minimum occupancy"}; + o2::framework::Configurable occupancyMax{"occupancyMax", 1000000, "Maximum occupancy"}; o2::framework::Configurable nPvContributorsMin{"nPvContributorsMin", 0, "Minimum number of PV contributors"}; o2::framework::Configurable chi2PvMax{"chi2PvMax", -1.f, "Maximum PV chi2"}; o2::framework::Configurable zPvPosMin{"zPvPosMin", -10.f, "Minimum PV posZ (cm)"}; o2::framework::Configurable zPvPosMax{"zPvPosMax", 10.f, "Maximum PV posZ (cm)"}; + o2::framework::Configurable useNoCollInTimeRangeNarrow{"useNoCollInTimeRangeNarrow", false, "Reject collisions in time range narrow"}; + o2::framework::Configurable useNoCollInTimeRangeStandard{"useNoCollInTimeRangeStandard", false, "Reject collisions in time range strict"}; + o2::framework::Configurable useNoCollInRofStandard{"useNoCollInRofStandard", false, "Reject collisions in ROF standard"}; o2::framework::Configurable softwareTrigger{"softwareTrigger", "", "Label of software trigger. Multiple triggers can be selected dividing them by a comma. Set None if you want bcs that are not selected by any trigger"}; o2::framework::Configurable bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"}; - o2::framework::Configurable ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "Users/m/mpuccio/EventFiltering/OTS/", "ccdb path for ZORRO objects"}; + o2::framework::Configurable ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "Users/m/mpuccio/EventFiltering/OTS/Chunked/", "ccdb path for ZORRO objects"}; + o2::framework::ConfigurableAxis th2ConfigAxisCent{"th2ConfigAxisCent", {100, 0., 100.}, ""}; + o2::framework::ConfigurableAxis th2ConfigAxisOccupancy{"th2ConfigAxisOccupancy", {14, 0, 140000}, ""}; // histogram names static constexpr char nameHistCollisions[] = "hCollisions"; @@ -106,8 +118,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char nameHistPosXAfterEvSel[] = "hPosXAfterEvSel"; static constexpr char nameHistPosYAfterEvSel[] = "hPosYAfterEvSel"; static constexpr char nameHistNumPvContributorsAfterSel[] = "hNumPvContributorsAfterSel"; + static constexpr char nameHistCollisionsCentOcc[] = "hCollisionsCentOcc"; std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel; + std::shared_ptr hCollisionsCentOcc; // util to retrieve trigger mask in case of software triggers Zorro zorro; @@ -127,6 +141,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { hNumPvContributorsAfterSel = registry.add(nameHistNumPvContributorsAfterSel, "selected events;#it{y}_{prim. vtx.} (cm);entries", {o2::framework::HistType::kTH1D, {{500, -0.5, 499.5}}}); setEventRejectionLabels(hCollisions, softwareTrigger); + const o2::framework::AxisSpec th2AxisCent{th2ConfigAxisCent, "Centrality"}; + const o2::framework::AxisSpec th2AxisOccupancy{th2ConfigAxisOccupancy, "Occupancy"}; + hCollisionsCentOcc = registry.add(nameHistCollisionsCentOcc, "selected events;Centrality; Occupancy", {o2::framework::HistType::kTH2D, {th2AxisCent, th2AxisOccupancy}}); + // we initialise the summary object if (softwareTrigger.value != "") { zorroSummary.setObject(zorro.getZorroSummary()); @@ -147,17 +165,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { uint16_t rejectionMask{0}; // 16 bits, in case new ev. selections will be added if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { - if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0A) { - centrality = collision.centFT0A(); - } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) { - centrality = collision.centFT0C(); - } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { - centrality = collision.centFT0M(); - } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FV0A) { - centrality = collision.centFV0A(); - } else { - LOGP(fatal, "Unsupported centrality estimator!"); - } + centrality = getCentrality(collision); if (centrality < centralityMin || centrality > centralityMax) { SETBIT(rejectionMask, EventRejection::Centrality); } @@ -189,11 +197,22 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { if (useNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { SETBIT(rejectionMask, EventRejection::NoSameBunchPileup); } - /// occupancy estimator (ITS tracks with at least 5 clusters in +-10us from current collision) - if (useNumTracksInTimeRange) { - const int numTracksInTimeRange = collision.trackOccupancyInTimeRange(); - if (numTracksInTimeRange < numTracksInTimeRangeMin || numTracksInTimeRange > numTracksInTimeRangeMax) { - SETBIT(rejectionMask, EventRejection::NumTracksInTimeRange); + /// No collisions in time range narrow + if (useNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + SETBIT(rejectionMask, EventRejection::NoCollInTimeRangeNarrow); + } + /// No collisions in time range strict + if (useNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + SETBIT(rejectionMask, EventRejection::NoCollInTimeRangeStandard); + } + /// No collisions in ROF standard + if (useNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + SETBIT(rejectionMask, EventRejection::NoCollInRofStandard); + } + if (useOccupancyCut) { + float occupancy = getOccupancy(collision, occEstimator); + if (occupancy < occupancyMin || occupancy > occupancyMax) { + SETBIT(rejectionMask, EventRejection::Occupancy); } } } @@ -240,11 +259,51 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { return rejectionMask; } + /// Get the occupancy + /// \param collision is the collision with the occupancy information + /// \param occEstimator is the occupancy estimator (1: ITS, 2: FT0C) + template + float getOccupancy(Coll const& collision, int occEstimator = 1) + { + switch (occEstimator) { + case 1: // ITS + return collision.trackOccupancyInTimeRange(); + break; + case 2: // FT0c + return collision.ft0cOccupancyInTimeRange(); + break; + default: + LOG(warning) << "Occupancy estimator not valid. Possible values are ITS or FT0C. Fallback to ITS"; + return collision.trackOccupancyInTimeRange(); + break; + } + } + + /// Get the centrality + /// \param collision is the collision with the centrality information + /// \param centEstimator is the centrality estimator from hf_centrality::CentralityEstimator + template + float getCentrality(Coll const& collision) + { + if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0A) { + return collision.centFT0A(); + } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) { + return collision.centFT0C(); + } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { + return collision.centFT0M(); + } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FV0A) { + return collision.centFV0A(); + } else { + LOG(warning) << "Centrality estimator not valid. Possible values are V0A, T0M, T0A, T0C. Fallback to FT0c"; + return collision.centFT0C(); + } + } + /// \brief Fills histograms for monitoring event selections satisfied by the collision. /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision template - void fillHistograms(Coll const& collision, const uint16_t rejectionMask, float& centrality) + void fillHistograms(Coll const& collision, const uint16_t rejectionMask, float& centrality, float occupancy = -1) { hCollisions->Fill(EventRejection::None); const float posZ = collision.posZ(); @@ -262,6 +321,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { hPosZAfterEvSel->Fill(posZ); hNumPvContributorsAfterSel->Fill(collision.numContrib()); hSelCollisionsCent->Fill(centrality); + hCollisionsCentOcc->Fill(centrality, occupancy); } }; diff --git a/PWGHF/Utils/utilsPid.h b/PWGHF/Utils/utilsPid.h index c0cec3e0ce1..19325426cd6 100644 --- a/PWGHF/Utils/utilsPid.h +++ b/PWGHF/Utils/utilsPid.h @@ -17,15 +17,11 @@ #ifndef PWGHF_UTILS_UTILSPID_H_ #define PWGHF_UTILS_UTILSPID_H_ -namespace o2::aod +namespace o2::aod::pid_tpc_tof_utils { - -namespace pid_tpc_tof_utils -{ - -enum HfProngSpecies : int { Pion = 0, - Kaon, - Proton }; +enum HfProngSpecies : uint8_t { Pion = 0, + Kaon, + Proton }; /// Function to combine TPC and TOF NSigma /// \param tiny switch between full and tiny (binned) PID tables @@ -100,9 +96,6 @@ void fillProngPid(TRK const& track, ROW& rowPid) // fill candidate prong PID rows rowPid(nSigTpc, nSigTof); } - -} // namespace pid_tpc_tof_utils - -} // namespace o2::aod +} // namespace o2::aod::pid_tpc_tof_utils #endif // PWGHF_UTILS_UTILSPID_H_ diff --git a/PWGJE/Core/JetCandidateUtilities.h b/PWGJE/Core/JetCandidateUtilities.h index 43e66f82d66..6c5c0328ef5 100644 --- a/PWGJE/Core/JetCandidateUtilities.h +++ b/PWGJE/Core/JetCandidateUtilities.h @@ -38,7 +38,6 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" -#include "PWGHF/DataModel/DerivedTablesStored.h" #include "PWGJE/Core/FastJetUtilities.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" @@ -374,30 +373,30 @@ float getCandidateInvariantMass(T const& candidate) } template -void fillCandidateCollisionTable(T const& collision, U const& candidates, V& CandiateCollisionTable, int32_t& CandidateCollisionTableIndex) +void fillCandidateCollisionTable(T const& collision, U const& /*candidates*/, V& CandiateCollisionTable, int32_t& CandidateCollisionTableIndex) { if constexpr (jethfutilities::isHFTable
()) { - jethfutilities::fillHFCollisionTable(collision, candidates, CandiateCollisionTable, CandidateCollisionTableIndex); + jethfutilities::fillHFCollisionTable(collision, CandiateCollisionTable, CandidateCollisionTableIndex); } else if constexpr (jetdqutilities::isDielectronTable()) { jetdqutilities::fillDielectronCollisionTable(collision, CandiateCollisionTable, CandidateCollisionTableIndex); // if more dilepton tables are added we would need a fillDQCollisionTable } } template -void fillCandidateMcCollisionTable(T const& mcCollision, U const& candidates, V& CandiateMcCollisionTable, int32_t& CandidateMcCollisionTableIndex) +void fillCandidateMcCollisionTable(T const& mcCollision, U const& /*candidates*/, V& CandiateMcCollisionTable, int32_t& CandidateMcCollisionTableIndex) { if constexpr (jethfutilities::isHFMcTable()) { - jethfutilities::fillHFMcCollisionTable(mcCollision, candidates, CandiateMcCollisionTable, CandidateMcCollisionTableIndex); + jethfutilities::fillHFMcCollisionTable(mcCollision, CandiateMcCollisionTable, CandidateMcCollisionTableIndex); } else if constexpr (jetdqutilities::isDielectronMcTable()) { jetdqutilities::fillDielectronMcCollisionTable(mcCollision, CandiateMcCollisionTable, CandidateMcCollisionTableIndex); } } -template -void fillCandidateTable(T const& candidate, int32_t collisionIndex, U& BaseTable, V& HFParTable, M& HFParETable, N& HFSelectionFlagTable, O& HFMlTable, P& HFMCDTable, int32_t& candidateTableIndex) +template +void fillCandidateTable(T const& candidate, int32_t collisionIndex, U& BaseTable, V& HFParTable, M& HFParETable, N& HFParDaughterTable, O& HFSelectionFlagTable, P& HFMlTable, Q& HFMlDaughterTable, S& HFMCDTable, int32_t& candidateTableIndex) { if constexpr (jethfutilities::isHFCandidate()) { - jethfutilities::fillHFCandidateTable(candidate, collisionIndex, BaseTable, HFParTable, HFParETable, HFSelectionFlagTable, HFMlTable, HFMCDTable, candidateTableIndex); + jethfutilities::fillHFCandidateTable(candidate, collisionIndex, BaseTable, HFParTable, HFParETable, HFParDaughterTable, HFSelectionFlagTable, HFMlTable, HFMlDaughterTable, HFMCDTable, candidateTableIndex); } else if constexpr (jetdqutilities::isDielectronCandidate()) { jetdqutilities::fillDielectronCandidateTable(candidate, collisionIndex, BaseTable, candidateTableIndex); } diff --git a/PWGJE/Core/JetDQUtilities.h b/PWGJE/Core/JetDQUtilities.h index e68a23494f6..91b4c3cdd30 100644 --- a/PWGJE/Core/JetDQUtilities.h +++ b/PWGJE/Core/JetDQUtilities.h @@ -188,11 +188,7 @@ auto slicedPerDielectronCollision(T const& table, U const& /*candidates*/, V con template int getDielectronCandidateCollisionId(T const& candidate) { - if constexpr (isDielectronCandidate()) { - return candidate.reducedeventId(); - } else { - return -1; - } + return candidate.reducedeventId(); } /** @@ -275,11 +271,7 @@ float getDielectronTablePDGMass() template float getDielectronCandidateInvariantMass(T const& candidate) { - if constexpr (isDielectronCandidate()) { - return candidate.mass(); - } else { - return -1.0; - } + return candidate.mass(); } template diff --git a/PWGJE/Core/JetFindingUtilities.h b/PWGJE/Core/JetFindingUtilities.h index 8efd9733e6e..c41bfbd4f0f 100644 --- a/PWGJE/Core/JetFindingUtilities.h +++ b/PWGJE/Core/JetFindingUtilities.h @@ -336,7 +336,7 @@ void findJets(JetFinder& jetFinder, std::vector& inputPartic * @param pdgDatabase database of pdg codes * @param candidate optional hf candidiate */ -template +template void analyseParticles(std::vector& inputParticles, std::string particleSelection, int jetTypeParticleLevel, T const& particles, o2::framework::Service pdgDatabase, std::optional const& candidate = std::nullopt) { for (auto& particle : particles) { @@ -366,9 +366,11 @@ void analyseParticles(std::vector& inputParticles, std::stri if (cand.mcParticleId() == particle.globalIndex()) { continue; } - auto hfParticle = cand.template mcParticle_as(); - if (jetcandidateutilities::isDaughterParticle(hfParticle, particle.globalIndex())) { - continue; + if constexpr (checkIsDaughter) { + auto hfParticle = cand.template mcParticle_as(); + if (jetcandidateutilities::isDaughterParticle(hfParticle, particle.globalIndex())) { + continue; + } } } } diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h index fca1f459fcc..1334d8ad6f6 100644 --- a/PWGJE/Core/JetHFUtilities.h +++ b/PWGJE/Core/JetHFUtilities.h @@ -38,7 +38,6 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" -#include "PWGHF/DataModel/DerivedTablesStored.h" #include "PWGJE/Core/FastJetUtilities.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" @@ -297,7 +296,7 @@ bool isHFDaughterTrack(T& track, U& candidate, V const& /*tracks*/) return false; } } else if constexpr (isBplusCandidate()) { - if (candidate.template prong0_as().template prong0_as().globalIndex() == track.globalIndex() || candidate.template prong0_as().template prong1_as().globalIndex() == track.globalIndex() || candidate.template prong1_as().globalIndex() == track.globalIndex()) { + if (candidate.prong0Id() == track.globalIndex() || candidate.prong1Id() == track.globalIndex() || candidate.prong2Id() == track.globalIndex()) { return true; } else { return false; @@ -383,15 +382,7 @@ auto slicedPerHFCollision(T const& table, U const& /*candidates*/, V const& coll template int getHFCandidateCollisionId(T const& candidate) { - if constexpr (isD0Candidate()) { - return candidate.hfCollBaseId(); - } else if constexpr (isLcCandidate()) { - return candidate.hfCollBaseId(); - } else if constexpr (isBplusCandidate()) { - return candidate.hfCollBaseId(); - } else { - return -1; - } + return candidate.hfCollBaseId(); } /** @@ -402,15 +393,7 @@ int getHFCandidateCollisionId(T const& candidate) template int getHFMcCandidateCollisionId(T const& candidate) { - if constexpr (isD0McCandidate()) { - return candidate.hfMcCollBaseId(); - } else if constexpr (isLcMcCandidate()) { - return candidate.hfMcCollBaseId(); - } else if constexpr (isBplusMcCandidate()) { - return candidate.hfMcCollBaseId(); - } else { - return -1; - } + return candidate.hfMcCollBaseId(); } /** @@ -423,11 +406,9 @@ int getHFCandidatePDG(T const& /*candidate*/) { if constexpr (isD0Candidate() || isD0McCandidate()) { return static_cast(o2::constants::physics::Pdg::kD0); - } - if constexpr (isLcCandidate() || isLcMcCandidate()) { + } else if constexpr (isLcCandidate() || isLcMcCandidate()) { return static_cast(o2::constants::physics::Pdg::kLambdaCPlus); - } - if constexpr (isBplusCandidate() || isBplusMcCandidate()) { + } else if constexpr (isBplusCandidate() || isBplusMcCandidate()) { return static_cast(o2::constants::physics::Pdg::kBPlus); } else { return 0; @@ -442,11 +423,9 @@ int getHFTablePDG() { if constexpr (isD0Table() || isD0McTable()) { return static_cast(o2::constants::physics::Pdg::kD0); - } - if constexpr (isLcTable() || isLcMcTable()) { + } else if constexpr (isLcTable() || isLcMcTable()) { return static_cast(o2::constants::physics::Pdg::kLambdaCPlus); - } - if constexpr (isBplusTable() || isBplusMcTable()) { + } else if constexpr (isBplusTable() || isBplusMcTable()) { return static_cast(o2::constants::physics::Pdg::kBPlus); } else { return 0; @@ -463,11 +442,9 @@ float getHFCandidatePDGMass(T const& /*candidate*/) { if constexpr (isD0Candidate() || isD0McCandidate()) { return static_cast(o2::constants::physics::MassD0); - } - if constexpr (isLcCandidate() || isLcMcCandidate()) { + } else if constexpr (isLcCandidate() || isLcMcCandidate()) { return static_cast(o2::constants::physics::MassLambdaCPlus); - } - if constexpr (isBplusCandidate() || isBplusMcCandidate()) { + } else if constexpr (isBplusCandidate() || isBplusMcCandidate()) { return static_cast(o2::constants::physics::MassBPlus); } else { return -1.0; @@ -483,11 +460,9 @@ float getHFTablePDGMass() { if constexpr (isD0Table() || isD0McTable()) { return static_cast(o2::constants::physics::MassD0); - } - if constexpr (isLcTable() || isLcMcTable()) { + } else if constexpr (isLcTable() || isLcMcTable()) { return static_cast(o2::constants::physics::MassLambdaCPlus); - } - if constexpr (isBplusTable() || isBplusMcTable()) { + } else if constexpr (isBplusTable() || isBplusMcTable()) { return static_cast(o2::constants::physics::MassBPlus); } else { return -1.0; @@ -502,74 +477,26 @@ float getHFTablePDGMass() template float getHFCandidateInvariantMass(T const& candidate) { - if constexpr (isD0Candidate()) { - return candidate.m(); - } - if constexpr (isLcCandidate()) { - return candidate.m(); - } - if constexpr (isBplusCandidate()) { - return candidate.m(); - } else { - return -1.0; - } -} - -template -void fillD0CollisionTable(T const& collision, U& D0CollisionTable, int32_t& D0CollisionTableIndex) -{ - D0CollisionTable(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.centFV0A(), collision.multZeqNTracksPV()); - D0CollisionTableIndex = D0CollisionTable.lastIndex(); + return candidate.m(); } template -void fillLcCollisionTable(T const& collision, U& LcCollisionTable, int32_t& LcCollisionTableIndex) -{ - LcCollisionTable(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.centFV0A(), collision.multZeqNTracksPV()); - LcCollisionTableIndex = LcCollisionTable.lastIndex(); -} - -template -void fillHFCollisionTable(T const& collision, U const& /*candidates*/, V& HFCollisionTable, int32_t& HFCollisionTableIndex) +void fillHFCollisionTable(T const& collision, U& HFCollisionTable, int32_t& HFCollisionTableIndex) { - if constexpr (isD0Table()) { - fillD0CollisionTable(collision, HFCollisionTable, HFCollisionTableIndex); - } - if constexpr (isLcTable()) { - fillLcCollisionTable(collision, HFCollisionTable, HFCollisionTableIndex); - } + HFCollisionTable(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.centFV0A(), collision.multZeqNTracksPV()); + HFCollisionTableIndex = HFCollisionTable.lastIndex(); } template -void fillD0McCollisionTable(T const& mcCollision, U& D0McCollisionTable, int32_t& D0McCollisionTableIndex) -{ - D0McCollisionTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()); - D0McCollisionTableIndex = D0McCollisionTable.lastIndex(); -} - -template -void fillLcMcCollisionTable(T const& mcCollision, U& LcMcCollisionTable, int32_t& LcMcCollisionTableIndex) -{ - LcMcCollisionTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()); - LcMcCollisionTableIndex = LcMcCollisionTable.lastIndex(); -} - -template -void fillHFMcCollisionTable(T const& mcCollision, U const& /*candidates*/, V& HFMcCollisionTable, int32_t& HFMcCollisionTableIndex) +void fillHFMcCollisionTable(T const& mcCollision, U& HFMcCollisionTable, int32_t& HFMcCollisionTableIndex) { - if constexpr (isD0McTable()) { - fillD0McCollisionTable(mcCollision, HFMcCollisionTable, HFMcCollisionTableIndex); - } - if constexpr (isLcMcTable()) { - fillLcMcCollisionTable(mcCollision, HFMcCollisionTable, HFMcCollisionTableIndex); - } + HFMcCollisionTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.centFT0M()); + HFMcCollisionTableIndex = HFMcCollisionTable.lastIndex(); } -template -void fillD0CandidateTable(T const& candidate, int32_t collisionIndex, U& D0BaseTable, V& D0ParTable, M& D0ParETable, N& D0SelectionFlagTable, O& D0MlTable, P& D0MCDTable, int32_t& D0CandidateTableIndex) +template +void fillD0CandidateTable(T const& candidate, U& D0ParTable, V& D0ParETable, M& D0MlTable, N& D0MCDTable) { - D0BaseTable(collisionIndex, candidate.pt(), candidate.eta(), candidate.phi(), candidate.m(), candidate.y()); - D0ParTable( candidate.chi2PCA(), candidate.cpa(), @@ -620,23 +547,19 @@ void fillD0CandidateTable(T const& candidate, int32_t collisionIndex, U& D0BaseT candidate.cosThetaStar(), candidate.ct()); - D0SelectionFlagTable(candidate.candidateSelFlag()); - if constexpr (isMc) { - D0MCDTable(candidate.flagMcMatchRec(), candidate.originMcRec()); - } - std::vector mlScoresVector; auto mlScoresSpan = candidate.mlScores(); std::copy(mlScoresSpan.begin(), mlScoresSpan.end(), std::back_inserter(mlScoresVector)); D0MlTable(mlScoresVector); - D0CandidateTableIndex = D0BaseTable.lastIndex(); + if constexpr (isMc) { + D0MCDTable(candidate.flagMcMatchRec(), candidate.originMcRec()); + } } -template -void fillLcCandidateTable(T const& candidate, int32_t collisionIndex, U& LcBaseTable, V& LcParTable, M& LcParETable, N& LcSelectionFlagTable, O& LcMlTable, P& LcMCDTable, int32_t& LcCandidateTableIndex) +template +void fillLcCandidateTable(T const& candidate, U& LcParTable, V& LcParETable, M& LcMlTable, N& LcMCDTable) { - LcBaseTable(collisionIndex, candidate.pt(), candidate.eta(), candidate.phi(), candidate.m(), candidate.y()); LcParTable( candidate.chi2PCA(), @@ -696,52 +619,115 @@ void fillLcCandidateTable(T const& candidate, int32_t collisionIndex, U& LcBaseT candidate.errorImpactParameter2(), candidate.ct()); - LcSelectionFlagTable(candidate.candidateSelFlag()); - if constexpr (isMc) { - LcMCDTable(candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.isCandidateSwapped()); - } - std::vector mlScoresVector; auto mlScoresSpan = candidate.mlScores(); std::copy(mlScoresSpan.begin(), mlScoresSpan.end(), std::back_inserter(mlScoresVector)); LcMlTable(mlScoresVector); - LcCandidateTableIndex = LcBaseTable.lastIndex(); + if constexpr (isMc) { + LcMCDTable(candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.isCandidateSwapped()); + } } +// need to update this template -void fillHFCandidateTable(T const& candidate, int32_t collisionIndex, U& HFBaseTable, V& HFParTable, M& HFParETable, N& HFSelectionFlagTable, O& HFMlTable, P& HFMCDTable, int32_t& HFCandidateTableIndex) +void fillBplusCandidateTable(T const& candidate, U& BplusParTable, V& BplusParETable, M& BplusParD0Table, N& BplusMlTable, O& BplusMlD0Table, P& BplusMCDTable) { - if constexpr (isD0Candidate()) { - fillD0CandidateTable(candidate, collisionIndex, HFBaseTable, HFParTable, HFParETable, HFSelectionFlagTable, HFMlTable, HFMCDTable, HFCandidateTableIndex); - } - if constexpr (isLcCandidate()) { - fillLcCandidateTable(candidate, collisionIndex, HFBaseTable, HFParTable, HFParETable, HFSelectionFlagTable, HFMlTable, HFMCDTable, HFCandidateTableIndex); + + BplusParTable( + candidate.chi2PCA(), + candidate.cpa(), + candidate.cpaXY(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameterNormalised0(), + candidate.impactParameterNormalised1(), + candidate.nSigTpcPiExpPi(), + candidate.nSigTofPiExpPi(), + candidate.nSigTpcTofPiExpPi(), + candidate.nSigTpcKaExpPi(), + candidate.nSigTofKaExpPi(), + candidate.nSigTpcTofKaExpPi(), + candidate.maxNormalisedDeltaIP(), + candidate.impactParameterProduct()); + + BplusParETable( + candidate.xSecondaryVertex(), + candidate.ySecondaryVertex(), + candidate.zSecondaryVertex(), + candidate.errorDecayLength(), + candidate.errorDecayLengthXY(), + candidate.rSecondaryVertex(), + candidate.pProng1(), + candidate.pxProng1(), + candidate.pyProng1(), + candidate.pzProng1(), + candidate.errorImpactParameter1(), + candidate.cosThetaStar(), + candidate.ct()); + + BplusParD0Table( + candidate.cpaCharm(), + candidate.decayLengthCharm(), + candidate.impactParameter0Charm(), + candidate.impactParameter1Charm(), + candidate.impactParameterProductCharm(), + candidate.nSigTpcPiExpPiCharm(), + candidate.nSigTofPiExpPiCharm(), + candidate.nSigTpcTofPiExpPiCharm(), + candidate.nSigTpcKaExpPiCharm(), + candidate.nSigTofKaExpPiCharm(), + candidate.nSigTpcTofKaExpPiCharm(), + candidate.nSigTpcPiExpKaCharm(), + candidate.nSigTofPiExpKaCharm(), + candidate.nSigTpcTofPiExpKaCharm(), + candidate.nSigTpcKaExpKaCharm(), + candidate.nSigTofKaExpKaCharm(), + candidate.nSigTpcTofKaExpKaCharm()); + + // BplusSelectionFlagTable(candidate.candidateSelFlag()); + + BplusMlTable(candidate.mlScoreSig()); + + std::vector mlScoresCharmVector; + auto mlScoresCharmSpan = candidate.mlScoresCharm(); + std::copy(mlScoresCharmSpan.begin(), mlScoresCharmSpan.end(), std::back_inserter(mlScoresCharmVector)); + BplusMlD0Table(mlScoresCharmVector); + + if constexpr (isMc) { + BplusMCDTable(candidate.flagMcMatchRec(), candidate.originMcRec()); } } -template -void fillD0CandidateMcTable(T const& candidate, int32_t mcCollisionIndex, U& D0PBaseTable, int32_t& D0CandidateTableIndex) -{ - D0PBaseTable(mcCollisionIndex, candidate.pt(), candidate.eta(), candidate.phi(), candidate.y(), candidate.flagMcMatchGen(), candidate.originMcGen()); - D0CandidateTableIndex = D0PBaseTable.lastIndex(); -} -template -void fillLcCandidateMcTable(T const& candidate, int32_t mcCollisionIndex, U& LcPBaseTable, int32_t& LcCandidateTableIndex) +template +void fillHFCandidateTable(T const& candidate, int32_t collisionIndex, U& HFBaseTable, V& HFParTable, M& HFParETable, N& HFParDaughterTable, O& HFSelectionFlagTable, P& HFMlTable, Q& HFMlDaughterTable, S& HFMCDTable, int32_t& HFCandidateTableIndex) { - LcPBaseTable(mcCollisionIndex, candidate.pt(), candidate.eta(), candidate.phi(), candidate.y(), candidate.flagMcMatchGen(), candidate.originMcGen()); - LcCandidateTableIndex = LcPBaseTable.lastIndex(); + HFBaseTable(collisionIndex, candidate.pt(), candidate.eta(), candidate.phi(), candidate.m(), candidate.y()); + HFCandidateTableIndex = HFBaseTable.lastIndex(); + HFSelectionFlagTable(candidate.candidateSelFlag()); + + if constexpr (isD0Candidate()) { + fillD0CandidateTable(candidate, HFParTable, HFParETable, HFMlTable, HFMCDTable); + } + if constexpr (isLcCandidate()) { + fillLcCandidateTable(candidate, HFParTable, HFParETable, HFMlTable, HFMCDTable); + } + if constexpr (isBplusCandidate()) { + fillBplusCandidateTable(candidate, HFParTable, HFParETable, HFParDaughterTable, HFMlTable, HFMlDaughterTable, HFMCDTable); + } } template void fillHFCandidateMcTable(T const& candidate, int32_t mcCollisionIndex, U& BaseMcTable, int32_t& candidateTableIndex) { - if constexpr (isD0McCandidate()) { - fillD0CandidateMcTable(candidate, mcCollisionIndex, BaseMcTable, candidateTableIndex); - } - if constexpr (isLcMcCandidate()) { - fillLcCandidateMcTable(candidate, mcCollisionIndex, BaseMcTable, candidateTableIndex); - } + BaseMcTable(mcCollisionIndex, candidate.pt(), candidate.eta(), candidate.phi(), candidate.y(), candidate.flagMcMatchGen(), candidate.originMcGen()); + candidateTableIndex = BaseMcTable.lastIndex(); } }; // namespace jethfutilities diff --git a/PWGJE/Core/JetMatchingUtilities.h b/PWGJE/Core/JetMatchingUtilities.h index 559a4a6c59e..90885ca737a 100644 --- a/PWGJE/Core/JetMatchingUtilities.h +++ b/PWGJE/Core/JetMatchingUtilities.h @@ -473,7 +473,7 @@ auto getConstituents(T const& jet, U const& /*constituents*/) if constexpr (jetfindingutilities::isEMCALClusterTable()) { return jet.template clusters_as(); } else if constexpr (jetfindingutilities::isDummyTable()) { // this is for the case where EMCal clusters are tested but no clusters exist, like in the case of charged jet analyses - return NULL; + return nullptr; } else { return jet.template tracks_as(); } diff --git a/PWGJE/Core/JetTaggingUtilities.h b/PWGJE/Core/JetTaggingUtilities.h index d6a4ee8f32b..c607a44c6da 100644 --- a/PWGJE/Core/JetTaggingUtilities.h +++ b/PWGJE/Core/JetTaggingUtilities.h @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "TF1.h" #include "Framework/Logger.h" @@ -137,12 +139,13 @@ int jetTrackFromHFShower(T const& jet, U const& /*tracks*/, V const& particles, bool hasMcParticle = false; int origin = -1; for (auto& track : jet.template tracks_as()) { + hftrack = track; // for init if origin is 1 or 2, the track is not hftrack if (!track.has_mcParticle()) { continue; } hasMcParticle = true; auto const& particle = track.template mcParticle_as(); - origin = RecoDecay::getCharmHadronOrigin(particles, particle, searchUpToQuark); + origin = RecoDecay::getParticleOrigin(particles, particle, searchUpToQuark); if (origin == 1 || origin == 2) { // 1=charm , 2=beauty hftrack = track; if (origin == 1) { @@ -153,6 +156,7 @@ int jetTrackFromHFShower(T const& jet, U const& /*tracks*/, V const& particles, } } } + if (hasMcParticle) { return JetTaggingSpecies::lightflavour; } else { @@ -173,7 +177,8 @@ int jetParticleFromHFShower(T const& jet, U const& particles, typename U::iterat int origin = -1; for (const auto& particle : jet.template tracks_as()) { - origin = RecoDecay::getCharmHadronOrigin(particles, particle, searchUpToQuark); + hfparticle = particle; // for init if origin is 1 or 2, the particle is not hfparticle + origin = RecoDecay::getParticleOrigin(particles, particle, searchUpToQuark); if (origin == 1 || origin == 2) { // 1=charm , 2=beauty hfparticle = particle; if (origin == 1) { @@ -626,6 +631,177 @@ bool isTaggedJetSV(T const jet, U const& /*prongs*/, float const& prongChi2PCAMi return true; } +/** + * Clusters jet constituent tracks into groups of tracks originating from same mcParticle position (trkVtxIndex), and finds each track origin (trkOrigin). (for GNN b-jet tagging) + * @param trkLabels Track labels for GNN vertex and track origin predictions. trkVtxIndex: The index value of each vertex (cluster) which is determined by the function. trkOrigin: The category of the track origin (0: not physical primary, 1: charm, 2: beauty, 3: primary vertex, 4: other secondary vertex). + * @param vtxResParam Vertex resolution parameter which determines the cluster size. (cm) + * @param trackPtMin Minimum value of track pT. + * @return The number of vertices (clusters) in the jet. + */ +template +int vertexClustering(AnyCollision const& collision, AnalysisJet const& jet, AnyTracks const&, AnyParticles const& particles, AnyOriginalParticles const&, std::unordered_map>& trkLabels, bool searchUpToQuark, float vtxResParam = 0.01 /* 0.01cm = 100um */, float trackPtMin = 0.5) +{ + const auto& tracks = jet.template tracks_as(); + const int n_trks = tracks.size(); + + // trkVtxIndex + + std::vector tempTrkVtxIndex; + + int i = 0; + for (const auto& constituent : tracks) { + if (!constituent.has_mcParticle() || !constituent.template mcParticle_as().isPhysicalPrimary() || constituent.pt() < trackPtMin) + tempTrkVtxIndex.push_back(-1); + else + tempTrkVtxIndex.push_back(i++); + } + tempTrkVtxIndex.push_back(i); // temporary index for PV + if (n_trks < 1) { // the process should be done for n_trks == 1 as well + trkLabels["trkVtxIndex"] = tempTrkVtxIndex; + return n_trks; + } + + int n_pos = n_trks + 1; + std::vector dists(n_pos * (n_pos - 1) / 2); + auto trk_pair_idx = [n_pos](int ti, int tj) { + if (ti == tj || ti >= n_pos || tj >= n_pos || ti < 0 || tj < 0) { + LOGF(info, "Track pair index out of range"); + return -1; + } else { + return (ti < tj) ? (ti * n_pos - (ti * (ti + 1)) / 2 + tj - ti - 1) : (tj * n_pos - (tj * (tj + 1)) / 2 + ti - tj - 1); + } + }; // index n_trks is for PV + + for (int ti = 0; ti < n_pos - 1; ti++) + for (int tj = ti + 1; tj < n_pos; tj++) { + std::array posi, posj; + + if (tj < n_trks) { + if (tracks[tj].has_mcParticle()) { + const auto& pj = tracks[tj].template mcParticle_as().template mcParticle_as(); + posj = std::array{pj.vx(), pj.vy(), pj.vz()}; + } else { + dists[trk_pair_idx(ti, tj)] = std::numeric_limits::max(); + continue; + } + } else { + posj = std::array{collision.posX(), collision.posY(), collision.posZ()}; + } + + if (tracks[ti].has_mcParticle()) { + const auto& pi = tracks[ti].template mcParticle_as().template mcParticle_as(); + posi = std::array{pi.vx(), pi.vy(), pi.vz()}; + } else { + dists[trk_pair_idx(ti, tj)] = std::numeric_limits::max(); + continue; + } + + dists[trk_pair_idx(ti, tj)] = RecoDecay::distance(posi, posj); + } + + int clusteri = -1, clusterj = -1; + float min_min_dist = -1.f; // If there is an not-merge-able min_dist pair, check the 2nd-min_dist pair. + while (true) { + + float min_dist = -1.f; // Get min_dist pair + for (int ti = 0; ti < n_pos - 1; ti++) + for (int tj = ti + 1; tj < n_pos; tj++) + if (tempTrkVtxIndex[ti] != tempTrkVtxIndex[tj] && tempTrkVtxIndex[ti] >= 0 && tempTrkVtxIndex[tj] >= 0) { + float dist = dists[trk_pair_idx(ti, tj)]; + if ((dist < min_dist || min_dist < 0.f) && dist > min_min_dist) { + min_dist = dist; + clusteri = ti; + clusterj = tj; + } + } + if (clusteri < 0 || clusterj < 0) + break; + + bool mrg = true; // Merge-ability check + for (int ti = 0; ti < n_pos && mrg; ti++) + if (tempTrkVtxIndex[ti] == tempTrkVtxIndex[clusteri] && tempTrkVtxIndex[ti] >= 0) { + for (int tj = 0; tj < n_pos && mrg; tj++) + if (tj != ti && tempTrkVtxIndex[tj] == tempTrkVtxIndex[clusterj] && tempTrkVtxIndex[tj] >= 0) { + if (dists[trk_pair_idx(ti, tj)] > vtxResParam) { // If there is more distant pair compared to vtx_res between two clusters, they cannot be merged. + mrg = false; + min_min_dist = min_dist; + } + } + } + if (min_dist > vtxResParam || min_dist < 0.f) + break; + + if (mrg) { // Merge two clusters + int old_index = tempTrkVtxIndex[clusterj]; + for (int t = 0; t < n_pos; t++) + if (tempTrkVtxIndex[t] == old_index) + tempTrkVtxIndex[t] = tempTrkVtxIndex[clusteri]; + } + } + + int n_vertices = 0; + + // Sort the indices from PV (as 0) to the most distant SV (as 1~). + int idxPV = tempTrkVtxIndex[n_trks]; + for (int t = 0; t < n_trks; t++) + if (tempTrkVtxIndex[t] == idxPV) { + tempTrkVtxIndex[t] = -2; + n_vertices = 1; // There is a track originating from PV + } + + std::unordered_map avgDistances; + std::unordered_map count; + for (int t = 0; t < n_trks; t++) { + if (tempTrkVtxIndex[t] >= 0) { + avgDistances[tempTrkVtxIndex[t]] += dists[trk_pair_idx(t, n_trks)]; + count[tempTrkVtxIndex[t]]++; + } + } + + trkLabels["trkVtxIndex"] = std::vector(n_trks, -1); + if (count.size() != 0) { // If there is any SV cluster not only PV cluster + for (auto& [idx, avgDistance] : avgDistances) + avgDistance /= count[idx]; + + n_vertices += avgDistances.size(); + + std::vector> sortedIndices(avgDistances.begin(), avgDistances.end()); + std::sort(sortedIndices.begin(), sortedIndices.end(), [](const auto& a, const auto& b) { return a.second < b.second; }); + int rank = 1; + for (const auto& [idx, avgDistance] : sortedIndices) { + bool found = false; + for (int t = 0; t < n_trks; t++) + if (tempTrkVtxIndex[t] == idx) { + trkLabels["trkVtxIndex"][t] = rank; + found = true; + } + rank += found; + } + } + + for (int t = 0; t < n_trks; t++) + if (tempTrkVtxIndex[t] == -2) + trkLabels["trkVtxIndex"][t] = 0; + + // trkOrigin + + int trkIdx = 0; + for (auto& constituent : jet.template tracks_as()) { + if (!constituent.has_mcParticle() || !constituent.template mcParticle_as().isPhysicalPrimary() || constituent.pt() < trackPtMin) { + trkLabels["trkOrigin"].push_back(0); + } else { + const auto& particle = constituent.template mcParticle_as(); + int orig = RecoDecay::getParticleOrigin(particles, particle, searchUpToQuark); + trkLabels["trkOrigin"].push_back((orig > 0) ? orig : (trkLabels["trkVtxIndex"][trkIdx] == 0) ? 3 + : 4); + } + + trkIdx++; + } + + return n_vertices; +} + }; // namespace jettaggingutilities #endif // PWGJE_CORE_JETTAGGINGUTILITIES_H_ diff --git a/PWGJE/DataModel/EMCALClusterDefinition.h b/PWGJE/DataModel/EMCALClusterDefinition.h index d3480c29366..ead4a14dde7 100644 --- a/PWGJE/DataModel/EMCALClusterDefinition.h +++ b/PWGJE/DataModel/EMCALClusterDefinition.h @@ -9,11 +9,9 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// Class for the cluster definition, i.e. what is considered a cluster by the clusterizer. -// The cluster definition contains information about the used algorithm, seed threshold, -// cell energy, gradient as well as timing cut -// -/// \author Florian Jonas +/// \file EMCALClusterDefinition.h +/// \brief Class for the cluster definition, i.e. what is considered a cluster by the clusterizer. The cluster definition contains information about the used algorithm, seed threshold, cell energy, gradient as well as timing cut +/// \author Florian Jonas , Marvin Hemmer #ifndef PWGJE_DATAMODEL_EMCALCLUSTERDEFINITION_H_ #define PWGJE_DATAMODEL_EMCALCLUSTERDEFINITION_H_ @@ -38,15 +36,17 @@ struct EMCALClusterDefinition { std::string name = "kUndefined"; // name of the cluster definition double seedEnergy = 0.1; // seed threshold (GeV) double minCellEnergy = 0.05; // minimum cell energy (GeV) - double timeMin = -10000; // minimum time (ns) - double timeMax = 10000; // maximum time (ns) + double timeMin = -10000.; // minimum time (ns) + double timeMax = 10000.; // maximum time (ns) + double timeDiff = 20000.; // maximum time difference (ns) between seed cell and aggregation cell bool doGradientCut = true; // apply gradient cut if true double gradientCut = -1; // gradient cut + bool recalcShowerShape5x5 = false; // recalculate shower shape using 5x5 cells // default constructor EMCALClusterDefinition() = default; // constructor - EMCALClusterDefinition(ClusterAlgorithm_t pAlgorithm, int pStorageID, int pSelectedCellType, std::string pName, double pSeedEnergy, double pMinCellEnergy, double pTimeMin, double pTimeMax, bool pDoGradientCut, double pGradientCut) + EMCALClusterDefinition(ClusterAlgorithm_t pAlgorithm, int pStorageID, int pSelectedCellType, std::string pName, double pSeedEnergy, double pMinCellEnergy, double pTimeMin, double pTimeMax, double ptimeDiff, bool pDoGradientCut, double pGradientCut, bool precalcShowerShape5x5) { algorithm = pAlgorithm; storageID = pStorageID; @@ -56,14 +56,16 @@ struct EMCALClusterDefinition { minCellEnergy = pMinCellEnergy; timeMin = pTimeMin; timeMax = pTimeMax; + timeDiff = ptimeDiff; doGradientCut = pDoGradientCut; gradientCut = pGradientCut; + recalcShowerShape5x5 = precalcShowerShape5x5; } // implement comparison operators for int std::string and ClusterAlgorithm_t bool operator==(const EMCALClusterDefinition& rhs) const { - return (algorithm == rhs.algorithm && storageID == rhs.storageID && name == rhs.name && seedEnergy == rhs.seedEnergy && minCellEnergy == rhs.minCellEnergy && timeMin == rhs.timeMin && timeMax == rhs.timeMax && gradientCut == rhs.gradientCut && doGradientCut == rhs.doGradientCut); + return (algorithm == rhs.algorithm && storageID == rhs.storageID && name == rhs.name && seedEnergy == rhs.seedEnergy && minCellEnergy == rhs.minCellEnergy && timeMin == rhs.timeMin && timeMax == rhs.timeMax && timeDiff == rhs.timeDiff && gradientCut == rhs.gradientCut && doGradientCut == rhs.doGradientCut && recalcShowerShape5x5 == rhs.recalcShowerShape5x5); } bool operator!=(const EMCALClusterDefinition& rhs) const { diff --git a/PWGJE/DataModel/EMCALClusters.h b/PWGJE/DataModel/EMCALClusters.h index 34c2888f338..1981fd635aa 100644 --- a/PWGJE/DataModel/EMCALClusters.h +++ b/PWGJE/DataModel/EMCALClusters.h @@ -9,8 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// Table definitions for EMCAL analysis clusters -// +/// \file EMCALClusters.h +/// \brief Table definitions for EMCAL analysis clusters /// \author Raymond Ehlers , ORNL #ifndef PWGJE_DATAMODEL_EMCALCLUSTERS_H_ @@ -27,38 +27,64 @@ namespace emcalcluster { // define global cluster definitions -// the V1 algorithm is not yet implemented, but the V3 algorithm is // New definitions should be added here! -const EMCALClusterDefinition kV1Default(ClusterAlgorithm_t::kV1, 0, 1, "kV1Default", 0.5, 0.1, -10000, 10000, true, 0.03); // dummy -const EMCALClusterDefinition kV1Variation1(ClusterAlgorithm_t::kV3, 1, 1, "kV1Variation1", 0.3, 0.1, -10000, 10000, true, 0.03); // dummy -const EMCALClusterDefinition kV1Variation2(ClusterAlgorithm_t::kV3, 2, 1, "kV1Variation2", 0.2, 0.1, -10000, 10000, true, 0.03); // dummy -const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.5, 0.1, -10000, 10000, true, 0.03); -const EMCALClusterDefinition kV3Variation1(ClusterAlgorithm_t::kV3, 11, 1, "kV3Variation1", 0.5, 0.1, -10000, 10000, true, 0.); -const EMCALClusterDefinition kV3Variation2(ClusterAlgorithm_t::kV3, 12, 1, "kV3Variation2", 0.5, 0.1, -10000, 10000, false, 0.); -const EMCALClusterDefinition kV3Variation3(ClusterAlgorithm_t::kV3, 13, 1, "kV3Variation3", 0.5, 0.1, -10000, 10000, true, 20.); -const EMCALClusterDefinition kV3LowSeed(ClusterAlgorithm_t::kV3, 14, 1, "kV3LowSeed", 0.3, 0.1, -10000, 10000, false, 0.); +const EMCALClusterDefinition kV3NoSplit(ClusterAlgorithm_t::kV3, 0, 1, "kV3NoSplit", 0.5, 0.1, -10000, 10000, 20000, false, 0., false); +const EMCALClusterDefinition kV3NoSplitLowSeed(ClusterAlgorithm_t::kV3, 1, 1, "kV3NoSplitLowSeed", 0.3, 0.1, -10000, 10000, 20000, false, 0., false); +const EMCALClusterDefinition kV3NoSplitLowerSeed(ClusterAlgorithm_t::kV3, 2, 1, "kV3NoSplitLowerSeed", 0.2, 0.1, -10000, 10000, 20000, false, 0., false); +const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.5, 0.1, -10000, 10000, 20000, true, 0.03, false); +const EMCALClusterDefinition kV3MostSplit(ClusterAlgorithm_t::kV3, 11, 1, "kV3MostSplit", 0.5, 0.1, -10000, 10000, 20000, true, 0., false); +const EMCALClusterDefinition kV3LowSeed(ClusterAlgorithm_t::kV3, 12, 1, "kV3LowSeed", 0.3, 0.1, -10000, 10000, 20000, true, 0.03, false); +const EMCALClusterDefinition kV3MostSplitLowSeed(ClusterAlgorithm_t::kV3, 13, 1, "kV3MostSplitLowSeed", 0.3, 0.1, -10000, 10000, 20000, true, 0., false); +const EMCALClusterDefinition kV3StrictTime(ClusterAlgorithm_t::kV3, 20, 1, "kV3StrictTime", 0.5, 0.1, -500, 500, 20000, true, 0.03, false); +const EMCALClusterDefinition kV3StricterTime(ClusterAlgorithm_t::kV3, 21, 1, "kV3StricterTime", 0.5, 0.1, -100, 100, 20000, true, 0.03, false); +const EMCALClusterDefinition kV3MostStrictTime(ClusterAlgorithm_t::kV3, 22, 1, "kV3MostStrictTime", 0.5, 0.1, -50, 50, 20000, true, 0.03, false); +const EMCALClusterDefinition kV3Default5x5(ClusterAlgorithm_t::kV3, 30, 1, "kV3Default5x5", 0.5, 0.1, -10000, 10000, 20000, true, 0.03, true); +const EMCALClusterDefinition kV3SmallTimeDiff(ClusterAlgorithm_t::kV3, 40, 1, "kV3SmallTimeDiff", 0.5, 0.1, -10000, 10000, 500, true, 0.03, false); +const EMCALClusterDefinition kV3SmallerTimeDiff(ClusterAlgorithm_t::kV3, 41, 1, "kV3SmallerTimeDiff", 0.5, 0.1, -10000, 10000, 100, true, 0.03, false); +const EMCALClusterDefinition kV3SmallestTimeDiff(ClusterAlgorithm_t::kV3, 42, 1, "kV3SmallestTimeDiff", 0.5, 0.1, -10000, 10000, 50, true, 0.03, false); +const EMCALClusterDefinition kV3MostSplitSmallTimeDiff(ClusterAlgorithm_t::kV3, 43, 1, "kV3MostSplitSmallTimeDiff", 0.5, 0.1, -10000, 10000, 500, true, 0., false); +const EMCALClusterDefinition kV3MostSplitSmallerTimeDiff(ClusterAlgorithm_t::kV3, 44, 1, "kV3MostSplitSmallerTimeDiff", 0.5, 0.1, -10000, 10000, 100, true, 0., false); +const EMCALClusterDefinition kV3MostSplitSmallestTimeDiff(ClusterAlgorithm_t::kV3, 45, 1, "kV3MostSplitSmallestTimeDiff", 0.5, 0.1, -10000, 10000, 50, true, 0., false); /// \brief function returns EMCALClusterDefinition for the given name /// \param name name of the cluster definition /// \return EMCALClusterDefinition for the given name const EMCALClusterDefinition getClusterDefinitionFromString(const std::string& clusterDefinitionName) { - if (clusterDefinitionName == "kV1Default") { - return kV1Default; - } else if (clusterDefinitionName == "kV1Variation1") { - return kV1Variation1; - } else if (clusterDefinitionName == "kV1Variation2") { - return kV1Variation2; + if (clusterDefinitionName == "kV3NoSplit") { + return kV3NoSplit; + } else if (clusterDefinitionName == "kV3NoSplitLowSeed") { + return kV3NoSplitLowSeed; + } else if (clusterDefinitionName == "kV3NoSplitLowerSeed") { + return kV3NoSplitLowerSeed; } else if (clusterDefinitionName == "kV3Default") { return kV3Default; - } else if (clusterDefinitionName == "kV3Variation1") { - return kV3Variation1; - } else if (clusterDefinitionName == "kV3Variation2") { - return kV3Variation2; - } else if (clusterDefinitionName == "kV3Variation3") { - return kV3Variation3; + } else if (clusterDefinitionName == "kV3MostSplit") { + return kV3MostSplit; } else if (clusterDefinitionName == "kV3LowSeed") { return kV3LowSeed; + } else if (clusterDefinitionName == "kV3MostSplitLowSeed") { + return kV3MostSplitLowSeed; + } else if (clusterDefinitionName == "kV3StrictTime") { + return kV3StrictTime; + } else if (clusterDefinitionName == "kV3StricterTime") { + return kV3StricterTime; + } else if (clusterDefinitionName == "kV3MostStrictTime") { + return kV3MostStrictTime; + } else if (clusterDefinitionName == "kV3Default5x5") { + return kV3Default5x5; + } else if (clusterDefinitionName == "kV3SmallTimeDiff") { + return kV3SmallTimeDiff; + } else if (clusterDefinitionName == "kV3SmallerTimeDiff") { + return kV3SmallerTimeDiff; + } else if (clusterDefinitionName == "kV3SmallestTimeDiff") { + return kV3SmallestTimeDiff; + } else if (clusterDefinitionName == "kV3MostSplitSmallTimeDiff") { + return kV3MostSplitSmallTimeDiff; + } else if (clusterDefinitionName == "kV3MostSplitSmallerTimeDiff") { + return kV3MostSplitSmallerTimeDiff; + } else if (clusterDefinitionName == "kV3MostSplitSmallestTimeDiff") { + return kV3MostSplitSmallestTimeDiff; } else { throw std::invalid_argument("Cluster definition name not recognized"); } diff --git a/PWGJE/DataModel/GammaJetAnalysisTree.h b/PWGJE/DataModel/GammaJetAnalysisTree.h index beb927f381c..7d468a339e7 100644 --- a/PWGJE/DataModel/GammaJetAnalysisTree.h +++ b/PWGJE/DataModel/GammaJetAnalysisTree.h @@ -31,9 +31,10 @@ DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); DECLARE_SOA_COLUMN(Rho, rho, float); DECLARE_SOA_COLUMN(EventSel, eventSel, uint8_t); +DECLARE_SOA_COLUMN(Occupancy, occupancy, int); DECLARE_SOA_BITMAP_COLUMN(Alias, alias, 32); } // namespace gjevent -DECLARE_SOA_TABLE(GjEvents, "AOD", "GJEVENT", o2::soa::Index<>, gjevent::Multiplicity, gjevent::Centrality, gjevent::Rho, gjevent::EventSel, gjevent::Alias) +DECLARE_SOA_TABLE(GjEvents, "AOD", "GJEVENT", o2::soa::Index<>, gjevent::Multiplicity, gjevent::Centrality, gjevent::Rho, gjevent::EventSel, gjevent::Occupancy, gjevent::Alias) using GjEvent = GjEvents::iterator; @@ -41,6 +42,7 @@ namespace gjgamma { DECLARE_SOA_INDEX_COLUMN(GjEvent, gjevent); //! event index DECLARE_SOA_COLUMN(Energy, energy, float); //! cluster energy (GeV) +DECLARE_SOA_COLUMN(Definition, definition, int); //! cluster definition, see EMCALClusterDefinition.h DECLARE_SOA_COLUMN(Eta, eta, float); //! cluster pseudorapidity (calculated using vertex) DECLARE_SOA_COLUMN(Phi, phi, float); //! cluster azimuthal angle (calculated using vertex) DECLARE_SOA_COLUMN(M02, m02, float); //! shower shape long axis @@ -57,19 +59,22 @@ DECLARE_SOA_COLUMN(TMdeltaEta, tmdeltaeta, float); //! delta DECLARE_SOA_COLUMN(TMtrackP, tmtrackp, float); //! track momentum of closest match, -1 if no match found } // namespace gjgamma DECLARE_SOA_TABLE(GjGammas, "AOD", "GJGAMMA", - gjgamma::GjEventId, gjgamma::Energy, gjgamma::Eta, gjgamma::Phi, gjgamma::M02, gjgamma::M20, gjgamma::NCells, gjgamma::Time, gjgamma::IsExotic, gjgamma::DistanceToBadChannel, gjgamma::NLM, gjgamma::IsoRaw, gjgamma::PerpConeRho, gjgamma::TMdeltaPhi, gjgamma::TMdeltaEta, gjgamma::TMtrackP) + gjgamma::GjEventId, gjgamma::Energy, gjgamma::Definition, gjgamma::Eta, gjgamma::Phi, gjgamma::M02, gjgamma::M20, gjgamma::NCells, gjgamma::Time, gjgamma::IsExotic, gjgamma::DistanceToBadChannel, gjgamma::NLM, gjgamma::IsoRaw, gjgamma::PerpConeRho, gjgamma::TMdeltaPhi, gjgamma::TMdeltaEta, gjgamma::TMtrackP) namespace gjchjet { DECLARE_SOA_INDEX_COLUMN(GjEvent, gjevent); DECLARE_SOA_COLUMN(Pt, pt, float); DECLARE_SOA_COLUMN(Eta, eta, float); DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(Radius, radius, float); DECLARE_SOA_COLUMN(Energy, energy, float); DECLARE_SOA_COLUMN(Mass, mass, float); DECLARE_SOA_COLUMN(Area, area, float); +DECLARE_SOA_COLUMN(LeadingTrackPt, leadingtrackpt, float); +DECLARE_SOA_COLUMN(PerpConeRho, perpconerho, float); DECLARE_SOA_COLUMN(NConstituents, nConstituents, ushort); } // namespace gjchjet -DECLARE_SOA_TABLE(GjChargedJets, "AOD", "GJCHJET", gjchjet::GjEventId, gjchjet::Pt, gjchjet::Eta, gjchjet::Phi, gjchjet::Energy, gjchjet::Mass, gjchjet::Area, gjchjet::NConstituents) +DECLARE_SOA_TABLE(GjChargedJets, "AOD", "GJCHJET", gjchjet::GjEventId, gjchjet::Pt, gjchjet::Eta, gjchjet::Phi, gjchjet::Radius, gjchjet::Energy, gjchjet::Mass, gjchjet::Area, gjchjet::LeadingTrackPt, gjchjet::PerpConeRho, gjchjet::NConstituents) } // namespace o2::aod #endif // PWGJE_DATAMODEL_GAMMAJETANALYSISTREE_H_ diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index b3356fcc4a4..34b8359981f 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -179,8 +179,8 @@ DECLARE_JET_TABLES_LEVELS(Charged, JTrackSub, HfD0Bases, HfD0PBases, "C"); DECLARE_JET_TABLES_LEVELS(Full, JTrackSub, HfD0Bases, HfD0PBases, "F"); DECLARE_JET_TABLES_LEVELS(Neutral, JTrackSub, HfD0Bases, HfD0PBases, "N"); DECLARE_JET_TABLES_LEVELS(D0Charged, JTrackD0Sub, HfD0Bases, HfD0PBases, "D0"); -DECLARE_JET_TABLES_LEVELS(LcCharged, JTrackLcSub, Hf3PBases, Hf3PPBases, "Lc"); -DECLARE_JET_TABLES_LEVELS(BplusCharged, JTrackBplusSub, HfCandBplus, HfD0PBases, "BPl"); +DECLARE_JET_TABLES_LEVELS(LcCharged, JTrackLcSub, HfLcBases, HfLcPBases, "Lc"); +DECLARE_JET_TABLES_LEVELS(BplusCharged, JTrackBplusSub, HfBplusBases, HfBplusPBases, "BP"); DECLARE_JET_TABLES_LEVELS(V0Charged, JTrackSub, V0Cores, JV0Mcs, "V0"); DECLARE_JET_TABLES_LEVELS(DielectronCharged, JTrackSub, Dielectrons, JDielectronMcs, "DIEL"); @@ -209,25 +209,31 @@ using JetClustersMCD = o2::soa::Join; using JetMcCollisions = JMcCollisions; using JetMcCollision = JetMcCollisions::iterator; using JetParticles = JMcParticles; +using JetParticlesSub = JMcParticleSubs; using CollisionsD0 = o2::soa::Join; using CandidatesD0Data = o2::soa::Join; using CandidatesD0MCD = o2::soa::Join; using JetTracksSubD0 = JTrackD0Subs; +using JetParticlesSubD0 = JMcParticleD0Subs; using McCollisionsD0 = o2::soa::Join; using CandidatesD0MCP = o2::soa::Join; -using CollisionsLc = o2::soa::Join; -using CandidatesLcData = o2::soa::Join; -using CandidatesLcMCD = o2::soa::Join; +using CollisionsLc = o2::soa::Join; +using CandidatesLcData = o2::soa::Join; +using CandidatesLcMCD = o2::soa::Join; using JetTracksSubLc = JTrackLcSubs; -using McCollisionsLc = o2::soa::Join; -using CandidatesLcMCP = o2::soa::Join; +using JetParticlesSubLc = JMcParticleLcSubs; +using McCollisionsLc = o2::soa::Join; +using CandidatesLcMCP = o2::soa::Join; -using CandidatesBplusData = o2::soa::Join; -using CandidatesBplusMCD = o2::soa::Join; +using CollisionsBplus = o2::soa::Join; +using CandidatesBplusData = o2::soa::Join; +using CandidatesBplusMCD = o2::soa::Join; using JetTracksSubBplus = JTrackBplusSubs; -using CandidatesBplusMCP = o2::soa::Join; +using JetParticlesSubBplus = JMcParticleBplusSubs; +using McCollisionsBplus = o2::soa::Join; +using CandidatesBplusMCP = o2::soa::Join; using CandidatesV0Data = o2::soa::Join; using CandidatesV0MCD = o2::soa::Join; @@ -239,6 +245,7 @@ using CollisionsDielectron = o2::soa::Join; using CandidatesDielectronMCD = o2::soa::Join; using JetTracksSubDielectron = JTrackDielectronSubs; +using JetParticlesSubDielectron = JMcParticleDielectronSubs; using McCollisionsDielectron = o2::soa::Join; using CandidatesDielectronMCP = o2::soa::Join; diff --git a/PWGJE/DataModel/JetReducedData.h b/PWGJE/DataModel/JetReducedData.h index e5ce626f9a7..77aa55d9c29 100644 --- a/PWGJE/DataModel/JetReducedData.h +++ b/PWGJE/DataModel/JetReducedData.h @@ -40,46 +40,25 @@ DECLARE_SOA_COLUMN(ReadCountsWithTVXAndNoTFB, readCountsWithTVXAndNoTFB, std::ve DECLARE_SOA_COLUMN(ReadCountsWithTVXAndNoTFBAndNoITSROFB, readCountsWithTVXAndNoTFBAndNoITSROFB, std::vector); } // namespace jbc -DECLARE_SOA_TABLE(JBCs, "AOD", "JBC", - o2::soa::Index<>, - jbc::RunNumber, - jbc::GlobalBC, - jbc::Timestamp, - jbc::Alias, - jbc::Selection); +DECLARE_SOA_TABLE_STAGED(JBCs, "JBC", + o2::soa::Index<>, + jbc::RunNumber, + jbc::GlobalBC, + jbc::Timestamp, + jbc::Alias, + jbc::Selection); using JBC = JBCs::iterator; - -DECLARE_SOA_TABLE(StoredJBCs, "AOD1", "JBC", - o2::soa::Index<>, - jbc::RunNumber, - jbc::GlobalBC, - jbc::Timestamp, - jbc::Alias, - jbc::Selection, - o2::soa::Marker<1>); - using StoredJBC = StoredJBCs::iterator; -DECLARE_SOA_TABLE(JBCPIs, "AOD", "JBCPI", - jbc::BCId); - -DECLARE_SOA_TABLE(StoredJBCPIs, "AOD1", "JBCPI", - jbc::BCId, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE(BCCounts, "AOD", "BCCOUNT", - jbc::ReadCounts, - jbc::ReadCountsWithTVX, - jbc::ReadCountsWithTVXAndNoTFB, - jbc::ReadCountsWithTVXAndNoTFBAndNoITSROFB); +DECLARE_SOA_TABLE_STAGED(JBCPIs, "JBCPI", + jbc::BCId); -DECLARE_SOA_TABLE(StoredBCCounts, "AOD1", "BCCOUNT", - jbc::ReadCounts, - jbc::ReadCountsWithTVX, - jbc::ReadCountsWithTVXAndNoTFB, - jbc::ReadCountsWithTVXAndNoTFBAndNoITSROFB, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(BCCounts, "BCCOUNT", + jbc::ReadCounts, + jbc::ReadCountsWithTVX, + jbc::ReadCountsWithTVXAndNoTFB, + jbc::ReadCountsWithTVXAndNoTFBAndNoITSROFB); namespace jcollision { @@ -113,59 +92,32 @@ DECLARE_SOA_COLUMN(IsAmbiguous, isAmbiguous, bool); DECLARE_SOA_COLUMN(IsEMCALReadout, isEmcalReadout, bool); } // namespace jcollision -DECLARE_SOA_TABLE(JCollisions, "AOD", "JCOLLISION", - o2::soa::Index<>, - jcollision::PosX, - jcollision::PosY, - jcollision::PosZ, - jcollision::Multiplicity, - jcollision::Centrality, - jcollision::TrackOccupancyInTimeRange, - jcollision::EventSel, - jcollision::Alias, - jcollision::TriggerSel); +DECLARE_SOA_TABLE_STAGED(JCollisions, "JCOLLISION", + o2::soa::Index<>, + jcollision::PosX, + jcollision::PosY, + jcollision::PosZ, + jcollision::Multiplicity, + jcollision::Centrality, + jcollision::TrackOccupancyInTimeRange, + jcollision::EventSel, + jcollision::Alias, + jcollision::TriggerSel); using JCollision = JCollisions::iterator; - -DECLARE_SOA_TABLE(StoredJCollisions, "AOD1", "JCOLLISION", - o2::soa::Index<>, - jcollision::PosX, - jcollision::PosY, - jcollision::PosZ, - jcollision::Multiplicity, - jcollision::Centrality, - jcollision::TrackOccupancyInTimeRange, - jcollision::EventSel, - jcollision::Alias, - jcollision::TriggerSel, - o2::soa::Marker<1>); - using StoredJCollision = StoredJCollisions::iterator; -DECLARE_SOA_TABLE(JEMCCollisionLbs, "AOD", "JEMCCOLLISIONLB", - jcollision::IsAmbiguous, - jcollision::IsEMCALReadout); +DECLARE_SOA_TABLE_STAGED(JEMCCollisionLbs, "JEMCCOLLISIONLB", + jcollision::IsAmbiguous, + jcollision::IsEMCALReadout); using JEMCCollisionLb = JEMCCollisionLbs::iterator; - -DECLARE_SOA_TABLE(StoredJEMCCollisionLbs, "AOD1", "JEMCCOLLISIONLB", - jcollision::IsAmbiguous, - jcollision::IsEMCALReadout, - o2::soa::Marker<1>); using StoredJEMCCollisionLb = StoredJEMCCollisionLbs::iterator; -DECLARE_SOA_TABLE(JCollisionPIs, "AOD", "JCOLLISIONPI", - jcollision::CollisionId); +DECLARE_SOA_TABLE_STAGED(JCollisionPIs, "JCOLLISIONPI", + jcollision::CollisionId); -DECLARE_SOA_TABLE(StoredJCollisionPIs, "AOD1", "JCOLLISIONPI", - jcollision::CollisionId, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE(JCollisionBCs, "AOD", "JCOLLISIONBC", - jcollision::JBCId); - -DECLARE_SOA_TABLE(StoredJCollisionBCs, "AOD1", "JCOLLISIONBC", - jcollision::JBCId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JCollisionBCs, "JCOLLISIONBC", + jcollision::JBCId); DECLARE_SOA_TABLE(JChTrigSels, "AOD", "JCHTRIGSEL", jcollision::ChargedTriggerSel); @@ -176,34 +128,19 @@ DECLARE_SOA_TABLE(JFullTrigSels, "AOD", "JFULLTRIGSEL", DECLARE_SOA_TABLE(JChHFTrigSels, "AOD", "JCHHFTRIGSEL", jcollision::ChargedHFTriggerSel); -DECLARE_SOA_TABLE(CollisionCounts, "AOD", "COLLCOUNT", - jcollision::ReadCounts, - jcollision::ReadCountsWithTVX, - jcollision::ReadCountsWithTVXAndZVertexAndSel8, - jcollision::ReadCountsWithTVXAndZVertexAndSel8Full, - jcollision::ReadCountsWithTVXAndZVertexAndSel8FullPbPb, - jcollision::ReadCountsWithTVXAndZVertexAndSelMC, - jcollision::ReadCountsWithTVXAndZVertexAndSelMCFull, - jcollision::ReadCountsWithTVXAndZVertexAndSelMCFullPbPb, - jcollision::ReadCountsWithTVXAndZVertexAndSelUnanchoredMC, - jcollision::ReadCountsWithTVXAndZVertexAndSelTVX, - jcollision::ReadCountsWithTVXAndZVertexAndSel7, - jcollision::ReadCountsWithTVXAndZVertexAndSel7KINT7); - -DECLARE_SOA_TABLE(StoredCollisionCounts, "AOD1", "COLLCOUNT", - jcollision::ReadCounts, - jcollision::ReadCountsWithTVX, - jcollision::ReadCountsWithTVXAndZVertexAndSel8, - jcollision::ReadCountsWithTVXAndZVertexAndSel8Full, - jcollision::ReadCountsWithTVXAndZVertexAndSel8FullPbPb, - jcollision::ReadCountsWithTVXAndZVertexAndSelMC, - jcollision::ReadCountsWithTVXAndZVertexAndSelMCFull, - jcollision::ReadCountsWithTVXAndZVertexAndSelMCFullPbPb, - jcollision::ReadCountsWithTVXAndZVertexAndSelUnanchoredMC, - jcollision::ReadCountsWithTVXAndZVertexAndSelTVX, - jcollision::ReadCountsWithTVXAndZVertexAndSel7, - jcollision::ReadCountsWithTVXAndZVertexAndSel7KINT7, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(CollisionCounts, "COLLCOUNT", + jcollision::ReadCounts, + jcollision::ReadCountsWithTVX, + jcollision::ReadCountsWithTVXAndZVertexAndSel8, + jcollision::ReadCountsWithTVXAndZVertexAndSel8Full, + jcollision::ReadCountsWithTVXAndZVertexAndSel8FullPbPb, + jcollision::ReadCountsWithTVXAndZVertexAndSelMC, + jcollision::ReadCountsWithTVXAndZVertexAndSelMCFull, + jcollision::ReadCountsWithTVXAndZVertexAndSelMCFullPbPb, + jcollision::ReadCountsWithTVXAndZVertexAndSelUnanchoredMC, + jcollision::ReadCountsWithTVXAndZVertexAndSelTVX, + jcollision::ReadCountsWithTVXAndZVertexAndSel7, + jcollision::ReadCountsWithTVXAndZVertexAndSel7KINT7); namespace jmccollision { @@ -213,43 +150,26 @@ DECLARE_SOA_COLUMN(PosY, posY, float); DECLARE_SOA_COLUMN(PosZ, posZ, float); DECLARE_SOA_COLUMN(Weight, weight, float); } // namespace jmccollision -DECLARE_SOA_TABLE(JMcCollisions, "AOD", "JMCCOLLISION", - o2::soa::Index<>, - jmccollision::PosX, - jmccollision::PosY, - jmccollision::PosZ, - jmccollision::Weight); +DECLARE_SOA_TABLE_STAGED(JMcCollisions, "JMCCOLLISION", + o2::soa::Index<>, + jmccollision::PosX, + jmccollision::PosY, + jmccollision::PosZ, + jmccollision::Weight); using JMcCollision = JMcCollisions::iterator; - -DECLARE_SOA_TABLE(StoredJMcCollisions, "AOD1", "JMCCOLLISION", - o2::soa::Index<>, - jmccollision::PosX, - jmccollision::PosY, - jmccollision::PosZ, - jmccollision::Weight, - o2::soa::Marker<1>); - using StoredJMcCollision = StoredJMcCollisions::iterator; -DECLARE_SOA_TABLE(JMcCollisionPIs, "AOD", "JMCCOLLISIONPI", - jmccollision::McCollisionId); - -DECLARE_SOA_TABLE(StoredJMcCollisionPIs, "AOD1", "JMCCOLLISIONPI", - jmccollision::McCollisionId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JMcCollisionPIs, "JMCCOLLISIONPI", + jmccollision::McCollisionId); namespace jmccollisionlb { DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); } -DECLARE_SOA_TABLE(JMcCollisionLbs, "AOD", "JMCCOLLISIONLB", - jmccollisionlb::JMcCollisionId); - -DECLARE_SOA_TABLE(StoredJMcCollisionLbs, "AOD1", "JMCCOLLISIONLB", - jmccollisionlb::JMcCollisionId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JMcCollisionLbs, "JMCCOLLISIONLB", + jmccollisionlb::JMcCollisionId); namespace jtrack { @@ -282,68 +202,48 @@ DECLARE_SOA_DYNAMIC_COLUMN(Sign, sign, [](uint8_t trackSel) -> int { if (trackSel & (1 << jetderiveddatautilities::JTrackSel::trackSign)){ return 1;} else{return -1;} }); } // namespace jtrack -DECLARE_SOA_TABLE(JTracks, "AOD", "JTRACK", - o2::soa::Index<>, - jtrack::JCollisionId, - jtrack::Pt, - jtrack::Eta, - jtrack::Phi, - jtrack::TrackSel, - jtrack::Px, - jtrack::Py, - jtrack::Pz, - jtrack::P, - jtrack::Energy, - jtrack::Sign); +DECLARE_SOA_TABLE_STAGED(JTracks, "JTRACK", + o2::soa::Index<>, + jtrack::JCollisionId, + jtrack::Pt, + jtrack::Eta, + jtrack::Phi, + jtrack::TrackSel, + jtrack::Px, + jtrack::Py, + jtrack::Pz, + jtrack::P, + jtrack::Energy, + jtrack::Sign); using JTrack = JTracks::iterator; - -DECLARE_SOA_TABLE(StoredJTracks, "AOD1", "JTRACK", - o2::soa::Index<>, - jtrack::JCollisionId, - jtrack::Pt, - jtrack::Eta, - jtrack::Phi, - jtrack::TrackSel, - jtrack::Px, - jtrack::Py, - jtrack::Pz, - jtrack::P, - jtrack::Energy, - jtrack::Sign, - o2::soa::Marker<1>); - using StoredJTrack = StoredJTracks::iterator; -DECLARE_SOA_TABLE(JTrackExtras, "AOD", "JTRACKEXTRA", - jtrack::DCAX, - jtrack::DCAY, - jtrack::DCAZ, - jtrack::DCAXY, - jtrack::DCAXYZ, - jtrack::SigmaDCAZ, - jtrack::SigmaDCAXY, - jtrack::SigmaDCAXYZ, - jtrack::Sigma1Pt); - -DECLARE_SOA_TABLE(StoredJTrackExtras, "AOD1", "JTRACKEXTRA", - jtrack::DCAX, - jtrack::DCAY, - jtrack::DCAZ, - jtrack::DCAXY, - jtrack::DCAXYZ, - jtrack::SigmaDCAZ, - jtrack::SigmaDCAXY, - jtrack::SigmaDCAXYZ, - jtrack::Sigma1Pt, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE(JTrackPIs, "AOD", "JTRACKPI", - jtrack::TrackId); - -DECLARE_SOA_TABLE(StoredJTrackPIs, "AOD1", "JTRACKPI", - jtrack::TrackId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JTrackExtras, "JTRACKEXTRA", + jtrack::DCAX, + jtrack::DCAY, + jtrack::DCAZ, + jtrack::DCAXY, + jtrack::DCAXYZ, + jtrack::SigmaDCAZ, + jtrack::SigmaDCAXY, + jtrack::SigmaDCAXYZ, + jtrack::Sigma1Pt); + +DECLARE_SOA_TABLE_STAGED(JTrackPIs, "JTRACKPI", + jtrack::TrackId); + +namespace jemctrack +{ +DECLARE_SOA_INDEX_COLUMN(JTrack, track); +DECLARE_SOA_COLUMN(EtaEMCAL, etaEmcal, float); +DECLARE_SOA_COLUMN(PhiEMCAL, phiEmcal, float); +} // namespace jemctrack + +DECLARE_SOA_TABLE_STAGED(JEMCTracks, "JEMCTrack", + jemctrack::JTrackId, + jemctrack::EtaEMCAL, + jemctrack::PhiEMCAL); namespace jmcparticle { @@ -372,69 +272,39 @@ DECLARE_SOA_DYNAMIC_COLUMN(Energy, energy, [](float e) -> float { return e; }); } // namespace jmcparticle -DECLARE_SOA_TABLE(JMcParticles, "AOD", "JMCPARTICLE", - o2::soa::Index<>, - jmcparticle::JMcCollisionId, - jmcparticle::Pt, - jmcparticle::Eta, - jmcparticle::Phi, - jmcparticle::Y, - jmcparticle::E, - jmcparticle::PdgCode, - jmcparticle::GenStatusCode, - jmcparticle::HepMCStatusCode, - jmcparticle::IsPhysicalPrimary, - jmcparticle::MothersIds, - jmcparticle::DaughtersIdSlice, - jmcparticle::Px, - jmcparticle::Py, - jmcparticle::Pz, - jmcparticle::P, - jmcparticle::Energy); +DECLARE_SOA_TABLE_STAGED(JMcParticles, "JMCPARTICLE", + o2::soa::Index<>, + jmcparticle::JMcCollisionId, + jmcparticle::Pt, + jmcparticle::Eta, + jmcparticle::Phi, + jmcparticle::Y, + jmcparticle::E, + jmcparticle::PdgCode, + jmcparticle::GenStatusCode, + jmcparticle::HepMCStatusCode, + jmcparticle::IsPhysicalPrimary, + jmcparticle::MothersIds, + jmcparticle::DaughtersIdSlice, + jmcparticle::Px, + jmcparticle::Py, + jmcparticle::Pz, + jmcparticle::P, + jmcparticle::Energy); using JMcParticle = JMcParticles::iterator; - -DECLARE_SOA_TABLE(StoredJMcParticles, "AOD1", "JMCPARTICLE", - o2::soa::Index<>, - jmcparticle::JMcCollisionId, - jmcparticle::Pt, - jmcparticle::Eta, - jmcparticle::Phi, - jmcparticle::Y, - jmcparticle::E, - jmcparticle::PdgCode, - jmcparticle::GenStatusCode, - jmcparticle::HepMCStatusCode, - jmcparticle::IsPhysicalPrimary, - jmcparticle::MothersIds, - jmcparticle::DaughtersIdSlice, - jmcparticle::Px, - jmcparticle::Py, - jmcparticle::Pz, - jmcparticle::P, - jmcparticle::Energy, - o2::soa::Marker<1>); - using StoredJMcParticle = StoredJMcParticles::iterator; -DECLARE_SOA_TABLE(JMcParticlePIs, "AOD", "JMCPARTICLEPI", - jmcparticle::McParticleId); - -DECLARE_SOA_TABLE(StoredJMcParticlePIs, "AOD1", "JMCPARTICLEPI", - jmcparticle::McParticleId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JMcParticlePIs, "JMCPARTICLEPI", + jmcparticle::McParticleId); namespace jmctracklb { DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); } -DECLARE_SOA_TABLE(JMcTrackLbs, "AOD", "JMCTRACKLB", //! Table joined to the track table containing the MC index - jmctracklb::JMcParticleId); - -DECLARE_SOA_TABLE(StoredJMcTrackLbs, "AOD1", "JMCTRACKLB", //! Table joined to the track table containing the MC index - jmctracklb::JMcParticleId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JMcTrackLbs, "JMCTRACKLB", //! Table joined to the track table containing the MC index + jmctracklb::JMcParticleId); namespace jcluster { @@ -462,38 +332,21 @@ DECLARE_SOA_COLUMN(SubleadingCellNumber, subleadingCellNumber, int); //! energ } // namespace jcluster -DECLARE_SOA_TABLE(JClusters, "AOD", "JCLUSTER", //! - o2::soa::Index<>, jcluster::JCollisionId, jcluster::ID, jcluster::Energy, - jcluster::CoreEnergy, jcluster::RawEnergy, jcluster::Eta, jcluster::Phi, - jcluster::M02, jcluster::M20, jcluster::NCells, jcluster::Time, - jcluster::IsExotic, jcluster::DistanceToBadChannel, jcluster::NLM, jcluster::Definition, - jcluster::LeadingCellEnergy, jcluster::SubleadingCellEnergy, jcluster::LeadingCellNumber, jcluster::SubleadingCellNumber); +DECLARE_SOA_TABLE_STAGED(JClusters, "JCLUSTER", //! + o2::soa::Index<>, jcluster::JCollisionId, jcluster::ID, jcluster::Energy, + jcluster::CoreEnergy, jcluster::RawEnergy, jcluster::Eta, jcluster::Phi, + jcluster::M02, jcluster::M20, jcluster::NCells, jcluster::Time, + jcluster::IsExotic, jcluster::DistanceToBadChannel, jcluster::NLM, jcluster::Definition, + jcluster::LeadingCellEnergy, jcluster::SubleadingCellEnergy, jcluster::LeadingCellNumber, jcluster::SubleadingCellNumber); using JCluster = JClusters::iterator; - -DECLARE_SOA_TABLE(StoredJClusters, "AOD1", "JCLUSTER", - o2::soa::Index<>, jcluster::JCollisionId, jcluster::ID, jcluster::Energy, - jcluster::CoreEnergy, jcluster::RawEnergy, jcluster::Eta, jcluster::Phi, - jcluster::M02, jcluster::M20, jcluster::NCells, jcluster::Time, - jcluster::IsExotic, jcluster::DistanceToBadChannel, jcluster::NLM, jcluster::Definition, - jcluster::LeadingCellEnergy, jcluster::SubleadingCellEnergy, jcluster::LeadingCellNumber, jcluster::SubleadingCellNumber, - o2::soa::Marker<1>); - using StoredJCluster = StoredJClusters::iterator; -DECLARE_SOA_TABLE(JClusterPIs, "AOD", "JCLUSTERPI", - jcluster::EMCALClusterId); +DECLARE_SOA_TABLE_STAGED(JClusterPIs, "JCLUSTERPI", + jcluster::EMCALClusterId); -DECLARE_SOA_TABLE(StoredJClusterPIs, "AOD1", "JCLUSTERPI", - jcluster::EMCALClusterId, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE(JClusterTracks, "AOD", "JCLUSTERTRACK", //! - jcluster::JTrackIds); - -DECLARE_SOA_TABLE(StoredJClusterTracks, "AOD1", "JCLUSTERTRACK", //! - jcluster::JTrackIds, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JClusterTracks, "JCLUSTERTRACK", //! + jcluster::JTrackIds); namespace jmcclusterlb { @@ -501,12 +354,8 @@ DECLARE_SOA_ARRAY_INDEX_COLUMN(JMcParticle, mcParticle); DECLARE_SOA_COLUMN(AmplitudeA, amplitudeA, std::vector); } // namespace jmcclusterlb -DECLARE_SOA_TABLE(JMcClusterLbs, "AOD", "JMCCLUSTERLB", //! - jmcclusterlb::JMcParticleIds, jmcclusterlb::AmplitudeA); - -DECLARE_SOA_TABLE(StoredJMcClusterLbs, "AOD1", "JMCCLUSTERLB", //! - jmcclusterlb::JMcParticleIds, jmcclusterlb::AmplitudeA, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JMcClusterLbs, "JMCCLUSTERLB", //! + jmcclusterlb::JMcParticleIds, jmcclusterlb::AmplitudeA); namespace jdummy { @@ -514,14 +363,9 @@ namespace jdummy DECLARE_SOA_COLUMN(Dummy, dummy, bool); } // namespace jdummy -DECLARE_SOA_TABLE(JDummys, "AOD", "JDUMMY", - o2::soa::Index<>, - jdummy::Dummy); - -DECLARE_SOA_TABLE(StoredJDummys, "AOD1", "JDUMMY", - o2::soa::Index<>, - jdummy::Dummy, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JDummys, "JDUMMY", + o2::soa::Index<>, + jdummy::Dummy); } // namespace o2::aod diff --git a/PWGJE/DataModel/JetReducedDataDQ.h b/PWGJE/DataModel/JetReducedDataDQ.h index 21fadaf9e95..a5779ebd3b4 100644 --- a/PWGJE/DataModel/JetReducedDataDQ.h +++ b/PWGJE/DataModel/JetReducedDataDQ.h @@ -26,21 +26,11 @@ namespace o2::aod { -DECLARE_SOA_TABLE(JDielectronMcCollisions, "AOD", "JDIELMCCOLL", - o2::soa::Index<>, - jmccollision::PosX, - jmccollision::PosY, - jmccollision::PosZ, - o2::soa::Marker<3>); - -using JMcCollision = JMcCollisions::iterator; - -DECLARE_SOA_TABLE(StoredJDielectronMcCollisions, "AOD1", "JDIELMCCOLL", - o2::soa::Index<>, - jmccollision::PosX, - jmccollision::PosY, - jmccollision::PosZ, - o2::soa::Marker<4>); +DECLARE_SOA_TABLE_STAGED(JDielectronMcCollisions, "JDIELMCCOLL", + o2::soa::Index<>, + jmccollision::PosX, + jmccollision::PosY, + jmccollision::PosZ); namespace jdielectronindices { @@ -52,30 +42,16 @@ DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); } // namespace jdielectronindices -DECLARE_SOA_TABLE(JDielectronCollisionIds, "AOD", "JDIELCOLLID", - jdielectronindices::JCollisionId); - -DECLARE_SOA_TABLE(StoredJDielectronCollisionIds, "AOD1", "JDIELCOLLID", - jdielectronindices::JCollisionId, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE(JDielectronMcCollisionIds, "AOD", "JDIELMCCOLLID", - jdielectronindices::JMcCollisionId); - -DECLARE_SOA_TABLE(StoredJDielectronMcCollisionIds, "AOD1", "JDIELMCCOLLID", - jdielectronindices::JMcCollisionId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JDielectronCollisionIds, "JDIELCOLLID", + jdielectronindices::JCollisionId); -DECLARE_SOA_TABLE(JDielectronIds, "AOD", "JDIELID", - jdielectronindices::JCollisionId, - jdielectronindices::Prong0Id, - jdielectronindices::Prong1Id); +DECLARE_SOA_TABLE_STAGED(JDielectronMcCollisionIds, "JDIELMCCOLLID", + jdielectronindices::JMcCollisionId); -DECLARE_SOA_TABLE(StoredJDielectronIds, "AOD1", "JDIELID", - jdielectronindices::JCollisionId, - jdielectronindices::Prong0Id, - jdielectronindices::Prong1Id, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JDielectronIds, "JDIELID", + jdielectronindices::JCollisionId, + jdielectronindices::Prong0Id, + jdielectronindices::Prong1Id); namespace jdielectronmc { @@ -103,63 +79,34 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); } // namespace jdielectronmc -DECLARE_SOA_TABLE(JDielectronMcs, "AOD", "JDIELMC", - o2::soa::Index<>, - jdielectronindices::JDielectronMcCollisionId, - jdielectronmc::Pt, - jdielectronmc::Eta, - jdielectronmc::Phi, - jdielectronmc::Y, - jdielectronmc::E, - jdielectronmc::M, - jdielectronmc::PdgCode, - jdielectronmc::GenStatusCode, - jdielectronmc::HepMCStatusCode, - jdielectronmc::IsPhysicalPrimary, - jdielectronmc::DecayFlag, - jdielectronmc::Origin, - jdielectronmc::Px, - jdielectronmc::Py, - jdielectronmc::Pz, - jdielectronmc::P); +DECLARE_SOA_TABLE_STAGED(JDielectronMcs, "JDIELMC", + o2::soa::Index<>, + jdielectronindices::JDielectronMcCollisionId, + jdielectronmc::Pt, + jdielectronmc::Eta, + jdielectronmc::Phi, + jdielectronmc::Y, + jdielectronmc::E, + jdielectronmc::M, + jdielectronmc::PdgCode, + jdielectronmc::GenStatusCode, + jdielectronmc::HepMCStatusCode, + jdielectronmc::IsPhysicalPrimary, + jdielectronmc::DecayFlag, + jdielectronmc::Origin, + jdielectronmc::Px, + jdielectronmc::Py, + jdielectronmc::Pz, + jdielectronmc::P); using JDielectronMc = JDielectronMcs::iterator; - -DECLARE_SOA_TABLE(StoredJDielectronMcs, "AOD1", "JDIELMC", - o2::soa::Index<>, - jdielectronindices::JDielectronMcCollisionId, - jdielectronmc::Pt, - jdielectronmc::Eta, - jdielectronmc::Phi, - jdielectronmc::Y, - jdielectronmc::E, - jdielectronmc::M, - jdielectronmc::PdgCode, - jdielectronmc::GenStatusCode, - jdielectronmc::HepMCStatusCode, - jdielectronmc::IsPhysicalPrimary, - jdielectronmc::DecayFlag, - jdielectronmc::Origin, - jdielectronmc::Px, - jdielectronmc::Py, - jdielectronmc::Pz, - jdielectronmc::P, - o2::soa::Marker<1>); - using StoredJDielectronMc = StoredJDielectronMcs::iterator; -DECLARE_SOA_TABLE(JDielectronMcIds, "AOD", "JDIELMCID", - jdielectronindices::JMcCollisionId, - jdielectronindices::JMcParticleId, - jdielectronmc::MothersIds, - jdielectronmc::DaughtersIdSlice); - -DECLARE_SOA_TABLE(StoredJDielectronMcIds, "AOD1", "JDIELMCID", - jdielectronindices::JMcCollisionId, - jdielectronindices::JMcParticleId, - jdielectronmc::MothersIds, - jdielectronmc::DaughtersIdSlice, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JDielectronMcIds, "JDIELMCID", + jdielectronindices::JMcCollisionId, + jdielectronindices::JMcParticleId, + jdielectronmc::MothersIds, + jdielectronmc::DaughtersIdSlice); namespace jdummydq { @@ -168,35 +115,37 @@ DECLARE_SOA_COLUMN(DummyDQ, dummyDQ, bool); } // namespace jdummydq DECLARE_SOA_TABLE(JDielectron1Dummys, "AOD", "JDIEL1DUMMY", - o2::soa::Index<>, jdummydq::DummyDQ, o2::soa::Marker<1>); DECLARE_SOA_TABLE(JDielectron2Dummys, "AOD", "JDIEL2DUMMY", - o2::soa::Index<>, jdummydq::DummyDQ, o2::soa::Marker<2>); DECLARE_SOA_TABLE(JDielectron3Dummys, "AOD", "JDIEL3DUMMY", - o2::soa::Index<>, jdummydq::DummyDQ, o2::soa::Marker<3>); DECLARE_SOA_TABLE(JDielectron4Dummys, "AOD", "JDIEL4DUMMY", - o2::soa::Index<>, jdummydq::DummyDQ, o2::soa::Marker<4>); DECLARE_SOA_TABLE(JDielectron5Dummys, "AOD", "JDIEL5DUMMY", - o2::soa::Index<>, jdummydq::DummyDQ, o2::soa::Marker<5>); DECLARE_SOA_TABLE(JDielectron6Dummys, "AOD", "JDIEL6DUMMY", - o2::soa::Index<>, jdummydq::DummyDQ, o2::soa::Marker<6>); +DECLARE_SOA_TABLE(JDielectron7Dummys, "AOD", "JDIEL7DUMMY", + jdummydq::DummyDQ, + o2::soa::Marker<7>); + +DECLARE_SOA_TABLE(JDielectron8Dummys, "AOD", "JDIEL8DUMMY", + jdummydq::DummyDQ, + o2::soa::Marker<8>); + } // namespace o2::aod #endif // PWGJE_DATAMODEL_JETREDUCEDDATADQ_H_ diff --git a/PWGJE/DataModel/JetReducedDataHF.h b/PWGJE/DataModel/JetReducedDataHF.h index 13056e0f1fc..855746326a2 100644 --- a/PWGJE/DataModel/JetReducedDataHF.h +++ b/PWGJE/DataModel/JetReducedDataHF.h @@ -35,39 +35,33 @@ DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); } // namespace jd0indices -DECLARE_SOA_TABLE(JD0CollisionIds, "AOD", "JD0COLLID", - jd0indices::JCollisionId); +DECLARE_SOA_TABLE_STAGED(JD0CollisionIds, "JD0COLLID", + jd0indices::JCollisionId); -DECLARE_SOA_TABLE(StoredJD0CollisionIds, "AOD1", "JD0COLLID", - jd0indices::JCollisionId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JD0McCollisionIds, "JD0MCCOLLID", + jd0indices::JMcCollisionId); -DECLARE_SOA_TABLE(JD0McCollisionIds, "AOD", "JD0MCCOLLID", - jd0indices::JMcCollisionId); +DECLARE_SOA_TABLE_STAGED(JD0Ids, "JD0ID", + jd0indices::JCollisionId, + jd0indices::Prong0Id, + jd0indices::Prong1Id); -DECLARE_SOA_TABLE(StoredJD0McCollisionIds, "AOD1", "JD0MCCOLLID", - jd0indices::JMcCollisionId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JD0PIds, "JD0PID", + jd0indices::JMcCollisionId, + jd0indices::JMcParticleId); -DECLARE_SOA_TABLE(JD0Ids, "AOD", "JD0ID", - jd0indices::JCollisionId, - jd0indices::Prong0Id, - jd0indices::Prong1Id); +namespace jdummyd0 +{ +DECLARE_SOA_COLUMN(DummyD0, dummyD0, bool); +} // namespace jdummyd0 -DECLARE_SOA_TABLE(StoredJD0Ids, "AOD1", "JD0ID", - jd0indices::JCollisionId, - jd0indices::Prong0Id, - jd0indices::Prong1Id, +DECLARE_SOA_TABLE(JDumD0ParDaus, "AOD", "JDUMD0PARDAU", + jdummyd0::DummyD0, o2::soa::Marker<1>); -DECLARE_SOA_TABLE(JD0PIds, "AOD", "JD0PID", - jd0indices::JMcCollisionId, - jd0indices::JMcParticleId); - -DECLARE_SOA_TABLE(StoredJD0PIds, "AOD1", "JD0PID", - jd0indices::JMcCollisionId, - jd0indices::JMcParticleId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE(JDumD0MlDaus, "AOD", "JDumD0MLDAU", + jdummyd0::DummyD0, + o2::soa::Marker<2>); namespace jlcindices { @@ -79,42 +73,62 @@ DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); } // namespace jlcindices -DECLARE_SOA_TABLE(JLcCollisionIds, "AOD", "JLCCOLLID", - jlcindices::JCollisionId); +DECLARE_SOA_TABLE_STAGED(JLcCollisionIds, "JLCCOLLID", + jlcindices::JCollisionId); -DECLARE_SOA_TABLE(StoredJLcCollisionIds, "AOD1", "JLCCOLLID", - jlcindices::JCollisionId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JLcMcCollisionIds, "JLCMCCOLLID", + jlcindices::JMcCollisionId); -DECLARE_SOA_TABLE(JLcMcCollisionIds, "AOD", "JLCMCCOLLID", - jlcindices::JMcCollisionId); +DECLARE_SOA_TABLE_STAGED(JLcIds, "JLCID", + jlcindices::JCollisionId, + jlcindices::Prong0Id, + jlcindices::Prong1Id, + jlcindices::Prong2Id); -DECLARE_SOA_TABLE(StoredJLcMcCollisionIds, "AOD1", "JLCMCCOLLID", - jlcindices::JMcCollisionId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JLcPIds, "JLCPID", + jlcindices::JMcCollisionId, + jlcindices::JMcParticleId); -DECLARE_SOA_TABLE(JLcIds, "AOD", "JLCID", - jlcindices::JCollisionId, - jlcindices::Prong0Id, - jlcindices::Prong1Id, - jlcindices::Prong2Id); - -DECLARE_SOA_TABLE(StoredJLcIds, "AOD1", "JLCID", - jlcindices::JCollisionId, - jlcindices::Prong0Id, - jlcindices::Prong1Id, - jlcindices::Prong2Id, - o2::soa::Marker<1>); +namespace jdummylc +{ -DECLARE_SOA_TABLE(JLcPIds, "AOD", "JLCPID", - jlcindices::JMcCollisionId, - jlcindices::JMcParticleId); +DECLARE_SOA_COLUMN(DummyLc, dummyLc, bool); -DECLARE_SOA_TABLE(StoredJLcPIds, "AOD1", "JLCPID", - jlcindices::JMcCollisionId, - jlcindices::JMcParticleId, +} // namespace jdummylc +DECLARE_SOA_TABLE(JDumLcParDaus, "AOD", "JDUMLCPARDAU", + jdummylc::DummyLc, o2::soa::Marker<1>); +DECLARE_SOA_TABLE(JDumLcMlDaus, "AOD", "JDUMLCMLDAU", + jdummylc::DummyLc, + o2::soa::Marker<2>); + +namespace jbplusindices +{ +DECLARE_SOA_INDEX_COLUMN(JCollision, collision); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, JTracks, "_0"); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, JTracks, "_1"); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong2, prong2, int, JTracks, "_2"); +DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); +DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); +} // namespace jbplusindices + +DECLARE_SOA_TABLE_STAGED(JBplusCollisionIds, "JBPCOLLID", + jbplusindices::JCollisionId); + +DECLARE_SOA_TABLE_STAGED(JBplusMcCollisionIds, "JBPMCCOLLID", + jbplusindices::JMcCollisionId); + +DECLARE_SOA_TABLE_STAGED(JBplusIds, "JBPID", + jbplusindices::JCollisionId, + jbplusindices::Prong0Id, + jbplusindices::Prong1Id, + jbplusindices::Prong2Id); + +DECLARE_SOA_TABLE_STAGED(JBplusPIds, "JBPPID", + jbplusindices::JMcCollisionId, + jbplusindices::JMcParticleId); + } // namespace o2::aod #endif // PWGJE_DATAMODEL_JETREDUCEDDATAHF_H_ diff --git a/PWGJE/DataModel/JetReducedDataV0.h b/PWGJE/DataModel/JetReducedDataV0.h index abd5904b0ec..d904403b532 100644 --- a/PWGJE/DataModel/JetReducedDataV0.h +++ b/PWGJE/DataModel/JetReducedDataV0.h @@ -26,21 +26,12 @@ namespace o2::aod { -DECLARE_SOA_TABLE(JV0McCollisions, "AOD", "JV0MCCOLL", - o2::soa::Index<>, - jmccollision::PosX, - jmccollision::PosY, - jmccollision::PosZ, - o2::soa::Marker<1>); - -using JMcCollision = JMcCollisions::iterator; - -DECLARE_SOA_TABLE(StoredJV0McCollisions, "AOD1", "JV0MCCOLL", - o2::soa::Index<>, - jmccollision::PosX, - jmccollision::PosY, - jmccollision::PosZ, - o2::soa::Marker<2>); +DECLARE_SOA_TABLE_STAGED(JV0McCollisions, "JV0MCCOLL", + o2::soa::Index<>, + jmccollision::PosX, + jmccollision::PosY, + jmccollision::PosZ, + o2::soa::Marker<3>); namespace jv0indices { @@ -52,19 +43,11 @@ DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); } // namespace jv0indices -DECLARE_SOA_TABLE(JV0CollisionIds, "AOD", "JV0COLLID", - jv0indices::JCollisionId); - -DECLARE_SOA_TABLE(StoredJV0CollisionIds, "AOD1", "JV0COLLID", - jv0indices::JCollisionId, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE(JV0McCollisionIds, "AOD", "JV0MCCOLLID", - jv0indices::JMcCollisionId); +DECLARE_SOA_TABLE_STAGED(JV0CollisionIds, "JV0COLLID", + jv0indices::JCollisionId); -DECLARE_SOA_TABLE(StoredJV0McCollisionIds, "AOD1", "JV0MCCOLLID", - jv0indices::JMcCollisionId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JV0McCollisionIds, "JV0MCCOLLID", + jv0indices::JMcCollisionId); DECLARE_SOA_TABLE(JV0Ids, "AOD", "JV0ID", jv0indices::JCollisionId, @@ -96,61 +79,33 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); } // namespace jv0mc -DECLARE_SOA_TABLE(JV0Mcs, "AOD", "JV0MC", - o2::soa::Index<>, - jv0indices::JV0McCollisionId, - jv0mc::Pt, - jv0mc::Eta, - jv0mc::Phi, - jv0mc::Y, - jv0mc::E, - jv0mc::M, - jv0mc::PdgCode, - jv0mc::GenStatusCode, - jv0mc::HepMCStatusCode, - jv0mc::IsPhysicalPrimary, - jv0mc::DecayFlag, - jv0mc::Px, - jv0mc::Py, - jv0mc::Pz, - jv0mc::P); +DECLARE_SOA_TABLE_STAGED(JV0Mcs, "JV0MC", + o2::soa::Index<>, + jv0indices::JV0McCollisionId, + jv0mc::Pt, + jv0mc::Eta, + jv0mc::Phi, + jv0mc::Y, + jv0mc::E, + jv0mc::M, + jv0mc::PdgCode, + jv0mc::GenStatusCode, + jv0mc::HepMCStatusCode, + jv0mc::IsPhysicalPrimary, + jv0mc::DecayFlag, + jv0mc::Px, + jv0mc::Py, + jv0mc::Pz, + jv0mc::P); using JV0Mc = JV0Mcs::iterator; - -DECLARE_SOA_TABLE(StoredJV0Mcs, "AOD1", "JV0MC", - o2::soa::Index<>, - jv0indices::JV0McCollisionId, - jv0mc::Pt, - jv0mc::Eta, - jv0mc::Phi, - jv0mc::Y, - jv0mc::E, - jv0mc::M, - jv0mc::PdgCode, - jv0mc::GenStatusCode, - jv0mc::HepMCStatusCode, - jv0mc::IsPhysicalPrimary, - jv0mc::DecayFlag, - jv0mc::Px, - jv0mc::Py, - jv0mc::Pz, - jv0mc::P, - o2::soa::Marker<1>); - using StoredJV0Mc = StoredJV0Mcs::iterator; -DECLARE_SOA_TABLE(JV0McIds, "AOD", "JV0MCID", - jv0indices::JMcCollisionId, - jv0indices::JMcParticleId, - jv0mc::MothersIds, - jv0mc::DaughtersIdSlice); - -DECLARE_SOA_TABLE(StoredJV0McIds, "AOD1", "JV0MCID", - jv0indices::JMcCollisionId, - jv0indices::JMcParticleId, - jv0mc::MothersIds, - jv0mc::DaughtersIdSlice, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JV0McIds, "JV0MCID", + jv0indices::JMcCollisionId, + jv0indices::JMcParticleId, + jv0mc::MothersIds, + jv0mc::DaughtersIdSlice); } // namespace o2::aod diff --git a/PWGJE/DataModel/JetSubstructure.h b/PWGJE/DataModel/JetSubstructure.h index 2e5d03f46d0..9b606b8dcfd 100644 --- a/PWGJE/DataModel/JetSubstructure.h +++ b/PWGJE/DataModel/JetSubstructure.h @@ -122,8 +122,8 @@ DECLARE_SOA_COLUMN(JetNConstituents, jetNConstituents, int); //! JETSUBSTRUCTURE_TABLES_DEF(C, "C", CJetCOs, "CJETCO", CEWSJetCOs, "CEWSJETCO", CMCDJetCOs, "CMCDJETCO", CMCPJetCOs, "CMCPJETCO"); JETSUBSTRUCTURE_TABLES_DEF(D0C, "D0C", HfD0Bases, "HFD0BASE", HfD0Bases, "HFD0BASE", HfD0Bases, "HFD0BASE", HfD0PBases, "HFD0PBASE"); -JETSUBSTRUCTURE_TABLES_DEF(LcC, "LCC", Hf3PBases, "HF3PBASE", Hf3PBases, "HF3PBASE", Hf3PBases, "HF3PBASE", Hf3PPBases, "HF3PPBASE"); -JETSUBSTRUCTURE_TABLES_DEF(BplusC, "BPLUSC", HfD0Bases, "HFD0BASE", HfD0Bases, "HFD0BASE", HfD0Bases, "HFD0BASE", HfD0PBases, "HFD0PBASE"); +JETSUBSTRUCTURE_TABLES_DEF(LcC, "LCC", HfLcBases, "HFLcBASE", HfLcBases, "HFLcBASE", HfLcBases, "HFLcBASE", HfLcPBases, "HFLcPBASE"); +JETSUBSTRUCTURE_TABLES_DEF(BplusC, "BPC", HfBplusBases, "HFBPBASE", HfBplusBases, "HFBPBASE", HfBplusBases, "HFBPBASE", HfBplusPBases, "HFBPPBASE"); JETSUBSTRUCTURE_TABLES_DEF(DielectronC, "DIELC", Dielectrons, "RTDIELECTRON", Dielectrons, "RTDIELECTRON", Dielectrons, "RTDIELECTRON", JDielectronMcs, "JDIELMC"); } // namespace o2::aod diff --git a/PWGJE/DataModel/JetSubtraction.h b/PWGJE/DataModel/JetSubtraction.h index f789d18637a..3f78c05ec58 100644 --- a/PWGJE/DataModel/JetSubtraction.h +++ b/PWGJE/DataModel/JetSubtraction.h @@ -22,6 +22,7 @@ #include "Framework/AnalysisDataModel.h" #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetReducedDataDQ.h" #include "PWGHF/DataModel/DerivedTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGDQ/DataModel/ReducedInfoTables.h" @@ -38,6 +39,7 @@ DECLARE_SOA_COLUMN(RhoM, rhoM, float); //! namespace bkgcharged { DECLARE_SOA_INDEX_COLUMN(JCollision, collision); +DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); } // namespace bkgcharged namespace bkgd0 @@ -45,144 +47,275 @@ namespace bkgd0 DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfD0Bases, "_0"); } // namespace bkgd0 +namespace bkgd0mc +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfD0PBases, "_0"); +} // namespace bkgd0mc + namespace bkglc { -DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, Hf3PBases, "_0"); +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfLcBases, "_0"); } // namespace bkglc +namespace bkglcmc +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfLcPBases, "_0"); +} // namespace bkglcmc + namespace bkgbplus { -DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfCandBplus, "_0"); +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfBplusBases, "_0"); } // namespace bkgbplus +namespace bkgbplusmc +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfBplusPBases, "_0"); +} // namespace bkgbplusmc + namespace bkgdielectron { DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, Dielectrons, "_0"); -// DECLARE_SOA_INDEX_COLUMN(Dielectron, candidate); } // namespace bkgdielectron +namespace bkgdielectronmc +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, JDielectronMcs, "_0"); +} // namespace bkgdielectronmc + DECLARE_SOA_TABLE(BkgChargedRhos, "AOD", "BkgCRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM); -DECLARE_SOA_TABLE(BkgD0Rhos, "AOD", "BkgD0Rho", +DECLARE_SOA_TABLE(BkgChargedMcRhos, "AOD", "BkgCMcRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<1>); -DECLARE_SOA_TABLE(BkgLcRhos, "AOD", "BkgLcRho", +DECLARE_SOA_TABLE(BkgD0Rhos, "AOD", "BkgD0Rho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<2>); -DECLARE_SOA_TABLE(BkgBplusRhos, "AOD", "BkgBPlRho", +DECLARE_SOA_TABLE(BkgD0McRhos, "AOD", "BkgD0McRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<3>); -DECLARE_SOA_TABLE(BkgDielectronRhos, "AOD", "BkgDIELRho", +DECLARE_SOA_TABLE(BkgLcRhos, "AOD", "BkgLcRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<4>); -namespace jtracksub -{ +DECLARE_SOA_TABLE(BkgLcMcRhos, "AOD", "BkgLcMcRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<5>); + +DECLARE_SOA_TABLE(BkgBplusRhos, "AOD", "BkgRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<6>); + +DECLARE_SOA_TABLE(BkgBplusMcRhos, "AOD", "BkgBPMcRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<7>); + +DECLARE_SOA_TABLE(BkgDielectronRhos, "AOD", "BkgDIELRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<8>); -DECLARE_SOA_COLUMN(Pt, pt, float); -DECLARE_SOA_COLUMN(Eta, eta, float); -DECLARE_SOA_COLUMN(Phi, phi, float); -DECLARE_SOA_COLUMN(Energy, energy, float); -DECLARE_SOA_COLUMN(TrackSel, trackSel, uint8_t); -DECLARE_SOA_DYNAMIC_COLUMN(Px, px, - [](float pt, float phi) -> float { return pt * std::cos(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Py, py, - [](float pt, float phi) -> float { return pt * std::sin(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, - [](float pt, float eta) -> float { return pt * std::sinh(eta); }); -DECLARE_SOA_DYNAMIC_COLUMN(P, p, - [](float pt, float eta) -> float { return pt * std::cosh(eta); }); -} // namespace jtracksub +DECLARE_SOA_TABLE(BkgDielectronMcRhos, "AOD", "BkgDIELMcRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<9>); DECLARE_SOA_TABLE(JTrackSubs, "AOD", "JTrackSubs", o2::soa::Index<>, bkgcharged::JCollisionId, - jtracksub::Pt, - jtracksub::Eta, - jtracksub::Phi, - jtracksub::Energy, - jtracksub::TrackSel, - jtracksub::Px, - jtracksub::Py, - jtracksub::Pz, - jtracksub::P); + jtrack::Pt, + jtrack::Eta, + jtrack::Phi, + jtrack::TrackSel, + jtrack::Px, + jtrack::Py, + jtrack::Pz, + jtrack::P, + jtrack::Energy); using JTrackSub = JTrackSubs::iterator; +DECLARE_SOA_TABLE(JMcParticleSubs, "AOD", "JMcPartSubs", + o2::soa::Index<>, + bkgcharged::JMcCollisionId, + jmcparticle::Pt, + jmcparticle::Eta, + jmcparticle::Phi, + jmcparticle::Y, + jmcparticle::E, + jmcparticle::PdgCode, + jmcparticle::GenStatusCode, + jmcparticle::HepMCStatusCode, + jmcparticle::IsPhysicalPrimary, + jmcparticle::Px, + jmcparticle::Py, + jmcparticle::Pz, + jmcparticle::P, + jmcparticle::Energy); + +using JMcParticleSub = JMcParticleSubs::iterator; + DECLARE_SOA_TABLE(JTrackD0Subs, "AOD", "JTrackD0Subs", o2::soa::Index<>, bkgd0::CandidateId, - jtracksub::Pt, - jtracksub::Eta, - jtracksub::Phi, - jtracksub::Energy, - jtracksub::TrackSel, - jtracksub::Px, - jtracksub::Py, - jtracksub::Pz, - jtracksub::P); + jtrack::Pt, + jtrack::Eta, + jtrack::Phi, + jtrack::TrackSel, + jtrack::Px, + jtrack::Py, + jtrack::Pz, + jtrack::P, + jtrack::Energy); using JTrackD0Sub = JTrackD0Subs::iterator; +DECLARE_SOA_TABLE(JMcParticleD0Subs, "AOD", "JMcPartD0Subs", + o2::soa::Index<>, + bkgd0mc::CandidateId, + jmcparticle::Pt, + jmcparticle::Eta, + jmcparticle::Phi, + jmcparticle::Y, + jmcparticle::E, + jmcparticle::PdgCode, + jmcparticle::GenStatusCode, + jmcparticle::HepMCStatusCode, + jmcparticle::IsPhysicalPrimary, + jmcparticle::Px, + jmcparticle::Py, + jmcparticle::Pz, + jmcparticle::P, + jmcparticle::Energy); + +using JMcParticleD0Sub = JMcParticleD0Subs::iterator; + DECLARE_SOA_TABLE(JTrackLcSubs, "AOD", "JTrackLcSubs", o2::soa::Index<>, bkglc::CandidateId, - jtracksub::Pt, - jtracksub::Eta, - jtracksub::Phi, - jtracksub::Energy, - jtracksub::TrackSel, - jtracksub::Px, - jtracksub::Py, - jtracksub::Pz, - jtracksub::P); + jtrack::Pt, + jtrack::Eta, + jtrack::Phi, + jtrack::TrackSel, + jtrack::Px, + jtrack::Py, + jtrack::Pz, + jtrack::P, + jtrack::Energy); using JTrackLcSub = JTrackLcSubs::iterator; -DECLARE_SOA_TABLE(JTrackBplusSubs, "AOD", "JTrackBPlSubs", +DECLARE_SOA_TABLE(JMcParticleLcSubs, "AOD", "JMcPartLcSubs", + o2::soa::Index<>, + bkglcmc::CandidateId, + jmcparticle::Pt, + jmcparticle::Eta, + jmcparticle::Phi, + jmcparticle::Y, + jmcparticle::E, + jmcparticle::PdgCode, + jmcparticle::GenStatusCode, + jmcparticle::HepMCStatusCode, + jmcparticle::IsPhysicalPrimary, + jmcparticle::Px, + jmcparticle::Py, + jmcparticle::Pz, + jmcparticle::P, + jmcparticle::Energy); + +using JMcParticleLcSub = JMcParticleLcSubs::iterator; + +DECLARE_SOA_TABLE(JTrackBplusSubs, "AOD", "JTrackBPSubs", o2::soa::Index<>, bkgbplus::CandidateId, - jtracksub::Pt, - jtracksub::Eta, - jtracksub::Phi, - jtracksub::Energy, - jtracksub::TrackSel, - jtracksub::Px, - jtracksub::Py, - jtracksub::Pz, - jtracksub::P); + jtrack::Pt, + jtrack::Eta, + jtrack::Phi, + jtrack::TrackSel, + jtrack::Px, + jtrack::Py, + jtrack::Pz, + jtrack::P, + jtrack::Energy); using JTrackBplusSub = JTrackBplusSubs::iterator; +DECLARE_SOA_TABLE(JMcParticleBplusSubs, "AOD", "JMcPartBPSubs", + o2::soa::Index<>, + bkgbplusmc::CandidateId, + jmcparticle::Pt, + jmcparticle::Eta, + jmcparticle::Phi, + jmcparticle::Y, + jmcparticle::E, + jmcparticle::PdgCode, + jmcparticle::GenStatusCode, + jmcparticle::HepMCStatusCode, + jmcparticle::IsPhysicalPrimary, + jmcparticle::Px, + jmcparticle::Py, + jmcparticle::Pz, + jmcparticle::P, + jmcparticle::Energy); + +using JMcParticleBplusSub = JMcParticleBplusSubs::iterator; + DECLARE_SOA_TABLE(JTrackDielectronSubs, "AOD", "JTrackDIELSubs", o2::soa::Index<>, bkgdielectron::CandidateId, - jtracksub::Pt, - jtracksub::Eta, - jtracksub::Phi, - jtracksub::Energy, - jtracksub::TrackSel, - jtracksub::Px, - jtracksub::Py, - jtracksub::Pz, - jtracksub::P); + jtrack::Pt, + jtrack::Eta, + jtrack::Phi, + jtrack::TrackSel, + jtrack::Px, + jtrack::Py, + jtrack::Pz, + jtrack::P, + jtrack::Energy); using JTrackDielectronSub = JTrackDielectronSubs::iterator; +DECLARE_SOA_TABLE(JMcParticleDielectronSubs, "AOD", "JMcPartDIELSubs", + o2::soa::Index<>, + bkgdielectronmc::CandidateId, + jmcparticle::Pt, + jmcparticle::Eta, + jmcparticle::Phi, + jmcparticle::Y, + jmcparticle::E, + jmcparticle::PdgCode, + jmcparticle::GenStatusCode, + jmcparticle::HepMCStatusCode, + jmcparticle::IsPhysicalPrimary, + jmcparticle::Px, + jmcparticle::Py, + jmcparticle::Pz, + jmcparticle::P, + jmcparticle::Energy); + +using JMcParticleDielectronSub = JMcParticleDielectronSubs::iterator; + } // namespace o2::aod #endif // PWGJE_DATAMODEL_JETSUBTRACTION_H_ diff --git a/PWGJE/JetFinders/CMakeLists.txt b/PWGJE/JetFinders/CMakeLists.txt index 4c63447cf36..ba4dbb132fc 100644 --- a/PWGJE/JetFinders/CMakeLists.txt +++ b/PWGJE/JetFinders/CMakeLists.txt @@ -14,108 +14,123 @@ add_subdirectory(Duplicates) if(FastJet_FOUND) o2physics_add_dpl_workflow(jet-finder-data-charged - SOURCES jetfinderdatacharged.cxx + SOURCES jetFinderDataCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-mcd-charged - SOURCES jetfindermcdcharged.cxx + SOURCES jetFinderMCDCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-mcp-charged - SOURCES jetfindermcpcharged.cxx + SOURCES jetFinderMCPCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-data-full - SOURCES jetfinderdatafull.cxx + SOURCES jetFinderDataFull.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-mcd-full - SOURCES jetfindermcdfull.cxx + SOURCES jetFinderMCDFull.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-mcp-full - SOURCES jetfindermcpfull.cxx + SOURCES jetFinderMCPFull.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-data-neutral - SOURCES jetfinderdataneutral.cxx + SOURCES jetFinderDataNeutral.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-mcd-neutral - SOURCES jetfindermcdneutral.cxx + SOURCES jetFinderMCDNeutral.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-mcp-neutral - SOURCES jetfindermcpneutral.cxx + SOURCES jetFinderMCPNeutral.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-d0-data-charged - SOURCES jetfinderD0datacharged.cxx + SOURCES jetFinderD0DataCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-d0-mcd-charged - SOURCES jetfinderD0mcdcharged.cxx + SOURCES jetFinderD0MCDCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-d0-mcp-charged - SOURCES jetfinderD0mcpcharged.cxx + SOURCES jetFinderD0MCPCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-lc-data-charged - SOURCES jetfinderLcdatacharged.cxx + SOURCES jetFinderLcDataCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-lc-mcd-charged - SOURCES jetfinderLcmcdcharged.cxx + SOURCES jetFinderLcMCDCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-lc-mcp-charged - SOURCES jetfinderLcmcpcharged.cxx + SOURCES jetFinderLcMCPCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-finder-bplus-data-charged + SOURCES jetFinderBplusDataCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-finder-bplus-mcd-charged + SOURCES jetFinderBplusMCDCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-finder-bplus-mcp-charged + SOURCES jetFinderBplusMCPCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-v0-data-charged - SOURCES jetfinderV0datacharged.cxx + SOURCES jetFinderV0DataCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-v0-mcd-charged - SOURCES jetfinderV0mcdcharged.cxx + SOURCES jetFinderV0MCDCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-v0-mcp-charged - SOURCES jetfinderV0mcpcharged.cxx + SOURCES jetFinderV0MCPCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-dielectron-data-charged - SOURCES jetfinderDielectrondatacharged.cxx + SOURCES jetFinderDielectronDataCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-dielectron-mcd-charged - SOURCES jetfinderDielectronmcdcharged.cxx + SOURCES jetFinderDielectronMCDCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-dielectron-mcp-charged - SOURCES jetfinderDielectronmcpcharged.cxx + SOURCES jetFinderDielectronMCPCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) diff --git a/PWGJE/JetFinders/Duplicates/CMakeLists.txt b/PWGJE/JetFinders/Duplicates/CMakeLists.txt index a884489b29c..4270de9f221 100644 --- a/PWGJE/JetFinders/Duplicates/CMakeLists.txt +++ b/PWGJE/JetFinders/Duplicates/CMakeLists.txt @@ -13,17 +13,17 @@ if(FastJet_FOUND) o2physics_add_dpl_workflow(jet-finder-data-charged-1 - SOURCES jetfinderdatacharged1.cxx + SOURCES jetFinderDataCharged1.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-mcd-charged-1 - SOURCES jetfindermcdcharged1.cxx + SOURCES jetFinderMCDCharged1.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-mcp-charged-1 - SOURCES jetfindermcpcharged1.cxx + SOURCES jetFinderMCPCharged1.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) diff --git a/PWGJE/JetFinders/Duplicates/jetfinderdatacharged1.cxx b/PWGJE/JetFinders/Duplicates/jetFinderDataCharged1.cxx similarity index 96% rename from PWGJE/JetFinders/Duplicates/jetfinderdatacharged1.cxx rename to PWGJE/JetFinders/Duplicates/jetFinderDataCharged1.cxx index d102d57c675..46f2dd88df8 100644 --- a/PWGJE/JetFinders/Duplicates/jetfinderdatacharged1.cxx +++ b/PWGJE/JetFinders/Duplicates/jetFinderDataCharged1.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderDataCharged1 = JetFinderTask; diff --git a/PWGJE/JetFinders/Duplicates/jetfindermcdcharged1.cxx b/PWGJE/JetFinders/Duplicates/jetFinderMCDCharged1.cxx similarity index 96% rename from PWGJE/JetFinders/Duplicates/jetfindermcdcharged1.cxx rename to PWGJE/JetFinders/Duplicates/jetFinderMCDCharged1.cxx index 36f9412aad2..4a13537a48b 100644 --- a/PWGJE/JetFinders/Duplicates/jetfindermcdcharged1.cxx +++ b/PWGJE/JetFinders/Duplicates/jetFinderMCDCharged1.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderMCDetectorLevelCharged1 = JetFinderTask; diff --git a/PWGJE/JetFinders/Duplicates/jetfindermcpcharged1.cxx b/PWGJE/JetFinders/Duplicates/jetFinderMCPCharged1.cxx similarity index 96% rename from PWGJE/JetFinders/Duplicates/jetfindermcpcharged1.cxx rename to PWGJE/JetFinders/Duplicates/jetFinderMCPCharged1.cxx index ff1d2a10e2b..68e3f861ae6 100644 --- a/PWGJE/JetFinders/Duplicates/jetfindermcpcharged1.cxx +++ b/PWGJE/JetFinders/Duplicates/jetFinderMCPCharged1.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderMCParticleLevelCharged1 = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfinder.cxx b/PWGJE/JetFinders/jetFinder.cxx similarity index 91% rename from PWGJE/JetFinders/jetfinder.cxx rename to PWGJE/JetFinders/jetFinder.cxx index 61eb0fbacb4..bbbdcb4b92c 100644 --- a/PWGJE/JetFinders/jetfinder.cxx +++ b/PWGJE/JetFinders/jetFinder.cxx @@ -15,6 +15,8 @@ /// \author Jochen Klein /// \author Raymond Ehlers , ORNL +#include + #include "PWGJE/Core/JetFindingUtilities.h" #include "Framework/runDataProcessing.h" @@ -139,7 +141,6 @@ struct JetFinderTask { aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax); Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta >= trackEtaMin && aod::jtrack::eta <= trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); // do we need eta cut both here and in globalselection? - Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta >= trackEtaMin && aod::jtracksub::eta <= trackEtaMax && aod::jtracksub::phi >= trackPhiMin && aod::jtracksub::phi <= trackPhiMax); Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta >= trackEtaMin && aod::jmcparticle::eta <= trackEtaMax && aod::jmcparticle::phi >= trackPhiMin && aod::jmcparticle::phi <= trackPhiMax); Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta >= clusterEtaMin && aod::jcluster::eta <= clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); @@ -200,16 +201,25 @@ struct JetFinderTask { { // TODO: MC event selection? inputParticles.clear(); - jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 1, particles, pdgDatabase); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 1, particles, pdgDatabase); jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJetMCP")) : std::shared_ptr(nullptr), fillTHnSparse); } PROCESS_SWITCH(JetFinderTask, processParticleLevelChargedJets, "Particle level charged jet finding", false); + void processParticleLevelChargedEvtWiseSubJets(aod::JetMcCollision const& collision, soa::Filtered const& particles) + { + // TODO: MC event selection? + inputParticles.clear(); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 1, particles, pdgDatabase); + jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJetMCP")) : std::shared_ptr(nullptr), fillTHnSparse); + } + PROCESS_SWITCH(JetFinderTask, processParticleLevelChargedEvtWiseSubJets, "Particle level charged with event-wise constituent subtraction jet finding", false); + void processParticleLevelNeutralJets(aod::JetMcCollision const& collision, soa::Filtered const& particles) { // TODO: MC event selection? inputParticles.clear(); - jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 2, particles, pdgDatabase); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 2, particles, pdgDatabase); jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJetMCP")) : std::shared_ptr(nullptr), fillTHnSparse); } PROCESS_SWITCH(JetFinderTask, processParticleLevelNeutralJets, "Particle level neutral jet finding", false); @@ -218,7 +228,7 @@ struct JetFinderTask { { // TODO: MC event selection? inputParticles.clear(); - jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 0, particles, pdgDatabase); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 0, particles, pdgDatabase); jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJetMCP")) : std::shared_ptr(nullptr), fillTHnSparse); } diff --git a/PWGJE/JetFinders/jetFinderBplusDataCharged.cxx b/PWGJE/JetFinders/jetFinderBplusDataCharged.cxx new file mode 100644 index 00000000000..402527211fb --- /dev/null +++ b/PWGJE/JetFinders/jetFinderBplusDataCharged.cxx @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet finder B+ data charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +using JetFinderBplusDataCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsData", true}}}, + TaskName{"jet-finder-bplus-data-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/JetFinders/jetFinderBplusMCDCharged.cxx b/PWGJE/JetFinders/jetFinderBplusMCDCharged.cxx new file mode 100644 index 00000000000..4eed52e30b3 --- /dev/null +++ b/PWGJE/JetFinders/jetFinderBplusMCDCharged.cxx @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet finder B+ mcd charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +using JetFinderBplusMCDetectorLevelCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsMCD", true}}}, + TaskName{"jet-finder-bplus-mcd-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/JetFinders/jetFinderBplusMCPCharged.cxx b/PWGJE/JetFinders/jetFinderBplusMCPCharged.cxx new file mode 100644 index 00000000000..83a1e7c9d60 --- /dev/null +++ b/PWGJE/JetFinders/jetFinderBplusMCPCharged.cxx @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet finder B+ mcp charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +using JetFinderBplusMCParticleLevelCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsMCP", true}}}, + TaskName{"jet-finder-bplus-mcp-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/JetFinders/jetfinderD0datacharged.cxx b/PWGJE/JetFinders/jetFinderD0DataCharged.cxx similarity index 84% rename from PWGJE/JetFinders/jetfinderD0datacharged.cxx rename to PWGJE/JetFinders/jetFinderD0DataCharged.cxx index d26fb239ea3..29ab757dbce 100644 --- a/PWGJE/JetFinders/jetfinderD0datacharged.cxx +++ b/PWGJE/JetFinders/jetFinderD0DataCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderD0DataCharged = JetFinderHFTask; +using JetFinderD0DataCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderD0mcdcharged.cxx b/PWGJE/JetFinders/jetFinderD0MCDCharged.cxx similarity index 81% rename from PWGJE/JetFinders/jetfinderD0mcdcharged.cxx rename to PWGJE/JetFinders/jetFinderD0MCDCharged.cxx index afc97fad2b1..46847bf8651 100644 --- a/PWGJE/JetFinders/jetfinderD0mcdcharged.cxx +++ b/PWGJE/JetFinders/jetFinderD0MCDCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderD0MCDetectorLevelCharged = JetFinderHFTask; +using JetFinderD0MCDetectorLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderD0mcpcharged.cxx b/PWGJE/JetFinders/jetFinderD0MCPCharged.cxx similarity index 81% rename from PWGJE/JetFinders/jetfinderD0mcpcharged.cxx rename to PWGJE/JetFinders/jetFinderD0MCPCharged.cxx index a92690ebe2a..a21aceff347 100644 --- a/PWGJE/JetFinders/jetfinderD0mcpcharged.cxx +++ b/PWGJE/JetFinders/jetFinderD0MCPCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderD0MCParticleLevelCharged = JetFinderHFTask; +using JetFinderD0MCParticleLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderdatacharged.cxx b/PWGJE/JetFinders/jetFinderDataCharged.cxx similarity index 96% rename from PWGJE/JetFinders/jetfinderdatacharged.cxx rename to PWGJE/JetFinders/jetFinderDataCharged.cxx index df740ad2dba..e713eb4fa7c 100644 --- a/PWGJE/JetFinders/jetfinderdatacharged.cxx +++ b/PWGJE/JetFinders/jetFinderDataCharged.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderDataCharged = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfinderdatafull.cxx b/PWGJE/JetFinders/jetFinderDataFull.cxx similarity index 96% rename from PWGJE/JetFinders/jetfinderdatafull.cxx rename to PWGJE/JetFinders/jetFinderDataFull.cxx index a75896212be..07d103d93b2 100644 --- a/PWGJE/JetFinders/jetfinderdatafull.cxx +++ b/PWGJE/JetFinders/jetFinderDataFull.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderDataFull = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfinderdataneutral.cxx b/PWGJE/JetFinders/jetFinderDataNeutral.cxx similarity index 96% rename from PWGJE/JetFinders/jetfinderdataneutral.cxx rename to PWGJE/JetFinders/jetFinderDataNeutral.cxx index a325de11bbd..28a1b898a15 100644 --- a/PWGJE/JetFinders/jetfinderdataneutral.cxx +++ b/PWGJE/JetFinders/jetFinderDataNeutral.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderDataNeutral = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfinderDielectrondatacharged.cxx b/PWGJE/JetFinders/jetFinderDielectronDataCharged.cxx similarity index 80% rename from PWGJE/JetFinders/jetfinderDielectrondatacharged.cxx rename to PWGJE/JetFinders/jetFinderDielectronDataCharged.cxx index 1703462a168..2b040080579 100644 --- a/PWGJE/JetFinders/jetfinderDielectrondatacharged.cxx +++ b/PWGJE/JetFinders/jetFinderDielectronDataCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderDielectronDataCharged = JetFinderHFTask; +using JetFinderDielectronDataCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderDielectronmcdcharged.cxx b/PWGJE/JetFinders/jetFinderDielectronMCDCharged.cxx similarity index 77% rename from PWGJE/JetFinders/jetfinderDielectronmcdcharged.cxx rename to PWGJE/JetFinders/jetFinderDielectronMCDCharged.cxx index 87b3a5b8013..105b58d459a 100644 --- a/PWGJE/JetFinders/jetfinderDielectronmcdcharged.cxx +++ b/PWGJE/JetFinders/jetFinderDielectronMCDCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderDielectronMCDetectorLevelCharged = JetFinderHFTask; +using JetFinderDielectronMCDetectorLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderDielectronmcpcharged.cxx b/PWGJE/JetFinders/jetFinderDielectronMCPCharged.cxx similarity index 77% rename from PWGJE/JetFinders/jetfinderDielectronmcpcharged.cxx rename to PWGJE/JetFinders/jetFinderDielectronMCPCharged.cxx index b72e82ed53e..b6aa797e80e 100644 --- a/PWGJE/JetFinders/jetfinderDielectronmcpcharged.cxx +++ b/PWGJE/JetFinders/jetFinderDielectronMCPCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderDielectronMCParticleLevelCharged = JetFinderHFTask; +using JetFinderDielectronMCParticleLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderhf.cxx b/PWGJE/JetFinders/jetFinderHF.cxx similarity index 90% rename from PWGJE/JetFinders/jetfinderhf.cxx rename to PWGJE/JetFinders/jetFinderHF.cxx index db62faee40d..53b6114cbe7 100644 --- a/PWGJE/JetFinders/jetfinderhf.cxx +++ b/PWGJE/JetFinders/jetFinderHF.cxx @@ -14,6 +14,8 @@ /// \author Nima Zardoshti /// \author Jochen Klein +#include + #include "CommonConstants/PhysicsConstants.h" #include "PWGJE/Core/JetFindingUtilities.h" @@ -24,26 +26,10 @@ using namespace o2::analysis; using namespace o2::framework; using namespace o2::framework::expressions; -/* -void customize(std::vector& workflowOptions) -{ - std::vector hfjetworkflows{{"d0-data-charged", VariantType::Int, 1, {"D0 jets charged data"}}, - {"d0-mcd-charged", VariantType::Int, 0, {"D0 jets charged MCD"}}, - {"d0-mcp-charged", VariantType::Int, 0, {"D0 jets charged MCD"}}, - {"bplus-data-charged", VariantType::Int, 0, {"B+ jets charged MCD"}}, - {"bplus-mcd-charged", VariantType::Int, 0, {"B+ jets charged MCD"}}, - {"bplus-mcp-charged", VariantType::Int, 0, {"B+ jets charged MCD"}}, - {"lc-data-charged", VariantType::Int, 0, {"Lc jets charged MCD"}}, - {"lc-mcd-charged", VariantType::Int, 0, {"Lc jets charged MCD"}}, - {"lc-mcp-charged", VariantType::Int, 0, {"Lc jets charged MCD"}}}; - std::swap(workflowOptions, hfjetworkflows); -} -*/ - // NB: runDataProcessing.h must be included after customize! #include "Framework/runDataProcessing.h" -template +template struct JetFinderHFTask { Produces jetsTable; Produces constituentsTable; @@ -167,15 +153,18 @@ struct JetFinderHFTask { aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax); Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta >= trackEtaMin && aod::jtrack::eta <= trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); - Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta >= trackEtaMin && aod::jtracksub::eta <= trackEtaMax && aod::jtracksub::phi >= trackPhiMin && aod::jtracksub::phi <= trackPhiMax); Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta >= trackEtaMin && aod::jmcparticle::eta <= trackEtaMax && aod::jmcparticle::phi >= trackPhiMin && aod::jmcparticle::phi <= trackPhiMax); Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta >= clusterEtaMin && aod::jcluster::eta <= clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); // Filter candidateCuts = (aod::hfcand::pt >= candPtMin && aod::hfcand::pt < candPtMax && aod::hfcand::y >= candYMin && aod::hfcand::y < candYMax); PresliceOptional> perD0Candidate = aod::bkgd0::candidateId; + PresliceOptional> perD0McCandidate = aod::bkgd0mc::candidateId; PresliceOptional> perLcCandidate = aod::bkglc::candidateId; + PresliceOptional> perLcMcCandidate = aod::bkglcmc::candidateId; PresliceOptional> perBplusCandidate = aod::bkgbplus::candidateId; + PresliceOptional> perBplusMcCandidate = aod::bkgbplusmc::candidateId; PresliceOptional> perDielectronCandidate = aod::bkgdielectron::candidateId; + PresliceOptional> perDielectronMcCandidate = aod::bkgdielectronmc::candidateId; // function that generalically processes Data and reco level events template @@ -206,7 +195,7 @@ struct JetFinderHFTask { } // function that generalically processes gen level events - template + template void analyseMCP(T const& collision, U const& particles, V const& candidate, int jetTypeParticleLevel, float minJetPt, float maxJetPt) { if (rejectIncorrectDecaysMCP && !jetcandidateutilities::isMatchedCandidate(candidate)) { // is this even needed in the new derived format? it means any simulations run have to force the decay channel @@ -217,7 +206,11 @@ struct JetFinderHFTask { if (!jetfindingutilities::analyseCandidate(inputParticles, candidate, candPtMin, candPtMax, candYMin, candYMax)) { return; } - jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, std::optional{candidate}); + if constexpr (checkIsDaughter) { + jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, std::optional{candidate}); + } else { + jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, std::optional{candidate}); + } jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse, true); } @@ -263,8 +256,18 @@ struct JetFinderHFTask { CandidateTableMCP const& candidates) { for (typename CandidateTableMCP::iterator const& candidate : candidates) { - analyseMCP(collision, particles, candidate, 1, jetPtMin, jetPtMax); + analyseMCP(collision, particles, candidate, 1, jetPtMin, jetPtMax); } } PROCESS_SWITCH(JetFinderHFTask, processChargedJetsMCP, "hf jet finding on MC particle level", false); + + void processChargedEvtWiseSubJetsMCP(aod::JetMcCollision const& collision, + soa::Filtered const& particles, + CandidateTableMCP const& candidates) + { + for (typename CandidateTableMCP::iterator const& candidate : candidates) { + analyseMCP(collision, jetcandidateutilities::slicedPerCandidate(particles, candidate, perD0McCandidate, perLcMcCandidate, perBplusMcCandidate, perDielectronMcCandidate), candidate, 1, jetPtMin, jetPtMax); + } + } + PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsMCP, "hf jet finding on MC particle level", false); }; diff --git a/PWGJE/JetFinders/jetfinderLcdatacharged.cxx b/PWGJE/JetFinders/jetFinderLcDataCharged.cxx similarity index 84% rename from PWGJE/JetFinders/jetfinderLcdatacharged.cxx rename to PWGJE/JetFinders/jetFinderLcDataCharged.cxx index bf522020db8..821cbd87df8 100644 --- a/PWGJE/JetFinders/jetfinderLcdatacharged.cxx +++ b/PWGJE/JetFinders/jetFinderLcDataCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderLcDataCharged = JetFinderHFTask; +using JetFinderLcDataCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderLcmcdcharged.cxx b/PWGJE/JetFinders/jetFinderLcMCDCharged.cxx similarity index 81% rename from PWGJE/JetFinders/jetfinderLcmcdcharged.cxx rename to PWGJE/JetFinders/jetFinderLcMCDCharged.cxx index 410d51695b1..c25f35c0efb 100644 --- a/PWGJE/JetFinders/jetfinderLcmcdcharged.cxx +++ b/PWGJE/JetFinders/jetFinderLcMCDCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderLcMCDetectorLevelCharged = JetFinderHFTask; +using JetFinderLcMCDetectorLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderLcmcpcharged.cxx b/PWGJE/JetFinders/jetFinderLcMCPCharged.cxx similarity index 81% rename from PWGJE/JetFinders/jetfinderLcmcpcharged.cxx rename to PWGJE/JetFinders/jetFinderLcMCPCharged.cxx index 9183edef828..41607ed57d9 100644 --- a/PWGJE/JetFinders/jetfinderLcmcpcharged.cxx +++ b/PWGJE/JetFinders/jetFinderLcMCPCharged.cxx @@ -13,9 +13,9 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderhf.cxx" +#include "PWGJE/JetFinders/jetFinderHF.cxx" -using JetFinderLcMCParticleLevelCharged = JetFinderHFTask; +using JetFinderLcMCParticleLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfindermcdcharged.cxx b/PWGJE/JetFinders/jetFinderMCDCharged.cxx similarity index 96% rename from PWGJE/JetFinders/jetfindermcdcharged.cxx rename to PWGJE/JetFinders/jetFinderMCDCharged.cxx index 6f248edcaf8..d8558a57770 100644 --- a/PWGJE/JetFinders/jetfindermcdcharged.cxx +++ b/PWGJE/JetFinders/jetFinderMCDCharged.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderMCDetectorLevelCharged = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfindermcdfull.cxx b/PWGJE/JetFinders/jetFinderMCDFull.cxx similarity index 96% rename from PWGJE/JetFinders/jetfindermcdfull.cxx rename to PWGJE/JetFinders/jetFinderMCDFull.cxx index 29464e814c9..0123b75d823 100644 --- a/PWGJE/JetFinders/jetfindermcdfull.cxx +++ b/PWGJE/JetFinders/jetFinderMCDFull.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderMCDetectorLevelFull = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfindermcdneutral.cxx b/PWGJE/JetFinders/jetFinderMCDNeutral.cxx similarity index 96% rename from PWGJE/JetFinders/jetfindermcdneutral.cxx rename to PWGJE/JetFinders/jetFinderMCDNeutral.cxx index f58cc09492d..9e8225b0c5f 100644 --- a/PWGJE/JetFinders/jetfindermcdneutral.cxx +++ b/PWGJE/JetFinders/jetFinderMCDNeutral.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderMCDetectorLevelNeutral = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfindermcpcharged.cxx b/PWGJE/JetFinders/jetFinderMCPCharged.cxx similarity index 96% rename from PWGJE/JetFinders/jetfindermcpcharged.cxx rename to PWGJE/JetFinders/jetFinderMCPCharged.cxx index 41981a193f1..9cba0092a53 100644 --- a/PWGJE/JetFinders/jetfindermcpcharged.cxx +++ b/PWGJE/JetFinders/jetFinderMCPCharged.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderMCParticleLevelCharged = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfindermcpfull.cxx b/PWGJE/JetFinders/jetFinderMCPFull.cxx similarity index 96% rename from PWGJE/JetFinders/jetfindermcpfull.cxx rename to PWGJE/JetFinders/jetFinderMCPFull.cxx index cd0bda48730..ff9c26e4d91 100644 --- a/PWGJE/JetFinders/jetfindermcpfull.cxx +++ b/PWGJE/JetFinders/jetFinderMCPFull.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderMCParticleLevelFull = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfindermcpneutral.cxx b/PWGJE/JetFinders/jetFinderMCPNeutral.cxx similarity index 96% rename from PWGJE/JetFinders/jetfindermcpneutral.cxx rename to PWGJE/JetFinders/jetFinderMCPNeutral.cxx index e4f8c00683f..8593fb1f644 100644 --- a/PWGJE/JetFinders/jetfindermcpneutral.cxx +++ b/PWGJE/JetFinders/jetFinderMCPNeutral.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinder.cxx" +#include "PWGJE/JetFinders/jetFinder.cxx" using JetFinderMCParticleLevelNeutral = JetFinderTask; diff --git a/PWGJE/JetFinders/jetfinderv0.cxx b/PWGJE/JetFinders/jetFinderV0.cxx similarity index 98% rename from PWGJE/JetFinders/jetfinderv0.cxx rename to PWGJE/JetFinders/jetFinderV0.cxx index e36fb6235de..4398a3b1a7a 100644 --- a/PWGJE/JetFinders/jetfinderv0.cxx +++ b/PWGJE/JetFinders/jetFinderV0.cxx @@ -13,6 +13,8 @@ // /// \author Nima Zardoshti +#include + #include "CommonConstants/PhysicsConstants.h" #include "PWGJE/Core/JetFindingUtilities.h" @@ -177,7 +179,7 @@ struct JetFinderV0Task { if (!jetfindingutilities::analyseV0s(inputParticles, candidates, candPtMin, candPtMax, candYMin, candYMax, candIndex)) { return; } - jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, std::optional{candidates}); + jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, std::optional{candidates}); jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse, true); } diff --git a/PWGJE/JetFinders/jetfinderV0datacharged.cxx b/PWGJE/JetFinders/jetFinderV0DataCharged.cxx similarity index 96% rename from PWGJE/JetFinders/jetfinderV0datacharged.cxx rename to PWGJE/JetFinders/jetFinderV0DataCharged.cxx index b080f135c6b..7b1ac0a261f 100644 --- a/PWGJE/JetFinders/jetfinderV0datacharged.cxx +++ b/PWGJE/JetFinders/jetFinderV0DataCharged.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderv0.cxx" +#include "PWGJE/JetFinders/jetFinderV0.cxx" using JetFinderV0DataCharged = JetFinderV0Task; diff --git a/PWGJE/JetFinders/jetfinderV0mcdcharged.cxx b/PWGJE/JetFinders/jetFinderV0MCDCharged.cxx similarity index 96% rename from PWGJE/JetFinders/jetfinderV0mcdcharged.cxx rename to PWGJE/JetFinders/jetFinderV0MCDCharged.cxx index b46ddeb1b28..30442208085 100644 --- a/PWGJE/JetFinders/jetfinderV0mcdcharged.cxx +++ b/PWGJE/JetFinders/jetFinderV0MCDCharged.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderv0.cxx" +#include "PWGJE/JetFinders/jetFinderV0.cxx" using JetFinderV0MCDetectorLevelCharged = JetFinderV0Task; diff --git a/PWGJE/JetFinders/jetfinderV0mcpcharged.cxx b/PWGJE/JetFinders/jetFinderV0MCPCharged.cxx similarity index 96% rename from PWGJE/JetFinders/jetfinderV0mcpcharged.cxx rename to PWGJE/JetFinders/jetFinderV0MCPCharged.cxx index 29f0fee1bd2..27de0bdbc3c 100644 --- a/PWGJE/JetFinders/jetfinderV0mcpcharged.cxx +++ b/PWGJE/JetFinders/jetFinderV0MCPCharged.cxx @@ -13,7 +13,7 @@ // /// \author Nima Zardoshti -#include "PWGJE/JetFinders/jetfinderv0.cxx" +#include "PWGJE/JetFinders/jetFinderV0.cxx" using JetFinderV0MCParticleLevelCharged = JetFinderV0Task; diff --git a/PWGJE/TableProducer/CMakeLists.txt b/PWGJE/TableProducer/CMakeLists.txt index 12fa8359820..4e8141566f3 100644 --- a/PWGJE/TableProducer/CMakeLists.txt +++ b/PWGJE/TableProducer/CMakeLists.txt @@ -9,91 +9,77 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. +add_subdirectory(Matching) if(FastJet_FOUND) o2physics_add_dpl_workflow(jet-deriveddata-producer - SOURCES jetderiveddataproducer.cxx + SOURCES derivedDataProducer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-deriveddata-trigger-producer - SOURCES jetderiveddatatriggerproducer.cxx + SOURCES derivedDataTriggerProducer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-deriveddata-producer-dummy - SOURCES jetderiveddataproducerdummy.cxx + SOURCES derivedDataProducerDummy.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-deriveddata-producer-dummy-d0 - SOURCES jetderiveddataproducerdummyd0.cxx + SOURCES derivedDataProducerDummyD0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-deriveddata-producer-dummy-lc - SOURCES jetderiveddataproducerdummylc.cxx + SOURCES derivedDataProducerDummyLc.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-deriveddata-producer-dummy-bplus + SOURCES derivedDataProducerDummyBplus.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-deriveddata-producer-dummy-dielectron - SOURCES jetderiveddataproducerdummydielectron.cxx + SOURCES derivedDataProducerDummyDielectron.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-deriveddata-writer - SOURCES jetderiveddatawriter.cxx + SOURCES derivedDataWriter.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-luminosity-producer - SOURCES luminosityproducer.cxx + SOURCES luminosityProducer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-luminosity-calculator - SOURCES luminositycalculator.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(jet-matching-mc - SOURCES jetmatchingmc.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(jet-matching-sub - SOURCES jetmatchingsub.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(jet-matching-mc-sub - SOURCES jetmatchingmcsub.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(jet-matching-duplicates - SOURCES jetmatchingduplicates.cxx + SOURCES luminosityCalculator.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-eventweight-mcd - SOURCES jeteventweightmcd.cxx + SOURCES jetEventWeightMCD.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-eventweight-mcp - SOURCES jeteventweightmcp.cxx + SOURCES jetEventWeightMCP.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-track-derived - SOURCES jettrackderived.cxx + SOURCES jetTrackDerived.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-taggerhf - SOURCES jettaggerhf.cxx + SOURCES jetTaggerHF.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGJE/TableProducer/Matching/CMakeLists.txt b/PWGJE/TableProducer/Matching/CMakeLists.txt new file mode 100644 index 00000000000..a3848f352e7 --- /dev/null +++ b/PWGJE/TableProducer/Matching/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +# All rights not expressly granted are reserved. +# +# This software is distributed under the terms of the GNU General Public +# License v3 (GPL Version 3), copied verbatim in the file "COPYING". +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +add_subdirectory(Duplicates) + +if(FastJet_FOUND) + +o2physics_add_dpl_workflow(jet-matching-mc-ch + SOURCES jetMatchingMCCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-full + SOURCES jetMatchingMCFull.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-neutral + SOURCES jetMatchingMCNeutral.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-d0-ch + SOURCES jetMatchingMCD0Charged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-lc-ch + SOURCES jetMatchingMCLcCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-bplus-ch + SOURCES jetMatchingMCBplusCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-dielectron-ch + SOURCES jetMatchingMCDielectronCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-v0-ch + SOURCES jetMatchingMCV0Charged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-sub-ch + SOURCES jetMatchingMCSubCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-sub-d0-ch + SOURCES jetMatchingMCSubD0Charged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-sub-lc-ch + SOURCES jetMatchingMCSubLcCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-sub-bplus-ch + SOURCES jetMatchingMCSubBplusCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-sub-dielectron-ch + SOURCES jetMatchingMCSubDielectronCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-sub-ch + SOURCES jetMatchingSubCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-sub-d0-ch + SOURCES jetMatchingSubD0Charged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-sub-lc-ch + SOURCES jetMatchingSubLcCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-sub-bplus-ch + SOURCES jetMatchingSubBplusCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-sub-dielectron-ch + SOURCES jetMatchingSubDielectronCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +endif() diff --git a/PWGJE/TableProducer/Matching/Duplicates/CMakeLists.txt b/PWGJE/TableProducer/Matching/Duplicates/CMakeLists.txt new file mode 100644 index 00000000000..52a7a0377c9 --- /dev/null +++ b/PWGJE/TableProducer/Matching/Duplicates/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +# All rights not expressly granted are reserved. +# +# This software is distributed under the terms of the GNU General Public +# License v3 (GPL Version 3), copied verbatim in the file "COPYING". +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +if(FastJet_FOUND) + +o2physics_add_dpl_workflow(jet-matching-data-ch-1 + SOURCES jetMatchingDuplicatesChargedData1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mcd-ch-1 + SOURCES jetMatchingDuplicatesChargedMCD1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mcp-ch-1 + SOURCES jetMatchingDuplicatesChargedMCP1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +endif() diff --git a/PWGJE/TableProducer/jetmatchingduplicates.cxx b/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicates.cxx similarity index 64% rename from PWGJE/TableProducer/jetmatchingduplicates.cxx rename to PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicates.cxx index 3c6ef791d4f..bc4711efae3 100644 --- a/PWGJE/TableProducer/jetmatchingduplicates.cxx +++ b/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicates.cxx @@ -53,11 +53,6 @@ struct JetMatchingDuplicates { { } - void processDummy(aod::JetCollisions const&) - { - } - PROCESS_SWITCH(JetMatchingDuplicates, processDummy, "Dummy process", true); - void processJets(aod::JetCollisions const& collisions, JetsBase const& jetsBase, JetsTag const& jetsTag, Tracks const& tracks, Candidates const& candidates) @@ -89,37 +84,5 @@ struct JetMatchingDuplicates { jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order } } - PROCESS_SWITCH(JetMatchingDuplicates, processJets, "Perform jet matching", false); + PROCESS_SWITCH(JetMatchingDuplicates, processJets, "Perform jet matching", true); }; - -using Charged1JetDataMatching = JetMatchingDuplicates, - soa::Join, - aod::ChargedJetsMatchedToCharged1Jets, - aod::Charged1JetsMatchedToChargedJets, - aod::JTracks, - aod::JDummys>; - -using Charged1JetMCDMatching = JetMatchingDuplicates, - soa::Join, - aod::ChargedMCDetectorLevelJetsMatchedToCharged1MCDetectorLevelJets, - aod::Charged1MCDetectorLevelJetsMatchedToChargedMCDetectorLevelJets, - aod::JTracks, - aod::JDummys>; - -using Charged1JetMCPMatching = JetMatchingDuplicates, - soa::Join, - aod::ChargedMCParticleLevelJetsMatchedToCharged1MCParticleLevelJets, - aod::Charged1MCParticleLevelJetsMatchedToChargedMCParticleLevelJets, - aod::JMcParticles, - aod::JDummys>; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-data-ch-1"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mcd-ch-1"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mcp-ch-1"})); - - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedData1.cxx b/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedData1.cxx new file mode 100644 index 00000000000..8115c95bf04 --- /dev/null +++ b/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedData1.cxx @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching duplicates charged data task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicates.cxx" + +using Charged1JetDataMatchingDupliacates = JetMatchingDuplicates, + soa::Join, + aod::ChargedJetsMatchedToCharged1Jets, + aod::Charged1JetsMatchedToChargedJets, + aod::JTracks, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-data-ch-1"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedMCD1.cxx b/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedMCD1.cxx new file mode 100644 index 00000000000..96033d17d4e --- /dev/null +++ b/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedMCD1.cxx @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching duplicates charged mcd task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicates.cxx" + +using Charged1JetMCDMatchingDupliacates = JetMatchingDuplicates, + soa::Join, + aod::ChargedMCDetectorLevelJetsMatchedToCharged1MCDetectorLevelJets, + aod::Charged1MCDetectorLevelJetsMatchedToChargedMCDetectorLevelJets, + aod::JTracks, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mcd-ch-1"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedMCP1.cxx b/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedMCP1.cxx new file mode 100644 index 00000000000..11b39822bcb --- /dev/null +++ b/PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicatesChargedMCP1.cxx @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching duplicates charged mcp task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/Duplicates/jetMatchingDuplicates.cxx" + +using Charged1JetMCPMatchingDupliacates = JetMatchingDuplicates, + soa::Join, + aod::ChargedMCParticleLevelJetsMatchedToCharged1MCParticleLevelJets, + aod::Charged1MCParticleLevelJetsMatchedToChargedMCParticleLevelJets, + aod::JMcParticles, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mcp-ch-1"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMC.cxx b/PWGJE/TableProducer/Matching/jetMatchingMC.cxx new file mode 100644 index 00000000000..ef56702af09 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMC.cxx @@ -0,0 +1,104 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file jetmatchingmc.cxx +/// \brief matching detector level and generator level jets +/// +/// \author Raymond Ehlers , ORNL +/// \author Jochen Klein +/// \author Aimeric Lanodu +/// \author Nima Zardoshti + +#include + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/runDataProcessing.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/Core/JetMatchingUtilities.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +template +struct JetMatchingMc { + + Configurable doMatchingGeo{"doMatchingGeo", true, "Enable geometric matching"}; + Configurable doMatchingPt{"doMatchingPt", true, "Enable pt matching"}; + Configurable doMatchingHf{"doMatchingHf", false, "Enable HF matching"}; + Configurable maxMatchingDistance{"maxMatchingDistance", 0.24f, "Max matching distance"}; + Configurable minPtFraction{"minPtFraction", 0.5f, "Minimum pt fraction for pt matching"}; + + Produces jetsBasetoTagMatchingTable; + Produces jetsTagtoBaseMatchingTable; + + // preslicing jet collections, only for Mc-based collection + static constexpr bool jetsBaseIsMc = o2::soa::relatedByIndex(); + static constexpr bool jetsTagIsMc = o2::soa::relatedByIndex(); + + Preslice baseJetsPerCollision = jetsBaseIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId; + Preslice tagJetsPerCollision = jetsTagIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId; + + PresliceUnsorted CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; + + void init(InitContext const&) + { + } + + void processJets(aod::JetMcCollisions const& mcCollisions, aod::JetCollisionsMCD const& collisions, + JetsBase const& jetsBase, JetsTag const& jetsTag, + aod::JetTracksMCD const& tracks, + ClustersBase const& clusters, + aod::JetParticles const& particles, + CandidatesBase const& candidatesBase, + CandidatesTag const& candidatesTag) + { + + // initialise objects used to store the matching index arrays (array in case a mcCollision is split) before filling the matching tables + std::vector> jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF; + std::vector> jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF; + // waiting for framework fix to make sliced collection of same type as original collection: + jetsBasetoTagMatchingGeo.assign(jetsBase.size(), {}); + jetsBasetoTagMatchingPt.assign(jetsBase.size(), {}); + jetsBasetoTagMatchingHF.assign(jetsBase.size(), {}); + jetsTagtoBaseMatchingGeo.assign(jetsTag.size(), {}); + jetsTagtoBaseMatchingPt.assign(jetsTag.size(), {}); + jetsTagtoBaseMatchingHF.assign(jetsTag.size(), {}); + + for (const auto& mcCollision : mcCollisions) { + + const auto collisionsPerMcColl = collisions.sliceBy(CollisionsPerMcCollision, mcCollision.globalIndex()); + + for (const auto& collision : collisionsPerMcColl) { + + const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, jetsBaseIsMc ? mcCollision.globalIndex() : collision.globalIndex()); + const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, jetsTagIsMc ? mcCollision.globalIndex() : collision.globalIndex()); + + jetmatchingutilities::doAllMatching(jetsBasePerColl, jetsTagPerColl, jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF, jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF, candidatesBase, candidatesTag, tracks, clusters, particles, particles, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction); + } + } + for (auto i = 0; i < jetsBase.size(); ++i) { + jetsBasetoTagMatchingTable(jetsBasetoTagMatchingGeo[i], jetsBasetoTagMatchingPt[i], jetsBasetoTagMatchingHF[i]); // is (and needs to) be filled in order + } + for (auto i = 0; i < jetsTag.size(); i++) { + jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order + } + } + PROCESS_SWITCH(JetMatchingMc, processJets, "Perform jet matching", true); +}; diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCBplusCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCBplusCharged.cxx new file mode 100644 index 00000000000..8a5705f273f --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCBplusCharged.cxx @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc B+ charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +using BplusChargedJetMatchingMC = JetMatchingMc, + soa::Join, + aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCParticleLevelJets, + aod::BplusChargedMCParticleLevelJetsMatchedToBplusChargedMCDetectorLevelJets, + aod::CandidatesBplusMCD, + aod::CandidatesBplusMCP, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-bplus-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCCharged.cxx new file mode 100644 index 00000000000..fe951be4566 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCCharged.cxx @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +using ChargedJetMatchingMC = JetMatchingMc, + soa::Join, + aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets, + aod::ChargedMCParticleLevelJetsMatchedToChargedMCDetectorLevelJets, + aod::JCollisions, + aod::JMcCollisions, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCD0Charged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCD0Charged.cxx new file mode 100644 index 00000000000..64abc51c79d --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCD0Charged.cxx @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc D0 charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +using D0ChargedJetMatchingMC = JetMatchingMc, + soa::Join, + aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCParticleLevelJets, + aod::D0ChargedMCParticleLevelJetsMatchedToD0ChargedMCDetectorLevelJets, + aod::CandidatesD0MCD, + aod::CandidatesD0MCP, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-d0-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCDielectronCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCDielectronCharged.cxx new file mode 100644 index 00000000000..7d284ecbee4 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCDielectronCharged.cxx @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc Dielectron charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +using DielectronChargedJetMatchingMC = JetMatchingMc, + soa::Join, + aod::DielectronChargedMCDetectorLevelJetsMatchedToDielectronChargedMCParticleLevelJets, + aod::DielectronChargedMCParticleLevelJetsMatchedToDielectronChargedMCDetectorLevelJets, + aod::CandidatesDielectronMCD, + aod::CandidatesDielectronMCP, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-dielectron-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCFull.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCFull.cxx new file mode 100644 index 00000000000..e4bf6f3979d --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCFull.cxx @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc full task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +using FullJetMatchingMC = JetMatchingMc, + soa::Join, + aod::FullMCDetectorLevelJetsMatchedToFullMCParticleLevelJets, + aod::FullMCParticleLevelJetsMatchedToFullMCDetectorLevelJets, + aod::JCollisions, + aod::JMcCollisions, + aod::JetClustersMCD>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-full"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCLcCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCLcCharged.cxx new file mode 100644 index 00000000000..9be7e169e57 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCLcCharged.cxx @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc Lc charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +using LcChargedJetMatchingMC = JetMatchingMc, + soa::Join, + aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCParticleLevelJets, + aod::LcChargedMCParticleLevelJetsMatchedToLcChargedMCDetectorLevelJets, + aod::CandidatesLcMCD, + aod::CandidatesLcMCP, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-lc-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCNeutral.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCNeutral.cxx new file mode 100644 index 00000000000..8af1d2513bc --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCNeutral.cxx @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching neutral task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +using NeutralJetMatchingMC = JetMatchingMc, + soa::Join, + aod::NeutralMCDetectorLevelJetsMatchedToNeutralMCParticleLevelJets, + aod::NeutralMCParticleLevelJetsMatchedToNeutralMCDetectorLevelJets, + aod::JCollisions, + aod::JMcCollisions, + aod::JetClustersMCD>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-neutral"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/jetmatchingmcsub.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx similarity index 52% rename from PWGJE/TableProducer/jetmatchingmcsub.cxx rename to PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx index 819771a1088..9db070ec7b6 100644 --- a/PWGJE/TableProducer/jetmatchingmcsub.cxx +++ b/PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx @@ -13,6 +13,8 @@ /// \brief matching event-wise constituent subtracted detector level and unsubtracted generated level jets (this is usseful as a template for embedding matching) /// \author Nima Zardoshti +#include + #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoA.h" @@ -53,11 +55,6 @@ struct JetMatchingMcSub { { } - void processDummy(aod::JetCollisions const&) - { - } - PROCESS_SWITCH(JetMatchingMcSub, processDummy, "Dummy process", true); - void processJets(aod::JetCollisions const& collisions, JetsBase const& jetsBase, JetsTag const& jetsTag, aod::JetTracks const& tracks, @@ -91,44 +88,5 @@ struct JetMatchingMcSub { jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order } } - PROCESS_SWITCH(JetMatchingMcSub, processJets, "Perform jet matching", false); + PROCESS_SWITCH(JetMatchingMcSub, processJets, "Perform jet matching", true); }; - -using ChargedJetMatching = JetMatchingMcSub, - soa::Join, - aod::ChargedMCDetectorLevelJetsMatchedToChargedMCDetectorLevelEventWiseSubtractedJets, - aod::ChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToChargedMCDetectorLevelJets, - aod::JDummys>; -using D0ChargedJetMatching = JetMatchingMcSub, - soa::Join, - aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCDetectorLevelEventWiseSubtractedJets, - aod::D0ChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToD0ChargedMCDetectorLevelJets, - aod::CandidatesD0MCD>; -using LcChargedJetMatching = JetMatchingMcSub, - soa::Join, - aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCDetectorLevelEventWiseSubtractedJets, - aod::LcChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToLcChargedMCDetectorLevelJets, - aod::CandidatesLcMCD>; -/*using BplusChargedJetMatching = JetMatchingMcSub, - soa::Join, - aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCDetectorLevelEventWiseSubtractedJets, - aod::BplusChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToBplusChargedMCDetectorLevelJets, - aod::CandidatesBplusMCD>;*/ -using DielectronChargedJetMatching = JetMatchingMcSub, - soa::Join, - aod::DielectronChargedMCDetectorLevelJetsMatchedToDielectronChargedMCDetectorLevelEventWiseSubtractedJets, - aod::DielectronChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToDielectronChargedMCDetectorLevelJets, - aod::CandidatesDielectronMCD>; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-sub-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-d0-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-lc-ch"})); - // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-bplus-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-dielectron-ch"})); - - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCSubBplusCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCSubBplusCharged.cxx new file mode 100644 index 00000000000..86db7221aa6 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCSubBplusCharged.cxx @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc subtracted B+ charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx" + +using D0ChargedJetMatchingMCSub = JetMatchingMcSub, + soa::Join, + aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCDetectorLevelEventWiseSubtractedJets, + aod::D0ChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToD0ChargedMCDetectorLevelJets, + aod::CandidatesD0MCD>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-d0-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCSubCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCSubCharged.cxx new file mode 100644 index 00000000000..2b0c5c19992 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCSubCharged.cxx @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc subtracted charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx" + +using ChargedJetMatchingMCSub = JetMatchingMcSub, + soa::Join, + aod::ChargedMCDetectorLevelJetsMatchedToChargedMCDetectorLevelEventWiseSubtractedJets, + aod::ChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToChargedMCDetectorLevelJets, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-sub-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCSubD0Charged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCSubD0Charged.cxx new file mode 100644 index 00000000000..92a71c20900 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCSubD0Charged.cxx @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc subtracted D0 charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx" + +using D0ChargedJetMatchingMCSub = JetMatchingMcSub, + soa::Join, + aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCDetectorLevelEventWiseSubtractedJets, + aod::D0ChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToD0ChargedMCDetectorLevelJets, + aod::CandidatesD0MCD>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-d0-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCSubDielectronCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCSubDielectronCharged.cxx new file mode 100644 index 00000000000..376e904f473 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCSubDielectronCharged.cxx @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc subtracted Dielectron charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx" + +using DielectronChargedJetMatchingMCSub = JetMatchingMcSub, + soa::Join, + aod::DielectronChargedMCDetectorLevelJetsMatchedToDielectronChargedMCDetectorLevelEventWiseSubtractedJets, + aod::DielectronChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToDielectronChargedMCDetectorLevelJets, + aod::CandidatesDielectronMCD>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-dielectron-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCSubLcCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCSubLcCharged.cxx new file mode 100644 index 00000000000..6a9456eb241 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCSubLcCharged.cxx @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching mc subtracted Lc charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx" + +using LcChargedJetMatchingMCSub = JetMatchingMcSub, + soa::Join, + aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCDetectorLevelEventWiseSubtractedJets, + aod::LcChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToLcChargedMCDetectorLevelJets, + aod::CandidatesLcMCD>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-lc-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCV0Charged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCV0Charged.cxx new file mode 100644 index 00000000000..d0910abc488 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCV0Charged.cxx @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching V0 charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +using V0ChargedJetMatchingMC = JetMatchingMc, + soa::Join, + aod::V0ChargedMCDetectorLevelJetsMatchedToV0ChargedMCParticleLevelJets, + aod::V0ChargedMCParticleLevelJetsMatchedToV0ChargedMCDetectorLevelJets, + aod::CandidatesV0MCD, + aod::CandidatesV0MCP, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-v0-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/jetmatchingsub.cxx b/PWGJE/TableProducer/Matching/jetMatchingSub.cxx similarity index 54% rename from PWGJE/TableProducer/jetmatchingsub.cxx rename to PWGJE/TableProducer/Matching/jetMatchingSub.cxx index de8fce87bbd..36e809b5129 100644 --- a/PWGJE/TableProducer/jetmatchingsub.cxx +++ b/PWGJE/TableProducer/Matching/jetMatchingSub.cxx @@ -13,6 +13,8 @@ /// \brief matching event-wise constituent subtracted data jets and unsubtracted data jets /// \author Nima Zardoshti +#include + #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoA.h" @@ -53,11 +55,6 @@ struct JetMatchingSub { { } - void processDummy(aod::JetCollisions const&) - { - } - PROCESS_SWITCH(JetMatchingSub, processDummy, "Dummy process", true); - void processJets(aod::JetCollisions const& collisions, JetsBase const& jetsBase, JetsTag const& jetsTag, aod::JetTracks const& tracks, TracksTag const& tracksSub, Candidates const& candidates) @@ -89,48 +86,5 @@ struct JetMatchingSub { jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order } } - PROCESS_SWITCH(JetMatchingSub, processJets, "Perform jet matching", false); + PROCESS_SWITCH(JetMatchingSub, processJets, "Perform jet matching", true); }; - -using ChargedJetMatching = JetMatchingSub, - soa::Join, - aod::ChargedJetsMatchedToChargedEventWiseSubtractedJets, - aod::ChargedEventWiseSubtractedJetsMatchedToChargedJets, - aod::JTrackSubs, - aod::JDummys>; -using D0ChargedJetMatching = JetMatchingSub, - soa::Join, - aod::D0ChargedJetsMatchedToD0ChargedEventWiseSubtractedJets, - aod::D0ChargedEventWiseSubtractedJetsMatchedToD0ChargedJets, - aod::JTrackD0Subs, - aod::CandidatesD0Data>; -using LcChargedJetMatching = JetMatchingSub, - soa::Join, - aod::LcChargedJetsMatchedToLcChargedEventWiseSubtractedJets, - aod::LcChargedEventWiseSubtractedJetsMatchedToLcChargedJets, - aod::JTrackLcSubs, - aod::CandidatesLcData>; -/*using BplusChargedJetMatching = JetMatchingSub, - soa::Join, - aod::BplusChargedJetsMatchedToBplusChargedEventWiseSubtractedJets, - aod::BplusChargedEventWiseSubtractedJetsMatchedToBplusChargedJets, - aod::JTrackBplusSubs, - aod::CandidatesBplusData>;*/ -using DielectronChargedJetMatching = JetMatchingSub, - soa::Join, - aod::DielectronChargedJetsMatchedToDielectronChargedEventWiseSubtractedJets, - aod::DielectronChargedEventWiseSubtractedJetsMatchedToDielectronChargedJets, - aod::JTrackDielectronSubs, - aod::CandidatesDielectronData>; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-sub-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-d0-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-lc-ch"})); - // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-bplus-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-dielectron-ch"})); - - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/TableProducer/Matching/jetMatchingSubBplusCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingSubBplusCharged.cxx new file mode 100644 index 00000000000..a24b7c6de6f --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingSubBplusCharged.cxx @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching subtracted B+ charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingSub.cxx" + +using BplusChargedJetMatchingSub = JetMatchingSub, + soa::Join, + aod::BplusChargedJetsMatchedToBplusChargedEventWiseSubtractedJets, + aod::BplusChargedEventWiseSubtractedJetsMatchedToBplusChargedJets, + aod::JTrackBplusSubs, + aod::CandidatesBplusData>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-bplus-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingSubCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingSubCharged.cxx new file mode 100644 index 00000000000..4d12c3c0448 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingSubCharged.cxx @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching subtracted charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingSub.cxx" + +using ChargedJetMatchingSub = JetMatchingSub, + soa::Join, + aod::ChargedJetsMatchedToChargedEventWiseSubtractedJets, + aod::ChargedEventWiseSubtractedJetsMatchedToChargedJets, + aod::JTrackSubs, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-sub-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingSubD0Charged.cxx b/PWGJE/TableProducer/Matching/jetMatchingSubD0Charged.cxx new file mode 100644 index 00000000000..d07f5186d95 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingSubD0Charged.cxx @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching subtracted D0 charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingSub.cxx" + +using D0ChargedJetMatchingSub = JetMatchingSub, + soa::Join, + aod::D0ChargedJetsMatchedToD0ChargedEventWiseSubtractedJets, + aod::D0ChargedEventWiseSubtractedJetsMatchedToD0ChargedJets, + aod::JTrackD0Subs, + aod::CandidatesD0Data>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-d0-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingSubDielectronCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingSubDielectronCharged.cxx new file mode 100644 index 00000000000..94960e214d8 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingSubDielectronCharged.cxx @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching subtracted Dielectron charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingSub.cxx" + +using DielectronChargedJetMatchingSub = JetMatchingSub, + soa::Join, + aod::DielectronChargedJetsMatchedToDielectronChargedEventWiseSubtractedJets, + aod::DielectronChargedEventWiseSubtractedJetsMatchedToDielectronChargedJets, + aod::JTrackDielectronSubs, + aod::CandidatesDielectronData>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-dielectron-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingSubLcCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingSubLcCharged.cxx new file mode 100644 index 00000000000..eabc5209fa8 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingSubLcCharged.cxx @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet matching subtracted Lc charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingSub.cxx" + +using LcChargedJetMatchingSub = JetMatchingSub, + soa::Join, + aod::LcChargedJetsMatchedToLcChargedEventWiseSubtractedJets, + aod::LcChargedEventWiseSubtractedJetsMatchedToLcChargedJets, + aod::JTrackLcSubs, + aod::CandidatesLcData>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-lc-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/jetderiveddataproducer.cxx b/PWGJE/TableProducer/derivedDataProducer.cxx similarity index 91% rename from PWGJE/TableProducer/jetderiveddataproducer.cxx rename to PWGJE/TableProducer/derivedDataProducer.cxx index 6c5ae6157f4..0167ceeed5b 100644 --- a/PWGJE/TableProducer/jetderiveddataproducer.cxx +++ b/PWGJE/TableProducer/derivedDataProducer.cxx @@ -72,6 +72,7 @@ struct JetDerivedDataProducerTask { Produces jMcCollisionsParentIndexTable; Produces jTracksTable; Produces jTracksExtraTable; + Produces jTracksEMCalTable; Produces jTracksParentIndexTable; Produces jMcTracksLabelTable; Produces jMcParticlesTable; @@ -88,6 +89,10 @@ struct JetDerivedDataProducerTask { Produces jLcMcCollisionIdsTable; Produces jLcIdsTable; Produces jLcParticleIdsTable; + Produces jBplusCollisionIdsTable; + Produces jBplusMcCollisionIdsTable; + Produces jBplusIdsTable; + Produces jBplusParticleIdsTable; Produces jV0IdsTable; Produces jV0McCollisionsTable; Produces jV0McCollisionIdsTable; @@ -343,7 +348,7 @@ struct JetDerivedDataProducerTask { } PROCESS_SWITCH(JetDerivedDataProducerTask, processParticles, "produces derived parrticle table", false); - void processClusters(aod::Collision const&, aod::EMCALClusters const& clusters, aod::EMCALClusterCells const& cells, aod::Calos const&, aod::EMCALMatchedTracks const& matchedTracks, aod::Tracks const&) + void processClusters(aod::Collision const&, aod::EMCALClusters const& clusters, aod::EMCALClusterCells const& cells, aod::Calos const&, aod::EMCALMatchedTracks const& matchedTracks, soa::Join const&) { for (auto cluster : clusters) { @@ -377,6 +382,8 @@ struct JetDerivedDataProducerTask { for (const auto& clusterTrack : clusterTracks) { auto JClusterID = trackCollisionMapping.find({clusterTrack.trackId(), cluster.collisionId()}); // does EMCal use its own associator? clusterTrackIDs.push_back(JClusterID->second); + auto emcTrack = clusterTrack.track_as>(); + jTracksEMCalTable(JClusterID->second, emcTrack.trackEtaEmcal(), emcTrack.trackPhiEmcal()); } jClustersMatchedTracksTable(clusterTrackIDs); } @@ -426,19 +433,19 @@ struct JetDerivedDataProducerTask { } PROCESS_SWITCH(JetDerivedDataProducerTask, processD0MC, "produces derived index for D0 particles", false); - void processLcCollisions(aod::Hf3PCollIds::iterator const& LcCollision) + void processLcCollisions(aod::HfLcCollIds::iterator const& LcCollision) { jLcCollisionIdsTable(LcCollision.collisionId()); } PROCESS_SWITCH(JetDerivedDataProducerTask, processLcCollisions, "produces derived index for Lc collisions", false); - void processLcMcCollisions(aod::Hf3PMcCollIds::iterator const& LcMcCollision) + void processLcMcCollisions(aod::HfLcMcCollIds::iterator const& LcMcCollision) { jLcMcCollisionIdsTable(LcMcCollision.mcCollisionId()); } PROCESS_SWITCH(JetDerivedDataProducerTask, processLcMcCollisions, "produces derived index for Lc MC collisions", false); - void processLc(aod::Hf3PIds::iterator const& Lc, aod::Tracks const&) + void processLc(aod::HfLcIds::iterator const& Lc, aod::Tracks const&) { auto JProng0ID = trackCollisionMapping.find({Lc.prong0Id(), Lc.prong0_as().collisionId()}); auto JProng1ID = trackCollisionMapping.find({Lc.prong1Id(), Lc.prong1_as().collisionId()}); @@ -452,12 +459,44 @@ struct JetDerivedDataProducerTask { } PROCESS_SWITCH(JetDerivedDataProducerTask, processLc, "produces derived index for Lc candidates", false); - void processLcMC(aod::Hf3PPIds::iterator const& Lc) + void processLcMC(aod::HfLcPIds::iterator const& Lc) { jLcParticleIdsTable(Lc.mcCollisionId(), Lc.mcParticleId()); } PROCESS_SWITCH(JetDerivedDataProducerTask, processLcMC, "produces derived index for Lc particles", false); + void processBplusCollisions(aod::HfBplusCollIds::iterator const& BplusCollision) + { + jBplusCollisionIdsTable(BplusCollision.collisionId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processBplusCollisions, "produces derived index for Bplus collisions", false); + + void processBplusMcCollisions(aod::HfBplusMcCollIds::iterator const& BplusMcCollision) + { + jBplusMcCollisionIdsTable(BplusMcCollision.mcCollisionId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processBplusMcCollisions, "produces derived index for Bplus MC collisions", false); + + void processBplus(aod::HfBplusIds::iterator const& Bplus, aod::Tracks const&) + { + auto JProng0ID = trackCollisionMapping.find({Bplus.prong0Id(), Bplus.prong0_as().collisionId()}); + auto JProng1ID = trackCollisionMapping.find({Bplus.prong1Id(), Bplus.prong1_as().collisionId()}); + auto JProng2ID = trackCollisionMapping.find({Bplus.prong2Id(), Bplus.prong2_as().collisionId()}); + if (withCollisionAssociator) { + JProng0ID = trackCollisionMapping.find({Bplus.prong0Id(), Bplus.collisionId()}); + JProng1ID = trackCollisionMapping.find({Bplus.prong1Id(), Bplus.collisionId()}); + JProng2ID = trackCollisionMapping.find({Bplus.prong2Id(), Bplus.collisionId()}); + } + jBplusIdsTable(Bplus.collisionId(), JProng0ID->second, JProng1ID->second, JProng2ID->second); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processBplus, "produces derived index for Bplus candidates", false); + + void processBplusMC(aod::HfBplusPIds::iterator const& Bplus) + { + jBplusParticleIdsTable(Bplus.mcCollisionId(), Bplus.mcParticleId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processBplusMC, "produces derived index for Bplus particles", false); + void processV0(aod::V0Indices::iterator const& V0, aod::Tracks const&) { auto JPosTrackID = trackCollisionMapping.find({V0.posTrackId(), V0.posTrack_as().collisionId()}); diff --git a/PWGJE/TableProducer/derivedDataProducerDummy.cxx b/PWGJE/TableProducer/derivedDataProducerDummy.cxx new file mode 100644 index 00000000000..da60109d94f --- /dev/null +++ b/PWGJE/TableProducer/derivedDataProducerDummy.cxx @@ -0,0 +1,81 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// temporary task to produce HF and DQ tables needed when making inclusive derived data - should become obsolete when tables are able to be prouduced based on a configurable +// +/// \author Nima Zardoshti + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/runDataProcessing.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGHF/DataModel/DerivedTables.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct JetDerivedDataProducerDummyTask { + + Produces d0CollisionsTable; + Produces d0CollisionsMatchingTable; + Produces d0sTable; + Produces d0ParsTable; + Produces d0ParExtrasTable; + Produces d0SelsTable; + Produces d0MlsTable; + Produces d0McsTable; + Produces d0McCollisionsTable; + Produces d0ParticlesTable; + + Produces lcCollisionsTable; + Produces lcCollisionsMatchingTable; + Produces lcsTable; + Produces lcParsTable; + Produces lcParExtrasTable; + Produces lcSelsTable; + Produces lcMlsTable; + Produces lcMcsTable; + Produces lcMcCollisionsTable; + Produces lcParticlesTable; + + Produces bplusCollisionsTable; + Produces bplusCollisionsMatchingTable; + Produces bplussTable; + Produces bplusParsTable; + Produces bplusParExtrasTable; + Produces bplusParD0sTable; + Produces bplusMlsTable; + Produces bplusMlD0sTable; + Produces bplusMcsTable; + Produces bplusMcCollisionsTable; + Produces bplusParticlesTable; + + Produces dielectronCollisionsTable; + Produces dielectronTable; + + void init(InitContext const&) + { + } + + void processDummy(aod::JDummys const&) + { + } + PROCESS_SWITCH(JetDerivedDataProducerDummyTask, processDummy, "leaves all tables empty", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"jet-deriveddata-producer-dummy"})}; +} diff --git a/PWGJE/TableProducer/jetderiveddataproducerdummy.cxx b/PWGJE/TableProducer/derivedDataProducerDummyBplus.cxx similarity index 76% rename from PWGJE/TableProducer/jetderiveddataproducerdummy.cxx rename to PWGJE/TableProducer/derivedDataProducerDummyBplus.cxx index efbd1fa4cf5..8f3e238710a 100644 --- a/PWGJE/TableProducer/jetderiveddataproducerdummy.cxx +++ b/PWGJE/TableProducer/derivedDataProducerDummyBplus.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// temporary task to produce HF tables needed when making inclusive derived data - should become obsolete when tables are able to be prouduced based on a configurable +// temporary task to produce HF and DQ tables needed when making B+ jet derived data - should become obsolete when tables are able to be prouduced based on a configurable // /// \author Nima Zardoshti @@ -38,16 +38,16 @@ struct JetDerivedDataProducerDummyTask { Produces d0McCollisionsTable; Produces d0ParticlesTable; - Produces lcCollisionsTable; - Produces lcCollisionsMatchingTable; - Produces lcsTable; - Produces lcParsTable; - Produces lcParExtrasTable; - Produces lcSelsTable; - Produces lcMlsTable; - Produces lcMcsTable; - Produces lcMcCollisionsTable; - Produces lcParticlesTable; + Produces lcCollisionsTable; + Produces lcCollisionsMatchingTable; + Produces lcsTable; + Produces lcParsTable; + Produces lcParExtrasTable; + Produces lcSelsTable; + Produces lcMlsTable; + Produces lcMcsTable; + Produces lcMcCollisionsTable; + Produces lcParticlesTable; Produces dielectronCollisionsTable; Produces dielectronTable; diff --git a/PWGJE/TableProducer/jetderiveddataproducerdummyd0.cxx b/PWGJE/TableProducer/derivedDataProducerDummyD0.cxx similarity index 62% rename from PWGJE/TableProducer/jetderiveddataproducerdummyd0.cxx rename to PWGJE/TableProducer/derivedDataProducerDummyD0.cxx index 8b02d7cdeab..c28b0e44dfe 100644 --- a/PWGJE/TableProducer/jetderiveddataproducerdummyd0.cxx +++ b/PWGJE/TableProducer/derivedDataProducerDummyD0.cxx @@ -27,16 +27,28 @@ using namespace o2::framework::expressions; struct JetDerivedDataProducerDummyD0Task { - Produces lcCollisionsTable; - Produces lcCollisionsMatchingTable; - Produces lcsTable; - Produces lcParsTable; - Produces lcParExtrasTable; - Produces lcSelsTable; - Produces lcMlsTable; - Produces lcMcsTable; - Produces lcMcCollisionsTable; - Produces lcParticlesTable; + Produces lcCollisionsTable; + Produces lcCollisionsMatchingTable; + Produces lcsTable; + Produces lcParsTable; + Produces lcParExtrasTable; + Produces lcSelsTable; + Produces lcMlsTable; + Produces lcMcsTable; + Produces lcMcCollisionsTable; + Produces lcParticlesTable; + + Produces bplusCollisionsTable; + Produces bplusCollisionsMatchingTable; + Produces bplussTable; + Produces bplusParsTable; + Produces bplusParExtrasTable; + Produces bplusParD0sTable; + Produces bplusMlsTable; + Produces bplusMlD0sTable; + Produces bplusMcsTable; + Produces bplusMcCollisionsTable; + Produces bplusParticlesTable; Produces dielectronCollisionsTable; Produces dielectronTable; diff --git a/PWGJE/TableProducer/jetderiveddataproducerdummydielectron.cxx b/PWGJE/TableProducer/derivedDataProducerDummyDielectron.cxx similarity index 67% rename from PWGJE/TableProducer/jetderiveddataproducerdummydielectron.cxx rename to PWGJE/TableProducer/derivedDataProducerDummyDielectron.cxx index 784fa3e4826..9df74703902 100644 --- a/PWGJE/TableProducer/jetderiveddataproducerdummydielectron.cxx +++ b/PWGJE/TableProducer/derivedDataProducerDummyDielectron.cxx @@ -38,16 +38,28 @@ struct JetDerivedDataProducerDummyDielectronTask { Produces d0McCollisionsTable; Produces d0ParticlesTable; - Produces lcCollisionsTable; - Produces lcCollisionsMatchingTable; - Produces lcsTable; - Produces lcParsTable; - Produces lcParExtrasTable; - Produces lcSelsTable; - Produces lcMlsTable; - Produces lcMcsTable; - Produces lcMcCollisionsTable; - Produces lcParticlesTable; + Produces lcCollisionsTable; + Produces lcCollisionsMatchingTable; + Produces lcsTable; + Produces lcParsTable; + Produces lcParExtrasTable; + Produces lcSelsTable; + Produces lcMlsTable; + Produces lcMcsTable; + Produces lcMcCollisionsTable; + Produces lcParticlesTable; + + Produces bplusCollisionsTable; + Produces bplusCollisionsMatchingTable; + Produces bplussTable; + Produces bplusParsTable; + Produces bplusParExtrasTable; + Produces bplusParD0sTable; + Produces bplusMlsTable; + Produces bplusMlD0sTable; + Produces bplusMcsTable; + Produces bplusMcCollisionsTable; + Produces bplusParticlesTable; void init(InitContext const&) { diff --git a/PWGJE/TableProducer/jetderiveddataproducerdummylc.cxx b/PWGJE/TableProducer/derivedDataProducerDummyLc.cxx similarity index 79% rename from PWGJE/TableProducer/jetderiveddataproducerdummylc.cxx rename to PWGJE/TableProducer/derivedDataProducerDummyLc.cxx index 05e1384deac..5550e97a9ae 100644 --- a/PWGJE/TableProducer/jetderiveddataproducerdummylc.cxx +++ b/PWGJE/TableProducer/derivedDataProducerDummyLc.cxx @@ -38,6 +38,18 @@ struct JetDerivedDataProducerDummyLcTask { Produces d0McCollisionsTable; Produces d0ParticlesTable; + Produces bplusCollisionsTable; + Produces bplusCollisionsMatchingTable; + Produces bplussTable; + Produces bplusParsTable; + Produces bplusParExtrasTable; + Produces bplusParD0sTable; + Produces bplusMlsTable; + Produces bplusMlD0sTable; + Produces bplusMcsTable; + Produces bplusMcCollisionsTable; + Produces bplusParticlesTable; + Produces dielectronCollisionsTable; Produces dielectronTable; diff --git a/PWGJE/TableProducer/jetderiveddatatriggerproducer.cxx b/PWGJE/TableProducer/derivedDataTriggerProducer.cxx similarity index 100% rename from PWGJE/TableProducer/jetderiveddatatriggerproducer.cxx rename to PWGJE/TableProducer/derivedDataTriggerProducer.cxx diff --git a/PWGJE/TableProducer/jetderiveddatawriter.cxx b/PWGJE/TableProducer/derivedDataWriter.cxx similarity index 80% rename from PWGJE/TableProducer/jetderiveddatawriter.cxx rename to PWGJE/TableProducer/derivedDataWriter.cxx index 68028aee6fa..fb70c198fbf 100644 --- a/PWGJE/TableProducer/jetderiveddatawriter.cxx +++ b/PWGJE/TableProducer/derivedDataWriter.cxx @@ -51,6 +51,9 @@ struct JetDerivedDataWriter { Configurable thresholdChargedLcJetPtMin{"thresholdChargedLcJetPtMin", 0.0, "Minimum charged Lc jet pt to accept event"}; Configurable thresholdChargedEventWiseSubtractedLcJetPtMin{"thresholdChargedEventWiseSubtractedLcJetPtMin", 0.0, "Minimum charged event-wise subtracted Lc jet pt to accept event"}; Configurable thresholdChargedLcMCPJetPtMin{"thresholdChargedLcMCPJetPtMin", 0.0, "Minimum charged Lc mcp jet pt to accept event"}; + Configurable thresholdChargedBplusJetPtMin{"thresholdChargedBplusJetPtMin", 0.0, "Minimum charged Bplus jet pt to accept event"}; + Configurable thresholdChargedEventWiseSubtractedBplusJetPtMin{"thresholdChargedEventWiseSubtractedBplusJetPtMin", 0.0, "Minimum charged event-wise subtracted Bplus jet pt to accept event"}; + Configurable thresholdChargedBplusMCPJetPtMin{"thresholdChargedBplusMCPJetPtMin", 0.0, "Minimum charged Bplus mcp jet pt to accept event"}; Configurable thresholdChargedDielectronJetPtMin{"thresholdChargedDielectronJetPtMin", 0.0, "Minimum charged Dielectron jet pt to accept event"}; Configurable thresholdChargedEventWiseSubtractedDielectronJetPtMin{"thresholdChargedEventWiseSubtractedDielectronJetPtMin", 0.0, "Minimum charged event-wise subtracted Dielectron jet pt to accept event"}; Configurable thresholdChargedDielectronMCPJetPtMin{"thresholdChargedDielectronMCPJetPtMin", 0.0, "Minimum charged Dielectron mcp jet pt to accept event"}; @@ -67,9 +70,10 @@ struct JetDerivedDataWriter { Configurable trackEtaSelectionMax{"trackEtaSelectionMax", 0.9, "only save tracks that have an eta smaller than this eta"}; Configurable saveBCsTable{"saveBCsTable", true, "save the bunch crossing table to the output"}; Configurable saveClustersTable{"saveClustersTable", false, "save the clusters table to the output"}; - Configurable saveD0Table{"saveD0Table", false, "save the D0 table to the output"}; - Configurable saveLcTable{"saveLcTable", false, "save the Lc table to the output"}; - Configurable saveDielectronTable{"saveDielectronTable", false, "save the Dielectron table to the output"}; + Configurable saveD0Table{"saveD0Table", false, "save the D0 tables to the output"}; + Configurable saveLcTable{"saveLcTable", false, "save the Lc tables to the output"}; + Configurable saveBplusTable{"saveBplusTable", false, "save the Bplus tables to the output"}; + Configurable saveDielectronTable{"saveDielectronTable", false, "save the Dielectron tables to the output"}; Configurable triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; } config; @@ -87,6 +91,7 @@ struct JetDerivedDataWriter { Produces storedJMcCollisionsParentIndexTable; Produces storedJTracksTable; Produces storedJTracksExtraTable; + Produces storedJTracksEMCalTable; Produces storedJTracksParentIndexTable; Produces storedJMcTracksLabelTable; Produces storedJMcParticlesTable; @@ -101,8 +106,10 @@ struct JetDerivedDataWriter { Produces storedD0sTable; Produces storedD0ParsTable; Produces storedD0ParExtrasTable; + Produces storedD0ParDaughtersDummyTable; Produces storedD0SelsTable; Produces storedD0MlsTable; + Produces storedD0MlDughtersDummyTable; Produces storedD0McsTable; Produces storedD0IdsTable; Produces storedD0McCollisionsTable; @@ -111,21 +118,40 @@ struct JetDerivedDataWriter { Produces storedD0ParticlesTable; Produces storedD0ParticleIdsTable; - Produces storedLcCollisionsTable; + Produces storedLcCollisionsTable; Produces storedLcCollisionIdsTable; - Produces storedLcsTable; - Produces storedLcParsTable; - Produces storedLcParExtrasTable; - Produces storedLcSelsTable; - Produces storedLcMlsTable; - Produces storedLcMcsTable; + Produces storedLcsTable; + Produces storedLcParsTable; + Produces storedLcParExtrasTable; + Produces storedLcParDaughtersDummyTable; + Produces storedLcSelsTable; + Produces storedLcMlsTable; + Produces storedLcMlDughtersDummyTable; + Produces storedLcMcsTable; Produces storedLcIdsTable; - Produces storedLcMcCollisionsTable; + Produces storedLcMcCollisionsTable; Produces storedLcMcCollisionIdsTable; - Produces storedLcMcCollisionsMatchingTable; - Produces storedLcParticlesTable; + Produces storedLcMcCollisionsMatchingTable; + Produces storedLcParticlesTable; Produces storedLcParticleIdsTable; + Produces storedBplusCollisionsTable; + Produces storedBplusCollisionIdsTable; + Produces storedBplussTable; + Produces storedBplusParsTable; + Produces storedBplusParExtrasTable; + Produces storedBplusParD0sTable; + Produces storedBplusSelsTable; + Produces storedBplusMlsTable; + Produces storedBplusMlD0sTable; + Produces storedBplusMcsTable; + Produces storedBplusIdsTable; + Produces storedBplusMcCollisionsTable; + Produces storedBplusMcCollisionIdsTable; + Produces storedBplusMcCollisionsMatchingTable; + Produces storedBplusParticlesTable; + Produces storedBplusParticleIdsTable; + Produces storedDielectronCollisionsTable; Produces storedDielectronCollisionIdsTable; Produces storedDielectronsTable; @@ -142,14 +168,18 @@ struct JetDerivedDataWriter { Preslice> TracksPerCollision = aod::jtrack::collisionId; Preslice> ClustersPerCollision = aod::jcluster::collisionId; Preslice> D0McCollisionsPerMcCollision = aod::jd0indices::mcCollisionId; - Preslice> LcMcCollisionsPerMcCollision = aod::jlcindices::mcCollisionId; + Preslice> LcMcCollisionsPerMcCollision = aod::jlcindices::mcCollisionId; + Preslice> BplusMcCollisionsPerMcCollision = aod::jbplusindices::mcCollisionId; Preslice DielectronMcCollisionsPerMcCollision = aod::jdielectronindices::mcCollisionId; Preslice D0CollisionsPerCollision = aod::jd0indices::collisionId; Preslice LcCollisionsPerCollision = aod::jlcindices::collisionId; + Preslice BplusCollisionsPerCollision = aod::jbplusindices::collisionId; Preslice DielectronCollisionsPerCollision = aod::jdielectronindices::collisionId; Preslice D0sPerCollision = aod::jd0indices::collisionId; Preslice LcsPerCollision = aod::jlcindices::collisionId; + Preslice BplussPerCollision = aod::jbplusindices::collisionId; Preslice DielectronsPerCollision = aod::jdielectronindices::collisionId; + PresliceUnsorted EMCTrackPerTrack = aod::jemctrack::trackId; std::vector collisionFlag; std::vector McCollisionFlag; @@ -275,6 +305,12 @@ struct JetDerivedDataWriter { selectionObjectPtMin = config.thresholdChargedEventWiseSubtractedLcJetPtMin; } else if constexpr (std::is_same_v, aod::LcChargedMCParticleLevelJets>) { selectionObjectPtMin = config.thresholdChargedLcMCPJetPtMin; + } else if constexpr (std::is_same_v, aod::BplusChargedJets> || std::is_same_v, aod::BplusChargedMCDetectorLevelJets>) { + selectionObjectPtMin = config.thresholdChargedBplusJetPtMin; + } else if constexpr (std::is_same_v, aod::BplusChargedEventWiseSubtractedJets> || std::is_same_v, aod::BplusChargedMCDetectorLevelEventWiseSubtractedJets>) { + selectionObjectPtMin = config.thresholdChargedEventWiseSubtractedBplusJetPtMin; + } else if constexpr (std::is_same_v, aod::BplusChargedMCParticleLevelJets>) { + selectionObjectPtMin = config.thresholdChargedBplusMCPJetPtMin; } else if constexpr (std::is_same_v, aod::DielectronChargedJets> || std::is_same_v, aod::DielectronChargedMCDetectorLevelJets>) { selectionObjectPtMin = config.thresholdChargedDielectronJetPtMin; } else if constexpr (std::is_same_v, aod::DielectronChargedEventWiseSubtractedJets> || std::is_same_v, aod::DielectronChargedMCDetectorLevelEventWiseSubtractedJets>) { @@ -344,6 +380,11 @@ struct JetDerivedDataWriter { PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingLcChargedMCDJets, "process Lc charged mcd jets", false); PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingLcChargedMCDetectorLevelEventWiseSubtractedJets, "process Lc event-wise subtracted charged mcd jets", false); PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingLcChargedMCPJets, "process Lc charged mcp jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingBplusChargedJets, "process Bplus charged jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingBplusChargedEventWiseSubtractedJets, "process Bplus event-wise subtracted charged jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingBplusChargedMCDJets, "process Bplus charged mcd jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingBplusChargedMCDetectorLevelEventWiseSubtractedJets, "process Bplus event-wise subtracted charged mcd jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingBplusChargedMCPJets, "process Bplus charged mcp jets", false); PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingDielectronChargedJets, "process Dielectron charged jets", false); PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingDielectronChargedEventWiseSubtractedJets, "process Dielectron event-wise subtracted charged jets", false); PROCESS_SWITCH_FULL(JetDerivedDataWriter, processSelectionObjects, processSelectingDielectronChargedMCDJets, "process Dielectron charged mcd jets", false); @@ -361,7 +402,7 @@ struct JetDerivedDataWriter { } PROCESS_SWITCH(JetDerivedDataWriter, processStoreDummyTable, "write out dummy output table", true); - void processStoreData(soa::Join::iterator const& collision, soa::Join const&, soa::Join const& tracks, soa::Join const& clusters, aod::CollisionsD0 const& D0Collisions, aod::CandidatesD0Data const& D0s, aod::CollisionsLc const& LcCollisions, aod::CandidatesLcData const& Lcs, aod::CollisionsDielectron const& DielectronCollisions, aod::CandidatesDielectronData const& Dielectrons) + void processStoreData(soa::Join::iterator const& collision, soa::Join const&, soa::Join const& tracks, aod::JEMCTracks const& emcTracks, soa::Join const& clusters, aod::CollisionsD0 const& D0Collisions, aod::CandidatesD0Data const& D0s, aod::CollisionsLc const& LcCollisions, aod::CandidatesLcData const& Lcs, aod::CollisionsBplus const& BplusCollisions, aod::CandidatesBplusData const& Bpluss, aod::CollisionsDielectron const& DielectronCollisions, aod::CandidatesDielectronData const& Dielectrons) { std::map bcMapping; std::map trackMapping; @@ -415,6 +456,9 @@ struct JetDerivedDataWriter { auto JtrackIndex = trackMapping.find(clusterTrack.globalIndex()); if (JtrackIndex != trackMapping.end()) { clusterStoredJTrackIDs.push_back(JtrackIndex->second); + auto emcTracksPerTrack = emcTracks.sliceBy(EMCTrackPerTrack, clusterTrack.globalIndex()); + auto emcTrackPerTrack = emcTracksPerTrack.iteratorAt(0); + products.storedJTracksEMCalTable(JtrackIndex->second, emcTrackPerTrack.etaEmcal(), emcTrackPerTrack.phiEmcal()); } } products.storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); @@ -424,12 +468,12 @@ struct JetDerivedDataWriter { if (config.saveD0Table) { int32_t collisionD0Index = -1; for (const auto& D0Collision : D0Collisions) { // should only ever be one - jethfutilities::fillD0CollisionTable(D0Collision, products.storedD0CollisionsTable, collisionD0Index); + jethfutilities::fillHFCollisionTable(D0Collision, products.storedD0CollisionsTable, collisionD0Index); products.storedD0CollisionIdsTable(products.storedJCollisionsTable.lastIndex()); } for (const auto& D0 : D0s) { int32_t D0Index = -1; - jethfutilities::fillD0CandidateTable(D0, collisionD0Index, products.storedD0sTable, products.storedD0ParsTable, products.storedD0ParExtrasTable, products.storedD0SelsTable, products.storedD0MlsTable, products.storedD0McsTable, D0Index); + jethfutilities::fillHFCandidateTable(D0, collisionD0Index, products.storedD0sTable, products.storedD0ParsTable, products.storedD0ParExtrasTable, products.storedD0ParDaughtersDummyTable, products.storedD0SelsTable, products.storedD0MlsTable, products.storedD0MlDughtersDummyTable, products.storedD0McsTable, D0Index); int32_t prong0Id = -1; int32_t prong1Id = -1; @@ -448,12 +492,12 @@ struct JetDerivedDataWriter { if (config.saveLcTable) { int32_t collisionLcIndex = -1; for (const auto& LcCollision : LcCollisions) { // should only ever be one - jethfutilities::fillLcCollisionTable(LcCollision, products.storedLcCollisionsTable, collisionLcIndex); + jethfutilities::fillHFCollisionTable(LcCollision, products.storedLcCollisionsTable, collisionLcIndex); products.storedLcCollisionIdsTable(products.storedJCollisionsTable.lastIndex()); } for (const auto& Lc : Lcs) { int32_t LcIndex = -1; - jethfutilities::fillLcCandidateTable(Lc, collisionLcIndex, products.storedLcsTable, products.storedLcParsTable, products.storedLcParExtrasTable, products.storedLcSelsTable, products.storedLcMlsTable, products.storedLcMcsTable, LcIndex); + jethfutilities::fillHFCandidateTable(Lc, collisionLcIndex, products.storedLcsTable, products.storedLcParsTable, products.storedLcParExtrasTable, products.storedLcParDaughtersDummyTable, products.storedLcSelsTable, products.storedLcMlsTable, products.storedLcMlDughtersDummyTable, products.storedLcMcsTable, LcIndex); int32_t prong0Id = -1; int32_t prong1Id = -1; @@ -473,6 +517,34 @@ struct JetDerivedDataWriter { products.storedLcIdsTable(products.storedJCollisionsTable.lastIndex(), prong0Id, prong1Id, prong2Id); } } + if (config.saveBplusTable) { + int32_t collisionBplusIndex = -1; + for (const auto& BplusCollision : BplusCollisions) { // should only ever be one + jethfutilities::fillHFCollisionTable(BplusCollision, products.storedBplusCollisionsTable, collisionBplusIndex); + products.storedBplusCollisionIdsTable(products.storedJCollisionsTable.lastIndex()); + } + for (const auto& Bplus : Bpluss) { + int32_t BplusIndex = -1; + jethfutilities::fillHFCandidateTable(Bplus, collisionBplusIndex, products.storedBplussTable, products.storedBplusParsTable, products.storedBplusParExtrasTable, products.storedBplusParD0sTable, products.storedBplusSelsTable, products.storedBplusMlsTable, products.storedBplusMlD0sTable, products.storedBplusMcsTable, BplusIndex); + + int32_t prong0Id = -1; + int32_t prong1Id = -1; + int32_t prong2Id = -1; + auto JtrackIndex = trackMapping.find(Bplus.prong0Id()); + if (JtrackIndex != trackMapping.end()) { + prong0Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(Bplus.prong1Id()); + if (JtrackIndex != trackMapping.end()) { + prong1Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(Bplus.prong2Id()); + if (JtrackIndex != trackMapping.end()) { + prong2Id = JtrackIndex->second; + } + products.storedBplusIdsTable(products.storedJCollisionsTable.lastIndex(), prong0Id, prong1Id, prong2Id); + } + } if (config.saveDielectronTable) { int32_t collisionDielectronIndex = -1; for (const auto& DielectronCollision : DielectronCollisions) { // should only ever be one @@ -502,13 +574,14 @@ struct JetDerivedDataWriter { // to run after all jet selections PROCESS_SWITCH(JetDerivedDataWriter, processStoreData, "write out data output tables", false); - void processStoreMC(soa::Join const& mcCollisions, soa::Join const& collisions, soa::Join const&, soa::Join const& tracks, soa::Join const& clusters, soa::Join const& particles, aod::CollisionsD0 const& D0Collisions, aod::CandidatesD0MCD const& D0s, soa::Join const& D0McCollisions, aod::CandidatesD0MCP const& D0Particles, aod::CollisionsLc const& LcCollisions, aod::CandidatesLcMCD const& Lcs, soa::Join const& LcMcCollisions, aod::CandidatesLcMCP const& LcParticles, aod::CollisionsDielectron const& DielectronCollisions, aod::CandidatesDielectronMCD const& Dielectrons, aod::McCollisionsDielectron const& DielectronMcCollisions, aod::CandidatesDielectronMCP const& DielectronParticles) + void processStoreMC(soa::Join const& mcCollisions, soa::Join const& collisions, soa::Join const&, soa::Join const& tracks, aod::JEMCTracks const& emcTracks, soa::Join const& clusters, soa::Join const& particles, aod::CollisionsD0 const& D0Collisions, aod::CandidatesD0MCD const& D0s, soa::Join const& D0McCollisions, aod::CandidatesD0MCP const& D0Particles, aod::CollisionsLc const& LcCollisions, aod::CandidatesLcMCD const& Lcs, soa::Join const& LcMcCollisions, aod::CandidatesLcMCP const& LcParticles, aod::CollisionsBplus const& BplusCollisions, aod::CandidatesBplusMCD const& Bpluss, soa::Join const& BplusMcCollisions, aod::CandidatesBplusMCP const& BplusParticles, aod::CollisionsDielectron const& DielectronCollisions, aod::CandidatesDielectronMCD const& Dielectrons, aod::McCollisionsDielectron const& DielectronMcCollisions, aod::CandidatesDielectronMCP const& DielectronParticles) { std::map bcMapping; std::map paticleMapping; std::map mcCollisionMapping; std::map D0CollisionMapping; std::map LcCollisionMapping; + std::map BplusCollisionMapping; int particleTableIndex = 0; for (auto mcCollision : mcCollisions) { bool collisionSelected = false; @@ -566,12 +639,12 @@ struct JetDerivedDataWriter { const auto d0McCollisionsPerMcCollision = D0McCollisions.sliceBy(D0McCollisionsPerMcCollision, mcCollision.globalIndex()); int32_t mcCollisionD0Index = -1; for (const auto& d0McCollisionPerMcCollision : d0McCollisionsPerMcCollision) { // should only ever be one - jethfutilities::fillD0McCollisionTable(d0McCollisionPerMcCollision, products.storedD0McCollisionsTable, mcCollisionD0Index); + jethfutilities::fillHFMcCollisionTable(d0McCollisionPerMcCollision, products.storedD0McCollisionsTable, mcCollisionD0Index); products.storedD0McCollisionIdsTable(products.storedJMcCollisionsTable.lastIndex()); } for (const auto& D0Particle : D0Particles) { int32_t D0ParticleIndex = -1; - jethfutilities::fillD0CandidateMcTable(D0Particle, mcCollisionD0Index, products.storedD0ParticlesTable, D0ParticleIndex); + jethfutilities::fillHFCandidateMcTable(D0Particle, mcCollisionD0Index, products.storedD0ParticlesTable, D0ParticleIndex); int32_t D0ParticleId = -1; auto JParticleIndex = paticleMapping.find(D0Particle.mcParticleId()); if (JParticleIndex != paticleMapping.end()) { @@ -585,12 +658,12 @@ struct JetDerivedDataWriter { const auto lcMcCollisionsPerMcCollision = LcMcCollisions.sliceBy(LcMcCollisionsPerMcCollision, mcCollision.globalIndex()); int32_t mcCollisionLcIndex = -1; for (const auto& lcMcCollisionPerMcCollision : lcMcCollisionsPerMcCollision) { // should only ever be one - jethfutilities::fillLcMcCollisionTable(lcMcCollisionPerMcCollision, products.storedLcMcCollisionsTable, mcCollisionLcIndex); + jethfutilities::fillHFMcCollisionTable(lcMcCollisionPerMcCollision, products.storedLcMcCollisionsTable, mcCollisionLcIndex); products.storedLcMcCollisionIdsTable(products.storedJMcCollisionsTable.lastIndex()); } for (const auto& LcParticle : LcParticles) { int32_t LcParticleIndex = -1; - jethfutilities::fillLcCandidateMcTable(LcParticle, mcCollisionLcIndex, products.storedLcParticlesTable, LcParticleIndex); + jethfutilities::fillHFCandidateMcTable(LcParticle, mcCollisionLcIndex, products.storedLcParticlesTable, LcParticleIndex); int32_t LcParticleId = -1; auto JParticleIndex = paticleMapping.find(LcParticle.mcParticleId()); if (JParticleIndex != paticleMapping.end()) { @@ -599,6 +672,24 @@ struct JetDerivedDataWriter { products.storedLcParticleIdsTable(products.storedJMcCollisionsTable.lastIndex(), LcParticleId); } } + if (config.saveBplusTable) { + const auto lcMcCollisionsPerMcCollision = BplusMcCollisions.sliceBy(BplusMcCollisionsPerMcCollision, mcCollision.globalIndex()); + int32_t mcCollisionBplusIndex = -1; + for (const auto& lcMcCollisionPerMcCollision : lcMcCollisionsPerMcCollision) { // should only ever be one + jethfutilities::fillHFMcCollisionTable(lcMcCollisionPerMcCollision, products.storedBplusMcCollisionsTable, mcCollisionBplusIndex); + products.storedBplusMcCollisionIdsTable(products.storedJMcCollisionsTable.lastIndex()); + } + for (const auto& BplusParticle : BplusParticles) { + int32_t BplusParticleIndex = -1; + jethfutilities::fillHFCandidateMcTable(BplusParticle, mcCollisionBplusIndex, products.storedBplusParticlesTable, BplusParticleIndex); + int32_t BplusParticleId = -1; + auto JParticleIndex = paticleMapping.find(BplusParticle.mcParticleId()); + if (JParticleIndex != paticleMapping.end()) { + BplusParticleId = JParticleIndex->second; + } + products.storedBplusParticleIdsTable(products.storedJMcCollisionsTable.lastIndex(), BplusParticleId); + } + } if (config.saveDielectronTable) { const auto dielectronMcCollisionsPerMcCollision = DielectronMcCollisions.sliceBy(DielectronMcCollisionsPerMcCollision, mcCollision.globalIndex()); int32_t mcCollisionDielectronIndex = -1; @@ -722,6 +813,9 @@ struct JetDerivedDataWriter { auto JtrackIndex = trackMapping.find(clusterTrack.globalIndex()); if (JtrackIndex != trackMapping.end()) { clusterStoredJTrackIDs.push_back(JtrackIndex->second); + const auto emcTracksPerTrack = emcTracks.sliceBy(EMCTrackPerTrack, clusterTrack.globalIndex()); + auto emcTrackPerTrack = emcTracksPerTrack.iteratorAt(0); + products.storedJTracksEMCalTable(JtrackIndex->second, emcTrackPerTrack.etaEmcal(), emcTrackPerTrack.phiEmcal()); } } products.storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); @@ -744,14 +838,14 @@ struct JetDerivedDataWriter { const auto d0CollisionsPerCollision = D0Collisions.sliceBy(D0CollisionsPerCollision, collision.globalIndex()); int32_t collisionD0Index = -1; for (const auto& d0CollisionPerCollision : d0CollisionsPerCollision) { // should only ever be one - jethfutilities::fillD0CollisionTable(d0CollisionPerCollision, products.storedD0CollisionsTable, collisionD0Index); + jethfutilities::fillHFCollisionTable(d0CollisionPerCollision, products.storedD0CollisionsTable, collisionD0Index); products.storedD0CollisionIdsTable(products.storedJCollisionsTable.lastIndex()); D0CollisionMapping.insert(std::make_pair(d0CollisionPerCollision.globalIndex(), products.storedD0CollisionsTable.lastIndex())); } const auto d0sPerCollision = D0s.sliceBy(D0sPerCollision, collision.globalIndex()); for (const auto& D0 : d0sPerCollision) { int32_t D0Index = -1; - jethfutilities::fillD0CandidateTable(D0, collisionD0Index, products.storedD0sTable, products.storedD0ParsTable, products.storedD0ParExtrasTable, products.storedD0SelsTable, products.storedD0MlsTable, products.storedD0McsTable, D0Index); + jethfutilities::fillHFCandidateTable(D0, collisionD0Index, products.storedD0sTable, products.storedD0ParsTable, products.storedD0ParExtrasTable, products.storedD0ParDaughtersDummyTable, products.storedD0SelsTable, products.storedD0MlsTable, products.storedD0MlDughtersDummyTable, products.storedD0McsTable, D0Index); int32_t prong0Id = -1; int32_t prong1Id = -1; @@ -771,14 +865,14 @@ struct JetDerivedDataWriter { const auto lcCollisionsPerCollision = LcCollisions.sliceBy(LcCollisionsPerCollision, collision.globalIndex()); int32_t collisionLcIndex = -1; for (const auto& lcCollisionPerCollision : lcCollisionsPerCollision) { // should only ever be one - jethfutilities::fillLcCollisionTable(lcCollisionPerCollision, products.storedLcCollisionsTable, collisionLcIndex); + jethfutilities::fillHFCollisionTable(lcCollisionPerCollision, products.storedLcCollisionsTable, collisionLcIndex); products.storedLcCollisionIdsTable(products.storedJCollisionsTable.lastIndex()); LcCollisionMapping.insert(std::make_pair(lcCollisionPerCollision.globalIndex(), products.storedLcCollisionsTable.lastIndex())); } const auto lcsPerCollision = Lcs.sliceBy(LcsPerCollision, collision.globalIndex()); for (const auto& Lc : lcsPerCollision) { int32_t LcIndex = -1; - jethfutilities::fillLcCandidateTable(Lc, collisionLcIndex, products.storedLcsTable, products.storedLcParsTable, products.storedLcParExtrasTable, products.storedLcSelsTable, products.storedLcMlsTable, products.storedLcMcsTable, LcIndex); + jethfutilities::fillHFCandidateTable(Lc, collisionLcIndex, products.storedLcsTable, products.storedLcParsTable, products.storedLcParExtrasTable, products.storedLcParDaughtersDummyTable, products.storedLcSelsTable, products.storedLcMlsTable, products.storedLcMlDughtersDummyTable, products.storedLcMcsTable, LcIndex); int32_t prong0Id = -1; int32_t prong1Id = -1; @@ -799,6 +893,38 @@ struct JetDerivedDataWriter { } } + if (config.saveBplusTable) { + const auto lcCollisionsPerCollision = BplusCollisions.sliceBy(BplusCollisionsPerCollision, collision.globalIndex()); + int32_t collisionBplusIndex = -1; + for (const auto& lcCollisionPerCollision : lcCollisionsPerCollision) { // should only ever be one + jethfutilities::fillHFCollisionTable(lcCollisionPerCollision, products.storedBplusCollisionsTable, collisionBplusIndex); + products.storedBplusCollisionIdsTable(products.storedJCollisionsTable.lastIndex()); + BplusCollisionMapping.insert(std::make_pair(lcCollisionPerCollision.globalIndex(), products.storedBplusCollisionsTable.lastIndex())); + } + const auto lcsPerCollision = Bpluss.sliceBy(BplussPerCollision, collision.globalIndex()); + for (const auto& Bplus : lcsPerCollision) { + int32_t BplusIndex = -1; + jethfutilities::fillHFCandidateTable(Bplus, collisionBplusIndex, products.storedBplussTable, products.storedBplusParsTable, products.storedBplusParExtrasTable, products.storedBplusParD0sTable, products.storedBplusSelsTable, products.storedBplusMlsTable, products.storedBplusMlD0sTable, products.storedBplusMcsTable, BplusIndex); + + int32_t prong0Id = -1; + int32_t prong1Id = -1; + int32_t prong2Id = -1; + auto JtrackIndex = trackMapping.find(Bplus.prong0Id()); + if (JtrackIndex != trackMapping.end()) { + prong0Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(Bplus.prong1Id()); + if (JtrackIndex != trackMapping.end()) { + prong1Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(Bplus.prong2Id()); + if (JtrackIndex != trackMapping.end()) { + prong2Id = JtrackIndex->second; + } + products.storedBplusIdsTable(products.storedJCollisionsTable.lastIndex(), prong0Id, prong1Id, prong2Id); + } + } + if (config.saveDielectronTable) { const auto dielectronCollisionsPerCollision = DielectronCollisions.sliceBy(DielectronCollisionsPerCollision, collision.globalIndex()); int32_t collisionDielectronIndex = -1; @@ -854,6 +980,20 @@ struct JetDerivedDataWriter { products.storedLcMcCollisionsMatchingTable(lcCollisionIDs); } } + + if (config.saveBplusTable) { + const auto lcMcCollisionsPerMcCollision = BplusMcCollisions.sliceBy(BplusMcCollisionsPerMcCollision, mcCollision.globalIndex()); + for (const auto& lcMcCollisionPerMcCollision : lcMcCollisionsPerMcCollision) { // should just be one + std::vector lcCollisionIDs; + for (auto const& lcCollisionPerMcCollision : lcMcCollisionPerMcCollision.template hfCollBases_as()) { + auto lcCollisionIndex = BplusCollisionMapping.find(lcCollisionPerMcCollision.globalIndex()); + if (lcCollisionIndex != BplusCollisionMapping.end()) { + lcCollisionIDs.push_back(lcCollisionIndex->second); + } + } + products.storedBplusMcCollisionsMatchingTable(lcCollisionIDs); + } + } } } } @@ -861,7 +1001,7 @@ struct JetDerivedDataWriter { // to run after all jet selections PROCESS_SWITCH(JetDerivedDataWriter, processStoreMC, "write out data output tables for mc", false); - void processStoreMCP(soa::Join const& mcCollisions, soa::Join const& particles, aod::McCollisionsD0 const& D0McCollisions, aod::CandidatesD0MCP const& D0Particles, aod::McCollisionsLc const& LcMcCollisions, aod::CandidatesLcMCP const& LcParticles, aod::McCollisionsDielectron const& DielectronMcCollisions, aod::CandidatesDielectronMCP const& DielectronParticles) + void processStoreMCP(soa::Join const& mcCollisions, soa::Join const& particles, aod::McCollisionsD0 const& D0McCollisions, aod::CandidatesD0MCP const& D0Particles, aod::McCollisionsLc const& LcMcCollisions, aod::CandidatesLcMCP const& LcParticles, aod::McCollisionsBplus const& BplusMcCollisions, aod::CandidatesBplusMCP const& BplusParticles, aod::McCollisionsDielectron const& DielectronMcCollisions, aod::CandidatesDielectronMCP const& DielectronParticles) { int particleTableIndex = 0; @@ -910,12 +1050,12 @@ struct JetDerivedDataWriter { const auto d0McCollisionsPerMcCollision = D0McCollisions.sliceBy(D0McCollisionsPerMcCollision, mcCollision.globalIndex()); int32_t mcCollisionD0Index = -1; for (const auto& d0McCollisionPerMcCollision : d0McCollisionsPerMcCollision) { // should only ever be one - jethfutilities::fillD0McCollisionTable(d0McCollisionPerMcCollision, products.storedD0McCollisionsTable, mcCollisionD0Index); + jethfutilities::fillHFMcCollisionTable(d0McCollisionPerMcCollision, products.storedD0McCollisionsTable, mcCollisionD0Index); products.storedD0McCollisionIdsTable(products.storedJMcCollisionsTable.lastIndex()); } for (const auto& D0Particle : D0Particles) { int32_t D0ParticleIndex = -1; - jethfutilities::fillD0CandidateMcTable(D0Particle, mcCollisionD0Index, products.storedD0ParticlesTable, D0ParticleIndex); + jethfutilities::fillHFCandidateMcTable(D0Particle, mcCollisionD0Index, products.storedD0ParticlesTable, D0ParticleIndex); int32_t D0ParticleId = -1; auto JParticleIndex = paticleMapping.find(D0Particle.mcParticleId()); if (JParticleIndex != paticleMapping.end()) { @@ -928,12 +1068,12 @@ struct JetDerivedDataWriter { const auto lcMcCollisionsPerMcCollision = LcMcCollisions.sliceBy(LcMcCollisionsPerMcCollision, mcCollision.globalIndex()); int32_t mcCollisionLcIndex = -1; for (const auto& lcMcCollisionPerMcCollision : lcMcCollisionsPerMcCollision) { // should only ever be one - jethfutilities::fillLcMcCollisionTable(lcMcCollisionPerMcCollision, products.storedLcMcCollisionsTable, mcCollisionLcIndex); + jethfutilities::fillHFMcCollisionTable(lcMcCollisionPerMcCollision, products.storedLcMcCollisionsTable, mcCollisionLcIndex); products.storedLcMcCollisionIdsTable(products.storedJMcCollisionsTable.lastIndex()); } for (const auto& LcParticle : LcParticles) { int32_t LcParticleIndex = -1; - jethfutilities::fillLcCandidateMcTable(LcParticle, mcCollisionLcIndex, products.storedLcParticlesTable, LcParticleIndex); + jethfutilities::fillHFCandidateMcTable(LcParticle, mcCollisionLcIndex, products.storedLcParticlesTable, LcParticleIndex); int32_t LcParticleId = -1; auto JParticleIndex = paticleMapping.find(LcParticle.mcParticleId()); if (JParticleIndex != paticleMapping.end()) { @@ -942,6 +1082,24 @@ struct JetDerivedDataWriter { products.storedLcParticleIdsTable(products.storedJMcCollisionsTable.lastIndex(), LcParticleId); } } + if (config.saveBplusTable) { + const auto lcMcCollisionsPerMcCollision = BplusMcCollisions.sliceBy(BplusMcCollisionsPerMcCollision, mcCollision.globalIndex()); + int32_t mcCollisionBplusIndex = -1; + for (const auto& lcMcCollisionPerMcCollision : lcMcCollisionsPerMcCollision) { // should only ever be one + jethfutilities::fillHFMcCollisionTable(lcMcCollisionPerMcCollision, products.storedBplusMcCollisionsTable, mcCollisionBplusIndex); + products.storedBplusMcCollisionIdsTable(products.storedJMcCollisionsTable.lastIndex()); + } + for (const auto& BplusParticle : BplusParticles) { + int32_t BplusParticleIndex = -1; + jethfutilities::fillHFCandidateMcTable(BplusParticle, mcCollisionBplusIndex, products.storedBplusParticlesTable, BplusParticleIndex); + int32_t BplusParticleId = -1; + auto JParticleIndex = paticleMapping.find(BplusParticle.mcParticleId()); + if (JParticleIndex != paticleMapping.end()) { + BplusParticleId = JParticleIndex->second; + } + products.storedBplusParticleIdsTable(products.storedJMcCollisionsTable.lastIndex(), BplusParticleId); + } + } if (config.saveDielectronTable) { const auto dielectronMcCollisionsPerMcCollision = DielectronMcCollisions.sliceBy(DielectronMcCollisionsPerMcCollision, mcCollision.globalIndex()); int32_t mcCollisionDielectronIndex = -1; diff --git a/PWGJE/TableProducer/emcalCorrectionTask.cxx b/PWGJE/TableProducer/emcalCorrectionTask.cxx index 9664875bba3..2db77ca4894 100644 --- a/PWGJE/TableProducer/emcalCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalCorrectionTask.cxx @@ -8,17 +8,24 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - -// EMCAL Correction Task -// -/// \author Raymond Ehlers , ORNL -/// \author Florian Jonas +/// +/// EMCAL Correction Task +/// +/// \file emcalCorrectionTask.cxx +/// +/// \brief Task that provides EMCal clusters and applies necessary corrections +/// +/// \author Raymond Ehlers (raymond.ehlers@cern.ch) ORNL, Florian Jonas (florian.jonas@cern.ch) +/// #include -#include #include #include #include +#include +#include +#include +#include #include "CCDB/BasicCCDBManager.h" #include "Framework/runDataProcessing.h" @@ -47,12 +54,12 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using myGlobTracks = o2::soa::Join; -using bcEvSels = o2::soa::Join; -using collEventSels = o2::soa::Join; -using filteredCells = o2::soa::Filtered; -using mcCells = o2::soa::Join; -using filteredMCCells = o2::soa::Filtered; +using MyGlobTracks = o2::soa::Join; +using BcEvSels = o2::soa::Join; +using CollEventSels = o2::soa::Join; +using FilteredCells = o2::soa::Filtered; +using McCells = o2::soa::Join; +using FilteredMcCells = o2::soa::Filtered; struct EmcalCorrectionTask { Produces clusters; @@ -64,23 +71,22 @@ struct EmcalCorrectionTask { Produces emcalcollisionmatch; // Preslices - Preslice perCollision = o2::aod::track::collisionId; - PresliceUnsorted collisionsPerFoundBC = aod::evsel::foundBCId; + Preslice perCollision = o2::aod::track::collisionId; + PresliceUnsorted collisionsPerFoundBC = aod::evsel::foundBCId; Preslice collisionsPerBC = aod::collision::bcId; - Preslice cellsPerFoundBC = aod::calo::bcId; - Preslice mcCellsPerFoundBC = aod::calo::bcId; + Preslice cellsPerFoundBC = aod::calo::bcId; + Preslice mcCellsPerFoundBC = aod::calo::bcId; // Options for the clusterization // 1 corresponds to EMCAL cells based on the Run2 definition. Configurable selectedCellType{"selectedCellType", 1, "EMCAL Cell type"}; - Configurable clusterDefinitions{"clusterDefinition", "kV3Default", "cluster definition to be selected, e.g. V3Default. Multiple definitions can be specified separated by comma"}; + Configurable clusterDefinitions{"clusterDefinitions", "kV3Default", "cluster definition to be selected, e.g. V3Default. Multiple definitions can be specified separated by comma"}; Configurable maxMatchingDistance{"maxMatchingDistance", 0.4f, "Max matching distance track-cluster"}; - Configurable hasPropagatedTracks{"hasPropagatedTracks", false, "temporary flag, only set to true when running over data which has the tracks propagated to EMCal/PHOS!"}; Configurable nonlinearityFunction{"nonlinearityFunction", "DATA_TestbeamFinal", "Nonlinearity correction at cluster level"}; Configurable disableNonLin{"disableNonLin", false, "Disable NonLin correction if set to true"}; Configurable hasShaperCorrection{"hasShaperCorrection", true, "Apply correction for shaper saturation"}; Configurable applyCellAbsScale{"applyCellAbsScale", 0, "Enable absolute cell energy scale to correct for energy loss in material in front of EMCal"}; - Configurable> vCellAbsScaleFactor{"cellAbsScaleFactor", {1.f}, "values for absolute cell energy calibration. Different values correspond to different regions or SM types of EMCal"}; + Configurable> cellAbsScaleFactors{"cellAbsScaleFactors", {1.f}, "values for absolute cell energy calibration. Different values correspond to different regions or SM types of EMCal"}; Configurable logWeight{"logWeight", 4.5, "logarithmic weight for the cluster center of gravity calculation"}; Configurable exoticCellFraction{"exoticCellFraction", 0.97, "Good cell if fraction < 1-ecross/ecell"}; Configurable exoticCellDiffTime{"exoticCellDiffTime", 1.e6, "If time of candidate to exotic and close cell is larger than exoticCellDiffTime (in ns), it must be noisy, set amp to 0"}; @@ -88,6 +94,7 @@ struct EmcalCorrectionTask { Configurable exoticCellInCrossMinAmplitude{"exoticCellInCrossMinAmplitude", 0.1, "Minimum energy of cells in cross, if lower not considered in cross"}; Configurable useWeightExotic{"useWeightExotic", false, "States if weights should be used for exotic cell cut"}; Configurable isMC{"isMC", false, "States if run over MC"}; + Configurable applyCellTimeCorrection{"applyCellTimeCorrection", true, "apply a correction to the cell time for data and MC: Shift both average cell times to 0 and smear MC time distribution to fit data better"}; // Require EMCAL cells (CALO type 1) Filter emccellfilter = aod::calo::caloType == selectedCellType; @@ -109,6 +116,14 @@ struct EmcalCorrectionTask { // QA o2::framework::HistogramRegistry mHistManager{"EMCALCorrectionTaskQAHistograms"}; + // Random number generator to draw cell time smearing for MC + std::random_device rd{}; + std::mt19937_64 rdgen{rd()}; + std::normal_distribution<> normalgaus{0, 1}; // mean = 0, stddev = 1 (apply amplitude of smearing after drawing random for performance reasons) + + // EMCal geometry + o2::emcal::Geometry* geometry; + void init(InitContext const&) { LOG(debug) << "Start init!"; @@ -125,7 +140,7 @@ struct EmcalCorrectionTask { mCcdbManager->get("GLO/Config/Geometry"); } LOG(debug) << "After load geometry!"; - o2::emcal::Geometry* geometry = o2::emcal::Geometry::GetInstanceFromRunNumber(223409); + geometry = o2::emcal::Geometry::GetInstanceFromRunNumber(223409); if (!geometry) { LOG(error) << "Failure accessing geometry"; } @@ -147,17 +162,18 @@ struct EmcalCorrectionTask { mClusterFactories.setExoticCellMinAmplitude(exoticCellMinAmplitude); mClusterFactories.setExoticCellInCrossMinAmplitude(exoticCellInCrossMinAmplitude); mClusterFactories.setUseWeightExotic(useWeightExotic); - for (auto& clusterDefinition : mClusterDefinitions) { - mClusterizers.emplace_back(std::make_unique>(1E9, clusterDefinition.timeMin, clusterDefinition.timeMax, clusterDefinition.gradientCut, clusterDefinition.doGradientCut, clusterDefinition.seedEnergy, clusterDefinition.minCellEnergy)); + for (const auto& clusterDefinition : mClusterDefinitions) { + mClusterizers.emplace_back(std::make_unique>(clusterDefinition.timeDiff, clusterDefinition.timeMin, clusterDefinition.timeMax, clusterDefinition.gradientCut, clusterDefinition.doGradientCut, clusterDefinition.seedEnergy, clusterDefinition.minCellEnergy)); LOG(info) << "Cluster definition initialized: " << clusterDefinition.toString(); LOG(info) << "timeMin: " << clusterDefinition.timeMin; LOG(info) << "timeMax: " << clusterDefinition.timeMax; + LOG(info) << "timeDiff: " << clusterDefinition.timeDiff; LOG(info) << "gradientCut: " << clusterDefinition.gradientCut; LOG(info) << "seedEnergy: " << clusterDefinition.seedEnergy; LOG(info) << "minCellEnergy: " << clusterDefinition.minCellEnergy; - LOG(info) << "storageID" << clusterDefinition.storageID; + LOG(info) << "storageID: " << clusterDefinition.storageID; } - for (auto& clusterizer : mClusterizers) { + for (const auto& clusterizer : mClusterizers) { clusterizer->setGeometry(geometry); } @@ -171,34 +187,49 @@ struct EmcalCorrectionTask { LOG(debug) << "Completed init!"; + // Define the cell energy binning + std::vector cellEnergyBins; + for (int i = 0; i < 51; i++) + cellEnergyBins.emplace_back(0.1 * (i - 0) + 0.0); // from 0 to 5 GeV/c, every 0.1 GeV + for (int i = 51; i < 76; i++) + cellEnergyBins.emplace_back(0.2 * (i - 51) + 5.2); // from 5.2 to 10.0 GeV, every 0.2 GeV + for (int i = 76; i < 166; i++) + cellEnergyBins.emplace_back(1. * (i - 76) + 11.); // from 11.0 to 100. GeV, every 1 GeV + // Setup QA hists. // NOTE: This is not comprehensive. - using o2HistType = o2::framework::HistType; - using o2Axis = o2::framework::AxisSpec; - o2Axis energyAxis{200, 0., 100., "E (GeV)"}, + using O2HistType = o2::framework::HistType; + o2::framework::AxisSpec energyAxis{200, 0., 100., "E (GeV)"}, + timeAxis{300, -100, 200., "t (ns)"}, etaAxis{160, -0.8, 0.8, "#eta"}, - phiAxis{72, 0, 2 * 3.14159, "phi"}; - mHistManager.add("hCellE", "hCellE", o2HistType::kTH1F, {energyAxis}); - mHistManager.add("hCellTowerID", "hCellTowerID", o2HistType::kTH1I, {{20000, 0, 20000}}); - mHistManager.add("hCellEtaPhi", "hCellEtaPhi", o2HistType::kTH2F, {etaAxis, phiAxis}); + phiAxis{72, 0, 2 * 3.14159, "phi"}, + nlmAxis{50, -0.5, 49.5, "NLM"}; + mHistManager.add("hCellE", "hCellE", O2HistType::kTH1F, {energyAxis}); + mHistManager.add("hCellTowerID", "hCellTowerID", O2HistType::kTH1D, {{20000, 0, 20000}}); + mHistManager.add("hCellEtaPhi", "hCellEtaPhi", O2HistType::kTH2F, {etaAxis, phiAxis}); + mHistManager.add("hHGCellTimeEnergy", "hCellTime", O2HistType::kTH2F, {{300, -30, 30}, cellEnergyBins}); // Cell time vs energy for high gain cells (low energies) + mHistManager.add("hLGCellTimeEnergy", "hCellTime", O2HistType::kTH2F, {{300, -30, 30}, cellEnergyBins}); // Cell time vs energy for low gain cells (high energies) // NOTE: Reversed column and row because it's more natural for presentation. - mHistManager.add("hCellRowCol", "hCellRowCol;Column;Row", o2HistType::kTH2I, {{97, 0, 97}, {600, 0, 600}}); - mHistManager.add("hClusterE", "hClusterE", o2HistType::kTH1F, {energyAxis}); - mHistManager.add("hClusterEtaPhi", "hClusterEtaPhi", o2HistType::kTH2F, {etaAxis, phiAxis}); - mHistManager.add("hGlobalTrackEtaPhi", "hGlobalTrackEtaPhi", o2HistType::kTH2F, {etaAxis, phiAxis}); - mHistManager.add("hGlobalTrackMult", "hGlobalTrackMult", o2HistType::kTH1I, {{200, -0.5, 199.5, "N_{trk}"}}); - mHistManager.add("hCollisionType", "hCollisionType;;#it{count}", o2HistType::kTH1I, {{3, -0.5, 2.5}}); + mHistManager.add("hCellRowCol", "hCellRowCol;Column;Row", O2HistType::kTH2D, {{96, -0.5, 95.5}, {208, -0.5, 207.5}}); + mHistManager.add("hClusterE", "hClusterE", O2HistType::kTH1F, {energyAxis}); + mHistManager.add("hClusterNLM", "hClusterNLM", O2HistType::kTH1F, {nlmAxis}); + mHistManager.add("hClusterEtaPhi", "hClusterEtaPhi", O2HistType::kTH2F, {etaAxis, phiAxis}); + mHistManager.add("hClusterTime", "hClusterTime", O2HistType::kTH1F, {timeAxis}); + mHistManager.add("hGlobalTrackEtaPhi", "hGlobalTrackEtaPhi", O2HistType::kTH2F, {etaAxis, phiAxis}); + mHistManager.add("hGlobalTrackMult", "hGlobalTrackMult", O2HistType::kTH1D, {{200, -0.5, 199.5, "N_{trk}"}}); + mHistManager.add("hCollisionType", "hCollisionType;;#it{count}", O2HistType::kTH1D, {{3, -0.5, 2.5}}); auto hCollisionType = mHistManager.get(HIST("hCollisionType")); hCollisionType->GetXaxis()->SetBinLabel(1, "no collision"); hCollisionType->GetXaxis()->SetBinLabel(2, "normal collision"); hCollisionType->GetXaxis()->SetBinLabel(3, "mult. collisions"); - mHistManager.add("hClusterType", "hClusterType;;#it{count}", o2HistType::kTH1I, {{3, -0.5, 2.5}}); + mHistManager.add("hClusterType", "hClusterType;;#it{count}", O2HistType::kTH1D, {{3, -0.5, 2.5}}); auto hClusterType = mHistManager.get(HIST("hClusterType")); hClusterType->GetXaxis()->SetBinLabel(1, "no collision"); hClusterType->GetXaxis()->SetBinLabel(2, "normal collision"); hClusterType->GetXaxis()->SetBinLabel(3, "mult. collisions"); - mHistManager.add("hCollPerBC", "hCollPerBC;#it{N}_{coll.};#it{count}", o2HistType::kTH1I, {{100, -0.5, 99.5}}); - mHistManager.add("hBC", "hBC;;#it{count}", o2HistType::kTH1D, {{8, -0.5, 7.5}}); + mHistManager.add("hCollPerBC", "hCollPerBC;#it{N}_{coll.};#it{count}", O2HistType::kTH1D, {{100, -0.5, 99.5}}); + mHistManager.add("hBC", "hBC;;#it{count}", O2HistType::kTH1D, {{8, -0.5, 7.5}}); + mHistManager.add("hCollisionTimeReso", "hCollisionTimeReso;#Delta t_{coll};#it{count}", O2HistType::kTH1D, {{2000, 0, 2000}}); auto hBC = mHistManager.get(HIST("hBC")); hBC->GetXaxis()->SetBinLabel(1, "with EMCal cells"); hBC->GetXaxis()->SetBinLabel(2, "with EMCal cells but no collision"); @@ -209,8 +240,8 @@ struct EmcalCorrectionTask { hBC->GetXaxis()->SetBinLabel(7, "no EMCal cells and mult. collisions"); hBC->GetXaxis()->SetBinLabel(8, "all BC"); if (isMC) { - mHistManager.add("hContributors", "hContributors;contributor per cell hit;#it{counts}", o2HistType::kTH1I, {{20, 0, 20}}); - mHistManager.add("hMCParticleEnergy", "hMCParticleEnergy;#it{E} (GeV/#it{c});#it{counts}", o2HistType::kTH1F, {energyAxis}); + mHistManager.add("hContributors", "hContributors;contributor per cell hit;#it{counts}", O2HistType::kTH1I, {{20, 0, 20}}); + mHistManager.add("hMCParticleEnergy", "hMCParticleEnergy;#it{E} (GeV/#it{c});#it{counts}", O2HistType::kTH1F, {energyAxis}); } } @@ -219,7 +250,7 @@ struct EmcalCorrectionTask { // void process(aod::BCs const& bcs, aod::Collision const& collision, aod::Calos const& cells) // Appears to need the BC to be accessed to be available in the collision table... - void processFull(bcEvSels const& bcs, collEventSels const& collisions, myGlobTracks const& tracks, filteredCells const& cells) + void processFull(BcEvSels const& bcs, CollEventSels const& collisions, MyGlobTracks const& tracks, FilteredCells const& cells) { LOG(debug) << "Starting process full."; @@ -227,7 +258,7 @@ struct EmcalCorrectionTask { int nCellsProcessed = 0; std::unordered_map numberCollsInBC; // Number of collisions mapped to the global BC index of all BCs std::unordered_map numberCellsInBC; // Number of cells mapped to the global BC index of all BCs to check whether EMCal was readout - for (auto bc : bcs) { + for (const auto& bc : bcs) { LOG(debug) << "Next BC"; // Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer. // In particular, we need to filter only EMCAL cells. @@ -248,17 +279,17 @@ struct EmcalCorrectionTask { countBC(collisionsInFoundBC.size(), true); std::vector cellsBC; std::vector cellIndicesBC; - for (auto& cell : cellsInBC) { + for (const auto& cell : cellsInBC) { auto amplitude = cell.amplitude(); - if (static_cast(hasShaperCorrection)) { + if (static_cast(hasShaperCorrection) && emcal::intToChannelType(cell.cellType()) == emcal::ChannelType_t::LOW_GAIN) { // Apply shaper correction to LG cells amplitude = o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(amplitude); } if (applyCellAbsScale) { - amplitude *= GetAbsCellScale(cell.cellNumber()); + amplitude *= getAbsCellScale(cell.cellNumber()); } cellsBC.emplace_back(cell.cellNumber(), amplitude, - cell.time(), + cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType())), o2::emcal::intToChannelType(cell.cellType())); cellIndicesBC.emplace_back(cell.globalIndex()); } @@ -269,7 +300,7 @@ struct EmcalCorrectionTask { // TODO: Helpful for now, but should be removed. LOG(debug) << "Converted EMCAL cells"; - for (auto& cell : cellsBC) { + for (const auto& cell : cellsBC) { LOG(debug) << cell.getTower() << ": E: " << cell.getEnergy() << ", time: " << cell.getTimeStamp() << ", type: " << cell.getType(); } @@ -284,19 +315,20 @@ struct EmcalCorrectionTask { // dummy loop to get the first collision for (const auto& col : collisionsInFoundBC) { if (col.foundBCId() == bc.globalIndex()) { + mHistManager.fill(HIST("hCollisionTimeReso"), col.collisionTimeRes()); mHistManager.fill(HIST("hCollPerBC"), 1); mHistManager.fill(HIST("hCollisionType"), 1); - math_utils::Point3D vertex_pos = {col.posX(), col.posY(), col.posZ()}; + math_utils::Point3D vertexPos = {col.posX(), col.posY(), col.posZ()}; std::vector> clusterToTrackIndexMap; std::vector> trackToClusterIndexMap; - std::tuple>, std::vector>> IndexMapPair{clusterToTrackIndexMap, trackToClusterIndexMap}; + std::tuple>, std::vector>> indexMapPair{clusterToTrackIndexMap, trackToClusterIndexMap}; std::vector trackGlobalIndex; - doTrackMatching(col, tracks, IndexMapPair, vertex_pos, trackGlobalIndex); + doTrackMatching(col, tracks, indexMapPair, vertexPos, trackGlobalIndex); // Store the clusters in the table where a matching collision could // be identified. - FillClusterTable(col, vertex_pos, iClusterizer, cellIndicesBC, IndexMapPair, trackGlobalIndex); + fillClusterTable(col, vertexPos, iClusterizer, cellIndicesBC, indexMapPair, trackGlobalIndex); } } } else { // ambiguous @@ -309,7 +341,7 @@ struct EmcalCorrectionTask { hasCollision = true; mHistManager.fill(HIST("hCollisionType"), 2); } - FillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); + fillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); } LOG(debug) << "Cluster loop done for clusterizer " << iClusterizer; @@ -320,7 +352,7 @@ struct EmcalCorrectionTask { // Loop through all collisions and fill emcalcollisionmatch with a boolean stating, whether the collision was ambiguous (not the only collision in its BC) for (const auto& collision : collisions) { - auto globalbcid = collision.foundBC_as().globalIndex(); + auto globalbcid = collision.foundBC_as().globalIndex(); auto foundColls = numberCollsInBC.find(globalbcid); auto foundCells = numberCellsInBC.find(globalbcid); if (foundColls != numberCollsInBC.end() && foundCells != numberCellsInBC.end()) { @@ -334,7 +366,7 @@ struct EmcalCorrectionTask { } PROCESS_SWITCH(EmcalCorrectionTask, processFull, "run full analysis", true); - void processMCFull(bcEvSels const& bcs, collEventSels const& collisions, myGlobTracks const& tracks, filteredMCCells const& cells, aod::StoredMcParticles_001 const&) + void processMCFull(BcEvSels const& bcs, CollEventSels const& collisions, MyGlobTracks const& tracks, FilteredMcCells const& cells, aod::StoredMcParticles_001 const&) { LOG(debug) << "Starting process full."; @@ -342,7 +374,7 @@ struct EmcalCorrectionTask { int nCellsProcessed = 0; std::unordered_map numberCollsInBC; // Number of collisions mapped to the global BC index of all BCs std::unordered_map numberCellsInBC; // Number of cells mapped to the global BC index of all BCs to check whether EMCal was readout - for (auto bc : bcs) { + for (const auto& bc : bcs) { LOG(debug) << "Next BC"; // Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer. // In particular, we need to filter only EMCAL cells. @@ -364,19 +396,19 @@ struct EmcalCorrectionTask { std::vector cellsBC; std::vector cellIndicesBC; std::vector cellLabels; - for (auto& cell : cellsInBC) { + for (const auto& cell : cellsInBC) { mHistManager.fill(HIST("hContributors"), cell.mcParticle_as().size()); auto cellParticles = cell.mcParticle_as(); - for (auto& cellparticle : cellParticles) { + for (const auto& cellparticle : cellParticles) { mHistManager.fill(HIST("hMCParticleEnergy"), cellparticle.e()); } auto amplitude = cell.amplitude(); - if (static_cast(hasShaperCorrection)) { + if (static_cast(hasShaperCorrection) && emcal::intToChannelType(cell.cellType()) == emcal::ChannelType_t::LOW_GAIN) { // Apply shaper correction to LG cells amplitude = o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(amplitude); } cellsBC.emplace_back(cell.cellNumber(), amplitude, - cell.time(), + cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType())), o2::emcal::intToChannelType(cell.cellType())); cellIndicesBC.emplace_back(cell.globalIndex()); cellLabels.emplace_back(cell.mcParticleIds(), cell.amplitudeA()); @@ -388,7 +420,7 @@ struct EmcalCorrectionTask { // TODO: Helpful for now, but should be removed. LOG(debug) << "Converted EMCAL cells"; - for (auto& cell : cellsBC) { + for (const auto& cell : cellsBC) { LOG(debug) << cell.getTower() << ": E: " << cell.getEnergy() << ", time: " << cell.getTimeStamp() << ", type: " << cell.getType(); } @@ -405,17 +437,17 @@ struct EmcalCorrectionTask { if (col.foundBCId() == bc.globalIndex()) { mHistManager.fill(HIST("hCollPerBC"), 1); mHistManager.fill(HIST("hCollisionType"), 1); - math_utils::Point3D vertex_pos = {col.posX(), col.posY(), col.posZ()}; + math_utils::Point3D vertexPos = {col.posX(), col.posY(), col.posZ()}; std::vector> clusterToTrackIndexMap; std::vector> trackToClusterIndexMap; - std::tuple>, std::vector>> IndexMapPair{clusterToTrackIndexMap, trackToClusterIndexMap}; + std::tuple>, std::vector>> indexMapPair{clusterToTrackIndexMap, trackToClusterIndexMap}; std::vector trackGlobalIndex; - doTrackMatching(col, tracks, IndexMapPair, vertex_pos, trackGlobalIndex); + doTrackMatching(col, tracks, indexMapPair, vertexPos, trackGlobalIndex); // Store the clusters in the table where a matching collision could // be identified. - FillClusterTable(col, vertex_pos, iClusterizer, cellIndicesBC, IndexMapPair, trackGlobalIndex); + fillClusterTable(col, vertexPos, iClusterizer, cellIndicesBC, indexMapPair, trackGlobalIndex); } } } else { // ambiguous @@ -428,7 +460,7 @@ struct EmcalCorrectionTask { hasCollision = true; mHistManager.fill(HIST("hCollisionType"), 2); } - FillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); + fillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); } LOG(debug) << "Cluster loop done for clusterizer " << iClusterizer; } // end of clusterizer loop @@ -438,7 +470,7 @@ struct EmcalCorrectionTask { // Loop through all collisions and fill emcalcollisionmatch with a boolean stating, whether the collision was ambiguous (not the only collision in its BC) for (const auto& collision : collisions) { - auto globalbcid = collision.foundBC_as().globalIndex(); + auto globalbcid = collision.foundBC_as().globalIndex(); auto foundColls = numberCollsInBC.find(globalbcid); auto foundCells = numberCellsInBC.find(globalbcid); if (foundColls != numberCollsInBC.end() && foundCells != numberCellsInBC.end()) { @@ -451,12 +483,12 @@ struct EmcalCorrectionTask { LOG(detail) << "Processed " << nBCsProcessed << " BCs with " << nCellsProcessed << " cells"; } PROCESS_SWITCH(EmcalCorrectionTask, processMCFull, "run full analysis with MC info", false); - void processStandalone(aod::BCs const& bcs, aod::Collisions const& collisions, filteredCells const& cells) + void processStandalone(aod::BCs const& bcs, aod::Collisions const& collisions, FilteredCells const& cells) { LOG(debug) << "Starting process standalone."; int nBCsProcessed = 0; int nCellsProcessed = 0; - for (auto bc : bcs) { + for (const auto& bc : bcs) { LOG(debug) << "Next BC"; // Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer. // In particular, we need to filter only EMCAL cells. @@ -475,10 +507,10 @@ struct EmcalCorrectionTask { countBC(collisionsInBC.size(), true); std::vector cellsBC; std::vector cellIndicesBC; - for (auto& cell : cellsInBC) { + for (const auto& cell : cellsInBC) { cellsBC.emplace_back(cell.cellNumber(), cell.amplitude(), - cell.time(), + cell.time() + getCellTimeShift(cell.cellNumber(), cell.amplitude(), o2::emcal::intToChannelType(cell.cellType())), o2::emcal::intToChannelType(cell.cellType())); cellIndicesBC.emplace_back(cell.globalIndex()); } @@ -489,7 +521,7 @@ struct EmcalCorrectionTask { // TODO: Helpful for now, but should be removed. LOG(debug) << "Converted EMCAL cells"; - for (auto& cell : cellsBC) { + for (const auto& cell : cellsBC) { LOG(debug) << cell.getTower() << ": E: " << cell.getEnergy() << ", time: " << cell.getTimeStamp() << ", type: " << cell.getType(); } @@ -506,11 +538,11 @@ struct EmcalCorrectionTask { for (const auto& col : collisionsInBC) { mHistManager.fill(HIST("hCollPerBC"), 1); mHistManager.fill(HIST("hCollisionType"), 1); - math_utils::Point3D vertex_pos = {col.posX(), col.posY(), col.posZ()}; + math_utils::Point3D vertexPos = {col.posX(), col.posY(), col.posZ()}; // Store the clusters in the table where a matching collision could // be identified. - FillClusterTable(col, vertex_pos, iClusterizer, cellIndicesBC); + fillClusterTable(col, vertexPos, iClusterizer, cellIndicesBC); } } else { // ambiguous // LOG(warning) << "No vertex found for event. Assuming (0,0,0)."; @@ -522,7 +554,7 @@ struct EmcalCorrectionTask { hasCollision = true; mHistManager.fill(HIST("hCollisionType"), 2); } - FillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); + fillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); } LOG(debug) << "Cluster loop done for clusterizer " << iClusterizer; @@ -548,6 +580,8 @@ struct EmcalCorrectionTask { mAnalysisClusters.clear(); mClusterLabels.clear(); mClusterFactories.reset(); + // in preparation for future O2 changes + // mClusterFactories.setClusterizerSettings(mClusterDefinitions.at(iClusterizer).minCellEnergy, mClusterDefinitions.at(iClusterizer).timeMin, mClusterDefinitions.at(iClusterizer).timeMax, mClusterDefinitions.at(iClusterizer).recalcShowerShape5x5); if (cellLabels) { mClusterFactories.setContainer(*emcalClusters, cellsBC, *emcalClustersInputIndices, cellLabels); } else { @@ -568,7 +602,7 @@ struct EmcalCorrectionTask { } template - void FillClusterTable(Collision const& col, math_utils::Point3D const& vertex_pos, size_t iClusterizer, const gsl::span cellIndicesBC, std::optional>, std::vector>>> const& IndexMapPair = std::nullopt, std::optional> const& trackGlobalIndex = std::nullopt) + void fillClusterTable(Collision const& col, math_utils::Point3D const& vertexPos, size_t iClusterizer, const gsl::span cellIndicesBC, std::optional>, std::vector>>> const& indexMapPair = std::nullopt, std::optional> const& trackGlobalIndex = std::nullopt) { // we found a collision, put the clusters into the none ambiguous table clusters.reserve(mAnalysisClusters.size()); @@ -580,7 +614,7 @@ struct EmcalCorrectionTask { for (const auto& cluster : mAnalysisClusters) { // Determine the cluster eta, phi, correcting for the vertex position. auto pos = cluster.getGlobalPosition(); - pos = pos - vertex_pos; + pos = pos - vertexPos; // Normalize the vector and rescale by energy. pos *= (cluster.E() / std::sqrt(pos.Mag2())); @@ -617,12 +651,14 @@ struct EmcalCorrectionTask { } // end of cells of cluser loop // fill histograms mHistManager.fill(HIST("hClusterE"), cluster.E()); + mHistManager.fill(HIST("hClusterNLM"), cluster.getNExMax()); + mHistManager.fill(HIST("hClusterTime"), cluster.getClusterTime()); mHistManager.fill(HIST("hClusterEtaPhi"), pos.Eta(), TVector2::Phi_0_2pi(pos.Phi())); - if (IndexMapPair && trackGlobalIndex) { - for (unsigned int iTrack = 0; iTrack < std::get<0>(*IndexMapPair)[iCluster].size(); iTrack++) { - if (std::get<0>(*IndexMapPair)[iCluster][iTrack] >= 0) { - LOG(debug) << "Found track " << (*trackGlobalIndex)[std::get<0>(*IndexMapPair)[iCluster][iTrack]] << " in cluster " << cluster.getID(); - matchedTracks(clusters.lastIndex(), (*trackGlobalIndex)[std::get<0>(*IndexMapPair)[iCluster][iTrack]]); + if (indexMapPair && trackGlobalIndex) { + for (unsigned int iTrack = 0; iTrack < std::get<0>(*indexMapPair)[iCluster].size(); iTrack++) { + if (std::get<0>(*indexMapPair)[iCluster][iTrack] >= 0) { + LOG(debug) << "Found track " << (*trackGlobalIndex)[std::get<0>(*indexMapPair)[iCluster][iTrack]] << " in cluster " << cluster.getID(); + matchedTracks(clusters.lastIndex(), (*trackGlobalIndex)[std::get<0>(*indexMapPair)[iCluster][iTrack]]); } } } @@ -631,7 +667,7 @@ struct EmcalCorrectionTask { } template - void FillAmbigousClusterTable(BC const& bc, size_t iClusterizer, const gsl::span cellIndicesBC, bool hasCollision) + void fillAmbigousClusterTable(BC const& bc, size_t iClusterizer, const gsl::span cellIndicesBC, bool hasCollision) { int cellindex = -1; clustersAmbiguous.reserve(mAnalysisClusters.size()); @@ -669,27 +705,27 @@ struct EmcalCorrectionTask { clustercellsambiguous(clustersAmbiguous.lastIndex(), cellIndicesBC[cellindex]); } // end of cells of cluster loop - } // end of cluster loop + } // end of cluster loop } template - void doTrackMatching(Collision const& col, myGlobTracks const& tracks, std::tuple>, std::vector>>& IndexMapPair, math_utils::Point3D& vertex_pos, std::vector& trackGlobalIndex) + void doTrackMatching(Collision const& col, MyGlobTracks const& tracks, std::tuple>, std::vector>>& indexMapPair, math_utils::Point3D& vertexPos, std::vector& trackGlobalIndex) { auto groupedTracks = tracks.sliceBy(perCollision, col.globalIndex()); - int NTracksInCol = groupedTracks.size(); + int nTracksInCol = groupedTracks.size(); std::vector trackPhi; std::vector trackEta; // reserve memory to reduce on the fly memory allocation - trackPhi.reserve(NTracksInCol); - trackEta.reserve(NTracksInCol); - trackGlobalIndex.reserve(NTracksInCol); - FillTrackInfo(groupedTracks, trackPhi, trackEta, trackGlobalIndex); + trackPhi.reserve(nTracksInCol); + trackEta.reserve(nTracksInCol); + trackGlobalIndex.reserve(nTracksInCol); + fillTrackInfo(groupedTracks, trackPhi, trackEta, trackGlobalIndex); - int NClusterInCol = mAnalysisClusters.size(); + int nClusterInCol = mAnalysisClusters.size(); std::vector clusterPhi; std::vector clusterEta; - clusterPhi.reserve(NClusterInCol); - clusterEta.reserve(NClusterInCol); + clusterPhi.reserve(nClusterInCol); + clusterEta.reserve(nClusterInCol); // TODO one loop that could in principle be combined with the other // loop to improve performance @@ -697,48 +733,40 @@ struct EmcalCorrectionTask { // Determine the cluster eta, phi, correcting for the vertex // position. auto pos = cluster.getGlobalPosition(); - pos = pos - vertex_pos; + pos = pos - vertexPos; // Normalize the vector and rescale by energy. pos *= (cluster.E() / std::sqrt(pos.Mag2())); clusterPhi.emplace_back(TVector2::Phi_0_2pi(pos.Phi())); clusterEta.emplace_back(pos.Eta()); } - IndexMapPair = + indexMapPair = jetutilities::MatchClustersAndTracks(clusterPhi, clusterEta, trackPhi, trackEta, maxMatchingDistance, 20); } template - void FillTrackInfo(Tracks const& tracks, std::vector& trackPhi, std::vector& trackEta, std::vector& trackGlobalIndex) + void fillTrackInfo(Tracks const& tracks, std::vector& trackPhi, std::vector& trackEta, std::vector& trackGlobalIndex) { - int NTrack = 0; - for (auto& track : tracks) { + int nTrack = 0; + for (const auto& track : tracks) { // TODO only consider tracks in current emcal/dcal acceptanc if (!track.isGlobalTrack()) { // only global tracks continue; } - NTrack++; - if (hasPropagatedTracks) { // only temporarily while not every data - // has the tracks propagated to EMCal/PHOS - trackPhi.emplace_back(TVector2::Phi_0_2pi(track.trackPhiEmcal())); - trackEta.emplace_back(track.trackEtaEmcal()); - mHistManager.fill(HIST("hGlobalTrackEtaPhi"), track.trackEtaEmcal(), - TVector2::Phi_0_2pi(track.trackPhiEmcal())); - } else { - trackPhi.emplace_back(TVector2::Phi_0_2pi(track.phi())); - trackEta.emplace_back(track.eta()); - mHistManager.fill(HIST("hGlobalTrackEtaPhi"), track.eta(), - TVector2::Phi_0_2pi(track.phi())); - } + nTrack++; + trackPhi.emplace_back(TVector2::Phi_0_2pi(track.trackPhiEmcal())); + trackEta.emplace_back(track.trackEtaEmcal()); + mHistManager.fill(HIST("hGlobalTrackEtaPhi"), track.trackEtaEmcal(), + TVector2::Phi_0_2pi(track.trackPhiEmcal())); trackGlobalIndex.emplace_back(track.globalIndex()); } - mHistManager.fill(HIST("hGlobalTrackMult"), NTrack); + mHistManager.fill(HIST("hGlobalTrackMult"), nTrack); } - void countBC(int numberOfCollisions, bool hasEMCcells) + void countBC(int numberOfCollisions, bool hasEMCCells) { - int emcDataOffset = hasEMCcells ? 0 : 3; + int emcDataOffset = hasEMCCells ? 0 : 3; int collisionOffset = 2; switch (numberOfCollisions) { case 0: @@ -752,7 +780,7 @@ struct EmcalCorrectionTask { break; } mHistManager.fill(HIST("hBC"), 7); // All collisions - if (hasEMCcells) { + if (hasEMCCells) { mHistManager.fill(HIST("hBC"), 0); } mHistManager.fill(HIST("hBC"), 1 + emcDataOffset + collisionOffset); @@ -762,8 +790,12 @@ struct EmcalCorrectionTask { { // Cell QA // For convenience, use the clusterizer stored geometry to get the eta-phi - for (auto& cell : cellsBC) { + for (const auto& cell : cellsBC) { mHistManager.fill(HIST("hCellE"), cell.getEnergy()); + if (cell.getLowGain()) + mHistManager.fill(HIST("hLGCellTimeEnergy"), cell.getTimeStamp(), cell.getEnergy()); + else if (cell.getHighGain()) + mHistManager.fill(HIST("hHGCellTimeEnergy"), cell.getTimeStamp(), cell.getEnergy()); mHistManager.fill(HIST("hCellTowerID"), cell.getTower()); auto res = mClusterizers.at(0)->getGeometry()->EtaPhiFromIndex(cell.getTower()); mHistManager.fill(HIST("hCellEtaPhi"), std::get<0>(res), TVector2::Phi_0_2pi(std::get<1>(res))); @@ -773,26 +805,70 @@ struct EmcalCorrectionTask { } } - float GetAbsCellScale(const int cellID) + float getAbsCellScale(const int cellID) { // Apply cell scale based on SM types (Full, Half (not used), EMC 1/3, DCal, DCal 1/3) // Same as in Run2 data if (applyCellAbsScale == 1) { int iSM = mClusterizers.at(0)->getGeometry()->GetSuperModuleNumber(cellID); - return vCellAbsScaleFactor.value[mClusterizers.at(0)->getGeometry()->GetSMType(iSM)]; + return cellAbsScaleFactors.value[mClusterizers.at(0)->getGeometry()->GetSMType(iSM)]; // Apply cell scale based on columns to accoutn for material of TRD structures } else if (applyCellAbsScale == 2) { auto res = mClusterizers.at(0)->getGeometry()->GlobalRowColFromIndex(cellID); - return vCellAbsScaleFactor.value[std::get<1>(res)]; + return cellAbsScaleFactors.value[std::get<1>(res)]; } else { return 1.f; } } + + // Apply shift of the cell time in data and MC + // In MC this has to be done to shift the cell time, which is not calibrated to 0 due to the flight time of the particles to the EMCal surface (~15ns) + // In data this is done to correct for the time walk effect + float getCellTimeShift(const int16_t cellID, const float cellEnergy, const emcal::ChannelType_t cellType) + { + if (!applyCellTimeCorrection) { + return 0.f; + } + float timeshift = 0.f; + float timesmear = 0.f; + if (isMC) { // ---> MC + // Shift the time to 0, as the TOF was simulated -> eta dependent shift (as larger eta values are further away from collision point) + // Use distance between vertex and EMCal (at eta = 0) and distance on EMCal surface (cell size times column) to calculate distance to cell + // 0.2 is cell size in m (0.06) divided by the speed of light in m/ns (0.3) - 47.5 is the "middle" of the EMCal (2*48 cells in one column) + float timeCol = 0.2f * (geometry->GlobalCol(cellID) - 47.5f); // calculate time to get to specific column + timeshift = -std::sqrt(215.f + timeCol * timeCol); // 215 is 14.67ns^2 (time it takes to get the cell at eta = 0) + + // Also smear the time to account for the broader time resolution in data than in MC + if (cellEnergy < 0.3) // Cells with tless than 300 MeV cannot be the leading cell in the cluster, so their time does not require precise calibration + timesmear = 0.; // They will therefore not be smeared and only get their shift + else if (cellType == emcal::ChannelType_t::HIGH_GAIN) // High gain cells -> Low energies + timesmear = normalgaus(rdgen) * (1.6 + 9.5 * std::exp(-3. * cellEnergy)); // Parameters extracted from LHC24f3b & LHC22o (pp), but also usable for other periods + else if (cellType == emcal::ChannelType_t::LOW_GAIN) // Low gain cells -> High energies + timesmear = normalgaus(rdgen) * (5.0); // Parameters extracted from LHC24g4 & LHC24aj (pp), but also usable for other periods + + } else { // ---> Data + if (cellEnergy < 0.3) { // Cells with tless than 300 MeV cannot be the leading cell in the cluster, so their time does not require precise calibration + timeshift = 0.; // In data they will not be shifted (they are close to 0 anyways) + } else if (cellType == emcal::ChannelType_t::HIGH_GAIN) { // High gain cells -> Low energies + if (cellEnergy < 4.) // Low energy regime + timeshift = 0.8 * std::log(2.7 * cellEnergy); // Parameters extracted from LHC22o (pp), but also usable for other periods + else // Medium energy regime + timeshift = 1.5 * std::log(0.9 * cellEnergy); // Parameters extracted from LHC22o (pp), but also usable for other periods + } else if (cellType == emcal::ChannelType_t::LOW_GAIN) { // Low gain cells -> High energies + if (cellEnergy < 30.) // High energy regime + timeshift = 1.9 * std::log(0.09 * cellEnergy); // Parameters extracted from LHC24aj (pp), but also usable for other periods + else // Very high energy regime + timeshift = 1.9; // Parameters extracted from LHC24aj (pp), but also usable for other periods + } + LOG(debug) << "Shift the cell time by " << timeshift << " + " << timesmear << " ns"; + } + return timeshift + timesmear; + }; }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"emcal-correction-task"})}; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx index 396888fe1a7..c1c1dc19b54 100644 --- a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx +++ b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx @@ -31,10 +31,15 @@ using namespace o2::framework::expressions; struct eventWiseConstituentSubtractorTask { Produces trackSubtractedTable; + Produces particleSubtractedTable; Produces trackSubtractedD0Table; + Produces particleSubtractedD0Table; Produces trackSubtractedLcTable; + Produces particleSubtractedLcTable; Produces trackSubtractedBplusTable; + Produces particleSubtractedBplusTable; Produces trackSubtractedDielectronTable; + Produces particleSubtractedDielectronTable; Configurable trackPtMin{"trackPtMin", 0.15, "minimum track pT"}; Configurable trackPtMax{"trackPtMax", 1000.0, "maximum track pT"}; @@ -45,6 +50,8 @@ struct eventWiseConstituentSubtractorTask { Configurable trackingEfficiency{"trackingEfficiency", 1.0, "tracking efficiency applied to jet finding"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable particleSelections{"particleSelections", "PhysicalPrimary", "set particle selections"}; + Configurable alpha{"alpha", 1.0, "exponent of transverse momentum in calculating the distance measure between pairs"}; Configurable rMax{"rMax", 0.24, "maximum distance of subtraction"}; Configurable eventEtaMax{"eventEtaMax", 0.9, "maximum pseudorapidity of event"}; @@ -56,9 +63,14 @@ struct eventWiseConstituentSubtractorTask { std::vector tracksSubtracted; int trackSelection = -1; + std::string particleSelection; + + Service pdgDatabase; + void init(o2::framework::InitContext&) { trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + particleSelection = static_cast(particleSelections); eventWiseConstituentSubtractor.setDoRhoMassSub(doRhoMassSub); eventWiseConstituentSubtractor.setConstSubAlphaRMax(alpha, rMax); @@ -66,11 +78,11 @@ struct eventWiseConstituentSubtractorTask { } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); + Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta >= trackEtaMin && aod::jmcparticle::eta <= trackEtaMax && aod::jmcparticle::phi >= trackPhiMin && aod::jmcparticle::phi <= trackPhiMax); template - void analyseHF(T const& tracks, U const& candidates, V& trackSubtractedTable) + void analyseHF(T const& tracks, U const& candidates, V& trackSubTable) { - for (auto& candidate : candidates) { inputParticles.clear(); tracksSubtracted.clear(); @@ -78,8 +90,22 @@ struct eventWiseConstituentSubtractorTask { tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, candidate.rho(), candidate.rhoM()); for (auto const& trackSubtracted : tracksSubtracted) { + trackSubTable(candidate.globalIndex(), trackSubtracted.pt(), trackSubtracted.eta(), trackSubtracted.phi(), jetderiveddatautilities::setSingleTrackSelectionBit(trackSelection)); + } + } + } + + template + void analyseHFMc(T const& particles, U const& candidates, V& particleSubTable) + { + for (auto& candidate : candidates) { + inputParticles.clear(); + tracksSubtracted.clear(); + jetfindingutilities::analyseParticles(inputParticles, particleSelection, 1, particles, pdgDatabase, std::optional{candidate}); // currently only works for charged analyses - trackSubtractedTable(candidate.globalIndex(), trackSubtracted.pt(), trackSubtracted.eta(), trackSubtracted.phi(), trackSubtracted.E(), jetderiveddatautilities::setSingleTrackSelectionBit(trackSelection)); + tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, candidate.rho(), candidate.rhoM()); + for (auto const& trackSubtracted : tracksSubtracted) { + particleSubTable(candidate.globalIndex(), trackSubtracted.pt(), trackSubtracted.eta(), trackSubtracted.phi(), trackSubtracted.rap(), trackSubtracted.e(), 211, 1, 1, 1); // everything after phi is artificial and should not be used for analyses } } } @@ -94,34 +120,73 @@ struct eventWiseConstituentSubtractorTask { tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, collision.rho(), collision.rhoM()); for (auto const& trackSubtracted : tracksSubtracted) { - trackSubtractedTable(collision.globalIndex(), trackSubtracted.pt(), trackSubtracted.eta(), trackSubtracted.phi(), trackSubtracted.E(), jetderiveddatautilities::setSingleTrackSelectionBit(trackSelection)); + trackSubtractedTable(collision.globalIndex(), trackSubtracted.pt(), trackSubtracted.eta(), trackSubtracted.phi(), jetderiveddatautilities::setSingleTrackSelectionBit(trackSelection)); } } PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processCollisions, "Fill table of subtracted tracks for collisions", true); + void processMcCollisions(soa::Join::iterator const& mcCollision, soa::Filtered const& particles) + { + + inputParticles.clear(); + tracksSubtracted.clear(); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 1, particles, pdgDatabase); + + tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, mcCollision.rho(), mcCollision.rhoM()); + + for (auto const& trackSubtracted : tracksSubtracted) { + particleSubtractedTable(mcCollision.globalIndex(), trackSubtracted.pt(), trackSubtracted.eta(), trackSubtracted.phi(), trackSubtracted.rap(), trackSubtracted.e(), 211, 1, 1, 1); // everything after phi is artificial and should not be used for analyses + } + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processMcCollisions, "Fill table of subtracted tracks for Mc collisions", false); + void processD0Collisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) { analyseHF(tracks, candidates, trackSubtractedD0Table); } PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processD0Collisions, "Fill table of subtracted tracks for collisions with D0 candidates", false); + void processD0McCollisions(aod::JetMcCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + { + analyseHFMc(tracks, candidates, particleSubtractedD0Table); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processD0McCollisions, "Fill table of subtracted tracks for collisions with D0 MCP candidates", false); + void processLcCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) { analyseHF(tracks, candidates, trackSubtractedLcTable); } PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processLcCollisions, "Fill table of subtracted tracks for collisions with Lc candidates", false); - void processBplusCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + void processLcMcCollisions(aod::JetMcCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) { - analyseHF(tracks, candidates, trackSubtractedBplusTable); + analyseHFMc(tracks, candidates, particleSubtractedLcTable); } - PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processBplusCollisions, "Fill table of subtracted tracks for collisions with Bplus candidates", false); + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processLcMcCollisions, "Fill table of subtracted tracks for collisions with Lc MCP candidates", false); + + void processBplusCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + { + analyseHF(tracks, candidates, trackSubtractedBplusTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processBplusCollisions, "Fill table of subtracted tracks for collisions with Bplus candidates", false); + + void processBplusMcCollisions(aod::JetMcCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + { + analyseHFMc(tracks, candidates, particleSubtractedBplusTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processBplusMcCollisions, "Fill table of subtracted tracks for collisions with Bplus MCP candidates", false); void processDielectronCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) { analyseHF(tracks, candidates, trackSubtractedDielectronTable); } PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processDielectronCollisions, "Fill table of subtracted tracks for collisions with Dielectron candidates", false); + + void processDielectronMcCollisions(aod::JetMcCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + { + analyseHFMc(tracks, candidates, particleSubtractedDielectronTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processDielectronMcCollisions, "Fill table of subtracted tracks for collisions with Dielectron MCP candidates", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"subtractor-eventwiseconstituent"})}; } diff --git a/PWGJE/TableProducer/jeteventweightmcd.cxx b/PWGJE/TableProducer/jetEventWeightMCD.cxx similarity index 100% rename from PWGJE/TableProducer/jeteventweightmcd.cxx rename to PWGJE/TableProducer/jetEventWeightMCD.cxx diff --git a/PWGJE/TableProducer/jeteventweightmcp.cxx b/PWGJE/TableProducer/jetEventWeightMCP.cxx similarity index 100% rename from PWGJE/TableProducer/jeteventweightmcp.cxx rename to PWGJE/TableProducer/jetEventWeightMCP.cxx diff --git a/PWGJE/TableProducer/jettaggerhf.cxx b/PWGJE/TableProducer/jetTaggerHF.cxx similarity index 100% rename from PWGJE/TableProducer/jettaggerhf.cxx rename to PWGJE/TableProducer/jetTaggerHF.cxx diff --git a/PWGJE/TableProducer/jettrackderived.cxx b/PWGJE/TableProducer/jetTrackDerived.cxx similarity index 100% rename from PWGJE/TableProducer/jettrackderived.cxx rename to PWGJE/TableProducer/jetTrackDerived.cxx diff --git a/PWGJE/TableProducer/jetmatchingmc.cxx b/PWGJE/TableProducer/jetmatchingmc.cxx deleted file mode 100644 index 5ad292fcf8f..00000000000 --- a/PWGJE/TableProducer/jetmatchingmc.cxx +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file jetmatchingmc.cxx -/// \brief matching detector level and generator level jets -/// -/// \author Raymond Ehlers , ORNL -/// \author Jochen Klein -/// \author Aimeric Lanodu -/// \author Nima Zardoshti - -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoA.h" -#include "Framework/runDataProcessing.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/Core/JetUtilities.h" -#include "PWGJE/Core/JetFindingUtilities.h" -#include "PWGJE/Core/JetMatchingUtilities.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -template -struct JetMatchingMc { - - Configurable doMatchingGeo{"doMatchingGeo", true, "Enable geometric matching"}; - Configurable doMatchingPt{"doMatchingPt", true, "Enable pt matching"}; - Configurable doMatchingHf{"doMatchingHf", false, "Enable HF matching"}; - Configurable maxMatchingDistance{"maxMatchingDistance", 0.24f, "Max matching distance"}; - Configurable minPtFraction{"minPtFraction", 0.5f, "Minimum pt fraction for pt matching"}; - - Produces jetsBasetoTagMatchingTable; - Produces jetsTagtoBaseMatchingTable; - - // preslicing jet collections, only for Mc-based collection - static constexpr bool jetsBaseIsMc = o2::soa::relatedByIndex(); - static constexpr bool jetsTagIsMc = o2::soa::relatedByIndex(); - - Preslice baseJetsPerCollision = jetsBaseIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId; - Preslice tagJetsPerCollision = jetsTagIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId; - - PresliceUnsorted CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; - - void init(InitContext const&) - { - } - - void processDummy(aod::JetMcCollisions const&) - { - } - PROCESS_SWITCH(JetMatchingMc, processDummy, "Dummy process", true); - - void processJets(aod::JetMcCollisions const& mcCollisions, aod::JetCollisionsMCD const& collisions, - JetsBase const& jetsBase, JetsTag const& jetsTag, - aod::JetTracksMCD const& tracks, - ClustersBase const& clusters, - aod::JetParticles const& particles, - CandidatesBase const& candidatesBase, - CandidatesTag const& candidatesTag) - { - - // initialise objects used to store the matching index arrays (array in case a mcCollision is split) before filling the matching tables - std::vector> jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF; - std::vector> jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF; - // waiting for framework fix to make sliced collection of same type as original collection: - jetsBasetoTagMatchingGeo.assign(jetsBase.size(), {}); - jetsBasetoTagMatchingPt.assign(jetsBase.size(), {}); - jetsBasetoTagMatchingHF.assign(jetsBase.size(), {}); - jetsTagtoBaseMatchingGeo.assign(jetsTag.size(), {}); - jetsTagtoBaseMatchingPt.assign(jetsTag.size(), {}); - jetsTagtoBaseMatchingHF.assign(jetsTag.size(), {}); - - for (const auto& mcCollision : mcCollisions) { - - const auto collisionsPerMcColl = collisions.sliceBy(CollisionsPerMcCollision, mcCollision.globalIndex()); - - for (const auto& collision : collisionsPerMcColl) { - - const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, jetsBaseIsMc ? mcCollision.globalIndex() : collision.globalIndex()); - const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, jetsTagIsMc ? mcCollision.globalIndex() : collision.globalIndex()); - - jetmatchingutilities::doAllMatching(jetsBasePerColl, jetsTagPerColl, jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF, jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF, candidatesBase, candidatesTag, tracks, clusters, particles, particles, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction); - } - } - for (auto i = 0; i < jetsBase.size(); ++i) { - jetsBasetoTagMatchingTable(jetsBasetoTagMatchingGeo[i], jetsBasetoTagMatchingPt[i], jetsBasetoTagMatchingHF[i]); // is (and needs to) be filled in order - } - for (auto i = 0; i < jetsTag.size(); i++) { - jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order - } - } - PROCESS_SWITCH(JetMatchingMc, processJets, "Perform jet matching", false); -}; - -using ChargedJetMatching = JetMatchingMc, - soa::Join, - aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets, - aod::ChargedMCParticleLevelJetsMatchedToChargedMCDetectorLevelJets, - aod::JCollisions, - aod::JMcCollisions, - aod::JDummys>; -using FullJetMatching = JetMatchingMc, - soa::Join, - aod::FullMCDetectorLevelJetsMatchedToFullMCParticleLevelJets, - aod::FullMCParticleLevelJetsMatchedToFullMCDetectorLevelJets, - aod::JCollisions, - aod::JMcCollisions, - aod::JetClustersMCD>; -using NeutralJetMatching = JetMatchingMc, - soa::Join, - aod::NeutralMCDetectorLevelJetsMatchedToNeutralMCParticleLevelJets, - aod::NeutralMCParticleLevelJetsMatchedToNeutralMCDetectorLevelJets, - aod::JCollisions, - aod::JMcCollisions, - aod::JetClustersMCD>; -using D0ChargedJetMatching = JetMatchingMc, - soa::Join, - aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCParticleLevelJets, - aod::D0ChargedMCParticleLevelJetsMatchedToD0ChargedMCDetectorLevelJets, - aod::CandidatesD0MCD, - aod::CandidatesD0MCP, - aod::JDummys>; -using LcChargedJetMatching = JetMatchingMc, - soa::Join, - aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCParticleLevelJets, - aod::LcChargedMCParticleLevelJetsMatchedToLcChargedMCDetectorLevelJets, - aod::CandidatesLcMCD, - aod::CandidatesLcMCP, - aod::JDummys>; -/*using BplusChargedJetMatching = JetMatchingMc, - soa::Join, - aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCParticleLevelJets, - aod::BplusChargedMCParticleLevelJetsMatchedToBplusChargedMCDetectorLevelJets, - aod::CandidatesBplusMCD, - aod::CandidatesBplusMCP, - aod::JDummys>>;*/ -using V0ChargedJetMatching = JetMatchingMc, - soa::Join, - aod::V0ChargedMCDetectorLevelJetsMatchedToV0ChargedMCParticleLevelJets, - aod::V0ChargedMCParticleLevelJetsMatchedToV0ChargedMCDetectorLevelJets, - aod::CandidatesV0MCD, - aod::CandidatesV0MCP, - aod::JDummys>; - -using DielectronChargedJetMatching = JetMatchingMc, - soa::Join, - aod::DielectronChargedMCDetectorLevelJetsMatchedToDielectronChargedMCParticleLevelJets, - aod::DielectronChargedMCParticleLevelJetsMatchedToDielectronChargedMCDetectorLevelJets, - aod::CandidatesDielectronMCD, - aod::CandidatesDielectronMCP, - aod::JDummys>; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-full"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-neutral"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-d0-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-lc-ch"})); - // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-bplus-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-v0-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-dielectron-ch"})); - - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/TableProducer/luminositycalculator.cxx b/PWGJE/TableProducer/luminosityCalculator.cxx similarity index 100% rename from PWGJE/TableProducer/luminositycalculator.cxx rename to PWGJE/TableProducer/luminosityCalculator.cxx diff --git a/PWGJE/TableProducer/luminosityproducer.cxx b/PWGJE/TableProducer/luminosityProducer.cxx similarity index 100% rename from PWGJE/TableProducer/luminosityproducer.cxx rename to PWGJE/TableProducer/luminosityProducer.cxx diff --git a/PWGJE/TableProducer/rhoEstimator.cxx b/PWGJE/TableProducer/rhoEstimator.cxx index 13a596c2aaa..b8a74936bfd 100644 --- a/PWGJE/TableProducer/rhoEstimator.cxx +++ b/PWGJE/TableProducer/rhoEstimator.cxx @@ -31,10 +31,15 @@ using namespace o2::framework::expressions; struct RhoEstimatorTask { Produces rhoChargedTable; + Produces rhoChargedMcTable; Produces rhoD0Table; + Produces rhoD0McTable; Produces rhoLcTable; + Produces rhoLcMcTable; Produces rhoBplusTable; + Produces rhoBplusMcTable; Produces rhoDielectronTable; + Produces rhoDielectronMcTable; Configurable trackPtMin{"trackPtMin", 0.15, "minimum track pT"}; Configurable trackPtMax{"trackPtMax", 1000.0, "maximum track pT"}; @@ -45,6 +50,8 @@ struct RhoEstimatorTask { Configurable trackingEfficiency{"trackingEfficiency", 1.0, "tracking efficiency applied to jet finding"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable particleSelections{"particleSelections", "PhysicalPrimary", "set particle selections"}; + Configurable bkgjetR{"bkgjetR", 0.2, "jet resolution parameter for determining background density"}; Configurable bkgEtaMin{"bkgEtaMin", -0.9, "minimim pseudorapidity for determining background density"}; Configurable bkgEtaMax{"bkgEtaMax", 0.9, "maximum pseudorapidity for determining background density"}; @@ -56,10 +63,14 @@ struct RhoEstimatorTask { float bkgPhiMax_; std::vector inputParticles; int trackSelection = -1; + std::string particleSelection; + + Service pdgDatabase; void init(o2::framework::InitContext&) { trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + particleSelection = static_cast(particleSelections); bkgSub.setJetBkgR(bkgjetR); bkgSub.setEtaMinMax(bkgEtaMin, bkgEtaMax); @@ -70,8 +81,9 @@ struct RhoEstimatorTask { } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); + Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta >= trackEtaMin && aod::jmcparticle::eta <= trackEtaMax && aod::jmcparticle::phi >= trackPhiMin && aod::jmcparticle::phi <= trackPhiMax); - void processChargedCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks) + void processChargedCollisions(aod::JetCollision const& /*collision*/, soa::Filtered const& tracks) { inputParticles.clear(); jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); @@ -80,6 +92,15 @@ struct RhoEstimatorTask { } PROCESS_SWITCH(RhoEstimatorTask, processChargedCollisions, "Fill rho tables for collisions using charged tracks", true); + void processChargedMcCollisions(aod::JetMcCollision const& /*mcCollision*/, soa::Filtered const& particles) + { + inputParticles.clear(); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 1, particles, pdgDatabase); + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoChargedMcTable(rho, rhoM); + } + PROCESS_SWITCH(RhoEstimatorTask, processChargedMcCollisions, "Fill rho tables for MC collisions using charged tracks", false); + void processD0Collisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesD0Data const& candidates) { inputParticles.clear(); @@ -93,6 +114,19 @@ struct RhoEstimatorTask { } PROCESS_SWITCH(RhoEstimatorTask, processD0Collisions, "Fill rho tables for collisions with D0 candidates", false); + void processD0McCollisions(aod::JetMcCollision const&, soa::Filtered const& particles, aod::CandidatesD0MCP const& candidates) + { + inputParticles.clear(); + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseParticles(inputParticles, particleSelection, 1, particles, pdgDatabase, std::optional{candidate}); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoD0McTable(rho, rhoM); + } + } + PROCESS_SWITCH(RhoEstimatorTask, processD0McCollisions, "Fill rho tables for collisions with D0 MCP candidates", false); + void processLcCollisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesLcData const& candidates) { inputParticles.clear(); @@ -106,18 +140,44 @@ struct RhoEstimatorTask { } PROCESS_SWITCH(RhoEstimatorTask, processLcCollisions, "Fill rho tables for collisions with Lc candidates", false); - void processBplusCollisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesBplusData const& candidates) + void processLcMcCollisions(aod::JetMcCollision const&, soa::Filtered const& particles, aod::CandidatesLcMCP const& candidates) { inputParticles.clear(); for (auto& candidate : candidates) { inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, trackingEfficiency, std::optional{candidate}); + jetfindingutilities::analyseParticles(inputParticles, particleSelection, 1, particles, pdgDatabase, std::optional{candidate}); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); - rhoBplusTable(rho, rhoM); + rhoLcMcTable(rho, rhoM); } } - PROCESS_SWITCH(RhoEstimatorTask, processBplusCollisions, "Fill rho tables for collisions with Bplus candidates", false); + PROCESS_SWITCH(RhoEstimatorTask, processLcMcCollisions, "Fill rho tables for collisions with Lc MCP candidates", false); + + void processBplusCollisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesBplusData const& candidates) + { + inputParticles.clear(); + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, trackingEfficiency, std::optional{candidate}); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoBplusTable(rho, rhoM); + } + } + PROCESS_SWITCH(RhoEstimatorTask, processBplusCollisions, "Fill rho tables for collisions with Bplus candidates", false); + + void processBplusMcCollisions(aod::JetMcCollision const&, soa::Filtered const& particles, aod::CandidatesBplusMCP const& candidates) + { + inputParticles.clear(); + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseParticles(inputParticles, particleSelection, 1, particles, pdgDatabase, std::optional{candidate}); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoBplusMcTable(rho, rhoM); + } + } + PROCESS_SWITCH(RhoEstimatorTask, processBplusMcCollisions, "Fill rho tables for collisions with Bplus MCP candidates", false); void processDielectronCollisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesDielectronData const& candidates) { @@ -131,6 +191,19 @@ struct RhoEstimatorTask { } } PROCESS_SWITCH(RhoEstimatorTask, processDielectronCollisions, "Fill rho tables for collisions with Dielectron candidates", false); + + void processDielectronMcCollisions(aod::JetMcCollision const&, soa::Filtered const& particles, aod::CandidatesDielectronMCP const& candidates) + { + inputParticles.clear(); + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseParticles(inputParticles, particleSelection, 1, particles, pdgDatabase, std::optional{candidate}); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoDielectronMcTable(rho, rhoM); + } + } + PROCESS_SWITCH(RhoEstimatorTask, processDielectronMcCollisions, "Fill rho tables for collisions with Dielectron MCP candidates", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"estimator-rho"})}; } diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 562aeb833ee..4582452a7ab 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -11,19 +11,19 @@ o2physics_add_dpl_workflow(emc-cellmonitor - SOURCES emccellmonitor.cxx + SOURCES emcCellMonitor.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-clustermonitor - SOURCES emcclustermonitor.cxx + SOURCES emcClusterMonitor.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-eventselection-qa - SOURCES emceventselectionqa.cxx + SOURCES emcEventSelectionQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-vertexselection-qa - SOURCES emcvertexselectionqa.cxx + SOURCES emcVertexSelectionQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-pi0-energyscale-calib @@ -31,61 +31,101 @@ o2physics_add_dpl_workflow(emc-pi0-energyscale-calib PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-tmmonitor - SOURCES emctmmonitor.cxx + SOURCES emcTmMonitor.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(mc-generator-studies - SOURCES mcgeneratorstudies.cxx + SOURCES mcGeneratorStudies.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(photon-isolation-qa - SOURCES PhotonIsolationQA.cxx + SOURCES photonIsolationQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) if(FastJet_FOUND) o2physics_add_dpl_workflow(jet-substructure - SOURCES jetsubstructure.cxx + SOURCES jetSubstructure.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-substructure-output - SOURCES jetsubstructureoutput.cxx + SOURCES jetSubstructureOutput.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(jet-substructure-hf - SOURCES jetsubstructurehf.cxx + o2physics_add_dpl_workflow(jet-substructure-d0 + SOURCES jetSubstructureD0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(jet-substructure-hf-output - SOURCES jetsubstructurehfoutput.cxx + o2physics_add_dpl_workflow(jet-substructure-lc + SOURCES jetSubstructureLc.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-substructure-bplus + SOURCES jetSubstructureBplus.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-dielectron + SOURCES jetSubstructureDielectron.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-d0-output + SOURCES jetSubstructureD0Output.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-lc-output + SOURCES jetSubstructureLcOutput.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-bplus-output + SOURCES jetSubstructureBplusOutput.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-dielectron-output + SOURCES jetSubstructureDielectronOutput.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-fragmentation - SOURCES jetfragmentation.cxx + SOURCES jetFragmentation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-v0-spectra - SOURCES v0jetspectra.cxx + SOURCES v0JetSpectra.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-v0qa - SOURCES v0qa.cxx + SOURCES v0QA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-charged-qa - SOURCES jetfinderQA.cxx + SOURCES jetFinderQA.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-charged-v2 + SOURCES jetChargedV2.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-finder-d0-qa + SOURCES jetFinderD0QA.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-finder-lc-qa + SOURCES jetFinderLcQA.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-finder-bplus-qa + SOURCES jetFinderBplusQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(jet-finder-hf-qa - SOURCES jetfinderhfQA.cxx + o2physics_add_dpl_workflow(jet-finder-dielectron-qa + SOURCES jetFinderDielectronQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-full-qa - SOURCES jetfinderfullQA.cxx + SOURCES jetFinderFullQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-v0-qa - SOURCES jetfinderv0QA.cxx + SOURCES jetFinderV0QA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(trigger-correlations @@ -97,15 +137,15 @@ if(FastJet_FOUND) PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-full-trigger-qa - SOURCES FullJetTriggerQATask.cxx + SOURCES fullJetTriggerQATask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-matching-qa - SOURCES jetmatchingqa.cxx + SOURCES jetMatchingQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-validation-qa - SOURCES jetvalidationqa.cxx + SOURCES jetValidationQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-tutorial @@ -117,7 +157,7 @@ if(FastJet_FOUND) PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(track-jet-qa - SOURCES trackJetqa.cxx + SOURCES trackJetQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(track-efficiency @@ -129,7 +169,7 @@ if(FastJet_FOUND) PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-nsubjettiness - SOURCES nSubjettiness.cxx + SOURCES nsubjettiness.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(phi-in-jets @@ -141,7 +181,7 @@ if(FastJet_FOUND) PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-taggerhf-qa - SOURCES jettaggerhfQA.cxx + SOURCES jetTaggerHFQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-lund-reclustering @@ -149,11 +189,11 @@ if(FastJet_FOUND) PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore FastJet::FastJet FastJet::Contrib COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-hf-fragmentation - SOURCES hffragmentationfunction.cxx + SOURCES hfFragmentationFunction.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-planarflow - SOURCES jetplanarflow.cxx + SOURCES jetPlanarFlow.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-ch-corr @@ -169,13 +209,9 @@ if(FastJet_FOUND) PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(full-jet-spectra-pp - SOURCES fulljetspectrapp.cxx + SOURCES fullJetSpectraPP.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(gamma-jet-tree-producer - SOURCES gammajettreeproducer.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::PWGJECore O2Physics::AnalysisCore - COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(bjet-tagging-ml SOURCES bjetTaggingML.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2Physics::MLCore @@ -184,5 +220,9 @@ if(FastJet_FOUND) SOURCES jetSpectraEseTask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(gamma-jet-tree-producer + SOURCES gammaJetTreeProducer.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) endif() diff --git a/PWGJE/Tasks/ChJetTriggerQATask.cxx b/PWGJE/Tasks/ChJetTriggerQATask.cxx index 19e4df451ff..7b8331706bc 100644 --- a/PWGJE/Tasks/ChJetTriggerQATask.cxx +++ b/PWGJE/Tasks/ChJetTriggerQATask.cxx @@ -89,6 +89,9 @@ struct ChJetTriggerQATask { ConfigurableAxis dcaXY_Binning{"dcaXY_Binning", {100, -5., 5.}, ""}; ConfigurableAxis dcaZ_Binning{"dcaZ_Binning", {100, -3., 3.}, ""}; + ConfigurableAxis xPhiAxis{"xPhiAxis", {180, 0., TMath::TwoPi()}, ""}; + ConfigurableAxis yQ1pTAxis{"yQ1pTAxis", {200, -0.5, 0.5}, ""}; + float fiducialVolume; // 0.9 - jetR HistogramRegistry spectra; @@ -128,6 +131,7 @@ struct ChJetTriggerQATask { spectra.add("nITSClusters_TrackPt", "Number of ITS hits vs phi & pT of tracks", kTH3F, {{7, 1., 8.}, {60, 0., TMath::TwoPi()}, {100, 0., 100.}}); spectra.add("ptphiQualityTracks", "pT vs phi of quality tracks", {HistType::kTH2F, {{100, 0., 100.}, {60, 0, TMath::TwoPi()}}}); spectra.add("ptphiAllTracks", "pT vs phi of all tracks", {HistType::kTH2F, {{100, 0., +100.}, {60, 0, TMath::TwoPi()}}}); + spectra.add("phi_Q1pT", "Track phi vs. q/pT", kTH2F, {xPhiAxis, yQ1pTAxis}); // Supplementary plots if (bAddSupplementHistosToOutput) { @@ -206,6 +210,7 @@ struct ChJetTriggerQATask { continue; } + spectra.fill(HIST("phi_Q1pT"), originalTrack.phi(), originalTrack.sign() / originalTrack.pt()); spectra.fill(HIST("ptphiQualityTracks"), track.pt(), track.phi()); bool bDcaCondition = (fabs(track.dcaZ()) < dcaZ_cut) && (fabs(track.dcaXY()) < dcaXY_multFact * DcaXYPtCut(track.pt())); diff --git a/PWGJE/Tasks/bjetTaggingML.cxx b/PWGJE/Tasks/bjetTaggingML.cxx index e1e9d9e03d0..98b3542cc09 100644 --- a/PWGJE/Tasks/bjetTaggingML.cxx +++ b/PWGJE/Tasks/bjetTaggingML.cxx @@ -14,6 +14,10 @@ /// /// \author Hadi Hassan , University of Jyväskylä +#include +#include +#include + #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/ASoA.h" @@ -84,6 +88,7 @@ struct BJetTaggingML { // event level configurables Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable useEventWeight{"useEventWeight", true, "Flag whether to scale histograms with the event weight"}; Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; @@ -114,7 +119,7 @@ struct BJetTaggingML { Configurable> binsPtMl{"binsPtMl", std::vector{5., 1000.}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{cuts_ml::CutSmaller, cuts_ml::CutNot}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {defaultCutsMl[0], 1, 2, {"pT bin 0"}, {"score for default b-jet tagging", "uncer 1"}}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)2, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", 2, "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -450,7 +455,7 @@ struct BJetTaggingML { continue; } - float eventWeight = analysisJet.eventWeight(); + float eventWeight = useEventWeight ? analysisJet.eventWeight() : 1.0; float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); if (analysisJet.pt() > pTHatMaxMCD * pTHat) { continue; @@ -535,7 +540,7 @@ struct BJetTaggingML { continue; } - float eventWeight = mcpjet.eventWeight(); + float eventWeight = useEventWeight ? mcpjet.eventWeight() : 1.0; float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); if (mcpjet.pt() > pTHatMaxMCP * pTHat) { continue; @@ -582,7 +587,7 @@ struct BJetTaggingML { continue; } - float eventWeight = mcpjet.eventWeight(); + float eventWeight = useEventWeight ? mcpjet.eventWeight() : 1.0; float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); if (mcpjet.pt() > pTHatMaxMCP * pTHat) { continue; diff --git a/PWGJE/Tasks/bjetTreeCreator.cxx b/PWGJE/Tasks/bjetTreeCreator.cxx index 2d60344085a..6f9fe6a85b1 100644 --- a/PWGJE/Tasks/bjetTreeCreator.cxx +++ b/PWGJE/Tasks/bjetTreeCreator.cxx @@ -15,6 +15,11 @@ /// /// \author Hadi Hassan , University of Jyväskylä +#include +#include +#include +#include + #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/ASoA.h" @@ -81,6 +86,15 @@ DECLARE_SOA_COLUMN(SignedIP3D, ip3d, float); //! The t DECLARE_SOA_COLUMN(SignedIP3DSign, ip3dsigma, float); //! The track signed 3D IP significance DECLARE_SOA_COLUMN(MomFraction, momfraction, float); //! The track momentum fraction of the jets DECLARE_SOA_COLUMN(DeltaRTrackVertex, rtrackvertex, float); //! DR between the track and the closest SV, to be decided whether to add to or not +DECLARE_SOA_COLUMN(TrackPhi, trackphi, float); //! The track phi +DECLARE_SOA_COLUMN(TrackCharge, trackcharge, float); //! The track sign (charge) +DECLARE_SOA_COLUMN(TrackITSChi2NCl, trackitschi2ncl, float); //! The track ITS Chi2NCl +DECLARE_SOA_COLUMN(TrackTPCChi2NCl, tracktpcchi2ncl, float); //! The track TPC Chi2NCl +DECLARE_SOA_COLUMN(TrackITSNCls, trackitsncls, float); //! The track ITS NCls +DECLARE_SOA_COLUMN(TrackTPCNCls, tracktpcncls, float); //! The track TPC NCls (Found) +DECLARE_SOA_COLUMN(TrackTPCNCrossedRows, tracktpcncrossedrows, float); //! The track TPC NCrossedRows +DECLARE_SOA_COLUMN(TrackOrigin, trk_origin, int); //! The track origin label for GNN track origin predictions +DECLARE_SOA_COLUMN(TrackVtxIndex, trk_vtx_index, int); //! The track vertex index for GNN vertex predictions // DECLARE_SOA_COLUMN(DCATrackJet, dcatrackjet, float); //! The distance between track and jet, unfortunately it cannot be calculated in O2 } // namespace trackInfo @@ -101,6 +115,20 @@ DECLARE_SOA_TABLE(bjetTracksParams, "AOD", "BJETTRACKSPARAM", using bjetTracksParam = bjetTracksParams::iterator; +DECLARE_SOA_TABLE(bjetTracksParamsExtra, "AOD", "BJETTRACKSEXTRA", + // o2::soa::Index<>, + trackInfo::TrackPhi, + trackInfo::TrackCharge, + trackInfo::TrackITSChi2NCl, + trackInfo::TrackTPCChi2NCl, + trackInfo::TrackITSNCls, + trackInfo::TrackTPCNCls, + trackInfo::TrackTPCNCrossedRows, + trackInfo::TrackOrigin, + trackInfo::TrackVtxIndex); + +using bjetTracksParamExtra = bjetTracksParamsExtra::iterator; + namespace SVInfo { DECLARE_SOA_INDEX_COLUMN(bjetParam, jetindex); //! The jet index @@ -154,6 +182,7 @@ struct BJetTreeCreator { Produces bjetParamsTable; Produces bjetTracksParamsTable; + Produces bjetTracksExtraTable; Produces bjetSVParamsTable; Produces bjetConstituentsTable; @@ -196,6 +225,8 @@ struct BJetTreeCreator { Configurable produceTree{"produceTree", true, "produce the jet TTree"}; + Configurable vtxRes{"vtxRes", 0.01, "Vertex position resolution (cluster size) for GNN vertex predictions (cm)"}; + int eventSelection = -1; std::vector jetRadiiValues; @@ -225,7 +256,7 @@ struct BJetTreeCreator { registry.add("h2_jetMass_jetpT", "Jet mass;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{jet} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 50.0}}}); registry.add("h2_SVMass_jetpT", "Secondary vertex mass;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{SV} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 10}}}); - if (doprocessMCJets) { + if (doprocessMCJets || doprocessMCJetsForGNN) { registry.add("h2_SIPs2D_jetpT_bjet", "2D IP significance b-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_SIPs3D_jetpT_bjet", "3D IP significance b-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_LxyS_jetpT_bjet", "Decay length in XY b-jets;#it{p}_{T,jet} (GeV/#it{c});S#it{L}_{xy}", {HistType::kTH2F, {{200, 0., 200.}, {100, 0., 100.0}}}); @@ -259,6 +290,45 @@ struct BJetTreeCreator { registry.add("h2_Response_DetjetpT_PartjetpT_cjet", "Response matrix c-jets;#it{p}_{T,jet}^{det} (GeV/#it{c});#it{p}_{T,jet}^{part} (GeV/#it{c})", {HistType::kTH2F, {{200, 0., 200.}, {200, 0., 200.}}}); registry.add("h2_Response_DetjetpT_PartjetpT_lfjet", "Response matrix lf-jet;#it{p}_{T,jet}^{det} (GeV/#it{c});#it{p}_{T,jet}^{part} (GeV/#it{c})", {HistType::kTH2F, {{200, 0., 200.}, {200, 0., 200.}}}); } + + if (doprocessMCJetsForGNN) { + //+jet + registry.add("h_jet_pt", "jet_pt;#it{p}_{T}^{ch jet} (GeV/#it{c});Entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_jet_eta", "jet_eta;#it{#eta}_{ch jet};Entries", {HistType::kTH1F, {{200, -2., 2.}}}); + registry.add("h_jet_phi", "jet_phi;#it{#phi}_{ch jet};Entries", {HistType::kTH1F, {{200, 0., 2. * M_PI}}}); + registry.add("h_jet_flav", "jet_flav;jet flavor;Entries", {HistType::kTH1F, {{4, 0., 4.}}}); + registry.add("h_n_trks", "n_trks;#it{n}_{tracks};Entries", {HistType::kTH1F, {{50, 0., 50.}}}); + registry.add("h_jet_mass", "jet_mass;#it{m}_{jet} (GeV/#it{c}^2);Entries", {HistType::kTH1F, {{200, 0., 50.}}}); + auto h_jet_flav = registry.get(HIST("h_jet_flav")); + h_jet_flav->GetXaxis()->SetBinLabel(1, "no mcparticle"); // 0 + h_jet_flav->GetXaxis()->SetBinLabel(2, "c-jet"); // 1 + h_jet_flav->GetXaxis()->SetBinLabel(3, "b-jet"); // 2 + h_jet_flav->GetXaxis()->SetBinLabel(4, "lf-jet"); // 3 + registry.add("h_n_vertices", "n_vertices;#it{n}_{vertex};Entries", {HistType::kTH1F, {{50, 0., 50.}}}); + //+trk + registry.add("h_trk_pt", "trk_pt;#it{p}_{T} (GeV/#it{c});Entries", {HistType::kTH1F, {{200, 0., 100.}}}); + registry.add("h_trk_eta", "trk_eta;#it{#eta};Entries", {HistType::kTH1F, {{200, -2., 2.}}}); + registry.add("h_trk_phi", "trk_phi;#it{#phi};Entries", {HistType::kTH1F, {{200, 0., 2. * M_PI}}}); + registry.add("h_trk_charge", "trk_charge;#it{q};Entries", {HistType::kTH1F, {{3, -1.5, 1.5}}}); + registry.add("h_trk_dcaxy", "trk_dcaxy;#it{DCA}_{xy} (cm);Entries", {HistType::kTH1F, {{200, -0.1, 0.1}}}); + registry.add("h_trk_dcaxyz", "trk_dcaxyz;#it{DCA}_{xyz} (cm);Entries", {HistType::kTH1F, {{200, -0.1, 0.1}}}); + registry.add("h_trk_sigmadcaxy", "trk_sigmadcaxy;#it{#sigma}_{#it{DCA}_{xy}} (cm);Entries", {HistType::kTH1F, {{200, 0., 0.1}}}); + registry.add("h_trk_sigmadcaxyz", "trk_sigmadcaxyz;#it{#sigma}_{#it{DCA}_{xyz}} (cm);Entries", {HistType::kTH1F, {{200, 0., 0.1}}}); + registry.add("h_trk_itsncls", "trk_itsncls;ITS NCls;Entries", {HistType::kTH1F, {{10, 0., 10.}}}); + registry.add("h_trk_tpcncls", "trk_tpcncls;TPC NCls (Found);Entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_trk_tpcncrs", "trk_tpcncrs;TPC NCrossedRows;Entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_trk_itschi2ncl", "trk_itschi2ncl;ITS #it{#chi}^{2}/ndf;Entries", {HistType::kTH1F, {{200, 0., 20.}}}); + registry.add("h_trk_tpcchi2ncl", "trk_tpcchi2ncl;TPC #it{#chi}^{2}/ndf;Entries", {HistType::kTH1F, {{200, 0., 10.}}}); + registry.add("h2_trk_jtrackpt_vs_origtrackpt", "JTracks::pt vs Tracks::pt", {HistType::kTH2F, {{200, 0., 100.}, {200, 0., 100.}}}); + registry.add("h_trk_vtx_index", "trk_vtx_index;Vertex index;Entries", {HistType::kTH1F, {{20, 0., 20.}}}); + registry.add("h_trk_origin", "trk_origin;Track origin;Entries", {HistType::kTH1F, {{5, 0., 5.}}}); + auto h_trk_origin = registry.get(HIST("h_trk_origin")); + h_trk_origin->GetXaxis()->SetBinLabel(1, "NotPhysPrim"); + h_trk_origin->GetXaxis()->SetBinLabel(2, "Charm"); + h_trk_origin->GetXaxis()->SetBinLabel(3, "Beauty"); + h_trk_origin->GetXaxis()->SetBinLabel(4, "Primary"); + h_trk_origin->GetXaxis()->SetBinLabel(5, "OtherSecondary"); + } } // FIXME filtering only works when you loop directly over the list, but if you loop over it as a constituent they will not be filtered @@ -272,6 +342,8 @@ struct BJetTreeCreator { using JetTracksMCDwID = soa::Filtered>; using DataJets = soa::Filtered>; + using OriginalTracks = soa::Join; + // Function to get the reduction factor based on jet pT double getReductionFactor(double jetPT) { @@ -347,6 +419,8 @@ struct BJetTreeCreator { } } + using TrackLabelMap = std::unordered_map>; + template void analyzeJetTrackInfo(AnyCollision const& /*collision*/, AnalysisJet const& analysisJet, AnyTracks const& /*allTracks*/, SecondaryVertices const& /*allSVs*/, std::vector& trackIndices, int jetFlavor = 0, double eventweight = 1.0) { @@ -392,6 +466,77 @@ struct BJetTreeCreator { } } + template + void analyzeJetTrackInfoForGNN(AnyCollision const& /*collision*/, AnalysisJet const& analysisJet, AnyTracks const& /*allTracks*/, AnyOriginalTracks const&, std::vector& trackIndices, int jetFlavor = 0, double eventweight = 1.0, TrackLabelMap* trkLabels = nullptr) + { + int trkIdx = -1; + for (auto& constituent : analysisJet.template tracks_as()) { + + trkIdx++; + + if (constituent.pt() < trackPtMin) { + continue; + } + + double deltaRJetTrack = jetutilities::deltaR(analysisJet, constituent); + double dotProduct = RecoDecay::dotProd(std::array{analysisJet.px(), analysisJet.py(), analysisJet.pz()}, std::array{constituent.px(), constituent.py(), constituent.pz()}); + int sign = jettaggingutilities::getGeoSign(analysisJet, constituent); + + registry.fill(HIST("h2_SIPs2D_jetpT"), analysisJet.pt(), sign * std::abs(constituent.dcaXY()) / constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h2_SIPs3D_jetpT"), analysisJet.pt(), sign * std::abs(constituent.dcaXYZ()) / constituent.sigmadcaXYZ(), eventweight); + + if (doprocessMCJetsForGNN) { + if (jetFlavor == 2) { + registry.fill(HIST("h2_SIPs2D_jetpT_bjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXY()) / constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h2_SIPs3D_jetpT_bjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXYZ()) / constituent.sigmadcaXYZ(), eventweight); + } else if (jetFlavor == 1) { + registry.fill(HIST("h2_SIPs2D_jetpT_cjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXY()) / constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h2_SIPs3D_jetpT_cjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXYZ()) / constituent.sigmadcaXYZ(), eventweight); + } else { + registry.fill(HIST("h2_SIPs2D_jetpT_lfjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXY()) / constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h2_SIPs3D_jetpT_lfjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXYZ()) / constituent.sigmadcaXYZ(), eventweight); + } + + auto origConstit = constituent.template track_as(); + + //+ + int trkVtxIndex = 0; + int trkOrigin = 0; + if (trkLabels != nullptr) { + trkVtxIndex = (*trkLabels)["trkVtxIndex"][trkIdx]; + trkOrigin = (*trkLabels)["trkOrigin"][trkIdx]; + } + + //+trk + registry.fill(HIST("h_trk_pt"), constituent.pt(), eventweight); + registry.fill(HIST("h_trk_eta"), constituent.eta(), eventweight); + registry.fill(HIST("h_trk_phi"), origConstit.phi(), eventweight); + registry.fill(HIST("h_trk_charge"), constituent.sign(), eventweight); + registry.fill(HIST("h_trk_dcaxy"), std::abs(constituent.dcaXY()) * sign, eventweight); + registry.fill(HIST("h_trk_dcaxyz"), std::abs(constituent.dcaXYZ()) * sign, eventweight); + registry.fill(HIST("h_trk_sigmadcaxy"), constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h_trk_sigmadcaxyz"), constituent.sigmadcaXYZ(), eventweight); + registry.fill(HIST("h_trk_itsncls"), origConstit.itsNCls(), eventweight); + registry.fill(HIST("h_trk_tpcncls"), origConstit.tpcNClsFound(), eventweight); + registry.fill(HIST("h_trk_tpcncrs"), origConstit.tpcNClsCrossedRows(), eventweight); + registry.fill(HIST("h_trk_itschi2ncl"), origConstit.itsChi2NCl(), eventweight); + registry.fill(HIST("h_trk_tpcchi2ncl"), origConstit.tpcChi2NCl(), eventweight); + registry.fill(HIST("h2_trk_jtrackpt_vs_origtrackpt"), constituent.pt(), origConstit.pt(), eventweight); // jtrack & new extra table are well joined (linear correlation) + registry.fill(HIST("h_trk_vtx_index"), trkVtxIndex); + registry.fill(HIST("h_trk_origin"), trkOrigin); + + if (produceTree) { + bjetTracksExtraTable(/*bjetParamsTable.lastIndex() + 1, */ origConstit.phi(), constituent.sign(), origConstit.itsChi2NCl(), origConstit.tpcChi2NCl(), origConstit.itsNCls(), origConstit.tpcNClsFound(), origConstit.tpcNClsCrossedRows(), trkOrigin, trkVtxIndex); //+ + } + } + + if (produceTree) { + bjetTracksParamsTable(bjetParamsTable.lastIndex() + 1, constituent.pt(), constituent.eta(), dotProduct, dotProduct / analysisJet.p(), deltaRJetTrack, std::abs(constituent.dcaXY()) * sign, constituent.sigmadcaXY(), std::abs(constituent.dcaXYZ()) * sign, constituent.sigmadcaXYZ(), constituent.p() / analysisJet.p(), 0.); + } + trackIndices.push_back(bjetTracksParamsTable.lastIndex()); + } + } + void processDummy(FilteredCollision::iterator const& /*collision*/) { } @@ -548,6 +693,89 @@ struct BJetTreeCreator { } PROCESS_SWITCH(BJetTreeCreator, processMCJets, "jet information in MC", false); + using MCDJetTableNoSV = soa::Filtered>; + using JetParticleswID = soa::Join; + + void processMCJetsForGNN(FilteredCollisionMCD::iterator const& collision, aod::JMcCollisions const&, MCDJetTableNoSV const& MCDjets, MCPJetTable const& MCPjets, JetTracksMCDwID const& allTracks, JetParticleswID const& MCParticles, OriginalTracks const& origTracks, aod::McParticles const& origParticles) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || (static_cast(std::rand()) / RAND_MAX < eventReductionFactor)) { + return; + } + + registry.fill(HIST("h_vertexZ"), collision.posZ()); + + auto const mcParticlesPerColl = MCParticles.sliceBy(McParticlesPerCollision, collision.mcCollisionId()); + auto const mcPJetsPerColl = MCPjets.sliceBy(McPJetsPerCollision, collision.mcCollisionId()); + + for (const auto& analysisJet : MCDjets) { + + bool jetIncluded = false; + for (auto jetR : jetRadiiValues) { + if (analysisJet.r() == static_cast(jetR * 100)) { + jetIncluded = true; + break; + } + } + + if (!jetIncluded) { + continue; + } + + std::vector tracksIndices; + std::vector SVsIndices; + + int16_t jetFlavor = 0; + + for (auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + if (useQuarkDef) { + jetFlavor = jettaggingutilities::getJetFlavor(mcpjet, mcParticlesPerColl); + } else { + jetFlavor = jettaggingutilities::getJetFlavorHadron(mcpjet, mcParticlesPerColl); + } + } + + if ((jetFlavor != JetTaggingSpecies::charm && jetFlavor != JetTaggingSpecies::beauty) && (static_cast(std::rand()) / RAND_MAX < getReductionFactor(analysisJet.pt()))) { + continue; + } + + float eventWeight = analysisJet.eventWeight(); + + //+ + TrackLabelMap trkLabels{{"trkVtxIndex", {}}, {"trkOrigin", {}}}; + int nVertices = jettaggingutilities::vertexClustering(collision.template mcCollision_as(), analysisJet, allTracks, MCParticles, origParticles, trkLabels, true, vtxRes, trackPtMin); + analyzeJetTrackInfoForGNN(collision, analysisJet, allTracks, origTracks, tracksIndices, jetFlavor, eventWeight, &trkLabels); + + registry.fill(HIST("h2_jetMass_jetpT"), analysisJet.pt(), analysisJet.mass(), eventWeight); + registry.fill(HIST("h2_nTracks_jetpT"), analysisJet.pt(), tracksIndices.size()); + + //+jet + registry.fill(HIST("h_jet_pt"), analysisJet.pt()); + registry.fill(HIST("h_jet_eta"), analysisJet.eta()); + registry.fill(HIST("h_jet_phi"), analysisJet.phi()); + registry.fill(HIST("h_jet_flav"), jetFlavor); + registry.fill(HIST("h_n_trks"), tracksIndices.size()); + registry.fill(HIST("h_jet_mass"), analysisJet.mass()); + registry.fill(HIST("h_n_vertices"), nVertices); + + if (jetFlavor == 2) { + registry.fill(HIST("h2_jetMass_jetpT_bjet"), analysisJet.pt(), analysisJet.mass(), eventWeight); + registry.fill(HIST("h_jetpT_detector_bjet"), analysisJet.pt(), eventWeight); + } else if (jetFlavor == 1) { + registry.fill(HIST("h2_jetMass_jetpT_cjet"), analysisJet.pt(), analysisJet.mass(), eventWeight); + registry.fill(HIST("h_jetpT_detector_cjet"), analysisJet.pt(), eventWeight); + } else { + registry.fill(HIST("h2_jetMass_jetpT_lfjet"), analysisJet.pt(), analysisJet.mass(), eventWeight); + registry.fill(HIST("h_jetpT_detector_lfjet"), analysisJet.pt(), eventWeight); + } + + if (produceTree) { + bjetConstituentsTable(bjetParamsTable.lastIndex() + 1, tracksIndices, SVsIndices); + bjetParamsTable(analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), tracksIndices.size(), nVertices, analysisJet.mass(), jetFlavor, analysisJet.r()); + } + } + } + PROCESS_SWITCH(BJetTreeCreator, processMCJetsForGNN, "jet information in MC for GNN", false); + Filter mccollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; using FilteredCollisionMCP = soa::Filtered; diff --git a/PWGJE/Tasks/emccellmonitor.cxx b/PWGJE/Tasks/emcCellMonitor.cxx similarity index 100% rename from PWGJE/Tasks/emccellmonitor.cxx rename to PWGJE/Tasks/emcCellMonitor.cxx diff --git a/PWGJE/Tasks/emcclustermonitor.cxx b/PWGJE/Tasks/emcClusterMonitor.cxx similarity index 96% rename from PWGJE/Tasks/emcclustermonitor.cxx rename to PWGJE/Tasks/emcClusterMonitor.cxx index 2d6d50b6fef..9db525fe409 100644 --- a/PWGJE/Tasks/emcclustermonitor.cxx +++ b/PWGJE/Tasks/emcClusterMonitor.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -75,6 +76,7 @@ struct ClusterMonitor { std::vector mVetoBCIDs; std::vector mSelectBCIDs; + std::vector mCellTime; /// \brief Create output histograms and initialize geometry void init(InitContext const&) @@ -94,6 +96,8 @@ struct ClusterMonitor { const o2Axis supermoduleAxis{20, -0.5, 19.5, "Supermodule ID"}; o2Axis timeAxis{mClusterTimeBinning, "t_{cl} (ns)"}; o2Axis numberClustersAxis{mNumberClusterBinning, "Number of clusters / event"}; + const AxisSpec thAxisCellTimeDiff{3000, -1500, 1500, "#Delta#it{t}_{cell} (ns)"}; + const AxisSpec thAxisCellTimeMean{1500, -600, 900, "#LT#it{t}_{cell}#GT (ns)"}; // event properties mHistManager.add("eventsAll", "Number of events", o2HistType::kTH1F, {{1, 0.5, 1.5}}); @@ -109,7 +113,6 @@ struct ClusterMonitor { mHistManager.add("numberOfClustersSMBC", "number of clusters per supermodule per bunch crossing (ambiguous BCs)", o2HistType::kTH2F, {numberClustersAxis, {20, -0.5, 19.5, "SupermoduleID"}}); // cluster properties (matched clusters) - int MaxMatched = 20; // maximum number of matched tracks, hardcoded in emcalCorrectionTask.cxx! mHistManager.add("clusterE", "Energy of cluster", o2HistType::kTH1F, {energyAxis}); mHistManager.add("clusterEMatched", "Energy of cluster (with match)", o2HistType::kTH1F, {energyAxis}); mHistManager.add("clusterESupermodule", "Energy of the cluster vs. supermoduleID", o2HistType::kTH2F, {energyAxis, supermoduleAxis}); @@ -122,6 +125,8 @@ struct ClusterMonitor { mHistManager.add("clusterDistanceToBadChannel", "Distance to bad channel", o2HistType::kTH1F, {{100, 0, 100}}); mHistManager.add("clusterTimeVsE", "Cluster time vs energy", o2HistType::kTH2F, {timeAxis, energyAxis}); mHistManager.add("clusterAmpFractionLeadingCell", "Fraction of energy in leading cell", o2HistType::kTH1F, {{100, 0, 1}}); + mHistManager.add("clusterCellTimeDiff", "Cell time difference in clusters", o2HistType::kTH1D, {thAxisCellTimeDiff}); + mHistManager.add("clusterCellTimeMean", "Mean cell time per cluster", o2HistType::kTH1D, {thAxisCellTimeMean}); // add histograms per supermodule for (int ism = 0; ism < 20; ++ism) { @@ -239,12 +244,21 @@ struct ClusterMonitor { auto cellsofcluster = emccluscells.sliceBy(perCluster, cluster.globalIndex()); double maxamp = 0; double ampfraction = 0; + mCellTime.clear(); + mCellTime.reserve(cellsofcluster.size()); for (const auto& cell : cellsofcluster) { // example how to get any information of the cell associated with cluster LOG(debug) << "Cell ID:" << cell.calo().amplitude() << " Time " << cell.calo().time(); if (cell.calo().amplitude() > maxamp) { maxamp = cell.calo().amplitude(); } + mCellTime.push_back(cell.calo().time()); + } // end of loop over cells + mHistManager.fill(HIST("clusterCellTimeMean"), std::accumulate(mCellTime.begin(), mCellTime.end(), 0.0f) / mCellTime.size()); + for (std::size_t iCell1 = 0; iCell1 < mCellTime.size() - 1; iCell1++) { + for (std::size_t iCell2 = iCell1 + 1; iCell2 < mCellTime.size(); iCell2++) { + mHistManager.fill(HIST("clusterCellTimeDiff"), mCellTime[iCell1] - mCellTime[iCell2]); + } } ampfraction = maxamp / cluster.energy(); mHistManager.fill(HIST("clusterAmpFractionLeadingCell"), ampfraction); diff --git a/PWGJE/Tasks/emceventselectionqa.cxx b/PWGJE/Tasks/emcEventSelectionQA.cxx similarity index 100% rename from PWGJE/Tasks/emceventselectionqa.cxx rename to PWGJE/Tasks/emcEventSelectionQA.cxx diff --git a/PWGJE/Tasks/emctmmonitor.cxx b/PWGJE/Tasks/emcTmMonitor.cxx similarity index 100% rename from PWGJE/Tasks/emctmmonitor.cxx rename to PWGJE/Tasks/emcTmMonitor.cxx diff --git a/PWGJE/Tasks/emcvertexselectionqa.cxx b/PWGJE/Tasks/emcVertexSelectionQA.cxx similarity index 100% rename from PWGJE/Tasks/emcvertexselectionqa.cxx rename to PWGJE/Tasks/emcVertexSelectionQA.cxx diff --git a/PWGJE/Tasks/fulljetspectrapp.cxx b/PWGJE/Tasks/fullJetSpectraPP.cxx similarity index 100% rename from PWGJE/Tasks/fulljetspectrapp.cxx rename to PWGJE/Tasks/fullJetSpectraPP.cxx diff --git a/PWGJE/Tasks/FullJetTriggerQATask.cxx b/PWGJE/Tasks/fullJetTriggerQATask.cxx similarity index 99% rename from PWGJE/Tasks/FullJetTriggerQATask.cxx rename to PWGJE/Tasks/fullJetTriggerQATask.cxx index 99b76fcedb9..c9a9152381d 100644 --- a/PWGJE/Tasks/FullJetTriggerQATask.cxx +++ b/PWGJE/Tasks/fullJetTriggerQATask.cxx @@ -796,8 +796,8 @@ struct JetTriggerQA { registry.fill(HIST("hJetRMaxPtJetPt"), jet.r() * 1e-2, jetPt, jet.pt()); } } // for jets - } // if maxJet.r() == std::round(f_jetR * 100) - } // for maxJet + } // if maxJet.r() == std::round(f_jetR * 100) + } // for maxJet // Fill counters for events without max jets for (std::size_t ir = 0; ir < foundMaxJet.size(); ir++) { if (!foundMaxJet[ir]) { @@ -819,8 +819,8 @@ struct JetTriggerQA { for (const auto& jet : jets) { registry.fill(HIST("hJetRMaxPtJetPtNoFiducial"), jet.r() * 1e-2, jetPt, jet.pt()); } // for jets - } // if maxJet.r() == std::round(f_jetR * 100) - } // for maxjet no fiducial + } // if maxJet.r() == std::round(f_jetR * 100) + } // for maxjet no fiducial } // process diff --git a/PWGJE/Tasks/gammajettreeproducer.cxx b/PWGJE/Tasks/gammaJetTreeProducer.cxx similarity index 60% rename from PWGJE/Tasks/gammajettreeproducer.cxx rename to PWGJE/Tasks/gammaJetTreeProducer.cxx index 273205ccb7c..e1ffd83887f 100644 --- a/PWGJE/Tasks/gammajettreeproducer.cxx +++ b/PWGJE/Tasks/gammaJetTreeProducer.cxx @@ -9,6 +9,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +// C++ system headers first +#include +#include +#include + +// Framework and other headers after #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" @@ -44,9 +50,10 @@ /// \since 02.08.2024 /// using namespace o2; +using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; -using selectedClusters = o2::soa::Filtered; +using emcClusters = o2::soa::Join; #include "Framework/runDataProcessing.h" @@ -72,12 +79,10 @@ struct GammaJetTreeProducer { trackSelections{"trackSelections", "globalTracks", "set track selections"}; Configurable trackMinPt{"trackMinPt", 0.15, "minimum track pT cut"}; Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"}; - Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; Configurable isoR{"isoR", 0.4, "isolation cone radius"}; - - // cluster cuts - Configurable mClusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; - // Preslice perClusterMatchedTracks = o2::aod::jcluster::clusterId; + Configurable perpConeJetR{"perpConeJetR", 0.4, "perpendicular cone radius used to calculate perp cone rho for jet"}; + Configurable trackMatchingEoverP{"trackMatchingEoverP", 2.0, "closest track is required to have E/p < value"}; + Configurable minClusterETrigger{"minClusterETrigger", 0.0, "minimum cluster energy to trigger"}; int mRunNumber = 0; int eventSelection = -1; @@ -98,14 +103,21 @@ struct GammaJetTreeProducer { // create histograms LOG(info) << "Creating histograms"; - const o2Axis ptAxis{100, 0, 100, "p_{T} (GeV/c)"}; + const o2Axis ptAxis{100, 0, 200, "p_{T} (GeV/c)"}; const o2Axis energyAxis{100, 0, 100, "E (GeV)"}; const o2Axis m02Axis{100, 0, 3, "m02"}; - + const o2Axis etaAxis{100, -1, 1, "#eta"}; + const o2Axis phiAxis{100, 0, 2 * TMath::Pi(), "#phi"}; + const o2Axis occupancyAxis{300, 0, 30000, "occupancy"}; mHistograms.add("clusterE", "Energy of cluster", o2HistType::kTH1F, {energyAxis}); mHistograms.add("trackPt", "pT of track", o2HistType::kTH1F, {ptAxis}); mHistograms.add("chjetPt", "pT of charged jet", o2HistType::kTH1F, {ptAxis}); + mHistograms.add("chjetPtEtaPhi", "pT of charged jet", o2HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); mHistograms.add("chjetpt_vs_constpt", "pT of charged jet vs pT of constituents", o2HistType::kTH2F, {ptAxis, ptAxis}); + + // track QA THnSparse + mHistograms.add("trackPtEtaPhi", "Track QA", o2HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); + mHistograms.add("trackPtEtaOccupancy", "Track QA vs occupancy", o2HistType::kTHnSparseF, {ptAxis, etaAxis, occupancyAxis}); } // --------------------- @@ -123,7 +135,16 @@ struct GammaJetTreeProducer { return true; } - bool isEventAccepted(const auto& collision) + int getStoredColIndex(const auto& collision) + { + int32_t storedColIndex = -1; + if (auto foundCol = collisionMapping.find(collision.globalIndex()); foundCol != collisionMapping.end()) { + storedColIndex = foundCol->second; + } + return storedColIndex; + } + + bool isEventAccepted(const auto& collision, const auto& clusters) { if (collision.posZ() > mVertexCut) { @@ -138,7 +159,14 @@ struct GammaJetTreeProducer { if (!jetderiveddatautilities::eventEMCAL(collision)) { return false; } - return true; + + // Check if event contains a cluster with energy > minClusterETrigger + for (auto cluster : clusters) { + if (cluster.energy() > minClusterETrigger) { + return true; + } + } + return false; } double ch_iso_in_cone(const auto& cluster, aod::JetTracks const& tracks, float radius = 0.4) @@ -156,12 +184,25 @@ struct GammaJetTreeProducer { } return iso; } - double ch_perp_cone_rho(const auto& cluster, aod::JetTracks const& tracks, float radius = 0.4) + + void runTrackQA(const auto& collision, aod::JetTracks const& tracks) + { + for (auto track : tracks) { + if (!isTrackSelected(track)) { + continue; + } + mHistograms.fill(HIST("trackPt"), track.pt()); + mHistograms.fill(HIST("trackPtEtaPhi"), track.pt(), track.eta(), track.phi()); + mHistograms.fill(HIST("trackPtEtaOccupancy"), track.pt(), track.eta(), collision.trackOccupancyInTimeRange()); + } + } + + double ch_perp_cone_rho(const auto& object, aod::JetTracks const& tracks, float radius = 0.4) { double ptSumLeft = 0; double ptSumRight = 0; - double cPhi = TVector2::Phi_0_2pi(cluster.phi()); + double cPhi = TVector2::Phi_0_2pi(object.phi()); // rotate cone left by 90 degrees float cPhiLeft = cPhi - TMath::Pi() / 2; @@ -173,8 +214,8 @@ struct GammaJetTreeProducer { if (!isTrackSelected(track)) { continue; } - dRLeft = jetutilities::deltaR(cluster.eta(), cPhiLeft, track.eta(), track.phi()); - dRRight = jetutilities::deltaR(cluster.eta(), cPhiRight, track.eta(), track.phi()); + dRLeft = jetutilities::deltaR(object.eta(), cPhiLeft, track.eta(), track.phi()); + dRRight = jetutilities::deltaR(object.eta(), cPhiRight, track.eta(), track.phi()); if (dRLeft < radius) { ptSumLeft += track.pt(); @@ -191,25 +232,46 @@ struct GammaJetTreeProducer { // --------------------- // Processing functions // --------------------- + // WARNING: This function always has to run first in the processing chain void processClearMaps(aod::JetCollisions const&) { collisionMapping.clear(); } PROCESS_SWITCH(GammaJetTreeProducer, processClearMaps, "process function that clears all the maps in each dataframe", true); + // WARNING: This function always has to run second in the processing chain + void processEvent(soa::Join::iterator const& collision, emcClusters const& clusters) + { + if (!isEventAccepted(collision, clusters)) { + return; + } + + eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw()); + collisionMapping[collision.globalIndex()] = eventsTable.lastIndex(); + } + PROCESS_SWITCH(GammaJetTreeProducer, processEvent, "Process event", true); + + // --------------------- + // Processing functions can be safely added below this line + // --------------------- + // define cluster filter. It selects only those clusters which are of the type // sadly passing of the string at runtime is not possible for technical region so cluster definition is // an integer instead - Filter clusterDefinitionSelection = (o2::aod::jcluster::definition == mClusterDefinition); + PresliceUnsorted EMCTrackPerTrack = aod::jemctrack::trackId; // Process clusters - void processClusters(soa::Join::iterator const& collision, selectedClusters const& clusters, aod::JetTracks const& tracks) + void processClusters(soa::Join::iterator const& collision, emcClusters const& clusters, aod::JetTracks const& tracks, aod::JEMCTracks const& emctracks) { - if (!isEventAccepted(collision)) { + // event selection + int32_t storedColIndex = getStoredColIndex(collision); + if (storedColIndex == -1) return; - } - eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.alias_raw()); - collisionMapping[collision.globalIndex()] = eventsTable.lastIndex(); + // eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw()); + // collisionMapping[collision.globalIndex()] = eventsTable.lastIndex(); + + // loop over tracks one time for QA + runTrackQA(collision, tracks); // loop over clusters for (auto cluster : clusters) { @@ -226,28 +288,25 @@ struct GammaJetTreeProducer { // double dRMin = 100; double p = -1; - // auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, cluster.globalIndex()); - // for (const auto& match : tracksofcluster) { - // // ask the jtracks table for track with ID trackID - // double dR = deltaR(cluster.eta(), cluster.phi(), match.tracks_as().Eta(), match.tracks_as().Phi()); - // if (dR < dRMin) { - // dRMin = dR; - // dEta = cluster.eta() - match.tracks_as().eta(); - // dPhi = TVector2::Phi_0_2pi(cluster.phi()) - TVector2::Phi_0_2pi(match.tracks_as().phi()); - // if (abs(dPhi) > M_PI) { - // dPhi = 2 * M_PI - abs(dPhi); - // } - // p = match.tracks_as().p(); - // } - // } - - // // for compression reasons make dPhi and dEta 0 if no match is found - // if (p == -1) { - // dPhi = 0; - // dEta = 0; - // } - - gammasTable(eventsTable.lastIndex(), cluster.energy(), cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), cluster.nlm(), isoraw, perpconerho, dPhi, dEta, p); + // do track matching + auto tracksofcluster = cluster.matchedTracks_as(); + for (auto track : tracksofcluster) { + if (!isTrackSelected(track)) { + continue; + } + auto emcTracksPerTrack = emctracks.sliceBy(EMCTrackPerTrack, track.globalIndex()); + auto emcTrack = emcTracksPerTrack.iteratorAt(0); + // find closest track that still has E/p < trackMatchingEoverP + if (cluster.energy() / track.p() > trackMatchingEoverP) { + continue; + } else { + dEta = cluster.eta() - emcTrack.etaEmcal(); + dPhi = RecoDecay::constrainAngle(RecoDecay::constrainAngle(emcTrack.phiEmcal(), -M_PI) - RecoDecay::constrainAngle(cluster.phi(), -M_PI), -M_PI); + p = track.p(); + break; + } + } + gammasTable(storedColIndex, cluster.energy(), cluster.definition(), cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), cluster.nlm(), isoraw, perpconerho, dPhi, dEta, p); } // dummy loop over tracks @@ -257,30 +316,35 @@ struct GammaJetTreeProducer { } PROCESS_SWITCH(GammaJetTreeProducer, processClusters, "Process EMCal clusters", true); - Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); + Filter jetCuts = aod::jet::pt > jetPtMin; // Process charged jets - void processChargedJets(soa::Join::iterator const& collision, soa::Filtered> const& chargedJets, aod::JetTracks const&) + void processChargedJets(soa::Join::iterator const& collision, soa::Filtered> const& chargedJets, aod::JetTracks const& tracks) { // event selection - if (!isEventAccepted(collision)) { + int32_t storedColIndex = getStoredColIndex(collision); + if (storedColIndex == -1) return; - } - + float leadingTrackPt = 0; + ushort nconst = 0; // loop over charged jets for (auto jet : chargedJets) { if (jet.pt() < jetPtMin) continue; - ushort nconst = 0; + nconst = 0; + leadingTrackPt = 0; // loop over constituents for (auto& constituent : jet.template tracks_as()) { mHistograms.fill(HIST("chjetpt_vs_constpt"), jet.pt(), constituent.pt()); nconst++; + if (constituent.pt() > leadingTrackPt) { + leadingTrackPt = constituent.pt(); + } } - int32_t storedColIndex = -1; - if (auto foundCol = collisionMapping.find(collision.globalIndex()); foundCol != collisionMapping.end()) { - storedColIndex = foundCol->second; - } - chargedJetsTable(storedColIndex, jet.pt(), jet.eta(), jet.phi(), jet.energy(), jet.mass(), jet.area(), nconst); + + // calculate perp cone rho + double perpconerho = ch_perp_cone_rho(jet, tracks, perpConeJetR); + mHistograms.fill(HIST("chjetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + chargedJetsTable(storedColIndex, jet.pt(), jet.eta(), jet.phi(), jet.r(), jet.energy(), jet.mass(), jet.area(), leadingTrackPt, perpconerho, nconst); // fill histograms mHistograms.fill(HIST("chjetPt"), jet.pt()); } diff --git a/PWGJE/Tasks/hffragmentationfunction.cxx b/PWGJE/Tasks/hfFragmentationFunction.cxx similarity index 54% rename from PWGJE/Tasks/hffragmentationfunction.cxx rename to PWGJE/Tasks/hfFragmentationFunction.cxx index 812e8bbea9f..49e1e204358 100644 --- a/PWGJE/Tasks/hffragmentationfunction.cxx +++ b/PWGJE/Tasks/hfFragmentationFunction.cxx @@ -15,6 +15,9 @@ /// /// The task store data relevant to the calculation of hadronization observables radial /// profile and/or jet momentum fraction for charmed hadrons +#include +#include + #include "TVector3.h" #include "fastjet/PseudoJet.hh" @@ -41,6 +44,7 @@ #include "PWGJE/Core/JetFinder.h" #include "PWGJE/Core/FastJetUtilities.h" #include "PWGJE/Core/JetHFUtilities.h" +#include "PWGJE/Core/JetUtilities.h" using namespace o2; using namespace o2::framework; @@ -68,6 +72,7 @@ DECLARE_SOA_COLUMN(JetHfDist, jethfdist, float); DECLARE_SOA_COLUMN(JetPt, jetpt, float); DECLARE_SOA_COLUMN(JetEta, jeteta, float); DECLARE_SOA_COLUMN(JetPhi, jetphi, float); +DECLARE_SOA_COLUMN(JetNConst, jetnconst, int); DECLARE_SOA_COLUMN(HfPt, hfpt, float); DECLARE_SOA_COLUMN(HfEta, hfeta, float); DECLARE_SOA_COLUMN(HfPhi, hfphi, float); @@ -75,10 +80,16 @@ DECLARE_SOA_COLUMN(HfMass, hfmass, float); DECLARE_SOA_COLUMN(HfY, hfy, float); DECLARE_SOA_COLUMN(HfPrompt, hfPrompt, bool); DECLARE_SOA_COLUMN(HfMatch, hfmatch, bool); +DECLARE_SOA_COLUMN(HfMlScore0, hfmlscore0, float); +DECLARE_SOA_COLUMN(HfMlScore1, hfmlscore1, float); +DECLARE_SOA_COLUMN(HfMlScore2, hfmlscore2, float); +DECLARE_SOA_COLUMN(HfMatchedFrom, hfmatchedfrom, int); +DECLARE_SOA_COLUMN(HfSelectedAs, hfselectedas, int); DECLARE_SOA_COLUMN(MCJetHfDist, mcjethfdist, float); DECLARE_SOA_COLUMN(MCJetPt, mcjetpt, float); DECLARE_SOA_COLUMN(MCJetEta, mcjeteta, float); DECLARE_SOA_COLUMN(MCJetPhi, mcjetphi, float); +DECLARE_SOA_COLUMN(MCJetNConst, mcjetnconst, float); DECLARE_SOA_COLUMN(MCHfPt, mchfpt, float); DECLARE_SOA_COLUMN(MCHfEta, mchfeta, float); DECLARE_SOA_COLUMN(MCHfPhi, mchfphi, float); @@ -91,16 +102,21 @@ DECLARE_SOA_TABLE(JetDistanceTable, "AOD", "JETDISTTABLE", jet_distance::JetPt, jet_distance::JetEta, jet_distance::JetPhi, + jet_distance::JetNConst, jet_distance::HfPt, jet_distance::HfEta, jet_distance::HfPhi, jet_distance::HfMass, - jet_distance::HfY); + jet_distance::HfY, + jet_distance::HfMlScore0, + jet_distance::HfMlScore1, + jet_distance::HfMlScore2); DECLARE_SOA_TABLE(MCPJetDistanceTable, "AOD", "MCPJETDISTTABLE", jet_distance::MCJetHfDist, jet_distance::MCJetPt, jet_distance::MCJetEta, jet_distance::MCJetPhi, + jet_distance::MCJetNConst, jet_distance::MCHfPt, jet_distance::MCHfEta, jet_distance::MCHfPhi, @@ -112,18 +128,25 @@ DECLARE_SOA_TABLE(MCDJetDistanceTable, "AOD", "MCDJETDISTTABLE", jet_distance::JetPt, jet_distance::JetEta, jet_distance::JetPhi, + jet_distance::JetNConst, jet_distance::HfPt, jet_distance::HfEta, jet_distance::HfPhi, jet_distance::HfMass, jet_distance::HfY, jet_distance::HfPrompt, - jet_distance::HfMatch); + jet_distance::HfMatch, + jet_distance::HfMlScore0, + jet_distance::HfMlScore1, + jet_distance::HfMlScore2, + jet_distance::HfMatchedFrom, + jet_distance::HfSelectedAs); DECLARE_SOA_TABLE(MatchJetDistanceTable, "AOD", "MATCHTABLE", jet_distance::MCJetHfDist, jet_distance::MCJetPt, jet_distance::MCJetEta, jet_distance::MCJetPhi, + jet_distance::MCJetNConst, jet_distance::MCHfPt, jet_distance::MCHfEta, jet_distance::MCHfPhi, @@ -133,12 +156,18 @@ DECLARE_SOA_TABLE(MatchJetDistanceTable, "AOD", "MATCHTABLE", jet_distance::JetPt, jet_distance::JetEta, jet_distance::JetPhi, + jet_distance::JetNConst, jet_distance::HfPt, jet_distance::HfEta, jet_distance::HfPhi, jet_distance::HfMass, jet_distance::HfY, - jet_distance::HfPrompt); + jet_distance::HfPrompt, + jet_distance::HfMlScore0, + jet_distance::HfMlScore1, + jet_distance::HfMlScore2, + jet_distance::HfMatchedFrom, + jet_distance::HfSelectedAs); } // namespace o2::aod struct HfFragmentationFunctionTask { @@ -160,14 +189,33 @@ struct HfFragmentationFunctionTask { // Histogram registry: an object to hold your histograms HistogramRegistry registry{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + + int eventSelection = -1; + void init(InitContext const&) { + // initialise event selection: + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); // create histograms // collision system histograms - registry.add("h_collision_counter", ";# collisions;", {HistType::kTH1F, {{2, 0., 1.}}}); + std::vector histLabels = {"mccollisions", "z_cut", "collisions", "sel8"}; + registry.add("h_collision_counter", ";# of collisions;", HistType::kTH1F, {{static_cast(histLabels.size()), 0.0, static_cast(histLabels.size())}}); + auto counter = registry.get(HIST("h_collision_counter")); + for (std::vector::size_type iCounter = 0; iCounter < histLabels.size(); iCounter++) { + counter->GetXaxis()->SetBinLabel(iCounter + 1, histLabels[iCounter].data()); + } + registry.add("h_jet_counter", ";# of jets;", {HistType::kTH1F, {{6, 0., 3.0}}}); + auto jetCounter = registry.get(HIST("h_jet_counter")); + jetCounter->GetXaxis()->SetBinLabel(1, "particle level"); + jetCounter->GetXaxis()->SetBinLabel(2, "detector level"); + jetCounter->GetXaxis()->SetBinLabel(3, "particle matched jets"); + jetCounter->GetXaxis()->SetBinLabel(4, "detector matched jets"); + jetCounter->GetXaxis()->SetBinLabel(5, "mcd matched to mcp loop"); + jetCounter->GetXaxis()->SetBinLabel(6, "mcp matched to mcd loop"); // D0 candidate histograms from data - registry.add("h_jet_counter", ";# jets;", {HistType::kTH1F, {{2, 0., 1.}}}); registry.add("h_d0_jet_projection", ";z^{D^{0},jet}_{||};dN/dz^{D^{0},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}); registry.add("h_d0_jet_distance_vs_projection", ";#DeltaR_{D^{0},jet};z^{D^{0},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}); registry.add("h_d0_jet_distance", ";#DeltaR_{D^{0},jet};dN/d(#DeltaR)", {HistType::kTH1F, {{1000, 0., 10.}}}); @@ -182,12 +230,16 @@ struct HfFragmentationFunctionTask { void processDummy(aod::TracksIU const&) {} PROCESS_SWITCH(HfFragmentationFunctionTask, processDummy, "Dummy process function turned on by default", true); - void processDataChargedSubstructure(aod::JetCollision const&, + void processDataChargedSubstructure(aod::JetCollision const& collision, soa::Join const& jets, aod::CandidatesD0Data const&) { - - double axisDistance = 0; + // apply event selection and fill histograms for sanity check + registry.fill(HIST("h_collision_counter"), 2.0); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || !(abs(collision.posZ()) < vertexZCut)) { + return; + } + registry.fill(HIST("h_collision_counter"), 3.0); for (auto& jet : jets) { // fill jet counter histogram @@ -199,11 +251,12 @@ struct HfFragmentationFunctionTask { // obtaining jet 3-vector TVector3 d0Vector(d0Candidate.px(), d0Candidate.py(), d0Candidate.pz()); + // calculating fraction of the jet momentum carried by the D0 along the direction of the jet axis double z_parallel = (jetVector * d0Vector) / (jetVector * jetVector); // calculating angular distance in eta-phi plane - axisDistance = RecoDecay::sqrtSumOfSquares(jet.eta() - d0Candidate.eta(), deltaPhi(jet.phi(), d0Candidate.phi())); + double axisDistance = jetutilities::deltaR(jet, d0Candidate); // filling histograms registry.fill(HIST("h_d0_jet_projection"), z_parallel); @@ -218,8 +271,8 @@ struct HfFragmentationFunctionTask { // filling table distJetTable(axisDistance, - jet.pt(), jet.eta(), jet.phi(), - d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), d0Candidate.m(), d0Candidate.y()); + jet.pt(), jet.eta(), jet.phi(), jet.tracks_as().size(), + d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), d0Candidate.m(), d0Candidate.y(), d0Candidate.mlScores()[0], d0Candidate.mlScores()[1], d0Candidate.mlScores()[2]); break; // get out of candidates' loop after first HF particle is found in jet } // end of D0 candidates loop @@ -234,25 +287,65 @@ struct HfFragmentationFunctionTask { JetMCDTable const& mcdjets, JetMCPTable const& mcpjets, aod::CandidatesD0MCD const&, - aod::CandidatesD0MCP const&) + aod::CandidatesD0MCP const&, + aod::JetTracks const&, + aod::JetParticles const&) { for (const auto& mccollision : mccollisions) { + registry.fill(HIST("h_collision_counter"), 0.0); + // skip collisions outside of |z| < vertexZCut + if (abs(mccollision.posZ()) > vertexZCut) { + continue; + } + registry.fill(HIST("h_collision_counter"), 1.0); + // reconstructed collisions associated to same mccollision const auto collisionsPerMCCollision = collisions.sliceBy(CollisionsPerMCCollision, mccollision.globalIndex()); for (const auto& collision : collisionsPerMCCollision) { + + registry.fill(HIST("h_collision_counter"), 2.0); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || !(abs(collision.posZ()) < vertexZCut)) { + continue; + } + registry.fill(HIST("h_collision_counter"), 3.0); + // d0 detector level jets associated to the current same collision const auto d0mcdJetsPerCollision = mcdjets.sliceBy(D0MCDJetsPerCollision, collision.globalIndex()); for (const auto& mcdjet : d0mcdJetsPerCollision) { + registry.fill(HIST("h_jet_counter"), 0.5); + // obtain leading HF candidate in jet auto mcdd0cand = mcdjet.candidates_first_as(); + if (mcdjet.has_matchedJetCand()) { + registry.fill(HIST("h_jet_counter"), 1.5); + } + + // reflection information for storage: D0 = +1, D0bar = -1, neither = 0 + int matchedFrom = 0; + int decayChannel = 1 << aod::hf_cand_2prong::DecayType::D0ToPiK; + int selectedAs = 0; + + if (mcdd0cand.flagMcMatchRec() == decayChannel) { // matched to D0 on truth level + matchedFrom = 1; + } else if (mcdd0cand.flagMcMatchRec() == -decayChannel) { // matched to D0bar on truth level + matchedFrom = -1; + } + // bitwise AND operation: Checks whether BIT(i) is set, regardless of other bits + if (mcdd0cand.candidateSelFlag() & BIT(0)) { // CandidateSelFlag == BIT(0) -> selected as D0 + selectedAs = 1; + } else if (mcdd0cand.candidateSelFlag() & BIT(1)) { // CandidateSelFlag == BIT(1) -> selected as D0bar + selectedAs = -1; + } + // store data in MC detector level table - mcddistJetTable(RecoDecay::sqrtSumOfSquares(mcdjet.eta() - mcdd0cand.eta(), deltaPhi(mcdjet.phi(), mcdd0cand.phi())), - mcdjet.pt(), mcdjet.eta(), mcdjet.phi(), // detector level jet + mcddistJetTable(jetutilities::deltaR(mcdjet, mcdd0cand), + mcdjet.pt(), mcdjet.eta(), mcdjet.phi(), mcdjet.tracks_as().size(), // detector level jet mcdd0cand.pt(), mcdd0cand.eta(), mcdd0cand.phi(), mcdd0cand.m(), mcdd0cand.y(), (mcdd0cand.originMcRec() == RecoDecay::OriginType::Prompt), // detector level D0 candidate - mcdjet.has_matchedJetCand()); + mcdjet.has_matchedJetCand(), mcdd0cand.mlScores()[0], mcdd0cand.mlScores()[1], mcdd0cand.mlScores()[2], // // Machine Learning PID scores: background, prompt, non-prompt + matchedFrom, selectedAs); // D0 = +1, D0bar = -1, neither = 0 } } @@ -260,12 +353,18 @@ struct HfFragmentationFunctionTask { const auto d0mcpJetsPerMCCollision = mcpjets.sliceBy(D0MCPJetsPerMCCollision, mccollision.globalIndex()); for (const auto& mcpjet : d0mcpJetsPerMCCollision) { + registry.fill(HIST("h_jet_counter"), 0.0); + // obtain leading HF particle in jet auto mcpd0cand = mcpjet.candidates_first_as(); + if (mcpjet.has_matchedJetCand()) { + registry.fill(HIST("h_jet_counter"), 1.0); + } + // store data in MC detector level table (calculate angular distance in eta-phi plane on the fly) - mcpdistJetTable(RecoDecay::sqrtSumOfSquares(mcpjet.eta() - mcpd0cand.eta(), deltaPhi(mcpjet.phi(), mcpd0cand.phi())), - mcpjet.pt(), mcpjet.eta(), mcpjet.phi(), // particle level jet + mcpdistJetTable(jetutilities::deltaR(mcpjet, mcpd0cand), + mcpjet.pt(), mcpjet.eta(), mcpjet.phi(), mcpjet.tracks_as().size(), // particle level jet mcpd0cand.pt(), mcpd0cand.eta(), mcpd0cand.phi(), mcpd0cand.y(), (mcpd0cand.originMcGen() == RecoDecay::OriginType::Prompt), // particle level D0 mcpjet.has_matchedJetCand()); } @@ -273,32 +372,82 @@ struct HfFragmentationFunctionTask { } PROCESS_SWITCH(HfFragmentationFunctionTask, processMcEfficiency, "non-matched and matched MC HF and jets", false); - void processMcChargedMatched(aod::JetMcCollision const&, - JetMCDTable const&, - JetMCPTable const& mcpjets, + void processMcChargedMatched(aod::JetMcCollisions const& mccollisions, + aod::JetCollisionsMCD const& collisions, + JetMCDTable const& mcdjets, + JetMCPTable const&, aod::CandidatesD0MCD const&, - aod::CandidatesD0MCP const&) + aod::CandidatesD0MCP const&, + aod::JetTracks const&, + aod::JetParticles const&) { - // fill jet counter histogram - registry.fill(HIST("h_collision_counter"), 0.5); + for (const auto& mccollision : mccollisions) { - // d0 particle level jets associated to same mccollision - for (const auto& mcpjet : mcpjets) { + registry.fill(HIST("h_collision_counter"), 0.0); - // obtain leading HF particle in jet - auto mcpd0cand = mcpjet.candidates_first_as(); + // skip collisions outside of |z| < vertexZCut + if (abs(mccollision.posZ()) > vertexZCut) { + continue; + } + registry.fill(HIST("h_collision_counter"), 1.0); - // loop through detector level matched to current particle level - for (auto& mcdjet : mcpjet.matchedJetCand_as()) { + // reconstructed collisions associated to same mccollision + const auto collisionsPerMCCollision = collisions.sliceBy(CollisionsPerMCCollision, mccollision.globalIndex()); + for (const auto& collision : collisionsPerMCCollision) { - // obtain leading HF candidate in jet - auto mcdd0cand = mcdjet.candidates_first_as(); + registry.fill(HIST("h_collision_counter"), 2.0); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || !(abs(collision.posZ()) < vertexZCut)) { + continue; + } + registry.fill(HIST("h_collision_counter"), 3.0); + // d0 detector level jets associated to the current same collision + const auto d0mcdJetsPerCollision = mcdjets.sliceBy(D0MCDJetsPerCollision, collision.globalIndex()); + for (const auto& mcdjet : d0mcdJetsPerCollision) { + + registry.fill(HIST("h_jet_counter"), 0.5); + + // comparison with fill on bin on 2.5 for sanity check + if (mcdjet.has_matchedJetCand()) { + registry.fill(HIST("h_jet_counter"), 1.5); + } - // store matched particle and detector level data in one single table (calculate angular distance in eta-phi plane on the fly) - matchJetTable(RecoDecay::sqrtSumOfSquares(mcpjet.eta() - mcpd0cand.eta(), deltaPhi(mcpjet.phi(), mcpd0cand.phi())), mcpjet.pt(), mcpjet.eta(), mcpjet.phi(), // particle level jet - mcpd0cand.pt(), mcpd0cand.eta(), mcpd0cand.phi(), mcpd0cand.y(), (mcpd0cand.originMcGen() == RecoDecay::OriginType::Prompt), // particle level D0 - RecoDecay::sqrtSumOfSquares(mcdjet.eta() - mcdd0cand.eta(), deltaPhi(mcdjet.phi(), mcdd0cand.phi())), mcdjet.pt(), mcdjet.eta(), mcdjet.phi(), // detector level jet - mcdd0cand.pt(), mcdd0cand.eta(), mcdd0cand.phi(), mcdd0cand.m(), mcdd0cand.y(), (mcdd0cand.originMcRec() == RecoDecay::OriginType::Prompt)); // detector level D0 + // obtain leading HF candidate in jet + auto mcdd0cand = mcdjet.candidates_first_as(); + + // reflection information for storage: D0 = +1, D0bar = -1, neither = 0 + int matchedFrom = 0; + int decayChannel = 1 << aod::hf_cand_2prong::DecayType::D0ToPiK; + int selectedAs = 0; + + if (mcdd0cand.flagMcMatchRec() == decayChannel) { // matched to D0 on truth level + matchedFrom = 1; + } else if (mcdd0cand.flagMcMatchRec() == -decayChannel) { // matched to D0bar on truth level + matchedFrom = -1; + } + // bitwise AND operation: Checks whether BIT(i) is set, regardless of other bits + if (mcdd0cand.candidateSelFlag() & BIT(0)) { // CandidateSelFlag == BIT(0) -> selected as D0 + selectedAs = 1; + } else if (mcdd0cand.candidateSelFlag() & BIT(1)) { // CandidateSelFlag == BIT(1) -> selected as D0bar + selectedAs = -1; + } + + // loop through detector level matched to current particle level + for (auto& mcpjet : mcdjet.matchedJetCand_as()) { + + registry.fill(HIST("h_jet_counter"), 2.5); + + // obtain leading HF candidate in jet + auto mcpd0cand = mcpjet.candidates_first_as(); + + // store matched particle and detector level data in one single table (calculate angular distance in eta-phi plane on the fly) + matchJetTable(jetutilities::deltaR(mcpjet, mcpd0cand), mcpjet.pt(), mcpjet.eta(), mcpjet.phi(), mcpjet.tracks_as().size(), // particle level jet + mcpd0cand.pt(), mcpd0cand.eta(), mcpd0cand.phi(), mcpd0cand.y(), (mcpd0cand.originMcGen() == RecoDecay::OriginType::Prompt), // particle level D0 + jetutilities::deltaR(mcdjet, mcdd0cand), mcdjet.pt(), mcdjet.eta(), mcdjet.phi(), mcdjet.tracks_as().size(), // detector level jet + mcdd0cand.pt(), mcdd0cand.eta(), mcdd0cand.phi(), mcdd0cand.m(), mcdd0cand.y(), (mcdd0cand.originMcRec() == RecoDecay::OriginType::Prompt), // detector level D0 + mcdd0cand.mlScores()[0], mcdd0cand.mlScores()[1], mcdd0cand.mlScores()[2], // Machine Learning PID scores: background, prompt, non-prompt + matchedFrom, selectedAs); // D0 = +1, D0bar = -1, neither = 0 + } + } } } } diff --git a/PWGJE/Tasks/jetChargedV2.cxx b/PWGJE/Tasks/jetChargedV2.cxx new file mode 100644 index 00000000000..dc62692a2b4 --- /dev/null +++ b/PWGJE/Tasks/jetChargedV2.cxx @@ -0,0 +1,552 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet v2 task +/// \author Yubiao Wang +// C++/ROOT includes. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +// o2Physics includes. + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" + +#include "Framework/runDataProcessing.h" + +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/CCDB/ctpRateFetcher.h" + +//< evt pln .h >// +#include "Framework/ASoAHelpers.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StaticFor.h" + +#include "Common/DataModel/Qvectors.h" +#include "Common/Core/EventPlaneHelper.h" +//< evt pln .h | end >// + +// o2 includes. +#include "DetectorsCommonDataFormats/AlignParam.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/HistogramRegistry.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Core/TrackSelectionDefaults.h" + +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/DataModel/Jet.h" + +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "EventFiltering/filterTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +//=====================< evt pln >=====================// +using MyCollisions = soa::Join; +//=====================< evt pln | end >=====================// + +struct Jetchargedv2Task { + HistogramRegistry registry; + HistogramRegistry histosQA{"histosQA", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + + Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; + + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; + Configurable trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"}; + Configurable trackPtMax{"trackPtMax", 1000., "maximum pT acceptance for tracks"}; + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; + + Configurable jetAreaFractionMin{"jetAreaFractionMin", -99.0, "used to make a cut on the jet areas"}; + Configurable leadingConstituentPtMin{"leadingConstituentPtMin", -99.0, "minimum pT selection on jet constituent"}; + Configurable jetPtMin{"jetPtMin", 0.15, "minimum pT acceptance for jets"}; + Configurable jetPtMax{"jetPtMax", 200.0, "maximum pT acceptance for jets"}; + Configurable jetEtaMin{"jetEtaMin", -0.9, "minimum eta acceptance for jets"}; + Configurable jetEtaMax{"jetEtaMax", 0.9, "maximum eta acceptance for jets"}; + Configurable jetRadius{"jetRadius", 0.2, "jet resolution parameters"}; + + Configurable randomConeR{"randomConeR", 0.4, "size of random Cone for estimating background fluctuations"}; + + //=====================< evt pln >=====================// + Configurable cfgAddEvtSel{"cfgAddEvtSel", true, "event selection"}; + Configurable> cfgnMods{"cfgnMods", {2}, "Modulation of interest"}; + Configurable cfgnTotalSystem{"cfgnTotalSystem", 7, "total qvector number"}; + Configurable cfgDetName{"cfgDetName", "FT0M", "The name of detector to be analyzed"}; + Configurable cfgRefAName{"cfgRefAName", "TPCpos", "The name of detector for reference A"}; + Configurable cfgRefBName{"cfgRefBName", "TPCneg", "The name of detector for reference B"}; + + ConfigurableAxis cfgaxisQvecF{"cfgaxisQvecF", {300, -1, 1}, ""}; + ConfigurableAxis cfgaxisQvec{"cfgaxisQvec", {100, -3, 3}, ""}; + ConfigurableAxis cfgaxisCent{"cfgaxisCent", {90, 0, 90}, ""}; + + EventPlaneHelper helperEP; + int DetId; + int RefAId; + int RefBId; + + template + int GetDetId(const T& name) + { + if (name.value == "BPos" || name.value == "BNeg" || name.value == "BTot") { + LOGF(warning, "Using deprecated label: %s. Please use TPCpos, TPCneg, TPCall instead.", name.value); + } + if (name.value == "FT0C") { + return 0; + } else if (name.value == "FT0A") { + return 1; + } else if (name.value == "FT0M") { + return 2; + } else if (name.value == "FV0A") { + return 3; + } else if (name.value == "TPCpos" || name.value == "BPos") { + return 4; + } else if (name.value == "TPCneg" || name.value == "BNeg") { + return 5; + } else if (name.value == "TPCall" || name.value == "BTot") { + return 6; + } else { + return 0; + } + } + //=====================< evt pln | end >=====================// + + Configurable selectedJetsRadius{"selectedJetsRadius", 0.4, "resolution parameter for histograms without radius"}; + + std::vector jetPtBins; + std::vector jetPtBinsRhoAreaSub; + + int eventSelection = -1; + int trackSelection = -1; + double evtnum = 1; // evt sum for local rho test + + void init(o2::framework::InitContext&) + { + DetId = GetDetId(cfgDetName); + RefAId = GetDetId(cfgRefAName); + RefBId = GetDetId(cfgRefBName); + if (DetId == RefAId || DetId == RefBId || RefAId == RefBId) { + LOGF(info, "Wrong detector configuration \n The FT0C will be used to get Q-Vector \n The TPCpos and TPCneg will be used as reference systems"); + DetId = 0; + RefAId = 4; + RefBId = 5; + } + + auto jetPtTemp = 0.0; + jetPtBins.push_back(jetPtTemp); + jetPtBinsRhoAreaSub.push_back(jetPtTemp); + while (jetPtTemp < jetPtMax) { + if (jetPtTemp < 100.0) { + jetPtTemp += 1.0; + jetPtBins.push_back(jetPtTemp); + jetPtBinsRhoAreaSub.push_back(jetPtTemp); + jetPtBinsRhoAreaSub.push_back(-jetPtTemp); + } else if (jetPtTemp < 200.0) { + jetPtTemp += 5.0; + jetPtBins.push_back(jetPtTemp); + jetPtBinsRhoAreaSub.push_back(jetPtTemp); + jetPtBinsRhoAreaSub.push_back(-jetPtTemp); + + } else { + jetPtTemp += 10.0; + jetPtBins.push_back(jetPtTemp); + jetPtBinsRhoAreaSub.push_back(jetPtTemp); + jetPtBinsRhoAreaSub.push_back(-jetPtTemp); + } + } + std::sort(jetPtBinsRhoAreaSub.begin(), jetPtBinsRhoAreaSub.end()); + + AxisSpec jetPtAxis = {jetPtBins, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec jetPtAxisRhoAreaSub = {jetPtBinsRhoAreaSub, "#it{p}_{T} (GeV/#it{c})"}; + //< bkg sub | end >// + + AxisSpec axisPt = {40, 0.0, 4.0}; + AxisSpec axisEta = {32, -0.8, 0.8}; + AxisSpec axixCent = {20, 0, 100}; + AxisSpec axisChID = {220, 0, 220}; + + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + + //< \sigma p_T at local rho test plot > + registry.add("h_ptsum_collnum", "ptsum collnum;collnum;entries", {HistType::kTH1F, {{40, 0.0, 40}}}); + registry.add("h_ptsum_sumpt", "jet sumpt;sum p_{T};entries", {HistType::kTH1F, {{160, 0., TMath::TwoPi()}}}); + registry.add("h2_phi_track_eta", "phi vs track eta; #eta (GeV/#it{c}); #varphi", {HistType::kTH2F, {{100, -1.0, 1.0}, {160, 0., TMath::TwoPi()}}}); + registry.add("h2_phi_track_pt", "phi vs track pT; #it{p}_{T,track} (GeV/#it{c}); #varphi", {HistType::kTH2F, {{200, 0., 200.}, {160, 0., TMath::TwoPi()}}}); + registry.add("h2_centrality_phi_w_pt", "centrality vs jet #varphi; centrality; entries", {HistType::kTH2F, {{100, 0.0, 100.0}, {160, 0., TMath::TwoPi()}}}); + registry.add("h2_evtnum_phi_w_pt", "eventNumber vs jet #varphi; #eventNumber; entries", {HistType::kTH2F, {{100000, 0.0, 100000}, {160, 0., TMath::TwoPi()}}}); + + //< \sigma p_T at local rho test plot | end > + + registry.add("h2_centrality_collisions", "centrality vs collisions; centrality; collisions", {HistType::kTH2F, {{1200, -10.0, 110.0}, {4, 0.0, 4.0}}}); + registry.add("h2_centrality_track_pt", "centrality vs track pT; centrality; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{1200, -10.0, 110.0}, {200, 0., 200.}}}); + registry.add("h2_centrality_track_eta", "centrality vs track #eta; centrality; #eta_{track}", {HistType::kTH2F, {{1200, -10.0, 110.0}, {100, -1.0, 1.0}}}); + registry.add("h2_centrality_track_phi", "centrality vs track #varphi; centrality; #varphi_{track}", {HistType::kTH2F, {{1200, -10.0, 110.0}, {160, -1.0, 7.}}}); + + registry.add("h_jet_pt_rhoareasubtracted", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + + registry.add("h_recoil_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_recoil_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_recoil_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}); + registry.add("h_recoil_jet_dphi", "hadron-jet #Delta#phi;#Delta#phi_{jet,trigger hadron};entries", {HistType::kTH1F, {{40, -2.0, 2.0}}}); + + registry.add("leadJetPt", "leadJet Pt ", {HistType::kTH1F, {{200, 0., 200.0}}}); + registry.add("leadJetPhi", "leadJet constituent #phi ", {HistType::kTH1F, {{80, -1.0, 7.}}}); + registry.add("leadJetEta", "leadJet constituent #eta ", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + + //< RC test plots >// + registry.add("h3_centrality_RCpt_RandomCornPhi_rhorandomcone", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{120, -10.0, 110.0}, {800, -400.0, 400.0}, {160, 0., TMath::TwoPi()}}}); + registry.add("h3_centrality_RCpt_RandomCornPhi_rhorandomconewithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{120, -10.0, 110.0}, {800, -400.0, 400.0}, {160, 0., TMath::TwoPi()}}}); + //< bkg sub plot | end >// + + registry.add("h_jet_pt_in_out_plane_v2", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_in_plane_v2", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_out_of_plane_v2", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_in_plane_v3", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_out_of_plane_v3", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + + registry.add("h2_centrality_jet_pt_in_plane_v2", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_out_of_plane_v2", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_in_plane_v3", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_out_of_plane_v3", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + //< bkg sub DeltaPhi plot | end >// + + //=====================< evt pln plot >=====================// + AxisSpec axisCent{cfgaxisCent, "centrality"}; + AxisSpec axisQvec{cfgaxisQvec, "Q"}; + AxisSpec axisQvecF{cfgaxisQvecF, "Q"}; + + AxisSpec axisEvtPl{360, -constants::math::PI, constants::math::PI}; + + histosQA.add("histCent", "Centrality TrkProcess", HistType::kTH1F, {axisCent}); + histosQA.add("histCentTrkProcess_aftersel", "Centrality TrkProcess aft_sel", HistType::kTH1F, {axisCent}); + + for (uint i = 0; i < cfgnMods->size(); i++) { + histosQA.add(Form("histQvecUncorV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); + histosQA.add(Form("histQvecRectrV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); + histosQA.add(Form("histQvecTwistV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); + histosQA.add(Form("histQvecFinalV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvec, axisQvec, axisCent}}); + + histosQA.add(Form("histEvtPlUncorV%d", cfgnMods->at(i)), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + histosQA.add(Form("histEvtPlRectrV%d", cfgnMods->at(i)), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + histosQA.add(Form("histEvtPlTwistV%d", cfgnMods->at(i)), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + histosQA.add(Form("histEvtPlFinalV%d", cfgnMods->at(i)), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + } + //=====================< evt pln plot | end >=====================// + } + + Preslice JetsPerJCollision = aod::jet::collisionId; + Preslice tracksPerJCollision = o2::aod::jtrack::collisionId; + + Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + + template + bool isAcceptedJet(U const& jet) + { + if (jetAreaFractionMin > -98.0) { + if (jet.area() < jetAreaFractionMin * M_PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { + return false; + } + } + if (leadingConstituentPtMin > -98.0) { + bool isMinleadingConstituent = false; + for (auto& constituent : jet.template tracks_as()) { + if (constituent.pt() >= leadingConstituentPtMin) { + isMinleadingConstituent = true; + break; + } + } + if (!isMinleadingConstituent) { + return false; + } + } + return true; + } + + void fillLeadingJetQA(double leadingJetPt, double leadingJetPhi, double leadingJetEta) + { + registry.fill(HIST("leadJetPt"), leadingJetPt); + registry.fill(HIST("leadJetPhi"), leadingJetPhi); + registry.fill(HIST("leadJetEta"), leadingJetEta); + } // end of fillLeadingJetQA template + + void processjetQA(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + aod::JetTracks const& tracks) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + double leadingTrackpT = 0.0; + double leadingTrackPhi = 0.0; + for (auto const& track : tracks) { + if (track.pt() > 6.0 && track.pt() < 10.0) { + if (track.pt() > leadingTrackpT) { + leadingTrackpT = track.pt(); + leadingTrackPhi = track.phi(); + } + } + } + if (leadingTrackpT == 0.0) + return; + for (auto& jet : jets) { + if (TMath::Abs(RecoDecay::constrainAngle(RecoDecay::constrainAngle(jet.phi(), -o2::constants::math::PIHalf) - RecoDecay::constrainAngle(leadingTrackPhi, -o2::constants::math::PIHalf), -o2::constants::math::PIHalf) > 0.6)) { + registry.fill(HIST("h_recoil_jet_pt"), jet.pt()); + registry.fill(HIST("h_recoil_jet_eta"), jet.eta()); + registry.fill(HIST("h_recoil_jet_phi"), jet.phi()); + registry.fill(HIST("h_recoil_jet_dphi"), jet.phi() - leadingTrackPhi); + } + } + } + PROCESS_SWITCH(Jetchargedv2Task, processjetQA, "jet rho v2 jet QA", true); + + void processInOutJetV2(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + aod::JetTracks const&) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + + //=====================< evt pln [n=2->\Psi_2, n=3->\Psi_3] >=====================// + histosQA.fill(HIST("histCent"), collision.cent()); + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int DetInd = DetId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + if (nmode == 2) { + if (collision.qvecAmp()[DetId] > 1e-8) { + histosQA.fill(HIST("histQvecUncorV2"), collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], collision.cent()); + histosQA.fill(HIST("histQvecRectrV2"), collision.qvecRe()[DetInd + 1], collision.qvecIm()[DetInd + 1], collision.cent()); + histosQA.fill(HIST("histQvecTwistV2"), collision.qvecRe()[DetInd + 2], collision.qvecIm()[DetInd + 2], collision.cent()); + histosQA.fill(HIST("histQvecFinalV2"), collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], collision.cent()); + + histosQA.fill(HIST("histEvtPlUncorV2"), helperEP.GetEventPlane(collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlRectrV2"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 1], collision.qvecIm()[DetInd + 1], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlTwistV2"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 2], collision.qvecIm()[DetInd + 2], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlFinalV2"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], nmode), collision.cent()); + } + } else if (nmode == 3) { + histosQA.fill(HIST("histQvecUncorV3"), collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], collision.cent()); + histosQA.fill(HIST("histQvecRectrV3"), collision.qvecRe()[DetInd + 1], collision.qvecIm()[DetInd + 1], collision.cent()); + histosQA.fill(HIST("histQvecTwistV3"), collision.qvecRe()[DetInd + 2], collision.qvecIm()[DetInd + 2], collision.cent()); + histosQA.fill(HIST("histQvecFinalV3"), collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], collision.cent()); + + histosQA.fill(HIST("histEvtPlUncorV3"), helperEP.GetEventPlane(collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlRectrV3"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 1], collision.qvecIm()[DetInd + 1], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlTwistV3"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 2], collision.qvecIm()[DetInd + 2], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlFinalV3"), helperEP.GetEventPlane(collision.qvecRe()[DetInd + 3], collision.qvecIm()[DetInd + 3], nmode), collision.cent()); + } + + if (nmode == 2) { + Double_t phiMinusPsi2; + if (collision.qvecAmp()[DetId] < 1e-8) { + continue; + } + float evtPl2 = helperEP.GetEventPlane(collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], nmode); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + registry.fill(HIST("h_jet_pt_rhoareasubtracted"), jet.pt() - (collision.rho() * jet.area()), 1); + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h_jet_pt_in_out_plane_v2"), jet.pt() - (collision.rho() * jet.area()), 1.0); + } + phiMinusPsi2 = jet.phi() - evtPl2; + + if ((phiMinusPsi2 < TMath::Pi() / 4) || (phiMinusPsi2 >= 7 * TMath::Pi() / 4) || (phiMinusPsi2 >= 3 * TMath::Pi() / 4 && phiMinusPsi2 < 5 * TMath::Pi() / 4)) { + registry.fill(HIST("h_jet_pt_in_plane_v2"), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + } else { + registry.fill(HIST("h_jet_pt_out_of_plane_v2"), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + } + } + //< JetPtCorr = Jet_pT-*A in-plane and out-of-plane | end >// + } else if (nmode == 3) { + Double_t phiMinusPsi3; + float evtPl3 = helperEP.GetEventPlane(collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], nmode); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + phiMinusPsi3 = jet.phi() - evtPl3; + + if ((phiMinusPsi3 < TMath::Pi() / 4) || (phiMinusPsi3 >= 7 * TMath::Pi() / 4) || (phiMinusPsi3 >= 3 * TMath::Pi() / 4 && phiMinusPsi3 < 5 * TMath::Pi() / 4)) { + registry.fill(HIST("h_jet_pt_in_plane_v3"), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_in_plane_v3"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + } else { + registry.fill(HIST("h_jet_pt_out_of_plane_v3"), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v3"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + } + } + } + } + } + PROCESS_SWITCH(Jetchargedv2Task, processInOutJetV2, "Jet V2 in and out of plane", true); + + void processSigmaPt(soa::Filtered> const& collisions, + soa::Join const& jets, + aod::JetTracks const& tracks) + { + for (const auto& collision : collisions) { + double leadingJetPt = -1; + double leadingJetPhi = -1; + double leadingJetEta = -1; + for (auto& jet : jets) { + if (jet.pt() > leadingJetPt) { + leadingJetPt = jet.pt(); + leadingJetEta = jet.eta(); + leadingJetPhi = jet.phi(); + } + } + fillLeadingJetQA(leadingJetPt, leadingJetPhi, leadingJetEta); + + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + auto collTracks = tracks.sliceBy(tracksPerJCollision, collision.globalIndex()); + + if (jets.size() > 0) { + for (auto const& track : collTracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection) && (fabs(track.eta() - leadingJetEta) > jetRadius)) { + registry.fill(HIST("h2_phi_track_pt"), track.pt(), track.phi()); + registry.fill(HIST("h2_phi_track_eta"), track.eta(), track.phi()); + registry.fill(HIST("h_ptsum_sumpt"), track.phi(), track.pt()); // \sigma p_T distribution test [ && track.pt() >= 0.2 && track.pt() <= 5.] + registry.fill(HIST("h2_centrality_phi_w_pt"), collision.centrality(), track.phi(), track.pt()); // \sigma track.pt() distribution with centrality test + registry.fill(HIST("h2_evtnum_phi_w_pt"), evtnum, track.phi(), track.pt()); + } + } + } + registry.fill(HIST("h_ptsum_collnum"), 0.5); + evtnum += 1; + } + } + PROCESS_SWITCH(Jetchargedv2Task, processSigmaPt, "Sigma pT and bkg as fcn of phi", true); + + void processRandomConeDataV2(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + soa::Filtered const& tracks) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + + for (uint i = 0; i < cfgnMods->size(); i++) { + TRandom3 randomNumber(0); + float randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); + float randomConePhi = randomNumber.Uniform(0.0, 2 * M_PI); + float randomConePt = 0; + + int nmode = cfgnMods->at(i); + int DetInd = DetId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + + Double_t RcPhiPsi2; + float evtPl2 = helperEP.GetEventPlane(collision.qvecRe()[DetInd], collision.qvecIm()[DetInd], nmode); + RcPhiPsi2 = randomConePhi - evtPl2; + + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { + float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-M_PI)); + float dEta = track.eta() - randomConeEta; + if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + randomConePt += track.pt(); + } + } + } + registry.fill(HIST("h3_centrality_RCpt_RandomCornPhi_rhorandomcone"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho(), RcPhiPsi2, 1.0); + // removing the leading jet from the random cone + if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet + float dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-M_PI)); + float dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; + + bool jetWasInCone = false; + while (TMath::Sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt(0).r() / 100.0 + randomConeR) { + jetWasInCone = true; + randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); + randomConePhi = randomNumber.Uniform(0.0, 2 * M_PI); + dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-M_PI)); + dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; + } + if (jetWasInCone) { + randomConePt = 0.0; + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { // if track selection is uniformTrack, dcaXY and dcaZ cuts need to be added as they aren't in the selection so that they can be studied here + float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-M_PI)); + float dEta = track.eta() - randomConeEta; + if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + randomConePt += track.pt(); + } + } + } + } + } + registry.fill(HIST("h3_centrality_RCpt_RandomCornPhi_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho(), RcPhiPsi2, 1.0); + } + } + PROCESS_SWITCH(Jetchargedv2Task, processRandomConeDataV2, "QA for random cone estimation of background fluctuations in data", true); + + void processTracksQA(soa::Filtered>::iterator const& collision, + soa::Filtered const& tracks) + { + // histosQA.fill(HIST("histCentTrkProcess"), collision.centrality()); + registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + histosQA.fill(HIST("histCentTrkProcess_aftersel"), collision.centrality()); + registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 1.5); + + for (auto const& track : tracks) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + registry.fill(HIST("h2_centrality_track_pt"), collision.centrality(), track.pt()); + registry.fill(HIST("h2_centrality_track_eta"), collision.centrality(), track.eta()); + registry.fill(HIST("h2_centrality_track_phi"), collision.centrality(), track.phi()); + } + } + PROCESS_SWITCH(Jetchargedv2Task, processTracksQA, "QA for charged tracks", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-charged-v2"})}; +} diff --git a/PWGJE/Tasks/jetFinderBplusQA.cxx b/PWGJE/Tasks/jetFinderBplusQA.cxx new file mode 100644 index 00000000000..4b7c42b4580 --- /dev/null +++ b/PWGJE/Tasks/jetFinderBplusQA.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet finder B+ charged QA task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetFinderHFQA.cxx" + +using JetFinderBplusQATask = JetFinderHFQATask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-finder-charged-bplus-qa"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetFinderD0QA.cxx b/PWGJE/Tasks/jetFinderD0QA.cxx new file mode 100644 index 00000000000..2db58308d87 --- /dev/null +++ b/PWGJE/Tasks/jetFinderD0QA.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet finder D0 charged QA task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetFinderHFQA.cxx" + +using JetFinderD0QATask = JetFinderHFQATask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-finder-charged-d0-qa"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetFinderDielectronQA.cxx b/PWGJE/Tasks/jetFinderDielectronQA.cxx new file mode 100644 index 00000000000..516f4501a7b --- /dev/null +++ b/PWGJE/Tasks/jetFinderDielectronQA.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet finder Dielectron charged QA task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetFinderHFQA.cxx" + +using JetFinderDielectronQATask = JetFinderHFQATask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-finder-charged-dielectron-qa"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetfinderfullQA.cxx b/PWGJE/Tasks/jetFinderFullQA.cxx similarity index 100% rename from PWGJE/Tasks/jetfinderfullQA.cxx rename to PWGJE/Tasks/jetFinderFullQA.cxx diff --git a/PWGJE/Tasks/jetfinderhfQA.cxx b/PWGJE/Tasks/jetFinderHFQA.cxx similarity index 96% rename from PWGJE/Tasks/jetfinderhfQA.cxx rename to PWGJE/Tasks/jetFinderHFQA.cxx index 9ac052bdebe..36cf4d149d8 100644 --- a/PWGJE/Tasks/jetfinderhfQA.cxx +++ b/PWGJE/Tasks/jetFinderHFQA.cxx @@ -480,7 +480,6 @@ struct JetFinderHFQATask { using JetTableMCPMatchedWeightedJoined = soa::Join; Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta > trackEtaMin && aod::jtracksub::eta < trackEtaMax); Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); // Filter candidateCutsD0 = (aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar); @@ -1556,31 +1555,3 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processCandidates, "HF candidate QA", false); }; - -using JetFinderD0QATask = JetFinderHFQATask; -using JetFinderLcQATask = JetFinderHFQATask; -// using JetFinderBplusQATask = JetFinderHFQATask; -using JetFinderDielectronQATask = JetFinderHFQATask; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-finder-charged-d0-qa"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-finder-charged-lc-qa"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-finder-charged-dielectron-qa"})); - - // tasks.emplace_back(adaptAnalysisTask(cfgc, - // SetDefaultProcesses{}, - // TaskName{"jet-finder-charged-bplus-qa"})); - - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/Tasks/jetFinderLcQA.cxx b/PWGJE/Tasks/jetFinderLcQA.cxx new file mode 100644 index 00000000000..311086c86c8 --- /dev/null +++ b/PWGJE/Tasks/jetFinderLcQA.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet finder Lc charged QA task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetFinderHFQA.cxx" + +using JetFinderLcQATask = JetFinderHFQATask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-finder-charged-lc-qa"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetfinderQA.cxx b/PWGJE/Tasks/jetFinderQA.cxx similarity index 99% rename from PWGJE/Tasks/jetfinderQA.cxx rename to PWGJE/Tasks/jetFinderQA.cxx index efb303fbea8..67806db1115 100644 --- a/PWGJE/Tasks/jetfinderQA.cxx +++ b/PWGJE/Tasks/jetFinderQA.cxx @@ -326,7 +326,6 @@ struct JetFinderQATask { } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta > trackEtaMin && aod::jtracksub::eta < trackEtaMax); Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); PresliceUnsorted> CollisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; diff --git a/PWGJE/Tasks/jetfinderv0QA.cxx b/PWGJE/Tasks/jetFinderV0QA.cxx similarity index 99% rename from PWGJE/Tasks/jetfinderv0QA.cxx rename to PWGJE/Tasks/jetFinderV0QA.cxx index b901db5d61d..362239cf8e1 100644 --- a/PWGJE/Tasks/jetfinderv0QA.cxx +++ b/PWGJE/Tasks/jetFinderV0QA.cxx @@ -164,7 +164,6 @@ struct JetFinderV0QATask { using JetTableMCPMatchedWeightedJoined = soa::Join; Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta > trackEtaMin && aod::jtracksub::eta < trackEtaMax); Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); template diff --git a/PWGJE/Tasks/jetfragmentation.cxx b/PWGJE/Tasks/jetFragmentation.cxx similarity index 100% rename from PWGJE/Tasks/jetfragmentation.cxx rename to PWGJE/Tasks/jetFragmentation.cxx diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 65da4f3ded7..b6cb7d9ee6d 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -8,12 +8,13 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - -// h+jet analysis task // -// Authors: Daniel Jones +/// \file jetHadronRecoil.cxx +/// \brief Task for analysing hadron triggered events. +/// \author Daniel Jones #include +#include #include "TRandom3.h" @@ -44,26 +45,27 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct hJetAnalysis { +struct JetHadronRecoil { - Configurable eventSelections{"eventSelection", "sel8", "choose event selection"}; - Configurable trackSelections{"trackSelection", "globalTracks", "set track selections"}; + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; Configurable trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"}; Configurable trackPtMax{"trackPtMax", 100.0, "maximum pT acceptance for tracks"}; Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; - Configurable pt_TTref_min{"pt_TTref_min", 5, "reference minimum trigger track pt"}; - Configurable pt_TTref_max{"pt_TTref_max", 7, "reference maximum trigger track pt"}; - Configurable pt_TTsig_min{"pt_TTsig_min", 20, "signal minimum trigger track pt"}; - Configurable pt_TTsig_max{"pt_TTsig_max", 50, "signal maximum trigger track pt"}; - Configurable frac_sig{"frac_sig", 0.5, "fraction of events to use for signal"}; + Configurable ptTTrefMin{"ptTTrefMin", 5, "reference minimum trigger track pt"}; + Configurable ptTTrefMax{"ptTTrefMax", 7, "reference maximum trigger track pt"}; + Configurable ptTTsigMin{"ptTTsigMin", 20, "signal minimum trigger track pt"}; + Configurable ptTTsigMax{"ptTTsigMax", 50, "signal maximum trigger track pt"}; + Configurable fracSig{"fracSig", 0.5, "fraction of events to use for signal"}; Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; + Configurable triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; - Preslice> PartJetsPerCollision = aod::jet::mcCollisionId; + Preslice> partJetsPerCollision = aod::jet::mcCollisionId; TRandom3* rand = new TRandom3(0); @@ -77,18 +79,18 @@ struct hJetAnalysis { {"hPtTrack", "Track p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}}, {"hEtaTrack", "Track #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"hPhiTrack", "Track #phi;#phi;entries", {HistType::kTH1F, {{160, -1.0, 7.0}}}}, - {"hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, 2 * o2::constants::math::PI}, {150, 0, 150}}}}, - {"hSignalPtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, 2 * o2::constants::math::PI}, {150, 0, 150}}}}, + {"hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {150, 0, 150}}}}, + {"hSignalPtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {150, 0, 150}}}}, {"hReferencePt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{150, 0, 150}}}}, {"hSignalPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{150, 0, 150}}}}, - {"hSignalLeadingTrack", "leading track p_{T};p_{T,jet};#Delta#phi;leading track p_{T}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, 2 * o2::constants::math::PI}, {150, 0, 150}}}}, - {"hReferenceLeadingTrack", "leading track p_{T};p_{T,jet};#Delta#phi;leading track p_{T}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, 2 * o2::constants::math::PI}, {150, 0, 150}}}}, + {"hSignalLeadingTrack", "leading track p_{T};p_{T,jet};#Delta#phi;leading track p_{T}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, o2::constants::math::TwoPI}, {150, 0, 150}}}}, + {"hReferenceLeadingTrack", "leading track p_{T};p_{T,jet};#Delta#phi;leading track p_{T}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, o2::constants::math::TwoPI}, {150, 0, 150}}}}, {"hJetSignalMultiplicity", "jet multiplicity;N_{jets};entries", {HistType::kTH1F, {{10, 0, 10}}}}, {"hJetReferenceMultiplicity", "jet multiplicity;N_{jets};entries", {HistType::kTH1F, {{10, 0, 10}}}}, - {"hJetSignalConstituentMultiplicity", "jet constituent multiplicity;p_{T,jet};#Delta#phi;N_{constituents}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, 2 * o2::constants::math::PI}, {50, 0, 50}}}}, - {"hJetReferenceConstituentMultiplicity", "jet constituent multiplicity;p_{T,jet};#Delta#phi;N_{constituents}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, 2 * o2::constants::math::PI}, {50, 0, 50}}}}, - {"hJetSignalConstituentPt", "jet constituent p_{T};p_{T,jet};#Delta#phi;p_{T,constituent}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, 2 * o2::constants::math::PI}, {150, 0, 150}}}}, - {"hJetReferenceConstituentPt", "jet constituent p_{T};p_{T,jet};#Delta#phi;p_{T,constituent}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, 2 * o2::constants::math::PI}, {150, 0, 150}}}}, + {"hJetSignalConstituentMultiplicity", "jet constituent multiplicity;p_{T,jet};#Delta#phi;N_{constituents}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, o2::constants::math::TwoPI}, {50, 0, 50}}}}, + {"hJetReferenceConstituentMultiplicity", "jet constituent multiplicity;p_{T,jet};#Delta#phi;N_{constituents}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, o2::constants::math::TwoPI}, {50, 0, 50}}}}, + {"hJetSignalConstituentPt", "jet constituent p_{T};p_{T,jet};#Delta#phi;p_{T,constituent}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, o2::constants::math::TwoPI}, {150, 0, 150}}}}, + {"hJetReferenceConstituentPt", "jet constituent p_{T};p_{T,jet};#Delta#phi;p_{T,constituent}", {HistType::kTH3F, {{150, 0, 150}, {100, 0, o2::constants::math::TwoPI}, {150, 0, 150}}}}, {"hSigEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}}, {"hRefEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}}, {"hJetPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{200, 0, 200}}}}, @@ -105,17 +107,19 @@ struct hJetAnalysis { {"hDeltaRSignalPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {{50, 0.0, 0.15}}}}, {"hDeltaRpTSignal", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{200, 0, 200}, {50, 0.0, 0.15}}}}, {"hDeltaRpTSignalPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{200, 0, 200}, {50, 0.0, 0.15}}}}, - {"hDeltaRpTDPhiSignal", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{200, 0, 200}, {100, 0, 2 * o2::constants::math::PI}, {50, 0.0, 0.15}}}}, - {"hDeltaRpTDPhiSignalPart", "Particle jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{200, 0, 200}, {100, 0, 2 * o2::constants::math::PI}, {50, 0.0, 0.15}}}}, + {"hDeltaRpTDPhiSignal", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{200, 0, 200}, {100, 0, o2::constants::math::TwoPI}, {50, 0.0, 0.15}}}}, + {"hDeltaRpTDPhiSignalPart", "Particle jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{200, 0, 200}, {100, 0, o2::constants::math::TwoPI}, {50, 0.0, 0.15}}}}, {"hDeltaRReference", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {{50, 0.0, 0.15}}}}, {"hDeltaRPartReference", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {{50, 0.0, 0.15}}}}, {"hDeltaRpTReference", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{200, 0, 200}, {50, 0.0, 0.15}}}}, {"hDeltaRpTPartReference", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{200, 0, 200}, {50, 0.0, 0.15}}}}, - {"hDeltaRpTDPhiReference", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{200, 0, 200}, {100, 0, 2 * o2::constants::math::PI}, {50, 0.0, 0.15}}}}, - {"hDeltaRpTDPhiReferencePart", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{200, 0, 200}, {100, 0, 2 * o2::constants::math::PI}, {50, 0.0, 0.15}}}}, + {"hDeltaRpTDPhiReference", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{200, 0, 200}, {100, 0, o2::constants::math::TwoPI}, {50, 0.0, 0.15}}}}, + {"hDeltaRpTDPhiReferencePart", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{200, 0, 200}, {100, 0, o2::constants::math::TwoPI}, {50, 0.0, 0.15}}}}, {"hPtMatched", "p_{T} matching;p_{T,det};p_{T,part}", {HistType::kTH2F, {{200, 0, 200}, {200, 0, 200}}}}, {"hPhiMatched", "#phi matching;#phi_{det};#phi_{part}", {HistType::kTH2F, {{160, -1.0, 7.0}, {160, -1.0, 7.0}}}}, {"hDeltaRMatched", "#DeltaR matching;#DeltaR_{det};#DeltaR_{part}", {HistType::kTH2F, {{50, 0.0, 0.15}, {50, 0.0, 0.15}}}}, + {"hPtMatched1d", "p_{T} matching 1d;p_{T,part}", {HistType::kTH1F, {{200, 0, 200}}}}, + {"hDeltaRMatched1d", "#DeltaR matching 1d;#DeltaR_{part}", {HistType::kTH1F, {{50, 0.0, 0.15}}}}, {"hPtResolution", "p_{T} resolution;p_{T,part};Relative Resolution", {HistType::kTH2F, {{200, 0, 200}, {1000, -5.0, 5.0}}}}, {"hPhiResolution", "#phi resolution;#p{T,part};Resolution", {HistType::kTH2F, {{200, 0, 200}, {1000, -7.0, 7.0}}}}, {"hDeltaRResolution", "#DeltaR Resolution;p_{T,part};Resolution", {HistType::kTH2F, {{200, 0, 200}, {1000, -0.15, 0.15}}}}, @@ -123,6 +127,7 @@ struct hJetAnalysis { int eventSelection = -1; int trackSelection = -1; + std::vector triggerMaskBits; Service pdg; @@ -130,6 +135,7 @@ struct hJetAnalysis { { eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); Filter jetCuts = aod::jet::r == nround(jetR.node() * 100.0f); Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); @@ -139,70 +145,70 @@ struct hJetAnalysis { template void fillHistograms(T const& jets, W const& /*jetsWTA*/, U const& tracks, float weight = 1.0) { - bool is_sig_col; - std::vector phi_TT_ar; - double phi_TT = 0; - int trig_number = 0; - int n_TT = 0; + bool isSigCol; + std::vector phiTTAr; + double phiTT = 0; + int trigNumber = 0; + int nTT = 0; double leadingPT = 0; float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); float dice = rand->Rndm(); - if (dice < frac_sig) - is_sig_col = true; + if (dice < fracSig) + isSigCol = true; else - is_sig_col = false; + isSigCol = false; - for (auto& track : tracks) { + for (const auto& track : tracks) { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - if (is_sig_col && track.pt() < pt_TTsig_max && track.pt() > pt_TTsig_min) { - phi_TT_ar.push_back(track.phi()); - n_TT++; + if (isSigCol && track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { + phiTTAr.push_back(track.phi()); + nTT++; } - if (!is_sig_col && track.pt() < pt_TTref_max && track.pt() > pt_TTref_min) { - phi_TT_ar.push_back(track.phi()); - n_TT++; + if (!isSigCol && track.pt() < ptTTrefMax && track.pt() > ptTTrefMin) { + phiTTAr.push_back(track.phi()); + nTT++; } registry.fill(HIST("hPtTrack"), track.pt(), weight); registry.fill(HIST("hEtaTrack"), track.eta(), weight); registry.fill(HIST("hPhiTrack"), track.phi(), weight); } - if (n_TT > 0) { - trig_number = rand->Integer(n_TT); - phi_TT = phi_TT_ar[trig_number]; - if (is_sig_col) { + if (nTT > 0) { + trigNumber = rand->Integer(nTT); + phiTT = phiTTAr[trigNumber]; + if (isSigCol) { registry.fill(HIST("hNtrig"), 1.5, weight); registry.fill(HIST("hJetSignalMultiplicity"), jets.size(), weight); - registry.fill(HIST("hSigEventTriggers"), n_TT, weight); + registry.fill(HIST("hSigEventTriggers"), nTT, weight); } - if (!is_sig_col) { + if (!isSigCol) { registry.fill(HIST("hNtrig"), 0.5, weight); registry.fill(HIST("hJetReferenceMultiplicity"), jets.size(), weight); - registry.fill(HIST("hRefEventTriggers"), n_TT, weight); + registry.fill(HIST("hRefEventTriggers"), nTT, weight); } } - for (auto& jet : jets) { + for (const auto& jet : jets) { if (jet.pt() > pTHatMaxMCD * pTHat) { continue; } registry.fill(HIST("hJetPt"), jet.pt(), weight); registry.fill(HIST("hJetEta"), jet.eta(), weight); registry.fill(HIST("hJetPhi"), jet.phi(), weight); - for (auto& jetWTA : jet.template matchedJetGeo_as>()) { + for (const auto& jetWTA : jet.template matchedJetGeo_as>()) { double deltaPhi = RecoDecay::constrainAngle(jetWTA.phi() - jet.phi(), -o2::constants::math::PI); double deltaEta = jetWTA.eta() - jet.eta(); double dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaEta); registry.fill(HIST("hDeltaR"), dR, weight); registry.fill(HIST("hDeltaRpT"), jet.pt(), dR, weight); } - if (n_TT > 0) { - float dphi = RecoDecay::constrainAngle(jet.phi() - phi_TT); - if (is_sig_col) { - for (auto& jetWTA : jet.template matchedJetGeo_as>()) { + if (nTT > 0) { + float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT); + if (isSigCol) { + for (const auto& jetWTA : jet.template matchedJetGeo_as>()) { double deltaPhi = RecoDecay::constrainAngle(jetWTA.phi() - jet.phi(), -o2::constants::math::PI); double deltaEta = jetWTA.eta() - jet.eta(); double dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaEta); @@ -217,7 +223,7 @@ struct hJetAnalysis { registry.fill(HIST("hSignalPt"), jet.pt(), weight); } registry.fill(HIST("hJetSignalConstituentMultiplicity"), jet.pt(), dphi, jet.tracksIds().size(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (const auto& constituent : jet.template tracks_as()) { if (constituent.pt() > leadingPT) { leadingPT = constituent.pt(); } @@ -225,8 +231,8 @@ struct hJetAnalysis { } registry.fill(HIST("hSignalLeadingTrack"), jet.pt(), dphi, leadingPT, weight); } - if (!is_sig_col) { - for (auto& jetWTA : jet.template matchedJetGeo_as>()) { + if (!isSigCol) { + for (const auto& jetWTA : jet.template matchedJetGeo_as>()) { double deltaPhi = RecoDecay::constrainAngle(jetWTA.phi() - jet.phi(), -o2::constants::math::PI); double deltaEta = jetWTA.eta() - jet.eta(); double dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaEta); @@ -241,7 +247,7 @@ struct hJetAnalysis { registry.fill(HIST("hReferencePt"), jet.pt(), weight); } registry.fill(HIST("hJetReferenceConstituentMultiplicity"), jet.pt(), dphi, jet.tracksIds().size(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (const auto& constituent : jet.template tracks_as()) { if (constituent.pt() > leadingPT) { leadingPT = constituent.pt(); } @@ -256,21 +262,21 @@ struct hJetAnalysis { template void fillMCPHistograms(T const& jets, W const& /*jetsWTA*/, U const& particles, float weight = 1.0) { - bool is_sig_col; - std::vector phi_TT_ar; - double phi_TT = 0; - int trig_number = 0; - int n_TT = 0; + bool isSigCol; + std::vector phiTTAr; + double phiTT = 0; + int trigNumber = 0; + int nTT = 0; double leadingPT = 0; float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); float dice = rand->Rndm(); - if (dice < frac_sig) - is_sig_col = true; + if (dice < fracSig) + isSigCol = true; else - is_sig_col = false; + isSigCol = false; - for (auto& particle : particles) { + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle) { continue; @@ -278,52 +284,52 @@ struct hJetAnalysis { if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) { continue; } - if (is_sig_col && particle.pt() < pt_TTsig_max && particle.pt() > pt_TTsig_min) { - phi_TT_ar.push_back(particle.phi()); - n_TT++; + if (isSigCol && particle.pt() < ptTTsigMax && particle.pt() > ptTTsigMin) { + phiTTAr.push_back(particle.phi()); + nTT++; } - if (!is_sig_col && particle.pt() < pt_TTref_max && particle.pt() > pt_TTref_min) { - phi_TT_ar.push_back(particle.phi()); - n_TT++; + if (!isSigCol && particle.pt() < ptTTrefMax && particle.pt() > ptTTrefMin) { + phiTTAr.push_back(particle.phi()); + nTT++; } registry.fill(HIST("hPtPart"), particle.pt(), weight); registry.fill(HIST("hEtaPart"), particle.eta(), weight); registry.fill(HIST("hPhiPart"), particle.phi(), weight); } - if (n_TT > 0) { - trig_number = rand->Integer(n_TT); - phi_TT = phi_TT_ar[trig_number]; - if (is_sig_col) { + if (nTT > 0) { + trigNumber = rand->Integer(nTT); + phiTT = phiTTAr[trigNumber]; + if (isSigCol) { registry.fill(HIST("hNtrig"), 1.5, weight); registry.fill(HIST("hJetSignalMultiplicity"), jets.size(), weight); - registry.fill(HIST("hSigEventTriggers"), n_TT, weight); + registry.fill(HIST("hSigEventTriggers"), nTT, weight); } - if (!is_sig_col) { + if (!isSigCol) { registry.fill(HIST("hNtrig"), 0.5, weight); registry.fill(HIST("hJetReferenceMultiplicity"), jets.size(), weight); - registry.fill(HIST("hRefEventTriggers"), n_TT, weight); + registry.fill(HIST("hRefEventTriggers"), nTT, weight); } } - for (auto& jet : jets) { + for (const auto& jet : jets) { if (jet.pt() > pTHatMaxMCP * pTHat) { continue; } registry.fill(HIST("hJetPt"), jet.pt(), weight); registry.fill(HIST("hJetEta"), jet.eta(), weight); registry.fill(HIST("hJetPhi"), jet.phi(), weight); - for (auto& jetWTA : jet.template matchedJetGeo_as>()) { + for (const auto& jetWTA : jet.template matchedJetGeo_as>()) { double deltaPhi = RecoDecay::constrainAngle(jetWTA.phi() - jet.phi(), -o2::constants::math::PI); double deltaEta = jetWTA.eta() - jet.eta(); double dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaEta); registry.fill(HIST("hDeltaRPart"), dR, weight); registry.fill(HIST("hDeltaRpTPart"), jet.pt(), dR, weight); } - if (n_TT > 0) { - float dphi = RecoDecay::constrainAngle(jet.phi() - phi_TT); - if (is_sig_col) { - for (auto& jetWTA : jet.template matchedJetGeo_as>()) { + if (nTT > 0) { + float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT); + if (isSigCol) { + for (const auto& jetWTA : jet.template matchedJetGeo_as>()) { double deltaPhi = RecoDecay::constrainAngle(jetWTA.phi() - jet.phi(), -o2::constants::math::PI); double deltaEta = jetWTA.eta() - jet.eta(); double dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaEta); @@ -338,7 +344,7 @@ struct hJetAnalysis { registry.fill(HIST("hSignalPt"), jet.pt(), weight); } registry.fill(HIST("hJetSignalConstituentMultiplicity"), jet.pt(), dphi, jet.tracksIds().size(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (const auto& constituent : jet.template tracks_as()) { if (constituent.pt() > leadingPT) { leadingPT = constituent.pt(); } @@ -346,8 +352,8 @@ struct hJetAnalysis { } registry.fill(HIST("hSignalLeadingTrack"), jet.pt(), dphi, leadingPT, weight); } - if (!is_sig_col) { - for (auto& jetWTA : jet.template matchedJetGeo_as>()) { + if (!isSigCol) { + for (const auto& jetWTA : jet.template matchedJetGeo_as>()) { double deltaPhi = RecoDecay::constrainAngle(jetWTA.phi() - jet.phi(), -o2::constants::math::PI); double deltaEta = jetWTA.eta() - jet.eta(); double dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaEta); @@ -362,7 +368,7 @@ struct hJetAnalysis { registry.fill(HIST("hReferencePt"), jet.pt(), weight); } registry.fill(HIST("hJetReferenceConstituentMultiplicity"), jet.pt(), dphi, jet.tracksIds().size(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (const auto& constituent : jet.template tracks_as()) { if (constituent.pt() > leadingPT) { leadingPT = constituent.pt(); } @@ -397,7 +403,7 @@ struct hJetAnalysis { } if (jetBase.has_matchedJetGeo()) { - for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + for (const auto& jetTag : jetBase.template matchedJetGeo_as>()) { if (jetTag.pt() > pTHatMaxMCP * pTHat) { continue; } @@ -418,6 +424,8 @@ struct hJetAnalysis { registry.fill(HIST("hDeltaRMatched"), dR, dRp, weight); registry.fill(HIST("hDeltaRResolution"), jetTag.pt(), dRp - dR, weight); registry.fill(HIST("hFullMatching"), jetBase.pt(), jetTag.pt(), jetBase.phi(), jetTag.phi(), dR, dRp, weight); + registry.fill(HIST("hPtMatched1d"), jetTag.pt(), weight); + registry.fill(HIST("hDeltaRMatched1d"), dRp, weight); } } } @@ -430,10 +438,13 @@ struct hJetAnalysis { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); fillHistograms(jets, jetsWTA, tracks); } - PROCESS_SWITCH(hJetAnalysis, processData, "process data", true); + PROCESS_SWITCH(JetHadronRecoil, processData, "process data", true); void processMCD(soa::Filtered::iterator const& collision, soa::Filtered> const& jets, @@ -443,10 +454,13 @@ struct hJetAnalysis { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); fillHistograms(jets, jetsWTA, tracks); } - PROCESS_SWITCH(hJetAnalysis, processMCD, "process MC detector level", false); + PROCESS_SWITCH(JetHadronRecoil, processMCD, "process MC detector level", false); void processMCDWeighted(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, @@ -457,10 +471,13 @@ struct hJetAnalysis { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); fillHistograms(jets, jetsWTA, tracks, collision.mcCollision().weight()); } - PROCESS_SWITCH(hJetAnalysis, processMCDWeighted, "process MC detector level with event weights", false); + PROCESS_SWITCH(JetHadronRecoil, processMCDWeighted, "process MC detector level with event weights", false); void processMCP(aod::JetMcCollision const& collision, soa::Filtered> const& jets, @@ -473,7 +490,7 @@ struct hJetAnalysis { registry.fill(HIST("hZvtxSelected"), collision.posZ()); fillMCPHistograms(jets, jetsWTA, particles); } - PROCESS_SWITCH(hJetAnalysis, processMCP, "process MC particle level", false); + PROCESS_SWITCH(JetHadronRecoil, processMCP, "process MC particle level", false); void processMCPWeighted(aod::JetMcCollision const& collision, soa::Filtered> const& jets, @@ -486,7 +503,7 @@ struct hJetAnalysis { registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.weight()); fillMCPHistograms(jets, jetsWTA, particles, collision.weight()); } - PROCESS_SWITCH(hJetAnalysis, processMCPWeighted, "process MC particle level with event weights", false); + PROCESS_SWITCH(JetHadronRecoil, processMCPWeighted, "process MC particle level with event weights", false); void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, @@ -500,13 +517,16 @@ struct hJetAnalysis { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(PartJetsPerCollision, collision.mcCollisionId()); + const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); for (const auto& mcdjet : mcdjets) { fillMatchedHistograms(mcdjet, mcdjetsWTA, mcpjetsWTACut, mcpjets); } } - PROCESS_SWITCH(hJetAnalysis, processJetsMCPMCDMatched, "process MC matched (inc jets)", false); + PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatched, "process MC matched (inc jets)", false); void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, @@ -520,13 +540,16 @@ struct hJetAnalysis { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(PartJetsPerCollision, collision.mcCollisionId()); + const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); for (const auto& mcdjet : mcdjets) { fillMatchedHistograms(mcdjet, mcdjetsWTA, mcpjetsWTACut, mcpjets, mcdjet.eventWeight()); } } - PROCESS_SWITCH(hJetAnalysis, processJetsMCPMCDMatchedWeighted, "process MC matched with event weights (inc jets)", false); + PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatchedWeighted, "process MC matched with event weights (inc jets)", false); void processRecoilJetsMCPMCDMatched(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, @@ -540,11 +563,14 @@ struct hJetAnalysis { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(PartJetsPerCollision, collision.mcCollisionId()); + const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); bool ishJetEvent = false; - for (auto& track : tracks) { - if (track.pt() < pt_TTsig_max && track.pt() > pt_TTsig_min) { + for (const auto& track : tracks) { + if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { ishJetEvent = true; break; } @@ -555,7 +581,7 @@ struct hJetAnalysis { } } } - PROCESS_SWITCH(hJetAnalysis, processRecoilJetsMCPMCDMatched, "process MC matched (recoil jets)", false); + PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatched, "process MC matched (recoil jets)", false); void processRecoilJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, @@ -569,11 +595,14 @@ struct hJetAnalysis { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(PartJetsPerCollision, collision.mcCollisionId()); + const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); bool ishJetEvent = false; - for (auto& track : tracks) { - if (track.pt() < pt_TTsig_max && track.pt() > pt_TTsig_min) { + for (const auto& track : tracks) { + if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { ishJetEvent = true; break; } @@ -584,7 +613,7 @@ struct hJetAnalysis { } } } - PROCESS_SWITCH(hJetAnalysis, processRecoilJetsMCPMCDMatchedWeighted, "process MC matched with event weights (recoil jets)", false); + PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatchedWeighted, "process MC matched with event weights (recoil jets)", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"hJetAnalysis"})}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGJE/Tasks/jetmatchingqa.cxx b/PWGJE/Tasks/jetMatchingQA.cxx similarity index 100% rename from PWGJE/Tasks/jetmatchingqa.cxx rename to PWGJE/Tasks/jetMatchingQA.cxx diff --git a/PWGJE/Tasks/jetplanarflow.cxx b/PWGJE/Tasks/jetPlanarFlow.cxx similarity index 100% rename from PWGJE/Tasks/jetplanarflow.cxx rename to PWGJE/Tasks/jetPlanarFlow.cxx diff --git a/PWGJE/Tasks/jetSpectraEseTask.cxx b/PWGJE/Tasks/jetSpectraEseTask.cxx index 3643a0d4d4e..96ecaba87b9 100644 --- a/PWGJE/Tasks/jetSpectraEseTask.cxx +++ b/PWGJE/Tasks/jetSpectraEseTask.cxx @@ -14,6 +14,8 @@ /// /// \author Joachim C. K. B. Hansen, Lund University +#include + #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" @@ -42,6 +44,7 @@ struct JetSpectraEseTask { ConfigurableAxis binJetPt{"binJetPt", {200, 0., 200.}, ""}; ConfigurableAxis bindPhi{"bindPhi", {100, -TMath::Pi() - 1, TMath::Pi() + 1}, ""}; ConfigurableAxis binESE{"binESE", {100, 0, 100}, ""}; + ConfigurableAxis binCos{"binCos", {100, -1.05, 1.05}, ""}; Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"}; Configurable jetR{"jetR", 0.2, "jet resolution parameter"}; @@ -58,6 +61,8 @@ struct JetSpectraEseTask { AxisSpec dPhiAxis = {bindPhi, "#Delta#phi"}; AxisSpec eseAxis = {binESE, "#it{q}_{2}"}; + AxisSpec cosAxis = {binCos, ""}; + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; int eventSelection = -1; @@ -73,16 +78,30 @@ struct JetSpectraEseTask { switch (fColSwitch) { case 0: LOGF(info, "JetSpectraEseTask::init() - using data"); - registry.add("h_collisions", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - registry.add("h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{jetPtAxis}}}); - registry.add("h_jet_pt_bkgsub", "jet pT background sub;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{jetPtAxis}}}); - registry.add("h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); - registry.add("h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}); - registry.add("h_rho", ";#rho;entries", {HistType::kTH1F, {{100, 0, 200.}}}); - registry.add("h_jet_area", ";area_{jet};entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("h_Psi2", "#Psi_{2};entries;", {HistType::kTH1F, {{150, -2.5, 2.5}}}); - registry.add("h_dPhi", "#Delta#phi;entries;", {HistType::kTH1F, {{dPhiAxis}}}); - registry.add("jet_pt_dPhi_q2", "", {HistType::kTH3F, {{jetPtAxis}, {dPhiAxis}, {eseAxis}}}); + registry.add("hEventCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.add("hJetPt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{jetPtAxis}}}); + registry.add("hJetPt_bkgsub", "jet pT background sub;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{jetPtAxis}}}); + registry.add("hJetEta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("hJetPhi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}); + registry.add("hRho", ";#rho;entries", {HistType::kTH1F, {{100, 0, 200.}}}); + registry.add("hJetArea", ";area_{jet};entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("hdPhi", "#Delta#phi;entries;", {HistType::kTH1F, {{dPhiAxis}}}); + registry.add("hJetPtdPhiq2", "", {HistType::kTH3F, {{jetPtAxis}, {dPhiAxis}, {eseAxis}}}); + registry.add("hPsi2FT0C", ";Centrality; #Psi_{2}", {HistType::kTH2F, {{100, 0, 100}, {150, -2.5, 2.5}}}); + registry.add("hPsi2FT0A", ";Centrality; #Psi_{2}", {HistType::kTH2F, {{100, 0, 100}, {150, -2.5, 2.5}}}); + registry.add("hPsi2FV0A", ";Centrality; #Psi_{2}", {HistType::kTH2F, {{100, 0, 100}, {150, -2.5, 2.5}}}); + registry.add("hPsi2TPCpos", ";Centrality; #Psi_{2}", {HistType::kTH2F, {{100, 0, 100}, {150, -2.5, 2.5}}}); + registry.add("hPsi2TPCneg", ";Centrality; #Psi_{2}", {HistType::kTH2F, {{100, 0, 100}, {150, -2.5, 2.5}}}); + registry.add("hCosPsi2FT0CmFT0A", ";Centrality;cos(2(#Psi_{2}^{FT0C}-#Psi_{2}^{FT0A}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + registry.add("hCosPsi2FT0CmFV0A", ";Centrality;cos(2(#Psi_{2}^{FT0C}-#Psi_{2}^{FV0A}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + registry.add("hCosPsi2FV0AmFT0A", ";Centrality;cos(2(#Psi_{2}^{FT0C}-#Psi_{2}^{FV0A}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + registry.add("hCosPsi2FT0AmFT0C", ";Centrality;cos(2(#Psi_{2}^{FT0A}-#Psi_{2}^{FT0C}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + registry.add("hCosPsi2FT0AmFV0A", ";Centrality;cos(2(#Psi_{2}^{FT0C}-#Psi_{2}^{FV0A}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + registry.add("hCosPsi2FV0AmFT0C", ";Centrality;cos(2(#Psi_{2}^{FV0A}-#Psi_{2}^{FT0C}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + registry.add("hCosPsi2TPCposmTPCneg", ";Centrality;cos(2(#Psi_{2}^{TPCpos}-#Psi_{2}^{TPCneg}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + registry.add("hCosPsi2TPCposmFV0A", ";Centrality;cos(2(#Psi_{2}^{TPCpos}-#Psi_{2}^{FV0A}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + registry.add("hCosPsi2TPCnegmFV0A", ";Centrality;cos(2(#Psi_{2}^{TPCneg}-#Psi_{2}^{FV0A}));#it{q}_{2}", {HistType::kTH3F, {{100, 0, 100}, {cosAxis}, {eseAxis}}}); + break; case 1: LOGF(info, "JetSpectraEseTask::init() - using MC"); @@ -109,47 +128,47 @@ struct JetSpectraEseTask { Filter mcCollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; void processESEDataCharged(soa::Join::iterator const& collision, - soa::Join const&, + soa::Join const&, soa::Filtered const& jets, aod::JetTracks const& tracks) { float counter{0.5f}; - registry.fill(HIST("h_collisions"), counter++); - auto originalCollision = collision.collision_as>(); - if (originalCollision.fESECOL()[0] != 1) - return; - registry.fill(HIST("h_collisions"), counter++); + registry.fill(HIST("hEventCounter"), counter++); + const auto originalCollision = collision.collision_as>(); + registry.fill(HIST("hEventCounter"), counter++); if (originalCollision.centFT0C() < CentRange->at(0) || originalCollision.centFT0C() > CentRange->at(1)) return; - registry.fill(HIST("h_collisions"), counter++); - auto vPsi2 = 1 / 2.0 * TMath::ATan2(originalCollision.qvecFT0CImVec()[0], originalCollision.qvecFT0CReVec()[0]); - auto qPerc = originalCollision.qPERCFT0C(); + registry.fill(HIST("hEventCounter"), counter++); + + const auto vPsi2 = procEP(originalCollision); + const auto qPerc = originalCollision.qPERCFT0C(); + if (qPerc[0] < 0) + return; + registry.fill(HIST("hEventCounter"), counter++); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) return; - registry.fill(HIST("h_collisions"), counter++); + registry.fill(HIST("hEventCounter"), counter++); if (!isAcceptedLeadTrack(tracks)) return; - registry.fill(HIST("h_collisions"), counter++); - registry.fill(HIST("h_rho"), collision.rho()); + registry.fill(HIST("hEventCounter"), counter++); + registry.fill(HIST("hRho"), collision.rho()); for (auto const& jet : jets) { float jetpT_bkgsub = jet.pt() - (collision.rho() * jet.area()); - registry.fill(HIST("h_jet_pt"), jet.pt()); - registry.fill(HIST("h_jet_pt_bkgsub"), jetpT_bkgsub); - registry.fill(HIST("h_jet_eta"), jet.eta()); - registry.fill(HIST("h_jet_phi"), jet.phi()); - registry.fill(HIST("h_Psi2"), vPsi2); - registry.fill(HIST("h_jet_area"), jet.area()); + registry.fill(HIST("hJetPt"), jet.pt()); + registry.fill(HIST("hJetPt_bkgsub"), jetpT_bkgsub); + registry.fill(HIST("hJetEta"), jet.eta()); + registry.fill(HIST("hJetPhi"), jet.phi()); + registry.fill(HIST("hJetArea"), jet.area()); float dPhi = RecoDecay::constrainAngle(jet.phi() - vPsi2, -o2::constants::math::PI); - registry.fill(HIST("h_dPhi"), dPhi); - if (qPerc[0] < 0) - continue; - registry.fill(HIST("jet_pt_dPhi_q2"), jetpT_bkgsub, dPhi, qPerc[0]); + registry.fill(HIST("hdPhi"), dPhi); + registry.fill(HIST("hJetPtdPhiq2"), jetpT_bkgsub, dPhi, qPerc[0]); /* check the dphi */ } - registry.fill(HIST("h_collisions"), counter++); + registry.fill(HIST("hEventCounter"), counter++); } PROCESS_SWITCH(JetSpectraEseTask, processESEDataCharged, "process ese collisions", true); @@ -211,6 +230,50 @@ struct JetSpectraEseTask { else return true; } + + template + float procEP(qVectors const& vec) + { + const auto epFT0A = 1 / 2.0 * TMath::ATan2(vec.qvecFT0AImVec()[0], vec.qvecFT0AReVec()[0]); + const auto epFV0A = 1 / 2.0 * std::atan2(vec.qvecFV0AImVec()[0], vec.qvecFV0AReVec()[0]); + const auto epFT0C = 1 / 2.0 * std::atan2(vec.qvecFT0CImVec()[0], vec.qvecFT0CReVec()[0]); + const auto epTPCpos = 1 / 2.0 * std::atan2(vec.qvecTPCposImVec()[0], vec.qvecTPCposReVec()[0]); + const auto epTPCneg = 1 / 2.0 * std::atan2(vec.qvecTPCnegImVec()[0], vec.qvecTPCnegReVec()[0]); + + registry.fill(HIST("hPsi2FT0C"), vec.centFT0C(), epFT0C); + registry.fill(HIST("hPsi2FT0A"), vec.centFT0C(), epFT0A); + registry.fill(HIST("hPsi2FV0A"), vec.centFT0C(), epFV0A); + registry.fill(HIST("hPsi2TPCpos"), vec.centFT0C(), epTPCpos); + registry.fill(HIST("hPsi2TPCneg"), vec.centFT0C(), epTPCneg); + + const auto cosPsi2FT0CmFT0A = cosPsiXY(epFT0C, epFT0A); + const auto cosPsi2FT0CmFV0A = cosPsiXY(epFT0C, epFV0A); + const auto cosPsi2FV0AmFT0A = cosPsiXY(epFV0A, epFT0A); + const auto cosPsi2FT0AmFT0C = cosPsiXY(epFT0A, epFT0C); + const auto cosPsi2FT0AmFV0A = cosPsiXY(epFT0A, epFV0A); + const auto cosPsi2FV0AmFT0C = cosPsiXY(epFV0A, epFT0C); + const auto cosPsi2TPCposmTPCneg = cosPsiXY(epTPCpos, epTPCneg); + const auto cosPsi2TPCposmFV0A = cosPsiXY(epTPCpos, epFV0A); + const auto cosPsi2TPCnegmFV0A = cosPsiXY(epTPCneg, epFV0A); + + registry.fill(HIST("hCosPsi2FT0CmFT0A"), vec.centFT0C(), cosPsi2FT0CmFT0A, vec.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2FT0CmFV0A"), vec.centFT0C(), cosPsi2FT0CmFV0A, vec.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2FV0AmFT0A"), vec.centFT0C(), cosPsi2FV0AmFT0A, vec.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2FT0AmFT0C"), vec.centFT0C(), cosPsi2FT0AmFT0C, vec.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2FT0AmFV0A"), vec.centFT0C(), cosPsi2FT0AmFV0A, vec.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2FV0AmFT0C"), vec.centFT0C(), cosPsi2FV0AmFT0C, vec.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2TPCposmTPCneg"), vec.centFT0C(), cosPsi2TPCposmTPCneg, vec.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2TPCposmFV0A"), vec.centFT0C(), cosPsi2TPCposmFV0A, vec.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2TPCnegmFV0A"), vec.centFT0C(), cosPsi2TPCnegmFV0A, vec.qPERCFT0C()[0]); + + return epFT0A; + } + + template + float cosPsiXY(Psi const& psiX, Psi const& psiY) + { + return std::cos(2.0 * (psiX - psiY)); + } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGJE/Tasks/jetsubstructure.cxx b/PWGJE/Tasks/jetSubstructure.cxx similarity index 100% rename from PWGJE/Tasks/jetsubstructure.cxx rename to PWGJE/Tasks/jetSubstructure.cxx diff --git a/PWGJE/Tasks/jetSubstructureBplus.cxx b/PWGJE/Tasks/jetSubstructureBplus.cxx new file mode 100644 index 00000000000..61228fe5b19 --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureBplus.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet substructure B+ charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHF.cxx" + +using JetSubstructureBplus = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesBplusData, aod::CandidatesBplusMCP, aod::BplusCJetSSs, aod::BplusCMCDJetSSs, aod::BplusCMCPJetSSs, aod::BplusCEWSJetSSs, aod::JTrackBplusSubs>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-substructure-bplus"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureBplusOutput.cxx b/PWGJE/Tasks/jetSubstructureBplusOutput.cxx new file mode 100644 index 00000000000..e81e12566fa --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureBplusOutput.cxx @@ -0,0 +1,26 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet substructure output B+ charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHFOutput.cxx" + +using JetSubstructureOutputBplus = JetSubstructureHFOutputTask, aod::CandidatesBplusData, aod::CandidatesBplusMCD, aod::CandidatesBplusMCP, aod::JTrackBplusSubs, soa::Join, soa::Join, aod::BplusCJetCOs, aod::BplusCJetOs, aod::BplusCJetSSOs, aod::BplusCJetMOs, soa::Join, aod::BplusCMCDJetCOs, aod::BplusCMCDJetOs, aod::BplusCMCDJetSSOs, aod::BplusCMCDJetMOs, soa::Join, aod::BplusCMCPJetCOs, aod::BplusCMCPJetOs, aod::BplusCMCPJetSSOs, aod::BplusCMCPJetMOs, soa::Join, aod::BplusCEWSJetCOs, aod::BplusCEWSJetOs, aod::BplusCEWSJetSSOs, aod::BplusCEWSJetMOs, aod::StoredHfBplusCollBase, aod::StoredHfBplusBases, aod::StoredHfBplusPars, aod::StoredHfBplusParEs, aod::StoredHfBplusParD0s, aod::StoredHfBplusSels, aod::StoredHfBplusMls, aod::StoredHfBplusMlD0s, aod::StoredHfBplusMcs, aod::StoredHfBplusMcCollBases, aod::StoredHfBplusMcRCollIds, aod::StoredHfBplusPBases>; // all the 3P tables have been made into Bplus but they might be made common + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-bplus-output"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureD0.cxx b/PWGJE/Tasks/jetSubstructureD0.cxx new file mode 100644 index 00000000000..96760654a3a --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureD0.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet substructure D0 charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHF.cxx" + +using JetSubstructureD0 = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesD0Data, aod::CandidatesD0MCP, aod::D0CJetSSs, aod::D0CMCDJetSSs, aod::D0CMCPJetSSs, aod::D0CEWSJetSSs, aod::JTrackD0Subs>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-substructure-d0"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureD0Output.cxx b/PWGJE/Tasks/jetSubstructureD0Output.cxx new file mode 100644 index 00000000000..7eb6b474eaf --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureD0Output.cxx @@ -0,0 +1,26 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet substructure output D0 charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHFOutput.cxx" + +using JetSubstructureOutputD0 = JetSubstructureHFOutputTask, aod::CandidatesD0Data, aod::CandidatesD0MCD, aod::CandidatesD0MCP, aod::JTrackD0Subs, soa::Join, soa::Join, aod::D0CJetCOs, aod::D0CJetOs, aod::D0CJetSSOs, aod::D0CJetMOs, soa::Join, aod::D0CMCDJetCOs, aod::D0CMCDJetOs, aod::D0CMCDJetSSOs, aod::D0CMCDJetMOs, soa::Join, aod::D0CMCPJetCOs, aod::D0CMCPJetOs, aod::D0CMCPJetSSOs, aod::D0CMCPJetMOs, soa::Join, aod::D0CEWSJetCOs, aod::D0CEWSJetOs, aod::D0CEWSJetSSOs, aod::D0CEWSJetMOs, aod::StoredHfD0CollBase, aod::StoredHfD0Bases, aod::StoredHfD0Pars, aod::StoredHfD0ParEs, aod::JDumD0ParDaus, aod::StoredHfD0Sels, aod::StoredHfD0Mls, aod::JDumD0MlDaus, aod::StoredHfD0Mcs, aod::StoredHfD0McCollBases, aod::StoredHfD0McRCollIds, aod::StoredHfD0PBases>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-d0-output"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureDielectron.cxx b/PWGJE/Tasks/jetSubstructureDielectron.cxx new file mode 100644 index 00000000000..e5532cce52e --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureDielectron.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet substructure Dielectron charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHF.cxx" + +using JetSubstructureDielectron = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesDielectronData, aod::CandidatesDielectronMCP, aod::DielectronCJetSSs, aod::DielectronCMCDJetSSs, aod::DielectronCMCPJetSSs, aod::DielectronCEWSJetSSs, aod::JTrackDielectronSubs>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-substructure-dielectron"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureDielectronOutput.cxx b/PWGJE/Tasks/jetSubstructureDielectronOutput.cxx new file mode 100644 index 00000000000..76cdd6e7643 --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureDielectronOutput.cxx @@ -0,0 +1,26 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet substructure output Dielectron charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHFOutput.cxx" + +using JetSubstructureOutputDielectron = JetSubstructureHFOutputTask, soa::Join, aod::DielectronCJetCOs, aod::DielectronCJetOs, aod::DielectronCJetSSOs, aod::DielectronCJetMOs, soa::Join, aod::DielectronCMCDJetCOs, aod::DielectronCMCDJetOs, aod::DielectronCMCDJetSSOs, aod::DielectronCMCDJetMOs, soa::Join, aod::DielectronCMCPJetCOs, aod::DielectronCMCPJetOs, aod::DielectronCMCPJetSSOs, aod::DielectronCMCPJetMOs, soa::Join, aod::DielectronCEWSJetCOs, aod::DielectronCEWSJetOs, aod::DielectronCEWSJetSSOs, aod::DielectronCEWSJetMOs, aod::StoredReducedEvents, aod::StoredDielectrons, aod::JDielectron1Dummys, aod::JDielectron2Dummys, aod::JDielectron3Dummys, aod::JDielectron4Dummys, aod::JDielectron5Dummys, aod::JDielectron6Dummys, aod::JDielectron7Dummys, aod::StoredJDielectronMcCollisions, aod::JDielectron8Dummys, aod::StoredJDielectronMcs>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-dielectron-output"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetsubstructurehf.cxx b/PWGJE/Tasks/jetSubstructureHF.cxx similarity index 80% rename from PWGJE/Tasks/jetsubstructurehf.cxx rename to PWGJE/Tasks/jetSubstructureHF.cxx index c20515e9618..46572c17f07 100644 --- a/PWGJE/Tasks/jetsubstructurehf.cxx +++ b/PWGJE/Tasks/jetSubstructureHF.cxx @@ -14,6 +14,8 @@ /// \author Nima Zardoshti // +#include + #include "fastjet/PseudoJet.hh" #include "fastjet/ClusterSequenceArea.hh" @@ -241,11 +243,6 @@ struct JetSubstructureHFTask { outputTable(energyMotherVec, ptLeadingVec, ptSubLeadingVec, thetaVec, nSub[0], nSub[1], nSub[2], pairPtVec, pairEnergyVec, pairThetaVec, angularity); } - void processDummy(aod::JetTracks const&) - { - } - PROCESS_SWITCH(JetSubstructureHFTask, processDummy, "Dummy process function turned on by default", true); - void processChargedJetsData(typename JetTableData::iterator const& jet, CandidateTable const& candidates, aod::JetTracks const& tracks) @@ -289,31 +286,3 @@ struct JetSubstructureHFTask { } PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsMCP, "HF jet substructure on MC particle level", false); }; -using JetSubstructureD0 = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesD0Data, aod::CandidatesD0MCP, aod::D0CJetSSs, aod::D0CMCDJetSSs, aod::D0CMCPJetSSs, aod::D0CEWSJetSSs, aod::JTrackD0Subs>; -using JetSubstructureLc = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesLcData, aod::CandidatesLcMCP, aod::LcCJetSSs, aod::LcCMCDJetSSs, aod::LcCMCPJetSSs, aod::LcCEWSJetSSs, aod::JTrackLcSubs>; -// using JetSubstructureBplus = JetSubstructureHFTask,soa::Join,soa::Join,soa::Join, aod::CandidatesBplusData, aod::CandidatesBplusMCP, aod::BplusCJetSSs,aod::BplusCMCDJetSSs,aod::BplusCMCPJetSSs, aod::BplusCEWSJetSSs, aod::JTrackBplusSubs>; -using JetSubstructureDielectron = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesDielectronData, aod::CandidatesDielectronMCP, aod::DielectronCJetSSs, aod::DielectronCMCDJetSSs, aod::DielectronCMCPJetSSs, aod::DielectronCEWSJetSSs, aod::JTrackDielectronSubs>; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-d0"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-lc"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-dielectron"})); - /* - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-bplus"})); - */ - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/Tasks/jetsubstructurehfoutput.cxx b/PWGJE/Tasks/jetSubstructureHFOutput.cxx similarity index 77% rename from PWGJE/Tasks/jetsubstructurehfoutput.cxx rename to PWGJE/Tasks/jetSubstructureHFOutput.cxx index a822d22b4f7..d651f2d8e5b 100644 --- a/PWGJE/Tasks/jetsubstructurehfoutput.cxx +++ b/PWGJE/Tasks/jetSubstructureHFOutput.cxx @@ -14,6 +14,8 @@ /// \author Nima Zardoshti // +#include + #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoA.h" @@ -40,7 +42,7 @@ using namespace o2::framework::expressions; // NB: runDataProcessing.h must be included after customize! #include "Framework/runDataProcessing.h" -template +template struct JetSubstructureHFOutputTask { Produces collisionOutputTableData; @@ -63,8 +65,10 @@ struct JetSubstructureHFOutputTask { Produces candidateTable; Produces candidateParsTable; Produces candidateParExtrasTable; + Produces candidateParsDaughterTable; Produces candidateSelsTable; Produces candidateMlsTable; + Produces candidateMlsDaughterTable; Produces candidateMcsTable; Produces hfMcCollisionsTable; Produces hfMcCollisionsMatchingTable; @@ -100,9 +104,11 @@ struct JetSubstructureHFOutputTask { PresliceUnsorted> CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; PresliceOptional D0CollisionsPerCollision = aod::jd0indices::collisionId; PresliceOptional LcCollisionsPerCollision = aod::jlcindices::collisionId; + PresliceOptional BplusCollisionsPerCollision = aod::jbplusindices::collisionId; PresliceOptional DielectronCollisionsPerCollision = aod::jdielectronindices::collisionId; PresliceOptional> D0McCollisionsPerMcCollision = aod::jd0indices::mcCollisionId; - PresliceOptional> LcMcCollisionsPerMcCollision = aod::jlcindices::mcCollisionId; + PresliceOptional> LcMcCollisionsPerMcCollision = aod::jlcindices::mcCollisionId; + PresliceOptional> BplusMcCollisionsPerMcCollision = aod::jbplusindices::mcCollisionId; PresliceOptional DielectronMcCollisionsPerMcCollision = aod::jdielectronindices::mcCollisionId; void init(InitContext const&) @@ -205,7 +211,7 @@ struct JetSubstructureHFOutputTask { if (hfCollisionIndex != candidateCollisionMapping.end()) { candidateCollisionIndex = hfCollisionIndex->second; } - jetcandidateutilities::fillCandidateTable(candidate, candidateCollisionIndex, candidateTable, candidateParsTable, candidateParExtrasTable, candidateSelsTable, candidateMlsTable, candidateMcsTable, candidateIndex); + jetcandidateutilities::fillCandidateTable(candidate, candidateCollisionIndex, candidateTable, candidateParsTable, candidateParExtrasTable, candidateParsDaughterTable, candidateSelsTable, candidateMlsTable, candidateMlsDaughterTable, candidateMcsTable, candidateIndex); } candidateMap.insert(std::make_pair(candidate.globalIndex(), candidateIndex)); } @@ -320,7 +326,7 @@ struct JetSubstructureHFOutputTask { if constexpr (!isMCPOnly) { for (const auto& collision : collisions) { if (collisionFlag[collision.globalIndex()]) { - const auto hfCollisionsPerCollision = jetcandidateutilities::slicedPerCandidateCollision(hfCollisions, candidates, collision, D0CollisionsPerCollision, LcCollisionsPerCollision, D0CollisionsPerCollision, DielectronCollisionsPerCollision); // add Bplus later + const auto hfCollisionsPerCollision = jetcandidateutilities::slicedPerCandidateCollision(hfCollisions, candidates, collision, D0CollisionsPerCollision, LcCollisionsPerCollision, BplusCollisionsPerCollision, DielectronCollisionsPerCollision); // add Bplus later int32_t candidateCollisionIndex = -1; for (const auto& hfCollisionPerCollision : hfCollisionsPerCollision) { // should only ever be one auto hfCollisionTableIndex = candidateCollisionMapping.find(hfCollisionPerCollision.globalIndex()); @@ -336,7 +342,7 @@ struct JetSubstructureHFOutputTask { if constexpr (isMC) { for (const auto& mcCollision : mcCollisions) { if (mcCollisionFlag[mcCollision.globalIndex()]) { - const auto hfMcCollisionsPerMcCollision = jetcandidateutilities::slicedPerCandidateCollision(hfMcCollisions, candidatesMCP, mcCollision, D0McCollisionsPerMcCollision, LcMcCollisionsPerMcCollision, D0McCollisionsPerMcCollision, DielectronMcCollisionsPerMcCollision); // add Bplus later + const auto hfMcCollisionsPerMcCollision = jetcandidateutilities::slicedPerCandidateCollision(hfMcCollisions, candidatesMCP, mcCollision, D0McCollisionsPerMcCollision, LcMcCollisionsPerMcCollision, BplusMcCollisionsPerMcCollision, DielectronMcCollisionsPerMcCollision); // add Bplus later int32_t candidateMcCollisionIndex = -1; for (const auto& hfMcCollisionPerMcCollision : hfMcCollisionsPerMcCollision) { // should only ever be one auto hfMcCollisionTableIndex = candidateMcCollisionMapping.find(hfMcCollisionPerMcCollision.globalIndex()); @@ -497,19 +503,3 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputMatchingMC, "jet matching output MC", false); }; -using JetSubstructureOutputD0 = JetSubstructureHFOutputTask, aod::CandidatesD0Data, aod::CandidatesD0MCD, aod::CandidatesD0MCP, aod::JTrackD0Subs, soa::Join, soa::Join, aod::D0CJetCOs, aod::D0CJetOs, aod::D0CJetSSOs, aod::D0CJetMOs, soa::Join, aod::D0CMCDJetCOs, aod::D0CMCDJetOs, aod::D0CMCDJetSSOs, aod::D0CMCDJetMOs, soa::Join, aod::D0CMCPJetCOs, aod::D0CMCPJetOs, aod::D0CMCPJetSSOs, aod::D0CMCPJetMOs, soa::Join, aod::D0CEWSJetCOs, aod::D0CEWSJetOs, aod::D0CEWSJetSSOs, aod::D0CEWSJetMOs, aod::StoredHfD0CollBase, aod::StoredHfD0Bases, aod::StoredHfD0Pars, aod::StoredHfD0ParEs, aod::StoredHfD0Sels, aod::StoredHfD0Mls, aod::StoredHfD0Mcs, aod::StoredHfD0McCollBases, aod::StoredHfD0McRCollIds, aod::StoredHfD0PBases>; -using JetSubstructureOutputLc = JetSubstructureHFOutputTask, aod::CandidatesLcData, aod::CandidatesLcMCD, aod::CandidatesLcMCP, aod::JTrackLcSubs, soa::Join, soa::Join, aod::LcCJetCOs, aod::LcCJetOs, aod::LcCJetSSOs, aod::LcCJetMOs, soa::Join, aod::LcCMCDJetCOs, aod::LcCMCDJetOs, aod::LcCMCDJetSSOs, aod::LcCMCDJetMOs, soa::Join, aod::LcCMCPJetCOs, aod::LcCMCPJetOs, aod::LcCMCPJetSSOs, aod::LcCMCPJetMOs, soa::Join, aod::LcCEWSJetCOs, aod::LcCEWSJetOs, aod::LcCEWSJetSSOs, aod::LcCEWSJetMOs, aod::StoredHf3PCollBase, aod::StoredHf3PBases, aod::StoredHf3PPars, aod::StoredHf3PParEs, aod::StoredHf3PSels, aod::StoredHf3PMls, aod::StoredHf3PMcs, aod::StoredHf3PMcCollBases, aod::StoredHf3PMcRCollIds, aod::StoredHf3PPBases>; -// using JetSubstructureOutputBplus = JetSubstructureHFOutputTask, aod::CandidatesBplusData, aod::CandidatesBplusMCD, aod::CandidatesBplusMCP, aod::JTrackBplusSubs, soa::Join, soa::Join, aod::BplusCJetCOs, aod::BplusCJetOs, aod::BplusCJetSSOs, aod::BplusCJetMOs, soa::Join, aod::BplusCMCDJetCOs, aod::BplusCMCDJetOs, aod::BplusCMCDJetSSOs, aod::BplusCMCDJetMOs, soa::Join, aod::BplusCMCPJetCOs, aod::BplusCMCPJetOs, aod::BplusCMCPJetSSOs, aod::BplusCMCPJetMOs, soa::Join, aod::BplusCEWSJetCOs, aod::BplusCEWSJetOs, aod::BplusCEWSJetSSOs, aod::BplusCEWSJetMOs, aod::StoredHfBplusCollBase, aod::StoredHfBplusBases, aod::StoredHfBplusPars, aod::StoredHfBplusParEs, aod::StoredHfBplusSels, aod::StoredHfBplusMls, aod::StoredHfBplusMcs, aod::StoredHfBplusPBases>; -using JetSubstructureOutputDielectron = JetSubstructureHFOutputTask, soa::Join, aod::DielectronCJetCOs, aod::DielectronCJetOs, aod::DielectronCJetSSOs, aod::DielectronCJetMOs, soa::Join, aod::DielectronCMCDJetCOs, aod::DielectronCMCDJetOs, aod::DielectronCMCDJetSSOs, aod::DielectronCMCDJetMOs, soa::Join, aod::DielectronCMCPJetCOs, aod::DielectronCMCPJetOs, aod::DielectronCMCPJetSSOs, aod::DielectronCMCPJetMOs, soa::Join, aod::DielectronCEWSJetCOs, aod::DielectronCEWSJetOs, aod::DielectronCEWSJetSSOs, aod::DielectronCEWSJetMOs, aod::StoredReducedEvents, aod::StoredDielectrons, aod::JDielectron1Dummys, aod::JDielectron2Dummys, aod::JDielectron3Dummys, aod::JDielectron4Dummys, aod::JDielectron5Dummys, aod::StoredJDielectronMcCollisions, aod::JDielectron6Dummys, aod::StoredJDielectronMcs>; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-d0-output"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-lc-output"})); - // tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-bplus-output"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-dielectron-output"})); - - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/Tasks/jetSubstructureLc.cxx b/PWGJE/Tasks/jetSubstructureLc.cxx new file mode 100644 index 00000000000..dc985515164 --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureLc.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet substructure Lc charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHF.cxx" + +using JetSubstructureLc = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesLcData, aod::CandidatesLcMCP, aod::LcCJetSSs, aod::LcCMCDJetSSs, aod::LcCMCPJetSSs, aod::LcCEWSJetSSs, aod::JTrackLcSubs>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-substructure-lc"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureLcOutput.cxx b/PWGJE/Tasks/jetSubstructureLcOutput.cxx new file mode 100644 index 00000000000..dad7b2a52b5 --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureLcOutput.cxx @@ -0,0 +1,26 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// jet substructure output Lc charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHFOutput.cxx" + +using JetSubstructureOutputLc = JetSubstructureHFOutputTask, aod::CandidatesLcData, aod::CandidatesLcMCD, aod::CandidatesLcMCP, aod::JTrackLcSubs, soa::Join, soa::Join, aod::LcCJetCOs, aod::LcCJetOs, aod::LcCJetSSOs, aod::LcCJetMOs, soa::Join, aod::LcCMCDJetCOs, aod::LcCMCDJetOs, aod::LcCMCDJetSSOs, aod::LcCMCDJetMOs, soa::Join, aod::LcCMCPJetCOs, aod::LcCMCPJetOs, aod::LcCMCPJetSSOs, aod::LcCMCPJetMOs, soa::Join, aod::LcCEWSJetCOs, aod::LcCEWSJetOs, aod::LcCEWSJetSSOs, aod::LcCEWSJetMOs, aod::StoredHfLcCollBase, aod::StoredHfLcBases, aod::StoredHfLcPars, aod::StoredHfLcParEs, aod::JDumLcParDaus, aod::StoredHfLcSels, aod::StoredHfLcMls, aod::JDumLcMlDaus, aod::StoredHfLcMcs, aod::StoredHfLcMcCollBases, aod::StoredHfLcMcRCollIds, aod::StoredHfLcPBases>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-lc-output"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetsubstructureoutput.cxx b/PWGJE/Tasks/jetSubstructureOutput.cxx similarity index 100% rename from PWGJE/Tasks/jetsubstructureoutput.cxx rename to PWGJE/Tasks/jetSubstructureOutput.cxx diff --git a/PWGJE/Tasks/jettaggerhfQA.cxx b/PWGJE/Tasks/jetTaggerHFQA.cxx similarity index 100% rename from PWGJE/Tasks/jettaggerhfQA.cxx rename to PWGJE/Tasks/jetTaggerHFQA.cxx diff --git a/PWGJE/Tasks/jetTutorial.cxx b/PWGJE/Tasks/jetTutorial.cxx index 81861293949..230aaa53aaa 100644 --- a/PWGJE/Tasks/jetTutorial.cxx +++ b/PWGJE/Tasks/jetTutorial.cxx @@ -313,7 +313,7 @@ struct JetTutorialTask { return; } for (auto& jet : jets) { - if (std::abs(RecoDecay::constrainAngle(jet.phi() - leadingTrackPhi, -o2::constants::math::PIHalf) > 0.6)) { + if (std::abs(RecoDecay::constrainAngle(jet.phi() - leadingTrackPhi, -o2::constants::math::PIHalf)) > 0.6) { registry.fill(HIST("h_recoil_jet_pt"), jet.pt()); registry.fill(HIST("h_recoil_jet_eta"), jet.eta()); registry.fill(HIST("h_recoil_jet_phi"), jet.phi()); diff --git a/PWGJE/Tasks/jetvalidationqa.cxx b/PWGJE/Tasks/jetValidationQA.cxx similarity index 99% rename from PWGJE/Tasks/jetvalidationqa.cxx rename to PWGJE/Tasks/jetValidationQA.cxx index c608c9c256c..261bea68571 100644 --- a/PWGJE/Tasks/jetvalidationqa.cxx +++ b/PWGJE/Tasks/jetValidationQA.cxx @@ -437,7 +437,7 @@ struct mcJetTrackCollisionQa { mHistManager.fill(HIST("selectedTrackEta"), track.eta()); } } // end of tracks loop - } // end of mcTrack template + } // end of mcTrack template template void fillMcDetJets(detectorJet const& mcdJet) @@ -496,7 +496,7 @@ struct mcJetTrackCollisionQa { } } } // end of loop particle level jets - } // end if has mc collision + } // end if has mc collision fillMcTrackHistos(tracks, collision, false); for (const auto& detJet : mcDetJets) { if (detJet.collisionId() == collision.globalIndex()) { @@ -506,7 +506,7 @@ struct mcJetTrackCollisionQa { } } } // end of loop detector level jets - } // end processMcRun2 + } // end processMcRun2 PROCESS_SWITCH(mcJetTrackCollisionQa, processMcRun2, "validate jet-finder output on converted run2 mc AOD's", false); void processMcRun3(aod::JetCollisionsMCD::iterator const& collision, @@ -530,7 +530,7 @@ struct mcJetTrackCollisionQa { } } } // end of loop particle level jets - } // end of loop if mc collision + } // end of loop if mc collision fillMcTrackHistos(tracks, collision, false); for (const auto& detJet : mcDetJets) { if (detJet.collisionId() == collision.globalIndex()) { @@ -540,7 +540,7 @@ struct mcJetTrackCollisionQa { } } } // end of loop detector level jets - } // end processMcRun3 + } // end processMcRun3 PROCESS_SWITCH(mcJetTrackCollisionQa, processMcRun3, "validate jet-finder output on run3 mc AOD's", false); // dummy process to run jetfinder validation code on AO2D's, but MC validation for run3 on hyperloop diff --git a/PWGJE/Tasks/mcgeneratorstudies.cxx b/PWGJE/Tasks/mcGeneratorStudies.cxx similarity index 66% rename from PWGJE/Tasks/mcgeneratorstudies.cxx rename to PWGJE/Tasks/mcGeneratorStudies.cxx index 83e37759732..98ec04f3341 100644 --- a/PWGJE/Tasks/mcgeneratorstudies.cxx +++ b/PWGJE/Tasks/mcGeneratorStudies.cxx @@ -32,6 +32,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using MyMCCollisions = soa::Join; +using MyBCs = o2::soa::Join; struct MCGeneratorStudies { HistogramRegistry mHistManager{"MCGeneratorStudyHistograms"}; @@ -55,6 +56,11 @@ struct MCGeneratorStudies { hCollisionCounter->GetXaxis()->SetBinLabel(6, "+unique"); // TVX with z < 10cm and Sel8 and good z xertex and unique (only collision in the BC) hCollisionCounter->GetXaxis()->SetBinLabel(7, "+EMC readout"); // TVX with z < 10cm and Sel8 and good z xertex and unique (only collision in the BC) and kTVXinEMC + auto hBCCounter = mHistManager.add("hBCCounter", "Number of BCs after BC cuts", HistType::kTH1F, {{3, 0.5, 3.5}}); + hBCCounter->GetXaxis()->SetBinLabel(1, "all"); + hBCCounter->GetXaxis()->SetBinLabel(2, "+TVX"); + hBCCounter->GetXaxis()->SetBinLabel(3, "+Collision"); + TString mesonLatexString = (TString)mSelectedParticleCode; switch (mSelectedParticleCode) { case 0: @@ -77,6 +83,11 @@ struct MCGeneratorStudies { mHistManager.add("Yield_TZSGUE", Form("Generated %s in unique TVXinEMC collisions with good z < 10cm and Sel8", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); mHistManager.add("Yield_TZSGUE_Accepted", Form("Accepted %s in unique TVXinEMC collisions with good z < 10cm and Sel8", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield_BC_T", Form("Generated %s in TVX triggered BCs", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield_BC_TC", Form("Generated %s in TVX triggered BCs that have at least one collision", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("NCollisionsMCCollisions", "Number of (MC)Collisions in the BC;#it{N}_(Collisions);#it{N}_(MC Collisions)", kTH2F, {{4, -0.5, 3.5}, {4, -0.5, 3.5}}); + mHistManager.add("NTVXCollisionsMCCollisions", "Number of (MC)Collisions in the TVX triggered BC;#it{N}_(Collisions);#it{N}_(MC Collisions)", kTH2F, {{4, -0.5, 3.5}, {4, -0.5, 3.5}}); + auto hEMCollisionCounter = mHistManager.add("hEMCollisionCounter", "collision counter;;Number of events", kTH1F, {{13, 0.5, 13.5}}, false); hEMCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); hEMCollisionCounter->GetXaxis()->SetBinLabel(2, "No TF border"); @@ -95,42 +106,89 @@ struct MCGeneratorStudies { o2::emcal::Geometry::GetInstanceFromRunNumber(300000); } - PresliceUnsorted perMcCollision = aod::mcparticle::mcCollisionId; + PresliceUnsorted perFoundBC = aod::evsel::foundBCId; + Preslice MCCollperBC = aod::mccollision::bcId; + Preslice perMcCollision = aod::mcparticle::mcCollisionId; - void process(MyMCCollisions::iterator const& collision, aod::McCollisions const&, aod::McParticles const& mcParticles) + void process(MyBCs const& bcs, MyMCCollisions const& collisions, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fillEventHistogram(&mHistManager, collision); - - auto mcCollision = collision.mcCollision(); - auto mcParticles_inColl = mcParticles.sliceBy(perMcCollision, mcCollision.globalIndex()); - - for (auto& mcParticle : mcParticles_inColl) { - if (mcParticle.pdgCode() != 0 && mcParticle.pdgCode() != mSelectedParticleCode) - continue; - if (fabs(mcParticle.y()) > mRapidityCut) - continue; - if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator()) - continue; - if (mRequireGammaGammaDecay && !isGammaGammaDecay(mcParticle, mcParticles)) - continue; - - mHistManager.fill(HIST("Yield"), mcParticle.pt()); - if (isAccepted(mcParticle, mcParticles)) - mHistManager.fill(HIST("Yield_Accepted"), mcParticle.pt()); - if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { - mHistManager.fill(HIST("Yield_T"), mcParticle.pt()); - if (abs(collision.posZ()) < mVertexCut) { - mHistManager.fill(HIST("Yield_TZ"), mcParticle.pt()); - if (collision.sel8()) { - mHistManager.fill(HIST("Yield_TZS"), mcParticle.pt()); - if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - mHistManager.fill(HIST("Yield_TZSG"), mcParticle.pt()); - if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - mHistManager.fill(HIST("Yield_TZSGU"), mcParticle.pt()); - if (mRequireEMCCellContent ? collision.isemcreadout() : collision.alias_bit(kTVXinEMC)) { - mHistManager.fill(HIST("Yield_TZSGUE"), mcParticle.pt()); - if (isAccepted(mcParticle, mcParticles)) - mHistManager.fill(HIST("Yield_TZSGUE_Accepted"), mcParticle.pt()); + + for (const auto& bc : bcs) { + + auto collisionsInFoundBC = collisions.sliceBy(perFoundBC, bc.globalIndex()); + auto MCCollisionsBC = mcCollisions.sliceBy(MCCollperBC, bc.globalIndex()); + + mHistManager.fill(HIST("NCollisionsMCCollisions"), collisionsInFoundBC.size(), MCCollisionsBC.size()); + mHistManager.fill(HIST("hBCCounter"), 1); + + if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) { // Count BCs with TVX trigger with and without a collision, as well as the generated particles within + + mHistManager.fill(HIST("NTVXCollisionsMCCollisions"), collisionsInFoundBC.size(), mcCollisions.size()); + + mHistManager.fill(HIST("hBCCounter"), 2); + + bool bcHasCollision = collisionsInFoundBC.size() > 0; + + if (bcHasCollision) + mHistManager.fill(HIST("hBCCounter"), 3); + + for (auto& mcCollision : MCCollisionsBC) { + + auto mcParticles_inColl = mcParticles.sliceBy(perMcCollision, mcCollision.globalIndex()); + + for (auto& mcParticle : mcParticles_inColl) { + if (mcParticle.pdgCode() != 0 && mcParticle.pdgCode() != mSelectedParticleCode) + continue; + if (fabs(mcParticle.y()) > mRapidityCut) + continue; + if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator()) + continue; + if (mRequireGammaGammaDecay && !isGammaGammaDecay(mcParticle, mcParticles)) + continue; + + mHistManager.fill(HIST("Yield_BC_T"), mcParticle.pt()); + + if (bcHasCollision) + mHistManager.fill(HIST("Yield_BC_TC"), mcParticle.pt()); + } + } + } + } + + for (auto& collision : collisions) { + fillEventHistogram(&mHistManager, collision); + + auto mcCollision = collision.mcCollision(); + auto mcParticles_inColl = mcParticles.sliceBy(perMcCollision, mcCollision.globalIndex()); + + for (auto& mcParticle : mcParticles_inColl) { + if (mcParticle.pdgCode() != 0 && mcParticle.pdgCode() != mSelectedParticleCode) + continue; + if (fabs(mcParticle.y()) > mRapidityCut) + continue; + if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator()) + continue; + if (mRequireGammaGammaDecay && !isGammaGammaDecay(mcParticle, mcParticles)) + continue; + + mHistManager.fill(HIST("Yield"), mcParticle.pt()); + if (isAccepted(mcParticle, mcParticles)) + mHistManager.fill(HIST("Yield_Accepted"), mcParticle.pt()); + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + mHistManager.fill(HIST("Yield_T"), mcParticle.pt()); + if (abs(collision.posZ()) < mVertexCut) { + mHistManager.fill(HIST("Yield_TZ"), mcParticle.pt()); + if (collision.sel8()) { + mHistManager.fill(HIST("Yield_TZS"), mcParticle.pt()); + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + mHistManager.fill(HIST("Yield_TZSG"), mcParticle.pt()); + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + mHistManager.fill(HIST("Yield_TZSGU"), mcParticle.pt()); + if (mRequireEMCCellContent ? collision.isemcreadout() : collision.alias_bit(kTVXinEMC)) { + mHistManager.fill(HIST("Yield_TZSGUE"), mcParticle.pt()); + if (isAccepted(mcParticle, mcParticles)) + mHistManager.fill(HIST("Yield_TZSGUE_Accepted"), mcParticle.pt()); + } } } } diff --git a/PWGJE/Tasks/nSubjettiness.cxx b/PWGJE/Tasks/nsubjettiness.cxx similarity index 100% rename from PWGJE/Tasks/nSubjettiness.cxx rename to PWGJE/Tasks/nsubjettiness.cxx diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index ab5f0c236f5..212c167fced 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -11,6 +11,8 @@ // author: Arvind Khuntia (arvind.khuntia@cern.ch) INFN Bologna, Italy +#include +#include #include #include @@ -31,6 +33,8 @@ #include "CommonConstants/PhysicsConstants.h" #include "ReconstructionDataFormats/Track.h" +#include "PWGLF/DataModel/LFParticleIdentification.h" + #include "PWGJE/Core/FastJetUtilities.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" #include "PWGJE/DataModel/Jet.h" @@ -92,6 +96,7 @@ struct nucleiInJets { Configurable isMC{"isMC", false, "flag for the MC"}; Configurable isWithJetEvents{"isWithJetEvents", true, "Events with at least one jet"}; Configurable isWithLeadingJet{"isWithLeadingJet", true, "Events with leading jet"}; + Configurable useLfTpcPid{"useLfTpcPid", true, "Events with custom TPC parameters"}; Configurable cfgtrkMinPt{"cfgtrkMinPt", 0.15, "set track min pT"}; Configurable cfgtrkMaxEta{"cfgtrkMaxEta", 0.8, "set track max Eta"}; @@ -149,7 +154,9 @@ struct nucleiInJets { using TrackCandidates = soa::Join; - + using TrackCandidatesLfPid = soa::Join; using TrackCandidatesMC = soa::Join(); - fillTrackInfo(trk, chargedjets, leadingJetWithPtEtaPhi); + if (useLfTpcPid) { + auto trk = track.track_as(); + fillTrackInfo(trk, chargedjets, leadingJetWithPtEtaPhi); + } else { + auto trk = track.track_as(); + fillTrackInfo(trk, chargedjets, leadingJetWithPtEtaPhi); + } } } @@ -1190,7 +1202,7 @@ struct nucleiInJets { // add pid later bool jetFlag = false; - for (int iDJet = 0; iDJet < mcdJetPt.size(); iDJet++) { + for (std::size_t iDJet = 0; iDJet < mcdJetPt.size(); iDJet++) { double delPhi = TVector2::Phi_mpi_pi(mcdJetPhi[iDJet] - track.phi()); double delEta = mcdJetEta[iDJet] - track.eta(); double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); @@ -1270,7 +1282,7 @@ struct nucleiInJets { // add pid later bool jetFlag = false; - for (int iDJet = 0; iDJet < mcpJetPt.size(); iDJet++) { + for (std::size_t iDJet = 0; iDJet < mcpJetPt.size(); iDJet++) { double delPhi = TVector2::Phi_mpi_pi(mcpJetPhi[iDJet] - mcParticle.phi()); double delEta = mcpJetEta[iDJet] - mcParticle.eta(); double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); diff --git a/PWGJE/Tasks/phiInJets.cxx b/PWGJE/Tasks/phiInJets.cxx index 19adf76e3b8..09206a3cf4b 100644 --- a/PWGJE/Tasks/phiInJets.cxx +++ b/PWGJE/Tasks/phiInJets.cxx @@ -821,7 +821,7 @@ struct phiInJets { int goodjets = 0; double jetpt = 0; - for (int i = 0; i < mcd_pt.size(); i++) { + for (std::size_t i = 0; i < mcd_pt.size(); i++) { if (i == 0) { if (lResonance.M() > 1.005 && lResonance.M() < 1.035) { RealPhiCandWithJet++; diff --git a/PWGJE/Tasks/PhotonIsolationQA.cxx b/PWGJE/Tasks/photonIsolationQA.cxx similarity index 82% rename from PWGJE/Tasks/PhotonIsolationQA.cxx rename to PWGJE/Tasks/photonIsolationQA.cxx index 878d404236c..03b8e4f1fe6 100644 --- a/PWGJE/Tasks/PhotonIsolationQA.cxx +++ b/PWGJE/Tasks/photonIsolationQA.cxx @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -55,6 +57,7 @@ using namespace o2::framework::expressions; using myGlobTracks = o2::soa::Join; using collisionEvSelIt = o2::soa::Join; +using collisionEvSelItMC = o2::aod::McCollisions; using MCClusters = o2::soa::Join; struct PhotonIsolationQA { @@ -78,17 +81,21 @@ struct PhotonIsolationQA { Configurable ExoticContribution{"ExoticContribution", false, "Exotic cluster in the data"}; Configurable minDPhi{"minDPhi", 0.01, "Minimum dPhi between track and cluster"}; Configurable Track_matching_Radius{"Track_matching_Radius", 0.05, "Radius for which a high energetic track is matched to a cluster"}; + Configurable isMC{"isMC", true, "should be set to true if the data set is monte carlo"}; Filter PosZFilter = nabs(aod::collision::posZ) < maxPosZ; + Filter PosZFilterMC = nabs(aod::mccollision::posZ) < maxPosZ; Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == mClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::energy > minClusterEnergy) && (o2::aod::emcalcluster::nCells >= minNCells) && (o2::aod::emcalcluster::nlm <= maxNLM) && (o2::aod::emcalcluster::isExotic == ExoticContribution); Filter emccellfilter = aod::calo::caloType == 1; using selectedCollisions = soa::Filtered; + using selectedMcCollisions = soa::Filtered; using selectedClusters = soa::Filtered; using selectedMCClusters = soa::Filtered; // Preslices Preslice collisionsPerBC = aod::collision::bcId; + Preslice McCollisionsPerBC = aod::mccollision::bcId; Preslice TracksPercollision = aod::track::collisionId; Preslice perClusterMatchedTracks = o2::aod::emcalclustercell::emcalclusterId; Preslice ClustersPerCol = aod::emcalcluster::collisionId; @@ -135,33 +142,48 @@ struct PhotonIsolationQA { Data_Info.add("hEvsPtIso", "Pt_Iso", o2HistType::kTH2F, {{Energy_Axis}, {PtIso_Axis}}); Data_Info.add("hRho_Perpen_Cone", "Energy vs Density of perpendicular cone", o2HistType::kTH2F, {{Energy_Axis}, {Rho_Axis}}); Data_Info.add("hShowerShape", "Shower shape", o2HistType::kTH2F, {{Shower_Shape_Long_Axis}, {Shower_Shape_Short_Axis}}); - Data_Info.add("hSigmaLongvsPtIso", "Long shower shape vs Pt_Iso", o2HistType::kTH2F, {{Shower_Shape_Long_Axis}, {PtIso_Axis}}); + Data_Info.add("hSigmaLongvsPtIso", "Long shower shape vs Pt_Iso", o2HistType::kTH3F, {{Shower_Shape_Long_Axis}, {PtIso_Axis}, {Energy_Axis}}); Data_Info.add("hABCDControlRegion", "Yield Control Regions", o2HistType::kTH2F, {{ABCD_Axis}, {Energy_Axis}}); Data_Info.add("hCollperBC", "collisions per BC", o2HistType::kTH1F, {BC_Axis}); Data_Info.add("hEnergy_NLM_Flag", "Energy vs NLM", o2HistType::kTH3F, {{Energy_Axis}, {NLM_Axis}, {SM_Flag_Axis}}); Data_Info.add("hNCells_NLM_Flag", "Energy vs NLM", o2HistType::kTH3F, {{NCells_Axis}, {NLM_Axis}, {SM_Flag_Axis}}); MC_Info.add("hPosZ", "Z Position of collision", o2HistType::kTH1F, {PosZ_Axis}); + MC_Info.get(HIST("hPosZ"))->Sumw2(); MC_Info.add("hNumClusters", "Number of cluster per collision", o2HistType::kTH1F, {Num_Cluster_Axis}); + MC_Info.get(HIST("hNumClusters"))->Sumw2(); MC_Info.add("hClusterLocation", "Location of shower in eta phi plane", o2HistType::kTH2F, {{Eta_Axis}, {Phi_Axis}}); MC_Info.add("hEnergy_ShowerShapeLong", "Energy vs Shower shape long axis", o2HistType::kTH2F, {{Energy_Axis}, {Shower_Shape_Long_Axis}}); + MC_Info.get(HIST("hEnergy_ShowerShapeLong"))->Sumw2(); MC_Info.add("hEnergy_ShowerShapeShort", "Energy vs Shower shape short axis", o2HistType::kTH2F, {{Energy_Axis}, {Shower_Shape_Short_Axis}}); + MC_Info.get(HIST("hEnergy_ShowerShapeShort"))->Sumw2(); MC_Info.add("hEnergy_m02_m20", "Energy cluster Vs m02 vs m20", o2HistType::kTH3F, {{Energy_Axis}, {Shower_Shape_Long_Axis}, {Shower_Shape_Short_Axis}}); + MC_Info.get(HIST("hEnergy_m02_m20"))->Sumw2(); MC_Info.add("hEnergy_NCells", "Energy vs Number of cells in cluster", o2HistType::kTH2F, {{Energy_Axis}, {NCells_Axis}}); + MC_Info.get(HIST("hEnergy_NCells"))->Sumw2(); MC_Info.add("hEvsNumTracks", "Energy of cluster vs matched tracks", o2HistType::kTH2F, {{Energy_Axis}, {Num_Track_Axis}}); + MC_Info.get(HIST("hEvsNumTracks"))->Sumw2(); MC_Info.add("hEvsPtIso", "Pt_Iso", o2HistType::kTH2F, {{Energy_Axis}, {PtIso_Axis}}); + MC_Info.get(HIST("hEvsPtIso"))->Sumw2(); MC_Info.add("hRho_Perpen_Cone", "Energy vs Density of perpendicular cone", o2HistType::kTH2F, {{Energy_Axis}, {Rho_Axis}}); + MC_Info.get(HIST("hRho_Perpen_Cone"))->Sumw2(); MC_Info.add("hShowerShape", "Shower shape", o2HistType::kTH2F, {{Shower_Shape_Long_Axis}, {Shower_Shape_Short_Axis}}); - MC_Info.add("hSigmaLongvsPtIso", "Long shower shape vs Pt_Iso", o2HistType::kTH2F, {{Shower_Shape_Long_Axis}, {PtIso_Axis}}); + MC_Info.get(HIST("hShowerShape"))->Sumw2(); + MC_Info.add("hSigmaLongvsPtIso", "Long shower shape vs Pt_Iso", o2HistType::kTH3F, {{Shower_Shape_Long_Axis}, {PtIso_Axis}, {Energy_Axis}}); + MC_Info.get(HIST("hSigmaLongvsPtIso"))->Sumw2(); MC_Info.add("hABCDControlRegion", "Yield Control Regions", o2HistType::kTH2F, {{ABCD_Axis}, {Energy_Axis}}); + MC_Info.get(HIST("hABCDControlRegion"))->Sumw2(); MC_Info.add("hClusterEnergy_MCParticleEnergy", "Energy cluster vs energy particle of cluster", o2HistType::kTH2F, {{Energy_Axis}, {Energy_Axis}}); + MC_Info.get(HIST("hClusterEnergy_MCParticleEnergy"))->Sumw2(); MC_Info.add("hMotherPDG", "PDG code of candidate photons mother", o2HistType::kTH1F, {{2000, -1000.5, 999.5}}); MC_Info.add("hMotherStatusCode", "Statuscode of candidate photons mother", o2HistType::kTH1F, {{400, -200.5, 199.5}}); MC_Info.add("hMotherStatusCodeVsPDG", "Statuscode of candidate photons mother", o2HistType::kTH2F, {{Status_Code_Axis}, {PDG_Axis}}); MC_Info.add("hCollperBC", "collisions per BC", o2HistType::kTH1F, {BC_Axis}); MC_Info.add("hEnergy_NLM_Flag", "Energy vs NLM", o2HistType::kTH3F, {{Energy_Axis}, {NLM_Axis}, {SM_Flag_Axis}}); + MC_Info.get(HIST("hEnergy_NLM_Flag"))->Sumw2(); MC_Info.add("hNCells_NLM_Flag", "Energy vs NLM", o2HistType::kTH3F, {{NCells_Axis}, {NLM_Axis}, {SM_Flag_Axis}}); + MC_Info.get(HIST("hNCells_NLM_Flag"))->Sumw2(); MC_Info.add("hPromtPhoton", "Energy vs m02 vs NCells, PtIso", o2HistType::kTHnSparseF, {{Energy_Axis}, {Shower_Shape_Long_Axis}, {NCells_Axis}, {PtIso_Axis}}); std::vector bin_names = {"A", "B", "C", "D", "True Bckgr A"}; @@ -248,29 +270,52 @@ struct PhotonIsolationQA { return Pt_Iso; } - void fillclusterhistos(const auto cluster, HistogramRegistry registry) + void fillclusterhistos(const auto cluster, HistogramRegistry registry, double weight = 1.0) { registry.fill(HIST("hClusterLocation"), cluster.eta(), cluster.phi()); - registry.fill(HIST("hEnergy_ShowerShapeLong"), cluster.energy(), cluster.m02()); - registry.fill(HIST("hEnergy_ShowerShapeShort"), cluster.energy(), cluster.m20()); - registry.fill(HIST("hEnergy_NCells"), cluster.energy(), cluster.nCells()); - registry.fill(HIST("hEnergy_m02_m20"), cluster.energy(), cluster.m02(), cluster.m20()); - registry.fill(HIST("hShowerShape"), cluster.m02(), cluster.m20()); + if (isMC == true) { + registry.fill(HIST("hEnergy_ShowerShapeLong"), cluster.energy(), cluster.m02(), weight); + registry.fill(HIST("hEnergy_ShowerShapeShort"), cluster.energy(), cluster.m20(), weight); + registry.fill(HIST("hEnergy_NCells"), cluster.energy(), cluster.nCells(), weight); + registry.fill(HIST("hEnergy_m02_m20"), cluster.energy(), cluster.m02(), cluster.m20(), weight); + registry.fill(HIST("hShowerShape"), cluster.m02(), cluster.m20(), weight); + } else { + registry.fill(HIST("hEnergy_ShowerShapeLong"), cluster.energy(), cluster.m02()); + registry.fill(HIST("hEnergy_ShowerShapeShort"), cluster.energy(), cluster.m20()); + registry.fill(HIST("hEnergy_NCells"), cluster.energy(), cluster.nCells()); + registry.fill(HIST("hEnergy_m02_m20"), cluster.energy(), cluster.m02(), cluster.m20()); + registry.fill(HIST("hShowerShape"), cluster.m02(), cluster.m20()); + } } - void fillABCDHisto(HistogramRegistry registry, const auto& cluster, double Pt_iso) + void fillABCDHisto(HistogramRegistry registry, const auto& cluster, double Pt_iso, double weight = 1.0) { - if ((Pt_iso < 1.5) && (cluster.m02() < 0.3) && (cluster.m02() > 0.1)) { - registry.fill(HIST("hABCDControlRegion"), 0.5, cluster.energy()); - } - if ((Pt_iso > 4.0) && (cluster.m02() < 0.3) && (cluster.m02() > 0.1)) { - registry.fill(HIST("hABCDControlRegion"), 1.5, cluster.energy()); - } - if ((Pt_iso < 1.5) && (cluster.m02() < 2.0) && (cluster.m02() > 0.4)) { - registry.fill(HIST("hABCDControlRegion"), 2.5, cluster.energy()); - } - if ((Pt_iso > 4.0) && (cluster.m02() < 2.0) && (cluster.m02() > 0.4)) { - registry.fill(HIST("hABCDControlRegion"), 3.5, cluster.energy()); + if (isMC == true) { + if ((Pt_iso < 1.5) && (cluster.m02() < 0.3) && (cluster.m02() > 0.1)) { + registry.fill(HIST("hABCDControlRegion"), 0.5, cluster.energy(), weight); + } + if ((Pt_iso > 4.0) && (cluster.m02() < 0.3) && (cluster.m02() > 0.1)) { + registry.fill(HIST("hABCDControlRegion"), 1.5, cluster.energy(), weight); + } + if ((Pt_iso < 1.5) && (cluster.m02() < 2.0) && (cluster.m02() > 0.4)) { + registry.fill(HIST("hABCDControlRegion"), 2.5, cluster.energy(), weight); + } + if ((Pt_iso > 4.0) && (cluster.m02() < 2.0) && (cluster.m02() > 0.4)) { + registry.fill(HIST("hABCDControlRegion"), 3.5, cluster.energy(), weight); + } + } else { + if ((Pt_iso < 1.5) && (cluster.m02() < 0.3) && (cluster.m02() > 0.1)) { + registry.fill(HIST("hABCDControlRegion"), 0.5, cluster.energy()); + } + if ((Pt_iso > 4.0) && (cluster.m02() < 0.3) && (cluster.m02() > 0.1)) { + registry.fill(HIST("hABCDControlRegion"), 1.5, cluster.energy()); + } + if ((Pt_iso < 1.5) && (cluster.m02() < 2.0) && (cluster.m02() > 0.4)) { + registry.fill(HIST("hABCDControlRegion"), 2.5, cluster.energy()); + } + if ((Pt_iso > 4.0) && (cluster.m02() < 2.0) && (cluster.m02() > 0.4)) { + registry.fill(HIST("hABCDControlRegion"), 3.5, cluster.energy()); + } } } @@ -351,30 +396,30 @@ struct PhotonIsolationQA { } // process monte carlo data - void processMC(aod::BCs const& bcs, selectedCollisions const& Collisions, selectedMCClusters const& mcclusters, aod::McParticles const&, myGlobTracks const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks, aod::Calos const&, aod::EMCALClusterCells const& ClusterCells) + void processMC(aod::BCs const& bcs, selectedMcCollisions const& Collisions, selectedMCClusters const& mcclusters, aod::McParticles const&, myGlobTracks const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks, aod::Calos const&, aod::EMCALClusterCells const& ClusterCells) { for (auto bc : bcs) { - auto collisionsInBC = Collisions.sliceBy(collisionsPerBC, bc.globalIndex()); + auto collisionsInBC = Collisions.sliceBy(McCollisionsPerBC, bc.globalIndex()); MC_Info.fill(HIST("hCollperBC"), collisionsInBC.size()); if (collisionsInBC.size() == 1) { for (const auto& Collision : collisionsInBC) { - MC_Info.fill(HIST("hPosZ"), Collision.posZ()); + MC_Info.fill(HIST("hPosZ"), Collision.posZ(), Collision.weight()); auto ClustersInCol = mcclusters.sliceBy(ClustersPerCol, Collision.globalIndex()); auto tracksInCol = tracks.sliceBy(TracksPercollision, Collision.globalIndex()); if (ClustersInCol.size() > 0) { - MC_Info.fill(HIST("hNumClusters"), ClustersInCol.size()); + MC_Info.fill(HIST("hNumClusters"), ClustersInCol.size(), Collision.weight()); } for (auto& mccluster : ClustersInCol) { auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, mccluster.globalIndex()); - fillclusterhistos(mccluster, MC_Info); - MC_Info.fill(HIST("hEvsNumTracks"), mccluster.energy(), tracksofcluster.size()); + fillclusterhistos(mccluster, MC_Info, Collision.weight()); + MC_Info.fill(HIST("hEvsNumTracks"), mccluster.energy(), tracksofcluster.size(), Collision.weight()); auto CellsInCluster = ClusterCells.sliceBy(CellsPerCluster, mccluster.globalIndex()); auto [NLM, flag] = CalculateNLM(CellsInCluster); - MC_Info.fill(HIST("hEnergy_NLM_Flag"), mccluster.energy(), NLM, flag); - MC_Info.fill(HIST("hNCells_NLM_Flag"), mccluster.nCells(), NLM, flag); + MC_Info.fill(HIST("hEnergy_NLM_Flag"), mccluster.energy(), NLM, flag, Collision.weight()); + MC_Info.fill(HIST("hNCells_NLM_Flag"), mccluster.nCells(), NLM, flag, Collision.weight()); if (!track_matching(mccluster, tracksofcluster)) { // no track with significant momentum is matched to cluster if (NLM <= maxNLM) { @@ -382,17 +427,17 @@ struct PhotonIsolationQA { double Rho_Perpen_Cone = Rho_Perpendicular_Cone(mccluster, tracksInCol); double Pt_iso = Pt_Iso(Pt_Cone, Rho_Perpen_Cone); - MC_Info.fill(HIST("hEvsPtIso"), mccluster.energy(), Pt_iso); - MC_Info.fill(HIST("hRho_Perpen_Cone"), mccluster.energy(), Rho_Perpen_Cone); - MC_Info.fill(HIST("hSigmaLongvsPtIso"), mccluster.m02(), Pt_iso); - fillABCDHisto(MC_Info, mccluster, Pt_iso); + MC_Info.fill(HIST("hEvsPtIso"), mccluster.energy(), Pt_iso, Collision.weight()); + MC_Info.fill(HIST("hRho_Perpen_Cone"), mccluster.energy(), Rho_Perpen_Cone, Collision.weight()); + MC_Info.fill(HIST("hSigmaLongvsPtIso"), mccluster.m02(), Pt_iso, mccluster.energy(), Collision.weight()); + fillABCDHisto(MC_Info, mccluster, Pt_iso, Collision.weight()); // acces mc true info auto ClusterParticles = mccluster.mcParticle_as(); bool background = true; for (auto& clusterparticle : ClusterParticles) { if (clusterparticle.pdgCode() == 22) { - MC_Info.fill(HIST("hClusterEnergy_MCParticleEnergy"), mccluster.energy(), clusterparticle.e()); + MC_Info.fill(HIST("hClusterEnergy_MCParticleEnergy"), mccluster.energy(), clusterparticle.e(), Collision.weight()); int first_mother_status_code = getOriginalMotherIndex(clusterparticle); if (abs(first_mother_status_code) == 23) { background = false; @@ -402,7 +447,7 @@ struct PhotonIsolationQA { } if (background) { if ((Pt_iso < 1.5) && (mccluster.m02() < 0.3) && (mccluster.m02() > 0.1)) { - MC_Info.fill(HIST("hABCDControlRegion"), 4.5, mccluster.energy()); + MC_Info.fill(HIST("hABCDControlRegion"), 4.5, mccluster.energy(), Collision.weight()); } } } @@ -448,7 +493,7 @@ struct PhotonIsolationQA { Data_Info.fill(HIST("hEvsPtIso"), cluster.energy(), Pt_iso); Data_Info.fill(HIST("hRho_Perpen_Cone"), cluster.energy(), Rho_Perpen_Cone); - Data_Info.fill(HIST("hSigmaLongvsPtIso"), cluster.m02(), Pt_iso); + Data_Info.fill(HIST("hSigmaLongvsPtIso"), cluster.m02(), Pt_iso, cluster.energy()); fillABCDHisto(Data_Info, cluster, Pt_iso); } } diff --git a/PWGJE/Tasks/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index 2ff07bcb11f..b3d1aaaffa9 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -405,7 +405,7 @@ struct statPromptPhoton { using jfilteredMCClusters = soa::Filtered; int nEventsRecMC_JE = 0; - void processMCRec_JE(jfilteredCollisions::iterator const& collision, jfilteredMCClusters const& mcclusters, jTrackCandidates const& tracks, soa::Join const& caltracks, aod::JMcParticles const&, TrackCandidates const&) + void processMCRec_JE(jfilteredCollisions::iterator const& collision, jfilteredMCClusters const& mcclusters, jTrackCandidates const& tracks, soa::Join const& /*caltracks*/, aod::JMcParticles const&, TrackCandidates const&) { nEventsRecMC_JE++; @@ -437,7 +437,6 @@ struct statPromptPhoton { histos.fill(HIST("REC_M02_AC"), mccluster.energy()); histos.fill(HIST("REC_All_Energy"), mccluster.energy()); bool photontrigger = false; // is a neutral cluster - bool nonvetotrigger = false; // probably is not a neutral cluster bool vetotrigger = false; // might be a neutral cluster bool chargetrigger = false; // is definitely not a neutral cluster double photonPt = 0.0; @@ -471,7 +470,6 @@ struct statPromptPhoton { histos.fill(HIST("REC_Cluster_QA"), 2.5); vetotrigger = true; } else { - nonvetotrigger = true; photontrigger = true; histos.fill(HIST("REC_Cluster_QA"), 1.5); } diff --git a/PWGJE/Tasks/trackJetqa.cxx b/PWGJE/Tasks/trackJetQA.cxx similarity index 99% rename from PWGJE/Tasks/trackJetqa.cxx rename to PWGJE/Tasks/trackJetQA.cxx index 9477f88d66e..437fdd914a0 100644 --- a/PWGJE/Tasks/trackJetqa.cxx +++ b/PWGJE/Tasks/trackJetQA.cxx @@ -171,7 +171,7 @@ struct TrackJetQa { histos.add("TrackPar/xyz", "track #it{x}, #it{y}, #it{z} position at dca in local coordinate system", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisTrackX, axisTrackY, axisTrackZ, axisPercentileFT0A, axisPercentileFT0C}); histos.add("TrackPar/alpha", "rotation angle of local wrt. global coordinate system", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisRotation, axisPercentileFT0A, axisPercentileFT0C}); histos.add("TrackPar/signed1Pt", "track signed 1/#it{p}_{T}", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisSignedPt, axisPercentileFT0A, axisPercentileFT0C}); - histos.add("TrackPar/snp", "sinus of track momentum azimuthal angle (snp)", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {11, -0.05, 0.5, "snp"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/snp", "sinus of track momentum azimuthal angle (snp)", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {11, -0.5, 0.5, "snp"}, axisPercentileFT0A, axisPercentileFT0C}); histos.add("TrackPar/tgl", "tangent of the track momentum dip angle (tgl)", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {200, -1., 1., "tgl"}, axisPercentileFT0A, axisPercentileFT0C}); histos.add("TrackPar/flags", "track flag;#it{p}_{T} [GeV/c];flag bit", {HistType::kTH2F, {{200, 0, 200}, {64, -0.5, 63.5}}}); histos.add("TrackPar/dcaXY", "distance of closest approach in #it{xy} plane", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisDcaXY, axisPercentileFT0A, axisPercentileFT0C}); diff --git a/PWGJE/Tasks/v0jetspectra.cxx b/PWGJE/Tasks/v0JetSpectra.cxx similarity index 100% rename from PWGJE/Tasks/v0jetspectra.cxx rename to PWGJE/Tasks/v0JetSpectra.cxx diff --git a/PWGJE/Tasks/v0qa.cxx b/PWGJE/Tasks/v0QA.cxx similarity index 99% rename from PWGJE/Tasks/v0qa.cxx rename to PWGJE/Tasks/v0QA.cxx index bdff8d941c3..e4de0088ccf 100644 --- a/PWGJE/Tasks/v0qa.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -1258,7 +1258,7 @@ struct V0QA { using DaughterJTracks = soa::Join; using DaughterTracks = soa::Join; - void processV0TrackQA(aod::JetCollision const& jcoll, soa::Join const& v0s, DaughterJTracks const&, DaughterTracks const&) + void processV0TrackQA(aod::JetCollision const& /*jcoll*/, soa::Join const& v0s, DaughterJTracks const&, DaughterTracks const&) { // if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { // return; diff --git a/PWGLF/DataModel/LFHStrangeCorrelationTables.h b/PWGLF/DataModel/LFHStrangeCorrelationTables.h index 1b31239f406..7f7578b3632 100644 --- a/PWGLF/DataModel/LFHStrangeCorrelationTables.h +++ b/PWGLF/DataModel/LFHStrangeCorrelationTables.h @@ -50,26 +50,33 @@ DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! DECLARE_SOA_INDEX_COLUMN_FULL(Track, track, int, Tracks, "_Assoc"); //! } // namespace assocPions DECLARE_SOA_TABLE(AssocPions, "AOD", "ASSOCPIONS", o2::soa::Index<>, assocPions::CollisionId, assocPions::TrackId); + +namespace assocHadrons +{ +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! +DECLARE_SOA_INDEX_COLUMN_FULL(Track, track, int, Tracks, "_Assoc"); //! +} // namespace assocHadrons +DECLARE_SOA_TABLE(AssocHadrons, "AOD", "ASSOCHADRONS", o2::soa::Index<>, assocHadrons::CollisionId, assocHadrons::TrackId); /// _________________________________________ /// Table for storing associated V0 indices namespace assocV0s { -DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! -DECLARE_SOA_INDEX_COLUMN(V0Core, v0Core); //! +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! +DECLARE_SOA_INDEX_COLUMN(V0Core, v0Core); //! // dEdx compatibility is done via encoded integer: 0: passes loose; 1: passes normal, 2: passes tight; definition of loose/normal/tight is in hStrangeCorrelationFilter DECLARE_SOA_COLUMN(CompatibleK0Short, compatibleK0Short, int); // compatible with K0Short dEdx, encoded syst checks DECLARE_SOA_COLUMN(CompatibleLambda, compatibleLambda, int); // compatible with Lambda dEdx, encoded syst checks DECLARE_SOA_COLUMN(CompatibleAntiLambda, compatibleAntiLambda, int); // compatible with AntiLambda dEdx, encoded syst checks -DECLARE_SOA_COLUMN(MCTrueK0Short, mcTrueK0Short, bool); // true K0Short in MC -DECLARE_SOA_COLUMN(MCTrueLambda, mcTrueLambda, bool); // true Lambda in MC -DECLARE_SOA_COLUMN(MCTrueAntiLambda, mcTrueAntiLambda, bool); // true AntiLambda in MC -DECLARE_SOA_COLUMN(MCPhysicalPrimary, mcPhysicalPrimary, bool); // true physical primary flag -DECLARE_SOA_COLUMN(NSigmaMassK0Short, nSigmaMassK0Short, float); // -DECLARE_SOA_COLUMN(NSigmaMassLambda, nSigmaMassLambda, float); // +DECLARE_SOA_COLUMN(MCTrueK0Short, mcTrueK0Short, bool); // true K0Short in MC +DECLARE_SOA_COLUMN(MCTrueLambda, mcTrueLambda, bool); // true Lambda in MC +DECLARE_SOA_COLUMN(MCTrueAntiLambda, mcTrueAntiLambda, bool); // true AntiLambda in MC +DECLARE_SOA_COLUMN(MCPhysicalPrimary, mcPhysicalPrimary, bool); // true physical primary flag +DECLARE_SOA_COLUMN(NSigmaMassK0Short, nSigmaMassK0Short, float); // +DECLARE_SOA_COLUMN(NSigmaMassLambda, nSigmaMassLambda, float); // DECLARE_SOA_COLUMN(NSigmaMassAntiLambda, nSigmaMassAntiLambda, float); // -DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) +DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) [](int cK0Short, int cLambda, int cAntiLambda, int value, int compatibilityLevel) -> bool { if (value == 0 && bitcheck(cK0Short, compatibilityLevel)) return true; @@ -119,8 +126,8 @@ DECLARE_SOA_TABLE(AssocV0s, "AOD", "ASSOCV0S", o2::soa::Index<>, /// Table for storing associated casc indices namespace assocCascades { -DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! -DECLARE_SOA_INDEX_COLUMN(CascData, cascData); //! +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! +DECLARE_SOA_INDEX_COLUMN(CascData, cascData); //! // dEdx compatibility is done via encoded integer: 0: passes loose; 1: passes normal, 2: passes tight; definition of loose/normal/tight is in hStrangeCorrelationFilter DECLARE_SOA_COLUMN(CompatibleXiMinus, compatibleXiMinus, int); // compatible with XiMinus @@ -128,14 +135,14 @@ DECLARE_SOA_COLUMN(CompatibleXiPlus, compatibleXiPlus, int); // compatib DECLARE_SOA_COLUMN(CompatibleOmegaMinus, compatibleOmegaMinus, int); // compatible with OmegaMinus DECLARE_SOA_COLUMN(CompatibleOmegaPlus, compatibleOmegaPlus, int); // compatible with OmegaPlus -DECLARE_SOA_COLUMN(MCTrueXiMinus, mcTrueXiMinus, bool); // true XiMinus in mc -DECLARE_SOA_COLUMN(MCTrueXiPlus, mcTrueXiPlus, bool); // true XiPlus in mc -DECLARE_SOA_COLUMN(MCTrueOmegaMinus, mcTrueOmegaMinus, bool); // true OmegaMinus in mc -DECLARE_SOA_COLUMN(MCTrueOmegaPlus, mcTrueOmegaPlus, bool); // true OmegaPlus in mc -DECLARE_SOA_COLUMN(MCPhysicalPrimary, mcPhysicalPrimary, bool); // physical primary in MC -DECLARE_SOA_COLUMN(NSigmaMassXi, nSigmaMassXi, float); // -DECLARE_SOA_COLUMN(NSigmaMassOmega, nSigmaMassOmega, float); // -DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) +DECLARE_SOA_COLUMN(MCTrueXiMinus, mcTrueXiMinus, bool); // true XiMinus in mc +DECLARE_SOA_COLUMN(MCTrueXiPlus, mcTrueXiPlus, bool); // true XiPlus in mc +DECLARE_SOA_COLUMN(MCTrueOmegaMinus, mcTrueOmegaMinus, bool); // true OmegaMinus in mc +DECLARE_SOA_COLUMN(MCTrueOmegaPlus, mcTrueOmegaPlus, bool); // true OmegaPlus in mc +DECLARE_SOA_COLUMN(MCPhysicalPrimary, mcPhysicalPrimary, bool); // physical primary in MC +DECLARE_SOA_COLUMN(NSigmaMassXi, nSigmaMassXi, float); // +DECLARE_SOA_COLUMN(NSigmaMassOmega, nSigmaMassOmega, float); // +DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) [](int cXiMinus, int cXiPlus, int cOmegaMinus, int cOmegaPlus, int value, int compatibilityLevel) -> bool { if (value == 0 && bitcheck(cXiMinus, compatibilityLevel)) return true; diff --git a/PWGLF/DataModel/LFHypernucleiKfTables.h b/PWGLF/DataModel/LFHypernucleiKfTables.h new file mode 100644 index 00000000000..328ab07f6b3 --- /dev/null +++ b/PWGLF/DataModel/LFHypernucleiKfTables.h @@ -0,0 +1,230 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// authors Janik Ditzel and Michael Hartung + +#ifndef PWGLF_DATAMODEL_LFHYPERNUCLEIKFTABLES_H_ +#define PWGLF_DATAMODEL_LFHYPERNUCLEIKFTABLES_H_ + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/Centrality.h" +#include "Common/Core/RecoDecay.h" + +namespace o2::aod +{ +namespace hykfmcColl +{ +DECLARE_SOA_COLUMN(PassedEvSel, passedEvSel, bool); //! +} +DECLARE_SOA_TABLE(HypKfMcColls, "AOD", "HYPKFMCCOLL", + o2::soa::Index<>, + hykfmcColl::PassedEvSel, + mccollision::PosX, + mccollision::PosY, + mccollision::PosZ); +using HypKfMcColl = HypKfMcColls::iterator; + +namespace hykfmc +{ +DECLARE_SOA_INDEX_COLUMN(HypKfMcColl, hypKfMcColl); +DECLARE_SOA_COLUMN(Species, species, int8_t); //! +DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! +DECLARE_SOA_COLUMN(Svx, svx, float); //! +DECLARE_SOA_COLUMN(Svy, svy, float); //! +DECLARE_SOA_COLUMN(Svz, svz, float); //! +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) { return RecoDecay::pt(std::array{px, py}); }); +DECLARE_SOA_DYNAMIC_COLUMN(Y, y, [](float E, float pz) { return 0.5 * TMath::Log((E + pz) / (E - pz)); }); +DECLARE_SOA_DYNAMIC_COLUMN(Mass, mass, [](float E, float px, float py, float pz) { return TMath::Sqrt(E * E - px * px - py * py - pz * pz); }); +DECLARE_SOA_DYNAMIC_COLUMN(IsMatter, isMatter, [](int pdgCode) { return pdgCode > 0; }); +} // namespace hykfmc + +DECLARE_SOA_TABLE(HypKfMcParts, "AOD", "HYPKFMCPART", + o2::soa::Index<>, + hykfmc::HypKfMcCollId, + hykfmc::Species, + mcparticle::PdgCode, + hykfmc::IsPhysicalPrimary, + mcparticle::Px, + mcparticle::Py, + mcparticle::Pz, + mcparticle::E, + hykfmc::Svx, + hykfmc::Svy, + hykfmc::Svz, + hykfmc::Pt, + hykfmc::Y, + hykfmc::Mass, + hykfmc::IsMatter); +using HypKfMcPart = HypKfMcParts::iterator; + +DECLARE_SOA_TABLE(HypKfColls, "AOD", "HYPKFCOLL", + o2::soa::Index<>, + hykfmcColl::PassedEvSel, + hykfmc::HypKfMcCollId, + collision::PosX, + collision::PosY, + collision::PosZ, + cent::CentFT0A, + cent::CentFT0C, + cent::CentFT0M); +using HypKfColl = HypKfColls::iterator; + +namespace hykftrk +{ +DECLARE_SOA_INDEX_COLUMN(HypKfColl, hypKfColl); +DECLARE_SOA_COLUMN(Rigidity, rigidity, float); //! +DECLARE_SOA_COLUMN(TPCnCluster, tpcNcluster, float); //! +DECLARE_SOA_COLUMN(TPCnSigma, tpcNsigma, float); //! +DECLARE_SOA_COLUMN(TPCnSigmaNhp, tpcNsigmaNhp, float); //! +DECLARE_SOA_COLUMN(TPCnSigmaNlp, tpcNsigmaNlp, float); //! +DECLARE_SOA_COLUMN(TOFMass, tofMass, float); //! +DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! +DECLARE_SOA_COLUMN(SubMass, subMass, float); //! +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) { return (double)pt * TMath::Cos(phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float pt, float phi) { return (double)pt * TMath::Sin(phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pt, float eta) { return (double)pt * TMath::SinH(eta); }); +DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) { return pt * TMath::CosH(eta); }); // +DECLARE_SOA_DYNAMIC_COLUMN(Y, y, [](float pt, float eta, float mass) { return std::log((RecoDecay::sqrtSumOfSquares(mass, pt * TMath::CosH(eta)) + pt * TMath::SinH(eta)) / RecoDecay::sqrtSumOfSquares(mass, pt)); }); +DECLARE_SOA_DYNAMIC_COLUMN(Lambda, lambda, [](float eta) { return 1. / TMath::CosH(eta); }); +DECLARE_SOA_DYNAMIC_COLUMN(ITSnCluster, itsNcluster, [](uint32_t itsClusterSizes) { + uint8_t n = 0; + for (uint8_t i = 0; i < 7; i++) { + if (itsClusterSizes >> (4 * i) & 15) + n++; + } + return n; +}); +DECLARE_SOA_DYNAMIC_COLUMN(ITSfirstLayer, itsFirstLayer, [](uint32_t itsClusterSizes) { + for (int i = 0; i < 8; i++) { + if (itsClusterSizes >> (4 * i) & 15) + return i; + } + return -999; +}); +DECLARE_SOA_DYNAMIC_COLUMN(ITSmeanClsSize, itsMeanClsSize, [](uint32_t itsClusterSizes) { + int sum = 0, n = 0; + for (int i = 0; i < 8; i++) { + sum += (itsClusterSizes >> (4 * i) & 15); + if (itsClusterSizes >> (4 * i) & 15) + n++; + } + return static_cast(sum) / n; +}); +} // namespace hykftrk + +DECLARE_SOA_TABLE(HypKfTracks, "AOD", "HYPKFTRACK", + o2::soa::Index<>, + hykfmc::Species, + track::Pt, + track::Eta, + track::Phi, + track::DcaXY, + track::DcaZ, + hykftrk::TPCnCluster, + track::TPCChi2NCl, + track::ITSClusterSizes, + track::ITSChi2NCl, + hykftrk::Rigidity, + track::TPCSignal, + hykftrk::TPCnSigma, + hykftrk::TPCnSigmaNhp, + hykftrk::TPCnSigmaNlp, + hykftrk::TOFMass, + hykftrk::IsPVContributor, + hykftrk::Px, + hykftrk::Py, + hykftrk::Pz, + hykftrk::P, + hykftrk::Lambda, + hykftrk::ITSnCluster, + hykftrk::ITSfirstLayer, + hykftrk::ITSmeanClsSize); +using HypKfTrack = HypKfTracks::iterator; + +DECLARE_SOA_TABLE(HypKfSubDs, "AOD", "HYPKFSUBD", + o2::soa::Index<>, + hykftrk::SubMass); +using HypKfSubD = HypKfSubDs::iterator; + +DECLARE_SOA_TABLE(HypKfDaughtAdds, "AOD", "HYPKFDAUGHTADD", + o2::soa::Index<>, + track::X, + track::Y, + track::Z, + mcparticle::Px, + mcparticle::Py, + mcparticle::Pz); +using HypKfDaughtAdd = HypKfDaughtAdds::iterator; + +namespace hykfhyp +{ +DECLARE_SOA_INDEX_COLUMN(HypKfColl, hypKfColl); +DECLARE_SOA_INDEX_COLUMN(HypKfMcPart, hypKfMcPart); +DECLARE_SOA_ARRAY_INDEX_COLUMN(HypKfDaughtAdd, addons); +DECLARE_SOA_ARRAY_INDEX_COLUMN(HypKfTrack, daughterTracks); +DECLARE_SOA_SELF_INDEX_COLUMN_FULL(HypDaughter, hypDaughter, int, "HypKfHypNucs"); +DECLARE_SOA_ARRAY_INDEX_COLUMN(HypKfSubD, subDaughters); +DECLARE_SOA_COLUMN(Primary, primary, bool); //! +DECLARE_SOA_COLUMN(Mass, mass, float); //! +DECLARE_SOA_COLUMN(Px, px, float); //! +DECLARE_SOA_COLUMN(Py, py, float); //! +DECLARE_SOA_COLUMN(Pz, pz, float); //! +DECLARE_SOA_COLUMN(DcaToPvXY, dcaToPvXY, float); //! +DECLARE_SOA_COLUMN(DcaToPvZ, dcaToPvZ, float); //! +DECLARE_SOA_COLUMN(DcaToVtxXY, dcaToVtxXY, float); //! +DECLARE_SOA_COLUMN(DcaToVtxZ, dcaToVtxZ, float); //! +DECLARE_SOA_COLUMN(Chi2, chi2, float); //! +DECLARE_SOA_COLUMN(DevToPvXY, devToPvXY, float); //! +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) { return RecoDecay::pt(px, py); }); +DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, [](float px, float py, float pz) { return RecoDecay::eta(std::array{px, py, pz}); }); +DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, [](float px, float py) { return RecoDecay::phi(std::array{px, py}); }); +DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float px, float py, float pz) { return RecoDecay::p(px, py, pz); }); // +DECLARE_SOA_DYNAMIC_COLUMN(Y, y, [](float px, float py, float pz, float mass) { return RecoDecay::y(std::array{px, py, pz}, mass); }); +DECLARE_SOA_DYNAMIC_COLUMN(McTrue, mcTrue, [](int hypKfMcPartId) { return hypKfMcPartId > 0; }); +DECLARE_SOA_DYNAMIC_COLUMN(IsMatter, isMatter, [](int8_t species) { return species > 0; }); +DECLARE_SOA_DYNAMIC_COLUMN(Cascade, cascade, [](int hypDaughter) { return hypDaughter > 0; }); +} // namespace hykfhyp + +DECLARE_SOA_TABLE(HypKfHypNucs, "AOD", "HYPKFHYPNUC", + o2::soa::Index<>, + hykfhyp::HypKfMcPartId, + hykfhyp::HypKfCollId, + hykfhyp::HypKfTrackIds, + hykfhyp::HypKfDaughtAddIds, + hykfhyp::HypDaughterId, + hykfhyp::HypKfSubDIds, + hykfmc::Species, + hykfhyp::Primary, + hykfhyp::Mass, + hykfhyp::Px, + hykfhyp::Py, + hykfhyp::Pz, + hykfhyp::DcaToPvXY, + hykfhyp::DcaToPvZ, + hykfhyp::DevToPvXY, + hykfhyp::DcaToVtxXY, + hykfhyp::DcaToVtxZ, + hykfhyp::Chi2, + hykfmc::Svx, + hykfmc::Svy, + hykfmc::Svz, + hykfhyp::Y, + hykfhyp::Pt, + hykfhyp::Eta, + hykfhyp::Phi, + hykfhyp::P, + hykfhyp::McTrue, + hykfhyp::IsMatter, + hykfhyp::Cascade); +using HypKfHypNuc = HypKfHypNucs::iterator; +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_LFHYPERNUCLEIKFTABLES_H_ diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index 46955373222..e86ae9e42c7 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -34,49 +34,50 @@ DECLARE_SOA_COLUMN(MultFT0C, multFT0C, float); // Multiplicity with DECLARE_SOA_COLUMN(PsiTPC, psiTPC, float); // Psi with TPC estimator DECLARE_SOA_COLUMN(MultTPC, multTPC, float); // Multiplicity with TPC estimator -DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter -DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter -DECLARE_SOA_COLUMN(PhiHe3, phiHe3, float); // Phi of the He daughter -DECLARE_SOA_COLUMN(EtaHe3, etaHe3, float); // Eta of the He daughter -DECLARE_SOA_COLUMN(PtPi, ptPi, float); // Pt of the Pi daughter -DECLARE_SOA_COLUMN(PhiPi, phiPi, float); // Phi of the Pi daughter -DECLARE_SOA_COLUMN(EtaPi, etaPi, float); // Eta of the Pi daughter -DECLARE_SOA_COLUMN(XPrimVtx, xPrimVtx, float); // Decay vertex of the candidate (x direction) -DECLARE_SOA_COLUMN(YPrimVtx, yPrimVtx, float); // Decay vertex of the candidate (y direction) -DECLARE_SOA_COLUMN(ZPrimVtx, zPrimVtx, float); // Decay vertex of the candidate (z direction) -DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); // Decay vertex of the candidate (x direction) -DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); // Decay vertex of the candidate (y direction) -DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); // Decay vertex of the candidate (z direction) -DECLARE_SOA_COLUMN(MassH3L, massH3L, float); // Squared mass w/ hypertriton mass hypo -DECLARE_SOA_COLUMN(MassH4L, massH4L, float); // Squared mass w/ H4L mass hypo -DECLARE_SOA_COLUMN(DcaV0Daug, dcaV0Daug, float); // DCA between daughters -DECLARE_SOA_COLUMN(CosPA, cosPA, double); // Cosine of the pointing angle -DECLARE_SOA_COLUMN(NSigmaHe, nSigmaHe, float); // Number of sigmas of the He daughter -DECLARE_SOA_COLUMN(NTPCclusHe, nTPCclusHe, uint8_t); // Number of TPC clusters of the He daughter -DECLARE_SOA_COLUMN(NTPCclusPi, nTPCclusPi, uint8_t); // Number of TPC clusters of the Pi daughter -DECLARE_SOA_COLUMN(TPCsignalHe, tpcSignalHe, uint16_t); // TPC signal of the He daughter -DECLARE_SOA_COLUMN(TPCsignalPi, tpcSignalPi, uint16_t); // TPC signal of the Pi daughter -DECLARE_SOA_COLUMN(TPCChi2He, tpcChi2He, float); // TPC chi2 of the He daughter -DECLARE_SOA_COLUMN(TrackedClSize, trackedClSize, int); // int: zero for non-tracked candidates -DECLARE_SOA_COLUMN(Flags, flags, uint8_t); // Flags for PID in tracking (bits [0, 3] for negative daughter, [4,7] for positive daughter) -DECLARE_SOA_COLUMN(TPCmomHe, tpcMomHe, float); // TPC momentum of the He daughter -DECLARE_SOA_COLUMN(TPCmomPi, tpcMomPi, float); // TPC momentum of the Pi daughter -DECLARE_SOA_COLUMN(ITSclusterSizesHe, itsClusterSizesHe, uint32_t); // ITS cluster size of the He daughter -DECLARE_SOA_COLUMN(ITSclusterSizesPi, itsClusterSizesPi, uint32_t); // ITS cluster size of the Pi daughter +DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter +DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter +DECLARE_SOA_COLUMN(PhiHe3, phiHe3, float); // Phi of the He daughter +DECLARE_SOA_COLUMN(EtaHe3, etaHe3, float); // Eta of the He daughter +DECLARE_SOA_COLUMN(PtPi, ptPi, float); // Pt of the Pi daughter +DECLARE_SOA_COLUMN(PhiPi, phiPi, float); // Phi of the Pi daughter +DECLARE_SOA_COLUMN(EtaPi, etaPi, float); // Eta of the Pi daughter +DECLARE_SOA_COLUMN(XPrimVtx, xPrimVtx, float); // Decay vertex of the candidate (x direction) +DECLARE_SOA_COLUMN(YPrimVtx, yPrimVtx, float); // Decay vertex of the candidate (y direction) +DECLARE_SOA_COLUMN(ZPrimVtx, zPrimVtx, float); // Decay vertex of the candidate (z direction) +DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); // Decay vertex of the candidate (x direction) +DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); // Decay vertex of the candidate (y direction) +DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); // Decay vertex of the candidate (z direction) +DECLARE_SOA_COLUMN(MassH3L, massH3L, float); // Squared mass w/ hypertriton mass hypo +DECLARE_SOA_COLUMN(MassH4L, massH4L, float); // Squared mass w/ H4L mass hypo +DECLARE_SOA_COLUMN(DcaV0Daug, dcaV0Daug, float); // DCA between daughters +DECLARE_SOA_COLUMN(CosPA, cosPA, double); // Cosine of the pointing angle +DECLARE_SOA_COLUMN(NSigmaHe, nSigmaHe, float); // Number of sigmas of the He daughter +DECLARE_SOA_COLUMN(NTPCclusHe, nTPCclusHe, uint8_t); // Number of TPC clusters of the He daughter +DECLARE_SOA_COLUMN(NTPCclusPi, nTPCclusPi, uint8_t); // Number of TPC clusters of the Pi daughter +DECLARE_SOA_COLUMN(TPCsignalHe, tpcSignalHe, uint16_t); // TPC signal of the He daughter +DECLARE_SOA_COLUMN(TPCsignalPi, tpcSignalPi, uint16_t); // TPC signal of the Pi daughter +DECLARE_SOA_COLUMN(TPCChi2He, tpcChi2He, float); // TPC chi2 of the He daughter +DECLARE_SOA_COLUMN(TrackedClSize, trackedClSize, int); // int: zero for non-tracked candidates +DECLARE_SOA_COLUMN(Flags, flags, uint8_t); // Flags for PID in tracking (bits [0, 3] for negative daughter, [4,7] for positive daughter) +DECLARE_SOA_COLUMN(TPCmomHe, tpcMomHe, float); // TPC momentum of the He daughter +DECLARE_SOA_COLUMN(TPCmomPi, tpcMomPi, float); // TPC momentum of the Pi daughter +DECLARE_SOA_COLUMN(TOFMass, tofMass, float); // TOF mass of the candidate +DECLARE_SOA_COLUMN(ITSclusterSizesHe, itsClusterSizesHe, uint32_t); // ITS cluster size of the He daughter +DECLARE_SOA_COLUMN(ITSclusterSizesPi, itsClusterSizesPi, uint32_t); // ITS cluster size of the Pi daughter DECLARE_SOA_COLUMN(ITSclusterSizesHyp, itsClusterSizesHyp, uint32_t); // ITS cluster size of the Pi daughter -DECLARE_SOA_COLUMN(DcaHe, dcaHe, float); // DCA between He daughter and V0 -DECLARE_SOA_COLUMN(DcaPi, dcaPi, float); // DCA between pi daughter and V0 -DECLARE_SOA_COLUMN(GenPt, genPt, float); // Pt of the hypertriton -DECLARE_SOA_COLUMN(GenPhi, genPhi, float); // Phi of the hypertriton -DECLARE_SOA_COLUMN(GenEta, genEta, float); // Eta of the hypertriton -DECLARE_SOA_COLUMN(GenPtHe3, genPtHe3, float); // Pt of the He daughter (to be used for the recalibration) -DECLARE_SOA_COLUMN(GenXDecVtx, genXDecVtx, float); // Decay vertex of the candidate (x direction) -DECLARE_SOA_COLUMN(GenYDecVtx, genYDecVtx, float); // Decay vertex of the candidate (y direction) -DECLARE_SOA_COLUMN(GenZDecVtx, genZDecVtx, float); // Decay vertex of the candidate (z direction) -DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: true for reco -DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal -DECLARE_SOA_COLUMN(IsRecoMCCollision, isRecoMCCollision, bool); // bool: true for reco MC collision -DECLARE_SOA_COLUMN(IsSurvEvSel, isSurvEvSel, bool); // bool: true for survived event selection +DECLARE_SOA_COLUMN(DcaHe, dcaHe, float); // DCA between He daughter and V0 +DECLARE_SOA_COLUMN(DcaPi, dcaPi, float); // DCA between pi daughter and V0 +DECLARE_SOA_COLUMN(GenPt, genPt, float); // Pt of the hypertriton +DECLARE_SOA_COLUMN(GenPhi, genPhi, float); // Phi of the hypertriton +DECLARE_SOA_COLUMN(GenEta, genEta, float); // Eta of the hypertriton +DECLARE_SOA_COLUMN(GenPtHe3, genPtHe3, float); // Pt of the He daughter (to be used for the recalibration) +DECLARE_SOA_COLUMN(GenXDecVtx, genXDecVtx, float); // Decay vertex of the candidate (x direction) +DECLARE_SOA_COLUMN(GenYDecVtx, genYDecVtx, float); // Decay vertex of the candidate (y direction) +DECLARE_SOA_COLUMN(GenZDecVtx, genZDecVtx, float); // Decay vertex of the candidate (z direction) +DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: true for reco +DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal +DECLARE_SOA_COLUMN(IsRecoMCCollision, isRecoMCCollision, bool); // bool: true for reco MC collision +DECLARE_SOA_COLUMN(IsSurvEvSel, isSurvEvSel, bool); // bool: true for survived event selection } // namespace hyperrec DECLARE_SOA_TABLE(DataHypCands, "AOD", "HYPCANDS", @@ -91,6 +92,7 @@ DECLARE_SOA_TABLE(DataHypCands, "AOD", "HYPCANDS", hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, + hyperrec::TOFMass, hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags, hyperrec::TrackedClSize); @@ -109,6 +111,7 @@ DECLARE_SOA_TABLE(DataHypCandsFlow, "AOD", "HYPCANDSFLOW", hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, + hyperrec::TOFMass, hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags, hyperrec::TrackedClSize); @@ -124,6 +127,7 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, + hyperrec::TOFMass, hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags, hyperrec::TrackedClSize, hyperrec::GenPt, diff --git a/PWGLF/DataModel/LFLithium4Tables.h b/PWGLF/DataModel/LFLithium4Tables.h index 1e65ffcf23b..486e44575ee 100644 --- a/PWGLF/DataModel/LFLithium4Tables.h +++ b/PWGLF/DataModel/LFLithium4Tables.h @@ -69,6 +69,10 @@ DECLARE_SOA_COLUMN(PhiMCPr, phiMCPr, float); DECLARE_SOA_COLUMN(SignedPtMC, signedPtMC, float); DECLARE_SOA_COLUMN(MassMC, massMC, float); +DECLARE_SOA_COLUMN(Multiplicity, multiplicity, uint16_t); +DECLARE_SOA_COLUMN(CentralityFT0C, centFT0C, float); +DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0C, float); + } // namespace Lithium4TablesNS DECLARE_SOA_TABLE(Lithium4Table, "AOD", "LITHIUM4TABLE", @@ -102,35 +106,6 @@ DECLARE_SOA_TABLE(Lithium4Table, "AOD", "LITHIUM4TABLE", Lithium4TablesNS::IsBkgLS, Lithium4TablesNS::IsBkgEM) DECLARE_SOA_TABLE(Lithium4TableMC, "AOD", "LITHIUM4TABLEMC", - Lithium4TablesNS::PtHe3, - Lithium4TablesNS::EtaHe3, - Lithium4TablesNS::PhiHe3, - Lithium4TablesNS::PtPr, - Lithium4TablesNS::EtaPr, - Lithium4TablesNS::PhiPr, - Lithium4TablesNS::DCAxyHe3, - Lithium4TablesNS::DCAzHe3, - Lithium4TablesNS::DCAxyPr, - Lithium4TablesNS::DCAzPr, - Lithium4TablesNS::SignalTPCHe3, - Lithium4TablesNS::InnerParamTPCHe3, - Lithium4TablesNS::SignalTPCPr, - Lithium4TablesNS::InnerParamTPCPr, - Lithium4TablesNS::NClsTPCHe3, - Lithium4TablesNS::NSigmaTPCHe3, - Lithium4TablesNS::NSigmaTPCPr, - Lithium4TablesNS::Chi2TPCHe3, - Lithium4TablesNS::Chi2TPCPr, - Lithium4TablesNS::MassTOFHe3, - Lithium4TablesNS::MassTOFPr, - Lithium4TablesNS::PIDtrkHe3, - Lithium4TablesNS::PIDtrkPr, - Lithium4TablesNS::ItsClusterSizeHe3, - Lithium4TablesNS::ItsClusterSizePr, - Lithium4TablesNS::SharedClustersHe3, - Lithium4TablesNS::SharedClustersPr, - Lithium4TablesNS::IsBkgLS, - Lithium4TablesNS::IsBkgEM, Lithium4TablesNS::PtMCHe3, Lithium4TablesNS::EtaMCHe3, Lithium4TablesNS::PhiMCHe3, @@ -139,6 +114,10 @@ DECLARE_SOA_TABLE(Lithium4TableMC, "AOD", "LITHIUM4TABLEMC", Lithium4TablesNS::PhiMCPr, Lithium4TablesNS::SignedPtMC, Lithium4TablesNS::MassMC) +DECLARE_SOA_TABLE(Lithium4Mult, "AOD", "LITHIUM4MULT", + Lithium4TablesNS::Multiplicity, + Lithium4TablesNS::CentralityFT0C, + Lithium4TablesNS::MultiplicityFT0C) } // namespace o2::aod diff --git a/PWGLF/DataModel/LFNonPromptCascadeTables.h b/PWGLF/DataModel/LFNonPromptCascadeTables.h index 4bdca4b9c97..aa1a3cdb867 100644 --- a/PWGLF/DataModel/LFNonPromptCascadeTables.h +++ b/PWGLF/DataModel/LFNonPromptCascadeTables.h @@ -25,10 +25,13 @@ namespace o2::aod namespace NPCascadeTable { DECLARE_SOA_COLUMN(MatchingChi2, matchingChi2, float); +DECLARE_SOA_COLUMN(DeltaPtITSCascade, deltaPtITSCascade, float); DECLARE_SOA_COLUMN(ITSClusSize, itsClusSize, float); +DECLARE_SOA_COLUMN(HasReassociatedCluster, hasReassociatedCluster, bool); DECLARE_SOA_COLUMN(IsGoodMatch, isGoodMatch, bool); DECLARE_SOA_COLUMN(IsGoodCascade, isGoodCascade, bool); DECLARE_SOA_COLUMN(PdgCodeMom, pdgCodeMom, int); +DECLARE_SOA_COLUMN(PdgCodeITStrack, pdgCodeITStrack, int); DECLARE_SOA_COLUMN(IsFromBeauty, isFromBeauty, bool); DECLARE_SOA_COLUMN(IsFromCharm, isFromCharm, bool); @@ -107,7 +110,9 @@ DECLARE_SOA_COLUMN(MCcollisionMatch, mcCollisionMatch, bool); } // namespace NPCascadeTable DECLARE_SOA_TABLE(NPCascTable, "AOD", "NPCASCTABLE", NPCascadeTable::MatchingChi2, + NPCascadeTable::DeltaPtITSCascade, NPCascadeTable::ITSClusSize, + NPCascadeTable::HasReassociatedCluster, NPCascadeTable::PvX, NPCascadeTable::PvY, NPCascadeTable::PvZ, @@ -161,10 +166,13 @@ DECLARE_SOA_TABLE(NPCascTable, "AOD", "NPCASCTABLE", DECLARE_SOA_TABLE(NPCascTableMC, "AOD", "NPCASCTABLEMC", NPCascadeTable::MatchingChi2, + NPCascadeTable::DeltaPtITSCascade, NPCascadeTable::ITSClusSize, + NPCascadeTable::HasReassociatedCluster, NPCascadeTable::IsGoodMatch, NPCascadeTable::IsGoodCascade, NPCascadeTable::PdgCodeMom, + NPCascadeTable::PdgCodeITStrack, NPCascadeTable::IsFromBeauty, NPCascadeTable::IsFromCharm, NPCascadeTable::PvX, diff --git a/PWGLF/DataModel/LFNucleiTables.h b/PWGLF/DataModel/LFNucleiTables.h index dd7b72abb67..2fcd940d070 100644 --- a/PWGLF/DataModel/LFNucleiTables.h +++ b/PWGLF/DataModel/LFNucleiTables.h @@ -185,44 +185,44 @@ DECLARE_SOA_TABLE(LfCandNucleus, "AOD", "LFNUCL", track::TPCNClsCrossedRows, track::TPCCrossedRowsOverFindableCls, track::TPCFoundOverFindableCls); -DECLARE_SOA_TABLE_FULL(LfCandNucleusDummy, "LfCandNucleus", "AOD", "LFNUCL", - o2::soa::Index<>, - full::LfNuclEventId, - full::DcaXY, full::DcaZ, - full::TPCNSigmaDe, full::TPCNSigmaHe, - full::TOFNSigmaDe, full::TOFNSigmaHe, - full::IsEvTimeTOF, - full::IsEvTimeT0AC, - full::HasTOF, - full::HasTRD, - full::TPCInnerParam, - full::Beta, - full::TPCSignal, - full::Pt, - full::Eta, - full::Phi, - full::Sign, - full::ITSNCls, - track::TPCNClsFindable, - track::TPCNClsFindableMinusFound, - track::TPCNClsFindableMinusCrossedRows, - full::TPCChi2Ncl, - full::ITSChi2NCl, - track::ITSClusterMap, - full::IsPVContributor, - full::P, - dummy::TPCNSigmaPi, dummy::TPCNSigmaKa, dummy::TPCNSigmaPr, - dummy::TPCNSigmaTr, dummy::TPCNSigmaAl, - dummy::TOFNSigmaPi, dummy::TOFNSigmaKa, dummy::TOFNSigmaPr, - dummy::TOFNSigmaTr, dummy::TOFNSigmaAl, - dummy::TPCExpSignalDiffPr, dummy::TPCExpSignalDiffDe, dummy::TPCExpSignalDiffHe, - dummy::TOFExpSignalDiffPr, dummy::TOFExpSignalDiffDe, dummy::TOFExpSignalDiffHe, - dummy::TOFExpMom, - full::Rapidity, - track::TPCNClsFound, - track::TPCNClsCrossedRows, - track::TPCCrossedRowsOverFindableCls, - track::TPCFoundOverFindableCls); +DECLARE_SOA_TABLE_VERSIONED(LfCandNucleusDummy, "AOD", "LFNUCL", 1, + o2::soa::Index<>, + full::LfNuclEventId, + full::DcaXY, full::DcaZ, + full::TPCNSigmaDe, full::TPCNSigmaHe, + full::TOFNSigmaDe, full::TOFNSigmaHe, + full::IsEvTimeTOF, + full::IsEvTimeT0AC, + full::HasTOF, + full::HasTRD, + full::TPCInnerParam, + full::Beta, + full::TPCSignal, + full::Pt, + full::Eta, + full::Phi, + full::Sign, + full::ITSNCls, + track::TPCNClsFindable, + track::TPCNClsFindableMinusFound, + track::TPCNClsFindableMinusCrossedRows, + full::TPCChi2Ncl, + full::ITSChi2NCl, + track::ITSClusterMap, + full::IsPVContributor, + full::P, + dummy::TPCNSigmaPi, dummy::TPCNSigmaKa, dummy::TPCNSigmaPr, + dummy::TPCNSigmaTr, dummy::TPCNSigmaAl, + dummy::TOFNSigmaPi, dummy::TOFNSigmaKa, dummy::TOFNSigmaPr, + dummy::TOFNSigmaTr, dummy::TOFNSigmaAl, + dummy::TPCExpSignalDiffPr, dummy::TPCExpSignalDiffDe, dummy::TPCExpSignalDiffHe, + dummy::TOFExpSignalDiffPr, dummy::TOFExpSignalDiffDe, dummy::TOFExpSignalDiffHe, + dummy::TOFExpMom, + full::Rapidity, + track::TPCNClsFound, + track::TPCNClsCrossedRows, + track::TPCCrossedRowsOverFindableCls, + track::TPCFoundOverFindableCls); DECLARE_SOA_TABLE(LfCandNucleusExtra, "AOD", "LFNUCLEXTRA", full::TPCNSigmaPi, full::TPCNSigmaKa, full::TPCNSigmaPr, diff --git a/PWGLF/DataModel/LFResonanceTables.h b/PWGLF/DataModel/LFResonanceTables.h index 7394c1714b1..b72dd1e745f 100644 --- a/PWGLF/DataModel/LFResonanceTables.h +++ b/PWGLF/DataModel/LFResonanceTables.h @@ -53,13 +53,14 @@ enum { kAllCutsINELg010, kECend, }; -DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality (Multiplicity) percentile (Default: FT0M) -DECLARE_SOA_COLUMN(Spherocity, spherocity, float); //! Spherocity of the event -DECLARE_SOA_COLUMN(EvtPl, evtPl, float); //! Second harmonic event plane -DECLARE_SOA_COLUMN(EvtPlResAB, evtPlResAB, float); //! Second harmonic event plane resolution of A-B sub events -DECLARE_SOA_COLUMN(EvtPlResAC, evtPlResAC, float); //! Second harmonic event plane resolution of A-C sub events -DECLARE_SOA_COLUMN(EvtPlResBC, evtPlResBC, float); //! Second harmonic event plane resolution of B-C sub events -DECLARE_SOA_COLUMN(BMagField, bMagField, float); //! Magnetic field +DECLARE_SOA_INDEX_COLUMN_FULL(Collision, collision, int, Collisions, "_Col"); //! +DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality (Multiplicity) percentile (Default: FT0M) +DECLARE_SOA_COLUMN(Spherocity, spherocity, float); //! Spherocity of the event +DECLARE_SOA_COLUMN(EvtPl, evtPl, float); //! Second harmonic event plane +DECLARE_SOA_COLUMN(EvtPlResAB, evtPlResAB, float); //! Second harmonic event plane resolution of A-B sub events +DECLARE_SOA_COLUMN(EvtPlResAC, evtPlResAC, float); //! Second harmonic event plane resolution of A-C sub events +DECLARE_SOA_COLUMN(EvtPlResBC, evtPlResBC, float); //! Second harmonic event plane resolution of B-C sub events +DECLARE_SOA_COLUMN(BMagField, bMagField, float); //! Magnetic field // MC DECLARE_SOA_COLUMN(IsVtxIn10, isVtxIn10, bool); //! Vtx10 DECLARE_SOA_COLUMN(IsINELgt0, isINELgt0, bool); //! INEL>0 @@ -71,6 +72,7 @@ DECLARE_SOA_COLUMN(ImpactParameter, impactParameter, float); //! ImpactParamete } // namespace resocollision DECLARE_SOA_TABLE(ResoCollisions, "AOD", "RESOCOLLISION", o2::soa::Index<>, + resocollision::CollisionId, o2::aod::mult::MultNTracksPV, collision::PosX, collision::PosY, @@ -87,6 +89,7 @@ DECLARE_SOA_TABLE(ResoCollisions, "AOD", "RESOCOLLISION", using ResoCollision = ResoCollisions::iterator; DECLARE_SOA_TABLE(ResoMCCollisions, "AOD", "RESOMCCOL", + o2::soa::Index<>, resocollision::IsVtxIn10, resocollision::IsINELgt0, resocollision::IsTriggerTVX, @@ -95,64 +98,101 @@ DECLARE_SOA_TABLE(ResoMCCollisions, "AOD", "RESOMCCOL", resocollision::ImpactParameter); using ResoMCCollision = ResoMCCollisions::iterator; +DECLARE_SOA_TABLE(ResoSpheroCollisions, "AOD", "RESOSPHEROCOLL", + o2::soa::Index<>, + resocollision::CollisionId, + resocollision::Spherocity); +using ResoSpheroCollision = ResoSpheroCollisions::iterator; + +DECLARE_SOA_TABLE(ResoEvtPlCollisions, "AOD", "RESOEVTPLCOLL", + o2::soa::Index<>, + resocollision::CollisionId, + resocollision::EvtPl, + resocollision::EvtPlResAB, + resocollision::EvtPlResAC, + resocollision::EvtPlResBC); +using ResoEvtPlCollision = ResoEvtPlCollisions::iterator; + // Resonance Daughters // inspired from PWGCF/DataModel/FemtoDerived.h namespace resodaughter { DECLARE_SOA_INDEX_COLUMN(ResoCollision, resoCollision); -DECLARE_SOA_COLUMN(Pt, pt, float); //! p_T (GeV/c) -DECLARE_SOA_COLUMN(Px, px, float); //! p_x (GeV/c) -DECLARE_SOA_COLUMN(Py, py, float); //! p_y (GeV/c) -DECLARE_SOA_COLUMN(Pz, pz, float); //! p_z (GeV/c) -DECLARE_SOA_COLUMN(Eta, eta, float); //! Eta -DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi -DECLARE_SOA_COLUMN(PartType, partType, uint8_t); //! Type of the particle, according to resodaughter::ParticleType -DECLARE_SOA_COLUMN(TempFitVar, tempFitVar, float); //! Observable for the template fitting (Track: DCA_xy, V0: CPA) -DECLARE_SOA_COLUMN(Indices, indices, int[2]); //! Field for the track indices to remove auto-correlations -DECLARE_SOA_COLUMN(CascadeIndices, cascIndices, int[3]); //! Field for the track indices to remove auto-correlations (ordered: positive, negative, bachelor) -DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of the track charge -DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //! Number of TPC crossed rows -DECLARE_SOA_COLUMN(TPCNClsFound, tpcNClsFound, uint8_t); //! Number of TPC clusters found -DECLARE_SOA_COLUMN(ITSNCls, itsNCls, uint8_t); //! Number of ITS clusters found -DECLARE_SOA_COLUMN(IsGlobalTrackWoDCA, isGlobalTrackWoDCA, bool); //! Is global track without DCA -DECLARE_SOA_COLUMN(IsGlobalTrack, isGlobalTrack, bool); //! Is global track -DECLARE_SOA_COLUMN(IsPrimaryTrack, isPrimaryTrack, bool); //! Is primary track -DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! Is primary vertex contributor -DECLARE_SOA_COLUMN(HasITS, hasITS, bool); //! Has ITS -DECLARE_SOA_COLUMN(HasTPC, hasTPC, bool); //! Has TPC -DECLARE_SOA_COLUMN(HasTOF, hasTOF, bool); //! Has TOF +DECLARE_SOA_INDEX_COLUMN_FULL(Track, track, int, Tracks, "_Trk"); //! +DECLARE_SOA_INDEX_COLUMN_FULL(V0, v0, int, V0s, "_V0"); //! +DECLARE_SOA_INDEX_COLUMN_FULL(Cascade, cascade, int, Cascades, "_Cas"); //! +DECLARE_SOA_COLUMN(Pt, pt, float); //! p_T (GeV/c) +DECLARE_SOA_COLUMN(Px, px, float); //! p_x (GeV/c) +DECLARE_SOA_COLUMN(Py, py, float); //! p_y (GeV/c) +DECLARE_SOA_COLUMN(Pz, pz, float); //! p_z (GeV/c) +DECLARE_SOA_COLUMN(Eta, eta, float); //! Eta +DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi +DECLARE_SOA_COLUMN(PartType, partType, uint8_t); //! Type of the particle, according to resodaughter::ParticleType +DECLARE_SOA_COLUMN(TempFitVar, tempFitVar, float); //! Observable for the template fitting (Track: DCA_xy, V0: CPA) +DECLARE_SOA_COLUMN(Indices, indices, int[2]); //! Field for the track indices to remove auto-correlations +DECLARE_SOA_COLUMN(CascadeIndices, cascadeIndices, int[3]); //! Field for the track indices to remove auto-correlations (ordered: positive, negative, bachelor) +DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of the track charge +DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //! Number of TPC crossed rows +DECLARE_SOA_COLUMN(TPCNClsFound, tpcNClsFound, uint8_t); //! Number of TPC clusters found +DECLARE_SOA_COLUMN(ITSNCls, itsNCls, uint8_t); //! Number of ITS clusters found +DECLARE_SOA_COLUMN(IsGlobalTrackWoDCA, isGlobalTrackWoDCA, bool); //! Is global track without DCA +DECLARE_SOA_COLUMN(IsGlobalTrack, isGlobalTrack, bool); //! Is global track +DECLARE_SOA_COLUMN(IsPrimaryTrack, isPrimaryTrack, bool); //! Is primary track +DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! Is primary vertex contributor +DECLARE_SOA_COLUMN(HasITS, hasITS, bool); //! Has ITS +DECLARE_SOA_COLUMN(HasTPC, hasTPC, bool); //! Has TPC +DECLARE_SOA_COLUMN(HasTOF, hasTOF, bool); //! Has TOF DECLARE_SOA_COLUMN(TPCCrossedRowsOverFindableCls, tpcCrossedRowsOverFindableCls, float); -DECLARE_SOA_COLUMN(DaughDCA, daughDCA, float); //! DCA between daughters -DECLARE_SOA_COLUMN(CascDaughDCA, cascdaughDCA, float); //! DCA between daughters from cascade -DECLARE_SOA_COLUMN(V0CosPA, v0CosPA, float); //! V0 Cosine of Pointing Angle -DECLARE_SOA_COLUMN(CascCosPA, cascCosPA, float); //! Cascade Cosine of Pointing Angle -DECLARE_SOA_COLUMN(MLambda, mLambda, float); //! The invariant mass of V0 candidate, assuming lambda -DECLARE_SOA_COLUMN(MAntiLambda, mAntiLambda, float); //! The invariant mass of V0 candidate, assuming antilambda -DECLARE_SOA_COLUMN(MK0Short, mK0Short, float); //! The invariant mass of V0 candidate, assuming k0s -DECLARE_SOA_COLUMN(MXi, mXi, float); //! The invariant mass of Xi candidate -DECLARE_SOA_COLUMN(TransRadius, transRadius, float); //! Transverse radius of the decay vertex -DECLARE_SOA_COLUMN(CascTransRadius, casctransRadius, float); //! Transverse radius of the decay vertex from cascade -DECLARE_SOA_COLUMN(DecayVtxX, decayVtxX, float); //! X position of the decay vertex -DECLARE_SOA_COLUMN(DecayVtxY, decayVtxY, float); //! Y position of the decay vertex -DECLARE_SOA_COLUMN(DecayVtxZ, decayVtxZ, float); //! Z position of the decay vertex +DECLARE_SOA_COLUMN(DaughDCA, daughDCA, float); //! DCA between daughters +DECLARE_SOA_COLUMN(CascDaughDCA, cascDaughDCA, float); //! DCA between daughters from cascade +DECLARE_SOA_COLUMN(V0CosPA, v0CosPA, float); //! V0 Cosine of Pointing Angle +DECLARE_SOA_COLUMN(CascCosPA, cascCosPA, float); //! Cascade Cosine of Pointing Angle +DECLARE_SOA_COLUMN(MLambda, mLambda, float); //! The invariant mass of V0 candidate, assuming lambda +DECLARE_SOA_COLUMN(MAntiLambda, mAntiLambda, float); //! The invariant mass of V0 candidate, assuming antilambda +DECLARE_SOA_COLUMN(MK0Short, mK0Short, float); //! The invariant mass of V0 candidate, assuming k0s +DECLARE_SOA_COLUMN(MXi, mXi, float); //! The invariant mass of Xi candidate +DECLARE_SOA_COLUMN(TransRadius, transRadius, float); //! Transverse radius of the decay vertex +DECLARE_SOA_COLUMN(CascTransRadius, cascTransRadius, float); //! Transverse radius of the decay vertex from cascade +DECLARE_SOA_COLUMN(DecayVtxX, decayVtxX, float); //! X position of the decay vertex +DECLARE_SOA_COLUMN(DecayVtxY, decayVtxY, float); //! Y position of the decay vertex +DECLARE_SOA_COLUMN(DecayVtxZ, decayVtxZ, float); //! Z position of the decay vertex +DECLARE_SOA_COLUMN(DaughterTPCNSigmaPosPi, daughterTPCNSigmaPosPi, float); //! TPC PID of the positive daughter as Pion +DECLARE_SOA_COLUMN(DaughterTPCNSigmaPosKa, daughterTPCNSigmaPosKa, float); //! TPC PID of the positive daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTPCNSigmaPosPr, daughterTPCNSigmaPosPr, float); //! TPC PID of the positive daughter as Proton +DECLARE_SOA_COLUMN(DaughterTPCNSigmaNegPi, daughterTPCNSigmaNegPi, float); //! TPC PID of the negative daughter as Pion +DECLARE_SOA_COLUMN(DaughterTPCNSigmaNegKa, daughterTPCNSigmaNegKa, float); //! TPC PID of the negative daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTPCNSigmaNegPr, daughterTPCNSigmaNegPr, float); //! TPC PID of the negative daughter as Proton +DECLARE_SOA_COLUMN(DaughterTPCNSigmaBachPi, daughterTPCNSigmaBachPi, float); //! TPC PID of the bachelor daughter as Pion +DECLARE_SOA_COLUMN(DaughterTPCNSigmaBachKa, daughterTPCNSigmaBachKa, float); //! TPC PID of the bachelor daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTPCNSigmaBachPr, daughterTPCNSigmaBachPr, float); //! TPC PID of the bachelor daughter as Proton +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPosPi, daughterTOFNSigmaPosPi, float); //! TOF PID of the positive daughter as Pion +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPosKa, daughterTOFNSigmaPosKa, float); //! TOF PID of the positive daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPosPr, daughterTOFNSigmaPosPr, float); //! TOF PID of the positive daughter as Proton +DECLARE_SOA_COLUMN(DaughterTOFNSigmaNegPi, daughterTOFNSigmaNegPi, float); //! TOF PID of the negative daughter as Pion +DECLARE_SOA_COLUMN(DaughterTOFNSigmaNegKa, daughterTOFNSigmaNegKa, float); //! TOF PID of the negative daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTOFNSigmaNegPr, daughterTOFNSigmaNegPr, float); //! TOF PID of the negative daughter as Proton +DECLARE_SOA_COLUMN(DaughterTOFNSigmaBachPi, daughterTOFNSigmaBachPi, float); //! TOF PID of the bachelor daughter as Pion +DECLARE_SOA_COLUMN(DaughterTOFNSigmaBachKa, daughterTOFNSigmaBachKa, float); //! TOF PID of the bachelor daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTOFNSigmaBachPr, daughterTOFNSigmaBachPr, float); //! TOF PID of the bachelor daughter as Proton // For MC DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! Index of the corresponding MC particle DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); DECLARE_SOA_COLUMN(ProducedByGenerator, producedByGenerator, bool); -DECLARE_SOA_COLUMN(MothersId, motherId, int); //! Id of the mother particle +DECLARE_SOA_COLUMN(MotherId, motherId, int); //! Id of the mother particle DECLARE_SOA_COLUMN(MotherPDG, motherPDG, int); //! PDG code of the mother particle DECLARE_SOA_COLUMN(DaughterPDG1, daughterPDG1, int); //! PDG code of the first Daughter particle DECLARE_SOA_COLUMN(DaughterPDG2, daughterPDG2, int); //! PDG code of the second Daughter particle -DECLARE_SOA_COLUMN(DaughterID1, daughterId1, int); //! Id of the first Daughter particle -DECLARE_SOA_COLUMN(DaughterID2, daughterId2, int); //! Id of the second Daughter particle +DECLARE_SOA_COLUMN(DaughterID1, daughterID1, int); //! Id of the first Daughter particle +DECLARE_SOA_COLUMN(DaughterID2, daughterID2, int); //! Id of the second Daughter particle DECLARE_SOA_COLUMN(SiblingIds, siblingIds, int[2]); //! Index of the particles with the same mother -DECLARE_SOA_COLUMN(BachTrkID, bachtrkID, int); //! Id of the bach track from cascade +DECLARE_SOA_COLUMN(BachTrkID, bachTrkID, int); //! Id of the bach track from cascade DECLARE_SOA_COLUMN(V0ID, v0ID, int); //! Id of the V0 from cascade } // namespace resodaughter DECLARE_SOA_TABLE(ResoTracks, "AOD", "RESOTRACKS", o2::soa::Index<>, resodaughter::ResoCollisionId, + resodaughter::TrackId, resodaughter::Pt, resodaughter::Px, resodaughter::Py, @@ -193,6 +233,7 @@ using ResoTrack = ResoTracks::iterator; DECLARE_SOA_TABLE(ResoV0s, "AOD", "RESOV0S", o2::soa::Index<>, resodaughter::ResoCollisionId, + resodaughter::V0Id, resodaughter::Pt, resodaughter::Px, resodaughter::Py, @@ -200,6 +241,18 @@ DECLARE_SOA_TABLE(ResoV0s, "AOD", "RESOV0S", resodaughter::Eta, resodaughter::Phi, resodaughter::Indices, + resodaughter::DaughterTPCNSigmaPosPi, + resodaughter::DaughterTPCNSigmaPosKa, + resodaughter::DaughterTPCNSigmaPosPr, + resodaughter::DaughterTPCNSigmaNegPi, + resodaughter::DaughterTPCNSigmaNegKa, + resodaughter::DaughterTPCNSigmaNegPr, + resodaughter::DaughterTOFNSigmaPosPi, + resodaughter::DaughterTOFNSigmaPosKa, + resodaughter::DaughterTOFNSigmaPosPr, + resodaughter::DaughterTOFNSigmaNegPi, + resodaughter::DaughterTOFNSigmaNegKa, + resodaughter::DaughterTOFNSigmaNegPr, resodaughter::V0CosPA, resodaughter::DaughDCA, v0data::DCAPosToPV, @@ -217,6 +270,7 @@ using ResoV0 = ResoV0s::iterator; DECLARE_SOA_TABLE(ResoCascades, "AOD", "RESOCASCADES", o2::soa::Index<>, resodaughter::ResoCollisionId, + resodaughter::CascadeId, resodaughter::Pt, resodaughter::Px, resodaughter::Py, @@ -224,6 +278,24 @@ DECLARE_SOA_TABLE(ResoCascades, "AOD", "RESOCASCADES", resodaughter::Eta, resodaughter::Phi, resodaughter::CascadeIndices, + resodaughter::DaughterTPCNSigmaPosPi, + resodaughter::DaughterTPCNSigmaPosKa, + resodaughter::DaughterTPCNSigmaPosPr, + resodaughter::DaughterTPCNSigmaNegPi, + resodaughter::DaughterTPCNSigmaNegKa, + resodaughter::DaughterTPCNSigmaNegPr, + resodaughter::DaughterTPCNSigmaBachPi, + resodaughter::DaughterTPCNSigmaBachKa, + resodaughter::DaughterTPCNSigmaBachPr, + resodaughter::DaughterTOFNSigmaPosPi, + resodaughter::DaughterTOFNSigmaPosKa, + resodaughter::DaughterTOFNSigmaPosPr, + resodaughter::DaughterTOFNSigmaNegPi, + resodaughter::DaughterTOFNSigmaNegKa, + resodaughter::DaughterTOFNSigmaNegPr, + resodaughter::DaughterTOFNSigmaBachPi, + resodaughter::DaughterTOFNSigmaBachKa, + resodaughter::DaughterTOFNSigmaBachPr, resodaughter::V0CosPA, resodaughter::CascCosPA, resodaughter::DaughDCA, @@ -245,7 +317,7 @@ using ResoCascade = ResoCascades::iterator; DECLARE_SOA_TABLE(ResoMCTracks, "AOD", "RESOMCTRACKS", mcparticle::PdgCode, - resodaughter::MothersId, + resodaughter::MotherId, resodaughter::MotherPDG, resodaughter::SiblingIds, resodaughter::IsPhysicalPrimary, @@ -254,7 +326,7 @@ using ResoMCTrack = ResoMCTracks::iterator; DECLARE_SOA_TABLE(ResoMCV0s, "AOD", "RESOMCV0S", mcparticle::PdgCode, - resodaughter::MothersId, + resodaughter::MotherId, resodaughter::MotherPDG, resodaughter::DaughterID1, resodaughter::DaughterID2, @@ -266,7 +338,7 @@ using ResoMCV0 = ResoMCV0s::iterator; DECLARE_SOA_TABLE(ResoMCCascades, "AOD", "RESOMCCASCADES", mcparticle::PdgCode, - resodaughter::MothersId, + resodaughter::MotherId, resodaughter::MotherPDG, resodaughter::BachTrkID, resodaughter::V0ID, @@ -291,7 +363,9 @@ DECLARE_SOA_TABLE(ResoMCParents, "AOD", "RESOMCPARENTS", resodaughter::Pz, resodaughter::Eta, resodaughter::Phi, - mcparticle::Y); + mcparticle::Y, + mcparticle::E, + mcparticle::StatusCode); using ResoMCParent = ResoMCParents::iterator; using Reso2TracksExt = soa::Join; // without Extra @@ -299,5 +373,17 @@ using Reso2TracksMC = soa::Join; using Reso2TracksPID = soa::Join; using Reso2TracksPIDExt = soa::Join; // Without Extra +using ResoCollisionCandidates = soa::Join; +using ResoRun2CollisionCandidates = soa::Join; +using ResoCollisionCandidatesMC = soa::Join; +using ResoRun2CollisionCandidatesMC = soa::Join; +using ResoTrackCandidates = aod::Reso2TracksPIDExt; +using ResoTrackCandidatesMC = soa::Join; +using ResoV0Candidates = aod::V0Datas; +using ResoV0CandidatesMC = soa::Join; +using ResoCascadesCandidates = aod::CascDatas; +using ResoCascadesCandidatesMC = soa::Join; +using BCsWithRun2Info = soa::Join; + } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFRESONANCETABLES_H_ diff --git a/PWGLF/DataModel/LFResonanceTablesMergeDF.h b/PWGLF/DataModel/LFResonanceTablesMergeDF.h index bceb237faff..00ec4741956 100644 --- a/PWGLF/DataModel/LFResonanceTablesMergeDF.h +++ b/PWGLF/DataModel/LFResonanceTablesMergeDF.h @@ -44,6 +44,7 @@ DECLARE_SOA_COLUMN(BMagField, bMagField, float); //! Magnetic field } // namespace resocollisiondf DECLARE_SOA_TABLE(ResoCollisionDFs, "AOD", "RESOCOLLISIONDF", o2::soa::Index<>, + o2::aod::mult::MultNTracksPV, collision::PosX, collision::PosY, collision::PosZ, @@ -54,7 +55,8 @@ DECLARE_SOA_TABLE(ResoCollisionDFs, "AOD", "RESOCOLLISIONDF", resocollisiondf::EvtPlResAC, resocollisiondf::EvtPlResBC, resocollisiondf::BMagField, - timestamp::Timestamp); + timestamp::Timestamp, + evsel::NumTracksInTimeRange); using ResoCollisionDF = ResoCollisionDFs::iterator; // Resonance Daughters diff --git a/PWGLF/DataModel/LFSigmaTables.h b/PWGLF/DataModel/LFSigmaTables.h index 683e752ba33..01ef1354162 100644 --- a/PWGLF/DataModel/LFSigmaTables.h +++ b/PWGLF/DataModel/LFSigmaTables.h @@ -45,12 +45,18 @@ namespace sigma0Core DECLARE_SOA_COLUMN(SigmapT, sigmapT, float); DECLARE_SOA_COLUMN(SigmaMass, sigmaMass, float); DECLARE_SOA_COLUMN(SigmaRapidity, sigmaRapidity, float); +DECLARE_SOA_COLUMN(SigmaOPAngle, sigmaOPAngle, float); +DECLARE_SOA_COLUMN(SigmaDeltaEta, sigmaDeltaEta, float); +DECLARE_SOA_COLUMN(SigmaDeltaPhi, sigmaDeltaPhi, float); } // namespace sigma0Core DECLARE_SOA_TABLE(Sigma0Cores, "AOD", "SIGMA0CORES", sigma0Core::SigmapT, sigma0Core::SigmaMass, - sigma0Core::SigmaRapidity); + sigma0Core::SigmaRapidity, + sigma0Core::SigmaOPAngle, + sigma0Core::SigmaDeltaEta, + sigma0Core::SigmaDeltaPhi); DECLARE_SOA_TABLE(Sigma0CollRefs, "AOD", "SIGMA0COLLREF", //! optional table to refer back to a collision o2::soa::Index<>, sigma0Core::Sigma0CollisionId); @@ -70,6 +76,7 @@ DECLARE_SOA_COLUMN(PhotonDCAPosPV, photonDCAPosPV, float); DECLARE_SOA_COLUMN(PhotonZconv, photonZconv, float); DECLARE_SOA_COLUMN(PhotonEta, photonEta, float); DECLARE_SOA_COLUMN(PhotonY, photonY, float); +DECLARE_SOA_COLUMN(PhotonPhi, photonPhi, float); DECLARE_SOA_COLUMN(PhotonPosTPCNSigma, photonPosTPCNSigma, float); DECLARE_SOA_COLUMN(PhotonNegTPCNSigma, photonNegTPCNSigma, float); DECLARE_SOA_COLUMN(PhotonPosTPCCrossedRows, photonPosTPCCrossedRows, uint8_t); @@ -91,8 +98,8 @@ DECLARE_SOA_COLUMN(GammaBDTScore, gammaBDTScore, float); } // namespace sigmaPhotonExtra DECLARE_SOA_TABLE(SigmaPhotonExtras, "AOD", "SIGMA0PHOTON", - sigmaPhotonExtra::PhotonMass, sigmaPhotonExtra::PhotonPt, + sigmaPhotonExtra::PhotonMass, sigmaPhotonExtra::PhotonQt, sigmaPhotonExtra::PhotonAlpha, sigmaPhotonExtra::PhotonRadius, @@ -103,6 +110,7 @@ DECLARE_SOA_TABLE(SigmaPhotonExtras, "AOD", "SIGMA0PHOTON", sigmaPhotonExtra::PhotonZconv, sigmaPhotonExtra::PhotonEta, sigmaPhotonExtra::PhotonY, + sigmaPhotonExtra::PhotonPhi, sigmaPhotonExtra::PhotonPosTPCNSigma, sigmaPhotonExtra::PhotonNegTPCNSigma, sigmaPhotonExtra::PhotonPosTPCCrossedRows, @@ -136,10 +144,15 @@ DECLARE_SOA_COLUMN(LambdaDCANegPV, lambdaDCANegPV, float); DECLARE_SOA_COLUMN(LambdaDCAPosPV, lambdaDCAPosPV, float); DECLARE_SOA_COLUMN(LambdaEta, lambdaEta, float); DECLARE_SOA_COLUMN(LambdaY, lambdaY, float); +DECLARE_SOA_COLUMN(LambdaPhi, lambdaPhi, float); DECLARE_SOA_COLUMN(LambdaPosPrTPCNSigma, lambdaPosPrTPCNSigma, float); DECLARE_SOA_COLUMN(LambdaPosPiTPCNSigma, lambdaPosPiTPCNSigma, float); DECLARE_SOA_COLUMN(LambdaNegPrTPCNSigma, lambdaNegPrTPCNSigma, float); DECLARE_SOA_COLUMN(LambdaNegPiTPCNSigma, lambdaNegPiTPCNSigma, float); +DECLARE_SOA_COLUMN(LambdaPrTOFNSigma, lambdaPrTOFNSigma, float); +DECLARE_SOA_COLUMN(LambdaPiTOFNSigma, lambdaPiTOFNSigma, float); +DECLARE_SOA_COLUMN(ALambdaPrTOFNSigma, aLambdaPrTOFNSigma, float); +DECLARE_SOA_COLUMN(ALambdaPiTOFNSigma, aLambdaPiTOFNSigma, float); DECLARE_SOA_COLUMN(LambdaPosTPCCrossedRows, lambdaPosTPCCrossedRows, uint8_t); DECLARE_SOA_COLUMN(LambdaNegTPCCrossedRows, lambdaNegTPCCrossedRows, uint8_t); DECLARE_SOA_COLUMN(LambdaPosPt, lambdaPosPt, float); @@ -173,10 +186,15 @@ DECLARE_SOA_TABLE(SigmaLambdaExtras, "AOD", "SIGMA0LAMBDA", sigmaLambdaExtra::LambdaDCAPosPV, sigmaLambdaExtra::LambdaEta, sigmaLambdaExtra::LambdaY, + sigmaLambdaExtra::LambdaPhi, sigmaLambdaExtra::LambdaPosPrTPCNSigma, sigmaLambdaExtra::LambdaPosPiTPCNSigma, sigmaLambdaExtra::LambdaNegPrTPCNSigma, sigmaLambdaExtra::LambdaNegPiTPCNSigma, + sigmaLambdaExtra::LambdaPrTOFNSigma, + sigmaLambdaExtra::LambdaPiTOFNSigma, + sigmaLambdaExtra::ALambdaPrTOFNSigma, + sigmaLambdaExtra::ALambdaPiTOFNSigma, sigmaLambdaExtra::LambdaPosTPCCrossedRows, sigmaLambdaExtra::LambdaNegTPCCrossedRows, sigmaLambdaExtra::LambdaPosPt, @@ -198,14 +216,26 @@ DECLARE_SOA_TABLE(SigmaLambdaExtras, "AOD", "SIGMA0LAMBDA", // for MC data namespace sigmaMCCore { -DECLARE_SOA_COLUMN(IsSigma, isSigma, bool); +DECLARE_SOA_COLUMN(IsSigma, isSigma, bool); // TODO: include PDG + IsPhysicalPrimary DECLARE_SOA_COLUMN(IsAntiSigma, isAntiSigma, bool); +DECLARE_SOA_COLUMN(PhotonCandPDGCode, photonCandPDGCode, int); +DECLARE_SOA_COLUMN(PhotonCandPDGCodeMother, photonCandPDGCodeMother, int); +DECLARE_SOA_COLUMN(IsPhotonCandPrimary, isPhotonCandPrimary, bool); +DECLARE_SOA_COLUMN(LambdaCandPDGCode, lambdaCandPDGCode, int); +DECLARE_SOA_COLUMN(LambdaCandPDGCodeMother, lambdaCandPDGCodeMother, int); +DECLARE_SOA_COLUMN(IsLambdaCandPrimary, isLambdaCandPrimary, bool); } // namespace sigmaMCCore DECLARE_SOA_TABLE(SigmaMCCores, "AOD", "SIGMA0MCCORES", sigmaMCCore::IsSigma, - sigmaMCCore::IsAntiSigma); + sigmaMCCore::IsAntiSigma, + sigmaMCCore::PhotonCandPDGCode, + sigmaMCCore::PhotonCandPDGCodeMother, + sigmaMCCore::IsPhotonCandPrimary, + sigmaMCCore::LambdaCandPDGCode, + sigmaMCCore::LambdaCandPDGCodeMother, + sigmaMCCore::IsLambdaCandPrimary); } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFSIGMATABLES_H_ diff --git a/PWGLF/DataModel/LFSlimNucleiTables.h b/PWGLF/DataModel/LFSlimNucleiTables.h index afc076d1a54..2ceba88be7d 100644 --- a/PWGLF/DataModel/LFSlimNucleiTables.h +++ b/PWGLF/DataModel/LFSlimNucleiTables.h @@ -36,6 +36,7 @@ DECLARE_SOA_COLUMN(DCAz, dcaz, float); DECLARE_SOA_COLUMN(TPCsignal, tpcSignal, float); DECLARE_SOA_COLUMN(ITSchi2, itsChi2, float); DECLARE_SOA_COLUMN(TPCchi2, tpcChi2, float); +DECLARE_SOA_COLUMN(TOFchi2, tofChi2, float); DECLARE_SOA_COLUMN(Flags, flags, uint16_t); DECLARE_SOA_COLUMN(TPCfindableCls, tpcFindableCls, uint8_t); DECLARE_SOA_COLUMN(TPCcrossedRows, tpcCrossedRows, uint8_t); @@ -47,6 +48,7 @@ DECLARE_SOA_COLUMN(gPt, genPt, float); DECLARE_SOA_COLUMN(gEta, genEta, float); DECLARE_SOA_COLUMN(gPhi, genPhi, float); DECLARE_SOA_COLUMN(PDGcode, pdgCode, int); +DECLARE_SOA_COLUMN(MotherPDGcode, MotherpdgCode, int); DECLARE_SOA_COLUMN(SurvivedEventSelection, survivedEventSelection, bool); DECLARE_SOA_COLUMN(AbsoDecL, absoDecL, float); @@ -79,6 +81,7 @@ DECLARE_SOA_TABLE(NucleiTable, "AOD", "NUCLEITABLE", NucleiTableNS::TPCsignal, NucleiTableNS::ITSchi2, NucleiTableNS::TPCchi2, + NucleiTableNS::TOFchi2, NucleiTableNS::Flags, NucleiTableNS::TPCfindableCls, NucleiTableNS::TPCcrossedRows, @@ -113,6 +116,7 @@ DECLARE_SOA_TABLE(NucleiTableMC, "AOD", "NUCLEITABLEMC", NucleiTableNS::TPCsignal, NucleiTableNS::ITSchi2, NucleiTableNS::TPCchi2, + NucleiTableNS::TOFchi2, NucleiTableNS::Flags, NucleiTableNS::TPCfindableCls, NucleiTableNS::TPCcrossedRows, @@ -124,6 +128,7 @@ DECLARE_SOA_TABLE(NucleiTableMC, "AOD", "NUCLEITABLEMC", NucleiTableNS::gEta, NucleiTableNS::gPhi, NucleiTableNS::PDGcode, + NucleiTableNS::MotherPDGcode, NucleiTableNS::SurvivedEventSelection, NucleiTableNS::AbsoDecL); diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 1ce4e5fcf0b..66d9027779e 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -22,6 +22,7 @@ #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/McCollisionExtra.h" #include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/SPCalibrationTables.h" #include "PWGUD/DataModel/UDTables.h" namespace o2::aod @@ -128,15 +129,6 @@ DECLARE_SOA_TABLE_VERSIONED(StraEvSels_001, "AOD", "STRAEVSELS", 1, //! udcollision::TotalFDDAmplitudeC, // UPC info: re-assigned FDD-C amplitude, in case of SG event, from the most active bc udzdc::EnergyCommonZNA, // UPC info: re-assigned ZN-A amplitude, in case of SG event, from the most active bc udzdc::EnergyCommonZNC, // UPC info: re-assigned ZN-C amplitude, in case of SG event, from the most active bc - - // Dynamic columns for manipulating information - // stracollision::TotalFV0AmplitudeA, - // stracollision::TotalFT0AmplitudeA, - // stracollision::TotalFT0AmplitudeC, - // stracollision::TotalFDDAmplitudeA, - // stracollision::TotalFDDAmplitudeC, - // stracollision::EnergyCommonZNA, - // stracollision::EnergyCommonZNC, stracollision::IsUPC); DECLARE_SOA_TABLE_VERSIONED(StraEvSels_002, "AOD", "STRAEVSELS", 2, //! debug information @@ -160,17 +152,7 @@ DECLARE_SOA_TABLE_VERSIONED(StraEvSels_002, "AOD", "STRAEVSELS", 2, //! udcollision::TotalFDDAmplitudeC, // UPC info: re-assigned FDD-C amplitude, in case of SG event, from the most active bc udzdc::EnergyCommonZNA, // UPC info: re-assigned ZN-A amplitude, in case of SG event, from the most active bc udzdc::EnergyCommonZNC, // UPC info: re-assigned ZN-C amplitude, in case of SG event, from the most active bc - - collision::Flags, // Contains Vertex::Flags, with most notably the UPCMode to know whether the vertex has been found using UPC settings - - // Dynamic columns for manipulating information - // stracollision::TotalFV0AmplitudeA, - // stracollision::TotalFT0AmplitudeA, - // stracollision::TotalFT0AmplitudeC, - // stracollision::TotalFDDAmplitudeA, - // stracollision::TotalFDDAmplitudeC, - // stracollision::EnergyCommonZNA, - // stracollision::EnergyCommonZNC, + collision::Flags, // Contains Vertex::Flags, with most notably the UPCMode to know whether the vertex has been found using UPC settings stracollision::IsUPC); DECLARE_SOA_TABLE_VERSIONED(StraEvSels_003, "AOD", "STRAEVSELS", 3, //! debug information @@ -195,8 +177,34 @@ DECLARE_SOA_TABLE_VERSIONED(StraEvSels_003, "AOD", "STRAEVSELS", 3, //! udcollision::TotalFDDAmplitudeC, // UPC info: re-assigned FDD-C amplitude, in case of SG event, from the most active bc udzdc::EnergyCommonZNA, // UPC info: re-assigned ZN-A amplitude, in case of SG event, from the most active bc udzdc::EnergyCommonZNC, // UPC info: re-assigned ZN-C amplitude, in case of SG event, from the most active bc + collision::Flags, // Contains Vertex::Flags, with most notably the UPCMode to know whether the vertex has been found using UPC settings + stracollision::IsUPC); + +DECLARE_SOA_TABLE_VERSIONED(StraEvSels_004, "AOD", "STRAEVSELS", 4, //! debug information + evsel::Sel8, evsel::Selection, //! event selection: sel8 + mult::MultFT0A, mult::MultFT0C, mult::MultFV0A, // FIT detectors + mult::MultFDDA, mult::MultFDDC, + mult::MultNTracksPVeta1, // track multiplicities with eta cut for INEL>0 + mult::MultPVTotalContributors, // number of PV contribs total + mult::MultNTracksGlobal, // global track multiplicities + mult::MultNTracksITSTPC, // track multiplicities, PV contribs, no eta cut + mult::MultAllTracksTPCOnly, // TPConly track multiplicities, all, no eta cut + mult::MultAllTracksITSTPC, // ITSTPC track multiplicities, all, no eta cut + mult::MultZNA, mult::MultZNC, mult::MultZEM1, // ZDC signals + mult::MultZEM2, mult::MultZPA, mult::MultZPC, + evsel::NumTracksInTimeRange, // add occupancy in specified time interval by a number of tracks from nearby collisions + evsel::SumAmpFT0CInTimeRange, // add occupancy in specified time interval by a sum of FT0C amplitudes from nearby collisions + udcollision::GapSide, // UPC info: 0 for side A, 1 for side C, 2 for both sides, 3 neither A or C, 4 not enough or too many pv contributors + udcollision::TotalFT0AmplitudeA, // UPC info: re-assigned FT0-A amplitude, in case of SG event, from the most active bc + udcollision::TotalFT0AmplitudeC, // UPC info: re-assigned FT0-C amplitude, in case of SG event, from the most active bc + udcollision::TotalFV0AmplitudeA, // UPC info: re-assigned FV0-A amplitude, in case of SG event, from the most active bc + udcollision::TotalFDDAmplitudeA, // UPC info: re-assigned FDD-A amplitude, in case of SG event, from the most active bc + udcollision::TotalFDDAmplitudeC, // UPC info: re-assigned FDD-C amplitude, in case of SG event, from the most active bc + udzdc::EnergyCommonZNA, // UPC info: re-assigned ZN-A amplitude, in case of SG event, from the most active bc + udzdc::EnergyCommonZNC, // UPC info: re-assigned ZN-C amplitude, in case of SG event, from the most active bc collision::Flags, // Contains Vertex::Flags, with most notably the UPCMode to know whether the vertex has been found using UPC settings + evsel::Alias, // trigger aliases (e.g. kTVXinTRD for v2) // Dynamic columns for manipulating information // stracollision::TotalFV0AmplitudeA, @@ -221,20 +229,30 @@ DECLARE_SOA_TABLE(StraTPCQVs, "AOD", "STRATPCQVS", //! tpc Qvec qvec::QvecBPosRe, qvec::QvecBPosIm, epcalibrationtable::QTPCR); DECLARE_SOA_TABLE(StraFT0CQVsEv, "AOD", "STRAFT0CQVSEv", //! events used to compute t0c Qvec epcalibrationtable::TriggerEventEP); -DECLARE_SOA_TABLE(StraStamps, "AOD", "STRASTAMPS", //! information for ID-ing mag field if needed +DECLARE_SOA_TABLE(StraZDCSP, "AOD", "STRAZDCSP", //! events used to compute the ZDC spectator plane + spcalibrationtable::TriggerEventSP, spcalibrationtable::PsiZDCA, spcalibrationtable::PsiZDCC); +DECLARE_SOA_TABLE(StraStamps_000, "AOD", "STRASTAMPS", //! information for ID-ing mag field if needed bc::RunNumber, timestamp::Timestamp); +DECLARE_SOA_TABLE_VERSIONED(StraStamps_001, "AOD", "STRASTAMPS", 1, //! information for ID-ing mag field if needed + bc::RunNumber, timestamp::Timestamp, bc::GlobalBC); using StraRawCents = StraRawCents_004; -using StraEvSels = StraEvSels_003; +using StraEvSels = StraEvSels_004; +using StraStamps = StraStamps_001; using StraCollision = StraCollisions::iterator; using StraCent = StraCents::iterator; //______________________________________________________ // for correlating information with MC // also allows for collision association cross-checks -DECLARE_SOA_TABLE(StraMCCollisions, "AOD", "STRAMCCOLLISION", //! MC collision properties +DECLARE_SOA_TABLE(StraMCCollisions_000, "AOD", "STRAMCCOLLISION", //! MC collision properties o2::soa::Index<>, mccollision::PosX, mccollision::PosY, mccollision::PosZ, mccollision::ImpactParameter); +DECLARE_SOA_TABLE_VERSIONED(StraMCCollisions_001, "AOD", "STRAMCCOLLISION", 1, //! debug information + o2::soa::Index<>, mccollision::PosX, mccollision::PosY, mccollision::PosZ, + mccollision::ImpactParameter, mccollision::EventPlaneAngle); +using StraMCCollisions = StraMCCollisions_001; + DECLARE_SOA_TABLE(StraMCCollMults, "AOD", "STRAMCCOLLMULTS", //! MC collision multiplicities mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, o2::soa::Marker<2>); @@ -629,110 +647,62 @@ DECLARE_SOA_TABLE(V0Indices, "AOD", "V0INDEX", //! index table when using AO2Ds DECLARE_SOA_TABLE(V0CollRefs, "AOD", "V0COLLREF", //! optional table to refer back to a collision o2::soa::Index<>, v0data::StraCollisionId); -DECLARE_SOA_TABLE(V0Extras, "AOD", "V0EXTRA", //! optional table to refer to custom track extras - o2::soa::Index<>, v0data::PosTrackExtraId, v0data::NegTrackExtraId); - -DECLARE_SOA_TABLE(StoredV0Extras, "AOD1", "V0EXTRA", //! optional table to refer to custom track extras - o2::soa::Index<>, v0data::PosTrackExtraId, v0data::NegTrackExtraId, soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(V0Extras, "V0EXTRA", //! optional table to refer to custom track extras + o2::soa::Index<>, v0data::PosTrackExtraId, v0data::NegTrackExtraId); DECLARE_SOA_TABLE(V0TrackXs, "AOD", "V0TRACKX", //! track X positions at minima when using AO2Ds v0data::PosX, v0data::NegX, o2::soa::Marker<1>); -DECLARE_SOA_TABLE_FULL(V0CoresBase, "V0Cores", "AOD", "V0CORE", //! core information about decay, viable with AO2Ds or derived - o2::soa::Index<>, - v0data::X, v0data::Y, v0data::Z, - v0data::PxPos, v0data::PyPos, v0data::PzPos, - v0data::PxNeg, v0data::PyNeg, v0data::PzNeg, - v0data::DCAV0Daughters, v0data::DCAPosToPV, v0data::DCANegToPV, - v0data::V0CosPA, v0data::DCAV0ToPV, v0data::V0Type, - - // Dynamic columns - v0data::PtHypertriton, - v0data::PtAntiHypertriton, - v0data::V0Radius, - v0data::DistOverTotMom, - v0data::Alpha, - v0data::QtArm, - v0data::PsiPair, - v0data::PFracPos, - v0data::PFracNeg, // 24 - - // Invariant masses - v0data::MLambda, - v0data::MAntiLambda, - v0data::MK0Short, - v0data::MGamma, - v0data::MHypertriton, - v0data::MAntiHypertriton, - v0data::M, - - // Longitudinal - v0data::YK0Short, - v0data::YLambda, - v0data::YHypertriton, - v0data::YAntiHypertriton, - v0data::Rapidity, - v0data::NegativePt, - v0data::PositivePt, - v0data::NegativeEta, - v0data::NegativePhi, - v0data::PositiveEta, - v0data::PositivePhi, - v0data::IsStandardV0, - v0data::IsPhotonTPConly, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(V0CoresBase, "V0CORE", //! core information about decay, viable with AO2Ds or derived + o2::soa::Index<>, + v0data::X, v0data::Y, v0data::Z, + v0data::PxPos, v0data::PyPos, v0data::PzPos, + v0data::PxNeg, v0data::PyNeg, v0data::PzNeg, + v0data::DCAV0Daughters, v0data::DCAPosToPV, v0data::DCANegToPV, + v0data::V0CosPA, v0data::DCAV0ToPV, v0data::V0Type, + + // Dynamic columns + v0data::PtHypertriton, + v0data::PtAntiHypertriton, + v0data::V0Radius, + v0data::DistOverTotMom, + v0data::Alpha, + v0data::QtArm, + v0data::PsiPair, + v0data::PFracPos, + v0data::PFracNeg, // 24 + + // Invariant masses + v0data::MLambda, + v0data::MAntiLambda, + v0data::MK0Short, + v0data::MGamma, + v0data::MHypertriton, + v0data::MAntiHypertriton, + v0data::M, + + // Longitudinal + v0data::YK0Short, + v0data::YLambda, + v0data::YHypertriton, + v0data::YAntiHypertriton, + v0data::Rapidity, + v0data::NegativePt, + v0data::PositivePt, + v0data::NegativeEta, + v0data::NegativePhi, + v0data::PositiveEta, + v0data::PositivePhi, + v0data::IsStandardV0, + v0data::IsPhotonTPConly); // extended table with expression columns that can be used as arguments of dynamic columns DECLARE_SOA_EXTENDED_TABLE_USER(V0Cores, V0CoresBase, "V0COREEXT", //! v0data::Px, v0data::Py, v0data::Pz, v0data::Pt, v0data::P, v0data::Phi, v0data::Eta); // the table name has here to be the one with EXT which is not nice and under study -DECLARE_SOA_TABLE_FULL(StoredV0CoresBase, "V0Cores", "AOD1", "V0CORE", //! core information about decay, viable with AO2Ds or derived - o2::soa::Index<>, - v0data::X, v0data::Y, v0data::Z, - v0data::PxPos, v0data::PyPos, v0data::PzPos, - v0data::PxNeg, v0data::PyNeg, v0data::PzNeg, - v0data::DCAV0Daughters, v0data::DCAPosToPV, v0data::DCANegToPV, - v0data::V0CosPA, v0data::DCAV0ToPV, v0data::V0Type, - - // Dynamic columns - v0data::PtHypertriton, - v0data::PtAntiHypertriton, - v0data::V0Radius, - v0data::DistOverTotMom, - v0data::Alpha, - v0data::QtArm, - v0data::PsiPair, - v0data::PFracPos, - v0data::PFracNeg, // 24 - - // Invariant masses - v0data::MLambda, - v0data::MAntiLambda, - v0data::MK0Short, - v0data::MGamma, - v0data::MHypertriton, - v0data::MAntiHypertriton, - v0data::M, - - // Longitudinal - v0data::YK0Short, - v0data::YLambda, - v0data::YHypertriton, - v0data::YAntiHypertriton, - v0data::Rapidity, - v0data::NegativePt, - v0data::PositivePt, - v0data::NegativeEta, - v0data::NegativePhi, - v0data::PositiveEta, - v0data::PositivePhi, - v0data::IsStandardV0, - v0data::IsPhotonTPConly, - o2::soa::Marker<3>); - -// extended table with expression columns that can be used as arguments of dynamic columns -DECLARE_SOA_EXTENDED_TABLE_USER(StoredV0Cores, StoredV0CoresBase, "V0COREEXT", //! - v0data::Px, v0data::Py, v0data::Pz, v0data::Pt, v0data::P, v0data::Phi, v0data::Eta, o2::soa::Marker<2>); // the table name has here to be the one with EXT which is not nice and under study +// // extended table with expression columns that can be used as arguments of dynamic columns +// DECLARE_SOA_EXTENDED_TABLE_USER(StoredV0Cores, StoredV0CoresBase, "V0COREEXT", //! +// v0data::Px, v0data::Py, v0data::Pz, v0data::Pt, v0data::P, v0data::Phi, v0data::Eta, o2::soa::Marker<2>); // the table name has here to be the one with EXT which is not nice and under study DECLARE_SOA_TABLE(V0TraPosAtDCAs, "AOD", "V0TRAPOSATDCAs", //! positions of tracks at their DCA for debug v0data::XPosAtDCA, v0data::YPosAtDCA, v0data::ZPosAtDCA, @@ -808,60 +778,60 @@ DECLARE_SOA_EXTENDED_TABLE_USER(V0fCCores, StoredV0fCCores, "V0FCCOREEXT", DECLARE_SOA_TABLE_FULL(V0fCCovs, "V0fCCovs", "AOD", "V0FCCOVS", //! V0 covariance matrices v0data::PositionCovMat, v0data::MomentumCovMat, o2::soa::Marker<2>); -DECLARE_SOA_TABLE(V0MCCores_000, "AOD", "V0MCCORE", //! MC properties of the V0 for posterior analysis - v0data::PDGCode, v0data::PDGCodeMother, - v0data::PDGCodePositive, v0data::PDGCodeNegative, - v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, - v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, - v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC); - -DECLARE_SOA_TABLE_VERSIONED(V0MCCores_001, "AOD", "V0MCCORE", 1, //! debug information - v0data::ParticleIdMC, //! MC properties of the V0 for posterior analysis - v0data::PDGCode, v0data::PDGCodeMother, - v0data::PDGCodePositive, v0data::PDGCodeNegative, - v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, - v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, - v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC); - -DECLARE_SOA_TABLE_VERSIONED(V0MCCores_002, "AOD", "V0MCCORE", 2, //! debug information - v0data::ParticleIdMC, //! MC properties of the V0 for posterior analysis - v0data::PDGCode, v0data::PDGCodeMother, - v0data::PDGCodePositive, v0data::PDGCodeNegative, - v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, - v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, - v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC, - v0data::PxMC, v0data::PyMC, v0data::PzMC, - v0data::RapidityMC, - v0data::NegativePtMC, - v0data::PositivePtMC, - v0data::PtMC); - -DECLARE_SOA_TABLE(StoredV0MCCores_000, "AOD", "V0MCCORE", //! MC properties of the V0 for posterior analysis - v0data::PDGCode, v0data::PDGCodeMother, - v0data::PDGCodePositive, v0data::PDGCodeNegative, - v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, - v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, - v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE_VERSIONED(StoredV0MCCores_001, "AOD", "V0MCCORE", 1, //! debug information - v0data::ParticleIdMC, //! MC properties of the V0 for posterior analysis - v0data::PDGCode, v0data::PDGCodeMother, - v0data::PDGCodePositive, v0data::PDGCodeNegative, - v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, - v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, - v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE_VERSIONED(StoredV0MCCores_002, "AOD", "V0MCCORE", 2, //! debug information - v0data::ParticleIdMC, //! MC properties of the V0 for posterior analysis - v0data::PDGCode, v0data::PDGCodeMother, - v0data::PDGCodePositive, v0data::PDGCodeNegative, - v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, - v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, - v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC, - v0data::PxMC, v0data::PyMC, v0data::PzMC, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(V0MCCores_000, "V0MCCORE", //! MC properties of the V0 for posterior analysis + v0data::PDGCode, v0data::PDGCodeMother, + v0data::PDGCodePositive, v0data::PDGCodeNegative, + v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, + v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, + v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC); + +DECLARE_SOA_TABLE_STAGED_VERSIONED(V0MCCores_001, "V0MCCORE", 1, //! debug information + v0data::ParticleIdMC, //! MC properties of the V0 for posterior analysis + v0data::PDGCode, v0data::PDGCodeMother, + v0data::PDGCodePositive, v0data::PDGCodeNegative, + v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, + v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, + v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC); + +DECLARE_SOA_TABLE_STAGED_VERSIONED(V0MCCores_002, "V0MCCORE", 2, //! debug information + v0data::ParticleIdMC, //! MC properties of the V0 for posterior analysis + v0data::PDGCode, v0data::PDGCodeMother, + v0data::PDGCodePositive, v0data::PDGCodeNegative, + v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, + v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, + v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC, + v0data::PxMC, v0data::PyMC, v0data::PzMC, + v0data::RapidityMC, + v0data::NegativePtMC, + v0data::PositivePtMC, + v0data::PtMC); + +// DECLARE_SOA_TABLE(StoredV0MCCores_000, "AOD", "V0MCCORE", //! MC properties of the V0 for posterior analysis +// v0data::PDGCode, v0data::PDGCodeMother, +// v0data::PDGCodePositive, v0data::PDGCodeNegative, +// v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, +// v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, +// v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC, +// o2::soa::Marker<1>); + +// DECLARE_SOA_TABLE_VERSIONED(StoredV0MCCores_001, "AOD", "V0MCCORE", 1, //! debug information +// v0data::ParticleIdMC, //! MC properties of the V0 for posterior analysis +// v0data::PDGCode, v0data::PDGCodeMother, +// v0data::PDGCodePositive, v0data::PDGCodeNegative, +// v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, +// v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, +// v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC, +// o2::soa::Marker<1>); + +// DECLARE_SOA_TABLE_VERSIONED(StoredV0MCCores_002, "AOD", "V0MCCORE", 2, //! debug information +// v0data::ParticleIdMC, //! MC properties of the V0 for posterior analysis +// v0data::PDGCode, v0data::PDGCodeMother, +// v0data::PDGCodePositive, v0data::PDGCodeNegative, +// v0data::IsPhysicalPrimary, v0data::XMC, v0data::YMC, v0data::ZMC, +// v0data::PxPosMC, v0data::PyPosMC, v0data::PzPosMC, +// v0data::PxNegMC, v0data::PyNegMC, v0data::PzNegMC, +// v0data::PxMC, v0data::PyMC, v0data::PzMC, +// o2::soa::Marker<1>); DECLARE_SOA_TABLE(V0MCCollRefs, "AOD", "V0MCCOLLREF", //! refers MC candidate back to proper MC Collision o2::soa::Index<>, v0data::StraMCCollisionId, o2::soa::Marker<2>); @@ -870,11 +840,8 @@ DECLARE_SOA_TABLE(GeK0Short, "AOD", "GeK0Short", v0data::GeneratedK0Short); DECLARE_SOA_TABLE(GeLambda, "AOD", "GeLambda", v0data::GeneratedLambda); DECLARE_SOA_TABLE(GeAntiLambda, "AOD", "GeAntiLambda", v0data::GeneratedAntiLambda); -DECLARE_SOA_TABLE(V0MCMothers, "AOD", "V0MCMOTHER", //! optional table for MC mothers - o2::soa::Index<>, v0data::MotherMCPartId); - -DECLARE_SOA_TABLE(StoredV0MCMothers, "AOD1", "V0MCMOTHER", //! optional table for MC mothers - o2::soa::Index<>, v0data::MotherMCPartId, o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(V0MCMothers, "V0MCMOTHER", //! optional table for MC mothers + o2::soa::Index<>, v0data::MotherMCPartId); using V0MCCores = V0MCCores_002; using StoredV0MCCores = StoredV0MCCores_002; @@ -1043,13 +1010,22 @@ DECLARE_SOA_COLUMN(BachX, bachX, float); //! bachelor track X at min //______________________________________________________ // REGULAR COLUMNS FOR CASCCOVS // Saved from finding: covariance matrix of parent track (on request) -DECLARE_SOA_COLUMN(PositionCovMat, positionCovMat, float[6]); //! covariance matrix elements -DECLARE_SOA_COLUMN(MomentumCovMat, momentumCovMat, float[6]); //! covariance matrix elements +DECLARE_SOA_DYNAMIC_COLUMN(PositionCovMat, positionCovMat, //! for transparent handling + [](const float covMat[21]) -> std::vector { + std::vector posCovMat { covMat[0], covMat[1], covMat[2], covMat[3], covMat[4], covMat[5] }; + return posCovMat; }); +DECLARE_SOA_DYNAMIC_COLUMN(MomentumCovMat, momentumCovMat, //! for transparent handling + [](const float covMat[21]) -> std::vector { + std::vector momCovMat { covMat[9], covMat[13], covMat[14], covMat[18], covMat[19], covMat[20] }; + return momCovMat; }); DECLARE_SOA_COLUMN(KFTrackCovMat, kfTrackCovMat, float[21]); //! covariance matrix elements for KF method (Cascade) DECLARE_SOA_COLUMN(KFTrackCovMatV0, kfTrackCovMatV0, float[21]); //! covariance matrix elements for KF method (V0) DECLARE_SOA_COLUMN(KFTrackCovMatV0DauPos, kfTrackCovMatV0DauPos, float[21]); //! covariance matrix elements for KF method (V0 pos daughter) DECLARE_SOA_COLUMN(KFTrackCovMatV0DauNeg, kfTrackCovMatV0DauNeg, float[21]); //! covariance matrix elements for KF method (V0 neg daughter) +// for CascCovs / TraCascCovs, meant to provide consistent interface everywhere +DECLARE_SOA_COLUMN(CovMat, covMat, float[21]); //! covariance matrix elements + //______________________________________________________ // REGULAR COLUMNS FOR CASCBBS // General cascade properties: position, momentum @@ -1419,11 +1395,20 @@ DECLARE_SOA_TABLE(CascMCMothers, "AOD", "CASCMCMOTHER", //! optional table for M DECLARE_SOA_TABLE(CascBBs, "AOD", "CASCBB", //! bachelor-baryon correlation variables cascdata::BachBaryonCosPA, cascdata::BachBaryonDCAxyToPV) -DECLARE_SOA_TABLE_FULL(CascCovs, "CascCovs", "AOD", "CASCCOVS", //! - cascdata::PositionCovMat, cascdata::MomentumCovMat); +DECLARE_SOA_TABLE(CascCovs, "AOD", "CASCCOVS", //! + cascdata::CovMat, + cascdata::PositionCovMat, + cascdata::MomentumCovMat, + o2::soa::Marker<1>); + +DECLARE_SOA_TABLE(KFCascCovs, "AOD", "KFCASCCOVS", //! + cascdata::KFTrackCovMat, cascdata::KFTrackCovMatV0, cascdata::KFTrackCovMatV0DauPos, cascdata::KFTrackCovMatV0DauNeg); -DECLARE_SOA_TABLE_FULL(KFCascCovs, "KFCascCovs", "AOD", "KFCASCCOVS", //! - cascdata::KFTrackCovMat, cascdata::KFTrackCovMatV0, cascdata::KFTrackCovMatV0DauPos, cascdata::KFTrackCovMatV0DauNeg); +DECLARE_SOA_TABLE(TraCascCovs, "AOD", "TRACASCCOVS", //! + cascdata::CovMat, + cascdata::PositionCovMat, + cascdata::MomentumCovMat, + o2::soa::Marker<2>); // extended table with expression columns that can be used as arguments of dynamic columns DECLARE_SOA_EXTENDED_TABLE_USER(CascCores, StoredCascCores, "CascDATAEXT", //! @@ -1499,6 +1484,8 @@ using CascadesLinked = soa::Join; using CascadeLinked = CascadesLinked::iterator; using KFCascadesLinked = soa::Join; using KFCascadeLinked = KFCascadesLinked::iterator; +using TraCascadesLinked = soa::Join; +using TraCascadeLinked = TraCascadesLinked::iterator; namespace cascdata { diff --git a/PWGLF/DataModel/LFhe3HadronTables.h b/PWGLF/DataModel/LFhe3HadronTables.h new file mode 100644 index 00000000000..9074fb8b20c --- /dev/null +++ b/PWGLF/DataModel/LFhe3HadronTables.h @@ -0,0 +1,128 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// +/// \file LFhe3HadronTables.h +/// \brief Slim tables for he3Hadron +/// + +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" + +#ifndef PWGLF_DATAMODEL_LFHE3HADRONTABLES_H_ +#define PWGLF_DATAMODEL_LFHE3HADRONTABLES_H_ + +namespace o2::aod +{ +namespace he3HadronTablesNS +{ + +DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); +DECLARE_SOA_COLUMN(EtaHe3, etaHe3, float); +DECLARE_SOA_COLUMN(PhiHe3, phiHe3, float); +DECLARE_SOA_COLUMN(PtHad, ptHad, float); +DECLARE_SOA_COLUMN(EtaHad, etaHad, float); +DECLARE_SOA_COLUMN(PhiHad, phiHad, float); + +DECLARE_SOA_COLUMN(DCAxyHe3, dcaxyHe3, float); +DECLARE_SOA_COLUMN(DCAzHe3, dcazHe3, float); +DECLARE_SOA_COLUMN(DCAxyHad, dcaxyHad, float); +DECLARE_SOA_COLUMN(DCAzHad, dcazHad, float); + +DECLARE_SOA_COLUMN(SignalTPCHe3, signalTPCHe3, float); +DECLARE_SOA_COLUMN(InnerParamTPCHe3, innerParamTPCHe3, float); +DECLARE_SOA_COLUMN(SignalTPCHad, signalTPCHad, float); +DECLARE_SOA_COLUMN(InnerParamTPCHad, innerParamTPCHad, float); +DECLARE_SOA_COLUMN(NClsTPCHe3, nClsTPCHe3, uint8_t); +DECLARE_SOA_COLUMN(NSigmaTPCHe3, nSigmaTPCHe3, float); +DECLARE_SOA_COLUMN(NSigmaTPCHad, nSigmaTOFHad, float); +DECLARE_SOA_COLUMN(Chi2TPCHe3, chi2TPCHe3, float); +DECLARE_SOA_COLUMN(Chi2TPCHad, chi2TPCHad, float); +DECLARE_SOA_COLUMN(MassTOFHe3, massTOFHe3, float); +DECLARE_SOA_COLUMN(MassTOFHad, massTOFHad, float); +DECLARE_SOA_COLUMN(PIDtrkHe3, pidTrkHe3, uint32_t); +DECLARE_SOA_COLUMN(PIDtrkHad, pidTrkHad, uint32_t); + +DECLARE_SOA_COLUMN(ItsClusterSizeHe3, itsClusterSizeHe3, uint32_t); +DECLARE_SOA_COLUMN(ItsClusterSizeHad, itsClusterSizeHad, uint32_t); + +DECLARE_SOA_COLUMN(SharedClustersHe3, sharedClustersHe3, uint8_t); +DECLARE_SOA_COLUMN(SharedClustersHad, sharedClustersHad, uint8_t); + +DECLARE_SOA_COLUMN(IsBkgUS, isBkgUS, bool); +DECLARE_SOA_COLUMN(IsBkgEM, isBkgEM, bool); + +DECLARE_SOA_COLUMN(PtMCHe3, ptMCHe3, float); +DECLARE_SOA_COLUMN(EtaMCHe3, etaMCHe3, float); +DECLARE_SOA_COLUMN(PhiMCHe3, phiMCHe3, float); +DECLARE_SOA_COLUMN(PtMCHad, ptMCHad, float); +DECLARE_SOA_COLUMN(EtaMCHad, etaMCHad, float); +DECLARE_SOA_COLUMN(PhiMCHad, phiMCHad, float); +DECLARE_SOA_COLUMN(SignedPtMC, signedPtMC, float); +DECLARE_SOA_COLUMN(MassMC, massMC, float); + +DECLARE_SOA_COLUMN(CollisionId, collisionId, int64_t); +DECLARE_SOA_COLUMN(ZVertex, zVertex, float); +DECLARE_SOA_COLUMN(Multiplicity, multiplicity, uint16_t); +DECLARE_SOA_COLUMN(CentralityFT0C, centFT0C, float); +DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0C, float); + +} // namespace he3HadronTablesNS + +DECLARE_SOA_TABLE(he3HadronTable, "AOD", "HE3HADTABLE", + he3HadronTablesNS::PtHe3, + he3HadronTablesNS::EtaHe3, + he3HadronTablesNS::PhiHe3, + he3HadronTablesNS::PtHad, + he3HadronTablesNS::EtaHad, + he3HadronTablesNS::PhiHad, + he3HadronTablesNS::DCAxyHe3, + he3HadronTablesNS::DCAzHe3, + he3HadronTablesNS::DCAxyHad, + he3HadronTablesNS::DCAzHad, + he3HadronTablesNS::SignalTPCHe3, + he3HadronTablesNS::InnerParamTPCHe3, + he3HadronTablesNS::SignalTPCHad, + he3HadronTablesNS::InnerParamTPCHad, + he3HadronTablesNS::NClsTPCHe3, + he3HadronTablesNS::NSigmaTPCHe3, + he3HadronTablesNS::NSigmaTPCHad, + he3HadronTablesNS::Chi2TPCHe3, + he3HadronTablesNS::Chi2TPCHad, + he3HadronTablesNS::MassTOFHe3, + he3HadronTablesNS::MassTOFHad, + he3HadronTablesNS::PIDtrkHe3, + he3HadronTablesNS::PIDtrkHad, + he3HadronTablesNS::ItsClusterSizeHe3, + he3HadronTablesNS::ItsClusterSizeHad, + he3HadronTablesNS::SharedClustersHe3, + he3HadronTablesNS::SharedClustersHad, + he3HadronTablesNS::IsBkgUS, + he3HadronTablesNS::IsBkgEM) +DECLARE_SOA_TABLE(he3HadronTableMC, "AOD", "HE3HADTABLEMC", + he3HadronTablesNS::PtMCHe3, + he3HadronTablesNS::EtaMCHe3, + he3HadronTablesNS::PhiMCHe3, + he3HadronTablesNS::PtMCHad, + he3HadronTablesNS::EtaMCHad, + he3HadronTablesNS::PhiMCHad, + he3HadronTablesNS::SignedPtMC, + he3HadronTablesNS::MassMC) +DECLARE_SOA_TABLE(he3HadronMult, "AOD", "HE3HADMULT", + he3HadronTablesNS::CollisionId, + he3HadronTablesNS::ZVertex, + he3HadronTablesNS::Multiplicity, + he3HadronTablesNS::CentralityFT0C, + he3HadronTablesNS::MultiplicityFT0C) + +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_LFHE3HADRONTABLES_H_ diff --git a/PWGLF/DataModel/SPCalibrationTables.h b/PWGLF/DataModel/SPCalibrationTables.h index bc92d39a4b7..2b417ce8758 100644 --- a/PWGLF/DataModel/SPCalibrationTables.h +++ b/PWGLF/DataModel/SPCalibrationTables.h @@ -28,7 +28,7 @@ namespace o2::aod { namespace spcalibrationtable { -DECLARE_SOA_COLUMN(TriggerEvent, triggerevent, bool); +DECLARE_SOA_COLUMN(TriggerEventSP, triggereventsp, bool); DECLARE_SOA_COLUMN(TriggerEventRunNo, triggereventrunno, int); DECLARE_SOA_COLUMN(Cent, cent, float); DECLARE_SOA_COLUMN(Vx, vx, float); @@ -52,7 +52,7 @@ DECLARE_SOA_COLUMN(PsiZDCC, psiZDCC, float); DECLARE_SOA_COLUMN(PsiZDCA, psiZDCA, float); } // namespace spcalibrationtable DECLARE_SOA_TABLE(SPCalibrationTables, "AOD", "SPCALCOLS", - spcalibrationtable::TriggerEvent, + spcalibrationtable::TriggerEventSP, spcalibrationtable::TriggerEventRunNo, spcalibrationtable::Cent, spcalibrationtable::Vx, diff --git a/PWGLF/DataModel/V0SelectorTables.h b/PWGLF/DataModel/V0SelectorTables.h index a20aa44d641..1283c754819 100644 --- a/PWGLF/DataModel/V0SelectorTables.h +++ b/PWGLF/DataModel/V0SelectorTables.h @@ -11,6 +11,8 @@ #ifndef PWGLF_DATAMODEL_V0SELECTORTABLES_H_ #define PWGLF_DATAMODEL_V0SELECTORTABLES_H_ +#include +#include namespace o2::aod { @@ -35,20 +37,12 @@ DECLARE_SOA_DYNAMIC_COLUMN(IsRejectedCandidate, isRejectedCandidate, //! Flag to [](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FREJECTED; }); } // namespace v0flags -DECLARE_SOA_TABLE(V0SignalFlags, "AOD", "V0SIGNALFLAGS", - v0flags::SignalFlag, - v0flags::IsK0SCandidate, - v0flags::IsLambdaCandidate, - v0flags::IsAntiLambdaCandidate, - v0flags::IsRejectedCandidate); - -DECLARE_SOA_TABLE(StoredV0SignalFlags, "AOD1", "V0SIGNALFLAGS", - v0flags::SignalFlag, - v0flags::IsK0SCandidate, - v0flags::IsLambdaCandidate, - v0flags::IsAntiLambdaCandidate, - v0flags::IsRejectedCandidate, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(V0SignalFlags, "V0SIGNALFLAGS", + v0flags::SignalFlag, + v0flags::IsK0SCandidate, + v0flags::IsLambdaCandidate, + v0flags::IsAntiLambdaCandidate, + v0flags::IsRejectedCandidate); } // namespace o2::aod diff --git a/PWGLF/DataModel/Vtx3BodyTables.h b/PWGLF/DataModel/Vtx3BodyTables.h index 26c8dff1424..51e155206bd 100644 --- a/PWGLF/DataModel/Vtx3BodyTables.h +++ b/PWGLF/DataModel/Vtx3BodyTables.h @@ -382,10 +382,20 @@ DECLARE_SOA_COLUMN(DCAVtxDaughtersKF, dcavtxdaughterskf, float); //! sum DECLARE_SOA_COLUMN(Track0Sign, track0sign, float); //! sign of proton daughter track DECLARE_SOA_COLUMN(Track1Sign, track1sign, float); //! sign of pion daughter track DECLARE_SOA_COLUMN(Track2Sign, track2sign, float); //! sign of deuteron daughter track +DECLARE_SOA_COLUMN(TPCInnerParamTrack0, tpcinnerparamtrack0, float); //! momentum at inner wall of TPC of proton daughter +DECLARE_SOA_COLUMN(TPCInnerParamTrack1, tpcinnerparamtrack1, float); //! momentum at inner wall of TPC of pion daughter +DECLARE_SOA_COLUMN(TPCInnerParamTrack2, tpcinnerparamtrack2, float); //! momentum at inner wall of TPC of deuteron daughter // PID -DECLARE_SOA_COLUMN(TPCNSigmaProton, tpcnsigmaproton, float); //! nsigma of TPC PID of the proton daughter -DECLARE_SOA_COLUMN(TPCNSigmaPion, tpcnsigmapion, float); //! nsigma of TPC PID of the pion daughter -DECLARE_SOA_COLUMN(TPCNSigmaDeuteron, tpcnsigmadeuteron, float); //! nsigma of TPC PID of the bachelor daughter +DECLARE_SOA_COLUMN(TPCNSigmaProton, tpcnsigmaproton, float); //! nsigma proton of TPC PID of the proton daughter +DECLARE_SOA_COLUMN(TPCNSigmaPion, tpcnsigmapion, float); //! nsigma pion of TPC PID of the pion daughter +DECLARE_SOA_COLUMN(TPCNSigmaDeuteron, tpcnsigmadeuteron, float); //! nsigma deuteron of TPC PID of the bachelor daughter +DECLARE_SOA_COLUMN(TPCNSigmaPionBach, tpcnsigmapionbach, float); //! nsigma pion of TPC PID of the bachelor daughter +DECLARE_SOA_COLUMN(TPCdEdxProton, tpcdedxproton, float); //! TPC dEdx of the proton daughter +DECLARE_SOA_COLUMN(TPCdEdxPion, tpcdedxpion, float); //! TPC dEdx of the pion daughter +DECLARE_SOA_COLUMN(TPCdEdxDeuteron, tpcdedxdeuteron, float); //! TPC dEdx of the bachelor daughter +DECLARE_SOA_COLUMN(TOFNSigmaDeuteron, tofnsigmadeuteron, float); //! nsigma of TOF PID of the bachelor daughter +DECLARE_SOA_COLUMN(ITSClusSizeDeuteron, itsclussizedeuteron, double); //! average ITS cluster size of bachelor daughter +DECLARE_SOA_COLUMN(PIDTrackingDeuteron, pidtrackingdeuteron, uint32_t); //! PID during tracking of bachelor daughter // Monte Carlo DECLARE_SOA_COLUMN(GenP, genp, float); //! generated momentum @@ -397,6 +407,12 @@ DECLARE_SOA_COLUMN(GenCtau, genctau, double); //! generated ctau DECLARE_SOA_COLUMN(GenPhi, genphi, float); //! generated phi DECLARE_SOA_COLUMN(GenEta, geneta, float); //! generated eta DECLARE_SOA_COLUMN(GenRapidity, genrapidity, float); //! generated rapidity +DECLARE_SOA_COLUMN(GenPosP, genposp, float); //! generated momentum pos daughter particle +DECLARE_SOA_COLUMN(GenPosPt, genpospt, float); //! generated transverse momentum pos daughter particle +DECLARE_SOA_COLUMN(GenNegP, gennegp, float); //! generated momentum neg daughter particle +DECLARE_SOA_COLUMN(GenNegPt, gennegpt, float); //! generated transverse momentum neg daughter particle +DECLARE_SOA_COLUMN(GenBachP, genbachp, float); //! generated momentum bachelor daughter particle +DECLARE_SOA_COLUMN(GenBachPt, genbachpt, float); //! generated transverse momentum bachelor daughter particle DECLARE_SOA_COLUMN(IsTrueH3L, istrueh3l, bool); //! flag for true hypertriton candidate DECLARE_SOA_COLUMN(IsTrueAntiH3L, istrueantih3l, bool); //! flag for true anti-hypertriton candidate DECLARE_SOA_COLUMN(PdgCode, pdgcode, int); //! MC particle PDG code @@ -406,6 +422,7 @@ DECLARE_SOA_COLUMN(IsReco, isreco, int); //! flag if candidate wa // V0 DECLARE_SOA_COLUMN(MassV0, massv0, float); //! proton, pion vertex mass DECLARE_SOA_COLUMN(Chi2MassV0, chi2massv0, float); //! chi2 of proton, pion mass constraint to Lambda mass +DECLARE_SOA_COLUMN(CosPAV0, cospav0, float); //! proton, pion vertex mass } // namespace kfvtx3body @@ -428,11 +445,13 @@ DECLARE_SOA_TABLE(KFVtx3BodyDatas, "AOD", "KFVTX3BODYDATA", // V0 kfvtx3body::MassV0, kfvtx3body::Chi2MassV0, + kfvtx3body::CosPAV0, // daughters - vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton - vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion - vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron + vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton + vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion + vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron + kfvtx3body::TPCInnerParamTrack0, kfvtx3body::TPCInnerParamTrack1, kfvtx3body::TPCInnerParamTrack2, // proton, pion, deuteron kfvtx3body::DCATrack0ToPVKF, kfvtx3body::DCATrack1ToPVKF, kfvtx3body::DCATrack2ToPVKF, kfvtx3body::DCAxyTrack0ToPVKF, kfvtx3body::DCAxyTrack1ToPVKF, kfvtx3body::DCAxyTrack2ToPVKF, kfvtx3body::DCAxyTrack0ToSVKF, kfvtx3body::DCAxyTrack1ToSVKF, kfvtx3body::DCAxyTrack2ToSVKF, kfvtx3body::DCAxyTrack0ToTrack1KF, kfvtx3body::DCAxyTrack0ToTrack2KF, kfvtx3body::DCAxyTrack1ToTrack2KF, @@ -440,27 +459,11 @@ DECLARE_SOA_TABLE(KFVtx3BodyDatas, "AOD", "KFVTX3BODYDATA", kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV, kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV, kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron - kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, - - // dynamic columns - vtx3body::VtxRadius, - vtx3body::DistOverTotMom, - vtx3body::VtxCosPA, - vtx3body::DCAVtxToPV, - - // Longitudinal - vtx3body::YHypertriton, - vtx3body::Eta, - vtx3body::Phi, - vtx3body::Track0Pt, // proton pT - vtx3body::Track0Eta, // proton eta - vtx3body::Track0Phi, // proton phi - vtx3body::Track1Pt, // pion pT - vtx3body::Track1Eta, // pion eta - vtx3body::Track1Phi, // pion phi - vtx3body::Track2Pt, // deuteron pT - vtx3body::Track2Eta, // deuteron eta - vtx3body::Track2Phi); // deuteron phi + kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, kfvtx3body::TPCNSigmaPionBach, + kfvtx3body::TPCdEdxProton, kfvtx3body::TPCdEdxPion, kfvtx3body::TPCdEdxDeuteron, + kfvtx3body::TOFNSigmaDeuteron, + kfvtx3body::ITSClusSizeDeuteron, + kfvtx3body::PIDTrackingDeuteron); using KFVtx3BodyData = KFVtx3BodyDatas::iterator; namespace kfvtx3body @@ -480,51 +483,33 @@ DECLARE_SOA_TABLE(KFVtx3BodyDatasLite, "AOD", "KF3BODYLITE", // hypertriton candidate kfvtx3body::Mass, vtx3body::X, vtx3body::Y, vtx3body::Z, - kfvtx3body::XErr, kfvtx3body::YErr, kfvtx3body::ZErr, kfvtx3body::Px, kfvtx3body::Py, kfvtx3body::Pz, kfvtx3body::Pt, kfvtx3body::Sign, kfvtx3body::DCAVtxToPVKF, kfvtx3body::DCAXYVtxToPVKF, kfvtx3body::VtxCosPAKF, kfvtx3body::VtxCosXYPAKF, - kfvtx3body::VtxCosPAKFtopo, kfvtx3body::VtxCosXYPAKFtopo, kfvtx3body::DecayLKF, kfvtx3body::DecayLXYKF, kfvtx3body::DecayLDeltaL, kfvtx3body::Chi2geoNDF, kfvtx3body::Chi2topoNDF, kfvtx3body::CTauKFtopo, // V0 kfvtx3body::MassV0, kfvtx3body::Chi2MassV0, + kfvtx3body::CosPAV0, // daughters - vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton - vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion - vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron + vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton + vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion + vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron + kfvtx3body::TPCInnerParamTrack0, kfvtx3body::TPCInnerParamTrack1, kfvtx3body::TPCInnerParamTrack2, // proton, pion, deuteron kfvtx3body::DCATrack0ToPVKF, kfvtx3body::DCATrack1ToPVKF, kfvtx3body::DCATrack2ToPVKF, kfvtx3body::DCAxyTrack0ToPVKF, kfvtx3body::DCAxyTrack1ToPVKF, kfvtx3body::DCAxyTrack2ToPVKF, kfvtx3body::DCAxyTrack0ToSVKF, kfvtx3body::DCAxyTrack1ToSVKF, kfvtx3body::DCAxyTrack2ToSVKF, kfvtx3body::DCAxyTrack0ToTrack1KF, kfvtx3body::DCAxyTrack0ToTrack2KF, kfvtx3body::DCAxyTrack1ToTrack2KF, kfvtx3body::DCAVtxDaughtersKF, - kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV, - kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV, kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron - kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, - - // dynamic columns - vtx3body::VtxRadius, - vtx3body::DistOverTotMom, - vtx3body::VtxCosPA, - vtx3body::DCAVtxToPV, - - // Longitudinal - vtx3body::YHypertriton, - vtx3body::Eta, - vtx3body::Phi, - vtx3body::Track0Pt, // proton pT - vtx3body::Track0Eta, // proton eta - vtx3body::Track0Phi, // proton phi - vtx3body::Track1Pt, // pion pT - vtx3body::Track1Eta, // pion eta - vtx3body::Track1Phi, // pion phi - vtx3body::Track2Pt, // deuteron pT - vtx3body::Track2Eta, // deuteron eta - vtx3body::Track2Phi); // deuteron phi + kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, kfvtx3body::TPCNSigmaPionBach, + kfvtx3body::TPCdEdxProton, kfvtx3body::TPCdEdxPion, kfvtx3body::TPCdEdxDeuteron, + kfvtx3body::TOFNSigmaDeuteron, + kfvtx3body::ITSClusSizeDeuteron, + kfvtx3body::PIDTrackingDeuteron); using KFVtx3BodyDataLite = KFVtx3BodyDatasLite::iterator; @@ -547,11 +532,13 @@ DECLARE_SOA_TABLE(McKFVtx3BodyDatas, "AOD", "MCKF3BODYDATAS", // V0 kfvtx3body::MassV0, kfvtx3body::Chi2MassV0, + kfvtx3body::CosPAV0, // daughters - vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton - vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion - vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron + vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton + vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion + vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron + kfvtx3body::TPCInnerParamTrack0, kfvtx3body::TPCInnerParamTrack1, kfvtx3body::TPCInnerParamTrack2, // proton, pion, deuteron kfvtx3body::DCATrack0ToPVKF, kfvtx3body::DCATrack1ToPVKF, kfvtx3body::DCATrack2ToPVKF, kfvtx3body::DCAxyTrack0ToPVKF, kfvtx3body::DCAxyTrack1ToPVKF, kfvtx3body::DCAxyTrack2ToPVKF, kfvtx3body::DCAxyTrack0ToSVKF, kfvtx3body::DCAxyTrack1ToSVKF, kfvtx3body::DCAxyTrack2ToSVKF, kfvtx3body::DCAxyTrack0ToTrack1KF, kfvtx3body::DCAxyTrack0ToTrack2KF, kfvtx3body::DCAxyTrack1ToTrack2KF, @@ -559,7 +546,11 @@ DECLARE_SOA_TABLE(McKFVtx3BodyDatas, "AOD", "MCKF3BODYDATAS", kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV, kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV, kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron - kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, + kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, kfvtx3body::TPCNSigmaPionBach, + kfvtx3body::TPCdEdxProton, kfvtx3body::TPCdEdxPion, kfvtx3body::TPCdEdxDeuteron, + kfvtx3body::TOFNSigmaDeuteron, + kfvtx3body::ITSClusSizeDeuteron, + kfvtx3body::PIDTrackingDeuteron, // MC information kfvtx3body::GenP, @@ -569,30 +560,13 @@ DECLARE_SOA_TABLE(McKFVtx3BodyDatas, "AOD", "MCKF3BODYDATAS", kfvtx3body::GenPhi, kfvtx3body::GenEta, kfvtx3body::GenRapidity, + kfvtx3body::GenPosP, kfvtx3body::GenPosPt, + kfvtx3body::GenNegP, kfvtx3body::GenNegPt, + kfvtx3body::GenBachP, kfvtx3body::GenBachPt, kfvtx3body::IsTrueH3L, kfvtx3body::IsTrueAntiH3L, kfvtx3body::PdgCode, kfvtx3body::IsReco, - kfvtx3body::SurvEvSel, - - // dynamic columns - vtx3body::VtxRadius, - vtx3body::DistOverTotMom, - vtx3body::VtxCosPA, - vtx3body::DCAVtxToPV, - - // Longitudinal - vtx3body::YHypertriton, - vtx3body::Eta, - vtx3body::Phi, - vtx3body::Track0Pt, // proton pT - vtx3body::Track0Eta, // proton eta - vtx3body::Track0Phi, // proton phi - vtx3body::Track1Pt, // pion pT - vtx3body::Track1Eta, // pion eta - vtx3body::Track1Phi, // pion phi - vtx3body::Track2Pt, // deuteron pT - vtx3body::Track2Eta, // deuteron eta - vtx3body::Track2Phi); // deuteron phi + kfvtx3body::SurvEvSel); // Definition of labels for KFVtx3BodyDatas namespace mckfvtx3bodylabel diff --git a/PWGLF/DataModel/cascqaanalysis.h b/PWGLF/DataModel/cascqaanalysis.h index 30053e145a6..ea451559da5 100644 --- a/PWGLF/DataModel/cascqaanalysis.h +++ b/PWGLF/DataModel/cascqaanalysis.h @@ -115,6 +115,8 @@ namespace cascadesflow DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); +DECLARE_SOA_COLUMN(IsNoCollInTimeRange, isNoCollInTimeRange, bool); +DECLARE_SOA_COLUMN(IsNoCollInRof, isNoCollInRof, bool); DECLARE_SOA_COLUMN(Sign, sign, int16_t); DECLARE_SOA_COLUMN(Pt, pt, float); DECLARE_SOA_COLUMN(Eta, eta, float); @@ -160,7 +162,7 @@ DECLARE_SOA_TABLE(CascTraining, "AOD", "CascTraining", o2::soa::Index<>, mycascades::DCABachToPV, mycascades::DCACascDaughters, mycascades::DCAV0Daughters, mycascades::DCAV0ToPV, mycascades::BachBaryonCosPA, mycascades::BachBaryonDCAxyToPV, mycascades::McPdgCode); DECLARE_SOA_TABLE(CascAnalysis, "AOD", "CascAnalysis", o2::soa::Index<>, - cascadesflow::CentFT0C, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Eta, cascadesflow::Phi, cascadesflow::MassXi, cascadesflow::MassOmega, cascadesflow::V2CSP, cascadesflow::V2CEP, cascadesflow::PsiT0C, cascadesflow::BDTResponseXi, cascadesflow::BDTResponseOmega, cascadesflow::CosThetaStarLambdaFromOmega, cascadesflow::CosThetaStarLambdaFromXi, cascadesflow::CosThetaStarProton, mycascades::McPdgCode); + cascadesflow::CentFT0C, cascadesflow::IsNoCollInTimeRange, cascadesflow::IsNoCollInRof, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Eta, cascadesflow::Phi, cascadesflow::MassXi, cascadesflow::MassOmega, cascadesflow::V2CSP, cascadesflow::V2CEP, cascadesflow::PsiT0C, cascadesflow::BDTResponseXi, cascadesflow::BDTResponseOmega, cascadesflow::CosThetaStarLambdaFromOmega, cascadesflow::CosThetaStarLambdaFromXi, cascadesflow::CosThetaStarProton, mycascades::McPdgCode); namespace myMCcascades { diff --git a/PWGLF/DataModel/pidTOFGeneric.h b/PWGLF/DataModel/pidTOFGeneric.h index 2c1c9960a21..b43d4ecc9ff 100644 --- a/PWGLF/DataModel/pidTOFGeneric.h +++ b/PWGLF/DataModel/pidTOFGeneric.h @@ -51,7 +51,7 @@ namespace pidtofgeneric static constexpr float kCSPEED = TMath::C() * 1.0e2f * 1.0e-12f; // c in cm/ps -template +template class TofPidNewCollision { public: @@ -83,85 +83,95 @@ class TofPidNewCollision pidType = pidId; } - float GetTOFNSigma(o2::track::PID::ID pidId, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true) - { - float mMassHyp = o2::track::pid_constants::sMasses2Z[track.pidForTracking()]; - float expTime = track.length() * sqrt((mMassHyp * mMassHyp) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v + template + float GetTOFNSigma(o2::track::PID::ID pidId, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true); - float evTime = correctedcol.evTime(); - float evTimeErr = correctedcol.evTimeErr(); - float tofsignal = track.trackTime() * 1000 + expTime; // in ps - float expSigma, tofNsigma; + template + float GetTOFNSigma(TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true); +}; - if (originalcol.globalIndex() == correctedcol.globalIndex()) { - evTime = track.evTimeForTrack(); - evTimeErr = track.evTimeErrForTrack(); +template +template +float TofPidNewCollision::GetTOFNSigma(o2::track::PID::ID pidId, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D) +{ + float mMassHyp = o2::track::pid_constants::sMasses2Z[track.pidForTracking()]; + float expTime = track.length() * sqrt((mMassHyp * mMassHyp) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v + + float evTime = correctedcol.evTime(); + float evTimeErr = correctedcol.evTimeErr(); + float tofsignal = track.trackTime() * 1000 + expTime; // in ps + float expSigma, tofNsigma; + + if (originalcol.globalIndex() == correctedcol.globalIndex()) { + evTime = track.evTimeForTrack(); + evTimeErr = track.evTimeErrForTrack(); + } else { + if (EnableBCAO2D) { + auto originalbc = originalcol.template bc_as(); + auto correctedbc = correctedcol.template bc_as(); + o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR(originalbc.globalBC()); + o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR(correctedbc.globalBC()); + tofsignal += originalIR.differenceInBCNS(correctedIR) * 1000; } else { - if (EnableBCAO2D) { - auto originalbc = originalcol.template bc_as(); - auto correctedbc = correctedcol.template bc_as(); - o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR(originalbc.globalBC()); - o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR(correctedbc.globalBC()); - tofsignal += originalIR.differenceInBCNS(correctedIR) * 1000; - } else { - auto originalbc = originalcol.template foundBC_as(); - auto correctedbc = correctedcol.template foundBC_as(); - o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR(originalbc.globalBC()); - o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR(correctedbc.globalBC()); - tofsignal += originalIR.differenceInBCNS(correctedIR) * 1000; - } + auto originalbc = originalcol.template foundBC_as(); + auto correctedbc = correctedcol.template foundBC_as(); + o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR(originalbc.globalBC()); + o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR(correctedbc.globalBC()); + tofsignal += originalIR.differenceInBCNS(correctedIR) * 1000; } - - switch (pidId) { - case 0: - expSigma = responseEl.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseEl.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 1: - expSigma = responseMu.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseMu.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 2: - expSigma = responsePi.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responsePi.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 3: - expSigma = responseKa.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseKa.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 4: - expSigma = responsePr.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responsePr.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 5: - expSigma = responseDe.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseDe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 6: - expSigma = responseTr.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseTr.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 7: - expSigma = responseHe.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseHe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 8: - expSigma = responseAl.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseAl.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - default: - LOG(fatal) << "Wrong particle ID in TofPidSecondary class"; - return -999; - } - - return tofNsigma; } - float GetTOFNSigma(TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true) - { - return GetTOFNSigma(pidType, track, originalcol, correctedcol, EnableBCAO2D); + switch (pidId) { + case 0: + expSigma = responseEl.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseEl.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + case 1: + expSigma = responseMu.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseMu.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + case 2: + expSigma = responsePi.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responsePi.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + case 3: + expSigma = responseKa.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseKa.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + case 4: + expSigma = responsePr.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responsePr.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + case 5: + expSigma = responseDe.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseDe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + case 6: + expSigma = responseTr.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseTr.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + case 7: + expSigma = responseHe.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseHe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + case 8: + expSigma = responseAl.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseAl.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; + break; + default: + LOG(fatal) << "Wrong particle ID in TofPidSecondary class"; + return -999; } -}; + + return tofNsigma; +} + +template +template +float TofPidNewCollision::GetTOFNSigma(TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D) +{ + return GetTOFNSigma(pidType, track, originalcol, correctedcol, EnableBCAO2D); +} } // namespace pidtofgeneric } // namespace o2::aod diff --git a/PWGLF/TableProducer/Common/epvector.cxx b/PWGLF/TableProducer/Common/epvector.cxx index f5c2aad66b9..c5ceda81949 100644 --- a/PWGLF/TableProducer/Common/epvector.cxx +++ b/PWGLF/TableProducer/Common/epvector.cxx @@ -25,6 +25,7 @@ #include #include #include +#include // o2Physics includes. #include "Framework/AnalysisDataModel.h" @@ -95,9 +96,14 @@ struct epvector { Configurable useGainCallib{"useGainCallib", true, "use gain calibration"}; Configurable useRecentere{"useRecentere", true, "use Recentering"}; Configurable useShift{"useShift", false, "use Shift"}; + Configurable useShift2{"useShift2", false, "use Shift for others"}; Configurable ConfGainPath{"ConfGainPath", "Users/s/skundu/My/Object/test100", "Path to gain calibration"}; Configurable ConfRecentere{"ConfRecentere", "Users/s/skundu/My/Object/Finaltest2/recenereall", "Path for recentere"}; Configurable ConfShift{"ConfShift", "Users/s/skundu/My/Object/Finaltest2/recenereall", "Path for Shift"}; + Configurable ConfShiftFT0A{"ConfShiftFT0A", "Users/s/skundu/My/Object/Finaltest2/recenereall", "Path for Shift FT0A"}; + Configurable ConfShiftTPC{"ConfShiftTPC", "Users/s/skundu/My/Object/Finaltest2/recenereall", "Path for Shift TPC"}; + Configurable ConfShiftTPCL{"ConfShiftTPCL", "Users/s/skundu/My/Object/Finaltest2/recenereall", "Path for Shift TPCL"}; + Configurable ConfShiftTPCR{"ConfShiftTPCR", "Users/s/skundu/My/Object/Finaltest2/recenereall", "Path for Shift TPCR"}; ConfigurableAxis configAxisCentrality{"configAxisCentrality", {80, 0.0, 80}, "centrality bining"}; // Event selection cuts - Alex TF1* fMultPVCutLow = nullptr; @@ -166,6 +172,10 @@ struct epvector { histos.add("QTPC", "QTPC", kTH3F, {centAxis, qAxis, occupancyAxis}); histos.add("ShiftFT0C", "ShiftFT0C", kTProfile3D, {centAxis, basisAxis, shiftAxis}); + histos.add("ShiftFT0A", "ShiftFT0A", kTProfile3D, {centAxis, basisAxis, shiftAxis}); + histos.add("ShiftTPC", "ShiftTPC", kTProfile3D, {centAxis, basisAxis, shiftAxis}); + histos.add("ShiftTPCL", "ShiftTPCL", kTProfile3D, {centAxis, basisAxis, shiftAxis}); + histos.add("ShiftTPCR", "ShiftTPCR", kTProfile3D, {centAxis, basisAxis, shiftAxis}); // Event selection cut additional - Alex // if (additionalEvsel) { @@ -254,6 +264,10 @@ struct epvector { TProfile* gainprofile; TH2D* hrecentere; TProfile3D* shiftprofile; + TProfile3D* shiftprofile2; + TProfile3D* shiftprofile3; + TProfile3D* shiftprofile4; + TProfile3D* shiftprofile5; Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); @@ -361,15 +375,46 @@ struct epvector { if (useShift && (currentRunNumber != lastRunNumber)) { shiftprofile = ccdb->getForTimeStamp(ConfShift.value, bc.timestamp()); + if (useShift2) { + shiftprofile2 = ccdb->getForTimeStamp(ConfShiftFT0A.value, bc.timestamp()); + shiftprofile3 = ccdb->getForTimeStamp(ConfShiftTPC.value, bc.timestamp()); + shiftprofile4 = ccdb->getForTimeStamp(ConfShiftTPCL.value, bc.timestamp()); + shiftprofile5 = ccdb->getForTimeStamp(ConfShiftTPCR.value, bc.timestamp()); + } } if (useShift) { auto deltapsiFT0C = 0.0; + auto deltapsiFT0A = 0.0; + auto deltapsiTPC = 0.0; + auto deltapsiTPCL = 0.0; + auto deltapsiTPCR = 0.0; for (int ishift = 1; ishift <= 10; ishift++) { auto coeffshiftxFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(centrality, 0.5, ishift - 0.5)); auto coeffshiftyFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(centrality, 1.5, ishift - 0.5)); deltapsiFT0C = deltapsiFT0C + ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * 2.0 * psiFT0C) + coeffshiftyFT0C * TMath::Sin(ishift * 2.0 * psiFT0C))); + if (useShift2) { + auto coeffshiftxFT0A = shiftprofile2->GetBinContent(shiftprofile2->FindBin(centrality, 0.5, ishift - 0.5)); + auto coeffshiftyFT0A = shiftprofile2->GetBinContent(shiftprofile2->FindBin(centrality, 1.5, ishift - 0.5)); + + auto coeffshiftxTPC = shiftprofile3->GetBinContent(shiftprofile3->FindBin(centrality, 0.5, ishift - 0.5)); + auto coeffshiftyTPC = shiftprofile3->GetBinContent(shiftprofile3->FindBin(centrality, 1.5, ishift - 0.5)); + + auto coeffshiftxTPCL = shiftprofile4->GetBinContent(shiftprofile4->FindBin(centrality, 0.5, ishift - 0.5)); + auto coeffshiftyTPCL = shiftprofile4->GetBinContent(shiftprofile4->FindBin(centrality, 1.5, ishift - 0.5)); + + auto coeffshiftxTPCR = shiftprofile5->GetBinContent(shiftprofile5->FindBin(centrality, 0.5, ishift - 0.5)); + auto coeffshiftyTPCR = shiftprofile5->GetBinContent(shiftprofile5->FindBin(centrality, 1.5, ishift - 0.5)); + deltapsiFT0A = deltapsiFT0A + ((1 / (1.0 * ishift)) * (-coeffshiftxFT0A * TMath::Cos(ishift * 2.0 * psiFT0A) + coeffshiftyFT0A * TMath::Sin(ishift * 2.0 * psiFT0A))); + deltapsiTPC = deltapsiTPC + ((1 / (1.0 * ishift)) * (-coeffshiftxTPC * TMath::Cos(ishift * 2.0 * psiTPC) + coeffshiftyTPC * TMath::Sin(ishift * 2.0 * psiTPC))); + deltapsiTPCL = deltapsiTPCL + ((1 / (1.0 * ishift)) * (-coeffshiftxTPCL * TMath::Cos(ishift * 2.0 * psiTPCL) + coeffshiftyTPCL * TMath::Sin(ishift * 2.0 * psiTPCL))); + deltapsiTPCR = deltapsiTPCR + ((1 / (1.0 * ishift)) * (-coeffshiftxTPCR * TMath::Cos(ishift * 2.0 * psiTPCR) + coeffshiftyTPCR * TMath::Sin(ishift * 2.0 * psiTPCR))); + } } psiFT0C = psiFT0C + deltapsiFT0C; + psiFT0A = psiFT0A + deltapsiFT0A; + psiTPC = psiTPC + deltapsiTPC; + psiTPCL = psiTPCL + deltapsiTPCL; + psiTPCR = psiTPCR + deltapsiTPCR; } histos.fill(HIST("QxFT0C"), centrality, qxFT0C); histos.fill(HIST("QyFT0C"), centrality, qyFT0C); @@ -416,6 +461,18 @@ struct epvector { for (int ishift = 1; ishift <= 10; ishift++) { histos.fill(HIST("ShiftFT0C"), centrality, 0.5, ishift - 0.5, TMath::Sin(ishift * 2.0 * psiFT0C)); histos.fill(HIST("ShiftFT0C"), centrality, 1.5, ishift - 0.5, TMath::Cos(ishift * 2.0 * psiFT0C)); + + histos.fill(HIST("ShiftFT0A"), centrality, 0.5, ishift - 0.5, TMath::Sin(ishift * 2.0 * psiFT0A)); + histos.fill(HIST("ShiftFT0A"), centrality, 1.5, ishift - 0.5, TMath::Cos(ishift * 2.0 * psiFT0A)); + + histos.fill(HIST("ShiftTPC"), centrality, 0.5, ishift - 0.5, TMath::Sin(ishift * 2.0 * psiTPC)); + histos.fill(HIST("ShiftTPC"), centrality, 1.5, ishift - 0.5, TMath::Cos(ishift * 2.0 * psiTPC)); + + histos.fill(HIST("ShiftTPCL"), centrality, 0.5, ishift - 0.5, TMath::Sin(ishift * 2.0 * psiTPCL)); + histos.fill(HIST("ShiftTPCL"), centrality, 1.5, ishift - 0.5, TMath::Cos(ishift * 2.0 * psiTPCL)); + + histos.fill(HIST("ShiftTPCR"), centrality, 0.5, ishift - 0.5, TMath::Sin(ishift * 2.0 * psiTPCR)); + histos.fill(HIST("ShiftTPCR"), centrality, 1.5, ishift - 0.5, TMath::Cos(ishift * 2.0 * psiTPCR)); } lastRunNumber = currentRunNumber; } diff --git a/PWGLF/TableProducer/Common/spvector.cxx b/PWGLF/TableProducer/Common/spvector.cxx index 262d8e6c59d..d3318cd1aa7 100644 --- a/PWGLF/TableProducer/Common/spvector.cxx +++ b/PWGLF/TableProducer/Common/spvector.cxx @@ -126,6 +126,8 @@ struct spvector { Configurable lfinebinCent{"lfinebinCent", 0.0, "lower bin value in cent fine histograms"}; Configurable hfinebinCent{"hfinebinCent", 80.0, "higher bin value in cent fine histograms"}; Configurable QA{"QA", false, "QA histograms"}; + Configurable useShift{"useShift", false, "shift histograms"}; + Configurable nshift{"nshift", 10, "no. of iterations in shifting"}; Configurable ispolarization{"ispolarization", false, "Flag to check polarization"}; Configurable finecorrection{"finecorrection", false, "Flag to check fine correction"}; Configurable rejbadevent{"rejbadevent", true, "Flag to check bad events"}; @@ -150,6 +152,8 @@ struct spvector { Configurable ConfRecenterevySp{"ConfRecenterevySp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere"}; Configurable ConfRecenterevzSp{"ConfRecenterevzSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere"}; Configurable ConfRecenteresqSp{"ConfRecenteresqSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recenteresq"}; + Configurable ConfShiftC{"ConfShiftC", "Users/p/prottay/My/Object/Testinglocaltree/shiftcallib2", "Path to shift C"}; + Configurable ConfShiftA{"ConfShiftA", "Users/p/prottay/My/Object/Testinglocaltree/shiftcallib2", "Path to shift A"}; // Event selection cuts - Alex TF1* fMultPVCutLow = nullptr; @@ -161,7 +165,7 @@ struct spvector { int mRunNumber{-1}; template - bool eventSelected(TCollision collision, const float& centrality) + bool eventSelected(TCollision collision, const double& centrality) { auto multNTracksPV = collision.multNTracksPV(); if (multNTracksPV < fMultPVCutLow->Eval(centrality)) @@ -197,6 +201,8 @@ struct spvector { AxisSpec vxfineAxis = {VxfineNbins, lfinebinVx, hfinebinVx, "vxfine"}; AxisSpec vyfineAxis = {VyfineNbins, lfinebinVy, hfinebinVy, "vyfine"}; AxisSpec centfineAxis = {CentfineNbins, lfinebinCent, hfinebinCent, "V0M (%) fine"}; + AxisSpec shiftAxis = {10, 0, 10, "shift"}; + AxisSpec basisAxis = {2, 0, 2, "basis"}; histos.add("hCentrality", "hCentrality", kTH1F, {{centfineAxis}}); histos.add("hpQxZDCAC", "hpQxZDCAC", kTProfile, {centfineAxis}); @@ -246,6 +252,8 @@ struct spvector { histos.add("ZDCAmp", "ZDCAmp", kTProfile2D, {channelZDCAxis, vzfineAxis}); histos.add("ZDCAmpCommon", "ZDCAmpCommon", kTProfile2D, {{2, 0.0, 2.0}, vzfineAxis}); // histos.add("ZDCAmpCommon", "ZDCAmpCommon", kTProfile3D, {{2,0.0,2.0}, vzfineAxis, centfineAxis}); + histos.add("ShiftZDCC", "ShiftZDCC", kTProfile3D, {centfineAxis, basisAxis, shiftAxis}); + histos.add("ShiftZDCA", "ShiftZDCA", kTProfile3D, {centfineAxis, basisAxis, shiftAxis}); if (QA) { histos.add("Vz", "Vz", kTH1F, {vzfineAxis}); @@ -283,6 +291,8 @@ struct spvector { TH2F* hrecenterevySp; TH2F* hrecenterevzSp; THnF* hrecenteresqSp; + TProfile3D* shiftprofileA; + TProfile3D* shiftprofileC; // Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; // Filter centralityFilter = (nabs(aod::cent::centFT0C) < cfgCutCentralityMax && nabs(aod::cent::centFT0C) > cfgCutCentralityMin); @@ -309,8 +319,8 @@ struct spvector { auto vx = collision.posX(); auto vy = collision.posY(); - float psiZDCC = -99; - float psiZDCA = -99; + double psiZDCC = -99; + double psiZDCA = -99; auto qxZDCA = 0.0; auto qxZDCC = 0.0; auto qyZDCA = 0.0; @@ -338,12 +348,12 @@ struct spvector { return; } - if (znaEnergy[0] < 0.0 || znaEnergy[1] < 0.0 || znaEnergy[2] < 0.0 || znaEnergy[3] < 0.0) { + if (znaEnergy[0] <= 0.0 || znaEnergy[1] <= 0.0 || znaEnergy[2] <= 0.0 || znaEnergy[3] <= 0.0) { triggerevent = false; spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA); return; } - if (zncEnergy[0] < 0.0 || zncEnergy[1] < 0.0 || zncEnergy[2] < 0.0 || zncEnergy[3] < 0.0) { + if (zncEnergy[0] <= 0.0 || zncEnergy[1] <= 0.0 || zncEnergy[2] <= 0.0 || zncEnergy[3] <= 0.0) { triggerevent = false; spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA); return; @@ -360,8 +370,8 @@ struct spvector { auto gainequal = 1.0; auto alphaZDC = 0.395; - constexpr float x[4] = {-1.75, 1.75, -1.75, 1.75}; - constexpr float y[4] = {-1.75, -1.75, 1.75, 1.75}; + constexpr double x[4] = {-1.75, 1.75, -1.75, 1.75}; + constexpr double y[4] = {-1.75, -1.75, 1.75, 1.75}; // histos.fill(HIST("ZDCAmpCommon"), 0.5, vz, centrality, znaEnergycommon); // histos.fill(HIST("ZDCAmpCommon"), 1.5, vz, centrality, zncEnergycommon); @@ -384,11 +394,11 @@ struct spvector { spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA); return; } else { - float ampl = gainequal * znaEnergy[iChA]; + double ampl = gainequal * znaEnergy[iChA]; if (followpub) { ampl = TMath::Power(ampl, alphaZDC); } - qxZDCA = qxZDCA + ampl * x[iChA]; + qxZDCA = qxZDCA - ampl * x[iChA]; qyZDCA = qyZDCA + ampl * y[iChA]; sumA = sumA + ampl; histos.fill(HIST("ZDCAmp"), chanelid + 0.5, vz, ampl); @@ -400,11 +410,11 @@ struct spvector { spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA); return; } else { - float ampl = gainequal * zncEnergy[iChA - 4]; + double ampl = gainequal * zncEnergy[iChA - 4]; if (followpub) { ampl = TMath::Power(ampl, alphaZDC); } - qxZDCC = qxZDCC - ampl * x[iChA - 4]; + qxZDCC = qxZDCC + ampl * x[iChA - 4]; qyZDCC = qyZDCC + ampl * y[iChA - 4]; sumC = sumC + ampl; histos.fill(HIST("ZDCAmp"), chanelid + 0.5, vz, ampl); @@ -422,11 +432,6 @@ struct spvector { qxZDCC = qxZDCC / sumC; qyZDCC = qyZDCC / sumC; } - } else { - qxZDCA = qxZDCA; - qxZDCC = qxZDCC; - qyZDCA = qyZDCA; - qyZDCC = qyZDCC; } if (sumA <= 1e-4 || sumC <= 1e-4) { qxZDCA = 0.0; @@ -474,24 +479,24 @@ struct spvector { // Get the global bin for meanxA int globalBinMeanxA = hrecentereSp->GetBin(binCoords); - float meanxA = hrecentereSp->GetBinContent(globalBinMeanxA); - float meanxAerror = hrecentereSp->GetBinError(globalBinMeanxA); + double meanxA = hrecentereSp->GetBinContent(globalBinMeanxA); + double meanxAerror = hrecentereSp->GetBinError(globalBinMeanxA); // Repeat for other channels (meanyA, meanxC, meanyC) binCoords[4] = channelAxis->FindBin(1.5); // Channel for meanyA int globalBinMeanyA = hrecentereSp->GetBin(binCoords); - float meanyA = hrecentereSp->GetBinContent(globalBinMeanyA); - float meanyAerror = hrecentereSp->GetBinError(globalBinMeanyA); + double meanyA = hrecentereSp->GetBinContent(globalBinMeanyA); + double meanyAerror = hrecentereSp->GetBinError(globalBinMeanyA); binCoords[4] = channelAxis->FindBin(2.5); // Channel for meanxC int globalBinMeanxC = hrecentereSp->GetBin(binCoords); - float meanxC = hrecentereSp->GetBinContent(globalBinMeanxC); - float meanxCerror = hrecentereSp->GetBinError(globalBinMeanxC); + double meanxC = hrecentereSp->GetBinContent(globalBinMeanxC); + double meanxCerror = hrecentereSp->GetBinError(globalBinMeanxC); binCoords[4] = channelAxis->FindBin(3.5); // Channel for meanyC int globalBinMeanyC = hrecentereSp->GetBin(binCoords); - float meanyC = hrecentereSp->GetBinContent(globalBinMeanyC); - float meanyCerror = hrecentereSp->GetBinError(globalBinMeanyC); + double meanyC = hrecentereSp->GetBinContent(globalBinMeanyC); + double meanyCerror = hrecentereSp->GetBinError(globalBinMeanyC); if (rejbadevent) { if ((TMath::Abs(meanxA) > 90000.0 || TMath::Abs(meanxC) > 90000.0 || TMath::Abs(meanyA) > 90000.0 || TMath::Abs(meanyC) > 90000.0) && (TMath::Abs(meanxAerror) > 9000.0 || TMath::Abs(meanxCerror) > 9000.0 || TMath::Abs(meanyAerror) > 9000.0 || TMath::Abs(meanyCerror) > 9000.0)) { @@ -524,15 +529,15 @@ struct spvector { if (useRecenterefineSp && hrecenterecentSp) { - float meanxAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 0.5)); - float meanyAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 1.5)); - float meanxCcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 2.5)); - float meanyCcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 3.5)); + double meanxAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 0.5)); + double meanyAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 1.5)); + double meanxCcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 2.5)); + double meanyCcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 3.5)); - float meanxAcenterror = hrecenterecentSp->GetBinError(hrecenterecentSp->FindBin(centrality, 0.5)); - float meanyAcenterror = hrecenterecentSp->GetBinError(hrecenterecentSp->FindBin(centrality, 1.5)); - float meanxCcenterror = hrecenterecentSp->GetBinError(hrecenterecentSp->FindBin(centrality, 2.5)); - float meanyCcenterror = hrecenterecentSp->GetBinError(hrecenterecentSp->FindBin(centrality, 3.5)); + double meanxAcenterror = hrecenterecentSp->GetBinError(hrecenterecentSp->FindBin(centrality, 0.5)); + double meanyAcenterror = hrecenterecentSp->GetBinError(hrecenterecentSp->FindBin(centrality, 1.5)); + double meanxCcenterror = hrecenterecentSp->GetBinError(hrecenterecentSp->FindBin(centrality, 2.5)); + double meanyCcenterror = hrecenterecentSp->GetBinError(hrecenterecentSp->FindBin(centrality, 3.5)); if (rejbadeventcent) { if ((TMath::Abs(meanxAcent) > 90000.0 || TMath::Abs(meanxCcent) > 90000.0 || TMath::Abs(meanyAcent) > 90000.0 || TMath::Abs(meanyCcent) > 90000.0) && (TMath::Abs(meanxAcenterror) > 9000.0 || TMath::Abs(meanxCcenterror) > 9000.0 || TMath::Abs(meanyAcenterror) > 9000.0 || TMath::Abs(meanyCcenterror) > 9000.0)) { @@ -557,15 +562,15 @@ struct spvector { if (useRecenterefineSp && hrecenterevxSp) { - float meanxAvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 0.5)); - float meanyAvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 1.5)); - float meanxCvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 2.5)); - float meanyCvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 3.5)); + double meanxAvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 0.5)); + double meanyAvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 1.5)); + double meanxCvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 2.5)); + double meanyCvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 3.5)); - float meanxAvxerror = hrecenterevxSp->GetBinError(hrecenterevxSp->FindBin(vx, 0.5)); - float meanyAvxerror = hrecenterevxSp->GetBinError(hrecenterevxSp->FindBin(vx, 1.5)); - float meanxCvxerror = hrecenterevxSp->GetBinError(hrecenterevxSp->FindBin(vx, 2.5)); - float meanyCvxerror = hrecenterevxSp->GetBinError(hrecenterevxSp->FindBin(vx, 3.5)); + double meanxAvxerror = hrecenterevxSp->GetBinError(hrecenterevxSp->FindBin(vx, 0.5)); + double meanyAvxerror = hrecenterevxSp->GetBinError(hrecenterevxSp->FindBin(vx, 1.5)); + double meanxCvxerror = hrecenterevxSp->GetBinError(hrecenterevxSp->FindBin(vx, 2.5)); + double meanyCvxerror = hrecenterevxSp->GetBinError(hrecenterevxSp->FindBin(vx, 3.5)); if (rejbadeventvx) { if ((TMath::Abs(meanxAvx) > 90000.0 || TMath::Abs(meanxCvx) > 90000.0 || TMath::Abs(meanyAvx) > 90000.0 || TMath::Abs(meanyCvx) > 90000.0) && (TMath::Abs(meanxAvxerror) > 9000.0 || TMath::Abs(meanxCvxerror) > 9000.0 || TMath::Abs(meanyAvxerror) > 9000.0 || TMath::Abs(meanyCvxerror) > 9000.0)) { @@ -590,15 +595,15 @@ struct spvector { if (useRecenterefineSp && hrecenterevySp) { - float meanxAvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 0.5)); - float meanyAvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 1.5)); - float meanxCvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 2.5)); - float meanyCvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 3.5)); + double meanxAvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 0.5)); + double meanyAvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 1.5)); + double meanxCvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 2.5)); + double meanyCvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 3.5)); - float meanxAvyerror = hrecenterevySp->GetBinError(hrecenterevySp->FindBin(vy, 0.5)); - float meanyAvyerror = hrecenterevySp->GetBinError(hrecenterevySp->FindBin(vy, 1.5)); - float meanxCvyerror = hrecenterevySp->GetBinError(hrecenterevySp->FindBin(vy, 2.5)); - float meanyCvyerror = hrecenterevySp->GetBinError(hrecenterevySp->FindBin(vy, 3.5)); + double meanxAvyerror = hrecenterevySp->GetBinError(hrecenterevySp->FindBin(vy, 0.5)); + double meanyAvyerror = hrecenterevySp->GetBinError(hrecenterevySp->FindBin(vy, 1.5)); + double meanxCvyerror = hrecenterevySp->GetBinError(hrecenterevySp->FindBin(vy, 2.5)); + double meanyCvyerror = hrecenterevySp->GetBinError(hrecenterevySp->FindBin(vy, 3.5)); if (rejbadeventvy) { if ((TMath::Abs(meanxAvy) > 90000.0 || TMath::Abs(meanxCvy) > 90000.0 || TMath::Abs(meanyAvy) > 90000.0 || TMath::Abs(meanyCvy) > 90000.0) && (TMath::Abs(meanxAvyerror) > 9000.0 || TMath::Abs(meanxCvyerror) > 9000.0 || TMath::Abs(meanyAvyerror) > 9000.0 || TMath::Abs(meanyCvyerror) > 9000.0)) { @@ -623,15 +628,15 @@ struct spvector { if (useRecenterefineSp && hrecenterevzSp) { - float meanxAvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 0.5)); - float meanyAvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 1.5)); - float meanxCvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 2.5)); - float meanyCvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 3.5)); + double meanxAvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 0.5)); + double meanyAvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 1.5)); + double meanxCvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 2.5)); + double meanyCvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 3.5)); - float meanxAvzerror = hrecenterevzSp->GetBinError(hrecenterevzSp->FindBin(vz, 0.5)); - float meanyAvzerror = hrecenterevzSp->GetBinError(hrecenterevzSp->FindBin(vz, 1.5)); - float meanxCvzerror = hrecenterevzSp->GetBinError(hrecenterevzSp->FindBin(vz, 2.5)); - float meanyCvzerror = hrecenterevzSp->GetBinError(hrecenterevzSp->FindBin(vz, 3.5)); + double meanxAvzerror = hrecenterevzSp->GetBinError(hrecenterevzSp->FindBin(vz, 0.5)); + double meanyAvzerror = hrecenterevzSp->GetBinError(hrecenterevzSp->FindBin(vz, 1.5)); + double meanxCvzerror = hrecenterevzSp->GetBinError(hrecenterevzSp->FindBin(vz, 2.5)); + double meanyCvzerror = hrecenterevzSp->GetBinError(hrecenterevzSp->FindBin(vz, 3.5)); if (rejbadeventvz) { if ((TMath::Abs(meanxAvz) > 90000.0 || TMath::Abs(meanxCvz) > 90000.0 || TMath::Abs(meanyAvz) > 90000.0 || TMath::Abs(meanyCvz) > 90000.0) && (TMath::Abs(meanxAvzerror) > 9000.0 || TMath::Abs(meanxCvzerror) > 9000.0 || TMath::Abs(meanyAvzerror) > 9000.0 || TMath::Abs(meanyCvzerror) > 9000.0)) { @@ -659,6 +664,32 @@ struct spvector { psiZDCC = 1.0 * TMath::ATan2(qyZDCC, qxZDCC); psiZDCA = 1.0 * TMath::ATan2(qyZDCA, qxZDCA); + if (useShift && (currentRunNumber != lastRunNumber)) { + shiftprofileC = ccdb->getForTimeStamp(ConfShiftC.value, bc.timestamp()); + shiftprofileA = ccdb->getForTimeStamp(ConfShiftA.value, bc.timestamp()); + } + if (useShift) { + auto deltapsiZDCC = 0.0; + auto deltapsiZDCA = 0.0; + for (int ishift = 1; ishift <= nshift; ishift++) { + auto coeffshiftxZDCC = shiftprofileC->GetBinContent(shiftprofileC->FindBin(centrality, 0.5, ishift - 0.5)); + auto coeffshiftyZDCC = shiftprofileC->GetBinContent(shiftprofileC->FindBin(centrality, 1.5, ishift - 0.5)); + auto coeffshiftxZDCA = shiftprofileA->GetBinContent(shiftprofileA->FindBin(centrality, 0.5, ishift - 0.5)); + auto coeffshiftyZDCA = shiftprofileA->GetBinContent(shiftprofileA->FindBin(centrality, 1.5, ishift - 0.5)); + deltapsiZDCC = deltapsiZDCC + ((2 / (1.0 * ishift)) * (-coeffshiftxZDCC * TMath::Cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * TMath::Sin(ishift * 1.0 * psiZDCC))); + deltapsiZDCA = deltapsiZDCA + ((2 / (1.0 * ishift)) * (-coeffshiftxZDCA * TMath::Cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * TMath::Sin(ishift * 1.0 * psiZDCA))); + } + psiZDCC = psiZDCC + deltapsiZDCC; + psiZDCA = psiZDCA + deltapsiZDCA; + } + + for (int ishift = 1; ishift <= nshift; ishift++) { + histos.fill(HIST("ShiftZDCC"), centrality, 0.5, ishift - 0.5, TMath::Sin(ishift * 1.0 * psiZDCC)); + histos.fill(HIST("ShiftZDCC"), centrality, 1.5, ishift - 0.5, TMath::Cos(ishift * 1.0 * psiZDCC)); + histos.fill(HIST("ShiftZDCA"), centrality, 0.5, ishift - 0.5, TMath::Sin(ishift * 1.0 * psiZDCA)); + histos.fill(HIST("ShiftZDCA"), centrality, 1.5, ishift - 0.5, TMath::Cos(ishift * 1.0 * psiZDCA)); + } + histos.fill(HIST("hpQxZDCAC"), centrality, (qxZDCA * qxZDCC)); histos.fill(HIST("hpQyZDCAC"), centrality, (qyZDCA * qyZDCC)); histos.fill(HIST("hpQxZDCAQyZDCC"), centrality, (qxZDCA * qyZDCC)); diff --git a/PWGLF/TableProducer/Nuspex/CMakeLists.txt b/PWGLF/TableProducer/Nuspex/CMakeLists.txt index 7e0d4bcbe4e..99b1df8d314 100644 --- a/PWGLF/TableProducer/Nuspex/CMakeLists.txt +++ b/PWGLF/TableProducer/Nuspex/CMakeLists.txt @@ -44,8 +44,8 @@ o2physics_add_dpl_workflow(nucleustreecreator PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(lithium4analysis - SOURCES lithium4analysis.cxx +o2physics_add_dpl_workflow(he3hadronfemto + SOURCES he3HadronFemto.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) @@ -66,7 +66,7 @@ o2physics_add_dpl_workflow(threebodymcfinder o2physics_add_dpl_workflow(threebody-reco-task SOURCES threebodyRecoTask.cxx - PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(ebye-maker @@ -88,3 +88,13 @@ o2physics_add_dpl_workflow(threebody-kf-task SOURCES threebodyKFTask.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(hypernuclei-kf-reco-task + SOURCES hypKfRecoTask.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore KFParticle::KFParticle + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(hypernuclei-kf-tree-creator + SOURCES hypKfTreeCreator.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx b/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx index 676572e035d..237b4538a2d 100644 --- a/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx +++ b/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx @@ -45,6 +45,7 @@ #include "Common/TableProducer/PID/pidTOFBase.h" #include "Common/Core/PID/TPCPIDResponse.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" #include "DCAFitter/DCAFitterN.h" #include "PWGLF/DataModel/LFClusterStudiesTable.h" @@ -234,6 +235,12 @@ struct LfTreeCreatorClusterStudies { {"nSigmaTOFDe", "nSigma TOF Deuteron; signed #it{p} (GeV/#it{c}); n#sigma_{TOF} d", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {100, -3.0f, 3.0f}}}}, {"TOFmassDe", "TOF mass De; signed #it{p}_{T} (GeV/#it{c}); mass_{TOF} ^{3}He (GeV/#it{c}^2)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {100, 1.0f, 5.0f}}}}, {"TOFmassHe", "TOF mass He3; signed #it{p}_{T} (GeV/#it{c}); mass_{TOF} ^{3}He (GeV/#it{c}^2)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {100, 1.0f, 5.0f}}}}, + {"nSigmaITSEl", "nSigma ITS Electron; signed #it{p} (GeV/#it{c}); n#sigma_{ITS} e", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {60, -2.0f, 2.0f}}}}, + {"nSigmaITSPi", "nSigma ITS Pion; signed #it{p} (GeV/#it{c}); n#sigma_{ITS} #pi", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {60, -3.0f, 3.0f}}}}, + {"nSigmaITSKa", "nSigma ITS Kaon; signed #it{p} (GeV/#it{c}); n#sigma_{ITS} e", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {60, -4.0f, 4.0f}}}}, + {"nSigmaITSPr", "nSigma ITS Proton; signed #it{p} (GeV/#it{c}); n#sigma_{ITS} p", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {60, -3.0f, 3.0f}}}}, + {"nSigmaITSDe", "nSigma ITS Deuteron; signed #it{p} (GeV/#it{c}); n#sigma_{ITS} d", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {100, -3.0f, 3.0f}}}}, + {"nSigmaITSHe", "nSigma ITS He3; signed #it{p} (GeV/#it{c}); n#sigma_{ITS} ^{3}He", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {100, -3.0f, 3.0f}}}}, {"pmatchingEl", "#it{p} matching e; signed #it{p}_{TPC} (GeV/#it{c}); #frac{#it{p}_{TPC} - #it{p}}{#it{p}_{TPC}}", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {100, -0.5f, 0.5f}}}}, {"pmatchingPi", "#it{p} matching #pi; signed #it{p}_{TPC} (GeV/#it{c}); #frac{#it{p}_{TPC} - #it{p}}{#it{p}_{TPC}}", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {100, -0.5f, 0.5f}}}}, {"pmatchingKa", "#it{p} matching K; signed #it{p}_{TPC} (GeV/#it{c}); #frac{#it{p}_{TPC} - #it{p}}{#it{p}_{TPC}}", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {100, -0.5f, 0.5f}}}}, @@ -258,8 +265,7 @@ struct LfTreeCreatorClusterStudies { std::vector m_v0TrackParCovs; o2::vertexing::DCAFitterN<2> m_fitter; - o2::pid::tof::Beta m_responseBeta; - o2::pid::tof::Beta m_responseBetaMc; + o2::aod::ITSResponse m_responseITS; template bool initializeFitter(const T& trackParCovA, const T& trackParCovB) @@ -442,15 +448,9 @@ struct LfTreeCreatorClusterStudies { template float computeTOFmassDe(const T& candidate) { - if constexpr (isMC) { - float beta = m_responseBetaMc.GetBeta(candidate); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - return candidate.tpcInnerParam() * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); - } else { - float beta = m_responseBeta.GetBeta(candidate); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - return candidate.tpcInnerParam() * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); - } + float beta = o2::pid::tof::Beta::GetBeta(candidate); + beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked + return candidate.tpcInnerParam() * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); } // ========================================================================================================= @@ -478,20 +478,11 @@ struct LfTreeCreatorClusterStudies { template float computeTOFmassHe3(const T& candidate) { - if constexpr (isMC) { - float beta = m_responseBetaMc.GetBeta(candidate); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - bool heliumPID = candidate.pidForTracking() == o2::track::PID::Helium3 || candidate.pidForTracking() == o2::track::PID::Alpha; - float correctedTPCinnerParamHe3 = (heliumPID && he3setting_compensatePIDinTracking) ? candidate.tpcInnerParam() / 2.f : candidate.tpcInnerParam(); - return correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); - } else { - float beta = m_responseBeta.GetBeta(candidate); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - bool heliumPID = candidate.pidForTracking() == o2::track::PID::Helium3 || candidate.pidForTracking() == o2::track::PID::Alpha; - float correctedTPCinnerParamHe3 = (heliumPID && he3setting_compensatePIDinTracking) ? candidate.tpcInnerParam() / 2.f : candidate.tpcInnerParam(); - return correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); - } - return -999.f; + float beta = o2::pid::tof::Beta::GetBeta(candidate); + beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked + bool heliumPID = candidate.pidForTracking() == o2::track::PID::Helium3 || candidate.pidForTracking() == o2::track::PID::Alpha; + float correctedTPCinnerParamHe3 = (heliumPID && he3setting_compensatePIDinTracking) ? candidate.tpcInnerParam() / 2.f : candidate.tpcInnerParam(); + return correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); } // ========================================================================================================= @@ -705,7 +696,9 @@ struct LfTreeCreatorClusterStudies { m_hAnalysis.fill(HIST("massLambda"), std::hypot(momMother[0], momMother[1], momMother[2]), massLambdaV0); m_hAnalysis.fill(HIST("armenteros_plot_lambda"), alphaAP, qtAP); m_hAnalysis.fill(HIST("nSigmaTPCPr"), std::hypot(momPos[0], momPos[1], momPos[2]), posTrack.tpcNSigmaPr()); + m_hAnalysis.fill(HIST("nSigmaITSPr"), std::hypot(momPos[0], momPos[1], momPos[2]), m_responseITS.nSigmaITS(posTrack.itsClusterSizes(), posTrack.p(), posTrack.eta())); m_hAnalysis.fill(HIST("nSigmaTPCPi"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, negTrack.tpcNSigmaPi()); + m_hAnalysis.fill(HIST("nSigmaITSPi"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, m_responseITS.nSigmaITS(negTrack.itsClusterSizes(), negTrack.p(), negTrack.eta())); m_hAnalysis.fill(HIST("pmatchingPr"), posTrack.tpcInnerParam(), (posTrack.tpcInnerParam() - posTrack.p()) / posTrack.tpcInnerParam()); m_hAnalysis.fill(HIST("pmatchingPi"), -negTrack.tpcInnerParam(), (negTrack.tpcInnerParam() - negTrack.p()) / negTrack.tpcInnerParam()); @@ -715,7 +708,9 @@ struct LfTreeCreatorClusterStudies { // "signed" pt for antimatter m_hAnalysis.fill(HIST("armenteros_plot_lambda"), alphaAP, qtAP); m_hAnalysis.fill(HIST("nSigmaTPCPi"), std::hypot(momPos[0], momPos[1], momPos[2]), posTrack.tpcNSigmaPi()); - m_hAnalysis.fill(HIST("nSigmaTPCPi"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, negTrack.tpcNSigmaPr()); + m_hAnalysis.fill(HIST("nSigmaITSPi"), std::hypot(momPos[0], momPos[1], momPos[2]), m_responseITS.nSigmaITS(posTrack.itsClusterSizes(), posTrack.p(), posTrack.eta())); + m_hAnalysis.fill(HIST("nSigmaTPCPr"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, negTrack.tpcNSigmaPr()); + m_hAnalysis.fill(HIST("nSigmaITSPr"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, m_responseITS.nSigmaITS(negTrack.itsClusterSizes(), negTrack.p(), negTrack.eta())); m_hAnalysis.fill(HIST("pmatchingPi"), posTrack.tpcInnerParam(), (posTrack.tpcInnerParam() - posTrack.p()) / posTrack.tpcInnerParam()); m_hAnalysis.fill(HIST("pmatchingPr"), -negTrack.tpcInnerParam(), (negTrack.tpcInnerParam() - negTrack.p()) / negTrack.tpcInnerParam()); @@ -723,6 +718,8 @@ struct LfTreeCreatorClusterStudies { massV0 = 0.f; m_hAnalysis.fill(HIST("nSigmaTPCEl"), std::hypot(momPos[0], momPos[1], momPos[2]), posTrack.tpcNSigmaEl()); m_hAnalysis.fill(HIST("nSigmaTPCEl"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, negTrack.tpcNSigmaEl()); + m_hAnalysis.fill(HIST("nSigmaITSEl"), std::hypot(momPos[0], momPos[1], momPos[2]), m_responseITS.nSigmaITS(posTrack.itsClusterSizes(), posTrack.p(), posTrack.eta())); + m_hAnalysis.fill(HIST("nSigmaITSEl"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, m_responseITS.nSigmaITS(negTrack.itsClusterSizes(), negTrack.p(), negTrack.eta())); m_hAnalysis.fill(HIST("armenteros_plot_gamma"), alphaAP, qtAP); m_hAnalysis.fill(HIST("pmatchingEl"), posTrack.tpcInnerParam(), (posTrack.tpcInnerParam() - posTrack.p()) / posTrack.tpcInnerParam()); m_hAnalysis.fill(HIST("pmatchingEl"), -negTrack.tpcInnerParam(), (negTrack.tpcInnerParam() - negTrack.p()) / negTrack.tpcInnerParam()); @@ -972,6 +969,7 @@ struct LfTreeCreatorClusterStudies { } m_hAnalysis.fill(HIST("de_selections"), DeSelections::kDePIDtof); m_hAnalysis.fill(HIST("nSigmaTPCDe"), track.p() * track.sign(), computeNSigmaDe(track)); + m_hAnalysis.fill(HIST("nSigmaITSDe"), track.p() * track.sign(), m_responseITS.nSigmaITS(track.itsClusterSizes(), track.p(), track.eta())); m_hAnalysis.fill(HIST("nSigmaTOFDe"), track.p() * track.sign(), track.tofNSigmaDe()); m_hAnalysis.fill(HIST("TOFmassDe"), track.p() * track.sign(), computeTOFmassDe(track)); m_hAnalysis.fill(HIST("pmatchingDe"), track.sign() * track.tpcInnerParam(), (track.tpcInnerParam() - track.p()) / track.tpcInnerParam()); @@ -1060,6 +1058,7 @@ struct LfTreeCreatorClusterStudies { m_hAnalysis.fill(HIST("he3_selections"), He3Selections::kHe3PIDtof); m_hAnalysis.fill(HIST("nSigmaTPCHe"), track.p() * track.sign(), computeNSigmaHe3(track)); + m_hAnalysis.fill(HIST("nSigmaITSHe"), track.p() * track.sign(), m_responseITS.nSigmaITS(track.itsClusterSizes(), track.p(), track.eta())); m_hAnalysis.fill(HIST("TOFmassHe"), track.p() * track.sign(), tofMass); m_hAnalysis.fill(HIST("pmatchingHe"), track.sign() * correctedTPCinnerParam, (correctedTPCinnerParam - track.p()) / correctedTPCinnerParam); diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index 2544040a312..980c3cee06f 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -16,6 +16,9 @@ #include #include #include +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -59,16 +62,33 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using MyCollisions = soa::Join; using FullTracksExtIU = soa::Join; using FullTracksExtPIDIU = soa::Join; using ColwithEvTimes = o2::soa::Join; +using FullCols = o2::soa::Join; +using ColwithEvTimesMults = o2::soa::Join; using TrackExtIUwithEvTimes = soa::Join; using TrackExtPIDIUwithEvTimes = soa::Join; using MCLabeledTracksIU = soa::Join; +struct vtxCandidate { + int track0Id; + int track1Id; + int track2Id; + int collisionId; + int decay3bodyId; + float vtxPos[3]; + float track0P[3]; + float track1P[3]; + float track2P[3]; + float dcadaughters; + float daudcaxytopv[3]; // 0 - proton, 1 - pion, 2 - bachelor + float daudcatopv[3]; // 0 - proton, 1 - pion, 2 - bachelor + float bachelortofNsigma; +}; + struct decay3bodyBuilder { Produces vtx3bodydata; @@ -76,6 +96,7 @@ struct decay3bodyBuilder { Produces kfvtx3bodydatalite; Service ccdb; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + std::vector vtxCandidates; // Configurables Configurable d_UseAbsDCA{"d_UseAbsDCA", true, "Use Abs DCAs"}; @@ -95,7 +116,6 @@ struct decay3bodyBuilder { kNVtxSteps }; enum kfvtxstep { kKfVtxAll = 0, - kKfVtxCollIds, kKfVtxCharge, kKfVtxEta, kKfVtxTPCNcls, @@ -121,9 +141,10 @@ struct decay3bodyBuilder { HistogramRegistry registry{"registry", {}}; // hypothesis - Configurable motherhyp{"motherhyp", 0, "hypothesis of the 3body decayed particle"}; // corresponds to hyp3body - int bachelorcharge = 1; // to be updated in Init base on the hypothesis - o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; // to be updated in Init base on the hypothesis + Configurable motherhyp{"motherhyp", 0, "hypothesis of the 3body decayed particle"}; // corresponds to hyp3body + int bachelorcharge = 1; // to be updated in Init base on the hypothesis + // o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; // to be updated in Init base on the hypothesis + o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; // to be updated in Init base on the hypothesis // Selection criteria Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; @@ -183,18 +204,50 @@ struct decay3bodyBuilder { Configurable maxDcaPiDe{"kfparticleConfigurations.maxDcaPiDe", 1000., "Maximum geometrical distance between pion and deuteron at the SV in 3D with KFParticle"}; Configurable maxDcaXYSVDau{"kfparticleConfigurations.maxDcaXYSVDau", 1.0, "Maximum geometrical distance of daughter tracks from the SV in XY with KFParticle"}; Configurable maxRapidityHt{"kfparticleConfigurations.maxRapidityHt", 1., "Maximum rapidity for Hypertriton candidates with KFParticle"}; - Configurable minPtHt{"kfparticleConfigurations.minPtHt", 0., "Minimum momentum for Hypertriton candidates with KFParticle"}; + Configurable minPtHt{"kfparticleConfigurations.minPtHt", 0.01, "Minimum momentum for Hypertriton candidates with KFParticle (0.01 applied in SVertexer)"}; Configurable maxPtHt{"kfparticleConfigurations.maxPtHt", 36., "Maximum momentum for Hypertriton candidates with KFParticle"}; Configurable minMassHt{"kfparticleConfigurations.minMassHt", 2.96, "Minimum candidate mass with KFParticle"}; Configurable maxMassHt{"kfparticleConfigurations.maxMassHt", 3.05, "Maximum candidate mass with KFParticle"}; Configurable maxctauHt{"kfparticleConfigurations.maxctauHt", 40., "Maximum candidate ctau with KFParticle before topological constraint"}; Configurable maxChi2geo{"kfparticleConfigurations.maxChi2geo", 1000., "Maximum chi2 geometrical with KFParticle"}; - Configurable minCosPA{"kfparticleConfigurations.minCosPA", 0.5, "Minimum cosine pointing angle with KFParticle"}; - Configurable minCosPAxy{"kfparticleConfigurations.minCosPAxy", 0.5, "Minimum cosine pointing angle in xy with KFParticle"}; + Configurable minCosPA{"kfparticleConfigurations.minCosPA", 0.8, "Minimum cosine pointing angle with KFParticle (0.8 applied in SVertexer)"}; + Configurable minCosPAxy{"kfparticleConfigurations.minCosPAxy", 0.8, "Minimum cosine pointing angle in xy with KFParticle"}; Configurable applyTopoSel{"kfparticleConfigurations.applyTopoSel", false, "Apply selection constraining the mother to the PV with KFParticle"}; Configurable maxChi2topo{"kfparticleConfigurations.maxChi2topo", 1000., "Maximum chi2 topological with KFParticle"}; + Configurable nEvtMixing{"kfparticleConfigurations.nEvtMixing", 5, "Number of events to mix"}; + Configurable applySVertexerCuts{"kfparticleConfigurations.applySVertexerCuts", true, "Apply SVertexer selections in event mixing case"}; + ConfigurableAxis binsVtxZ{"kfparticleConfigurations.binsVtxZ", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis binsMultiplicity{"kfparticleConfigurations.binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - multiplicity"}; } kfparticleConfigurations; + //------------------------------------------------------------------ + // Sets for event mixing + struct : ConfigurableGroup { + Configurable nUseMixedEvent{"nUseMixedEvent", 5, "nUseMixedEvent"}; + Configurable em_event_sel8_selection{"em_event_sel8_selection", true, "event selection count post sel8 cut"}; + Configurable etacut{"etacut", 0.9, "etacut"}; + Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; + Configurable maxProtonPt{"maxProtonPt", 5, "maxProtonPt"}; + Configurable minPionPt{"minPionPt", 0.1, "minPionPt"}; + Configurable maxPionPt{"maxPionPt", 1.2, "maxPionPt"}; + Configurable minDeuteronPt{"minDeuteronPt", 0.6, "minDeuteronPt"}; + Configurable maxDeuteronPt{"maxDeuteronPt", 10, "maxDeuteronPt"}; + Configurable mintpcNClsproton{"mintpcNClsproton", 90, "min tpc Nclusters for proton"}; + Configurable mintpcNClspion{"mintpcNClspion", 70, "min tpc Nclusters for pion"}; + Configurable mintpcNClsbachelor{"mintpcNClsbachelor", 100, "min tpc Nclusters for bachelor"}; + Configurable emTpcPidNsigmaCut{"emTpcPidNsigmaCut", 5, "emTpcPidNsigmaCut"}; + } EMTrackSel; + + Preslice tracksperCol = aod::track::collisionId; + SliceCache cache; + ConfigurableAxis axisPosZ{"axisPosZ", {40, -10, 10}, "Mixing bins - posZ"}; + ConfigurableAxis axisCentrality{"axisCentrality", {10, 0, 100}, "Mixing bins - centrality"}; + using BinningType = ColumnBinningPolicy; + + // KF event mixing + using BinningTypeKF = ColumnBinningPolicy; + BinningTypeKF binningOnPosAndMult{{kfparticleConfigurations.binsVtxZ, kfparticleConfigurations.binsMultiplicity}, true}; + // Filters and slices // Filter collisionFilter = (aod::evsel::sel8 == true && nabs(aod::collision::posZ) < 10.f); Preslice perCollision = o2::aod::decay3body::collisionId; @@ -271,7 +324,7 @@ struct decay3bodyBuilder { fitter3body.setMatCorrType(matCorr); // Add histograms separately for different process functions - if (doprocessRun3 == true) { + if (doprocessRun3 == true || doprocessRun3EM == true || doprocessRun3EMLikeSign == true) { registry.add("hEventCounter", "hEventCounter", HistType::kTH1F, {{1, 0.0f, 1.0f}}); auto hVtx3BodyCounter = registry.add("hVtx3BodyCounter", "hVtx3BodyCounter", HistType::kTH1F, {{6, 0.0f, 6.0f}}); hVtx3BodyCounter->GetXaxis()->SetBinLabel(1, "Total"); @@ -283,36 +336,35 @@ struct decay3bodyBuilder { registry.add("hBachelorTOFNSigmaDe", "", HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}); } - if (doprocessRun3withKFParticle == true) { + if (doprocessRun3withKFParticle == true || doprocessRun3EMwithKFParticle == true) { auto hEventCounterKFParticle = registry.add("hEventCounterKFParticle", "hEventCounterKFParticle", HistType::kTH1F, {{4, 0.0f, 4.0f}}); hEventCounterKFParticle->GetXaxis()->SetBinLabel(1, "total"); hEventCounterKFParticle->GetXaxis()->SetBinLabel(2, "sel8"); hEventCounterKFParticle->GetXaxis()->SetBinLabel(3, "vertexZ"); hEventCounterKFParticle->GetXaxis()->SetBinLabel(4, "has candidate"); hEventCounterKFParticle->LabelsOption("v"); - auto hVtx3BodyCounterKFParticle = registry.add("hVtx3BodyCounterKFParticle", "hVtx3BodyCounterKFParticle", HistType::kTH1F, {{22, 0.0f, 22.0f}}); + auto hVtx3BodyCounterKFParticle = registry.add("hVtx3BodyCounterKFParticle", "hVtx3BodyCounterKFParticle", HistType::kTH1F, {{21, 0.0f, 21.0f}}); hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(1, "Total"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(2, "CollIds"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(3, "Charge"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(4, "Eta"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(5, "TPCNcls"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(6, "TPCRows"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(7, "TPCpid"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(8, "DCAxyPV"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(9, "DCAzPV"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(10, "V0MassConst"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(11, "HasSV"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(12, "DcaDau"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(13, "DCADauVtx"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(14, "DauPt"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(15, "Rapidity"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(16, "Pt"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(17, "Mass"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(18, "CosPA"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(19, "CosPAXY"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(20, "Chi2geo"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(21, "TopoConstr"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(22, "Chi2topo"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(2, "Charge"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(3, "Eta"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(4, "TPCNcls"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(5, "TPCRows"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(6, "TPCpid"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(7, "DCAxyPV"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(8, "DCAzPV"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(9, "V0MassConst"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(10, "HasSV"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(11, "DcaDau"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(12, "DCADauVtx"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(13, "DauPt"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(14, "Rapidity"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(15, "Pt"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(16, "Mass"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(17, "CosPA"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(18, "CosPAXY"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(19, "Chi2geo"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(20, "TopoConstr"); + hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(21, "Chi2topo"); hVtx3BodyCounterKFParticle->LabelsOption("v"); registry.add("QA/Tracks/hTrackPosTPCNcls", "hTrackPosTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); @@ -347,6 +399,19 @@ struct decay3bodyBuilder { registry.add("QA/Event/hVtxCovXZ", "hVtxCovXZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XZ) (cm^{2})"}}); registry.add("QA/Event/hVtxCovYZ", "hVtxCovYZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YZ) (cm^{2})"}}); } + + if (doprocessRun3EMwithKFParticle == true) { + auto hPairCounterMixing = registry.add("QA/EM/hPairCounterMixing", "hPairCounterMixing", HistType::kTH1F, {{3, 0.0f, 3.0f}}); + hPairCounterMixing->GetXaxis()->SetBinLabel(1, "total"); + hPairCounterMixing->GetXaxis()->SetBinLabel(2, "sel8"); + hPairCounterMixing->GetXaxis()->SetBinLabel(3, "vertexZ"); + hPairCounterMixing->LabelsOption("v"); + auto hCombinationCounterMixing = registry.add("QA/EM/hCombinationCounterMixing", "hCombinationCounterMixing", HistType::kTH1F, {{3, 0.0f, 3.0f}}); + hCombinationCounterMixing->GetXaxis()->SetBinLabel(1, "total"); + hCombinationCounterMixing->GetXaxis()->SetBinLabel(2, "bach sign/ID"); + hCombinationCounterMixing->GetXaxis()->SetBinLabel(3, "bach pT"); + hCombinationCounterMixing->LabelsOption("v"); + } } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -510,471 +575,616 @@ struct decay3bodyBuilder { //------------------------------------------------------------------ // 3body candidate builder - template - // void buildVtx3BodyDataTable(TCollisionTable const& /*allcollisions*/, TCollisionTable::iterator const& collision, TTrackTable const& /*tracks*/, aod::Decay3Bodys const& decay3bodys, int bachelorcharge = 1) - void buildVtx3BodyDataTable(TCollisionTable const& collision, TTrackTable const& /*tracks*/, aod::Decay3Bodys const& decay3bodys, int bachelorcharge = 1) + template + void fillVtxCand(TCollisionTable const& collision, TTrackTable const& t0, TTrackTable const& t1, TTrackTable const& t2, int64_t decay3bodyId, int bachelorcharge = 1) { - for (auto& vtx3body : decay3bodys) { - - registry.fill(HIST("hVtx3BodyCounter"), kVtxAll); + registry.fill(HIST("hVtx3BodyCounter"), kVtxAll); - auto t0 = vtx3body.template track0_as(); - auto t1 = vtx3body.template track1_as(); - auto t2 = vtx3body.template track2_as(); - - if (t0.tpcNClsFound() < mintpcNCls && t1.tpcNClsFound() < mintpcNCls && t2.tpcNClsFound() < mintpcNCls) { - continue; - } - registry.fill(HIST("hVtx3BodyCounter"), kVtxTPCNcls); - - // Recalculate the TOF PID - double tofNSigmaBach = -999; - if (t2.has_collision() && t2.hasTOF()) { + if (t0.tpcNClsFound() < mintpcNCls || t1.tpcNClsFound() < mintpcNCls || t2.tpcNClsFound() < mintpcNCls) { + return; + } + registry.fill(HIST("hVtx3BodyCounter"), kVtxTPCNcls); + + // Recalculate the TOF PID + double tofNSigmaBach = -999; + if (t2.has_collision() && t2.hasTOF()) { + if (decay3bodyId == -1) { + // for event-mixing, the collisionId of tracks not equal to global index + tofNSigmaBach = bachelorTOFPID.GetTOFNSigma(t2, collision, collision); + } else { auto originalcol = t2.template collision_as(); tofNSigmaBach = bachelorTOFPID.GetTOFNSigma(t2, originalcol, collision); } + } - if (enablePidCut) { - if (t2.sign() > 0) { - if (!checkPIDH3L(t0, t1, t2, tofNSigmaBach)) - continue; - } else { - if (!checkPIDH3L(t1, t0, t2, tofNSigmaBach)) - continue; - } + if (enablePidCut) { + if (t2.sign() > 0) { + if (!checkPIDH3L(t0, t1, t2, tofNSigmaBach)) + return; + } else { + if (!checkPIDH3L(t1, t0, t2, tofNSigmaBach)) + return; } + } - registry.fill(HIST("hVtx3BodyCounter"), kVtxPIDCut); - - // Calculate DCA with respect to the collision associated to the V0, not individual tracks - gpu::gpustd::array dcaInfo; + registry.fill(HIST("hVtx3BodyCounter"), kVtxPIDCut); - auto Track0Par = getTrackPar(t0); - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track0Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track0dcaXY = dcaInfo[0]; - auto Track0dca = std::sqrt(Track0dcaXY * Track0dcaXY + dcaInfo[1] * dcaInfo[1]); + // Calculate DCA with respect to the collision associated to the V0, not individual tracks + gpu::gpustd::array dcaInfo; - auto Track1Par = getTrackPar(t1); - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track1Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track1dcaXY = dcaInfo[0]; - auto Track1dca = std::sqrt(Track1dcaXY * Track1dcaXY + dcaInfo[1] * dcaInfo[1]); + auto Track0Par = getTrackPar(t0); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track0Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); + auto Track0dcaXY = dcaInfo[0]; + auto Track0dca = std::sqrt(Track0dcaXY * Track0dcaXY + dcaInfo[1] * dcaInfo[1]); - auto Track2Par = getTrackPar(t2); - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track2Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track2dcaXY = dcaInfo[0]; - auto Track2dca = std::sqrt(Track2dcaXY * Track2dcaXY + dcaInfo[1] * dcaInfo[1]); + auto Track1Par = getTrackPar(t1); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track1Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); + auto Track1dcaXY = dcaInfo[0]; + auto Track1dca = std::sqrt(Track1dcaXY * Track1dcaXY + dcaInfo[1] * dcaInfo[1]); - auto Track0 = getTrackParCov(t0); - auto Track1 = getTrackParCov(t1); - auto Track2 = getTrackParCov(t2); - int n3bodyVtx = fitter3body.process(Track0, Track1, Track2); - if (n3bodyVtx == 0) { // discard this pair - continue; - } - registry.fill(HIST("hVtx3BodyCounter"), kVtxhasSV); + auto Track2Par = getTrackPar(t2); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track2Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); + auto Track2dcaXY = dcaInfo[0]; + auto Track2dca = std::sqrt(Track2dcaXY * Track2dcaXY + dcaInfo[1] * dcaInfo[1]); - std::array pos = {0.}; - const auto& vtxXYZ = fitter3body.getPCACandidate(); - for (int i = 0; i < 3; i++) { - pos[i] = vtxXYZ[i]; - } - - std::array p0 = {0.}, p1 = {0.}, p2{0.}; - const auto& propagatedTrack0 = fitter3body.getTrack(0); - const auto& propagatedTrack1 = fitter3body.getTrack(1); - const auto& propagatedTrack2 = fitter3body.getTrack(2); - propagatedTrack0.getPxPyPzGlo(p0); - propagatedTrack1.getPxPyPzGlo(p1); - propagatedTrack2.getPxPyPzGlo(p2); - for (int i = 0; i < 3; i++) { - p2[i] *= bachelorcharge; - } - std::array p3B = {p0[0] + p1[0] + p2[0], p0[1] + p1[1] + p2[1], p0[2] + p1[2] + p2[2]}; + auto Track0 = getTrackParCov(t0); + auto Track1 = getTrackParCov(t1); + auto Track2 = getTrackParCov(t2); + int n3bodyVtx = fitter3body.process(Track0, Track1, Track2); + if (n3bodyVtx == 0) { // discard this pair + return; + } + registry.fill(HIST("hVtx3BodyCounter"), kVtxhasSV); - if (fitter3body.getChi2AtPCACandidate() > dcavtxdau) { - continue; - } - registry.fill(HIST("hVtx3BodyCounter"), kVtxDcaDau); + std::array pos = {0.}; + const auto& vtxXYZ = fitter3body.getPCACandidate(); + for (int i = 0; i < 3; i++) { + pos[i] = vtxXYZ[i]; + } - float VtxcosPA = RecoDecay::cpa(array{collision.posX(), collision.posY(), collision.posZ()}, array{pos[0], pos[1], pos[2]}, array{p3B[0], p3B[1], p3B[2]}); - if (VtxcosPA < minCosPA3body) { - continue; - } - registry.fill(HIST("hVtx3BodyCounter"), kVtxCosPA); + std::array p0 = {0.}, p1 = {0.}, p2{0.}; + const auto& propagatedTrack0 = fitter3body.getTrack(0); + const auto& propagatedTrack1 = fitter3body.getTrack(1); + const auto& propagatedTrack2 = fitter3body.getTrack(2); + propagatedTrack0.getPxPyPzGlo(p0); + propagatedTrack1.getPxPyPzGlo(p1); + propagatedTrack2.getPxPyPzGlo(p2); + for (int i = 0; i < 3; i++) { + p2[i] *= bachelorcharge; + } + std::array p3B = {p0[0] + p1[0] + p2[0], p0[1] + p1[1] + p2[1], p0[2] + p1[2] + p2[2]}; - registry.fill(HIST("hBachelorTOFNSigmaDe"), t2.sign() * t2.p(), tofNSigmaBach); + if (fitter3body.getChi2AtPCACandidate() > dcavtxdau) { + return; + } + registry.fill(HIST("hVtx3BodyCounter"), kVtxDcaDau); - vtx3bodydata( - t0.globalIndex(), t1.globalIndex(), t2.globalIndex(), collision.globalIndex(), vtx3body.globalIndex(), - pos[0], pos[1], pos[2], - p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], - fitter3body.getChi2AtPCACandidate(), - Track0dcaXY, Track1dcaXY, Track2dcaXY, - Track0dca, Track1dca, Track2dca, - tofNSigmaBach); + float VtxcosPA = RecoDecay::cpa(array{collision.posX(), collision.posY(), collision.posZ()}, array{pos[0], pos[1], pos[2]}, array{p3B[0], p3B[1], p3B[2]}); + if (VtxcosPA < minCosPA3body) { + return; } + registry.fill(HIST("hVtx3BodyCounter"), kVtxCosPA); + + registry.fill(HIST("hBachelorTOFNSigmaDe"), t2.sign() * t2.p(), tofNSigmaBach); + + vtxCandidate candVtx; + candVtx.track0Id = t0.globalIndex(); + candVtx.track1Id = t1.globalIndex(); + candVtx.track2Id = t2.globalIndex(); + candVtx.collisionId = collision.globalIndex(); + candVtx.decay3bodyId = decay3bodyId; + candVtx.vtxPos[0] = pos[0]; + candVtx.vtxPos[1] = pos[1]; + candVtx.vtxPos[2] = pos[2]; + candVtx.track0P[0] = p0[0]; + candVtx.track0P[1] = p0[1]; + candVtx.track0P[2] = p0[2]; + candVtx.track1P[0] = p1[0]; + candVtx.track1P[1] = p1[1]; + candVtx.track1P[2] = p1[2]; + candVtx.track2P[0] = p2[0]; + candVtx.track2P[1] = p2[1]; + candVtx.track2P[2] = p2[2]; + candVtx.dcadaughters = fitter3body.getChi2AtPCACandidate(); + candVtx.daudcaxytopv[0] = Track0dcaXY; + candVtx.daudcaxytopv[1] = Track1dcaXY; + candVtx.daudcaxytopv[2] = Track2dcaXY; + candVtx.daudcatopv[0] = Track0dca; + candVtx.daudcatopv[1] = Track1dca; + candVtx.daudcatopv[2] = Track2dca; + candVtx.bachelortofNsigma = tofNSigmaBach; + vtxCandidates.push_back(candVtx); + } + //------------------------------------------------------------------ + // fill the StoredVtx3BodyDatas table + void fillVtx3BodyTable(vtxCandidate const& candVtx) + { + vtx3bodydata( + candVtx.track0Id, candVtx.track1Id, candVtx.track2Id, candVtx.collisionId, candVtx.decay3bodyId, + candVtx.vtxPos[0], candVtx.vtxPos[1], candVtx.vtxPos[2], + candVtx.track0P[0], candVtx.track0P[1], candVtx.track0P[2], candVtx.track1P[0], candVtx.track1P[1], candVtx.track1P[2], candVtx.track2P[0], candVtx.track2P[1], candVtx.track2P[2], + candVtx.dcadaughters, + candVtx.daudcaxytopv[0], candVtx.daudcaxytopv[1], candVtx.daudcaxytopv[2], + candVtx.daudcatopv[0], candVtx.daudcatopv[1], candVtx.daudcatopv[2], + candVtx.bachelortofNsigma); } //------------------------------------------------------------------ // 3body candidate builder with KFParticle - template - void buildVtx3BodyDataTableKFParticle(TCollision const& collision, aod::Decay3Bodys const& decay3bodys, int bachelorcharge = 1) + template + void buildVtx3BodyDataTableKFParticle(TCollision const& collision, TTrack const& trackPos, TTrack const& trackNeg, TTrack const& trackBach, int64_t decay3bodyID, int bachelorcharge = 1) { LOG(debug) << "buildVtx3BodyDataTableKFParticle called."; - for (auto& vtx3body : decay3bodys) { - LOG(debug) << "Entered decay3bodys loop."; - - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxAll); - - auto trackPos = vtx3body.template track0_as(); - auto trackNeg = vtx3body.template track1_as(); - auto trackBach = vtx3body.template track2_as(); - auto trackParCovPos = getTrackParCov(trackPos); - auto trackParCovNeg = getTrackParCov(trackNeg); - auto trackParCovBach = getTrackParCov(trackBach); - LOG(debug) << "Got all daughter tracks."; - - KFPVertex kfpVertex = createKFPVertexFromCollision(collision); - KFParticle kfpv(kfpVertex); - LOG(debug) << "Created KF PV."; - - bool isMatter = trackBach.sign() > 0 ? true : false; - - // ---------- fill trackQA and vertexQA histograms - if (kfparticleConfigurations.doTrackQA) { - registry.fill(HIST("QA/Tracks/hTrackPosTPCNcls"), trackPos.tpcNClsFound()); - registry.fill(HIST("QA/Tracks/hTrackNegTPCNcls"), trackNeg.tpcNClsFound()); - registry.fill(HIST("QA/Tracks/hTrackBachTPCNcls"), trackBach.tpcNClsFound()); - registry.fill(HIST("QA/Tracks/hTrackPosHasTPC"), trackPos.hasTPC()); - registry.fill(HIST("QA/Tracks/hTrackNegHasTPC"), trackNeg.hasTPC()); - registry.fill(HIST("QA/Tracks/hTrackBachHasTPC"), trackBach.hasTPC()); - registry.fill(HIST("QA/Tracks/hTrackBachITSClusSizes"), trackBach.itsClusterSizes()); - if (isMatter) { - registry.fill(HIST("QA/Tracks/hTrackProtonTPCPID"), trackPos.sign() * trackPos.tpcInnerParam(), trackPos.tpcNSigmaPr()); - registry.fill(HIST("QA/Tracks/hTrackPionTPCPID"), trackNeg.sign() * trackNeg.tpcInnerParam(), trackNeg.tpcNSigmaPi()); - registry.fill(HIST("QA/Tracks/hTrackProtonPt"), trackPos.pt()); - registry.fill(HIST("QA/Tracks/hTrackPionPt"), trackNeg.pt()); - } else { - registry.fill(HIST("QA/Tracks/hTrackProtonTPCPID"), trackNeg.sign() * trackNeg.tpcInnerParam(), trackNeg.tpcNSigmaPr()); - registry.fill(HIST("QA/Tracks/hTrackPionTPCPID"), trackPos.sign() * trackPos.tpcInnerParam(), trackPos.tpcNSigmaPi()); - registry.fill(HIST("QA/Tracks/hTrackProtonPt"), trackNeg.pt()); - registry.fill(HIST("QA/Tracks/hTrackPionPt"), trackPos.pt()); - } - registry.fill(HIST("QA/Tracks/hTrackBachTPCPID"), trackBach.sign() * trackBach.tpcInnerParam(), trackBach.tpcNSigmaDe()); - registry.fill(HIST("QA/Tracks/hTrackBachPt"), trackBach.pt()); - } - if (kfparticleConfigurations.doVertexQA) { - registry.fill(HIST("QA/Event/hVtxXKF"), kfpv.GetX()); - registry.fill(HIST("QA/Event/hVtxYKF"), kfpv.GetY()); - registry.fill(HIST("QA/Event/hVtxZKF"), kfpv.GetZ()); - registry.fill(HIST("QA/Event/hVtxCovXXKF"), kfpv.GetCovariance(0)); - registry.fill(HIST("QA/Event/hVtxCovYYKF"), kfpv.GetCovariance(2)); - registry.fill(HIST("QA/Event/hVtxCovZZKF"), kfpv.GetCovariance(5)); - registry.fill(HIST("QA/Event/hVtxCovXYKF"), kfpv.GetCovariance(1)); - registry.fill(HIST("QA/Event/hVtxCovXZKF"), kfpv.GetCovariance(3)); - registry.fill(HIST("QA/Event/hVtxCovYZKF"), kfpv.GetCovariance(4)); - registry.fill(HIST("QA/Event/hVtxX"), collision.posX()); - registry.fill(HIST("QA/Event/hVtxY"), collision.posY()); - registry.fill(HIST("QA/Event/hVtxZ"), collision.posZ()); - registry.fill(HIST("QA/Event/hVtxCovXX"), collision.covXX()); - registry.fill(HIST("QA/Event/hVtxCovYY"), collision.covYY()); - registry.fill(HIST("QA/Event/hVtxCovZZ"), collision.covZZ()); - registry.fill(HIST("QA/Event/hVtxCovXY"), collision.covXY()); - registry.fill(HIST("QA/Event/hVtxCovXZ"), collision.covXZ()); - registry.fill(HIST("QA/Event/hVtxCovYZ"), collision.covYZ()); - } + bool isEventMixing = false; + if (decay3bodyID == -1) { + isEventMixing = true; + } - // -------- STEP 1: track selection -------- - // collision ID --> not correct? tracks can have different collisions, but belong to one 3prong vertex! - // if (trackPos.collisionId() != trackNeg.collisionId() || trackPos.collisionId() != trackBach.collisionId() || trackNeg.collisionId() != trackBach.collisionId()) { - // continue; - // } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCollIds); - // track IDs --> already checked in SVertexer! + // initialise KF primary vertex + KFPVertex kfpVertex = createKFPVertexFromCollision(collision); + KFParticle kfpv(kfpVertex); + LOG(debug) << "Created KF PV."; + + // fill event QA histograms + if (kfparticleConfigurations.doVertexQA) { + registry.fill(HIST("QA/Event/hVtxXKF"), kfpv.GetX()); + registry.fill(HIST("QA/Event/hVtxYKF"), kfpv.GetY()); + registry.fill(HIST("QA/Event/hVtxZKF"), kfpv.GetZ()); + registry.fill(HIST("QA/Event/hVtxCovXXKF"), kfpv.GetCovariance(0)); + registry.fill(HIST("QA/Event/hVtxCovYYKF"), kfpv.GetCovariance(2)); + registry.fill(HIST("QA/Event/hVtxCovZZKF"), kfpv.GetCovariance(5)); + registry.fill(HIST("QA/Event/hVtxCovXYKF"), kfpv.GetCovariance(1)); + registry.fill(HIST("QA/Event/hVtxCovXZKF"), kfpv.GetCovariance(3)); + registry.fill(HIST("QA/Event/hVtxCovYZKF"), kfpv.GetCovariance(4)); + registry.fill(HIST("QA/Event/hVtxX"), collision.posX()); + registry.fill(HIST("QA/Event/hVtxY"), collision.posY()); + registry.fill(HIST("QA/Event/hVtxZ"), collision.posZ()); + registry.fill(HIST("QA/Event/hVtxCovXX"), collision.covXX()); + registry.fill(HIST("QA/Event/hVtxCovYY"), collision.covYY()); + registry.fill(HIST("QA/Event/hVtxCovZZ"), collision.covZZ()); + registry.fill(HIST("QA/Event/hVtxCovXY"), collision.covXY()); + registry.fill(HIST("QA/Event/hVtxCovXZ"), collision.covXZ()); + registry.fill(HIST("QA/Event/hVtxCovYZ"), collision.covYZ()); + } - // track signs (pos, neg, bach) --> sanity check, should already be in SVertexer - if (trackPos.sign() != +1 || trackNeg.sign() != -1) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCharge); + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxAll); - // track eta - if (abs(trackPos.eta()) > kfparticleConfigurations.maxEta || abs(trackNeg.eta()) > kfparticleConfigurations.maxEta || abs(trackBach.eta()) > kfparticleConfigurations.maxEta) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxEta); + auto trackParCovPos = getTrackParCov(trackPos); + auto trackParCovNeg = getTrackParCov(trackNeg); + auto trackParCovBach = getTrackParCov(trackBach); + LOG(debug) << "Got all daughter tracks."; - // number of TPC clusters - if (trackBach.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsBach) { - continue; - } - if (isMatter && ((kfparticleConfigurations.useTPCforPion && trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion) || trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsProton)) { - continue; - } else if (!isMatter && ((kfparticleConfigurations.useTPCforPion && trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion) || trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsProton)) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCNcls); + bool isMatter = trackBach.sign() > 0 ? true : false; - // number of TPC crossed rows - if (trackBach.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows) { - continue; - } - if (isMatter && ((kfparticleConfigurations.useTPCforPion && trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion) || trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { - continue; - } else if (!isMatter && ((kfparticleConfigurations.useTPCforPion && trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion) || trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { - continue; + // ---------- fill track QA histograms ---------- + if (kfparticleConfigurations.doTrackQA) { + registry.fill(HIST("QA/Tracks/hTrackPosTPCNcls"), trackPos.tpcNClsFound()); + registry.fill(HIST("QA/Tracks/hTrackNegTPCNcls"), trackNeg.tpcNClsFound()); + registry.fill(HIST("QA/Tracks/hTrackBachTPCNcls"), trackBach.tpcNClsFound()); + registry.fill(HIST("QA/Tracks/hTrackPosHasTPC"), trackPos.hasTPC()); + registry.fill(HIST("QA/Tracks/hTrackNegHasTPC"), trackNeg.hasTPC()); + registry.fill(HIST("QA/Tracks/hTrackBachHasTPC"), trackBach.hasTPC()); + registry.fill(HIST("QA/Tracks/hTrackBachITSClusSizes"), trackBach.itsClusterSizes()); + if (isMatter) { + registry.fill(HIST("QA/Tracks/hTrackProtonTPCPID"), trackPos.sign() * trackPos.tpcInnerParam(), trackPos.tpcNSigmaPr()); + registry.fill(HIST("QA/Tracks/hTrackPionTPCPID"), trackNeg.sign() * trackNeg.tpcInnerParam(), trackNeg.tpcNSigmaPi()); + registry.fill(HIST("QA/Tracks/hTrackProtonPt"), trackPos.pt()); + registry.fill(HIST("QA/Tracks/hTrackPionPt"), trackNeg.pt()); + } else { + registry.fill(HIST("QA/Tracks/hTrackProtonTPCPID"), trackNeg.sign() * trackNeg.tpcInnerParam(), trackNeg.tpcNSigmaPr()); + registry.fill(HIST("QA/Tracks/hTrackPionTPCPID"), trackPos.sign() * trackPos.tpcInnerParam(), trackPos.tpcNSigmaPi()); + registry.fill(HIST("QA/Tracks/hTrackProtonPt"), trackNeg.pt()); + registry.fill(HIST("QA/Tracks/hTrackPionPt"), trackPos.pt()); } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCRows); - - // TPC PID - float tpcNsigmaProton; - float tpcNsigmaPion; - float tpcNsigmaDeuteron = trackBach.tpcNSigmaDe(); - if (isMatter) { // hypertriton (proton, pi-, deuteron) - tpcNsigmaProton = trackPos.tpcNSigmaPr(); - tpcNsigmaPion = trackNeg.tpcNSigmaPi(); - if (!selectTPCPID(trackPos, trackNeg, trackBach)) { - continue; - } - } else if (!isMatter) { // anti-hypertriton (anti-proton, pi+, deuteron) - tpcNsigmaProton = trackNeg.tpcNSigmaPr(); - tpcNsigmaPion = trackPos.tpcNSigmaPi(); - if (!selectTPCPID(trackNeg, trackPos, trackBach)) { - continue; - } + registry.fill(HIST("QA/Tracks/hTrackBachTPCPID"), trackBach.sign() * trackBach.tpcInnerParam(), trackBach.tpcNSigmaDe()); + registry.fill(HIST("QA/Tracks/hTrackBachPt"), trackBach.pt()); + } + + // -------- STEP 1: track selection -------- + // collision ID --> not correct? tracks can have different collisions, but belong to one 3prong vertex! + // if (trackPos.collisionId() != trackNeg.collisionId() || trackPos.collisionId() != trackBach.collisionId() || trackNeg.collisionId() != trackBach.collisionId()) { + // continue; + // } + // track IDs --> already checked in SVertexer! + + // track signs (pos, neg, bach) --> sanity check, should already be in SVertexer + if (trackPos.sign() != +1 || trackNeg.sign() != -1) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCharge); + + // track eta + if (abs(trackPos.eta()) > kfparticleConfigurations.maxEta || abs(trackNeg.eta()) > kfparticleConfigurations.maxEta || abs(trackBach.eta()) > kfparticleConfigurations.maxEta) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxEta); + + // number of TPC clusters + if (trackBach.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsBach) { + return; + } + if (isMatter && ((kfparticleConfigurations.useTPCforPion && trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion) || trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsProton)) { + return; + } else if (!isMatter && ((kfparticleConfigurations.useTPCforPion && trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion) || trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsProton)) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCNcls); + + // number of TPC crossed rows + if (trackBach.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows) { + return; + } + if (isMatter && ((kfparticleConfigurations.useTPCforPion && trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion) || trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { + return; + } else if (!isMatter && ((kfparticleConfigurations.useTPCforPion && trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion) || trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCRows); + + // TPC PID + float tpcNsigmaProton; + float tpcNsigmaPion; + float dEdxProton; + float dEdxPion; + float tpcNsigmaDeuteron = trackBach.tpcNSigmaDe(); + float tpcNsigmaPionBach = trackBach.tpcNSigmaPi(); + float dEdxDeuteron = trackBach.tpcSignal(); + if (isMatter) { // hypertriton (proton, pi-, deuteron) + tpcNsigmaProton = trackPos.tpcNSigmaPr(); + tpcNsigmaPion = trackNeg.tpcNSigmaPi(); + dEdxProton = trackPos.tpcSignal(); + dEdxPion = trackNeg.tpcSignal(); + if (!selectTPCPID(trackPos, trackNeg, trackBach)) { + return; } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCPID); - LOG(debug) << "Basic track selections done."; - - // track DCAxy and DCAz to PV associated with decay3body - o2::dataformats::VertexBase mPV; - o2::dataformats::DCA mDcaInfoCovPos; - o2::dataformats::DCA mDcaInfoCovNeg; - o2::dataformats::DCA mDcaInfoCovBach; - auto trackParCovPVPos = trackParCovPos; - auto trackParCovPVNeg = trackParCovNeg; - auto trackParCovPVBach = trackParCovBach; - mPV.setPos({collision.posX(), collision.posY(), collision.posZ()}); - mPV.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVPos, 2.f, matCorr, &mDcaInfoCovPos); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVNeg, 2.f, matCorr, &mDcaInfoCovNeg); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVBach, 2.f, matCorr, &mDcaInfoCovBach); - auto TrackPosDcaXY = mDcaInfoCovPos.getY(); - auto TrackNegDcaXY = mDcaInfoCovNeg.getY(); - auto TrackBachDcaXY = mDcaInfoCovBach.getY(); - auto TrackPosDcaZ = mDcaInfoCovPos.getZ(); - auto TrackNegDcaZ = mDcaInfoCovNeg.getZ(); - auto TrackBachDcaZ = mDcaInfoCovBach.getZ(); - if (isMatter && (fabs(TrackNegDcaXY) <= kfparticleConfigurations.mindcaXYPionPV || fabs(TrackPosDcaXY) <= kfparticleConfigurations.mindcaXYProtonPV)) { - continue; - } else if (!isMatter && (fabs(TrackPosDcaXY) <= kfparticleConfigurations.mindcaXYPionPV || fabs(TrackNegDcaXY) <= kfparticleConfigurations.mindcaXYProtonPV)) { - continue; + } else if (!isMatter) { // anti-hypertriton (anti-proton, pi+, deuteron) + tpcNsigmaProton = trackNeg.tpcNSigmaPr(); + tpcNsigmaPion = trackPos.tpcNSigmaPi(); + dEdxProton = trackNeg.tpcSignal(); + dEdxPion = trackPos.tpcSignal(); + if (!selectTPCPID(trackNeg, trackPos, trackBach)) { + return; } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDCAxyPV); - if (isMatter && (fabs(TrackNegDcaZ) <= kfparticleConfigurations.mindcaZPionPV || fabs(TrackPosDcaZ) <= kfparticleConfigurations.mindcaZProtonPV)) { - continue; - } else if (!isMatter && (fabs(TrackPosDcaZ) <= kfparticleConfigurations.mindcaZPionPV || fabs(TrackNegDcaZ) <= kfparticleConfigurations.mindcaZProtonPV)) { - continue; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCPID); + LOG(debug) << "Basic track selections done."; + + // TOF PID of deuteron (set motherhyp correctly) + double tofNSigmaDeuteron = -999; + if (trackBach.has_collision() && trackBach.hasTOF()) { + if (isEventMixing) { + tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(trackBach, collision, collision); + } else { + auto originalcol = trackBach.template collision_as(); + tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(trackBach, originalcol, collision); } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDCAzPV); - // calculate 3D track DCA - auto TrackPosDca = std::sqrt(TrackPosDcaXY * TrackPosDcaXY + TrackPosDcaZ * TrackPosDcaZ); - auto TrackNegDca = std::sqrt(TrackNegDcaXY * TrackNegDcaXY + TrackNegDcaZ * TrackNegDcaZ); - auto TrackBachDca = std::sqrt(TrackBachDcaXY * TrackBachDcaXY + TrackBachDcaZ * TrackBachDcaZ); - - // -------- STEP 2: fit vertex with proton and pion -------- - // Fit vertex with DCA fitter to find minimization point --> uses material corrections implicitly - if (kfparticleConfigurations.doDCAFitterPreMinimum) { - try { - fitter3body.process(trackParCovPos, trackParCovNeg, trackParCovBach); - } catch (std::runtime_error& e) { - LOG(error) << "Exception caught in DCA fitter process call: Not able to fit decay3body vertex!"; - continue; - } - // re-acquire tracks at vertex position from DCA fitter - trackParCovPos = fitter3body.getTrack(0); - trackParCovNeg = fitter3body.getTrack(1); - trackParCovBach = fitter3body.getTrack(2); + } - LOG(debug) << "Minimum found with DCA fitter for decay3body."; - } + // Average ITS cluster size of deuteron track + double averageClusterSizeDeuteron(0); + int nCls(0); + for (int i = 0; i < 7; i++) { + int clusterSize = trackBach.itsClsSizeInLayer(i); + averageClusterSizeDeuteron += static_cast(clusterSize); + if (clusterSize > 0) + nCls++; + } + averageClusterSizeDeuteron = averageClusterSizeDeuteron / static_cast(nCls); + + /// TODO: check to which PV bachelor DCA has to be calculated in event mixing case and add it here + // track DCAxy and DCAz to PV associated with decay3body + o2::dataformats::VertexBase mPV; + o2::dataformats::DCA mDcaInfoCovPos; + o2::dataformats::DCA mDcaInfoCovNeg; + o2::dataformats::DCA mDcaInfoCovBach; + auto trackParCovPVPos = trackParCovPos; + auto trackParCovPVNeg = trackParCovNeg; + auto trackParCovPVBach = trackParCovBach; + mPV.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mPV.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVPos, 2.f, matCorr, &mDcaInfoCovPos); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVNeg, 2.f, matCorr, &mDcaInfoCovNeg); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVBach, 2.f, matCorr, &mDcaInfoCovBach); + auto TrackPosDcaXY = mDcaInfoCovPos.getY(); + auto TrackNegDcaXY = mDcaInfoCovNeg.getY(); + auto TrackBachDcaXY = mDcaInfoCovBach.getY(); + auto TrackPosDcaZ = mDcaInfoCovPos.getZ(); + auto TrackNegDcaZ = mDcaInfoCovNeg.getZ(); + auto TrackBachDcaZ = mDcaInfoCovBach.getZ(); + // calculate 3D track DCA + auto TrackPosDca = std::sqrt(TrackPosDcaXY * TrackPosDcaXY + TrackPosDcaZ * TrackPosDcaZ); + auto TrackNegDca = std::sqrt(TrackNegDcaXY * TrackNegDcaXY + TrackNegDcaZ * TrackNegDcaZ); + auto TrackBachDca = std::sqrt(TrackBachDcaXY * TrackBachDcaXY + TrackBachDcaZ * TrackBachDcaZ); + // selection + if (isMatter && (fabs(TrackNegDcaXY) <= kfparticleConfigurations.mindcaXYPionPV || fabs(TrackPosDcaXY) <= kfparticleConfigurations.mindcaXYProtonPV)) { + return; + } else if (!isMatter && (fabs(TrackPosDcaXY) <= kfparticleConfigurations.mindcaXYPionPV || fabs(TrackNegDcaXY) <= kfparticleConfigurations.mindcaXYProtonPV)) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDCAxyPV); + if (isMatter && (fabs(TrackNegDcaZ) <= kfparticleConfigurations.mindcaZPionPV || fabs(TrackPosDcaZ) <= kfparticleConfigurations.mindcaZProtonPV)) { + return; + } else if (!isMatter && (fabs(TrackPosDcaZ) <= kfparticleConfigurations.mindcaZPionPV || fabs(TrackNegDcaZ) <= kfparticleConfigurations.mindcaZProtonPV)) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDCAzPV); + // SVertexer selection bachelor track for event mixing + if (isEventMixing && kfparticleConfigurations.applySVertexerCuts && TrackBachDca < 0.05) { + return; + } - // create KFParticle objects from tracks - KFParticle kfpProton, kfpPion; - if (isMatter) { - kfpProton = createKFParticleFromTrackParCov(trackParCovPos, trackPos.sign(), constants::physics::MassProton); - kfpPion = createKFParticleFromTrackParCov(trackParCovNeg, trackNeg.sign(), constants::physics::MassPionCharged); - } else if (!isMatter) { - kfpProton = createKFParticleFromTrackParCov(trackParCovNeg, trackNeg.sign(), constants::physics::MassProton); - kfpPion = createKFParticleFromTrackParCov(trackParCovPos, trackPos.sign(), constants::physics::MassPionCharged); - } - LOG(debug) << "KFParticle objects created from daughter tracks."; + // daughter track momentum at inner wall of TPC + float tpcInnerParamProton; + float tpcInnerParamPion; + float tpcInnerParamDeuteron = trackBach.tpcInnerParam(); + if (isMatter) { // hypertriton (proton, pi-, deuteron) + tpcInnerParamProton = trackPos.tpcInnerParam(); + tpcInnerParamPion = trackNeg.tpcInnerParam(); + } else if (!isMatter) { // anti-hypertriton (anti-proton, pi+, deuteron) + tpcInnerParamProton = trackNeg.tpcInnerParam(); + tpcInnerParamPion = trackPos.tpcInnerParam(); + } - // Construct V0 - KFParticle KFV0; - int nDaughters = 2; - const KFParticle* Daughters[2] = {&kfpProton, &kfpPion}; - KFV0.SetConstructMethod(2); + // -------- STEP 2: fit vertex with proton and pion -------- + // Fit vertex with DCA fitter to find minimization point --> uses material corrections implicitly + if (kfparticleConfigurations.doDCAFitterPreMinimum) { try { - KFV0.Construct(Daughters, nDaughters); + fitter3body.process(trackParCovPos, trackParCovNeg, trackParCovBach); } catch (std::runtime_error& e) { - LOG(debug) << "Failed to create V0 vertex from daughter tracks." << e.what(); - continue; - } - KFV0.TransportToDecayVertex(); - LOG(debug) << "V0 constructed."; - - // check V0 mass and set mass constraint - float massV0, sigmaMassV0; - KFV0.GetMass(massV0, sigmaMassV0); - KFParticle KFV0Mass = KFV0; - KFV0Mass.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); - float chi2massV0 = KFV0Mass.GetChi2() / KFV0Mass.GetNDF(); - if (kfparticleConfigurations.useLambdaMassConstraint) { - LOG(debug) << "V0 mass constraint applied."; - KFV0 = KFV0Mass; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxV0MassConst); - - // -------- STEP 3: fit vertex with V0 and deuteron -------- - // Create KFParticle object from deuteron track - KFParticle kfpDeuteron; - kfpDeuteron = createKFParticleFromTrackParCov(trackParCovBach, trackBach.sign() * bachelorcharge, constants::physics::MassDeuteron); - LOG(debug) << "KFParticle created from deuteron track."; - // Add deuteron to V0 vertex - KFParticle KFHt; - KFHt = KFV0; - KFHt.SetConstructMethod(2); - try { - KFHt.AddDaughter(kfpDeuteron); - } catch (std::runtime_error& e) { - LOG(debug) << "Failed to create Hyper triton from V0 and deuteron." << e.what(); - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxhasSV); - LOG(debug) << "Hypertriton vertex constructed."; - - // -------- STEP 4: selections after geometrical vertex fit -------- - // Get updated daughter tracks - kfpProton.SetProductionVertex(KFHt); - kfpPion.SetProductionVertex(KFHt); - kfpDeuteron.SetProductionVertex(KFHt); - LOG(debug) << "Topo constraint applied to daughters."; - // daughter DCAs - if ((kfpProton.GetDistanceFromParticle(kfpPion) >= kfparticleConfigurations.maxDcaProPi) || (kfpProton.GetDistanceFromParticle(kfpDeuteron) >= kfparticleConfigurations.maxDcaProDeu) || (kfpPion.GetDistanceFromParticle(kfpDeuteron) >= kfparticleConfigurations.maxDcaPiDe)) { - continue; + LOG(error) << "Exception caught in DCA fitter process call: Not able to fit decay3body vertex!"; + return; } - float DCAvtxDaughters3D = kfpProton.GetDistanceFromParticle(kfpPion) + kfpProton.GetDistanceFromParticle(kfpDeuteron) + kfpPion.GetDistanceFromParticle(kfpDeuteron); - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDcaDau); - LOG(debug) << "DCA selection after vertex fit applied."; + // re-acquire tracks at vertex position from DCA fitter + trackParCovPos = fitter3body.getTrack(0); + trackParCovNeg = fitter3body.getTrack(1); + trackParCovBach = fitter3body.getTrack(2); - // daughter DCAs to vertex - if (kfpProton.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau || kfpPion.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau || kfpDeuteron.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDcaDauVtx); - LOG(debug) << "DCA to vertex selection after vertex fit applied."; + LOG(debug) << "Minimum found with DCA fitter for decay3body."; + } - // daughter pT - if (kfpProton.GetPt() < kfparticleConfigurations.minPtProton || kfpProton.GetPt() > kfparticleConfigurations.maxPtProton || kfpPion.GetPt() < kfparticleConfigurations.minPtPion || kfpPion.GetPt() > kfparticleConfigurations.maxPtPion || kfpDeuteron.GetPt() < kfparticleConfigurations.minPtDeuteron || kfpDeuteron.GetPt() > kfparticleConfigurations.maxPtDeuteron) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDauPt); - LOG(debug) << "Daughter pT selection applied."; + // create KFParticle objects from tracks + KFParticle kfpProton, kfpPion; + if (isMatter) { + kfpProton = createKFParticleFromTrackParCov(trackParCovPos, trackPos.sign(), constants::physics::MassProton); + kfpPion = createKFParticleFromTrackParCov(trackParCovNeg, trackNeg.sign(), constants::physics::MassPionCharged); + } else if (!isMatter) { + kfpProton = createKFParticleFromTrackParCov(trackParCovNeg, trackNeg.sign(), constants::physics::MassProton); + kfpPion = createKFParticleFromTrackParCov(trackParCovPos, trackPos.sign(), constants::physics::MassPionCharged); + } + LOG(debug) << "KFParticle objects created from daughter tracks."; + + // Construct V0 as intermediate step + KFParticle KFV0; + int nDaughtersV0 = 2; + const KFParticle* DaughtersV0[2] = {&kfpProton, &kfpPion}; + KFV0.SetConstructMethod(2); + try { + KFV0.Construct(DaughtersV0, nDaughtersV0); + } catch (std::runtime_error& e) { + LOG(debug) << "Failed to create V0 vertex from daughter tracks." << e.what(); + return; + } + KFV0.TransportToDecayVertex(); + LOG(debug) << "V0 constructed."; + + // check V0 mass and set mass constraint + float massV0, sigmaMassV0; + KFV0.GetMass(massV0, sigmaMassV0); + KFParticle KFV0Mass = KFV0; + KFV0Mass.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); + float chi2massV0 = KFV0Mass.GetChi2() / KFV0Mass.GetNDF(); + if (kfparticleConfigurations.useLambdaMassConstraint) { + LOG(debug) << "V0 mass constraint applied."; + KFV0 = KFV0Mass; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxV0MassConst); + + // -------- STEP 3: fit three body vertex -------- + // Create KFParticle object from deuteron track + KFParticle kfpDeuteron; + kfpDeuteron = createKFParticleFromTrackParCov(trackParCovBach, trackBach.sign() * bachelorcharge, constants::physics::MassDeuteron); + LOG(debug) << "KFParticle created from deuteron track."; + // Construct 3body vertex + int nDaughters3body = 3; + const KFParticle* Daughters3body[3] = {&kfpProton, &kfpPion, &kfpDeuteron}; + KFParticle KFHt; + KFHt.SetConstructMethod(2); + try { + KFHt.Construct(Daughters3body, nDaughters3body); + } catch (std::runtime_error& e) { + LOG(debug) << "Failed to create Hyper triton 3-body vertex." << e.what(); + return; + } + // transport all daughter tracks to hypertriton vertex + float HtVtx[3] = {0.}; + HtVtx[0] = KFHt.GetX(); + HtVtx[1] = KFHt.GetY(); + HtVtx[2] = KFHt.GetZ(); + kfpProton.TransportToPoint(HtVtx); + kfpPion.TransportToPoint(HtVtx); + kfpDeuteron.TransportToPoint(HtVtx); + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxhasSV); + LOG(debug) << "Hypertriton vertex constructed."; + + // -------- STEP 4: daughter selections after geometrical vertex fit -------- + // daughter DCAs with KF + if ((kfpProton.GetDistanceFromParticle(kfpPion) >= kfparticleConfigurations.maxDcaProPi) || (kfpProton.GetDistanceFromParticle(kfpDeuteron) >= kfparticleConfigurations.maxDcaProDeu) || (kfpPion.GetDistanceFromParticle(kfpDeuteron) >= kfparticleConfigurations.maxDcaPiDe)) { + return; + } + float DCAvtxDaughters3D = kfpProton.GetDistanceFromParticle(kfpPion) + kfpProton.GetDistanceFromParticle(kfpDeuteron) + kfpPion.GetDistanceFromParticle(kfpDeuteron); + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDcaDau); + LOG(debug) << "DCA selection after vertex fit applied."; - // -------- STEP 5: candidate selection after geometrical vertex fit -------- - // Rapidity - float rapHt = RecoDecay::y(std::array{KFHt.GetPx(), KFHt.GetPy(), KFHt.GetPz()}, o2::constants::physics::MassHyperTriton); - if (std::abs(rapHt) > kfparticleConfigurations.maxRapidityHt) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxRap); + // daughter DCAs to vertex + if (kfpProton.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau || kfpPion.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau || kfpDeuteron.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDcaDauVtx); + LOG(debug) << "DCA to vertex selection after vertex fit applied."; - // Pt selection - if (KFHt.GetPt() <= kfparticleConfigurations.minPtHt || KFHt.GetPt() >= kfparticleConfigurations.maxPtHt) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxPt); + // daughter pT + if (kfpProton.GetPt() < kfparticleConfigurations.minPtProton || kfpProton.GetPt() > kfparticleConfigurations.maxPtProton || kfpPion.GetPt() < kfparticleConfigurations.minPtPion || kfpPion.GetPt() > kfparticleConfigurations.maxPtPion || kfpDeuteron.GetPt() < kfparticleConfigurations.minPtDeuteron || kfpDeuteron.GetPt() > kfparticleConfigurations.maxPtDeuteron) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDauPt); + LOG(debug) << "Daughter pT selection applied."; - // Mass window - float massHt, sigmaMassHt; - KFHt.GetMass(massHt, sigmaMassHt); - if (massHt <= kfparticleConfigurations.minMassHt || massHt >= kfparticleConfigurations.maxMassHt) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxMass); + // -------- STEP 5: candidate selection after geometrical vertex fit -------- + // Rapidity + float rapHt = RecoDecay::y(std::array{KFHt.GetPx(), KFHt.GetPy(), KFHt.GetPz()}, o2::constants::physics::MassHyperTriton); + if (std::abs(rapHt) > kfparticleConfigurations.maxRapidityHt) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxRap); - // cos(PA) to PV - if (std::abs(cpaFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPA) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCosPA); + // Pt selection + if (KFHt.GetPt() <= kfparticleConfigurations.minPtHt || KFHt.GetPt() >= kfparticleConfigurations.maxPtHt) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxPt); - // cos(PA) xy to PV - if (std::abs(cpaXYFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPAxy) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCosPAXY); + // Mass window + float massHt, sigmaMassHt; + KFHt.GetMass(massHt, sigmaMassHt); + if (massHt <= kfparticleConfigurations.minMassHt || massHt >= kfparticleConfigurations.maxMassHt) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxMass); - // chi2 geometrical - float chi2geoNDF = KFHt.GetChi2() / KFHt.GetNDF(); - if (chi2geoNDF >= kfparticleConfigurations.maxChi2geo) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxChi2geo); - LOG(debug) << "Basic selections after vertex fit done."; + // cos(PA) to PV + if (std::abs(cpaFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPA) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCosPA); - // ctau before topo constraint - if (KFHt.GetLifeTime() > kfparticleConfigurations.maxctauHt) { - return; - } + // cos(PA) xy to PV + if (std::abs(cpaXYFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPAxy) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCosPAXY); - // -------- STEP 6: topological constraint -------- - /// Set vertex constraint and topological selection - KFParticle KFHtPV = KFHt; - try { - KFHtPV.SetProductionVertex(kfpv); - } catch (std::runtime_error& e) { - LOG(error) << "Exception caught KFParticle process call: Topological constraint failed"; - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTopoConstr); // to check if topo constraint fails - // get topological chi2 - float chi2topoNDF = KFHtPV.GetChi2() / KFHtPV.GetNDF(); - KFHtPV.TransportToDecayVertex(); - if (kfparticleConfigurations.applyTopoSel && chi2topoNDF >= kfparticleConfigurations.maxChi2topo) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxChi2topo); + // chi2 geometrical + float chi2geoNDF = KFHt.GetChi2() / KFHt.GetNDF(); + if (chi2geoNDF >= kfparticleConfigurations.maxChi2geo) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxChi2geo); + LOG(debug) << "Basic selections after vertex fit done."; + + // ctau before topo constraint + if (KFHt.GetLifeTime() > kfparticleConfigurations.maxctauHt) { + return; + } - //------------------------------------------------------------------ - // table filling - kfvtx3bodydata( - collision.globalIndex(), trackPos.globalIndex(), trackNeg.globalIndex(), trackBach.globalIndex(), vtx3body.globalIndex(), + // -------- STEP 6: topological constraint -------- + /// Set vertex constraint and topological selection + KFParticle KFHtPV = KFHt; + try { + KFHtPV.SetProductionVertex(kfpv); + } catch (std::runtime_error& e) { + LOG(error) << "Exception caught KFParticle process call: Topological constraint failed"; + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTopoConstr); // to check if topo constraint fails + // get topological chi2 + float chi2topoNDF = KFHtPV.GetChi2() / KFHtPV.GetNDF(); + KFHtPV.TransportToDecayVertex(); + if (kfparticleConfigurations.applyTopoSel && chi2topoNDF >= kfparticleConfigurations.maxChi2topo) { + return; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxChi2topo); + + // additional selections from SVertexer for event mixing + float radius3body = sqrt(KFHt.GetX() * KFHt.GetX() + KFHt.GetY() * KFHt.GetY()); + float radiusV0 = sqrt(KFV0.GetX() * KFV0.GetX() + KFV0.GetY() * KFV0.GetY()); + float radiusTrackBachIU = sqrt(trackBach.x() * trackBach.x() + trackBach.y() * trackBach.y()); + if (isEventMixing && kfparticleConfigurations.applySVertexerCuts && (abs(radiusV0 - radius3body) > 3 || (radiusTrackBachIU - radius3body) > 50 || (radius3body - radiusTrackBachIU) > 1)) { + return; + } + + //------------------------------------------------------------------ + // table filling + kfvtx3bodydata( + collision.globalIndex(), trackPos.globalIndex(), trackNeg.globalIndex(), trackBach.globalIndex(), decay3bodyID, + // hypertriton + massHt, + KFHt.GetX(), KFHt.GetY(), KFHt.GetZ(), + KFHt.GetErrX(), KFHt.GetErrY(), KFHt.GetErrZ(), + KFHt.GetPx(), KFHt.GetPy(), KFHt.GetPz(), KFHt.GetPt(), + KFHt.GetErrPx(), KFHt.GetErrPy(), KFHt.GetErrPz(), KFHt.GetErrPt(), + KFHt.GetQ(), + KFHt.GetDistanceFromVertex(kfpv), KFHt.GetDistanceFromVertexXY(kfpv), + cpaFromKF(KFHt, kfpv), // before topo constraint + cpaXYFromKF(KFHt, kfpv), + cpaFromKF(KFHtPV, kfpv), // after topo constraint + cpaXYFromKF(KFHtPV, kfpv), + KFHtPV.GetDecayLength(), KFHtPV.GetDecayLengthXY(), // decay length defined after topological constraint + KFHtPV.GetDecayLength() / KFHtPV.GetErrDecayLength(), // ldl + chi2geoNDF, chi2topoNDF, + KFHtPV.GetLifeTime(), + // V0 + massV0, chi2massV0, + cpaFromKF(KFV0, kfpv), + // daughter momenta at vertex + kfpProton.GetPx(), kfpProton.GetPy(), kfpProton.GetPz(), + kfpPion.GetPx(), kfpPion.GetPy(), kfpPion.GetPz(), + kfpDeuteron.GetPx(), kfpDeuteron.GetPy(), kfpDeuteron.GetPz(), + // daughter momenta at inner wall of TPC + tpcInnerParamProton, tpcInnerParamPion, tpcInnerParamDeuteron, + // daughter DCAs KF + kfpProton.GetDistanceFromVertex(kfpv), + kfpPion.GetDistanceFromVertex(kfpv), + kfpDeuteron.GetDistanceFromVertex(kfpv), + kfpProton.GetDistanceFromVertexXY(kfpv), + kfpPion.GetDistanceFromVertexXY(kfpv), + kfpDeuteron.GetDistanceFromVertexXY(kfpv), + kfpProton.GetDistanceFromVertexXY(KFHt), + kfpPion.GetDistanceFromVertexXY(KFHt), + kfpDeuteron.GetDistanceFromVertexXY(KFHt), + kfpProton.GetDistanceFromParticle(kfpPion), + kfpProton.GetDistanceFromParticle(kfpDeuteron), + kfpPion.GetDistanceFromParticle(kfpDeuteron), + DCAvtxDaughters3D, + // daughter DCAs to PV in XY propagated with material + TrackPosDcaXY, TrackNegDcaXY, TrackBachDcaXY, + // daughter DCAs to PV in 3D propagated with material + TrackPosDca, TrackNegDca, TrackBachDca, + // daughter signs + kfpProton.GetQ(), + kfpPion.GetQ(), + trackBach.sign(), + // daughter PID + tpcNsigmaProton, tpcNsigmaPion, tpcNsigmaDeuteron, tpcNsigmaPionBach, + dEdxProton, dEdxPion, dEdxDeuteron, + tofNSigmaDeuteron, + averageClusterSizeDeuteron, + trackBach.pidForTracking()); + + if (kfparticleConfigurations.fillCandidateLiteTable) { + kfvtx3bodydatalite( // hypertriton massHt, KFHt.GetX(), KFHt.GetY(), KFHt.GetZ(), - KFHt.GetErrX(), KFHt.GetErrY(), KFHt.GetErrZ(), KFHt.GetPx(), KFHt.GetPy(), KFHt.GetPz(), KFHt.GetPt(), - KFHt.GetErrPx(), KFHt.GetErrPy(), KFHt.GetErrPz(), KFHt.GetErrPt(), KFHt.GetQ(), KFHt.GetDistanceFromVertex(kfpv), KFHt.GetDistanceFromVertexXY(kfpv), cpaFromKF(KFHt, kfpv), // before topo constraint cpaXYFromKF(KFHt, kfpv), - cpaFromKF(KFHtPV, kfpv), // after topo constraint - cpaXYFromKF(KFHtPV, kfpv), KFHtPV.GetDecayLength(), KFHtPV.GetDecayLengthXY(), // decay length defined after topological constraint KFHtPV.GetDecayLength() / KFHtPV.GetErrDecayLength(), // ldl chi2geoNDF, chi2topoNDF, KFHtPV.GetLifeTime(), // V0 massV0, chi2massV0, - // daughter momenta + cpaFromKF(KFV0, kfpv), + // daughter momenta at vertex kfpProton.GetPx(), kfpProton.GetPy(), kfpProton.GetPz(), kfpPion.GetPx(), kfpPion.GetPy(), kfpPion.GetPz(), kfpDeuteron.GetPx(), kfpDeuteron.GetPy(), kfpDeuteron.GetPz(), + // daughter momenta at inner wall of TPC + tpcInnerParamProton, tpcInnerParamPion, tpcInnerParamDeuteron, // daughter DCAs KF kfpProton.GetDistanceFromVertex(kfpv), kfpPion.GetDistanceFromVertex(kfpv), @@ -989,92 +1199,162 @@ struct decay3bodyBuilder { kfpProton.GetDistanceFromParticle(kfpDeuteron), kfpPion.GetDistanceFromParticle(kfpDeuteron), DCAvtxDaughters3D, - // daughter DCAs to PV in XY propagated with material - TrackPosDcaXY, TrackNegDcaXY, TrackBachDcaXY, - // daughter DCAs to PV in 3D propagated with material - TrackPosDca, TrackNegDca, TrackBachDca, // daughter signs kfpProton.GetQ(), kfpPion.GetQ(), trackBach.sign(), // daughter PID - tpcNsigmaProton, - tpcNsigmaPion, - tpcNsigmaDeuteron); - - if (kfparticleConfigurations.fillCandidateLiteTable) { - kfvtx3bodydatalite( - // hypertriton - massHt, - KFHt.GetX(), KFHt.GetY(), KFHt.GetZ(), - KFHt.GetErrX(), KFHt.GetErrY(), KFHt.GetErrZ(), - KFHt.GetPx(), KFHt.GetPy(), KFHt.GetPz(), KFHt.GetPt(), - KFHt.GetQ(), - KFHt.GetDistanceFromVertex(kfpv), KFHt.GetDistanceFromVertexXY(kfpv), - cpaFromKF(KFHt, kfpv), // before topo constraint - cpaXYFromKF(KFHt, kfpv), - cpaFromKF(KFHtPV, kfpv), // after topo constraint - cpaXYFromKF(KFHtPV, kfpv), - KFHtPV.GetDecayLength(), KFHtPV.GetDecayLengthXY(), // decay length defined after topological constraint - KFHtPV.GetDecayLength() / KFHtPV.GetErrDecayLength(), // ldl - chi2geoNDF, chi2topoNDF, - KFHtPV.GetLifeTime(), - // V0 - massV0, chi2massV0, - // daughter momenta - kfpProton.GetPx(), kfpProton.GetPy(), kfpProton.GetPz(), - kfpPion.GetPx(), kfpPion.GetPy(), kfpPion.GetPz(), - kfpDeuteron.GetPx(), kfpDeuteron.GetPy(), kfpDeuteron.GetPz(), - // daughter DCAs KF - kfpProton.GetDistanceFromVertex(kfpv), - kfpPion.GetDistanceFromVertex(kfpv), - kfpDeuteron.GetDistanceFromVertex(kfpv), - kfpProton.GetDistanceFromVertexXY(kfpv), - kfpPion.GetDistanceFromVertexXY(kfpv), - kfpDeuteron.GetDistanceFromVertexXY(kfpv), - kfpProton.GetDistanceFromVertexXY(KFHt), - kfpPion.GetDistanceFromVertexXY(KFHt), - kfpDeuteron.GetDistanceFromVertexXY(KFHt), - kfpProton.GetDistanceFromParticle(kfpPion), - kfpProton.GetDistanceFromParticle(kfpDeuteron), - kfpPion.GetDistanceFromParticle(kfpDeuteron), - DCAvtxDaughters3D, - // daughter DCAs to PV in XY propagated with material - TrackPosDcaXY, TrackNegDcaXY, TrackBachDcaXY, - // daughter DCAs to PV in 3D propagated with material - TrackPosDca, TrackNegDca, TrackBachDca, - // daughter signs - kfpProton.GetQ(), - kfpPion.GetQ(), - trackBach.sign(), - // daughter PID - tpcNsigmaProton, - tpcNsigmaPion, - tpcNsigmaDeuteron); - } - LOG(debug) << "Table filled."; - - // fill event counter hist (has selected candidate) - registry.fill(HIST("hEventCounterKFParticle"), 3.5); + tpcNsigmaProton, tpcNsigmaPion, tpcNsigmaDeuteron, tpcNsigmaPionBach, + dEdxProton, dEdxPion, dEdxDeuteron, + tofNSigmaDeuteron, + averageClusterSizeDeuteron, + trackBach.pidForTracking()); } + LOG(debug) << "Table filled."; + + // fill event counter hist (has selected candidate) + registry.fill(HIST("hEventCounterKFParticle"), 3.5); } //------------------------------------------------------------------ - void processRun3(ColwithEvTimes const& collisions, TrackExtPIDIUwithEvTimes const& tracksIU, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) + void processRun3(ColwithEvTimes const& collisions, TrackExtPIDIUwithEvTimes const& /*tracksIU*/, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) { + vtxCandidates.clear(); + for (const auto& collision : collisions) { auto bc = collision.bc_as(); initCCDB(bc); registry.fill(HIST("hEventCounter"), 0.5); const auto& d3bodysInCollision = decay3bodys.sliceBy(perCollision, collision.globalIndex()); - // buildVtx3BodyDataTable(collisions, collision, tracksIU, d3bodysInCollision, bachelorcharge); - buildVtx3BodyDataTable(collision, tracksIU, d3bodysInCollision, bachelorcharge); + for (auto& d3body : d3bodysInCollision) { + auto t0 = d3body.template track0_as(); + auto t1 = d3body.template track1_as(); + auto t2 = d3body.template track2_as(); + fillVtxCand(collision, t0, t1, t2, d3body.globalIndex(), bachelorcharge); + } + } + + for (auto& candVtx : vtxCandidates) { + fillVtx3BodyTable(candVtx); } } PROCESS_SWITCH(decay3bodyBuilder, processRun3, "Produce DCA fitter decay3body tables", true); - void processRun3withKFParticle(MyCollisions const& collisions, FullTracksExtPIDIU const&, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) + //------------------------------------------------------------------ + // Event-mixing background + void processRun3EM(FullCols const& collisions, TrackExtPIDIUwithEvTimes const& tracksIU, aod::BCsWithTimestamps const&) + { + + vtxCandidates.clear(); + + auto tracksTuple = std::make_tuple(tracksIU); + BinningType binningEvent{{axisPosZ, axisCentrality}, true}; + SameKindPair pair{binningEvent, EMTrackSel.nUseMixedEvent, -1, collisions, tracksTuple, &cache}; + + Partition candProtons = aod::track::signed1Pt > 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minProtonPt && aod::track::pt <= EMTrackSel.maxProtonPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClsproton && nabs(aod::pidtpc::tpcNSigmaPr) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candAntiProtons = aod::track::signed1Pt < 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minProtonPt && aod::track::pt <= EMTrackSel.maxProtonPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClsproton && nabs(aod::pidtpc::tpcNSigmaPr) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candPionPlus = aod::track::signed1Pt > 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minPionPt && aod::track::pt <= EMTrackSel.maxPionPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClspion && nabs(aod::pidtpc::tpcNSigmaPi) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candPionMinus = aod::track::signed1Pt < 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minPionPt && aod::track::pt <= EMTrackSel.maxPionPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClspion && nabs(aod::pidtpc::tpcNSigmaPi) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candBachelors = aod::track::signed1Pt > 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minDeuteronPt && aod::track::pt <= EMTrackSel.maxDeuteronPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClsbachelor && nabs(aod::pidtpc::tpcNSigmaDe) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candAntiBachelors = aod::track::signed1Pt < 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minDeuteronPt && aod::track::pt <= EMTrackSel.maxDeuteronPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClsbachelor && nabs(aod::pidtpc::tpcNSigmaDe) <= EMTrackSel.emTpcPidNsigmaCut; + candProtons.bindTable(tracksIU); + candPionPlus.bindTable(tracksIU); + candAntiProtons.bindTable(tracksIU); + candPionMinus.bindTable(tracksIU); + candBachelors.bindTable(tracksIU); + candAntiBachelors.bindTable(tracksIU); + + for (auto& [c1, tracks1, c2, tracks2] : pair) { + if (EMTrackSel.em_event_sel8_selection && (!c1.sel8() || !c2.sel8())) { + continue; + } + auto bc = c1.bc_as(); + initCCDB(bc); + auto protons = candProtons->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto pionsplus = candPionPlus->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto antiprotons = candAntiProtons->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto pionsminus = candPionMinus->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto bachelors = candBachelors->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); + auto antibachelors = candAntiBachelors->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); + + for (auto const& [tpos, tneg, tbach] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(protons, pionsminus, bachelors))) { + fillVtxCand(c1, tpos, tneg, tbach, -1, bachelorcharge); + } + for (auto const& [tpos, tneg, tbach] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(pionsplus, antiprotons, antibachelors))) { + fillVtxCand(c1, tpos, tneg, tbach, -1, bachelorcharge); + } + } + + // Aviod break of preslice in following workflow + std::sort(vtxCandidates.begin(), vtxCandidates.end(), [](const vtxCandidate a, const vtxCandidate b) { + return a.collisionId < b.collisionId; + }); + + for (auto& candVtx : vtxCandidates) { + fillVtx3BodyTable(candVtx); + } + } + PROCESS_SWITCH(decay3bodyBuilder, processRun3EM, "Produce event-mix background", false); + + //------------------------------------------------------------------ + // Event-mixing background + like-sign (to aviod deuteron with wrong collisionId) + void processRun3EMLikeSign(FullCols const& collisions, TrackExtPIDIUwithEvTimes const& tracksIU, aod::BCsWithTimestamps const&) + { + + vtxCandidates.clear(); + + auto tracksTuple = std::make_tuple(tracksIU); + BinningType binningEvent{{axisPosZ, axisCentrality}, true}; + SameKindPair pair{binningEvent, 5, -1, collisions, tracksTuple, &cache}; + + Partition candProtons = aod::track::signed1Pt > 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minProtonPt && aod::track::pt <= EMTrackSel.maxProtonPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClsproton && nabs(aod::pidtpc::tpcNSigmaPr) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candPionPlus = aod::track::signed1Pt > 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minPionPt && aod::track::pt <= EMTrackSel.maxPionPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClspion && nabs(aod::pidtpc::tpcNSigmaPi) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candAntiProtons = aod::track::signed1Pt < 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minProtonPt && aod::track::pt <= EMTrackSel.maxProtonPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClsproton && nabs(aod::pidtpc::tpcNSigmaPr) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candPionMinus = aod::track::signed1Pt < 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minPionPt && aod::track::pt <= EMTrackSel.maxPionPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClspion && nabs(aod::pidtpc::tpcNSigmaPi) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candBachelors = aod::track::signed1Pt > 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minDeuteronPt && aod::track::pt <= EMTrackSel.maxDeuteronPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClsbachelor && nabs(aod::pidtpc::tpcNSigmaDe) <= EMTrackSel.emTpcPidNsigmaCut; + Partition candAntiBachelors = aod::track::signed1Pt < 0.f && nabs(aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minDeuteronPt && aod::track::pt <= EMTrackSel.maxDeuteronPt && aod::track::tpcNClsFindable >= (uint8_t)EMTrackSel.mintpcNClsbachelor && nabs(aod::pidtpc::tpcNSigmaDe) <= EMTrackSel.emTpcPidNsigmaCut; + candProtons.bindTable(tracksIU); + candPionPlus.bindTable(tracksIU); + candAntiProtons.bindTable(tracksIU); + candPionMinus.bindTable(tracksIU); + candBachelors.bindTable(tracksIU); + candAntiBachelors.bindTable(tracksIU); + + for (auto& [c1, tracks1, c2, tracks2] : pair) { + if (EMTrackSel.em_event_sel8_selection && (!c1.sel8() || !c2.sel8())) { + continue; + } + auto bc = c1.bc_as(); + initCCDB(bc); + auto protons = candProtons->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto pionsplus = candPionPlus->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto antiprotons = candAntiProtons->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto pionsminus = candPionMinus->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto bachelors = candBachelors->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); + auto antibachelors = candAntiBachelors->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); + + for (auto const& [tpos, tneg, tbach] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(protons, pionsminus, antibachelors))) { + fillVtxCand(c1, tpos, tneg, tbach, -1, bachelorcharge); + } + for (auto const& [tpos, tneg, tbach] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(pionsplus, antiprotons, bachelors))) { + fillVtxCand(c1, tpos, tneg, tbach, -1, bachelorcharge); + } + } + + // Aviod break of preslice in following workflow + std::sort(vtxCandidates.begin(), vtxCandidates.end(), [](const vtxCandidate a, const vtxCandidate b) { + return a.collisionId < b.collisionId; + }); + + for (auto& candVtx : vtxCandidates) { + fillVtx3BodyTable(candVtx); + } + } + PROCESS_SWITCH(decay3bodyBuilder, processRun3EMLikeSign, "Produce event-mix background with like-sign method", false); + //------------------------------------------------------------------ + + void processRun3withKFParticle(ColwithEvTimes const& collisions, TrackExtPIDIUwithEvTimes const&, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) { for (const auto& collision : collisions) { // event selection @@ -1097,13 +1377,62 @@ struct decay3bodyBuilder { // LOG(debug) << "Collision index: " << collIdx; auto Decay3BodyTable_thisCollision = decay3bodys.sliceBy(perCollision, collIdx); // LOG(debug) << "Decay3Body tables sliced per collision. Calling buildVtx3BodyDataTableKFParticle function..."; - buildVtx3BodyDataTableKFParticle(collision, Decay3BodyTable_thisCollision, bachelorcharge); + for (auto& vtx3body : Decay3BodyTable_thisCollision) { + auto trackPos = vtx3body.template track0_as(); + auto trackNeg = vtx3body.template track1_as(); + auto trackBach = vtx3body.template track2_as(); + buildVtx3BodyDataTableKFParticle(collision, trackPos, trackNeg, trackBach, vtx3body.globalIndex(), bachelorcharge); + } LOG(debug) << "End of processKFParticle."; } } PROCESS_SWITCH(decay3bodyBuilder, processRun3withKFParticle, "Produce KFParticle decay3body tables", false); + + void processRun3EMwithKFParticle(ColwithEvTimesMults const& collisions, TrackExtPIDIUwithEvTimes const& tracksIU, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) + { + auto tuple = std::make_tuple(decay3bodys, tracksIU); + Pair pair{binningOnPosAndMult, kfparticleConfigurations.nEvtMixing, -1, collisions, tuple, &cache}; // indicates that under/overflow (-1) to be ignored + + for (auto& [c1, decays3body, c2, tracks] : pair) { + registry.fill(HIST("QA/EM/hPairCounterMixing"), 0.5); + // event selection + if (kfparticleConfigurations.doSel8selection && (!c1.sel8() || !c2.sel8())) { + continue; + } + registry.fill(HIST("QA/EM/hPairCounterMixing"), 1.5); + if (kfparticleConfigurations.doPosZselection && (abs(c1.posZ()) > 10.f || abs(c2.posZ()) > 10.f)) { + continue; + } + registry.fill(HIST("QA/EM/hPairCounterMixing"), 2.5); + auto bc = c1.bc_as(); + initCCDB(bc); + LOG(debug) << "CCDB initialised."; + + for (auto& [decay3body, track] : soa::combinations(soa::CombinationsFullIndexPolicy(decays3body, tracks))) { + auto trackPos = decay3body.template track0_as(); + auto trackNeg = decay3body.template track1_as(); + auto trackBach = decay3body.template track2_as(); + + registry.fill(HIST("QA/EM/hCombinationCounterMixing"), 0.5); + + // selections bachelor track + if ((trackBach.sign() > 0 && !(track.sign() > 0)) || (trackBach.sign() < 0 && !(track.sign() < 0)) || trackBach.globalIndex() == track.globalIndex()) { // only combine if track has correct sign and is not same as trackBach + continue; + } + registry.fill(HIST("QA/EM/hCombinationCounterMixing"), 1.5); + if (track.pt() < 0.6) { // SVertexer selection + continue; + } + registry.fill(HIST("QA/EM/hCombinationCounterMixing"), 2.5); + buildVtx3BodyDataTableKFParticle(c1, trackPos, trackNeg, track, -1, bachelorcharge); + LOG(debug) << "buildVtx3BodyDataTableKFParticle called."; + } + } + } + PROCESS_SWITCH(decay3bodyBuilder, processRun3EMwithKFParticle, "Produce KFParticle decay3body mixed event tables", false); }; +// build link from decay3body -> vtx3body struct decay3bodyDataLinkBuilder { Produces vtxdataLink; @@ -1116,7 +1445,9 @@ struct decay3bodyDataLinkBuilder { for (int ii = 0; ii < decay3bodytable.size(); ii++) lIndices[ii] = -1; for (auto& vtxdata : vtxdatatable) { - lIndices[vtxdata.decay3bodyId()] = vtxdata.globalIndex(); + if (vtxdata.decay3bodyId() != -1) { + lIndices[vtxdata.decay3bodyId()] = vtxdata.globalIndex(); + } } for (int ii = 0; ii < decay3bodytable.size(); ii++) { vtxdataLink(lIndices[ii]); @@ -1129,8 +1460,14 @@ struct kfdecay3bodyDataLinkBuilder { void init(InitContext const&) {} + void processDoNotBuildLink(aod::Collisions::iterator const&) + { + // dummy process function + } + PROCESS_SWITCH(kfdecay3bodyDataLinkBuilder, processDoNotBuildLink, "Do not build data link table.", false); + // build Decay3Body -> KFDecay3BodyData link table - void process(aod::Decay3Bodys const& decay3bodytable, aod::KFVtx3BodyDatas const& vtxdatatable) + void processBuildLink(aod::Decay3Bodys const& decay3bodytable, aod::KFVtx3BodyDatas const& vtxdatatable) { std::vector lIndices; lIndices.reserve(decay3bodytable.size()); @@ -1143,6 +1480,7 @@ struct kfdecay3bodyDataLinkBuilder { kfvtxdataLink(lIndices[ii]); } } + PROCESS_SWITCH(kfdecay3bodyDataLinkBuilder, processBuildLink, "Build data link table.", true); }; struct decay3bodyLabelBuilder { @@ -1323,7 +1661,6 @@ struct decay3bodyLabelBuilder { struct decay3bodyInitializer { Spawns vtx3bodydatas; - // Spawns kfvtx3bodydatas; void init(InitContext const&) {} }; diff --git a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx index e909a575a89..98580beb99b 100644 --- a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx +++ b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -183,6 +185,12 @@ struct tagRun2V0MCalibration { TFormula* mMCScale = nullptr; } Run2V0MInfo; +struct tagRun2CL0Calibration { + bool mCalibrationStored = false; + TH1* mhVtxAmpCorr = nullptr; + TH1* mhMultSelCalib = nullptr; +} Run2CL0Info; + struct ebyeMaker { Produces collisionEbyeTable; Produces miniCollTable; @@ -410,6 +418,15 @@ struct ebyeMaker { } else { LOGF(fatal, "Calibration information from V0M for run %d corrupted", bc.runNumber()); } + if (doprocessRun2) { + Run2CL0Info.mhVtxAmpCorr = getccdb("hVtx_fnSPDClusters0_Normalized"); + Run2CL0Info.mhMultSelCalib = getccdb("hMultSelCalib_CL0"); + if ((Run2CL0Info.mhVtxAmpCorr != nullptr) && (Run2CL0Info.mhMultSelCalib != nullptr)) { + Run2CL0Info.mCalibrationStored = true; + } else { + LOGF(fatal, "Calibration information from CL0 multiplicity for run %d corrupted", bc.runNumber()); + } + } } else { auto grpmagPath{"GLO/Config/GRPMagField"}; grpmag = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); @@ -985,22 +1002,24 @@ struct ebyeMaker { candidateV0.globalIndexPos); } - for (auto& candidateTrack : candidateTracks[1]) { // deuterons - nucleiEbyeTable( - collisionEbyeTable.lastIndex(), - candidateTrack.pt, - candidateTrack.eta, - candidateTrack.mass, - candidateTrack.dcapv, - candidateTrack.tpcncls, - candidateTrack.tpcnsigma, - candidateTrack.tofmass); + for (int iP{0}; iP < kNpart; ++iP) { + for (auto& candidateTrack : candidateTracks[iP]) { // deuterons + protons + nucleiEbyeTable( + collisionEbyeTable.lastIndex(), + candidateTrack.pt, + candidateTrack.eta, + candidateTrack.mass, + candidateTrack.dcapv, + candidateTrack.tpcncls, + candidateTrack.tpcnsigma, + candidateTrack.tofmass); + } } } } PROCESS_SWITCH(ebyeMaker, processRun3, "process (Run 3)", false); - void processRun2(soa::Join const& collisions, TracksFull const& tracks, aod::V0s const& V0s, aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs, BCsWithRun2Info const&) + void processRun2(soa::Join const& collisions, TracksFull const& tracks, aod::V0s const& V0s, aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs, BCsWithRun2Info const&) { for (const auto& collision : collisions) { auto bc = collision.bc_as(); @@ -1020,7 +1039,11 @@ struct ebyeMaker { if (!(collision.sel7() && collision.alias_bit(kINT7)) && (!kINT7Intervals || (kINT7Intervals && ((cV0M >= 10 && cV0M < 30) || cV0M > 50)))) continue; - auto centralityCl0 = collision.centRun2CL0(); + auto centralityCl0 = 105.0f; + if (Run2CL0Info.mCalibrationStored) { + float cl0m = bc.spdClustersL0() * Run2CL0Info.mhVtxAmpCorr->GetBinContent(Run2CL0Info.mhVtxAmpCorr->FindFixBin(collision.posZ())); + centralityCl0 = Run2CL0Info.mhMultSelCalib->GetBinContent(Run2CL0Info.mhMultSelCalib->FindFixBin(cl0m)); + } if (kUseEstimatorsCorrelationCut) { const auto& x = centralityCl0; const double center = estimatorsCorrelationCoef[0] + estimatorsCorrelationCoef[1] * x; @@ -1061,16 +1084,18 @@ struct ebyeMaker { candidateV0.globalIndexPos); } - for (auto& candidateTrack : candidateTracks[1]) { // deuterons - nucleiEbyeTable( - collisionEbyeTable.lastIndex(), - candidateTrack.pt, - candidateTrack.eta, - candidateTrack.mass, - candidateTrack.dcapv, - candidateTrack.tpcncls, - candidateTrack.tpcnsigma, - candidateTrack.tofmass); + for (int iP{0}; iP < kNpart; ++iP) { + for (auto& candidateTrack : candidateTracks[iP]) { // deuterons + protons + nucleiEbyeTable( + collisionEbyeTable.lastIndex(), + candidateTrack.pt, + candidateTrack.eta, + candidateTrack.mass, + candidateTrack.dcapv, + candidateTrack.tpcncls, + candidateTrack.tpcnsigma, + candidateTrack.tofmass); + } } } } @@ -1173,20 +1198,22 @@ struct ebyeMaker { candidateV0.isreco); } - for (auto& candidateTrack : candidateTracks[1]) { // deuterons - mcNucleiEbyeTable( - collisionEbyeTable.lastIndex(), - candidateTrack.pt, - candidateTrack.eta, - candidateTrack.mass, - candidateTrack.dcapv, - candidateTrack.tpcncls, - candidateTrack.tpcnsigma, - candidateTrack.tofmass, - candidateTrack.genpt, - candidateTrack.geneta, - candidateTrack.pdgcode, - candidateTrack.isreco); + for (int iP{0}; iP < kNpart; ++iP) { + for (auto& candidateTrack : candidateTracks[iP]) { // deuterons + protons + mcNucleiEbyeTable( + collisionEbyeTable.lastIndex(), + candidateTrack.pt, + candidateTrack.eta, + candidateTrack.mass, + candidateTrack.dcapv, + candidateTrack.tpcncls, + candidateTrack.tpcnsigma, + candidateTrack.tofmass, + candidateTrack.genpt, + candidateTrack.geneta, + candidateTrack.pdgcode, + candidateTrack.isreco); + } } } } @@ -1239,20 +1266,22 @@ struct ebyeMaker { candidateV0.isreco); } - for (auto& candidateTrack : candidateTracks[1]) { // deuterons - mcNucleiEbyeTable( - collisionEbyeTable.lastIndex(), - candidateTrack.pt, - candidateTrack.eta, - candidateTrack.mass, - candidateTrack.dcapv, - candidateTrack.tpcncls, - candidateTrack.tpcnsigma, - candidateTrack.tofmass, - candidateTrack.genpt, - candidateTrack.geneta, - candidateTrack.pdgcode, - candidateTrack.isreco); + for (int iP{0}; iP < kNpart; ++iP) { + for (auto& candidateTrack : candidateTracks[iP]) { // deuterons + protons + mcNucleiEbyeTable( + collisionEbyeTable.lastIndex(), + candidateTrack.pt, + candidateTrack.eta, + candidateTrack.mass, + candidateTrack.dcapv, + candidateTrack.tpcncls, + candidateTrack.tpcnsigma, + candidateTrack.tofmass, + candidateTrack.genpt, + candidateTrack.geneta, + candidateTrack.pdgcode, + candidateTrack.isreco); + } } } } diff --git a/PWGLF/TableProducer/Nuspex/lithium4analysis.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx similarity index 60% rename from PWGLF/TableProducer/Nuspex/lithium4analysis.cxx rename to PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index 95948dd3e07..5f05fb4fa1d 100644 --- a/PWGLF/TableProducer/Nuspex/lithium4analysis.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -8,7 +8,7 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// Analysis task for anti-lithium4 analysis +// Analysis task for he3-hadron femto analysis #include #include @@ -23,6 +23,9 @@ #include #include +#include +#include +#include #include #include #include // std::prev @@ -39,10 +42,11 @@ #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" -// #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/TableProducer/PID/pidTOFBase.h" @@ -58,7 +62,7 @@ #include "ReconstructionDataFormats/Track.h" #include "PWGLF/DataModel/EPCalibrationTables.h" -#include "PWGLF/DataModel/LFLithium4Tables.h" +#include "PWGLF/DataModel/LFhe3HadronTables.h" #include "PWGLF/Utils/svPoolCreator.h" using namespace o2; @@ -67,16 +71,25 @@ using namespace o2::framework::expressions; using std::array; using CollBracket = o2::math_utils::Bracket; +using McIter = aod::McParticles::iterator; +using CollBracket = o2::math_utils::Bracket; +using CollisionsFull = soa::Join; +using CollisionsFullMC = soa::Join; +using TrackCandidates = soa::Join; +using TrackCandidatesMC = soa::Join; + namespace { constexpr double betheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; -constexpr float he3Mass = o2::constants::physics::MassHelium3; -constexpr float protonMass = o2::constants::physics::MassProton; +// constexpr float he3Mass = o2::constants::physics::MassHelium3; +// constexpr float protonMass = o2::constants::physics::MassProton; +// constexpr float pionchargedMass = o2::constants::physics::MassPiPlus; constexpr int li4PDG = 1000030040; constexpr int prPDG = 2212; constexpr int hePDG = 1000020030; +// constexpr int pichargedPDG = 211; enum Selections { kNoCuts = 0, @@ -87,68 +100,71 @@ enum Selections { } // namespace -struct Lithium4Candidate { +struct he3HadCandidate { - float recoPtHe3() const { return sign * std::hypot(momHe3[0], momHe3[1]); } + float recoPtHe3() const { return signHe3 * std::hypot(momHe3[0], momHe3[1]); } float recoPhiHe3() const { return std::atan2(momHe3[1], momHe3[0]); } float recoEtaHe3() const { return std::asinh(momHe3[2] / recoPtHe3()); } - float recoPtPr() const { return sign * std::hypot(momPr[0], momPr[1]); } - float recoPhiPr() const { return std::atan2(momPr[1], momPr[0]); } - float recoEtaPr() const { return std::asinh(momPr[2] / recoPtPr()); } + float recoPtHad() const { return signHad * std::hypot(momHad[0], momHad[1]); } + float recoPhiHad() const { return std::atan2(momHad[1], momHad[0]); } + float recoEtaHad() const { return std::asinh(momHad[2] / recoPtHad()); } std::array momHe3 = {99.f, 99.f, 99.f}; - std::array momPr = {99.f, 99.f, 99.f}; + std::array momHad = {99.f, 99.f, 99.f}; - float sign = 1.f; + float signHe3 = 1.f; + float signHad = 1.f; float invMass = -10.f; float DCAxyHe3 = -10.f; float DCAzHe3 = -10.f; - float DCAxyPr = -10.f; - float DCAzPr = -10.f; + float DCAxyHad = -10.f; + float DCAzHad = -10.f; uint16_t tpcSignalHe3 = 0u; - uint16_t tpcSignalPr = 0u; + uint16_t tpcSignalHad = 0u; float momHe3TPC = -99.f; - float momPrTPC = -99.f; + float momHadTPC = -99.f; uint8_t nTPCClustersHe3 = 0u; uint8_t sharedClustersHe3 = 0u; - uint8_t sharedClustersPr = 0u; + uint8_t sharedClustersHad = 0u; float chi2TPCHe3 = -10.f; - float chi2TPCPr = -10.f; + float chi2TPCHad = -10.f; float nSigmaHe3 = -10.f; - float nSigmaPr = -10.f; + float nSigmaHad = -10.f; uint32_t PIDtrkHe3 = 0xFFFFF; // PID in tracking - uint32_t PIDtrkPr = 0xFFFFF; + uint32_t PIDtrkHad = 0xFFFFF; float massTOFHe3 = -10; - float massTOFPr = -10; + float massTOFHad = -10; uint32_t itsClSizeHe3 = 0u; - uint32_t itsClSizePr = 0u; + uint32_t itsClSizeHad = 0u; bool isBkgUS = false; // unlike sign bool isBkgEM = false; // event mixing int trackIDHe3 = -1; - int trackIDPr = -1; + int trackIDHad = -1; float l4MassMC = -10.f; float l4PtMC = -99.f; float momHe3MC = -99.f; float etaHe3MC = -99.f; float phiHe3MC = -99.f; - float momPrMC = -99.f; - float etaPrMC = -99.f; - float phiPrMC = -99.f; + float momHadMC = -99.f; + float etaHadMC = -99.f; + float phiHadMC = -99.f; // collision information - unsigned int collisionID = 0; + int32_t collisionID = 0; }; -struct lithium4analysis { +struct he3hadronfemto { - Produces m_outputDataTable; - Produces m_outputMCTable; + Produces m_outputDataTable; + Produces m_outputMCTable; + Produces m_outputMultiplicityTable; // Selections + Configurable setting_HadPDGCode{"setting_HadPDGCode", 211, "Hadron - PDG code"}; Configurable setting_cutVertex{"setting_cutVertex", 10.0f, "Accepted z-vertex range"}; Configurable setting_cutRigidityMinHe3{"setting_cutRigidityMinHe3", 0.8f, "Minimum rigidity for He3"}; Configurable setting_cutEta{"setting_cutEta", 0.9f, "Eta cut on daughter track"}; @@ -156,14 +172,17 @@ struct lithium4analysis { Configurable setting_cutDCAz{"setting_cutDCAz", 2.0f, "DCAz range for tracks"}; Configurable setting_cutChi2tpcLow{"setting_cutChi2tpcLow", 0.5f, "Low cut on TPC chi2"}; Configurable setting_cutInvMass{"setting_cutInvMass", 0.0f, "Invariant mass upper limit"}; - Configurable setting_cutPtMinLi{"setting_cutPtMinLi", 0.0f, "Minimum PT cut on Li4"}; + Configurable setting_cutPtMinhe3Had{"setting_cutPtMinhe3Had", 0.0f, "Minimum PT cut on he3Had4"}; Configurable setting_cutClSizeItsHe3{"setting_cutClSizeItsHe3", 4.0f, "Minimum ITS cluster size for He3"}; Configurable setting_cutNsigmaTPC{"setting_cutNsigmaTPC", 3.0f, "Value of the TPC Nsigma cut"}; - Configurable setting_cutPtMinTOFPr{"setting_cutPtMinTOFPr", 0.5f, "Minimum pT to apply the TOF cut on protons"}; + Configurable setting_cutNsigmaITS{"setting_cutNsigmaITS", -1.5f, "Value of the TPC Nsigma cut"}; + Configurable setting_cutPtMinTOFHad{"setting_cutPtMinTOFHad", 0.4f, "Minimum pT to apply the TOF cut on hadrons"}; Configurable setting_cutNsigmaTOF{"setting_cutNsigmaTOF", 3.0f, "Value of the TOF Nsigma cut"}; Configurable setting_noMixedEvents{"setting_noMixedEvents", 5, "Number of mixed events per event"}; Configurable setting_enableBkgUS{"setting_enableBkgUS", false, "Enable US background"}; + Configurable setting_saveUSandLS{"setting_saveUSandLS", true, "Save All Pairs"}; Configurable setting_isMC{"setting_isMC", false, "Run MC"}; + Configurable setting_fillMultiplicity{"setting_fillMultiplicity", false, "Fill multiplicity table"}; // Zorro Configurable setting_skimmedProcessing{"setting_skimmedProcessing", false, "Skimmed dataset processing"}; @@ -185,22 +204,16 @@ struct lithium4analysis { Configurable setting_compensatePIDinTracking{"setting_compensatePIDinTracking", false, "If true, divide tpcInnerParam by the electric charge"}; Configurable setting_materialCorrection{"setting_materialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Material correction type"}; - using McIter = aod::McParticles::iterator; - using CollBracket = o2::math_utils::Bracket; - using CollisionsFull = soa::Join; //, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms>>; - using CollisionsFullMC = soa::Join; //, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms>>; - using TrackCandidates = soa::Join; - using TrackCandidatesMC = soa::Join; - Preslice m_perCol = aod::track::collisionId; Preslice m_perColMC = aod::track::collisionId; // binning for EM background - ConfigurableAxis axisVertex{"axisVertex", {30, -10, 10}, "vertex axis for bin"}; - using BinningType = ColumnBinningPolicy; - BinningType binningOnPositions{{axisVertex}, true}; + ConfigurableAxis axisVertex{"axisVertex", {30, -10, 10}, "Binning for multiplicity"}; + ConfigurableAxis axisCentrality{"axisCentrality", {40, 0, 100}, "Binning for centrality"}; + using BinningType = ColumnBinningPolicy; + BinningType binningPolicy{{axisVertex, axisCentrality}, true}; SliceCache cache; - SameKindPair m_pair{binningOnPositions, setting_noMixedEvents, -1, &cache}; + SameKindPair m_pair{binningPolicy, setting_noMixedEvents, -1, &cache}; std::array m_BBparamsHe; @@ -216,9 +229,6 @@ struct lithium4analysis { Zorro m_zorro; OutputObj m_zorroSummary{"zorroSummary"}; - // check for mixed event to same event distribution compatibility - std::vector m_trackIdx2; - HistogramRegistry m_qaRegistry{ "QA", { @@ -229,15 +239,18 @@ struct lithium4analysis { {"hEmptyPool", "svPoolCreator did not find track pairs false/true", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, {"hDCAxyHe3", ";DCA_{xy} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, {"hDCAzHe3", ";DCA_{z} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, - {"hLitInvMass", "; M(^{3}He + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{50, 3.74f, 3.85f}}}}, - {"hHe3Pt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{200, -6.0f, 6.0f}}}}, - {"hProtonPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{200, -3.0f, 3.0f}}}}, + {"hhe3HadtInvMass", "; M(^{3}He + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{50, 3.74f, 3.85f}}}}, + {"hHe3Pt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, + {"hHadronPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, {"h2dEdxHe3candidates", "dEdx distribution; #it{p} (GeV/#it{c}); dE/dx (a.u.)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {100, 0.0f, 2000.0f}}}}, - {"h2ClSizeCosLamHe3", "; n#sigma_{TPC} ; #LT ITS Cluster Size #GT #LT cos#lambda #GT (^{3}He)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {120, 0.0f, 15.0f}}}}, - {"h2NsigmaHe3TPC", "NsigmaHe3 TPC distribution; #it{p}/z (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, - {"h2NsigmaProtonTPC", "NsigmaProton TPC distribution; #it{p}/z (GeV/#it{c}); n#sigma_{TPC}(p)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, - {"h2NsigmaProtonTPC_preselection", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, - {"h2NsigmaProtonTOF", "NsigmaProton TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaHe3TPC", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaHe3TPC_preselection", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"h2NSigmaHe3ITS_preselection", "NsigmaHe3 ITS distribution; signed #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS} ^{3}He", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}}}}, + {"h2NSigmaHe3ITS", "NsigmaHe3 ITS distribution; signed #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS} ^{3}He", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}}}}, + {"h2NsigmaHadronTPC", "NsigmaHadron TPC distribution; #it{p}_{T}(GeV/#it{c}); n#sigma_{TPC}(p)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaHadronTPC_preselection", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"h2NsigmaHadronTOF", "NsigmaHadron TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaHadronTOF_preselection", "NsigmaHadron TOF distribution; #iit{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, }, OutputObjHandlingPolicy::AnalysisObject, false, @@ -378,17 +391,53 @@ struct lithium4analysis { } template - bool selectionPIDProton(const Ttrack& candidate) + float computeTPCNSigmaHadron(const Ttrack& candidate) + { + float tpcNSigmaHad = 0; + if (setting_HadPDGCode == 211) { + tpcNSigmaHad = candidate.tpcNSigmaPi(); + } else if (setting_HadPDGCode == 2212) { + tpcNSigmaHad = candidate.tpcNSigmaPr(); + } else { + LOG(info) << "invalid PDG code for TPC"; + } + return tpcNSigmaHad; + } + + template + float computeTOFNSigmaHadron(const Ttrack& candidate) { - m_qaRegistry.fill(HIST("h2NsigmaProtonTPC_preselection"), candidate.tpcInnerParam(), candidate.tpcNSigmaPr()); - if (candidate.hasTOF() && candidate.pt() < setting_cutPtMinTOFPr) { - if (std::abs(candidate.tofNSigmaPr()) < setting_cutNsigmaTOF && std::abs(candidate.tpcNSigmaPr()) < setting_cutNsigmaTPC) { - m_qaRegistry.fill(HIST("h2NsigmaProtonTPC"), candidate.tpcInnerParam(), candidate.tpcNSigmaPr()); - m_qaRegistry.fill(HIST("h2NsigmaProtonTOF"), candidate.p(), candidate.tofNSigmaPr()); - return true; + float tofNSigmaHad = 0; + if (setting_HadPDGCode == 211) { + tofNSigmaHad = candidate.tofNSigmaPi(); + } else if (setting_HadPDGCode == 2212) { + tofNSigmaHad = candidate.tofNSigmaPr(); + } else { + LOG(info) << "invalid PDG code for TOF"; + } + return tofNSigmaHad; + } + + template + bool selectionPIDHadron(const Ttrack& candidate) + { + auto tpcNSigmaHad = computeTPCNSigmaHadron(candidate); + m_qaRegistry.fill(HIST("h2NsigmaHadronTPC_preselection"), candidate.tpcInnerParam(), tpcNSigmaHad); + if (candidate.hasTOF() && candidate.pt() > setting_cutPtMinTOFHad) { + auto tofNSigmaHad = computeTOFNSigmaHadron(candidate); + + if (std::abs(tpcNSigmaHad) > setting_cutNsigmaTPC) { + return false; } - } else if (std::abs(candidate.tpcNSigmaPr()) < setting_cutNsigmaTPC) { - m_qaRegistry.fill(HIST("h2NsigmaProtonTPC"), candidate.tpcInnerParam(), candidate.tpcNSigmaPr()); + m_qaRegistry.fill(HIST("h2NsigmaHadronTOF_preselection"), candidate.pt(), tofNSigmaHad); + if (std::abs(tofNSigmaHad) > setting_cutNsigmaTOF) { + return false; + } + m_qaRegistry.fill(HIST("h2NsigmaHadronTPC"), candidate.pt(), tpcNSigmaHad); + m_qaRegistry.fill(HIST("h2NsigmaHadronTOF"), candidate.pt(), tofNSigmaHad); + return true; + } else if (std::abs(tpcNSigmaHad) < setting_cutNsigmaTPC) { + m_qaRegistry.fill(HIST("h2NsigmaHadronTPC"), candidate.pt(), tpcNSigmaHad); return true; } return false; @@ -415,43 +464,37 @@ struct lithium4analysis { return false; } - float cosl = 1. / std::cosh(candidate.eta()); - float meanClsizeIts = 0.f; - int nHitsIts = 0; - for (int ilayer = 0; ilayer < 7; ilayer++) { - float clsizeLayer = (candidate.itsClusterSizes() >> ilayer * 4) & 0b1111; - if (clsizeLayer > 0) { - nHitsIts++; - meanClsizeIts += clsizeLayer; - } - } - float clsizeCoslIts = meanClsizeIts / nHitsIts * cosl; - if (clsizeCoslIts < setting_cutClSizeItsHe3) { - return false; - } - auto nSigmaHe3 = computeNSigmaHe3(candidate); + m_qaRegistry.fill(HIST("h2NsigmaHe3TPC_preselection"), candidate.sign() * 2 * candidate.pt(), nSigmaHe3); if (std::abs(nSigmaHe3) > setting_cutNsigmaTPC) { return false; } + // + o2::aod::ITSResponse m_responseITS; + auto ITSnSigmaHe3 = m_responseITS.nSigmaITS(candidate.itsClusterSizes(), 2 * candidate.p(), candidate.eta()); + // + m_qaRegistry.fill(HIST("h2NSigmaHe3ITS_preselection"), candidate.sign() * 2 * candidate.pt(), ITSnSigmaHe3); + if (ITSnSigmaHe3 < setting_cutNsigmaITS) { + return false; + } m_qaRegistry.fill(HIST("h2dEdxHe3candidates"), candidate.sign() * correctedTPCinnerParam, candidate.tpcSignal()); - m_qaRegistry.fill(HIST("h2NsigmaHe3TPC"), candidate.sign() * correctedTPCinnerParam, nSigmaHe3); - m_qaRegistry.fill(HIST("h2ClSizeCosLamHe3"), nSigmaHe3, clsizeCoslIts); + m_qaRegistry.fill(HIST("h2NsigmaHe3TPC"), candidate.sign() * 2 * candidate.pt(), nSigmaHe3); + m_qaRegistry.fill(HIST("h2NSigmaHe3ITS"), candidate.sign() * 2 * candidate.pt(), ITSnSigmaHe3); return true; } // ================================================================================================================== template - bool fillCandidateInfo(const Ttrack& trackHe3, const Ttrack& trackPr, const CollBracket& collBracket, const Tcollisions& collisions, Lithium4Candidate& li4cand, const Ttracks& trackTable, bool mix) + bool fillCandidateInfo(const Ttrack& trackHe3, const Ttrack& trackHad, const CollBracket& collBracket, const Tcollisions& collisions, he3HadCandidate& he3Hadcand, const Ttracks& /*trackTable*/, bool isMixedEvent) { - if (!mix) { + if (!isMixedEvent) { auto trackCovHe3 = getTrackParCov(trackHe3); - auto trackCovPr = getTrackParCov(trackPr); + auto trackCovHad = getTrackParCov(trackHad); int nCand = 0; try { - nCand = m_fitter.process(trackCovHe3, trackCovPr); + nCand = m_fitter.process(trackCovHe3, trackCovHad); } catch (...) { LOG(error) << "Exception caught in DCA fitter process call!"; return false; @@ -481,94 +524,104 @@ struct lithium4analysis { if (!m_goodCollisions[collIdxMin]) { return false; } + he3Hadcand.collisionID = collIdxMin; + } else { + he3Hadcand.collisionID = collBracket.getMin(); } - li4cand.momHe3 = std::array{trackHe3.px(), trackHe3.py(), trackHe3.pz()}; + he3Hadcand.momHe3 = std::array{trackHe3.px(), trackHe3.py(), trackHe3.pz()}; for (int i = 0; i < 3; i++) - li4cand.momHe3[i] = li4cand.momHe3[i] * 2; - li4cand.momPr = std::array{trackPr.px(), trackPr.py(), trackPr.pz()}; - - float invMass = RecoDecay::m(std::array{li4cand.momHe3, li4cand.momPr}, std::array{o2::constants::physics::MassHelium3, o2::constants::physics::MassProton}); + he3Hadcand.momHe3[i] = he3Hadcand.momHe3[i] * 2; + he3Hadcand.momHad = std::array{trackHad.px(), trackHad.py(), trackHad.pz()}; + float invMass = 0; + if (setting_HadPDGCode == 211) { + invMass = RecoDecay::m(std::array{he3Hadcand.momHe3, he3Hadcand.momHad}, std::array{o2::constants::physics::MassHelium3, o2::constants::physics::MassPiPlus}); + } else if (setting_HadPDGCode == 2212) { + invMass = RecoDecay::m(std::array{he3Hadcand.momHe3, he3Hadcand.momHad}, std::array{o2::constants::physics::MassHelium3, o2::constants::physics::MassProton}); + } else { + LOG(info) << "invalid PDG code for invMass"; + } + // float invMass = RecoDecay::m(std::array{he3Hadcand.momHe3, he3Hadcand.momHad}, std::array{o2::constants::physics::MassHelium3, o2::constants::physics::MassPiPlus}); if (setting_cutInvMass > 0 && invMass > setting_cutInvMass) { return false; } - float ptLi = std::hypot(li4cand.momHe3[0] + li4cand.momPr[0], li4cand.momHe3[1] + li4cand.momPr[1]); - if (ptLi < setting_cutPtMinLi) { + float pthe3Had = std::hypot(he3Hadcand.momHe3[0] + he3Hadcand.momHad[0], he3Hadcand.momHe3[1] + he3Hadcand.momHad[1]); + if (pthe3Had < setting_cutPtMinhe3Had) { return false; } - li4cand.sign = trackHe3.sign(); + he3Hadcand.signHe3 = trackHe3.sign(); + he3Hadcand.signHad = trackHad.sign(); - li4cand.DCAxyHe3 = trackHe3.dcaXY(); - li4cand.DCAzHe3 = trackHe3.dcaZ(); - li4cand.DCAxyPr = trackPr.dcaXY(); - li4cand.DCAzPr = trackPr.dcaZ(); + he3Hadcand.DCAxyHe3 = trackHe3.dcaXY(); + he3Hadcand.DCAzHe3 = trackHe3.dcaZ(); + he3Hadcand.DCAxyHad = trackHad.dcaXY(); + he3Hadcand.DCAzHad = trackHad.dcaZ(); - li4cand.tpcSignalHe3 = trackHe3.tpcSignal(); + he3Hadcand.tpcSignalHe3 = trackHe3.tpcSignal(); bool heliumPID = trackHe3.pidForTracking() == o2::track::PID::Helium3 || trackHe3.pidForTracking() == o2::track::PID::Alpha; float correctedTPCinnerParamHe3 = (heliumPID && setting_compensatePIDinTracking) ? trackHe3.tpcInnerParam() / 2.f : trackHe3.tpcInnerParam(); - li4cand.momHe3TPC = correctedTPCinnerParamHe3; - li4cand.tpcSignalPr = trackPr.tpcSignal(); - li4cand.momPrTPC = trackPr.tpcInnerParam(); + he3Hadcand.momHe3TPC = correctedTPCinnerParamHe3; + he3Hadcand.tpcSignalHad = trackHad.tpcSignal(); + he3Hadcand.momHadTPC = trackHad.tpcInnerParam(); + + he3Hadcand.nTPCClustersHe3 = trackHe3.tpcNClsFound(); + he3Hadcand.nSigmaHe3 = computeNSigmaHe3(trackHe3); + he3Hadcand.nSigmaHad = computeTPCNSigmaHadron(trackHad); - li4cand.nTPCClustersHe3 = trackHe3.tpcNClsFound(); - li4cand.nSigmaHe3 = computeNSigmaHe3(trackHe3); - li4cand.nSigmaPr = trackPr.tpcNSigmaPr(); - li4cand.chi2TPCHe3 = trackHe3.tpcChi2NCl(); - li4cand.chi2TPCPr = trackPr.tpcChi2NCl(); + he3Hadcand.chi2TPCHe3 = trackHe3.tpcChi2NCl(); + he3Hadcand.chi2TPCHad = trackHad.tpcChi2NCl(); - li4cand.PIDtrkHe3 = trackHe3.pidForTracking(); - li4cand.PIDtrkPr = trackPr.pidForTracking(); + he3Hadcand.PIDtrkHe3 = trackHe3.pidForTracking(); + he3Hadcand.PIDtrkHad = trackHad.pidForTracking(); - li4cand.itsClSizeHe3 = trackHe3.itsClusterSizes(); - li4cand.itsClSizePr = trackPr.itsClusterSizes(); + he3Hadcand.itsClSizeHe3 = trackHe3.itsClusterSizes(); + he3Hadcand.itsClSizeHad = trackHad.itsClusterSizes(); - li4cand.sharedClustersHe3 = trackHe3.tpcNClsShared(); - li4cand.sharedClustersPr = trackPr.tpcNClsShared(); + he3Hadcand.sharedClustersHe3 = trackHe3.tpcNClsShared(); + he3Hadcand.sharedClustersHad = trackHad.tpcNClsShared(); - li4cand.isBkgUS = trackHe3.sign() * trackPr.sign() < 0; - li4cand.isBkgEM = mix; + he3Hadcand.isBkgUS = trackHe3.sign() * trackHad.sign() < 0; + he3Hadcand.isBkgEM = isMixedEvent; - li4cand.invMass = invMass; + he3Hadcand.invMass = invMass; - li4cand.trackIDHe3 = trackHe3.globalIndex(); - li4cand.trackIDPr = trackPr.globalIndex(); + he3Hadcand.trackIDHe3 = trackHe3.globalIndex(); + he3Hadcand.trackIDHad = trackHad.globalIndex(); - o2::pid::tof::Beta responseBeta; if (trackHe3.hasTOF()) { - float beta = responseBeta.GetBeta(trackHe3); + float beta = o2::pid::tof::Beta::GetBeta(trackHe3); beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked bool heliumPID = trackHe3.pidForTracking() == o2::track::PID::Helium3 || trackHe3.pidForTracking() == o2::track::PID::Alpha; float correctedTPCinnerParamHe3 = (heliumPID && setting_compensatePIDinTracking) ? trackHe3.tpcInnerParam() / 2.f : trackHe3.tpcInnerParam(); - li4cand.massTOFHe3 = correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); + he3Hadcand.massTOFHe3 = correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); } - if (trackPr.hasTOF()) { - float beta = responseBeta.GetBeta(trackPr); + if (trackHad.hasTOF()) { + float beta = o2::pid::tof::Beta::GetBeta(trackHad); beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - li4cand.massTOFPr = trackPr.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); + he3Hadcand.massTOFHad = trackHad.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); } return true; } template - void fillCandidateInfoMC(const Mc& mctrackHe3, const Mc& mctrackPr, const Mc& mctrackMother, Lithium4Candidate& li4cand) + void fillCandidateInfoMC(const Mc& mctrackHe3, const Mc& mctrackHad, const Mc& mctrackMother, he3HadCandidate& he3Hadcand) { - li4cand.momHe3MC = mctrackHe3.pt() * (mctrackHe3.pdgCode() > 0 ? 1 : -1); - li4cand.etaHe3MC = mctrackHe3.eta(); - li4cand.phiHe3MC = mctrackHe3.phi(); - li4cand.momPrMC = mctrackPr.pt() * (mctrackPr.pdgCode() > 0 ? 1 : -1); - li4cand.etaPrMC = mctrackPr.eta(); - li4cand.phiPrMC = mctrackPr.phi(); - li4cand.l4PtMC = mctrackMother.pt() * (mctrackMother.pdgCode() > 0 ? 1 : -1); - const double eLit = mctrackHe3.e() + mctrackPr.e(); - li4cand.l4MassMC = std::sqrt(eLit * eLit - mctrackMother.p() * mctrackMother.p()); + he3Hadcand.momHe3MC = mctrackHe3.pt() * (mctrackHe3.pdgCode() > 0 ? 1 : -1); + he3Hadcand.etaHe3MC = mctrackHe3.eta(); + he3Hadcand.phiHe3MC = mctrackHe3.phi(); + he3Hadcand.momHadMC = mctrackHad.pt() * (mctrackHad.pdgCode() > 0 ? 1 : -1); + he3Hadcand.etaHadMC = mctrackHad.eta(); + he3Hadcand.phiHadMC = mctrackHad.phi(); + he3Hadcand.l4PtMC = mctrackMother.pt() * (mctrackMother.pdgCode() > 0 ? 1 : -1); + const double eLit = mctrackHe3.e() + mctrackHad.e(); + he3Hadcand.l4MassMC = std::sqrt(eLit * eLit - mctrackMother.p() * mctrackMother.p()); } template void pairTracksSameEvent(const Ttrack& tracks) { - for (auto track0 : tracks) { m_qaRegistry.fill(HIST("hTrackSel"), Selections::kNoCuts); @@ -589,13 +642,16 @@ struct lithium4analysis { continue; } - if (!setting_enableBkgUS) { - if (track0.sign() * track1.sign() < 0) { + if (!setting_saveUSandLS) { + if (!setting_enableBkgUS && (track0.sign() * track1.sign() < 0)) { + continue; + } + if (setting_enableBkgUS && (track0.sign() * track1.sign() > 0)) { continue; } } - if (!selectTrack(track1) || !selectionPIDProton(track1)) { + if (!selectTrack(track1) || !selectionPIDHadron(track1)) { continue; } @@ -611,20 +667,20 @@ struct lithium4analysis { } template - void pairTracksEventMixing(T& he3Cands, T& protonCands) + void pairTracksEventMixing(T& he3Cands, T& hadronCands) { for (auto& he3Cand : he3Cands) { if (!selectTrack(he3Cand) || !selectionPIDHe3(he3Cand)) { continue; } - for (auto& protonCand : protonCands) { - if (!selectTrack(protonCand) || !selectionPIDProton(protonCand)) { + for (auto& hadronCand : hadronCands) { + if (!selectTrack(hadronCand) || !selectionPIDHadron(hadronCand)) { continue; } SVCand trackPair; trackPair.tr0Idx = he3Cand.globalIndex(); - trackPair.tr1Idx = protonCand.globalIndex(); + trackPair.tr1Idx = hadronCand.globalIndex(); const int collIdx = he3Cand.collisionId(); CollBracket collBracket{collIdx, collIdx}; trackPair.collBracket = collBracket; @@ -633,88 +689,122 @@ struct lithium4analysis { } } - void fillTable(const Lithium4Candidate& li4cand, bool isMC = false) + template + void fillTable(const he3HadCandidate& he3Hadcand, const Tcoll& collision, bool isMC = false) { - if (!isMC) { - m_outputDataTable( - li4cand.recoPtHe3(), - li4cand.recoEtaHe3(), - li4cand.recoPhiHe3(), - li4cand.recoPtPr(), - li4cand.recoEtaPr(), - li4cand.recoPhiPr(), - li4cand.DCAxyHe3, - li4cand.DCAzHe3, - li4cand.DCAxyPr, - li4cand.DCAzPr, - li4cand.tpcSignalHe3, - li4cand.momHe3TPC, - li4cand.tpcSignalPr, - li4cand.momPrTPC, - li4cand.nTPCClustersHe3, - li4cand.nSigmaHe3, - li4cand.nSigmaPr, - li4cand.chi2TPCHe3, - li4cand.chi2TPCPr, - li4cand.massTOFHe3, - li4cand.massTOFPr, - li4cand.PIDtrkHe3, - li4cand.PIDtrkPr, - li4cand.itsClSizeHe3, - li4cand.itsClSizePr, - li4cand.sharedClustersHe3, - li4cand.sharedClustersPr, - li4cand.isBkgUS, - li4cand.isBkgEM); - } else { + m_outputDataTable( + he3Hadcand.recoPtHe3(), + he3Hadcand.recoEtaHe3(), + he3Hadcand.recoPhiHe3(), + he3Hadcand.recoPtHad(), + he3Hadcand.recoEtaHad(), + he3Hadcand.recoPhiHad(), + he3Hadcand.DCAxyHe3, + he3Hadcand.DCAzHe3, + he3Hadcand.DCAxyHad, + he3Hadcand.DCAzHad, + he3Hadcand.tpcSignalHe3, + he3Hadcand.momHe3TPC, + he3Hadcand.tpcSignalHad, + he3Hadcand.momHadTPC, + he3Hadcand.nTPCClustersHe3, + he3Hadcand.nSigmaHe3, + he3Hadcand.nSigmaHad, + he3Hadcand.chi2TPCHe3, + he3Hadcand.chi2TPCHad, + he3Hadcand.massTOFHe3, + he3Hadcand.massTOFHad, + he3Hadcand.PIDtrkHe3, + he3Hadcand.PIDtrkHad, + he3Hadcand.itsClSizeHe3, + he3Hadcand.itsClSizeHad, + he3Hadcand.sharedClustersHe3, + he3Hadcand.sharedClustersHad, + he3Hadcand.isBkgUS, + he3Hadcand.isBkgEM); + if (isMC) { m_outputMCTable( - li4cand.recoPtHe3(), - li4cand.recoEtaHe3(), - li4cand.recoPhiHe3(), - li4cand.recoPtPr(), - li4cand.recoEtaPr(), - li4cand.recoPhiPr(), - li4cand.DCAxyHe3, - li4cand.DCAzHe3, - li4cand.DCAxyPr, - li4cand.DCAzPr, - li4cand.tpcSignalHe3, - li4cand.momHe3TPC, - li4cand.tpcSignalPr, - li4cand.momPrTPC, - li4cand.nTPCClustersHe3, - li4cand.nSigmaHe3, - li4cand.nSigmaPr, - li4cand.chi2TPCHe3, - li4cand.chi2TPCPr, - li4cand.massTOFHe3, - li4cand.massTOFPr, - li4cand.PIDtrkHe3, - li4cand.PIDtrkPr, - li4cand.itsClSizeHe3, - li4cand.itsClSizePr, - li4cand.sharedClustersHe3, - li4cand.sharedClustersPr, - li4cand.isBkgUS, - li4cand.isBkgEM, - li4cand.momHe3MC, - li4cand.etaHe3MC, - li4cand.phiHe3MC, - li4cand.momPrMC, - li4cand.etaPrMC, - li4cand.phiPrMC, - li4cand.l4PtMC, - li4cand.l4MassMC); + he3Hadcand.momHe3MC, + he3Hadcand.etaHe3MC, + he3Hadcand.phiHe3MC, + he3Hadcand.momHadMC, + he3Hadcand.etaHadMC, + he3Hadcand.phiHadMC, + he3Hadcand.l4PtMC, + he3Hadcand.l4MassMC); + } + if (setting_fillMultiplicity) { + m_outputMultiplicityTable( + collision.globalIndex(), + collision.posZ(), + collision.numContrib(), + collision.centFT0C(), + collision.multFT0C()); } } - void fillHistograms(const Lithium4Candidate& li4cand) + void fillHistograms(const he3HadCandidate& he3Hadcand) { - m_qaRegistry.fill(HIST("hHe3Pt"), li4cand.recoPtHe3()); - m_qaRegistry.fill(HIST("hProtonPt"), li4cand.recoPtPr()); - m_qaRegistry.fill(HIST("hLitInvMass"), li4cand.invMass); - m_qaRegistry.fill(HIST("hDCAxyHe3"), li4cand.DCAxyHe3); - m_qaRegistry.fill(HIST("hDCAzHe3"), li4cand.DCAzHe3); + m_qaRegistry.fill(HIST("hHe3Pt"), he3Hadcand.recoPtHe3()); + m_qaRegistry.fill(HIST("hHadronPt"), he3Hadcand.recoPtHad()); + m_qaRegistry.fill(HIST("hhe3HadtInvMass"), he3Hadcand.invMass); + m_qaRegistry.fill(HIST("hDCAxyHe3"), he3Hadcand.DCAxyHe3); + m_qaRegistry.fill(HIST("hDCAzHe3"), he3Hadcand.DCAzHe3); + } + + // ================================================================================================================== + + template + void fillPairs(const Tcollisions& collisions, const Ttracks& tracks, const bool isMixedEvent) + { + for (auto& trackPair : m_trackPairs) { + + auto heTrack = tracks.rawIteratorAt(trackPair.tr0Idx); + auto hadTrack = tracks.rawIteratorAt(trackPair.tr1Idx); + auto collBracket = trackPair.collBracket; + + he3HadCandidate he3Hadcand; + if (!fillCandidateInfo(heTrack, hadTrack, collBracket, collisions, he3Hadcand, tracks, isMixedEvent)) { + continue; + } + fillHistograms(he3Hadcand); + auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); + fillTable(he3Hadcand, collision, /*isMC*/ false); + } + } + + template + void fillMcParticles(const Tcollisions& collisions, const TmcParticles& mcParticles, std::vector& filledMothers) + { + for (auto& mcParticle : mcParticles) { + + if (std::abs(mcParticle.pdgCode()) != li4PDG || std::abs(mcParticle.y()) > 1 || mcParticle.isPhysicalPrimary() == false) { + continue; + } + + if (std::find(filledMothers.begin(), filledMothers.end(), mcParticle.globalIndex()) != filledMothers.end()) { + continue; + } + + auto kDaughters = mcParticle.template daughters_as(); + bool daughtHe3(false), daughtHad(false); + McIter mcHe3, mcHad; + for (auto kCurrentDaughter : kDaughters) { + if (std::abs(kCurrentDaughter.pdgCode()) == hePDG) { + daughtHe3 = true; + mcHe3 = kCurrentDaughter; + } else if (std::abs(kCurrentDaughter.pdgCode()) == prPDG) { + daughtHad = true; + mcHad = kCurrentDaughter; + } + } + if (daughtHe3 && daughtHad) { + he3HadCandidate he3Hadcand; + fillCandidateInfoMC(mcHe3, mcHad, mcParticle, he3Hadcand); + auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); + fillTable(he3Hadcand, collision, /*isMC*/ true); + } + } } // ================================================================================================================== @@ -742,22 +832,11 @@ struct lithium4analysis { if (m_trackPairs.size() == 0) { continue; } - for (auto& trackPair : m_trackPairs) { - - auto heTrack = tracks.rawIteratorAt(trackPair.tr0Idx); - auto prTrack = tracks.rawIteratorAt(trackPair.tr1Idx); - auto collBracket = trackPair.collBracket; - Lithium4Candidate li4cand; - if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, li4cand, tracks, /*mix*/ false)) { - continue; - } - fillHistograms(li4cand); - fillTable(li4cand, false); - } + fillPairs(collisions, tracks, /*isMixedEvent*/ false); } } - PROCESS_SWITCH(lithium4analysis, processSameEvent, "Process Same event", false); + PROCESS_SWITCH(he3hadronfemto, processSameEvent, "Process Same event", false); void processMixedEvent(const CollisionsFull& collisions, const TrackCandidates& tracks) { @@ -776,21 +855,9 @@ struct lithium4analysis { pairTracksEventMixing(tracks2, tracks1); } - for (auto& trackPair : m_trackPairs) { - - auto heTrack = tracks.rawIteratorAt(trackPair.tr0Idx); - auto prTrack = tracks.rawIteratorAt(trackPair.tr1Idx); - auto collBracket = trackPair.collBracket; - - Lithium4Candidate li4cand; - if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, li4cand, tracks, /*mix*/ true)) { - continue; - } - fillHistograms(li4cand); - fillTable(li4cand, false); - } + fillPairs(collisions, tracks, /*isMixedEvent*/ true); } - PROCESS_SWITCH(lithium4analysis, processMixedEvent, "Process Mixed event", false); + PROCESS_SWITCH(he3hadronfemto, processMixedEvent, "Process Mixed event", false); void processMC(const CollisionsFullMC& collisions, const aod::BCsWithTimestamps& bcs, const TrackCandidatesMC& tracks, const aod::McParticles& mcParticles) { @@ -825,62 +892,36 @@ struct lithium4analysis { } auto mctrackHe3 = heTrack.mcParticle(); - auto mctrackPr = prTrack.mcParticle(); + auto mctrackHad = prTrack.mcParticle(); - if (std::abs(mctrackHe3.pdgCode()) != hePDG || std::abs(mctrackPr.pdgCode()) != prPDG) { + if (std::abs(mctrackHe3.pdgCode()) != hePDG || std::abs(mctrackHad.pdgCode()) != prPDG) { continue; } for (auto& mothertrack : mctrackHe3.mothers_as()) { - for (auto& mothertrackPr : mctrackPr.mothers_as()) { + for (auto& mothertrackHad : mctrackHad.mothers_as()) { - if (mothertrack != mothertrackPr || std::abs(mothertrack.pdgCode()) != li4PDG || std::abs(mothertrack.y()) > 1) { + if (mothertrack != mothertrackHad || std::abs(mothertrack.pdgCode()) != li4PDG || std::abs(mothertrack.y()) > 1) { continue; } - Lithium4Candidate li4cand; - if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, li4cand, tracks, /*mix*/ false)) { + he3HadCandidate he3Hadcand; + if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, he3Hadcand, tracks, /*mix*/ false)) { continue; } - fillCandidateInfoMC(mctrackHe3, mctrackPr, mothertrack, li4cand); - fillHistograms(li4cand); - fillTable(li4cand, true); + fillCandidateInfoMC(mctrackHe3, mctrackHad, mothertrack, he3Hadcand); + fillHistograms(he3Hadcand); + auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); + fillTable(he3Hadcand, collision, /*isMC*/ true); filledMothers.push_back(mothertrack.globalIndex()); } } } } - for (auto& mcParticle : mcParticles) { - - if (std::abs(mcParticle.pdgCode()) != li4PDG || std::abs(mcParticle.y()) > 1 || mcParticle.isPhysicalPrimary() == false) { - continue; - } - - if (std::find(filledMothers.begin(), filledMothers.end(), mcParticle.globalIndex()) != filledMothers.end()) { - continue; - } - - auto kDaughters = mcParticle.daughters_as(); - bool daughtHe3(false), daughtPr(false); - McIter mcHe3, mcPr; - for (auto kCurrentDaughter : kDaughters) { - if (std::abs(kCurrentDaughter.pdgCode()) == hePDG) { - daughtHe3 = true; - mcHe3 = kCurrentDaughter; - } else if (std::abs(kCurrentDaughter.pdgCode()) == prPDG) { - daughtPr = true; - mcPr = kCurrentDaughter; - } - } - if (daughtHe3 && daughtPr) { - Lithium4Candidate li4cand; - fillCandidateInfoMC(mcHe3, mcPr, mcParticle, li4cand); - fillTable(li4cand, true); - } - } + fillMcParticles(collisions, mcParticles, filledMothers); } - PROCESS_SWITCH(lithium4analysis, processMC, "Process MC", false); + PROCESS_SWITCH(he3hadronfemto, processMC, "Process MC", false); void processSameEventPools(const CollisionsFull& collisions, const TrackCandidates& tracks, const aod::AmbiguousTracks& ambiguousTracks, const aod::BCsWithTimestamps& bcs) { @@ -903,9 +944,9 @@ struct lithium4analysis { continue; m_qaRegistry.fill(HIST("hTrackSel"), Selections::kTrackCuts); - bool selPr = selectionPIDProton(track); + bool selHad = selectionPIDHadron(track); bool selHe = selectionPIDHe3(track); - if ((!selPr && !selHe) || (selPr && selHe)) { + if ((!selHad && !selHe) || (selHad && selHe)) { continue; } m_qaRegistry.fill(HIST("hTrackSel"), Selections::kPID); @@ -915,27 +956,16 @@ struct lithium4analysis { m_svPoolCreator.appendTrackCand(track, collisions, pdgHypo, ambiguousTracks, bcs); } - auto& svPool = m_svPoolCreator.getSVCandPool(collisions, true); - if (svPool.size() == 0) { + m_trackPairs = m_svPoolCreator.getSVCandPool(collisions, true); + if (m_trackPairs.size() == 0) { m_qaRegistry.fill(HIST("hEmptyPool"), 1); return; } m_qaRegistry.fill(HIST("hEmptyPool"), 0); - for (auto& svCand : svPool) { - auto heTrack = tracks.rawIteratorAt(svCand.tr0Idx); - auto prTrack = tracks.rawIteratorAt(svCand.tr1Idx); - auto collBracket = svCand.collBracket; - Lithium4Candidate li4cand; - - if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, li4cand, tracks, /*mix*/ false)) { - continue; - } - fillHistograms(li4cand); - fillTable(li4cand, false); - } + fillPairs(collisions, tracks, /*isMixedEvent*/ false); } - PROCESS_SWITCH(lithium4analysis, processSameEventPools, "Process Same event pools", false); + PROCESS_SWITCH(he3hadronfemto, processSameEventPools, "Process Same event pools", false); void processMcPools(const CollisionsFullMC& collisions, const TrackCandidatesMC& tracks, const aod::AmbiguousTracks& ambiguousTracks, const aod::BCsWithTimestamps& bcs, const aod::McParticles& mcParticles, const aod::McTrackLabels& mcTrackLabels) { @@ -960,9 +990,9 @@ struct lithium4analysis { continue; m_qaRegistry.fill(HIST("hTrackSel"), Selections::kTrackCuts); - bool selPr = selectionPIDProton(track); + bool selHad = selectionPIDHadron(track); bool selHe = selectionPIDHe3(track); - if ((!selPr && !selHe) || (selPr && selHe)) + if ((!selHad && !selHe) || (selHad && selHe)) continue; m_qaRegistry.fill(HIST("hTrackSel"), Selections::kPID); @@ -990,65 +1020,39 @@ struct lithium4analysis { } auto mctrackHe3 = heTrackLabel.mcParticle_as(); - auto mctrackPr = prTrackLabel.mcParticle_as(); + auto mctrackHad = prTrackLabel.mcParticle_as(); - if (std::abs(mctrackHe3.pdgCode()) != hePDG || std::abs(mctrackPr.pdgCode()) != prPDG || !mctrackHe3.has_mothers() || !mctrackPr.has_mothers()) { + if (std::abs(mctrackHe3.pdgCode()) != hePDG || std::abs(mctrackHad.pdgCode()) != prPDG || !mctrackHe3.has_mothers() || !mctrackHad.has_mothers()) { continue; } for (auto& mothertrackHe : mctrackHe3.mothers_as()) { - for (auto& mothertrackPr : mctrackPr.mothers_as()) { + for (auto& mothertrackHad : mctrackHad.mothers_as()) { - if (mothertrackHe.globalIndex() != mothertrackPr.globalIndex() || std::abs(mothertrackHe.pdgCode()) != li4PDG || std::abs(mothertrackHe.y()) > 1) { + if (mothertrackHe.globalIndex() != mothertrackHad.globalIndex() || std::abs(mothertrackHe.pdgCode()) != li4PDG || std::abs(mothertrackHe.y()) > 1) { continue; } - Lithium4Candidate li4cand; - if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, li4cand, tracks, /*mix*/ false)) { + he3HadCandidate he3Hadcand; + if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, he3Hadcand, tracks, /*mix*/ false)) { continue; } - fillCandidateInfoMC(mctrackHe3, mctrackPr, mothertrackHe, li4cand); - fillHistograms(li4cand); - fillTable(li4cand, true); + fillCandidateInfoMC(mctrackHe3, mctrackHad, mothertrackHe, he3Hadcand); + fillHistograms(he3Hadcand); + auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); + fillTable(he3Hadcand, collision, /*isMC*/ true); filledMothers.push_back(mothertrackHe.globalIndex()); } } } - for (auto& mcParticle : mcParticles) { - - if (std::abs(mcParticle.pdgCode()) != li4PDG || std::abs(mcParticle.y()) > 1 || mcParticle.isPhysicalPrimary() == false) { - continue; - } - - if (std::find(filledMothers.begin(), filledMothers.end(), mcParticle.globalIndex()) != filledMothers.end()) { - continue; - } - - auto kDaughters = mcParticle.daughters_as(); - bool daughtHe3(false), daughtPr(false); - McIter mcHe3, mcPr; - for (auto kCurrentDaughter : kDaughters) { - if (std::abs(kCurrentDaughter.pdgCode()) == hePDG) { - daughtHe3 = true; - mcHe3 = kCurrentDaughter; - } else if (std::abs(kCurrentDaughter.pdgCode()) == prPDG) { - daughtPr = true; - mcPr = kCurrentDaughter; - } - } - if (daughtHe3 && daughtPr) { - Lithium4Candidate li4cand; - fillCandidateInfoMC(mcHe3, mcPr, mcParticle, li4cand); - fillTable(li4cand, true); - } - } + fillMcParticles(collisions, mcParticles, filledMothers); } - PROCESS_SWITCH(lithium4analysis, processMcPools, "Process MC pools", false); + PROCESS_SWITCH(he3hadronfemto, processMcPools, "Process MC pools", false); }; WorkflowSpec defineDataProcessing(const ConfigContext& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"lithium4analysis"})}; + adaptAnalysisTask(cfgc, TaskName{"he3hadronfemto"})}; } diff --git a/PWGLF/TableProducer/Nuspex/hypKfRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hypKfRecoTask.cxx new file mode 100644 index 00000000000..353459c835b --- /dev/null +++ b/PWGLF/TableProducer/Nuspex/hypKfRecoTask.cxx @@ -0,0 +1,1223 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/// +/// \brief Hypernuclei rconstruction using KGParticle package +/// \authors Janik Ditzel and Michael Hartung + +#include +#include +#include +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "ReconstructionDataFormats/Track.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Centrality.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/PID/TPCPIDResponse.h" +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "DCAFitter/DCAFitterN.h" +#include "Common/DataModel/PIDResponse.h" +#include "PWGLF/DataModel/LFHypernucleiKfTables.h" +#include "TRandom.h" +#include "Common/DataModel/CollisionAssociationTables.h" + +// KFParticle +#ifndef HomogeneousField +#define HomogeneousField +#endif +#include "KFParticle.h" +#include "KFPTrack.h" +#include "KFPVertex.h" +#include "KFParticleBase.h" +#include "KFVertex.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using CollisionsFull = soa::Join; +using CollisionsFullMC = soa::Join; +using TracksFull = soa::Join; + +//---------------------------------------------------------------------------------------------------------------- + +namespace +{ +static const int nDaughterParticles = 6; +enum DAUGHTERS { kPion, + kProton, + kDeuteron, + kTriton, + kHe3, + kAlpha }; + +static const std::vector particleNames{"pion", "proton", "deuteron", "triton", "helion", "alpha"}; +static const std::vector particlePdgCodes{211, 2212, o2::constants::physics::kDeuteron, o2::constants::physics::kTriton, o2::constants::physics::kHelium3, o2::constants::physics::kAlpha}; +static const std::vector particleMasses{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron, o2::constants::physics::MassTriton, o2::constants::physics::MassHelium3, o2::constants::physics::MassAlpha}; +static const std::vector particleCharge{1, 1, 1, 1, 2, 2}; + +const int nBetheParams = 6; +static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; +constexpr double betheBlochDefault[nDaughterParticles][nBetheParams]{ + {14.182511, 3.784237, 0.010118, 1.775545, 0.742465, 0.09}, // pion + {23.248183, 2.357092, -0.143924, 2.178266, 0.416733, 0.09}, // proton + {12.881922, 3.775785, 0.062699, 2.452242, 1.049385, 0.09}, // deuteron + {0.313129, 181.664226, 2779397163087.684082, 2.130773, 29.609643, 0.09}, // triton + {70.584685, 3.196364, 0.133878, 2.731736, 1.675617, 0.09}, // helion + {105.625770, 0.868172, -0.871411, 1.895609, 0.046273, 0.09}}; // alpha + +const int nTrkSettings = 13; +static const std::vector trackPIDsettingsNames{"useBBparams", "minITSnCls", "minTPCnCls", "maxTPCchi2", "maxITSchi2", "minRigidity", "maxRigidity", "maxTPCnSigma", "TOFrequiredabove", "minTOFmass", "maxTOFmass", "minDcaToPvXY", "minDcaToPvZ"}; +constexpr double trackPIDsettings[nDaughterParticles][nTrkSettings]{ + {0, 0, 50, 5, 50, 0.2, 1.2, 3, -1, 0, 100, 0., 0.}, + {0, 0, 50, 5, 50, 0.5, 100, 3, -1, 0, 100, 0., 0.}, + {0, 0, 50, 5, 50, 0.5, 100, 3, -1, 0, 100, 0., 0.}, + {0, 0, 50, 5, 50, 0.5, 100, 3, -1, 0, 100, 0., 0.}, + {0, 0, 50, 5, 50, 0.5, 100, 3, -1, 0, 100, 0., 0.}, + {0, 0, 50, 5, 50, 0.5, 100, 3, -1, 0, 100, 0., 0.}}; + +static const int nHyperNuclei = 10; +static const std::vector hyperNucNames{"L->p+pi", "3LH->3He+pi", "3LH->d+p+pi", "4LH->4He+pi", "4LH->t+p+pi", "4LHe->3He+p+pi", "5LHe->4He+p+pi", "5LHe->3He+d+pi", "custom1", "custom2"}; +static const std::vector hyperNucEnabledLb{"enabled"}; +static const std::vector reduceLb{"reduce factor"}; +constexpr int hyperNucEnabled[nHyperNuclei][1]{{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}; +constexpr float reduceFactor[nHyperNuclei][1]{{1.}, {1.}, {1.}, {1.}, {1.}, {1.}, {1.}, {1.}, {1.}, {1.}}; +static const std::vector hyperNucPdgLb{"PDG code"}; +static constexpr int hyperNucPdgCodes[nHyperNuclei][1]{ + {3122}, + {o2::constants::physics::kHyperTriton}, + {o2::constants::physics::kHyperTriton}, + {o2::constants::physics::kHyperHydrogen4}, + {o2::constants::physics::kHyperHydrogen4}, + {o2::constants::physics::kHyperHelium4}, + {o2::constants::physics::kHyperHelium5}, + {o2::constants::physics::kHyperHelium5}, + {0}, + {0}}; +static const std::vector hyperNucDaughtersLb{"daughter1", "daughter2", "daughter3", "daughter4"}; +static const std::string hyperNucDaughters[nHyperNuclei][4]{{"proton", "pion", "none", "none"}, {"helion", "pion", "none", "none"}, {"deuteron", "proton", "pion", "none"}, {"alpha", "pion", "none", "none"}, {"triton", "proton", "pion", "none"}, {"helion", "proton", "pion", "none"}, {"alpha", "proton", "pion", "none"}, {"helion", "deuteron", "pion", "none"}, {"none", "none", "none", "none"}, {"none", "none", "none", "none"}}; // NOLINT: runtime/string +static const std::string hyperNucSigns[nHyperNuclei][4]{{"+", "-", "", ""}, {"+", "-", "", ""}, {"+", "+", "-", ""}, {"+", "-", "", ""}, {"+", "+", "-", ""}, {"+", "+", "-", ""}, {"+", "+", "-", ""}, {"+", "+", "-", ""}, {"", "", "", ""}, {"", "", "", ""}}; // NOLINT: runtime/string +const int nSelPrim = 8; +static const std::vector preSelectionPrimNames{"minMass", "maxMass", "minCt", "maxCt", "minCosPa", "maxDcaTracks", "maxDcaMotherToPvXY", "maxDcaMotherToPvZ"}; +constexpr double preSelectionsPrimaries[nHyperNuclei][nSelPrim]{ + {1.0, 1.3, 0, 100, -1., 100., 10., 10.}, + {2.9, 3.1, 0, 100, -1., 100., 10., 10.}, + {2.9, 3.1, 0, 100, -1., 100., 10., 10.}, + {3.6, 4.2, 0, 100, -1., 100., 10., 10.}, + {3.6, 4.2, 0, 100, -1., 100., 10., 10.}, + {3.6, 4.2, 0, 100, -1., 100., 10., 10.}, + {4.6, 5.2, 0, 100, -1., 100., 10., 10.}, + {4.6, 5.2, 0, 100, -1., 100., 10., 10.}, + {0.0, 9.9, 0, 100, -1., 100., 10., 10.}, + {0.0, 9.9, 0, 100, -1., 100., 10., 10.}}; +const int nSelSec = 8; +static const std::vector preSelectionSecNames{"minMass", "maxMass", "minCt", "maxCt", "minCosPaSv", "maxDcaTracks", "maxDcaMotherToSvXY", "maxDcaMotherToSvZ"}; +constexpr double preSelectionsSecondaries[nHyperNuclei][nSelSec]{ + {1.0, 1.3, 0, 100, -1., 100., 10., 10.}, + {2.9, 3.1, 0, 100, -1., 100., 10., 10.}, + {2.9, 3.1, 0, 100, -1., 100., 10., 10.}, + {3.6, 4.2, 0, 100, -1., 100., 10., 10.}, + {3.6, 4.2, 0, 100, -1., 100., 10., 10.}, + {3.6, 4.2, 0, 100, -1., 100., 10., 10.}, + {4.6, 5.2, 0, 100, -1., 100., 10., 10.}, + {4.6, 5.2, 0, 100, -1., 100., 10., 10.}, + {0.0, 9.9, 0, 100, -1., 100., 10., 10.}, + {0.0, 9.9, 0, 100, -1., 100., 10., 10.}}; + +static const int nCascades = 6; +static const std::vector cascadeNames{"4LLH->4LHe+pi", "4XHe->4LHe+pi", "custom1", "custom2", "custom3", "custom4"}; +constexpr int cascadeEnabled[nCascades][1]{{0}, {0}, {0}, {0}, {0}, {0}}; +constexpr int cascadePdgCodes[nCascades][1]{ + {1020010040}, + {1120010040}, + {0}, + {0}, + {0}, + {0}}; +static const std::vector cascadeHypDaughterLb{"hypernucleus"}; +static const std::string cascadeHypDaughter[nCascades][1]{{"4LHe->3He+p+pi"}, {"4LHe->3He+p+pi"}, {"none"}, {"none"}, {"none"}, {"none"}}; // NOLINT: runtime/string +static const std::vector cascadeDaughtersLb{"daughter2", "daughter3", "daughter4"}; +static const std::string cascadeDaughters[nCascades][3]{{"pion", "none", "none"}, {"pion", "none", "none"}, {"none", "none", "none"}, {"none", "none", "none"}, {"none", "none", "none"}, {"none", "none", "none"}}; // NOLINT: runtime/string +static const std::string cascadeSigns[nCascades][4]{{"+", "-", "", ""}, {"+", "-", "", ""}, {"", "", "", ""}, {"", "", "", ""}, {"", "", "", ""}, {"", "", "", ""}}; // NOLINT: runtime/string +const int nSelCas = 8; +static const std::vector preSelectionCascadeNames{"minMass", "maxMass", "minCt", "maxCt", "minCosPa", "maxDcaTracks", "maxDcaMotherToPvXY", "maxDcaMotherToPvZ"}; +constexpr double preSelectionsCascades[nCascades][nSelCas]{ + {3.9, 4.3, 0, 100, -1., 100., 10., 10.}, + {3.9, 4.3, 0, 100, -1., 100., 10., 10.}, + {3.9, 4.3, 0, 100, -1., 100., 10., 10.}, + {3.9, 4.3, 0, 100, -1., 100., 10., 10.}, + {3.9, 4.3, 0, 100, -1., 100., 10., 10.}, + {3.9, 4.3, 0, 100, -1., 100., 10., 10.}}; + +//---------------------------------------------------------------------------------------------------------------- +struct daughterParticle { + TString name; + int pdgCode; + double mass; + int charge; + double resolution; + std::vector betheParams; + + daughterParticle(std::string name_, int pdgCode_, double mass_, int charge_, LabeledArray bethe) + { + name = TString(name_); + pdgCode = pdgCode_; + mass = mass_; + charge = charge_; + resolution = bethe.get(name, "resolution"); + betheParams.clear(); + for (unsigned int i = 0; i < 5; i++) + betheParams.push_back(bethe.get(name, i)); + } + + void Print() + { + std::cout << std::endl + << "Daughter: " << name << std::endl; + std::cout << "PDG: " << pdgCode << ", Mass: " << mass << ", Charge: " << charge << std::endl; + for (double d : betheParams) + std::cout << d << ", " << std::flush; + std::cout << resolution << std::endl; + } +}; // class daughterParticle + +struct hyperNucleus { + TString name; + int pdgCode; + double massMax; + double massMin; + bool active; + std::vector daughters; + std::vector daughterTrackSigns; + + hyperNucleus(std::string name_, int pdgCode_, bool active_, std::vector daughters_, std::vector daughterTrackSigns_) + { + name = TString(name_); + pdgCode = pdgCode_; + active = active_; + for (int d : daughters_) + daughters.push_back(d); + for (int dc : daughterTrackSigns_) + daughterTrackSigns.push_back(dc); + } + hyperNucleus(std::string name_, int pdgCode_, bool active_, int hypDaughter, std::vector daughters_, std::vector daughterTrackSigns_) + { + daughters.push_back(hypDaughter); + name = TString(name_); + pdgCode = pdgCode_; + active = active_; + for (int d : daughters_) + daughters.push_back(d); + for (int dc : daughterTrackSigns_) + daughterTrackSigns.push_back(dc); + } + int GetNdaughters() { return static_cast(daughters.size()); } + const char* motherName() { return name.Contains("->") ? ((TString)name(0, name.First("-"))).Data() : name.Data(); } + const char* daughterNames() { return name.Contains("->") ? ((TString)name(name.First("-") + 2, name.Length())).Data() : ""; } + void Print() + { + std::cout << std::endl + << "Hypernucleus: " << name << " (" << pdgCode << "):" << (active ? " active" : " not active") << std::endl; + for (double d : daughters) + std::cout << d << ", " << std::flush; + for (double dc : daughterTrackSigns) + std::cout << dc << ", " << std::flush; + std::cout << std::endl + << std::endl; + } +}; // class hyperNucleus + +struct hyperNucCandidate { + int species; + KFParticle kfp; + std::vector kfpDaughters; + hyperNucCandidate* hypNucDaughter; + std::vector daughterTrackIds; + std::vector recoSV; + float devToVtx; + float dcaToVtxXY; + float dcaToVtxZ; + float chi2; + bool mcTrue; + bool isPhysPrimary; + bool isPrimaryCandidate, isSecondaryCandidate, isUsedSecondary; + int64_t mcParticleId; + int tableId; + + hyperNucCandidate(int species_, std::vector kfpDaughters_, std::vector daughterTrackIds_) : species(species_), hypNucDaughter(0), devToVtx(999), dcaToVtxXY(999), dcaToVtxZ(999), chi2(999), mcTrue(false), isPhysPrimary(false), isPrimaryCandidate(false), isSecondaryCandidate(false), isUsedSecondary(false), mcParticleId(-1), tableId(-1) + { + for (auto kfd : kfpDaughters_) + kfpDaughters.push_back(kfd); + for (auto dt : daughterTrackIds_) + daughterTrackIds.push_back(dt); + Init(); + } + hyperNucCandidate(int species_, hyperNucCandidate* hypNucDaughter_, std::vector kfpDaughters_, std::vector daughterTrackIds_) : species(species_), hypNucDaughter(hypNucDaughter_), devToVtx(999), dcaToVtxXY(999), dcaToVtxZ(999), chi2(999), mcTrue(false), isPhysPrimary(false), isPrimaryCandidate(false), isSecondaryCandidate(false), isUsedSecondary(false), mcParticleId(-1), tableId(-1) + { + for (auto kfd : kfpDaughters_) + kfpDaughters.push_back(kfd); + for (auto dt : daughterTrackIds_) + daughterTrackIds.push_back(dt); + Init(); + } + + void Init() + { + kfp.SetConstructMethod(2); + for (size_t i = 0; i < kfpDaughters.size(); i++) + kfp.AddDaughter(kfpDaughters.at(i)); + kfp.TransportToDecayVertex(); + chi2 = kfp.GetChi2() / kfp.GetNDF(); + recoSV.clear(); + recoSV.push_back(kfp.GetX()); + recoSV.push_back(kfp.GetY()); + recoSV.push_back(kfp.GetZ()); + } + bool CheckKfp() + { + if (kfp.GetMass() == 0) + return false; + if (std::isnan(kfp.GetMass())) + return false; + return true; + } + int GetDaughterTableId() + { + if (hypNucDaughter) + return hypNucDaughter->tableId; + return -1; + } + bool IsCascade() { return hypNucDaughter != 0; } + int GetSign() + { + if (kfp.GetQ() == 0) + return kfpDaughters.front().GetQ() / std::abs(kfpDaughters.front().GetQ()); + return kfp.GetQ() / std::abs(kfp.GetQ()); + } + int GetNdaughters() { return static_cast(kfpDaughters.size()); } + float GetDcaTracks() { return GetNdaughters() == 2 ? GetDcaTracks2() : GetMaxDcaToSv(); } + float GetDcaTracks2() { return kfpDaughters.at(0).GetDistanceFromParticle(kfpDaughters.at(1)); } + float GetMaxDcaToSv() + { + float maxDca = std::numeric_limits::lowest(); + for (auto& daughter : kfpDaughters) { + float dca = daughter.GetDistanceFromVertex(&recoSV[0]); + if (dca > maxDca) + maxDca = dca; + } + return maxDca; + } + float GetDcaMotherToVertex(std::vector vtx) { return kfp.GetDistanceFromVertex(&vtx[0]); } + double GetCpa(std::vector vtx) + { + kfp.TransportToDecayVertex(); + return RecoDecay::cpa(std::array{vtx[0], vtx[1], vtx[2]}, std::array{recoSV[0], recoSV[1], recoSV[2]}, std::array{kfp.GetPx(), kfp.GetPy(), kfp.GetPz()}); + ; + } + float GetCt(std::vector vtx) + { + float dl = 0; + for (size_t i = 0; i < vtx.size(); i++) { + float tmp = recoSV.at(i) - vtx.at(i); + dl += (tmp * tmp); + } + return TMath::Sqrt(dl) * kfp.GetMass() / kfp.GetP(); + } + float GetDcaMotherToVtxXY(std::vector vtx) { return kfp.GetDistanceFromVertexXY(&vtx[0]); } + float GetDcaMotherToVtxZ(std::vector vtx) + { + kfp.TransportToPoint(&vtx[0]); + return std::abs(kfp.GetZ() - vtx[2]); + } + void GetDaughterPosMom(int daughter, std::vector& posMom) + { + kfpDaughters.at(daughter).TransportToPoint(&recoSV[0]); + posMom.assign({kfpDaughters.at(daughter).GetX(), kfpDaughters.at(daughter).GetY(), kfpDaughters.at(daughter).GetZ(), kfpDaughters.at(daughter).GetPx(), kfpDaughters.at(daughter).GetPy(), kfpDaughters.at(daughter).GetPz()}); + } + void CalcDevToVtx(KFPVertex& vtx) { devToVtx = kfp.GetDeviationFromVertexXY(vtx); } + void CalcDevToVtx(hyperNucCandidate& cand) + { + devToVtx = kfp.GetDeviationFromParticleXY(cand.kfp); + dcaToVtxXY = GetDcaMotherToVtxXY(cand.recoSV); + dcaToVtxZ = GetDcaMotherToVtxZ(cand.recoSV); + } + float GetSubDaughterMass(int d1, int d2) + { + KFParticle subDaughter; + subDaughter.SetConstructMethod(2); + subDaughter.AddDaughter(kfpDaughters.at(d1)); + subDaughter.AddDaughter(kfpDaughters.at(d2)); + subDaughter.TransportToDecayVertex(); + return subDaughter.GetMass(); + } +}; // class hyperNucCandidate + +struct indexPairs { + std::vector> pairs; + + void Add(int64_t a, int b) { pairs.push_back({a, b}); } + void Clear() { pairs.clear(); } + bool GetIndex(int64_t a, int& b) + { + for (auto& pair : pairs) { + if (pair.first == a) { + b = pair.second; + return true; + } + } + return false; + } +}; // class indexPairs + +struct mcCollInfo { + bool hasRecoColl; + bool passedEvSel; + bool hasRecoParticle; + int tableIndex; + mcCollInfo() : hasRecoColl(false), passedEvSel(false), hasRecoParticle(false), tableIndex(-1) {} +}; // class mcCollInfo + +//---------------------------------------------------------------------------------------------------------------- +std::vector> hDeDx; +std::vector> hInvMass; +} // namespace + +//---------------------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------------------- +struct hypKfRecoTask { + + Produces outputMcCollisionTable; + Produces outputMcParticleTable; + Produces outputCollisionTable; + Produces outputTrackTable; + Produces outputDaughterAddonTable; + Produces outputSubDaughterTable; + Produces outputHypNucTable; + + Preslice perCollision = aod::track_association::collisionId; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable cfgSaveOnlyMcTrue{"cfgSaveOnlyMcTrue", true, "save only MCtrue candidates"}; + Configurable cfgDebug{"cfgDebug", 1, "debug level"}; + + Configurable cfgRigidityCorrection{"cfgRigidityCorrection", false, "apply rigidity correction"}; + Configurable cfgCutEta{"cfgCutEta", 0.9f, "Eta range for tracks"}; + Configurable cfgUsePVcontributors{"cfgUsePVcontributors", true, "use tracks that are PV contibutors"}; + + Configurable> cfgHyperNucsActive{"cfgHyperNucsActive", {hyperNucEnabled[0], nHyperNuclei, 1, hyperNucNames, hyperNucEnabledLb}, "enable or disable reconstruction"}; + Configurable> cfgReduce{"cfgReduce", {reduceFactor[0], nHyperNuclei, 1, hyperNucNames, reduceLb}, "reconstruct only a percentage of all possible hypernuclei"}; + Configurable> cfgHyperNucPdg{"cfgHyperNucsPdg", {hyperNucPdgCodes[0], nHyperNuclei, 1, hyperNucNames, hyperNucPdgLb}, "PDG codes"}; + Configurable> cfgHyperNucDaughters{"cfgHyperNucDaughters", {hyperNucDaughters[0], nHyperNuclei, 4, hyperNucNames, hyperNucDaughtersLb}, "Daughter particles"}; + Configurable> cfgHyperNucSigns{"cfgHyperNucSigns", {hyperNucSigns[0], nHyperNuclei, 4, hyperNucNames, hyperNucDaughtersLb}, "Daughter signs"}; + + Configurable> cfgCascadesActive{"cfgCascadesActive", {cascadeEnabled[0], nCascades, 1, cascadeNames, hyperNucEnabledLb}, "enable or disable reconstruction"}; + Configurable> cfgCascadesPdg{"cfgCascadesPdg", {cascadePdgCodes[0], nCascades, 1, cascadeNames, hyperNucPdgLb}, "PDG codes"}; + Configurable> cfgCascadeHypDaughter{"cfgCascadeHypDaughter", {cascadeHypDaughter[0], nCascades, 1, cascadeNames, cascadeHypDaughterLb}, "Hyernuclei daugther"}; + Configurable> cfgCascadeDaughters{"cfgCascadeDaughters", {cascadeDaughters[0], nCascades, 3, cascadeNames, cascadeDaughtersLb}, "Daughter particles"}; + Configurable> cfgCascadeSigns{"cfgCascadeSigns", {cascadeSigns[0], nCascades, 4, cascadeNames, hyperNucDaughtersLb}, "Daughter signs"}; + + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], nDaughterParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; + Configurable> cfgTrackPIDsettings{"cfgTrackPIDsettings", {trackPIDsettings[0], nDaughterParticles, nTrkSettings, particleNames, trackPIDsettingsNames}, "track selection and PID criteria"}; + Configurable> cfgPreSelectionsPrimaries{"cfgPreSelectionsPrimaries", {preSelectionsPrimaries[0], nHyperNuclei, nSelPrim, hyperNucNames, preSelectionPrimNames}, "selection criteria for primary hypernuclei"}; + Configurable> cfgPreSelectionsSecondaries{"cfgPreSelectionsSecondaries", {preSelectionsSecondaries[0], nHyperNuclei, nSelSec, hyperNucNames, preSelectionSecNames}, "selection criteria for secondary hypernuclei"}; + Configurable> cfgPreSelectionsCascades{"cfgPreSelectionsCascades", {preSelectionsCascades[0], nCascades, nSelCas, cascadeNames, preSelectionCascadeNames}, "selection criteria for cascade hypernuclei"}; + + // CCDB + Service ccdb; + Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable pidPath{"pidPath", "", "Path to the PID response object"}; + + std::vector daughterParticles; + std::vector> foundDaughters; + std::vector> singleHyperNucCandidates; // hypernuclei candidates + std::vector> cascadeHyperNucCandidates; // cascade candidates + std::vector singleHyperNuclei; + std::vector cascadeHyperNuclei; + std::vector primVtx; + std::vector cents; + std::vector mcCollInfos; + indexPairs trackIndices; + indexPairs mcPartIndices; + KFPVertex KfPrimVtx; + bool collHasCandidate, collHasMcTrueCandidate; + bool collPassedEvSel; + int64_t mcCollTableIndex; + int mRunNumber; + float d_bz; + TRandom rand; + //---------------------------------------------------------------------------------------------------------------- + + void init(InitContext const&) + { + mRunNumber = 0; + d_bz = 0; + rand.SetSeed(0); + + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + for (int i = 0; i < nDaughterParticles; i++) { // create daughterparticles + daughterParticles.push_back(daughterParticle(particleNames.at(i), particlePdgCodes.at(i), particleMasses.at(i), particleCharge.at(i), cfgBetheBlochParams)); + } + for (unsigned int i = 0; i < nHyperNuclei; i++) { // create hypernuclei + singleHyperNuclei.push_back(hyperNucleus(hyperNucNames.at(i), cfgHyperNucPdg->get(i, 0u), cfgHyperNucsActive->get(i, 0u), getDaughterVec(i, cfgHyperNucDaughters), getDaughterSignVec(i, cfgHyperNucSigns))); + } + for (unsigned int i = 0; i < nCascades; i++) { // create cascades + cascadeHyperNuclei.push_back(hyperNucleus(cascadeNames.at(i), cfgCascadesPdg->get(i, 0u), cfgCascadesActive->get(i, 0u), getHypDaughterVec(i, cfgCascadeHypDaughter), getDaughterVec(i, cfgCascadeDaughters), getDaughterSignVec(i, cfgCascadeSigns))); + } + + // define histogram axes + const AxisSpec axisMagField{10, -10., 10., "magnetic field"}; + const AxisSpec axisNev{3, 0., 3., "Number of events"}; + const AxisSpec axisRigidity{4000, -10., 10., "#it{p}^{TPC}/#it{z}"}; + const AxisSpec axisdEdx{2000, 0, 2000, "d#it{E}/d#it{x}"}; + const AxisSpec axisInvMass{1000, 1, 6, "inv mass"}; + + // create histograms + histos.add("histMagField", "histMagField", kTH1F, {axisMagField}); + histos.add("histNev", "histNev", kTH1F, {axisNev}); + hDeDx.resize(2 * nDaughterParticles + 2); + for (int i = 0; i < nDaughterParticles + 1; i++) { + TString histName = i < nDaughterParticles ? daughterParticles[i].name : "all"; + hDeDx[2 * i] = histos.add(Form("histdEdx_%s", histName.Data()), ";p_{TPC}/z (GeV/#it{c}); d#it{E}/d#it{x}", HistType::kTH2F, {axisRigidity, axisdEdx}); + hDeDx[2 * i + 1] = histos.add(Form("histdEdx_%s_Cuts", histName.Data()), ";p_{TPC}/z (GeV/#it{c}); d#it{E}/d#it{x}", HistType::kTH2F, {axisRigidity, axisdEdx}); + } + // create invariant mass histograms + hInvMass.resize(nHyperNuclei + nCascades); + int histCount = 0; + std::vector> hypNucVectors = {singleHyperNuclei, cascadeHyperNuclei}; + for (auto vec : hypNucVectors) { + for (auto nuc : vec) { + if (nuc.active) { + hInvMass[histCount] = histos.add(Form("h%d_%s", histCount, nuc.motherName()), ";;Counts", HistType::kTH1F, {axisInvMass}); + } + histCount++; + } + } + } + //---------------------------------------------------------------------------------------------------------------- + + void findDaughterParticles(aod::TrackAssoc const& tracksByColl, TracksFull const& tracks) + { + // track loop, store daughter candidates in std::vector + for (const auto& trackId : tracksByColl) { + const auto& track = tracks.rawIteratorAt(trackId.trackId()); + filldedx(track, nDaughterParticles); + if (std::abs(track.eta()) > cfgCutEta) + continue; + if (!cfgUsePVcontributors && track.isPVContributor()) + continue; + for (size_t i = 0; i < daughterParticles.size(); i++) { + if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls")) + continue; + if (track.tpcChi2NCl() > cfgTrackPIDsettings->get(i, "maxTPCchi2")) + continue; + if (track.itsNCls() < cfgTrackPIDsettings->get(i, "minITSnCls")) + continue; + if (track.itsChi2NCl() > cfgTrackPIDsettings->get(i, "maxITSchi2")) + continue; + if (std::abs(getTPCnSigma(track, daughterParticles.at(i))) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) + continue; + filldedx(track, i); + if (std::abs(track.dcaXY()) < cfgTrackPIDsettings->get(i, "minDcaToPvXY")) + continue; + if (std::abs(track.dcaZ()) < cfgTrackPIDsettings->get(i, "minDcaToPvZ")) + continue; + if (getRigidity(track) < cfgTrackPIDsettings->get(i, "minRigidity") || getRigidity(track) > cfgTrackPIDsettings->get(i, "maxRigidity")) + continue; + if (cfgTrackPIDsettings->get(i, "TOFrequiredabove") >= 0 && getRigidity(track) > cfgTrackPIDsettings->get(i, "TOFrequiredabove") && (track.mass() < cfgTrackPIDsettings->get(i, "minTOFmass") || track.mass() > cfgTrackPIDsettings->get(i, "maxTOFmass"))) + continue; + foundDaughters.at(i).push_back(track.globalIndex()); + } + } // track loop + } + + //---------------------------------------------------------------------------------------------------------------- + void checkMCTrueTracks(aod::McTrackLabels const& trackLabels, aod::McParticles const&) + { + for (int i = 0; i < nDaughterParticles; i++) { + auto& daughterVec = foundDaughters.at(i); + for (auto it = daughterVec.begin(); it < daughterVec.end(); it++) { + bool mcTrue = true; + const auto& mcLab = trackLabels.rawIteratorAt(*it); + if (!mcLab.has_mcParticle()) { + mcTrue = false; + } else { + const auto& mcPart = mcLab.mcParticle_as(); + if (std::abs(mcPart.pdgCode()) != daughterParticles.at(i).pdgCode) { + mcTrue = false; + } + if (!mcPart.has_mothers()) { + mcTrue = false; + } + } + if (!mcTrue) { + daughterVec.erase(it); + } + } + } + } + //---------------------------------------------------------------------------------------------------------------- + void createKFHypernuclei(TracksFull const& tracks) + { + // loop over all hypernuclei that are to be reconstructed + for (size_t hyperNucIter = 0; hyperNucIter < singleHyperNuclei.size(); hyperNucIter++) { + hyperNucleus* hyperNuc = &(singleHyperNuclei.at(hyperNucIter)); + if (!hyperNuc->active) + continue; + int nDaughters = hyperNuc->GetNdaughters(); + + std::vector::iterator> it; + int nCombinations = 1; + for (int i = 0; i < nDaughters; i++) { + nCombinations *= foundDaughters.at(hyperNuc->daughters.at(i)).size(); + it.push_back(foundDaughters.at(hyperNuc->daughters.at(i)).begin()); + } + if (!nCombinations) + continue; + while (it[0] != foundDaughters.at(hyperNuc->daughters.at(0)).end()) { + + // check for correct signs, avoid double usage of tracks + bool passedChecks = true; + int checkSign = 0; + std::vector vec; + for (int i = 0; i < nDaughters; i++) { + const auto& daughterTrack = tracks.rawIteratorAt(*(it[i])); + if (!i) + checkSign = daughterTrack.sign(); + if (daughterTrack.sign() != checkSign * hyperNuc->daughterTrackSigns.at(i) || std::find(vec.begin(), vec.end(), *it[i]) != vec.end()) { + passedChecks = false; + break; + } + vec.push_back(*it[i]); + } + if (passedChecks && rand.Rndm() <= cfgReduce->get((unsigned int)hyperNucIter, 0u)) { + // create daugther KFParticles + std::vector daughterIds; + std::vector daughterKfps; + for (int i = 0; i < nDaughters; i++) { + const auto& daughterTrack = tracks.rawIteratorAt(*(it[i])); + daughterIds.push_back(*(it[i])); + auto daughterMass = daughterParticles.at(hyperNuc->daughters.at(i)).mass; + auto daughterCharge = daughterParticles.at(hyperNuc->daughters.at(i)).charge; + daughterKfps.push_back(CreateKFParticle(daughterTrack, daughterMass, daughterCharge)); + } + + hyperNucCandidate candidate(hyperNucIter, daughterKfps, daughterIds); + bool isPrimCandidate = true, isSecCandidate = true; + if (candidate.CheckKfp()) { + // apply pre selections + candidate.CalcDevToVtx(KfPrimVtx); + if (candidate.kfp.GetMass() < cfgPreSelectionsPrimaries->get(hyperNucIter, "minMass") || candidate.kfp.GetMass() > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxMass")) + isPrimCandidate = false; + if (candidate.GetDcaTracks() > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaTracks")) + isPrimCandidate = false; + if (candidate.GetCt(primVtx) < cfgPreSelectionsPrimaries->get(hyperNucIter, "minCt") || candidate.GetCt(primVtx) > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxCt")) + isPrimCandidate = false; + if (candidate.GetCpa(primVtx) < cfgPreSelectionsPrimaries->get(hyperNucIter, "minCosPa")) + isPrimCandidate = false; + if (candidate.GetDcaMotherToVtxXY(primVtx) > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaMotherToPvXY")) + isPrimCandidate = false; + if (candidate.GetDcaMotherToVtxZ(primVtx) > cfgPreSelectionsPrimaries->get(hyperNucIter, "maxDcaMotherToPvZ")) + isPrimCandidate = false; + if (isPrimCandidate) { + candidate.isPrimaryCandidate = true; + collHasCandidate = true; + } + if (candidate.kfp.GetMass() < cfgPreSelectionsSecondaries->get(hyperNucIter, "minMass") || candidate.kfp.GetMass() > cfgPreSelectionsSecondaries->get(hyperNucIter, "maxMass")) + isSecCandidate = false; + if (candidate.GetDcaTracks() > cfgPreSelectionsSecondaries->get(hyperNucIter, "maxDcaTracks")) + isSecCandidate = false; + if (candidate.GetCt(primVtx) < cfgPreSelectionsSecondaries->get(hyperNucIter, "minCt") || candidate.GetCt(primVtx) > cfgPreSelectionsSecondaries->get(hyperNucIter, "maxCt")) + isSecCandidate = false; + if (isSecCandidate) { + candidate.isSecondaryCandidate = true; + } + if (isPrimCandidate || isSecCandidate) + singleHyperNucCandidates.at(hyperNucIter).push_back(candidate); + } + } + it[nDaughters - 1]++; + for (int i = nDaughters - 1; i && it[i] == foundDaughters.at(hyperNuc->daughters.at(i)).end(); i--) { + it[i] = foundDaughters.at(hyperNuc->daughters.at(i)).begin(); + it[i - 1]++; + } + } + } + } + //---------------------------------------------------------------------------------------------------------------- + void createKFCascades(TracksFull const& tracks) + { + + // loop over all cascade hypernuclei that are to be reconstructed + for (size_t hyperNucIter = 0; hyperNucIter < cascadeHyperNuclei.size(); hyperNucIter++) { + hyperNucleus* hyperNuc = &(cascadeHyperNuclei.at(hyperNucIter)); + if (!hyperNuc->active) + continue; + int nDaughters = hyperNuc->GetNdaughters(); + + int nHypNucDaughters = singleHyperNucCandidates.at(hyperNuc->daughters.at(0)).size(); + std::vector vecHypNucDaughers; + for (int64_t i = 0; i < static_cast(nHypNucDaughters); i++) { + vecHypNucDaughers.push_back(i); + } + + std::vector::iterator> it; + int nCombinations = 1; + nCombinations *= nHypNucDaughters; + it.push_back(vecHypNucDaughers.begin()); + for (int i = 1; i < nDaughters; i++) { + nCombinations *= foundDaughters.at(hyperNuc->daughters.at(i)).size(); + it.push_back(foundDaughters.at(hyperNuc->daughters.at(i)).begin()); + } + if (!nCombinations) + continue; + while (it[0] != vecHypNucDaughers.end()) { + std::vector daughterIds; + std::vector daughterKfps; + + // select hypernuclei daughter KFParticle + auto hypNucDaughter = &(singleHyperNucCandidates.at(hyperNuc->daughters.at(0)).at(*it[0])); + // check for correct signs + int checkSign = hypNucDaughter->GetSign(); + bool passedChecks = true; + std::vector vec = hypNucDaughter->daughterTrackIds; + for (int i = 1; i < nDaughters; i++) { + const auto& daughterTrack = tracks.rawIteratorAt(*(it[i])); + if (!i) + checkSign = daughterTrack.sign(); + if (daughterTrack.sign() != checkSign * hyperNuc->daughterTrackSigns.at(i) || std::find(vec.begin(), vec.end(), *it[i]) != vec.end()) { + passedChecks = false; + break; + } + vec.push_back(*it[i]); + } + if (passedChecks && hypNucDaughter->isSecondaryCandidate) { + daughterKfps.push_back(hypNucDaughter->kfp); + for (int i = 1; i < nDaughters; i++) { + daughterIds.push_back(*(it[i])); + const auto& daughterTrack = tracks.rawIteratorAt(*(it[i])); + auto daughterMass = daughterParticles.at(hyperNuc->daughters.at(i)).mass; + auto daughterCharge = daughterParticles.at(hyperNuc->daughters.at(i)).charge; + daughterKfps.push_back(CreateKFParticle(daughterTrack, daughterMass, daughterCharge)); + } + + hyperNucCandidate candidate(hyperNucIter, hypNucDaughter, daughterKfps, daughterIds); + if (candidate.CheckKfp()) { + hypNucDaughter->CalcDevToVtx(candidate); + bool isCandidate = true; + // apply pre selections for hypernucleus daughter + if (hypNucDaughter->GetCpa(candidate.recoSV) < cfgPreSelectionsSecondaries->get(hyperNuc->daughters.at(0), "minCosPaSv")) + isCandidate = false; + if (hypNucDaughter->GetDcaMotherToVtxXY(candidate.recoSV) > cfgPreSelectionsSecondaries->get(hyperNuc->daughters.at(0), "maxDcaMotherToSvXY")) + isCandidate = false; + if (hypNucDaughter->GetDcaMotherToVtxZ(candidate.recoSV) > cfgPreSelectionsSecondaries->get(hyperNuc->daughters.at(0), "maxDcaMotherToSvZ")) + isCandidate = false; + // apply pre selections for cascade + if (candidate.kfp.GetMass() < cfgPreSelectionsCascades->get(hyperNucIter, "minMass") || candidate.kfp.GetMass() > cfgPreSelectionsCascades->get(hyperNucIter, "maxMass")) + isCandidate = false; + if (candidate.GetDcaTracks() > cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaTracks")) + isCandidate = false; + if (candidate.GetCt(primVtx) < cfgPreSelectionsCascades->get(hyperNucIter, "minCt") || candidate.GetCt(primVtx) > cfgPreSelectionsCascades->get(hyperNucIter, "maxCt")) + isCandidate = false; + if (candidate.GetCpa(primVtx) < cfgPreSelectionsCascades->get(hyperNucIter, "minCosPa")) + isCandidate = false; + if (candidate.GetDcaMotherToVtxXY(primVtx) > cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaMotherToPvXY")) + isCandidate = false; + if (candidate.GetDcaMotherToVtxZ(primVtx) > cfgPreSelectionsCascades->get(hyperNucIter, "maxDcaMotherToPvZ")) + isCandidate = false; + + if (isCandidate) { + collHasCandidate = true; + hypNucDaughter->isUsedSecondary = true; + cascadeHyperNucCandidates.at(hyperNucIter).push_back(candidate); + } + } + } + it[nDaughters - 1]++; + for (int i = nDaughters - 1; i && it[i] == foundDaughters.at(hyperNuc->daughters.at(i)).end(); i--) { + it[i] = foundDaughters.at(hyperNuc->daughters.at(i)).begin(); + it[i - 1]++; + } + } + } + } + //---------------------------------------------------------------------------------------------------------------- + void createMCinfo(aod::McTrackLabels const& trackLabels, aod::McCollisionLabels const&, aod::McParticles const& particlesMC, aod::McCollisions const&, bool cascadesOnly = false) + { + // check for mcTrue: single (primary & cascade daughter) and cascade hypernuclei + + std::vector*> hypNucVectors = {&singleHyperNuclei, &cascadeHyperNuclei}; + std::vector>*> candidateVectors = {&singleHyperNucCandidates, &cascadeHyperNucCandidates}; + const int nVecs = candidateVectors.size(); + + for (int vec = cascadesOnly ? 1 : 0; vec < nVecs; vec++) { + auto candidateVector = candidateVectors.at(vec); + for (size_t hyperNucIter = 0; hyperNucIter < hypNucVectors.at(vec)->size(); hyperNucIter++) { + hyperNucleus* hyperNuc = &(hypNucVectors.at(vec)->at(hyperNucIter)); + if (!hyperNuc->active) + continue; + for (auto& hypCand : candidateVector->at(hyperNucIter)) { + std::vector motherIds; + int daughterCount = 0; + if (hypCand.IsCascade()) { + if (!hypCand.hypNucDaughter->mcTrue) + continue; + const auto& mcPart = particlesMC.rawIteratorAt(hypCand.hypNucDaughter->mcParticleId); + if (!mcPart.has_mothers()) + continue; + daughterCount++; + for (auto& mother : mcPart.mothers_as()) { + if (mother.pdgCode() == hyperNuc->pdgCode * hypCand.GetSign()) { + motherIds.push_back(mother.globalIndex()); + break; + } + } + } + for (auto& daughter : hypCand.daughterTrackIds) { + const auto& mcLab = trackLabels.rawIteratorAt(daughter); + if (!mcLab.has_mcParticle()) + continue; + const auto& mcPart = mcLab.mcParticle_as(); + if (std::abs(mcPart.pdgCode()) != daughterParticles.at(hyperNuc->daughters.at(daughterCount++)).pdgCode) + continue; + if (!mcPart.has_mothers()) + continue; + for (auto& mother : mcPart.mothers_as()) { + if (mother.pdgCode() == hyperNuc->pdgCode * hypCand.GetSign()) { + motherIds.push_back(mother.globalIndex()); + break; + } + } + } + if (motherIds.size() != hyperNuc->daughters.size()) { + if (cfgSaveOnlyMcTrue) + hypCand.isSecondaryCandidate = false; + continue; + } + hypCand.mcTrue = true; + for (auto iter = motherIds.begin(); iter != motherIds.end() - 1; iter++) + if (*iter != *(iter + 1)) + hypCand.mcTrue = false; + if (hypCand.mcTrue) { + hypCand.mcParticleId = motherIds.front(); + collHasMcTrueCandidate = true; + } + if (!hypCand.mcTrue && cfgSaveOnlyMcTrue) + hypCand.isSecondaryCandidate = false; + } + } + } + } + //---------------------------------------------------------------------------------------------------------------- + + void fillTree(TracksFull const& tracks, bool saveOnlyMcTrue = false) + { + + outputCollisionTable( + collPassedEvSel, mcCollTableIndex, + primVtx.at(0), primVtx.at(1), primVtx.at(2), + cents.at(0), cents.at(1), cents.at(2)); + + std::vector*> hypNucVectors = {&singleHyperNuclei, &cascadeHyperNuclei}; + std::vector>*> candidateVectors = {&singleHyperNucCandidates, &cascadeHyperNucCandidates}; + + for (int vec = 0; vec < 2; vec++) { + auto candidateVector = candidateVectors.at(vec); + for (size_t hyperNucIter = 0; hyperNucIter < hypNucVectors.at(vec)->size(); hyperNucIter++) { + hyperNucleus* hyperNuc = &(hypNucVectors.at(vec)->at(hyperNucIter)); + if (!hyperNuc->active) + continue; + for (auto& hypCand : candidateVector->at(hyperNucIter)) { + if (!hypCand.isPrimaryCandidate && !hypCand.isUsedSecondary && !hypCand.IsCascade()) + continue; + if (saveOnlyMcTrue && !hypCand.mcTrue) + continue; + hInvMass[vec * nHyperNuclei + hyperNucIter]->Fill(hypCand.kfp.GetMass()); + std::vector vecDaugtherTracks, vecAddons, vecSubDaughters; + int daughterCount = 0; + for (auto daughterTrackId : hypCand.daughterTrackIds) { + int trackTableId; + if (!trackIndices.GetIndex(daughterTrackId, trackTableId)) { + auto daught = hyperNuc->daughters.at(daughterCount); + const auto& track = tracks.rawIteratorAt(daughterTrackId); + outputTrackTable( + hyperNuc->daughters.at(daughterCount) * track.sign(), + track.pt(), track.eta(), track.phi(), + track.dcaXY(), track.dcaZ(), + track.tpcNClsFound(), track.tpcChi2NCl(), + track.itsClusterSizes(), track.itsChi2NCl(), + getRigidity(track), track.tpcSignal(), getTPCnSigma(track, daughterParticles.at(daught)), + daught == kAlpha ? -999 : getTPCnSigma(track, daughterParticles.at(daught + 1)), + daught == kPion ? 999 : getTPCnSigma(track, daughterParticles.at(daught - 1)), + track.mass(), + track.isPVContributor()); + trackTableId = outputTrackTable.lastIndex(); + trackIndices.Add(daughterTrackId, trackTableId); + } + vecDaugtherTracks.push_back(trackTableId); + daughterCount++; + } + for (int i = 0; i < hypCand.GetNdaughters(); i++) { + std::vector posMom; + hypCand.GetDaughterPosMom(i, posMom); + outputDaughterAddonTable( + posMom.at(0), posMom.at(1), posMom.at(2), posMom.at(3), posMom.at(4), posMom.at(5)); + vecAddons.push_back(outputDaughterAddonTable.lastIndex()); + } + if (hypCand.GetNdaughters() > 2) { + for (int i = 0; i < hypCand.GetNdaughters(); i++) { + for (int j = i + 1; j < hypCand.GetNdaughters(); j++) { + outputSubDaughterTable(hypCand.GetSubDaughterMass(i, j)); + vecSubDaughters.push_back(outputSubDaughterTable.lastIndex()); + } + } + } + + hypCand.kfp.TransportToDecayVertex(); + int mcPartTableId; + outputHypNucTable( + mcPartIndices.GetIndex(hypCand.mcParticleId, mcPartTableId) ? mcPartTableId : -1, + outputCollisionTable.lastIndex(), vecDaugtherTracks, vecAddons, hypCand.GetDaughterTableId(), vecSubDaughters, + (vec * nHyperNuclei + hyperNucIter + 1) * hypCand.GetSign(), + hypCand.isPrimaryCandidate, hypCand.kfp.GetMass(), + hypCand.kfp.GetPx(), hypCand.kfp.GetPy(), hypCand.kfp.GetPz(), + hypCand.GetDcaMotherToVtxXY(primVtx), hypCand.GetDcaMotherToVtxZ(primVtx), + hypCand.devToVtx, hypCand.dcaToVtxXY, hypCand.dcaToVtxZ, hypCand.chi2, + hypCand.recoSV.at(0), hypCand.recoSV.at(1), hypCand.recoSV.at(2)); + hypCand.tableId = outputHypNucTable.lastIndex(); + } + } + } + } + //---------------------------------------------------------------------------------------------------------------- + + void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcColls, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::McParticles const& particlesMC, aod::McTrackLabels const& trackLabelsMC, aod::McCollisionLabels const& collLabels, aod::TrackAssoc const& tracksColl) + { + + mcCollInfos.clear(); + mcCollInfos.resize(mcColls.size()); + mcPartIndices.Clear(); + for (const auto& collision : collisions) { + if (!collision.has_mcCollision()) + continue; + if (collision.sel8() && std::abs(collision.posZ()) < 10) + mcCollInfos.at(collision.mcCollisionId()).passedEvSel = true; + } + std::vector*> hypNucVectors = {&singleHyperNuclei, &cascadeHyperNuclei}; + for (auto& mcPart : particlesMC) { + for (int vec = 0; vec < 2; vec++) { + for (size_t hyperNucIter = 0; hyperNucIter < hypNucVectors.at(vec)->size(); hyperNucIter++) { + hyperNucleus* hyperNuc = &(hypNucVectors.at(vec)->at(hyperNucIter)); + if (!hyperNuc->active) + continue; + if (std::abs(mcPart.pdgCode()) != hyperNuc->pdgCode) + continue; + bool isDecayMode = false; + float svx, svy, svz; + int daughterPdg; + if (vec == 0) + daughterPdg = daughterParticles.at(hyperNuc->daughters.at(0)).pdgCode; + else + daughterPdg = singleHyperNuclei.at(hyperNuc->daughters.at(0)).pdgCode; + for (auto& mcDaught : mcPart.daughters_as()) { + if (std::abs(mcDaught.pdgCode()) == daughterPdg) { + isDecayMode = true; + svx = mcDaught.vx(); + svy = mcDaught.vy(); + svz = mcDaught.vz(); + break; + } + } + if (!isDecayMode) + continue; + + if (mcCollInfos.at(mcPart.mcCollisionId()).tableIndex < 0) { + outputMcCollisionTable( + mcCollInfos.at(mcPart.mcCollisionId()).passedEvSel, + mcPart.mcCollision().posX(), mcPart.mcCollision().posY(), mcPart.mcCollision().posZ()); + } + mcCollInfos.at(mcPart.mcCollisionId()).tableIndex = outputMcCollisionTable.lastIndex(); + + outputMcParticleTable( + mcCollInfos.at(mcPart.mcCollisionId()).tableIndex, + (vec * nHyperNuclei + hyperNucIter + 1) * (mcPart.pdgCode() > 0 ? +1 : -1), + mcPart.pdgCode(), + mcPart.isPhysicalPrimary(), + mcPart.px(), mcPart.py(), mcPart.pz(), + mcPart.e(), + svx, svy, svz); + mcPartIndices.Add(mcPart.globalIndex(), outputMcParticleTable.lastIndex()); + } + } + } + + for (const auto& collision : collisions) { + auto bc = collision.bc_as(); + initCCDB(bc); + initCollision(collision); + const uint64_t collIdx = collision.globalIndex(); + auto tracksByColl = tracksColl.sliceBy(perCollision, collIdx); + findDaughterParticles(tracksByColl, tracks); + if (cfgSaveOnlyMcTrue) + checkMCTrueTracks(trackLabelsMC, particlesMC); + createKFHypernuclei(tracks); + createMCinfo(trackLabelsMC, collLabels, particlesMC, mcColls); + createKFCascades(tracks); + createMCinfo(trackLabelsMC, collLabels, particlesMC, mcColls, true); + + if (!collHasCandidate) + continue; + if (cfgSaveOnlyMcTrue && !collHasMcTrueCandidate) + continue; + + mcCollTableIndex = -1; + if (collision.has_mcCollision()) { + mcCollTableIndex = mcCollInfos.at(collision.mcCollisionId()).tableIndex; + if (mcCollTableIndex < 0) { + outputMcCollisionTable( + mcCollInfos.at(collision.mcCollisionId()).passedEvSel, + collision.mcCollision().posX(), collision.mcCollision().posY(), collision.mcCollision().posZ()); + mcCollTableIndex = outputMcCollisionTable.lastIndex(); + mcCollInfos.at(collision.mcCollisionId()).tableIndex = mcCollTableIndex; + } + } + fillTree(tracks, cfgSaveOnlyMcTrue); + } + } + PROCESS_SWITCH(hypKfRecoTask, processMC, "MC analysis", true); + //---------------------------------------------------------------------------------------------------------------- + void processData(CollisionsFull const& collisions, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::TrackAssoc const& tracksColl) + { + + for (const auto& collision : collisions) { + auto bc = collision.bc_as(); + initCCDB(bc); + initCollision(collision); + const uint64_t collIdx = collision.globalIndex(); + auto tracksByColl = tracksColl.sliceBy(perCollision, collIdx); + findDaughterParticles(tracksByColl, tracks); + createKFHypernuclei(tracks); + createKFCascades(tracks); + if (!collHasCandidate) + continue; + mcCollTableIndex = -1; + fillTree(tracks); + } + } + PROCESS_SWITCH(hypKfRecoTask, processData, "data analysis", false); + //---------------------------------------------------------------------------------------------------------------- + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + auto run3grp_timestamp = bc.timestamp(); + d_bz = 0; + o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + o2::parameters::GRPMagField* grpmag = 0x0; + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + if (d_bz_input < -990) { + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } else { + d_bz = d_bz_input; + } + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + if (d_bz_input < -990) { + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } else { + d_bz = d_bz_input; + } + } + mRunNumber = bc.runNumber(); + KFParticle::SetField(d_bz); + } + //---------------------------------------------------------------------------------------------------------------- + template + void initCollision(const T& collision) + { + foundDaughters.clear(); + foundDaughters.resize(nDaughterParticles); + singleHyperNucCandidates.clear(); + singleHyperNucCandidates.resize(nHyperNuclei); + cascadeHyperNucCandidates.clear(); + cascadeHyperNucCandidates.resize(nCascades); + trackIndices.Clear(); + collHasCandidate = false; + collHasMcTrueCandidate = false; + histos.fill(HIST("histMagField"), d_bz); + histos.fill(HIST("histNev"), 0.5); + + collPassedEvSel = collision.sel8() && std::abs(collision.posZ()) < 10; + if (collPassedEvSel) + histos.fill(HIST("histNev"), 1.5); + + KfPrimVtx = createKFPVertexFromCollision(collision); + primVtx.assign({collision.posX(), collision.posY(), collision.posZ()}); + cents.assign({collision.centFT0A(), collision.centFT0C(), collision.centFT0M()}); + } + + //---------------------------------------------------------------------------------------------------------------- + template + void filldedx(T const& track, int species) + { + const float rigidity = getRigidity(track); + hDeDx[2 * species]->Fill(track.sign() * rigidity, track.tpcSignal()); + if (track.tpcNClsFound() < 100 || track.itsNCls() < 2) + return; + hDeDx[2 * species + 1]->Fill(track.sign() * rigidity, track.tpcSignal()); + } + //---------------------------------------------------------------------------------------------------------------- + + template + float getTPCnSigma(T const& track, daughterParticle const& particle) + { + const float rigidity = getRigidity(track); + if (!track.hasTPC()) + return -999; + + if (particle.name == "pion" && cfgTrackPIDsettings->get("pion", "useBBparams") == 0) + return track.tpcNSigmaPi(); + if (particle.name == "proton" && cfgTrackPIDsettings->get("proton", "useBBparams") == 0) + return track.tpcNSigmaPr(); + if (particle.name == "deuteron" && cfgTrackPIDsettings->get("deuteron", "useBBparams") == 0) + return track.tpcNSigmaDe(); + if (particle.name == "triton" && cfgTrackPIDsettings->get("triton", "useBBparams") == 0) + return track.tpcNSigmaTr(); + if (particle.name == "helion" && cfgTrackPIDsettings->get("helion", "useBBparams") == 0) + return track.tpcNSigmaHe(); + if (particle.name == "alpha" && cfgTrackPIDsettings->get("alpha", "useBBparams") == 0) + return track.tpcNSigmaAl(); + + double expBethe{tpc::BetheBlochAleph(static_cast(particle.charge * rigidity / particle.mass), particle.betheParams[0], particle.betheParams[1], particle.betheParams[2], particle.betheParams[3], particle.betheParams[4])}; + double expSigma{expBethe * particle.resolution}; + float sigmaTPC = static_cast((track.tpcSignal() - expBethe) / expSigma); + return sigmaTPC; + } + //---------------------------------------------------------------------------------------------------------------- + + template + float getRigidity(T const& track) + { + if (!cfgRigidityCorrection) + return track.tpcInnerParam(); + bool hePID = track.pidForTracking() == o2::track::PID::Helium3 || track.pidForTracking() == o2::track::PID::Alpha; + return hePID ? track.tpcInnerParam() / 2 : track.tpcInnerParam(); + } + //---------------------------------------------------------------------------------------------------------------- + + template + KFParticle CreateKFParticle(const T& track, float mass, int charge) + { + auto trackparCov = getTrackParCov(track); + std::array fP; + std::array fM; + trackparCov.getXYZGlo(fP); + trackparCov.getPxPyPzGlo(fM); + float fPM[6]; + for (int i = 0; i < 3; i++) { + fPM[i] = fP[i]; + fPM[i + 3] = fM[i] * std::abs(charge); + } + std::array fC; + trackparCov.getCovXYZPxPyPzGlo(fC); + KFParticle part; + part.Create(fPM, fC.data(), std::abs(charge) * track.sign(), mass); + return part; + } + //---------------------------------------------------------------------------------------------------------------- + + template + KFPVertex createKFPVertexFromCollision(const T& collision) + { + KFPVertex kfpVertex; + kfpVertex.SetXYZ(collision.posX(), collision.posY(), collision.posZ()); + kfpVertex.SetCovarianceMatrix(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + kfpVertex.SetChi2(collision.chi2()); + kfpVertex.SetNDF(2 * collision.numContrib() - 3); + kfpVertex.SetNContributors(collision.numContrib()); + return kfpVertex; + } + //---------------------------------------------------------------------------------------------------------------- + + int getHypDaughterVec(unsigned int cascade, LabeledArray cfg) + { + std::string daughter = cfg.get(cascade, 0u); + if (std::find(hyperNucNames.begin(), hyperNucNames.end(), daughter) == hyperNucNames.end()) + return -1; + return std::find(hyperNucNames.begin(), hyperNucNames.end(), daughter) - hyperNucNames.begin(); + } + //---------------------------------------------------------------------------------------------------------------- + std::vector getDaughterVec(unsigned int hypNuc, LabeledArray cfg) + { + std::vector vec; + for (unsigned int i = 0; i < 4; i++) { + std::string daughter = cfg.get(hypNuc, i); + if (std::find(particleNames.begin(), particleNames.end(), daughter) == particleNames.end()) + break; + vec.push_back(std::find(particleNames.begin(), particleNames.end(), daughter) - particleNames.begin()); + } + return vec; + } + //---------------------------------------------------------------------------------------------------------------- + + std::vector getDaughterSignVec(unsigned int hypNuc, LabeledArray cfg) + { + std::vector vec; + for (unsigned int i = 0; i < 4; i++) { + std::string sign = cfg.get(hypNuc, i); + if (sign != "+" && sign != "-") + break; + vec.push_back(sign == "+" ? +1 : -1); + } + return vec; + } + //---------------------------------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------------------------------- +}; +//---------------------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------------------- +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} +//---------------------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------------------- diff --git a/PWGLF/TableProducer/Nuspex/hypKfTreeCreator.cxx b/PWGLF/TableProducer/Nuspex/hypKfTreeCreator.cxx new file mode 100644 index 00000000000..948cd62ac92 --- /dev/null +++ b/PWGLF/TableProducer/Nuspex/hypKfTreeCreator.cxx @@ -0,0 +1,768 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/// +/// \brief Creates flat tree for ML analysis +/// \authors Janik Ditzel and Michael Hartung + +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "ReconstructionDataFormats/Track.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Centrality.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/PID/TPCPIDResponse.h" +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "DCAFitter/DCAFitterN.h" +#include "Common/DataModel/PIDResponse.h" +#include "PWGLF/DataModel/LFHypernucleiKfTables.h" + +using namespace o2; +using namespace o2::framework; +typedef std::array arr3; + +namespace +{ +std::vector> hPt; + +struct trackProperties { + trackProperties() : X(0), Y(0), Z(0), Px(0), Py(0), Pz(0), TPCnCls(0), ITSnCls(0), TPCchi2(0), ITSchi2(0), ITSmeanClsSize(0), ITSmeanClsSizeL(0), Rigidity(0), TPCsignal(0), TPCnSigma(0), TPCnSigmaNhp(0), TPCnSigmaNlp(0), TOFmass(0), DcaXY(0), DcaZ(0), IsPvContributor(0), SubMass(0) {} + float X, Y, Z, Px, Py, Pz; + uint8_t TPCnCls, ITSnCls; + float TPCchi2, ITSchi2, ITSmeanClsSize, ITSmeanClsSizeL; + float Rigidity, TPCsignal, TPCnSigma, TPCnSigmaNhp, TPCnSigmaNlp; + float TOFmass, DcaXY, DcaZ; + bool IsPvContributor; + float SubMass; +}; + +struct hyperNucleus { + hyperNucleus() : PdgCode(0), IsReconstructed(0), GlobalIndex(0), Species(0), IsMatter(0), PassedEvSel(0), IsMatterMC(0), PassedEvSelMC(0), IsPhysicalPrimary(0), CollisionMcTrue(0), Mass(0), Y(0), Pt(0), Ct(0), YGen(0), PtGen(0), CtGen(0), CpaPvGen(0), CpaPv(0), CpaSv(0), MaxDcaTracks(0), MaxDcaTracksSV(0), DcaToPvXY(0), DcaToPvZ(0), DcaToVtxXY(0), DcaToVtxZ(0), DevToPvXY(0), Chi2(0), Pvx(0), Pvy(0), Pvz(0), Svx(0), Svy(0), Svz(0), Px(0), Py(0), Pz(0), PvxGen(0), PvyGen(0), PvzGen(0), SvxGen(0), SvyGen(0), SvzGen(0), PxGen(0), PyGen(0), PzGen(0), NsingleDaughters(0), NcascadeDaughters(0), McTrue(0), MCTrueVtx(0), McPhysicalPrimary(0), HypNucDaughter(0) {} + int PdgCode, IsReconstructed, GlobalIndex; + uint8_t Species; + bool IsMatter, PassedEvSel, IsMatterMC, PassedEvSelMC, IsPhysicalPrimary, CollisionMcTrue; + float Mass, Y, Pt, Ct, YGen, PtGen, CtGen, CpaPvGen, CpaPv, CpaSv, MaxDcaTracks, MaxDcaTracksSV; + float DcaToPvXY, DcaToPvZ, DcaToVtxXY, DcaToVtxZ, DevToPvXY, Chi2; + float Pvx, Pvy, Pvz, Svx, Svy, Svz, Px, Py, Pz; + float PvxGen, PvyGen, PvzGen, SvxGen, SvyGen, SvzGen, PxGen, PyGen, PzGen; + int NsingleDaughters, NcascadeDaughters; + bool McTrue, MCTrueVtx, McPhysicalPrimary; + std::vector daughterTracks; + std::vector subDaughterMassVec; + hyperNucleus* HypNucDaughter; + ~hyperNucleus() + { + if (HypNucDaughter) + delete HypNucDaughter; + } +}; +} // namespace +namespace o2::aod +{ +namespace hypkftree +{ +DECLARE_SOA_COLUMN(Y, y, float); +DECLARE_SOA_COLUMN(Ct, ct, float); +DECLARE_SOA_COLUMN(YGen, yGen, float); +DECLARE_SOA_COLUMN(PtGen, ptGen, float); +DECLARE_SOA_COLUMN(CtGen, ctGen, float); +DECLARE_SOA_COLUMN(CpaPvGen, cpaPvGen, float); +DECLARE_SOA_COLUMN(DcaTracks, dcaTracks, float); +DECLARE_SOA_COLUMN(DcaTrackSv, dcaTrackSv, float); +DECLARE_SOA_COLUMN(CosPa, cosPa, double); +DECLARE_SOA_COLUMN(McTrue, mcTrue, bool); +DECLARE_SOA_COLUMN(Pvx, pvx, float); +DECLARE_SOA_COLUMN(Pvy, pvy, float); +DECLARE_SOA_COLUMN(Pvz, pvz, float); +DECLARE_SOA_COLUMN(Tvx, tvx, float); +DECLARE_SOA_COLUMN(Tvy, tvy, float); +DECLARE_SOA_COLUMN(Tvz, tvz, float); +DECLARE_SOA_COLUMN(PxGen, pxGen, float); +DECLARE_SOA_COLUMN(PyGen, pyGen, float); +DECLARE_SOA_COLUMN(PzGen, pzGen, float); +DECLARE_SOA_COLUMN(PvxGen, pvxGen, float); +DECLARE_SOA_COLUMN(PvyGen, pvyGen, float); +DECLARE_SOA_COLUMN(PvzGen, pvzGen, float); +DECLARE_SOA_COLUMN(SvxGen, svxGen, float); +DECLARE_SOA_COLUMN(SvyGen, svyGen, float); +DECLARE_SOA_COLUMN(SvzGen, svzGen, float); +DECLARE_SOA_COLUMN(TvxGen, tvxGen, float); +DECLARE_SOA_COLUMN(TvyGen, tvyGen, float); +DECLARE_SOA_COLUMN(TvzGen, tvzGen, float); +DECLARE_SOA_COLUMN(PassedEvSelMC, passedEvSelMC, bool); +DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); +DECLARE_SOA_COLUMN(IsMatterGen, isMatterGen, bool); +DECLARE_SOA_COLUMN(IsReconstructed, isReconstructed, bool); +DECLARE_SOA_COLUMN(CollMcTrue, collMcTrue, bool); +DECLARE_SOA_COLUMN(D1X, d1X, float); +DECLARE_SOA_COLUMN(D1Y, d1Y, float); +DECLARE_SOA_COLUMN(D1Z, d1Z, float); +DECLARE_SOA_COLUMN(D1Px, d1Px, float); +DECLARE_SOA_COLUMN(D1Py, d1Py, float); +DECLARE_SOA_COLUMN(D1Pz, d1Pz, float); +DECLARE_SOA_COLUMN(D1TPCnCls, d1TPCnCls, uint8_t); +DECLARE_SOA_COLUMN(D1TPCchi2, d1TPCchi2, float); +DECLARE_SOA_COLUMN(D1ITSnCls, d1ITSnCls, uint8_t); +DECLARE_SOA_COLUMN(D1ITSchi2, d1ITSchi2, float); +DECLARE_SOA_COLUMN(D1ITSmeanClsSize, d1ITSmeanClsSize, float); +DECLARE_SOA_COLUMN(D1ITSmeanClsSizeL, d1ITSmeanClsSizeL, float); +DECLARE_SOA_COLUMN(D1Rigidity, d1Rigidity, float); +DECLARE_SOA_COLUMN(D1TPCsignal, d1TPCsignal, float); +DECLARE_SOA_COLUMN(D1TPCnSigma, d1TPCnSigma, float); +DECLARE_SOA_COLUMN(D1TPCnSigmaNhp, d1TPCnSigmaNhp, float); +DECLARE_SOA_COLUMN(D1TPCnSigmaNlp, d1TPCnSigmaNlp, float); +DECLARE_SOA_COLUMN(D1TOFmass, d1TOFmass, float); +DECLARE_SOA_COLUMN(D1DcaXY, d1DcaXY, float); +DECLARE_SOA_COLUMN(D1DcaZ, d1DcaZ, float); +DECLARE_SOA_COLUMN(D1IsPvContributor, d1IsPvContributor, bool); +DECLARE_SOA_COLUMN(D2X, d2X, float); +DECLARE_SOA_COLUMN(D2Y, d2Y, float); +DECLARE_SOA_COLUMN(D2Z, d2Z, float); +DECLARE_SOA_COLUMN(D2Px, d2Px, float); +DECLARE_SOA_COLUMN(D2Py, d2Py, float); +DECLARE_SOA_COLUMN(D2Pz, d2Pz, float); +DECLARE_SOA_COLUMN(D2TPCnCls, d2TPCnCls, uint8_t); +DECLARE_SOA_COLUMN(D2TPCchi2, d2TPCchi2, float); +DECLARE_SOA_COLUMN(D2ITSnCls, d2ITSnCls, uint8_t); +DECLARE_SOA_COLUMN(D2ITSchi2, d2ITSchi2, float); +DECLARE_SOA_COLUMN(D2ITSmeanClsSize, d2ITSmeanClsSize, float); +DECLARE_SOA_COLUMN(D2ITSmeanClsSizeL, d2ITSmeanClsSizeL, float); +DECLARE_SOA_COLUMN(D2Rigidity, d2Rigidity, float); +DECLARE_SOA_COLUMN(D2TPCsignal, d2TPCsignal, float); +DECLARE_SOA_COLUMN(D2TPCnSigma, d2TPCnSigma, float); +DECLARE_SOA_COLUMN(D2TPCnSigmaNhp, d2TPCnSigmaNhp, float); +DECLARE_SOA_COLUMN(D2TPCnSigmaNlp, d2TPCnSigmaNlp, float); +DECLARE_SOA_COLUMN(D2TOFmass, d2TOFmass, float); +DECLARE_SOA_COLUMN(D2DcaXY, d2DcaXY, float); +DECLARE_SOA_COLUMN(D2DcaZ, d2DcaZ, float); +DECLARE_SOA_COLUMN(D2IsPvContributor, d2IsPvContributor, bool); +DECLARE_SOA_COLUMN(D3X, d3X, float); +DECLARE_SOA_COLUMN(D3Y, d3Y, float); +DECLARE_SOA_COLUMN(D3Z, d3Z, float); +DECLARE_SOA_COLUMN(D3Px, d3Px, float); +DECLARE_SOA_COLUMN(D3Py, d3Py, float); +DECLARE_SOA_COLUMN(D3Pz, d3Pz, float); +DECLARE_SOA_COLUMN(D3TPCnCls, d3TPCnCls, uint8_t); +DECLARE_SOA_COLUMN(D3TPCchi2, d3TPCchi2, float); +DECLARE_SOA_COLUMN(D3ITSnCls, d3ITSnCls, uint8_t); +DECLARE_SOA_COLUMN(D3ITSchi2, d3ITSchi2, float); +DECLARE_SOA_COLUMN(D3ITSmeanClsSize, d3ITSmeanClsSize, float); +DECLARE_SOA_COLUMN(D3ITSmeanClsSizeL, d3ITSmeanClsSizeL, float); +DECLARE_SOA_COLUMN(D3Rigidity, d3Rigidity, float); +DECLARE_SOA_COLUMN(D3TPCsignal, d3TPCsignal, float); +DECLARE_SOA_COLUMN(D3TPCnSigma, d3TPCnSigma, float); +DECLARE_SOA_COLUMN(D3TPCnSigmaNhp, d3TPCnSigmaNhp, float); +DECLARE_SOA_COLUMN(D3TPCnSigmaNlp, d3TPCnSigmaNlp, float); +DECLARE_SOA_COLUMN(D3TOFmass, d3TOFmass, float); +DECLARE_SOA_COLUMN(D3DcaXY, d3DcaXY, float); +DECLARE_SOA_COLUMN(D3DcaZ, d3DcaZ, float); +DECLARE_SOA_COLUMN(D1D2Mass, d1d2Mass, float); +DECLARE_SOA_COLUMN(D1D3Mass, d1d3Mass, float); +DECLARE_SOA_COLUMN(D2D3Mass, d2d3Mass, float); +DECLARE_SOA_COLUMN(D3IsPvContributor, d3IsPvContributor, bool); +DECLARE_SOA_COLUMN(D0X, d0X, float); +DECLARE_SOA_COLUMN(D0Y, d0Y, float); +DECLARE_SOA_COLUMN(D0Z, d0Z, float); +DECLARE_SOA_COLUMN(D0Px, d0Px, float); +DECLARE_SOA_COLUMN(D0Py, d0Py, float); +DECLARE_SOA_COLUMN(D0Pz, d0Pz, float); +DECLARE_SOA_COLUMN(D0Mass, d0Mass, float); +DECLARE_SOA_COLUMN(D0Ct, d0ct, float); +DECLARE_SOA_COLUMN(D0CosPA, d0cosPa, float); +DECLARE_SOA_COLUMN(D0DcaTracks, d0dcaTracks, float); +DECLARE_SOA_COLUMN(D0DcaTracksTv, d0dcaTracksTv, float); +DECLARE_SOA_COLUMN(D0DcaToPvXY, d0dcaToPvXY, float); +DECLARE_SOA_COLUMN(D0DcaToPvZ, d0dcaToPvZ, float); +DECLARE_SOA_COLUMN(D0DcaToSvXY, d0dcaToSvXY, float); +DECLARE_SOA_COLUMN(D0DcaToSvZ, d0dcaToSvZ, float); +DECLARE_SOA_COLUMN(D0Chi2, d0chi2, float); +DECLARE_SOA_COLUMN(SD1X, sd1X, float); +DECLARE_SOA_COLUMN(SD1Y, sd1Y, float); +DECLARE_SOA_COLUMN(SD1Z, sd1Z, float); +DECLARE_SOA_COLUMN(SD1Px, sd1Px, float); +DECLARE_SOA_COLUMN(SD1Py, sd1Py, float); +DECLARE_SOA_COLUMN(SD1Pz, sd1Pz, float); +DECLARE_SOA_COLUMN(SD1TPCnCls, sd1TPCnCls, uint8_t); +DECLARE_SOA_COLUMN(SD1TPCchi2, sd1TPCchi2, float); +DECLARE_SOA_COLUMN(SD1ITSnCls, sd1ITSnCls, uint8_t); +DECLARE_SOA_COLUMN(SD1ITSchi2, sd1ITSchi2, float); +DECLARE_SOA_COLUMN(SD1ITSmeanClsSize, sd1ITSmeanClsSize, float); +DECLARE_SOA_COLUMN(SD1ITSmeanClsSizeL, sd1ITSmeanClsSizeL, float); +DECLARE_SOA_COLUMN(SD1Rigidity, sd1Rigidity, float); +DECLARE_SOA_COLUMN(SD1TPCsignal, sd1TPCsignal, float); +DECLARE_SOA_COLUMN(SD1TPCnSigma, sd1TPCnSigma, float); +DECLARE_SOA_COLUMN(SD1TPCnSigmaNhp, sd1TPCnSigmaNhp, float); +DECLARE_SOA_COLUMN(SD1TPCnSigmaNlp, sd1TPCnSigmaNlp, float); +DECLARE_SOA_COLUMN(SD1TOFmass, sd1TOFmass, float); +DECLARE_SOA_COLUMN(SD1DcaXY, sd1DcaXY, float); +DECLARE_SOA_COLUMN(SD1DcaZ, sd1DcaZ, float); +DECLARE_SOA_COLUMN(SD1IsPvContributor, sd1IsPvContributor, bool); +DECLARE_SOA_COLUMN(SD2X, sd2X, float); +DECLARE_SOA_COLUMN(SD2Y, sd2Y, float); +DECLARE_SOA_COLUMN(SD2Z, sd2Z, float); +DECLARE_SOA_COLUMN(SD2Px, sd2Px, float); +DECLARE_SOA_COLUMN(SD2Py, sd2Py, float); +DECLARE_SOA_COLUMN(SD2Pz, sd2Pz, float); +DECLARE_SOA_COLUMN(SD2TPCnCls, sd2TPCnCls, uint8_t); +DECLARE_SOA_COLUMN(SD2TPCchi2, sd2TPCchi2, float); +DECLARE_SOA_COLUMN(SD2ITSnCls, sd2ITSnCls, uint8_t); +DECLARE_SOA_COLUMN(SD2ITSchi2, sd2ITSchi2, float); +DECLARE_SOA_COLUMN(SD2ITSmeanClsSize, sd2ITSmeanClsSize, float); +DECLARE_SOA_COLUMN(SD2ITSmeanClsSizeL, sd2ITSmeanClsSizeL, float); +DECLARE_SOA_COLUMN(SD2Rigidity, sd2Rigidity, float); +DECLARE_SOA_COLUMN(SD2TPCsignal, sd2TPCsignal, float); +DECLARE_SOA_COLUMN(SD2TPCnSigma, sd2TPCnSigma, float); +DECLARE_SOA_COLUMN(SD2TPCnSigmaNhp, sd2TPCnSigmaNhp, float); +DECLARE_SOA_COLUMN(SD2TPCnSigmaNlp, sd2TPCnSigmaNlp, float); +DECLARE_SOA_COLUMN(SD2TOFmass, sd2TOFmass, float); +DECLARE_SOA_COLUMN(SD2DcaXY, sd2DcaXY, float); +DECLARE_SOA_COLUMN(SD2DcaZ, sd2DcaZ, float); +DECLARE_SOA_COLUMN(SD2IsPvContributor, sd2IsPvContributor, bool); +DECLARE_SOA_COLUMN(SD3X, sd3X, float); +DECLARE_SOA_COLUMN(SD3Y, sd3Y, float); +DECLARE_SOA_COLUMN(SD3Z, sd3Z, float); +DECLARE_SOA_COLUMN(SD3Px, sd3Px, float); +DECLARE_SOA_COLUMN(SD3Py, sd3Py, float); +DECLARE_SOA_COLUMN(SD3Pz, sd3Pz, float); +DECLARE_SOA_COLUMN(SD3TPCnCls, sd3TPCnCls, uint8_t); +DECLARE_SOA_COLUMN(SD3TPCchi2, sd3TPCchi2, float); +DECLARE_SOA_COLUMN(SD3ITSnCls, sd3ITSnCls, uint8_t); +DECLARE_SOA_COLUMN(SD3ITSchi2, sd3ITSchi2, float); +DECLARE_SOA_COLUMN(SD3ITSmeanClsSize, sd3ITSmeanClsSize, float); +DECLARE_SOA_COLUMN(SD3ITSmeanClsSizeL, sd3ITSmeanClsSizeL, float); +DECLARE_SOA_COLUMN(SD3Rigidity, sd3Rigidity, float); +DECLARE_SOA_COLUMN(SD3TPCsignal, sd3TPCsignal, float); +DECLARE_SOA_COLUMN(SD3TPCnSigma, sd3TPCnSigma, float); +DECLARE_SOA_COLUMN(SD3TPCnSigmaNhp, sd3TPCnSigmaNhp, float); +DECLARE_SOA_COLUMN(SD3TPCnSigmaNlp, sd3TPCnSigmaNlp, float); +DECLARE_SOA_COLUMN(SD3TOFmass, sd3TOFmass, float); +DECLARE_SOA_COLUMN(SD3DcaXY, sd3DcaXY, float); +DECLARE_SOA_COLUMN(SD3DcaZ, sd3DcaZ, float); +DECLARE_SOA_COLUMN(SD3IsPvContributor, sd3IsPvContributor, bool); +DECLARE_SOA_COLUMN(SD1SD2Mass, sd1sd2Mass, float); +DECLARE_SOA_COLUMN(SD1SD3Mass, sd1sd3Mass, float); +DECLARE_SOA_COLUMN(SD2SD3Mass, sd2sd3Mass, float); +} // namespace hypkftree + +#define HYPKFGENBASE mcparticle::PdgCode, hypkftree::IsMatterGen, hypkftree::IsReconstructed, hykfmc::IsPhysicalPrimary, hypkftree::PassedEvSelMC, hypkftree::YGen, hypkftree::PtGen, hypkftree::CtGen + +#define HYPKFGENEXT hypkftree::CpaPvGen, hypkftree::PxGen, hypkftree::PyGen, hypkftree::PzGen, hypkftree::PvxGen, hypkftree::PvyGen, hypkftree::PvzGen, hypkftree::SvxGen, hypkftree::SvyGen, hypkftree::SvzGen + +#define HYPKFGENCAS hypkftree::TvxGen, hypkftree::TvyGen, hypkftree::TvzGen + +#define HYPKFHYPNUC hykfmc::Species, hypkftree::IsMatter, hykfmcColl::PassedEvSel, hykfhyp::Mass, hypkftree::Y, track::Pt, hypkftree::Ct, hypkftree::CosPa, hypkftree::DcaTracks, hykfhyp::DcaToPvXY, hykfhyp::DcaToPvZ, hykfhyp::DevToPvXY, hykfhyp::Chi2, hypkftree::Pvx, hypkftree::Pvy, hypkftree::Pvz, hykfmc::Svx, hykfmc::Svy, hykfmc::Svz, hykfhyp::Px, hykfhyp::Py, hykfhyp::Pz, hypkftree::CollMcTrue + +#define HYPKFHYPNUCMC hypkftree::McTrue, hykfmc::IsPhysicalPrimary + +#define HYPKFD0 hypkftree::Tvx, hypkftree::Tvy, hypkftree::Tvz, hypkftree::D0X, hypkftree::D0Y, hypkftree::D0Z, hypkftree::D0Px, hypkftree::D0Py, hypkftree::D0Pz, hypkftree::D0Mass, hypkftree::D0Ct, hypkftree::D0CosPA, hypkftree::D0DcaTracks, hypkftree::D0DcaToPvXY, hypkftree::D0DcaToPvZ, hypkftree::D0DcaToSvXY, hypkftree::D0DcaToSvZ, hypkftree::D0Chi2 + +#define HYPKFD1 hypkftree::D1X, hypkftree::D1Y, hypkftree::D1Z, hypkftree::D1Px, hypkftree::D1Py, hypkftree::D1Pz, hypkftree::D1TPCnCls, hypkftree::D1TPCchi2, hypkftree::D1ITSnCls, hypkftree::D1ITSchi2, hypkftree::D1ITSmeanClsSize, hypkftree::D1ITSmeanClsSizeL, hypkftree::D1Rigidity, hypkftree::D1TPCsignal, hypkftree::D1TPCnSigma, hypkftree::D1TPCnSigmaNhp, hypkftree::D1TPCnSigmaNlp, hypkftree::D1TOFmass, hypkftree::D1DcaXY, hypkftree::D1DcaZ, hypkftree::D1IsPvContributor + +#define HYPKFD2 hypkftree::D2X, hypkftree::D2Y, hypkftree::D2Z, hypkftree::D2Px, hypkftree::D2Py, hypkftree::D2Pz, hypkftree::D2TPCnCls, hypkftree::D2TPCchi2, hypkftree::D2ITSnCls, hypkftree::D2ITSchi2, hypkftree::D2ITSmeanClsSize, hypkftree::D2ITSmeanClsSizeL, hypkftree::D2Rigidity, hypkftree::D2TPCsignal, hypkftree::D2TPCnSigma, hypkftree::D2TPCnSigmaNhp, hypkftree::D2TPCnSigmaNlp, hypkftree::D2TOFmass, hypkftree::D2DcaXY, hypkftree::D2DcaZ, hypkftree::D2IsPvContributor + +#define HYPKFD3 hypkftree::D3X, hypkftree::D3Y, hypkftree::D3Z, hypkftree::D3Px, hypkftree::D3Py, hypkftree::D3Pz, hypkftree::D3TPCnCls, hypkftree::D3TPCchi2, hypkftree::D3ITSnCls, hypkftree::D3ITSchi2, hypkftree::D3ITSmeanClsSize, hypkftree::D3ITSmeanClsSizeL, hypkftree::D3Rigidity, hypkftree::D3TPCsignal, hypkftree::D3TPCnSigma, hypkftree::D3TPCnSigmaNhp, hypkftree::D3TPCnSigmaNlp, hypkftree::D3TOFmass, hypkftree::D3DcaXY, hypkftree::D3DcaZ, hypkftree::D3IsPvContributor + +#define HYPKFSD1 hypkftree::SD1X, hypkftree::SD1Y, hypkftree::SD1Z, hypkftree::SD1Px, hypkftree::SD1Py, hypkftree::SD1Pz, hypkftree::SD1TPCnCls, hypkftree::SD1TPCchi2, hypkftree::SD1ITSnCls, hypkftree::SD1ITSchi2, hypkftree::SD1ITSmeanClsSize, hypkftree::SD1ITSmeanClsSizeL, hypkftree::SD1Rigidity, hypkftree::SD1TPCsignal, hypkftree::SD1TPCnSigma, hypkftree::SD1TPCnSigmaNhp, hypkftree::SD1TPCnSigmaNlp, hypkftree::SD1TOFmass, hypkftree::SD1DcaXY, hypkftree::SD1DcaZ, hypkftree::SD1IsPvContributor + +#define HYPKFSD2 hypkftree::SD2X, hypkftree::SD2Y, hypkftree::SD2Z, hypkftree::SD2Px, hypkftree::SD2Py, hypkftree::SD2Pz, hypkftree::SD2TPCnCls, hypkftree::SD2TPCchi2, hypkftree::SD2ITSnCls, hypkftree::SD2ITSchi2, hypkftree::SD2ITSmeanClsSize, hypkftree::SD2ITSmeanClsSizeL, hypkftree::SD2Rigidity, hypkftree::SD2TPCsignal, hypkftree::SD2TPCnSigma, hypkftree::SD2TPCnSigmaNhp, hypkftree::SD2TPCnSigmaNlp, hypkftree::SD2TOFmass, hypkftree::SD2DcaXY, hypkftree::SD2DcaZ, hypkftree::SD2IsPvContributor + +#define HYPKFSD3 hypkftree::SD3X, hypkftree::SD3Y, hypkftree::SD3Z, hypkftree::SD3Px, hypkftree::SD3Py, hypkftree::SD3Pz, hypkftree::SD3TPCnCls, hypkftree::SD3TPCchi2, hypkftree::SD3ITSnCls, hypkftree::SD3ITSchi2, hypkftree::SD3ITSmeanClsSize, hypkftree::SD3ITSmeanClsSizeL, hypkftree::SD3Rigidity, hypkftree::SD3TPCsignal, hypkftree::SD3TPCnSigma, hypkftree::SD3TPCnSigmaNhp, hypkftree::SD3TPCnSigmaNlp, hypkftree::SD3TOFmass, hypkftree::SD3DcaXY, hypkftree::SD3DcaZ, hypkftree::SD3IsPvContributor + +#define HYPKFSDMASS hypkftree::D1D2Mass, hypkftree::D1D3Mass, hypkftree::D2D3Mass +#define HYPKFSSDMASS hypkftree::SD1SD2Mass, hypkftree::SD1SD3Mass, hypkftree::SD2SD3Mass + +DECLARE_SOA_TABLE(HypKfGens, "AOD", "HYPKFGEN", HYPKFGENBASE); +using HypKfGen = HypKfGens::iterator; + +DECLARE_SOA_TABLE(HypKfSingleTwoBodyCandidates, "AOD", "HYPKFCAND2", HYPKFHYPNUC, HYPKFHYPNUCMC, HYPKFD1, HYPKFD2); +using HypKfSingleTwoBodyCandidate = HypKfSingleTwoBodyCandidates::iterator; + +DECLARE_SOA_TABLE(HypKfMcSingleTwoBodyCandidates, "AOD", "HYPKFMCCAND2", HYPKFGENBASE, HYPKFGENEXT, HYPKFHYPNUC, HYPKFD1, HYPKFD2); +using HypKfMcSingleTwoBodyCandidate = HypKfMcSingleTwoBodyCandidates::iterator; + +DECLARE_SOA_TABLE(HypKfSingleThreeBodyCandidates, "AOD", "HYPKFCAND3", HYPKFHYPNUC, HYPKFHYPNUCMC, HYPKFD1, HYPKFD2, HYPKFD3, HYPKFSDMASS); +using HypKfSingleThreeBodyCandidate = HypKfSingleThreeBodyCandidates::iterator; + +DECLARE_SOA_TABLE(HypKfMcSingleThreeBodyCandidates, "AOD", "HYPKFMCCAND3", HYPKFGENBASE, HYPKFGENEXT, HYPKFHYPNUC, HYPKFD1, HYPKFD2, HYPKFD3, HYPKFSDMASS); +using HypKfMcSingleThreeBodyCandidate = HypKfMcSingleThreeBodyCandidates::iterator; + +DECLARE_SOA_TABLE(HypKfCascadeTwoThreeCandidates, "AOD", "HYPKFCAND23", HYPKFHYPNUC, HYPKFHYPNUCMC, HYPKFD0, HYPKFD1, HYPKFSD1, HYPKFSD2, HYPKFSD3, HYPKFSSDMASS); +using HypKfCascadeTwoThreeCandidate = HypKfCascadeTwoThreeCandidates::iterator; + +DECLARE_SOA_TABLE(HypKfMcCascadeTwoThreeCandidates, "AOD", "HYPKFMCCAND23", HYPKFGENBASE, HYPKFGENEXT, HYPKFHYPNUC, HYPKFD0, HYPKFD1, HYPKFSD1, HYPKFSD2, HYPKFSD3, HYPKFSSDMASS); +using HypKfMcCascadeTwoThreeCandidate = HypKfMcCascadeTwoThreeCandidates::iterator; + +DECLARE_SOA_TABLE(HypKfCascadeThreeTwoCandidates, "AOD", "HYPKFCAND32", HYPKFHYPNUC, HYPKFHYPNUCMC, HYPKFD0, HYPKFD1, HYPKFD2, HYPKFSDMASS, HYPKFSD1, HYPKFSD2); +using HypKfCascadeThreeTwoCandidate = HypKfCascadeThreeTwoCandidates::iterator; + +DECLARE_SOA_TABLE(HypKfMcCascadeThreeTwoCandidates, "AOD", "HYPKFMCCAND32", HYPKFGENBASE, HYPKFGENEXT, HYPKFHYPNUC, HYPKFD0, HYPKFD1, HYPKFD2, HYPKFSDMASS, HYPKFSD1, HYPKFSD2); +using HypKfMcCascadeThreeTwoCandidate = HypKfMcCascadeThreeTwoCandidates::iterator; +} // namespace o2::aod + +struct hypKfTreeCreator { + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Produces outputMcGenTable; + Produces outputTableTwo; + Produces outputTableMcTwo; + Produces outputTableThree; + Produces outputTableMcThree; + Produces outputTableTwoThree; + Produces outputTableMcTwoThree; + Produces outputTableThreeTwo; + Produces outputTableMcThreeTwo; + PresliceUnsorted perMcParticle = aod::hykfhyp::hypKfMcPartId; + + Configurable cfgSpecies{"cfgSpecies", 0, "Select species"}; + Configurable cfgNprimDaughters{"cfgNprimDaughters", 0, "Number of primary daughters"}; + Configurable cfgNsecDaughters{"cfgNsecDaughters", 0, "Number of secondary daughters (cascades only)"}; + Configurable cfgMCGenerated{"cfgMCGenerated", false, "create MC generated tree"}; + Configurable cfgMCReconstructed{"cfgMCReconstructed", false, "create MC reconstructed tree"}; + Configurable cfgMCCombined{"cfgMCCombined", false, "create MC tree containig generated and reconstructed"}; + + bool isMC; + //___________________________________________________________________________________________________________________________________________________________ + + void init(InitContext const&) + { + const AxisSpec axisPt{10, 0., 10., "#it{p}_{T} (GeV/#it{c})"}; + hPt.resize(3); + hPt[0] = histos.add("hGen", "", HistType::kTH1F, {axisPt}); + hPt[0]->Sumw2(); + hPt[1] = histos.add("hRec", "", HistType::kTH1F, {axisPt}); + hPt[1]->Sumw2(); + hPt[2] = histos.add("hEff", "", HistType::kTH1F, {axisPt}); + isMC = false; + } + //___________________________________________________________________________________________________________________________________________________________ + + void processData(aod::HypKfHypNucs const& hypNucs, aod::HypKfColls const& hypKfColls, aod::HypKfTracks const& hypKfTrks, aod::HypKfDaughtAdds const& hypKfDAdd, aod::HypKfSubDs const& hypKfDSub) + { + for (auto& hypNuc : hypNucs) { + if (std::abs(hypNuc.species()) != cfgSpecies) + continue; + hyperNucleus candidate, hypDaughter, dummy; + fillCandidate(candidate, hypDaughter, hypNuc, hypNucs, hypKfColls, hypKfTrks, hypKfDAdd, hypKfDSub); + if (cfgNsecDaughters) { + fillCandidate(hypDaughter, dummy, hypNucs.rawIteratorAt(hypNuc.hypDaughterId()), hypNucs, hypKfColls, hypKfTrks, hypKfDAdd, hypKfDSub); + } + fillTable(candidate, hypDaughter); + } + } + PROCESS_SWITCH(hypKfTreeCreator, processData, "single tree", false); + //___________________________________________________________________________________________________________________________________________________________ + void fillTable(hyperNucleus& cand, hyperNucleus& hypDaughter) + { + if (isMC && cfgMCGenerated) + outputMcGenTable( + cand.PdgCode, cand.IsMatterMC, cand.IsReconstructed, cand.IsPhysicalPrimary, cand.PassedEvSelMC, cand.YGen, cand.PtGen, cand.CtGen); + + if (!cand.IsReconstructed) { + cand.daughterTracks.resize(4); + cand.subDaughterMassVec.resize(4); + hypDaughter.daughterTracks.resize(4); + hypDaughter.subDaughterMassVec.resize(4); + } + + if (cfgNprimDaughters == 2 && cfgNsecDaughters == 0) { + const auto& d1 = cand.daughterTracks.at(0); + const auto& d2 = cand.daughterTracks.at(1); + if (!isMC || (isMC && cfgMCReconstructed && cand.IsReconstructed)) + outputTableTwo( + cand.Species, cand.IsMatter, cand.PassedEvSel, cand.Mass, cand.Y, cand.Pt, cand.Ct, cand.CpaPv, cand.MaxDcaTracks, cand.DcaToPvXY, cand.DcaToPvZ, cand.DevToPvXY, + cand.Chi2, cand.Pvx, cand.Pvy, cand.Pvz, cand.Svx, cand.Svy, cand.Svz, cand.Px, cand.Py, cand.Pz, cand.CollisionMcTrue, cand.McTrue, cand.McPhysicalPrimary, + d1.X, d1.Y, d1.Z, d1.Px, d1.Py, d1.Pz, d1.TPCnCls, d1.TPCchi2, d1.ITSnCls, d1.ITSchi2, d1.ITSmeanClsSize, d1.ITSmeanClsSizeL, + d1.Rigidity, d1.TPCsignal, d1.TPCnSigma, d1.TPCnSigmaNhp, d1.TPCnSigmaNlp, d1.TOFmass, d1.DcaXY, d1.DcaZ, d1.IsPvContributor, + d2.X, d2.Y, d2.Z, d2.Px, d2.Py, d2.Pz, d2.TPCnCls, d2.TPCchi2, d2.ITSnCls, d2.ITSchi2, d2.ITSmeanClsSize, d2.ITSmeanClsSizeL, + d2.Rigidity, d2.TPCsignal, d2.TPCnSigma, d2.TPCnSigmaNhp, d2.TPCnSigmaNlp, d2.TOFmass, d2.DcaXY, d2.DcaZ, d2.IsPvContributor); + if (isMC && cfgMCCombined) + outputTableMcTwo( + cand.PdgCode, cand.IsMatterMC, cand.IsReconstructed, cand.IsPhysicalPrimary, cand.PassedEvSelMC, cand.YGen, cand.PtGen, cand.CtGen, + cand.CpaPvGen, cand.PxGen, cand.PyGen, cand.PzGen, cand.PvxGen, cand.PvyGen, cand.PvzGen, cand.SvxGen, cand.SvyGen, cand.SvzGen, + cand.Species, cand.IsMatter, cand.PassedEvSel, cand.Mass, cand.Y, cand.Pt, cand.Ct, cand.CpaPv, cand.MaxDcaTracks, cand.DcaToPvXY, cand.DcaToPvZ, cand.DevToPvXY, + cand.Chi2, cand.Pvx, cand.Pvy, cand.Pvz, cand.Svx, cand.Svy, cand.Svz, cand.Px, cand.Py, cand.Pz, cand.CollisionMcTrue, + d1.X, d1.Y, d1.Z, d1.Px, d1.Py, d1.Pz, d1.TPCnCls, d1.TPCchi2, d1.ITSnCls, d1.ITSchi2, d1.ITSmeanClsSize, d1.ITSmeanClsSizeL, + d1.Rigidity, d1.TPCsignal, d1.TPCnSigma, d1.TPCnSigmaNhp, d1.TPCnSigmaNlp, d1.TOFmass, d1.DcaXY, d1.DcaZ, d1.IsPvContributor, + d2.X, d2.Y, d2.Z, d2.Px, d2.Py, d2.Pz, d2.TPCnCls, d2.TPCchi2, d2.ITSnCls, d2.ITSchi2, d2.ITSmeanClsSize, d2.ITSmeanClsSizeL, + d2.Rigidity, d2.TPCsignal, d2.TPCnSigma, d2.TPCnSigmaNhp, d2.TPCnSigmaNlp, d2.TOFmass, d2.DcaXY, d2.DcaZ, d2.IsPvContributor); + } + if (cfgNprimDaughters == 3 && cfgNsecDaughters == 0) { + const auto& d1 = cand.daughterTracks.at(0); + const auto& d2 = cand.daughterTracks.at(1); + const auto& d3 = cand.daughterTracks.at(2); + if (!isMC || (isMC && cfgMCReconstructed && cand.IsReconstructed)) + outputTableThree( + cand.Species, cand.IsMatter, cand.PassedEvSel, cand.Mass, cand.Y, cand.Pt, cand.Ct, cand.CpaPv, cand.MaxDcaTracks, cand.DcaToPvXY, cand.DcaToPvZ, cand.DevToPvXY, + cand.Chi2, cand.Pvx, cand.Pvy, cand.Pvz, cand.Svx, cand.Svy, cand.Svz, cand.Px, cand.Py, cand.Pz, cand.CollisionMcTrue, cand.McTrue, cand.McPhysicalPrimary, + d1.X, d1.Y, d1.Z, d1.Px, d1.Py, d1.Pz, d1.TPCnCls, d1.TPCchi2, d1.ITSnCls, d1.ITSchi2, d1.ITSmeanClsSize, d1.ITSmeanClsSizeL, + d1.Rigidity, d1.TPCsignal, d1.TPCnSigma, d1.TPCnSigmaNhp, d1.TPCnSigmaNlp, d1.TOFmass, d1.DcaXY, d1.DcaZ, d1.IsPvContributor, + d2.X, d2.Y, d2.Z, d2.Px, d2.Py, d2.Pz, d2.TPCnCls, d2.TPCchi2, d2.ITSnCls, d2.ITSchi2, d2.ITSmeanClsSize, d2.ITSmeanClsSizeL, + d2.Rigidity, d2.TPCsignal, d2.TPCnSigma, d2.TPCnSigmaNhp, d2.TPCnSigmaNlp, d2.TOFmass, d2.DcaXY, d2.DcaZ, d2.IsPvContributor, + d3.X, d3.Y, d3.Z, d3.Px, d3.Py, d3.Pz, d3.TPCnCls, d3.TPCchi2, d3.ITSnCls, d3.ITSchi2, d3.ITSmeanClsSize, d3.ITSmeanClsSizeL, + d3.Rigidity, d3.TPCsignal, d3.TPCnSigma, d3.TPCnSigmaNhp, d3.TPCnSigmaNlp, d3.TOFmass, d3.DcaXY, d3.DcaZ, d3.IsPvContributor, + d1.SubMass, d2.SubMass, d3.SubMass); + if (isMC && cfgMCCombined) + outputTableMcThree( + cand.PdgCode, cand.IsMatterMC, cand.IsReconstructed, cand.IsPhysicalPrimary, cand.PassedEvSelMC, cand.YGen, cand.PtGen, cand.CtGen, + cand.CpaPvGen, cand.PxGen, cand.PyGen, cand.PzGen, cand.PvxGen, cand.PvyGen, cand.PvzGen, cand.SvxGen, cand.SvyGen, cand.SvzGen, + cand.Species, cand.IsMatter, cand.PassedEvSel, cand.Mass, cand.Y, cand.Pt, cand.Ct, cand.CpaPv, cand.MaxDcaTracks, cand.DcaToPvXY, cand.DcaToPvZ, cand.DevToPvXY, + cand.Chi2, cand.Pvx, cand.Pvy, cand.Pvz, cand.Svx, cand.Svy, cand.Svz, cand.Px, cand.Py, cand.Pz, cand.CollisionMcTrue, + d1.X, d1.Y, d1.Z, d1.Px, d1.Py, d1.Pz, d1.TPCnCls, d1.TPCchi2, d1.ITSnCls, d1.ITSchi2, d1.ITSmeanClsSize, d1.ITSmeanClsSizeL, + d1.Rigidity, d1.TPCsignal, d1.TPCnSigma, d1.TPCnSigmaNhp, d1.TPCnSigmaNlp, d1.TOFmass, d1.DcaXY, d1.DcaZ, d1.IsPvContributor, + d2.X, d2.Y, d2.Z, d2.Px, d2.Py, d2.Pz, d2.TPCnCls, d2.TPCchi2, d2.ITSnCls, d2.ITSchi2, d2.ITSmeanClsSize, d2.ITSmeanClsSizeL, + d2.Rigidity, d2.TPCsignal, d2.TPCnSigma, d2.TPCnSigmaNhp, d2.TPCnSigmaNlp, d2.TOFmass, d2.DcaXY, d2.DcaZ, d2.IsPvContributor, + d3.X, d3.Y, d3.Z, d3.Px, d3.Py, d3.Pz, d3.TPCnCls, d3.TPCchi2, d3.ITSnCls, d3.ITSchi2, d3.ITSmeanClsSize, d3.ITSmeanClsSizeL, + d3.Rigidity, d3.TPCsignal, d3.TPCnSigma, d3.TPCnSigmaNhp, d3.TPCnSigmaNlp, d3.TOFmass, d3.DcaXY, d3.DcaZ, d3.IsPvContributor, + d1.SubMass, d2.SubMass, d3.SubMass); + } + if (cfgNprimDaughters == 2 && cfgNsecDaughters == 3) { + const auto& d0 = cand.daughterTracks.at(0); + const auto& d1 = cand.daughterTracks.at(1); + const auto& sd1 = hypDaughter.daughterTracks.at(0); + const auto& sd2 = hypDaughter.daughterTracks.at(1); + const auto& sd3 = hypDaughter.daughterTracks.at(2); + if (!isMC || (isMC && cfgMCReconstructed && cand.IsReconstructed)) + outputTableTwoThree( + cand.Species, cand.IsMatter, cand.PassedEvSel, cand.Mass, cand.Y, cand.Pt, cand.Ct, cand.CpaPv, cand.MaxDcaTracks, cand.DcaToPvXY, cand.DcaToPvZ, cand.DevToPvXY, + cand.Chi2, cand.Pvx, cand.Pvy, cand.Pvz, cand.Svx, cand.Svy, cand.Svz, cand.Px, cand.Py, cand.Pz, cand.CollisionMcTrue, cand.McTrue, cand.McPhysicalPrimary, + hypDaughter.Svx, hypDaughter.Svy, hypDaughter.Svz, d0.X, d0.Y, d0.Z, d0.Px, d0.Py, d0.Pz, hypDaughter.Mass, hypDaughter.Ct, hypDaughter.CpaPv, + hypDaughter.MaxDcaTracks, hypDaughter.DcaToPvXY, hypDaughter.DcaToPvZ, hypDaughter.DcaToVtxXY, hypDaughter.DcaToVtxZ, hypDaughter.Chi2, + d1.X, d1.Y, d1.Z, d1.Px, d1.Py, d1.Pz, d1.TPCnCls, d1.TPCchi2, d1.ITSnCls, d1.ITSchi2, d1.ITSmeanClsSize, d1.ITSmeanClsSizeL, + d1.Rigidity, d1.TPCsignal, d1.TPCnSigma, d1.TPCnSigmaNhp, d1.TPCnSigmaNlp, d1.TOFmass, d1.DcaXY, d1.DcaZ, d1.IsPvContributor, + sd1.X, sd1.Y, sd1.Z, sd1.Px, sd1.Py, sd1.Pz, sd1.TPCnCls, sd1.TPCchi2, sd1.ITSnCls, sd1.ITSchi2, sd1.ITSmeanClsSize, sd1.ITSmeanClsSizeL, + sd1.Rigidity, sd1.TPCsignal, sd1.TPCnSigma, sd1.TPCnSigmaNhp, sd1.TPCnSigmaNlp, sd1.TOFmass, sd1.DcaXY, sd1.DcaZ, sd1.IsPvContributor, + sd2.X, sd2.Y, sd2.Z, sd2.Px, sd2.Py, sd2.Pz, sd2.TPCnCls, sd2.TPCchi2, sd2.ITSnCls, sd2.ITSchi2, sd2.ITSmeanClsSize, sd2.ITSmeanClsSizeL, + sd2.Rigidity, sd2.TPCsignal, sd2.TPCnSigma, sd2.TPCnSigmaNhp, sd2.TPCnSigmaNlp, sd2.TOFmass, sd2.DcaXY, sd2.DcaZ, sd2.IsPvContributor, + sd3.X, sd3.Y, sd3.Z, sd3.Px, sd3.Py, sd3.Pz, sd3.TPCnCls, sd3.TPCchi2, sd3.ITSnCls, sd3.ITSchi2, sd3.ITSmeanClsSize, sd3.ITSmeanClsSizeL, + sd3.Rigidity, sd3.TPCsignal, sd3.TPCnSigma, sd3.TPCnSigmaNhp, sd3.TPCnSigmaNlp, sd3.TOFmass, sd3.DcaXY, sd3.DcaZ, sd3.IsPvContributor, + sd1.SubMass, sd2.SubMass, sd3.SubMass); + if (isMC && cfgMCCombined) + outputTableMcTwoThree( + cand.PdgCode, cand.IsMatterMC, cand.IsReconstructed, cand.IsPhysicalPrimary, cand.PassedEvSelMC, cand.YGen, cand.PtGen, cand.CtGen, + cand.CpaPvGen, cand.PxGen, cand.PyGen, cand.PzGen, cand.PvxGen, cand.PvyGen, cand.PvzGen, cand.SvxGen, cand.SvyGen, cand.SvzGen, + cand.Species, cand.IsMatter, cand.PassedEvSel, cand.Mass, cand.Y, cand.Pt, cand.Ct, cand.CpaPv, cand.MaxDcaTracks, cand.DcaToPvXY, cand.DcaToPvZ, cand.DevToPvXY, + cand.Chi2, cand.Pvx, cand.Pvy, cand.Pvz, cand.Svx, cand.Svy, cand.Svz, cand.Px, cand.Py, cand.Pz, cand.CollisionMcTrue, + hypDaughter.Svx, hypDaughter.Svy, hypDaughter.Svz, d0.X, d0.Y, d0.Z, d0.Px, d0.Py, d0.Pz, hypDaughter.Mass, hypDaughter.Ct, hypDaughter.CpaPv, + hypDaughter.MaxDcaTracks, hypDaughter.DcaToPvXY, hypDaughter.DcaToPvZ, hypDaughter.DcaToVtxXY, hypDaughter.DcaToVtxZ, hypDaughter.Chi2, + d1.X, d1.Y, d1.Z, d1.Px, d1.Py, d1.Pz, d1.TPCnCls, d1.TPCchi2, d1.ITSnCls, d1.ITSchi2, d1.ITSmeanClsSize, d1.ITSmeanClsSizeL, + d1.Rigidity, d1.TPCsignal, d1.TPCnSigma, d1.TPCnSigmaNhp, d1.TPCnSigmaNlp, d1.TOFmass, d1.DcaXY, d1.DcaZ, d1.IsPvContributor, + sd1.X, sd1.Y, sd1.Z, sd1.Px, sd1.Py, sd1.Pz, sd1.TPCnCls, sd1.TPCchi2, sd1.ITSnCls, sd1.ITSchi2, sd1.ITSmeanClsSize, sd1.ITSmeanClsSizeL, + sd1.Rigidity, sd1.TPCsignal, sd1.TPCnSigma, sd1.TPCnSigmaNhp, sd1.TPCnSigmaNlp, sd1.TOFmass, sd1.DcaXY, sd1.DcaZ, sd1.IsPvContributor, + sd2.X, sd2.Y, sd2.Z, sd2.Px, sd2.Py, sd2.Pz, sd2.TPCnCls, sd2.TPCchi2, sd2.ITSnCls, sd2.ITSchi2, sd2.ITSmeanClsSize, sd2.ITSmeanClsSizeL, + sd2.Rigidity, sd2.TPCsignal, sd2.TPCnSigma, sd2.TPCnSigmaNhp, sd2.TPCnSigmaNlp, sd2.TOFmass, sd2.DcaXY, sd2.DcaZ, sd2.IsPvContributor, + sd3.X, sd3.Y, sd3.Z, sd3.Px, sd3.Py, sd3.Pz, sd3.TPCnCls, sd3.TPCchi2, sd3.ITSnCls, sd3.ITSchi2, sd3.ITSmeanClsSize, sd3.ITSmeanClsSizeL, + sd3.Rigidity, sd3.TPCsignal, sd3.TPCnSigma, sd3.TPCnSigmaNhp, sd3.TPCnSigmaNlp, sd3.TOFmass, sd3.DcaXY, sd3.DcaZ, sd3.IsPvContributor, + sd1.SubMass, sd2.SubMass, sd3.SubMass); + } + if (cfgNprimDaughters == 3 && cfgNsecDaughters == 1) { + const auto& d0 = cand.daughterTracks.at(0); + const auto& d1 = cand.daughterTracks.at(1); + const auto& d2 = cand.daughterTracks.at(2); + const auto& sd1 = hypDaughter.daughterTracks.at(0); + const auto& sd2 = hypDaughter.daughterTracks.at(1); + if (!isMC || (isMC && cfgMCReconstructed && cand.IsReconstructed)) + outputTableTwoThree( + cand.Species, cand.IsMatter, cand.PassedEvSel, cand.Mass, cand.Y, cand.Pt, cand.Ct, cand.CpaPv, cand.MaxDcaTracks, cand.DcaToPvXY, cand.DcaToPvZ, cand.DevToPvXY, + cand.Chi2, cand.Pvx, cand.Pvy, cand.Pvz, cand.Svx, cand.Svy, cand.Svz, cand.Px, cand.Py, cand.Pz, cand.CollisionMcTrue, cand.McTrue, cand.McPhysicalPrimary, + hypDaughter.Svx, hypDaughter.Svy, hypDaughter.Svz, d0.X, d0.Y, d0.Z, d0.Px, d0.Py, d0.Pz, hypDaughter.Mass, hypDaughter.Ct, hypDaughter.CpaPv, + hypDaughter.MaxDcaTracks, hypDaughter.DcaToPvXY, hypDaughter.DcaToPvZ, hypDaughter.DcaToVtxXY, hypDaughter.DcaToVtxZ, hypDaughter.Chi2, + d1.X, d1.Y, d1.Z, d1.Px, d1.Py, d1.Pz, d1.TPCnCls, d1.TPCchi2, d1.ITSnCls, d1.ITSchi2, d1.ITSmeanClsSize, d1.ITSmeanClsSizeL, + d1.Rigidity, d1.TPCsignal, d1.TPCnSigma, d1.TPCnSigmaNhp, d1.TPCnSigmaNlp, d1.TOFmass, d1.DcaXY, d1.DcaZ, d1.IsPvContributor, + d2.X, d2.Y, d2.Z, d2.Px, d2.Py, d2.Pz, d2.TPCnCls, d2.TPCchi2, d2.ITSnCls, d2.ITSchi2, d2.ITSmeanClsSize, d2.ITSmeanClsSizeL, + d2.Rigidity, d2.TPCsignal, d2.TPCnSigma, d2.TPCnSigmaNhp, d2.TPCnSigmaNlp, d2.TOFmass, d2.DcaXY, d2.DcaZ, d2.IsPvContributor, + d0.SubMass, d1.SubMass, d2.SubMass, + sd1.X, sd1.Y, sd1.Z, sd1.Px, sd1.Py, sd1.Pz, sd1.TPCnCls, sd1.TPCchi2, sd1.ITSnCls, sd1.ITSchi2, sd1.ITSmeanClsSize, sd1.ITSmeanClsSizeL, + sd1.Rigidity, sd1.TPCsignal, sd1.TPCnSigma, sd1.TPCnSigmaNhp, sd1.TPCnSigmaNlp, sd1.TOFmass, sd1.DcaXY, sd1.DcaZ, sd1.IsPvContributor, + sd2.X, sd2.Y, sd2.Z, sd2.Px, sd2.Py, sd2.Pz, sd2.TPCnCls, sd2.TPCchi2, sd2.ITSnCls, sd2.ITSchi2, sd2.ITSmeanClsSize, sd2.ITSmeanClsSizeL, + sd2.Rigidity, sd2.TPCsignal, sd2.TPCnSigma, sd2.TPCnSigmaNhp, sd2.TPCnSigmaNlp, sd2.TOFmass, sd2.DcaXY, sd2.DcaZ, sd2.IsPvContributor); + if (isMC && cfgMCCombined) + outputTableMcTwoThree( + cand.PdgCode, cand.IsMatterMC, cand.IsReconstructed, cand.IsPhysicalPrimary, cand.PassedEvSelMC, cand.YGen, cand.PtGen, cand.CtGen, + cand.CpaPvGen, cand.PxGen, cand.PyGen, cand.PzGen, cand.PvxGen, cand.PvyGen, cand.PvzGen, cand.SvxGen, cand.SvyGen, cand.SvzGen, + cand.Species, cand.IsMatter, cand.PassedEvSel, cand.Mass, cand.Y, cand.Pt, cand.Ct, cand.CpaPv, cand.MaxDcaTracks, cand.DcaToPvXY, cand.DcaToPvZ, cand.DevToPvXY, + cand.Chi2, cand.Pvx, cand.Pvy, cand.Pvz, cand.Svx, cand.Svy, cand.Svz, cand.Px, cand.Py, cand.Pz, cand.CollisionMcTrue, + hypDaughter.Svx, hypDaughter.Svy, hypDaughter.Svz, d0.X, d0.Y, d0.Z, d0.Px, d0.Py, d0.Pz, hypDaughter.Mass, hypDaughter.Ct, hypDaughter.CpaPv, + hypDaughter.MaxDcaTracks, hypDaughter.DcaToPvXY, hypDaughter.DcaToPvZ, hypDaughter.DcaToVtxXY, hypDaughter.DcaToVtxZ, hypDaughter.Chi2, + d1.X, d1.Y, d1.Z, d1.Px, d1.Py, d1.Pz, d1.TPCnCls, d1.TPCchi2, d1.ITSnCls, d1.ITSchi2, d1.ITSmeanClsSize, d1.ITSmeanClsSizeL, + d1.Rigidity, d1.TPCsignal, d1.TPCnSigma, d1.TPCnSigmaNhp, d1.TPCnSigmaNlp, d1.TOFmass, d1.DcaXY, d1.DcaZ, d1.IsPvContributor, + d2.X, d2.Y, d2.Z, d2.Px, d2.Py, d2.Pz, d2.TPCnCls, d2.TPCchi2, d2.ITSnCls, d2.ITSchi2, d2.ITSmeanClsSize, d2.ITSmeanClsSizeL, + d2.Rigidity, d2.TPCsignal, d2.TPCnSigma, d2.TPCnSigmaNhp, d2.TPCnSigmaNlp, d2.TOFmass, d2.DcaXY, d2.DcaZ, d2.IsPvContributor, + d0.SubMass, d1.SubMass, d2.SubMass, + sd1.X, sd1.Y, sd1.Z, sd1.Px, sd1.Py, sd1.Pz, sd1.TPCnCls, sd1.TPCchi2, sd1.ITSnCls, sd1.ITSchi2, sd1.ITSmeanClsSize, sd1.ITSmeanClsSizeL, + sd1.Rigidity, sd1.TPCsignal, sd1.TPCnSigma, sd1.TPCnSigmaNhp, sd1.TPCnSigmaNlp, sd1.TOFmass, sd1.DcaXY, sd1.DcaZ, sd1.IsPvContributor, + sd2.X, sd2.Y, sd2.Z, sd2.Px, sd2.Py, sd2.Pz, sd2.TPCnCls, sd2.TPCchi2, sd2.ITSnCls, sd2.ITSchi2, sd2.ITSmeanClsSize, sd2.ITSmeanClsSizeL, + sd2.Rigidity, sd2.TPCsignal, sd2.TPCnSigma, sd2.TPCnSigmaNhp, sd2.TPCnSigmaNlp, sd2.TOFmass, sd2.DcaXY, sd2.DcaZ, sd2.IsPvContributor); + } + } + //___________________________________________________________________________________________________________________________________________________________ + + void fillCandidate(hyperNucleus& cand, hyperNucleus& /*hypDaughter*/, aod::HypKfHypNuc const& hypNuc, aod::HypKfHypNucs const&, aod::HypKfColls const&, aod::HypKfTracks const&, aod::HypKfDaughtAdds const&, aod::HypKfSubDs const&) + { + cand.daughterTracks.clear(); + cand.subDaughterMassVec.clear(); + auto coll = hypNuc.hypKfColl(); + auto addOns = hypNuc.addons_as(); + auto posVec = posVector(addOns); + cand.Species = std::abs(hypNuc.species()); + cand.IsMatter = hypNuc.isMatter(); + cand.PassedEvSel = coll.passedEvSel(); + cand.Mass = hypNuc.mass(); + cand.Y = hypNuc.y(); + cand.Pt = hypNuc.pt(); + cand.Ct = ct(coll, hypNuc); + cand.CpaPv = cpa(coll, hypNuc); + cand.MaxDcaTracks = maxValue(dcaTrackSvAll(posVec, hypNuc, "XY")); + cand.DcaToPvXY = hypNuc.dcaToPvXY(); + cand.DcaToPvZ = hypNuc.dcaToPvZ(); + cand.DcaToVtxXY = hypNuc.dcaToVtxXY(); + cand.DcaToVtxZ = hypNuc.dcaToVtxZ(); + cand.DevToPvXY = hypNuc.devToPvXY(); + cand.Chi2 = hypNuc.chi2(); + cand.Pvx = coll.posX(); + cand.Pvy = coll.posY(); + cand.Pvz = coll.posZ(); + cand.Svx = hypNuc.svx(); + cand.Svy = hypNuc.svy(); + cand.Svz = hypNuc.svz(); + cand.Px = hypNuc.px(); + cand.Py = hypNuc.py(); + cand.Pz = hypNuc.pz(); + if (cfgNsecDaughters) { + trackProperties hypDaughter; + cand.daughterTracks.push_back(hypDaughter); + } + auto daughterTracks = hypNuc.daughterTracks_as(); + for (auto& track : daughterTracks) { + trackProperties daughter; + daughter.TPCnCls = track.tpcNcluster(); + daughter.ITSnCls = track.itsNcluster(); + daughter.TPCchi2 = track.tpcChi2NCl(); + daughter.ITSchi2 = track.itsChi2NCl(); + daughter.ITSmeanClsSize = track.itsMeanClsSize(); + daughter.ITSmeanClsSizeL = track.itsMeanClsSize() * track.lambda(); + daughter.Rigidity = track.rigidity(); + daughter.TPCsignal = track.tpcSignal(); + daughter.TPCnSigma = track.tpcNsigma(); + daughter.TPCnSigmaNhp = track.tpcNsigmaNhp(); + daughter.TPCnSigmaNlp = track.tpcNsigmaNlp(); + daughter.TOFmass = track.tofMass(); + daughter.DcaXY = track.dcaXY(); + daughter.DcaZ = track.dcaZ(); + daughter.IsPvContributor = track.isPVContributor(); + cand.daughterTracks.push_back(daughter); + } + int trackCount = 0; + for (auto& addOn : addOns) { + cand.daughterTracks.at(trackCount).X = addOn.x(); + cand.daughterTracks.at(trackCount).Y = addOn.y(); + cand.daughterTracks.at(trackCount).Z = addOn.z(); + cand.daughterTracks.at(trackCount).Px = addOn.px(); + cand.daughterTracks.at(trackCount).Py = addOn.py(); + cand.daughterTracks.at(trackCount).Pz = addOn.py(); + trackCount++; + } + cand.NsingleDaughters = trackCount; + if (cand.NsingleDaughters < 3) + return; + + trackCount = 0; + auto subDaughters = hypNuc.subDaughters_as(); + for (auto& subDaughter : subDaughters) { + cand.daughterTracks.at(trackCount++).SubMass = subDaughter.subMass(); + } + } + //___________________________________________________________________________________________________________________________________________________________ + + void processMC(aod::HypKfMcParts const& mcHypNucs, aod::HypKfHypNucs const& hypNucs, aod::HypKfMcColls const&, aod::HypKfColls const& hypKfColls, aod::HypKfTracks const& hypKfTrks, aod::HypKfDaughtAdds const& hypKfDAdd, aod::HypKfSubDs const& hypKfDSub) + { + isMC = true; + for (auto& mcHypNuc : mcHypNucs) { + if (std::abs(mcHypNuc.species()) != cfgSpecies) + continue; + auto mcColl = mcHypNuc.hypKfMcColl(); + const auto mcParticleIdx = mcHypNuc.globalIndex(); + auto hypNucsByMc = hypNucs.sliceBy(perMcParticle, mcParticleIdx); + hyperNucleus candidate, hypDaughter, dummy; + candidate.PdgCode = mcHypNuc.pdgCode(); + candidate.IsMatterMC = mcHypNuc.isMatter(); + candidate.IsPhysicalPrimary = mcHypNuc.isPhysicalPrimary(); + candidate.PassedEvSelMC = mcColl.passedEvSel(); + candidate.YGen = mcHypNuc.y(); + candidate.PtGen = mcHypNuc.pt(); + candidate.CtGen = ct(mcColl, mcHypNuc); + candidate.IsReconstructed = 0; + candidate.CpaPvGen = cpa(mcColl, mcHypNuc); + candidate.PxGen = mcHypNuc.px(); + candidate.PyGen = mcHypNuc.py(); + candidate.PzGen = mcHypNuc.pz(); + candidate.PvxGen = mcColl.posX(); + candidate.PvyGen = mcColl.posY(); + candidate.PvzGen = mcColl.posZ(); + candidate.SvxGen = mcHypNuc.svx(); + candidate.SvyGen = mcHypNuc.svy(); + candidate.SvzGen = mcHypNuc.svz(); + for (auto& hypNuc : hypNucsByMc) { + auto coll = hypNuc.hypKfColl(); + if (coll.hypKfMcCollId() == mcHypNuc.hypKfMcCollId()) { + candidate.CollisionMcTrue = true; + } + candidate.IsReconstructed++; + fillCandidate(candidate, hypDaughter, hypNucs.rawIteratorAt(hypNuc.globalIndex()), hypNucs, hypKfColls, hypKfTrks, hypKfDAdd, hypKfDSub); + if (cfgNsecDaughters) { + fillCandidate(hypDaughter, dummy, hypNucs.rawIteratorAt(hypNuc.hypDaughterId()), hypNucs, hypKfColls, hypKfTrks, hypKfDAdd, hypKfDSub); + } + } + fillTable(candidate, hypDaughter); + hPt[0]->Fill(mcHypNuc.pt()); + if (candidate.IsReconstructed) + hPt[1]->Fill(candidate.Pt); + } + hPt[2]->Divide(hPt[1].get(), hPt[0].get()); + } + PROCESS_SWITCH(hypKfTreeCreator, processMC, "MC Gen tree", false); + + //___________________________________________________________________________________________________________________________________________________________ + std::vector dcaTracksAll(std::vector& posVec, TString opt = "") + { + std::vector vec; + int n = posVec.size(); + for (int i = 0; i < (n - 1); i++) { + for (int j = (i + 1); j < n; j++) { + vec.push_back(dcaTracks(posVec, i, j, opt)); + } + } + return vec; + } + template + std::vector dcaTrackSvAll(std::vector& posVec, T const& hypNuc, TString opt = "") + { + std::vector vec; + for (size_t i = 0; i < posVec.size(); i++) { + vec.push_back(dcaTrackSv(posVec, i, hypNuc, opt)); + } + return vec; + } + + float maxValue(std::vector vec) + { + return *max_element(vec.begin(), vec.end()); + } + float meanValue(std::vector vec) + { + float sum = 0; + for (auto value : vec) + sum += value; + return sum / vec.size(); + } + float mean2Value(std::vector vec) + { + float sum = 0; + for (auto value : vec) + sum += (value * value); + return TMath::Sqrt(sum / vec.size()); + } + + float dcaTracks(std::vector v, int track1, int track2, TString opt = "XY") + { + if (opt == "XY") + return RecoDecay::distanceXY(v.at(track1), v.at(track2)); + else if (opt == "Z") + return std::abs(v.at(track1).at(2) - v.at(track2).at(2)); + else + return RecoDecay::distance(v.at(track1), v.at(track2)); + } + template + float dcaTrackSv(std::vector& v, int track, T const& hypNuc, TString opt = "") + { + if (opt == "XY") + return RecoDecay::distanceXY(v.at(track), decayVtx(hypNuc)); + else if (opt == "Z") + return std::abs(v.at(track).at(2) - decayVtx(hypNuc).at(2)); + else + return RecoDecay::distance(v.at(track), decayVtx(hypNuc)); + } + template + std::vector posVector(T const& addons) + { + std::vector v; + for (auto& pos : addons) { + v.push_back(std::array{pos.x(), pos.y(), pos.z()}); + } + return v; + } + template + arr3 primVtx(T const& coll) + { + return std::array{coll.posX(), coll.posY(), coll.posZ()}; + } + template + arr3 decayVtx(T const& hypNuc) + { + return std::array{hypNuc.svx(), hypNuc.svy(), hypNuc.svz()}; + } + template + arr3 momenta(T const& hypNuc) + { + return std::array{hypNuc.px(), hypNuc.py(), hypNuc.pz()}; + } + template + float decayLength(TColl const& coll, TPart const& hypNuc) + { + return RecoDecay::distance(primVtx(coll), decayVtx(hypNuc)); + } + template + float ct(TColl const& coll, TPart const& hypNuc) + { + return RecoDecay::ct(momenta(hypNuc), decayLength(coll, hypNuc), hypNuc.mass()); + } + template + double cpa(TColl const& coll, TPart const& hypNuc) + { + return RecoDecay::cpa(primVtx(coll), decayVtx(hypNuc), momenta(hypNuc)); + } + double paArcMin(double cosPa) + { + // returns the pointing angle (in arc min) for a given cosPa + return TMath::ACos(cosPa) * 60 * 180 / TMath::Pi(); + } + // only for Cascades + template + float decayLength(TPart const& mother, TPart const& daughter) + { + return RecoDecay::distance(decayVtx(mother), decayVtx(daughter)); + } + template + float ct(TPart const& mother, TPart const& daughter) + { + return RecoDecay::ct(momenta(daughter), decayLength(mother, daughter), daughter.mass()); + } + template + double cpa(TPart const& mother, TPart const& daughter) + { + return RecoDecay::cpa(decayVtx(mother), decayVtx(daughter), momenta(daughter)); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index 0068d7a506e..25f883bf1e3 100644 --- a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx @@ -34,6 +34,8 @@ #include "EventFiltering/ZorroSummary.h" #include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/PID/PIDTOF.h" +#include "Common/TableProducer/PID/pidTOFBase.h" #include "DataFormatsTPC/BetheBlochAleph.h" #include "DCAFitter/DCAFitterN.h" #include "PWGLF/Utils/svPoolCreator.h" @@ -44,7 +46,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; using CollBracket = o2::math_utils::Bracket; -using TracksFull = soa::Join; +using TracksFull = soa::Join; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; @@ -54,7 +56,7 @@ namespace { constexpr double betheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; -static const std::vector particleNames{"He3"}; +static const std::vector particleName{"He3"}; std::shared_ptr hEvents; std::shared_ptr hZvtx; std::shared_ptr hCentFT0A; @@ -103,6 +105,7 @@ struct hyperCandidate { uint16_t tpcSignalHe3 = 0u; uint16_t tpcSignalPi = 0u; float tpcChi2He3 = 0.f; + float massTOFHe3 = 0.f; uint8_t nTPCClustersHe3 = 0u; uint8_t nTPCClustersPi = 0u; uint32_t clusterSizeITSHe3 = 0u; @@ -160,7 +163,7 @@ struct hyperRecoTask { Configurable useCustomVertexer{"useCustomVertexer", false, "Use custom vertexer"}; Configurable skipAmbiTracks{"skipAmbiTracks", false, "Skip ambiguous tracks"}; Configurable customVertexerTimeMargin{"customVertexerTimeMargin", 800, "Time margin for custom vertexer (ns)"}; - Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for He3"}; + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, particleName, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for He3"}; Configurable cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", true, "If true, divide tpcInnerParam by the electric charge"}; Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Type of material correction"}; @@ -500,6 +503,12 @@ struct hyperRecoTask { hypCand.piTrackID = piTrack.globalIndex(); hypCand.collisionID = collision.globalIndex(); + if (heTrack.hasTOF()) { + float beta = o2::pid::tof::Beta::GetBeta(heTrack); + beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked + hypCand.massTOFHe3 = hypCand.momHe3TPC * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); + } + hDeDx3HeSel->Fill(heTrack.sign() * hypCand.momHe3TPC, heTrack.tpcSignal()); hNsigma3HeSel->Fill(heTrack.sign() * hypCand.momHe3TPC, hypCand.nSigmaHe3); hyperCandidates.push_back(hypCand); @@ -653,6 +662,7 @@ struct hyperRecoTask { hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, + hypCand.massTOFHe3, hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize); } } @@ -683,6 +693,7 @@ struct hyperRecoTask { hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, + hypCand.massTOFHe3, hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize); } } @@ -717,6 +728,7 @@ struct hyperRecoTask { hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, + hypCand.massTOFHe3, hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], @@ -789,7 +801,7 @@ struct hyperRecoTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, false, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], diff --git a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx index 70b000c2080..6d8e13e69a6 100644 --- a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx @@ -12,6 +12,11 @@ // Build \Lambda-n-n candidates from V0s and tracks // ============================================================================== #include +#include +#include +#include +#include + #include #include "Framework/runDataProcessing.h" @@ -75,6 +80,8 @@ std::shared_ptr hDecayChannel; std::shared_ptr hIsMatterGen; std::shared_ptr hIsMatterGenTwoBody; std::shared_ptr hDCAxy3H; +std::shared_ptr hLnnCandLoss; +std::shared_ptr hNSigma3HTPC_preselection; float alphaAP(std::array const& momB, std::array const& momC) { @@ -154,6 +161,7 @@ struct lnnRecoTask { Configurable nTPCClusMin3H{"nTPCClusMin3H", 80, "triton NTPC clusters cut"}; Configurable ptMinTOF{"ptMinTOF", 0.8, "minimum pt for TOF cut"}; Configurable TrTOFMass2Cut{"TrTOFMass2Cut", 5.5, "minimum Triton mass square to TOF"}; + Configurable BetaTrTOF{"BetaTrTOF", 0.4, "minimum beta TOF cut"}; Configurable mcSignalOnly{"mcSignalOnly", true, "If true, save only signal in MC"}; // Define o2 fitter, 2-prong, active memory (no need to redefine per event) @@ -186,9 +194,9 @@ struct lnnRecoTask { ConfigurableAxis nSigmaBins{"nSigmaBins", {200, -5.f, 5.f}, "Binning for n sigma"}; ConfigurableAxis zVtxBins{"zVtxBins", {100, -20.f, 20.f}, "Binning for n sigma"}; ConfigurableAxis centBins{"centBins", {100, 0.f, 100.f}, "Binning for centrality"}; - ConfigurableAxis TritMomBins{"TritMomBins", {100, 0.f, 5.f}, "Binning for Triton TPC momentum"}; + ConfigurableAxis TritMomBins{"TritMomBins", {100, -5.f, 5.f}, "Binning for Triton momentum"}; ConfigurableAxis MassTOFBins{"MassTOFBins", {400, 2.0f, 12.f}, "Binning for Triton Mass TOF"}; - ConfigurableAxis PtTritonBins{"PtTritonBins", {200, -5.f, 5.f}, "Binning for Triton pt positive values"}; + ConfigurableAxis PtTritonBins{"PtTritonBins", {200, -5.f, 5.f}, "Binning for Triton p values"}; ConfigurableAxis PtPosTritonBins{"PtPosTritonBins", {200, 0.f, 5.f}, "Binning for Triton pt positive values"}; ConfigurableAxis BetaBins{"BetaBins", {550, 0.f, 1.1f}, "Binning for Beta"}; ConfigurableAxis DCAxyBins{"DCAxyBins", {550, -5.f, 5.f}, "Binning for DCAxy"}; @@ -235,7 +243,7 @@ struct lnnRecoTask { const AxisSpec nSigma3HAxis{nSigmaBins, "n_{#sigma}({}^{3}H)"}; const AxisSpec zVtxAxis{zVtxBins, "z_{vtx} (cm)"}; const AxisSpec centAxis{centBins, "Centrality"}; - const AxisSpec TritMomAxis{TritMomBins, "#it{p}^{TPC}({}^{3}H)"}; + const AxisSpec TritMomAxis{TritMomBins, "#it{p}({}^{3}H)"}; const AxisSpec PtTrAxis{PtTritonBins, "#it{p_T}({}^{3}H)"}; const AxisSpec PtPosTrAxis{PtPosTritonBins, "#it{p_T}({}^{3}H)"}; const AxisSpec MassTOFAxis{MassTOFBins, "{m}^{2}/{z}^{2}"}; @@ -251,9 +259,20 @@ struct lnnRecoTask { h3HSignalPtTOF = qaRegistry.add("h3HSignalPtTOF", "; #it{p}_{T}({}^{3}H) (GeV/#it{c}); #beta (TOF)", HistType::kTH2F, {PtTrAxis, BetaAxis}); hDCAxy3H = qaRegistry.add("hDCAxy3H", "; #it{p}_{T}({}^{3}H) (GeV/#it{c}); #it{DCA}_{xy} 3H", HistType::kTH2F, {PtPosTrAxis, DCAxyAxis}); hEvents = qaRegistry.add("hEvents", ";Events; ", HistType::kTH1D, {{2, -0.5, 1.5}}); + hLnnCandLoss = qaRegistry.add("hLnnCandLoss", ";CandLoss; ", HistType::kTH1D, {{7, -0.5, 6.5}}); + hNSigma3HTPC_preselection = qaRegistry.add("hNSigma3HTPC_preselection", "#it{p}/z (GeV/#it{c}); n#sigma_{TPC}(^{3}H)", HistType::kTH2F, {rigidityAxis, nSigma3HAxis}); hEvents->GetXaxis()->SetBinLabel(1, "All"); hEvents->GetXaxis()->SetBinLabel(2, "sel8"); + hLnnCandLoss->GetYaxis()->SetTitle("#it{N}_{candidates}"); + hLnnCandLoss->GetXaxis()->SetTitle("Cuts"); + hLnnCandLoss->GetXaxis()->SetBinLabel(1, "Initial LnnCandidates"); + hLnnCandLoss->GetXaxis()->SetBinLabel(2, "not 3H"); + hLnnCandLoss->GetXaxis()->SetBinLabel(3, "not anti3H"); + hLnnCandLoss->GetXaxis()->SetBinLabel(4, "#it{p}_{Tmin}"); + hLnnCandLoss->GetXaxis()->SetBinLabel(5, "!isLnnMass"); + hLnnCandLoss->GetXaxis()->SetBinLabel(6, "DCA #it{V}_{0} daughter"); + hLnnCandLoss->GetXaxis()->SetBinLabel(7, "cosPA"); if (doprocessMC) { hDecayChannel = qaRegistry.add("hDecayChannel", ";Decay channel; ", HistType::kTH1D, {{2, -0.5, 1.5}}); hDecayChannel->GetXaxis()->SetBinLabel(1, "2-body"); @@ -361,6 +380,16 @@ struct lnnRecoTask { float alpha = alphaAP(momPos, momNeg); lnnCandidate lnnCand; lnnCand.isMatter = alpha > 0; + hLnnCandLoss->Fill(0.); + if ((lnnCand.isMatter && !is3H) || (!lnnCand.isMatter && !isAnti3H)) { + if (lnnCand.isMatter && !is3H) { + hLnnCandLoss->Fill(1.); + } + if (!lnnCand.isMatter && !isAnti3H) { + hLnnCandLoss->Fill(2.); + } + continue; + } auto& h3track = lnnCand.isMatter ? posTrack : negTrack; auto& h3Rigidity = lnnCand.isMatter ? posRigidity : negRigidity; @@ -392,12 +421,14 @@ struct lnnRecoTask { float beta = -1.f; if (h3track.pt() >= ptMinTOF) { + hNSigma3HTPC_preselection->Fill(h3track.tpcInnerParam(), lnnCand.nSigma3H); if (!h3track.hasTOF()) { continue; } + beta = h3track.beta(); lnnCand.mass2TrTOF = h3track.mass() * h3track.mass(); - if (lnnCand.mass2TrTOF < TrTOFMass2Cut) { + if (lnnCand.mass2TrTOF < TrTOFMass2Cut || beta < BetaTrTOF) { continue; } } @@ -436,6 +467,7 @@ struct lnnRecoTask { float lnnPt = std::hypot(lnnMom[0], lnnMom[1]); if (lnnPt < ptMin) { + hLnnCandLoss->Fill(3.); continue; } @@ -447,12 +479,14 @@ struct lnnRecoTask { isLNNMass = true; } if (!isLNNMass) { + hLnnCandLoss->Fill(4.); continue; } // V0, primary vertex and poiting angle lnnCand.dcaV0dau = std::sqrt(fitter.getChi2AtPCACandidate()); if (lnnCand.dcaV0dau > dcav0dau) { + hLnnCandLoss->Fill(5.); continue; } @@ -460,6 +494,7 @@ struct lnnRecoTask { double cosPA = RecoDecay::cpa(primVtx, lnnCand.decVtx, lnnMom); if (cosPA < v0cospa) { + hLnnCandLoss->Fill(6.); continue; } @@ -488,7 +523,7 @@ struct lnnRecoTask { hDCAxy3H->Fill(h3track.pt(), h3track.dcaXY()); if (h3track.hasTOF()) { h3HSignalPtTOF->Fill(chargeFactor * h3track.pt(), beta); - hNsigma3HSelTOF->Fill(chargeFactor * h3track.pt(), h3track.tofNSigmaTr()); + hNsigma3HSelTOF->Fill(chargeFactor * h3track.p(), h3track.tofNSigmaTr()); h3HMassPtTOF->Fill(chargeFactor * h3track.pt(), lnnCand.mass2TrTOF); } } diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index 0c511e1d755..c0c4de3c8c1 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx @@ -19,7 +19,11 @@ // o2-analysis-pid-tof-base, o2-analysis-multiplicity-table, o2-analysis-event-selection // (to add flow: o2-analysis-qvector-table, o2-analysis-centrality-table) +#include #include +#include +#include +#include #include "Math/Vector4D.h" @@ -31,6 +35,7 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/Core/PID/PIDTOF.h" #include "Common/TableProducer/PID/pidTOFBase.h" @@ -79,6 +84,7 @@ struct NucleusCandidate { float TPCsignal; float ITSchi2; float TPCchi2; + float TOFchi2; std::array nSigmaTPC; std::array tofMasses; bool fillTree; @@ -198,6 +204,7 @@ std::shared_ptr hGloTOFtracks[2]; std::shared_ptr hDeltaP[2][5]; std::shared_ptr hFlowHists[2][5]; std::shared_ptr hDCAHists[2][5]; +std::shared_ptr hMatchingStudy[2]; o2::base::MatLayerCylSet* lut = nullptr; std::vector candidates; @@ -249,6 +256,8 @@ struct nucleiSpectra { Configurable cfgCutOnReconstructedRapidity{"cfgCutOnReconstructedRapidity", false, "Cut on reconstructed rapidity"}; Configurable cfgCutNclusITS{"cfgCutNclusITS", 5, "Minimum number of ITS clusters"}; Configurable cfgCutNclusTPC{"cfgCutNclusTPC", 70, "Minimum number of TPC clusters"}; + Configurable cfgCutPtMinTree{"cfgCutPtMinTree", 0.2f, "Minimum track transverse momentum for tree saving"}; + Configurable cfgCutPtMaxTree{"cfgCutPtMaxTree", 15.0f, "Maximum track transverse momentum for tree saving"}; Configurable> cfgMomentumScalingBetheBloch{"cfgMomentumScalingBetheBloch", {nuclei::bbMomScalingDefault[0], 5, 2, nuclei::names, nuclei::chargeLabelNames}, "TPC Bethe-Bloch momentum scaling for light nuclei"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {nuclei::betheBlochDefault[0], 5, 6, nuclei::names, nuclei::betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; @@ -299,10 +308,8 @@ struct nucleiSpectra { int mRunNumber = 0; float mBz = 0.f; - Filter trackFilter = nabs(aod::track::eta) < cfgCutEta && aod::track::tpcInnerParam > cfgCutTpcMom; + using TrackCandidates = soa::Join; - using TrackCandidates = soa::Filtered>; - using TrackCandidatesMC = soa::Filtered>; // Collisions with chentrality using CollWithCent = soa::Join::iterator; @@ -458,6 +465,12 @@ struct nucleiSpectra { } } + if (doprocessMatching) { + for (int iC{0}; iC < 2; ++iC) { + nuclei::hMatchingStudy[iC] = spectra.add(fmt::format("hMatchingStudy{}", nuclei::matter[iC]).data(), ";#it{p}_{T};#phi;#eta;n#sigma_{ITS};n#sigma{TPC};n#sigma_{TOF}", HistType::kTHnSparseF, {{20, 1., 9.}, {10, 0., o2::constants::math::TwoPI}, {10, -1., 1.}, {50, -5., 5.}, {50, -5., 5.}, {50, 0., 1.}}); + } + } + nuclei::lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get("GLO/Param/MatLUT")); // TrackTuner initialization if (cfgUseTrackTuner) { @@ -490,7 +503,6 @@ struct nucleiSpectra { template void fillDataInfo(Tcoll const& collision, Ttrks const& tracks) { - o2::pid::tof::Beta responseBeta; auto bc = collision.template bc_as(); initCCDB(bc); if (cfgSkimmedProcessing) { @@ -517,7 +529,9 @@ struct nucleiSpectra { int nGloTracks[2]{0, 0}, nTOFTracks[2]{0, 0}; for (auto& track : tracks) { // start loop over tracks - if (track.itsNCls() < cfgCutNclusITS || + if (std::abs(track.eta()) > cfgCutEta || + track.tpcInnerParam() < cfgCutTpcMom || + track.itsNCls() < cfgCutNclusITS || track.tpcNClsFound() < cfgCutNclusTPC || track.tpcNClsCrossedRows() < 70 || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || @@ -525,7 +539,6 @@ struct nucleiSpectra { track.itsChi2NCl() > 36.f) { continue; } - // temporary fix: tpcInnerParam() returns the momentum in all the software tags before bool heliumPID = track.pidForTracking() == o2::track::PID::Helium3 || track.pidForTracking() == o2::track::PID::Alpha; float correctedTpcInnerParam = (heliumPID && cfgCompensatePIDinTracking) ? track.tpcInnerParam() / 2 : track.tpcInnerParam(); @@ -579,7 +592,7 @@ struct nucleiSpectra { gpu::gpustd::array dcaInfo; o2::base::Propagator::Instance()->propagateToDCA(collVtx, mTrackParCov, mBz, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfo); - float beta{responseBeta.GetBeta(track)}; + float beta{o2::pid::tof::Beta::GetBeta(track)}; spectra.fill(HIST("hTpcSignalDataSelected"), correctedTpcInnerParam * track.sign(), track.tpcSignal()); spectra.fill(HIST("hTofSignalData"), correctedTpcInnerParam, beta); beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked @@ -693,9 +706,15 @@ struct nucleiSpectra { computeEventPlane(collision.qvecBPosIm(), collision.qvecBPosRe()), collision.multTPC()}); } + if (fillTree) { + if (flag & BIT(2)) { + if (track.pt() < cfgCutPtMinTree || track.pt() > cfgCutPtMaxTree || track.sign() > 0) + continue; + } + } nuclei::candidates.emplace_back(NucleusCandidate{ static_cast(track.globalIndex()), static_cast(track.collisionId()), (1 - 2 * iC) * mTrackParCov.getPt(), mTrackParCov.getEta(), mTrackParCov.getPhi(), - correctedTpcInnerParam, beta, collision.posZ(), dcaInfo[0], dcaInfo[1], track.tpcSignal(), track.itsChi2NCl(), track.tpcChi2NCl(), + correctedTpcInnerParam, beta, collision.posZ(), dcaInfo[0], dcaInfo[1], track.tpcSignal(), track.itsChi2NCl(), track.tpcChi2NCl(), track.tofChi2(), nSigmaTPC, tofMasses, fillTree, fillDCAHist, correctPV, isSecondary, fromWeakDecay, flag, track.tpcNClsFindable(), static_cast(track.tpcNClsCrossedRows()), track.itsClusterMap(), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared()), static_cast(track.itsNCls()), static_cast(track.itsClusterSizes())}); } @@ -715,7 +734,7 @@ struct nucleiSpectra { fillDataInfo(collision, tracks); for (auto& c : nuclei::candidates) { if (c.fillTree) { - nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS); + nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS); } if (c.fillDCAHist) { for (int iS{0}; iS < nuclei::species; ++iS) { @@ -741,7 +760,7 @@ struct nucleiSpectra { fillDataInfo(collision, tracks); for (auto& c : nuclei::candidates) { if (c.fillTree) { - nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS); + nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS); } if (c.fillDCAHist) { for (int iS{0}; iS < nuclei::species; ++iS) { @@ -770,7 +789,7 @@ struct nucleiSpectra { fillDataInfo(collision, tracks); for (auto& c : nuclei::candidates) { if (c.fillTree) { - nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS); + nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS); } if (c.fillDCAHist) { for (int iS{0}; iS < nuclei::species; ++iS) { @@ -787,7 +806,7 @@ struct nucleiSpectra { PROCESS_SWITCH(nucleiSpectra, processDataFlowAlternative, "Data analysis with flow - alternative framework", false); Preslice tracksPerCollisions = aod::track::collisionId; - void processMC(soa::Join const& collisions, aod::McCollisions const& mcCollisions, TrackCandidatesMC const& tracks, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&) + void processMC(soa::Join const& collisions, aod::McCollisions const& mcCollisions, soa::Join const& tracks, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&) { nuclei::candidates.clear(); for (auto& c : mcCollisions) { @@ -821,12 +840,16 @@ struct nucleiSpectra { if (particle.mcCollisionId() == collMCGlobId) { c.correctPV = true; } + if (!c.correctPV) { + c.flags |= kIsAmbiguous; + } if (!particle.isPhysicalPrimary()) { c.isSecondary = true; if (particle.getProcess() == 4) { c.fromWeakDecay = true; } } + if (c.fillDCAHist && cfgDCAHists->get(iS, c.pt < 0)) { nuclei::hDCAHists[c.pt < 0][iS]->Fill(std::abs(c.pt), c.DCAxy, c.DCAz, c.nSigmaTPC[iS], c.tofMasses[iS], c.ITSnCls, c.TPCnCls, c.correctPV, c.isSecondary, c.fromWeakDecay); } @@ -835,16 +858,20 @@ struct nucleiSpectra { if (!storeIt) { continue; } + int MotherpdgCode = 0; isReconstructed[particle.globalIndex()] = true; if (particle.isPhysicalPrimary()) { c.flags |= kIsPhysicalPrimary; } else if (particle.has_mothers()) { c.flags |= kIsSecondaryFromWeakDecay; + for (auto& motherparticle : particle.mothers_as()) { + MotherpdgCode = motherparticle.pdgCode(); + } } else { c.flags |= kIsSecondaryFromMaterial; } float absoDecL = computeAbsoDecL(particle); - nucleiTableMC(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS, particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), goodCollisions[particle.mcCollisionId()], absoDecL); + nucleiTableMC(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS, particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), MotherpdgCode, goodCollisions[particle.mcCollisionId()], absoDecL); } int index{0}; @@ -865,7 +892,7 @@ struct nucleiSpectra { if (!isReconstructed[index] && (cfgTreeConfig->get(iS, 0u) || cfgTreeConfig->get(iS, 1u))) { float absDecL = computeAbsoDecL(particle); - nucleiTableMC(999., 999., 999., 0., 0., 999., 999., 999., -1, -1, -1, flags, 0, 0, 0, 0, 0, 0, particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), goodCollisions[particle.mcCollisionId()], absDecL); + nucleiTableMC(999., 999., 999., 0., 0., 999., 999., 999., -1, -1, -1, -1, flags, 0, 0, 0, 0, 0, 0, particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), 0, goodCollisions[particle.mcCollisionId()], absDecL); } break; } @@ -873,6 +900,29 @@ struct nucleiSpectra { } } PROCESS_SWITCH(nucleiSpectra, processMC, "MC analysis", false); + + void processMatching(soa::Join::iterator const& collision, TrackCandidates const& tracks, aod::BCsWithTimestamps const&) + { + if (!eventSelection(collision)) { + return; + } + o2::aod::ITSResponse itsResponse; + for (auto& track : tracks) { + if (std::abs(track.eta()) > cfgCutEta || + track.itsNCls() < 7 || + track.itsChi2NCl() > 36.f || + itsResponse.nSigmaITS(track) < -1.) { + continue; + } + double expBethe{tpc::BetheBlochAleph(static_cast(track.tpcInnerParam() * 2. / o2::constants::physics::MassHelium3), cfgBetheBlochParams->get(4, 0u), cfgBetheBlochParams->get(4, 1u), cfgBetheBlochParams->get(4, 2u), cfgBetheBlochParams->get(4, 3u), cfgBetheBlochParams->get(4, 4u))}; + double expSigma{expBethe * cfgBetheBlochParams->get(4, 5u)}; + double nSigmaTPC{(track.tpcSignal() - expBethe) / expSigma}; + int iC = track.signed1Pt() > 0; + nuclei::hMatchingStudy[iC]->Fill(track.pt() * 2, track.phi(), track.eta(), itsResponse.nSigmaITS(track), nSigmaTPC, o2::pid::tof::Beta::GetBeta(track)); + } + } + + PROCESS_SWITCH(nucleiSpectra, processMatching, "Matching analysis", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx b/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx index 0d560ecde46..7dad8981ee7 100644 --- a/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx +++ b/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "Framework/runDataProcessing.h" @@ -75,6 +76,11 @@ struct threebodyKFTask { registry.add("hDalitzHypertriton", "Dalitz diagram", HistType::kTH2F, {axisM2PrPi, axisM2PiDe})->GetYaxis()->SetTitle("#it{m}^{2}(#pi^{-},d) ((GeV/#it{c}^{2})^{2})"); registry.add("hDalitzAntiHypertriton", "Dalitz diagram", HistType::kTH2F, {axisM2PrPi, axisM2PiDe})->GetXaxis()->SetTitle("#it{m}^{2}(#bar{p},#pi^{+}) ((GeV/#it{c}^{2})^{2})"); + // bachelor histgrams + registry.add("hAverageITSClusterSizeBachelor", "Average ITS cluster size bachelor track", HistType::kTH1F, {{15, 0.5, 15.5, "#langle ITS cluster size #rangle"}}); + registry.add("hdEdxBachelor", "TPC dE/dx bachelor track", HistType::kTH1F, {{200, 0.0f, 200.0f, "Average ITS cluster size"}}); + registry.add("hPIDTrackingBachelor", "Tracking PID bachelor track", HistType::kTH1F, {{20, 0.5, 20.5, "Tracking PID identifier"}}); + // for gen information of reco candidates auto LabelHist = registry.add("hLabelCounter", "Reco MC candidate counter", HistType::kTH1F, {{3, 0.0f, 3.0f}}); LabelHist->GetXaxis()->SetBinLabel(1, "Total"); @@ -99,8 +105,16 @@ struct threebodyKFTask { } template - void fillDalitzPlot(TCand const& vtx3body) + void fillQAPlots(TCand const& vtx3body) { + // Mass plot + if (vtx3body.track2sign() > 0) { // hypertriton + registry.fill(HIST("hMassHypertriton"), vtx3body.mass()); + } else if (vtx3body.track2sign() < 0) { // anti-hypertriton + registry.fill(HIST("hMassAntiHypertriton"), vtx3body.mass()); + } + + // Dalitz plot auto m2prpi = RecoDecay::m2(array{array{vtx3body.pxtrack0(), vtx3body.pytrack0(), vtx3body.pztrack0()}, array{vtx3body.pxtrack1(), vtx3body.pytrack1(), vtx3body.pztrack1()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); auto m2pide = RecoDecay::m2(array{array{vtx3body.pxtrack1(), vtx3body.pytrack1(), vtx3body.pztrack1()}, array{vtx3body.pxtrack2(), vtx3body.pytrack2(), vtx3body.pztrack2()}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); if (std::abs(vtx3body.mass() - o2::constants::physics::MassHyperTriton) <= 0.005) { @@ -110,16 +124,11 @@ struct threebodyKFTask { registry.fill(HIST("hDalitzAntiHypertriton"), m2prpi, m2pide); } } - } - template - void fillMassPlot(TCand const& vtx3body) - { - if (vtx3body.track2sign() > 0) { // hypertriton - registry.fill(HIST("hMassHypertriton"), vtx3body.mass()); - } else if (vtx3body.track2sign() < 0) { // anti-hypertriton - registry.fill(HIST("hMassAntiHypertriton"), vtx3body.mass()); - } + // ITS cluster sizes + registry.fill(HIST("hAverageITSClusterSizeBachelor"), vtx3body.itsclussizedeuteron()); + registry.fill(HIST("hdEdxBachelor"), vtx3body.tpcdedxdeuteron()); + registry.fill(HIST("hPIDTrackingBachelor"), vtx3body.pidtrackingdeuteron()); } //------------------------------------------------------------------ @@ -130,10 +139,8 @@ struct threebodyKFTask { registry.fill(HIST("hCentFT0C"), collision.centFT0C()); for (auto& vtx3bodydata : vtx3bodydatas) { - // inv mass spectrum - fillMassPlot(vtx3bodydata); - // Dalitz plot - fillDalitzPlot(vtx3bodydata); + // QA histograms + fillQAPlots(vtx3bodydata); } } PROCESS_SWITCH(threebodyKFTask, processData, "Data analysis", true); @@ -165,11 +172,8 @@ struct threebodyKFTask { for (auto& vtx3bodydata : Decay3BodyTable_thisCollision) { registry.fill(HIST("hLabelCounter"), 0.5); - // fill Dalitz plot for all reco candidates - fillDalitzPlot(vtx3bodydata); - - // fill inv mass spectrum for all reco candidates - fillMassPlot(vtx3bodydata); + // fill QA histograms for all reco candidates + fillQAPlots(vtx3bodydata); double MClifetime = -1.; bool isTrueH3L = false; @@ -182,6 +186,12 @@ struct threebodyKFTask { std::array genDecVtx{-1.f}; int vtx3bodyPDGcode = -1; double MCmassPrPi = -1.; + float genPosP = -1.; + float genPosPt = -1.; + float genNegP = -1.; + float genNegPt = -1.; + float genBachP = -1.; + float genBachPt = -1.; auto track0 = vtx3bodydata.track0_as(); auto track1 = vtx3bodydata.track1_as(); @@ -205,6 +215,12 @@ struct threebodyKFTask { genRap = MCvtx3body.y(); genP = MCvtx3body.p(); genPt = MCvtx3body.pt(); + genPosP = lMCTrack0.p(); + genPosPt = lMCTrack0.pt(); + genNegP = lMCTrack1.p(); + genNegPt = lMCTrack1.pt(); + genBachP = lMCTrack2.p(); + genBachPt = lMCTrack2.pt(); filledMothers.push_back(MCvtx3body.globalIndex()); } // end is H3L or Anti-H3L if (MCvtx3body.pdgCode() == motherPdgCode && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == bachelorPdgCode) { @@ -244,18 +260,24 @@ struct threebodyKFTask { vtx3bodydata.chi2geondf(), vtx3bodydata.chi2topondf(), vtx3bodydata.ctaukftopo(), vtx3bodydata.massv0(), vtx3bodydata.chi2massv0(), - vtx3bodydata.pxtrack0(), vtx3bodydata.pytrack0(), vtx3bodydata.pztrack0(), // proton - vtx3bodydata.pxtrack1(), vtx3bodydata.pytrack1(), vtx3bodydata.pztrack1(), // pion - vtx3bodydata.pxtrack2(), vtx3bodydata.pytrack2(), vtx3bodydata.pztrack2(), // deuteron - vtx3bodydata.dcatrack0topvkf(), vtx3bodydata.dcatrack1topvkf(), vtx3bodydata.dcatrack2topvkf(), // proton, pion, deuteron - vtx3bodydata.dcaxytrack0topvkf(), vtx3bodydata.dcaxytrack1topvkf(), vtx3bodydata.dcaxytrack2topvkf(), // proton, pion, deuteron - vtx3bodydata.dcaxytrack0tosvkf(), vtx3bodydata.dcaxytrack1tosvkf(), vtx3bodydata.dcaxytrack2tosvkf(), // proton, pion, deuteron + vtx3bodydata.cospav0(), + vtx3bodydata.pxtrack0(), vtx3bodydata.pytrack0(), vtx3bodydata.pztrack0(), // proton + vtx3bodydata.pxtrack1(), vtx3bodydata.pytrack1(), vtx3bodydata.pztrack1(), // pion + vtx3bodydata.pxtrack2(), vtx3bodydata.pytrack2(), vtx3bodydata.pztrack2(), // deuteron + vtx3bodydata.tpcinnerparamtrack0(), vtx3bodydata.tpcinnerparamtrack1(), vtx3bodydata.tpcinnerparamtrack2(), // proton, pion, deuteron + vtx3bodydata.dcatrack0topvkf(), vtx3bodydata.dcatrack1topvkf(), vtx3bodydata.dcatrack2topvkf(), // proton, pion, deuteron + vtx3bodydata.dcaxytrack0topvkf(), vtx3bodydata.dcaxytrack1topvkf(), vtx3bodydata.dcaxytrack2topvkf(), // proton, pion, deuteron + vtx3bodydata.dcaxytrack0tosvkf(), vtx3bodydata.dcaxytrack1tosvkf(), vtx3bodydata.dcaxytrack2tosvkf(), // proton, pion, deuteron vtx3bodydata.dcaxytrack0totrack1kf(), vtx3bodydata.dcaxytrack0totrack2kf(), vtx3bodydata.dcaxytrack1totrack2kf(), vtx3bodydata.dcavtxdaughterskf(), vtx3bodydata.dcaxytrackpostopv(), vtx3bodydata.dcaxytracknegtopv(), vtx3bodydata.dcaxytrackbachtopv(), vtx3bodydata.dcatrackpostopv(), vtx3bodydata.dcatracknegtopv(), vtx3bodydata.dcatrackbachtopv(), vtx3bodydata.track0sign(), vtx3bodydata.track1sign(), vtx3bodydata.track2sign(), // proton, pion, deuteron - vtx3bodydata.tpcnsigmaproton(), vtx3bodydata.tpcnsigmapion(), vtx3bodydata.tpcnsigmadeuteron(), + vtx3bodydata.tpcnsigmaproton(), vtx3bodydata.tpcnsigmapion(), vtx3bodydata.tpcnsigmadeuteron(), vtx3bodydata.tpcnsigmapionbach(), + vtx3bodydata.tpcdedxproton(), vtx3bodydata.tpcdedxpion(), vtx3bodydata.tpcdedxdeuteron(), + vtx3bodydata.tofnsigmadeuteron(), + vtx3bodydata.itsclussizedeuteron(), + vtx3bodydata.pidtrackingdeuteron(), // MC info (-1 if not matched to MC particle) genP, genPt, @@ -264,6 +286,7 @@ struct threebodyKFTask { genPhi, genEta, genRap, + genPosP, genPosPt, genNegP, genNegPt, genBachP, genBachPt, isTrueH3L, isTrueAntiH3L, vtx3bodyPDGcode, true, // is reconstructed @@ -278,6 +301,12 @@ struct threebodyKFTask { double genMCmassPrPi = -1.; bool isTrueGenH3L = false; bool isTrueGenAntiH3L = false; + float genPBach = -1.; + float genPtBach = -1.; + float genPPos = -1.; + float genPtPos = -1.; + float genPNeg = -1.; + float genPtNeg = -1.; // check if mcparticle was reconstructed and already filled in the table if (std::find(filledMothers.begin(), filledMothers.end(), mcparticle.globalIndex()) != std::end(filledMothers)) { @@ -317,8 +346,12 @@ struct threebodyKFTask { for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { if (mcparticleDaughter.pdgCode() == 2212) { protonMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; + genPPos = mcparticleDaughter.p(); + genPtPos = mcparticleDaughter.pt(); } else if (mcparticleDaughter.pdgCode() == -211) { piMinusMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; + genPNeg = mcparticleDaughter.p(); + genPtNeg = mcparticleDaughter.pt(); } } genMCmassPrPi = RecoDecay::m(array{protonMom, piMinusMom}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); @@ -333,8 +366,12 @@ struct threebodyKFTask { for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { if (mcparticleDaughter.pdgCode() == -2212) { antiProtonMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; + genPNeg = mcparticleDaughter.p(); + genPtNeg = mcparticleDaughter.pt(); } else if (mcparticleDaughter.pdgCode() == 211) { piPlusMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; + genPPos = mcparticleDaughter.p(); + genPtPos = mcparticleDaughter.pt(); } } genMCmassPrPi = RecoDecay::m(array{antiProtonMom, piPlusMom}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); @@ -350,6 +387,8 @@ struct threebodyKFTask { for (auto& mcDaughter : mcparticle.daughters_as()) { if (std::abs(mcDaughter.pdgCode()) == bachelorPdgCode) { genDecayVtx = {mcDaughter.vx(), mcDaughter.vy(), mcDaughter.vz()}; + genPBach = mcDaughter.p(); + genPtBach = mcDaughter.pt(); } } double genMClifetime = RecoDecay::sqrtSumOfSquares(genDecayVtx[0] - mcparticle.vx(), genDecayVtx[1] - mcparticle.vy(), genDecayVtx[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); @@ -367,6 +406,8 @@ struct threebodyKFTask { -1, -1, -1, -1, -1, + -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -378,7 +419,11 @@ struct threebodyKFTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, + -1, + -1, // gen information mcparticle.p(), mcparticle.pt(), @@ -387,6 +432,7 @@ struct threebodyKFTask { mcparticle.phi(), mcparticle.eta(), mcparticle.y(), + genPPos, genPtPos, genPNeg, genPtNeg, genPBach, genPtBach, isTrueGenH3L, isTrueGenAntiH3L, mcparticle.pdgCode(), false, // is reconstructed diff --git a/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx b/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx index 8a664195f92..624ab1efa1b 100644 --- a/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx @@ -9,12 +9,16 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// StoredVtx3BodyDatas analysis task -// ======================== +/// \file threebodyRecoTask.cxx +/// \brief Analysis task for 3-body decay process (now mainly for hypertriton) +/// \author Yuanzhe Wang #include #include #include +#include +#include +#include #include #include "Framework/runDataProcessing.h" @@ -32,11 +36,14 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" #include "CommonConstants/PhysicsConstants.h" +#include "CCDB/BasicCCDBManager.h" + +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using std::array; using FullTracksExtIU = soa::Join; using MCLabeledTracksIU = soa::Join; @@ -74,26 +81,33 @@ struct Candidate3body { bool isSignal = false; bool isReco = false; int pdgCode = -1; - bool SurvivedEventSelection = false; + bool survivedEventSelection = false; }; -struct threebodyRecoTask { +struct ThreebodyRecoTask { Produces outputDataTable; Produces outputMCTable; - std::vector Candidates3body; + std::vector candidates3body; std::vector filledMothers; std::vector isGoodCollision; + Service ccdb; + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + + //------------------------------------------------------------------ + Preslice perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; + // Selection criteria Configurable vtxcospa{"vtxcospa", 0.99, "Vtx CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) Configurable dcavtxdau{"dcavtxdau", 1.0, "DCA Vtx Daughters"}; // loose cut Configurable dcapiontopv{"dcapiontopv", .05, "DCA Pion To PV"}; Configurable etacut{"etacut", 0.9, "etacut"}; Configurable rapiditycut{"rapiditycut", 1, "rapiditycut"}; - Configurable TofPidNsigmaMin{"TofPidNsigmaMin", -5, "TofPidNsigmaMin"}; - Configurable TofPidNsigmaMax{"TofPidNsigmaMax", 5, "TofPidNsigmaMax"}; - Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; + Configurable tofPIDNSigmaMin{"tofPIDNSigmaMin", -5, "tofPIDNSigmaMin"}; + Configurable tofPIDNSigmaMax{"tofPIDNSigmaMax", 5, "tofPIDNSigmaMax"}; + Configurable tpcPIDNSigmaCut{"tpcPIDNSigmaCut", 5, "tpcPIDNSigmaCut"}; Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; Configurable mc_event_selection{"mc_event_selection", true, "mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder"}; Configurable event_posZ_selection{"event_posZ_selection", true, "event selection count post poZ cut"}; @@ -119,10 +133,22 @@ struct threebodyRecoTask { float lowersignallimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; float uppersignallimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; + // CCDB options + Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable pidPath{"pidPath", "", "Path to the PID response object"}; + + // Zorro counting + Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "Skimmed dataset processing"}; + HistogramRegistry registry{ "registry", { - {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{4, 0.0f, 4.0f}}}}, + {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, {"hCentFT0C", "hCentFT0C", {HistType::kTH1F, {{100, 0.0f, 100.0f, "FT0C Centrality"}}}}, {"hCandidatesCounter", "hCandidatesCounter", {HistType::kTH1F, {{12, 0.0f, 12.0f}}}}, {"hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, @@ -144,17 +170,17 @@ struct threebodyRecoTask { //------------------------------------------------------------------ // Fill stats histograms - enum vtxstep { kCandAll = 0, - kCandCosPA, + enum Vtxstep { kCandAll = 0, kCandDauEta, + kCandDauPt, + kCandTPCNcls, + kCandTPCPID, + kCandTOFPID, + kCandDcaToPV, kCandRapidity, kCandct, + kCandCosPA, kCandDcaDau, - kCandTOFPID, - kCandTPCPID, - kCandTPCNcls, - kCandDauPt, - kCandDcaToPV, kCandInvMass, kNCandSteps }; @@ -165,12 +191,12 @@ struct threebodyRecoTask { void resetHistos() { - for (Int_t ii = 0; ii < kNCandSteps; ii++) { + for (int ii = 0; ii < kNCandSteps; ii++) { statisticsRegistry.candstats[ii] = 0; statisticsRegistry.truecandstats[ii] = 0; } } - void FillCandCounter(int kn, bool istrue = false) + void fillCandCounter(int kn, bool istrue = false) { statisticsRegistry.candstats[kn]++; if (istrue) { @@ -179,7 +205,7 @@ struct threebodyRecoTask { } void fillHistos() { - for (Int_t ii = 0; ii < kNCandSteps; ii++) { + for (int ii = 0; ii < kNCandSteps; ii++) { registry.fill(HIST("hCandidatesCounter"), ii, statisticsRegistry.candstats[ii]); if (doprocessMC == true) { registry.fill(HIST("hTrueHypertritonCounter"), ii, statisticsRegistry.truecandstats[ii]); @@ -187,15 +213,24 @@ struct threebodyRecoTask { } } - ConfigurableAxis dcaBinning{"dca-binning", {200, 0.0f, 1.0f}, ""}; - ConfigurableAxis ptBinning{"pt-binning", {200, 0.0f, 10.0f}, ""}; + int mRunNumber; void init(InitContext const&) { + + zorroSummary.setObject(zorro.getZorroSummary()); + mRunNumber = 0; + + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(1, "total"); registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(2, "sel8"); registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(3, "vertexZ"); - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(4, "has Candidate"); + registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(4, "Zorro H3L 3body event"); + registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(5, "has Candidate"); // Check for selection criteria !!! TracksIU required !!! registry.add("hDiffRVtxProton", "hDiffRVtxProton", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of proton @@ -203,6 +238,10 @@ struct threebodyRecoTask { registry.add("hDiffRVtxDeuteron", "hDiffRVtxDeuteron", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of deuteron registry.add("hDiffDaughterR", "hDiffDaughterR", HistType::kTH1F, {{10000, -100, 100}}); // difference between minR of pion&proton and R of deuteron(bachelor) + if (doprocessDataLikeSign == true) { + registry.add("hCorrectMassHypertriton", "hCorrectMassHypertriton", HistType::kTH1F, {{80, 2.96f, 3.04f}}); // check if there are contamination of possible signals which are caused by unexpected PID + } + if (doprocessMC == true) { registry.add("hTrueHypertritonCounter", "hTrueHypertritonCounter", HistType::kTH1F, {{12, 0.0f, 12.0f}}); auto hGeneratedHypertritonCounter = registry.add("hGeneratedHypertritonCounter", "hGeneratedHypertritonCounter", HistType::kTH1F, {{2, 0.0f, 2.0f}}); @@ -218,18 +257,31 @@ struct threebodyRecoTask { registry.add("hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); } - TString CandCounterbinLabel[kNCandSteps] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID", "TPCNcls", "DauPt", "PionDcatoPV", "InvMass"}; + TString candCounterbinLabel[kNCandSteps] = {"Total", "TrackEta", "DauPt", "TPCNcls", "TPCPID", "d TOFPID", "PionDcatoPV", "MomRapidity", "Lifetime", "VtxCosPA", "VtxDcaDau", "InvMass"}; for (int i{0}; i < kNCandSteps; i++) { - registry.get(HIST("hCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); + registry.get(HIST("hCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, candCounterbinLabel[i]); if (doprocessMC == true) { - registry.get(HIST("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); + registry.get(HIST("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, candCounterbinLabel[i]); } } } + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + + if (cfgSkimmedProcessing) { + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), "fH3L3Body"); + zorro.populateHistRegistry(registry, bc.runNumber()); + } + + mRunNumber = bc.runNumber(); + } + //------------------------------------------------------------------ - Preslice perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; - //------------------------------------------------------------------ + // Check if the mcparticle is hypertriton which decays into 3 daughters template bool is3bodyDecayed(TMCParticle const& particle) { @@ -238,7 +290,7 @@ struct threebodyRecoTask { } bool haveProton = false, havePion = false, haveBachelor = false; bool haveAntiProton = false, haveAntiPion = false, haveAntiBachelor = false; - for (auto& mcparticleDaughter : particle.template daughters_as()) { + for (const auto& mcparticleDaughter : particle.template daughters_as()) { if (mcparticleDaughter.pdgCode() == 2212) haveProton = true; if (mcparticleDaughter.pdgCode() == -2212) @@ -261,104 +313,24 @@ struct threebodyRecoTask { } //------------------------------------------------------------------ - // Analysis process for a single candidate - template - void CandidateAnalysis(TCollisionTable const& dCollision, TCandTable const& candData, bool& if_hasvtx, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double MClifetime = -1) + // Fill candidate table + template + void fillCand(TCollisionTable const& collision, TCandTable const& candData, TTrackTable const& trackProton, TTrackTable const& trackPion, TTrackTable const& trackDeuteron, bool isMatter, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double MClifetime = -1) { - FillCandCounter(kCandAll, isTrueCand); - - auto track0 = candData.template track0_as(); - auto track1 = candData.template track1_as(); - auto track2 = candData.template track2_as(); - - auto& trackProton = (track2.sign() > 0) ? track0 : track1; - auto& trackPion = (track2.sign() > 0) ? track1 : track0; - auto& trackDeuteron = track2; - - double cospa = candData.vtxcosPA(dCollision.posX(), dCollision.posY(), dCollision.posZ()); - if (cospa < vtxcospa) { - return; - } - FillCandCounter(kCandCosPA, isTrueCand); - if (std::abs(trackProton.eta()) > etacut || std::abs(trackPion.eta()) > etacut || std::abs(trackDeuteron.eta()) > etacut) { - return; - } - FillCandCounter(kCandDauEta, isTrueCand); - if (std::abs(candData.yHypertriton()) > rapiditycut) { - return; - } - FillCandCounter(kCandRapidity, isTrueCand); - double ct = candData.distovertotmom(dCollision.posX(), dCollision.posY(), dCollision.posZ()) * o2::constants::physics::MassHyperTriton; - if (ct > lifetimecut) { - return; - } - FillCandCounter(kCandct, isTrueCand); - if (candData.dcaVtxdaughters() > dcavtxdau) { - return; - } - FillCandCounter(kCandDcaDau, isTrueCand); - - registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - if ((candData.tofNSigmaBachDe() < TofPidNsigmaMin || candData.tofNSigmaBachDe() > TofPidNsigmaMax) && trackDeuteron.p() > minDeuteronPUseTOF) { - return; - } - FillCandCounter(kCandTOFPID, isTrueCand); - registry.fill(HIST("hDeuteronTOFVsPAtferTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - - if (std::abs(trackProton.tpcNSigmaPr()) > TpcPidNsigmaCut || std::abs(trackPion.tpcNSigmaPi()) > TpcPidNsigmaCut || std::abs(trackDeuteron.tpcNSigmaDe()) > TpcPidNsigmaCut) { - return; - } - FillCandCounter(kCandTPCPID, isTrueCand); - - if (trackProton.tpcNClsFound() < mintpcNClsproton || trackPion.tpcNClsFound() < mintpcNClspion || trackDeuteron.tpcNClsFound() < mintpcNClsdeuteron) { - return; - } - FillCandCounter(kCandTPCNcls, isTrueCand); - - if (trackProton.pt() < minProtonPt || trackProton.pt() > maxProtonPt || trackPion.pt() < minPionPt || trackPion.pt() > maxPionPt || trackDeuteron.pt() < minDeuteronPt || trackDeuteron.pt() > maxDeuteronPt) { - return; - } - FillCandCounter(kCandDauPt, isTrueCand); - - double dcapion = (track2.sign() > 0) ? candData.dcatrack1topv() : candData.dcatrack0topv(); - if (std::abs(dcapion) < dcapiontopv) { - return; - } - FillCandCounter(kCandDcaToPV, isTrueCand); + double cospa = candData.vtxcosPA(collision.posX(), collision.posY(), collision.posZ()); + double ct = candData.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassHyperTriton; Candidate3body cand3body; - // Hypertriton - if ((track2.sign() > 0 && candData.mHypertriton() > h3LMassLowerlimit && candData.mHypertriton() < h3LMassUpperlimit)) { - FillCandCounter(kCandInvMass, isTrueCand); - - registry.fill(HIST("hMassHypertriton"), candData.mHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), candData.mHypertriton()); - - cand3body.isMatter = true; + cand3body.isMatter = isMatter; + if (isMatter == true) { cand3body.lproton.SetXYZM(candData.pxtrack0(), candData.pytrack0(), candData.pztrack0(), o2::constants::physics::MassProton); cand3body.lpion.SetXYZM(candData.pxtrack1(), candData.pytrack1(), candData.pztrack1(), o2::constants::physics::MassPionCharged); - - if (candData.mHypertriton() > lowersignallimit && candData.mHypertriton() < uppersignallimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(array{array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } - } else if ((track2.sign() < 0 && candData.mAntiHypertriton() > h3LMassLowerlimit && candData.mAntiHypertriton() < h3LMassUpperlimit)) { - // AntiHypertriton - FillCandCounter(kCandInvMass, isTrueCand); - cand3body.isMatter = false; + } else { cand3body.lproton.SetXYZM(candData.pxtrack1(), candData.pytrack1(), candData.pztrack1(), o2::constants::physics::MassPionCharged); cand3body.lpion.SetXYZM(candData.pxtrack0(), candData.pytrack0(), candData.pztrack0(), o2::constants::physics::MassProton); - - registry.fill(HIST("hMassAntiHypertriton"), candData.mAntiHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), candData.mAntiHypertriton()); - if (candData.mAntiHypertriton() > lowersignallimit && candData.mAntiHypertriton() < uppersignallimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(array{array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } - } else { - return; } - if_hasvtx = true; cand3body.mcmotherId = lLabel; cand3body.track0Id = candData.track0Id(); cand3body.track1Id = candData.track1Id(); @@ -368,7 +340,7 @@ struct threebodyRecoTask { cand3body.ct = ct; cand3body.cosPA = cospa; cand3body.dcadaughters = candData.dcaVtxdaughters(); - cand3body.dcacandtopv = candData.dcavtxtopv(dCollision.posX(), dCollision.posY(), dCollision.posZ()); + cand3body.dcacandtopv = candData.dcavtxtopv(collision.posX(), collision.posY(), collision.posZ()); cand3body.vtxradius = candData.vtxradius(); cand3body.lbachelor.SetXYZM(candData.pxtrack2(), candData.pytrack2(), candData.pztrack2(), o2::constants::physics::MassDeuteron); cand3body.dautpcNclusters[0] = trackProton.tpcNClsFound(); @@ -399,11 +371,11 @@ struct threebodyRecoTask { cand3body.isSignal = true; cand3body.isReco = true; cand3body.pdgCode = cand3body.isMatter ? motherPdgCode : -motherPdgCode; - cand3body.SurvivedEventSelection = true; + cand3body.survivedEventSelection = true; filledMothers.push_back(lLabel); } - Candidates3body.push_back(cand3body); + candidates3body.push_back(cand3body); registry.fill(HIST("hProtonTPCBB"), trackProton.sign() * trackProton.p(), trackProton.tpcSignal()); registry.fill(HIST("hPionTPCBB"), trackPion.sign() * trackPion.p(), trackPion.tpcSignal()); @@ -419,12 +391,149 @@ struct threebodyRecoTask { registry.fill(HIST("hDiffDaughterR"), diffTrackR); } + //------------------------------------------------------------------ + // Selections for candidates + template + bool selectCand(TCollisionTable const& collision, TCandTable const& candData, TTrackTable const& trackProton, TTrackTable const& trackPion, TTrackTable const& trackDeuteron, bool isMatter, bool isTrueCand = false) + { + fillCandCounter(kCandAll, isTrueCand); + + // Selection on daughters + if (std::abs(trackProton.eta()) > etacut || std::abs(trackPion.eta()) > etacut || std::abs(trackDeuteron.eta()) > etacut) { + return false; + } + fillCandCounter(kCandDauEta, isTrueCand); + + if (trackProton.pt() < minProtonPt || trackProton.pt() > maxProtonPt || trackPion.pt() < minPionPt || trackPion.pt() > maxPionPt || trackDeuteron.pt() < minDeuteronPt || trackDeuteron.pt() > maxDeuteronPt) { + return false; + } + fillCandCounter(kCandDauPt, isTrueCand); + + if (trackProton.tpcNClsFound() < mintpcNClsproton || trackPion.tpcNClsFound() < mintpcNClspion || trackDeuteron.tpcNClsFound() < mintpcNClsdeuteron) { + return false; + } + fillCandCounter(kCandTPCNcls, isTrueCand); + + if (std::abs(trackProton.tpcNSigmaPr()) > tpcPIDNSigmaCut || std::abs(trackPion.tpcNSigmaPi()) > tpcPIDNSigmaCut || std::abs(trackDeuteron.tpcNSigmaDe()) > tpcPIDNSigmaCut) { + return false; + } + fillCandCounter(kCandTPCPID, isTrueCand); + + registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); + if ((candData.tofNSigmaBachDe() < tofPIDNSigmaMin || candData.tofNSigmaBachDe() > tofPIDNSigmaMax) && trackDeuteron.p() > minDeuteronPUseTOF) { + return false; + } + fillCandCounter(kCandTOFPID, isTrueCand); + registry.fill(HIST("hDeuteronTOFVsPAtferTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); + + double dcapion = isMatter ? candData.dcatrack1topv() : candData.dcatrack0topv(); + if (std::abs(dcapion) < dcapiontopv) { + return false; + } + fillCandCounter(kCandDcaToPV, isTrueCand); + + // Selection on candidate hypertriton + if (std::abs(candData.yHypertriton()) > rapiditycut) { + return false; + } + fillCandCounter(kCandRapidity, isTrueCand); + + double ct = candData.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassHyperTriton; + if (ct > lifetimecut) { + return false; + } + fillCandCounter(kCandct, isTrueCand); + + double cospa = candData.vtxcosPA(collision.posX(), collision.posY(), collision.posZ()); + if (cospa < vtxcospa) { + return false; + } + fillCandCounter(kCandCosPA, isTrueCand); + + if (candData.dcaVtxdaughters() > dcavtxdau) { + return false; + } + fillCandCounter(kCandDcaDau, isTrueCand); + + if ((isMatter && candData.mHypertriton() > h3LMassLowerlimit && candData.mHypertriton() < h3LMassUpperlimit)) { + // Hypertriton + registry.fill(HIST("hMassHypertriton"), candData.mHypertriton()); + registry.fill(HIST("hMassHypertritonTotal"), candData.mHypertriton()); + if (candData.mHypertriton() > lowersignallimit && candData.mHypertriton() < uppersignallimit) { + registry.fill(HIST("hDalitz"), RecoDecay::m2(std::array{std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, std::array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(std::array{std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); + } + } else if ((!isMatter && candData.mAntiHypertriton() > h3LMassLowerlimit && candData.mAntiHypertriton() < h3LMassUpperlimit)) { + // AntiHypertriton + registry.fill(HIST("hMassAntiHypertriton"), candData.mAntiHypertriton()); + registry.fill(HIST("hMassHypertritonTotal"), candData.mAntiHypertriton()); + if (candData.mAntiHypertriton() > lowersignallimit && candData.mAntiHypertriton() < uppersignallimit) { + registry.fill(HIST("hDalitz"), RecoDecay::m2(std::array{std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, std::array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(std::array{std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); + } + } else { + return false; + } + fillCandCounter(kCandInvMass, isTrueCand); + + return true; + } + + //------------------------------------------------------------------ + // Analysis process for a single candidate + template + void candidateAnalysis(TCollisionTable const& collision, TCandTable const& candData, bool& if_hasvtx, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double MClifetime = -1) + { + + auto track0 = candData.template track0_as(); + auto track1 = candData.template track1_as(); + auto track2 = candData.template track2_as(); + + bool isMatter = track2.sign() > 0; // true if the candidate is hypertriton (p pi- d) + + auto& trackProton = isMatter ? track0 : track1; + auto& trackPion = isMatter ? track1 : track0; + auto& trackDeuteron = track2; + + if (selectCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand)) { + if_hasvtx = true; + fillCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand, lLabel, lmother, MClifetime); + } + } + + //------------------------------------------------------------------ + // Analysis process for like-sign background : (p pi- anti-d) or (anti-p pi+ d) + template + void likeSignAnalysis(TCollisionTable const& collision, TCandTable const& candData, bool& if_hasvtx, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double MClifetime = -1) + { + + auto track0 = candData.template track0_as(); + auto track1 = candData.template track1_as(); + auto track2 = candData.template track2_as(); + + bool isMatter = track2.sign() < 0; // true if seach for background consists of (p pi- anti-d) + + // Assume proton has an oppisite charge with deuteron + auto& trackProton = isMatter ? track0 : track1; + auto& trackPion = isMatter ? track1 : track0; + auto& trackDeuteron = track2; + + if (selectCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand)) { + if_hasvtx = true; + fillCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand, lLabel, lmother, MClifetime); + // QA for if signals have the possibility to be reconginzed as a like-sign background + if (isMatter) { + registry.fill(HIST("hCorrectMassHypertriton"), candData.mHypertriton()); + } else { + registry.fill(HIST("hCorrectMassHypertriton"), candData.mAntiHypertriton()); + } + } + } + //------------------------------------------------------------------ // collect information for generated hypertriton (should be called after event selection) - void GetGeneratedH3LInfo(aod::McParticles const& particlesMC) + void getGeneratedH3LInfo(aod::McParticles const& particlesMC) { - for (auto& mcparticle : particlesMC) { - if (mcparticle.pdgCode() != motherPdgCode && mcparticle.pdgCode() != -motherPdgCode) { + for (const auto& mcparticle : particlesMC) { + if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { continue; } registry.fill(HIST("hGeneratedHypertritonCounter"), 0.5); @@ -432,7 +541,7 @@ struct threebodyRecoTask { bool haveProton = false, havePionPlus = false, haveDeuteron = false; bool haveAntiProton = false, havePionMinus = false, haveAntiDeuteron = false; double MClifetime = -1; - for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { + for (const auto& mcparticleDaughter : mcparticle.template daughters_as()) { if (mcparticleDaughter.pdgCode() == 2212) haveProton = true; if (mcparticleDaughter.pdgCode() == -2212) @@ -468,32 +577,93 @@ struct threebodyRecoTask { //------------------------------------------------------------------ // process real data analysis - void processData(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& /*tracks*/) + void processData(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const&, aod::BCsWithTimestamps const&) + { + for (const auto& collision : collisions) { + candidates3body.clear(); + + auto bc = collision.bc_as(); + initCCDB(bc); + registry.fill(HIST("hEventCounter"), 0.5); + if (event_sel8_selection && !collision.sel8()) { + continue; + } + registry.fill(HIST("hEventCounter"), 1.5); + if (event_posZ_selection && std::abs(collision.posZ()) > 10.f) { // 10cm + continue; + } + registry.fill(HIST("hEventCounter"), 2.5); + registry.fill(HIST("hCentFT0C"), collision.centFT0C()); + + if (cfgSkimmedProcessing) { + bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting + if (zorroSelected) { + registry.fill(HIST("hEventCounter"), 3.5); + } + } + + bool if_hasvtx = false; + auto d3bodyCands = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); + for (const auto& vtx : d3bodyCands) { + candidateAnalysis(collision, vtx, if_hasvtx); + } + if (if_hasvtx) + registry.fill(HIST("hEventCounter"), 4.5); + fillHistos(); + resetHistos(); + + for (const auto& cand3body : candidates3body) { + outputDataTable(collision.centFT0C(), + cand3body.isMatter, cand3body.invmass, cand3body.lcand.P(), cand3body.lcand.Pt(), cand3body.ct, + cand3body.cosPA, cand3body.dcadaughters, cand3body.dcacandtopv, cand3body.vtxradius, + cand3body.lproton.Pt(), cand3body.lproton.Eta(), cand3body.lproton.Phi(), cand3body.dauinnermostR[0], + cand3body.lpion.Pt(), cand3body.lpion.Eta(), cand3body.lpion.Phi(), cand3body.dauinnermostR[1], + cand3body.lbachelor.Pt(), cand3body.lbachelor.Eta(), cand3body.lbachelor.Phi(), cand3body.dauinnermostR[2], + cand3body.dautpcNclusters[0], cand3body.dautpcNclusters[1], cand3body.dautpcNclusters[2], + cand3body.dauitsclussize[0], cand3body.dauitsclussize[1], cand3body.dauitsclussize[2], + cand3body.dautpcNsigma[0], cand3body.dautpcNsigma[1], cand3body.dautpcNsigma[2], cand3body.bachelortofNsigma, + cand3body.daudcaxytopv[0], cand3body.daudcaxytopv[1], cand3body.daudcaxytopv[2], + cand3body.daudcatopv[0], cand3body.daudcatopv[1], cand3body.daudcatopv[2]); + } + } + } + PROCESS_SWITCH(ThreebodyRecoTask, processData, "Real data reconstruction", true); + + //------------------------------------------------------------------ + // process like-sign signal + void processDataLikeSign(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& /*tracks*/) { - for (auto collision : collisions) { - Candidates3body.clear(); + for (const auto& collision : collisions) { + candidates3body.clear(); registry.fill(HIST("hEventCounter"), 0.5); if (event_sel8_selection && !collision.sel8()) { continue; } registry.fill(HIST("hEventCounter"), 1.5); - if (event_posZ_selection && abs(collision.posZ()) > 10.f) { // 10cm + if (event_posZ_selection && std::abs(collision.posZ()) > 10.f) { // 10cm continue; } registry.fill(HIST("hEventCounter"), 2.5); registry.fill(HIST("hCentFT0C"), collision.centFT0C()); + if (cfgSkimmedProcessing) { + bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting + if (zorroSelected) { + registry.fill(HIST("hEventCounter"), 3.5); + } + } + bool if_hasvtx = false; auto d3bodyCands = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); - for (auto vtx : d3bodyCands) { - CandidateAnalysis(collision, vtx, if_hasvtx); + for (const auto& vtx : d3bodyCands) { + likeSignAnalysis(collision, vtx, if_hasvtx); } if (if_hasvtx) - registry.fill(HIST("hEventCounter"), 3.5); + registry.fill(HIST("hEventCounter"), 4.5); fillHistos(); resetHistos(); - for (auto& cand3body : Candidates3body) { + for (const auto& cand3body : candidates3body) { outputDataTable(collision.centFT0C(), cand3body.isMatter, cand3body.invmass, cand3body.lcand.P(), cand3body.lcand.Pt(), cand3body.ct, cand3body.cosPA, cand3body.dcadaughters, cand3body.dcacandtopv, cand3body.vtxradius, @@ -508,27 +678,29 @@ struct threebodyRecoTask { } } } - PROCESS_SWITCH(threebodyRecoTask, processData, "Real data reconstruction", true); + PROCESS_SWITCH(ThreebodyRecoTask, processDataLikeSign, "Like-sign signal reconstruction", false); //------------------------------------------------------------------ // process mc analysis void processMC(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, aod::McParticles const& particlesMC, MCLabeledTracksIU const& /*tracks*/, aod::McCollisions const& mcCollisions) { filledMothers.clear(); - GetGeneratedH3LInfo(particlesMC); + getGeneratedH3LInfo(particlesMC); isGoodCollision.resize(mcCollisions.size(), false); for (const auto& collision : collisions) { - Candidates3body.clear(); + candidates3body.clear(); registry.fill(HIST("hEventCounter"), 0.5); if (mc_event_selection && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { continue; } registry.fill(HIST("hEventCounter"), 1.5); - if (event_posZ_selection && abs(collision.posZ()) > 10.f) { // 10cm + if (event_posZ_selection && std::abs(collision.posZ()) > 10.f) { // 10cm continue; } registry.fill(HIST("hEventCounter"), 2.5); + registry.fill(HIST("hCentFT0C"), collision.centFT0C()); + if (collision.mcCollisionId() >= 0) { isGoodCollision[collision.mcCollisionId()] = true; } @@ -536,7 +708,7 @@ struct threebodyRecoTask { bool if_hasvtx = false; auto vtxsthiscol = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); - for (auto& vtx : vtxsthiscol) { + for (const auto& vtx : vtxsthiscol) { int lLabel = -1; int lPDG = -1; double MClifetime = -1; @@ -550,9 +722,9 @@ struct threebodyRecoTask { auto lMCTrack1 = track1.mcParticle_as(); auto lMCTrack2 = track2.mcParticle_as(); if (lMCTrack0.has_mothers() && lMCTrack1.has_mothers() && lMCTrack2.has_mothers()) { - for (auto& lMother0 : lMCTrack0.mothers_as()) { - for (auto& lMother1 : lMCTrack1.mothers_as()) { - for (auto& lMother2 : lMCTrack2.mothers_as()) { + for (const auto& lMother0 : lMCTrack0.mothers_as()) { + for (const auto& lMother1 : lMCTrack1.mothers_as()) { + for (const auto& lMother2 : lMCTrack2.mothers_as()) { if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { lLabel = lMother0.globalIndex(); lPDG = lMother0.pdgCode(); @@ -569,15 +741,15 @@ struct threebodyRecoTask { } } - CandidateAnalysis(collision, vtx, if_hasvtx, isTrueCand, lLabel, lmother, MClifetime); + candidateAnalysis(collision, vtx, if_hasvtx, isTrueCand, lLabel, lmother, MClifetime); } if (if_hasvtx) - registry.fill(HIST("hEventCounter"), 3.5); + registry.fill(HIST("hEventCounter"), 4.5); fillHistos(); resetHistos(); - for (auto& cand3body : Candidates3body) { + for (const auto& cand3body : candidates3body) { outputMCTable(collision.centFT0C(), cand3body.isMatter, cand3body.invmass, cand3body.lcand.P(), cand3body.lcand.Pt(), cand3body.ct, cand3body.cosPA, cand3body.dcadaughters, cand3body.dcacandtopv, cand3body.vtxradius, @@ -590,12 +762,12 @@ struct threebodyRecoTask { cand3body.daudcaxytopv[0], cand3body.daudcaxytopv[1], cand3body.daudcaxytopv[2], cand3body.daudcatopv[0], cand3body.daudcatopv[1], cand3body.daudcatopv[2], cand3body.lgencand.P(), cand3body.lgencand.Pt(), cand3body.genct, cand3body.lgencand.Phi(), cand3body.lgencand.Eta(), cand3body.lgencand.Rapidity(), - cand3body.isSignal, cand3body.isReco, cand3body.pdgCode, cand3body.SurvivedEventSelection); + cand3body.isSignal, cand3body.isReco, cand3body.pdgCode, cand3body.survivedEventSelection); } } // now we fill only the signal candidates that were not reconstructed - for (auto& mcparticle : particlesMC) { + for (const auto& mcparticle : particlesMC) { if (!is3bodyDecayed(mcparticle)) { continue; } @@ -604,7 +776,7 @@ struct threebodyRecoTask { } bool isSurEvSelection = isGoodCollision[mcparticle.mcCollisionId()]; std::array posSV{0.f}; - for (auto& mcDaughter : mcparticle.daughters_as()) { + for (const auto& mcDaughter : mcparticle.daughters_as()) { if (std::abs(mcDaughter.pdgCode()) == bachelorPdgCode) { posSV = {mcDaughter.vx(), mcDaughter.vy(), mcDaughter.vz()}; } @@ -625,12 +797,12 @@ struct threebodyRecoTask { true, false, mcparticle.pdgCode(), isSurEvSelection); } } - PROCESS_SWITCH(threebodyRecoTask, processMC, "MC reconstruction", false); + PROCESS_SWITCH(ThreebodyRecoTask, processMC, "MC reconstruction", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), }; } diff --git a/PWGLF/TableProducer/Resonances/CMakeLists.txt b/PWGLF/TableProducer/Resonances/CMakeLists.txt index baa9b98325a..785dbdf3828 100644 --- a/PWGLF/TableProducer/Resonances/CMakeLists.txt +++ b/PWGLF/TableProducer/Resonances/CMakeLists.txt @@ -17,7 +17,7 @@ o2physics_add_dpl_workflow(f1protoninitializer o2physics_add_dpl_workflow(f1protonreducedtable SOURCES f1protonreducedtable.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(filterf1proton @@ -25,8 +25,13 @@ o2physics_add_dpl_workflow(filterf1proton PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(reso2initializer - SOURCES LFResonanceInitializer.cxx +o2physics_add_dpl_workflow(resonance-initializer + SOURCES resonanceInitializer.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(resonance-module-initializer + SOURCES resonanceModuleInitializer.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Resonances/LFResonanceMergeDF.cxx b/PWGLF/TableProducer/Resonances/LFResonanceMergeDF.cxx index 9668afc3e01..9850a7bf23a 100644 --- a/PWGLF/TableProducer/Resonances/LFResonanceMergeDF.cxx +++ b/PWGLF/TableProducer/Resonances/LFResonanceMergeDF.cxx @@ -25,6 +25,7 @@ /// /// /// \author Bong-Hwi Lim /// Nasir Mehdi Malik +#include #include "Common/DataModel/PIDResponse.h" #include "Common/Core/TrackSelection.h" @@ -60,7 +61,6 @@ using namespace o2::soa; struct reso2dfmerged { // SliceCache cache; - Configurable nDF{"nDF", 1, "no of combination of collision"}; Configurable cpidCut{"cpidCut", 0, "pid cut"}; Configurable crejtpc{"crejtpc", 0, "reject electron pion"}; @@ -184,7 +184,7 @@ struct reso2dfmerged { const auto& innerVector = vecOfVecOfTuples[i]; histos.fill(HIST("Event/h1d_ft0_mult_percentile"), std::get<3>(tuple)); - resoCollisionsdf(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple), std::get<3>(tuple), std::get<4>(tuple), std::get<5>(tuple), 0., 0., 0., 0, 0); + resoCollisionsdf(0, std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple), std::get<3>(tuple), std::get<4>(tuple), std::get<5>(tuple), 0., 0., 0., 0., 0, collision.trackOccupancyInTimeRange()); // LOGF(info, "collisions: Index = %d ) %f - %f - %f %f %d -- %d", std::get<0>(tuple).globalIndex(),std::get<1>(tuple),std::get<2>(tuple), std::get<3>(tuple), std::get<4>(tuple), std::get<5>(tuple).size(),resoCollisionsdf.lastIndex()); for (const auto& tuple : innerVector) { @@ -239,9 +239,10 @@ struct reso2dfmerged { if (doprocessTrackDataDF) LOG(fatal) << "Disable processTrackDataDF first!"; + histos.fill(HIST("Event/h1d_ft0_mult_percentile"), collision.cent()); - resoCollisionsdf(collision.posX(), collision.posY(), collision.posZ(), collision.cent(), collision.spherocity(), collision.evtPl(), 0., 0., 0., 0., 0); + resoCollisionsdf(0, collision.posX(), collision.posY(), collision.posZ(), collision.cent(), collision.spherocity(), collision.evtPl(), 0., 0., 0., 0., 0, collision.trackOccupancyInTimeRange()); for (auto& track : tracks) { if (isPrimary && !track.isPrimaryTrack()) diff --git a/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx b/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx index 30082692386..87fcc6ab1d5 100644 --- a/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx +++ b/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx @@ -25,6 +25,10 @@ #include #include #include +#include + +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" #include "PWGLF/DataModel/ReducedF1ProtonTables.h" #include "Framework/ASoAHelpers.h" @@ -57,6 +61,9 @@ struct f1protonreducedtable { Service ccdb; o2::ccdb::CcdbApi ccdbApi; + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + // Configs for events Configurable ConfEvtSelectZvtx{"ConfEvtSelectZvtx", true, "Event selection includes max. z-Vertex"}; Configurable ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; @@ -66,6 +73,7 @@ struct f1protonreducedtable { Configurable trackSphMin{"trackSphMin", 10, "Number of tracks for Spherocity Calculation"}; // Configs for track PID + Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", true, "Analysed skimmed events"}; Configurable ConfUseManualPIDproton{"ConfUseManualPIDproton", true, "True: use home-made PID solution for proton "}; Configurable ConfUseManualPIDkaon{"ConfUseManualPIDkaon", true, "True: use home-made PID solution for kaon "}; Configurable ConfUseManualPIDpion{"ConfUseManualPIDpion", true, "True: use home-made PID solution for pion "}; @@ -135,6 +143,7 @@ struct f1protonreducedtable { Configurable cMaxRelMom{"cMaxRelMom", 0.5, "Relative momentum cut"}; // Histogram + OutputObj hProcessedEvents{TH1D("hProcessedEvents", ";; Number of events", 2, 0.0f, 2.0f)}; HistogramRegistry qaRegistry{"QAHistos", { {"hEventstat", "hEventstat", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, {"hInvMassf1", "hInvMassf1", {HistType::kTH2F, {{400, 1.1f, 1.9f}, {100, 0.0f, 10.0f}}}}, @@ -163,6 +172,9 @@ struct f1protonreducedtable { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + zorroSummary.setObject(zorro.getZorroSummary()); + hProcessedEvents->GetXaxis()->SetBinLabel(1, "All Trigger events"); + hProcessedEvents->GetXaxis()->SetBinLabel(2, "Events with F1 Trigger"); } template @@ -535,10 +547,15 @@ struct f1protonreducedtable { currentRunNumber = collision.bc_as().runNumber(); auto bc = collision.bc_as(); - + hProcessedEvents->Fill(0.5); + bool zorroSelected = false; if (isSelectedEvent(collision)) { - if (ConfUseManualPIDproton || ConfUseManualPIDkaon || ConfUseManualPIDpion) { - if (currentRunNumber != lastRunNumber) { + if (currentRunNumber != lastRunNumber) { + if (cfgSkimmedProcessing) { + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), "fTriggerEventF1Proton"); + zorro.populateHistRegistry(qaRegistry, bc.runNumber()); + } + if (ConfUseManualPIDproton || ConfUseManualPIDkaon || ConfUseManualPIDpion) { if (ConfUseManualPIDproton) { BBProton = setValuesBB(ccdbApi, bc, ConfPIDBBProton); BBAntiproton = setValuesBB(ccdbApi, bc, ConfPIDBBAntiProton); @@ -551,201 +568,208 @@ struct f1protonreducedtable { BBKaon = setValuesBB(ccdbApi, bc, ConfPIDBBKaon); BBAntikaon = setValuesBB(ccdbApi, bc, ConfPIDBBAntiKaon); } - lastRunNumber = currentRunNumber; } + lastRunNumber = currentRunNumber; } - - for (auto& track : tracks) { - - if (!isSelectedTrack(track)) - continue; - qaRegistry.fill(HIST("hDCAxy"), track.dcaXY()); - qaRegistry.fill(HIST("hDCAz"), track.dcaZ()); - qaRegistry.fill(HIST("hEta"), track.eta()); - qaRegistry.fill(HIST("hPhi"), track.phi()); - double nTPCSigmaP[3]{track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; - double nTPCSigmaN[3]{track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; - if (ConfUseManualPIDproton) { - auto bgScalingProton = 1 / massPr; // momentum scaling? - if (BBProton.size() == 6) - nTPCSigmaP[2] = updatePID(track, bgScalingProton, BBProton); - if (BBAntiproton.size() == 6) - nTPCSigmaN[2] = updatePID(track, bgScalingProton, BBAntiproton); - } - if (ConfUseManualPIDkaon) { - auto bgScalingKaon = 1 / massKa; // momentum scaling? - if (BBKaon.size() == 6) - nTPCSigmaP[1] = updatePID(track, bgScalingKaon, BBKaon); - if (BBAntikaon.size() == 6) - nTPCSigmaN[1] = updatePID(track, bgScalingKaon, BBAntikaon); - } - if (ConfUseManualPIDpion) { - auto bgScalingPion = 1 / massPi; // momentum scaling? - if (BBPion.size() == 6) - nTPCSigmaP[0] = updatePID(track, bgScalingPion, BBPion); - if (BBAntipion.size() == 6) - nTPCSigmaN[0] = updatePID(track, bgScalingPion, BBAntipion); - } - - if ((track.sign() > 0 && SelectionPID(track, strategyPIDPion, 0, nTPCSigmaP[0])) || (track.sign() < 0 && SelectionPID(track, strategyPIDPion, 0, nTPCSigmaN[0]))) { - ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), massPi); - pions.push_back(temp); - PionIndex.push_back(track.globalIndex()); - PionCharge.push_back(track.sign()); - auto PionTOF = 0; - if (track.sign() > 0) { - qaRegistry.fill(HIST("hNsigmaPtpionTPC"), nTPCSigmaP[0], track.pt()); + if (cfgSkimmedProcessing) { + zorroSelected = zorro.isSelected(collision.template bc_as().globalBC()); + } else { + zorroSelected = true; + } + if (zorroSelected) { + for (auto& track : tracks) { + hProcessedEvents->Fill(1.5); + if (!isSelectedTrack(track)) + continue; + qaRegistry.fill(HIST("hDCAxy"), track.dcaXY()); + qaRegistry.fill(HIST("hDCAz"), track.dcaZ()); + qaRegistry.fill(HIST("hEta"), track.eta()); + qaRegistry.fill(HIST("hPhi"), track.phi()); + double nTPCSigmaP[3]{track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + double nTPCSigmaN[3]{track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + if (ConfUseManualPIDproton) { + auto bgScalingProton = 1 / massPr; // momentum scaling? + if (BBProton.size() == 6) + nTPCSigmaP[2] = updatePID(track, bgScalingProton, BBProton); + if (BBAntiproton.size() == 6) + nTPCSigmaN[2] = updatePID(track, bgScalingProton, BBAntiproton); } - if (track.sign() < 0) { - qaRegistry.fill(HIST("hNsigmaPtpionTPC"), nTPCSigmaN[0], track.pt()); + if (ConfUseManualPIDkaon) { + auto bgScalingKaon = 1 / massKa; // momentum scaling? + if (BBKaon.size() == 6) + nTPCSigmaP[1] = updatePID(track, bgScalingKaon, BBKaon); + if (BBAntikaon.size() == 6) + nTPCSigmaN[1] = updatePID(track, bgScalingKaon, BBAntikaon); } - if (track.hasTOF()) { - qaRegistry.fill(HIST("hNsigmaPtpionTOF"), track.tofNSigmaPi(), track.pt()); - PionTOF = 1; + if (ConfUseManualPIDpion) { + auto bgScalingPion = 1 / massPi; // momentum scaling? + if (BBPion.size() == 6) + nTPCSigmaP[0] = updatePID(track, bgScalingPion, BBPion); + if (BBAntipion.size() == 6) + nTPCSigmaN[0] = updatePID(track, bgScalingPion, BBAntipion); } - PionTOFHit.push_back(PionTOF); - } - if ((track.pt() > cMinKaonPt && track.sign() > 0 && SelectionPID(track, strategyPIDKaon, 1, nTPCSigmaP[1])) || (track.pt() > cMinKaonPt && track.sign() < 0 && SelectionPID(track, strategyPIDKaon, 1, nTPCSigmaN[1]))) { - ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), massKa); - kaons.push_back(temp); - KaonIndex.push_back(track.globalIndex()); - KaonCharge.push_back(track.sign()); - auto KaonTOF = 0; - if (track.sign() > 0) { - qaRegistry.fill(HIST("hNsigmaPtkaonTPC"), nTPCSigmaP[1], track.pt()); + if ((track.sign() > 0 && SelectionPID(track, strategyPIDPion, 0, nTPCSigmaP[0])) || (track.sign() < 0 && SelectionPID(track, strategyPIDPion, 0, nTPCSigmaN[0]))) { + ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), massPi); + pions.push_back(temp); + PionIndex.push_back(track.globalIndex()); + PionCharge.push_back(track.sign()); + auto PionTOF = 0; + if (track.sign() > 0) { + qaRegistry.fill(HIST("hNsigmaPtpionTPC"), nTPCSigmaP[0], track.pt()); + } + if (track.sign() < 0) { + qaRegistry.fill(HIST("hNsigmaPtpionTPC"), nTPCSigmaN[0], track.pt()); + } + if (track.hasTOF()) { + qaRegistry.fill(HIST("hNsigmaPtpionTOF"), track.tofNSigmaPi(), track.pt()); + PionTOF = 1; + } + PionTOFHit.push_back(PionTOF); } - if (track.sign() < 0) { - qaRegistry.fill(HIST("hNsigmaPtkaonTPC"), nTPCSigmaN[1], track.pt()); + + if ((track.pt() > cMinKaonPt && track.sign() > 0 && SelectionPID(track, strategyPIDKaon, 1, nTPCSigmaP[1])) || (track.pt() > cMinKaonPt && track.sign() < 0 && SelectionPID(track, strategyPIDKaon, 1, nTPCSigmaN[1]))) { + ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), massKa); + kaons.push_back(temp); + KaonIndex.push_back(track.globalIndex()); + KaonCharge.push_back(track.sign()); + auto KaonTOF = 0; + if (track.sign() > 0) { + qaRegistry.fill(HIST("hNsigmaPtkaonTPC"), nTPCSigmaP[1], track.pt()); + } + if (track.sign() < 0) { + qaRegistry.fill(HIST("hNsigmaPtkaonTPC"), nTPCSigmaN[1], track.pt()); + } + if (track.hasTOF()) { + qaRegistry.fill(HIST("hNsigmaPtkaonTOF"), track.tofNSigmaKa(), track.pt()); + KaonTOF = 1; + } + KaonTOFHit.push_back(KaonTOF); } - if (track.hasTOF()) { - qaRegistry.fill(HIST("hNsigmaPtkaonTOF"), track.tofNSigmaKa(), track.pt()); - KaonTOF = 1; + + if ((track.pt() < cMaxProtonPt && track.sign() > 0 && SelectionPID(track, strategyPIDProton, 2, nTPCSigmaP[2])) || (track.pt() < cMaxProtonPt && track.sign() < 0 && SelectionPID(track, strategyPIDProton, 2, nTPCSigmaN[2]))) { + ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), massPr); + protons.push_back(temp); + ProtonIndex.push_back(track.globalIndex()); + ProtonCharge.push_back(track.sign()); + if (track.sign() > 0) { + qaRegistry.fill(HIST("hNsigmaPtprotonTPC"), nTPCSigmaP[2], track.pt()); + ProtonTPCNsigma.push_back(nTPCSigmaP[2]); + } + if (track.sign() < 0) { + qaRegistry.fill(HIST("hNsigmaPtprotonTPC"), nTPCSigmaN[2], track.pt()); + ProtonTPCNsigma.push_back(nTPCSigmaN[2]); + } + if (track.hasTOF()) { + qaRegistry.fill(HIST("hNsigmaPtprotonTOF"), track.tofNSigmaPr(), track.pt()); + ProtonTOFNsigma.push_back(track.tofNSigmaPr()); + ProtonTOFHit.push_back(1); + } + if (!track.hasTOF()) { + ProtonTOFNsigma.push_back(999.0); + ProtonTOFHit.push_back(0); + } } - KaonTOFHit.push_back(KaonTOF); - } + } // track loop end + for (auto& v0 : V0s) { - if ((track.pt() < cMaxProtonPt && track.sign() > 0 && SelectionPID(track, strategyPIDProton, 2, nTPCSigmaP[2])) || (track.pt() < cMaxProtonPt && track.sign() < 0 && SelectionPID(track, strategyPIDProton, 2, nTPCSigmaN[2]))) { - ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), massPr); - protons.push_back(temp); - ProtonIndex.push_back(track.globalIndex()); - ProtonCharge.push_back(track.sign()); - if (track.sign() > 0) { - qaRegistry.fill(HIST("hNsigmaPtprotonTPC"), nTPCSigmaP[2], track.pt()); - ProtonTPCNsigma.push_back(nTPCSigmaP[2]); + if (!SelectionV0(collision, v0)) { + continue; } - if (track.sign() < 0) { - qaRegistry.fill(HIST("hNsigmaPtprotonTPC"), nTPCSigmaN[2], track.pt()); - ProtonTPCNsigma.push_back(nTPCSigmaN[2]); + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); + double nTPCSigmaPos[1]{postrack.tpcNSigmaPi()}; + double nTPCSigmaNeg[1]{negtrack.tpcNSigmaPi()}; + if (ConfUseManualPIDdaughterPion) { + auto bgScalingPion = 1 / massPi; // momentum scaling? + if (BBPion.size() == 6) + nTPCSigmaPos[0] = updatePID(postrack, bgScalingPion, BBPion); + if (BBAntipion.size() == 6) + nTPCSigmaNeg[0] = updatePID(negtrack, bgScalingPion, BBAntipion); } - if (track.hasTOF()) { - qaRegistry.fill(HIST("hNsigmaPtprotonTOF"), track.tofNSigmaPr(), track.pt()); - ProtonTOFNsigma.push_back(track.tofNSigmaPr()); - ProtonTOFHit.push_back(1); + if (!isSelectedV0Daughter(postrack, 1, nTPCSigmaPos[0])) { + continue; } - if (!track.hasTOF()) { - ProtonTOFNsigma.push_back(999.0); - ProtonTOFHit.push_back(0); + if (!isSelectedV0Daughter(negtrack, -1, nTPCSigmaNeg[0])) { + continue; } + qaRegistry.fill(HIST("hInvMassk0"), v0.mK0Short(), v0.pt()); + ROOT::Math::PtEtaPhiMVector temp(v0.pt(), v0.eta(), v0.phi(), massK0s); + kshorts.push_back(temp); + KshortPosDaughIndex.push_back(postrack.globalIndex()); + KshortNegDaughIndex.push_back(negtrack.globalIndex()); } - } // track loop end - for (auto& v0 : V0s) { - - if (!SelectionV0(collision, v0)) { - continue; - } - auto postrack = v0.template posTrack_as(); - auto negtrack = v0.template negTrack_as(); - double nTPCSigmaPos[1]{postrack.tpcNSigmaPi()}; - double nTPCSigmaNeg[1]{negtrack.tpcNSigmaPi()}; - if (ConfUseManualPIDdaughterPion) { - auto bgScalingPion = 1 / massPi; // momentum scaling? - if (BBPion.size() == 6) - nTPCSigmaPos[0] = updatePID(postrack, bgScalingPion, BBPion); - if (BBAntipion.size() == 6) - nTPCSigmaNeg[0] = updatePID(negtrack, bgScalingPion, BBAntipion); - } - if (!isSelectedV0Daughter(postrack, 1, nTPCSigmaPos[0])) { - continue; - } - if (!isSelectedV0Daughter(negtrack, -1, nTPCSigmaNeg[0])) { - continue; - } - qaRegistry.fill(HIST("hInvMassk0"), v0.mK0Short(), v0.pt()); - ROOT::Math::PtEtaPhiMVector temp(v0.pt(), v0.eta(), v0.phi(), massK0s); - kshorts.push_back(temp); - KshortPosDaughIndex.push_back(postrack.globalIndex()); - KshortNegDaughIndex.push_back(negtrack.globalIndex()); - } - if (pions.size() != 0 && kaons.size() != 0 && kshorts.size() != 0) { - for (auto ipion = pions.begin(); ipion != pions.end(); ++ipion) { - for (auto ikaon = kaons.begin(); ikaon != kaons.end(); ++ikaon) { - auto i1 = std::distance(pions.begin(), ipion); - auto i2 = std::distance(kaons.begin(), ikaon); - if (PionIndex.at(i1) == KaonIndex.at(i2)) - continue; - for (auto ikshort = kshorts.begin(); ikshort != kshorts.end(); ++ikshort) { - auto i3 = std::distance(kshorts.begin(), ikshort); - if (PionIndex.at(i1) == KshortPosDaughIndex.at(i3)) - continue; - if (PionIndex.at(i1) == KshortNegDaughIndex.at(i3)) - continue; - KKs0Vector = kaons.at(i2) + kshorts.at(i3); - if (KKs0Vector.M() > cMaxMassKKs0) + if (pions.size() != 0 && kaons.size() != 0 && kshorts.size() != 0) { + for (auto ipion = pions.begin(); ipion != pions.end(); ++ipion) { + for (auto ikaon = kaons.begin(); ikaon != kaons.end(); ++ikaon) { + auto i1 = std::distance(pions.begin(), ipion); + auto i2 = std::distance(kaons.begin(), ikaon); + if (PionIndex.at(i1) == KaonIndex.at(i2)) continue; - F1Vector = KKs0Vector + pions.at(i1); - if (F1Vector.M() > cMaxMassF1) - continue; - if (F1Vector.Pt() < cMinF1Pt) - continue; - - // check if the pair is unlike or wrongsign - auto pairsign = 1; - if (PionCharge.at(i1) * KaonCharge.at(i2) > 0) { - qaRegistry.fill(HIST("hInvMassf1Like"), F1Vector.M(), F1Vector.Pt()); - pairsign = -1; - } - ROOT::Math::PtEtaPhiMVector temp(F1Vector.Pt(), F1Vector.Eta(), F1Vector.Phi(), F1Vector.M()); - f1resonance.push_back(temp); - f1resonanced1.push_back(pions.at(i1)); - f1resonanced2.push_back(kaons.at(i2)); - f1resonanced3.push_back(kshorts.at(i3)); - f1signal.push_back(pairsign); - f1kaonkshortmass.push_back(KKs0Vector.M()); - F1PionIndex.push_back(PionIndex.at(i1)); - F1KaonIndex.push_back(KaonIndex.at(i2)); - F1KshortDaughterPositiveIndex.push_back(KshortPosDaughIndex.at(i3)); - F1KshortDaughterNegativeIndex.push_back(KshortNegDaughIndex.at(i3)); - PionTOFHitFinal.push_back(PionTOFHit.at(i1)); // Pion TOF Hit - KaonTOFHitFinal.push_back(KaonTOFHit.at(i2)); // Kaon TOF Hit - if (pairsign == 1) { - qaRegistry.fill(HIST("hInvMassf1"), F1Vector.M(), F1Vector.Pt()); - numberF1 = numberF1 + 1; - for (auto iproton = protons.begin(); iproton != protons.end(); ++iproton) { - auto i4 = std::distance(protons.begin(), iproton); - ProtonVectorDummy = protons.at(i4); - if (numberF1 == 1) { - //////////// Fill final proton information after pairing////////// - ROOT::Math::PtEtaPhiMVector temp(ProtonVectorDummy.Pt(), ProtonVectorDummy.Eta(), ProtonVectorDummy.Phi(), massPr); - protonsfinal.push_back(temp); // 4 vector - ProtonChargeFinal.push_back(ProtonCharge.at(i4)); // Charge - ProtonTOFHitFinal.push_back(ProtonTOFHit.at(i4)); // TOF Hit - ProtonTOFNsigmaFinal.push_back(ProtonTOFNsigma.at(i4)); // Nsigma TOF - ProtonTPCNsigmaFinal.push_back(ProtonTPCNsigma.at(i4)); // Nsigma TPC - F1ProtonIndex.push_back(ProtonIndex.at(i4)); // proton index for share track - } - - if ((ProtonIndex.at(i4) == PionIndex.at(i1)) || (ProtonIndex.at(i4) == KaonIndex.at(i2)) || (ProtonIndex.at(i4) == KshortPosDaughIndex.at(i3)) || (ProtonIndex.at(i4) == KshortNegDaughIndex.at(i3))) { - continue; + for (auto ikshort = kshorts.begin(); ikshort != kshorts.end(); ++ikshort) { + auto i3 = std::distance(kshorts.begin(), ikshort); + if (PionIndex.at(i1) == KshortPosDaughIndex.at(i3)) + continue; + if (PionIndex.at(i1) == KshortNegDaughIndex.at(i3)) + continue; + KKs0Vector = kaons.at(i2) + kshorts.at(i3); + if (KKs0Vector.M() > cMaxMassKKs0) + continue; + F1Vector = KKs0Vector + pions.at(i1); + if (F1Vector.M() > cMaxMassF1) + continue; + if (F1Vector.Pt() < cMinF1Pt) + continue; + + // check if the pair is unlike or wrongsign + auto pairsign = 1; + if (PionCharge.at(i1) * KaonCharge.at(i2) > 0) { + qaRegistry.fill(HIST("hInvMassf1Like"), F1Vector.M(), F1Vector.Pt()); + pairsign = -1; + } + ROOT::Math::PtEtaPhiMVector temp(F1Vector.Pt(), F1Vector.Eta(), F1Vector.Phi(), F1Vector.M()); + f1resonance.push_back(temp); + f1resonanced1.push_back(pions.at(i1)); + f1resonanced2.push_back(kaons.at(i2)); + f1resonanced3.push_back(kshorts.at(i3)); + f1signal.push_back(pairsign); + f1kaonkshortmass.push_back(KKs0Vector.M()); + F1PionIndex.push_back(PionIndex.at(i1)); + F1KaonIndex.push_back(KaonIndex.at(i2)); + F1KshortDaughterPositiveIndex.push_back(KshortPosDaughIndex.at(i3)); + F1KshortDaughterNegativeIndex.push_back(KshortNegDaughIndex.at(i3)); + PionTOFHitFinal.push_back(PionTOFHit.at(i1)); // Pion TOF Hit + KaonTOFHitFinal.push_back(KaonTOFHit.at(i2)); // Kaon TOF Hit + if (pairsign == 1) { + qaRegistry.fill(HIST("hInvMassf1"), F1Vector.M(), F1Vector.Pt()); + numberF1 = numberF1 + 1; + for (auto iproton = protons.begin(); iproton != protons.end(); ++iproton) { + auto i4 = std::distance(protons.begin(), iproton); + ProtonVectorDummy = protons.at(i4); + if (numberF1 == 1) { + //////////// Fill final proton information after pairing////////// + ROOT::Math::PtEtaPhiMVector temp(ProtonVectorDummy.Pt(), ProtonVectorDummy.Eta(), ProtonVectorDummy.Phi(), massPr); + protonsfinal.push_back(temp); // 4 vector + ProtonChargeFinal.push_back(ProtonCharge.at(i4)); // Charge + ProtonTOFHitFinal.push_back(ProtonTOFHit.at(i4)); // TOF Hit + ProtonTOFNsigmaFinal.push_back(ProtonTOFNsigma.at(i4)); // Nsigma TOF + ProtonTPCNsigmaFinal.push_back(ProtonTPCNsigma.at(i4)); // Nsigma TPC + F1ProtonIndex.push_back(ProtonIndex.at(i4)); // proton index for share track + } + + if ((ProtonIndex.at(i4) == PionIndex.at(i1)) || (ProtonIndex.at(i4) == KaonIndex.at(i2)) || (ProtonIndex.at(i4) == KshortPosDaughIndex.at(i3)) || (ProtonIndex.at(i4) == KshortNegDaughIndex.at(i3))) { + continue; + } + + kstar = getkstar(F1Vector, *iproton); + qaRegistry.fill(HIST("hkstarDist"), kstar); + if (kstar > cMaxRelMom) { + continue; + } + qaRegistry.fill(HIST("hInvMassf1kstar"), F1Vector.M(), F1Vector.Pt(), kstar); + keepEventF1Proton = true; } - - kstar = getkstar(F1Vector, *iproton); - qaRegistry.fill(HIST("hkstarDist"), kstar); - if (kstar > cMaxRelMom) - continue; - qaRegistry.fill(HIST("hInvMassf1kstar"), F1Vector.M(), F1Vector.Pt(), kstar); - keepEventF1Proton = true; } } } diff --git a/PWGLF/TableProducer/Resonances/LFResonanceInitializer.cxx b/PWGLF/TableProducer/Resonances/resonanceInitializer.cxx similarity index 74% rename from PWGLF/TableProducer/Resonances/LFResonanceInitializer.cxx rename to PWGLF/TableProducer/Resonances/resonanceInitializer.cxx index fc3c4fdc3ff..e518efc3986 100644 --- a/PWGLF/TableProducer/Resonances/LFResonanceInitializer.cxx +++ b/PWGLF/TableProducer/Resonances/resonanceInitializer.cxx @@ -8,17 +8,17 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - -/// \file LFResonanceInitializer.cxx -/// \brief Initializes variables for the resonance candidate producers -/// /// +/// \file resonanceInitializer.cxx +/// \brief Initializes variables for the resonance candidate producers /// \author Bong-Hwi Lim +/// +#include +#include #include "Common/DataModel/PIDResponse.h" #include "Common/Core/TrackSelection.h" #include "Common/DataModel/Centrality.h" -// #include "Common/DataModel/Multiplicity.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" @@ -38,19 +38,22 @@ #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "CommonConstants/MathConstants.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; +using namespace o2::constants::physics; +using namespace o2::constants::math; /// Initializer for the resonance candidate producers -struct reso2initializer { +struct ResonanceInitializer { SliceCache cache; - float cXiMass; int mRunNumber; int multEstimator; - float d_bz; + float dBz; Service ccdb; Service pdg; @@ -65,7 +68,7 @@ struct reso2initializer { Produces reso2mccascades; // CCDB options - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbURL{"ccdbURL", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; @@ -74,9 +77,9 @@ struct reso2initializer { Configurable cfgFatalWhenNull{"cfgFatalWhenNull", true, "Fatal when null on ccdb access"}; // Configurables - Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; - Configurable ConfFillQA{"ConfFillQA", false, "Fill QA histograms"}; - Configurable ConfBypassCCDB{"ConfBypassCCDB", true, "Bypass loading CCDB part to save CPU time and memory"}; // will be affected to b_z value. + Configurable dBzInput{"dBzInput", -999, "bz field, -999 is automatic"}; + Configurable cfgFillQA{"cfgFillQA", false, "Fill QA histograms"}; + Configurable cfgBypassCCDB{"cfgBypassCCDB", true, "Bypass loading CCDB part to save CPU time and memory"}; // will be affected to b_z value. // Track filter from tpcSkimsTableCreator Configurable trackSelection{"trackSelection", 0, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; @@ -88,22 +91,22 @@ struct reso2initializer { /// Event cuts o2::analysis::CollisonCuts colCuts; - Configurable ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; - Configurable ConfEvtOccupancyInTimeRange{"ConfEvtOccupancyInTimeRange", -1, "Evt sel: maximum track occupancy"}; - Configurable ConfEvtTriggerCheck{"ConfEvtTriggerCheck", false, "Evt sel: check for trigger"}; - Configurable ConfEvtTriggerSel{"ConfEvtTriggerSel", 8, "Evt sel: trigger"}; - Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", true, "Evt sel: check for offline selection"}; - Configurable ConfEvtTriggerTVXSel{"ConfEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; - Configurable ConfEvtTFBorderCut{"ConfEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; - Configurable ConfEvtUseITSTPCvertex{"ConfEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; - Configurable ConfEvtZvertexTimedifference{"ConfEvtZvertexTimedifference", false, "Evt sel: apply Z-vertex time difference"}; - Configurable ConfEvtPileupRejection{"ConfEvtPileupRejection", false, "Evt sel: apply pileup rejection"}; - Configurable ConfEvtNoITSROBorderCut{"ConfEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; + Configurable cfgEvtZvtx{"cfgEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable cfgEvtOccupancyInTimeRange{"cfgEvtOccupancyInTimeRange", -1, "Evt sel: maximum track occupancy"}; + Configurable cfgEvtTriggerCheck{"cfgEvtTriggerCheck", false, "Evt sel: check for trigger"}; + Configurable cfgEvtTriggerSel{"cfgEvtTriggerSel", 8, "Evt sel: trigger"}; + Configurable cfgEvtOfflineCheck{"cfgEvtOfflineCheck", true, "Evt sel: check for offline selection"}; + Configurable cfgEvtTriggerTVXSel{"cfgEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; + Configurable cfgEvtTFBorderCut{"cfgEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; + Configurable cfgEvtUseITSTPCvertex{"cfgEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; + Configurable cfgEvtZvertexTimedifference{"cfgEvtZvertexTimedifference", false, "Evt sel: apply Z-vertex time difference"}; + Configurable cfgEvtPileupRejection{"cfgEvtPileupRejection", false, "Evt sel: apply pileup rejection"}; + Configurable cfgEvtNoITSROBorderCut{"cfgEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; Configurable cfgMultName{"cfgMultName", "FT0M", "The name of multiplicity estimator"}; // Qvector configuration - Configurable ConfBypassQvec{"ConfBypassQvec", true, "Bypass for qvector task"}; + Configurable cfgBypassQvec{"cfgBypassQvec", true, "Bypass for qvector task"}; Configurable cfgEvtPl{"cfgEvtPl", 40500, "Configuration of three subsystems for the event plane and its resolution, 10000*RefA + 100*RefB + S, where FT0C:0, FT0A:1, FT0M:2, FV0A:3, BPos:5, BNeg:6"}; // Pre-selection cuts @@ -125,7 +128,7 @@ struct reso2initializer { Configurable cMinV0CosPA{"cMinV0CosPA", 0.995, "Minimum V0 CosPA to PV"}; /// DCA Selections for Cascades - Configurable mincrossedrows_cascbach{"mincrossedrows_cascbach", 70, "min crossed rows for bachelor track from cascade"}; + Configurable cfgMinCrossedRowsCascBach{"cfgMinCrossedRowsCascBach", 70, "min crossed rows for bachelor track from cascade"}; Configurable cMinCascBachDCArToPVcut{"cMinCascBachDCArToPVcut", 0.05f, "Cascade Bachelor Track DCAr cut to PV Minimum"}; // Pre-selection Configurable cMaxCascBachDCArToPVcut{"cMaxCascBachDCArToPVcut", 999.0f, "Cascade Bachelor Track DCAr cut to PV Maximum"}; // Pre-selection Configurable cMaxCascDCAV0Daughters{"cMaxCascDCAV0Daughters", 1.6, "Cascade DCA between V0 daughters Maximum"}; @@ -153,9 +156,9 @@ struct reso2initializer { EventPlaneHelper helperEP; - int EvtPlRefAId = static_cast(cfgEvtPl / 10000); - int EvtPlRefBId = static_cast((cfgEvtPl - EvtPlRefAId * 10000) / 100); - int EvtPlDetId = cfgEvtPl - EvtPlRefAId * 10000 - EvtPlRefBId * 100; + int evtPlRefAId = static_cast(cfgEvtPl / 10000); + int evtPlRefBId = static_cast((cfgEvtPl - evtPlRefAId * 10000) / 100); + int evtPlDetId = cfgEvtPl - evtPlRefAId * 10000 - evtPlRefBId * 100; // MC Resonance parent filter Partition selectedMCParticles = (nabs(aod::mcparticle::pdgCode) == 313) // K* @@ -187,40 +190,41 @@ struct reso2initializer { using ResoV0sMC = soa::Join; using ResoCascades = aod::CascDatas; using ResoCascadesMC = soa::Join; + using BCsWithRun2Info = soa::Join; template - bool IsTrackSelected(CollisionType const&, TrackType const& track) + bool isTrackSelected(CollisionType const&, TrackType const& track) { // Track selection - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodTrackIndices"), 0.5); // MC case can be handled here if constexpr (isMC) { // MC check - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodMCTrackIndices"), 0.5); } // DCAxy cut - if (fabs(track.dcaXY()) > cMaxDCArToPVcut) + if (std::fabs(track.dcaXY()) > cMaxDCArToPVcut) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodTrackIndices"), 1.5); // DCAz cut - if (fabs(track.dcaZ()) > cMaxDCAzToPVcut || fabs(track.dcaZ()) < cMinDCAzToPVcut) + if (std::fabs(track.dcaZ()) > cMaxDCAzToPVcut || std::fabs(track.dcaZ()) < cMinDCAzToPVcut) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodTrackIndices"), 2.5); - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodTrackIndices"), 7.5); return true; } template - bool IsV0Selected(CollisionType const&, V0Type const& v0, TrackType const&) + bool isV0Selected(CollisionType const&, V0Type const& v0, TrackType const&) { // V0 selection - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodV0Indices"), 0.5); auto postrack = v0.template posTrack_as(); @@ -230,39 +234,39 @@ struct reso2initializer { return false; if (negtrack.tpcNClsCrossedRows() < mincrossedrows) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodV0Indices"), 1.5); - if (fabs(postrack.dcaXY()) < cMinV0PosDCArToPVcut) + if (std::fabs(postrack.dcaXY()) < cMinV0PosDCArToPVcut) return false; - if (fabs(negtrack.dcaXY()) < cMinV0NegDCArToPVcut) + if (std::fabs(negtrack.dcaXY()) < cMinV0NegDCArToPVcut) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodV0Indices"), 2.5); if ((v0.v0radius() > cMaxV0Radius) || (v0.v0radius() < cMinV0Radius)) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodV0Indices"), 3.5); if (v0.v0cosPA() < cMinV0CosPA) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodV0Indices"), 4.5); // MC case can be handled here if constexpr (isMC) { // MC check - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodMCV0Indices"), 0.5); } return true; } template - bool IsCascSelected(CollisionType const& collision, CascType const& casc, TrackType const&) + bool isCascSelected(CollisionType const& collision, CascType const& casc, TrackType const&) { // V0 selection - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodCascIndices"), 0.5); auto trackBach = casc.template bachelor_as(); @@ -270,16 +274,16 @@ struct reso2initializer { // auto trackNeg = casc.template negTrack_as(); // track cuts - if (trackBach.tpcNClsCrossedRows() < mincrossedrows_cascbach) + if (trackBach.tpcNClsCrossedRows() < cfgMinCrossedRowsCascBach) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodCascIndices"), 1.5); - if (fabs(trackBach.dcaXY()) < cMinCascBachDCArToPVcut) + if (std::fabs(trackBach.dcaXY()) < cMinCascBachDCArToPVcut) return false; - if (fabs(trackBach.dcaXY()) > cMaxCascBachDCArToPVcut) + if (std::fabs(trackBach.dcaXY()) > cMaxCascBachDCArToPVcut) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodCascIndices"), 2.5); // DCA daugthers @@ -287,7 +291,7 @@ struct reso2initializer { return false; if (casc.dcacascdaughters() > cMaxCascDCACascDaughters) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodCascIndices"), 3.5); // CPA cuts @@ -295,34 +299,34 @@ struct reso2initializer { return false; if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cMinCascV0CosPA) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodCascIndices"), 4.5); // V0 radius auto v0radius = casc.v0radius(); if ((v0radius > cMaxCascV0Radius) || (v0radius < cMinCascV0Radius)) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodCascIndices"), 5.5); // Casc radius auto cascradius = casc.cascradius(); if ((cascradius > cMaxCascRadius) || (cascradius < cMinCascRadius)) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodCascIndices"), 6.5); // Casc mass auto cascMass = casc.mXi(); - if (abs(cascMass - cXiMass) > cCascMassResol) + if (std::abs(cascMass - MassXiMinus) > cCascMassResol) return false; - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodCascIndices"), 7.5); // MC case can be handled here if constexpr (isMC) { // MC check - if (ConfFillQA) + if (cfgFillQA) qaRegistry.fill(HIST("hGoodMCCascIndices"), 0.5); } return true; @@ -330,9 +334,9 @@ struct reso2initializer { // Check if the collision is INEL>0 template - bool IsTrueINEL0(MCColl const& /*mccoll*/, MCPart const& mcparts) + bool isTrueINEL0(MCColl const& /*mccoll*/, MCPart const& mcparts) { - for (auto& mcparticle : mcparts) { + for (auto const& mcparticle : mcparts) { if (!mcparticle.isPhysicalPrimary()) continue; auto p = pdg->GetParticle(mcparticle.pdgCode()); @@ -348,7 +352,7 @@ struct reso2initializer { // Centralicity estimator selection template - float CentEst(ResoColl ResoEvents) + float centEst(ResoColl ResoEvents) { float returnValue = -999.0; switch (multEstimator) { @@ -378,7 +382,7 @@ struct reso2initializer { /// \param tracks All tracks /// \return value of the spherocity of the event template - float ComputeSpherocity(T const& tracks, int nTracksMin, int spdef) + float computeSpherocity(T const& tracks, int nTracksMin, int spdef) { // if number of tracks is not enough for spherocity estimation. int ntrks = tracks.size(); @@ -389,7 +393,7 @@ struct reso2initializer { float ptSum = 0.; for (auto const& track : tracks) { - if (ConfFillQA) { + if (cfgFillQA) { qaRegistry.fill(HIST("Phi"), track.phi()); } if (spdef == 0) { @@ -402,39 +406,39 @@ struct reso2initializer { float tempSph = 1.; for (int i = 0; i < 360 / 0.1; ++i) { float sum = 0., pt = 0.; - float phiparm = (TMath::Pi() * i * 0.1) / 180.; - float nx = TMath::Cos(phiparm); - float ny = TMath::Sin(phiparm); + float phiparm = (PI * i * 0.1) / 180.; + float nx = std::cos(phiparm); + float ny = std::sin(phiparm); for (auto const& trk : tracks) { pt = trk.pt(); if (spdef == 0) { pt = 1.; } float phi = trk.phi(); - float px = pt * TMath::Cos(phi); - float py = pt * TMath::Sin(phi); + float px = pt * std::cos(phi); + float py = pt * std::sin(phi); // sum += pt * abs(sin(phiparm - phi)); - sum += TMath::Abs(px * ny - py * nx); + sum += std::abs(px * ny - py * nx); } - float sph = TMath::Power((sum / ptSum), 2); + float sph = std::pow((sum / ptSum), 2); if (sph < tempSph) tempSph = sph; } - return TMath::Power(TMath::Pi() / 2., 2) * tempSph; + return std::pow(PIHalf, 2) * tempSph; } template - float GetEvtPl(ResoColl ResoEvents) + float getEvtPl(ResoColl ResoEvents) { float returnValue = -999.0; - if (ResoEvents.qvecAmp()[EvtPlDetId] > 1e-8) - returnValue = helperEP.GetEventPlane(ResoEvents.qvecRe()[EvtPlDetId * 4 + 3], ResoEvents.qvecIm()[EvtPlDetId * 4 + 3], 2); + if (ResoEvents.qvecAmp()[evtPlDetId] > 1e-8) + returnValue = helperEP.GetEventPlane(ResoEvents.qvecRe()[evtPlDetId * 4 + 3], ResoEvents.qvecIm()[evtPlDetId * 4 + 3], 2); return returnValue; } template - float GetEvtPlRes(ResoColl ResoEvents, int a, int b) + float getEvtPlRes(ResoColl ResoEvents, int a, int b) { float returnValue = -999.0; if (ResoEvents.qvecAmp()[a] < 1e-8 || ResoEvents.qvecAmp()[b] < 1e-8) @@ -448,10 +452,11 @@ struct reso2initializer { void fillTracks(CollisionType const& collision, TrackType const& tracks) { // Loop over tracks - for (auto& track : tracks) { - if (!IsTrackSelected(collision, track)) + for (auto const& track : tracks) { + if (!isTrackSelected(collision, track)) continue; reso2trks(resoCollisions.lastIndex(), + track.globalIndex(), track.pt(), track.px(), track.py(), @@ -498,12 +503,13 @@ struct reso2initializer { void fillV0s(CollisionType const& collision, V0Type const& v0s, TrackType const& tracks) { int childIDs[2] = {0, 0}; // these IDs are necessary to keep track of the children - for (auto& v0 : v0s) { - if (!IsV0Selected(collision, v0, tracks)) + for (auto const& v0 : v0s) { + if (!isV0Selected(collision, v0, tracks)) continue; childIDs[0] = v0.posTrackId(); childIDs[1] = v0.negTrackId(); reso2v0s(resoCollisions.lastIndex(), + v0.globalIndex(), v0.pt(), v0.px(), v0.py(), @@ -511,6 +517,18 @@ struct reso2initializer { v0.eta(), v0.phi(), childIDs, + v0.template posTrack_as().tpcNSigmaPi(), + v0.template posTrack_as().tpcNSigmaKa(), + v0.template posTrack_as().tpcNSigmaPr(), + v0.template negTrack_as().tpcNSigmaPi(), + v0.template negTrack_as().tpcNSigmaKa(), + v0.template negTrack_as().tpcNSigmaPr(), + v0.template negTrack_as().tofNSigmaPi(), + v0.template negTrack_as().tofNSigmaKa(), + v0.template negTrack_as().tofNSigmaPr(), + v0.template posTrack_as().tofNSigmaPi(), + v0.template posTrack_as().tofNSigmaKa(), + v0.template posTrack_as().tofNSigmaPr(), v0.v0cosPA(), v0.dcaV0daughters(), v0.dcapostopv(), @@ -531,13 +549,14 @@ struct reso2initializer { void fillCascades(CollisionType const& collision, CascType const& cascades, TrackType const& tracks) { int childIDs[3] = {0, 0, 0}; // these IDs are necessary to keep track of the children - for (auto& casc : cascades) { - if (!IsCascSelected(collision, casc, tracks)) + for (auto const& casc : cascades) { + if (!isCascSelected(collision, casc, tracks)) continue; childIDs[0] = casc.posTrackId(); childIDs[1] = casc.negTrackId(); childIDs[2] = casc.bachelorId(); reso2cascades(resoCollisions.lastIndex(), + casc.globalIndex(), casc.pt(), casc.px(), casc.py(), @@ -545,6 +564,24 @@ struct reso2initializer { casc.eta(), casc.phi(), childIDs, + casc.template posTrack_as().tpcNSigmaPi(), + casc.template posTrack_as().tpcNSigmaKa(), + casc.template posTrack_as().tpcNSigmaPr(), + casc.template negTrack_as().tpcNSigmaPi(), + casc.template negTrack_as().tpcNSigmaKa(), + casc.template negTrack_as().tpcNSigmaPr(), + casc.template bachelor_as().tpcNSigmaPi(), + casc.template bachelor_as().tpcNSigmaKa(), + casc.template bachelor_as().tpcNSigmaPr(), + casc.template posTrack_as().tofNSigmaPi(), + casc.template posTrack_as().tofNSigmaKa(), + casc.template posTrack_as().tofNSigmaPr(), + casc.template negTrack_as().tofNSigmaPi(), + casc.template negTrack_as().tofNSigmaKa(), + casc.template negTrack_as().tofNSigmaPr(), + casc.template bachelor_as().tofNSigmaPi(), + casc.template bachelor_as().tofNSigmaKa(), + casc.template bachelor_as().tofNSigmaPr(), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()), casc.dcaV0daughters(), @@ -570,7 +607,7 @@ struct reso2initializer { // ------ Temporal lambda function to prevent error in build auto getMothersIndeces = [&](auto const& theMcParticle) { std::vector lMothersIndeces{}; - for (auto& lMother : theMcParticle.template mothers_as()) { + for (auto const& lMother : theMcParticle.template mothers_as()) { LOGF(debug, " mother index lMother: %d", lMother.globalIndex()); lMothersIndeces.push_back(lMother.globalIndex()); } @@ -578,7 +615,7 @@ struct reso2initializer { }; auto getMothersPDGCodes = [&](auto const& theMcParticle) { std::vector lMothersPDGs{}; - for (auto& lMother : theMcParticle.template mothers_as()) { + for (auto const& lMother : theMcParticle.template mothers_as()) { LOGF(debug, " mother pdgcode lMother: %d", lMother.pdgCode()); lMothersPDGs.push_back(lMother.pdgCode()); } @@ -586,9 +623,9 @@ struct reso2initializer { }; auto getSiblingsIndeces = [&](auto const& theMcParticle) { std::vector lSiblingsIndeces{}; - for (auto& lMother : theMcParticle.template mothers_as()) { + for (auto const& lMother : theMcParticle.template mothers_as()) { LOGF(debug, " mother index lMother: %d", lMother.globalIndex()); - for (auto& lDaughter : lMother.template daughters_as()) { + for (auto const& lDaughter : lMother.template daughters_as()) { LOGF(debug, " daughter index lDaughter: %d", lDaughter.globalIndex()); if (lDaughter.globalIndex() != 0 && lDaughter.globalIndex() != theMcParticle.globalIndex()) { lSiblingsIndeces.push_back(lDaughter.globalIndex()); @@ -601,7 +638,7 @@ struct reso2initializer { std::vector mothers = {-1, -1}; std::vector motherPDGs = {-1, -1}; int siblings[2] = {0, 0}; - std::vector siblings_temp = {-1, -1}; + std::vector siblingsTemp = {-1, -1}; if (track.has_mcParticle()) { // // Get the MC particle @@ -609,16 +646,16 @@ struct reso2initializer { if (particle.has_mothers()) { mothers = getMothersIndeces(particle); motherPDGs = getMothersPDGCodes(particle); - siblings_temp = getSiblingsIndeces(particle); + siblingsTemp = getSiblingsIndeces(particle); } while (mothers.size() > 2) { mothers.pop_back(); motherPDGs.pop_back(); } - if (siblings_temp.size() > 0) - siblings[0] = siblings_temp[0]; - if (siblings_temp.size() > 1) - siblings[1] = siblings_temp[1]; + if (siblingsTemp.size() > 0) + siblings[0] = siblingsTemp[0]; + if (siblingsTemp.size() > 1) + siblings[1] = siblingsTemp[1]; reso2mctracks(particle.pdgCode(), mothers[0], motherPDGs[0], @@ -642,7 +679,7 @@ struct reso2initializer { // ------ Temporal lambda function to prevent error in build auto getMothersIndeces = [&](auto const& theMcParticle) { std::vector lMothersIndeces{}; - for (auto& lMother : theMcParticle.template mothers_as()) { + for (auto const& lMother : theMcParticle.template mothers_as()) { LOGF(debug, " mother index lMother: %d", lMother.globalIndex()); lMothersIndeces.push_back(lMother.globalIndex()); } @@ -650,7 +687,7 @@ struct reso2initializer { }; auto getMothersPDGCodes = [&](auto const& theMcParticle) { std::vector lMothersPDGs{}; - for (auto& lMother : theMcParticle.template mothers_as()) { + for (auto const& lMother : theMcParticle.template mothers_as()) { LOGF(debug, " mother pdgcode lMother: %d", lMother.pdgCode()); lMothersPDGs.push_back(lMother.pdgCode()); } @@ -658,7 +695,7 @@ struct reso2initializer { }; auto getDaughtersIndeces = [&](auto const& theMcParticle) { std::vector lDaughtersIndeces{}; - for (auto& lDaughter : theMcParticle.template daughters_as()) { + for (auto const& lDaughter : theMcParticle.template daughters_as()) { LOGF(debug, " daughter index lDaughter: %d", lDaughter.globalIndex()); if (lDaughter.globalIndex() != 0) { lDaughtersIndeces.push_back(lDaughter.globalIndex()); @@ -668,7 +705,7 @@ struct reso2initializer { }; auto getDaughtersPDGCodes = [&](auto const& theMcParticle) { std::vector lDaughtersPDGs{}; - for (auto& lDaughter : theMcParticle.template daughters_as()) { + for (auto const& lDaughter : theMcParticle.template daughters_as()) { LOGF(debug, " daughter pdgcode lDaughter: %d", lDaughter.pdgCode()); if (lDaughter.globalIndex() != 0) { lDaughtersPDGs.push_back(lDaughter.pdgCode()); @@ -728,7 +765,7 @@ struct reso2initializer { // ------ Temporal lambda function to prevent error in build auto getMothersIndeces = [&](auto const& theMcParticle) { std::vector lMothersIndeces{}; - for (auto& lMother : theMcParticle.template mothers_as()) { + for (auto const& lMother : theMcParticle.template mothers_as()) { LOGF(debug, " mother index lMother: %d", lMother.globalIndex()); lMothersIndeces.push_back(lMother.globalIndex()); } @@ -736,7 +773,7 @@ struct reso2initializer { }; auto getMothersPDGCodes = [&](auto const& theMcParticle) { std::vector lMothersPDGs{}; - for (auto& lMother : theMcParticle.template mothers_as()) { + for (auto const& lMother : theMcParticle.template mothers_as()) { LOGF(debug, " mother pdgcode lMother: %d", lMother.pdgCode()); lMothersPDGs.push_back(lMother.pdgCode()); } @@ -744,7 +781,7 @@ struct reso2initializer { }; auto getDaughtersIndeces = [&](auto const& theMcParticle) { std::vector lDaughtersIndeces{}; - for (auto& lDaughter : theMcParticle.template daughters_as()) { + for (auto const& lDaughter : theMcParticle.template daughters_as()) { LOGF(debug, " daughter index lDaughter: %d", lDaughter.globalIndex()); if (lDaughter.globalIndex() != 0) { lDaughtersIndeces.push_back(lDaughter.globalIndex()); @@ -754,7 +791,7 @@ struct reso2initializer { }; auto getDaughtersPDGCodes = [&](auto const& theMcParticle) { std::vector lDaughtersPDGs{}; - for (auto& lDaughter : theMcParticle.template daughters_as()) { + for (auto const& lDaughter : theMcParticle.template daughters_as()) { LOGF(debug, " daughter pdgcode lDaughter: %d", lDaughter.pdgCode()); if (lDaughter.globalIndex() != 0) { lDaughtersPDGs.push_back(lDaughter.pdgCode()); @@ -811,7 +848,7 @@ struct reso2initializer { template void fillMCParticles(SelectedMCPartType const& mcParts, TotalMCParts const& mcParticles) { - for (auto& mcPart : mcParts) { + for (auto const& mcPart : mcParts) { std::vector daughterPDGs; if (mcPart.has_daughters()) { auto daughter01 = mcParticles.rawIteratorAt(mcPart.daughtersIds()[0] - mcParticles.offset()); @@ -832,7 +869,9 @@ struct reso2initializer { mcPart.pz(), mcPart.eta(), mcPart.phi(), - mcPart.y()); + mcPart.y(), + mcPart.e(), + mcPart.statusCode()); daughterPDGs.clear(); } } @@ -842,11 +881,11 @@ struct reso2initializer { { auto centrality = 0.0; if constexpr (!isRun2) - centrality = CentEst(mccol); + centrality = centEst(mccol); else centrality = mccol.centRun2V0M(); - bool inVtx10 = (abs(mccol.mcCollision().posZ()) > 10.) ? false : true; - bool isTrueINELgt0 = IsTrueINEL0(mccol, mcparts); + bool inVtx10 = (std::abs(mccol.mcCollision().posZ()) > 10.) ? false : true; + bool isTrueINELgt0 = isTrueINEL0(mccol, mcparts); bool isTriggerTVX = mccol.selection_bit(aod::evsel::kIsTriggerTVX); bool isSel8 = mccol.sel8(); bool isSelected = colCuts.isSelected(mccol); @@ -894,9 +933,8 @@ struct reso2initializer { void init(InitContext&) { - cXiMass = pdg->GetParticle(3312)->Mass(); mRunNumber = 0; - d_bz = 0; + dBz = 0; // Multiplicity estimator selection (0: FT0M, 1: FT0C, 2: FT0A, 99: FV0A) if (cfgMultName.value == "FT0M") { multEstimator = 0; @@ -922,19 +960,19 @@ struct reso2initializer { // Case selector based on the process. if (doprocessTrackDataRun2 || doprocessTrackV0DataRun2 || doprocessTrackV0CascDataRun2 || doprocessTrackMCRun2 || doprocessTrackV0MCRun2 || doprocessTrackV0CascMCRun2) { - colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, false); + colCuts.setCuts(cfgEvtZvtx, cfgEvtTriggerCheck, cfgEvtTriggerSel, cfgEvtOfflineCheck, false); } else if (doprocessTrackData || doprocessTrackV0Data || doprocessTrackV0CascData || doprocessTrackMC || doprocessTrackV0MC || doprocessTrackV0CascMC || doprocessTrackEPData) { - colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, true, false, ConfEvtOccupancyInTimeRange); + colCuts.setCuts(cfgEvtZvtx, cfgEvtTriggerCheck, cfgEvtTriggerSel, cfgEvtOfflineCheck, true, false, cfgEvtOccupancyInTimeRange); } colCuts.init(&qaRegistry); - colCuts.setTriggerTVX(ConfEvtTriggerTVXSel); - colCuts.setApplyTFBorderCut(ConfEvtTFBorderCut); - colCuts.setApplyITSTPCvertex(ConfEvtUseITSTPCvertex); - colCuts.setApplyZvertexTimedifference(ConfEvtZvertexTimedifference); - colCuts.setApplyPileupRejection(ConfEvtPileupRejection); - colCuts.setApplyNoITSROBorderCut(ConfEvtNoITSROBorderCut); - if (!ConfBypassCCDB) { - ccdb->setURL(ccdburl.value); + colCuts.setTriggerTVX(cfgEvtTriggerTVXSel); + colCuts.setApplyTFBorderCut(cfgEvtTFBorderCut); + colCuts.setApplyITSTPCvertex(cfgEvtUseITSTPCvertex); + colCuts.setApplyZvertexTimedifference(cfgEvtZvertexTimedifference); + colCuts.setApplyPileupRejection(cfgEvtPileupRejection); + colCuts.setApplyNoITSROBorderCut(cfgEvtNoITSROBorderCut); + if (!cfgBypassCCDB) { + ccdb->setURL(ccdbURL.value); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(cfgFatalWhenNull); @@ -949,7 +987,7 @@ struct reso2initializer { qaRegistry.add("Event/hMCEventIndices", "hMCEventIndices", kTH2D, {centAxis, idxMCAxis}); } AxisSpec idxAxis = {8, 0, 8, "Index"}; - if (ConfFillQA) { + if (cfgFillQA) { qaRegistry.add("hGoodTrackIndices", "hGoodTrackIndices", kTH1F, {idxAxis}); qaRegistry.add("hGoodMCTrackIndices", "hGoodMCTrackIndices", kTH1F, {idxAxis}); qaRegistry.add("hGoodV0Indices", "hGoodV0Indices", kTH1F, {idxAxis}); @@ -962,48 +1000,53 @@ struct reso2initializer { void initCCDB(aod::BCsWithTimestamps::iterator const& bc) // Simple copy from LambdaKzeroFinder.cxx { - if (ConfBypassCCDB) + if (cfgBypassCCDB) return; if (mRunNumber == bc.runNumber()) { return; } // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; + if (dBzInput > -990) { + dBz = dBzInput; ; o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + if (std::fabs(dBz) > 1e-5) { + grpmag.setL3Current(30000.f / (dBz / 5.0f)); } o2::base::Propagator::initFieldFromGRP(&grpmag); mRunNumber = bc.runNumber(); return; } - auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + auto run3GRPTimestamp = bc.timestamp(); + o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3GRPTimestamp); o2::parameters::GRPMagField* grpmag = 0x0; if (grpo) { o2::base::Propagator::initFieldFromGRP(grpo); // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + dBz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3GRPTimestamp << " with magnetic field of " << dBz << " kZG"; } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + grpmag = ccdb->getForTimeStamp(grpmagPath, run3GRPTimestamp); if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3GRPTimestamp; } o2::base::Propagator::initFieldFromGRP(grpmag); // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + dBz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3GRPTimestamp << " with magnetic field of " << dBz << " kZG"; } mRunNumber = bc.runNumber(); // Set magnetic field value once known - LOGF(info, "Bz set to %f for run: ", d_bz, mRunNumber); + LOGF(info, "Bz set to %f for run: ", dBz, mRunNumber); } + void processDummy(ResoRun2Events const& /*collisions*/) + { + } + PROCESS_SWITCH(ResonanceInitializer, processDummy, "Process for dummy", true); + void processTrackData(ResoEvents::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) @@ -1015,28 +1058,27 @@ struct reso2initializer { return; colCuts.fillQA(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centEst(collision), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); } - PROCESS_SWITCH(reso2initializer, processTrackData, "Process for data", true); + PROCESS_SWITCH(ResonanceInitializer, processTrackData, "Process for data", false); void processTrackDataRun2(ResoRun2Events::iterator const& collision, soa::Filtered const& tracks, - aod::BCsWithTimestamps const&) + BCsWithRun2Info const&) { - auto bc = collision.bc_as(); /// adding timestamp to access magnetic field later - initCCDB(bc); + auto bc = collision.bc_as(); // Default event selection if (!colCuts.isSelected(collision)) return; colCuts.fillQARun2(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); } - PROCESS_SWITCH(reso2initializer, processTrackDataRun2, "Process for data", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackDataRun2, "Process for data", false); void processTrackEPData(soa::Join::iterator const& collision, soa::Filtered const& tracks, @@ -1049,11 +1091,11 @@ struct reso2initializer { return; colCuts.fillQA(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), GetEvtPl(collision), GetEvtPlRes(collision, EvtPlDetId, EvtPlRefAId), GetEvtPlRes(collision, EvtPlDetId, EvtPlRefBId), GetEvtPlRes(collision, EvtPlRefAId, EvtPlRefBId), d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centEst(collision), computeSpherocity(tracks, trackSphMin, trackSphDef), getEvtPl(collision), getEvtPlRes(collision, evtPlDetId, evtPlRefAId), getEvtPlRes(collision, evtPlDetId, evtPlRefBId), getEvtPlRes(collision, evtPlRefAId, evtPlRefBId), dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); } - PROCESS_SWITCH(reso2initializer, processTrackEPData, "Process for data and ep ana", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackEPData, "Process for data and ep ana", false); void processTrackV0Data(ResoEvents::iterator const& collision, soa::Filtered const& tracks, @@ -1067,31 +1109,30 @@ struct reso2initializer { return; colCuts.fillQA(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centEst(collision), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); fillV0s(collision, V0s, tracks); } - PROCESS_SWITCH(reso2initializer, processTrackV0Data, "Process for data", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackV0Data, "Process for data", false); void processTrackV0DataRun2(ResoRun2Events::iterator const& collision, soa::Filtered const& tracks, ResoV0s const& V0s, - aod::BCsWithTimestamps const&) + BCsWithRun2Info const&) { - auto bc = collision.bc_as(); /// adding timestamp to access magnetic field later - initCCDB(bc); + auto bc = collision.bc_as(); // Default event selection if (!colCuts.isSelected(collision)) return; colCuts.fillQARun2(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); fillV0s(collision, V0s, tracks); } - PROCESS_SWITCH(reso2initializer, processTrackV0DataRun2, "Process for data", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackV0DataRun2, "Process for data", false); void processTrackV0CascData(ResoEvents::iterator const& collision, soa::Filtered const& tracks, @@ -1106,34 +1147,33 @@ struct reso2initializer { return; colCuts.fillQA(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centEst(collision), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); fillV0s(collision, V0s, tracks); fillCascades(collision, Cascades, tracks); } - PROCESS_SWITCH(reso2initializer, processTrackV0CascData, "Process for data", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackV0CascData, "Process for data", false); void processTrackV0CascDataRun2(ResoRun2Events::iterator const& collision, soa::Filtered const& tracks, ResoV0s const& V0s, ResoCascades const& Cascades, - aod::BCsWithTimestamps const&) + BCsWithRun2Info const&) { - auto bc = collision.bc_as(); /// adding timestamp to access magnetic field later - initCCDB(bc); + auto bc = collision.bc_as(); // Default event selection if (!colCuts.isSelected(collision)) return; colCuts.fillQARun2(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); fillV0s(collision, V0s, tracks); fillCascades(collision, Cascades, tracks); } - PROCESS_SWITCH(reso2initializer, processTrackV0CascDataRun2, "Process for data", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackV0CascDataRun2, "Process for data", false); Preslice perMcCollision = aod::mcparticle::mcCollisionId; void processTrackMC(soa::Join::iterator const& collision, @@ -1144,7 +1184,7 @@ struct reso2initializer { initCCDB(bc); colCuts.fillQA(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centEst(collision), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); auto mccollision = collision.mcCollision_as(); float impactpar = mccollision.impactParameter(); @@ -1157,7 +1197,7 @@ struct reso2initializer { auto mcParts = selectedMCParticles->sliceBy(perMcCollision, collision.mcCollision().globalIndex()); fillMCParticles(mcParts, mcParticles); } - PROCESS_SWITCH(reso2initializer, processTrackMC, "Process for MC", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackMC, "Process for MC", false); void processTrackEPMC(soa::Join::iterator const& collision, aod::McCollisions const&, soa::Filtered const& tracks, @@ -1167,7 +1207,7 @@ struct reso2initializer { initCCDB(bc); colCuts.fillQA(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), GetEvtPl(collision), GetEvtPlRes(collision, EvtPlDetId, EvtPlRefAId), GetEvtPlRes(collision, EvtPlDetId, EvtPlRefBId), GetEvtPlRes(collision, EvtPlRefAId, EvtPlRefBId), d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centEst(collision), computeSpherocity(tracks, trackSphMin, trackSphDef), getEvtPl(collision), getEvtPlRes(collision, evtPlDetId, evtPlRefAId), getEvtPlRes(collision, evtPlDetId, evtPlRefBId), getEvtPlRes(collision, evtPlRefAId, evtPlRefBId), dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1176,18 +1216,17 @@ struct reso2initializer { auto mcParts = selectedMCParticles->sliceBy(perMcCollision, collision.mcCollision().globalIndex()); fillMCParticles(mcParts, mcParticles); } - PROCESS_SWITCH(reso2initializer, processTrackEPMC, "Process for MC and ep ana", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackEPMC, "Process for MC and ep ana", false); Preslice perMcCollisionRun2 = aod::mcparticle::mcCollisionId; void processTrackMCRun2(soa::Join::iterator const& collision, aod::McCollisions const&, soa::Filtered const& tracks, - aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&) + aod::McParticles const& mcParticles, BCsWithRun2Info const&) { - auto bc = collision.bc_as(); /// adding timestamp to access magnetic field later - initCCDB(bc); + auto bc = collision.bc_as(); colCuts.fillQARun2(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1197,7 +1236,7 @@ struct reso2initializer { auto mcParts = selectedMCParticles->sliceBy(perMcCollisionRun2, collision.mcCollision().globalIndex()); fillMCParticles(mcParts, mcParticles); } - PROCESS_SWITCH(reso2initializer, processTrackMCRun2, "Process for MC", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackMCRun2, "Process for MC", false); void processTrackV0MC(soa::Join::iterator const& collision, aod::McCollisions const&, soa::Filtered const& tracks, @@ -1208,7 +1247,7 @@ struct reso2initializer { initCCDB(bc); colCuts.fillQA(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centEst(collision), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1219,18 +1258,17 @@ struct reso2initializer { auto mcParts = selectedMCParticles->sliceBy(perMcCollision, collision.mcCollision().globalIndex()); fillMCParticles(mcParts, mcParticles); } - PROCESS_SWITCH(reso2initializer, processTrackV0MC, "Process for MC", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackV0MC, "Process for MC", false); void processTrackV0MCRun2(soa::Join::iterator const& collision, aod::McCollisions const&, soa::Filtered const& tracks, ResoV0sMC const& V0s, - aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&) + aod::McParticles const& mcParticles, BCsWithRun2Info const&) { - auto bc = collision.bc_as(); /// adding timestamp to access magnetic field later - initCCDB(bc); + auto bc = collision.bc_as(); colCuts.fillQARun2(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1241,7 +1279,7 @@ struct reso2initializer { auto mcParts = selectedMCParticles->sliceBy(perMcCollision, collision.mcCollision().globalIndex()); fillMCParticles(mcParts, mcParticles); } - PROCESS_SWITCH(reso2initializer, processTrackV0MCRun2, "Process for MC", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackV0MCRun2, "Process for MC", false); void processTrackV0CascMC(soa::Join::iterator const& collision, aod::McCollisions const&, soa::Filtered const& tracks, @@ -1253,7 +1291,7 @@ struct reso2initializer { initCCDB(bc); colCuts.fillQA(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centEst(collision), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1266,19 +1304,18 @@ struct reso2initializer { auto mcParts = selectedMCParticles->sliceBy(perMcCollision, collision.mcCollision().globalIndex()); fillMCParticles(mcParts, mcParticles); } - PROCESS_SWITCH(reso2initializer, processTrackV0CascMC, "Process for MC", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackV0CascMC, "Process for MC", false); void processTrackV0CascMCRun2(soa::Join::iterator const& collision, aod::McCollisions const&, soa::Filtered const& tracks, ResoV0sMC const& V0s, ResoCascadesMC const& Cascades, - aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&) + aod::McParticles const& mcParticles, BCsWithRun2Info const&) { - auto bc = collision.bc_as(); /// adding timestamp to access magnetic field later - initCCDB(bc); + auto bc = collision.bc_as(); colCuts.fillQARun2(collision); - resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), computeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1291,12 +1328,12 @@ struct reso2initializer { auto mcParts = selectedMCParticles->sliceBy(perMcCollision, collision.mcCollision().globalIndex()); fillMCParticles(mcParts, mcParticles); } - PROCESS_SWITCH(reso2initializer, processTrackV0CascMCRun2, "Process for MC", false); + PROCESS_SWITCH(ResonanceInitializer, processTrackV0CascMCRun2, "Process for MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"lf-reso2initializer"}), + adaptAnalysisTask(cfgc), }; } diff --git a/PWGLF/TableProducer/Resonances/resonanceModuleInitializer.cxx b/PWGLF/TableProducer/Resonances/resonanceModuleInitializer.cxx new file mode 100644 index 00000000000..327585d6295 --- /dev/null +++ b/PWGLF/TableProducer/Resonances/resonanceModuleInitializer.cxx @@ -0,0 +1,1257 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +/// \file resonanceModuleInitializer.cxx +/// \brief Initializes variables for the resonance candidate producers +/// +/// \author Bong-Hwi Lim + +#include +#include +#include "CCDB/BasicCCDBManager.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/Core/EventPlaneHelper.h" +#include "CommonConstants/PhysicsConstants.h" +#include "CommonConstants/MathConstants.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFResonanceTables.h" +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/collisionCuts.h" +#include "ReconstructionDataFormats/Track.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; +using namespace o2::constants::math; + +/** + * @brief Initializer for the event pool for resonance study + * + * This struct is responsible for initializing and processing collision data + * for resonance studies. It handles event selection, centrality estimation, + * and QA histogram filling. + */ +struct ResonanceModuleInitializer { + int mRunNumber; ///< Run number for the current data + int multEstimator; ///< Multiplicity estimator type + float dBz; ///< Magnetic field value + float centrality; ///< Centrality value for the event + Service ccdb; ///< CCDB manager service + Service pdg; ///< PDG database service + EventPlaneHelper helperEP; ///< Helper for event plane calculations + + Produces resoCollisions; ///< Output table for resonance collisions + Produces resoMCCollisions; ///< Output table for MC resonance collisions + + // CCDB options + Configurable ccdbURL{"ccdbURL", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + + Configurable cfgFatalWhenNull{"cfgFatalWhenNull", true, "Fatal when null on ccdb access"}; + + // Configurables + Configurable dBzInput{"dBzInput", -999, "bz field, -999 is automatic"}; + Configurable cfgFillQA{"cfgFillQA", false, "Fill QA histograms"}; + Configurable cfgBypassCCDB{"cfgBypassCCDB", true, "Bypass loading CCDB part to save CPU time and memory"}; // will be affected to b_z value. + Configurable cfgMultName{"cfgMultName", "FT0M", "The name of multiplicity estimator"}; + Configurable cfgCentralityMC{"cfgCentralityMC", 0, "Centrality estimator for MC (0: Reco, 1: MC, 2: impact parameter)"}; + + // EventCorrection for MC + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 0.01, 0.1, 1.0, 5.0, 10., 15., 20., 30., 40., 50., 70., 100.0, 105.}, "Binning of the centrality axis"}; + ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -20, -15, -10, -7, -5, -3, -2, -1, 0, 1, 2, 3, 5, 7, 10, 15, 20}, "Mixing bins - z-vertex"}; + + /// Event cuts + o2::analysis::CollisonCuts colCuts; + Configurable cfgEvtZvtx{"cfgEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable cfgEvtOccupancyInTimeRange{"cfgEvtOccupancyInTimeRange", -1, "Evt sel: maximum track occupancy"}; + Configurable cfgEvtTriggerCheck{"cfgEvtTriggerCheck", false, "Evt sel: check for trigger"}; + Configurable cfgEvtTriggerSel{"cfgEvtTriggerSel", 8, "Evt sel: trigger"}; + Configurable cfgEvtOfflineCheck{"cfgEvtOfflineCheck", true, "Evt sel: check for offline selection"}; + Configurable cfgEvtTriggerTVXSel{"cfgEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; + Configurable cfgEvtTFBorderCut{"cfgEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; + Configurable cfgEvtUseITSTPCvertex{"cfgEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; + Configurable cfgEvtZvertexTimedifference{"cfgEvtZvertexTimedifference", false, "Evt sel: apply Z-vertex time difference"}; + Configurable cfgEvtPileupRejection{"cfgEvtPileupRejection", false, "Evt sel: apply pileup rejection"}; + Configurable cfgEvtNoITSROBorderCut{"cfgEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; + + // Qvector configuration + Configurable cfgBypassQvec{"cfgBypassQvec", true, "Bypass for qvector task"}; + Configurable cfgEvtPl{"cfgEvtPl", 40500, "Configuration of three subsystems for the event plane and its resolution, 10000*RefA + 100*RefB + S, where FT0C:0, FT0A:1, FT0M:2, FV0A:3, BPos:5, BNeg:6"}; + + int evtPlRefAId = static_cast(cfgEvtPl / 10000); + int evtPlRefBId = static_cast((cfgEvtPl - evtPlRefAId * 10000) / 100); + int evtPlDetId = cfgEvtPl - evtPlRefAId * 10000 - evtPlRefBId * 100; + + HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgEvtZvtx; + + /** + * @brief Initializes the task + * + * @param context Initialization context + */ + void init(InitContext&) + { + mRunNumber = 0; + dBz = 0; + centrality = 0; + // Determine the multiplicity estimator based on the configuration + multEstimator = 0; + if (cfgMultName.value == "FT0M") { + multEstimator = 0; + } else if (cfgMultName.value == "FT0C") { + multEstimator = 1; + } else if (cfgMultName.value == "FT0A") { + multEstimator = 2; + } else if (cfgMultName.value == "FV0A") { + multEstimator = 99; + } + LOGF(info, "Mult estimator: %d, %s", multEstimator, cfgMultName.value.c_str()); + + // Ensure that only one process type is active at a time + if (doprocessRun3 && doprocessRun2) { + LOG(fatal) << "You cannot run both Run2 and Run3 processes at the same time"; + } + if (doprocessRun2MC && doprocessRun3MC) { + LOG(fatal) << "You cannot run both Run2 and Run3 MC processes at the same time"; + } + + // Initialize event selection cuts based on the process type + if (doprocessRun2) { + colCuts.setCuts(cfgEvtZvtx, cfgEvtTriggerCheck, cfgEvtTriggerSel, cfgEvtOfflineCheck, false); + } else if (doprocessRun3) { + colCuts.setCuts(cfgEvtZvtx, cfgEvtTriggerCheck, cfgEvtTriggerSel, cfgEvtOfflineCheck, true, false, cfgEvtOccupancyInTimeRange); + } + colCuts.init(&qaRegistry); + colCuts.setTriggerTVX(cfgEvtTriggerTVXSel); + colCuts.setApplyTFBorderCut(cfgEvtTFBorderCut); + colCuts.setApplyITSTPCvertex(cfgEvtUseITSTPCvertex); + colCuts.setApplyZvertexTimedifference(cfgEvtZvertexTimedifference); + colCuts.setApplyPileupRejection(cfgEvtPileupRejection); + colCuts.setApplyNoITSROBorderCut(cfgEvtNoITSROBorderCut); + + // Configure CCDB access if not bypassed + if (!cfgBypassCCDB) { + ccdb->setURL(ccdbURL.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(cfgFatalWhenNull); + uint64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); // TODO must become global parameter from the train creation time + } + + // Initialize QA histograms if required + if (doprocessRun3MC || doprocessRun2MC) { + AxisSpec centAxis = {binsCent, "Centrality (%)"}; + AxisSpec idxMCAxis = {26, -0.5, 25.5, "Index"}; + qaRegistry.add("Event/hMCEventIndices", "hMCEventIndices", kTH2D, {centAxis, idxMCAxis}); + } + } + + /** + * @brief Initializes CCDB for a given BC + * + * @param bc BC iterator + */ + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) // Simple copy from LambdaKzeroFinder.cxx + { + if (cfgBypassCCDB) + return; + if (mRunNumber == bc.runNumber()) { + return; + } + + // In case override, don't proceed, please - no CCDB access required + if (dBzInput > -990) { + dBz = dBzInput; + ; + o2::parameters::GRPMagField grpmag; + if (std::fabs(dBz) > 1e-5) { + grpmag.setL3Current(30000.f / (dBz / 5.0f)); + } + o2::base::Propagator::initFieldFromGRP(&grpmag); + mRunNumber = bc.runNumber(); + return; + } + + auto run3grpTimestamp = bc.timestamp(); + o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grpTimestamp); + o2::parameters::GRPMagField* grpmag = 0x0; + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + // Fetch magnetic field from ccdb for current collision + dBz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grpTimestamp << " with magnetic field of " << dBz << " kZG"; + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grpTimestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grpTimestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + // Fetch magnetic field from ccdb for current collision + dBz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grpTimestamp << " with magnetic field of " << dBz << " kZG"; + } + mRunNumber = bc.runNumber(); + // Set magnetic field value once known + LOGF(info, "Bz set to %f for run: ", dBz, mRunNumber); + } + + /** + * @brief Checks if the collision is INEL>0 + * + * @tparam MCPart Type of MC particles + * @param mcparts MC particles + * @return true if INEL>0, false otherwise + */ + template + bool isTrueINEL0(MCPart const& mcparts) + { + for (auto const& mcparticle : mcparts) { + if (!mcparticle.isPhysicalPrimary()) + continue; + auto p = pdg->GetParticle(mcparticle.pdgCode()); + if (p != nullptr) { + if (std::abs(p->Charge()) >= 3) { + if (std::abs(mcparticle.eta()) < 1) + return true; + } + } + } + return false; + } + + /** + * @brief Centrality estimator selection + * + * @tparam ResoColl Type of resonance collision + * @tparam isMC Boolean indicating if it's MC + * @param ResoEvents Resonance events + * @return Centrality value + */ + template + float centEst(ResoColl ResoEvents) + { + float returnValue = -999.0; + switch (multEstimator) { + case 0: + returnValue = ResoEvents.centFT0M(); + break; + case 1: + if constexpr (isMC) { + LOG(fatal) << "CentFV0A is not available for MC"; + return returnValue; + } else { + returnValue = ResoEvents.centFT0C(); + break; + } + case 2: + if constexpr (isMC) { + LOG(fatal) << "CentFT0A is not available for MC"; + return returnValue; + } else { + returnValue = ResoEvents.centFT0A(); + break; + } + case 99: + if constexpr (isMC) { + LOG(fatal) << "CentFV0A is not available for MC"; + return returnValue; + } else { + returnValue = ResoEvents.centFV0A(); + break; + } + default: + returnValue = ResoEvents.centFT0M(); + break; + } + return returnValue; + } + using GenMCCollisions = soa::Join; + float centEstMC(const GenMCCollisions::iterator& collision) { return centEst(collision); } + + /** + * @brief Computes the spherocity of an event + * + * @tparam T Type of the tracks + * @param tracks All tracks + * @param nTracksMin Minimum number of tracks + * @param spdef Spherocity definition + * @return Spherocity value + */ + template + float computeSpherocity(T const& tracks, int nTracksMin, int spdef) + { + // if number of tracks is not enough for spherocity estimation. + int ntrks = tracks.size(); + if (ntrks < nTracksMin) + return -99.; + + // start computing spherocity + + float ptSum = 0.; + for (auto const& track : tracks) { + if (cfgFillQA) { + qaRegistry.fill(HIST("Phi"), track.phi()); + } + if (spdef == 0) { + ptSum += 1.; + } else { + ptSum += track.pt(); + } + } + + float tempSph = 1.; + for (int i = 0; i < 360 / 0.1; ++i) { + float sum = 0., pt = 0.; + float phiparm = (PI * i * 0.1) / 180.; + float nx = std::cos(phiparm); + float ny = std::sin(phiparm); + for (auto const& trk : tracks) { + pt = trk.pt(); + if (spdef == 0) { + pt = 1.; + } + float phi = trk.phi(); + float px = pt * std::cos(phi); + float py = pt * std::sin(phi); + // sum += pt * abs(sin(phiparm - phi)); + sum += std::abs(px * ny - py * nx); + } + float sph = std::pow((sum / ptSum), 2); + if (sph < tempSph) + tempSph = sph; + } + + return std::pow(PIHalf, 2) * tempSph; + } + + /** + * @brief Gets the event plane + * + * @tparam ResoColl Type of resonance collision + * @param ResoEvents Resonance events + * @return Event plane value + */ + template + float getEvtPl(ResoColl ResoEvents) + { + float returnValue = -999.0; + if (ResoEvents.qvecAmp()[evtPlDetId] > 1e-8) + returnValue = helperEP.GetEventPlane(ResoEvents.qvecRe()[evtPlDetId * 4 + 3], ResoEvents.qvecIm()[evtPlDetId * 4 + 3], 2); + return returnValue; + } + + /** + * @brief Gets the event plane resolution + * + * @tparam ResoColl Type of resonance collision + * @param ResoEvents Resonance events + * @param a First index + * @param b Second index + * @return Event plane resolution + */ + template + float getEvtPlRes(ResoColl ResoEvents, int a, int b) + { + float returnValue = -999.0; + if (ResoEvents.qvecAmp()[a] < 1e-8 || ResoEvents.qvecAmp()[b] < 1e-8) + return returnValue; + returnValue = helperEP.GetResolution(helperEP.GetEventPlane(ResoEvents.qvecRe()[a * 4 + 3], ResoEvents.qvecIm()[a * 4 + 3], 2), helperEP.GetEventPlane(ResoEvents.qvecRe()[b * 4 + 3], ResoEvents.qvecIm()[b * 4 + 3], 2), 2); + return returnValue; + } + + /** + * @brief Fills MC particles + * + * @tparam CollisionType Type of collision + * @tparam SelectedMCPartType Type of selected MC particles + * @tparam TotalMCParts Type of total MC particles + * @param collision Collision data + * @param mcParts Selected MC particles + * @param mcParticles Total MC particles + */ + template + void fillMCParticles(CollisionType collision, SelectedMCPartType const& mcParts, TotalMCParts const& mcParticles) + { + for (auto const& mcPart : mcParts) { + std::vector daughterPDGs; + if (mcPart.has_daughters()) { + auto daughter01 = mcParticles.rawIteratorAt(mcPart.daughtersIds()[0] - mcParticles.offset()); + auto daughter02 = mcParticles.rawIteratorAt(mcPart.daughtersIds()[1] - mcParticles.offset()); + daughterPDGs = {daughter01.pdgCode(), daughter02.pdgCode()}; + } else { + daughterPDGs = {-1, -1}; + } + reso2mcparents(collision.globalIndex(), + mcPart.globalIndex(), + mcPart.pdgCode(), + daughterPDGs[0], daughterPDGs[1], + mcPart.isPhysicalPrimary(), + mcPart.producedByGenerator(), + mcPart.pt(), + mcPart.px(), + mcPart.py(), + mcPart.pz(), + mcPart.eta(), + mcPart.phi(), + mcPart.y()); + daughterPDGs.clear(); + } + } + + /** + * @brief Fills MC collision data + * + * @tparam isRun2 Boolean indicating if it's Run2 + * @tparam MCCol Type of MC collision + * @tparam MCPart Type of MC particles + * @param mccol MC collision data + * @param mcparts MC particles + */ + template + void fillMCCollision(MCCol const& mccol, MCPart const& mcparts) + { + const auto& mcColg = mccol.template mcCollision_as(); + float mcCent = 999.0; + if constexpr (isRun2) { + if (cfgCentralityMC == 0) { + mcCent = mccol.centRun2V0M(); + } else { + mcCent = mcColg.impactParameter(); + } + } else { + if (cfgCentralityMC == 0) { + mcCent = centEst(mccol); + } else if (cfgCentralityMC == 1) { + mcCent = centEstMC(mcColg); + } else if (cfgCentralityMC == 2) { + mcCent = mcColg.impactParameter(); + } + } + bool inVtx10 = (std::abs(mcColg.posZ()) > 10.) ? false : true; + bool isTrueINELgt0 = isTrueINEL0(mcparts); + bool isTriggerTVX = mccol.selection_bit(aod::evsel::kIsTriggerTVX); + bool isSel8 = mccol.sel8(); + bool isSelected = colCuts.isSelected(mccol); + resoMCCollisions(inVtx10, isTrueINELgt0, isTriggerTVX, isSel8, isSelected, mcCent); + + // QA for Trigger efficiency + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kINEL); + if (inVtx10) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kINEL10); + if (isTrueINELgt0) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kINELg0); + if (inVtx10 && isTrueINELgt0) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kINELg010); + + // TVX MB trigger + if (isTriggerTVX) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kTrig); + if (isTriggerTVX && inVtx10) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kTrig10); + if (isTriggerTVX && isTrueINELgt0) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kTrigINELg0); + if (isTriggerTVX && isTrueINELgt0 && inVtx10) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kTrigINELg010); + + // Sel8 event selection + if (isSel8) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kSel8); + if (isSel8 && inVtx10) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kSel810); + if (isSel8 && isTrueINELgt0) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kSel8INELg0); + if (isSel8 && isTrueINELgt0 && inVtx10) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kSel8INELg010); + + // CollisionCuts selection + if (isSelected) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kAllCuts); + if (isSelected && inVtx10) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kAllCuts10); + if (isSelected && isTrueINELgt0) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kAllCutsINELg0); + if (isSelected && isTrueINELgt0 && inVtx10) + qaRegistry.fill(HIST("Event/hMCEventIndices"), mcCent, aod::resocollision::kAllCutsINELg010); + } + + /** + * @brief Processes Dummy + * + * @param collision Collision data + */ + void processDummy(aod::Collisions const&) + { + } + PROCESS_SWITCH(ResonanceModuleInitializer, processDummy, "process Dummy", true); + + /** + * @brief Processes Run3 data + * + * @param collision Collision data + * @param bc BC data + */ + void processRun3(soa::Filtered::iterator const& collision, + aod::BCsWithTimestamps const&) + { + auto bc = collision.bc_as(); + initCCDB(bc); + // Default event selection + if (!colCuts.isSelected(collision)) + return; + colCuts.fillQA(collision); + centrality = centEst(collision); + + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centrality, -999, 0., 0., 0., 0., dBz, bc.timestamp(), collision.trackOccupancyInTimeRange()); + } + PROCESS_SWITCH(ResonanceModuleInitializer, processRun3, "Default process for RUN3", false); + + /** + * @brief Processes Run2 data + * + * @param collision Collision data + * @param bc BC data + */ + void processRun2(soa::Filtered::iterator const& collision, + aod::BCsWithRun2Info const&) + { + auto bc = collision.bc_as(); + // Default event selection + if (!colCuts.isSelected(collision)) + return; + colCuts.fillQARun2(collision); + centrality = collision.centRun2V0M(); + + resoCollisions(collision.globalIndex(), 0, collision.posX(), collision.posY(), collision.posZ(), centrality, -999, 0., 0., 0., 0., dBz, bc.timestamp(), -999); + } + PROCESS_SWITCH(ResonanceModuleInitializer, processRun2, "process for RUN2", false); + + /** + * @brief Processes Run3 MC data + * + * @param collision Collision data + * @param mcParticles MC particles + * @param mcCollisions MC collisions + */ + void processRun3MC(soa::Filtered::iterator const& collision, + aod::McParticles const& mcParticles, GenMCCollisions const&) + { + fillMCCollision(collision, mcParticles); + } + PROCESS_SWITCH(ResonanceModuleInitializer, processRun3MC, "process MC for RUN3", false); + + /** + * @brief Processes Run2 MC data + * + * @param collision Collision data + * @param mcParticles MC particles + */ + void processRun2MC(soa::Filtered::iterator const& collision, + aod::McParticles const& mcParticles) + { + fillMCCollision(collision, mcParticles); + } + PROCESS_SWITCH(ResonanceModuleInitializer, processRun2MC, "process MC for RUN2", false); +}; + +/** + * @brief Initializer for the resonance daughters producer + * + * This struct initializes and processes daughters for resonance studies. + * It applies daughter selection criteria and fills QA histograms for daughter properties. + */ +struct ResonanceDaughterInitializer { + SliceCache cache; + Produces reso2trks; ///< Output table for resonance tracks + Produces reso2mctracks; ///< Output table for MC resonance tracks + Produces reso2v0s; ///< Output table for resonance V0s + Produces reso2mcv0s; ///< Output table for MC resonance V0s + Produces reso2cascades; ///< Output table for resonance cascades + Produces reso2mccascades; ///< Output table for MC resonance cascades + + // Configurables + Configurable cfgFillQA{"cfgFillQA", false, "Fill QA histograms"}; + + // Configurables for tracks + Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 2.0, "Track DCAr cut to PV Maximum"}; + Configurable cMinDCArToPVcut{"cMinDCArToPVcut", 0.0, "Track DCAr cut to PV Minimum"}; + Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + Configurable cMinDCAzToPVcut{"cMinDCAzToPVcut", 0.0, "Track DCAz cut to PV Minimum"}; + Configurable trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; + + // Configurables for V0s + Configurable cMinV0Radius{"cMinV0Radius", 0.0, "Minimum V0 radius from PV"}; + Configurable cMaxV0Radius{"cMaxV0Radius", 200.0, "Maximum V0 radius from PV"}; + Configurable cMinV0CosPA{"cMinV0CosPA", 0.995, "Minimum V0 CosPA to PV"}; + + // Configurables for cascades + Configurable cMinCascRadius{"cMinCascRadius", 0.0, "Minimum Cascade radius from PV"}; + Configurable cMaxCascRadius{"cMaxCascRadius", 200.0, "Maximum Cascade radius from PV"}; + Configurable cMinCascCosPA{"cMinCascCosPA", 0.97, "Minimum Cascade CosPA to PV"}; + + // Filters + Filter dcaXYFilter = nabs(aod::track::dcaXY) < cMaxDCArToPVcut && nabs(aod::track::dcaXY) > cMinDCArToPVcut; + Filter dcaZFilter = nabs(aod::track::dcaZ) < cMaxDCAzToPVcut && nabs(aod::track::dcaZ) > cMinDCAzToPVcut; + Preslice perMcCollision = aod::mcparticle::mcCollisionId; + + // Track selection filter based on configuration + Filter trackFilter = (trackSelection.node() == 0) || + ((trackSelection.node() == 1) && requireGlobalTrackInFilter()) || // kGlobalTrack = kQualityTracks | kPrimaryTracks | kInAcceptanceTracks + ((trackSelection.node() == 2) && requireGlobalTrackWoPtEtaInFilter()) || // kGlobalTrackWoPtEta = kQualityTracks | kPrimaryTracks + ((trackSelection.node() == 3) && requireGlobalTrackWoDCAInFilter()) || // kGlobalTrackWoDCA = kQualityTracks | kInAcceptanceTracks + ((trackSelection.node() == 4) && requireQualityTracksInFilter()) || // kQualityTracks = kQualityTracksITS | kQualityTracksTPC + ((trackSelection.node() == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); // kInAcceptanceTracks = kPtRange | kEtaRange + HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + /** + * @brief Initializes the task + * + * @param context Initialization context + */ + void init(InitContext&) + { + if (cfgFillQA) { + AxisSpec idxAxis = {8, -0.5, 7.5, "Index"}; + AxisSpec ptAxis = {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec etaAxis = {100, -1.0f, 1.0f, "#eta"}; + AxisSpec phiAxis = {100, 0.0f, TwoPI, "#phi"}; + + qaRegistry.add("QA/hGoodTrackIndices", "hGoodTrackIndices", kTH1D, {idxAxis}); + if (doprocessMC) { + qaRegistry.add("QA/hGoodMCTrackIndices", "hGoodMCTrackIndices", kTH1D, {idxAxis}); + } + qaRegistry.add("QA/hTrackPt", "Track pT", kTH1F, {ptAxis}); + qaRegistry.add("QA/hTrackEta", "Track eta", kTH1F, {etaAxis}); + qaRegistry.add("QA/hTrackPhi", "Track phi", kTH1F, {phiAxis}); + + if (doprocessV0Data || doprocessV0MC) { + qaRegistry.add("QA/hGoodV0Indices", "hGoodV0Indices", kTH1D, {idxAxis}); + if (doprocessMC) { + qaRegistry.add("QA/hGoodMCV0Indices", "hGoodMCV0Indices", kTH1D, {idxAxis}); + } + AxisSpec radiusAxis = {100, 0.0, 200.0, "V0 Radius"}; + AxisSpec cosPAAxis = {100, 0.995, 1.0, "V0 CosPA"}; + qaRegistry.add("QA/hV0Radius", "V0 Radius", kTH1F, {radiusAxis}); + qaRegistry.add("QA/hV0CosPA", "V0 CosPA", kTH1F, {cosPAAxis}); + } + + if (doprocessCascData || doprocessCascMC) { + AxisSpec radiusAxis = {100, 0.0, 200.0, "Cascade Radius"}; + AxisSpec cosPAAxis = {100, 0.97, 1.0, "Cascade CosPA"}; + qaRegistry.add("QA/hGoodCascIndices", "hGoodCascIndices", kTH1D, {idxAxis}); + if (doprocessMC) { + qaRegistry.add("QA/hGoodMCCascIndices", "hGoodMCCascIndices", kTH1D, {idxAxis}); + } + qaRegistry.add("QA/hCascRadius", "Cascade Radius", kTH1F, {radiusAxis}); + qaRegistry.add("QA/hCascCosPA", "Cascade CosPA", kTH1F, {cosPAAxis}); + } + } + if (doprocessData || doprocessMC) { + LOGF(info, "ResonanceDaughterInitializer initialized with tracks"); + } + if (doprocessV0Data || doprocessV0MC) { + LOGF(info, "ResonanceDaughterInitializer initialized with V0s"); + } + if (doprocessCascData || doprocessCascMC) { + LOGF(info, "ResonanceDaughterInitializer initialized with cascades"); + } + + // Check if the module is initialized with both data and MC + if ((doprocessData && doprocessMC) || (doprocessV0Data && doprocessV0MC) || (doprocessCascData && doprocessCascMC)) { + LOGF(fatal, "ResonanceDaughterInitializer initialized with both data and MC"); + } + // Check if none of the processes are enabled + if (!doprocessDummy && !doprocessData && !doprocessMC && !doprocessV0Data && !doprocessV0MC && !doprocessCascData && !doprocessCascMC) { + LOGF(fatal, "ResonanceDaughterInitializer not initialized, enable at least one process"); + } + } + + /** + * @brief Fills track data + * + * @tparam isMC Boolean indicating if it's MC + * @tparam TrackType Type of track + * @tparam CollisionType Type of collision + * @param collision Collision data + * @param tracks Track data + */ + template + void fillTracks(CollisionType const& collision, TrackType const& tracks) + { + // Loop over tracks + for (auto const& track : tracks) { + if (cfgFillQA) { + qaRegistry.fill(HIST("QA/hGoodTrackIndices"), 0); + qaRegistry.fill(HIST("QA/hTrackPt"), track.pt()); + qaRegistry.fill(HIST("QA/hTrackEta"), track.eta()); + qaRegistry.fill(HIST("QA/hTrackPhi"), track.phi()); + } + reso2trks(collision.globalIndex(), + track.globalIndex(), + track.pt(), + track.px(), + track.py(), + track.pz(), + track.eta(), + track.phi(), + track.sign(), + (uint8_t)track.tpcNClsCrossedRows(), + (uint8_t)track.tpcNClsFound(), + (uint8_t)track.itsNCls(), + track.dcaXY(), + track.dcaZ(), + track.x(), + track.alpha(), + track.hasITS(), + track.hasTPC(), + track.hasTOF(), + track.tpcNSigmaPi(), + track.tpcNSigmaKa(), + track.tpcNSigmaPr(), + track.tpcNSigmaEl(), + track.tofNSigmaPi(), + track.tofNSigmaKa(), + track.tofNSigmaPr(), + track.tofNSigmaEl(), + track.tpcSignal(), + track.passedITSRefit(), + track.passedTPCRefit(), + track.isGlobalTrackWoDCA(), + track.isGlobalTrack(), + track.isPrimaryTrack(), + track.isPVContributor(), + track.tpcCrossedRowsOverFindableCls(), + track.itsChi2NCl(), + track.tpcChi2NCl()); + if constexpr (isMC) { + fillMCTrack(track); + } + } + } + + /** + * @brief Fills MC track data + * + * @tparam TrackType Type of track + * @param track Track data + */ + template + void fillMCTrack(TrackType const& track) + { + // ------ Temporal lambda function to prevent error in build + auto getMothersIndeces = [&](auto const& theMcParticle) { + std::vector lMothersIndeces{}; + for (auto const& lMother : theMcParticle.template mothers_as()) { + LOGF(debug, " mother index lMother: %d", lMother.globalIndex()); + lMothersIndeces.push_back(lMother.globalIndex()); + } + return lMothersIndeces; + }; + auto getMothersPDGCodes = [&](auto const& theMcParticle) { + std::vector lMothersPDGs{}; + for (auto const& lMother : theMcParticle.template mothers_as()) { + LOGF(debug, " mother pdgcode lMother: %d", lMother.pdgCode()); + lMothersPDGs.push_back(lMother.pdgCode()); + } + return lMothersPDGs; + }; + auto getSiblingsIndeces = [&](auto const& theMcParticle) { + std::vector lSiblingsIndeces{}; + for (auto const& lMother : theMcParticle.template mothers_as()) { + LOGF(debug, " mother index lMother: %d", lMother.globalIndex()); + for (auto const& lDaughter : lMother.template daughters_as()) { + LOGF(debug, " daughter index lDaughter: %d", lDaughter.globalIndex()); + if (lDaughter.globalIndex() != 0 && lDaughter.globalIndex() != theMcParticle.globalIndex()) { + lSiblingsIndeces.push_back(lDaughter.globalIndex()); + } + } + } + return lSiblingsIndeces; + }; + // ------ + std::vector mothers = {-1, -1}; + std::vector motherPDGs = {-1, -1}; + int siblings[2] = {0, 0}; + std::vector siblingsTemp = {-1, -1}; + if (track.has_mcParticle()) { + if (cfgFillQA) { + qaRegistry.fill(HIST("QA/hGoodMCTrackIndices"), 0); + } + // Get the MC particle + const auto& particle = track.mcParticle(); + if (particle.has_mothers()) { + mothers = getMothersIndeces(particle); + motherPDGs = getMothersPDGCodes(particle); + siblingsTemp = getSiblingsIndeces(particle); + } + while (mothers.size() > 2) { + mothers.pop_back(); + motherPDGs.pop_back(); + } + if (siblingsTemp.size() > 0) + siblings[0] = siblingsTemp[0]; + if (siblingsTemp.size() > 1) + siblings[1] = siblingsTemp[1]; + reso2mctracks(particle.pdgCode(), + mothers[0], + motherPDGs[0], + siblings, + particle.isPhysicalPrimary(), + particle.producedByGenerator()); + } else { + // No MC particle associated + reso2mctracks(0, + mothers[0], + motherPDGs[0], + siblings, + 0, + 0); + } + } + + /** + * @brief Fills V0 data + * + * @tparam isMC Boolean indicating if it's MC + * @tparam CollisionType Type of collision + * @tparam V0Type Type of V0 + * @tparam TrackType Type of track + * @param collision Collision data + * @param v0s V0 data + * @param tracks Track data + */ + template + void fillV0s(CollisionType const& collision, V0Type const& v0s, TrackType const&) + { + int childIDs[2] = {0, 0}; // these IDs are necessary to keep track of the children + for (auto const& v0 : v0s) { + if (cfgFillQA) { + qaRegistry.fill(HIST("QA/hGoodV0Indices"), 0); + qaRegistry.fill(HIST("QA/hV0Radius"), v0.v0radius()); + qaRegistry.fill(HIST("QA/hV0CosPA"), v0.v0cosPA()); + } + childIDs[0] = v0.posTrackId(); + childIDs[1] = v0.negTrackId(); + reso2v0s(collision.globalIndex(), + v0.globalIndex(), + v0.pt(), + v0.px(), + v0.py(), + v0.pz(), + v0.eta(), + v0.phi(), + childIDs, + v0.template posTrack_as().tpcNSigmaPi(), + v0.template posTrack_as().tpcNSigmaKa(), + v0.template posTrack_as().tpcNSigmaPr(), + v0.template negTrack_as().tpcNSigmaPi(), + v0.template negTrack_as().tpcNSigmaKa(), + v0.template negTrack_as().tpcNSigmaPr(), + v0.template negTrack_as().tofNSigmaPi(), + v0.template negTrack_as().tofNSigmaKa(), + v0.template negTrack_as().tofNSigmaPr(), + v0.template posTrack_as().tofNSigmaPi(), + v0.template posTrack_as().tofNSigmaKa(), + v0.template posTrack_as().tofNSigmaPr(), + v0.v0cosPA(), + v0.dcaV0daughters(), + v0.dcapostopv(), + v0.dcanegtopv(), + v0.dcav0topv(), + v0.mLambda(), + v0.mAntiLambda(), + v0.mK0Short(), + v0.v0radius(), v0.x(), v0.y(), v0.z()); + if constexpr (isMC) { + fillMCV0(v0); + } + } + } + + /** + * @brief Fills MC V0 data + * + * @tparam V0Type Type of V0 + * @param v0 V0 data + */ + template + void fillMCV0(V0Type const& v0) + { + // ------ Temporal lambda function to prevent error in build + auto getMothersIndeces = [&](auto const& theMcParticle) { + std::vector lMothersIndeces{}; + for (auto const& lMother : theMcParticle.template mothers_as()) { + LOGF(debug, " mother index lMother: %d", lMother.globalIndex()); + lMothersIndeces.push_back(lMother.globalIndex()); + } + return lMothersIndeces; + }; + auto getMothersPDGCodes = [&](auto const& theMcParticle) { + std::vector lMothersPDGs{}; + for (auto const& lMother : theMcParticle.template mothers_as()) { + LOGF(debug, " mother pdgcode lMother: %d", lMother.pdgCode()); + lMothersPDGs.push_back(lMother.pdgCode()); + } + return lMothersPDGs; + }; + auto getDaughtersIndeces = [&](auto const& theMcParticle) { + std::vector lDaughtersIndeces{}; + for (auto const& lDaughter : theMcParticle.template daughters_as()) { + LOGF(debug, " daughter index lDaughter: %d", lDaughter.globalIndex()); + if (lDaughter.globalIndex() != 0) { + lDaughtersIndeces.push_back(lDaughter.globalIndex()); + } + } + return lDaughtersIndeces; + }; + auto getDaughtersPDGCodes = [&](auto const& theMcParticle) { + std::vector lDaughtersPDGs{}; + for (auto const& lDaughter : theMcParticle.template daughters_as()) { + LOGF(debug, " daughter pdgcode lDaughter: %d", lDaughter.pdgCode()); + if (lDaughter.globalIndex() != 0) { + lDaughtersPDGs.push_back(lDaughter.pdgCode()); + } + } + return lDaughtersPDGs; + }; + // ------ + std::vector mothers = {-1, -1}; + std::vector motherPDGs = {-1, -1}; + std::vector daughters = {-1, -1}; + std::vector daughterPDGs = {-1, -1}; + if (v0.has_mcParticle()) { + if (cfgFillQA) { + qaRegistry.fill(HIST("QA/hGoodMCV0Indices"), 0); + } + auto v0mc = v0.mcParticle(); + if (v0mc.has_mothers()) { + mothers = getMothersIndeces(v0mc); + motherPDGs = getMothersPDGCodes(v0mc); + } + while (mothers.size() > 2) { + mothers.pop_back(); + motherPDGs.pop_back(); + } + if (v0mc.has_daughters()) { + daughters = getDaughtersIndeces(v0mc); + daughterPDGs = getDaughtersPDGCodes(v0mc); + } + while (daughters.size() > 2) { + LOGF(info, "daughters.size() is larger than 2"); + daughters.pop_back(); + daughterPDGs.pop_back(); + } + reso2mcv0s(v0mc.pdgCode(), + mothers[0], + motherPDGs[0], + daughters[0], + daughters[1], + daughterPDGs[0], + daughterPDGs[1], + v0mc.isPhysicalPrimary(), + v0mc.producedByGenerator()); + } else { + reso2mcv0s(0, + mothers[0], + motherPDGs[0], + daughters[0], + daughters[1], + daughterPDGs[0], + daughterPDGs[1], + 0, + 0); + } + } + + /** + * @brief Fills cascade data + * + * @tparam isMC Boolean indicating if it's MC + * @tparam CollisionType Type of collision + * @tparam CascType Type of cascade + * @tparam TrackType Type of track + * @param collision Collision data + * @param cascades Cascade data + * @param tracks Track data + */ + template + void fillCascades(CollisionType const& collision, CascType const& cascades, TrackType const&) + { + int childIDs[3] = {0, 0, 0}; // these IDs are necessary to keep track of the children + for (auto const& casc : cascades) { + if (cfgFillQA) { + qaRegistry.fill(HIST("QA/hGoodCascIndices"), 0); + qaRegistry.fill(HIST("QA/hCascRadius"), casc.cascradius()); + qaRegistry.fill(HIST("QA/hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + } + childIDs[0] = casc.posTrackId(); + childIDs[1] = casc.negTrackId(); + childIDs[2] = casc.bachelorId(); + reso2cascades(collision.globalIndex(), + casc.globalIndex(), + casc.pt(), + casc.px(), + casc.py(), + casc.pz(), + casc.eta(), + casc.phi(), + childIDs, + casc.template posTrack_as().tpcNSigmaPi(), + casc.template posTrack_as().tpcNSigmaKa(), + casc.template posTrack_as().tpcNSigmaPr(), + casc.template negTrack_as().tpcNSigmaPi(), + casc.template negTrack_as().tpcNSigmaKa(), + casc.template negTrack_as().tpcNSigmaPr(), + casc.template bachelor_as().tpcNSigmaPi(), + casc.template bachelor_as().tpcNSigmaKa(), + casc.template bachelor_as().tpcNSigmaPr(), + casc.template posTrack_as().tofNSigmaPi(), + casc.template posTrack_as().tofNSigmaKa(), + casc.template posTrack_as().tofNSigmaPr(), + casc.template negTrack_as().tofNSigmaPi(), + casc.template negTrack_as().tofNSigmaKa(), + casc.template negTrack_as().tofNSigmaPr(), + casc.template bachelor_as().tofNSigmaPi(), + casc.template bachelor_as().tofNSigmaKa(), + casc.template bachelor_as().tofNSigmaPr(), + casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()), + casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()), + casc.dcaV0daughters(), + casc.dcacascdaughters(), + casc.dcapostopv(), + casc.dcanegtopv(), + casc.dcabachtopv(), + casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()), + casc.dcaXYCascToPV(), + casc.dcaZCascToPV(), + casc.sign(), + casc.mXi(), + casc.v0radius(), casc.cascradius(), casc.x(), casc.y(), casc.z()); + if constexpr (isMC) { + fillMCCascade(casc); + } + } + } + + /** + * @brief Fills MC cascade data + * + * @tparam CascType Type of cascade + * @param casc Cascade data + */ + template + void fillMCCascade(CascType const& casc) + { + // ------ Temporal lambda function to prevent error in build + auto getMothersIndeces = [&](auto const& theMcParticle) { + std::vector lMothersIndeces{}; + for (auto const& lMother : theMcParticle.template mothers_as()) { + LOGF(debug, " mother index lMother: %d", lMother.globalIndex()); + lMothersIndeces.push_back(lMother.globalIndex()); + } + return lMothersIndeces; + }; + auto getMothersPDGCodes = [&](auto const& theMcParticle) { + std::vector lMothersPDGs{}; + for (auto const& lMother : theMcParticle.template mothers_as()) { + LOGF(debug, " mother pdgcode lMother: %d", lMother.pdgCode()); + lMothersPDGs.push_back(lMother.pdgCode()); + } + return lMothersPDGs; + }; + auto getDaughtersIndeces = [&](auto const& theMcParticle) { + std::vector lDaughtersIndeces{}; + for (auto const& lDaughter : theMcParticle.template daughters_as()) { + LOGF(debug, " daughter index lDaughter: %d", lDaughter.globalIndex()); + if (lDaughter.globalIndex() != 0) { + lDaughtersIndeces.push_back(lDaughter.globalIndex()); + } + } + return lDaughtersIndeces; + }; + auto getDaughtersPDGCodes = [&](auto const& theMcParticle) { + std::vector lDaughtersPDGs{}; + for (auto const& lDaughter : theMcParticle.template daughters_as()) { + LOGF(debug, " daughter pdgcode lDaughter: %d", lDaughter.pdgCode()); + if (lDaughter.globalIndex() != 0) { + lDaughtersPDGs.push_back(lDaughter.pdgCode()); + } + } + return lDaughtersPDGs; + }; + // ------ + std::vector mothers = {-1, -1}; + std::vector motherPDGs = {-1, -1}; + std::vector daughters = {-1, -1}; + std::vector daughterPDGs = {-1, -1}; + if (casc.has_mcParticle()) { + if (cfgFillQA) { + qaRegistry.fill(HIST("QA/hGoodMCCascIndices"), 0); + } + auto cascmc = casc.mcParticle(); + if (cascmc.has_mothers()) { + mothers = getMothersIndeces(cascmc); + motherPDGs = getMothersPDGCodes(cascmc); + } + while (mothers.size() > 2) { + mothers.pop_back(); + motherPDGs.pop_back(); + } + if (cascmc.has_daughters()) { + daughters = getDaughtersIndeces(cascmc); + daughterPDGs = getDaughtersPDGCodes(cascmc); + } + while (daughters.size() > 2) { + LOGF(info, "daughters.size() is larger than 2"); + daughters.pop_back(); + daughterPDGs.pop_back(); + } + reso2mccascades(cascmc.pdgCode(), + mothers[0], + motherPDGs[0], + daughters[0], + daughters[1], + daughterPDGs[0], + daughterPDGs[1], + cascmc.isPhysicalPrimary(), + cascmc.producedByGenerator()); + } else { + reso2mccascades(0, + mothers[0], + motherPDGs[0], + daughters[0], + daughters[1], + daughterPDGs[0], + daughterPDGs[1], + 0, + 0); + } + } + + /** + * @brief Processes dummy + * + * @param collision Collision data + */ + void processDummy(aod::ResoCollision const&) + { + } + PROCESS_SWITCH(ResonanceDaughterInitializer, processDummy, "Process dummy", true); + + /** + * @brief Processes data tracks + * + * @param collision Collision data + * @param tracks Track data + */ + void processData(aod::ResoCollision const& collision, + soa::Filtered const& tracks) + { + fillTracks(collision, tracks); + } + PROCESS_SWITCH(ResonanceDaughterInitializer, processData, "Process tracks for data", false); + + /** + * @brief Processes MC tracks + * + * @param collision Collision data + * @param tracks Track data + * @param mcParticles MC particles + */ + void processMC(aod::ResoCollision const& collision, + soa::Filtered const& tracks, + aod::McParticles const&) + { + fillTracks(collision, tracks); + } + PROCESS_SWITCH(ResonanceDaughterInitializer, processMC, "Process tracks for MC", false); + + /** + * @brief Processes V0 data + * + * @param collision Collision data + * @param v0s V0 data + * @param tracks Track data + */ + void processV0Data(aod::ResoCollision const& collision, soa::Filtered const& v0s, aod::ResoTrackCandidates const& tracks) + { + fillV0s(collision, v0s, tracks); + } + PROCESS_SWITCH(ResonanceDaughterInitializer, processV0Data, "Process V0s for data", false); + + /** + * @brief Processes MC V0 data + * + * @param collision Collision data + * @param v0s V0 data + * @param tracks Track data + */ + void processV0MC(aod::ResoCollision const& collision, soa::Filtered const& v0s, aod::ResoTrackCandidatesMC const& tracks) + { + fillV0s(collision, v0s, tracks); + } + PROCESS_SWITCH(ResonanceDaughterInitializer, processV0MC, "Process V0s for MC", false); + + /** + * @brief Processes cascade data + * + * @param collision Collision data + * @param cascades Cascade data + * @param tracks Track data + */ + void processCascData(aod::ResoCollision const& collision, soa::Filtered const& cascades, aod::ResoTrackCandidates const& tracks) + { + fillCascades(collision, cascades, tracks); + } + PROCESS_SWITCH(ResonanceDaughterInitializer, processCascData, "Process Cascades for data", false); + + /** + * @brief Processes MC cascade data + * + * @param collision Collision data + * @param cascades Cascade data + * @param tracks Track data + */ + void processCascMC(aod::ResoCollision const& collision, soa::Filtered const& cascades, aod::ResoTrackCandidatesMC const& tracks) + { + fillCascades(collision, cascades, tracks); + } + PROCESS_SWITCH(ResonanceDaughterInitializer, processCascMC, "Process Cascades for MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt index e75fbd9e573..50311dd41cd 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt @@ -39,6 +39,11 @@ o2physics_add_dpl_workflow(straevselsconverter3 PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(straevselsconverter4 + SOURCES straevselsconverter4.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(straevselsconverter2rawcents SOURCES straevselsconverter2rawcents.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -67,4 +72,14 @@ o2physics_add_dpl_workflow(v0coresconverter2 o2physics_add_dpl_workflow(v0mlscoresconverter SOURCES v0mlscoresconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(stramccollisionconverter + SOURCES stramccollisionconverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(strastampsconverter + SOURCES strastampsconverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter4.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter4.cxx new file mode 100644 index 00000000000..ad988fd93aa --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter4.cxx @@ -0,0 +1,66 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "ITStracking/Vertexer.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +using namespace o2; +using namespace o2::framework; + +// Converts Stra Event selections from 000 to 001 +struct straevselsconverter4 { + Produces straEvSels_004; + + void process(aod::StraEvSels_003 const& straEvSels_003) + { + for (auto& values : straEvSels_003) { + straEvSels_004(values.sel8(), + values.selection_raw(), + values.multFT0A(), + values.multFT0C(), + values.multFT0A(), + 0 /*dummy FDDA value*/, + 0 /*dummy FDDC value*/, + values.multNTracksPVeta1(), + values.multPVTotalContributors(), + values.multNTracksGlobal(), + values.multNTracksITSTPC(), + values.multAllTracksTPCOnly(), + values.multAllTracksITSTPC(), + values.multZNA(), + values.multZNC(), + values.multZEM1(), + values.multZEM2(), + values.multZPA(), + values.multZPC(), + values.trackOccupancyInTimeRange(), + 0 /*dummy occupancy value*/, + values.gapSide(), + values.totalFT0AmplitudeA(), + values.totalFT0AmplitudeC(), + values.totalFV0AmplitudeA(), + values.totalFDDAmplitudeA(), + values.totalFDDAmplitudeC(), + values.energyCommonZNA(), + values.energyCommonZNC(), + values.flags(), + 0 /*dummy Alias value*/); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/stramccollisionconverter.cxx b/PWGLF/TableProducer/Strangeness/Converters/stramccollisionconverter.cxx new file mode 100644 index 00000000000..8c7950dc4fd --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/stramccollisionconverter.cxx @@ -0,0 +1,36 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +using namespace o2; +using namespace o2::framework; + +// Converts V0 version 001 to 002 +struct stramccollisionconverter { + Produces straMCCollisions_001; + + void process(aod::StraMCCollisions_000 const& straMCcoll) + { + for (auto& mccollision : straMCcoll) { + straMCCollisions_001(mccollision.posX(), mccollision.posY(), mccollision.posZ(), + mccollision.impactParameter(), 0.0f); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/strastampsconverter.cxx b/PWGLF/TableProducer/Strangeness/Converters/strastampsconverter.cxx new file mode 100644 index 00000000000..7f5f129d623 --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/strastampsconverter.cxx @@ -0,0 +1,37 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +using namespace o2; +using namespace o2::framework; + +// Converts Stra Stamps from 000 to 001 +struct strastampsconverter { + Produces straStamps_001; + + void process(aod::StraStamps_000 const& straStamps_000) + { + for (auto& values : straStamps_000) { + straStamps_001(values.runNumber(), + values.timestamp(), + 0 /*dummy globalBC value*/); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/v0mlscoresconverter.cxx b/PWGLF/TableProducer/Strangeness/Converters/v0mlscoresconverter.cxx index f7e901e780f..9f2020bf20d 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/v0mlscoresconverter.cxx +++ b/PWGLF/TableProducer/Strangeness/Converters/v0mlscoresconverter.cxx @@ -26,7 +26,7 @@ struct v0mlscoresconverter { void process(aod::V0Cores const& v0cores) { - for (auto& values : v0cores) { + for (int64_t i = 0; i < v0cores.size(); ++i) { gammaMLSelections(-1); lambdaMLSelections(-1); antiLambdaMLSelections(-1); diff --git a/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx b/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx index 30a0b178454..6a7c74dc273 100644 --- a/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx @@ -36,6 +36,8 @@ // david.dobrigkeit.chinellato@cern.ch // +#include +#include #include #include #include @@ -124,6 +126,7 @@ struct cascadeBuilder { Produces cascTrackXs; // if desired for replaying of position information Produces cascbb; // if enabled Produces casccovs; // if requested by someone + Produces tracasccovs; // if requested by someone Produces kfcasccovs; // if requested by someone // produces calls for machine-learning selections @@ -136,7 +139,7 @@ struct cascadeBuilder { Configurable d_UseAutodetectMode{"d_UseAutodetectMode", false, "Autodetect requested topo sels"}; // Configurables related to table creation - Configurable createCascCovMats{"createCascCovMats", -1, {"Produces V0 cov matrices. -1: auto, 0: don't, 1: yes. Default: auto (-1)"}}; + Configurable createCascCovMats{"createCascCovMats", -1, {"Produces casc cov matrices. -1: auto, 0: don't, 1: yes. Default: auto (-1)"}}; Configurable createCascTrackXs{"createCascTrackXs", -1, {"Produces track X at minima table. -1: auto, 0: don't, 1: yes. Default: auto (-1)"}}; // Topological selection criteria @@ -1409,12 +1412,8 @@ struct cascadeBuilder { KFXi.TransportToDecayVertex(); KFOmega.TransportToDecayVertex(); - // get DCA of updated daughters at vertex - KFParticle kfpBachPionUpd = kfpBachPion; - KFParticle kfpV0Upd = kfpV0; - kfpBachPionUpd.SetProductionVertex(KFXi); - kfpV0Upd.SetProductionVertex(KFXi); - cascadecandidate.dcacascdau = kfpBachPionUpd.GetDistanceFromParticle(kfpV0Upd); + // get DCA of daughters at vertex + cascadecandidate.dcacascdau = kfpBachPion.GetDistanceFromParticle(kfpV0); if (cascadecandidate.dcacascdau > dcacascdau) return false; @@ -1601,15 +1600,19 @@ struct cascadeBuilder { // store momentum covariance matrix std::array covTv0 = {0.}; std::array covTbachelor = {0.}; + float covCascade[21]; // std::array momentumCovariance; - float momentumCovariance[6]; lV0Track.getCovXYZPxPyPzGlo(covTv0); lBachelorTrack.getCovXYZPxPyPzGlo(covTbachelor); constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (int i = 0; i < 21; i++) { + covCascade[i] = 0.0f; + } for (int i = 0; i < 6; i++) { - momentumCovariance[i] = covTv0[MomInd[i]] + covTbachelor[MomInd[i]]; + covCascade[i] = positionCovariance[i]; + covCascade[MomInd[i]] = covTv0[MomInd[i]] + covTbachelor[MomInd[i]]; } - casccovs(positionCovariance, momentumCovariance); + casccovs(covCascade); } } @@ -1778,15 +1781,19 @@ struct cascadeBuilder { // store momentum covariance matrix std::array covTv0 = {0.}; std::array covTbachelor = {0.}; + float covCascade[21]; // std::array momentumCovariance; - float momentumCovariance[6]; lV0Track.getCovXYZPxPyPzGlo(covTv0); lBachelorTrack.getCovXYZPxPyPzGlo(covTbachelor); constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (int i = 0; i < 21; i++) { + covCascade[i] = 0.0f; + } for (int i = 0; i < 6; i++) { - momentumCovariance[i] = covTv0[MomInd[i]] + covTbachelor[MomInd[i]]; + covCascade[i] = positionCovariance[i]; + covCascade[MomInd[i]] = covTv0[MomInd[i]] + covTbachelor[MomInd[i]]; } - casccovs(positionCovariance, momentumCovariance); + casccovs(covCascade); } float lPt = 0.0f; @@ -1830,7 +1837,7 @@ struct cascadeBuilder { continue; // safety (should be fine but depends on future stratrack dev) // Track casting to auto cascadeTrack = trackedCascade.template track_as(); - auto cascadeTrackPar = getTrackPar(cascadeTrack); + auto cascadeTrackPar = getTrackParCov(cascadeTrack); auto const& collision = cascade.collision(); gpu::gpustd::array dcaInfo; lCascadeTrack.setPID(o2::track::PID::XiMinus); // FIXME: not OK for omegas @@ -1910,6 +1917,19 @@ struct cascadeBuilder { cascadecandidate.v0dcapostopv, cascadecandidate.v0dcanegtopv, cascadecandidate.bachDCAxy, cascadecandidate.cascDCAxy, cascadecandidate.cascDCAz, // <--- stratrack (cascDCAxy/z) trackedCascade.matchingChi2(), trackedCascade.topologyChi2(), trackedCascade.itsClsSize()); // <--- stratrack fit info + + if (createCascCovMats) { + // create tracked cascade covariance in exactly the same way as non-tracked + // ensures getter consistency and full compatibility in template functions + // (easy switching between tracked and non-tracked) + std::array traCovMat = {0.}; + cascadeTrackPar.getCovXYZPxPyPzGlo(traCovMat); + float traCovMatArray[21]; + for (int ii = 0; ii < 21; ii++) { + traCovMatArray[ii] = traCovMat[ii]; + } + tracasccovs(traCovMatArray); + } } } // En masse filling at end of process call @@ -2234,7 +2254,7 @@ struct cascadePreselector { void checkAndFinalize() { // parse + publish tag table now - for (int ii = 0; ii < selectionMask.size(); ii++) { + for (std::size_t ii = 0; ii < selectionMask.size(); ii++) { histos.fill(HIST("hPreselectorStatistics"), 0.0f); // All cascades bool validCascade = bitcheck(selectionMask[ii], bitTrackQuality); if (validCascade) { @@ -2356,9 +2376,9 @@ struct cascadePreselector { /// Extends the cascdata table with expression columns struct cascadeInitializer { - Spawns cascdataext; - Spawns kfcascdataext; - Spawns tracascdataext; + Spawns cascdataext; + Spawns kfcascdataext; + Spawns tracascdataext; void init(InitContext const&) {} }; diff --git a/PWGLF/TableProducer/Strangeness/cascadefinder.cxx b/PWGLF/TableProducer/Strangeness/cascadefinder.cxx index ae4cc41802a..a56b02666a1 100644 --- a/PWGLF/TableProducer/Strangeness/cascadefinder.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadefinder.cxx @@ -432,7 +432,7 @@ struct cascadefinderQA { /// Extends the cascdata table with expression columns struct cascadeinitializer { - Spawns cascdataext; + Spawns cascdataext; void init(InitContext const&) {} }; diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 66e10074b8e..6f6b8b307a3 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -12,6 +12,9 @@ /// \brief Task to create derived data for cascade flow analyses /// \authors: Chiara De Martin (chiara.de.martin@cern.ch), Maximiliano Puccio (maximiliano.puccio@cern.ch) +#include +#include +#include #include "Math/Vector3D.h" #include "TRandom3.h" #include "Common/DataModel/Centrality.h" @@ -121,8 +124,6 @@ static const std::vector labelsCutScore = {"Background score", "Sig struct cascadeFlow { - PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; - // axes ConfigurableAxis axisQVs{"axisQVs", {500, -10.f, 10.f}, "axisQVs"}; ConfigurableAxis axisQVsNorm{"axisQVsNorm", {200, -1.f, 1.f}, "axisQVsNorm"}; @@ -134,10 +135,16 @@ struct cascadeFlow { Configurable isNoSameBunchPileupCut{"isNoSameBunchPileupCut", 1, "Same found-by-T0 bunch crossing rejection"}; Configurable isGoodZvtxFT0vsPVCut{"isGoodZvtxFT0vsPVCut", 1, "z of PV by tracks and z of PV from FT0 A-C time difference cut"}; Configurable isGoodEventEP{"isGoodEventEP", 1, "Event is used to calibrate event plane"}; + Configurable isTrackOccupancySel{"isTrackOccupancySel", 0, "isTrackOccupancySel"}; Configurable MinOccupancy{"MinOccupancy", 0, "MinOccupancy"}; Configurable MaxOccupancy{"MaxOccupancy", 500, "MaxOccupancy"}; - Configurable isCollInStandardTimeRange{"isCollInStandardTimeRange", 1, "To remove collisions in +-10 micros time range"}; - Configurable isCollInNarrowTimeRange{"isCollInNarrowTimeRange", 0, "To remove collisions in +-4 micros time range"}; + Configurable isFT0OccupancySel{"isFT0OccupancySel", 0, "isFT0OccupancySel"}; + Configurable MinOccupancyFT0{"MinOccupancyFT0", 0, "MinOccupancyFT0"}; + Configurable MaxOccupancyFT0{"MaxOccupancyFT0", 5000, "MaxOccupancyFT0"}; + Configurable isNoCollInStandardTimeRange{"isNoCollInStandardTimeRange", 1, "To remove collisions in +-10 micros time range"}; + Configurable isNoCollInNarrowTimeRange{"isNoCollInNarrowTimeRange", 0, "To remove collisions in +-2 micros time range"}; + Configurable isNoCollInRofStandard{"isNoCollInRofStandard", 0, "To remove collisions in the same ITS ROF and with a multiplicity above a certain threshold"}; + Configurable isNoTVXinTRD{"isNoTVXinTRD", 0, "To remove collisions with trigger in TRD"}; Configurable MinPt{"MinPt", 0.6, "Min pt of cascade"}; Configurable MaxPt{"MaxPt", 10, "Max pt of cascade"}; @@ -164,7 +171,7 @@ struct cascadeFlow { Configurable> binsPtMl{"binsPtMl", std::vector{cascade_flow_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{cascade_flow_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {cascade_flow_cuts_ml::cuts[0], cascade_flow_cuts_ml::nBinsPt, cascade_flow_cuts_ml::nCutScores, cascade_flow_cuts_ml::labelsPt, cascade_flow_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)cascade_flow_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", static_cast(cascade_flow_cuts_ml::nCutScores), "Number of classes in ML model"}; o2::ccdb::CcdbApi ccdbApi; @@ -173,56 +180,89 @@ struct cascadeFlow { o2::analysis::MlResponse mlResponseOmega; template - bool AcceptEvent(TCollision const& collision) + bool AcceptEvent(TCollision const& collision, bool isFillHisto) { - histos.fill(HIST("hNEvents"), 0.5); - histos.fill(HIST("hEventNchCorrelationBefCuts"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); - histos.fill(HIST("hEventPVcontributorsVsCentralityBefCuts"), collision.centFT0C(), collision.multNTracksPVeta1()); - histos.fill(HIST("hEventGlobalTracksVsCentralityBefCuts"), collision.centFT0C(), collision.multNTracksGlobal()); + if (isFillHisto) { + histos.fill(HIST("hNEvents"), 0.5); + histos.fill(HIST("hEventNchCorrelationBefCuts"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventPVcontributorsVsCentralityBefCuts"), collision.centFT0C(), collision.multNTracksPVeta1()); + histos.fill(HIST("hEventGlobalTracksVsCentralityBefCuts"), collision.centFT0C(), collision.multNTracksGlobal()); + } // Event selection if required if (sel8 && !collision.sel8()) { return false; } - histos.fill(HIST("hNEvents"), 1.5); + if (isFillHisto) + histos.fill(HIST("hNEvents"), 1.5); // Z vertex selection if (TMath::Abs(collision.posZ()) > cutzvertex) { return false; } - histos.fill(HIST("hNEvents"), 2.5); + if (isFillHisto) + histos.fill(HIST("hNEvents"), 2.5); // kNoSameBunchPileup selection if (isNoSameBunchPileupCut && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { return false; } - histos.fill(HIST("hNEvents"), 3.5); + if (isFillHisto) + histos.fill(HIST("hNEvents"), 3.5); // kIsGoodZvtxFT0vsPV selection if (isGoodZvtxFT0vsPVCut && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } - histos.fill(HIST("hNEvents"), 4.5); + if (isFillHisto) + histos.fill(HIST("hNEvents"), 4.5); // occupancy cut int occupancy = collision.trackOccupancyInTimeRange(); - if (occupancy < MinOccupancy || occupancy > MaxOccupancy) { + if (isTrackOccupancySel && (occupancy < MinOccupancy || occupancy > MaxOccupancy)) { return false; } - histos.fill(HIST("hNEvents"), 5.5); + // occupancy cut based on FT0C + int occupancyFT0 = collision.ft0cOccupancyInTimeRange(); + if (isFT0OccupancySel && (occupancyFT0 < MinOccupancyFT0 || occupancyFT0 > MaxOccupancyFT0)) { + return false; + } + + if (isFillHisto) + histos.fill(HIST("hNEvents"), 5.5); - if (isCollInStandardTimeRange && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + // time-based event selection + if (isNoCollInStandardTimeRange && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return false; } + if (isNoCollInNarrowTimeRange && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + + if (isFillHisto) + histos.fill(HIST("hNEvents"), 6.5); - if (isCollInNarrowTimeRange && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + // In-ROF event selection + if (isNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { return false; } - histos.fill(HIST("hNEvents"), 6.5); - histos.fill(HIST("hEventNchCorrelation"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); - histos.fill(HIST("hEventPVcontributorsVsCentrality"), collision.centFT0C(), collision.multNTracksPVeta1()); - histos.fill(HIST("hEventGlobalTracksVsCentrality"), collision.centFT0C(), collision.multNTracksGlobal()); + if (isFillHisto) + histos.fill(HIST("hNEvents"), 7.5); + + // TVX in TRD + // if (isNoTVXinTRD && collision.alias_bit(kTVXinTRD)){ + // return false; + // } + + if (isFillHisto) + histos.fill(HIST("hNEvents"), 8.5); + + if (isFillHisto) { + histos.fill(HIST("hEventNchCorrelation"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventPVcontributorsVsCentrality"), collision.centFT0C(), collision.multNTracksPVeta1()); + histos.fill(HIST("hEventGlobalTracksVsCentrality"), collision.centFT0C(), collision.multNTracksGlobal()); + } return true; } @@ -326,7 +366,21 @@ struct cascadeFlow { cosThetaStarLambda[i] = boostedLambda.Pz() / boostedLambda.P(); } + // time-based event selection + bool isNoCollInTimeRangeStd = 0; + if (coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) + isNoCollInTimeRangeStd = 1; + // IN-ROF pile-up rejection + bool isNoCollInRofStd = 0; + if (coll.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) + isNoCollInRofStd = 1; + // TVX in TRD + // bool isTVXinTRD = 0; + // if (coll.alias_bit(kTVXinTRD)) isTVXinTRD = 1; + analysisSample(coll.centFT0C(), + isNoCollInTimeRangeStd, + isNoCollInRofStd, casc.sign(), casc.pt(), casc.eta(), @@ -354,8 +408,9 @@ struct cascadeFlow { const AxisSpec ptAxis{static_cast((MaxPt - MinPt) / 0.2), MinPt, MaxPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec v2Axis{200, -1., 1., "#it{v}_{2}"}; const AxisSpec CentAxis{18, 0., 90., "FT0C centrality percentile"}; - TString hNEventsLabels[8] = {"All", "sel8", "z vrtx", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "trackOccupancyInTimeRange", "kNoCollInTimeRange", "kIsGoodEventEP"}; - TString hNEventsLabelsMC[5] = {"All", "z vtx", ">=1RecoColl", "1Reco", "2Reco"}; + TString hNEventsLabels[10] = {"All", "sel8", "z vrtx", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "trackOccupancyInTimeRange", "kNoCollInTimeRange", "kNoCollInROF", "kTVXinTRD", "kIsGoodEventEP"}; + TString hNEventsLabelsMC[6] = {"All", "z vtx", ">=1RecoColl", "1Reco", "2Reco", "EvSelected"}; + TString hNCascLabelsMC[8] = {"All Xi", "all Omega", "Xi: has MC coll", "Om: has MC coll", "Xi: isPrimary", "Om: is Primary", "Xi: |eta|<0.8", "Om: |eta| < 0.8"}; resolution.add("QVectorsT0CTPCA", "QVectorsT0CTPCA", HistType::kTH2F, {axisQVs, CentAxis}); resolution.add("QVectorsT0CTPCC", "QVectorsT0CTPCC", HistType::kTH2F, {axisQVs, CentAxis}); @@ -364,7 +419,7 @@ struct cascadeFlow { resolution.add("QVectorsNormT0CTPCC", "QVectorsNormT0CTPCC", HistType::kTH2F, {axisQVsNorm, CentAxis}); resolution.add("QVectorsNormTPCAC", "QVectorsNormTPCCB", HistType::kTH2F, {axisQVsNorm, CentAxis}); - histos.add("hNEvents", "hNEvents", {HistType::kTH1F, {{8, 0.f, 8.f}}}); + histos.add("hNEvents", "hNEvents", {HistType::kTH1F, {{10, 0.f, 10.f}}}); for (Int_t n = 1; n <= histos.get(HIST("hNEvents"))->GetNbinsX(); n++) { histos.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(n, hNEventsLabels[n - 1]); } @@ -381,25 +436,37 @@ struct cascadeFlow { histos.add("hEventNchCorrelationAfterEP", "hEventNchCorrelationAfterEP", kTH2F, {{5000, 0, 5000}, {2500, 0, 2500}}); histos.add("hEventPVcontributorsVsCentralityAfterEP", "hEventPVcontributorsVsCentralityAfterEP", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); histos.add("hEventGlobalTracksVsCentralityAfterEP", "hEventGlobalTracksVsCentralityAfterEP", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); + histos.add("hMultNTracksITSTPCVsCentrality", "hMultNTracksITSTPCVsCentrality", kTH2F, {{100, 0, 100}, {1000, 0, 5000}}); histos.add("hCandidate", "hCandidate", HistType::kTH1F, {{22, -0.5, 21.5}}); histos.add("hCascadeSignal", "hCascadeSignal", HistType::kTH1F, {{6, -0.5, 5.5}}); histos.add("hCascade", "hCascade", HistType::kTH1F, {{6, -0.5, 5.5}}); + histos.add("hXiPtvsCent", "hXiPtvsCent", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); + histos.add("hXiPtvsCentEta08", "hXiPtvsCentEta08", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); + histos.add("hXiPtvsCentY05", "hXiPtvsCentY05", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); + histos.add("hOmegaPtvsCent", "hOmegaPtvsCent", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); + histos.add("hOmegaPtvsCentEta08", "hOmegaPtvsCentEta08", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); + histos.add("hOmegaPtvsCentY05", "hOmegaPtvsCentY05", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); histos.add("hCascadePhi", "hCascadePhi", HistType::kTH1F, {{100, 0, 2 * TMath::Pi()}}); histos.add("hcascminuspsiT0C", "hcascminuspsiT0C", HistType::kTH1F, {{100, 0, TMath::Pi()}}); histos.add("hv2CEPvsFT0C", "hv2CEPvsFT0C", HistType::kTH2F, {CentAxis, {100, -1, 1}}); histos.add("hv2CEPvsv2CSP", "hv2CEPvsV2CSP", HistType::kTH2F, {{100, -1, 1}, {100, -1, 1}}); - histosMCGen.add("h2DGenXiEta08", "h2DGenXiEta08", HistType::kTH2F, {{100, 0, 100}, {200, 0, 20}}); - histosMCGen.add("h2DGenOmegaEta08", "h2DGenOmegaEta08", HistType::kTH2F, {{100, 0, 100}, {200, 0, 20}}); - histosMCGen.add("h2DGenXiY05", "h2DGenXiY05", HistType::kTH2F, {{100, 0, 100}, {200, 0, 20}}); - histosMCGen.add("h2DGenOmegaY05", "h2DGenOmegaY05", HistType::kTH2F, {{100, 0, 100}, {200, 0, 20}}); + histosMCGen.add("h2DGenXiEta08", "h2DGenXiEta08", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); + histosMCGen.add("h2DGenOmegaEta08", "h2DGenOmegaEta08", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); + histosMCGen.add("h2DGenXiY05", "h2DGenXiY05", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); + histosMCGen.add("h2DGenOmegaY05", "h2DGenOmegaY05", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); histosMCGen.add("hGenXiY", "hGenXiY", HistType::kTH1F, {{100, -1, 1}}); histosMCGen.add("hGenOmegaY", "hGenOmegaY", HistType::kTH1F, {{100, -1, 1}}); - histosMCGen.add("hNEventsMC", "hNEventsMC", {HistType::kTH1F, {{5, 0.f, 5.f}}}); + histosMCGen.add("hZvertexGen", "hZvertexGen", HistType::kTH1F, {{100, -20, 20}}); + histosMCGen.add("hNEventsMC", "hNEventsMC", {HistType::kTH1F, {{6, 0.f, 6.f}}}); for (Int_t n = 1; n <= histosMCGen.get(HIST("hNEventsMC"))->GetNbinsX(); n++) { histosMCGen.get(HIST("hNEventsMC"))->GetXaxis()->SetBinLabel(n, hNEventsLabelsMC[n - 1]); } + histosMCGen.add("hNCascGen", "hNCascGen", {HistType::kTH1F, {{8, 0.f, 8.f}}}); + for (Int_t n = 1; n <= histosMCGen.get(HIST("hNCascGen"))->GetNbinsX(); n++) { + histosMCGen.get(HIST("hNCascGen"))->GetXaxis()->SetBinLabel(n, hNCascLabelsMC[n - 1]); + } for (int iS{0}; iS < 2; ++iS) { cascadev2::hMassBeforeSelVsPt[iS] = histos.add(Form("hMassBeforeSelVsPt%s", cascadev2::speciesNames[iS].data()), "hMassBeforeSelVsPt", HistType::kTH2F, {massCascAxis[iS], ptAxis}); @@ -433,7 +500,7 @@ struct cascadeFlow { int counter = 0; - if (!AcceptEvent(coll)) { + if (!AcceptEvent(coll, 1)) { return; } @@ -484,7 +551,7 @@ struct cascadeFlow { void processTrainingSignal(soa::Join::iterator const& coll, CascMCCandidates const& Cascades, DauTracks const&, soa::Join const&) { - if (!AcceptEvent(coll)) { + if (!AcceptEvent(coll, 1)) { return; } histos.fill(HIST("hEventCentrality"), coll.centFT0C()); @@ -516,7 +583,7 @@ struct cascadeFlow { void processAnalyseData(CollEventPlane const& coll, CascCandidates const& Cascades, DauTracks const&) { - if (!AcceptEvent(coll)) { + if (!AcceptEvent(coll, 1)) { return; } @@ -524,7 +591,7 @@ struct cascadeFlow { if (isGoodEventEP && !coll.triggereventep()) { return; } - histos.fill(HIST("hNEvents"), 7.5); + histos.fill(HIST("hNEvents"), 9.5); histos.fill(HIST("hEventNchCorrelationAfterEP"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); histos.fill(HIST("hEventPVcontributorsVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksPVeta1()); histos.fill(HIST("hEventGlobalTracksVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksGlobal()); @@ -638,7 +705,7 @@ struct cascadeFlow { void processAnalyseDataEPCentralFW(CollEventPlaneCentralFW const& coll, CascCandidates const& Cascades, DauTracks const&) { - if (!AcceptEvent(coll)) { + if (!AcceptEvent(coll, 1)) { return; } @@ -649,7 +716,7 @@ struct cascadeFlow { } } - histos.fill(HIST("hNEvents"), 7.5); + histos.fill(HIST("hNEvents"), 9.5); histos.fill(HIST("hEventNchCorrelationAfterEP"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); histos.fill(HIST("hEventPVcontributorsVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksPVeta1()); histos.fill(HIST("hEventGlobalTracksVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksGlobal()); @@ -766,16 +833,17 @@ struct cascadeFlow { void processAnalyseMC(soa::Join::iterator const& coll, CascMCCandidates const& Cascades, DauTracks const&, soa::Join const&) { - if (!AcceptEvent(coll)) { + if (!AcceptEvent(coll, 1)) { return; } - histos.fill(HIST("hNEvents"), 7.5); + histos.fill(HIST("hNEvents"), 9.5); histos.fill(HIST("hEventNchCorrelationAfterEP"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); histos.fill(HIST("hEventPVcontributorsVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksPVeta1()); histos.fill(HIST("hEventGlobalTracksVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksGlobal()); histos.fill(HIST("hEventCentrality"), coll.centFT0C()); histos.fill(HIST("hEventVertexZ"), coll.posZ()); + histos.fill(HIST("hMultNTracksITSTPCVsCentrality"), coll.centFT0C(), coll.multNTracksITSTPC()); std::vector bdtScore[2]; for (auto& casc : Cascades) { @@ -792,6 +860,24 @@ struct cascadeFlow { pdgCode = 0; } + // rapidity definition + float XiY = RecoDecay::y(std::array{casc.px(), casc.py(), casc.pz()}, constants::physics::MassXiMinus); + float OmegaY = RecoDecay::y(std::array{casc.px(), casc.py(), casc.pz()}, constants::physics::MassOmegaMinus); + // true reco cascades before applying any selection + if (std::abs(pdgCode) == 3312 && std::abs(cascMC.pdgCodeV0()) == 3122 && std::abs(cascMC.pdgCodeBachelor()) == 211) { + histos.fill(HIST("hXiPtvsCent"), coll.centFT0C(), casc.pt()); + if (std::abs(casc.eta()) < 0.8) + histos.fill(HIST("hXiPtvsCentEta08"), coll.centFT0C(), casc.pt()); + if (std::abs(XiY) < 0.5) + histos.fill(HIST("hXiPtvsCentY05"), coll.centFT0C(), casc.pt()); + } else if (std::abs(pdgCode) == 3334 && std::abs(cascMC.pdgCodeV0()) == 3122 && std::abs(cascMC.pdgCodeBachelor()) == 321) { + histos.fill(HIST("hOmegaPtvsCent"), coll.centFT0C(), casc.pt()); + if (std::abs(casc.eta()) < 0.8) + histos.fill(HIST("hOmegaPtvsCentEta08"), coll.centFT0C(), casc.pt()); + if (std::abs(OmegaY) < 0.5) + histos.fill(HIST("hOmegaPtvsCentY05"), coll.centFT0C(), casc.pt()); + } + /// Add some minimal cuts for single track variables (min number of TPC clusters) auto negExtra = casc.negTrackExtra_as(); auto posExtra = casc.posTrackExtra_as(); @@ -819,7 +905,6 @@ struct cascadeFlow { float massCasc[2]{casc.mXi(), casc.mOmega()}; - // inv mass loose cut if (casc.pt() < MinPt || casc.pt() > MaxPt) { continue; } @@ -869,82 +954,96 @@ struct cascadeFlow { } } - void processMCGen(MCCollisionsStra const& mcCollisions, soa::Join const& collisions, soa::Join const& CascMCCores) + void processMCGen(MCCollisionsStra::iterator const& mcCollision, const soa::SmallGroups>& collisions, const soa::SmallGroups>& cascMC) { - for (auto const& mcCollision : mcCollisions) { - histosMCGen.fill(HIST("hNEventsMC"), 0.5); - // Generated with accepted z vertex - if (TMath::Abs(mcCollision.posZ()) > cutzvertex) { - return; + histosMCGen.fill(HIST("hZvertexGen"), mcCollision.posZ()); + histosMCGen.fill(HIST("hNEventsMC"), 0.5); + // Generated with accepted z vertex + if (TMath::Abs(mcCollision.posZ()) > cutzvertex) { + return; + } + histosMCGen.fill(HIST("hNEventsMC"), 1.5); + // Check if there is at least one of the reconstructed collisions associated to this MC collision + if (collisions.size() < 1) + return; + histosMCGen.fill(HIST("hNEventsMC"), 2.5); + if (collisions.size() == 1) + histosMCGen.fill(HIST("hNEventsMC"), 3.5); + else if (collisions.size() == 2) + histosMCGen.fill(HIST("hNEventsMC"), 4.5); + + int biggestNContribs = -1; + float centrality = 100.5f; + int nCollisions = 0; + for (auto const& coll : collisions) { + if (!AcceptEvent(coll, 0)) { + continue; + } + if (biggestNContribs < coll.multPVTotalContributors()) { + biggestNContribs = coll.multPVTotalContributors(); + centrality = coll.centFT0C(); } - histosMCGen.fill(HIST("hNEventsMC"), 1.5); - // Check if there is at least one of the reconstructed collisions associated to this MC collision + nCollisions++; + } + if (nCollisions < 1) { + return; + } - auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex()); + histosMCGen.fill(HIST("hNEventsMC"), 5.5); - int biggestNContribs = -1; - int bestCollisionIndex = -1; - float centrality = 100.5f; - int nCollisions = 0; - for (auto const& collision : groupedCollisions) { + for (auto const& cascmc : cascMC) { + if (TMath::Abs(cascmc.pdgCode()) == 3312) + histosMCGen.fill(HIST("hNCascGen"), 0.5); + else if (TMath::Abs(cascmc.pdgCode()) == 3334) + histosMCGen.fill(HIST("hNCascGen"), 1.5); + if (!cascmc.has_straMCCollision()) + continue; + if (TMath::Abs(cascmc.pdgCode()) == 3312) + histosMCGen.fill(HIST("hNCascGen"), 2.5); + else if (TMath::Abs(cascmc.pdgCode()) == 3334) + histosMCGen.fill(HIST("hNCascGen"), 3.5); + if (!cascmc.isPhysicalPrimary()) + continue; + if (TMath::Abs(cascmc.pdgCode()) == 3312) + histosMCGen.fill(HIST("hNCascGen"), 4.5); + else if (TMath::Abs(cascmc.pdgCode()) == 3334) + histosMCGen.fill(HIST("hNCascGen"), 5.5); - if (!AcceptEvent(collision)) { - continue; - } - if (biggestNContribs < collision.multPVTotalContributors()) { - biggestNContribs = collision.multPVTotalContributors(); - bestCollisionIndex = collision.globalIndex(); - centrality = collision.centFT0C(); - } - nCollisions++; - } - if (nCollisions < 1) { - return; - } - histosMCGen.fill(HIST("hNEventsMC"), 2.5); - if (nCollisions == 1) - histosMCGen.fill(HIST("hNEventsMC"), 3.5); - else if (nCollisions == 2) - histosMCGen.fill(HIST("hNEventsMC"), 4.5); - for (auto const& cascMC : CascMCCores) { - if (!cascMC.has_straMCCollision()) - continue; + float ptmc = RecoDecay::sqrtSumOfSquares(cascmc.pxMC(), cascmc.pyMC()); - if (!cascMC.isPhysicalPrimary()) - continue; + float theta = std::atan(ptmc / cascmc.pzMC()); //-pi/2 < theta < pi/2 + + float theta1 = 0; + + // if pz is positive (i.e. positive rapidity): 0 < theta < pi/2 + if (theta > 0) + theta1 = theta; // 0 < theta1/2 < pi/4 --> 0 < tan (theta1/2) < 1 --> positive eta + // if pz is negative (i.e. negative rapidity): -pi/2 < theta < 0 --> we need 0 < theta1/2 < pi/2 for the ln to be defined + else + theta1 = TMath::Pi() + theta; // pi/2 < theta1 < pi --> pi/4 < theta1/2 < pi/2 --> 1 < tan (theta1/2) --> negative eta - float ptmc = RecoDecay::sqrtSumOfSquares(cascMC.pxMC(), cascMC.pyMC()); - - float theta = std::atan(ptmc / cascMC.pzMC()); //-pi/2 < theta < pi/2 - - float theta1 = 0; - - // if pz is positive (i.e. positive rapidity): 0 < theta < pi/2 - if (theta > 0) - theta1 = theta; // 0 < theta1/2 < pi/4 --> 0 < tan (theta1/2) < 1 --> positive eta - // if pz is negative (i.e. negative rapidity): -pi/2 < theta < 0 --> we need 0 < theta1/2 < pi/2 for the ln to be defined - else - theta1 = TMath::Pi() + theta; // pi/2 < theta1 < pi --> pi/4 < theta1/2 < pi/2 --> 1 < tan (theta1/2) --> negative eta - - float cascMCeta = -log(std::tan(theta1 / 2)); - float cascMCy = 0; - - if (TMath::Abs(cascMC.pdgCode()) == 3312) { - cascMCy = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, constants::physics::MassXiMinus); - if (TMath::Abs(cascMCeta) < etaCascMCGen) - histosMCGen.fill(HIST("h2DGenXiEta08"), centrality, ptmc); - if (TMath::Abs(cascMCy) < yCascMCGen) - histosMCGen.fill(HIST("h2DGenXiY05"), centrality, ptmc); - histosMCGen.fill(HIST("hGenXiY"), cascMCy); - } else if (TMath::Abs(cascMC.pdgCode() == 3334)) { - cascMCy = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, constants::physics::MassOmegaMinus); - if (TMath::Abs(cascMCeta) < etaCascMCGen) - histosMCGen.fill(HIST("h2DGenOmegaEta08"), centrality, ptmc); - if (TMath::Abs(cascMCy) < yCascMCGen) - histosMCGen.fill(HIST("h2DGenOmegaY05"), centrality, ptmc); - histosMCGen.fill(HIST("hGenOmegaY"), cascMCy); + float cascMCeta = -log(std::tan(theta1 / 2)); + float cascMCy = 0; + + if (TMath::Abs(cascmc.pdgCode()) == 3312) { + cascMCy = RecoDecay::y(std::array{cascmc.pxMC(), cascmc.pyMC(), cascmc.pzMC()}, constants::physics::MassXiMinus); + if (TMath::Abs(cascMCeta) < etaCascMCGen) { + histosMCGen.fill(HIST("h2DGenXiEta08"), centrality, ptmc); + histosMCGen.fill(HIST("hNCascGen"), 6.5); + } + if (TMath::Abs(cascMCy) < yCascMCGen) + histosMCGen.fill(HIST("h2DGenXiY05"), centrality, ptmc); + histosMCGen.fill(HIST("hGenXiY"), cascMCy); + } else if (TMath::Abs(cascmc.pdgCode() == 3334)) { + cascMCy = RecoDecay::y(std::array{cascmc.pxMC(), cascmc.pyMC(), cascmc.pzMC()}, constants::physics::MassOmegaMinus); + if (TMath::Abs(cascMCeta) < etaCascMCGen) { + histosMCGen.fill(HIST("h2DGenOmegaEta08"), centrality, ptmc); + histosMCGen.fill(HIST("hNCascGen"), 7.5); } + if (TMath::Abs(cascMCy) < yCascMCGen) + histosMCGen.fill(HIST("h2DGenOmegaY05"), centrality, ptmc); + histosMCGen.fill(HIST("hGenOmegaY"), cascMCy); } } } diff --git a/PWGLF/TableProducer/Strangeness/cascademcbuilder.cxx b/PWGLF/TableProducer/Strangeness/cascademcbuilder.cxx index 729ac3e27da..3d4a5642004 100644 --- a/PWGLF/TableProducer/Strangeness/cascademcbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/cascademcbuilder.cxx @@ -61,6 +61,8 @@ struct cascademcbuilder { Configurable addGeneratedOmegaMinus{"addGeneratedOmegaMinus", false, "add CascMCCore entry for generated, not-recoed OmegaMinus"}; Configurable addGeneratedOmegaPlus{"addGeneratedOmegaPlus", false, "add CascMCCore entry for generated, not-recoed OmegaPlus"}; + Configurable treatPiToMuDecays{"treatPiToMuDecays", true, "if true, will correctly capture pi -> mu and V0 label will still point to originating V0 decay in those cases. Nota bene: prong info will still be for the muon!"}; + Configurable rapidityWindow{"rapidityWindow", 0.5, "rapidity window to save non-recoed candidates"}; //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* @@ -92,6 +94,36 @@ struct cascademcbuilder { mcCascinfo thisInfo; //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* + // kink handling + template + int getOriginatingParticle(mcpart const& part, int& indexForPositionOfDecay) + { + int returnValue = -1; + if (part.has_mothers()) { + auto const& motherList = part.template mothers_as(); + if (motherList.size() == 1) { + for (const auto& mother : motherList) { + if (std::abs(part.pdgCode()) == 13 && treatPiToMuDecays) { + // muon decay, de-ref mother twice + if (mother.has_mothers()) { + auto grandMotherList = mother.template mothers_as(); + if (grandMotherList.size() == 1) { + for (const auto& grandMother : grandMotherList) { + returnValue = grandMother.globalIndex(); + indexForPositionOfDecay = mother.globalIndex(); // for V0 decay position: grab muon + } + } + } + } else { + returnValue = mother.globalIndex(); + indexForPositionOfDecay = part.globalIndex(); + } + } + } + } + return returnValue; + } + template void generateCascadeMCinfo(TCascadeTable cascTable, TMCParticleTable mcParticles) { @@ -147,51 +179,52 @@ struct cascademcbuilder { thisInfo.processNegative = lMCNegTrack.getProcess(); thisInfo.processBachelor = lMCBachTrack.getProcess(); - // Step 1: check if the mother is the same, go up a level - if (lMCNegTrack.has_mothers() && lMCPosTrack.has_mothers()) { - for (auto& lNegMother : lMCNegTrack.template mothers_as()) { - for (auto& lPosMother : lMCPosTrack.template mothers_as()) { - if (lNegMother == lPosMother) { - // acquire information - thisInfo.lxyz[0] = lMCPosTrack.vx(); - thisInfo.lxyz[1] = lMCPosTrack.vy(); - thisInfo.lxyz[2] = lMCPosTrack.vz(); - thisInfo.pdgCodeV0 = lNegMother.pdgCode(); + // Step 0: treat pi -> mu + antineutrino + // if present, de-reference original V0 correctly and provide label to original object + // NOTA BENE: the prong info will still correspond to a muon, treat carefully! + int negOriginating = -1, posOriginating = -1, bachOriginating = -1; + int particleForLambdaDecayPositionIdx = -1, particleForCascadeDecayPositionIdx = -1; + negOriginating = getOriginatingParticle(lMCNegTrack, particleForLambdaDecayPositionIdx); + posOriginating = getOriginatingParticle(lMCPosTrack, particleForLambdaDecayPositionIdx); + bachOriginating = getOriginatingParticle(lMCBachTrack, particleForCascadeDecayPositionIdx); + + if (negOriginating > -1 && negOriginating == posOriginating) { + auto originatingV0 = mcParticles.rawIteratorAt(negOriginating); + auto particleForLambdaDecayPosition = mcParticles.rawIteratorAt(particleForLambdaDecayPositionIdx); + + thisInfo.label = originatingV0.globalIndex(); + thisInfo.lxyz[0] = particleForLambdaDecayPosition.vx(); + thisInfo.lxyz[1] = particleForLambdaDecayPosition.vy(); + thisInfo.lxyz[2] = particleForLambdaDecayPosition.vz(); + thisInfo.pdgCodeV0 = originatingV0.pdgCode(); + + if (originatingV0.has_mothers()) { + for (auto& lV0Mother : originatingV0.template mothers_as()) { + if (lV0Mother.globalIndex() == bachOriginating) { // found mother particle + thisInfo.label = lV0Mother.globalIndex(); + + if (lV0Mother.has_mcCollision()) { + thisInfo.mcCollision = lV0Mother.mcCollisionId(); // save this reference, please + } - // if we got to this level, it means the mother particle exists and is the same - // now we have to go one level up and compare to the bachelor mother too - if (lNegMother.has_mothers() && lMCBachTrack.has_mothers()) { - for (auto& lV0Mother : lNegMother.template mothers_as()) { - for (auto& lBachMother : lMCBachTrack.template mothers_as()) { - if (lV0Mother == lBachMother) { - thisInfo.label = lV0Mother.globalIndex(); - - if (lV0Mother.has_mcCollision()) { - thisInfo.mcCollision = lV0Mother.mcCollisionId(); // save this reference, please - } - - thisInfo.pdgCode = lV0Mother.pdgCode(); - thisInfo.isPhysicalPrimary = lV0Mother.isPhysicalPrimary(); - thisInfo.xyz[0] = lMCBachTrack.vx(); - thisInfo.xyz[1] = lMCBachTrack.vy(); - thisInfo.xyz[2] = lMCBachTrack.vz(); - thisInfo.momentum[0] = lV0Mother.px(); - thisInfo.momentum[1] = lV0Mother.py(); - thisInfo.momentum[2] = lV0Mother.pz(); - if (lV0Mother.has_mothers()) { - for (auto& lV0GrandMother : lV0Mother.template mothers_as()) { - thisInfo.pdgCodeMother = lV0GrandMother.pdgCode(); - thisInfo.motherLabel = lV0GrandMother.globalIndex(); - } - } - } - } - } // end conditional V0-bach pair - } // end has mothers - } // end neg = pos mother conditional - } - } // end loop neg/pos mothers - } // end conditional of mothers existing + thisInfo.pdgCode = lV0Mother.pdgCode(); + thisInfo.isPhysicalPrimary = lV0Mother.isPhysicalPrimary(); + thisInfo.xyz[0] = originatingV0.vx(); + thisInfo.xyz[1] = originatingV0.vy(); + thisInfo.xyz[2] = originatingV0.vz(); + thisInfo.momentum[0] = lV0Mother.px(); + thisInfo.momentum[1] = lV0Mother.py(); + thisInfo.momentum[2] = lV0Mother.pz(); + if (lV0Mother.has_mothers()) { + for (auto& lV0GrandMother : lV0Mother.template mothers_as()) { + thisInfo.pdgCodeMother = lV0GrandMother.pdgCode(); + thisInfo.motherLabel = lV0GrandMother.globalIndex(); + } + } + } + } // end v0 mother loop + } // end has_mothers check for V0 + } // end conditional of pos/neg originating being the same } // end association check // Construct label table (note: this will be joinable with CascDatas) casclabels( diff --git a/PWGLF/TableProducer/Strangeness/cascadespawner.cxx b/PWGLF/TableProducer/Strangeness/cascadespawner.cxx index 4e2d0c68a44..dc004b91e78 100644 --- a/PWGLF/TableProducer/Strangeness/cascadespawner.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadespawner.cxx @@ -35,7 +35,7 @@ using namespace o2::framework::expressions; /// Extends the cascdata table with expression columns struct cascadespawner { - Spawns cascdataext; + Spawns cascdataext; void init(InitContext const&) {} }; diff --git a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx index 0f8659fac38..0e14c0f491f 100644 --- a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx +++ b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx @@ -16,6 +16,9 @@ /// \modified by Roman Nepeivoda (roman.nepeivoda@cern.ch) /// \since June 1, 2023 +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -57,6 +60,7 @@ struct cascqaanalysis { Configurable isTriggerTVX{"isTriggerTVX", 1, "TVX trigger"}; Configurable isNoTimeFrameBorder{"isNoTimeFrameBorder", 1, "TF border cut"}; Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", 1, "ITS ROF border cut"}; + Configurable isNoCollInTimeRangeNarrow{"isNoCollInTimeRangeNarrow", 1, "No collisions in +-2us window"}; // Cascade selection criteria Configurable scalefactor{"scalefactor", 1.0, "Scaling factor"}; @@ -115,9 +119,9 @@ struct cascqaanalysis { TString hCandidateCounterLabels[4] = {"All candidates", "passed topo cuts", "has associated MC particle", "associated with Xi(Omega)"}; TString hNEventsMCLabels[6] = {"All", "z vrtx", "INEL", "INEL>0", "INEL>1", "Associated with rec. collision"}; - TString hNEventsLabels[12] = {"All", "kIsTriggerTVX", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kIsVertexITSTPC", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "isVertexTOFmatched", "z vrtx", "INEL", "INEL>0", "INEL>1"}; + TString hNEventsLabels[13] = {"All", "kIsTriggerTVX", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kIsVertexITSTPC", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "isVertexTOFmatched", "kNoCollInTimeRangeNarrow", "z vrtx", "INEL", "INEL>0", "INEL>1"}; - registry.add("hNEvents", "hNEvents", {HistType::kTH1F, {{12, 0.f, 12.f}}}); + registry.add("hNEvents", "hNEvents", {HistType::kTH1F, {{13, 0.f, 13.f}}}); for (Int_t n = 1; n <= registry.get(HIST("hNEvents"))->GetNbinsX(); n++) { registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(n, hNEventsLabels[n - 1]); @@ -174,7 +178,7 @@ struct cascqaanalysis { aod::cascdata::dcaV0daughters < dcav0dau && aod::cascdata::dcacascdaughters < dcacascdau); - Partition pvContribTracksIUEta1 = (nabs(aod::track::eta) < 1.0f) && ((aod::track::flags & (uint32_t)o2::aod::track::PVContributor) == (uint32_t)o2::aod::track::PVContributor); + Partition pvContribTracksIUEta1 = (nabs(aod::track::eta) < 1.0f) && ((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)); Partition globalTracksIUEta05 = (nabs(aod::track::eta) < 0.5f) && (requireGlobalTrackInFilter()); template @@ -252,14 +256,14 @@ struct cascqaanalysis { { // 0 - INEL, 1 - INEL>0, 2 - INEL>1 int evFlag = 0; - registry.fill(HIST("hNEvents"), 9.5); // INEL + registry.fill(HIST("hNEvents"), 10.5); // INEL if (collision.isInelGt0()) { evFlag += 1; - registry.fill(HIST("hNEvents"), 10.5); // INEL>0 + registry.fill(HIST("hNEvents"), 11.5); // INEL>0 } if (collision.isInelGt1()) { evFlag += 1; - registry.fill(HIST("hNEvents"), 11.5); // INEL>1 + registry.fill(HIST("hNEvents"), 12.5); // INEL>1 } return evFlag; } @@ -326,13 +330,20 @@ struct cascqaanalysis { if (isFillEventSelectionQA) { registry.fill(HIST("hNEvents"), 7.5); } + // kNoCollInTimeRangeNarrow selection + if (isNoCollInTimeRangeNarrow && !collision.selection_bit(aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 8.5); + } // Z vertex selection if (TMath::Abs(collision.posZ()) > cutzvertex) { return false; } if (isFillEventSelectionQA) { - registry.fill(HIST("hNEvents"), 8.5); + registry.fill(HIST("hNEvents"), 9.5); registry.fill(HIST("hZCollision"), collision.posZ()); } @@ -472,15 +483,15 @@ struct cascqaanalysis { uint16_t nchFV0 = GetGenNchInFV0Aregion(mcPartSlice); int evType = 0; - registry.fill(HIST("hNEvents"), 9.5); // INEL + registry.fill(HIST("hNEvents"), 10.5); // INEL // Rec. collision associated with INEL>0 gen. one if (pwglf::isINELgtNmc(mcPartSlice, 0, pdgDB)) { - registry.fill(HIST("hNEvents"), 10.5); // INEL + registry.fill(HIST("hNEvents"), 11.5); // INEL evType++; } // Rec. collision associated with INEL>1 gen. one if (pwglf::isINELgtNmc(mcPartSlice, 1, pdgDB)) { - registry.fill(HIST("hNEvents"), 11.5); // INEL + registry.fill(HIST("hNEvents"), 12.5); // INEL evType++; } diff --git a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx index 0dd6cf1d4ec..220670d1e4a 100644 --- a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx +++ b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx @@ -141,6 +141,7 @@ struct hstrangecorrelationfilter { Produces assocPion; Produces assocV0; Produces assocCascades; + Produces assocHadrons; TF1* fK0Mean = new TF1("fK0Mean", "[0]+[1]*x+[2]*TMath::Exp(-[3]*x)"); TF1* fK0Width = new TF1("fK0Width", "[0]+[1]*x+[2]*TMath::Exp(-[3]*x)"); @@ -314,7 +315,41 @@ struct hstrangecorrelationfilter { continue; } - assocPion( + assocHadrons( + track.collisionId(), + track.globalIndex()); + } + } + + void processAssocHadrons(soa::Join::iterator const& collision, soa::Filtered> const& tracks) + { + // Perform basic event selection + if (!collision.sel8()) { + return; + } + // No need to correlate stuff that's in far collisions + if (TMath::Abs(collision.posZ()) > 10.0) { + return; + } + + /// _________________________________________________ + /// Step 1: Populate table with trigger tracks + for (auto const& track : tracks) { + if (track.eta() > assocEtaMax || track.eta() < assocEtaMin) { + continue; + } + // if (track.sign()= 1 ) {continue;} + if (track.pt() > assocPtCutMax || track.pt() < assocPtCutMin) { + continue; + } + if (track.tpcNClsCrossedRows() < minTPCNCrossedRows) { + continue; // crossed rows + } + if (!track.hasITS() && triggerRequireITS) { + continue; // skip, doesn't have ITS signal (skips lots of TPC-only!) + } + + assocHadrons( track.collisionId(), track.globalIndex()); } @@ -494,6 +529,7 @@ struct hstrangecorrelationfilter { PROCESS_SWITCH(hstrangecorrelationfilter, processV0s, "Produce associated V0 tables", true); PROCESS_SWITCH(hstrangecorrelationfilter, processAssocPions, "Produce associated Pion tables", true); PROCESS_SWITCH(hstrangecorrelationfilter, processCascades, "Produce associated cascade tables", true); + PROCESS_SWITCH(hstrangecorrelationfilter, processAssocHadrons, "Produce associated Hadron tables", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx b/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx index 2e1fb20f689..376b980a8b0 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx @@ -36,6 +36,8 @@ // david.dobrigkeit.chinellato@cern.ch // +#include +#include #include #include #include @@ -263,6 +265,7 @@ struct lambdakzeroBuilder { static constexpr float defaultLambdaWindowParameters[1][4] = {{1.17518e-03, 1.24099e-04, 5.47937e-03, 3.08009e-01}}; Configurable> massCutK0{"massCutK0", {defaultK0MassWindowParameters[0], 4, {"constant", "linear", "expoConstant", "expoRelax"}}, "mass parameters for K0"}; Configurable> massCutLambda{"massCutLambda", {defaultLambdaWindowParameters[0], 4, {"constant", "linear", "expoConstant", "expoRelax"}}, "mass parameters for Lambda"}; + Configurable massCutPhoton{"massCutPhoton", 0.2, "Photon max mass"}; Configurable massWindownumberOfSigmas{"massWindownumberOfSigmas", 5e+6, "number of sigmas around mass peaks to keep"}; Configurable massWindowWithTPCPID{"massWindowWithTPCPID", false, "when checking mass windows, correlate with TPC dE/dx"}; Configurable massWindowSafetyMargin{"massWindowSafetyMargin", 0.001, "Extra mass window safety margin"}; @@ -977,15 +980,18 @@ struct lambdakzeroBuilder { bool desiredMassK0Short = false; bool desiredMassLambda = false; bool desiredMassAntiLambda = false; + bool desiredMassGamma = false; if (massWindownumberOfSigmas > 1e+3) { desiredMassK0Short = true; // safety fallback desiredMassLambda = true; // safety fallback desiredMassAntiLambda = true; // safety fallback + desiredMassGamma = true; // safety fallback } else { desiredMassK0Short = TMath::Abs(v0candidate.k0ShortMass - o2::constants::physics::MassKaonNeutral) < massWindownumberOfSigmas * getMassSigmaK0Short(lPt) + massWindowSafetyMargin; desiredMassLambda = TMath::Abs(v0candidate.lambdaMass - o2::constants::physics::MassLambda) < massWindownumberOfSigmas * getMassSigmaLambda(lPt) + massWindowSafetyMargin; desiredMassAntiLambda = TMath::Abs(v0candidate.antiLambdaMass - o2::constants::physics::MassLambda) < massWindownumberOfSigmas * getMassSigmaLambda(lPt) + massWindowSafetyMargin; + desiredMassGamma = TMath::Abs(lGammaMass) < massCutPhoton; } // check if user requested to correlate mass requirement with TPC PID @@ -993,6 +999,7 @@ struct lambdakzeroBuilder { bool dEdxK0Short = V0.isdEdxK0Short() || !massWindowWithTPCPID; bool dEdxLambda = V0.isdEdxLambda() || !massWindowWithTPCPID; bool dEdxAntiLambda = V0.isdEdxAntiLambda() || !massWindowWithTPCPID; + bool dEdxGamma = V0.isdEdxGamma() || !massWindowWithTPCPID; // check proper lifetime if asked for bool passML2P_K0Short = lML2P_K0Short < lifetimecut->get("lifetimecutK0S") || lifetimecut->get("lifetimecutK0S") > 1000; @@ -1004,6 +1011,8 @@ struct lambdakzeroBuilder { keepCandidate = true; if (passML2P_Lambda && dEdxAntiLambda && desiredMassAntiLambda) keepCandidate = true; + if (dEdxGamma && desiredMassGamma) + keepCandidate = true; if (!keepCandidate) return false; @@ -1555,7 +1564,7 @@ struct lambdakzeroPreselector { void checkAndFinalize() { // parse + publish tag table now - for (int ii = 0; ii < selectionMask.size(); ii++) { + for (std::size_t ii = 0; ii < selectionMask.size(); ii++) { histos.fill(HIST("hPreselectorStatistics"), 0.0f); // all V0s bool validV0 = bitcheck(selectionMask[ii], bitTrackQuality); if (validV0) { diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeromcbuilder.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeromcbuilder.cxx index a2324681040..1d7b1c29490 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzeromcbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzeromcbuilder.cxx @@ -55,6 +55,8 @@ struct lambdakzeromcbuilder { Configurable addGeneratedAntiLambda{"addGeneratedAntiLambda", false, "add V0MCCore entry for generated, not-recoed AntiLambda"}; Configurable addGeneratedGamma{"addGeneratedGamma", false, "add V0MCCore entry for generated, not-recoed Gamma"}; + Configurable treatPiToMuDecays{"treatPiToMuDecays", true, "if true, will correctly capture pi -> mu and V0 label will still point to originating V0 decay in those cases. Nota bene: prong info will still be for the muon!"}; + Configurable rapidityWindow{"rapidityWindow", 0.5, "rapidity window to save non-recoed candidates"}; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -111,15 +113,38 @@ struct lambdakzeromcbuilder { std::array posP; std::array negP; std::array momentum; - uint64_t packedMcParticleIndices; }; mcV0info thisInfo; //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* - // prong index combiner - uint64_t combineProngIndices(uint32_t low, uint32_t high) + // kink handling + template + int getOriginatingParticle(mcpart const& part, int& indexForPositionOfDecay) { - return (((uint64_t)high) << 32) | ((uint64_t)low); + int returnValue = -1; + if (part.has_mothers()) { + auto const& motherList = part.template mothers_as(); + if (motherList.size() == 1) { + for (const auto& mother : motherList) { + if (std::abs(part.pdgCode()) == 13 && treatPiToMuDecays) { + // muon decay, de-ref mother twice + if (mother.has_mothers()) { + auto grandMotherList = mother.template mothers_as(); + if (grandMotherList.size() == 1) { + for (const auto& grandMother : grandMotherList) { + returnValue = grandMother.globalIndex(); + indexForPositionOfDecay = mother.globalIndex(); // for V0 decay position: grab muon + } + } + } + } else { + returnValue = mother.globalIndex(); + indexForPositionOfDecay = part.globalIndex(); + } + } + } + } + return returnValue; } //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* @@ -131,7 +156,6 @@ struct lambdakzeromcbuilder { std::vector mcParticleIsReco(mcParticles.size(), false); // mc Particle not recoed by V0s for (auto& v0 : v0table) { - thisInfo.packedMcParticleIndices = 0; // not de-referenced properly yet thisInfo.label = -1; thisInfo.motherLabel = -1; thisInfo.pdgCode = 0; @@ -152,7 +176,6 @@ struct lambdakzeromcbuilder { auto lMCNegTrack = lNegTrack.mcParticle_as(); auto lMCPosTrack = lPosTrack.mcParticle_as(); - thisInfo.packedMcParticleIndices = combineProngIndices(lPosTrack.mcParticleId(), lNegTrack.mcParticleId()); thisInfo.pdgCodePositive = lMCPosTrack.pdgCode(); thisInfo.pdgCodeNegative = lMCNegTrack.pdgCode(); thisInfo.processPositive = lMCPosTrack.getProcess(); @@ -163,65 +186,71 @@ struct lambdakzeromcbuilder { thisInfo.negP[0] = lMCNegTrack.px(); thisInfo.negP[1] = lMCNegTrack.py(); thisInfo.negP[2] = lMCNegTrack.pz(); - if (lMCNegTrack.has_mothers() && lMCPosTrack.has_mothers()) { - for (auto& lNegMother : lMCNegTrack.mothers_as()) { - for (auto& lPosMother : lMCPosTrack.mothers_as()) { - if (lNegMother.globalIndex() == lPosMother.globalIndex()) { - thisInfo.label = lNegMother.globalIndex(); - thisInfo.xyz[0] = lMCPosTrack.vx(); - thisInfo.xyz[1] = lMCPosTrack.vy(); - thisInfo.xyz[2] = lMCPosTrack.vz(); - - // MC pos. and neg. daughters are the same! Looking for replacement... - if (lMCPosTrack.globalIndex() == lMCNegTrack.globalIndex()) { - auto const& daughters = lNegMother.daughters_as(); - for (auto& ldau : daughters) { - // check if the candidate originate from a decay - // if not, this is not a suitable candidate for one of the decay daughters - if (ldau.getProcess() != 4) // see TMCProcess.h - continue; - - if (lMCPosTrack.pdgCode() < 0 && ldau.pdgCode() > 0) { // the positive track needs to be changed - thisInfo.pdgCodePositive = ldau.pdgCode(); - thisInfo.processPositive = ldau.getProcess(); - thisInfo.posP[0] = ldau.px(); - thisInfo.posP[1] = ldau.py(); - thisInfo.posP[2] = ldau.pz(); - thisInfo.xyz[0] = ldau.vx(); - thisInfo.xyz[1] = ldau.vy(); - thisInfo.xyz[2] = ldau.vz(); - } - if (lMCNegTrack.pdgCode() > 0 && ldau.pdgCode() < 0) { // the negative track needs to be changed - thisInfo.pdgCodeNegative = ldau.pdgCode(); - thisInfo.processNegative = ldau.getProcess(); - thisInfo.negP[0] = ldau.px(); - thisInfo.negP[1] = ldau.py(); - thisInfo.negP[2] = ldau.pz(); - } - } - } - if (lNegMother.has_mcCollision()) { - thisInfo.mcCollision = lNegMother.mcCollisionId(); // save this reference, please - } + // check for pi -> mu + antineutrino decay + // if present, de-reference original V0 correctly and provide label to original object + // NOTA BENE: the prong info will still correspond to a muon, treat carefully! + int negOriginating = -1, posOriginating = -1, particleForDecayPositionIdx = -1; + negOriginating = getOriginatingParticle(lMCNegTrack, particleForDecayPositionIdx); + posOriginating = getOriginatingParticle(lMCPosTrack, particleForDecayPositionIdx); + + if (negOriginating > -1 && negOriginating == posOriginating) { + auto originatingV0 = mcParticles.rawIteratorAt(negOriginating); + auto particleForDecayPosition = mcParticles.rawIteratorAt(particleForDecayPositionIdx); + + thisInfo.label = originatingV0.globalIndex(); + thisInfo.xyz[0] = particleForDecayPosition.vx(); + thisInfo.xyz[1] = particleForDecayPosition.vy(); + thisInfo.xyz[2] = particleForDecayPosition.vz(); + + // MC pos. and neg. daughters are the same! Looking for replacement... + // if (lMCPosTrack.globalIndex() == lMCNegTrack.globalIndex()) { + // auto const& daughters = lNegMother.daughters_as(); + // for (auto& ldau : daughters) { + // // check if the candidate originates from a decay + // // if not, this is not a suitable candidate for one of the decay daughters + // if (ldau.getProcess() != 4) // see TMCProcess.h + // continue; + + // if (lMCPosTrack.pdgCode() < 0 && ldau.pdgCode() > 0) { // the positive track needs to be changed + // thisInfo.pdgCodePositive = ldau.pdgCode(); + // thisInfo.processPositive = ldau.getProcess(); + // thisInfo.posP[0] = ldau.px(); + // thisInfo.posP[1] = ldau.py(); + // thisInfo.posP[2] = ldau.pz(); + // thisInfo.xyz[0] = ldau.vx(); + // thisInfo.xyz[1] = ldau.vy(); + // thisInfo.xyz[2] = ldau.vz(); + // } + // if (lMCNegTrack.pdgCode() > 0 && ldau.pdgCode() < 0) { // the negative track needs to be changed + // thisInfo.pdgCodeNegative = ldau.pdgCode(); + // thisInfo.processNegative = ldau.getProcess(); + // thisInfo.negP[0] = ldau.px(); + // thisInfo.negP[1] = ldau.py(); + // thisInfo.negP[2] = ldau.pz(); + // } + // } + // } + + if (originatingV0.has_mcCollision()) { + thisInfo.mcCollision = originatingV0.mcCollisionId(); // save this reference, please + } - // acquire information - thisInfo.pdgCode = lNegMother.pdgCode(); - thisInfo.isPhysicalPrimary = lNegMother.isPhysicalPrimary(); - thisInfo.momentum[0] = lNegMother.px(); - thisInfo.momentum[1] = lNegMother.py(); - thisInfo.momentum[2] = lNegMother.pz(); - - if (lNegMother.has_mothers()) { - for (auto& lNegGrandMother : lNegMother.mothers_as()) { - thisInfo.pdgCodeMother = lNegGrandMother.pdgCode(); - thisInfo.motherLabel = lNegGrandMother.globalIndex(); - } - } - } + // acquire information + thisInfo.pdgCode = originatingV0.pdgCode(); + thisInfo.isPhysicalPrimary = originatingV0.isPhysicalPrimary(); + thisInfo.momentum[0] = originatingV0.px(); + thisInfo.momentum[1] = originatingV0.py(); + thisInfo.momentum[2] = originatingV0.pz(); + + if (originatingV0.has_mothers()) { + for (auto& lV0Mother : originatingV0.mothers_as()) { + thisInfo.pdgCodeMother = lV0Mother.pdgCode(); + thisInfo.motherLabel = lV0Mother.globalIndex(); } } } + } // end association check // Construct label table (note: this will be joinable with V0Datas!) v0labels( @@ -308,7 +337,6 @@ struct lambdakzeromcbuilder { if (populateV0MCCoresAsymmetric) { // first step: add any un-recoed v0mmcores that were requested for (auto& mcParticle : mcParticles) { - thisInfo.packedMcParticleIndices = 0; thisInfo.label = -1; thisInfo.motherLabel = -1; thisInfo.pdgCode = 0; diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeromcfinder.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeromcfinder.cxx index 86e71a80ae2..0a0db73ea6d 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzeromcfinder.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzeromcfinder.cxx @@ -24,10 +24,18 @@ // david.dobrigkeit.chinellato@cern.ch // -#include #include #include #include +#include + +#include "Math/Vector4D.h" +#include +#include +#include +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -50,14 +58,6 @@ #include "CommonConstants/PhysicsConstants.h" #include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table -#include -#include -#include -#include -#include -#include -#include - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -351,7 +351,7 @@ struct lambdakzeromcfinder { continue; // skip particles without decay mothers for (auto& posMotherParticle : posParticle.mothers_as()) { // determine if mother particle satisfies any condition curently being searched for - for (int ipdg = 0; ipdg < searchedV0PDG.size(); ipdg++) + for (std::size_t ipdg = 0; ipdg < searchedV0PDG.size(); ipdg++) if (searchedV0PDG[ipdg] == posMotherParticle.pdgCode() && fabs(posMotherParticle.y()) < yPreFilter) { v0pdgIndex = ipdg; // index mapping to desired V0 species motherIndex = posMotherParticle.globalIndex(); diff --git a/PWGLF/TableProducer/Strangeness/sigma0builder.cxx b/PWGLF/TableProducer/Strangeness/sigma0builder.cxx index ff77cf5f718..bd44e781f5c 100644 --- a/PWGLF/TableProducer/Strangeness/sigma0builder.cxx +++ b/PWGLF/TableProducer/Strangeness/sigma0builder.cxx @@ -54,12 +54,10 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using std::cout; -using std::endl; using dauTracks = soa::Join; -using V0DerivedMCDatas = soa::Join; -using V0MLDerivedDatas = soa::Join; -using V0StandardDerivedDatas = soa::Join; +using V0DerivedMCDatas = soa::Join; +using V0MLDerivedDatas = soa::Join; +using V0StandardDerivedDatas = soa::Join; struct sigma0builder { SliceCache cache; @@ -86,73 +84,133 @@ struct sigma0builder { // For standard approach: //// Lambda criteria: - Configurable LambdaDauPseudoRap{"LambdaDauPseudoRap", 1.0, "Max pseudorapidity of daughter tracks"}; - Configurable LambdaMinDCANegToPv{"LambdaMinDCANegToPv", .01, "min DCA Neg To PV (cm)"}; - Configurable LambdaMinDCAPosToPv{"LambdaMinDCAPosToPv", .01, "min DCA Pos To PV (cm)"}; + Configurable LambdaDauPseudoRap{"LambdaDauPseudoRap", 1.5, "Max pseudorapidity of daughter tracks"}; + Configurable LambdaMinDCANegToPv{"LambdaMinDCANegToPv", 0.0, "min DCA Neg To PV (cm)"}; + Configurable LambdaMinDCAPosToPv{"LambdaMinDCAPosToPv", 0.0, "min DCA Pos To PV (cm)"}; Configurable LambdaMaxDCAV0Dau{"LambdaMaxDCAV0Dau", 3.5, "Max DCA V0 Daughters (cm)"}; - Configurable LambdaMinv0radius{"LambdaMinv0radius", 0.1, "Min V0 radius (cm)"}; - Configurable LambdaMaxv0radius{"LambdaMaxv0radius", 200, "Max V0 radius (cm)"}; - Configurable LambdaWindow{"LambdaWindow", 0.01, "Mass window around expected (in GeV/c2)"}; + Configurable LambdaMinv0radius{"LambdaMinv0radius", 0.0, "Min V0 radius (cm)"}; + Configurable LambdaMaxv0radius{"LambdaMaxv0radius", 60, "Max V0 radius (cm)"}; + Configurable LambdaWindow{"LambdaWindow", 0.05, "Mass window around expected (in GeV/c2)"}; //// Photon criteria: - Configurable PhotonMaxDauPseudoRap{"PhotonMaxDauPseudoRap", 1.0, "Max pseudorapidity of daughter tracks"}; - Configurable PhotonMinDCAToPv{"PhotonMinDCAToPv", 0.001, "Min DCA daughter To PV (cm)"}; - Configurable PhotonMaxDCAV0Dau{"PhotonMaxDCAV0Dau", 3.0, "Max DCA V0 Daughters (cm)"}; - Configurable PhotonMinRadius{"PhotonMinRadius", 0.5, "Min photon conversion radius (cm)"}; - Configurable PhotonMaxRadius{"PhotonMaxRadius", 250, "Max photon conversion radius (cm)"}; + Configurable PhotonMaxDauPseudoRap{"PhotonMaxDauPseudoRap", 1.5, "Max pseudorapidity of daughter tracks"}; + Configurable PhotonMinDCAToPv{"PhotonMinDCAToPv", 0.0, "Min DCA daughter To PV (cm)"}; + Configurable PhotonMaxDCAV0Dau{"PhotonMaxDCAV0Dau", 3.5, "Max DCA V0 Daughters (cm)"}; + Configurable PhotonMinRadius{"PhotonMinRadius", 0.0, "Min photon conversion radius (cm)"}; + Configurable PhotonMaxRadius{"PhotonMaxRadius", 240, "Max photon conversion radius (cm)"}; Configurable PhotonMaxMass{"PhotonMaxMass", 0.3, "Max photon mass (GeV/c^{2})"}; //// Sigma0 criteria: - Configurable Sigma0Window{"Sigma0Window", 0.05, "Mass window around expected (in GeV/c2)"}; - Configurable SigmaMaxRap{"SigmaMaxRap", 0.5, "Max sigma0 rapidity"}; + Configurable Sigma0Window{"Sigma0Window", 0.1, "Mass window around expected (in GeV/c2)"}; + Configurable SigmaMaxRap{"SigmaMaxRap", 0.8, "Max sigma0 rapidity"}; // Axis // base properties - ConfigurableAxis vertexZ{"vertexZ", {30, -15.0f, 15.0f}, ""}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for analysis"}; ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Centrality"}; - ConfigurableAxis axisSigmaMass{"axisSigmaMass", {200, 1.16f, 1.23f}, "M_{#Sigma^{0}} (GeV/c^{2})"}; ConfigurableAxis axisDeltaPt{"axisDeltaPt", {100, -1.0, +1.0}, "#Delta(p_{T})"}; + // Invariant Mass + ConfigurableAxis axisSigmaMass{"axisSigmaMass", {1000, 1.10f, 1.30f}, "M_{#Sigma^{0}} (GeV/c^{2})"}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.05f, 1.151f}, "M_{#Lambda} (GeV/c^{2})"}; + ConfigurableAxis axisPhotonMass{"axisPhotonMass", {600, -0.1f, 0.5f}, "M_{#Gamma}"}; + + // AP plot axes + ConfigurableAxis axisAPAlpha{"axisAPAlpha", {220, -1.1f, 1.1f}, "V0 AP alpha"}; + ConfigurableAxis axisAPQt{"axisAPQt", {220, 0.0f, 0.5f}, "V0 AP alpha"}; + + // Track quality axes + ConfigurableAxis axisTPCrows{"axisTPCrows", {160, 0.0f, 160.0f}, "N TPC rows"}; + + // topological variable QA axes + ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {500, 0.0f, 50.0f}, "DCA (cm)"}; + ConfigurableAxis axisDCAdau{"axisDCAdau", {50, 0.0f, 5.0f}, "DCA (cm)"}; + ConfigurableAxis axisRadius{"axisRadius", {240, 0.0f, 120.0f}, "V0 radius (cm)"}; + ConfigurableAxis axisRapidity{"axisRapidity", {100, -2.0f, 2.0f}, "Rapidity"}; + ConfigurableAxis axisCandSel{"axisCandSel", {13, 0.5f, +13.5f}, "Candidate Selection"}; + int nSigmaCandidates = 0; void init(InitContext const&) { // Event counter - histos.add("hEventVertexZ", "hEventVertexZ", kTH1F, {vertexZ}); - histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{20, -100.0f, 100.0f}}); - histos.add("hCandidateBuilderSelection", "hCandidateBuilderSelection", kTH1F, {{11, -0.5f, +11.5f}}); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(1, "Photon Mass Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(2, "Photon DauEta Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(3, "Photon DCAToPV Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(4, "Photon DCADau Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(5, "Photon Radius Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(6, "Lambda Mass Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(7, "Lambda DauEta Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(8, "Lambda DCAToPV Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(9, "Lambda Radius Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(10, "Lambda DCADau Cut"); - histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(11, "Sigma Window"); - - // For efficiency calculation (and QA): - histos.add("Efficiency/h2dPtVsCentrality_GammaAll", "h2dPtVsCentrality_GammaAll", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_LambdaAll", "h2dPtVsCentrality_LambdaAll", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_AntiLambdaAll", "h2dPtVsCentrality_AntiLambdaAll", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_GammaSigma0", "h2dPtVsCentrality_GammaSigma0", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_LambdaSigma0", "h2dPtVsCentrality_LambdaSigma0", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_Sigma0All", "h2dPtVsCentrality_Sigma0All", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_Sigma0AfterSel", "h2dPtVsCentrality_Sigma0AfterSel", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_AntiSigma0All", "h2dPtVsCentrality_AntiSigma0All", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_GammaAntiSigma0", "h2dPtVsCentrality_GammaAntiSigma0", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_LambdaAntiSigma0", "h2dPtVsCentrality_LambdaAntiSigma0", kTH2D, {axisCentrality, axisPt}); - histos.add("Efficiency/h2dPtVsCentrality_AntiSigma0AfterSel", "h2dPtVsCentrality_AntiSigma0AfterSel", kTH2D, {axisCentrality, axisPt}); - - histos.add("Efficiency/h2dSigmaPtVsLambdaPt", "h2dSigmaPtVsLambdaPt", kTH2D, {axisPt, axisPt}); - histos.add("Efficiency/h2dSigmaPtVsGammaPt", "h2dSigmaPtVsGammaPt", kTH2D, {axisPt, axisPt}); - - histos.add("Efficiency/h2dLambdaPtResolution", "h2dLambdaPtResolution", kTH2D, {axisPt, axisDeltaPt}); - histos.add("Efficiency/h2dGammaPtResolution", "h2dGammaPtResolution", kTH2D, {axisPt, axisDeltaPt}); - - histos.add("h3dMassSigmasAll", "h3dMassSigmasAll", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); + histos.add("hEventCentrality", "hEventCentrality", kTH1F, {axisCentrality}); + histos.add("hCandidateBuilderSelection", "hCandidateBuilderSelection", kTH1F, {axisCandSel}); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(1, "No Sel"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(2, "Photon Mass Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(3, "Photon DauEta Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(4, "Photon DCAToPV Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(5, "Photon DCADau Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(6, "Photon Radius Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(7, "Lambda Mass Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(8, "Lambda DauEta Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(9, "Lambda DCAToPV Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(10, "Lambda Radius Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(11, "Lambda DCADau Cut"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(12, "Sigma Mass Window"); + histos.get(HIST("hCandidateBuilderSelection"))->GetXaxis()->SetBinLabel(13, "Sigma Y Window"); + + // For QA: + histos.add("Selection/hPhotonMass", "hPhotonMass", kTH1F, {axisPhotonMass}); + histos.add("Selection/hPhotonNegEta", "hPhotonNegEta", kTH1F, {axisRapidity}); + histos.add("Selection/hPhotonPosEta", "hPhotonPosEta", kTH1F, {axisRapidity}); + histos.add("Selection/hPhotonDCANegToPV", "hPhotonDCANegToPV", kTH1F, {axisDCAtoPV}); + histos.add("Selection/hPhotonDCAPosToPV", "hPhotonDCAPosToPV", kTH1F, {axisDCAtoPV}); + histos.add("Selection/hPhotonDCADau", "hPhotonDCADau", kTH1F, {axisDCAdau}); + histos.add("Selection/hPhotonRadius", "hPhotonRadius", kTH1F, {axisRadius}); + histos.add("Selection/hLambdaMass", "hLambdaMass", kTH1F, {axisLambdaMass}); + histos.add("Selection/hAntiLambdaMass", "hAntiLambdaMass", kTH1F, {axisLambdaMass}); + histos.add("Selection/hLambdaNegEta", "hLambdaNegEta", kTH1F, {axisRapidity}); + histos.add("Selection/hLambdaPosEta", "hLambdaPosEta", kTH1F, {axisRapidity}); + histos.add("Selection/hLambdaDCANegToPV", "hLambdaDCANegToPV", kTH1F, {axisDCAtoPV}); + histos.add("Selection/hLambdaDCAPosToPV", "hLambdaDCAPosToPV", kTH1F, {axisDCAtoPV}); + histos.add("Selection/hLambdaDCADau", "hLambdaDCADau", kTH1F, {axisDCAdau}); + histos.add("Selection/hLambdaRadius", "hLambdaRadius", kTH1F, {axisRadius}); + histos.add("Selection/hSigmaMass", "hSigmaMass", kTH1F, {axisSigmaMass}); + histos.add("Selection/hSigmaMassWindow", "hSigmaMassWindow", kTH1F, {{1000, -0.09f, 0.11f}}); + histos.add("Selection/hSigmaY", "hSigmaY", kTH1F, {axisRapidity}); + + histos.add("GeneralQA/h2dMassGammaVsK0S", "h2dMassGammaVsK0S", kTH2D, {axisPhotonMass, {200, 0.4f, 0.6f}}); + histos.add("GeneralQA/h2dMassLambdaVsK0S", "h2dMassLambdaVsK0S", kTH2D, {axisLambdaMass, {200, 0.4f, 0.6f}}); + histos.add("GeneralQA/h2dMassGammaVsLambda", "h2dMassGammaVsLambda", kTH2D, {axisPhotonMass, axisLambdaMass}); + histos.add("GeneralQA/h3dMassSigma0VsDaupTs", "h3dMassSigma0VsDaupTs", kTH3F, {axisPt, axisPt, axisSigmaMass}); + histos.add("GeneralQA/h2dMassGammaVsK0SAfterMassSel", "h2dMassGammaVsK0SAfterMassSel", kTH2D, {axisPhotonMass, {200, 0.4f, 0.6f}}); + histos.add("GeneralQA/h2dMassLambdaVsK0SAfterMassSel", "h2dMassLambdaVsK0SAfterMassSel", kTH2D, {axisLambdaMass, {200, 0.4f, 0.6f}}); + histos.add("GeneralQA/h2dMassGammaVsLambdaAfterMassSel", "h2dMassGammaVsLambdaAfterMassSel", kTH2D, {axisPhotonMass, axisLambdaMass}); + + // MC + histos.add("MC/h2dPtVsCentrality_GammaBeforeSel", "h2dPtVsCentrality_GammaBeforeSel", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_LambdaBeforeSel", "h2dPtVsCentrality_LambdaBeforeSel", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_AntiLambdaBeforeSel", "h2dPtVsCentrality_AntiLambdaBeforeSel", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_GammaSigma0", "h2dPtVsCentrality_GammaSigma0", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_LambdaSigma0", "h2dPtVsCentrality_LambdaSigma0", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_Sigma0BeforeSel", "h2dPtVsCentrality_Sigma0BeforeSel", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_Sigma0AfterSel", "h2dPtVsCentrality_Sigma0AfterSel", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_AntiSigma0BeforeSel", "h2dPtVsCentrality_AntiSigma0BeforeSel", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_GammaAntiSigma0", "h2dPtVsCentrality_GammaAntiSigma0", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_LambdaAntiSigma0", "h2dPtVsCentrality_LambdaAntiSigma0", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_AntiSigma0AfterSel", "h2dPtVsCentrality_AntiSigma0AfterSel", kTH2D, {axisCentrality, axisPt}); + + // Sigma vs Daughters pT + histos.add("MC/h2dSigmaPtVsLambdaPt", "h2dSigmaPtVsLambdaPt", kTH2D, {axisPt, axisPt}); + histos.add("MC/h2dSigmaPtVsGammaPt", "h2dSigmaPtVsGammaPt", kTH2D, {axisPt, axisPt}); + + // pT Resolution: + histos.add("MC/h2dLambdaPtResolution", "h2dLambdaPtResolution", kTH2D, {axisPt, axisDeltaPt}); + histos.add("MC/h2dGammaPtResolution", "h2dGammaPtResolution", kTH2D, {axisPt, axisDeltaPt}); + + // For background decomposition + histos.add("MC/h2dPtVsMassSigma_All", "h2dPtVsMassSigma_All", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_SignalOnly", "h2dPtVsMassSigma_SignalOnly", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_TrueDaughters", "h2dPtVsMassSigma_TrueDaughters", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_TrueGammaFakeLambda", "h2dPtVsMassSigma_TrueGammaFakeLambda", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_FakeGammaTrueLambda", "h2dPtVsMassSigma_FakeGammaTrueLambda", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_FakeDaughters", "h2dPtVsMassSigma_FakeDaughters", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dTrueDaughtersMatrix", "h2dTrueDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add("MC/h2dTrueGammaFakeLambdaMatrix", "h2dTrueGammaFakeLambdaMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add("MC/h2dFakeGammaTrueLambdaMatrix", "h2dFakeGammaTrueLambdaMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add("MC/h2dFakeDaughtersMatrix", "h2dFakeDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + + histos.add("h3dMassSigmasBeforeSel", "h3dMassSigmasBeforeSel", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); histos.add("h3dMassSigmasAfterSel", "h3dMassSigmasAfterSel", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); } @@ -163,6 +221,10 @@ struct sigma0builder { if ((lambda.v0Type() == 0) || (gamma.v0Type() == 0)) return false; + // Checking if both V0s are made of the very same tracks + if ((gamma.posTrackExtraId() == lambda.posTrackExtraId()) || (gamma.negTrackExtraId() == lambda.negTrackExtraId()) || (gamma.posTrackExtraId() == lambda.negTrackExtraId()) || (gamma.negTrackExtraId() == lambda.posTrackExtraId()) || (gamma.posTrackExtraId() == lambda.negTrackExtraId())) + return false; + if constexpr ( requires { gamma.gammaBDTScore(); } && requires { lambda.lambdaBDTScore(); } && @@ -180,38 +242,54 @@ struct sigma0builder { } else { // Standard selection // Gamma basic selection criteria: - if (TMath::Abs(gamma.mGamma()) > PhotonMaxMass) + histos.fill(HIST("hCandidateBuilderSelection"), 1.); + histos.fill(HIST("Selection/hPhotonMass"), gamma.mGamma()); + if ((gamma.mGamma() < 0) || (gamma.mGamma() > PhotonMaxMass)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 0.); + histos.fill(HIST("Selection/hPhotonNegEta"), gamma.negativeeta()); + histos.fill(HIST("Selection/hPhotonPosEta"), gamma.positiveeta()); + histos.fill(HIST("hCandidateBuilderSelection"), 2.); if ((TMath::Abs(gamma.negativeeta()) > PhotonMaxDauPseudoRap) || (TMath::Abs(gamma.positiveeta()) > PhotonMaxDauPseudoRap)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 1.); + histos.fill(HIST("Selection/hPhotonDCANegToPV"), TMath::Abs(gamma.dcanegtopv())); + histos.fill(HIST("Selection/hPhotonDCAPosToPV"), TMath::Abs(gamma.dcapostopv())); + histos.fill(HIST("hCandidateBuilderSelection"), 3.); if ((TMath::Abs(gamma.dcapostopv()) < PhotonMinDCAToPv) || (TMath::Abs(gamma.dcanegtopv()) < PhotonMinDCAToPv)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 2.); + histos.fill(HIST("Selection/hPhotonDCADau"), TMath::Abs(gamma.dcaV0daughters())); + histos.fill(HIST("hCandidateBuilderSelection"), 4.); if (TMath::Abs(gamma.dcaV0daughters()) > PhotonMaxDCAV0Dau) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 3.); + histos.fill(HIST("Selection/hPhotonRadius"), gamma.v0radius()); + histos.fill(HIST("hCandidateBuilderSelection"), 5.); if ((gamma.v0radius() < PhotonMinRadius) || (gamma.v0radius() > PhotonMaxRadius)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 4.); + histos.fill(HIST("hCandidateBuilderSelection"), 6.); + histos.fill(HIST("Selection/hLambdaMass"), lambda.mLambda()); + histos.fill(HIST("Selection/hAntiLambdaMass"), lambda.mAntiLambda()); // Lambda basic selection criteria: if ((TMath::Abs(lambda.mLambda() - 1.115683) > LambdaWindow) && (TMath::Abs(lambda.mAntiLambda() - 1.115683) > LambdaWindow)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 5.); + histos.fill(HIST("Selection/hLambdaNegEta"), lambda.negativeeta()); + histos.fill(HIST("Selection/hLambdaPosEta"), lambda.positiveeta()); + histos.fill(HIST("hCandidateBuilderSelection"), 7.); if ((TMath::Abs(lambda.negativeeta()) > LambdaDauPseudoRap) || (TMath::Abs(lambda.positiveeta()) > LambdaDauPseudoRap)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 6.); + histos.fill(HIST("Selection/hLambdaDCANegToPV"), lambda.dcanegtopv()); + histos.fill(HIST("Selection/hLambdaDCAPosToPV"), lambda.dcapostopv()); + histos.fill(HIST("hCandidateBuilderSelection"), 8.); if ((TMath::Abs(lambda.dcapostopv()) < LambdaMinDCAPosToPv) || (TMath::Abs(lambda.dcanegtopv()) < LambdaMinDCANegToPv)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 7.); + histos.fill(HIST("Selection/hLambdaRadius"), lambda.v0radius()); + histos.fill(HIST("hCandidateBuilderSelection"), 9.); if ((lambda.v0radius() < LambdaMinv0radius) || (lambda.v0radius() > LambdaMaxv0radius)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 8.); + histos.fill(HIST("Selection/hLambdaDCADau"), lambda.dcaV0daughters()); + histos.fill(HIST("hCandidateBuilderSelection"), 10.); if (TMath::Abs(lambda.dcaV0daughters()) > LambdaMaxDCAV0Dau) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 9.); + histos.fill(HIST("hCandidateBuilderSelection"), 11.); } // Sigma0 candidate properties std::array pVecPhotons{gamma.px(), gamma.py(), gamma.pz()}; @@ -219,15 +297,57 @@ struct sigma0builder { auto arrMom = std::array{pVecPhotons, pVecLambda}; float sigmamass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); float sigmarap = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0); + float SigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()}); + + histos.fill(HIST("Selection/hSigmaMass"), sigmamass); + histos.fill(HIST("Selection/hSigmaMassWindow"), sigmamass - 1.192642); + histos.fill(HIST("GeneralQA/h2dMassGammaVsK0S"), gamma.mGamma(), gamma.mK0Short()); + histos.fill(HIST("GeneralQA/h2dMassLambdaVsK0S"), lambda.mLambda(), lambda.mK0Short()); + histos.fill(HIST("GeneralQA/h2dMassGammaVsLambda"), gamma.mGamma(), lambda.mLambda()); + histos.fill(HIST("GeneralQA/h3dMassSigma0VsDaupTs"), gamma.pt(), lambda.pt(), sigmamass); + + if constexpr (requires { gamma.pdgCode(); } && requires { lambda.pdgCode(); }) { + + histos.fill(HIST("MC/h2dPtVsMassSigma_All"), SigmapT, sigmamass); + + // Real Gamma x Real Lambda - but not from the same sigma0/antisigma0! + if ((gamma.pdgCode() == 22) && ((lambda.pdgCode() == 3122) || (lambda.pdgCode() == -3122)) && (gamma.motherMCPartId() != lambda.motherMCPartId())) { + histos.fill(HIST("MC/h2dPtVsMassSigma_TrueDaughters"), SigmapT, sigmamass); + histos.fill(HIST("MC/h2dTrueDaughtersMatrix"), lambda.pdgCodeMother(), gamma.pdgCodeMother()); + } + + // Real Gamma x fake Lambda + if ((gamma.pdgCode() == 22) && (lambda.pdgCode() != 3122) && (lambda.pdgCode() != -3122)) { + histos.fill(HIST("MC/h2dPtVsMassSigma_TrueGammaFakeLambda"), SigmapT, sigmamass); + histos.fill(HIST("MC/h2dTrueGammaFakeLambdaMatrix"), lambda.pdgCodeMother(), gamma.pdgCodeMother()); + } + + // Fake Gamma x Real Lambda + if ((gamma.pdgCode() != 22) && ((lambda.pdgCode() == 3122) || (lambda.pdgCode() == -3122))) { + histos.fill(HIST("MC/h2dPtVsMassSigma_FakeGammaTrueLambda"), SigmapT, sigmamass); + histos.fill(HIST("MC/h2dFakeGammaTrueLambdaMatrix"), lambda.pdgCodeMother(), gamma.pdgCodeMother()); + } + + // Fake Gamma x Fake Lambda + if ((gamma.pdgCode() != 22) && (lambda.pdgCode() != 3122) && (lambda.pdgCode() != -3122)) { + histos.fill(HIST("MC/h2dPtVsMassSigma_FakeDaughters"), SigmapT, sigmamass); + histos.fill(HIST("MC/h2dFakeDaughtersMatrix"), lambda.pdgCodeMother(), gamma.pdgCodeMother()); + } + } if (TMath::Abs(sigmamass - 1.192642) > Sigma0Window) return false; + histos.fill(HIST("GeneralQA/h2dMassGammaVsK0SAfterMassSel"), gamma.mGamma(), gamma.mK0Short()); + histos.fill(HIST("GeneralQA/h2dMassLambdaVsK0SAfterMassSel"), lambda.mLambda(), lambda.mK0Short()); + histos.fill(HIST("GeneralQA/h2dMassGammaVsLambdaAfterMassSel"), gamma.mGamma(), lambda.mLambda()); + histos.fill(HIST("Selection/hSigmaY"), sigmarap); + histos.fill(HIST("hCandidateBuilderSelection"), 12.); + if (TMath::Abs(sigmarap) > SigmaMaxRap) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 10.); - + histos.fill(HIST("hCandidateBuilderSelection"), 13.); return true; } // Helper struct to pass v0 information @@ -235,6 +355,9 @@ struct sigma0builder { float mass; float pT; float Rapidity; + float OPAngle; + float DeltaEta; + float DeltaPhi; } sigmaCandidate; // Fill tables with reconstructed sigma0 candidate @@ -256,19 +379,6 @@ struct sigma0builder { AntiLambdaBDTScore = lambda.antiLambdaBDTScore(); } - // Sigma0 candidate properties - std::array pVecPhotons{gamma.px(), gamma.py(), gamma.pz()}; - std::array pVecLambda{lambda.px(), lambda.py(), lambda.pz()}; - auto arrMom = std::array{pVecPhotons, pVecLambda}; - sigmaCandidate.mass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); - sigmaCandidate.pT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()}); - sigmaCandidate.Rapidity = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0); - - // Sigma related - float fSigmapT = sigmaCandidate.pT; - float fSigmaMass = sigmaCandidate.mass; - float fSigmaRap = sigmaCandidate.Rapidity; - // Daughters related /// Photon auto posTrackGamma = gamma.template posTrackExtra_as(); @@ -286,6 +396,7 @@ struct sigma0builder { float fPhotonZconv = gamma.z(); float fPhotonEta = gamma.eta(); float fPhotonY = RecoDecay::y(std::array{gamma.px(), gamma.py(), gamma.pz()}, o2::constants::physics::MassGamma); + float fPhotonPhi = RecoDecay::phi(gamma.px(), gamma.py()); float fPhotonPosTPCNSigma = posTrackGamma.tpcNSigmaEl(); float fPhotonNegTPCNSigma = negTrackGamma.tpcNSigmaEl(); uint8_t fPhotonPosTPCCrossedRows = posTrackGamma.tpcCrossedRows(); @@ -319,10 +430,17 @@ struct sigma0builder { float fLambdaDCAPosPV = lambda.dcapostopv(); float fLambdaEta = lambda.eta(); float fLambdaY = lambda.yLambda(); + float fLambdaPhi = RecoDecay::phi(lambda.px(), lambda.py()); float fLambdaPosPrTPCNSigma = posTrackLambda.tpcNSigmaPr(); float fLambdaPosPiTPCNSigma = posTrackLambda.tpcNSigmaPi(); float fLambdaNegPrTPCNSigma = negTrackLambda.tpcNSigmaPr(); float fLambdaNegPiTPCNSigma = negTrackLambda.tpcNSigmaPi(); + + float fLambdaPrTOFNSigma = lambda.tofNSigmaLaPr(); + float fLambdaPiTOFNSigma = lambda.tofNSigmaLaPi(); + float fALambdaPrTOFNSigma = lambda.tofNSigmaALaPr(); + float fALambdaPiTOFNSigma = lambda.tofNSigmaALaPi(); + uint8_t fLambdaPosTPCCrossedRows = posTrackLambda.tpcCrossedRows(); uint8_t fLambdaNegTPCCrossedRows = negTrackLambda.tpcCrossedRows(); float fLambdaPosPt = lambda.positivept(); @@ -339,12 +457,34 @@ struct sigma0builder { uint32_t fLambdaNegITSClSize = negTrackLambda.itsClusterSizes(); uint8_t fLambdaV0Type = lambda.v0Type(); + // Sigma0 candidate properties + std::array pVecPhotons{gamma.px(), gamma.py(), gamma.pz()}; + std::array pVecLambda{lambda.px(), lambda.py(), lambda.pz()}; + auto arrMom = std::array{pVecPhotons, pVecLambda}; + TVector3 v1(gamma.px(), gamma.py(), gamma.pz()); + TVector3 v2(lambda.px(), lambda.py(), lambda.pz()); + + sigmaCandidate.mass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); + sigmaCandidate.pT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()}); + sigmaCandidate.Rapidity = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0); + sigmaCandidate.OPAngle = v1.Angle(v2); + sigmaCandidate.DeltaEta = fLambdaEta - fPhotonEta; + sigmaCandidate.DeltaPhi = fLambdaPhi - fPhotonPhi; + + // Sigma related + float fSigmapT = sigmaCandidate.pT; + float fSigmaMass = sigmaCandidate.mass; + float fSigmaRap = sigmaCandidate.Rapidity; + float fSigmaOPAngle = sigmaCandidate.OPAngle; + float fSigmaDeltaEta = sigmaCandidate.DeltaEta; + float fSigmaDeltaPhi = sigmaCandidate.DeltaPhi; + // Filling TTree for ML analysis - sigma0cores(fSigmapT, fSigmaMass, fSigmaRap); + sigma0cores(fSigmapT, fSigmaMass, fSigmaRap, fSigmaOPAngle, fSigmaDeltaEta, fSigmaDeltaPhi); sigmaPhotonExtras(fPhotonPt, fPhotonMass, fPhotonQt, fPhotonAlpha, fPhotonRadius, fPhotonCosPA, fPhotonDCADau, fPhotonDCANegPV, fPhotonDCAPosPV, fPhotonZconv, - fPhotonEta, fPhotonY, fPhotonPosTPCNSigma, fPhotonNegTPCNSigma, fPhotonPosTPCCrossedRows, + fPhotonEta, fPhotonY, fPhotonPhi, fPhotonPosTPCNSigma, fPhotonNegTPCNSigma, fPhotonPosTPCCrossedRows, fPhotonNegTPCCrossedRows, fPhotonPosPt, fPhotonNegPt, fPhotonPosEta, fPhotonNegEta, fPhotonPosY, fPhotonNegY, fPhotonPsiPair, fPhotonPosITSCls, fPhotonNegITSCls, fPhotonPosITSClSize, fPhotonNegITSClSize, @@ -352,9 +492,10 @@ struct sigma0builder { sigmaLambdaExtras(fLambdaPt, fLambdaMass, fAntiLambdaMass, fLambdaQt, fLambdaAlpha, fLambdaRadius, fLambdaCosPA, fLambdaDCADau, fLambdaDCANegPV, - fLambdaDCAPosPV, fLambdaEta, fLambdaY, fLambdaPosPrTPCNSigma, - fLambdaPosPiTPCNSigma, fLambdaNegPrTPCNSigma, fLambdaNegPiTPCNSigma, fLambdaPosTPCCrossedRows, - fLambdaNegTPCCrossedRows, fLambdaPosPt, fLambdaNegPt, fLambdaPosEta, + fLambdaDCAPosPV, fLambdaEta, fLambdaY, fLambdaPhi, fLambdaPosPrTPCNSigma, + fLambdaPosPiTPCNSigma, fLambdaNegPrTPCNSigma, fLambdaNegPiTPCNSigma, + fLambdaPrTOFNSigma, fLambdaPiTOFNSigma, fALambdaPrTOFNSigma, fALambdaPiTOFNSigma, + fLambdaPosTPCCrossedRows, fLambdaNegTPCCrossedRows, fLambdaPosPt, fLambdaNegPt, fLambdaPosEta, fLambdaNegEta, fLambdaPosPrY, fLambdaPosPiY, fLambdaNegPrY, fLambdaNegPiY, fLambdaPosITSCls, fLambdaNegITSCls, fLambdaPosITSClSize, fLambdaNegITSClSize, fLambdaV0Type, LambdaBDTScore, AntiLambdaBDTScore); @@ -368,8 +509,7 @@ struct sigma0builder { auto V0Table_thisCollision = V0s.sliceBy(perCollisionMCDerived, collIdx); // V0 table sliced - for (auto& gamma : V0Table_thisCollision) { // selecting photons from Sigma0 - + for (auto& gamma : V0Table_thisCollision) { // selecting photons from Sigma0 float centrality = coll.centFT0C(); // Auxiliary histograms: @@ -377,39 +517,38 @@ struct sigma0builder { float GammaY = TMath::Abs(RecoDecay::y(std::array{gamma.px(), gamma.py(), gamma.pz()}, o2::constants::physics::MassGamma)); if (GammaY < 0.5) { // rapidity selection - histos.fill(HIST("Efficiency/h2dPtVsCentrality_GammaAll"), centrality, gamma.pt()); // isgamma - histos.fill(HIST("Efficiency/h2dGammaPtResolution"), gamma.pt(), gamma.pt() - RecoDecay::pt(array{gamma.pxMC(), gamma.pyMC()})); // pT resolution + histos.fill(HIST("MC/h2dPtVsCentrality_GammaBeforeSel"), centrality, gamma.pt()); // isgamma + histos.fill(HIST("MC/h2dGammaPtResolution"), gamma.pt(), gamma.pt() - RecoDecay::pt(array{gamma.pxMC(), gamma.pyMC()})); // pT resolution if (gamma.pdgCodeMother() == 3212) { - histos.fill(HIST("Efficiency/h2dPtVsCentrality_GammaSigma0"), centrality, gamma.pt()); // isgamma from sigma + histos.fill(HIST("MC/h2dPtVsCentrality_GammaSigma0"), centrality, gamma.pt()); // isgamma from sigma } if (gamma.pdgCodeMother() == -3212) { - histos.fill(HIST("Efficiency/h2dPtVsCentrality_GammaAntiSigma0"), centrality, gamma.pt()); // isgamma from sigma + histos.fill(HIST("MC/h2dPtVsCentrality_GammaAntiSigma0"), centrality, gamma.pt()); // isgamma from sigma } } } if (gamma.pdgCode() == 3122) { // Is Lambda float LambdaY = TMath::Abs(RecoDecay::y(std::array{gamma.px(), gamma.py(), gamma.pz()}, o2::constants::physics::MassLambda)); if (LambdaY < 0.5) { // rapidity selection - histos.fill(HIST("Efficiency/h2dPtVsCentrality_LambdaAll"), centrality, gamma.pt()); - histos.fill(HIST("Efficiency/h2dLambdaPtResolution"), gamma.pt(), gamma.pt() - RecoDecay::pt(array{gamma.pxMC(), gamma.pyMC()})); // pT resolution + histos.fill(HIST("MC/h2dPtVsCentrality_LambdaBeforeSel"), centrality, gamma.pt()); + histos.fill(HIST("MC/h2dLambdaPtResolution"), gamma.pt(), gamma.pt() - RecoDecay::pt(array{gamma.pxMC(), gamma.pyMC()})); // pT resolution if (gamma.pdgCodeMother() == 3212) { - histos.fill(HIST("Efficiency/h2dPtVsCentrality_LambdaSigma0"), centrality, gamma.pt()); + histos.fill(HIST("MC/h2dPtVsCentrality_LambdaSigma0"), centrality, gamma.pt()); } } } if (gamma.pdgCode() == -3122) { // Is AntiLambda float AntiLambdaY = TMath::Abs(RecoDecay::y(std::array{gamma.px(), gamma.py(), gamma.pz()}, o2::constants::physics::MassLambda)); if (AntiLambdaY < 0.5) { // rapidity selection - histos.fill(HIST("Efficiency/h2dPtVsCentrality_AntiLambdaAll"), centrality, gamma.pt()); + histos.fill(HIST("MC/h2dPtVsCentrality_AntiLambdaBeforeSel"), centrality, gamma.pt()); if (gamma.pdgCodeMother() == -3212) { - histos.fill(HIST("Efficiency/h2dPtVsCentrality_LambdaAntiSigma0"), centrality, gamma.pt()); // isantilambda from antisigma + histos.fill(HIST("MC/h2dPtVsCentrality_LambdaAntiSigma0"), centrality, gamma.pt()); // isantilambda from antisigma } } } for (auto& lambda : V0Table_thisCollision) { // selecting lambdas from Sigma0 - // Sigma0 candidate properties std::array pVecPhotons{gamma.px(), gamma.py(), gamma.pz()}; std::array pVecLambda{lambda.px(), lambda.py(), lambda.pz()}; @@ -418,31 +557,43 @@ struct sigma0builder { float SigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()}); float SigmaY = TMath::Abs(RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0)); - histos.fill(HIST("h3dMassSigmasAll"), centrality, SigmapT, SigmaMass); - if ((gamma.pdgCode() == 22) && (gamma.pdgCodeMother() == 3212) && (lambda.pdgCode() == 3122) && (lambda.pdgCodeMother() == 3212) && (gamma.motherMCPartId() == lambda.motherMCPartId()) && (SigmaY < 0.5)) { - histos.fill(HIST("Efficiency/h2dPtVsCentrality_Sigma0All"), centrality, RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()})); - histos.fill(HIST("Efficiency/h2dSigmaPtVsLambdaPt"), SigmapT, lambda.pt()); - histos.fill(HIST("Efficiency/h2dSigmaPtVsGammaPt"), SigmapT, gamma.pt()); + histos.fill(HIST("MC/h2dPtVsCentrality_Sigma0BeforeSel"), centrality, RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()})); + histos.fill(HIST("MC/h2dSigmaPtVsLambdaPt"), SigmapT, lambda.pt()); + histos.fill(HIST("MC/h2dSigmaPtVsGammaPt"), SigmapT, gamma.pt()); } if ((gamma.pdgCode() == 22) && (gamma.pdgCodeMother() == -3212) && (lambda.pdgCode() == -3122) && (lambda.pdgCodeMother() == -3212) && (gamma.motherMCPartId() == lambda.motherMCPartId()) && (SigmaY < 0.5)) - histos.fill(HIST("Efficiency/h2dPtVsCentrality_AntiSigma0All"), centrality, SigmapT); + histos.fill(HIST("MC/h2dPtVsCentrality_AntiSigma0BeforeSel"), centrality, SigmapT); if (!processSigmaCandidate(lambda, gamma)) // basic selection continue; bool fIsSigma = false; bool fIsAntiSigma = false; - histos.fill(HIST("h3dMassSigmasAfterSel"), centrality, SigmapT, SigmaMass); + bool fIsPhotonPrimary = gamma.isPhysicalPrimary(); + int PhotonCandPDGCode = gamma.pdgCode(); + int PhotonCandPDGCodeMother = gamma.pdgCodeMother(); + bool fIsLambdaPrimary = lambda.isPhysicalPrimary(); + int LambdaCandPDGCode = lambda.pdgCode(); + int LambdaCandPDGCodeMother = lambda.pdgCodeMother(); + if ((gamma.pdgCode() == 22) && (gamma.pdgCodeMother() == 3212) && (lambda.pdgCode() == 3122) && (lambda.pdgCodeMother() == 3212) && (gamma.motherMCPartId() == lambda.motherMCPartId())) { fIsSigma = true; - histos.fill(HIST("Efficiency/h2dPtVsCentrality_Sigma0AfterSel"), centrality, RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()})); + histos.fill(HIST("MC/h2dPtVsCentrality_Sigma0AfterSel"), centrality, RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()})); } if ((gamma.pdgCode() == 22) && (gamma.pdgCodeMother() == -3212) && (lambda.pdgCode() == -3122) && (lambda.pdgCodeMother() == -3212) && (gamma.motherMCPartId() == lambda.motherMCPartId())) { fIsAntiSigma = true; - histos.fill(HIST("Efficiency/h2dPtVsCentrality_AntiSigma0AfterSel"), centrality, RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()})); + histos.fill(HIST("MC/h2dPtVsCentrality_AntiSigma0AfterSel"), centrality, RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()})); + // TH3D Mass histogram } - sigma0mccores(fIsSigma, fIsAntiSigma); + sigma0mccores(fIsSigma, fIsAntiSigma, + PhotonCandPDGCode, PhotonCandPDGCodeMother, fIsPhotonPrimary, + LambdaCandPDGCode, LambdaCandPDGCodeMother, fIsLambdaPrimary); + + // QA histograms + // Signal only (sigma0+antisigma0) + if (fIsSigma || fIsAntiSigma) + histos.fill(HIST("MC/h2dPtVsMassSigma_SignalOnly"), SigmapT, SigmaMass); } } } @@ -455,23 +606,32 @@ struct sigma0builder { const uint64_t collIdx = coll.globalIndex(); auto V0Table_thisCollision = V0s.sliceBy(perCollisionSTDDerived, collIdx); - histos.fill(HIST("hEventVertexZ"), coll.posZ()); histos.fill(HIST("hEventCentrality"), coll.centFT0C()); sigma0Coll(coll.posX(), coll.posY(), coll.posZ(), coll.centFT0M(), coll.centFT0A(), coll.centFT0C(), coll.centFV0A()); // V0 table sliced for (auto& gamma : V0Table_thisCollision) { // selecting photons from Sigma0 for (auto& lambda : V0Table_thisCollision) { // selecting lambdas from Sigma0 + std::array pVecPhotons{gamma.px(), gamma.py(), gamma.pz()}; + std::array pVecLambda{lambda.px(), lambda.py(), lambda.pz()}; + auto arrMom = std::array{pVecPhotons, pVecLambda}; + float SigmaMass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); + float SigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()}); + // float SigmaY = TMath::Abs(RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0)); + histos.fill(HIST("h3dMassSigmasBeforeSel"), coll.centFT0C(), SigmapT, SigmaMass); + if (!processSigmaCandidate(lambda, gamma)) // applying selection for reconstruction continue; + histos.fill(HIST("h3dMassSigmasAfterSel"), coll.centFT0C(), SigmapT, SigmaMass); + + sigma0CollRefs(collIdx); + fillTables(lambda, gamma); // filling tables with accepted candidates + nSigmaCandidates++; if (nSigmaCandidates % 5000 == 0) { LOG(info) << "Sigma0 Candidates built: " << nSigmaCandidates; } - - sigma0CollRefs(collIdx); - fillTables(lambda, gamma); // filling tables with accepted candidates } } } @@ -484,7 +644,7 @@ struct sigma0builder { const uint64_t collIdx = coll.globalIndex(); auto V0Table_thisCollision = V0s.sliceBy(perCollisionMLDerived, collIdx); - histos.fill(HIST("hEventVertexZ"), coll.posZ()); + histos.fill(HIST("hEventCentrality"), coll.centFT0C()); sigma0Coll(coll.posX(), coll.posY(), coll.posZ(), coll.centFT0M(), coll.centFT0A(), coll.centFT0C(), coll.centFV0A()); // V0 table sliced diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 177786c6d5c..9888f324bf4 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" @@ -112,6 +114,7 @@ struct strangederivedbuilder { Produces StraFV0AQVs; // FV0A Q-vector Produces StraTPCQVs; // TPC Q-vector Produces StraFT0CQVsEv; // events used to compute FT0C Q-vector (LF) + Produces StraZDCSP; // ZDC Sums and Products //__________________________________________________ // Generated binned data @@ -378,8 +381,9 @@ struct strangederivedbuilder { totalFDDAmplitudeA, totalFDDAmplitudeC, energyCommonZNA, energyCommonZNC, // Collision flags - collision.flags()); - strangeStamps(bc.runNumber(), bc.timestamp()); + collision.flags(), + collision.alias_raw()); + strangeStamps(bc.runNumber(), bc.timestamp(), bc.globalBC()); } for (const auto& v0 : V0Table_thisColl) V0CollIndices[v0.globalIndex()] = strangeColl.lastIndex(); @@ -414,7 +418,8 @@ struct strangederivedbuilder { // ______________________________________________ // fill all MC collisions, correlate via index later on for (const auto& mccollision : mcCollisions) { - strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(), mccollision.impactParameter()); + strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(), + mccollision.impactParameter(), mccollision.eventPlaneAngle()); strangeMCMults(mccollision.multMCFT0A(), mccollision.multMCFT0C(), mccollision.multMCNParticlesEta05(), mccollision.multMCNParticlesEta08(), @@ -800,6 +805,10 @@ struct strangederivedbuilder { StraFT0CQVs(collision.qFT0C() * std::cos(2 * collision.psiFT0C()), collision.qFT0C() * std::sin(2 * collision.psiFT0C()), collision.qFT0C()); StraFT0CQVsEv(collision.triggereventep()); } + void processZDCSP(soa::Join::iterator const& collision) + { + StraZDCSP(collision.triggereventsp(), collision.psiZDCA(), collision.psiZDCC()); + } void processFT0MQVectors(soa::Join::iterator const& collision) { StraFT0MQVs(collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M()); @@ -905,6 +914,7 @@ struct strangederivedbuilder { PROCESS_SWITCH(strangederivedbuilder, processFV0AQVectors, "Produce FV0A Q-vectors table", false); PROCESS_SWITCH(strangederivedbuilder, processTPCQVectors, "Produce TPC Q-vectors table", false); PROCESS_SWITCH(strangederivedbuilder, processTPCQVectorsLF, "Produce TPC Q-vectors table using LF temporary calibration", false); + PROCESS_SWITCH(strangederivedbuilder, processZDCSP, "Produce ZDC SP table", false); // dedicated findable functionality PROCESS_SWITCH(strangederivedbuilder, processV0FoundTags, "Produce FoundV0Tags for findable exercise", false); diff --git a/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx b/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx index 7a541b48ed5..6d751cde7c1 100644 --- a/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx +++ b/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx @@ -12,6 +12,8 @@ // author: Lars Jörgensen #include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -29,9 +31,6 @@ #include "fastjet/AreaDefinition.hh" #include "fastjet/ClusterSequenceArea.hh" #include "fastjet/GhostedAreaSpec.hh" -// #include "fastjet/Selector.hh" -// #include "fastjet/tools/Subtractor.hh" -// #include "fastjet/tools/JetMedianBackgroundEstimator.hh" #include "PWGJE/Core/JetBkgSubUtils.h" #include "TVector2.h" #include "TVector3.h" @@ -43,8 +42,8 @@ using namespace o2::framework::expressions; struct AxisSpecs { AxisSpec ptAxisPos = {1000, 0, 100, "#it{p}_{T} [GeV/#it{c}]"}; AxisSpec ptAxisFull = {2000, -100, 100, "#it{p}_{T} [GeV/#it{c}]"}; - AxisSpec nsigmapTAxis = {1000, -50, 50, "#it{p}_{T} [GeV/#it{c}]"}; - AxisSpec nsigmaAxis = {1000, -15, 15, "n#sigma"}; + AxisSpec nsigmapTAxis = {500, 0, 50, "#it{p}_{T} [GeV/#it{c}]"}; + AxisSpec nsigmaAxis = {300, -15, 15, "n#sigma"}; AxisSpec dcazAxis = {1000, -1, 1, "DCA_{z} [cm]"}; AxisSpec dcaxyAxis = {1000, -0.5, 0.5, "DCA_{xy} [cm]"}; AxisSpec angDistPhiAxis = {1000, -2, 5, "#Delta#varphi"}; @@ -67,8 +66,6 @@ struct AngularCorrelationsInJets { Configurable fJetR{"jetR", 0.4, "jet resolution parameter"}; Configurable fMinJetPt{"minJetPt", 5.0, "minimum total pT to accept jet"}; Configurable fMinJetParticlePt{"minJetParticlePt", 0.0, "minimum pT to accept jet particle"}; - // Configurable fMinLeadingPt{"minLeadingPt", 5.0, "minimum pT for leading track"}; - // float fMinLeadingPt = 5.0; // Proton Cuts Configurable fProtonDCAxyYield{"protonDCAxyYield", 0.05, "[proton] DCAxy cut for yield"}; @@ -122,6 +119,7 @@ struct AngularCorrelationsInJets { Configurable fAntinucleiTOFnsigYield{"antinucleiTOFnsigmaHighPtYield", 4.0, "[antinuclei] min TOF nsigma with high pT for yield"}; Configurable fAntinucleiTOFnsigCF{"antinucleiTOFnsigmaHighPtCF", 4.0, "[antinuclei] max TOF nsigma for CF"}; Configurable fDeuteronAnalysis{"deuteronAnalysis", true, "true [false]: analyse (anti)deuterons [(anti)helium-3]"}; + Configurable fUseTOFMass{"useTOFmass", true, "use TOF mass instead of pion mass if available"}; Configurable fBufferSize{"trackBufferSize", 2000, "Number of mixed-event tracks being stored"}; @@ -181,8 +179,7 @@ struct AngularCorrelationsInJets { registryData.add("hPtJetAntiproton", "p_{T} of antiprotons", HistType::kTH1D, {axisSpecs.ptAxisPos}); registryData.add("hPtJetNuclei", "p_{T} of nuclei", HistType::kTH1D, {axisSpecs.ptAxisPos}); registryData.add("hPtJetAntinuclei", "p_{T} of antinuclei", HistType::kTH1D, {axisSpecs.ptAxisPos}); - registryData.add("hPtTotalJet", "p_{T} of entire jet;#it{p}_{T} [GeV/#it{c}]", HistType::kTH1F, {{2000, 0, 500}}); - registryData.add("hPtDiff", "p_{T} difference PseudoJet/original track;#it{p}_{T} [GeV/#it{c}]", HistType::kTH1D, {{100, -5, 5}}); + registryData.add("hPtTotalJet", "p_{T} of entire jet;#it{p}_{T} [GeV/#it{c}]", HistType::kTH1F, {{1000, 0, 500}}); registryQA.add("hPtJetProton_15", "Proton p_{T} for jet p_{T} < 15 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); registryQA.add("hPtJetProton_20", "Proton p_{T} for jet p_{T} < 20 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); registryQA.add("hPtJetProton_30", "Proton p_{T} for jet p_{T} < 30 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); @@ -201,12 +198,24 @@ struct AngularCorrelationsInJets { registryQA.add("hPtJetAntinuclei_50", "Antinuclei p_{T} for jet p_{T} < 50 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); // nSigma - registryData.add("hTPCsignal", "TPC signal", HistType::kTH2F, {{1000, 0, 100, "#it{p} [GeV/#it{c}]"}, {5000, 0, 5000, "d#it{E}/d#it{X} (a.u.)"}}); - registryData.add("hTOFsignal", "TOF signal", HistType::kTH2F, {{1000, 0, 100, "#it{p} [GeV/#it{c}]"}, {550, 0, 1.1, "#beta (TOF)"}}); - registryData.add("hTPCnsigmaProton", "TPC n#sigma for (anti)proton", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); - registryData.add("hTOFnsigmaProton", "TOF n#sigma for (anti)proton", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); - registryData.add("hTPCnsigmaNuclei", "TPC n#sigma for (anti)nuclei", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); - registryData.add("hTOFnsigmaNuclei", "TOF n#sigma for (anti)nuclei", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCsignal", "TPC signal", HistType::kTH2F, {{1000, -100, 100, "#it{p} [GeV/#it{c}]"}, {5000, 0, 5000, "d#it{E}/d#it{X} (a.u.)"}}); + registryData.add("hTOFsignal", "TOF signal", HistType::kTH2F, {{1000, -100, 100, "#it{p} [GeV/#it{c}]"}, {550, 0, 1.1, "#beta (TOF)"}}); + registryData.add("hTPCnsigmaProton", "TPC n#sigma for proton", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFnsigmaProton", "TOF n#sigma for proton", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCnsigmaAntiproton", "TPC n#sigma for antiproton", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFnsigmaAntiproton", "TOF n#sigma for antiproton", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCnsigmaNuclei", "TPC n#sigma for nuclei", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFnsigmaNuclei", "TOF n#sigma for nuclei", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCnsigmaAntinuclei", "TPC n#sigma for antinuclei", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFnsigmaAntinuclei", "TOF n#sigma for antinuclei", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCnsigmaProtonCF", "TPC n#sigma for proton CF", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFnsigmaProtonCF", "TOF n#sigma for proton CF", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCnsigmaAntiprotonCF", "TPC n#sigma for antiproton CF", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFnsigmaAntiprotonCF", "TOF n#sigma for antiproton CF", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCnsigmaNucleiCF", "TPC n#sigma for nuclei CF", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFnsigmaNucleiCF", "TOF n#sigma for nuclei CF", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCnsigmaAntinucleiCF", "TPC n#sigma for antinuclei CF", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFnsigmaAntinucleiCF", "TOF n#sigma for antinuclei CF", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); // DCA registryData.add("hDCAxyFullJet", "DCA_{xy} of full jet", HistType::kTH2F, {axisSpecs.ptAxisFull, axisSpecs.dcaxyAxis}); @@ -252,6 +261,7 @@ struct AngularCorrelationsInJets { registryData.add("hDeltaPhiEtaMEAntinuclei", "#Delta#varphi vs #Delta#eta of antinuclei in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); // QA + registryQA.add("hPtDiff", "p_{T} difference PseudoJet/original track;#it{p}_{T} [GeV/#it{c}]", HistType::kTH1D, {{100, -5, 5}}); registryQA.add("hJetConeRadius", "Jet Radius;#it{R}", HistType::kTH1F, {{100, 0, 1}}); registryQA.add("hMaxRadiusVsPt", "Max Cone Radius vs p_{T}", HistType::kTH2F, {{axisSpecs.ptAxisPos}, {100, 0, 1}}); registryQA.add("hRhoEstimatePerp", "Background #rho (perp)", HistType::kTH2F, {{axisSpecs.ptAxisPos}, {200, 0, 20}}); @@ -260,7 +270,7 @@ struct AngularCorrelationsInJets { registryQA.add("hRhoMEstimateArea", "Background #rho_{m} (area)", HistType::kTH2F, {{axisSpecs.ptAxisPos}, {200, 0, 20}}); registryQA.add("hJetBkgDeltaPt", "#Delta p_{T} Clustered Cone - Pure Jet", HistType::kTH1F, {{200, 0, 10}}); - registryQA.add("hTOFmass", "TOF mass", HistType::kTH2F, {axisSpecs.ptAxisPos, {1000, 0, 5, "#it{m} [GeV/#it{c}^{2}]"}}); + registryQA.add("hTOFmass", "TOF mass vs p_{T}", HistType::kTH2F, {axisSpecs.ptAxisPos, {1000, 0, 5, "#it{m} [GeV/#it{c}^{2}]"}}); registryQA.get(HIST("hTOFmass"))->Sumw2(); registryQA.add("hPtFullEvent", "p_{T} after basic cuts", HistType::kTH1F, {axisSpecs.ptAxisPos}); registryQA.add("hCrossedRowsTPC", "Crossed rows TPC", HistType::kTH2I, {axisSpecs.ptAxisPos, {135, 65, 200}}); @@ -330,37 +340,49 @@ struct AngularCorrelationsInJets { return false; if (tightCuts) { // for correlation function + // DCA + if (TMath::Abs(track.dcaXY()) > fProtonDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fProtonDCAzCF) + return false; + + registryData.fill(HIST("hTPCnsigmaProtonCF"), track.pt(), track.tpcNSigmaPr()); + // TPC if (track.pt() < fProtonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fProtonTPCnsigLowCF) return false; if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fProtonTPCnsigHighCF) return false; + registryData.fill(HIST("hTOFnsigmaProtonCF"), track.pt(), track.tofNSigmaPr()); + + // TOF + if (track.hasTOF()) { + if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fProtonTOFnsigCF) + return false; + } + } else { // for yields // DCA - if (TMath::Abs(track.dcaXY()) > fProtonDCAxyCF) + if (TMath::Abs(track.dcaXY()) > fProtonDCAxyYield) return false; - if (TMath::Abs(track.dcaZ()) > fProtonDCAzCF) + if (TMath::Abs(track.dcaZ()) > fProtonDCAzYield) return false; - // TOF - if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fProtonTOFnsigCF) - return false; - } else { // for yields + registryData.fill(HIST("hTPCnsigmaProton"), track.pt(), track.tpcNSigmaPr()); + // TPC if (track.pt() < fProtonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fProtonTPCnsigLowYield) return false; if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fProtonTPCnsigHighYield) return false; - // DCA - if (TMath::Abs(track.dcaXY()) > fProtonDCAxyYield) - return false; - if (TMath::Abs(track.dcaZ()) > fProtonDCAzYield) - return false; + registryData.fill(HIST("hTOFnsigmaProton"), track.pt(), track.tofNSigmaPr()); // TOF - if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fProtonTOFnsigYield) - return false; + if (track.hasTOF()) { + if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fProtonTOFnsigYield) + return false; + } } return true; @@ -373,37 +395,49 @@ struct AngularCorrelationsInJets { return false; if (tightCuts) { // for correlation function + // DCA + if (TMath::Abs(track.dcaXY()) > fAntiprotonDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fAntiprotonDCAzCF) + return false; + + registryData.fill(HIST("hTPCnsigmaAntiprotonCF"), track.pt(), track.tpcNSigmaPr()); + // TPC if (track.pt() < fAntiprotonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fAntiprotonTPCnsigLowCF) return false; if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fAntiprotonTPCnsigHighCF) return false; + registryData.fill(HIST("hTOFnsigmaAntiprotonCF"), track.pt(), track.tofNSigmaPr()); + + // TOF + if (track.hasTOF()) { + if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fAntiprotonTOFnsigCF) + return false; + } + } else { // for yields // DCA - if (TMath::Abs(track.dcaXY()) > fAntiprotonDCAxyCF) + if (TMath::Abs(track.dcaXY()) > fAntiprotonDCAxyYield) return false; - if (TMath::Abs(track.dcaZ()) > fAntiprotonDCAzCF) + if (TMath::Abs(track.dcaZ()) > fAntiprotonDCAzYield) return false; - // TOF - if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fAntiprotonTOFnsigCF) - return false; - } else { // for yields + registryData.fill(HIST("hTPCnsigmaAntiproton"), track.pt(), track.tpcNSigmaPr()); + // TPC if (track.pt() < fAntiprotonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fAntiprotonTPCnsigLowYield) return false; if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fAntiprotonTPCnsigHighYield) return false; - // DCA - if (TMath::Abs(track.dcaXY()) > fAntiprotonDCAxyYield) - return false; - if (TMath::Abs(track.dcaZ()) > fAntiprotonDCAzYield) - return false; + registryData.fill(HIST("hTOFnsigmaAntiproton"), track.pt(), track.tofNSigmaPr()); // TOF - if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fAntiprotonTOFnsigYield) - return false; + if (track.hasTOF()) { + if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fAntiprotonTOFnsigYield) + return false; + } } return true; @@ -416,71 +450,95 @@ struct AngularCorrelationsInJets { return false; if (fDeuteronAnalysis) { if (tightCuts) { // for correlation function + // DCA + if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fNucleiDCAzCF) + return false; + + registryData.fill(HIST("hTPCnsigmaNucleiCF"), track.pt(), track.tpcNSigmaDe()); + // TPC if (track.pt() < fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fNucleiTPCnsigLowCF) return false; if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fNucleiTPCnsigHighCF) return false; + registryData.fill(HIST("hTOFnsigmaNucleiCF"), track.pt(), track.tofNSigmaDe()); + + // TOF + if (track.hasTOF()) { + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fNucleiTOFnsigCF) + return false; + } + } else { // for yields // DCA - if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyCF) + if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyYield) return false; - if (TMath::Abs(track.dcaZ()) > fNucleiDCAzCF) + if (TMath::Abs(track.dcaZ()) > fNucleiDCAzYield) return false; - // TOF - if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fNucleiTOFnsigCF) - return false; - } else { // for yields + registryData.fill(HIST("hTPCnsigmaNuclei"), track.pt(), track.tpcNSigmaDe()); + // TPC if (track.pt() < fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fNucleiTPCnsigLowYield) return false; if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fNucleiTPCnsigHighYield) return false; - // DCA - if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyYield) - return false; - if (TMath::Abs(track.dcaZ()) > fNucleiDCAzYield) - return false; + registryData.fill(HIST("hTOFnsigmaNuclei"), track.pt(), track.tofNSigmaDe()); // TOF - if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fNucleiTOFnsigYield) - return false; + if (track.hasTOF()) { + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fNucleiTOFnsigYield) + return false; + } } } else { if (tightCuts) { // for correlation function - including for helium just in case, but realistically, angular correlations won't be a thing here + // DCA + if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fNucleiDCAzCF) + return false; + + registryData.fill(HIST("hTPCnsigmaNucleiCF"), track.pt(), track.tpcNSigmaHe()); + // TPC if (track.pt() < fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fNucleiTPCnsigLowCF) return false; if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fNucleiTPCnsigHighCF) return false; + registryData.fill(HIST("hTOFnsigmaNucleiCF"), track.pt(), track.tofNSigmaHe()); + + // TOF + if (track.hasTOF()) { + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fNucleiTOFnsigCF) + return false; + } + } else { // for yields // DCA - if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyCF) + if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyYield) return false; - if (TMath::Abs(track.dcaZ()) > fNucleiDCAzCF) + if (TMath::Abs(track.dcaZ()) > fNucleiDCAzYield) return false; - // TOF - if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fNucleiTOFnsigCF) - return false; - } else { // for yields + registryData.fill(HIST("hTPCnsigmaNuclei"), track.pt(), track.tpcNSigmaHe()); + // TPC if (track.pt() < fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fNucleiTPCnsigLowYield) return false; if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fNucleiTPCnsigHighYield) return false; - // DCA - if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyYield) - return false; - if (TMath::Abs(track.dcaZ()) > fNucleiDCAzYield) - return false; + registryData.fill(HIST("hTOFnsigmaNuclei"), track.pt(), track.tofNSigmaHe()); // TOF - if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fNucleiTOFnsigYield) - return false; + if (track.hasTOF()) { + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fNucleiTOFnsigYield) + return false; + } } } @@ -495,33 +553,41 @@ struct AngularCorrelationsInJets { if (fDeuteronAnalysis) { if (tightCuts) { // for correlation function + // DCA + if (TMath::Abs(track.dcaXY()) > fAntinucleiDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fAntinucleiDCAzCF) + return false; + + registryData.fill(HIST("hTPCnsigmaAntinucleiCF"), track.pt(), track.tpcNSigmaDe()); + // TPC if (track.pt() < fAntinucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fAntinucleiTPCnsigLowCF) return false; if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fAntinucleiTPCnsigHighCF) return false; - // DCA - if (TMath::Abs(track.dcaXY()) > fAntinucleiDCAxyCF) - return false; - if (TMath::Abs(track.dcaZ()) > fAntinucleiDCAzCF) - return false; + registryData.fill(HIST("hTOFnsigmaAntinucleiCF"), track.pt(), track.tofNSigmaDe()); // TOF if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fAntinucleiTOFnsigCF) return false; } else { // for yields + // DCA + if (TMath::Abs(track.dcaXY()) > fAntinucleiDCAxyYield) + return false; + if (TMath::Abs(track.dcaZ()) > fAntinucleiDCAzYield) + return false; + + registryData.fill(HIST("hTPCnsigmaAntinuclei"), track.pt(), track.tpcNSigmaDe()); + // TPC if (track.pt() < fAntinucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fAntinucleiTPCnsigLowYield) return false; if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fAntinucleiTPCnsigHighYield) return false; - // DCA - if (TMath::Abs(track.dcaXY()) > fAntinucleiDCAxyYield) - return false; - if (TMath::Abs(track.dcaZ()) > fAntinucleiDCAzYield) - return false; + registryData.fill(HIST("hTOFnsigmaAntinuclei"), track.pt(), track.tofNSigmaDe()); // TOF if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fAntinucleiTOFnsigYield) @@ -529,33 +595,41 @@ struct AngularCorrelationsInJets { } } else { if (tightCuts) { // for correlation function - including for antihelium just in case, but realistically, angular correlations won't be a thing here + // DCA + if (TMath::Abs(track.dcaXY()) > fAntinucleiDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fAntinucleiDCAzCF) + return false; + + registryData.fill(HIST("hTPCnsigmaAntinucleiCF"), track.pt(), track.tpcNSigmaHe()); + // TPC if (track.pt() < fAntinucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fAntinucleiTPCnsigLowCF) return false; if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fAntinucleiTPCnsigHighCF) return false; - // DCA - if (TMath::Abs(track.dcaXY()) > fAntinucleiDCAxyCF) - return false; - if (TMath::Abs(track.dcaZ()) > fAntinucleiDCAzCF) - return false; + registryData.fill(HIST("hTOFnsigmaAntinucleiCF"), track.pt(), track.tofNSigmaHe()); // TOF if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fAntinucleiTOFnsigCF) return false; } else { // for yields + // DCA + if (TMath::Abs(track.dcaXY()) > fAntinucleiDCAxyYield) + return false; + if (TMath::Abs(track.dcaZ()) > fAntinucleiDCAzYield) + return false; + + registryData.fill(HIST("hTPCnsigmaAntinuclei"), track.pt(), track.tpcNSigmaHe()); + // TPC if (track.pt() < fAntinucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fAntinucleiTPCnsigLowYield) return false; if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fAntinucleiTPCnsigHighYield) return false; - // DCA - if (TMath::Abs(track.dcaXY()) > fAntinucleiDCAxyYield) - return false; - if (TMath::Abs(track.dcaZ()) > fAntinucleiDCAzYield) - return false; + registryData.fill(HIST("hTOFnsigmaAntinuclei"), track.pt(), track.tofNSigmaHe()); // TOF if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fAntinucleiTOFnsigYield) @@ -759,13 +833,13 @@ struct AngularCorrelationsInJets { return jetCounter; fastjet::PseudoJet subtractedJetPerp(0., 0., 0., 0.); subtractedJetPerp = bkgSub.doRhoAreaSub(jet, rhoPerp, rhoMPerp); - registryData.fill(HIST("hPtTotalSubJetPerp"), subtractedJetPerp.pt()); fastjet::PseudoJet subtractedJetArea(0., 0., 0., 0.); subtractedJetArea = bkgSub.doRhoAreaSub(jet, rho, rhoM); - registryData.fill(HIST("hPtTotalSubJetArea"), subtractedJetArea.pt()); if (subtractedJetPerp.pt() < fMinJetPt) // cut on jet w/o bkg return jetCounter; + registryData.fill(HIST("hPtTotalSubJetPerp"), subtractedJetPerp.pt()); + registryData.fill(HIST("hPtTotalSubJetArea"), subtractedJetArea.pt()); registryQA.fill(HIST("hRhoEstimateArea"), jet.pt(), rho); registryQA.fill(HIST("hRhoMEstimateArea"), jet.pt(), rhoM); registryQA.fill(HIST("hRhoEstimatePerp"), jet.pt(), rhoPerp); @@ -794,6 +868,8 @@ struct AngularCorrelationsInJets { if (std::isnan(constituent.phi()) || std::isnan(jet.phi())) // geometric jet cone continue; double DeltaPhi = TVector2::Phi_0_2pi(constituent.phi() - jet.phi()); + if (DeltaPhi > TMath::Pi()) + DeltaPhi = DeltaPhi - 2 * TMath::Pi(); double DeltaEta = constituent.eta() - jet.eta(); double Delta = TMath::Sqrt(DeltaPhi * DeltaPhi + DeltaEta * DeltaEta); registryQA.fill(HIST("hJetConeRadius"), Delta); @@ -892,11 +968,11 @@ struct AngularCorrelationsInJets { registryData.fill(HIST("hDCAxyFullJet"), jetParticle.pt() * jetParticle.sign(), jetParticle.dcaXY()); registryData.fill(HIST("hDCAzFullJet"), jetParticle.pt() * jetParticle.sign(), jetParticle.dcaZ()); registryData.fill(HIST("hTPCsignal"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcSignal()); - if (jetParticle.hasTOF()) + if (jetParticle.hasTOF()) { registryData.fill(HIST("hTOFsignal"), jetParticle.pt() * jetParticle.sign(), jetParticle.beta()); - + } double ptDiff = pseudoParticle.pt() - jetParticle.pt(); - registryData.fill(HIST("hPtDiff"), ptDiff); + registryQA.fill(HIST("hPtDiff"), ptDiff); if (jetParticle.pt() < fMinJetParticlePt) continue; @@ -911,9 +987,8 @@ struct AngularCorrelationsInJets { } else if (subtractedJetPerp.pt() < 50) { registryQA.fill(HIST("hPtJetProton_50"), jetParticle.pt()); } - registryData.fill(HIST("hTPCnsigmaProton"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaPr()); if (jetParticle.hasTOF()) - registryData.fill(HIST("hTOFnsigmaProton"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaPr()); + registryData.fill(HIST("hTOFnsigmaProton"), jetParticle.pt(), jetParticle.tofNSigmaPr()); registryData.fill(HIST("hTrackProtocol"), 4); // # protons if (isProton(jetParticle, true)) { registryData.fill(HIST("hTrackProtocol"), 5); // # high purity protons @@ -931,9 +1006,9 @@ struct AngularCorrelationsInJets { } else if (subtractedJetPerp.pt() < 50) { registryQA.fill(HIST("hPtJetAntiproton_50"), jetParticle.pt()); } - registryData.fill(HIST("hTPCnsigmaProton"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaPr()); + registryData.fill(HIST("hTPCnsigmaAntiproton"), jetParticle.pt(), jetParticle.tpcNSigmaPr()); if (jetParticle.hasTOF()) - registryData.fill(HIST("hTOFnsigmaProton"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaPr()); + registryData.fill(HIST("hTOFnsigmaAntiproton"), jetParticle.pt(), jetParticle.tofNSigmaPr()); registryData.fill(HIST("hTrackProtocol"), 6); // # antiprotons if (isAntiproton(jetParticle, true)) { registryData.fill(HIST("hTrackProtocol"), 7); // # high purity antiprotons @@ -952,15 +1027,15 @@ struct AngularCorrelationsInJets { registryQA.fill(HIST("hPtJetNuclei_50"), jetParticle.pt()); } if (fDeuteronAnalysis) { - registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaDe()); + registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt(), jetParticle.tpcNSigmaDe()); } else { - registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaHe()); + registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt(), jetParticle.tpcNSigmaHe()); } if (jetParticle.hasTOF()) { if (fDeuteronAnalysis) { - registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaDe()); + registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt(), jetParticle.tofNSigmaDe()); } else { - registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaHe()); + registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt(), jetParticle.tofNSigmaHe()); } } registryData.fill(HIST("hTrackProtocol"), 8); // # nuclei @@ -981,15 +1056,15 @@ struct AngularCorrelationsInJets { registryQA.fill(HIST("hPtJetAntinuclei_50"), jetParticle.pt()); } if (fDeuteronAnalysis) { - registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaDe()); + registryData.fill(HIST("hTPCnsigmaAntinuclei"), jetParticle.pt(), jetParticle.tpcNSigmaDe()); } else { - registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaHe()); + registryData.fill(HIST("hTPCnsigmaAntinuclei"), jetParticle.pt(), jetParticle.tpcNSigmaHe()); } if (jetParticle.hasTOF()) { if (fDeuteronAnalysis) { - registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaDe()); + registryData.fill(HIST("hTOFnsigmaAntinuclei"), jetParticle.pt(), jetParticle.tofNSigmaDe()); } else { - registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaHe()); + registryData.fill(HIST("hTOFnsigmaAntinuclei"), jetParticle.pt(), jetParticle.tofNSigmaHe()); } } registryData.fill(HIST("hTrackProtocol"), 10); // # antinuclei @@ -1056,15 +1131,18 @@ struct AngularCorrelationsInJets { continue; double mass; - if (track.hasTOF()) { - mass = track.mass(); // check reliability, maybe use only pion mass - registryQA.fill(HIST("hTOFmass"), track.pt(), track.mass()); - registryData.fill(HIST("hTrackProtocol"), 1); + if (fUseTOFMass) { + if (track.hasTOF()) { + mass = track.mass(); // check reliability, maybe use only pion mass + registryQA.fill(HIST("hTOFmass"), track.pt(), track.mass()); + registryData.fill(HIST("hTrackProtocol"), 1); + } else { + mass = 0.139; // pion mass as default, ~80% are pions + registryData.fill(HIST("hTrackProtocol"), 2); + } } else { - mass = 0.139; // pion mass as default, ~80% are pions - registryData.fill(HIST("hTrackProtocol"), 2); + mass = 0.139; } - // double mass = 0.139; // if (track.pt() > fMinLeadingPt) { // leadingID = track.globalIndex(); @@ -1124,7 +1202,7 @@ struct AngularCorrelationsInJets { } registryData.fill(HIST("hNumJetsInEvent"), jetCounter); - TVector3 hardestJetAxis(jets.at(0).px(), jets.at(0).py(), jets.at(0).pz()); + TVector3 hardestJetAxis(jets.at(0).px(), jets.at(0).py(), jets.at(0).pz()); // for full event, use hardest jet as orientation doCorrelations(particlesForCF, fBufferFull, fTempBufferFull, -1, hardestJetAxis); setTrackBuffer(fTempBufferFull, fBufferFull); } @@ -1138,9 +1216,9 @@ struct AngularCorrelationsInJets { initCCDB(bc); registryData.fill(HIST("hEventProtocol"), 0); - registryData.fill(HIST("hNumberOfEvents"), 0); if (!collision.alias_bit(kINT7)) continue; + registryData.fill(HIST("hNumberOfEvents"), 0); registryData.fill(HIST("hEventProtocol"), 1); auto slicedTracks = tracks.sliceBy(perCollisionFullTracksRun2, collision.globalIndex()); diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 620e0f6a54a..afc9891eb3e 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -144,9 +144,14 @@ o2physics_add_dpl_workflow(ebye-mult PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(he3-from-hypertriton-map + SOURCES he3FromHypertritonMap.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + if(FastJet_FOUND) o2physics_add_dpl_workflow(angular-correlations-in-jets SOURCES AngularCorrelationsInJets.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib COMPONENT_NAME Analysis) -endif() +endif() \ No newline at end of file diff --git a/PWGLF/Tasks/Nuspex/NucleiHistTask.cxx b/PWGLF/Tasks/Nuspex/NucleiHistTask.cxx index 8d55234b567..c7136664631 100644 --- a/PWGLF/Tasks/Nuspex/NucleiHistTask.cxx +++ b/PWGLF/Tasks/Nuspex/NucleiHistTask.cxx @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include "ReconstructionDataFormats/Track.h" #include "Framework/runDataProcessing.h" @@ -24,6 +26,7 @@ #include "Framework/ASoAHelpers.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Centrality.h" @@ -38,6 +41,8 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +std::vector ptBinning = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4., 5., 6., 8., 10., 12., 14.}; + struct NucleiHistTask { // Data @@ -54,10 +59,15 @@ struct NucleiHistTask { HistogramRegistry aHelium3_reg{"aHelium3", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry Helium4_reg{"Helium4", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry aHelium4_reg{"aHelium4", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + OutputObj histTrackcuts_data{TH1I("histTrackcuts_data", "Entires;Track cut", 18, 0, 18)}; // MC HistogramRegistry MC_recon_reg{"MC_particles_reco", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - OutputObj histPDG{TH1F("PDG", "PDG;PDG code", 20, 0.0, 20.0)}; + HistogramRegistry MC_gen_reg{"MC_particles_gen", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry MC_DCA{"MC_DCA", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + OutputObj histPDG_reco{TH1I("PDG reconstructed", "PDG;PDG code", 18, 0.0, 18)}; + OutputObj histPDG_gen{TH1I("PDG generated", "PDG;PDG code", 18, 0.0, 18)}; + OutputObj histTrackcuts_MC{TH1I("histTrackcuts_MC", "Entires;Track cut", 18, 0, 18)}; void init(o2::framework::InitContext&) { @@ -66,20 +76,71 @@ struct NucleiHistTask { LOG(fatal) << "Can't enable processData and processDataCent in the same time, pick one!"; } + // +++++++++++++++++++++ Data ++++++++++++++++++++++++ + histTrackcuts_data->GetXaxis()->SetBinLabel(1, "Events read"); + histTrackcuts_data->GetXaxis()->SetBinLabel(2, "Ev. sel. passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(3, "Rap. cut passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(4, "DCA cut passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(5, "TPCnCls cut passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(6, "TPCCrossedRowsOverFindable cut passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(7, "Chi2 cut passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(8, "Passed TPC refit cut"); + histTrackcuts_data->GetXaxis()->SetBinLabel(9, "Passed ITS refit cut"); + histTrackcuts_data->GetXaxis()->SetBinLabel(10, "ITSnCls cut passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(11, "Momentum cut passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(12, "hasITS & hasTPC cut passed"); + histTrackcuts_data->GetXaxis()->SetBinLabel(13, "GoldenChi2 cut passed"); + + // +++++++++++++++++++++ MC ++++++++++++++++++++++++ + histPDG_reco->GetXaxis()->SetBinLabel(1, "#pi^{+}"); + histPDG_reco->GetXaxis()->SetBinLabel(2, "#pi^{-}"); + histPDG_reco->GetXaxis()->SetBinLabel(3, "K^{+}"); + histPDG_reco->GetXaxis()->SetBinLabel(4, "K^{-}"); + histPDG_reco->GetXaxis()->SetBinLabel(5, "p"); + histPDG_reco->GetXaxis()->SetBinLabel(6, "#bar{p}"); + histPDG_reco->GetXaxis()->SetBinLabel(7, "d"); + histPDG_reco->GetXaxis()->SetBinLabel(8, "#bar{d}"); + histPDG_reco->GetXaxis()->SetBinLabel(9, "t"); + histPDG_reco->GetXaxis()->SetBinLabel(10, "#bar{t}"); + histPDG_reco->GetXaxis()->SetBinLabel(11, "^{3}He"); + histPDG_reco->GetXaxis()->SetBinLabel(12, "^{3}#bar{He}"); + histPDG_reco->GetXaxis()->SetBinLabel(13, "^{4}He"); + histPDG_reco->GetXaxis()->SetBinLabel(14, "^{4}#bar{He}"); + histPDG_gen->GetXaxis()->SetBinLabel(1, "#pi^{+}"); + histPDG_gen->GetXaxis()->SetBinLabel(2, "#pi^{-}"); + histPDG_gen->GetXaxis()->SetBinLabel(3, "K^{+}"); + histPDG_gen->GetXaxis()->SetBinLabel(4, "K^{-}"); + histPDG_gen->GetXaxis()->SetBinLabel(5, "p"); + histPDG_gen->GetXaxis()->SetBinLabel(6, "#bar{p}"); + histPDG_gen->GetXaxis()->SetBinLabel(7, "d"); + histPDG_gen->GetXaxis()->SetBinLabel(8, "#bar{d}"); + histPDG_gen->GetXaxis()->SetBinLabel(9, "t"); + histPDG_gen->GetXaxis()->SetBinLabel(10, "#bar{t}"); + histPDG_gen->GetXaxis()->SetBinLabel(11, "^{3}He"); + histPDG_gen->GetXaxis()->SetBinLabel(12, "^{3}#bar{He}"); + histPDG_gen->GetXaxis()->SetBinLabel(13, "^{4}He"); + histPDG_gen->GetXaxis()->SetBinLabel(14, "^{4}#bar{He}"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(1, "Events read"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(2, "Prim. particle. sel. passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(3, "Rap. cut passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(4, "DCA cut passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(5, "TPCnCls cut passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(6, "TPCCrossedRowsOverFindable cut passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(7, "Chi2 cut passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(8, "Passed TPC refit cut"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(9, "Passed ITS refit cut"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(10, "ITSnCls cut passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(11, "Momentum cut passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(12, "hasITS & hasTPC cut passed"); + histTrackcuts_MC->GetXaxis()->SetBinLabel(13, "GoldenChi2 cut passed"); + std::vector ptBinning = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4., 5., 6., 8., 10., 12., 14.}; - std::vector ptBinning_short = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4}; - std::vector ptBinning_diff = {-14.0, -12.0, -10.0, -8.0, -6.0, -5.0, -4.0, -3.6, -3.2, -2.8, -2.4, -2.2, -2.0, -1.8, -1.6, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4., 5., 6., 8., 10., 12., 14.}; - std::vector centBinning = {0., 1., 5., 10., 20., 30., 40., 50., 70., 100.}; std::vector etaBinning = {-1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; std::vector PDGBinning = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec ptAxis_reduced = {ptBinning_short, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec pAxis = {ptBinning, "#it{p} (GeV/#it{c})"}; - AxisSpec pAxis_reduced = {ptBinning_short, "#it{p} (GeV/#it{c})"}; - AxisSpec centAxis = {centBinning, "V0M (%)"}; - AxisSpec centralityAxis = {100, 0.0, 100.0, "VT0C (%)"}; - AxisSpec centralityAxis_extended = {105, 0.0, 105.0, "VT0C (%)"}; + AxisSpec centralityAxis = {100, 0.0, 105.0, "VT0C (%)"}; AxisSpec etaAxis = {etaBinning, "#eta"}; AxisSpec PDGBINNING = {PDGBinning, "PDG code"}; @@ -87,40 +148,31 @@ struct NucleiHistTask { // QA histograms spectra_reg.add("histRecVtxZData", "collision z position", HistType::kTH1F, {{200, -20., +20., "z position (cm)"}}); - spectra_reg.add("histTpcSignalData", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - spectra_reg.add("histTofSignalData", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - spectra_reg.add("histTpcSignalData_pT", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - spectra_reg.add("histTofSignalData_pT", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); + spectra_reg.add("histTpcSignalData", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p*} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); + spectra_reg.add("histTofSignalData", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p*} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); spectra_reg.add("histDcaVsPtData_particle", "dcaXY vs Pt (particle)", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); spectra_reg.add("histDcaZVsPtData_particle", "dcaZ vs Pt (particle)", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); spectra_reg.add("histDcaVsPtData_antiparticle", "dcaXY vs Pt (antiparticle)", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); spectra_reg.add("histDcaZVsPtData_antiparticle", "dcaZ vs Pt (antiparticle)", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); spectra_reg.add("histTOFm2", "TOF m^2 vs P", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - spectra_reg.add("histTOFm2_pT", "TOF m^2 vs Pt", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); spectra_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); spectra_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); spectra_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); spectra_reg.add("histChi2TPC", "chi^2 TPC vs Pt", HistType::kTH2F, {ptAxis, {100, 0.0, 5.0, "chi^2"}}); spectra_reg.add("histChi2ITS", "chi^2 ITS vs Pt", HistType::kTH2F, {ptAxis, {500, 0.0, 50.0, "chi^2"}}); - spectra_reg.add("histCentrality", "Centrality", HistType::kTH1F, {centralityAxis_extended}); + spectra_reg.add("histCentrality", "Centrality", HistType::kTH1F, {centralityAxis}); spectra_reg.add("histEtaWithOverFlow", "Pseudorapidity 0 - 105%% centrality", HistType::kTH1F, {etaAxis}); spectra_reg.add("histEta", "Pseudorapidity with centrality cut", HistType::kTH1F, {etaAxis}); - spectra_reg.add("histEta_cent", "Pseudorapidity vs Centrality", HistType::kTH2F, {centralityAxis_extended, etaAxis}); + spectra_reg.add("histEta_cent", "Pseudorapidity vs Centrality", HistType::kTH2F, {centralityAxis, etaAxis}); // histograms for pi⁺ - pion_reg.add("histKeepEventData", "skimming histogram (#pi^{+})", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); pion_reg.add("histTpcSignalData", "Specific energy loss (#pi^{+})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); pion_reg.add("histTofSignalData", "TOF signal (#pi^{+})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - pion_reg.add("histTpcSignalData_pT", "Specific energy loss (#pi^{+})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - pion_reg.add("histTofSignalData_pT", "TOF signal (#pi^{+})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); pion_reg.add("histDcaVsPtData", "dcaXY vs Pt (#pi^{+})", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); pion_reg.add("histDcaZVsPtData", "dcaZ vs Pt (#pi^{+})", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); pion_reg.add("histTOFm2", "TOF m^2 vs Pt (#pi^{+})", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - pion_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (#pi^{+})", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); pion_reg.add("histTpcNsigmaData", "n-sigma TPC (#pi^{+})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); pion_reg.add("histTofNsigmaData", "n-sigma TOF (#pi^{+})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); - pion_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (#pi^{+})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); - pion_reg.add("histTofNsigmaData_pT", "n-sigma TOF (#pi^{+})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); pion_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (#pi^{+})", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); pion_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (#pi^{+})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); pion_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (#pi^{+})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -134,19 +186,13 @@ struct NucleiHistTask { pion_reg.add("histTofm2_eta", "mass^2 TOF (#pi^{+}) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{#pi^{+}}"}, etaAxis}); // histograms for pi⁻ - apion_reg.add("histKeepEventData", "skimming histogram (#pi^{-})", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); apion_reg.add("histTpcSignalData", "Specific energy loss (#pi^{-})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); apion_reg.add("histTofSignalData", "TOF signal (#pi^{-})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - apion_reg.add("histTpcSignalData_pT", "Specific energy loss (#pi^{-})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - apion_reg.add("histTofSignalData_pT", "TOF signal (#pi^{-})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); apion_reg.add("histDcaVsPtData", "dcaXY vs Pt (#pi^{-})", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); apion_reg.add("histDcaZVsPtData", "dcaZ vs Pt (#pi^{-})", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); apion_reg.add("histTOFm2", "TOF m^2 vs Pt (#pi^{-})", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - apion_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (#pi^{-})", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); apion_reg.add("histTpcNsigmaData", "n-sigma TPC (#pi^{-})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); apion_reg.add("histTofNsigmaData", "n-sigma TOF (#pi^{-})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); - apion_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (#pi^{-})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); - apion_reg.add("histTofNsigmaData_pT", "n-sigma TOF (#pi^{-})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); apion_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (#pi^{-})", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); apion_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (#pi^{-})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); apion_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (#pi^{-})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -160,19 +206,13 @@ struct NucleiHistTask { apion_reg.add("histTofm2_eta", "mass^2 TOF (#pi^{-}) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{#pi^{+}}"}, etaAxis}); // histograms for Proton - proton_reg.add("histKeepEventData", "skimming histogram (p)", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); proton_reg.add("histTpcSignalData", "Specific energy loss (p)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); proton_reg.add("histTofSignalData", "TOF signal (p)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - proton_reg.add("histTpcSignalData_pT", "Specific energy loss (p)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - proton_reg.add("histTofSignalData_pT", "TOF signal (p)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); proton_reg.add("histDcaVsPtData", "dcaXY vs Pt (p)", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); proton_reg.add("histDcaZVsPtData", "dcaZ vs Pt (p)", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); proton_reg.add("histTOFm2", "TOF m^2 vs Pt (p)", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - proton_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (p)", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); proton_reg.add("histTpcNsigmaData", "n-sigma TPC (p)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{p}"}}); proton_reg.add("histTofNsigmaData", "n-sigma TOF (p)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{p}"}}); - proton_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (p)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{p}"}}); - proton_reg.add("histTofNsigmaData_pT", "n-sigma TOF (p)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{p}"}}); proton_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (p)", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); proton_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (p)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); proton_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (p)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -186,19 +226,13 @@ struct NucleiHistTask { proton_reg.add("histTofm2_eta", "mass^2 TOF (p) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{p}"}, etaAxis}); // histograms for antiProton - aproton_reg.add("histKeepEventData", "skimming histogram (#bar{p})", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); aproton_reg.add("histTpcSignalData", "Specific energy loss (#bar{p})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); aproton_reg.add("histTofSignalData", "TOF signal (#bar{p})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - aproton_reg.add("histTpcSignalData_pT", "Specific energy loss (#bar{p})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - aproton_reg.add("histTofSignalData_pT", "TOF signal (#bar{p})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); aproton_reg.add("histDcaVsPtData", "dcaXY vs Pt (#bar{p})", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); aproton_reg.add("histDcaZVsPtData", "dcaZ vs Pt (#bar{p})", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); aproton_reg.add("histTOFm2", "TOF m^2 vs Pt (#bar{p})", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - aproton_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (#bar{p})", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); aproton_reg.add("histTpcNsigmaData", "n-sigma TPC (#bar{p})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#bar{p}}"}}); aproton_reg.add("histTofNsigmaData", "n-sigma TOF (#bar{p})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#bar{p}}"}}); - aproton_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (#bar{p})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#bar{p}}"}}); - aproton_reg.add("histTofNsigmaData_pT", "n-sigma TOF (#bar{p})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#bar{p}}"}}); aproton_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (#bar{p})", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); aproton_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (#bar{p})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); aproton_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (#bar{p})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -212,19 +246,13 @@ struct NucleiHistTask { aproton_reg.add("histTofm2_eta", "mass^2 TOF (#bar{p}) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{#bar{p}}"}, etaAxis}); // histograms for Deuterons - deuteron_reg.add("histKeepEventData", "skimming histogram (d)", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); deuteron_reg.add("histTpcSignalData", "Specific energy loss (d)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); deuteron_reg.add("histTofSignalData", "TOF signal (d)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - deuteron_reg.add("histTpcSignalData_pT", "Specific energy loss (d)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - deuteron_reg.add("histTofSignalData_pT", "TOF signal (d)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); deuteron_reg.add("histDcaVsPtData", "dcaXY vs Pt (d)", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); deuteron_reg.add("histDcaZVsPtData", "dcaZ vs Pt (d)", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); deuteron_reg.add("histTOFm2", "TOF m^2 vs Pt (d)", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - deuteron_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (d)", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); deuteron_reg.add("histTpcNsigmaData", "n-sigma TPC (d)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{d}"}}); deuteron_reg.add("histTofNsigmaData", "n-sigma TOF (d)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{d}"}}); - deuteron_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (d)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{d}"}}); - deuteron_reg.add("histTofNsigmaData_pT", "n-sigma TOF (d)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{d}"}}); deuteron_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (d)", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); deuteron_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (d)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); deuteron_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (d)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -238,19 +266,13 @@ struct NucleiHistTask { deuteron_reg.add("histTofm2_eta", "mass^2 TOF (d) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{d}"}, etaAxis}); // histograms for antiDeuterons - adeuteron_reg.add("histKeepEventData", "skimming histogram (#bar{d})", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); adeuteron_reg.add("histTpcSignalData", "Specific energy loss (#bar{d})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); adeuteron_reg.add("histTofSignalData", "TOF signal (#bar{d})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - adeuteron_reg.add("histTpcSignalData_pT", "Specific energy loss (#bar{d})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - adeuteron_reg.add("histTofSignalData_pT", "TOF signal (#bar{d})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); adeuteron_reg.add("histDcaVsPtData", "dcaXY vs Pt (#bar{d})", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); adeuteron_reg.add("histDcaZVsPtData", "dcaZ vs Pt (#bar{d})", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); adeuteron_reg.add("histTOFm2", "TOF m^2 vs Pt (#bar{d})", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - adeuteron_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (#bar{d})", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); adeuteron_reg.add("histTpcNsigmaData", "n-sigma TPC (#bar{d})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#bar{d}}"}}); adeuteron_reg.add("histTofNsigmaData", "n-sigma TOF (#bar{d})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#bar{d}}"}}); - adeuteron_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (#bar{d})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#bar{d}}"}}); - adeuteron_reg.add("histTofNsigmaData_pT", "n-sigma TOF (#bar{d})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#bar{d}}"}}); adeuteron_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (#bar{d})", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); adeuteron_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (#bar{d})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); adeuteron_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (#bar{d})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -264,19 +286,13 @@ struct NucleiHistTask { adeuteron_reg.add("histTofm2_eta", "mass^2 TOF (#bar{d}) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{#bar{d}}"}, etaAxis}); // histograms for Triton - triton_reg.add("histKeepEventData", "skimming histogram (t)", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); triton_reg.add("histTpcSignalData", "Specific energy loss (t)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); triton_reg.add("histTofSignalData", "TOF signal (t)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - triton_reg.add("histTpcSignalData_pT", "Specific energy loss (t)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - triton_reg.add("histTofSignalData_pT", "TOF signal (t)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); triton_reg.add("histDcaVsPtData", "dcaXY vs Pt (t)", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); triton_reg.add("histDcaZVsPtData", "dcaZ vs Pt (t)", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); triton_reg.add("histTOFm2", "TOF m^2 vs Pt (t)", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - triton_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (t)", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); triton_reg.add("histTpcNsigmaData", "n-sigma TPC (t)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{t}"}}); triton_reg.add("histTofNsigmaData", "n-sigma TOF (t)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{t}"}}); - triton_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (t)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{t}"}}); - triton_reg.add("histTofNsigmaData_pT", "n-sigma TOF (t)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{t}"}}); triton_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (t)", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); triton_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (t)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); triton_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (t)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -290,19 +306,13 @@ struct NucleiHistTask { triton_reg.add("histTofm2_eta", "mass^2 TOF (t) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{t}"}, etaAxis}); // histograms for antiTriton - atriton_reg.add("histKeepEventData", "skimming histogram (#bar{t})", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); atriton_reg.add("histTpcSignalData", "Specific energy loss (#bar{t})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); atriton_reg.add("histTofSignalData", "TOF signal (#bar{t})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - atriton_reg.add("histTpcSignalData_pT", "Specific energy loss (#bar{t})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - atriton_reg.add("histTofSignalData_pT", "TOF signal (#bar{t})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); atriton_reg.add("histDcaVsPtData", "dcaXY vs Pt (#bar{t})", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); atriton_reg.add("histDcaZVsPtData", "dcaZ vs Pt (#bar{t})", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); atriton_reg.add("histTOFm2", "TOF m^2 vs Pt (#bar{t})", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - atriton_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (#bar{t})", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); atriton_reg.add("histTpcNsigmaData", "n-sigma TPC (#bar{t})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#bar{t}}"}}); atriton_reg.add("histTofNsigmaData", "n-sigma TOF (#bar{t})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{#bar{t}}"}}); - atriton_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (#bar{t})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#bar{t}}"}}); - atriton_reg.add("histTofNsigmaData_pT", "n-sigma TOF (#bar{t})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#bar{t}}"}}); atriton_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (#bar{t})", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); atriton_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (#bar{t})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); atriton_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (#bar{t})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -316,19 +326,13 @@ struct NucleiHistTask { atriton_reg.add("histTofm2_eta", "mass^2 TOF (#bar{t}) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{#bar{t}}"}, etaAxis}); // histograms for Helium-3 - Helium3_reg.add("histKeepEventData", "skimming histogram (^{3}He)", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); Helium3_reg.add("histTpcSignalData", "Specific energy loss (^{3}He)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); Helium3_reg.add("histTofSignalData", "TOF signal (^{3}He)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - Helium3_reg.add("histTpcSignalData_pT", "Specific energy loss (^{3}He)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - Helium3_reg.add("histTofSignalData_pT", "TOF signal (^{3}He)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); Helium3_reg.add("histDcaVsPtData", "dcaXY vs Pt (^{3}He)", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); Helium3_reg.add("histDcaZVsPtData", "dcaZ vs Pt (^{3}He)", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); Helium3_reg.add("histTOFm2", "TOF m^2 vs Pt (^{3}He)", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - Helium3_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (^{3}He)", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); Helium3_reg.add("histTpcNsigmaData", "n-sigma TPC (^{3}He)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); Helium3_reg.add("histTofNsigmaData", "n-sigma TOF (^{3}He)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); - Helium3_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (^{3}He)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); - Helium3_reg.add("histTofNsigmaData_pT", "n-sigma TOF (^{3}He)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); Helium3_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (^{3}He)", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); Helium3_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (^{3}He)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); Helium3_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (^{3}He)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -342,19 +346,13 @@ struct NucleiHistTask { Helium3_reg.add("histTofm2_eta", "mass^2 TOF (^{3}He) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{^{3}He}"}, etaAxis}); // histograms for antiHelium-3 - aHelium3_reg.add("histKeepEventData", "skimming histogram (^{3}#bar{He})", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); aHelium3_reg.add("histTpcSignalData", "Specific energy loss (^{3}#bar{He})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); aHelium3_reg.add("histTofSignalData", "TOF signal (^{3}#bar{He})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - aHelium3_reg.add("histTpcSignalData_pT", "Specific energy loss (^{3}#bar{He})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - aHelium3_reg.add("histTofSignalData_pT", "TOF signal (^{3}#bar{He})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); aHelium3_reg.add("histDcaVsPtData", "dcaXY vs Pt (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); aHelium3_reg.add("histDcaZVsPtData", "dcaZ vs Pt (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); aHelium3_reg.add("histTOFm2", "TOF m^2 vs Pt (^{3}#bar{He})", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - aHelium3_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); aHelium3_reg.add("histTpcNsigmaData", "n-sigma TPC (^{3}#bar{He})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); aHelium3_reg.add("histTofNsigmaData", "n-sigma TOF (^{3}#bar{He})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); - aHelium3_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); - aHelium3_reg.add("histTofNsigmaData_pT", "n-sigma TOF (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); aHelium3_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); aHelium3_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); aHelium3_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -368,19 +366,13 @@ struct NucleiHistTask { aHelium3_reg.add("histTofm2_eta", "mass^2 TOF (^{3}#bar{He}) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{^{3}He}"}, etaAxis}); // histograms for Helium-4 (alpha) - Helium4_reg.add("histKeepEventData", "skimming histogram (^{4}He)", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); Helium4_reg.add("histTpcSignalData", "Specific energy loss (^{4}He)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); Helium4_reg.add("histTofSignalData", "TOF signal (^{4}He)", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - Helium4_reg.add("histTpcSignalData_pT", "Specific energy loss (^{4}He)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - Helium4_reg.add("histTofSignalData_pT", "TOF signal (^{4}He)", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); Helium4_reg.add("histDcaVsPtData", "dcaXY vs Pt (^{4}He)", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); Helium4_reg.add("histDcaZVsPtData", "dcaZ vs Pt (^{4}He)", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); Helium4_reg.add("histTOFm2", "TOF m^2 vs Pt (^{4}He)", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - Helium4_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (^{4}He)", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); Helium4_reg.add("histTpcNsigmaData", "n-sigma TPC (^{4}He)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{4}He}"}}); Helium4_reg.add("histTofNsigmaData", "n-sigma TOF (^{4}He)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{4}He}"}}); - Helium4_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (^{4}He)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{4}He}"}}); - Helium4_reg.add("histTofNsigmaData_pT", "n-sigma TOF (^{4}He)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{4}He}"}}); Helium4_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (^{4}He)", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); Helium4_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (^{4}He)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); Helium4_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (^{4}He)", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -394,19 +386,13 @@ struct NucleiHistTask { Helium4_reg.add("histTofm2_eta", "mass^2 TOF (^{4}He) vs eta", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2_{^{4}He}"}, etaAxis}); // histograms for antiHelium-4 (alpha) - aHelium4_reg.add("histKeepEventData", "skimming histogram (^{4}#bar{He})", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); aHelium4_reg.add("histTpcSignalData", "Specific energy loss (^{4}#bar{He})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); aHelium4_reg.add("histTofSignalData", "TOF signal (^{4}#bar{He})", HistType::kTH2F, {{600, 0., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); - aHelium4_reg.add("histTpcSignalData_pT", "Specific energy loss (^{4}#bar{He})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); - aHelium4_reg.add("histTofSignalData_pT", "TOF signal (^{4}#bar{He})", HistType::kTH2F, {{600, 0., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); aHelium4_reg.add("histDcaVsPtData", "dcaXY vs Pt (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {250, -0.5, 0.5, "dca"}}); aHelium4_reg.add("histDcaZVsPtData", "dcaZ vs Pt (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {1000, -2.0, 2.0, "dca"}}); aHelium4_reg.add("histTOFm2", "TOF m^2 vs Pt (^{4}#bar{He})", HistType::kTH2F, {pAxis, {400, 0.0, 10.0, "m^2"}}); - aHelium4_reg.add("histTOFm2_pT", "TOF m^2 vs Pt (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {400, 0.0, 10.0, "m^2"}}); aHelium4_reg.add("histTpcNsigmaData", "n-sigma TPC (^{4}#bar{He})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{antiHe-4}"}}); aHelium4_reg.add("histTofNsigmaData", "n-sigma TOF (^{4}#bar{He})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{antiHe-4}"}}); - aHelium4_reg.add("histTpcNsigmaData_pT", "n-sigma TPC (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{antiHe-4}"}}); - aHelium4_reg.add("histTofNsigmaData_pT", "n-sigma TOF (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{antiHe-4}"}}); aHelium4_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {160, 0.0, 160.0, "nCluster"}}); aHelium4_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); aHelium4_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {10, 0.0, 10.0, "nCluster"}}); @@ -421,21 +407,24 @@ struct NucleiHistTask { // +++++++++++++++++++++ MC ++++++++++++++++++++++++++ + // MC generated + MC_gen_reg.add("histRecVtxMC", "MC generated vertex z position", HistType::kTH1F, {{400, -40., +40., "z position (cm)"}}); + MC_gen_reg.add("histCentrality", "Centrality", HistType::kTH1F, {centralityAxis}); + MC_gen_reg.add("histEta", "#eta", HistType::kTH2F, {{102, -2.01, 2.01}, PDGBINNING}); + MC_gen_reg.add("histPt", "p_{t}", HistType::kTH2F, {ptAxis, PDGBINNING}); + // MC reconstructed MC_recon_reg.add("histRecVtxMC", "MC reconstructed vertex z position", HistType::kTH1F, {{400, -40., +40., "z position (cm)"}}); - MC_recon_reg.add("histCentrality", "Centrality", HistType::kTH1F, {centralityAxis_extended}); + MC_recon_reg.add("histCentrality", "Centrality", HistType::kTH1F, {centralityAxis}); MC_recon_reg.add("histEta", "#eta", HistType::kTH2F, {{102, -2.01, 2.01}, PDGBINNING}); MC_recon_reg.add("histPt", "p_{t}", HistType::kTH2F, {ptAxis, PDGBINNING}); MC_recon_reg.add("histDCA", "DCA xy", HistType::kTH3F, {ptAxis, {250, -0.5, 0.5, "dca"}, PDGBINNING}); MC_recon_reg.add("histDCAz", "DCA z", HistType::kTH3F, {ptAxis, {1000, -2.0, 2.0, "dca"}, PDGBINNING}); MC_recon_reg.add("histTpcSignalData", "Specific energy loss", HistType::kTH3F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}, PDGBINNING}); MC_recon_reg.add("histTofSignalData", "TOF signal", HistType::kTH3F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}, PDGBINNING}); - MC_recon_reg.add("histTpcSignalData_pT", "Specific energy loss", HistType::kTH3F, {{600, -6., 6., "#it{p}_{T} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}, PDGBINNING}); - MC_recon_reg.add("histTofSignalData_pT", "TOF signal", HistType::kTH3F, {{600, -6., 6., "#it{p}_{T} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}, PDGBINNING}); MC_recon_reg.add("histTpcSignalData_all_species", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {5000, 0, 5000, "d#it{E} / d#it{X} (a. u.)"}}); MC_recon_reg.add("histTofSignalData_all_species", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {550, 0.0, 1.1, "#beta (TOF)"}}); MC_recon_reg.add("histTOFm2", "TOF m^2 vs Pt", HistType::kTH3F, {pAxis, {400, 0.0, 10.0, "m^2"}, PDGBINNING}); - MC_recon_reg.add("histTOFm2_pT", "TOF m^2 vs Pt", HistType::kTH3F, {ptAxis, {400, 0.0, 10.0, "m^2"}, PDGBINNING}); MC_recon_reg.add("histNClusterTPC", "Number of Clusters in TPC vs Pt", HistType::kTH3F, {ptAxis, {80, 0.0, 160.0, "nCluster"}, PDGBINNING}); MC_recon_reg.add("histNClusterITS", "Number of Clusters in ITS vs Pt", HistType::kTH3F, {ptAxis, {10, 0.0, 10.0, "ITS nCls"}, PDGBINNING}); MC_recon_reg.add("histNClusterITSib", "Number of Clusters in ib of ITS vs Pt", HistType::kTH3F, {ptAxis, {10, 0.0, 10.0, "ITS ib nCls"}, PDGBINNING}); @@ -467,37 +456,21 @@ struct NucleiHistTask { MC_recon_reg.add("histTofNsigmaDataAl", "TOF nSigma (^{4}He)", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{4}He}"}}); MC_recon_reg.add("histTofNsigmaDataaAl", "TOF nSigma (^{4}#bar{He})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{4}He}"}}); - MC_recon_reg.add("histTpcNsigmaDataPi_pT", "TPC nSigma (#pi^{+})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); - MC_recon_reg.add("histTpcNsigmaDataaPi_pT", "TPC nSigma (#pi^{-})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); - MC_recon_reg.add("histTpcNsigmaDataPr_pT", "TPC nSigma (p)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{p}"}}); - MC_recon_reg.add("histTpcNsigmaDataaPr_pT", "TPC nSigma (#bar{p})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{p}"}}); - MC_recon_reg.add("histTpcNsigmaDataDe_pT", "TPC nSigma (d)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{d}"}}); - MC_recon_reg.add("histTpcNsigmaDataaDe_pT", "TPC nSigma (#bar{d})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{d}"}}); - MC_recon_reg.add("histTpcNsigmaDataTr_pT", "TPC nSigma (t)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{t}"}}); - MC_recon_reg.add("histTpcNsigmaDataaTr_pT", "TPC nSigma (#bar{t})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{t}"}}); - MC_recon_reg.add("histTpcNsigmaDataHe_pT", "TPC nSigma (^{3}He)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{He-3}"}}); - MC_recon_reg.add("histTpcNsigmaDataaHe_pT", "TPC nSigma (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{He-3}"}}); - MC_recon_reg.add("histTpcNsigmaDataAl_pT", "TPC nSigma (^{4}He)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{He-4}"}}); - MC_recon_reg.add("histTpcNsigmaDataaAl_pT", "TPC nSigma (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{He-4}"}}); - MC_recon_reg.add("histTofNsigmaDataPi_pT", "TOF nSigma (#pi^{+})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); - MC_recon_reg.add("histTofNsigmaDataaPi_pT", "TOF nSigma (#pi^{-})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{#pi^{+}}"}}); - MC_recon_reg.add("histTofNsigmaDataPr_pT", "TOF nSigma (p)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{p}"}}); - MC_recon_reg.add("histTofNsigmaDataaPr_pT", "TOF nSigma (#bar{p})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{p}"}}); - MC_recon_reg.add("histTofNsigmaDataDe_pT", "TOF nSigma (d)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{d}"}}); - MC_recon_reg.add("histTofNsigmaDataaDe_pT", "TOF nSigma (#bar{d})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{d}"}}); - MC_recon_reg.add("histTofNsigmaDataTr_pT", "TOF nSigma (t)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{t}"}}); - MC_recon_reg.add("histTofNsigmaDataaTr_pT", "TOF nSigma (#bar{t})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{t}"}}); - MC_recon_reg.add("histTofNsigmaDataHe_pT", "TOF nSigma (^{3}He)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); - MC_recon_reg.add("histTofNsigmaDataaHe_pT", "TOF nSigma (^{3}#bar{He})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); - MC_recon_reg.add("histTofNsigmaDataAl_pT", "TOF nSigma (^{4}He)", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{4}He}"}}); - MC_recon_reg.add("histTofNsigmaDataaAl_pT", "TOF nSigma (^{4}#bar{He})", HistType::kTH2F, {ptAxis, {160, -20., +20., "n#sigma_{^{4}He}"}}); + MC_DCA.add("histDCA_prim", "DCA xy", HistType::kTH3F, {ptAxis, {250, -0.5, 0.5, "dca"}, PDGBINNING}); + MC_DCA.add("histDCAz_prim", "DCA z", HistType::kTH3F, {ptAxis, {1000, -2.0, 2.0, "dca"}, PDGBINNING}); + MC_DCA.add("histDCA_weak", "DCA xy", HistType::kTH3F, {ptAxis, {250, -0.5, 0.5, "dca"}, PDGBINNING}); + MC_DCA.add("histDCAz_weak", "DCA z", HistType::kTH3F, {ptAxis, {1000, -2.0, 2.0, "dca"}, PDGBINNING}); + MC_DCA.add("histDCA_mat", "DCA xy", HistType::kTH3F, {ptAxis, {250, -0.5, 0.5, "dca"}, PDGBINNING}); + MC_DCA.add("histDCAz_mat", "DCA z", HistType::kTH3F, {ptAxis, {1000, -2.0, 2.0, "dca"}, PDGBINNING}); } // Configurables + Configurable use_momentum_getter{"use_momentum_getter", 0, "0: track.p(), 1: track.pt(), 2: track.tpcInnerParam()"}; + Configurable momentum_He3{"momentum_He3", 0, "0: momentum * 1.0, 1: momentum * 2.0"}; Configurable yMin{"yMin", -0.5, "Maximum rapidity"}; Configurable yMax{"yMax", 0.5, "Minimum rapidity"}; - Configurable pTmin{"pTmin", 0.1f, "min pT"}; - Configurable pTmax{"pTmax", 1e+10f, "max pT"}; + Configurable p_min{"p_min", 0.1f, "min momentum"}; + Configurable p_max{"p_max", 1e+10f, "max momentum"}; Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutEta{"cfgCutEta", 0.9f, "Eta range for tracks"}; Configurable nsigmacutLow{"nsigmacutLow", -3.0, "Value of the Nsigma cut"}; @@ -507,38 +480,72 @@ struct NucleiHistTask { Configurable enable_Centrality_cut_global{"enable_Centrality_cut_global", true, "use Centrality cut"}; // Replacement for globalTrack filter + Configurable requireITS{"requireITS", true, "Additional cut on the ITS requirement"}; + Configurable requireTPC{"requireTPC", true, "Additional cut on the TPC requirement"}; + Configurable passedITSRefit{"passedITSRefit", true, "Additional cut on the ITS refit requirement"}; + Configurable passedTPCRefit{"passedTPCRefit", true, "Additional cut on the TPC refit requirement"}; Configurable minReqClusterITS{"minReqClusterITS", 1.0, "min number of clusters required in ITS"}; Configurable minReqClusterITSib{"minReqClusterITSib", 1.0, "min number of clusters required in ITS inner barrel"}; Configurable minTPCnClsFound{"minTPCnClsFound", 0.0f, "min number of crossed rows TPC"}; Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.0f, "min number of crossed rows TPC"}; Configurable minRatioCrossedRowsTPC{"minRatioCrossedRowsTPC", 0.8f, "min ratio of crossed rows over findable clusters TPC"}; Configurable maxRatioCrossedRowsTPC{"maxRatioCrossedRowsTPC", 2.0f, "max ratio of crossed rows over findable clusters TPC"}; - Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; - Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; + Configurable maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 4.f, "Cut on the maximum value of the chi2 per cluster in the TPC"}; + Configurable minChi2PerClusterTPC{"minChi2PerClusterTPC", 0.5f, "Cut on the minimum value of the chi2 per cluster in the TPC"}; + Configurable maxChi2PerClusterITS{"maxChi2PerClusterITS", 36.f, "Cut on the maximum value of the chi2 per cluster in the ITS"}; Configurable maxDCA_XY{"maxDCA_XY", 0.5f, "max DCA to vertex xy"}; Configurable maxDCA_Z{"maxDCA_Z", 2.0f, "max DCA to vertex z"}; Configurable lastRequiredTrdCluster{"lastRequiredTrdCluster", -1, "Last cluster to required in TRD for track selection. -1 does not require any TRD cluster"}; + Configurable requireGoldenChi2{"requireGoldenChi2", false, "Enable the requirement of GoldenChi2"}; Configurable event_selection_sel8{"event_selection_sel8", true, "Enable sel8 event selection"}; Configurable event_selection_MC_sel8{"event_selection_MC_sel8", true, "Enable sel8 event selection in MC processing"}; + Configurable require_PhysicalPrimary_MC_gen{"require_PhysicalPrimary_MC_gen", true, "Enable PhysicalPrimary selection in generated MC processing"}; + Configurable> Tpc_mSigma_shift_Pi{"Tpc_mSigma_shift_Pi", {.0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f}, "Array for shifting pi^{+} & pi^{-} nSigma values in TPC"}; + Configurable> Tpc_mSigma_shift_Pr{"Tpc_mSigma_shift_Pr", {.0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f}, "Array for shifting (anti)proton nSigma values in TPC"}; + Configurable> Tpc_mSigma_shift_De{"Tpc_mSigma_shift_De", {.0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f}, "Array for shifting (anti)deuteron nSigma values in TPC"}; + Configurable> Tpc_mSigma_shift_Tr{"Tpc_mSigma_shift_Tr", {.0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f}, "Array for shifting (anti)triton nSigma values in TPC"}; + Configurable> Tpc_mSigma_shift_He3{"Tpc_mSigma_shift_He3", {.0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f}, "Array for shifting (anti)helium-3 nSigma values in TPC"}; + Configurable> Tpc_mSigma_shift_Al{"Tpc_mSigma_shift_Al", {.0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f}, "Array for shifting (anti)helium-4 nSigma values in TPC"}; + + TF1* Pion_Tpc_nSigma_shift = 0; + TF1* Proton_Tpc_nSigma_shift = 0; + TF1* Deuteron_Tpc_nSigma_shift = 0; + TF1* Triton_Tpc_nSigma_shift = 0; + TF1* He3_Tpc_nSigma_shift = 0; + TF1* He4_Tpc_nSigma_shift = 0; + + Configurable enable_pT_shift_pion_tpc_nSigma{"enable_pT_shift_pion_tpc_nSigma", false, "Enable Pi plus TPC nSigma recentering by TF1"}; + Configurable enable_pT_shift_proton_tpc_nSigma{"enable_pT_shift_proton_tpc_nSigma", false, "Enable Proton TPC nSigma recentering by TF1"}; + Configurable enable_pT_shift_deuteron_tpc_nSigma{"enable_pT_shift_deuteron_tpc_nSigma", false, "Enable Deuteron TPC nSigma recentering by TF1"}; + Configurable enable_pT_shift_triton_tpc_nSigma{"enable_pT_shift_triton_tpc_nSigma", false, "Enable Triton TPC nSigma recentering by TF1"}; + Configurable enable_pT_shift_He3_tpc_nSigma{"enable_pT_shift_He3_tpc_nSigma", false, "Enable Helium-3 TPC nSigma recentering by TF1"}; + Configurable enable_pT_shift_He4_tpc_nSigma{"enable_pT_shift_He4_tpc_nSigma", false, "Enable Helium-4 TPC nSigma recentering by TF1"}; + + Configurable> parShiftPtPion{"parShiftPtPion", {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, "Parameters for Pi plus pT shift."}; + Configurable> parShiftPtProton{"parShiftPtProton", {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, "Parameters for Proton pT shift."}; + Configurable> parShiftPtDeuteron{"parShiftPtDeuteron", {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, "Parameters for Deuteron pT shift."}; + Configurable> parShiftPtTriton{"parShiftPtTriton", {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, "Parameters for Triton pT shift."}; + Configurable> parShiftPtHe3{"parShiftPtHe3", {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, "Parameters for Helium-3 pT shift."}; + Configurable> parShiftPtHe4{"parShiftPtHe4", {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, "Parameters for Alpha pT shift."}; + + // *************************************************************************** + + int getBinIndex(const std::vector& ptBinning, float momentum) + { + for (size_t i = 0; i < ptBinning.size() - 1; ++i) { + if (momentum >= ptBinning[i] && momentum < ptBinning[i + 1]) { + return i; + } + } + return -1; + } + + // *************************************************************************** template void fillHistograms(const CollisionType& event, const TracksType& tracks) { - bool keepEvent_pi = kFALSE; - bool keepEvent_p = kFALSE; - bool keepEvent_d = kFALSE; - bool keepEvent_t = kFALSE; - bool keepEvent_He3 = kFALSE; - bool keepEvent_He4 = kFALSE; - - bool keepEvent_antipi = kFALSE; - bool keepEvent_antip = kFALSE; - bool keepEvent_antid = kFALSE; - bool keepEvent_antit = kFALSE; - bool keepEvent_antiHe3 = kFALSE; - bool keepEvent_antiHe4 = kFALSE; - if (event_selection_sel8 && event.sel8()) { spectra_reg.fill(HIST("histRecVtxZData"), event.posZ()); } @@ -546,11 +553,98 @@ struct NucleiHistTask { spectra_reg.fill(HIST("histRecVtxZData"), event.posZ()); } + if (enable_pT_shift_pion_tpc_nSigma) { + Pion_Tpc_nSigma_shift = new TF1("Pion_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtPion; + Pion_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_proton_tpc_nSigma) { + Proton_Tpc_nSigma_shift = new TF1("Proton_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtProton; + Proton_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_deuteron_tpc_nSigma) { + Deuteron_Tpc_nSigma_shift = new TF1("Deuteron_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtDeuteron; + Deuteron_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_triton_tpc_nSigma) { + Triton_Tpc_nSigma_shift = new TF1("Triton_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtTriton; + Triton_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_He3_tpc_nSigma) { + He3_Tpc_nSigma_shift = new TF1("He3_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtHe3; + He3_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_He4_tpc_nSigma) { + He4_Tpc_nSigma_shift = new TF1("He4_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtHe4; + He4_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + for (auto track : tracks) { + histTrackcuts_data->AddBinContent(1); if (event_selection_sel8 && !event.sel8()) continue; + histTrackcuts_data->AddBinContent(2); + double momentum = 0.0; + double momentum_Z_equal_2 = 0.0; + int momentum_getter = 0; + int momentum_getter_Z_equal_2 = 0; + switch (use_momentum_getter) { + case 0: + momentum = track.p(); + switch (momentum_He3) { + case 0: + momentum_Z_equal_2 = track.p(); + break; + case 1: + momentum_Z_equal_2 = track.p() * 2.0; + break; + default: + momentum_getter_Z_equal_2 = -1; + break; + } + break; + case 1: + momentum = track.pt(); + switch (momentum_He3) { + case 0: + momentum_Z_equal_2 = track.pt(); + break; + case 1: + momentum_Z_equal_2 = track.pt() * 2.0; + break; + default: + momentum_getter_Z_equal_2 = -1; + break; + } + break; + case 2: + momentum = track.tpcInnerParam(); + switch (momentum_He3) { + case 0: + momentum_Z_equal_2 = track.tpcInnerParam(); + break; + case 1: + momentum_Z_equal_2 = track.tpcInnerParam() * 2.0; + break; + default: + momentum_getter_Z_equal_2 = -1; + break; + } + break; + default: + momentum_getter = -1; + break; + } + if (momentum_getter == -1 || momentum_getter_Z_equal_2 == -1) + break; + float TPCnumberClsFound = track.tpcNClsFound(); float TPC_nCls_Crossed_Rows = track.tpcNClsCrossedRows(); float RatioCrossedRowsOverFindableTPC = track.tpcCrossedRowsOverFindableCls(); @@ -587,6 +681,7 @@ struct NucleiHistTask { lorentzVector_He3.Rapidity() < yMin || lorentzVector_He3.Rapidity() > yMax || lorentzVector_He4.Rapidity() < yMin || lorentzVector_He4.Rapidity() > yMax) continue; + histTrackcuts_data->AddBinContent(3); float nSigmaPion = track.tpcNSigmaPi(); float nSigmaProton = track.tpcNSigmaPr(); @@ -601,25 +696,85 @@ struct NucleiHistTask { spectra_reg.fill(HIST("histChi2TPC"), track.pt(), track.tpcChi2NCl()); spectra_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); - if (TMath::Abs(track.dcaXY()) > maxDCA_XY || TMath::Abs(track.dcaZ()) > maxDCA_Z || TPCnumberClsFound < minTPCnClsFound || TPC_nCls_Crossed_Rows < minNCrossedRowsTPC || RatioCrossedRowsOverFindableTPC < minRatioCrossedRowsTPC || RatioCrossedRowsOverFindableTPC > maxRatioCrossedRowsTPC || Chi2perClusterTPC > maxChi2TPC || Chi2perClusterITS > maxChi2ITS || !(track.passedTPCRefit()) || !(track.passedITSRefit()) || (track.itsNClsInnerBarrel()) < minReqClusterITSib || (track.itsNCls()) < minReqClusterITS || track.pt() < pTmin || track.pt() > pTmax) + if (TMath::Abs(track.dcaXY()) > maxDCA_XY || TMath::Abs(track.dcaZ()) > maxDCA_Z) continue; - - spectra_reg.fill(HIST("histTpcSignalData"), track.p() * track.sign(), track.tpcSignal()); - spectra_reg.fill(HIST("histTpcSignalData_pT"), track.pt() * track.sign(), track.tpcSignal()); + histTrackcuts_data->AddBinContent(4); + if (TPCnumberClsFound < minTPCnClsFound || TPC_nCls_Crossed_Rows < minNCrossedRowsTPC) + continue; + histTrackcuts_data->AddBinContent(5); + if (RatioCrossedRowsOverFindableTPC < minRatioCrossedRowsTPC || RatioCrossedRowsOverFindableTPC > maxRatioCrossedRowsTPC) + continue; + histTrackcuts_data->AddBinContent(6); + if (Chi2perClusterTPC > maxChi2PerClusterTPC || Chi2perClusterTPC < minChi2PerClusterTPC || Chi2perClusterITS > maxChi2PerClusterITS) + continue; + histTrackcuts_data->AddBinContent(7); + if (!(track.passedTPCRefit())) + continue; + histTrackcuts_data->AddBinContent(8); + if (!(track.passedITSRefit())) + continue; + histTrackcuts_data->AddBinContent(9); + if ((track.itsNClsInnerBarrel()) < minReqClusterITSib || (track.itsNCls()) < minReqClusterITS) + continue; + histTrackcuts_data->AddBinContent(10); + if (track.pt() < p_min || track.pt() > p_max) + continue; + histTrackcuts_data->AddBinContent(11); + if ((requireITS && !(track.hasITS())) || (requireTPC && !(track.hasTPC()))) + continue; + histTrackcuts_data->AddBinContent(12); + if (requireGoldenChi2 && !(track.passedGoldenChi2())) + continue; + histTrackcuts_data->AddBinContent(13); + + spectra_reg.fill(HIST("histTpcSignalData"), momentum * track.sign(), track.tpcSignal()); + + int binIndex = getBinIndex(ptBinning, momentum); + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Pi.value.size())) + nSigmaPion += Tpc_mSigma_shift_Pi.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Pr.value.size())) + nSigmaProton += Tpc_mSigma_shift_Pr.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_De.value.size())) + nSigmaDeut += Tpc_mSigma_shift_De.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Tr.value.size())) + nSigmaTriton += Tpc_mSigma_shift_Tr.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_He3.value.size())) + nSigmaHe3 += Tpc_mSigma_shift_He3.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Al.value.size())) + nSigmaHe4 += Tpc_mSigma_shift_Al.value[binIndex]; + + if (enable_pT_shift_pion_tpc_nSigma) { + float nSigmaPion_shift = Pion_Tpc_nSigma_shift->Eval(momentum); + nSigmaPion -= nSigmaPion_shift; + } + if (enable_pT_shift_proton_tpc_nSigma) { + float nSigmaProton_shift = Proton_Tpc_nSigma_shift->Eval(momentum); + nSigmaProton -= nSigmaProton_shift; + } + if (enable_pT_shift_deuteron_tpc_nSigma) { + float nSigmaDeuteron_shift = Deuteron_Tpc_nSigma_shift->Eval(momentum); + nSigmaDeut -= nSigmaDeuteron_shift; + } + if (enable_pT_shift_triton_tpc_nSigma) { + float nSigmaTriton_shift = Triton_Tpc_nSigma_shift->Eval(momentum); + nSigmaTriton -= nSigmaTriton_shift; + } + if (enable_pT_shift_He3_tpc_nSigma) { + float nSigmaHe3_shift = He3_Tpc_nSigma_shift->Eval(momentum); + nSigmaHe3 -= nSigmaHe3_shift; + } + if (enable_pT_shift_He4_tpc_nSigma) { + float nSigmaHe4_shift = He4_Tpc_nSigma_shift->Eval(momentum); + nSigmaHe4 -= nSigmaHe4_shift; + } if (track.sign() > 0) { - pion_reg.fill(HIST("histTpcNsigmaData"), track.p(), nSigmaPion); - proton_reg.fill(HIST("histTpcNsigmaData"), track.p(), nSigmaProton); - deuteron_reg.fill(HIST("histTpcNsigmaData"), track.p(), nSigmaDeut); - triton_reg.fill(HIST("histTpcNsigmaData"), track.p(), nSigmaTriton); - Helium3_reg.fill(HIST("histTpcNsigmaData"), track.p() * 2.0, nSigmaHe3); - Helium4_reg.fill(HIST("histTpcNsigmaData"), track.p() * 2.0, nSigmaHe4); - pion_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt(), nSigmaPion); - proton_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt(), nSigmaProton); - deuteron_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt(), nSigmaDeut); - triton_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt(), nSigmaTriton); - Helium3_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt() * 2.0, nSigmaHe3); - Helium4_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt() * 2.0, nSigmaHe4); + pion_reg.fill(HIST("histTpcNsigmaData"), momentum, nSigmaPion); + proton_reg.fill(HIST("histTpcNsigmaData"), momentum, nSigmaProton); + deuteron_reg.fill(HIST("histTpcNsigmaData"), momentum, nSigmaDeut); + triton_reg.fill(HIST("histTpcNsigmaData"), momentum, nSigmaTriton); + Helium3_reg.fill(HIST("histTpcNsigmaData"), momentum_Z_equal_2, nSigmaHe3); + Helium4_reg.fill(HIST("histTpcNsigmaData"), momentum_Z_equal_2, nSigmaHe4); if (track.hasTOF()) { if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { @@ -634,24 +789,17 @@ struct NucleiHistTask { continue; } Float_t TOFmass2 = ((track.mass()) * (track.mass())); - spectra_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - spectra_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); + spectra_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); } } if (track.sign() < 0) { - apion_reg.fill(HIST("histTpcNsigmaData"), track.p(), nSigmaPion); - aproton_reg.fill(HIST("histTpcNsigmaData"), track.p(), nSigmaProton); - adeuteron_reg.fill(HIST("histTpcNsigmaData"), track.p(), nSigmaDeut); - atriton_reg.fill(HIST("histTpcNsigmaData"), track.p(), nSigmaTriton); - aHelium3_reg.fill(HIST("histTpcNsigmaData"), track.p() * 2.0, nSigmaHe3); - aHelium4_reg.fill(HIST("histTpcNsigmaData"), track.p() * 2.0, nSigmaHe4); - apion_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt(), nSigmaPion); - aproton_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt(), nSigmaProton); - adeuteron_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt(), nSigmaDeut); - atriton_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt(), nSigmaTriton); - aHelium3_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt() * 2.0, nSigmaHe3); - aHelium4_reg.fill(HIST("histTpcNsigmaData_pT"), track.pt() * 2.0, nSigmaHe4); + apion_reg.fill(HIST("histTpcNsigmaData"), momentum, nSigmaPion); + aproton_reg.fill(HIST("histTpcNsigmaData"), momentum, nSigmaProton); + adeuteron_reg.fill(HIST("histTpcNsigmaData"), momentum, nSigmaDeut); + atriton_reg.fill(HIST("histTpcNsigmaData"), momentum, nSigmaTriton); + aHelium3_reg.fill(HIST("histTpcNsigmaData"), momentum_Z_equal_2, nSigmaHe3); + aHelium4_reg.fill(HIST("histTpcNsigmaData"), momentum_Z_equal_2, nSigmaHe4); if (track.hasTOF()) { if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { @@ -666,8 +814,7 @@ struct NucleiHistTask { continue; } Float_t TOFmass2 = ((track.mass()) * (track.mass())); - spectra_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - spectra_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); + spectra_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); } } @@ -676,11 +823,9 @@ struct NucleiHistTask { if (nSigmaPion > nsigmacutLow && nSigmaPion < nsigmacutHigh) { if (track.sign() > 0) { - keepEvent_pi = kTRUE; pion_reg.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); pion_reg.fill(HIST("histDcaZVsPtData"), track.pt(), track.dcaZ()); - pion_reg.fill(HIST("histTpcSignalData"), track.p(), track.tpcSignal()); - pion_reg.fill(HIST("histTpcSignalData_pT"), track.pt(), track.tpcSignal()); + pion_reg.fill(HIST("histTpcSignalData"), momentum, track.tpcSignal()); pion_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsFound()); pion_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls()); pion_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel()); @@ -701,21 +846,16 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - pion_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - pion_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); - pion_reg.fill(HIST("histTofSignalData"), track.p(), beta); - pion_reg.fill(HIST("histTofSignalData_pT"), track.pt(), beta); - pion_reg.fill(HIST("histTofNsigmaData"), track.p(), track.tofNSigmaPi()); - pion_reg.fill(HIST("histTofNsigmaData_pT"), track.pt(), track.tofNSigmaPi()); + pion_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); + pion_reg.fill(HIST("histTofSignalData"), momentum, beta); + pion_reg.fill(HIST("histTofNsigmaData"), momentum, track.tofNSigmaPi()); } } if (track.sign() < 0) { - keepEvent_antipi = kTRUE; apion_reg.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); apion_reg.fill(HIST("histDcaZVsPtData"), track.pt(), track.dcaZ()); - apion_reg.fill(HIST("histTpcSignalData"), track.p(), track.tpcSignal()); - apion_reg.fill(HIST("histTpcSignalData_pT"), track.pt(), track.tpcSignal()); + apion_reg.fill(HIST("histTpcSignalData"), momentum, track.tpcSignal()); apion_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsFound()); apion_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls()); apion_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel()); @@ -736,12 +876,9 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - apion_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - apion_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); - apion_reg.fill(HIST("histTofSignalData"), track.p(), beta); - apion_reg.fill(HIST("histTofSignalData_pT"), track.pt(), beta); - apion_reg.fill(HIST("histTofNsigmaData"), track.p(), track.tofNSigmaPi()); - apion_reg.fill(HIST("histTofNsigmaData_pT"), track.pt(), track.tofNSigmaPi()); + apion_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); + apion_reg.fill(HIST("histTofSignalData"), momentum, beta); + apion_reg.fill(HIST("histTofNsigmaData"), momentum, track.tofNSigmaPi()); } } @@ -757,8 +894,7 @@ struct NucleiHistTask { if (lastLayer < lastRequiredTrdCluster) continue; } - spectra_reg.fill(HIST("histTofSignalData"), track.p() * track.sign(), track.beta()); - spectra_reg.fill(HIST("histTofSignalData_pT"), track.pt() * track.sign(), track.beta()); + spectra_reg.fill(HIST("histTofSignalData"), momentum * track.sign(), track.beta()); } } @@ -767,11 +903,9 @@ struct NucleiHistTask { if (nSigmaProton > nsigmacutLow && nSigmaProton < nsigmacutHigh) { if (track.sign() > 0) { - keepEvent_p = kTRUE; proton_reg.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); proton_reg.fill(HIST("histDcaZVsPtData"), track.pt(), track.dcaZ()); - proton_reg.fill(HIST("histTpcSignalData"), track.p(), track.tpcSignal()); - proton_reg.fill(HIST("histTpcSignalData_pT"), track.pt(), track.tpcSignal()); + proton_reg.fill(HIST("histTpcSignalData"), momentum, track.tpcSignal()); proton_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsFound()); proton_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls()); proton_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel()); @@ -792,21 +926,16 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - proton_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - proton_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); - proton_reg.fill(HIST("histTofSignalData"), track.p(), beta); - proton_reg.fill(HIST("histTofSignalData_pT"), track.pt(), beta); - proton_reg.fill(HIST("histTofNsigmaData"), track.p(), track.tofNSigmaPr()); - proton_reg.fill(HIST("histTofNsigmaData_pT"), track.pt(), track.tofNSigmaPr()); + proton_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); + proton_reg.fill(HIST("histTofSignalData"), momentum, beta); + proton_reg.fill(HIST("histTofNsigmaData"), momentum, track.tofNSigmaPr()); } } if (track.sign() < 0) { - keepEvent_antip = kTRUE; aproton_reg.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); aproton_reg.fill(HIST("histDcaZVsPtData"), track.pt(), track.dcaZ()); - aproton_reg.fill(HIST("histTpcSignalData"), track.p(), track.tpcSignal()); - aproton_reg.fill(HIST("histTpcSignalData_pT"), track.pt(), track.tpcSignal()); + aproton_reg.fill(HIST("histTpcSignalData"), momentum, track.tpcSignal()); aproton_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsFound()); aproton_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls()); aproton_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel()); @@ -827,12 +956,9 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - aproton_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - aproton_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); - aproton_reg.fill(HIST("histTofSignalData"), track.p(), beta); - aproton_reg.fill(HIST("histTofSignalData_pT"), track.pt(), beta); - aproton_reg.fill(HIST("histTofNsigmaData"), track.p(), track.tofNSigmaPr()); - aproton_reg.fill(HIST("histTofNsigmaData_pT"), track.pt(), track.tofNSigmaPr()); + aproton_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); + aproton_reg.fill(HIST("histTofSignalData"), momentum, beta); + aproton_reg.fill(HIST("histTofNsigmaData"), momentum, track.tofNSigmaPr()); } } @@ -848,8 +974,7 @@ struct NucleiHistTask { if (lastLayer < lastRequiredTrdCluster) continue; } - spectra_reg.fill(HIST("histTofSignalData"), track.p() * track.sign(), track.beta()); - spectra_reg.fill(HIST("histTofSignalData_pT"), track.pt() * track.sign(), track.beta()); + spectra_reg.fill(HIST("histTofSignalData"), momentum * track.sign(), track.beta()); } } @@ -858,11 +983,9 @@ struct NucleiHistTask { if (nSigmaDeut > nsigmacutLow && nSigmaDeut < nsigmacutHigh) { if (track.sign() > 0) { - keepEvent_d = kTRUE; deuteron_reg.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); deuteron_reg.fill(HIST("histDcaZVsPtData"), track.pt(), track.dcaZ()); - deuteron_reg.fill(HIST("histTpcSignalData"), track.p(), track.tpcSignal()); - deuteron_reg.fill(HIST("histTpcSignalData_pT"), track.pt(), track.tpcSignal()); + deuteron_reg.fill(HIST("histTpcSignalData"), momentum, track.tpcSignal()); deuteron_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsFound()); deuteron_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls()); deuteron_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel()); @@ -883,21 +1006,16 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - deuteron_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - deuteron_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); - deuteron_reg.fill(HIST("histTofSignalData"), track.p(), beta); - deuteron_reg.fill(HIST("histTofSignalData_pT"), track.pt(), beta); - deuteron_reg.fill(HIST("histTofNsigmaData"), track.p(), track.tofNSigmaDe()); - deuteron_reg.fill(HIST("histTofNsigmaData_pT"), track.pt(), track.tofNSigmaDe()); + deuteron_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); + deuteron_reg.fill(HIST("histTofSignalData"), momentum, beta); + deuteron_reg.fill(HIST("histTofNsigmaData"), momentum, track.tofNSigmaDe()); } } if (track.sign() < 0) { - keepEvent_antid = kTRUE; adeuteron_reg.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); adeuteron_reg.fill(HIST("histDcaZVsPtData"), track.pt(), track.dcaZ()); - adeuteron_reg.fill(HIST("histTpcSignalData"), track.p(), track.tpcSignal()); - adeuteron_reg.fill(HIST("histTpcSignalData_pT"), track.pt(), track.tpcSignal()); + adeuteron_reg.fill(HIST("histTpcSignalData"), momentum, track.tpcSignal()); adeuteron_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsFound()); adeuteron_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls()); adeuteron_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel()); @@ -918,12 +1036,9 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - adeuteron_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - adeuteron_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); - adeuteron_reg.fill(HIST("histTofSignalData"), track.p(), beta); - adeuteron_reg.fill(HIST("histTofSignalData_pT"), track.pt(), beta); - adeuteron_reg.fill(HIST("histTofNsigmaData"), track.p(), track.tofNSigmaDe()); - adeuteron_reg.fill(HIST("histTofNsigmaData_pT"), track.pt(), track.tofNSigmaDe()); + adeuteron_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); + adeuteron_reg.fill(HIST("histTofSignalData"), momentum, beta); + adeuteron_reg.fill(HIST("histTofNsigmaData"), momentum, track.tofNSigmaDe()); } } @@ -939,8 +1054,7 @@ struct NucleiHistTask { if (lastLayer < lastRequiredTrdCluster) continue; } - spectra_reg.fill(HIST("histTofSignalData"), track.p() * track.sign(), track.beta()); - spectra_reg.fill(HIST("histTofSignalData_pT"), track.pt() * track.sign(), track.beta()); + spectra_reg.fill(HIST("histTofSignalData"), momentum * track.sign(), track.beta()); } } @@ -949,11 +1063,9 @@ struct NucleiHistTask { if (nSigmaTriton > nsigmacutLow && nSigmaTriton < nsigmacutHigh) { if (track.sign() > 0) { - keepEvent_t = kTRUE; triton_reg.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); triton_reg.fill(HIST("histDcaZVsPtData"), track.pt(), track.dcaZ()); - triton_reg.fill(HIST("histTpcSignalData"), track.p(), track.tpcSignal()); - triton_reg.fill(HIST("histTpcSignalData_pT"), track.pt(), track.tpcSignal()); + triton_reg.fill(HIST("histTpcSignalData"), momentum, track.tpcSignal()); triton_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsFound()); triton_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls()); triton_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel()); @@ -974,21 +1086,16 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - triton_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - triton_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); - triton_reg.fill(HIST("histTofSignalData"), track.p(), beta); - triton_reg.fill(HIST("histTofSignalData_pT"), track.pt(), beta); - triton_reg.fill(HIST("histTofNsigmaData"), track.p(), track.tofNSigmaTr()); - triton_reg.fill(HIST("histTofNsigmaData_pT"), track.pt(), track.tofNSigmaTr()); + triton_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); + triton_reg.fill(HIST("histTofSignalData"), momentum, beta); + triton_reg.fill(HIST("histTofNsigmaData"), momentum, track.tofNSigmaTr()); } } if (track.sign() < 0) { - keepEvent_antit = kTRUE; atriton_reg.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); atriton_reg.fill(HIST("histDcaZVsPtData"), track.pt(), track.dcaZ()); - atriton_reg.fill(HIST("histTpcSignalData"), track.p(), track.tpcSignal()); - atriton_reg.fill(HIST("histTpcSignalData_pT"), track.pt(), track.tpcSignal()); + atriton_reg.fill(HIST("histTpcSignalData"), momentum, track.tpcSignal()); atriton_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsFound()); atriton_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls()); atriton_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel()); @@ -1009,12 +1116,9 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - atriton_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2); - atriton_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2); - atriton_reg.fill(HIST("histTofSignalData"), track.p(), beta); - atriton_reg.fill(HIST("histTofSignalData_pT"), track.pt(), beta); - atriton_reg.fill(HIST("histTofNsigmaData"), track.p(), track.tofNSigmaTr()); - atriton_reg.fill(HIST("histTofNsigmaData_pT"), track.pt(), track.tofNSigmaTr()); + atriton_reg.fill(HIST("histTOFm2"), momentum, TOFmass2); + atriton_reg.fill(HIST("histTofSignalData"), momentum, beta); + atriton_reg.fill(HIST("histTofNsigmaData"), momentum, track.tofNSigmaTr()); } } @@ -1030,8 +1134,7 @@ struct NucleiHistTask { if (lastLayer < lastRequiredTrdCluster) continue; } - spectra_reg.fill(HIST("histTofSignalData"), track.p() * track.sign(), track.beta()); - spectra_reg.fill(HIST("histTofSignalData_pT"), track.pt() * track.sign(), track.beta()); + spectra_reg.fill(HIST("histTofSignalData"), momentum * track.sign(), track.beta()); } } @@ -1040,11 +1143,9 @@ struct NucleiHistTask { if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { if (track.sign() > 0) { - keepEvent_He3 = kTRUE; Helium3_reg.fill(HIST("histDcaVsPtData"), track.pt() * 2.0, track.dcaXY()); Helium3_reg.fill(HIST("histDcaZVsPtData"), track.pt() * 2.0, track.dcaZ()); - Helium3_reg.fill(HIST("histTpcSignalData"), track.p() * 2.0, track.tpcSignal()); - Helium3_reg.fill(HIST("histTpcSignalData_pT"), track.pt() * 2.0, track.tpcSignal()); + Helium3_reg.fill(HIST("histTpcSignalData"), momentum_Z_equal_2, track.tpcSignal()); Helium3_reg.fill(HIST("histNClusterTPC"), track.pt() * 2.0, track.tpcNClsFound()); Helium3_reg.fill(HIST("histNClusterITS"), track.pt() * 2.0, track.itsNCls()); Helium3_reg.fill(HIST("histNClusterITSib"), track.pt() * 2.0, track.itsNClsInnerBarrel()); @@ -1065,21 +1166,16 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - Helium3_reg.fill(HIST("histTOFm2"), track.p() * 2.0, TOFmass2); - Helium3_reg.fill(HIST("histTOFm2_pT"), track.pt() * 2.0, TOFmass2); - Helium3_reg.fill(HIST("histTofSignalData"), track.p() * 2.0, beta); - Helium3_reg.fill(HIST("histTofSignalData_pT"), track.pt() * 2.0, beta); - Helium3_reg.fill(HIST("histTofNsigmaData"), track.p() * 2.0, track.tofNSigmaHe()); - Helium3_reg.fill(HIST("histTofNsigmaData_pT"), track.pt() * 2.0, track.tofNSigmaHe()); + Helium3_reg.fill(HIST("histTOFm2"), momentum_Z_equal_2, TOFmass2); + Helium3_reg.fill(HIST("histTofSignalData"), momentum_Z_equal_2, beta); + Helium3_reg.fill(HIST("histTofNsigmaData"), momentum_Z_equal_2, track.tofNSigmaHe()); } } if (track.sign() < 0) { - keepEvent_antiHe3 = kTRUE; aHelium3_reg.fill(HIST("histDcaVsPtData"), track.pt() * 2.0, track.dcaXY()); aHelium3_reg.fill(HIST("histDcaZVsPtData"), track.pt() * 2.0, track.dcaZ()); - aHelium3_reg.fill(HIST("histTpcSignalData"), track.p() * 2.0, track.tpcSignal()); - aHelium3_reg.fill(HIST("histTpcSignalData_pT"), track.pt() * 2.0, track.tpcSignal()); + aHelium3_reg.fill(HIST("histTpcSignalData"), momentum_Z_equal_2, track.tpcSignal()); aHelium3_reg.fill(HIST("histNClusterTPC"), track.pt() * 2.0, track.tpcNClsFound()); aHelium3_reg.fill(HIST("histNClusterITS"), track.pt() * 2.0, track.itsNCls()); aHelium3_reg.fill(HIST("histNClusterITSib"), track.pt() * 2.0, track.itsNClsInnerBarrel()); @@ -1100,12 +1196,9 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - aHelium3_reg.fill(HIST("histTOFm2"), track.p() * 2.0, TOFmass2); - aHelium3_reg.fill(HIST("histTOFm2_pT"), track.pt() * 2.0, TOFmass2); - aHelium3_reg.fill(HIST("histTofSignalData"), track.p() * 2.0, beta); - aHelium3_reg.fill(HIST("histTofSignalData_pT"), track.pt() * 2.0, beta); - aHelium3_reg.fill(HIST("histTofNsigmaData"), track.p() * 2.0, track.tofNSigmaHe()); - aHelium3_reg.fill(HIST("histTofNsigmaData_pT"), track.pt() * 2.0, track.tofNSigmaHe()); + aHelium3_reg.fill(HIST("histTOFm2"), momentum_Z_equal_2, TOFmass2); + aHelium3_reg.fill(HIST("histTofSignalData"), momentum_Z_equal_2, beta); + aHelium3_reg.fill(HIST("histTofNsigmaData"), momentum_Z_equal_2, track.tofNSigmaHe()); } } @@ -1121,8 +1214,7 @@ struct NucleiHistTask { if (lastLayer < lastRequiredTrdCluster) continue; } - spectra_reg.fill(HIST("histTofSignalData"), track.p() * 2.0 * track.sign(), track.beta()); - spectra_reg.fill(HIST("histTofSignalData_pT"), track.pt() * 2.0 * track.sign(), track.beta()); + spectra_reg.fill(HIST("histTofSignalData"), momentum_Z_equal_2 * track.sign(), track.beta()); } } @@ -1131,11 +1223,9 @@ struct NucleiHistTask { if (nSigmaHe4 > nsigmacutLow && nSigmaHe4 < nsigmacutHigh) { if (track.sign() > 0) { - keepEvent_He4 = kTRUE; Helium4_reg.fill(HIST("histDcaVsPtData"), track.pt() * 2.0, track.dcaXY()); Helium4_reg.fill(HIST("histDcaZVsPtData"), track.pt() * 2.0, track.dcaZ()); - Helium4_reg.fill(HIST("histTpcSignalData"), track.p() * 2.0, track.tpcSignal()); - Helium4_reg.fill(HIST("histTpcSignalData_pT"), track.pt() * 2.0, track.tpcSignal()); + Helium4_reg.fill(HIST("histTpcSignalData"), momentum_Z_equal_2, track.tpcSignal()); Helium4_reg.fill(HIST("histNClusterTPC"), track.pt() * 2.0, track.tpcNClsFound()); Helium4_reg.fill(HIST("histNClusterITS"), track.pt() * 2.0, track.itsNCls()); Helium4_reg.fill(HIST("histNClusterITSib"), track.pt() * 2.0, track.itsNClsInnerBarrel()); @@ -1156,21 +1246,16 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - Helium4_reg.fill(HIST("histTOFm2"), track.p() * 2.0, TOFmass2); - Helium4_reg.fill(HIST("histTOFm2_pT"), track.pt() * 2.0, TOFmass2); - Helium4_reg.fill(HIST("histTofSignalData"), track.p() * 2.0, beta); - Helium4_reg.fill(HIST("histTofSignalData_pT"), track.pt() * 2.0, beta); - Helium4_reg.fill(HIST("histTofNsigmaData"), track.p() * 2.0, track.tofNSigmaAl()); - Helium4_reg.fill(HIST("histTofNsigmaData_pT"), track.pt() * 2.0, track.tofNSigmaAl()); + Helium4_reg.fill(HIST("histTOFm2"), momentum_Z_equal_2, TOFmass2); + Helium4_reg.fill(HIST("histTofSignalData"), momentum_Z_equal_2, beta); + Helium4_reg.fill(HIST("histTofNsigmaData"), momentum_Z_equal_2, track.tofNSigmaAl()); } } if (track.sign() < 0) { - keepEvent_antiHe4 = kTRUE; aHelium4_reg.fill(HIST("histDcaVsPtData"), track.pt() * 2.0, track.dcaXY()); aHelium4_reg.fill(HIST("histDcaZVsPtData"), track.pt() * 2.0, track.dcaZ()); - aHelium4_reg.fill(HIST("histTpcSignalData"), track.p() * 2.0, track.tpcSignal()); - aHelium4_reg.fill(HIST("histTpcSignalData_pT"), track.pt() * 2.0, track.tpcSignal()); + aHelium4_reg.fill(HIST("histTpcSignalData"), momentum_Z_equal_2, track.tpcSignal()); aHelium4_reg.fill(HIST("histNClusterTPC"), track.pt() * 2.0, track.tpcNClsFound()); aHelium4_reg.fill(HIST("histNClusterITS"), track.pt() * 2.0, track.itsNCls()); aHelium4_reg.fill(HIST("histNClusterITSib"), track.pt() * 2.0, track.itsNClsInnerBarrel()); @@ -1191,12 +1276,9 @@ struct NucleiHistTask { } Float_t TOFmass2 = ((track.mass()) * (track.mass())); Float_t beta = track.beta(); - aHelium4_reg.fill(HIST("histTOFm2"), track.p() * 2.0, TOFmass2); - aHelium4_reg.fill(HIST("histTOFm2_pT"), track.pt() * 2.0, TOFmass2); - aHelium4_reg.fill(HIST("histTofSignalData"), track.p() * 2.0, beta); - aHelium4_reg.fill(HIST("histTofSignalData_pT"), track.pt() * 2.0, beta); - aHelium4_reg.fill(HIST("histTofNsigmaData"), track.p() * 2.0, track.tofNSigmaAl()); - aHelium4_reg.fill(HIST("histTofNsigmaData_pT"), track.pt() * 2.0, track.tofNSigmaAl()); + aHelium4_reg.fill(HIST("histTOFm2"), momentum_Z_equal_2, TOFmass2); + aHelium4_reg.fill(HIST("histTofSignalData"), momentum_Z_equal_2, beta); + aHelium4_reg.fill(HIST("histTofNsigmaData"), momentum_Z_equal_2, track.tofNSigmaAl()); } } @@ -1212,24 +1294,10 @@ struct NucleiHistTask { if (lastLayer < lastRequiredTrdCluster) continue; } - spectra_reg.fill(HIST("histTofSignalData"), track.p() * 2.0 * track.sign(), track.beta()); - spectra_reg.fill(HIST("histTofSignalData_pT"), track.pt() * 2.0 * track.sign(), track.beta()); + spectra_reg.fill(HIST("histTofSignalData"), momentum_Z_equal_2 * track.sign(), track.beta()); } } } - - pion_reg.fill(HIST("histKeepEventData"), keepEvent_pi); - apion_reg.fill(HIST("histKeepEventData"), keepEvent_antipi); - proton_reg.fill(HIST("histKeepEventData"), keepEvent_p); - aproton_reg.fill(HIST("histKeepEventData"), keepEvent_antip); - deuteron_reg.fill(HIST("histKeepEventData"), keepEvent_d); - adeuteron_reg.fill(HIST("histKeepEventData"), keepEvent_antid); - triton_reg.fill(HIST("histKeepEventData"), keepEvent_t); - atriton_reg.fill(HIST("histKeepEventData"), keepEvent_antit); - Helium3_reg.fill(HIST("histKeepEventData"), keepEvent_He3); - aHelium3_reg.fill(HIST("histKeepEventData"), keepEvent_antiHe3); - Helium4_reg.fill(HIST("histKeepEventData"), keepEvent_He4); - aHelium4_reg.fill(HIST("histKeepEventData"), keepEvent_antiHe4); } //**************************************************************************************************** @@ -1243,11 +1311,61 @@ struct NucleiHistTask { if (!event_selection_sel8) spectra_reg.fill(HIST("histCentrality"), event.centFT0C()); + if (enable_pT_shift_pion_tpc_nSigma) { + Pion_Tpc_nSigma_shift = new TF1("Pion_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtPion; + Pion_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_proton_tpc_nSigma) { + Proton_Tpc_nSigma_shift = new TF1("Proton_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtProton; + Proton_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_deuteron_tpc_nSigma) { + Deuteron_Tpc_nSigma_shift = new TF1("Deuteron_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtDeuteron; + Deuteron_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_triton_tpc_nSigma) { + Triton_Tpc_nSigma_shift = new TF1("Triton_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtTriton; + Triton_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_He3_tpc_nSigma) { + He3_Tpc_nSigma_shift = new TF1("He3_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtHe3; + He3_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_He4_tpc_nSigma) { + He4_Tpc_nSigma_shift = new TF1("He4_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtHe4; + He4_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + for (auto track : tracks) { if ((event_selection_sel8 && !event.sel8()) || (enable_Centrality_cut_global && (event.centFT0C() < minCentrality) && (event.centFT0C() > maxCentrality))) continue; + double momentum = 0.0; + int momentum_getter = 0; + switch (use_momentum_getter) { + case 0: + momentum = track.p(); + break; + case 1: + momentum = track.pt(); + break; + case 2: + momentum = track.tpcInnerParam(); + break; + default: + momentum_getter = -1; + break; + } + if (momentum_getter == -1) + break; + spectra_reg.fill(HIST("histEtaWithOverFlow"), track.eta()); spectra_reg.fill(HIST("histEta_cent"), event.centFT0C(), track.eta()); @@ -1261,8 +1379,33 @@ struct NucleiHistTask { float Chi2perClusterTPC = track.tpcChi2NCl(); float Chi2perClusterITS = track.itsChi2NCl(); - if (TPCnumberClsFound < minTPCnClsFound || TPC_nCls_Crossed_Rows < minNCrossedRowsTPC || RatioCrossedRowsOverFindableTPC < minRatioCrossedRowsTPC || RatioCrossedRowsOverFindableTPC > maxRatioCrossedRowsTPC || Chi2perClusterTPC > maxChi2TPC || Chi2perClusterITS > maxChi2ITS || !(track.passedTPCRefit()) || !(track.passedITSRefit()) || (track.itsNClsInnerBarrel()) < minReqClusterITSib || (track.itsNCls()) < minReqClusterITS) + if (TMath::Abs(track.dcaXY()) > maxDCA_XY || TMath::Abs(track.dcaZ()) > maxDCA_Z) + continue; + if (TPCnumberClsFound < minTPCnClsFound || TPC_nCls_Crossed_Rows < minNCrossedRowsTPC) + continue; + if (RatioCrossedRowsOverFindableTPC < minRatioCrossedRowsTPC || RatioCrossedRowsOverFindableTPC > maxRatioCrossedRowsTPC) + continue; + if (Chi2perClusterTPC > maxChi2PerClusterTPC || Chi2perClusterTPC < minChi2PerClusterTPC || Chi2perClusterITS > maxChi2PerClusterITS) continue; + if (!(track.passedTPCRefit())) + continue; + if (!(track.passedITSRefit())) + continue; + if ((track.itsNClsInnerBarrel()) < minReqClusterITSib || (track.itsNCls()) < minReqClusterITS) + continue; + if (track.pt() < p_min || track.pt() > p_max) + continue; + if ((requireITS && !(track.hasITS())) || (requireTPC && !(track.hasTPC()))) + continue; + if (requireGoldenChi2 && !(track.passedGoldenChi2())) + continue; + + float nSigmaPion = track.tpcNSigmaPi(); + float nSigmaProton = track.tpcNSigmaPr(); + float nSigmaDeut = track.tpcNSigmaDe(); + float nSigmaTriton = track.tpcNSigmaTr(); + float nSigmaHe3 = track.tpcNSigmaHe(); + float nSigmaHe4 = track.tpcNSigmaAl(); TLorentzVector lorentzVector_pion{}; TLorentzVector lorentzVector_proton{}; @@ -1286,22 +1429,61 @@ struct NucleiHistTask { lorentzVector_He4.Rapidity() < yMin || lorentzVector_He4.Rapidity() > yMax) continue; + int binIndex = getBinIndex(ptBinning, momentum); + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Pi.value.size())) + nSigmaPion += Tpc_mSigma_shift_Pi.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Pr.value.size())) + nSigmaProton += Tpc_mSigma_shift_Pr.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_De.value.size())) + nSigmaDeut += Tpc_mSigma_shift_De.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Tr.value.size())) + nSigmaTriton += Tpc_mSigma_shift_Tr.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_He3.value.size())) + nSigmaHe3 += Tpc_mSigma_shift_He3.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Al.value.size())) + nSigmaHe4 += Tpc_mSigma_shift_Al.value[binIndex]; + + if (enable_pT_shift_pion_tpc_nSigma) { + float nSigmaPion_shift = Pion_Tpc_nSigma_shift->Eval(momentum); + nSigmaPion -= nSigmaPion_shift; + } + if (enable_pT_shift_proton_tpc_nSigma) { + float nSigmaProton_shift = Proton_Tpc_nSigma_shift->Eval(momentum); + nSigmaProton -= nSigmaProton_shift; + } + if (enable_pT_shift_deuteron_tpc_nSigma) { + float nSigmaDeuteron_shift = Deuteron_Tpc_nSigma_shift->Eval(momentum); + nSigmaDeut -= nSigmaDeuteron_shift; + } + if (enable_pT_shift_triton_tpc_nSigma) { + float nSigmaTriton_shift = Triton_Tpc_nSigma_shift->Eval(momentum); + nSigmaTriton -= nSigmaTriton_shift; + } + if (enable_pT_shift_He3_tpc_nSigma) { + float nSigmaHe3_shift = He3_Tpc_nSigma_shift->Eval(momentum); + nSigmaHe3 -= nSigmaHe3_shift; + } + if (enable_pT_shift_He4_tpc_nSigma) { + float nSigmaHe4_shift = He4_Tpc_nSigma_shift->Eval(momentum); + nSigmaHe4 -= nSigmaHe4_shift; + } + if (track.sign() > 0) { - pion_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt(), track.tpcNSigmaPi(), event.centFT0C()); - proton_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt(), track.tpcNSigmaPr(), event.centFT0C()); - deuteron_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt(), track.tpcNSigmaDe(), event.centFT0C()); - triton_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt(), track.tpcNSigmaTr(), event.centFT0C()); - Helium3_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt() * 2.0, track.tpcNSigmaHe(), event.centFT0C()); - Helium4_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt() * 2.0, track.tpcNSigmaAl(), event.centFT0C()); + pion_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, nSigmaPion, event.centFT0C()); + proton_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, nSigmaProton, event.centFT0C()); + deuteron_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, nSigmaDeut, event.centFT0C()); + triton_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, nSigmaTriton, event.centFT0C()); + Helium3_reg.fill(HIST("histTpcNsigmaData_cent"), momentum * 2.0, nSigmaHe3, event.centFT0C()); + Helium4_reg.fill(HIST("histTpcNsigmaData_cent"), momentum * 2.0, nSigmaHe4, event.centFT0C()); if ((event.centFT0C() > minCentrality) && (event.centFT0C() < maxCentrality)) { - pion_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt(), track.tpcNSigmaPi(), track.eta()); - proton_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt(), track.tpcNSigmaPr(), track.eta()); - deuteron_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt(), track.tpcNSigmaDe(), track.eta()); - triton_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt(), track.tpcNSigmaTr(), track.eta()); - Helium3_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt() * 2.0, track.tpcNSigmaHe(), track.eta()); - Helium4_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt() * 2.0, track.tpcNSigmaAl(), track.eta()); + pion_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, nSigmaPion, track.eta()); + proton_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, nSigmaProton, track.eta()); + deuteron_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, nSigmaDeut, track.eta()); + triton_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, nSigmaTriton, track.eta()); + Helium3_reg.fill(HIST("histTpcNsigmaData_eta"), momentum * 2.0, nSigmaHe3, track.eta()); + Helium4_reg.fill(HIST("histTpcNsigmaData_eta"), momentum * 2.0, nSigmaHe4, track.eta()); } if (track.hasTOF()) { @@ -1316,54 +1498,53 @@ struct NucleiHistTask { if (lastLayer < lastRequiredTrdCluster) continue; } - - pion_reg.fill(HIST("histTofNsigmaData_cent"), track.pt(), track.tofNSigmaPi(), event.centFT0C()); - proton_reg.fill(HIST("histTofNsigmaData_cent"), track.pt(), track.tofNSigmaPr(), event.centFT0C()); - deuteron_reg.fill(HIST("histTofNsigmaData_cent"), track.pt(), track.tofNSigmaDe(), event.centFT0C()); - triton_reg.fill(HIST("histTofNsigmaData_cent"), track.pt(), track.tofNSigmaTr(), event.centFT0C()); - Helium3_reg.fill(HIST("histTofNsigmaData_cent"), track.pt() * 2.0, track.tofNSigmaHe(), event.centFT0C()); - Helium4_reg.fill(HIST("histTofNsigmaData_cent"), track.pt() * 2.0, track.tofNSigmaAl(), event.centFT0C()); - - pion_reg.fill(HIST("histTofm2_cent"), track.pt(), track.mass() * track.mass(), event.centFT0C()); - proton_reg.fill(HIST("histTofm2_cent"), track.pt(), track.mass() * track.mass(), event.centFT0C()); - deuteron_reg.fill(HIST("histTofm2_cent"), track.pt(), track.mass() * track.mass(), event.centFT0C()); - triton_reg.fill(HIST("histTofm2_cent"), track.pt(), track.mass() * track.mass(), event.centFT0C()); - Helium3_reg.fill(HIST("histTofm2_cent"), track.pt() * 2.0, track.mass() * track.mass(), event.centFT0C()); - Helium4_reg.fill(HIST("histTofm2_cent"), track.pt() * 2.0, track.mass() * track.mass(), event.centFT0C()); + pion_reg.fill(HIST("histTofNsigmaData_cent"), momentum, track.tofNSigmaPi(), event.centFT0C()); + proton_reg.fill(HIST("histTofNsigmaData_cent"), momentum, track.tofNSigmaPr(), event.centFT0C()); + deuteron_reg.fill(HIST("histTofNsigmaData_cent"), momentum, track.tofNSigmaDe(), event.centFT0C()); + triton_reg.fill(HIST("histTofNsigmaData_cent"), momentum, track.tofNSigmaTr(), event.centFT0C()); + Helium3_reg.fill(HIST("histTofNsigmaData_cent"), momentum * 2.0, track.tofNSigmaHe(), event.centFT0C()); + Helium4_reg.fill(HIST("histTofNsigmaData_cent"), momentum * 2.0, track.tofNSigmaAl(), event.centFT0C()); + + pion_reg.fill(HIST("histTofm2_cent"), momentum, track.mass() * track.mass(), event.centFT0C()); + proton_reg.fill(HIST("histTofm2_cent"), momentum, track.mass() * track.mass(), event.centFT0C()); + deuteron_reg.fill(HIST("histTofm2_cent"), momentum, track.mass() * track.mass(), event.centFT0C()); + triton_reg.fill(HIST("histTofm2_cent"), momentum, track.mass() * track.mass(), event.centFT0C()); + Helium3_reg.fill(HIST("histTofm2_cent"), momentum * 2.0, track.mass() * track.mass(), event.centFT0C()); + Helium4_reg.fill(HIST("histTofm2_cent"), momentum * 2.0, track.mass() * track.mass(), event.centFT0C()); if ((event.centFT0C() > minCentrality) && (event.centFT0C() < maxCentrality)) { - pion_reg.fill(HIST("histTofm2_eta"), track.pt(), track.mass() * track.mass(), track.eta()); - pion_reg.fill(HIST("histTofNsigmaData_eta"), track.pt(), track.tofNSigmaPi(), track.eta()); - proton_reg.fill(HIST("histTofm2_eta"), track.pt(), track.mass() * track.mass(), track.eta()); - proton_reg.fill(HIST("histTofNsigmaData_eta"), track.pt(), track.tofNSigmaPr(), track.eta()); - deuteron_reg.fill(HIST("histTofm2_eta"), track.pt(), track.mass() * track.mass(), track.eta()); - deuteron_reg.fill(HIST("histTofNsigmaData_eta"), track.pt(), track.tofNSigmaDe(), track.eta()); - triton_reg.fill(HIST("histTofm2_eta"), track.pt(), track.mass() * track.mass(), track.eta()); - triton_reg.fill(HIST("histTofNsigmaData_eta"), track.pt(), track.tofNSigmaTr(), track.eta()); - Helium3_reg.fill(HIST("histTofm2_eta"), track.pt() * 2.0, track.mass() * track.mass(), track.eta()); - Helium3_reg.fill(HIST("histTofNsigmaData_eta"), track.pt() * 2.0, track.tofNSigmaHe(), track.eta()); - Helium4_reg.fill(HIST("histTofm2_eta"), track.pt() * 2.0, track.mass() * track.mass(), track.eta()); - Helium4_reg.fill(HIST("histTofNsigmaData_eta"), track.pt() * 2.0, track.tofNSigmaAl(), track.eta()); + pion_reg.fill(HIST("histTofm2_eta"), momentum, track.mass() * track.mass(), track.eta()); + pion_reg.fill(HIST("histTofNsigmaData_eta"), momentum, track.tofNSigmaPi(), track.eta()); + proton_reg.fill(HIST("histTofm2_eta"), momentum, track.mass() * track.mass(), track.eta()); + proton_reg.fill(HIST("histTofNsigmaData_eta"), momentum, track.tofNSigmaPr(), track.eta()); + deuteron_reg.fill(HIST("histTofm2_eta"), momentum, track.mass() * track.mass(), track.eta()); + deuteron_reg.fill(HIST("histTofNsigmaData_eta"), momentum, track.tofNSigmaDe(), track.eta()); + triton_reg.fill(HIST("histTofm2_eta"), momentum, track.mass() * track.mass(), track.eta()); + triton_reg.fill(HIST("histTofNsigmaData_eta"), momentum, track.tofNSigmaTr(), track.eta()); + Helium3_reg.fill(HIST("histTofm2_eta"), momentum * 2.0, track.mass() * track.mass(), track.eta()); + Helium3_reg.fill(HIST("histTofNsigmaData_eta"), momentum * 2.0, track.tofNSigmaHe(), track.eta()); + Helium4_reg.fill(HIST("histTofm2_eta"), momentum * 2.0, track.mass() * track.mass(), track.eta()); + Helium4_reg.fill(HIST("histTofNsigmaData_eta"), momentum * 2.0, track.tofNSigmaAl(), track.eta()); } } } if (track.sign() < 0) { - apion_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt(), track.tpcNSigmaPi(), event.centFT0C()); - aproton_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt(), track.tpcNSigmaPr(), event.centFT0C()); - adeuteron_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt(), track.tpcNSigmaDe(), event.centFT0C()); - atriton_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt(), track.tpcNSigmaTr(), event.centFT0C()); - aHelium3_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt() * 2.0, track.tpcNSigmaHe(), event.centFT0C()); - aHelium4_reg.fill(HIST("histTpcNsigmaData_cent"), track.pt() * 2.0, track.tpcNSigmaAl(), event.centFT0C()); + apion_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, nSigmaPion, event.centFT0C()); + aproton_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, nSigmaProton, event.centFT0C()); + adeuteron_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, nSigmaDeut, event.centFT0C()); + atriton_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, nSigmaTriton, event.centFT0C()); + aHelium3_reg.fill(HIST("histTpcNsigmaData_cent"), momentum * 2.0, nSigmaHe3, event.centFT0C()); + aHelium4_reg.fill(HIST("histTpcNsigmaData_cent"), momentum * 2.0, nSigmaHe4, event.centFT0C()); if ((event.centFT0C() > minCentrality) && (event.centFT0C() < maxCentrality)) { - apion_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt(), track.tpcNSigmaPi(), track.eta()); - aproton_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt(), track.tpcNSigmaPr(), track.eta()); - adeuteron_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt(), track.tpcNSigmaDe(), track.eta()); - atriton_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt(), track.tpcNSigmaTr(), track.eta()); - aHelium3_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt() * 2.0, track.tpcNSigmaHe(), track.eta()); - aHelium4_reg.fill(HIST("histTpcNsigmaData_eta"), track.pt() * 2.0, track.tpcNSigmaAl(), track.eta()); + apion_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, nSigmaPion, track.eta()); + aproton_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, nSigmaProton, track.eta()); + adeuteron_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, nSigmaDeut, track.eta()); + atriton_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, nSigmaTriton, track.eta()); + aHelium3_reg.fill(HIST("histTpcNsigmaData_eta"), momentum * 2.0, nSigmaHe3, track.eta()); + aHelium4_reg.fill(HIST("histTpcNsigmaData_eta"), momentum * 2.0, nSigmaHe4, track.eta()); } if (track.hasTOF()) { @@ -1378,34 +1559,33 @@ struct NucleiHistTask { if (lastLayer < lastRequiredTrdCluster) continue; } - - apion_reg.fill(HIST("histTofNsigmaData_cent"), track.pt(), track.tofNSigmaPi(), event.centFT0C()); - aproton_reg.fill(HIST("histTofNsigmaData_cent"), track.pt(), track.tofNSigmaPr(), event.centFT0C()); - adeuteron_reg.fill(HIST("histTofNsigmaData_cent"), track.pt(), track.tofNSigmaDe(), event.centFT0C()); - atriton_reg.fill(HIST("histTofNsigmaData_cent"), track.pt(), track.tofNSigmaTr(), event.centFT0C()); - aHelium3_reg.fill(HIST("histTofNsigmaData_cent"), track.pt() * 2.0, track.tofNSigmaHe(), event.centFT0C()); - aHelium4_reg.fill(HIST("histTofNsigmaData_cent"), track.pt() * 2.0, track.tofNSigmaAl(), event.centFT0C()); - - apion_reg.fill(HIST("histTofm2_cent"), track.pt(), track.mass() * track.mass(), event.centFT0C()); - aproton_reg.fill(HIST("histTofm2_cent"), track.pt(), track.mass() * track.mass(), event.centFT0C()); - adeuteron_reg.fill(HIST("histTofm2_cent"), track.pt(), track.mass() * track.mass(), event.centFT0C()); - atriton_reg.fill(HIST("histTofm2_cent"), track.pt(), track.mass() * track.mass(), event.centFT0C()); - aHelium3_reg.fill(HIST("histTofm2_cent"), track.pt() * 2.0, track.mass() * track.mass(), event.centFT0C()); - aHelium4_reg.fill(HIST("histTofm2_cent"), track.pt() * 2.0, track.mass() * track.mass(), event.centFT0C()); + apion_reg.fill(HIST("histTofNsigmaData_cent"), momentum, track.tofNSigmaPi(), event.centFT0C()); + aproton_reg.fill(HIST("histTofNsigmaData_cent"), momentum, track.tofNSigmaPr(), event.centFT0C()); + adeuteron_reg.fill(HIST("histTofNsigmaData_cent"), momentum, track.tofNSigmaDe(), event.centFT0C()); + atriton_reg.fill(HIST("histTofNsigmaData_cent"), momentum, track.tofNSigmaTr(), event.centFT0C()); + aHelium3_reg.fill(HIST("histTofNsigmaData_cent"), momentum * 2.0, track.tofNSigmaHe(), event.centFT0C()); + aHelium4_reg.fill(HIST("histTofNsigmaData_cent"), momentum * 2.0, track.tofNSigmaAl(), event.centFT0C()); + + apion_reg.fill(HIST("histTofm2_cent"), momentum, track.mass() * track.mass(), event.centFT0C()); + aproton_reg.fill(HIST("histTofm2_cent"), momentum, track.mass() * track.mass(), event.centFT0C()); + adeuteron_reg.fill(HIST("histTofm2_cent"), momentum, track.mass() * track.mass(), event.centFT0C()); + atriton_reg.fill(HIST("histTofm2_cent"), momentum, track.mass() * track.mass(), event.centFT0C()); + aHelium3_reg.fill(HIST("histTofm2_cent"), momentum * 2.0, track.mass() * track.mass(), event.centFT0C()); + aHelium4_reg.fill(HIST("histTofm2_cent"), momentum * 2.0, track.mass() * track.mass(), event.centFT0C()); if ((event.centFT0C() > minCentrality) && (event.centFT0C() < maxCentrality)) { - apion_reg.fill(HIST("histTofm2_eta"), track.pt(), track.mass() * track.mass(), track.eta()); - apion_reg.fill(HIST("histTofNsigmaData_eta"), track.pt(), track.tofNSigmaPi(), track.eta()); - aproton_reg.fill(HIST("histTofm2_eta"), track.pt(), track.mass() * track.mass(), track.eta()); - aproton_reg.fill(HIST("histTofNsigmaData_eta"), track.pt(), track.tofNSigmaPr(), track.eta()); - adeuteron_reg.fill(HIST("histTofm2_eta"), track.pt(), track.mass() * track.mass(), track.eta()); - adeuteron_reg.fill(HIST("histTofNsigmaData_eta"), track.pt(), track.tofNSigmaDe(), track.eta()); - atriton_reg.fill(HIST("histTofm2_eta"), track.pt(), track.mass() * track.mass(), track.eta()); - atriton_reg.fill(HIST("histTofNsigmaData_eta"), track.pt(), track.tofNSigmaTr(), track.eta()); - aHelium3_reg.fill(HIST("histTofm2_eta"), track.pt() * 2.0, track.mass() * track.mass(), track.eta()); - aHelium3_reg.fill(HIST("histTofNsigmaData_eta"), track.pt() * 2.0, track.tofNSigmaHe(), track.eta()); - aHelium4_reg.fill(HIST("histTofm2_eta"), track.pt() * 2.0, track.mass() * track.mass(), track.eta()); - aHelium4_reg.fill(HIST("histTofNsigmaData_eta"), track.pt() * 2.0, track.tofNSigmaAl(), track.eta()); + apion_reg.fill(HIST("histTofm2_eta"), momentum, track.mass() * track.mass(), track.eta()); + apion_reg.fill(HIST("histTofNsigmaData_eta"), momentum, track.tofNSigmaPi(), track.eta()); + aproton_reg.fill(HIST("histTofm2_eta"), momentum, track.mass() * track.mass(), track.eta()); + aproton_reg.fill(HIST("histTofNsigmaData_eta"), momentum, track.tofNSigmaPr(), track.eta()); + adeuteron_reg.fill(HIST("histTofm2_eta"), momentum, track.mass() * track.mass(), track.eta()); + adeuteron_reg.fill(HIST("histTofNsigmaData_eta"), momentum, track.tofNSigmaDe(), track.eta()); + atriton_reg.fill(HIST("histTofm2_eta"), momentum, track.mass() * track.mass(), track.eta()); + atriton_reg.fill(HIST("histTofNsigmaData_eta"), momentum, track.tofNSigmaTr(), track.eta()); + aHelium3_reg.fill(HIST("histTofm2_eta"), momentum * 2.0, track.mass() * track.mass(), track.eta()); + aHelium3_reg.fill(HIST("histTofNsigmaData_eta"), momentum * 2.0, track.tofNSigmaHe(), track.eta()); + aHelium4_reg.fill(HIST("histTofm2_eta"), momentum * 2.0, track.mass() * track.mass(), track.eta()); + aHelium4_reg.fill(HIST("histTofNsigmaData_eta"), momentum * 2.0, track.tofNSigmaAl(), track.eta()); } } } @@ -1436,8 +1616,94 @@ struct NucleiHistTask { } PROCESS_SWITCH(NucleiHistTask, processDataCent, "process data with centralities", false); - void processMC(soa::Join::iterator const& collisions, soa::Filtered> const& tracks, - aod::McParticles& /*mcParticles*/, aod::McCollisions const& /*mcCollisions*/) + void processMCgen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) + { + MC_gen_reg.fill(HIST("histRecVtxMC"), mcCollision.posZ()); + MC_gen_reg.fill(HIST("histCentrality"), mcCollision.impactParameter()); + + for (const auto& mcParticleGen : mcParticles) { + if (require_PhysicalPrimary_MC_gen && !mcParticleGen.isPhysicalPrimary()) + continue; + int pdgCode = mcParticleGen.pdgCode(); + + if (mcParticleGen.y() > yMax || mcParticleGen.y() < yMin) + continue; + if (mcParticleGen.eta() > cfgCutEta || mcParticleGen.eta() < -cfgCutEta) + continue; + + int pdgbin = 0; + switch (pdgCode) { + case +211: + histPDG_gen->AddBinContent(1); + pdgbin = 0; + break; + case -211: + histPDG_gen->AddBinContent(2); + pdgbin = 1; + break; + case +321: + histPDG_gen->AddBinContent(3); + pdgbin = 2; + break; + case -321: + histPDG_gen->AddBinContent(4); + pdgbin = 3; + break; + case +2212: + histPDG_gen->AddBinContent(5); + pdgbin = 4; + break; + case -2212: + histPDG_gen->AddBinContent(6); + pdgbin = 5; + break; + case +1000010020: + histPDG_gen->AddBinContent(7); + pdgbin = 6; + break; + case -1000010020: + histPDG_gen->AddBinContent(8); + pdgbin = 7; + break; + case +1000010030: + histPDG_gen->AddBinContent(9); + pdgbin = 8; + break; + case -1000010030: + histPDG_gen->AddBinContent(10); + pdgbin = 9; + break; + case +1000020030: + histPDG_gen->AddBinContent(11); + pdgbin = 10; + break; + case -1000020030: + histPDG_gen->AddBinContent(12); + pdgbin = 11; + break; + case +1000020040: + histPDG_gen->AddBinContent(13); + pdgbin = 12; + break; + case -1000020040: + histPDG_gen->AddBinContent(14); + pdgbin = 13; + break; + default: + break; + } + MC_gen_reg.fill(HIST("histEta"), mcParticleGen.eta(), pdgbin); + if ((pdgCode == 1000020030) || (pdgCode == -1000020030) || (pdgCode == 1000020040) || (pdgCode == -1000020040)) { + MC_gen_reg.fill(HIST("histPt"), mcParticleGen.pt() * 2.0, pdgbin); + } else { + MC_gen_reg.fill(HIST("histPt"), mcParticleGen.pt(), pdgbin); + } + } + } + PROCESS_SWITCH(NucleiHistTask, processMCgen, "process generated MC", false); + + void processMCreco(soa::Join::iterator const& collisions, soa::Filtered> const& tracks, + aod::McParticles& /*mcParticles*/, aod::McCollisions const& /*mcCollisions*/) { if (event_selection_MC_sel8 && !collisions.sel8()) @@ -1445,67 +1711,83 @@ struct NucleiHistTask { MC_recon_reg.fill(HIST("histRecVtxMC"), collisions.posZ()); MC_recon_reg.fill(HIST("histCentrality"), collisions.centFT0C()); + if (enable_pT_shift_pion_tpc_nSigma) { + Pion_Tpc_nSigma_shift = new TF1("Pion_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtPion; + Pion_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_proton_tpc_nSigma) { + Proton_Tpc_nSigma_shift = new TF1("Proton_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtProton; + Proton_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_deuteron_tpc_nSigma) { + Deuteron_Tpc_nSigma_shift = new TF1("Deuteron_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtDeuteron; + Deuteron_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_triton_tpc_nSigma) { + Triton_Tpc_nSigma_shift = new TF1("Triton_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtTriton; + Triton_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_He3_tpc_nSigma) { + He3_Tpc_nSigma_shift = new TF1("He3_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtHe3; + He3_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + if (enable_pT_shift_He4_tpc_nSigma) { + He4_Tpc_nSigma_shift = new TF1("He4_Tpc_nSigma_shift", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x + [5] * x * x", 0.f, 14.f); + auto par = (std::vector)parShiftPtHe4; + He4_Tpc_nSigma_shift->SetParameters(par[0], par[1], par[2], par[3], par[4], par[5]); + } + for (auto& track : tracks) { + histTrackcuts_MC->AddBinContent(1); const auto particle = track.mcParticle(); - if (!particle.isPhysicalPrimary()) - continue; int pdgbin = 0; switch (particle.pdgCode()) { case +211: - histPDG->AddBinContent(1); pdgbin = 0; break; case -211: - histPDG->AddBinContent(2); pdgbin = 1; break; case +321: - histPDG->AddBinContent(3); pdgbin = 2; break; case -321: - histPDG->AddBinContent(4); pdgbin = 3; break; case +2212: - histPDG->AddBinContent(5); pdgbin = 4; break; case -2212: - histPDG->AddBinContent(6); pdgbin = 5; break; case +1000010020: - histPDG->AddBinContent(7); pdgbin = 6; break; case -1000010020: - histPDG->AddBinContent(8); pdgbin = 7; break; case +1000010030: - histPDG->AddBinContent(9); pdgbin = 8; break; case -1000010030: - histPDG->AddBinContent(10); pdgbin = 9; break; case +1000020030: - histPDG->AddBinContent(11); pdgbin = 10; break; case -1000020030: - histPDG->AddBinContent(12); pdgbin = 11; break; case +1000020040: - histPDG->AddBinContent(13); pdgbin = 12; break; case -1000020040: - histPDG->AddBinContent(14); pdgbin = 13; break; default: @@ -1513,6 +1795,102 @@ struct NucleiHistTask { break; } + if (particle.isPhysicalPrimary()) { + if ((particle.pdgCode() == 1000020030) || (particle.pdgCode() == -1000020030) || (particle.pdgCode() == 1000020040) || (particle.pdgCode() == -1000020040)) { + MC_DCA.fill(HIST("histDCA_prim"), track.pt() * 2.0, track.dcaXY(), pdgbin); + MC_DCA.fill(HIST("histDCAz_prim"), track.pt() * 2.0, track.dcaZ(), pdgbin); + } else { + MC_DCA.fill(HIST("histDCA_prim"), track.pt(), track.dcaXY(), pdgbin); + MC_DCA.fill(HIST("histDCAz_prim"), track.pt(), track.dcaZ(), pdgbin); + } + } else if (particle.has_mothers()) { + if ((particle.pdgCode() == 1000020030) || (particle.pdgCode() == -1000020030) || (particle.pdgCode() == 1000020040) || (particle.pdgCode() == -1000020040)) { + MC_DCA.fill(HIST("histDCA_weak"), track.pt() * 2.0, track.dcaXY(), pdgbin); + MC_DCA.fill(HIST("histDCAz_weak"), track.pt() * 2.0, track.dcaZ(), pdgbin); + } else { + MC_DCA.fill(HIST("histDCA_weak"), track.pt(), track.dcaXY(), pdgbin); + MC_DCA.fill(HIST("histDCAz_weak"), track.pt(), track.dcaZ(), pdgbin); + } + } else { + if ((particle.pdgCode() == 1000020030) || (particle.pdgCode() == -1000020030) || (particle.pdgCode() == 1000020040) || (particle.pdgCode() == -1000020040)) { + MC_DCA.fill(HIST("histDCA_mat"), track.pt() * 2.0, track.dcaXY(), pdgbin); + MC_DCA.fill(HIST("histDCAz_mat"), track.pt() * 2.0, track.dcaZ(), pdgbin); + } else { + MC_DCA.fill(HIST("histDCA_mat"), track.pt(), track.dcaXY(), pdgbin); + MC_DCA.fill(HIST("histDCAz_mat"), track.pt(), track.dcaZ(), pdgbin); + } + } + + if (!particle.isPhysicalPrimary()) + continue; + histTrackcuts_MC->AddBinContent(2); + + switch (particle.pdgCode()) { + case +211: + histPDG_reco->AddBinContent(1); + break; + case -211: + histPDG_reco->AddBinContent(2); + break; + case +321: + histPDG_reco->AddBinContent(3); + break; + case -321: + histPDG_reco->AddBinContent(4); + break; + case +2212: + histPDG_reco->AddBinContent(5); + break; + case -2212: + histPDG_reco->AddBinContent(6); + break; + case +1000010020: + histPDG_reco->AddBinContent(7); + break; + case -1000010020: + histPDG_reco->AddBinContent(8); + break; + case +1000010030: + histPDG_reco->AddBinContent(9); + break; + case -1000010030: + histPDG_reco->AddBinContent(10); + break; + case +1000020030: + histPDG_reco->AddBinContent(11); + break; + case -1000020030: + histPDG_reco->AddBinContent(12); + break; + case +1000020040: + histPDG_reco->AddBinContent(13); + break; + case -1000020040: + histPDG_reco->AddBinContent(14); + break; + default: + break; + } + + double momentum = 0.0; + int momentum_getter = 0; + switch (use_momentum_getter) { + case 0: + momentum = track.p(); + break; + case 1: + momentum = track.pt(); + break; + case 2: + momentum = track.tpcInnerParam(); + break; + default: + momentum_getter = -1; + break; + } + if (momentum_getter == -1) + break; + TLorentzVector lorentzVector_pion{}; TLorentzVector lorentzVector_kaon{}; TLorentzVector lorentzVector_proton{}; @@ -1537,6 +1915,7 @@ struct NucleiHistTask { lorentzVector_He3.Rapidity() < yMin || lorentzVector_He3.Rapidity() > yMax || lorentzVector_He4.Rapidity() < yMin || lorentzVector_He4.Rapidity() > yMax) continue; + histTrackcuts_MC->AddBinContent(3); MC_recon_reg.fill(HIST("histEta"), track.eta(), pdgbin); @@ -1544,9 +1923,8 @@ struct NucleiHistTask { MC_recon_reg.fill(HIST("histPt"), track.pt() * 2.0, pdgbin); MC_recon_reg.fill(HIST("histDCA"), track.pt() * 2.0, track.dcaXY(), pdgbin); MC_recon_reg.fill(HIST("histDCAz"), track.pt() * 2.0, track.dcaZ(), pdgbin); - MC_recon_reg.fill(HIST("histTpcSignalData"), track.p() * 2.0 * track.sign(), track.tpcSignal(), pdgbin); - MC_recon_reg.fill(HIST("histTpcSignalData_pT"), track.pt() * 2.0 * track.sign(), track.tpcSignal(), pdgbin); - MC_recon_reg.fill(HIST("histTpcSignalData_all_species"), track.pt() * 2.0 * track.sign(), track.tpcSignal()); + MC_recon_reg.fill(HIST("histTpcSignalData"), momentum * 2.0 * track.sign(), track.tpcSignal(), pdgbin); + MC_recon_reg.fill(HIST("histTpcSignalData_all_species"), momentum * 2.0 * track.sign(), track.tpcSignal()); MC_recon_reg.fill(HIST("histNClusterTPC"), track.pt() * 2.0, track.tpcNClsCrossedRows(), pdgbin); MC_recon_reg.fill(HIST("histNClusterITS"), track.pt() * 2.0, track.itsNCls(), pdgbin); MC_recon_reg.fill(HIST("histNClusterITSib"), track.pt() * 2.0, track.itsNClsInnerBarrel(), pdgbin); @@ -1557,9 +1935,8 @@ struct NucleiHistTask { MC_recon_reg.fill(HIST("histPt"), track.pt(), pdgbin); MC_recon_reg.fill(HIST("histDCA"), track.pt(), track.dcaXY(), pdgbin); MC_recon_reg.fill(HIST("histDCAz"), track.pt(), track.dcaZ(), pdgbin); - MC_recon_reg.fill(HIST("histTpcSignalData"), track.p() * track.sign(), track.tpcSignal(), pdgbin); - MC_recon_reg.fill(HIST("histTpcSignalData_pT"), track.pt() * track.sign(), track.tpcSignal(), pdgbin); - MC_recon_reg.fill(HIST("histTpcSignalData_all_species"), track.pt() * track.sign(), track.tpcSignal()); + MC_recon_reg.fill(HIST("histTpcSignalData"), momentum * track.sign(), track.tpcSignal(), pdgbin); + MC_recon_reg.fill(HIST("histTpcSignalData_all_species"), momentum * track.sign(), track.tpcSignal()); MC_recon_reg.fill(HIST("histNClusterTPC"), track.pt(), track.tpcNClsCrossedRows(), pdgbin); MC_recon_reg.fill(HIST("histNClusterITS"), track.pt(), track.itsNCls(), pdgbin); MC_recon_reg.fill(HIST("histNClusterITSib"), track.pt(), track.itsNClsInnerBarrel(), pdgbin); @@ -1574,8 +1951,37 @@ struct NucleiHistTask { float Chi2perClusterTPC = track.tpcChi2NCl(); float Chi2perClusterITS = track.itsChi2NCl(); - if (TPCnumberClsFound < minTPCnClsFound || TPC_nCls_Crossed_Rows < minNCrossedRowsTPC || RatioCrossedRowsOverFindableTPC < minRatioCrossedRowsTPC || RatioCrossedRowsOverFindableTPC > maxRatioCrossedRowsTPC || Chi2perClusterTPC > maxChi2TPC || Chi2perClusterITS > maxChi2ITS || !(track.passedTPCRefit()) || !(track.passedITSRefit()) || (track.itsNClsInnerBarrel()) < minReqClusterITSib || (track.itsNCls()) < minReqClusterITS || TMath::Abs(track.dcaXY()) > maxDCA_XY || TMath::Abs(track.dcaZ()) > maxDCA_Z) + if (TMath::Abs(track.dcaXY()) > maxDCA_XY || TMath::Abs(track.dcaZ()) > maxDCA_Z) + continue; + histTrackcuts_MC->AddBinContent(4); + if (TPCnumberClsFound < minTPCnClsFound || TPC_nCls_Crossed_Rows < minNCrossedRowsTPC) + continue; + histTrackcuts_MC->AddBinContent(5); + if (RatioCrossedRowsOverFindableTPC < minRatioCrossedRowsTPC || RatioCrossedRowsOverFindableTPC > maxRatioCrossedRowsTPC) + continue; + histTrackcuts_MC->AddBinContent(6); + if (Chi2perClusterTPC > maxChi2PerClusterTPC || Chi2perClusterTPC < minChi2PerClusterTPC || Chi2perClusterITS > maxChi2PerClusterITS) + continue; + histTrackcuts_MC->AddBinContent(7); + if (!(track.passedTPCRefit())) continue; + histTrackcuts_MC->AddBinContent(8); + if (!(track.passedITSRefit())) + continue; + histTrackcuts_MC->AddBinContent(9); + if ((track.itsNClsInnerBarrel()) < minReqClusterITSib || (track.itsNCls()) < minReqClusterITS) + continue; + histTrackcuts_MC->AddBinContent(10); + if (track.pt() < p_min || track.pt() > p_max) + continue; + histTrackcuts_MC->AddBinContent(11); + + if ((requireITS && !(track.hasITS())) || (requireTPC && !(track.hasTPC()))) + continue; + histTrackcuts_MC->AddBinContent(12); + if (requireGoldenChi2 && !(track.passedGoldenChi2())) + continue; + histTrackcuts_MC->AddBinContent(13); float nSigmaPion = track.tpcNSigmaPi(); float nSigmaProton = track.tpcNSigmaPr(); @@ -1584,88 +1990,101 @@ struct NucleiHistTask { float nSigmaHe3 = track.tpcNSigmaHe(); float nSigmaHe4 = track.tpcNSigmaAl(); + int binIndex = getBinIndex(ptBinning, momentum); + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Pi.value.size())) + nSigmaPion += Tpc_mSigma_shift_Pi.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Pr.value.size())) + nSigmaProton += Tpc_mSigma_shift_Pr.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_De.value.size())) + nSigmaDeuteron += Tpc_mSigma_shift_De.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Tr.value.size())) + nSigmaTriton += Tpc_mSigma_shift_Tr.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_He3.value.size())) + nSigmaHe3 += Tpc_mSigma_shift_He3.value[binIndex]; + if (binIndex >= 0 && binIndex < static_cast(Tpc_mSigma_shift_Al.value.size())) + nSigmaHe4 += Tpc_mSigma_shift_Al.value[binIndex]; + + if (enable_pT_shift_pion_tpc_nSigma) { + float nSigmaPion_shift = Pion_Tpc_nSigma_shift->Eval(momentum); + nSigmaPion -= nSigmaPion_shift; + } + if (enable_pT_shift_proton_tpc_nSigma) { + float nSigmaProton_shift = Proton_Tpc_nSigma_shift->Eval(momentum); + nSigmaProton -= nSigmaProton_shift; + } + if (enable_pT_shift_deuteron_tpc_nSigma) { + float nSigmaDeuteron_shift = Deuteron_Tpc_nSigma_shift->Eval(momentum); + nSigmaDeuteron -= nSigmaDeuteron_shift; + } + if (enable_pT_shift_triton_tpc_nSigma) { + float nSigmaTriton_shift = Triton_Tpc_nSigma_shift->Eval(momentum); + nSigmaTriton -= nSigmaTriton_shift; + } + if (enable_pT_shift_He3_tpc_nSigma) { + float nSigmaHe3_shift = He3_Tpc_nSigma_shift->Eval(momentum); + nSigmaHe3 -= nSigmaHe3_shift; + } + if (enable_pT_shift_He4_tpc_nSigma) { + float nSigmaHe4_shift = He4_Tpc_nSigma_shift->Eval(momentum); + nSigmaHe4 -= nSigmaHe4_shift; + } + if (track.sign() > 0) { - MC_recon_reg.fill(HIST("histTpcNsigmaDataPi"), track.p(), nSigmaPion); - MC_recon_reg.fill(HIST("histTpcNsigmaDataPr"), track.p(), nSigmaProton); - MC_recon_reg.fill(HIST("histTpcNsigmaDataDe"), track.p(), nSigmaDeuteron); - MC_recon_reg.fill(HIST("histTpcNsigmaDataTr"), track.p(), nSigmaTriton); - MC_recon_reg.fill(HIST("histTpcNsigmaDataHe"), track.p() * 2.0, nSigmaHe3); - MC_recon_reg.fill(HIST("histTpcNsigmaDataAl"), track.p() * 2.0, nSigmaHe4); - MC_recon_reg.fill(HIST("histTpcNsigmaDataPi_pT"), track.pt(), nSigmaPion); - MC_recon_reg.fill(HIST("histTpcNsigmaDataPr_pT"), track.pt(), nSigmaProton); - MC_recon_reg.fill(HIST("histTpcNsigmaDataDe_pT"), track.pt(), nSigmaDeuteron); - MC_recon_reg.fill(HIST("histTpcNsigmaDataTr_pT"), track.pt(), nSigmaTriton); - MC_recon_reg.fill(HIST("histTpcNsigmaDataHe_pT"), track.pt() * 2.0, nSigmaHe3); - MC_recon_reg.fill(HIST("histTpcNsigmaDataAl_pT"), track.pt() * 2.0, nSigmaHe4); + MC_recon_reg.fill(HIST("histTpcNsigmaDataPi"), momentum, nSigmaPion); + MC_recon_reg.fill(HIST("histTpcNsigmaDataPr"), momentum, nSigmaProton); + MC_recon_reg.fill(HIST("histTpcNsigmaDataDe"), momentum, nSigmaDeuteron); + MC_recon_reg.fill(HIST("histTpcNsigmaDataTr"), momentum, nSigmaTriton); + MC_recon_reg.fill(HIST("histTpcNsigmaDataHe"), momentum * 2.0, nSigmaHe3); + MC_recon_reg.fill(HIST("histTpcNsigmaDataAl"), momentum * 2.0, nSigmaHe4); } if (track.sign() < 0) { - MC_recon_reg.fill(HIST("histTpcNsigmaDataaPi"), track.p(), nSigmaPion); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaPr"), track.p(), nSigmaProton); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaDe"), track.p(), nSigmaDeuteron); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaTr"), track.p(), nSigmaTriton); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaHe"), track.p() * 2.0, nSigmaHe3); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaAl"), track.p() * 2.0, nSigmaHe4); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaPi_pT"), track.pt(), nSigmaPion); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaPr_pT"), track.pt(), nSigmaProton); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaDe_pT"), track.pt(), nSigmaDeuteron); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaTr_pT"), track.pt(), nSigmaTriton); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaHe_pT"), track.pt() * 2.0, nSigmaHe3); - MC_recon_reg.fill(HIST("histTpcNsigmaDataaAl_pT"), track.pt() * 2.0, nSigmaHe4); + MC_recon_reg.fill(HIST("histTpcNsigmaDataaPi"), momentum, nSigmaPion); + MC_recon_reg.fill(HIST("histTpcNsigmaDataaPr"), momentum, nSigmaProton); + MC_recon_reg.fill(HIST("histTpcNsigmaDataaDe"), momentum, nSigmaDeuteron); + MC_recon_reg.fill(HIST("histTpcNsigmaDataaTr"), momentum, nSigmaTriton); + MC_recon_reg.fill(HIST("histTpcNsigmaDataaHe"), momentum * 2.0, nSigmaHe3); + MC_recon_reg.fill(HIST("histTpcNsigmaDataaAl"), momentum * 2.0, nSigmaHe4); } if (track.hasTOF()) { Float_t TOFmass2 = ((track.mass()) * (track.mass())); - MC_recon_reg.fill(HIST("histTOFm2"), track.p(), TOFmass2, pdgbin); - MC_recon_reg.fill(HIST("histTOFm2_pT"), track.pt(), TOFmass2, pdgbin); - MC_recon_reg.fill(HIST("histTofSignalData"), track.p() * track.sign(), track.beta(), pdgbin); - MC_recon_reg.fill(HIST("histTofSignalData_pT"), track.pt() * track.sign(), track.beta(), pdgbin); - MC_recon_reg.fill(HIST("histTofSignalData_all_species"), track.pt() * track.sign(), track.beta()); + MC_recon_reg.fill(HIST("histTOFm2"), momentum, TOFmass2, pdgbin); + MC_recon_reg.fill(HIST("histTofSignalData"), momentum * track.sign(), track.beta(), pdgbin); + MC_recon_reg.fill(HIST("histTofSignalData_all_species"), momentum * track.sign(), track.beta()); if (track.sign() > 0) { if (nSigmaPion > nsigmacutLow && nSigmaPion < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataPi"), track.p(), track.tofNSigmaPi()); - MC_recon_reg.fill(HIST("histTofNsigmaDataPi_pT"), track.pt(), track.tofNSigmaPi()); + MC_recon_reg.fill(HIST("histTofNsigmaDataPi"), momentum, track.tofNSigmaPi()); if (nSigmaProton > nsigmacutLow && nSigmaProton < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataPr"), track.p(), track.tofNSigmaPr()); - MC_recon_reg.fill(HIST("histTofNsigmaDataPr_pT"), track.pt(), track.tofNSigmaPr()); + MC_recon_reg.fill(HIST("histTofNsigmaDataPr"), momentum, track.tofNSigmaPr()); if (nSigmaDeuteron > nsigmacutLow && nSigmaDeuteron < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataDe"), track.p(), track.tofNSigmaDe()); - MC_recon_reg.fill(HIST("histTofNsigmaDataDe_pT"), track.pt(), track.tofNSigmaDe()); + MC_recon_reg.fill(HIST("histTofNsigmaDataDe"), momentum, track.tofNSigmaDe()); if (nSigmaTriton > nsigmacutLow && nSigmaTriton < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataTr"), track.p(), track.tofNSigmaTr()); - MC_recon_reg.fill(HIST("histTofNsigmaDataTr_pT"), track.pt(), track.tofNSigmaTr()); + MC_recon_reg.fill(HIST("histTofNsigmaDataTr"), momentum, track.tofNSigmaTr()); if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataHe"), track.p() * 2.0, track.tofNSigmaHe()); - MC_recon_reg.fill(HIST("histTofNsigmaDataHe_pT"), track.pt() * 2.0, track.tofNSigmaHe()); + MC_recon_reg.fill(HIST("histTofNsigmaDataHe"), momentum * 2.0, track.tofNSigmaHe()); if (nSigmaHe4 > nsigmacutLow && nSigmaHe4 < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataAl"), track.p() * 2.0, track.tofNSigmaAl()); - MC_recon_reg.fill(HIST("histTofNsigmaDataAl_pT"), track.pt() * 2.0, track.tofNSigmaAl()); + MC_recon_reg.fill(HIST("histTofNsigmaDataAl"), momentum * 2.0, track.tofNSigmaAl()); } if (track.sign() < 0) { if (nSigmaPion > nsigmacutLow && nSigmaPion < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataaPi"), track.p(), track.tofNSigmaPi()); - MC_recon_reg.fill(HIST("histTofNsigmaDataaPi_pT"), track.pt(), track.tofNSigmaPi()); + MC_recon_reg.fill(HIST("histTofNsigmaDataaPi"), momentum, track.tofNSigmaPi()); if (nSigmaProton > nsigmacutLow && nSigmaProton < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataaPr"), track.p(), track.tofNSigmaPr()); - MC_recon_reg.fill(HIST("histTofNsigmaDataaPr_pT"), track.pt(), track.tofNSigmaPr()); + MC_recon_reg.fill(HIST("histTofNsigmaDataaPr"), momentum, track.tofNSigmaPr()); if (nSigmaDeuteron > nsigmacutLow && nSigmaDeuteron < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataaDe"), track.p(), track.tofNSigmaDe()); - MC_recon_reg.fill(HIST("histTofNsigmaDataaDe_pT"), track.pt(), track.tofNSigmaDe()); + MC_recon_reg.fill(HIST("histTofNsigmaDataaDe"), momentum, track.tofNSigmaDe()); if (nSigmaTriton > nsigmacutLow && nSigmaTriton < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataaTr"), track.p(), track.tofNSigmaTr()); - MC_recon_reg.fill(HIST("histTofNsigmaDataaTr_pT"), track.pt(), track.tofNSigmaTr()); + MC_recon_reg.fill(HIST("histTofNsigmaDataaTr"), momentum, track.tofNSigmaTr()); if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataaHe"), track.p() * 2.0, track.tofNSigmaHe()); - MC_recon_reg.fill(HIST("histTofNsigmaDataaHe_pT"), track.pt() * 2.0, track.tofNSigmaHe()); + MC_recon_reg.fill(HIST("histTofNsigmaDataaHe"), momentum * 2.0, track.tofNSigmaHe()); if (nSigmaHe4 > nsigmacutLow && nSigmaHe4 < nsigmacutHigh) - MC_recon_reg.fill(HIST("histTofNsigmaDataaAl"), track.p() * 2.0, track.tofNSigmaAl()); - MC_recon_reg.fill(HIST("histTofNsigmaDataaAl_pT"), track.pt() * 2.0, track.tofNSigmaAl()); + MC_recon_reg.fill(HIST("histTofNsigmaDataaAl"), momentum * 2.0, track.tofNSigmaAl()); } } } } - PROCESS_SWITCH(NucleiHistTask, processMC, "process MC", false); + PROCESS_SWITCH(NucleiHistTask, processMCreco, "process reconstructed MC", false); }; //**************************************************************************************************** diff --git a/PWGLF/Tasks/Nuspex/ebyeMult.cxx b/PWGLF/Tasks/Nuspex/ebyeMult.cxx index 66231c71549..7fc0ca8e941 100644 --- a/PWGLF/Tasks/Nuspex/ebyeMult.cxx +++ b/PWGLF/Tasks/Nuspex/ebyeMult.cxx @@ -9,8 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include +/// \file ebyeMult.cxx +/// \brief task to carry out multiplicity measurements for lf ebye analyses +/// \author Mario Ciacco + +#include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -28,7 +33,6 @@ #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" -#include "TDatabasePDG.h" #include "TFormula.h" using namespace o2; @@ -64,7 +68,7 @@ struct CandidateEvent { int nTklRec = -1; }; -struct tagRun2V0MCalibration { +struct TagRun2V0MCalibration { bool mCalibrationStored = false; TH1* mhVtxAmpCorrV0A = nullptr; TH1* mhVtxAmpCorrV0C = nullptr; @@ -85,30 +89,30 @@ enum PartTypes { kOther = 8 }; -struct ebyeMult { +struct EbyeMult { std::vector candidateTracks; Service ccdb; CandidateEvent candidateEvent; int mRunNumber; - float d_bz; + float dBz; uint8_t nTrackletsColl; ConfigurableAxis centAxis{"centAxis", {106, 0, 106}, "binning for the centrality"}; - ConfigurableAxis zVtxAxis{"zVtxBins", {100, -20.f, 20.f}, "Binning for the vertex z in cm"}; - ConfigurableAxis multAxis{"multAxis", {100, 0, 10000}, "Binning for the multiplicity axis"}; - ConfigurableAxis multFt0Axis{"multFt0Axis", {100, 0, 100000}, "Binning for the ft0 multiplicity axis"}; - Configurable genName{"genname", "", "Genearator name: HIJING, PYTHIA8, ... Default: \"\""}; + ConfigurableAxis zVtxAxis{"zVtxAxis", {100, -20.f, 20.f}, "Binning for the vertex z in cm"}; + ConfigurableAxis multAxis{"multAxis", {100, 0.f, 100.f}, "Binning for the multiplicity axis"}; + ConfigurableAxis multFt0Axis{"multFt0Axis", {100, 0.f, 100.f}, "Binning for the ft0 multiplicity axis"}; + Configurable genName{"genName", "", "Genearator name: HIJING, PYTHIA8, ... Default: \"\""}; Configurable zVtxMax{"zVtxMax", 10.0f, "maximum z position of the primary vertex"}; Configurable etaMax{"etaMax", 0.8f, "maximum eta"}; - Configurable ptMin{"ptMin", 0.4f, "minimum pT (GeV/c)"}; - Configurable ptMax{"ptMax", 4.f, "maximum pT (GeV/c)"}; + Configurable ptMin{"ptMin", 0.05f, "minimum pT (GeV/c)"}; + Configurable ptMax{"ptMax", 10.f, "maximum pT (GeV/c)"}; Configurable trackNcrossedRows{"trackNcrossedRows", 70, "Minimum number of crossed TPC rows"}; - Configurable trackNclusItsCut{"trackNclusITScut", 2, "Minimum number of ITS clusters"}; - Configurable trackNclusTpcCut{"trackNclusTPCcut", 60, "Minimum number of TPC clusters"}; + Configurable trackNclusITScut{"trackNclusITScut", 2, "Minimum number of ITS clusters"}; + Configurable trackNclusTPCcut{"trackNclusTPCcut", 60, "Minimum number of TPC clusters"}; Configurable trackChi2Cut{"trackChi2Cut", 4.f, "Maximum chi2/ncls in TPC"}; Configurable> cfgDcaSels{"cfgDcaSels", {dcaSels, 1, 3, particleName, dcaSelsNames}, "DCA selections"}; @@ -153,8 +157,8 @@ struct ebyeMult { if (!(track.itsClusterMap() & 0x01) && !(track.itsClusterMap() & 0x02)) { return false; } - if (track.itsNCls() < trackNclusItsCut || - track.tpcNClsFound() < trackNclusTpcCut || + if (track.itsNCls() < trackNclusITScut || + track.tpcNClsFound() < trackNclusTPCcut || track.tpcNClsCrossedRows() < trackNcrossedRows || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || track.tpcChi2NCl() > trackChi2Cut || @@ -224,46 +228,46 @@ struct ebyeMult { o2::base::Propagator::initFieldFromGRP(grpmag); } // Fetch magnetic field from ccdb for current collision - d_bz = o2::base::Propagator::Instance()->getNominalBz(); - LOG(info) << "Retrieved GRP for timestamp " << timestamp << " with magnetic field of " << d_bz << " kG"; + dBz = o2::base::Propagator::Instance()->getNominalBz(); + LOG(info) << "Retrieved GRP for timestamp " << timestamp << " with magnetic field of " << dBz << " kG"; mRunNumber = bc.runNumber(); } - // float getV0M(int64_t const id, float const zvtx, aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs) - // { - // auto fv0a = fv0as.rawIteratorAt(id); - // auto fv0c = fv0cs.rawIteratorAt(id); - // float multFV0A = 0; - // float multFV0C = 0; - // for (float amplitude : fv0a.amplitude()) { - // multFV0A += amplitude; - // } - - // for (float amplitude : fv0c.amplitude()) { - // multFV0C += amplitude; - // } - - // float v0m = -1; - // auto scaleMC = [](float x, float pars[6]) { - // return pow(((pars[0] + pars[1] * pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); - // }; - - // if (Run2V0MInfo.mMCScale != nullptr) { - // float multFV0M = multFV0A + multFV0C; - // v0m = scaleMC(multFV0M, Run2V0MInfo.mMCScalePars); - // LOGF(debug, "Unscaled v0m: %f, scaled v0m: %f", multFV0M, v0m); - // } else { - // v0m = multFV0A * Run2V0MInfo.mhVtxAmpCorrV0A->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0A->FindFixBin(zvtx)) + - // multFV0C * Run2V0MInfo.mhVtxAmpCorrV0C->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0C->FindFixBin(zvtx)); - // } - // return v0m; - // } + float getV0M(int64_t const id, float const zvtx, aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs) + { + auto fv0a = fv0as.rawIteratorAt(id); + auto fv0c = fv0cs.rawIteratorAt(id); + float multFV0A = 0; + float multFV0C = 0; + for (float const& amplitude : fv0a.amplitude()) { + multFV0A += amplitude; + } + + for (float const& amplitude : fv0c.amplitude()) { + multFV0C += amplitude; + } + + float v0m = -1; + auto scaleMC = [](float x, float pars[6]) { + return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); + }; + + if (Run2V0MInfo.mMCScale != nullptr) { + float multFV0M = multFV0A + multFV0C; + v0m = scaleMC(multFV0M, Run2V0MInfo.mMCScalePars); + LOGF(debug, "Unscaled v0m: %f, scaled v0m: %f", multFV0M, v0m); + } else { + v0m = multFV0A * Run2V0MInfo.mhVtxAmpCorrV0A->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0A->FindFixBin(zvtx)) + + multFV0C * Run2V0MInfo.mhVtxAmpCorrV0C->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0C->FindFixBin(zvtx)); + } + return v0m; + } void init(o2::framework::InitContext&) { mRunNumber = 0; - d_bz = 0; + dBz = 0; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -275,33 +279,52 @@ struct ebyeMult { histos.add("QA/V0MvsCL0", ";Centrality CL0 (%);Centrality V0M (%)", HistType::kTH2F, {centAxis, centAxis}); histos.add("QA/trackletsVsV0M", ";Centrality CL0 (%);Centrality V0M (%)", HistType::kTH2F, {centAxis, multAxis}); histos.add("QA/nTrklCorrelation", ";Tracklets |#eta| > 0.7; Tracklets |#eta| < 0.6", HistType::kTH2D, {{201, -0.5, 200.5}, {201, -0.5, 200.5}}); + histos.add("QA/nV0MCorrelation", ";V0M Multiplicity (%); Tracklets |#eta| < 0.6", HistType::kTH2D, {multAxis, {201, -0.5, 200.5}}); histos.add("QA/TrklEta", ";Tracklets #eta; Entries", HistType::kTH1D, {{100, -3., 3.}}); // rec tracks histos.add("RecTracks", ";Tracklets |#eta| > 0.7;#it{p}_{T} (GeV/#it{c});DCA_{#it{xy}} (cm)", HistType::kTH3D, {{201, -0.5, 200.5}, {100, -5., 5.}, {200, -1., 1.}}); + histos.add("RecTracksV0M", ";V0M Multiplicity (%);#it{p}_{T} (GeV/#it{c});DCA_{#it{xy}} (cm)", HistType::kTH3D, {multAxis, {100, -5., 5.}, {200, -1., 1.}}); // rec tracks and tracklets distribution histos.add("TracksDistr", ";Tracklets |#eta| > 0.7;#it{N}_{trk}", HistType::kTH2D, {{201, -0.5, 200.5}, {201, -0.5, 200.5}}); histos.add("TrackletsDistr", ";Tracklets |#eta| > 0.7;#it{N}_{tkl}", HistType::kTH2D, {{201, -0.5, 200.5}, {201, -0.5, 200.5}}); + histos.add("TracksDistrV0M", ";V0M Multiplicity (%);#it{N}_{trk}", HistType::kTH2D, {multAxis, {201, -0.5, 200.5}}); + histos.add("TrackletsDistrV0M", ";V0M Multiplicity (%);#it{N}_{tkl}", HistType::kTH2D, {multAxis, {201, -0.5, 200.5}}); + if (doprocessMcRun2) { // rec & gen particles (per species) histos.add("RecPart", ";Tracklets |#eta| > 0.7;#it{p}_{T} (GeV/#it{c});Species", HistType::kTH3D, {{201, -0.5, 200.5}, {100, -5., 5.}, {10, 0, 10}}); histos.add("GenPart", ";Tracklets |#eta| > 0.7;#it{p}_{T} (GeV/#it{c});Species", HistType::kTH3D, {{201, -0.5, 200.5}, {100, -5., 5.}, {10, 0, 10}}); + histos.add("RecPartV0M", ";V0M Multiplicity (%);#it{p}_{T} (GeV/#it{c});Species", HistType::kTH3D, {multAxis, {100, -5., 5.}, {10, 0, 10}}); + histos.add("GenPartV0M", ";V0M Multiplicity (%);#it{p}_{T} (GeV/#it{c});Species", HistType::kTH3D, {multAxis, {100, -5., 5.}, {10, 0, 10}}); + // dca_xy templates histos.add("PrimTracks", ";Tracklets |#eta| > 0.7;#it{p}_{T} (GeV/#it{c});DCA_{#it{xy}} (cm)", HistType::kTH3D, {{201, -0.5, 200.5}, {100, -5., 5.}, {200, -1., 1.}}); histos.add("SecWDTracks", ";Tracklets |#eta| > 0.7;#it{p}_{T} (GeV/#it{c});DCA_{#it{xy}} (cm)", HistType::kTH3D, {{201, -0.5, 200.5}, {100, -5., 5.}, {200, -1., 1.}}); histos.add("SecTracks", ";Tracklets |#eta| > 0.7;#it{p}_{T} (GeV/#it{c});DCA_{#it{xy}} (cm)", HistType::kTH3D, {{201, -0.5, 200.5}, {100, -5., 5.}, {200, -1., 1.}}); + histos.add("PrimTracksV0M", ";V0M Multiplicity (%);#it{p}_{T} (GeV/#it{c});DCA_{#it{xy}} (cm)", HistType::kTH3D, {multAxis, {100, -5., 5.}, {200, -1., 1.}}); + histos.add("SecWDTracksV0M", ";V0M Multiplicity (%);#it{p}_{T} (GeV/#it{c});DCA_{#it{xy}} (cm)", HistType::kTH3D, {multAxis, {100, -5., 5.}, {200, -1., 1.}}); + histos.add("SecTracksV0M", ";V0M Multiplicity (%);#it{p}_{T} (GeV/#it{c});DCA_{#it{xy}} (cm)", HistType::kTH3D, {multAxis, {100, -5., 5.}, {200, -1., 1.}}); + // response - histos.add("GenRecTracks", ";Tracklets |#eta| > 0.7#it;#it{N}_{trk};#it{N}_{gen}", HistType::kTH3D, {{201, -0.5, 200.5}, {201, -0.5, 200.5}, {201, -0.5, 200.5}}); + histos.add("GenRecTracks", ";Tracklets |#eta| > 0.7;#it{N}_{trk};#it{N}_{gen}", HistType::kTH3D, {{201, -0.5, 200.5}, {201, -0.5, 200.5}, {201, -0.5, 200.5}}); histos.add("GenRecTracklets", ";Tracklets |#eta| > 0.7;#it{N}_{tkl};#it{N}_{gen}", HistType::kTH3D, {{201, -0.5, 200.5}, {201, -0.5, 200.5}, {201, -0.5, 200.5}}); + + histos.add("GenRecTracksV0M", ";V0M Multiplicity (%);#it{N}_{trk};#it{N}_{gen}", HistType::kTH3D, {multAxis, {201, -0.5, 200.5}, {201, -0.5, 200.5}}); + histos.add("GenRecTrackletsV0M", ";V0M Multiplicity (%);#it{N}_{tkl};#it{N}_{gen}", HistType::kTH3D, {multAxis, {201, -0.5, 200.5}, {201, -0.5, 200.5}}); } + + // histograms for the evaluation of trigger efficiency + histos.add("GenINELgtZERO", ";#it{N}_{gen}", HistType::kTH1D, {multAxis}); + histos.add("RecINELgtZERO", ";#it{N}_{gen}", HistType::kTH1D, {multAxis}); } template - void fillRecoEvent(C const& collision, T const& tracksAll /* , float const& centrality */) + void fillRecoEvent(C const& collision, T const& tracksAll, float const& centrality) { auto tracks = tracksAll.sliceBy(perCollisionTracksFull, collision.globalIndex()); candidateTracks.clear(); @@ -336,6 +359,8 @@ struct ebyeMult { CandidateTrack candTrack; candTrack.pt = track.sign() > 0. ? trackPt : -trackPt; + if (trackPt < ptMin || trackPt > ptMax) + continue; candTrack.eta = trackEta; candTrack.dcapv = dca; candTrack.dcaxypv = dcaInfo[0]; @@ -343,70 +368,76 @@ struct ebyeMult { candTrack.globalIndex = track.globalIndex(); candidateTracks.push_back(candTrack); - if (std::abs(dcaInfo[0]) < cfgDcaSels->get("dcaxy")) { // dcaxy + if (std::abs(dcaInfo[0]) < cfgDcaSels->get("dcaxy")) { // dcaxy TODO: add pt dependent dcaxy cut ++nTracks; } } - histos.fill(HIST("QA/nTrklCorrelation"), nTracklets[0], nTracklets[1]); + histos.fill(HIST("QA/nTrklCorrelation"), nTracklets[1], nTracklets[0]); + histos.fill(HIST("QA/nV0MCorrelation"), centrality, nTracklets[0]); nTrackletsColl = nTracklets[1]; candidateEvent.nTklRec = nTracklets[0]; histos.fill(HIST("TracksDistr"), nTracklets[1], nTracks); histos.fill(HIST("TrackletsDistr"), nTracklets[1], nTracklets[0]); + histos.fill(HIST("TracksDistrV0M"), centrality, nTracks); + histos.fill(HIST("TrackletsDistrV0M"), centrality, nTracklets[0]); } template - void fillMcEvent(C const& collision, T const& tracks /* , float const& centrality */, aod::McParticles const&, aod::McTrackLabels const& mcLabels) + void fillMcEvent(C const& collision, T const& tracks, float const& centrality, aod::McParticles const&, aod::McTrackLabels const& mcLabels) { - fillRecoEvent(collision, tracks /* , centrality */); + fillRecoEvent(collision, tracks, centrality); int nTracks{0}; - for (auto& candidateTrack : candidateTracks) { - candidateTrack.isreco = true; + for (int iT{0}; iT < static_cast(candidateTracks.size()); ++iT) { + candidateTracks[iT].isreco = true; - auto mcLab = mcLabels.rawIteratorAt(candidateTrack.globalIndex); + auto mcLab = mcLabels.rawIteratorAt(candidateTracks[iT].globalIndex); if (mcLab.has_mcParticle()) { auto mcTrack = mcLab.template mcParticle_as(); - if (((mcTrack.flags() & 0x8) && (doprocessMcRun2)) || (mcTrack.flags() & 0x2)) + if (((mcTrack.flags() & 0x8) && (doprocessMcRun2)) || (mcTrack.flags() & 0x2) || (mcTrack.flags() & 0x1)) continue; if (!mcTrack.isPhysicalPrimary()) { if (mcTrack.has_mothers()) { // sec WD - histos.fill(HIST("SecWDTracks"), nTrackletsColl, candidateTrack.pt, candidateTrack.dcaxypv); + histos.fill(HIST("SecWDTracks"), nTrackletsColl, candidateTracks[iT].pt, candidateTracks[iT].dcaxypv); + histos.fill(HIST("SecWDTracksV0M"), centrality, candidateTracks[iT].pt, candidateTracks[iT].dcaxypv); } else { // from material - histos.fill(HIST("SecTracks"), nTrackletsColl, candidateTrack.pt, candidateTrack.dcaxypv); + histos.fill(HIST("SecTracks"), nTrackletsColl, candidateTracks[iT].pt, candidateTracks[iT].dcaxypv); + histos.fill(HIST("SecTracksV0M"), centrality, candidateTracks[iT].pt, candidateTracks[iT].dcaxypv); } } - if ((mcTrack.flags() & 0x1)) - continue; + if (std::abs(candidateTracks[iT].dcaxypv) > cfgDcaSels->get("dcaxy")) { // TODO: add pt dependent cut + ++nTracks; + } + if (mcTrack.isPhysicalPrimary()) { // primary - histos.fill(HIST("PrimTracks"), nTrackletsColl, candidateTrack.pt, candidateTrack.dcaxypv); + histos.fill(HIST("PrimTracks"), nTrackletsColl, candidateTracks[iT].pt, candidateTracks[iT].dcaxypv); + histos.fill(HIST("PrimTracksV0M"), centrality, candidateTracks[iT].pt, candidateTracks[iT].dcaxypv); } - if (std::abs(candidateTrack.dcaxypv) > cfgDcaSels->get("dcaxy")) + if (std::abs(candidateTracks[iT].dcaxypv) > cfgDcaSels->get("dcaxy")) continue; int partType = getPartType(mcTrack.pdgCode()); if (mcTrack.isPhysicalPrimary()) { // primary - histos.fill(HIST("RecPart"), nTrackletsColl, candidateTrack.pt, partType); - if (partType < PartTypes::kOther) { - ++nTracks; - } + histos.fill(HIST("RecPart"), nTrackletsColl, candidateTracks[iT].pt, partType); + histos.fill(HIST("RecPartV0M"), centrality, candidateTracks[iT].pt, partType); } auto genPt = std::hypot(mcTrack.px(), mcTrack.py()); - candidateTrack.pdgcode = mcTrack.pdgCode(); - candidateTrack.genpt = genPt; - candidateTrack.geneta = mcTrack.eta(); - candidateTrack.mcIndex = mcTrack.globalIndex(); + candidateTracks[iT].pdgcode = mcTrack.pdgCode(); + candidateTracks[iT].genpt = genPt; + candidateTracks[iT].geneta = mcTrack.eta(); + candidateTracks[iT].mcIndex = mcTrack.globalIndex(); } } candidateEvent.nTrkRec = nTracks; } - void fillMcGen(aod::McParticles const& mcParticles, aod::McTrackLabels const& /*mcLab*/, uint64_t const& collisionId) + void fillMcGen(aod::McParticles const& mcParticles, aod::McTrackLabels const& /*mcLab*/, uint64_t const& collisionId, float const& centrality) { int nParticles = 0; - auto mcParticles_thisCollision = mcParticles.sliceBy(perCollisionMcParts, collisionId); - for (auto& mcPart : mcParticles_thisCollision) { + auto mcParticlesThisCollision = mcParticles.sliceBy(perCollisionMcParts, collisionId); + for (auto const& mcPart : mcParticlesThisCollision) { auto genEta = mcPart.eta(); if (std::abs(genEta) > etaMax) { continue; @@ -416,6 +447,8 @@ struct ebyeMult { if (!mcPart.isPhysicalPrimary() /* && !mcPart.has_mothers() */) continue; auto genPt = std::hypot(mcPart.px(), mcPart.py()); + if (genPt < ptMin || genPt > ptMax) + continue; CandidateTrack candTrack; candTrack.genpt = genPt; candTrack.geneta = mcPart.eta(); @@ -426,6 +459,7 @@ struct ebyeMult { ++nParticles; } histos.fill(HIST("GenPart"), nTrackletsColl, mcPart.pdgCode() > 0 ? genPt : -genPt, partType); + histos.fill(HIST("GenPartV0M"), centrality, mcPart.pdgCode() > 0 ? genPt : -genPt, partType); auto it = find_if(candidateTracks.begin(), candidateTracks.end(), [&](CandidateTrack trk) { return trk.mcIndex == mcPart.globalIndex(); }); if (it != candidateTracks.end()) { @@ -434,11 +468,46 @@ struct ebyeMult { candidateTracks.emplace_back(candTrack); } } + histos.fill(HIST("RecINELgtZERO"), nParticles); histos.fill(HIST("GenRecTracks"), nTrackletsColl, candidateEvent.nTrkRec, nParticles); histos.fill(HIST("GenRecTracklets"), nTrackletsColl, candidateEvent.nTklRec, nParticles); + histos.fill(HIST("GenRecTracksV0M"), centrality, candidateEvent.nTrkRec, nParticles); + histos.fill(HIST("GenRecTrackletsV0M"), centrality, candidateEvent.nTklRec, nParticles); + } + + template + int genMultINELgtZERO(C const& collision, P const& particles) + { + if (std::abs(collision.posZ()) > zVtxMax) + return -1; + + int nParticles = 0; + int partInAcc = 0; + auto particlesThisCollision = particles.sliceBy(perCollisionMcParts, collision.globalIndex()); + for (auto const& particle : particlesThisCollision) { + if (((particle.flags() & 0x8) && (doprocessMcRun2)) || (particle.flags() & 0x2) || (particle.flags() & 0x1)) + continue; + if (!particle.isPhysicalPrimary() /* && !particle.has_mothers() */) + continue; + auto pt = std::hypot(particle.px(), particle.py()); + if (pt < ptMin || pt > ptMax) + continue; + + int partType = getPartType(particle.pdgCode()); + if (partType < PartTypes::kOther) { + if (std::abs(particle.eta()) < etaMax) + ++nParticles; + if (std::abs(particle.eta()) < 1.f) { + ++partInAcc; + } + } + } + if (partInAcc >= 0) + return nParticles; + return -1; } - void processRun2(soa::Join const& collisions, TracksFull const& tracks /* , aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs */, BCsWithRun2Info const&) + void processRun2(soa::Join const& collisions, TracksFull const& tracks, aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs, BCsWithRun2Info const&) { for (const auto& collision : collisions) { @@ -454,24 +523,28 @@ struct ebyeMult { if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) continue; - // float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs); - // float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m)); + if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kINELgtZERO))) + continue; + + float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs); + float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m)); histos.fill(HIST("QA/zVtx"), collision.posZ()); - fillRecoEvent(collision, tracks /* , cV0M */); + fillRecoEvent(collision, tracks, cV0M); - for (auto t : candidateTracks) { + for (auto const& t : candidateTracks) { histos.fill(HIST("RecTracks"), nTrackletsColl, t.pt, t.dcaxypv); + histos.fill(HIST("RecTracksV0M"), cV0M, t.pt, t.dcaxypv); } } } - PROCESS_SWITCH(ebyeMult, processRun2, "process (Run 2)", false); + PROCESS_SWITCH(EbyeMult, processRun2, "process (Run 2)", false); - void processMcRun2(soa::Join const& collisions, aod::McCollisions const& /*mcCollisions*/, TracksFull const& tracks /* , aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs */, aod::McParticles const& mcParticles, aod::McTrackLabels const& mcLab, BCsWithRun2Info const&) + void processMcRun2(soa::Join const& collisions, aod::McCollisions const& mcCollisions, TracksFull const& tracks, aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs, aod::McParticles const& mcParticles, aod::McTrackLabels const& mcLab, BCsWithRun2Info const&) { - for (const auto& collision : collisions) { + for (const auto& collision : collisions) { // TODO: fill numerator for trigger efficiency auto bc = collision.bc_as(); initCCDB(bc); @@ -481,20 +554,31 @@ struct ebyeMult { if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) continue; - // float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs); - // float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m)); + if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kINELgtZERO))) + continue; + + float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs); + float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m)); histos.fill(HIST("QA/zVtx"), collision.posZ()); - fillMcEvent(collision, tracks /* , cV0M */, mcParticles, mcLab); - fillMcGen(mcParticles, mcLab, collision.mcCollisionId()); + fillMcEvent(collision, tracks, cV0M, mcParticles, mcLab); + fillMcGen(mcParticles, mcLab, collision.mcCollisionId(), cV0M); + } + + // search generated INEL > 0 (one charged particle in |eta| < 1) + for (const auto& mcCollision : mcCollisions) { + int mult = genMultINELgtZERO(mcCollision, mcParticles); + if (mult >= 0) { + histos.fill(HIST("GenINELgtZERO"), mult); + } } } - PROCESS_SWITCH(ebyeMult, processMcRun2, "process mc (Run 2)", false); + PROCESS_SWITCH(EbyeMult, processMcRun2, "process mc (Run 2)", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 71ed425d9d3..334c952a105 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -1037,7 +1037,7 @@ struct hadronnucleicorrelation { if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.sign() > 0) registry.fill(HIST("hDenominatorPurity_Deuteron_TPC"), track.pt()); - if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF && track.sign() > 0) + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF && track.sign() > 0) registry.fill(HIST("hDenominatorPurity_Deuteron_TPCTOF"), track.pt()); if (((std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.beta() < -100) || (track.beta() > -100 && std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF)) && @@ -1055,7 +1055,7 @@ struct hadronnucleicorrelation { if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.sign() < 0) registry.fill(HIST("hDenominatorPurity_Deuteron_TPC"), track.pt() * -1); - if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF && track.sign() < 0) + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF && track.sign() < 0) registry.fill(HIST("hDenominatorPurity_Deuteron_TPCTOF"), track.pt() * -1); if (( (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.beta() < -100) || diff --git a/PWGLF/Tasks/Nuspex/he3FromHypertritonMap.cxx b/PWGLF/Tasks/Nuspex/he3FromHypertritonMap.cxx new file mode 100644 index 00000000000..27f6ed6d5b3 --- /dev/null +++ b/PWGLF/Tasks/Nuspex/he3FromHypertritonMap.cxx @@ -0,0 +1,129 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/// +/// \author Roberta Ferioli (roberta.ferioli@cern.ch) +/// \since November, 2024 + +#include +#include +#include +#include +#include +#include +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/DataTypes.h" +#include "ReconstructionDataFormats/Track.h" +#include "ReconstructionDataFormats/PID.h" +#include "ReconstructionDataFormats/DCA.h" +#include "Common/Core/trackUtilities.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponse.h" + +using namespace std; +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; +using std::array; + +using MCTracks = soa::Join; + +struct he3FromHypertritonMap { + HistogramRegistry registryMC{ + "registryMC", + {}, + OutputObjHandlingPolicy::AnalysisObject, + true, + true}; + + // Track Parameters + Configurable min_ITS_nClusters{"min_ITS_nClusters", 7, "minimum number of found ITS clusters"}; + Configurable min_TPC_nClusters{"min_TPC_nClusters", 100, "minimum number of found TPC clusters"}; + Configurable min_TPC_nCrossedRows{"min_TPC_nCrossedRows", 70, "minimum number of TPC crossed pad rows"}; + Configurable max_chi2_TPC{"max_chi2_TPC", 4.0f, "maximum TPC chi^2/Ncls"}; + Configurable min_chi2_TPC{"min_chi2_ITS", 0.5f, "minimum TPC chi^2/Ncls"}; + Configurable min_eta{"min_eta", -0.8f, "minimum_eta"}; + Configurable max_eta{"max_eta", +0.8f, "maximum_eta"}; + Configurable max_dcaxy{"max_dcaxy", 0.05f, "Maximum DCAxy"}; + Configurable max_dcaz{"max_dcaz", 0.05f, "Maximum DCAz"}; + Configurable min_nsigmaTPC{"min_nsigmaTPC", -2.0f, "Minimum nsigma TPC"}; + Configurable max_nsigmaTPC{"max_nsigmaTPC", +2.0f, "Maximum nsigma TPC"}; + Configurable min_pt{"min_pt", 0.0f, "minimum pt of the tracks"}; + Configurable max_pt{"max_pt", 10.0f, "maximum pt of the tracks"}; + Configurable nbin_pt{"nbin_pt", 50, "number of pt bins"}; + Configurable nbin_dca = {"nbin_dca", 50, "number of DCA bins"}; + + int AntihePDG = -1000020030; + int AntiHypertritonPDG = -1010010030; + int AntiHyperHelium4PDG = -1010020040; + + void init(InitContext const&) + { + registryMC.add("he3SecPtRec_from_hypertriton", "he3SecPtRec_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + registryMC.add("he3SecPtRec_from_hyperHe4", "he3SecPtRec_from_hyperHe4", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + registryMC.add("hypertritonPtgen", "hypertritonPtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + registryMC.add("hyperHe4Ptgen", "hyperHe4PtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + } + + void processMC(aod::McParticles const& /*mcParticles*/, const MCTracks& tracks) + { + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + continue; + } + auto mcparticle = track.mcParticle(); + if (mcparticle.pdgCode() != AntihePDG || mcparticle.isPhysicalPrimary()) { + continue; + } + + for (auto& motherparticle : mcparticle.mothers_as()) { + if (motherparticle.pdgCode() == AntiHypertritonPDG || motherparticle.pdgCode() == AntiHyperHelium4PDG) { + if (track.itsNCls() < min_ITS_nClusters || + track.tpcNClsFound() < min_TPC_nClusters || + track.tpcNClsCrossedRows() < min_TPC_nCrossedRows || + track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || + track.tpcChi2NCl() > 4.f || + track.tpcChi2NCl() < min_chi2_TPC || + track.eta() < min_eta || track.eta() > max_eta || + track.dcaXY() > max_dcaxy || track.dcaXY() < -max_dcaxy || + track.dcaZ() > max_dcaz || track.dcaZ() < -max_dcaz || + track.itsChi2NCl() > 36.f) { + continue; + } + if (motherparticle.pdgCode() == AntiHypertritonPDG) { + registryMC.fill(HIST("he3SecPtRec_from_hypertriton"), 2 * track.pt()); + registryMC.fill(HIST("hypertritonPtgen"), motherparticle.pt()); + } + if (motherparticle.pdgCode() == AntiHyperHelium4PDG) { + registryMC.fill(HIST("he3SecPtRec_from_hyperHe4"), 2 * track.pt()); + registryMC.fill(HIST("hyperHe4Ptgen"), motherparticle.pt()); + } + } + } + } + } + PROCESS_SWITCH(he3FromHypertritonMap, processMC, "Process MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx index 1fe1a563137..7d54bd86d48 100644 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx +++ b/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx @@ -19,6 +19,9 @@ #include #include #include +#include +#include +#include #include #include "CommonDataFormat/InteractionRecord.h" @@ -267,7 +270,7 @@ struct hypertriton3bodyTrackMcinfo { Configurable loadResponseFromCCDB{"loadResponseFromCCDB", false, "Flag to load the response from the CCDB"}; Configurable fatalOnPassNotAvailable{"fatalOnPassNotAvailable", true, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; - o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; + o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; o2::pid::tof::TOFResoParamsV2 mRespParamsV2; void initCCDB(aod::BCsWithTimestamps::iterator const& bc) diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx index 9542232160d..6d07b9e1de4 100644 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx +++ b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx @@ -146,6 +146,8 @@ struct hypertriton3bodyQa { struct hypertriton3bodyAnalysis { + Preslice perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; + // Selection criteria Configurable vtxcospa{"vtxcospa", 0.99, "Vtx CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) Configurable dcavtxdau{"dcavtxdau", 1.0, "DCA Vtx Daughters"}; // loose cut @@ -173,6 +175,12 @@ struct hypertriton3bodyAnalysis { Configurable mintpcNClsdeuteron{"mintpcNClsdeuteron", 100, "min tpc Nclusters for deuteron"}; Configurable mcsigma{"mcsigma", 0.0015, "sigma of mc invariant mass fit"}; // obtained from MC + Configurable bachelorPdgCode{"bachelorPdgCode", 1000010020, "pdgCode of bachelor daughter"}; + Configurable motherPdgCode{"motherPdgCode", 1010010030, "pdgCode of mother track"}; + + // 3sigma region for Dalitz plot + float lowersignallimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; + float uppersignallimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; HistogramRegistry registry{ "registry", @@ -231,16 +239,16 @@ struct hypertriton3bodyAnalysis { //------------------------------------------------------------------ // Fill stats histograms enum vtxstep { kCandAll = 0, - kCandCosPA, kCandDauEta, + kCandDauPt, + kCandTPCNcls, + kCandTPCPID, + kCandTOFPID, + kCandDcaToPV, kCandRapidity, kCandct, + kCandCosPA, kCandDcaDau, - kCandTOFPID, - kCandTPCPID, - kCandTPCNcls, - kCandDauPt, - kCandDcaToPV, kCandInvMass, kNCandSteps }; @@ -298,7 +306,7 @@ struct hypertriton3bodyAnalysis { registry.add("hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); } - TString CandCounterbinLabel[12] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID", "TPCNcls", "DauPt", "PionDcatoPV", "InvMass"}; + TString CandCounterbinLabel[kNCandSteps] = {"Total", "TrackEta", "DauPt", "TPCNcls", "TPCPID", "d TOFPID", "PionDcatoPV", "MomRapidity", "Lifetime", "VtxCosPA", "VtxDcaDau", "InvMass"}; for (int i{0}; i < kNCandSteps; i++) { registry.get(HIST("hCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); if (doprocessMC == true) { @@ -308,44 +316,32 @@ struct hypertriton3bodyAnalysis { } //------------------------------------------------------------------ - Preslice perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; - //------------------------------------------------------------------ - // Analysis process for a single candidate - template - void CandidateAnalysis(TCollisionTable const& dCollision, TCandTable const& candData, bool& if_hasvtx, bool isTrueCand = false, double MClifetime = -1, double lPt = -1) + // Selections for candidates + template + bool SelectCand(TCollisionTable const& collision, TCandTable const& candData, TTrackTable const& trackProton, TTrackTable const& trackPion, TTrackTable const& trackDeuteron, bool isMatter, bool isTrueCand = false, double MClifetime = -1, double lPt = -1) { - FillCandCounter(kCandAll, isTrueCand); - auto track0 = candData.template track0_as(); - auto track1 = candData.template track1_as(); - auto track2 = candData.template track2_as(); - - auto& trackProton = (track2.sign() > 0) ? track0 : track1; - auto& trackPion = (track2.sign() > 0) ? track1 : track0; - auto& trackDeuteron = track2; - - if (candData.vtxcosPA(dCollision.posX(), dCollision.posY(), dCollision.posZ()) < vtxcospa) { - return; - } - FillCandCounter(kCandCosPA, isTrueCand); - if (TMath::Abs(trackProton.eta()) > etacut || TMath::Abs(trackPion.eta()) > etacut || TMath::Abs(trackDeuteron.eta()) > etacut) { - return; + // Selection on daughters + if (std::abs(trackProton.eta()) > etacut || std::abs(trackPion.eta()) > etacut || std::abs(trackDeuteron.eta()) > etacut) { + return false; } FillCandCounter(kCandDauEta, isTrueCand); - if (TMath::Abs(candData.yHypertriton()) > rapiditycut) { - return; + + if (trackProton.pt() < minProtonPt || trackProton.pt() > maxProtonPt || trackPion.pt() < minPionPt || trackPion.pt() > maxPionPt || trackDeuteron.pt() < minDeuteronPt || trackDeuteron.pt() > maxDeuteronPt) { + return false; } - FillCandCounter(kCandRapidity, isTrueCand); - double ct = candData.distovertotmom(dCollision.posX(), dCollision.posY(), dCollision.posZ()) * o2::constants::physics::MassHyperTriton; - if (ct > lifetimecut) { - return; + FillCandCounter(kCandDauPt, isTrueCand); + + if (trackProton.tpcNClsFound() < mintpcNClsproton || trackPion.tpcNClsFound() < mintpcNClspion || trackDeuteron.tpcNClsFound() < mintpcNClsdeuteron) { + return false; } - FillCandCounter(kCandct, isTrueCand); - if (candData.dcaVtxdaughters() > dcavtxdau) { - return; + FillCandCounter(kCandTPCNcls, isTrueCand); + + if (std::abs(trackProton.tpcNSigmaPr()) > TpcPidNsigmaCut || std::abs(trackPion.tpcNSigmaPi()) > TpcPidNsigmaCut || std::abs(trackDeuteron.tpcNSigmaDe()) > TpcPidNsigmaCut) { + return false; } - FillCandCounter(kCandDcaDau, isTrueCand); + FillCandCounter(kCandTPCPID, isTrueCand); // registry.fill(HIST("hDeuteronDefaultTOFVsPBeforeTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); @@ -354,7 +350,7 @@ struct hypertriton3bodyAnalysis { registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); } if ((candData.tofNSigmaBachDe() < TofPidNsigmaMin || candData.tofNSigmaBachDe() > TofPidNsigmaMax) && trackDeuteron.p() > minDeuteronPUseTOF) { - return; + return false; } FillCandCounter(kCandTOFPID, isTrueCand); // registry.fill(HIST("hDeuteronDefaultTOFVsPAtferTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); @@ -364,36 +360,37 @@ struct hypertriton3bodyAnalysis { registry.fill(HIST("hDeuteronTOFVsPAfterTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); } - if (TMath::Abs(trackProton.tpcNSigmaPr()) > TpcPidNsigmaCut || TMath::Abs(trackPion.tpcNSigmaPi()) > TpcPidNsigmaCut || TMath::Abs(trackDeuteron.tpcNSigmaDe()) > TpcPidNsigmaCut) { - return; + double dcapion = isMatter ? candData.dcatrack1topv() : candData.dcatrack0topv(); + if (std::abs(dcapion) < dcapiontopv) { + return false; } - FillCandCounter(kCandTPCPID, isTrueCand); + FillCandCounter(kCandDcaToPV, isTrueCand); - if (trackProton.tpcNClsFound() < mintpcNClsproton || trackPion.tpcNClsFound() < mintpcNClspion || trackDeuteron.tpcNClsFound() < mintpcNClsdeuteron) { - return; + // Selection on candidate hypertriton + if (std::abs(candData.yHypertriton()) > rapiditycut) { + return false; } - FillCandCounter(kCandTPCNcls, isTrueCand); + FillCandCounter(kCandRapidity, isTrueCand); - if (trackProton.pt() < minProtonPt || trackProton.pt() > maxProtonPt || trackPion.pt() < minPionPt || trackPion.pt() > maxPionPt || trackDeuteron.pt() < minDeuteronPt || trackDeuteron.pt() > maxDeuteronPt) { - return; + double ct = candData.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassHyperTriton; + if (ct > lifetimecut) { + return false; } - FillCandCounter(kCandDauPt, isTrueCand); + FillCandCounter(kCandct, isTrueCand); - double dcapion = (track2.sign() > 0) ? candData.dcatrack1topv() : candData.dcatrack0topv(); - if (TMath::Abs(dcapion) < dcapiontopv) { - return; + double cospa = candData.vtxcosPA(collision.posX(), collision.posY(), collision.posZ()); + if (cospa < vtxcospa) { + return false; } - FillCandCounter(kCandDcaToPV, isTrueCand); - - // 3sigma region for Dalitz plot - double lowersignallimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; - double uppersignallimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; + FillCandCounter(kCandCosPA, isTrueCand); - // Hypertriton - if ((track2.sign() > 0 && candData.mHypertriton() > h3LMassLowerlimit && candData.mHypertriton() < h3LMassUpperlimit)) { - if_hasvtx = true; - FillCandCounter(kCandInvMass, isTrueCand); + if (candData.dcaVtxdaughters() > dcavtxdau) { + return false; + } + FillCandCounter(kCandDcaDau, isTrueCand); + if ((isMatter && candData.mHypertriton() > h3LMassLowerlimit && candData.mHypertriton() < h3LMassUpperlimit)) { + // Hypertriton registry.fill(HIST("hPtProton"), trackProton.pt()); registry.fill(HIST("hPtPionMinus"), trackPion.pt()); registry.fill(HIST("hPtDeuteron"), trackDeuteron.pt()); @@ -404,7 +401,7 @@ struct hypertriton3bodyAnalysis { registry.fill(HIST("hMassHypertriton"), candData.mHypertriton()); registry.fill(HIST("hMassHypertritonTotal"), candData.mHypertriton()); - registry.fill(HIST("h3dMassHypertriton"), 0., candData.pt(), candData.mHypertriton()); // dCollision.centV0M() instead of 0. once available + registry.fill(HIST("h3dMassHypertriton"), 0., candData.pt(), candData.mHypertriton()); // collision.centV0M() instead of 0. once available registry.fill(HIST("h3dTotalHypertriton"), ct, candData.pt(), candData.mHypertriton()); if (candData.mHypertriton() > lowersignallimit && candData.mHypertriton() < uppersignallimit) { registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(array{array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); @@ -412,11 +409,8 @@ struct hypertriton3bodyAnalysis { if (isTrueCand) { registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lPt, candData.mHypertriton()); } - } else if ((track2.sign() < 0 && candData.mAntiHypertriton() > h3LMassLowerlimit && candData.mAntiHypertriton() < h3LMassUpperlimit)) { + } else if ((!isMatter && candData.mAntiHypertriton() > h3LMassLowerlimit && candData.mAntiHypertriton() < h3LMassUpperlimit)) { // AntiHypertriton - if_hasvtx = true; - FillCandCounter(kCandInvMass, isTrueCand); - registry.fill(HIST("hPtAntiProton"), trackProton.pt()); registry.fill(HIST("hPtPionPlus"), trackPion.pt()); registry.fill(HIST("hPtAntiDeuteron"), trackDeuteron.pt()); @@ -427,7 +421,7 @@ struct hypertriton3bodyAnalysis { registry.fill(HIST("hMassAntiHypertriton"), candData.mAntiHypertriton()); registry.fill(HIST("hMassHypertritonTotal"), candData.mAntiHypertriton()); - registry.fill(HIST("h3dMassAntiHypertriton"), 0., candData.pt(), candData.mAntiHypertriton()); // dCollision.centV0M() instead of 0. once available + registry.fill(HIST("h3dMassAntiHypertriton"), 0., candData.pt(), candData.mAntiHypertriton()); // collision.centV0M() instead of 0. once available registry.fill(HIST("h3dTotalHypertriton"), ct, candData.pt(), candData.mAntiHypertriton()); if (candData.mAntiHypertriton() > lowersignallimit && candData.mAntiHypertriton() < uppersignallimit) { registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(array{array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); @@ -436,11 +430,14 @@ struct hypertriton3bodyAnalysis { registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lPt, candData.mHypertriton()); } } else { - return; + return false; } + + FillCandCounter(kCandInvMass, isTrueCand); + registry.fill(HIST("hDCAXYDeuteronToPV"), candData.dcaXYtrack2topv()); registry.fill(HIST("hDCADeuteronToPV"), candData.dcatrack2topv()); - registry.fill(HIST("hVtxCosPA"), candData.vtxcosPA(dCollision.posX(), dCollision.posY(), dCollision.posZ())); + registry.fill(HIST("hVtxCosPA"), candData.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("hDCAVtxDau"), candData.dcaVtxdaughters()); registry.fill(HIST("hProtonTPCNcls"), trackProton.tpcNClsCrossedRows()); registry.fill(HIST("hPionTPCNcls"), trackPion.tpcNClsCrossedRows()); @@ -455,6 +452,29 @@ struct hypertriton3bodyAnalysis { registry.fill(HIST("hPionTPCVsPt"), trackProton.pt(), trackPion.tpcNSigmaPi()); registry.fill(HIST("hDeuteronTPCVsPt"), trackDeuteron.pt(), trackDeuteron.tpcNSigmaDe()); registry.fill(HIST("hTOFPIDDeuteron"), candData.tofNSigmaBachDe()); + + return true; + } + + //------------------------------------------------------------------ + // Analysis process for a single candidate + template + void CandidateAnalysis(TCollisionTable const& collision, TCandTable const& candData, bool& if_hasvtx, bool isTrueCand = false, double MClifetime = -1, double lPt = -1) + { + + auto track0 = candData.template track0_as(); + auto track1 = candData.template track1_as(); + auto track2 = candData.template track2_as(); + + bool isMatter = track2.sign() > 0; + + auto& trackProton = isMatter ? track0 : track1; + auto& trackPion = isMatter ? track1 : track0; + auto& trackDeuteron = track2; + + if (SelectCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand, MClifetime, lPt)) { + if_hasvtx = true; + } } //------------------------------------------------------------------ @@ -462,7 +482,7 @@ struct hypertriton3bodyAnalysis { void GetGeneratedH3LInfo(aod::McParticles const& particlesMC) { for (auto& mcparticle : particlesMC) { - if (std::abs(mcparticle.pdgCode()) != 1010010030) { + if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { continue; } registry.fill(HIST("hGeneratedHypertritonCounter"), 0.5); @@ -479,22 +499,22 @@ struct hypertriton3bodyAnalysis { havePionPlus = true; if (mcparticleDaughter.pdgCode() == -211) havePionMinus = true; - if (mcparticleDaughter.pdgCode() == 1000010020) { + if (mcparticleDaughter.pdgCode() == bachelorPdgCode) { haveDeuteron = true; MClifetime = RecoDecay::sqrtSumOfSquares(mcparticleDaughter.vx() - mcparticle.vx(), mcparticleDaughter.vy() - mcparticle.vy(), mcparticleDaughter.vz() - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); } - if (mcparticleDaughter.pdgCode() == -1000010020) { + if (mcparticleDaughter.pdgCode() == -bachelorPdgCode) { haveAntiDeuteron = true; MClifetime = RecoDecay::sqrtSumOfSquares(mcparticleDaughter.vx() - mcparticle.vx(), mcparticleDaughter.vy() - mcparticle.vy(), mcparticleDaughter.vz() - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); } } - if (haveProton && havePionMinus && haveDeuteron && mcparticle.pdgCode() == 1010010030) { + if (haveProton && havePionMinus && haveDeuteron && mcparticle.pdgCode() == motherPdgCode) { registry.fill(HIST("hGeneratedHypertritonCounter"), 1.5); registry.fill(HIST("hPtGeneratedHypertriton"), mcparticle.pt()); registry.fill(HIST("hctGeneratedHypertriton"), MClifetime); registry.fill(HIST("hEtaGeneratedHypertriton"), mcparticle.eta()); registry.fill(HIST("hRapidityGeneratedHypertriton"), mcparticle.y()); - } else if (haveAntiProton && havePionPlus && haveAntiDeuteron && mcparticle.pdgCode() == -1010010030) { + } else if (haveAntiProton && havePionPlus && haveAntiDeuteron && mcparticle.pdgCode() == -motherPdgCode) { registry.fill(HIST("hGeneratedHypertritonCounter"), 1.5); registry.fill(HIST("hPtGeneratedAntiHypertriton"), mcparticle.pt()); registry.fill(HIST("hctGeneratedAntiHypertriton"), MClifetime); @@ -572,8 +592,8 @@ struct hypertriton3bodyAnalysis { // lLabel = lMother1.globalIndex(); lPt = lMother1.pt(); lPDG = lMother1.pdgCode(); - if ((lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) || - (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020)) { + if ((lPDG == motherPdgCode && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == bachelorPdgCode) || + (lPDG == -motherPdgCode && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -bachelorPdgCode)) { isTrueCand = true; MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * o2::constants::physics::MassHyperTriton / lMother2.p(); } @@ -598,6 +618,12 @@ struct hypertriton3bodyAnalysis { // check vtx3body with mclabels struct hypertriton3bodyLabelCheck { + + Configurable mc_event_selection{"mc_event_selection", true, "mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder"}; + Configurable event_posZ_selection{"event_posZ_selection", false, "event selection count post poZ cut"}; + Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; + Configurable motherPdgCode{"motherPdgCode", 1010010030, "pdgCode of mother track"}; + HistogramRegistry registry{"registry", {}}; void init(InitContext const&) @@ -634,10 +660,6 @@ struct hypertriton3bodyLabelCheck { } } - Configurable mc_event_selection{"mc_event_selection", true, "mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder"}; - Configurable event_posZ_selection{"event_posZ_selection", false, "event selection count post poZ cut"}; - Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - struct Indexdaughters { // check duplicated paired daughters int64_t index0; int64_t index1; @@ -713,7 +735,7 @@ struct hypertriton3bodyLabelCheck { auto lTrack0 = vtx.track0_as(); auto lTrack1 = vtx.track1_as(); auto lTrack2 = vtx.track2_as(); - if (std::abs(mcparticle.pdgCode()) != 1010010030) { + if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { continue; } registry.fill(HIST("hLabeledVtxCounter"), 1.5); diff --git a/PWGLF/Tasks/Nuspex/nucleiEbye.cxx b/PWGLF/Tasks/Nuspex/nucleiEbye.cxx index 3546d61da78..681d8b2892e 100644 --- a/PWGLF/Tasks/Nuspex/nucleiEbye.cxx +++ b/PWGLF/Tasks/Nuspex/nucleiEbye.cxx @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -357,6 +359,8 @@ struct nucleiEbye { histos.fill(HIST("QA/nClsTPC"), track.tpcNcls()); for (int iP{0}; iP < kNpart; ++iP) { + if (track.mass() != iP) + continue; if (trackPt < ptMin[iP] || trackPt > ptMax[iP]) { continue; } diff --git a/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx b/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx index ba53f7854b1..ab26df26ea1 100644 --- a/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx +++ b/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx @@ -22,6 +22,7 @@ #include #include #include "TGrid.h" +#include #include "CCDB/BasicCCDBManager.h" #include "CCDB/CcdbApi.h" @@ -110,6 +111,8 @@ struct nuclei_in_jets { Configurable max_nsigmaTPC{"max_nsigmaTPC", +3.0, "Maximum nsigma TPC"}; Configurable min_nsigmaTOF{"min_nsigmaTOF", -3.0, "Minimum nsigma TOF"}; Configurable max_nsigmaTOF{"max_nsigmaTOF", +3.5, "Maximum nsigma TOF"}; + Configurable max_pt_for_nsigmaTPC{"max_pt_for_nsigmaTPC", 2.0, "Maximum pt for TPC analysis"}; + Configurable min_pt_for_nsigmaTOF{"min_pt_for_nsigmaTOF", 0.5, "Minimum pt for TOF analysis"}; Configurable require_PV_contributor{"require_PV_contributor", true, "require that the track is a PV contributor"}; Configurable setDCAselectionPtDep{"setDCAselectionPtDep", true, "require pt dependent selection"}; Configurable applyReweighting{"applyReweighting", true, "apply reweighting"}; @@ -151,6 +154,7 @@ struct nuclei_in_jets { registryQC.add("sumPtUE", "sumPtUE", HistType::kTH1F, {{500, 0, 50, "#it{p}_{T} (GeV/#it{c})"}}); registryQC.add("nJets_found", "nJets_found", HistType::kTH1F, {{10, 0, 10, "#it{n}_{Jet}"}}); registryQC.add("nJets_selected", "nJets_selected", HistType::kTH1F, {{10, 0, 10, "#it{n}_{Jet}"}}); + registryQC.add("event_selection_jets", "event_selection_jets", HistType::kTH1F, {{10, 0, 10, "counter"}}); registryQC.add("dcaxy_vs_pt", "dcaxy_vs_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{xy} (cm)"}}); registryQC.add("dcaz_vs_pt", "dcaz_vs_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{z} (cm)"}}); registryQC.add("jet_ue_overlaps", "jet_ue_overlaps", HistType::kTH2F, {{20, 0.0, 20.0, "#it{n}_{jet}"}, {200, 0.0, 200.0, "#it{n}_{overlaps}"}}); @@ -178,10 +182,18 @@ struct nuclei_in_jets { registryData.add("antideuteron_ue_tpc", "antideuteron_ue_tpc", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); registryData.add("antideuteron_ue_tof", "antideuteron_ue_tof", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + // Deuterons + registryData.add("deuteron_jet_tof", "deuteron_jet_tof", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + registryData.add("deuteron_ue_tof", "deuteron_ue_tof", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + // Antihelium-3 registryData.add("antihelium3_jet_tpc", "antihelium3_jet_tpc", HistType::kTH2F, {{nbins, min * 3, max * 3, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); registryData.add("antihelium3_ue_tpc", "antihelium3_ue_tpc", HistType::kTH2F, {{nbins, min * 3, max * 3, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + // Helium-3 + registryData.add("helium3_jet_tpc", "helium3_jet_tpc", HistType::kTH2F, {{nbins, min * 3, max * 3, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("helium3_ue_tpc", "helium3_ue_tpc", HistType::kTH2F, {{nbins, min * 3, max * 3, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + // Generated registryMC.add("antiproton_jet_gen", "antiproton_jet_gen", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antideuteron_jet_gen", "antideuteron_jet_gen", HistType::kTH1F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}}); @@ -253,9 +265,9 @@ struct nuclei_in_jets { // standard selection if (!setDCAselectionPtDep) { - if (TMath::Abs(track.dcaXY()) > 0.1) + if (TMath::Abs(track.dcaXY()) > max_dcaxy) return false; - if (TMath::Abs(track.dcaZ()) > 0.1) + if (TMath::Abs(track.dcaZ()) > max_dcaz) return false; } @@ -367,7 +379,7 @@ struct nuclei_in_jets { double c = pz * pz * pz * pz - py * py * py * py - px * px * py * py; double delta = b * b - 4.0 * a * c; - // Protection agains delta<0 + // Protection against delta<0 if (delta < 0) { return; } @@ -429,6 +441,7 @@ struct nuclei_in_jets { { // Event Counter: before event selection registryData.fill(HIST("number_of_events_data"), 0.5); + registryQC.fill(HIST("event_selection_jets"), 0.5); // all events before jet selection // Event Selection if (!collision.sel8()) @@ -580,8 +593,27 @@ struct nuclei_in_jets { if (n_jets_selected == 0) return; registryData.fill(HIST("number_of_events_data"), 3.5); + registryQC.fill(HIST("event_selection_jets"), 1.5); // events with pTjet>10 GeV/c selected //************************************************************************************************************************************ + // Leading Track + double pt_max(0); + + // Loop over Reconstructed Tracks + for (auto const& track : tracks) { + + if (!passedTrackSelectionForJetReconstruction(track)) + continue; + + if (track.pt() > pt_max) { + pt_max = track.pt(); + } + } + // Event Counter: Skip Events with pt 5 GeV/c selected + // Overlaps int nOverlaps(0); for (int i = 0; i < static_cast(jet.size()); i++) { @@ -617,8 +649,6 @@ struct nuclei_in_jets { continue; if (require_PV_contributor && !(track.isPVContributor())) continue; - if (track.sign() > 0) - continue; // Variables double nsigmaTPCPr = track.tpcNSigmaPr(); @@ -642,15 +672,16 @@ struct nuclei_in_jets { double deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); // DCAxy Distributions of Antiprotons - if (isHighPurityAntiproton(track) && TMath::Abs(dcaz) < max_dcaz) { - if (deltaR_jet < Rjet) { - registryData.fill(HIST("antiproton_dca_jet"), pt, dcaxy); - } - if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { - registryData.fill(HIST("antiproton_dca_ue"), pt, dcaxy); + if (track.sign() < 0) { // only antiprotons + if (isHighPurityAntiproton(track) && TMath::Abs(dcaz) < max_dcaz) { + if (deltaR_jet < Rjet) { + registryData.fill(HIST("antiproton_dca_jet"), pt, dcaxy); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryData.fill(HIST("antiproton_dca_ue"), pt, dcaxy); + } } } - // DCA Cuts if (TMath::Abs(dcaxy) > max_dcaxy) continue; @@ -660,39 +691,61 @@ struct nuclei_in_jets { // Jet if (deltaR_jet < Rjet) { - // Antiproton - if (pt < 1.0) - registryData.fill(HIST("antiproton_jet_tpc"), pt, nsigmaTPCPr); - if (pt >= 0.5 && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC && track.hasTOF()) - registryData.fill(HIST("antiproton_jet_tof"), pt, nsigmaTOFPr); + if (track.sign() < 0) { // only antimatter + // Antiproton + if (pt < max_pt_for_nsigmaTPC) + registryData.fill(HIST("antiproton_jet_tpc"), pt, nsigmaTPCPr); + if (pt >= min_pt_for_nsigmaTOF && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC && track.hasTOF()) + registryData.fill(HIST("antiproton_jet_tof"), pt, nsigmaTOFPr); + + // Antideuteron + if (pt < max_pt_for_nsigmaTPC) + registryData.fill(HIST("antideuteron_jet_tpc"), pt, nsigmaTPCDe); + if (pt >= min_pt_for_nsigmaTOF && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC && track.hasTOF()) + registryData.fill(HIST("antideuteron_jet_tof"), pt, nsigmaTOFDe); + + // Antihelium3 + registryData.fill(HIST("antihelium3_jet_tpc"), 2.0 * pt, nsigmaTPCHe); + } - // Antideuteron - if (pt < 1.0) - registryData.fill(HIST("antideuteron_jet_tpc"), pt, nsigmaTPCDe); - if (pt >= 0.5 && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC && track.hasTOF()) - registryData.fill(HIST("antideuteron_jet_tof"), pt, nsigmaTOFDe); + if (track.sign() > 0) { // only matter + // Deuteron + if (pt >= min_pt_for_nsigmaTOF && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC && track.hasTOF()) + registryData.fill(HIST("deuteron_jet_tof"), pt, nsigmaTOFDe); - // Antihelium3 - registryData.fill(HIST("antihelium3_jet_tpc"), 2.0 * pt, nsigmaTPCHe); + // Helium3 + registryData.fill(HIST("helium3_jet_tpc"), 2.0 * pt, nsigmaTPCHe); + } } // UE if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { - // Antiproton - if (pt < 1.0) - registryData.fill(HIST("antiproton_ue_tpc"), pt, nsigmaTPCPr); - if (pt >= 0.5 && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC && track.hasTOF()) - registryData.fill(HIST("antiproton_ue_tof"), pt, nsigmaTOFPr); + if (track.sign() < 0) { // only antimatter + // Antiproton + if (pt < max_pt_for_nsigmaTPC) + registryData.fill(HIST("antiproton_ue_tpc"), pt, nsigmaTPCPr); + if (pt >= min_pt_for_nsigmaTOF && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC && track.hasTOF()) + registryData.fill(HIST("antiproton_ue_tof"), pt, nsigmaTOFPr); + + // Antideuteron + if (pt < max_pt_for_nsigmaTPC) + registryData.fill(HIST("antideuteron_ue_tpc"), pt, nsigmaTPCDe); + if (pt >= min_pt_for_nsigmaTOF && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC && track.hasTOF()) + registryData.fill(HIST("antideuteron_ue_tof"), pt, nsigmaTOFDe); + + // Antihelium3 + registryData.fill(HIST("antihelium3_ue_tpc"), 2.0 * pt, nsigmaTPCHe); + } - // Antideuteron - if (pt < 1.0) - registryData.fill(HIST("antideuteron_ue_tpc"), pt, nsigmaTPCDe); - if (pt >= 0.5 && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC && track.hasTOF()) - registryData.fill(HIST("antideuteron_ue_tof"), pt, nsigmaTOFDe); + if (track.sign() > 0) { // only matter + // Deuteron + if (pt >= min_pt_for_nsigmaTOF && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC && track.hasTOF()) + registryData.fill(HIST("deuteron_ue_tof"), pt, nsigmaTOFDe); - // Antihelium3 - registryData.fill(HIST("antihelium3_ue_tpc"), 2.0 * pt, nsigmaTPCHe); + // Helium3 + registryData.fill(HIST("helium3_ue_tpc"), 2.0 * pt, nsigmaTPCHe); + } } } } @@ -840,11 +893,11 @@ struct nuclei_in_jets { // Antiproton if (particle.pdgCode() == -2212) { - if (pt < 1.0 && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC) { + if (pt < max_pt_for_nsigmaTPC && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC) { registryMC.fill(HIST("antiproton_jet_rec_tpc"), pt, w_antip_jet); registryMC.fill(HIST("antiproton_ue_rec_tpc"), pt, w_antip_ue); } - if (pt >= 0.5 && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC && track.hasTOF() && nsigmaTOFPr > min_nsigmaTOF && nsigmaTOFPr < max_nsigmaTOF) { + if (pt >= min_pt_for_nsigmaTOF && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC && track.hasTOF() && nsigmaTOFPr > min_nsigmaTOF && nsigmaTOFPr < max_nsigmaTOF) { registryMC.fill(HIST("antiproton_jet_rec_tof"), pt, w_antip_jet); registryMC.fill(HIST("antiproton_ue_rec_tof"), pt, w_antip_ue); } @@ -852,11 +905,11 @@ struct nuclei_in_jets { // Antideuteron if (particle.pdgCode() == -1000010020) { - if (pt < 1.0 && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC) { + if (pt < max_pt_for_nsigmaTPC && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC) { registryMC.fill(HIST("antideuteron_jet_rec_tpc"), pt); registryMC.fill(HIST("antideuteron_ue_rec_tpc"), pt); } - if (pt >= 0.5 && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC && track.hasTOF() && nsigmaTOFDe > min_nsigmaTOF && nsigmaTOFDe < max_nsigmaTOF) { + if (pt >= min_pt_for_nsigmaTOF && nsigmaTPCDe > min_nsigmaTPC && nsigmaTPCDe < max_nsigmaTPC && track.hasTOF() && nsigmaTOFDe > min_nsigmaTOF && nsigmaTOFDe < max_nsigmaTOF) { registryMC.fill(HIST("antideuteron_jet_rec_tof"), pt); registryMC.fill(HIST("antideuteron_ue_rec_tof"), pt); } @@ -1095,9 +1148,9 @@ struct nuclei_in_jets { continue; } if (!setDCAselectionPtDep) { - if (dcaxy > 0.1) + if (dcaxy > max_dcaxy) continue; - if (dcaz > 0.1) + if (dcaz > max_dcaz) continue; } @@ -1196,9 +1249,9 @@ struct nuclei_in_jets { continue; } if (!setDCAselectionPtDep) { - if (dcaxy > 0.1) + if (dcaxy > max_dcaxy) continue; - if (dcaz > 0.1) + if (dcaz > max_dcaz) continue; } diff --git a/PWGLF/Tasks/Nuspex/spectraTOF.cxx b/PWGLF/Tasks/Nuspex/spectraTOF.cxx index b6d7c6cc2ec..dd7d43705f6 100644 --- a/PWGLF/Tasks/Nuspex/spectraTOF.cxx +++ b/PWGLF/Tasks/Nuspex/spectraTOF.cxx @@ -18,6 +18,7 @@ /// // O2 includes +#include #include "ReconstructionDataFormats/Track.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -38,7 +39,6 @@ #include "PWGLF/DataModel/mcCentrality.h" #include "Common/Core/RecoDecay.h" #include "TPDGCode.h" - using namespace o2; using namespace o2::track; using namespace o2::framework; @@ -52,16 +52,21 @@ std::array, NpCharge> hDcaXYZMat; std::array, NpCharge> hDcaXYWrongCollisionPrm; std::array, NpCharge> hDcaXYWrongCollisionStr; std::array, NpCharge> hDcaXYWrongCollisionMat; -std::array, NpCharge> hDcaXYMC; // DCA xy in the MC -std::array, NpCharge> hDcaZMC; // DCA z in the MC -std::array, NpCharge> hDcaXYMCD0; // DCA xy in the MC for particles from D0 -std::array, NpCharge> hDcaZMCD0; // DCA z in the MC for particles from D0 -std::array, NpCharge> hDcaXYMCCharm; // DCA xy in the MC for particles from charm -std::array, NpCharge> hdcaZMCCharm; // DCA z in the MC for particles from charm -std::array, NpCharge> hDcaXYMCBeauty; // DCA xy in the MC for particles from beauty -std::array, NpCharge> hDcaZMCBeauty; // DCA z in the MC for particles from beauty -std::array, NpCharge> hDcaXYMCNotHF; // DCA xy in the MC for particles from not a HF -std::array, NpCharge> hDcaZMCNotHF; // DCA z in the MC for particles from not a HF +std::array, NpCharge> hDcaXYMC; // DCA xy in the MC +std::array, NpCharge> hDcaZMC; // DCA z in the MC +std::array, NpCharge> hDcaXYMCD0; // DCA xy in the MC for particles from D0 +std::array, NpCharge> hDcaZMCD0; // DCA z in the MC for particles from D0 +std::array, NpCharge> hDcaXYMCCharm; // DCA xy in the MC for particles from charm +std::array, NpCharge> hdcaZMCCharm; // DCA z in the MC for particles from charm +std::array, NpCharge> hDcaXYMCBeauty; // DCA xy in the MC for particles from beauty +std::array, NpCharge> hDcaZMCBeauty; // DCA z in the MC for particles from beauty +std::array, NpCharge> hDcaXYMCNotHF; // DCA xy in the MC for particles from not a HF +std::array, NpCharge> hDcaZMCNotHF; // DCA z in the MC for particles from not a HF +std::array, NpCharge> hDecayLengthStr; // Decay Length for particles from Strange +std::array, NpCharge> hDecayLengthMCD0; // Decay Length in the MC for particles from D0 +std::array, NpCharge> hDecayLengthMCCharm; // Decay Length in the MC for particles from charm +std::array, NpCharge> hDecayLengthMCBeauty; // Decay Length in the MC for particles from charm +std::array, NpCharge> hDecayLengthMCNotHF; // Decay Length in the MC for particles from not a HF // Spectra task struct tofSpectra { @@ -335,6 +340,7 @@ struct tofSpectra { const AxisSpec phiAxis{200, 0, 7, "#it{#varphi} (rad)"}; const AxisSpec dcaZAxis{binsOptions.binsDca, "DCA_{z} (cm)"}; const AxisSpec lengthAxis{100, 0, 600, "Track length (cm)"}; + const AxisSpec decayLengthAxis{100, 0, 0.1, "Decay Length (cm)"}; if (enableTrackCutHistograms) { const AxisSpec chargeAxis{2, -2.f, 2.f, "Charge"}; @@ -416,12 +422,12 @@ struct tofSpectra { histos.add("Data/neg/pt/tpc", "neg TPC", kTH1D, {ptAxis}); if (includeCentralityToTracks) { - histos.add("Data/cent/pos/pt/its_tpc_tof", "pos ITS-TPC-TOF", kTH2D, {ptAxis, multAxis}); - histos.add("Data/cent/neg/pt/its_tpc_tof", "neg ITS-TPC-TOF", kTH2D, {ptAxis, multAxis}); - histos.add("Data/cent/pos/pt/its_tpc", "pos ITS-TPC", kTH2D, {ptAxis, multAxis}); - histos.add("Data/cent/neg/pt/its_tpc", "neg ITS-TPC", kTH2D, {ptAxis, multAxis}); - histos.add("Data/cent/pos/pt/its_tof", "pos ITS-TOF", kTH2D, {ptAxis, multAxis}); - histos.add("Data/cent/neg/pt/its_tof", "neg ITS-TOF", kTH2D, {ptAxis, multAxis}); + histos.add("Data/cent/pos/pt/its_tpc_tof", "pos ITS-TPC-TOF", kTH3D, {ptAxis, multAxis, occupancyAxis}); + histos.add("Data/cent/neg/pt/its_tpc_tof", "neg ITS-TPC-TOF", kTH3D, {ptAxis, multAxis, occupancyAxis}); + histos.add("Data/cent/pos/pt/its_tpc", "pos ITS-TPC", kTH3D, {ptAxis, multAxis, occupancyAxis}); + histos.add("Data/cent/neg/pt/its_tpc", "neg ITS-TPC", kTH3D, {ptAxis, multAxis, occupancyAxis}); + histos.add("Data/cent/pos/pt/its_tof", "pos ITS-TOF", kTH3D, {ptAxis, multAxis, occupancyAxis}); + histos.add("Data/cent/neg/pt/its_tof", "neg ITS-TOF", kTH3D, {ptAxis, multAxis, occupancyAxis}); } if (doprocessOccupancy) { @@ -634,7 +640,6 @@ struct tofSpectra { } histos.add(hpt_den_prm_mcgoodev[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis}); histos.add(hpt_den_prm_mcbadev[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis}); - const std::string cpName = Form("/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]); if (enableDCAxyzHistograms) { hDcaXYZPrm[i] = histos.add("dcaprm" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); @@ -654,6 +659,7 @@ struct tofSpectra { histos.add(hdcazstr[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); histos.add(hdcaxymat[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); histos.add(hdcazmat[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); + hDecayLengthStr[i] = histos.add("decaylengthstr" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis}); if (enableDcaGoodEvents) { histos.add(hdcaxyprmgoodevs[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); histos.add(hdcazprmgoodevs[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); @@ -669,6 +675,10 @@ struct tofSpectra { hdcaZMCCharm[i] = histos.add("dcazcharm" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); hDcaXYMCBeauty[i] = histos.add("dcaxybeauty" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); hDcaZMCBeauty[i] = histos.add("dcazbeauty" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); + hDecayLengthMCD0[i] = histos.add("decaylengthD0" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis}); + hDecayLengthMCCharm[i] = histos.add("decaylengthcharm" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis}); + hDecayLengthMCBeauty[i] = histos.add("decaylengthbeauty" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis}); + hDecayLengthMCNotHF[i] = histos.add("decaylengthnothf" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis}); } } @@ -725,7 +735,6 @@ struct tofSpectra { const auto& nsigmaTPC = o2::aod::pidutils::tpcNSigma(track); // const auto id = track.sign() > 0 ? id : id + Np; const float multiplicity = getMultiplicity(collision); - if (multiplicityEstimator == MultCodes::kNoMultiplicity) { if (track.sign() > 0) { histos.fill(HIST(hnsigmatpc[id]), track.pt(), nsigmaTPC); @@ -1114,7 +1123,7 @@ struct tofSpectra { } template - bool isTrackSelected(TrackType const& track, CollisionType const& collision) + bool isTrackSelected(TrackType const& track, CollisionType const& /*collision*/) { if constexpr (fillHistograms) { histos.fill(HIST("tracksel"), 1); @@ -1210,14 +1219,8 @@ struct tofSpectra { if (track.hasITS() && track.hasTPC() && track.hasTOF()) { if (track.sign() > 0) { histos.fill(HIST("Data/pos/pt/its_tpc_tof"), track.pt()); - if (includeCentralityToTracks) { - histos.fill(HIST("Data/cent/pos/pt/its_tpc_tof"), track.pt(), collision.centFT0C()); - } } else { histos.fill(HIST("Data/neg/pt/its_tpc_tof"), track.pt()); - if (includeCentralityToTracks) { - histos.fill(HIST("Data/cent/neg/pt/its_tpc_tof"), track.pt(), collision.centFT0C()); - } } } if (track.hasITS() && track.hasTRD() && track.hasTOF()) { @@ -1237,14 +1240,8 @@ struct tofSpectra { if (track.hasITS() && track.hasTPC()) { if (track.sign() > 0) { histos.fill(HIST("Data/pos/pt/its_tpc"), track.pt()); - if (includeCentralityToTracks) { - histos.fill(HIST("Data/cent/pos/pt/its_tpc"), track.pt(), collision.centFT0C()); - } } else { histos.fill(HIST("Data/neg/pt/its_tpc"), track.pt()); - if (includeCentralityToTracks) { - histos.fill(HIST("Data/cent/neg/pt/its_tpc"), track.pt(), collision.centFT0C()); - } } } if (track.hasTRD() && track.hasTOF()) { @@ -1264,14 +1261,8 @@ struct tofSpectra { if (track.hasITS() && track.hasTOF()) { if (track.sign() > 0) { histos.fill(HIST("Data/pos/pt/its_tof"), track.pt()); - if (includeCentralityToTracks) { - histos.fill(HIST("Data/cent/pos/pt/its_tof"), track.pt(), collision.centFT0C()); - } } else { histos.fill(HIST("Data/neg/pt/its_tof"), track.pt()); - if (includeCentralityToTracks) { - histos.fill(HIST("Data/cent/neg/pt/its_tof"), track.pt(), collision.centFT0C()); - } } } if (track.hasTPC() && track.hasTRD()) { @@ -1353,26 +1344,60 @@ struct tofSpectra { if (!isTrackSelected(track, collision)) { continue; } - const auto& nsigmaTPCPi = o2::aod::pidutils::tpcNSigma<2>(track); - const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track); - const auto& nsigmaTPCPr = o2::aod::pidutils::tpcNSigma<4>(track); - const auto& nsigmaTOFPi = o2::aod::pidutils::tofNSigma<2>(track); - const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track); - const auto& nsigmaTOFPr = o2::aod::pidutils::tofNSigma<4>(track); - histos.fill(HIST("nsigmatpc/test_occupancy/pos/pi"), track.pt(), nsigmaTPCPi, multiplicity, occupancy); - histos.fill(HIST("nsigmatpc/test_occupancy/neg/pi"), track.pt(), nsigmaTPCPi, multiplicity, occupancy); - histos.fill(HIST("nsigmatpc/test_occupancy/pos/ka"), track.pt(), nsigmaTPCKa, multiplicity, occupancy); - histos.fill(HIST("nsigmatpc/test_occupancy/neg/ka"), track.pt(), nsigmaTPCKa, multiplicity, occupancy); - histos.fill(HIST("nsigmatpc/test_occupancy/pos/pr"), track.pt(), nsigmaTPCPr, multiplicity, occupancy); - histos.fill(HIST("nsigmatpc/test_occupancy/neg/pr"), track.pt(), nsigmaTPCPr, multiplicity, occupancy); - - histos.fill(HIST("nsigmatof/test_occupancy/pos/pi"), track.pt(), nsigmaTOFPi, multiplicity, occupancy); - histos.fill(HIST("nsigmatof/test_occupancy/neg/pi"), track.pt(), nsigmaTOFPi, multiplicity, occupancy); - histos.fill(HIST("nsigmatof/test_occupancy/pos/ka"), track.pt(), nsigmaTOFKa, multiplicity, occupancy); - histos.fill(HIST("nsigmatof/test_occupancy/neg/ka"), track.pt(), nsigmaTOFKa, multiplicity, occupancy); - histos.fill(HIST("nsigmatof/test_occupancy/pos/pr"), track.pt(), nsigmaTOFPr, multiplicity, occupancy); - histos.fill(HIST("nsigmatof/test_occupancy/neg/pr"), track.pt(), nsigmaTOFPr, multiplicity, occupancy); + if (std::abs(track.rapidity(PID::getMass(2))) > trkselOptions.cfgCutY) { + return; + } + if (std::abs(track.rapidity(PID::getMass(3))) > trkselOptions.cfgCutY) { + return; + } + if (std::abs(track.rapidity(PID::getMass(4))) > trkselOptions.cfgCutY) { + return; + } + if (includeCentralityToTracks) { + if (track.sign() > 0) { + if (track.hasITS() && track.hasTPC() && track.hasTOF()) { + histos.fill(HIST("Data/cent/pos/pt/its_tpc_tof"), track.pt(), collision.centFT0C(), occupancy); + } + if (track.hasITS() && track.hasTOF()) { + histos.fill(HIST("Data/cent/pos/pt/its_tof"), track.pt(), collision.centFT0C(), occupancy); + } + if (track.hasITS() && track.hasTPC()) { + histos.fill(HIST("Data/cent/pos/pt/its_tpc"), track.pt(), collision.centFT0C(), occupancy); + } + } else { + if (track.hasITS() && track.hasTPC() && track.hasTOF()) { + histos.fill(HIST("Data/cent/neg/pt/its_tpc_tof"), track.pt(), collision.centFT0C(), occupancy); + } + if (track.hasITS() && track.hasTPC()) { + histos.fill(HIST("Data/cent/neg/pt/its_tpc"), track.pt(), collision.centFT0C(), occupancy); + } + if (track.hasITS() && track.hasTOF()) { + histos.fill(HIST("Data/cent/neg/pt/its_tof"), track.pt(), collision.centFT0C(), occupancy); + } + } + } + if (track.sign() > 0) { + histos.fill(HIST("nsigmatpc/test_occupancy/pos/pi"), track.pt(), track.tpcNSigmaPi(), multiplicity, occupancy); + histos.fill(HIST("nsigmatpc/test_occupancy/pos/ka"), track.pt(), track.tpcNSigmaKa(), multiplicity, occupancy); + histos.fill(HIST("nsigmatpc/test_occupancy/pos/pr"), track.pt(), track.tpcNSigmaPr(), multiplicity, occupancy); + } else if (track.sign() < 0) { + histos.fill(HIST("nsigmatpc/test_occupancy/neg/pi"), track.pt(), track.tpcNSigmaPi(), multiplicity, occupancy); + histos.fill(HIST("nsigmatpc/test_occupancy/neg/ka"), track.pt(), track.tpcNSigmaKa(), multiplicity, occupancy); + histos.fill(HIST("nsigmatpc/test_occupancy/neg/pr"), track.pt(), track.tpcNSigmaPr(), multiplicity, occupancy); + } + if (!track.hasTOF()) { + return; + } + if (track.sign() > 0) { + histos.fill(HIST("nsigmatof/test_occupancy/pos/pi"), track.pt(), track.tofNSigmaPi(), multiplicity, occupancy); + histos.fill(HIST("nsigmatof/test_occupancy/pos/ka"), track.pt(), track.tofNSigmaKa(), multiplicity, occupancy); + histos.fill(HIST("nsigmatof/test_occupancy/pos/pr"), track.pt(), track.tofNSigmaPr(), multiplicity, occupancy); + } else if (track.sign() < 0) { + histos.fill(HIST("nsigmatof/test_occupancy/neg/pi"), track.pt(), track.tofNSigmaPi(), multiplicity, occupancy); + histos.fill(HIST("nsigmatof/test_occupancy/neg/ka"), track.pt(), track.tofNSigmaKa(), multiplicity, occupancy); + histos.fill(HIST("nsigmatof/test_occupancy/neg/pr"), track.pt(), track.tofNSigmaPr(), multiplicity, occupancy); + } } // track } // process function PROCESS_SWITCH(tofSpectra, processOccupancy, "check for occupancy plots", false); @@ -1625,6 +1650,13 @@ struct tofSpectra { histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY()); histos.fill(HIST(hdcazstr[i]), track.pt(), track.dcaZ()); } + if (mcParticle.has_daughters()) { + auto daughter0 = mcParticle.template daughters_as().begin(); + double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; + double vertexPrimary[3] = {mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()}; + auto decayLength = RecoDecay::distance(vertexPrimary, vertexDau) / 10000; + hDecayLengthStr[i]->Fill(track.pt(), decayLength); + } } else { if (enableDCAxyzHistograms) { hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); @@ -1653,23 +1685,23 @@ struct tofSpectra { bool IsD0Mother = false; bool IsCharmMother = false; bool IsBeautyMother = false; + bool IsNotHFMother = false; if (mcParticle.has_mothers()) { const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false); for (const auto& mother : mcParticle.template mothers_as()) { - const int motherPdgCode = mother.pdgCode(); + const int motherPdgCode = std::abs(mother.pdgCode()); if (motherPdgCode == 421) { IsD0Mother = true; } - if (charmOrigin == RecoDecay::OriginType::NonPrompt) { - if ((motherPdgCode) / 1000 == 5 || (motherPdgCode) / 100 == 5) { - IsBeautyMother = true; - } + if (charmOrigin == RecoDecay::OriginType::NonPrompt && ((motherPdgCode) / 1000 == 5 || (motherPdgCode) / 100 == 5)) { + IsBeautyMother = true; + } + if (charmOrigin == RecoDecay::OriginType::Prompt && ((motherPdgCode) / 1000 == 4 || (motherPdgCode) / 100 == 4)) { + IsCharmMother = true; } - if (charmOrigin == RecoDecay::OriginType::Prompt) { - if ((motherPdgCode) / 1000 == 4 || (motherPdgCode) / 100 == 4) { - IsCharmMother = true; - } + if (!(motherPdgCode / 1000 == 4 || motherPdgCode / 100 == 4) && !(motherPdgCode / 1000 == 5 || motherPdgCode / 100 == 5)) { + IsNotHFMother = true; } } } @@ -1685,10 +1717,30 @@ struct tofSpectra { hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY()); hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ()); } - if (!IsCharmMother && !IsBeautyMother) { + if (IsNotHFMother) { hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY()); hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ()); } + + if (mcParticle.has_daughters()) { + auto daughter0 = mcParticle.template daughters_as().begin(); + double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; + double vertexPrimary[3] = {mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()}; + auto decayLength = RecoDecay::distance(vertexPrimary, vertexDau) / 10000; + + if (IsD0Mother) { + hDecayLengthMCD0[i]->Fill(track.pt(), decayLength); + } + if (IsCharmMother) { + hDecayLengthMCCharm[i]->Fill(track.pt(), decayLength); + } + if (IsBeautyMother) { + hDecayLengthMCBeauty[i]->Fill(track.pt(), decayLength); + } + if (IsNotHFMother) { + hDecayLengthMCNotHF[i]->Fill(track.pt(), decayLength); + } + } } } diff --git a/PWGLF/Tasks/QC/CMakeLists.txt b/PWGLF/Tasks/QC/CMakeLists.txt index 20377eb08cb..5fba2292100 100644 --- a/PWGLF/Tasks/QC/CMakeLists.txt +++ b/PWGLF/Tasks/QC/CMakeLists.txt @@ -72,7 +72,7 @@ o2physics_add_dpl_workflow(tpc-dedx-qa o2physics_add_dpl_workflow(vertexqa SOURCES vertexQA.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(efficiencyqa diff --git a/PWGLF/Tasks/QC/vertexQA.cxx b/PWGLF/Tasks/QC/vertexQA.cxx index 5e9060d51ce..66ae298813d 100644 --- a/PWGLF/Tasks/QC/vertexQA.cxx +++ b/PWGLF/Tasks/QC/vertexQA.cxx @@ -9,14 +9,18 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include #include -#include #include -#include +#include +#include +#include -#include "Framework/runDataProcessing.h" +#include "CCDB/BasicCCDBManager.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" using namespace o2; using namespace o2::framework; @@ -34,7 +38,7 @@ double deltaTimeColl(BCcoll const bccoll1, BCcoll const bccoll2) auto coll2 = std::get(bccoll2); auto bc1 = std::get(bccoll1); auto bc2 = std::get(bccoll2); - int64_t tmpDT = int64_t(bc1.globalBC()) - int64_t(bc2.globalBC()); + int64_t tmpDT = static_cast(bc1.globalBC()) - static_cast(bc2.globalBC()); double deltaT = tmpDT * LHCBunchSpacingNS + coll1.collisionTime() - coll2.collisionTime(); return deltaT; } @@ -57,6 +61,9 @@ DECLARE_SOA_TABLE(VtxQAtable, "AOD", "VTXQATABLE", } // namespace o2::aod struct vertexQA { + Service ccdb; + ctpRateFetcher mRateFetcher; + Produces vtxQAtable; Configurable storeTree{"storeTree", 1000, "Store in tree collisions from BC's with more than 'storeTree' vertices, for in-depth analysis"}; @@ -87,10 +94,15 @@ struct vertexQA { ConfigurableAxis nContribAxis{"nContribBins", {1000, 0, 5000}, "Binning for number of contributors to PV"}; ConfigurableAxis nContribDiffAxis{"nContribDiffBins", {1000, -5000, 5000}, "Binning for the difference in number of contributors to PV"}; + ConfigurableAxis irBinning{"IRbinning", {500, 0, 100}, "Binning for the interaction rate (kHz)"}; + Configurable irSource{"irSource", "ZNC hadronic", "Source of the interaction rate"}; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; std::deque colls; + int64_t mFirstBCid = -1; + void init(InitContext const&) { histos.add("nVtxHistogram", ";#it{N}_{vtx}^{rec};Entries", HistType::kTH1F, {nVtxAxis}); @@ -121,6 +133,11 @@ struct vertexQA { histos.add("nContribITSRofTimeSeriesHistogram", ";#it{N}_{contrib}^{1};#it{N}_{contrib}^{2}", HistType::kTH2F, {nContribAxis, nContribAxis}); histos.add("tDiffDuplicateTimeSeriesHistogram", ";#Delta#it{t}_{vtx} (ns);Entries", HistType::kTH1F, {tDiffVtxAxisExtend}); + histos.add("tIRvsCollisionRateHistogram", Form(";IR from %s (kHz);IR from reconstructed vertices (kHz)", irSource.value.data()), HistType::kTH2D, {irBinning, irBinning}); + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setFatalWhenNull(false); } void process(aod::BC const& bc, aod::Collisions const& collisions) @@ -231,6 +248,48 @@ struct vertexQA { } } } + PROCESS_SWITCH(vertexQA, process, "Standard vertex QA", true); + + void processIR(aod::BCsWithTimestamps const& bcs, aod::Collisions const& collisions) + { + if (collisions.size() <= 2) { + return; + } + + std::vector jumps{0ll}; + int64_t lastBC = bcs.rawIteratorAt(0).globalBC(); + for (auto bc : bcs) { + if (bc.globalBC() - lastBC > 3564 * 32) { // 32 orbits + jumps.push_back(bc.globalIndex()); + lastBC = bc.globalBC(); + } + } + uint64_t jumpsSentinel{1}; + std::vector collisionsIndices{0ll}; + for (auto col : collisions) { + if (jumpsSentinel == jumps.size()) { + break; + } + if (col.bcId() > jumps[jumpsSentinel]) { + collisionsIndices.push_back(col.globalIndex()); + jumpsSentinel++; + } + } + jumps.push_back(bcs.size()); + collisionsIndices.push_back(collisions.size()); + + for (size_t i{0}; i < jumps.size() - 1; ++i) { + auto startBC = bcs.rawIteratorAt(jumps[i]); + auto endBC = bcs.rawIteratorAt(jumps[i + 1] - 1); + double startIR = mRateFetcher.fetch(ccdb.service, startBC.timestamp(), startBC.runNumber(), irSource.value); + double endIR = mRateFetcher.fetch(ccdb.service, endBC.timestamp(), endBC.runNumber(), irSource.value); + double deltaT = (endBC.globalBC() - startBC.globalBC()) * LHCBunchSpacingNS * 1.e-9; + double collisionRate = (collisionsIndices[i + 1] - collisionsIndices[i]) / deltaT; /// -1 to remove the bias of the collisions at extremities? + double ir = (startIR + endIR) * 0.5; + histos.fill(HIST("tIRvsCollisionRateHistogram"), ir * 1.e-3, collisionRate * 1.e-3); + } + } + PROCESS_SWITCH(vertexQA, processIR, "Checks on interaction rate", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index 1eb6e473faf..d49deced8f3 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -24,6 +24,11 @@ o2physics_add_dpl_workflow(k892analysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(k892analysispbpb + SOURCES k892analysis_PbPb.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(kstar892analysis SOURCES kstar892analysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -134,6 +139,11 @@ o2physics_add_dpl_workflow(xi1530analysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(xi1530analysisqa + SOURCES xi1530Analysisqa.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(kaonkaonanalysis SOURCES kaonkaonanalysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -153,3 +163,8 @@ o2physics_add_dpl_workflow(highmasslambdasvx SOURCES highmasslambdasvx.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(chk892flow + SOURCES chk892flow.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Resonances/KshortKshort.cxx b/PWGLF/Tasks/Resonances/KshortKshort.cxx index 4bf26ff3330..69e967b2d94 100644 --- a/PWGLF/Tasks/Resonances/KshortKshort.cxx +++ b/PWGLF/Tasks/Resonances/KshortKshort.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include "TF1.h" #include "TRandom3.h" #include "Math/Vector3D.h" @@ -79,6 +80,8 @@ struct strangeness_tutorial { Configurable goodzvertex{"goodzvertex", false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; Configurable itstpctracks{"itstpctracks", false, "selects collisions with at least one ITS-TPC track,"}; Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; + Configurable applyOccupancyCut{"applyOccupancyCut", false, "Apply occupancy cut"}; + Configurable OccupancyCut{"OccupancyCut", 1000, "Mimimum Occupancy cut"}; // Configurable parameters for V0 selection Configurable ConfV0DCADaughMax{"ConfV0DCADaughMax", 1.0f, "DCA b/w V0 daughters"}; @@ -140,6 +143,7 @@ struct strangeness_tutorial { ConfigurableAxis axisdEdx{"axisdEdx", {20000, 0.0f, 200.0f}, "dE/dx (a.u.)"}; ConfigurableAxis axisPtfordEbydx{"axisPtfordEbydx", {2000, 0, 20}, "pT (GeV/c)"}; ConfigurableAxis axisMultdist{"axisMultdist", {3500, 0, 70000}, "Multiplicity distribution"}; + ConfigurableAxis occupancy_bins{"occupancy_bins", {VARIABLE_WIDTH, 0.0, 100, 500, 600, 1000, 1100, 1500, 1600, 2000, 2100, 2500, 2600, 3000, 3100, 3500, 3600, 4000, 4100, 4500, 4600, 5000, 5100, 9999}, "Binning of the occupancy axis"}; // Event selection cuts - Alex (Temporary, need to fix!) TF1* fMultPVCutLow = nullptr; @@ -160,6 +164,7 @@ struct strangeness_tutorial { // AxisSpec multiplicityAxis = {110, 0.0f, 150.0f, "Multiplicity Axis"}; AxisSpec multiplicityAxis = {binsCent, "Multiplicity Axis"}; AxisSpec thnAxisPOL{configThnAxisPOL, "Configurabel theta axis"}; + AxisSpec occupancy_axis = {occupancy_bins, "Occupancy [-40,100]"}; // THnSparses std::array sparses = {activateTHnSparseCosThStarHelicity, activateTHnSparseCosThStarProduction, activateTHnSparseCosThStarBeam, activateTHnSparseCosThStarRandom}; @@ -199,9 +204,9 @@ struct strangeness_tutorial { hglue.add("h1glueInvMassRot", "h1glueInvMassRot", kTH1F, {glueballMassAxis}); } - hglue.add("h3glueInvMassDS", "h3glueInvMassDS", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL}, true); - hglue.add("h3glueInvMassME", "h3glueInvMassME", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL}, true); - hglue.add("h3glueInvMassRot", "h3glueInvMassRot", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL}, true); + hglue.add("h3glueInvMassDS", "h3glueInvMassDS", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, occupancy_axis}, true); + hglue.add("h3glueInvMassME", "h3glueInvMassME", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, occupancy_axis}, true); + hglue.add("h3glueInvMassRot", "h3glueInvMassRot", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, occupancy_axis}, true); hglue.add("heventscheck", "heventscheck", kTH1I, {{10, 0, 10}}); hglue.add("htrackscheck_v0", "htrackscheck_v0", kTH1I, {{15, 0, 15}}); hglue.add("htrackscheck_v0_daughters", "htrackscheck_v0_daughters", kTH1I, {{15, 0, 15}}); @@ -540,6 +545,11 @@ struct strangeness_tutorial { return; } + auto occupancy_no = collision.trackOccupancyInTimeRange(); + if (applyOccupancyCut && occupancy_no < OccupancyCut) { + return; + } + if (QAevents) { rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); rEventSelection.fill(HIST("hmultiplicity"), multiplicity); @@ -644,45 +654,45 @@ struct strangeness_tutorial { if (activateTHnSparseCosThStarHelicity) { ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); // 3 vector of mother in COM frame auto cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())); - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity, occupancy_no); for (int i = 0; i < c_nof_rotations; i++) { float theta2 = rn->Uniform(TMath::Pi() - TMath::Pi() / rotational_cut, TMath::Pi() + TMath::Pi() / rotational_cut); lv4.SetPtEtaPhiM(v1.pt(), v1.eta(), v1.phi() + theta2, massK0s); // for rotated background lv5 = lv2 + lv4; - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarHelicity); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarHelicity, occupancy_no); } } else if (activateTHnSparseCosThStarProduction) { ROOT::Math::XYZVector normalVec = ROOT::Math::XYZVector(lv3.Py(), -lv3.Px(), 0.f); auto cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(normalVec.Mag2())); - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction, occupancy_no); for (int i = 0; i < c_nof_rotations; i++) { float theta2 = rn->Uniform(TMath::Pi() - TMath::Pi() / rotational_cut, TMath::Pi() + TMath::Pi() / rotational_cut); lv4.SetPtEtaPhiM(v1.pt(), v1.eta(), v1.phi() + theta2, massK0s); // for rotated background lv5 = lv2 + lv4; - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarProduction); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarProduction, occupancy_no); } } else if (activateTHnSparseCosThStarBeam) { ROOT::Math::XYZVector beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); auto cosThetaStarBeam = beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam, occupancy_no); for (int i = 0; i < c_nof_rotations; i++) { float theta2 = rn->Uniform(TMath::Pi() - TMath::Pi() / rotational_cut, TMath::Pi() + TMath::Pi() / rotational_cut); lv4.SetPtEtaPhiM(v1.pt(), v1.eta(), v1.phi() + theta2, massK0s); // for rotated background lv5 = lv2 + lv4; - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarBeam); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarBeam, occupancy_no); } } else if (activateTHnSparseCosThStarRandom) { auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::XYZVector randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); auto cosThetaStarRandom = randomVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom, occupancy_no); for (int i = 0; i < c_nof_rotations; i++) { float theta2 = rn->Uniform(TMath::Pi() - TMath::Pi() / rotational_cut, TMath::Pi() + TMath::Pi() / rotational_cut); lv4.SetPtEtaPhiM(v1.pt(), v1.eta(), v1.phi() + theta2, massK0s); // for rotated background lv5 = lv2 + lv4; - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarRandom); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarRandom, occupancy_no); } } } @@ -725,6 +735,11 @@ struct strangeness_tutorial { if (!eventselection(c1, multiplicity) || !eventselection(c2, multiplicity)) { continue; } + auto occupancy_no = c1.trackOccupancyInTimeRange(); + auto occupancy_no2 = c2.trackOccupancyInTimeRange(); + if (applyOccupancyCut && (occupancy_no < OccupancyCut || occupancy_no2 < OccupancyCut)) { + return; + } for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { @@ -782,21 +797,21 @@ struct strangeness_tutorial { if (activateTHnSparseCosThStarHelicity) { ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); // 3 vector of mother in COM frame auto cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())); - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity, occupancy_no); } else if (activateTHnSparseCosThStarProduction) { ROOT::Math::XYZVector normalVec = ROOT::Math::XYZVector(lv3.Py(), -lv3.Px(), 0.f); auto cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(normalVec.Mag2())); - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction, occupancy_no); } else if (activateTHnSparseCosThStarBeam) { ROOT::Math::XYZVector beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); auto cosThetaStarBeam = beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam, occupancy_no); } else if (activateTHnSparseCosThStarRandom) { auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::XYZVector randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); auto cosThetaStarRandom = randomVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom, occupancy_no); } } @@ -817,6 +832,11 @@ struct strangeness_tutorial { if (!eventselection(c1, multiplicity) || !eventselection(c2, multiplicity)) { continue; } + auto occupancy_no = c1.trackOccupancyInTimeRange(); + auto occupancy_no2 = c2.trackOccupancyInTimeRange(); + if (applyOccupancyCut && (occupancy_no < OccupancyCut || occupancy_no2 < OccupancyCut)) { + return; + } for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (t1.size() == 0 || t2.size() == 0) { @@ -873,21 +893,21 @@ struct strangeness_tutorial { if (activateTHnSparseCosThStarHelicity) { ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); // 3 vector of mother in COM frame auto cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())); - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity, occupancy_no); } else if (activateTHnSparseCosThStarProduction) { ROOT::Math::XYZVector normalVec = ROOT::Math::XYZVector(lv3.Py(), -lv3.Px(), 0.f); auto cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(normalVec.Mag2())); - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction, occupancy_no); } else if (activateTHnSparseCosThStarBeam) { ROOT::Math::XYZVector beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); auto cosThetaStarBeam = beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam, occupancy_no); } else if (activateTHnSparseCosThStarRandom) { auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::XYZVector randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); auto cosThetaStarRandom = randomVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom, occupancy_no); } } diff --git a/PWGLF/Tasks/Resonances/chk892flow.cxx b/PWGLF/Tasks/Resonances/chk892flow.cxx new file mode 100644 index 00000000000..7bc523eb9e0 --- /dev/null +++ b/PWGLF/Tasks/Resonances/chk892flow.cxx @@ -0,0 +1,975 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file chk892flow.cxx +/// \brief Reconstruction of track-track decay resonance candidates +/// +/// +/// \author Su-Jeong Ji + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // FIXME +#include // FIXME + +#include +#include +#include +#include +#include +#include + +#include "TRandom3.h" +#include "TF1.h" +#include "TVector2.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "Math/GenVector/Boost.h" +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/StaticFor.h" +#include "DCAFitter/DCAFitterN.h" + +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Qvectors.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/RecoDecay.h" + +#include "CommonConstants/PhysicsConstants.h" + +#include "ReconstructionDataFormats/Track.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" + +#include "CCDB/CcdbApi.h" +#include "CCDB/BasicCCDBManager.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/collisionCuts.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +struct chk892flow { + enum binType : unsigned int { + kKstarP = 0, + kKstarN, + kKstarP_Mix, + kKstarN_Mix, + kKstarP_GenINEL10, + kKstarN_GenINEL10, + kKstarP_GenINELgt10, + kKstarN_GenINELgt10, + kKstarP_GenTrig10, + kKstarN_GenTrig10, + kKstarP_GenEvtSel, + kKstarN_GenEvtSel, + kKstarP_Rec, + kKstarN_Rec, + kTYEnd + }; + + SliceCache cache; + Preslice perCollision = aod::track::collisionId; + + using EventCandidates = soa::Join; + using TrackCandidates = soa::Join; + using V0Candidates = aod::V0Datas; + + using MCEventCandidates = soa::Join; + using MCTrackCandidates = soa::Join; + using MCV0Candidates = soa::Join; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Service ccdb; + Service pdg; + o2::ccdb::CcdbApi ccdbApi; + + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + + // Configurables + ConfigurableAxis cfgBinsPt{"cfgBinsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; + ConfigurableAxis cfgBinsPtQA{"cfgBinsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; + ConfigurableAxis cfgBinsCent{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis cfgBinsVtxZ{"cfgBinsVtxZ", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "Binning of the z-vertex axis"}; + Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; + + /// Event cuts + o2::analysis::CollisonCuts colCuts; + Configurable ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable ConfEvtOccupancyInTimeRangeMax{"ConfEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; + Configurable ConfEvtOccupancyInTimeRangeMin{"ConfEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; + Configurable ConfEvtTriggerCheck{"ConfEvtTriggerCheck", false, "Evt sel: check for trigger"}; + Configurable ConfEvtTriggerSel{"ConfEvtTriggerSel", 8, "Evt sel: trigger"}; + Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", true, "Evt sel: check for offline selection"}; + Configurable ConfEvtTriggerTVXSel{"ConfEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; + Configurable ConfEvtTFBorderCut{"ConfEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; + Configurable ConfEvtUseITSTPCvertex{"ConfEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; + Configurable ConfEvtZvertexTimedifference{"ConfEvtZvertexTimedifference", true, "Evt sel: apply Z-vertex time difference"}; + Configurable ConfEvtPileupRejection{"ConfEvtPileupRejection", true, "Evt sel: apply pileup rejection"}; + Configurable ConfEvtNoITSROBorderCut{"ConfEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; + Configurable ConfincludeCentralityMC{"ConfincludeCentralityMC", false, "Include centrality in MC"}; + Configurable ConfEvtCollInTimeRangeStandard{"ConfEvtCollInTimeRangeStandard", true, "Evt sel: apply NoCollInTimeRangeStandard"}; + + /// Track selections + Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; + Configurable cMaxEtacut{"cMaxEtacut", 0.8, "Track maximum eta cut"}; + + // Cuts from polarization analysis + Configurable cfgQvecSel{"cfgQvecSel", true, "Reject events when no QVector"}; + Configurable cfgOccupancySel{"cfgOccupancySel", false, "Occupancy selection"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", -100, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgNCollinTR{"cfgNCollinTR", false, "Additional selection for the number of coll in time range"}; + + Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; + + // DCAr to PV + Configurable cMaxbDCArToPVcut{"cMaxbDCArToPVcut", 0.1, "Track DCAr cut to PV Maximum"}; + // DCAz to PV + Configurable cMaxbDCAzToPVcut{"cMaxbDCAzToPVcut", 0.1, "Track DCAz cut to PV Maximum"}; + + /// PID Selections, pion + Configurable cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC + Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF + Configurable nsigmaCutCombinedPion{"nsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined + Configurable cTOFVeto{"cTOFVeto", true, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto + + // Track selections + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor + + Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; + Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; + Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 999.0, "ITS Chi2/NCl"}; + Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 999.0, "TPC Chi2/NCl"}; + Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; + Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; + Configurable cfgHasITS{"cfgHasITS", false, "Require ITS"}; + Configurable cfgHasTPC{"cfgHasTPC", false, "Require TPC"}; + Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; + + // Secondary Selection + Configurable cfgReturnFlag{"boolReturnFlag", false, "Return Flag for debugging"}; + Configurable cSecondaryArmenterosCut{"boolArmenterosCut", true, "cut on Armenteros-Podolanski graph"}; + + Configurable cfgByPassDauPIDSelection{"cfgByPassDauPIDSelection", true, "Bypass Daughters PID selection"}; + Configurable cSecondaryDauDCAMax{"cSecondaryDauDCAMax", 1., "Maximum DCA Secondary daughters to PV"}; + Configurable cSecondaryDauPosDCAtoPVMin{"cSecondaryDauPosDCAtoPVMin", 0.0, "Minimum DCA Secondary positive daughters to PV"}; + Configurable cSecondaryDauNegDCAtoPVMin{"cSecondaryDauNegDCAtoPVMin", 0.0, "Minimum DCA Secondary negative daughters to PV"}; + + Configurable cSecondaryPtMin{"cSecondaryPtMin", 0.f, "Minimum transverse momentum of Secondary"}; + Configurable cSecondaryRapidityMax{"cSecondaryRapidityMax", 0.5, "Maximum rapidity of Secondary"}; + Configurable cSecondaryRadiusMin{"cSecondaryRadiusMin", 1.2, "Minimum transverse radius of Secondary"}; + Configurable cSecondaryCosPAMin{"cSecondaryCosPAMin", 0.995, "Mininum cosine pointing angle of Secondary"}; + Configurable cSecondaryDCAtoPVMax{"cSecondaryDCAtoPVMax", 0.3, "Maximum DCA Secondary to PV"}; + Configurable cSecondaryProperLifetimeMax{"cSecondaryProperLifetimeMax", 20, "Maximum Secondary Lifetime"}; + Configurable cSecondaryparamArmenterosCut{"paramArmenterosCut", 0.2, "parameter for Armenteros Cut"}; + Configurable cSecondaryMassWindow{"cSecondaryMassWindow", 0.075, "Secondary inv mass selciton window"}; + + // K* selection + Configurable cKstarMaxRap{"cKstarMaxRap", 0.5, "Kstar maximum rapidity"}; + Configurable cKstarMinRap{"cKstarMinRap", -0.5, "Kstar minimum rapidity"}; + + // Confs from flow analysis + Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + Configurable cfgNQvec{"cfgNQvec", 7, "The number of total Qvectors for looping over the task"}; + + Configurable cfgQvecDetName{"cfgQvecDetName", "FT0C", "The name of detector to be analyzed"}; + Configurable cfgQvecRefAName{"cfgQvecRefAName", "TPCpos", "The name of detector for reference A"}; + Configurable cfgQvecRefBName{"cfgQvecRefBName", "TPCneg", "The name of detector for reference B"}; + + int DetId; + int RefAId; + int RefBId; + + int QvecDetInd; + int QvecRefAInd; + int QvecRefBInd; + + float centrality; + + // PDG code + int kPDGK0s = 310; + int kPDGK0 = 311; + int kKstarPlus = 323; + int kPiPlus = 211; + + void init(o2::framework::InitContext&) + { + centrality = -999; + + colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, /*checkRun3*/ true, /*triggerTVXsel*/ false, ConfEvtOccupancyInTimeRangeMax, ConfEvtOccupancyInTimeRangeMin); + colCuts.init(&histos); + colCuts.setTriggerTVX(ConfEvtTriggerTVXSel); + colCuts.setApplyTFBorderCut(ConfEvtTFBorderCut); + colCuts.setApplyITSTPCvertex(ConfEvtUseITSTPCvertex); + colCuts.setApplyZvertexTimedifference(ConfEvtZvertexTimedifference); + colCuts.setApplyPileupRejection(ConfEvtPileupRejection); + colCuts.setApplyNoITSROBorderCut(ConfEvtNoITSROBorderCut); + colCuts.setApplyCollInTimeRangeStandard(ConfEvtCollInTimeRangeStandard); + + AxisSpec centAxis = {cfgBinsCent, "T0M (%)"}; + AxisSpec vtxzAxis = {cfgBinsVtxZ, "Z Vertex (cm)"}; + AxisSpec epAxis = {100, -1.0 * constants::math::PI, constants::math::PI}; + AxisSpec epresAxis = {100, -1.02, 1.02}; + AxisSpec ptAxis = {cfgBinsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisQA = {cfgBinsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec v2Axis = {200, -1, 1, "#v_{2}"}; + AxisSpec radiusAxis = {50, 0, 5, "Radius (cm)"}; + AxisSpec cpaAxis = {50, 0.95, 1.0, "CPA"}; + AxisSpec tauAxis = {250, 0, 25, "Lifetime (cm)"}; + AxisSpec dcaAxis = {200, 0, 2, "DCA (cm)"}; + AxisSpec dcaxyAxis = {200, 0, 2, "DCA_{#it{xy}} (cm)"}; + AxisSpec dcazAxis = {200, 0, 2, "DCA_{#it{z}} (cm)"}; + AxisSpec yAxis = {100, -1, 1, "Rapidity"}; + AxisSpec invMassAxisK0s = {400 / cNbinsDiv, 0.3, 0.7, "Invariant Mass (GeV/#it{c}^2)"}; // K0s ~497.611 + AxisSpec invMassAxisReso = {900 / cNbinsDiv, 0.5f, 1.4f, "Invariant Mass (GeV/#it{c}^2)"}; // chK(892) ~892 + AxisSpec invMassAxisScan = {150, 0, 1.5, "Invariant Mass (GeV/#it{c}^2)"}; // For selection + AxisSpec pidQAAxis = {130, -6.5, 6.5}; + AxisSpec dataTypeAxis = {9, 0, 9, "Histogram types"}; + AxisSpec mcTypeAxis = {4, 0, 4, "Histogram types"}; + + // THnSparse + AxisSpec axisType = {binType::kTYEnd, 0, binType::kTYEnd, "Type of bin with charge and mix"}; + AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; + + histos.add("QA/K0sCutCheck", "Check K0s cut", HistType::kTH1D, {AxisSpec{12, -0.5, 11.5, "Check"}}); + + histos.add("QA/before/CentDist", "Centrality distribution", {HistType::kTH1D, {centAxis}}); + histos.add("QA/before/VtxZ", "Centrality distribution", {HistType::kTH1D, {vtxzAxis}}); + histos.add("QA/before/hEvent", "Number of Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + + // EventPlane + histos.add("QA/EP/EPhEPDet", "Event plane distribution of FT0C (Det = A)", {HistType::kTH2D, {centAxis, epAxis}}); + histos.add("QA/EP/EPhEPB", "Event plane distribution of TPCpos (B)", {HistType::kTH2D, {centAxis, epAxis}}); + histos.add("QA/EP/EPhEPC", "Event plane distribution of TPCneg (C)", {HistType::kTH2D, {centAxis, epAxis}}); + + histos.add("QA/EP/hEPDet", "Event plane distribution of FT0C (Det = A)", {HistType::kTH2D, {centAxis, epAxis}}); + histos.add("QA/EP/hEPB", "Event plane distribution of TPCpos (B)", {HistType::kTH2D, {centAxis, epAxis}}); + histos.add("QA/EP/hEPC", "Event plane distribution of TPCneg (C)", {HistType::kTH2D, {centAxis, epAxis}}); + histos.add("QA/EP/hEPResAB", "cos(n(A-B))", {HistType::kTH2D, {centAxis, epAxis}}); + histos.add("QA/EP/hEPResAC", "cos(n(A-C))", {HistType::kTH2D, {centAxis, epAxis}}); + histos.add("QA/EP/hEPResBC", "cos(n(B-C))", {HistType::kTH2D, {centAxis, epAxis}}); + + // Bachelor pion + histos.add("QA/before/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/before/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QA/before/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/before/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + + histos.add("QA/after/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/after/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QA/after/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/after/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + + // Secondary pion 1 + histos.add("QA/before/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QA/before/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/before/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/before/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); + + histos.add("QA/after/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QA/after/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/after/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/after/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); + + // Secondary pion 2 + histos.add("QA/before/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QA/before/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/before/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/before/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); + + histos.add("QA/after/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QA/after/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/after/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/after/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); + + // K0s + histos.add("QA/before/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/before/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/before/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/before/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/before/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QA/before/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QA/before/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QA/before/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/before/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QA/before/hPtAsymSecondary", "pT asymmetry distribution of secondary resonance", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QA/before/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + + histos.add("QA/after/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/after/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/after/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/after/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/after/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QA/after/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QA/after/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QA/after/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/after/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QA/after/hPtAsymSecondary", "pT asymmetry distribution of secondary resonance", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QA/after/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + + // Kstar + // Invariant mass nSparse + histos.add("QA/before/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + histos.add("hInvmass_Kstar", "Invariant mass of unlike-sign chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis}); + histos.add("hInvmass_Kstar_Mix", "Invariant mass of unlike-sign chK(892) from mixed event", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis}); + + // Mass QA (quick check) + histos.add("QA/before/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); + histos.add("QA/before/k0sv2vsinvmass", "Invariant mass vs v2 of unlike-sign K0s", HistType::kTH2D, {invMassAxisK0s, v2Axis}); + histos.add("QA/before/kstarv2vsinvmass", "Invariant mass vs v2 of unlike-sign chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); + histos.add("QA/before/kstarinvmass_Mix", "Invariant mass of unlike-sign chK(892) from mixed event", HistType::kTH1D, {invMassAxisReso}); + histos.add("QA/before/kstarv2vsinvmass_Mix", "Invariant mass vs v2 of unlike-sign chK(892) from mixed event", HistType::kTH2D, {invMassAxisReso, v2Axis}); + + histos.add("QA/after/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + histos.add("QA/after/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); + histos.add("QA/after/k0sv2vsinvmass", "Invariant mass vs v2 of unlike-sign K0s", HistType::kTH2D, {invMassAxisK0s, v2Axis}); + histos.add("QA/after/kstarv2vsinvmass", "Invariant mass vs v2 of unlike-sign chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); + histos.add("QA/after/kstarinvmass_Mix", "Invariant mass of unlike-sign chK(892) from mixed event", HistType::kTH1D, {invMassAxisReso}); + histos.add("QA/after/kstarv2vsinvmass_Mix", "Invariant mass vs v2 of unlike-sign chK(892) from mixed event", HistType::kTH2D, {invMassAxisReso, v2Axis}); + + DetId = GetDetId(cfgQvecDetName); + RefAId = GetDetId(cfgQvecRefAName); + RefBId = GetDetId(cfgQvecRefBName); + + if (DetId == RefAId || DetId == RefBId || RefAId == RefBId) { + LOGF(info, "Wrong detector configuration \n The FT0C will be used to get Q-Vector \n The TPCpos and TPCneg will be used as reference systems"); + // LOGF(info) << "Wrong detector configuration \n The FT0C will be used to get Q-Vector \n The TPCpos and TPCneg will be used as reference systems"; + DetId = 0; + RefAId = 4; + RefBId = 5; + } + + // MC + if (doprocessMC) { + + histos.add("QAMC/hEvent", "Number of Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + // Bachelor pion + histos.add("QAMC/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QAMC/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxis}); + histos.add("QAMC/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + + // Secondary pion 1 + histos.add("QAMC/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QAMC/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxis}); + histos.add("QAMC/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + + // Secondary pion 2 + histos.add("QAMC/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxis}); + histos.add("QAMC/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); + + // Secondary Resonance (K0s cand) + histos.add("QAMC/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + + histos.add("QAMC/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxis}); + histos.add("QAMC/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QAMC/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QAMC/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QAMC/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QAMC/hPtAsymSecondary", "pT asymmetry distribution of secondary resonance", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QAMC/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + + // K892 + histos.add("QAMC/KstarOA", "Opening angle of chK(892)", HistType::kTH1D, {AxisSpec{100, 0, 3.14, "Opening angle"}}); + histos.add("QAMC/KstarPairAsym", "Pair asymmetry of chK(892)", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QAMC/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + + histos.add("QAMC/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); + histos.add("QAMC/k0sv2vsinvmass", "Invariant mass vs v2 of unlike-sign K0s", HistType::kTH2D, {invMassAxisK0s, v2Axis}); + histos.add("QAMC/kstarv2vsinvmass", "Invariant mass vs v2 of unlike-sign chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); + histos.add("QAMC/kstarinvmass_noKstar", "Invariant mass of unlike-sign no chK(892)", HistType::kTH1D, {invMassAxisReso}); + histos.add("QAMC/kstarv2vsinvmass_noKstar", "Invariant mass vs v2 of unlike-sign no chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); + + histos.add("hInvmass_Kstar_MC", "Invariant mass of unlike chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis}); + + ccdb->setURL(cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + } + + // Print output histograms statistics + LOG(info) << "Size of the histograms in chK(892) Analysis Task"; + histos.print(); + } + + template + float GetCentrality(CollisionType const& collision) + { + if (cfgCentEst == 1) { + return collision.centFT0C(); + } else if (cfgCentEst == 2) { + return collision.centFT0M(); + } else { + return -999; + } + } + + template + int GetDetId(DetNameType const& name) + { + LOGF(info, "GetDetID running"); + if (name.value == "FT0C") { + return 0; + } else if (name.value == "FT0A") { + return 1; + } else if (name.value == "FT0M") { + return 2; + } else if (name.value == "FV0A") { + return 3; + } else if (name.value == "TPCpos") { + return 4; + } else if (name.value == "TPCneg") { + return 5; + } else { + return false; + } + } + + // Track selection + template + bool trackCut(TrackType const& track) + { + // basic track cuts + if (std::abs(track.pt()) < cMinPtcut) + return false; + if (std::abs(track.eta()) > cMaxEtacut) + return false; + if (track.itsNCls() < cfgITScluster) + return false; + if (track.tpcNClsFound() < cfgTPCcluster) + return false; + if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) + return false; + if (track.itsChi2NCl() >= cfgITSChi2NCl) + return false; + if (track.tpcChi2NCl() >= cfgTPCChi2NCl) + return false; + if (cfgHasITS && !track.hasITS()) + return false; + if (cfgHasTPC && !track.hasTPC()) + return false; + if (cfgHasTOF && !track.hasTOF()) + return false; + if (cfgUseITSRefit && !track.passedITSRefit()) + return false; + if (cfgUseTPCRefit && !track.passedTPCRefit()) + return false; + if (cfgPVContributor && !track.isPVContributor()) + return false; + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (cfgGlobalTrack && !track.isGlobalTrack()) + return false; + if (cfgPrimaryTrack && !track.isPrimaryTrack()) + return false; + if (std::abs(track.dcaXY()) > cMaxbDCArToPVcut) + return false; + if (std::abs(track.dcaZ()) > cMaxbDCAzToPVcut) + return false; + return true; + } + + // PID selection tools + template + bool selectionPIDPion(TrackType const& candidate) + { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + if (std::abs(candidate.tpcNSigmaPi()) < cMaxTPCnSigmaPion) { + tpcPIDPassed = true; + } else { + return false; + } + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaPi()) < cMaxTOFnSigmaPion) { + tofPIDPassed = true; + } + if ((nsigmaCutCombinedPion > 0) && (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < nsigmaCutCombinedPion * nsigmaCutCombinedPion)) { + tofPIDPassed = true; + } + } else { + if (!cTOFVeto) { + return false; + } + tofPIDPassed = true; + } + if (tpcPIDPassed && tofPIDPassed) { + return true; + } + return false; + } + + template + bool selectionK0s(CollisionType const& collision, K0sType const& candidate) + { + auto DauDCA = candidate.dcaV0daughters(); + auto DauPosDCAtoPV = candidate.dcapostopv(); + auto DauNegDCAtoPV = candidate.dcanegtopv(); + auto pT = candidate.pt(); + auto Rapidity = candidate.yK0Short(); + auto Radius = candidate.v0radius(); + auto DCAtoPV = candidate.dcav0topv(); + auto CPA = candidate.v0cosPA(); + auto PropTauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; + auto mK0s = candidate.mK0Short(); + + if (cfgReturnFlag) { + bool returnFlag = true; + + histos.fill(HIST("QA/K0sCutCheck"), 0); + if (DauDCA > cSecondaryDauDCAMax) { + histos.fill(HIST("QA/K0sCutCheck"), 1); + returnFlag = false; + } + if (DauPosDCAtoPV < cSecondaryDauPosDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 2); + returnFlag = false; + } + if (DauNegDCAtoPV < cSecondaryDauNegDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 3); + returnFlag = false; + } + if (pT < cSecondaryPtMin) { + histos.fill(HIST("QA/K0sCutCheck"), 4); + returnFlag = false; + } + if (Rapidity > cSecondaryRapidityMax) { + histos.fill(HIST("QA/K0sCutCheck"), 5); + returnFlag = false; + } + if (Radius < cSecondaryRadiusMin) { + histos.fill(HIST("QA/K0sCutCheck"), 6); + returnFlag = false; + } + if (DCAtoPV > cSecondaryDCAtoPVMax) { + histos.fill(HIST("QA/K0sCutCheck"), 7); + returnFlag = false; + } + if (CPA < cSecondaryCosPAMin) { + histos.fill(HIST("QA/K0sCutCheck"), 8); + returnFlag = false; + } + if (PropTauK0s > cSecondaryProperLifetimeMax) { + histos.fill(HIST("QA/K0sCutCheck"), 9); + returnFlag = false; + } + if (fabs(mK0s - MassK0Short) > cSecondaryMassWindow) { + histos.fill(HIST("QA/K0sCutCheck"), 10); + returnFlag = false; + } + if (candidate.qtarm() < cSecondaryparamArmenterosCut * TMath::Abs(candidate.alpha())) { + histos.fill(HIST("QA/K0sCutCheck"), 11); + returnFlag = false; + } + return returnFlag; + + } else { + histos.fill(HIST("QA/K0sCutCheck"), 0); + if (DauDCA > cSecondaryDauDCAMax) { + histos.fill(HIST("QA/K0sCutCheck"), 1); + return false; + } + if (DauPosDCAtoPV < cSecondaryDauPosDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 2); + return false; + } + if (DauNegDCAtoPV < cSecondaryDauNegDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 3); + return false; + } + if (pT < cSecondaryPtMin) { + histos.fill(HIST("QA/K0sCutCheck"), 4); + return false; + } + if (Rapidity > cSecondaryRapidityMax) { + histos.fill(HIST("QA/K0sCutCheck"), 5); + return false; + } + if (Radius < cSecondaryRadiusMin) { + histos.fill(HIST("QA/K0sCutCheck"), 6); + return false; + } + if (DCAtoPV > cSecondaryDCAtoPVMax) { + histos.fill(HIST("QA/K0sCutCheck"), 7); + return false; + } + if (CPA < cSecondaryCosPAMin) { + histos.fill(HIST("QA/K0sCutCheck"), 8); + return false; + } + if (PropTauK0s > cSecondaryProperLifetimeMax) { + histos.fill(HIST("QA/K0sCutCheck"), 9); + return false; + } + if (fabs(mK0s - MassK0Short) > cSecondaryMassWindow) { + histos.fill(HIST("QA/K0sCutCheck"), 10); + return false; + } + if (candidate.qtarm() < cSecondaryparamArmenterosCut * TMath::Abs(candidate.alpha())) { + histos.fill(HIST("QA/K0sCutCheck"), 11); + return false; + } + return true; + } + + } // selectionK0s + + double GetPhiInRange(double phi) + { + double result = phi; + while (result < 0) { + result = result + 2. * TMath::Pi() / 2; + } + while (result > 2. * TMath::Pi() / 2) { + result = result - 2. * TMath::Pi() / 2; + } + return result; + } + + template + bool isTrueKstar(const TrackTemplate& bTrack, const V0Template& K0scand) + { + if (abs(bTrack.PDGCode()) != kPiPlus) // Are you pion? + return false; + if (abs(K0scand.PDGCode()) != kPDGK0s) // Are you K0s? + return false; + + auto motherbTrack = bTrack.template mothers_as(); + auto motherkV0 = K0scand.template mothers_as(); + + // Check bTrack first + if (abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter? + return false; // Apply first since it's more restrictive + + if (abs(motherkV0.pdgCode()) != 310) // Is it K0s? + return false; + // Check if K0s's mother is K0 (311) + auto motherK0 = motherkV0.template mothers_as(); + if (abs(motherK0.pdgCode()) != 311) + return false; + + // Check if K0's mother is Kstar (323) + auto motherKstar = motherK0.template mothers_as(); + if (abs(motherKstar.pdgCode()) != 323) + return false; + + // Check if bTrack and K0 have the same mother (global index) + if (motherbTrack.globalIndex() != motherK0.globalIndex()) + return false; + + return true; + } + + int count = 0; + + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksTypeK0s& dTracks2, int nmode) + { + histos.fill(HIST("QA/before/CentDist"), centrality); + + QvecDetInd = DetId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + QvecRefAInd = RefAId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + QvecRefBInd = RefBId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + + double EPDet = TMath::ATan2(collision.qvecIm()[QvecDetInd], collision.qvecRe()[QvecDetInd]) / static_cast(nmode); + double EPRefB = TMath::ATan2(collision.qvecIm()[QvecRefAInd], collision.qvecRe()[QvecRefAInd]) / static_cast(nmode); + double EPRefC = TMath::ATan2(collision.qvecIm()[QvecRefBInd], collision.qvecRe()[QvecRefBInd]) / static_cast(nmode); + + double EPResAB = TMath::Cos(static_cast(nmode) * (EPDet - EPRefB)); + double EPResAC = TMath::Cos(static_cast(nmode) * (EPDet - EPRefC)); + double EPResBC = TMath::Cos(static_cast(nmode) * (EPRefB - EPRefC)); + + histos.fill(HIST("QA/EP/hEPDet"), centrality, EPDet); + histos.fill(HIST("QA/EP/hEPB"), centrality, EPRefB); + histos.fill(HIST("QA/EP/hEPC"), centrality, EPRefC); + histos.fill(HIST("QA/EP/hEPResAB"), centrality, EPResAB); + histos.fill(HIST("QA/EP/hEPResAC"), centrality, EPResAC); + histos.fill(HIST("QA/EP/hEPResBC"), centrality, EPResBC); + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar; + std::vector trackIndicies = {}; + std::vector k0sIndicies = {}; + + for (auto& bTrack : dTracks1) { + auto trkbpt = bTrack.pt(); + auto istrkbhasTOF = bTrack.hasTOF(); + auto trkbNSigmaPiTPC = bTrack.tpcNSigmaPi(); + auto trkbNSigmaPiTOF = (istrkbhasTOF) ? bTrack.tofNSigmaPi() : -999.; + + if constexpr (!IsMix) { + // Bachelor pion QA plots + histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/before/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/before/trkbpionDCAz"), bTrack.dcaZ()); + } + + if (!trackCut(bTrack)) + continue; + if (!selectionPIDPion(bTrack)) + continue; + + if constexpr (!IsMix) { + // Bachelor pion QA plots after applying cuts + histos.fill(HIST("QA/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/after/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/after/trkbpionDCAz"), bTrack.dcaZ()); + } + trackIndicies.push_back(bTrack.index()); + } + + for (auto& K0scand : dTracks2) { + auto posDauTrack = K0scand.template posTrack_as(); + auto negDauTrack = K0scand.template negTrack_as(); + + /// Daughters + // Positve pion + auto trkppt = posDauTrack.pt(); + auto istrkphasTOF = posDauTrack.hasTOF(); + auto trkpNSigmaPiTPC = posDauTrack.tpcNSigmaPi(); + auto trkpNSigmaPiTOF = (istrkphasTOF) ? posDauTrack.tofNSigmaPi() : -999.; + // Negative pion + auto trknpt = negDauTrack.pt(); + auto istrknhasTOF = negDauTrack.hasTOF(); + auto trknNSigmaPiTPC = negDauTrack.tpcNSigmaPi(); + auto trknNSigmaPiTOF = (istrknhasTOF) ? negDauTrack.tofNSigmaPi() : -999.; + + /// K0s + auto trkkDauDCA = K0scand.dcaV0daughters(); + auto trkkDauDCAPostoPV = K0scand.dcapostopv(); + auto trkkDauDCANegtoPV = K0scand.dcanegtopv(); + auto trkkpt = K0scand.pt(); + auto trkky = K0scand.yK0Short(); + auto trkkRadius = K0scand.v0radius(); + auto trkkDCAtoPV = K0scand.dcav0topv(); + auto trkkCPA = K0scand.v0cosPA(); + auto trkkPropTau = K0scand.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; + auto trkkMass = K0scand.mK0Short(); + + if constexpr (!IsMix) { + // Seconddary QA plots + histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkppionpT"), trkppt); + histos.fill(HIST("QA/before/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trknpionpT"), trknpt); + histos.fill(HIST("QA/before/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/before/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/before/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/before/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/before/hy_Secondary"), trkky); + histos.fill(HIST("QA/before/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/before/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/before/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/before/hPropTauSecondary"), trkkPropTau); + histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); + } + + // if (!trackCut(posDauTrack) || !trackCut(negDauTrack)) // Too tight cut for K0s daugthers + // continue; + if (!cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) // Perhaps it's already applied in trackCut (need to check QA plots) + continue; + if (!cfgByPassDauPIDSelection && !selectionPIDPion(negDauTrack)) + continue; + if (!selectionK0s(collision, K0scand)) + continue; + + if constexpr (!IsMix) { + // Seconddary QA plots after applying cuts + + histos.fill(HIST("QA/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkppionpT"), trkppt); + histos.fill(HIST("QA/after/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trknpionpT"), trknpt); + histos.fill(HIST("QA/after/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/after/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/after/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/after/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/after/hy_Secondary"), trkky); + histos.fill(HIST("QA/after/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/after/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/after/hPropTauSecondary"), trkkPropTau); + histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); + } + k0sIndicies.push_back(K0scand.index()); + } + + for (auto& trackIndex : trackIndicies) { + for (auto& k0sIndex : k0sIndicies) { + auto bTrack = dTracks1.rawIteratorAt(trackIndex); + auto K0scand = dTracks2.rawIteratorAt(k0sIndex); + + lDecayDaughter_bach.SetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); + lResoSecondary.SetXYZM(K0scand.px(), K0scand.py(), K0scand.pz(), MassK0Short); + lResoKstar = lResoSecondary + lDecayDaughter_bach; + + auto phiminuspsi_k0s = GetPhiInRange(lResoSecondary.Phi() - EPDet); + auto phiminuspsi_kstar = GetPhiInRange(lResoKstar.Phi() - EPDet); + auto v2_k0s = TMath::Cos(static_cast(nmode) * phiminuspsi_k0s); + auto v2_kstar = TMath::Cos(static_cast(nmode) * phiminuspsi_kstar); + + // QA plots + if constexpr (!IsMix) { + histos.fill(HIST("QA/before/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); + histos.fill(HIST("QA/before/k0sv2vsinvmass"), lResoSecondary.M(), v2_k0s); + histos.fill(HIST("QA/before/kstarv2vsinvmass"), lResoKstar.M(), v2_kstar); + } + + if (lResoKstar.Rapidity() > cKstarMaxRap || lResoKstar.Rapidity() < cKstarMinRap) + continue; + + if constexpr (!IsMix) { + unsigned int typeKstar = bTrack.sign() > 0 ? binType::kKstarP : binType::kKstarN; + + histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); + histos.fill(HIST("QA/after/k0sv2vsinvmass"), lResoSecondary.M(), v2_k0s); + histos.fill(HIST("QA/after/kstarv2vsinvmass"), lResoKstar.M(), v2_kstar); + histos.fill(HIST("hInvmass_Kstar"), typeKstar, centrality, lResoKstar.Pt(), lResoKstar.M(), v2_kstar); + + } // IsMix + } // K0scand + } // bTrack + + count++; + + } // fillHistograms + + // process data + void processData(EventCandidates::iterator const& collision, + TrackCandidates const& tracks, + V0Candidates const& v0s, + aod::BCsWithTimestamps const&) + { + if (!colCuts.isSelected(collision)) // Default event selection + return; + if (cfgQvecSel && (collision.qvecAmp()[DetId] < 1e-4 || collision.qvecAmp()[RefAId] < 1e-4 || collision.qvecAmp()[RefBId] < 1e-4)) + return; // If we don't have a Q-vector + colCuts.fillQA(collision); + centrality = GetCentrality(collision); + + fillHistograms(collision, tracks, v0s, 2); // second order + } + PROCESS_SWITCH(chk892flow, processData, "Process Event for data without Partitioning", true); + + // process MC reconstructed level + void processMC(EventCandidates::iterator const& collision, + MCTrackCandidates const& tracks, + MCV0Candidates const& v0s) + { + + histos.fill(HIST("QAMC/hEvent"), 1.0); + + fillHistograms(collision, tracks, v0s, 2); + } + PROCESS_SWITCH(chk892flow, processMC, "Process Event for MC", false); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"lf-chk892flow"})}; +} diff --git a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx index bb27b5f81c7..85ad1180b23 100644 --- a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx +++ b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx @@ -79,6 +79,8 @@ struct f0980pbpbanalysis { Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; Configurable cfgMinOccupancy{"cfgMinOccupancy", -100, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; Configurable cfgNCollinTR{"cfgNCollinTR", false, "Additional selection for the number of coll in time range"}; + Configurable cfgPVSel{"cfgPVSel", false, "Additional PV selection flag for syst"}; + Configurable cfgPV{"cfgPV", 8.0, "Additional PV selection range for syst"}; Configurable cfgCentSel{"cfgCentSel", 80., "Centrality selection"}; Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; @@ -192,6 +194,9 @@ struct f0980pbpbanalysis { if (cfgNCollinTR && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return 0; } + if (cfgPVSel && std::abs(collision.posZ()) > cfgPV) { + return 0; + } return 1; } // event selection diff --git a/PWGLF/Tasks/Resonances/highmasslambda.cxx b/PWGLF/Tasks/Resonances/highmasslambda.cxx index c9b59e17180..75c41977fd5 100644 --- a/PWGLF/Tasks/Resonances/highmasslambda.cxx +++ b/PWGLF/Tasks/Resonances/highmasslambda.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include "TRandom3.h" #include "Math/Vector3D.h" @@ -74,10 +75,9 @@ struct highmasslambda { // Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; // fill output + Configurable fillQA{"fillQA", false, "fillQA"}; Configurable useSP{"useSP", false, "useSP"}; Configurable useSignDCAV0{"useSignDCAV0", true, "useSignDCAV0"}; - Configurable additionalEvSel{"additionalEvSel", true, "additionalEvSel"}; - Configurable additionalEvSel2{"additionalEvSel2", false, "additionalEvSel2"}; Configurable fillDefault{"fillDefault", false, "fill Occupancy"}; Configurable cfgOccupancyCut{"cfgOccupancyCut", 2500, "Occupancy cut"}; Configurable fillDecayLength{"fillDecayLength", true, "fill decay length"}; @@ -88,6 +88,8 @@ struct highmasslambda { Configurable cfgCutCentralityMax{"cfgCutCentralityMax", 50.0f, "Accepted maximum Centrality"}; Configurable cfgCutCentralityMin{"cfgCutCentralityMin", 30.0f, "Accepted minimum Centrality"}; // proton track cut + Configurable rejectPID{"rejectPID", true, "pion, kaon, electron rejection"}; + Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; Configurable ispTdifferentialDCA{"ispTdifferentialDCA", true, "is pT differential DCA"}; Configurable isPVContributor{"isPVContributor", true, "is PV contributor"}; Configurable confMinRot{"confMinRot", 5.0 * TMath::Pi() / 6.0, "Minimum of rotation"}; @@ -109,8 +111,9 @@ struct highmasslambda { Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; Configurable PIDstrategy{"PIDstrategy", 0, "0: TOF Veto, 1: TOF Veto opti, 2: TOF, 3: TOF loose 1, 4: TOF loose 2, 5: old pt dep"}; Configurable nsigmaCutTPC{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; - Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "TPC TOF combined PID"}; + Configurable nsigmaCutTOF{"nsigmaCutTOF", 3.0, "TOF PID"}; Configurable nsigmaCutTPCPre{"nsigmacutTPCPre", 3.0, "Value of the TPC Nsigma cut Pre filter"}; + Configurable minnsigmaCutTPCPre{"minnsigmacutTPCPre", -2.0, "Minimum Value of the TPC Nsigma cut Pre filter"}; Configurable kaonrejpar{"kaonrejpar", 1.0, "Kaon rej. par"}; // Configs for V0 Configurable ConfV0PtMin{"ConfV0PtMin", 0.f, "Minimum transverse momentum of V0"}; @@ -153,10 +156,10 @@ struct highmasslambda { Filter centralityFilter = (nabs(aod::cent::centFT0C) < cfgCutCentralityMax && nabs(aod::cent::centFT0C) > cfgCutCentralityMin); Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); Filter dcaCutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); - Filter pidFilter = nabs(aod::pidtpc::tpcNSigmaPr) < nsigmaCutTPCPre; + Filter pidFilter = aod::pidtpc::tpcNSigmaPr > minnsigmaCutTPCPre&& aod::pidtpc::tpcNSigmaPr < nsigmaCutTPCPre; using EventCandidates = soa::Filtered>; - using TrackCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; using AllTrackCandidates = soa::Join; using ResoV0s = aod::V0Datas; @@ -215,14 +218,6 @@ struct highmasslambda { histos.add("hNsigmaProtonPionTPC", "NsigmaProton-Pion TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); histos.add("hNsigmaProtonKaonTPC", "NsigmaProton-Kaon TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); - histos.add("hNsigmaProtonElectronTPC_afterPi", "NsigmaProton-Electron TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); - histos.add("hNsigmaProtonPionTPC_afterPi", "NsigmaProton-Pion TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); - histos.add("hNsigmaProtonKaonTPC_afterPi", "NsigmaProton-Kaon TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); - - histos.add("hNsigmaProtonElectronTPC_afterEl", "NsigmaProton-Electron TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); - histos.add("hNsigmaProtonPionTPC_afterEl", "NsigmaProton-Pion TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); - histos.add("hNsigmaProtonKaonTPC_afterEl", "NsigmaProton-Kaon TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); - histos.add("hNsigmaProtonElectronTPC_afterKa", "NsigmaProton-Electron TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); histos.add("hNsigmaProtonPionTPC_afterKa", "NsigmaProton-Pion TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); histos.add("hNsigmaProtonKaonTPC_afterKa", "NsigmaProton-Kaon TPC distribution", kTH3F, {{60, -3.0f, 3.0f}, {200, -10.0f, 10.0f}, {60, 0.0f, 6.0f}}); @@ -394,23 +389,17 @@ struct highmasslambda { template bool selectionPID1(const T& candidate) { - if (candidate.tpcInnerParam() < 0.7 && TMath::Abs(candidate.tpcNSigmaPr()) < 3.0) { + if (candidate.tpcInnerParam() < 0.85 && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC) { return true; } - if (candidate.tpcInnerParam() >= 0.7) { - // printf("I am here: %.3f\n", candidate.tpcInnerParam()); + if (candidate.tpcInnerParam() >= 0.85) { if (candidate.hasTOF()) { - auto combinedPID = TMath::Sqrt(candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr() + candidate.tofNSigmaPr() * candidate.tofNSigmaPr()) / TMath::Sqrt(2.0); - // printf("combine PIDA: %.3f\n", combinedPID); - if (combinedPID < nsigmaCutCombined) { + if (candidate.beta() > cfgCutTOFBeta && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPr()) < nsigmaCutTOF) { return true; } } if (!candidate.hasTOF()) { - if (candidate.tpcInnerParam() < 1.5 && TMath::Abs(candidate.tpcNSigmaPr()) < 3.0) { - return true; - } - if (candidate.tpcInnerParam() >= 1.5 && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < 2.0) { + if (candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC) { return true; } } @@ -422,16 +411,11 @@ struct highmasslambda { template bool selectionPID2(const T& candidate) { - if (candidate.tpcInnerParam() < 0.7 && TMath::Abs(candidate.tpcNSigmaPr()) < 3.0) { + if (candidate.tpcInnerParam() < 0.85 && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC) { return true; } - if (candidate.tpcInnerParam() >= 0.7) { - if (candidate.hasTOF()) { - auto combinedPID = TMath::Sqrt(candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr() + candidate.tofNSigmaPr() * candidate.tofNSigmaPr()) / TMath::Sqrt(2.0); - if (combinedPID < nsigmaCutCombined) { - return true; - } - } + if (candidate.tpcInnerParam() >= 0.85 && candidate.beta() > cfgCutTOFBeta && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPr()) < nsigmaCutTOF) { + return true; } return false; } @@ -440,18 +424,17 @@ struct highmasslambda { template bool selectionPID3(const T& candidate) { - if (candidate.tpcInnerParam() < 0.7 && TMath::Abs(candidate.tpcNSigmaPr()) < 3.0) { + if (candidate.tpcInnerParam() < 0.85 && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC) { return true; } - if (candidate.tpcInnerParam() >= 0.7) { + if (candidate.tpcInnerParam() >= 0.85) { if (candidate.hasTOF()) { - auto combinedPID = TMath::Sqrt(candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr() + candidate.tofNSigmaPr() * candidate.tofNSigmaPr()) / TMath::Sqrt(2.0); - if (combinedPID < nsigmaCutCombined) { + if (candidate.beta() > cfgCutTOFBeta && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPr()) < nsigmaCutTOF) { return true; } } if (!candidate.hasTOF()) { - if (candidate.tpcInnerParam() < 1.5 && TMath::Abs(candidate.tpcNSigmaPr()) < 3.0) { + if (candidate.tpcInnerParam() < 1.5 && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC) { return true; } } @@ -463,21 +446,17 @@ struct highmasslambda { template bool selectionPID4(const T& candidate) { - if (candidate.tpcInnerParam() < 0.7 && TMath::Abs(candidate.tpcNSigmaPr()) < 3.0) { + if (candidate.tpcInnerParam() < 0.85 && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC) { return true; } - if (candidate.tpcInnerParam() >= 0.7) { + if (candidate.tpcInnerParam() >= 0.85) { if (candidate.hasTOF()) { - auto combinedPID = TMath::Sqrt(candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr() + candidate.tofNSigmaPr() * candidate.tofNSigmaPr()) / TMath::Sqrt(2.0); - if (combinedPID < nsigmaCutCombined) { + if (candidate.beta() > cfgCutTOFBeta && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPr()) < nsigmaCutTOF) { return true; } } if (!candidate.hasTOF()) { - if (candidate.tpcInnerParam() < 1.5 && TMath::Abs(candidate.tpcNSigmaPr()) < 3.0) { - return true; - } - if (candidate.tpcInnerParam() >= 1.5 && candidate.tpcInnerParam() < 1.8 && candidate.tpcNSigmaPr() > -1.5 && candidate.tpcNSigmaPr() < 2.0) { + if (candidate.tpcInnerParam() < 1.8 && candidate.tpcNSigmaPr() > -2.0 && candidate.tpcNSigmaPr() < nsigmaCutTPC) { return true; } } @@ -578,22 +557,17 @@ struct highmasslambda { double v2, v2Rot; void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, AllTrackCandidates const&, ResoV0s const& V0s, aod::BCs const&) { - if (!collision.sel8()) { + if (!collision.sel8() || !collision.triggereventep() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return; } + auto centrality = collision.centFT0C(); auto multTPC = collision.multNTracksPV(); histos.fill(HIST("hFTOCvsTPCNoCut"), centrality, multTPC); - if (!collision.triggereventep()) { - return; - } - if (additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - return; - } - if (additionalEvSel2 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + int occupancy = collision.trackOccupancyInTimeRange(); + if (occupancy > cfgOccupancyCut) { return; } - int occupancy = collision.trackOccupancyInTimeRange(); auto psiFT0C = collision.psiFT0C(); auto psiFT0A = collision.psiFT0A(); auto psiTPC = collision.psiTPC(); @@ -627,33 +601,6 @@ struct highmasslambda { if (!selectionTrack(track1)) { continue; } - if (track1.hasTOF()) { - histos.fill(HIST("hNsigmaProtonTOFPre"), track1.tofNSigmaPr(), track1.pt()); - } - if (!track1.hasTOF()) { - histos.fill(HIST("hNsigmaProtonElectronTPC"), track1.tpcNSigmaPr(), track1.tpcNSigmaEl(), track1.tpcInnerParam()); - histos.fill(HIST("hNsigmaProtonPionTPC"), track1.tpcNSigmaPr(), track1.tpcNSigmaPi(), track1.tpcInnerParam()); - histos.fill(HIST("hNsigmaProtonKaonTPC"), track1.tpcNSigmaPr(), track1.tpcNSigmaKa(), track1.tpcInnerParam()); - if (!rejectPi(track1)) { - continue; - } - histos.fill(HIST("hNsigmaProtonElectronTPC_afterPi"), track1.tpcNSigmaPr(), track1.tpcNSigmaEl(), track1.tpcInnerParam()); - histos.fill(HIST("hNsigmaProtonPionTPC_afterPi"), track1.tpcNSigmaPr(), track1.tpcNSigmaPi(), track1.tpcInnerParam()); - histos.fill(HIST("hNsigmaProtonKaonTPC_afterPi"), track1.tpcNSigmaPr(), track1.tpcNSigmaKa(), track1.tpcInnerParam()); - if (!rejectEl(track1)) { - continue; - } - histos.fill(HIST("hNsigmaProtonElectronTPC_afterEl"), track1.tpcNSigmaPr(), track1.tpcNSigmaEl(), track1.tpcInnerParam()); - histos.fill(HIST("hNsigmaProtonPionTPC_afterEl"), track1.tpcNSigmaPr(), track1.tpcNSigmaPi(), track1.tpcInnerParam()); - histos.fill(HIST("hNsigmaProtonKaonTPC_afterEl"), track1.tpcNSigmaPr(), track1.tpcNSigmaKa(), track1.tpcInnerParam()); - if (!rejectKa(track1)) { - continue; - } - histos.fill(HIST("hNsigmaProtonElectronTPC_afterKa"), track1.tpcNSigmaPr(), track1.tpcNSigmaEl(), track1.tpcInnerParam()); - histos.fill(HIST("hNsigmaProtonPionTPC_afterKa"), track1.tpcNSigmaPr(), track1.tpcNSigmaPi(), track1.tpcInnerParam()); - histos.fill(HIST("hNsigmaProtonKaonTPC_afterKa"), track1.tpcNSigmaPr(), track1.tpcNSigmaKa(), track1.tpcInnerParam()); - } - // PID check if (PIDstrategy == 0 && !selectionPID1(track1)) { continue; @@ -668,6 +615,24 @@ struct highmasslambda { continue; } + if (track1.hasTOF()) { + histos.fill(HIST("hNsigmaProtonTOFPre"), track1.tofNSigmaPr(), track1.pt()); + } + if (!track1.hasTOF()) { + if (fillQA) { + histos.fill(HIST("hNsigmaProtonElectronTPC"), track1.tpcNSigmaPr(), track1.tpcNSigmaEl(), track1.tpcInnerParam()); + histos.fill(HIST("hNsigmaProtonPionTPC"), track1.tpcNSigmaPr(), track1.tpcNSigmaPi(), track1.tpcInnerParam()); + histos.fill(HIST("hNsigmaProtonKaonTPC"), track1.tpcNSigmaPr(), track1.tpcNSigmaKa(), track1.tpcInnerParam()); + } + if (rejectPID && !rejectKa(track1)) { + continue; + } + if (fillQA) { + histos.fill(HIST("hNsigmaProtonElectronTPC_afterKa"), track1.tpcNSigmaPr(), track1.tpcNSigmaEl(), track1.tpcInnerParam()); + histos.fill(HIST("hNsigmaProtonPionTPC_afterKa"), track1.tpcNSigmaPr(), track1.tpcNSigmaPi(), track1.tpcInnerParam()); + histos.fill(HIST("hNsigmaProtonKaonTPC_afterKa"), track1.tpcNSigmaPr(), track1.tpcNSigmaKa(), track1.tpcInnerParam()); + } + } histos.fill(HIST("hMomCorr"), track1.p() / track1.sign(), track1.p() - track1.tpcInnerParam(), centrality); histos.fill(HIST("hEta"), track1.eta()); histos.fill(HIST("hDcaxy"), track1.dcaXY()); @@ -724,7 +689,7 @@ struct highmasslambda { dcasum = v0.dcav0topv() - track1.dcaXY(); } histos.fill(HIST("hMassvsDecaySum"), Lambdac.M(), dcasum); - if (occupancy < cfgOccupancyCut && Lambdac.M() > cMinLambdaMass && Lambdac.M() <= cMaxLambdaMass && TMath::Abs(Lambdac.Rapidity()) < confRapidity && Lambdac.Pt() > 2.0 && Lambdac.Pt() <= 6.0) { + if (Lambdac.M() > cMinLambdaMass && Lambdac.M() <= cMaxLambdaMass && TMath::Abs(Lambdac.Rapidity()) < confRapidity && Lambdac.Pt() > 2.0 && Lambdac.Pt() <= 6.0) { if (fillDefault) { histos.fill(HIST("hSparseV2SASameEvent_V2"), Lambdac.M(), Lambdac.Pt(), v2, TMath::Abs(track1.dcaXY()), Proton.Pt()); } @@ -732,7 +697,6 @@ struct highmasslambda { histos.fill(HIST("hSparseV2SASameEvent_V2_dcatopv"), Lambdac.M(), Lambdac.Pt(), v2, v0.dcav0topv(), Proton.Pt()); } } - if (fillRotation) { for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { auto anglestart = confMinRot; @@ -752,7 +716,7 @@ struct highmasslambda { v2Rot = TMath::Cos(2.0 * phiminuspsiRot); } - if (occupancy < cfgOccupancyCut && LambdacRot.M() > cMinLambdaMass && LambdacRot.M() <= cMaxLambdaMass && TMath::Abs(LambdacRot.Rapidity()) < confRapidity && LambdacRot.Pt() > 2.0 && LambdacRot.Pt() <= 6.0) { + if (LambdacRot.M() > cMinLambdaMass && LambdacRot.M() <= cMaxLambdaMass && TMath::Abs(LambdacRot.Rapidity()) < confRapidity && LambdacRot.Pt() > 2.0 && LambdacRot.Pt() <= 6.0) { if (fillDefault) { histos.fill(HIST("hSparseV2SASameEventRotational_V2"), LambdacRot.M(), LambdacRot.Pt(), v2Rot, TMath::Abs(track1.dcaXY()), Proton.Pt()); } @@ -792,45 +756,31 @@ struct highmasslambda { BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass, axisEPAngle}, true}; Pair pairs{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksV0sTuple, &cache}; // -1 is the number of the bin to skip for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if (!collision1.sel8() || !collision2.sel8()) { + if (!collision1.sel8() || !collision1.triggereventep() || !collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (!collision1.triggereventep() || !collision2.triggereventep()) { + if (!collision2.sel8() || !collision2.triggereventep() || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (additionalEvSel && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (collision1.bcId() == collision2.bcId()) { continue; } - if (additionalEvSel && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - if (additionalEvSel2 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - return; - } - if (additionalEvSel2 && (!collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - return; - } auto centrality = collision1.centFT0C(); auto psiFT0C = collision1.psiFT0C(); auto QFT0C = collision1.qFT0C(); int occupancy1 = collision1.trackOccupancyInTimeRange(); int occupancy2 = collision1.trackOccupancyInTimeRange(); + if (occupancy1 > cfgOccupancyCut) { + continue; + } + if (occupancy2 > cfgOccupancyCut) { + continue; + } for (auto& [track1, v0] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (!selectionTrack(track1)) { continue; } - if (!track1.hasTOF()) { - if (!rejectPi(track1)) { - continue; - } - if (!rejectEl(track1)) { - continue; - } - if (!rejectKa(track1)) { - continue; - } - } - // PID check if (PIDstrategy == 0 && !selectionPID1(track1)) { continue; @@ -845,6 +795,11 @@ struct highmasslambda { continue; } + if (!track1.hasTOF()) { + if (rejectPID && !rejectEl(track1)) { + continue; + } + } if (!SelectionV0(collision2, v0)) { continue; } @@ -874,13 +829,6 @@ struct highmasslambda { } auto anglesign = (v0.x() - collision1.posX()) * v0.px() + (v0.y() - collision1.posY()) * v0.py() + (v0.z() - collision1.posZ()) * v0.pz(); anglesign = anglesign / TMath::Abs(anglesign); - auto dcasum = 0.0; - if (useSignDCAV0) { - dcasum = anglesign * (v0.dcav0topv()) - track1.dcaXY(); - } - if (!useSignDCAV0) { - dcasum = v0.dcav0topv() - track1.dcaXY(); - } if (occupancy1 < cfgOccupancyCut && occupancy2 < cfgOccupancyCut && Lambdac.M() > cMinLambdaMass && Lambdac.M() <= cMaxLambdaMass && TMath::Abs(Lambdac.Rapidity()) < confRapidity && Lambdac.Pt() > 2.0 && Lambdac.Pt() <= 6.0) { if (fillDefault) { diff --git a/PWGLF/Tasks/Resonances/k892analysis.cxx b/PWGLF/Tasks/Resonances/k892analysis.cxx index 0408b5105dc..2a980b3ffcd 100644 --- a/PWGLF/Tasks/Resonances/k892analysis.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis.cxx @@ -48,6 +48,7 @@ struct k892analysis { ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis occupancy_bins{"occupancy_bins", {VARIABLE_WIDTH, 0.0, 100, 500, 600, 1000, 1100, 1500, 1600, 2000, 2100, 2500, 2600, 3000, 3100, 3500, 3600, 4000, 4100, 4500, 4600, 5000, 5100, 9999}, "Binning of the occupancy axis"}; // ConfigurableAxis binsCent{"binsCent", {200, 0.0f, 200.0f}, "Binning of the centrality axis"}; Configurable cInvMassStart{"cInvMassStart", 0.6, "Invariant mass start"}; Configurable cInvMassEnd{"cInvMassEnd", 1.5, "Invariant mass end"}; @@ -58,6 +59,9 @@ struct k892analysis { Configurable invmass1D{"invmass1D", false, "Invariant mass 1D"}; Configurable study_antiparticle{"study_antiparticle", false, "Study anti-particles separately"}; Configurable PIDplots{"PIDplots", false, "Make TPC and TOF PID plots"}; + Configurable applyOccupancyCut{"applyOccupancyCut", false, "Apply occupancy cut"}; + Configurable OccupancyCut{"OccupancyCut", 1000, "Mimimum Occupancy cut"}; + /// Event Mixing Configurable nEvtMixing{"nEvtMixing", 5, "Number of events to mix"}; ConfigurableAxis CfgVtxBins{"CfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; @@ -139,6 +143,7 @@ struct k892analysis { AxisSpec ptAxisQA = {binsPtQA, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^2)"}; AxisSpec pidQAAxis = {cPIDBins, -cPIDQALimit, cPIDQALimit}; + AxisSpec occupancy_axis = {occupancy_bins, "Occupancy [-40,100]"}; if (additionalQAeventPlots) { // Test on Mixed event @@ -248,15 +253,17 @@ struct k892analysis { } // 3d histogram - histos.add("h3k892invmassDS", "Invariant mass of K(892)0 differnt sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis}); - histos.add("h3k892invmassLS", "Invariant mass of K(892)0 same sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis}); - histos.add("h3k892invmassME", "Invariant mass of K(892)0 mixed event", kTHnSparseF, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassDS", "Invariant mass of K(892)0 differnt sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis, occupancy_axis}); + histos.add("h3k892invmassLS", "Invariant mass of K(892)0 same sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis, occupancy_axis}); + histos.add("h3k892invmassME", "Invariant mass of K(892)0 mixed event", kTHnSparseF, {centAxis, ptAxis, invMassAxis, occupancy_axis}); + histos.add("h3k892invmassLSAnti", "Invariant mass of Anti-K(892)0 same sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis, occupancy_axis}); + if (study_antiparticle) { - histos.add("h3k892invmassDSAnti", "Invariant mass of Anti-K(892)0 differnt sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis}); - histos.add("h3k892invmassLSAnti", "Invariant mass of Anti-K(892)0 same sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassDSAnti", "Invariant mass of Anti-K(892)0 differnt sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis, occupancy_axis}); } + if (IsCalcRotBkg) { - histos.add("h3K892InvMassRotation", "Invariant mass of K(892)0 rotation", kTHnSparseF, {centAxis, ptAxis, invMassAxis}); + histos.add("h3K892InvMassRotation", "Invariant mass of K(892)0 rotation", kTHnSparseF, {centAxis, ptAxis, invMassAxis, occupancy_axis}); } if (additionalMEPlots) { @@ -445,6 +452,10 @@ struct k892analysis { if (additionalEvsel && !eventSelected(collision, multiplicity)) { return; } + auto occupancy_no = collision.trackOccupancyInTimeRange(); + if (applyOccupancyCut && occupancy_no < OccupancyCut) { + return; + } if (additionalQAplots) { histos.fill(HIST("MultCalib/centglopi_before"), multiplicity, dTracks1.size()); // centrality vs global tracks before the multiplicity calibration cuts @@ -623,28 +634,28 @@ struct k892analysis { float theta2 = rn->Uniform(TMath::Pi() - TMath::Pi() / rotational_cut, TMath::Pi() + TMath::Pi() / rotational_cut); ldaughter_rot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta2, massKa); // for rotated background lresonance_rot = lDecayDaughter1 + ldaughter_rot; - histos.fill(HIST("h3K892InvMassRotation"), multiplicity, lresonance_rot.Pt(), lresonance_rot.M()); + histos.fill(HIST("h3K892InvMassRotation"), multiplicity, lresonance_rot.Pt(), lresonance_rot.M(), occupancy_no); } } if (study_antiparticle) { if (trk1.sign() < 0) { if (invmass1D) histos.fill(HIST("k892invmassDS"), lResonance.M()); - histos.fill(HIST("h3k892invmassDS"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("h3k892invmassDS"), multiplicity, lResonance.Pt(), lResonance.M(), occupancy_no); } else if (trk1.sign() > 0) { if (invmass1D) histos.fill(HIST("k892invmassDSAnti"), lResonance.M()); - histos.fill(HIST("h3k892invmassDSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("h3k892invmassDSAnti"), multiplicity, lResonance.Pt(), lResonance.M(), occupancy_no); } } else { if (invmass1D) histos.fill(HIST("k892invmassDS"), lResonance.M()); - histos.fill(HIST("h3k892invmassDS"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("h3k892invmassDS"), multiplicity, lResonance.Pt(), lResonance.M(), occupancy_no); } } else { if (invmass1D) histos.fill(HIST("k892invmassME"), lResonance.M()); - histos.fill(HIST("h3k892invmassME"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("h3k892invmassME"), multiplicity, lResonance.Pt(), lResonance.M(), occupancy_no); if (additionalMEPlots) { if (trk1.sign() < 0) { if (invmass1D) @@ -696,20 +707,14 @@ struct k892analysis { } } else if (trk1.sign() * trk2.sign() > 0) { if constexpr (!IsMix) { - if (study_antiparticle) { - if (trk1.sign() < 0) { - if (invmass1D) - histos.fill(HIST("k892invmassLS"), lResonance.M()); - histos.fill(HIST("h3k892invmassLS"), multiplicity, lResonance.Pt(), lResonance.M()); - } else if (trk1.sign() > 0) { - if (invmass1D) - histos.fill(HIST("k892invmassLSAnti"), lResonance.M()); - histos.fill(HIST("h3k892invmassLSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - } - } else { + if (trk1.sign() < 0) { if (invmass1D) histos.fill(HIST("k892invmassLS"), lResonance.M()); - histos.fill(HIST("h3k892invmassLS"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("h3k892invmassLS"), multiplicity, lResonance.Pt(), lResonance.M(), occupancy_no); + } else if (trk1.sign() > 0) { + if (invmass1D) + histos.fill(HIST("k892invmassLSAnti"), lResonance.M()); + histos.fill(HIST("h3k892invmassLSAnti"), multiplicity, lResonance.Pt(), lResonance.M(), occupancy_no); } } } diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx new file mode 100644 index 00000000000..d1866ffb594 --- /dev/null +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -0,0 +1,1007 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +/// \author Marta Urioni + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" +#include "ReconstructionDataFormats/Track.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/Core/trackUtilities.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/TrackSelection.h" +#include "Framework/ASoAHelpers.h" +#include "DataFormatsParameters/GRPObject.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +using std::array; +struct k892analysis_PbPb { + SliceCache cache; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // histos + ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; + ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + + Configurable cInvMassStart{"cInvMassStart", 0.6, "Invariant mass start"}; + Configurable cInvMassEnd{"cInvMassEnd", 1.5, "Invariant mass end"}; + Configurable cInvMassBins{"cInvMassBins", 900, "Invariant mass binning"}; + Configurable cPIDBins{"cPIDBins", 65, "PID binning"}; + Configurable cPIDQALimit{"cPIDQALimit", 6.5, "PID QA limit"}; + Configurable cDCABins{"cDCABins", 300, "DCA binning"}; + + // events + Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; + Configurable additionalEvSel2{"additionalEvSel2", true, "NoSameBunchPileUp and IsGoodZvtxFT0vsPV"}; + Configurable additionalEvSel3{"additionalEvSel3", false, "Additional evsel3"}; + + // presel + Configurable cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"}; + + // Track selections + Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; + Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; + + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor + + Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; + Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; + Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; + Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; + Configurable cMaxTPCnSigmaKaon{"cMaxTPCnSigmaKaon", 3.0, "TPC nSigma cut for Kaon"}; // TPC + Configurable cMaxTOFnSigmaKaon{"cMaxTOFnSigmaKaon", 3.0, "TOF nSigma cut for Kaon"}; // TOF + Configurable cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC + Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF + Configurable cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection + + Configurable TofandTpcPID{"TOFandTPCPID", false, "apply both TOF and TPC PID"}; + + Configurable tpclowpt{"tpclowpt", true, "apply TPC at low pt"}; + Configurable tofhighpt{"tofhighpt", false, "apply TOF at high pt"}; + + // event mixing + Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; + ConfigurableAxis CfgVtxBins{"CfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"}; + + // cuts on mother + Configurable cfgCutsOnMother{"cfgCutsOnMother", false, "Enamble additional cuts on mother"}; + Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 15.0, "Maximum pt of mother cut"}; + Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 1.5, "Maximum Minv of mother cut"}; + + // configurables for partitions + Configurable cMaxPtTPC{"cMaxPtTPC", 1.2, "maximum pt to apply TPC PID and TOF if available"}; + Configurable cMinPtTOF{"cMinPtTOF", 0.8, "minimum pt to require TOF PID in addition to TPC"}; + + // plots + Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; + Configurable additionalQAeventPlots{"additionalQAeventPlots", false, "Additional QA event plots"}; + Configurable additionalMEPlots{"additionalMEPlots", false, "Additional Mixed event plots"}; + + // MC + Configurable genacceptancecut{"genacceptancecut", false, "Acceptance cut on generated MC particles"}; + Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; + + void init(o2::framework::InitContext&) + { + AxisSpec centAxis = {binsCent, "V0M (%)"}; + AxisSpec dcaxyAxis = {cDCABins, 0.0, 3.0, "DCA_{#it{xy}} (cm)"}; + AxisSpec dcazAxis = {cDCABins, 0.0, 3.0, "DCA_{#it{z}} (cm)"}; + AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; + AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisQA = {binsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^2)"}; + AxisSpec pidQAAxis = {cPIDBins, -cPIDQALimit, cPIDQALimit}; + + if (doprocessSameEvent || doprocessSameEventRun2 || doprocessMixedEvent || doprocessMixedEventRun2) { + // event histograms + histos.add("QAevent/hEvtCounterSameE", "Number of analyzed Same Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + histos.add("QAevent/hMultiplicityPercentSameE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); + histos.add("QAevent/hVertexZSameE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15., 15.}}); + + if (additionalQAeventPlots) { + // Test on Mixed event + histos.add("TestME/hCollisionIndexSameE", "coll index sameE", HistType::kTH1F, {{500, 0.0f, 500.0f}}); + histos.add("TestME/hCollisionIndexMixedE", "coll index mixedE", HistType::kTH1F, {{500, 0.0f, 500.0f}}); + histos.add("TestME/hnTrksSameE", "n tracks per event SameE", HistType::kTH1F, {{1000, 0.0f, 1000.0f}}); + histos.add("TestME/hnTrksMixedE", "n tracks per event MixedE", HistType::kTH1F, {{1000, 0.0f, 1000.0f}}); + histos.add("TestME/hPairsCounterSameE", "tot n pairs sameE", HistType::kTH1F, {{1, 0.5f, 1.5f}}); + histos.add("TestME/hPairsCounterMixedE", "tot n pairs mixedE", HistType::kTH1F, {{1, 0.5f, 1.5f}}); + + // event histograms + histos.add("QAevent/hEvtCounterMixedE", "Number of analyzed Mixed Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + histos.add("QAevent/hVertexZMixedE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15., 15.}}); + histos.add("QAevent/hMultiplicityPercentMixedE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); + } + } + + // Mass QA (quick check) + histos.add("k892invmassDS", "Invariant mass of K(892)0 different sign", kTH1F, {invMassAxis}); + histos.add("k892invmassDSAnti", "Invariant mass of Anti-K(892)0 different sign", kTH1F, {invMassAxis}); + histos.add("k892invmassLS", "Invariant mass of K(892)0 like sign", kTH1F, {invMassAxis}); + histos.add("k892invmassLSAnti", "Invariant mass of Anti-K(892)0 like sign", kTH1F, {invMassAxis}); + if (doprocessMixedEvent || doprocessMixedEventRun2) { + histos.add("k892invmassME", "Invariant mass of K(892)0 mixed event", kTH1F, {invMassAxis}); + if (additionalMEPlots) { + histos.add("k892invmassME_DS", "Invariant mass of K(892)0 mixed event DS", kTH1F, {invMassAxis}); + histos.add("k892invmassME_DSAnti", "Invariant mass of K(892)0 mixed event DSAnti", kTH1F, {invMassAxis}); + } + } + + if (additionalQAplots) { + // TPC ncluster distirbutions + histos.add("TPCncluster/TPCnclusterpi", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); + histos.add("TPCncluster/TPCnclusterka", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); + histos.add("TPCncluster/TPCnclusterPhipi", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + histos.add("TPCncluster/TPCnclusterPhika", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + } + + // DCA QA + histos.add("QA/trkDCAxy_pi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QA/trkDCAxy_ka", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QA/trkDCAz_pi", "DCAz distribution of pion track candidates", HistType::kTH1F, {dcazAxis}); + histos.add("QA/trkDCAz_ka", "DCAz distribution of kaon track candidates", HistType::kTH1F, {dcazAxis}); + // pT QA + histos.add("QA/trkpT_pi", "pT distribution of pion track candidates", kTH1F, {ptAxis}); + histos.add("QA/trkpT_ka", "pT distribution of kaon track candidates", kTH1F, {ptAxis}); + // PID QA + histos.add("QA/TOF_TPC_Map_pi_all", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QA/TOF_Nsigma_pi_all", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QA/TPC_Nsigma_pi_all", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QA/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QA/TOF_Nsigma_ka_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QA/TPC_Nsigmaka_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + // 3d histogram + histos.add("h3k892invmassDS", "Invariant mass of K(892)0 differnt sign", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassDSAnti", "Invariant mass of Anti-K(892)0 differnt sign", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassLS", "Invariant mass of K(892)0 same sign", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassLSAnti", "Invariant mass of Anti-K(892)0 same sign", kTH3F, {centAxis, ptAxis, invMassAxis}); + if (doprocessMixedEvent || doprocessMixedEventRun2) { + histos.add("h3k892invmassME", "Invariant mass of K(892)0 mixed event", kTH3F, {centAxis, ptAxis, invMassAxis}); + + if (additionalMEPlots) { + histos.add("QAME/TOF_TPC_Map_pi_all", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAME/TOF_Nsigma_pi_all", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAME/TPC_Nsigma_pi_all", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAME/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAME/TOF_Nsigma_ka_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAME/TPC_Nsigmaka_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("h3k892invmassME_DS", "Invariant mass of K(892)0 mixed event DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassME_DSAnti", "Invariant mass of K(892)0 mixed event DSAnti", kTH3F, {centAxis, ptAxis, invMassAxis}); + } + } + + if (doprocessMC || doprocessMCRun2) { + histos.add("hMCrecCollSels", "MC Event statistics", HistType::kTH1F, {{10, 0.0f, 10.0f}}); + histos.add("QAevent/hMultiplicityPercentMC", "Multiplicity percentile of MCrec collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); + + histos.add("h1k892Recsplit", "k892 Rec split", HistType::kTH1F, {{200, 0.0f, 20.0f}}); + // MC QA + histos.add("QAMCTrue/hGlobalIndexMotherRec", "index of rec mothers", HistType::kTH1F, {{static_cast(1e5), 0.0f, 1e5f}}); + histos.add("QAMCTrue/hGlobalIndexMotherGen", "index of gen mothers", HistType::kTH1F, {{static_cast(1e5), 0.0f, 1e5f}}); + histos.add("QAMCTrue/TOF_Nsigma_pi_all", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TPC_Nsigma_pi_all", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TOF_Nsigma_ka_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TPC_Nsigmaka_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("k892Recinvmass", "Inv mass distribution of Reconstructed MC K(892)", kTH1F, {invMassAxis}); + histos.add("k892RecinvmassAnti", "Inv mass distribution of Reconstructed MC AntiK(892)", kTH1F, {invMassAxis}); + histos.add("k892GenInvmass", "Invariant mass of generated K(892)0", kTH1F, {invMassAxis}); + histos.add("k892GenInvmassAnti", "Invariant mass of generated Anti-K(892)0", kTH1F, {invMassAxis}); + + histos.add("h3Reck892invmass", "Invariant mass of Reconstructed MC K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3Reck892invmassAnti", "Invariant mass of Reconstructed MC Anti-K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("k892Gen", "pT distribution of True MC K(892)0", kTH3F, {mcLabelAxis, ptAxis, centAxis}); + histos.add("k892GenAnti", "pT distribution of True MC Anti-K(892)0", kTH3F, {mcLabelAxis, ptAxis, centAxis}); + histos.add("k892Rec", "pT distribution of Reconstructed MC K(892)0", kTH2F, {ptAxis, centAxis}); + histos.add("k892RecAnti", "pT distribution of Reconstructed MC Anti-K(892)0", kTH2F, {ptAxis, centAxis}); + histos.add("h3k892GenInvmass", "Invariant mass of generated K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892GenInvmassAnti", "Invariant mass of generated Anti-K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); + } + // Print output histograms statistics + LOG(info) << "Size of the histograms in spectraTOF"; + histos.print(); + } + + double massKa = o2::constants::physics::MassKPlus; + double massPi = o2::constants::physics::MassPiPlus; + + template + bool trackCut(const TrackType track) + { + // basic track cuts + if (track.itsNCls() < cfgITScluster) + return false; + if (track.tpcNClsFound() < cfgTPCcluster) + return false; + if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) + return false; + if (cfgPVContributor && !track.isPVContributor()) + return false; + if (cfgPrimaryTrack && !track.isPrimaryTrack()) + return false; + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (cfgGlobalTrack && !track.isGlobalTrack()) + return false; + + return true; + } + + template + bool selectionPIDKaon(const T& candidate) + { + + if (TofandTpcPID) { + + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) <= cMaxTOFnSigmaKaon && candidate.hasTPC() && std::abs(candidate.tpcNSigmaKa()) <= cMaxTPCnSigmaKaon) { // tof and tpc cut + return true; + } + + } else { + + if (candidate.hasTPC() && std::abs(candidate.tpcNSigmaKa()) <= cMaxTPCnSigmaKaon) { // tpc cut, tof when available + + if (cByPassTOF) // skip tof selection + return true; + + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaKa()) <= cMaxTOFnSigmaKaon) { + return true; + } + } else { + return true; + } + } + } + + return false; + } + + template + bool selectionPIDPion(const T& candidate) + { + + if (TofandTpcPID) { + + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) <= cMaxTOFnSigmaPion && candidate.hasTPC() && std::abs(candidate.tpcNSigmaPi()) <= cMaxTPCnSigmaPion) { // tof and tpc cut + return true; + } + + } else { + + if (candidate.hasTPC() && std::abs(candidate.tpcNSigmaPi()) <= cMaxTPCnSigmaPion) { // tpc cut, tof when available + + if (cByPassTOF) // skip tof selection + return true; + + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaPi()) <= cMaxTOFnSigmaPion) { + return true; + } + } else { + return true; + } + } + } + + return false; + } + + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2) + { + + auto multiplicity = -999; + + if constexpr (!IsRun2) + multiplicity = collision.centFT0C(); + else + multiplicity = collision.centRun2V0M(); + + auto oldindex = -999; + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + for (auto& [trk1, trk2] : combinations(CombinationsFullIndexPolicy(dTracks1, dTracks2))) { + + // Full index policy is needed to consider all possible combinations + if (trk1.index() == trk2.index()) + continue; // We need to run (0,1), (1,0) pairs as well. but same id pairs are not needed. + + if (additionalQAeventPlots) { + if constexpr (!IsMC) { + if constexpr (!IsMix) { + histos.fill(HIST("TestME/hPairsCounterSameE"), 1.0); + } else { + histos.fill(HIST("TestME/hPairsCounterMixedE"), 1.0); + } + } + } + + //// Initialize variables + // Trk1: Pion, Trk2: Kaon + // apply the track cut + if (!trackCut(trk1) || !trackCut(trk2)) + continue; + + auto isTrk1hasTOF = trk1.hasTOF(); + auto isTrk2hasTOF = trk2.hasTOF(); + auto trk1ptPi = trk1.pt(); + auto trk1NSigmaPiTPC = trk1.tpcNSigmaPi(); + auto trk1NSigmaPiTOF = (isTrk1hasTOF) ? trk1.tofNSigmaPi() : -999.; + auto trk2ptKa = trk2.pt(); + auto trk2NSigmaKaTPC = trk2.tpcNSigmaKa(); + auto trk2NSigmaKaTOF = (isTrk2hasTOF) ? trk2.tofNSigmaKa() : -999.; + + if (!selectionPIDPion(trk1) || !selectionPIDKaon(trk2)) + continue; + + if constexpr (IsMC) { + if (tpclowpt) { + if (trk1ptPi >= cMaxPtTPC || trk2ptKa >= cMaxPtTPC) + continue; + } else if (tofhighpt) { + if (trk1ptPi <= cMinPtTOF || trk2ptKa <= cMinPtTOF) + continue; + } + } + + if (additionalQAplots) { + // TPCncluster distributions + histos.fill(HIST("TPCncluster/TPCnclusterpi"), trk1.tpcNClsFound()); + histos.fill(HIST("TPCncluster/TPCnclusterka"), trk2.tpcNClsFound()); + histos.fill(HIST("TPCncluster/TPCnclusterPhipi"), trk1.tpcNClsFound(), trk1.phi()); + histos.fill(HIST("TPCncluster/TPCnclusterPhika"), trk2.tpcNClsFound(), trk2.phi()); + } + + if constexpr (!IsMix) { + //// QA plots after the selection + // --- PID QA Pion + histos.fill(HIST("QA/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QA/TOF_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + histos.fill(HIST("QA/TOF_TPC_Map_pi_all"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); + } + // --- PID QA Kaon + histos.fill(HIST("QA/TPC_Nsigmaka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QA/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); + histos.fill(HIST("QA/TOF_TPC_Mapka_all"), trk2NSigmaKaTOF, trk2NSigmaKaTPC); + } + histos.fill(HIST("QA/trkpT_pi"), trk1ptPi); + histos.fill(HIST("QA/trkpT_ka"), trk2ptKa); + histos.fill(HIST("QA/trkDCAxy_pi"), trk1.dcaXY()); + histos.fill(HIST("QA/trkDCAxy_ka"), trk2.dcaXY()); + histos.fill(HIST("QA/trkDCAz_pi"), trk1.dcaZ()); + histos.fill(HIST("QA/trkDCAz_ka"), trk2.dcaZ()); + } else if (additionalMEPlots) { + // --- PID QA Pion + histos.fill(HIST("QAME/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAME/TOF_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + histos.fill(HIST("QAME/TOF_TPC_Map_pi_all"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); + } + // --- PID QA Kaon + histos.fill(HIST("QAME/TPC_Nsigmaka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QAME/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); + histos.fill(HIST("QAME/TOF_TPC_Mapka_all"), trk2NSigmaKaTOF, trk2NSigmaKaTPC); + } + } + + //// Resonance reconstruction + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + lResonance = lDecayDaughter1 + lDecayDaughter2; + // Rapidity cut + if (abs(lResonance.Rapidity()) >= 0.5) + continue; + if (cfgCutsOnMother) { + if (lResonance.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (lResonance.M() >= cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + + int track1Sign = trk1.sign(); + int track2Sign = trk2.sign(); + //// Un-like sign pair only + + if (track1Sign * track2Sign < 0) { + if constexpr (!IsMix) { + if (track1Sign < 0) { + histos.fill(HIST("k892invmassDS"), lResonance.M()); + histos.fill(HIST("h3k892invmassDS"), multiplicity, lResonance.Pt(), lResonance.M()); + } else if (track1Sign > 0) { + histos.fill(HIST("k892invmassDSAnti"), lResonance.M()); + histos.fill(HIST("h3k892invmassDSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + } else { + histos.fill(HIST("k892invmassME"), lResonance.M()); + histos.fill(HIST("h3k892invmassME"), multiplicity, lResonance.Pt(), lResonance.M()); + if (additionalMEPlots) { + if (track1Sign < 0) { + histos.fill(HIST("k892invmassME_DS"), lResonance.M()); + histos.fill(HIST("h3k892invmassME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + } else if (track1Sign > 0) { + histos.fill(HIST("k892invmassME_DSAnti"), lResonance.M()); + histos.fill(HIST("h3k892invmassME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + } + } + + // MC + if constexpr (IsMC) { + + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + continue; + + const auto mctrack1 = trk1.mcParticle(); + const auto mctrack2 = trk2.mcParticle(); + int track1PDG = TMath::Abs(mctrack1.pdgCode()); + int track2PDG = TMath::Abs(mctrack2.pdgCode()); + + if (!mctrack1.isPhysicalPrimary() || !mctrack2.isPhysicalPrimary()) + continue; + + if (track1PDG != 211 || track2PDG != 321) + continue; + + bool ismotherok = false; + int pdgcodeMother = -999; + for (auto& mothertrack1 : mctrack1.template mothers_as()) { + for (auto& mothertrack2 : mctrack2.template mothers_as()) { + if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) + continue; + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) + continue; + if (TMath::Abs(mothertrack1.pdgCode()) != 313) + continue; + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + histos.fill(HIST("h1k892Recsplit"), mothertrack1.pt()); + continue; + } + oldindex = mothertrack1.globalIndex(); + pdgcodeMother = mothertrack1.pdgCode(); + ismotherok = true; + } + } + + if (!ismotherok) + continue; + + histos.fill(HIST("QAMCTrue/hGlobalIndexMotherRec"), oldindex); + // Track selection check. + histos.fill(HIST("QAMCTrue/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + } + histos.fill(HIST("QAMCTrue/TPC_Nsigmaka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); + } + + // MC histograms + if (pdgcodeMother > 0) { + histos.fill(HIST("k892Rec"), lResonance.Pt(), multiplicity); + histos.fill(HIST("k892Recinvmass"), lResonance.M()); + histos.fill(HIST("h3Reck892invmass"), multiplicity, lResonance.Pt(), lResonance.M()); + } else { + histos.fill(HIST("k892RecAnti"), lResonance.Pt(), multiplicity); + histos.fill(HIST("k892RecinvmassAnti"), lResonance.M()); + histos.fill(HIST("h3Reck892invmassAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + } + } else if (track1Sign * track2Sign > 0) { + if constexpr (!IsMix) { + if (track1Sign < 0) { + histos.fill(HIST("k892invmassLS"), lResonance.M()); + histos.fill(HIST("h3k892invmassLS"), multiplicity, lResonance.Pt(), lResonance.M()); + } else if (track1Sign > 0) { + histos.fill(HIST("k892invmassLSAnti"), lResonance.M()); + histos.fill(HIST("h3k892invmassLSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + } + } // end on DS or LS if tenses + } // end of loop on tracks combinations + } // ennd on fill histograms + + Filter collisionFilter = nabs(aod::collision::posZ) <= cfgCutVertex; + Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfgCutCentrality; + Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) >= cfgCutPT); + Filter DCAcutFilter = (nabs(aod::track::dcaXY) <= cfgCutDCAxy) && (nabs(aod::track::dcaZ) <= cfgCutDCAz); + + using EventCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; + + // partitions tpc low pt + Partition negPitpc = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaPi) <= cMaxTPCnSigmaPion) && (nabs(aod::track::pt) < cMaxPtTPC); + Partition posKatpc = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cMaxTPCnSigmaKaon) && (nabs(aod::track::pt) < cMaxPtTPC); + + Partition posPitpc = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaPi) <= cMaxTPCnSigmaPion) && (nabs(aod::track::pt) < cMaxPtTPC); + Partition negKatpc = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cMaxTPCnSigmaKaon) && (nabs(aod::track::pt) < cMaxPtTPC); + + // tpc & tof, high pt + Partition negPitof = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtof::tofNSigmaPi) <= cMaxTOFnSigmaPion) && (nabs(aod::pidtpc::tpcNSigmaPi) <= cMaxTPCnSigmaPion) && (nabs(aod::track::pt) > cMinPtTOF); + Partition posKatof = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtof::tofNSigmaKa) <= cMaxTOFnSigmaKaon) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cMaxTPCnSigmaKaon) && (nabs(aod::track::pt) > cMinPtTOF); + + Partition posPitof = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtof::tofNSigmaPi) <= cMaxTOFnSigmaPion) && (nabs(aod::pidtpc::tpcNSigmaPi) <= cMaxTPCnSigmaPion) && (nabs(aod::track::pt) > cMinPtTOF); + Partition negKatof = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtof::tofNSigmaKa) <= cMaxTOFnSigmaKaon) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cMaxTPCnSigmaKaon) && (nabs(aod::track::pt) > cMinPtTOF); + + void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) + { + if (!collision.sel8()) { + return; + } + auto centrality = collision.centFT0C(); + if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + return; + } + if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + return; + } + if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + return; + } + // int occupancy = collision.trackOccupancyInTimeRange(); + + histos.fill(HIST("QAevent/hEvtCounterSameE"), 1); + histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), centrality); + + if (additionalQAeventPlots) { + histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); + histos.fill(HIST("TestME/hnTrksSameE"), tracks.size()); + } + + if (tpclowpt) { + //+- + auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + fillHistograms(collision, candPosPitpc, candNegKatpc); + + //-+ + auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + fillHistograms(collision, candNegPitpc, candPosKatpc); + + } else if (tofhighpt) { + //+- + auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + fillHistograms(collision, candPosPitof, candNegKatof); + + //-+ + auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + fillHistograms(collision, candNegPitof, candPosKatof); + } + } + PROCESS_SWITCH(k892analysis_PbPb, processSameEvent, "Process Same event", false); + + ///////*************************************** + + using Run2Events = soa::Join; //, aod::TrackletMults>; + using BCsWithRun2Info = soa::Join; + + void processSameEventRun2(Run2Events::iterator const& collision, TrackCandidates const& tracks, BCsWithRun2Info const&) + { + auto bc = collision.bc_as(); + + // if (!collision.alias_bit(kINT7)) + // return; + + // if (!collision.sel7()) + // return; + + if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) + return; + + if (std::abs(collision.posZ()) > cfgCutVertex) + return; + + auto centrality = collision.centRun2V0M(); + + if (centrality > cfgCutCentrality) + return; + + histos.fill(HIST("QAevent/hEvtCounterSameE"), 1); + histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), centrality); + + if (additionalQAeventPlots) { + histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); + histos.fill(HIST("TestME/hnTrksSameE"), tracks.size()); + } + + if (tpclowpt) { + //+- + auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + fillHistograms(collision, candPosPitpc, candNegKatpc); + + //-+ + auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + fillHistograms(collision, candNegPitpc, candPosKatpc); + + } else if (tofhighpt) { + //+- + auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + fillHistograms(collision, candPosPitof, candNegKatof); + + //-+ + auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + fillHistograms(collision, candNegPitof, candPosKatof); + } + } + PROCESS_SWITCH(k892analysis_PbPb, processSameEventRun2, "Process Same event Run2", false); + + using BinningTypeVtxCent = ColumnBinningPolicy; + void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) + { + auto tracksTuple = std::make_tuple(tracks); + BinningTypeVtxCent colBinning{{CfgVtxBins, CfgMultBins}, true}; + SameKindPair pairs{colBinning, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; + + for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (!collision1.sel8() || !collision2.sel8()) { + continue; + } + auto centrality = collision1.centFT0C(); + + if (timFrameEvsel && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + continue; + } + if (additionalEvSel2 && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + continue; + } + if (additionalEvSel3 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + + if (additionalQAeventPlots) { + histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); + histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), centrality); + histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision1.globalIndex()); + histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); + } + + if (tpclowpt) { + + //+- + auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candPosPitpc, candNegKatpc); + + //-+ + auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candNegPitpc, candPosKatpc); + + } else if (tofhighpt) { + + //+- + auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candPosPitof, candNegKatof); + + //-+ + auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candNegPitof, candPosKatof); + } + } + } + PROCESS_SWITCH(k892analysis_PbPb, processMixedEvent, "Process Mixed event", true); + + using BinningTypeVtxCentRun2 = ColumnBinningPolicy; + void processMixedEventRun2(Run2Events const& collisions, TrackCandidates const& tracks, BCsWithRun2Info const&) + { + auto tracksTuple = std::make_tuple(tracks); + BinningTypeVtxCentRun2 colBinning{{CfgVtxBins, CfgMultBins}, true}; + SameKindPair pairs{colBinning, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; + + for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { + + auto bc1 = collision1.bc_as(); + auto bc2 = collision2.bc_as(); + + if (!(bc1.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted)) || !(bc2.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) + continue; + + if ((std::abs(collision1.posZ()) > cfgCutVertex) || (std::abs(collision2.posZ()) > cfgCutVertex)) + continue; + + auto centrality1 = collision1.centRun2V0M(); + auto centrality2 = collision2.centRun2V0M(); + + if ((centrality1 > cfgCutCentrality) || (centrality2 > cfgCutCentrality)) + continue; + + if (additionalQAeventPlots) { + histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); + histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), centrality1); + histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision1.globalIndex()); + histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); + } + + if (tpclowpt) { + + //+- + auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candPosPitpc, candNegKatpc); + + //-+ + auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candNegPitpc, candPosKatpc); + + } else if (tofhighpt) { + + //+- + auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candPosPitof, candNegKatof); + + //-+ + auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candNegPitof, candPosKatof); + } + } + } + PROCESS_SWITCH(k892analysis_PbPb, processMixedEventRun2, "Process Mixed event Run2", true); + + // MC + + using EventCandidatesMCrec = soa::Join; + using TrackCandidatesMCrec = soa::Filtered>; + + void processMC(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks) + { + histos.fill(HIST("hMCrecCollSels"), 0); + if (recCollisions.size() == 0) { + histos.fill(HIST("hMCrecCollSels"), 1); + return; + } + if (recCollisions.size() > 1) { + histos.fill(HIST("hMCrecCollSels"), 2); + return; + } + for (auto& RecCollision : recCollisions) { + histos.fill(HIST("hMCrecCollSels"), 3); + if (!RecCollision.sel8()) { + continue; + } + histos.fill(HIST("hMCrecCollSels"), 4); + if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) { + continue; + } + histos.fill(HIST("hMCrecCollSels"), 5); + if (timFrameEvsel && (!RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + continue; + } + histos.fill(HIST("hMCrecCollSels"), 6); + if (additionalEvSel2 && (!RecCollision.selection_bit(aod::evsel::kNoSameBunchPileup) || !RecCollision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + continue; + } + histos.fill(HIST("hMCrecCollSels"), 7); + if (additionalEvSel3 && (!RecCollision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + histos.fill(HIST("hMCrecCollSels"), 8); + + auto centrality = RecCollision.centFT0C(); + histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); + auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); + fillHistograms(RecCollision, tracks, tracks); + + // Generated MC + for (auto& mcPart : mcParticles) { + if (abs(mcPart.y()) >= 0.5 || abs(mcPart.pdgCode()) != 313) + continue; + + auto kDaughters = mcPart.daughters_as(); + if (kDaughters.size() != 2) { + continue; + } + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + + auto daughtp = false; + auto daughtk = false; + for (auto kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) + break; + if (genacceptancecut && (kCurrentDaughter.pt() < cfgCutPT || TMath::Abs(kCurrentDaughter.eta()) > cfgCutEta)) + break; + + if (abs(kCurrentDaughter.pdgCode()) == 211) { + daughtp = true; + lDecayDaughter1.SetXYZM(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massPi); + } else if (abs(kCurrentDaughter.pdgCode()) == 321) { + daughtk = true; + lDecayDaughter2.SetXYZM(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + } + } + + if (!daughtp || !daughtk) + continue; + + lResonance = lDecayDaughter1 + lDecayDaughter2; + + histos.fill(HIST("QAMCTrue/hGlobalIndexMotherGen"), mcPart.globalIndex()); + + if (mcPart.pdgCode() > 0) { // no cuts, purely generated + histos.fill(HIST("k892GenInvmass"), lResonance.M()); + histos.fill(HIST("h3k892GenInvmass"), centrality, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("k892Gen"), 3, mcPart.pt(), centrality); + } else { + histos.fill(HIST("k892GenInvmassAnti"), lResonance.M()); + histos.fill(HIST("h3k892GenInvmassAnti"), centrality, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("k892GenAnti"), 3, mcPart.pt(), centrality); + } + + } // end loop on gen particles + + } // end loop on rec collisions + } + PROCESS_SWITCH(k892analysis_PbPb, processMC, "Process Monte Carlo", false); + + // MC Run2 + + using EventCandidatesMCrecRun2 = soa::Join; // aod::TrackletMults>; + + void processMCRun2(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks, BCsWithRun2Info const&) + { + histos.fill(HIST("hMCrecCollSels"), 0); + if (recCollisions.size() == 0) { + histos.fill(HIST("hMCrecCollSels"), 1); + return; + } + if (recCollisions.size() > 1) { + histos.fill(HIST("hMCrecCollSels"), 2); + return; + } + for (auto& RecCollision : recCollisions) { + auto bc = RecCollision.bc_as(); + histos.fill(HIST("hMCrecCollSels"), 3); + + if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) + continue; + histos.fill(HIST("hMCrecCollSels"), 4); + + if (std::abs(RecCollision.posZ()) > cfgCutVertex) + continue; + histos.fill(HIST("hMCrecCollSels"), 5); + + auto centrality = RecCollision.centRun2V0M(); + + histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); + auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); + fillHistograms(RecCollision, tracks, tracks); + + // Generated MC + for (auto& mcPart : mcParticles) { + if (abs(mcPart.y()) >= 0.5 || abs(mcPart.pdgCode()) != 313) + continue; + + auto kDaughters = mcPart.daughters_as(); + if (kDaughters.size() != 2) { + continue; + } + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + + auto daughtp = false; + auto daughtk = false; + for (auto kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) + break; + if (genacceptancecut && (kCurrentDaughter.pt() < cfgCutPT || TMath::Abs(kCurrentDaughter.eta()) > cfgCutEta)) + break; + + if (abs(kCurrentDaughter.pdgCode()) == 211) { + daughtp = true; + lDecayDaughter1.SetXYZM(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massPi); + } else if (abs(kCurrentDaughter.pdgCode()) == 321) { + daughtk = true; + lDecayDaughter2.SetXYZM(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + } + } + + if (!daughtp || !daughtk) + continue; + + lResonance = lDecayDaughter1 + lDecayDaughter2; + + histos.fill(HIST("QAMCTrue/hGlobalIndexMotherGen"), mcPart.globalIndex()); + + if (mcPart.pdgCode() > 0) { // no cuts, purely generated + histos.fill(HIST("k892GenInvmass"), lResonance.M()); + histos.fill(HIST("h3k892GenInvmass"), centrality, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("k892Gen"), 3, mcPart.pt(), centrality); + } else { + histos.fill(HIST("k892GenInvmassAnti"), lResonance.M()); + histos.fill(HIST("h3k892GenInvmassAnti"), centrality, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("k892GenAnti"), 3, mcPart.pt(), centrality); + } + + } // end loop on gen particles + + } // end loop on rec collisions + } + PROCESS_SWITCH(k892analysis_PbPb, processMCRun2, "Process Monte Carlo Run2", false); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"k892analysis_PbPb"})}; +} diff --git a/PWGLF/Tasks/Resonances/kstar892analysis.cxx b/PWGLF/Tasks/Resonances/kstar892analysis.cxx index ba456d46532..eb75690babd 100644 --- a/PWGLF/Tasks/Resonances/kstar892analysis.cxx +++ b/PWGLF/Tasks/Resonances/kstar892analysis.cxx @@ -18,6 +18,7 @@ #include #include "TF1.h" +#include #include "Common/Core/RecoDecay.h" #include "Common/DataModel/PIDResponse.h" @@ -602,7 +603,7 @@ struct kstar892analysis { } // MC histograms - if (trk1.motherPDG() < 0) { + if (trk1.motherPDG() > 0) { histos.fill(HIST("k892Rec"), lResonance.Pt(), multiplicity); histos.fill(HIST("ImpactParPlots/k892Rec"), lResonance.Pt(), impactpar); histos.fill(HIST("k892Recinvmass"), lResonance.M()); diff --git a/PWGLF/Tasks/Resonances/kstarpbpb.cxx b/PWGLF/Tasks/Resonances/kstarpbpb.cxx index 71136bff67e..2d507ba5dda 100644 --- a/PWGLF/Tasks/Resonances/kstarpbpb.cxx +++ b/PWGLF/Tasks/Resonances/kstarpbpb.cxx @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include #include @@ -83,6 +85,7 @@ struct kstarpbpb { Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; Configurable useGlobalTrack{"useGlobalTrack", true, "use Global track"}; + Configurable nsigmaCutTOF{"nsigmacutTOF", 3.0, "Value of the TOF Nsigma cut"}; Configurable nsigmaCutTPC{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 1, "Number of mixed events per event"}; @@ -99,8 +102,12 @@ struct kstarpbpb { Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; + Configurable OnlyTOF{"OnlyTOF", true, "OnlyTOF"}; + Configurable strategyPID{"strategyPID", 2, "PID strategy"}; Configurable isGI{"isGI", false, "pT dependent PID"}; + Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; + Configurable additionalQAplots1{"additionalQAplots1", true, "Additional QA plots"}; Configurable confMinRot{"confMinRot", 5.0 * TMath::Pi() / 6.0, "Minimum of rotation"}; Configurable confMaxRot{"confMaxRot", 7.0 * TMath::Pi() / 6.0, "Maximum of rotation"}; Configurable nBkgRotations{"nBkgRotations", 9, "Number of rotated copies (background) per each original candidate"}; @@ -115,7 +122,7 @@ struct kstarpbpb { Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using EventCandidates = soa::Filtered>; - using TrackCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; SliceCache cache; Partition posTracks = aod::track::signed1Pt > cfgCutCharge; @@ -144,23 +151,27 @@ struct kstarpbpb { AxisSpec occupancyAxis = {occupancyBinning, "Occupancy"}; histos.add("hpTvsRapidity", "pT vs Rapidity", kTH2F, {{100, 0.0f, 10.0f}, {300, -1.5f, 1.5f}}); - histos.add("hFTOCvsTPCSelected", "Mult correlation FT0C vs. TPC after selection", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}}); - histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}}); - histos.add("hOccupancy", "Occupancy distribution", kTH1F, {occupancyAxis}); - histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); - histos.add("hPsiFT0C", "PsiFT0C", kTH2F, {centAxis, phiAxis}); - histos.add("hPsiFT0A", "PsiFT0A", kTH2F, {centAxis, phiAxis}); - histos.add("hPsiTPC", "PsiTPC", kTH2F, {centAxis, phiAxis}); + histos.add("TPC_Nsigma_pi", "TPC_Nsigma_pi", kTH2F, {{60, 0.0f, 6.0f}, {500, -5, 5}}); + histos.add("TPC_Nsigma_ka", "TPC_Nsigma_ka", kTH2F, {{60, 0.0f, 6.0f}, {500, -5, 5}}); + histos.add("TOF_Nsigma_pi", "TOF_Nsigma_pi", kTH2F, {{60, 0.0f, 6.0f}, {500, -5, 5}}); + histos.add("TOF_Nsigma_ka", "TOF_Nsigma_ka", kTH2F, {{60, 0.0f, 6.0f}, {500, -5, 5}}); histos.add("hSparseV2SASameEvent_V2", "hSparseV2SASameEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); histos.add("hSparseV2SAlikeEventNN_V2", "hSparseV2SAlikeEventNN_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); histos.add("hSparseV2SAlikeEventPP_V2", "hSparseV2SAlikeEventPP_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); histos.add("hSparseV2SAMixedEvent_V2", "hSparseV2SAMixedEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); histos.add("hSparseV2SASameEventRotational_V2", "hSparseV2SASameEventRotational_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - - // histogram for resolution - histos.add("ResFT0CTPC", "ResFT0CTPC", kTH2F, {centAxis, resAxis}); - histos.add("ResFT0CFT0A", "ResFT0CFT0A", kTH2F, {centAxis, resAxis}); - histos.add("ResFT0ATPC", "ResFT0ATPC", kTH2F, {centAxis, resAxis}); + if (additionalQAplots1) { + histos.add("hFTOCvsTPCSelected", "Mult correlation FT0C vs. TPC after selection", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}}); + histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}}); + histos.add("hOccupancy", "Occupancy distribution", kTH1F, {occupancyAxis}); + histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); + histos.add("hPsiFT0C", "PsiFT0C", kTH2F, {centAxis, phiAxis}); + histos.add("hPsiFT0A", "PsiFT0A", kTH2F, {centAxis, phiAxis}); + histos.add("hPsiTPC", "PsiTPC", kTH2F, {centAxis, phiAxis}); + histos.add("ResFT0CTPC", "ResFT0CTPC", kTH2F, {centAxis, resAxis}); + histos.add("ResFT0CFT0A", "ResFT0CFT0A", kTH2F, {centAxis, resAxis}); + histos.add("ResFT0ATPC", "ResFT0ATPC", kTH2F, {centAxis, resAxis}); + } if (additionalQAplots) { // DCA QA histos.add("QAbefore/trkDCAxyka", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); @@ -248,17 +259,17 @@ struct kstarpbpb { bool selectionPIDNew(const T& candidate, int PID) { if (PID == 0) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { return true; } } else if (PID == 1) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { return true; } } @@ -269,23 +280,89 @@ struct kstarpbpb { bool selectionPID(const T& candidate, int PID) { if (PID == 0) { - if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!OnlyTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + return true; + } + if (!OnlyTOF && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { return true; } - if (candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (OnlyTOF && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { return true; } } else if (PID == 1) { - if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (!OnlyTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + return true; + } + if (!OnlyTOF && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { return true; } - if (candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (OnlyTOF && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { return true; } } return false; } + template + bool strategySelectionPID(const T& candidate, int PID, int strategy) + { + if (PID == 0) { + if (strategy == 0) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + return true; + } + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) { + return true; + } + } else if (strategy == 1) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + return true; + } + if (candidate.pt() >= 0.5 && TMath::Sqrt(candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) { + return true; + } + } else if (strategy == 2) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + return true; + } + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) { + return true; + } + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && !candidate.hasTOF()) { + return true; + } + } + } + if (PID == 1) { + if (strategy == 0) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + return true; + } + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) { + return true; + } + } else if (strategy == 1) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + return true; + } + if (candidate.pt() >= 0.5 && TMath::Sqrt(candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) { + return true; + } + } else if (strategy == 2) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + return true; + } + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) { + return true; + } + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && !candidate.hasTOF()) { + return true; + } + } + } + return false; + } + double GetPhiInRange(double phi) { double result = phi; @@ -298,7 +375,7 @@ struct kstarpbpb { return result; } template - bool isFakeKaon(T const& track, int PID) + bool isFakeKaon(T const& track, int /*PID*/) { const auto pglobal = track.p(); const auto ptpc = track.tpcInnerParam(); @@ -314,7 +391,115 @@ struct kstarpbpb { using BinningTypeVertexContributor = ColumnBinningPolicy; ROOT::Math::PxPyPzMVector KstarMother, daughter1, daughter2, kaonrot, kstarrot; - void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) + void processSE(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) + { + if (!collision.sel8() || !collision.triggereventep() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return; + } + auto centrality = collision.centFT0C(); + auto multTPC = collision.multNTracksPV(); + int occupancy = collision.trackOccupancyInTimeRange(); + auto psiFT0C = collision.psiFT0C(); + auto psiFT0A = collision.psiFT0A(); + auto psiTPC = collision.psiTPC(); + if (fillOccupancy && occupancy >= cfgOccupancyCut) { + return; + } + if (additionalEvsel && !eventSelected(collision, centrality)) { + return; + } + if (additionalQAplots1) { + histos.fill(HIST("hFTOCvsTPCSelected"), centrality, multTPC); + histos.fill(HIST("hPsiFT0C"), centrality, psiFT0C); + histos.fill(HIST("hPsiFT0A"), centrality, psiFT0A); + histos.fill(HIST("hPsiTPC"), centrality, psiTPC); + histos.fill(HIST("ResFT0CTPC"), centrality, TMath::Cos(2.0 * (psiFT0C - psiTPC))); + histos.fill(HIST("ResFT0CFT0A"), centrality, TMath::Cos(2.0 * (psiFT0C - psiFT0A))); + histos.fill(HIST("ResFT0ATPC"), centrality, TMath::Cos(2.0 * (psiTPC - psiFT0A))); + histos.fill(HIST("hCentrality"), centrality); + histos.fill(HIST("hOccupancy"), occupancy); + histos.fill(HIST("hVtxZ"), collision.posZ()); + } + for (auto track1 : tracks) { + if (!selectionTrack(track1)) { + continue; + } + bool track1kaon = false; + auto track1ID = track1.globalIndex(); + if (!strategySelectionPID(track1, 0, strategyPID)) { + continue; + } + track1kaon = true; + histos.fill(HIST("TPC_Nsigma_ka"), track1.p(), track1.tpcNSigmaKa()); + if (track1.hasTOF()) { + histos.fill(HIST("TOF_Nsigma_ka"), track1.p(), track1.tofNSigmaKa()); + } + for (auto track2 : tracks) { + if (!selectionTrack(track2)) { + continue; + } + bool track2pion = false; + auto track2ID = track2.globalIndex(); + if (!strategySelectionPID(track2, 1, strategyPID)) { + continue; + } + track2pion = true; + histos.fill(HIST("TPC_Nsigma_pi"), track2.p(), track1.tpcNSigmaPi()); + if (track2.hasTOF()) { + histos.fill(HIST("TOF_Nsigma_pi"), track2.p(), track1.tofNSigmaPi()); + } + if (track2ID == track1ID) { + continue; + } + if (!track1kaon || !track2pion) { + continue; + } + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + KstarMother = daughter1 + daughter2; + if (TMath::Abs(KstarMother.Rapidity()) > confRapidity) { + continue; + } + auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); + auto v2 = TMath::Cos(2.0 * phiminuspsi); + // unlike sign + if (track1.sign() * track2.sign() < 0) { + histos.fill(HIST("hSparseV2SASameEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + if (fillRotation) { + for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { + auto anglestart = confMinRot; + auto angleend = confMaxRot; + auto anglestep = (angleend - anglestart) / (1.0 * (nBkgRotations - 1)); + auto rotangle = anglestart + nrotbkg * anglestep; + histos.fill(HIST("hRotation"), rotangle); + auto rotkaonPx = track1.px() * std::cos(rotangle) - track1.py() * std::sin(rotangle); + auto rotkaonPy = track1.px() * std::sin(rotangle) + track1.py() * std::cos(rotangle); + kaonrot = ROOT::Math::PxPyPzMVector(rotkaonPx, rotkaonPy, track1.pz(), massKa); + kstarrot = kaonrot + daughter2; + if (TMath::Abs(kstarrot.Rapidity()) > confRapidity) { + continue; + } + auto phiminuspsiRot = GetPhiInRange(kstarrot.Phi() - psiFT0C); + auto v2Rot = TMath::Cos(2.0 * phiminuspsiRot); + histos.fill(HIST("hSparseV2SASameEventRotational_V2"), kstarrot.M(), kstarrot.Pt(), v2Rot, centrality); + } + } + } + // like sign + if (track1.sign() * track2.sign() > 0) { + if (track1.sign() > 0 && track2.sign() > 0) { + histos.fill(HIST("hSparseV2SAlikeEventPP_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + } + if (track1.sign() < 0 && track2.sign() < 0) { + histos.fill(HIST("hSparseV2SAlikeEventNN_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + } + } + } + } + } + PROCESS_SWITCH(kstarpbpb, processSE, "Process Same event latest", true); + + void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks*/, aod::BCs const&) { if (!collision.sel8()) { return; @@ -346,17 +531,18 @@ struct kstarpbpb { if (additionalEvsel && !eventSelected(collision, centrality)) { return; } - histos.fill(HIST("hFTOCvsTPCSelected"), centrality, multTPC); - histos.fill(HIST("hPsiFT0C"), centrality, psiFT0C); - histos.fill(HIST("hPsiFT0A"), centrality, psiFT0A); - histos.fill(HIST("hPsiTPC"), centrality, psiTPC); - histos.fill(HIST("ResFT0CTPC"), centrality, TMath::Cos(2.0 * (psiFT0C - psiTPC))); - histos.fill(HIST("ResFT0CFT0A"), centrality, TMath::Cos(2.0 * (psiFT0C - psiFT0A))); - histos.fill(HIST("ResFT0ATPC"), centrality, TMath::Cos(2.0 * (psiTPC - psiFT0A))); - histos.fill(HIST("hCentrality"), centrality); - histos.fill(HIST("hOccupancy"), occupancy); - histos.fill(HIST("hVtxZ"), collision.posZ()); - + if (additionalQAplots1) { + histos.fill(HIST("hFTOCvsTPCSelected"), centrality, multTPC); + histos.fill(HIST("hPsiFT0C"), centrality, psiFT0C); + histos.fill(HIST("hPsiFT0A"), centrality, psiFT0A); + histos.fill(HIST("hPsiTPC"), centrality, psiTPC); + histos.fill(HIST("ResFT0CTPC"), centrality, TMath::Cos(2.0 * (psiFT0C - psiTPC))); + histos.fill(HIST("ResFT0CFT0A"), centrality, TMath::Cos(2.0 * (psiFT0C - psiFT0A))); + histos.fill(HIST("ResFT0ATPC"), centrality, TMath::Cos(2.0 * (psiTPC - psiFT0A))); + histos.fill(HIST("hCentrality"), centrality); + histos.fill(HIST("hOccupancy"), occupancy); + histos.fill(HIST("hVtxZ"), collision.posZ()); + } for (auto track1 : posThisColl) { if (!selectionTrack(track1)) { continue; @@ -500,14 +686,13 @@ struct kstarpbpb { } } } - PROCESS_SWITCH(kstarpbpb, processSameEvent, "Process Same event", true); + PROCESS_SWITCH(kstarpbpb, processSameEvent, "Process Same event", false); void processlikeEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { if (!collision.sel8()) { return; } auto centrality = collision.centFT0C(); - auto multTPC = collision.multNTracksPV(); if (!collision.triggereventep()) { return; } @@ -621,7 +806,7 @@ struct kstarpbpb { } } - PROCESS_SWITCH(kstarpbpb, processlikeEvent, "Process like event", true); + PROCESS_SWITCH(kstarpbpb, processlikeEvent, "Process like event", false); void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& /*tracks*/) { BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass, axisEPAngle}, true}; @@ -743,7 +928,7 @@ struct kstarpbpb { } } } - PROCESS_SWITCH(kstarpbpb, processMixedEvent, "Process Mixed event", true); + PROCESS_SWITCH(kstarpbpb, processMixedEvent, "Process Mixed event", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx b/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx index 63f1c7d58d5..74234cb8bd1 100644 --- a/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Centrality.h" @@ -42,6 +43,8 @@ struct lambdaAnalysis_pb { Preslice perRCol = aod::resodaughter::resoCollisionId; Preslice perCollision = aod::track::collisionId; // Configurables. + + Configurable ConfEvtOccupancyInTimeRange{"ConfEvtOccupancyInTimeRange", -1, "Evt sel: maximum track occupancy"}; Configurable nBinsPt{"nBinsPt", 100, "N bins in pT histogram"}; Configurable nBinsInvM{"nBinsInvM", 120, "N bins in InvMass histogram"}; Configurable lambda1520id{"lambda1520id", 3124, "pdg"}; @@ -138,7 +141,7 @@ struct lambdaAnalysis_pb { histos.add("QAbefore/Kaon/h2d_ka_nsigma_tof_vs_tpc", "n#sigma^{TPC} vs n#sigma^{TOF} Kaons", kTH2F, {axisTPCNsigma, axisTOFNsigma}); // QA After - histos.add("QAafter/Proton/hd_pr_pt", "p_{T}-spectra Protons", kTH1F, {axisPt_pid}); + histos.add("QAafter/Proton/hd_pr_pt", "p_{T}-spectra Protons", kTH2F, {axisPt_pid, axisCent}); histos.add("QAafter/Proton/h2d_pr_dca_z", "dca_{z} Protons", kTH2F, {axisPt_pid, axisDCAz}); histos.add("QAafter/Proton/h2d_pr_dca_xy", "dca_{xy} Protons", kTH2F, {axisPt_pid, axisDCAxy}); histos.add("QAafter/Proton/h2d_pr_dEdx_p", "TPC Signal Protons", kTH2F, {axisP_pid, axisdEdx}); @@ -153,7 +156,7 @@ struct lambdaAnalysis_pb { histos.add("QAafter/Proton/h2d_Prka_nsigma_tof_p", " Protons kaon", kTH2F, {axisP_pid, axisTOFNsigma}); histos.add("QAafter/Proton/h2d_Prel_nsigma_tof_p", " Protons electron", kTH2F, {axisP_pid, axisTOFNsigma}); histos.add("QAafter/Proton/h2d_pr_nsigma_tof_vs_tpc", "n#sigma(TOF) vs n#sigma(TPC) Protons", kTH2F, {axisTPCNsigma, axisTOFNsigma}); - histos.add("QAafter/Kaon/hd_ka_pt", "p_{T}-spectra Kaons", kTH1F, {axisPt_pid}); + histos.add("QAafter/Kaon/hd_ka_pt", "p_{T}-spectra Kaons", kTH2F, {axisPt_pid, axisCent}); histos.add("QAafter/Kaon/h2d_ka_dca_z", "dca_{z} Kaons", kTH2F, {axisPt_pid, axisDCAz}); histos.add("QAafter/Kaon/h2d_ka_dca_xy", "dca_{xy} Kaons", kTH2F, {axisPt_pid, axisDCAxy}); histos.add("QAafter/Kaon/h2d_ka_dEdx_p", "TPC Signal Kaon", kTH2F, {axisP_pid, axisdEdx}); @@ -427,7 +430,7 @@ struct lambdaAnalysis_pb { auto _tpcnsigmaPr = trkPr.tpcNSigmaPr(); // Proton - histos.fill(HIST("QAafter/Proton/hd_pr_pt"), _ptPr); + histos.fill(HIST("QAafter/Proton/hd_pr_pt"), _ptPr, mult); histos.fill(HIST("QAafter/Proton/h2d_pr_dca_z"), _ptPr, trkPr.dcaZ()); histos.fill(HIST("QAafter/Proton/h2d_pr_dca_xy"), _ptPr, trkPr.dcaXY()); histos.fill(HIST("QAafter/Proton/h2d_pr_dEdx_p"), p_ptot, trkPr.tpcSignal()); @@ -449,7 +452,7 @@ struct lambdaAnalysis_pb { auto _tpcnsigmaKa = trkKa.tpcNSigmaKa(); // Kaon - histos.fill(HIST("QAafter/Kaon/hd_ka_pt"), _ptKa); + histos.fill(HIST("QAafter/Kaon/hd_ka_pt"), _ptKa, mult); histos.fill(HIST("QAafter/Kaon/h2d_ka_dca_z"), _ptKa, trkKa.dcaZ()); histos.fill(HIST("QAafter/Kaon/h2d_ka_dca_xy"), _ptKa, trkKa.dcaXY()); histos.fill(HIST("QAafter/Kaon/h2d_ka_dEdx_p"), k_ptot, trkKa.tpcSignal()); @@ -558,6 +561,8 @@ struct lambdaAnalysis_pb { { // LOGF(info, " collisions: Index = %d %d", collision.globalIndex(),tracks.size()); + if (ConfEvtOccupancyInTimeRange > 0 && collision.trackOccupancyInTimeRange() > ConfEvtOccupancyInTimeRange) + return; histos.fill(HIST("Event/h1d_ft0_mult_percentile"), collision.cent()); fillDataHistos(tracks, tracks, collision.cent()); } @@ -597,7 +602,6 @@ struct lambdaAnalysis_pb { } for (auto const& part : resoParents) { - if (abs(part.pdgCode()) != lambda1520id) // // L* pdg_code = 3124 continue; if (abs(part.y()) > 0.5) { // rapidity cut @@ -616,7 +620,10 @@ struct lambdaAnalysis_pb { if (!pass1 || !pass2) // If we have both decay products continue; - auto mass = 1.520; // part.M() + + TLorentzVector p4; + p4.SetPxPyPzE(part.px(), part.py(), part.pz(), part.e()); + auto mass = p4.M(); if (part.pdgCode() > 0) histos.fill(HIST("Analysis/h3d_gen_lstar_PM"), mass, part.pt(), mult); else @@ -637,7 +644,8 @@ struct lambdaAnalysis_pb { SameKindPair pairs{binningPositions2, cNumMixEv, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip for (auto& [c1, t1, c2, t2] : pairs) { - + if (ConfEvtOccupancyInTimeRange > 0 && c1.trackOccupancyInTimeRange() > ConfEvtOccupancyInTimeRange && c2.trackOccupancyInTimeRange() > ConfEvtOccupancyInTimeRange) + return; // LOGF(info, "processMCMixedDerived: Mixed collisions : %d (%.3f, %.3f,%d), %d (%.3f, %.3f,%d)",c1.globalIndex(), c1.posZ(), c1.cent(),c1.mult(), c2.globalIndex(), c2.posZ(), c2.cent(),c2.mult()); histos.fill(HIST("Event/mixing_vzVsmultpercentile"), c1.cent(), c1.posZ(), c1.evtPl()); fillDataHistos(t1, t2, c1.cent()); @@ -656,7 +664,8 @@ struct lambdaAnalysis_pb { if (doprocessData) LOG(error) << "Disable processData() first!"; - + if (ConfEvtOccupancyInTimeRange > 0 && collision.trackOccupancyInTimeRange() > ConfEvtOccupancyInTimeRange) + return; // LOGF(info, "inside df collisions: Index = %d %d", collision.globalIndex(),tracks.size()); histos.fill(HIST("Event/h1d_ft0_mult_percentile"), collision.cent()); fillDataHistos(tracks, tracks, collision.cent()); @@ -676,6 +685,8 @@ struct lambdaAnalysis_pb { SameKindPair pairs{binningPositions2, cNumMixEv, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip for (auto& [c1, t1, c2, t2] : pairs) { + if (ConfEvtOccupancyInTimeRange > 0 && c1.trackOccupancyInTimeRange() > ConfEvtOccupancyInTimeRange && c2.trackOccupancyInTimeRange() > ConfEvtOccupancyInTimeRange) + return; // LOGF(info, "processMCMixedDerived: Mixed collisions : %d (%.3f, %.3f,%d), %d (%.3f, %.3f,%d)",c1.globalIndex(), c1.posZ(), c1.cent(),c1.mult(), c2.globalIndex(), c2.posZ(), c2.cent(),c2.mult()); histos.fill(HIST("Event/mixing_vzVsmultpercentile"), c1.cent(), c1.posZ(), c1.evtPl()); @@ -691,13 +702,13 @@ struct lambdaAnalysis_pb { if (doprocessMix || doprocessMixDF) LOG(fatal) << "Disable processMix() or processMixDF() first!"; LOGF(debug, "Event Mixing Started"); - BinningTypeEP binningPositions2{{cMixVtxBins, cMixMultBins, cMixEPAngle}, true}; auto tracksTuple = std::make_tuple(tracks); SameKindPair pairs{binningPositions2, cNumMixEv, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip for (auto& [c1, t1, c2, t2] : pairs) { - + if (ConfEvtOccupancyInTimeRange > 0 && c1.trackOccupancyInTimeRange() > ConfEvtOccupancyInTimeRange && c2.trackOccupancyInTimeRange() > ConfEvtOccupancyInTimeRange) + return; // LOGF(info, "processMCMixedDerived: Mixed collisions : %d (%.3f, %.3f,%.3f), %d (%.3f, %.3f, %.3f)",c1.globalIndex(), c1.posZ(), c1.cent(),c1.evtPl(), c2.globalIndex(), c2.posZ(), c2.cent(),c2.evtPl()); histos.fill(HIST("Event/mixing_vzVsmultpercentile"), c1.cent(), c1.posZ(), c1.evtPl()); fillDataHistos(t1, t2, c1.cent()); diff --git a/PWGLF/Tasks/Resonances/lambda1520analysis.cxx b/PWGLF/Tasks/Resonances/lambda1520analysis.cxx index 5884c7b067a..97cec72b2c2 100644 --- a/PWGLF/Tasks/Resonances/lambda1520analysis.cxx +++ b/PWGLF/Tasks/Resonances/lambda1520analysis.cxx @@ -15,6 +15,7 @@ #include "TLorentzVector.h" #include "TF1.h" +#include "TRandom3.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "PWGLF/DataModel/LFResonanceTables.h" @@ -39,14 +40,12 @@ struct lambda1520analysis { // switches Configurable cEtaAssym{"cEtaAssym", false, "Turn on/off EtaAssym calculation"}; Configurable isFilladditionalQA{"isFilladditionalQA", false, "Turn on/off additional QA plots"}; - Configurable cAddlTrackcut{"cAddlTrackcut", false, "Switch to turn on/off Additional track cut"}; Configurable cOldPIDcut{"cOldPIDcut", false, "Switch to turn on/off old PID cut to apply pt dependent cut"}; Configurable FixedPIDcut{"FixedPIDcut", false, "Switch to turn on/off FIXED PID cut to apply pt dependent cut"}; Configurable cRejectPion{"cRejectPion", false, "Switch to turn on/off pion contamination"}; Configurable cDCAr7SigCut{"cDCAr7SigCut", false, "Track DCAr 7 Sigma cut to PV Maximum"}; Configurable cKinCuts{"cKinCuts", false, "Kinematic Cuts for p-K pair opening angle"}; Configurable cTPCNClsFound{"cTPCNClsFound", false, "Switch to turn on/off TPCNClsFound cut"}; - Configurable additionalEvsel{"additionalEvsel", true, "Additional event selcection"}; Configurable additionalQAeventPlots{"additionalQAeventPlots", false, "Additional QA event plots"}; Configurable additionalMEPlots{"additionalMEPlots", false, "Additional Mixed event plots"}; @@ -73,6 +72,8 @@ struct lambda1520analysis { Configurable cfgHasITS{"cfgHasITS", false, "Require ITS"}; Configurable cfgHasTPC{"cfgHasTPC", false, "Require TPC"}; Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; + Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; + Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; /// PID Selections Configurable cRejNsigmaTpc{"cRejNsigmaTpc", 3.0, "Reject tracks to improve purity of TPC PID"}; // Reject missidentified particles when tpc bands merge @@ -121,6 +122,11 @@ struct lambda1520analysis { Configurable cfgCutsOnMother{"cfgCutsOnMother", false, "Enamble additional cuts on mother"}; Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 10.0, "Maximum pt of mother cut"}; Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 3.0, "Maximum Minv of mother cut"}; + Configurable cfgCutsOnDaughters{"cfgCutsOnDaughters", false, "Enamble additional cuts on daughters"}; + Configurable cetaphiBins{"cetaphiBins", 400, "number of eta and phi bins"}; + Configurable cMaxDeltaEtaCut{"cMaxDeltaEtaCut", 0.7, "Maximum deltaEta between daughters"}; + Configurable cMaxDeltaPhiCut{"cMaxDeltaPhiCut", 1.5, "Maximum deltaPhi between daughters"}; + TRandom* rn = new TRandom(); /// Figures ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; @@ -132,13 +138,14 @@ struct lambda1520analysis { ConfigurableAxis binsTPCXrows{"binsTPCXrows", {200, 0, 200}, ""}; ConfigurableAxis binsnSigma{"binsnSigma", {130, -6.5, 6.5}, ""}; ConfigurableAxis binsnTPCSignal{"binsnTPCSignal", {1000, 0, 1000}, ""}; + ConfigurableAxis occupancy_bins{"occupancy_bins", {VARIABLE_WIDTH, 0.0, 100, 500, 600, 1000, 1100, 1500, 1600, 2000, 2100, 2500, 2600, 3000, 3100, 3500, 3600, 4000, 4100, 4500, 4600, 5000, 5100, 9999}, "Binning of the occupancy axis"}; + Configurable applyOccupancyCut{"applyOccupancyCut", false, "Apply occupancy cut"}; + Configurable OccupancyCut{"OccupancyCut", 1000, "Mimimum Occupancy cut"}; - // Event selection cuts - (Temporary, need to fix!) - TF1* fMultPVCutLow = nullptr; - TF1* fMultPVCutHigh = nullptr; - TF1* fMultCutLow = nullptr; - TF1* fMultCutHigh = nullptr; - TF1* fMultMultPVCut = nullptr; + // Rotational background + Configurable IsCalcRotBkg{"IsCalcRotBkg", true, "Calculate rotational background"}; + Configurable rotational_cut{"rotational_cut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; + Configurable c_nof_rotations{"c_nof_rotations", 3, "Number of random rotations in the rotational background"}; void init(o2::framework::InitContext&) { @@ -153,6 +160,7 @@ struct lambda1520analysis { AxisSpec pidQAAxis = {binsnSigma, "#sigma"}; AxisSpec axisTPCSignal = {binsnTPCSignal, ""}; AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; + AxisSpec occupancy_axis = {occupancy_bins, "Occupancy [-40,100]"}; if (additionalQAeventPlots) { // Test on Mixed event @@ -198,16 +206,10 @@ struct lambda1520analysis { histos.add("TPCncluster/TPCnclusterPhika", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); // Multiplicity correlation calibrations - histos.add("MultCalib/centglopr_before", "Centrality vs Global-Tracks", kTH2F, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}}); - histos.add("MultCalib/centgloka_before", "Centrality vs Global-Tracks", kTH2F, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}}); - histos.add("MultCalib/GloPVpr_before", "Global tracks vs PV tracks", kTH2F, {{500, 0, 5000, "Global tracks"}, {500, 0, 5000, "PV tracks"}}); - histos.add("MultCalib/GloPVka_before", "Global tracks vs PV tracks", kTH2F, {{500, 0, 5000, "Global tracks"}, {500, 0, 5000, "PV tracks"}}); - - // Multiplicity correlation calibrations - histos.add("MultCalib/centglopr_after", "Centrality vs Global-Tracks", kTH2F, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}}); - histos.add("MultCalib/centgloka_after", "Centrality vs Global-Tracks", kTH2F, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}}); - histos.add("MultCalib/GloPVpr_after", "Global tracks vs PV tracks", kTH2F, {{500, 0, 5000, "Global tracks"}, {500, 0, 5000, "PV tracks"}}); - histos.add("MultCalib/GloPVka_after", "Global tracks vs PV tracks", kTH2F, {{500, 0, 5000, "Global tracks"}, {500, 0, 5000, "PV tracks"}}); + histos.add("MultCalib/centglopr", "Centrality vs Global-Tracks", kTH2F, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}}); + histos.add("MultCalib/centgloka", "Centrality vs Global-Tracks", kTH2F, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}}); + histos.add("MultCalib/GloPVpr", "Global tracks vs PV tracks", kTH2F, {{500, 0, 5000, "Global tracks"}, {500, 0, 5000, "PV tracks"}}); + histos.add("MultCalib/GloPVka", "Global tracks vs PV tracks", kTH2F, {{500, 0, 5000, "Global tracks"}, {500, 0, 5000, "PV tracks"}}); } // PID QA after cuts @@ -241,6 +243,26 @@ struct lambda1520analysis { histos.add("Result/Data/lambda1520invmassLSPP", "Invariant mass of #Lambda(1520) Like Sign Method K^{#plus}p^{#plus}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); // K+ + Pr histos.add("Result/Data/lambda1520invmassLSMM", "Invariant mass of #Lambda(1520) Like Sign Method K^{#minus}p^{#minus}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); // K- + anti-Pr + // eta phi QA + if (cfgCutsOnDaughters) { + histos.add("QAbefore/deltaEta", "deltaEta of kaon and proton candidates", HistType::kTH1F, {{cetaphiBins, 0.0, 3.15}}); + histos.add("QAbefore/deltaPhi", "deltaPhi of kaon and proton candidates", HistType::kTH1F, {{cetaphiBins, 0.0, 3.15}}); + + histos.add("QAafter/deltaEta", "deltaEta of kaon and proton candidates", HistType::kTH1F, {{cetaphiBins, 0.0, 3.15}}); + histos.add("QAafter/deltaPhi", "deltaPhi of kaon and proton candidates", HistType::kTH1F, {{cetaphiBins, 0.0, 3.15}}); + + histos.add("QAafter/deltaEtaafter", "deltaEta of kaon and proton candidates", HistType::kTH1F, {{cetaphiBins, 0.0, 3.15}}); + histos.add("QAafter/deltaPhiafter", "deltaPhi of kaon and proton candidates", HistType::kTH1F, {{cetaphiBins, 0.0, 3.15}}); + histos.add("QAafter/EtaPrafter", "Eta of proton candidates", HistType::kTH1F, {{cetaphiBins, -1.6, 1.6}}); + histos.add("QAafter/PhiPrafter", "Phi of proton candidates", HistType::kTH1F, {{cetaphiBins, 0.0, 6.30}}); + histos.add("QAafter/EtaKaafter", "Eta of kaon candidates", HistType::kTH1F, {{cetaphiBins, -1.6, 1.6}}); + histos.add("QAafter/PhiKaafter", "Phi of kaon candidates", HistType::kTH1F, {{cetaphiBins, 0.0, 6.30}}); + } + + if (IsCalcRotBkg) { + histos.add("Result/Data/h3lambda1520InvMassRotation", "Invariant mass of #Lambda(1520) rotation", kTHnSparseF, {axisMult, axisPt, axisMassLambda1520, occupancy_axis}); + } + // 3d histogram histos.add("Result/Data/h3lambda1520invmass", "Invariant mass of #Lambda(1520) K^{#pm}p^{#mp}", HistType::kTH3F, {axisMult, axisPt, axisMassLambda1520}); histos.add("Result/Data/h3antilambda1520invmass", "Invariant mass of #Lambda(1520) K^{#mp}p^{#pm}", HistType::kTH3F, {axisMult, axisPt, axisMassLambda1520}); @@ -301,45 +323,11 @@ struct lambda1520analysis { histos.add("Result/MC/hantilambda1520Recoinvmass", "Inv mass distribution of Reconstructed MC Anti-#Lambda(1520)", kTH1F, {axisMassLambda1520}); } - if (additionalEvsel) { - fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); - fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); - fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x)", 0, 100); - fMultCutLow->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); - fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x)", 0, 100); - fMultCutHigh->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); - fMultMultPVCut = new TF1("fMultMultPVCut", "[0]+[1]*x+[2]*x*x", 0, 5000); - fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); - } // Print output histograms statistics LOG(info) << "Size of the histograms in spectraTOF"; histos.print(); } - template - bool eventSelected(TCollision collision, const float& centrality) - { - // if (collision.alias_bit(kTVXinTRD)) { - // // TRD triggered - // // return 0; - // } - auto multNTracksPV = collision.multNTracksPV(); - if (multNTracksPV < fMultPVCutLow->Eval(centrality)) - return 0; - if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) - return 0; - // if (multTrk < fMultCutLow->Eval(centrality)) - // return 0; - // if (multTrk > fMultCutHigh->Eval(centrality)) - // return 0; - // if (multTrk > fMultMultPVCut->Eval(multNTracksPV)) - // return 0; - - return 1; - } - double massKa = MassKaonCharged; double massPr = MassProton; @@ -358,22 +346,22 @@ struct lambda1520analysis { } if (std::abs(track.dcaZ()) > cMaxDCAzToPVcut) return false; - if (track.tpcNClsCrossedRows() < cMinTPCncr) + if (track.itsNCls() < cfgITScluster) return false; - if (cAddlTrackcut) { - if (!track.passedITSRefit() || !track.passedTPCRefit()) - return false; - if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) - return false; - if (track.itsChi2NCl() > cMaxChi2ITScut) - return false; - if (track.tpcChi2NCl() > cMaxChi2TPCcut) - return false; - if (track.itsNCls() < cfgITScluster) - return false; - } if (cTPCNClsFound && (track.tpcNClsFound() < cMinTPCNClsFound)) return false; + if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) + return false; + if (track.itsChi2NCl() > cMaxChi2ITScut) + return false; + if (track.tpcChi2NCl() > cMaxChi2TPCcut) + return false; + if (cfgHasITS && !track.hasITS()) + return false; + if (cfgHasTPC && !track.hasTPC()) + return false; + if (cfgHasTOF && !track.hasTOF()) + return false; if (cfgPrimaryTrack && !track.isPrimaryTrack()) return false; if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) @@ -382,11 +370,11 @@ struct lambda1520analysis { return false; if (cfgGlobalTrack && !track.isGlobalTrack()) return false; - if (cfgHasITS && !track.hasITS()) + if (cfgUseITSRefit && !track.passedITSRefit()) return false; - if (cfgHasTPC && !track.hasTPC()) + if (cfgUseTPCRefit && !track.passedTPCRefit()) return false; - if (cfgHasTOF && !track.hasTOF()) + if (track.tpcNClsCrossedRows() < cMinTPCncr) return false; return true; @@ -679,25 +667,20 @@ struct lambda1520analysis { { auto multiplicity = collision.cent(); - // Multiplicity correlation calibration plots - if (isFilladditionalQA) { - if constexpr (IsData) { - histos.fill(HIST("MultCalib/centglopr_before"), multiplicity, dTracks1.size()); - histos.fill(HIST("MultCalib/centgloka_before"), multiplicity, dTracks2.size()); - histos.fill(HIST("MultCalib/GloPVpr_before"), dTracks1.size(), collision.multNTracksPV()); - histos.fill(HIST("MultCalib/GloPVka_before"), dTracks2.size(), collision.multNTracksPV()); - } - } + // LOG(info) << "Before pass, Collision index:" << collision.index() << "multiplicity: " << collision.cent() << std::endl; - if (additionalEvsel && !eventSelected(collision, multiplicity)) { + auto occupancy_no = collision.trackOccupancyInTimeRange(); + if (applyOccupancyCut && occupancy_no < OccupancyCut) { return; } + + // Multiplicity correlation calibration plots if (isFilladditionalQA) { if constexpr (IsData) { - histos.fill(HIST("MultCalib/centglopr_after"), multiplicity, dTracks1.size()); - histos.fill(HIST("MultCalib/centgloka_after"), multiplicity, dTracks2.size()); - histos.fill(HIST("MultCalib/GloPVpr_after"), dTracks1.size(), collision.multNTracksPV()); - histos.fill(HIST("MultCalib/GloPVka_after"), dTracks2.size(), collision.multNTracksPV()); + histos.fill(HIST("MultCalib/centglopr"), multiplicity, dTracks1.size()); + histos.fill(HIST("MultCalib/centgloka"), multiplicity, dTracks2.size()); + histos.fill(HIST("MultCalib/GloPVpr"), dTracks1.size(), collision.multNTracksPV()); + histos.fill(HIST("MultCalib/GloPVka"), dTracks2.size(), collision.multNTracksPV()); } } @@ -714,8 +697,8 @@ struct lambda1520analysis { histos.fill(HIST("TestME/hnTrksMixedE"), dTracks1.size()); } } - - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + // LOG(info) << "After pass, Collision index:" << collision.index() << "multiplicity: " << collision.cent() << std::endl; + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance, ldaughter_rot, lresonance_rot; for (auto& [trk1, trk2] : combinations(CombinationsFullIndexPolicy(dTracks1, dTracks2))) { // Full index policy is needed to consider all possible combinations @@ -746,6 +729,10 @@ struct lambda1520analysis { auto trk2NSigmaKaTPC = trk2.tpcNSigmaKa(); auto trk2NSigmaKaTOF = (isTrk2hasTOF) ? trk2.tofNSigmaKa() : -999.; + auto deltaEta = TMath::Abs(trk1.eta() - trk2.eta()); + auto deltaPhi = TMath::Abs(trk1.phi() - trk2.phi()); + deltaPhi = (deltaPhi > TMath::Pi()) ? (2 * TMath::Pi() - deltaPhi) : deltaPhi; + //// QA plots before the selection // --- Track QA all if constexpr (IsData) { @@ -771,6 +758,10 @@ struct lambda1520analysis { histos.fill(HIST("QA/QAbefore/Track/TPC_CR"), trk1ptPr, trk1.tpcNClsCrossedRows()); histos.fill(HIST("QA/QAbefore/Track/pT"), trk1ptPr); histos.fill(HIST("QA/QAbefore/Track/eta"), trk1.eta()); + if (cfgCutsOnDaughters) { + histos.fill(HIST("QAbefore/deltaEta"), deltaEta); + histos.fill(HIST("QAbefore/deltaPhi"), deltaPhi); + } } //// Apply the pid selection @@ -823,7 +814,10 @@ struct lambda1520analysis { histos.fill(HIST("QA/QAafter/Kaon/TPC_CR"), trk2ptKa, trk2.tpcNClsCrossedRows()); histos.fill(HIST("QA/QAafter/Kaon/pT"), trk2ptKa); histos.fill(HIST("QA/QAafter/Kaon/eta"), trk2.eta()); - + if (cfgCutsOnDaughters) { + histos.fill(HIST("QAafter/deltaEta"), deltaEta); + histos.fill(HIST("QAafter/deltaPhi"), deltaPhi); + } if (isFilladditionalQA) { // TPCncluster distributions histos.fill(HIST("TPCncluster/TPCnclusterpr"), trk1.tpcNClsFound()); @@ -843,8 +837,8 @@ struct lambda1520analysis { } //// Resonance reconstruction - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPr); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + lDecayDaughter1.SetPtEtaPhiM(trk1.pt(), trk1.eta(), trk1.phi(), massPr); + lDecayDaughter2.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi(), massKa); lResonance = lDecayDaughter1 + lDecayDaughter2; // Rapidity cut if (abs(lResonance.Rapidity()) > 0.5) @@ -857,13 +851,38 @@ struct lambda1520analysis { continue; } + if (cfgCutsOnDaughters) { + if (deltaEta >= cMaxDeltaEtaCut) + continue; + if (deltaPhi >= cMaxDeltaPhiCut) + continue; + + if constexpr (!IsMix) { + histos.fill(HIST("QAafter/EtaPrafter"), trk1.eta()); + histos.fill(HIST("QAafter/PhiPrafter"), trk1.phi()); + histos.fill(HIST("QAafter/EtaKaafter"), trk2.eta()); + histos.fill(HIST("QAafter/PhiKaafter"), trk2.phi()); + histos.fill(HIST("QAafter/deltaEtaafter"), deltaEta); + histos.fill(HIST("QAafter/deltaPhiafter"), deltaPhi); + } + } + //// Un-like sign pair only if (trk1.sign() * trk2.sign() < 0) { if constexpr (IsData) { + if (IsCalcRotBkg) { + for (int i = 0; i < c_nof_rotations; i++) { + float theta2 = rn->Uniform(TMath::Pi() - TMath::Pi() / rotational_cut, TMath::Pi() + TMath::Pi() / rotational_cut); + ldaughter_rot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta2, massKa); // for rotated background + lresonance_rot = lDecayDaughter1 + ldaughter_rot; + histos.fill(HIST("Result/Data/h3lambda1520InvMassRotation"), multiplicity, lresonance_rot.Pt(), lresonance_rot.M(), occupancy_no); + } + } + if (trk1.sign() < 0) { histos.fill(HIST("Result/Data/lambda1520invmass"), lResonance.M()); histos.fill(HIST("Result/Data/h3lambda1520invmass"), multiplicity, lResonance.Pt(), lResonance.M()); - } else { + } else if (trk1.sign() > 0) { histos.fill(HIST("Result/Data/antilambda1520invmass"), lResonance.M()); histos.fill(HIST("Result/Data/h3antilambda1520invmass"), multiplicity, lResonance.Pt(), lResonance.M()); } @@ -981,16 +1000,12 @@ struct lambda1520analysis { continue; if (abs(part.y()) > 0.5) // rapidity cut continue; - bool pass1 = false; - bool pass2 = false; - if (abs(part.daughterPDG1()) == 321 || abs(part.daughterPDG2()) == 321) { // At least one decay to Kaon - pass2 = true; - } - if (abs(part.daughterPDG1()) == 2212 || abs(part.daughterPDG2()) == 2212) { // At least one decay to Proton - pass1 = true; - } + bool pass1 = abs(part.daughterPDG1()) == 321 || abs(part.daughterPDG2()) == 321; // At least one decay to Kaon + bool pass2 = abs(part.daughterPDG1()) == 2212 || abs(part.daughterPDG2()) == 2212; // At least one decay to Proton + if (!pass1 || !pass2) // If we have both decay products continue; + if (collision.isVtxIn10()) // INEL10 { if (part.pdgCode() > 0) diff --git a/PWGLF/Tasks/Resonances/lambdav2.cxx b/PWGLF/Tasks/Resonances/lambdav2.cxx index 4fbb16beddc..ae8c1b6446c 100644 --- a/PWGLF/Tasks/Resonances/lambdav2.cxx +++ b/PWGLF/Tasks/Resonances/lambdav2.cxx @@ -8,47 +8,53 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// -/// \brief this is a code for flow of lambda baryons for exotic pheno -/// \author prottay das -/// \since 25/04/2024 +// Particle flow task +// prottay.das@cern.ch -#include -#include -#include #include -#include +#include #include #include #include #include +#include +#include +#include #include -#include "TF1.h" - -#include +#include #include +#include #include -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" +#include "TRandom3.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "Math/GenVector/Boost.h" +#include "TF1.h" + +// #include "Common/DataModel/Qvectors.h" +#include "PWGLF/DataModel/SPCalibrationTables.h" +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/Core/trackUtilities.h" #include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/TrackSelection.h" #include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" -#include "Framework/runDataProcessing.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" #include "ReconstructionDataFormats/Track.h" - -#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "CCDB/BasicCCDBManager.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Common/DataModel/FT0Corrected.h" using namespace o2; using namespace o2::framework; @@ -57,302 +63,148 @@ using std::array; struct lambdav2 { - // Connect to ccdb - Service ccdb; - Configurable nolaterthan{ - "ccdb-no-later-than", - std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count(), - "latest acceptable timestamp of creation for the object"}; - Configurable url{"ccdb-url", "http://ccdb-test.cern.ch:8080", - "url of the ccdb repository"}; - - SliceCache cache; - - // Histograms are defined with HistogramRegistry - HistogramRegistry rEventSelection{"eventSelection", - {}, - OutputObjHandlingPolicy::AnalysisObject, - true, - true}; - HistogramRegistry histos{ - "histos", - {}, - OutputObjHandlingPolicy::AnalysisObject, - true, - true}; - - // Configurable for histograms - Configurable nBins{"nBins", 100, "N bins in all histos"}; - // Confugrable for QA histograms - Configurable QA{"QA", true, "QA"}; - Configurable QAv0{"QAv0", false, "QAv0"}; - // Configurable for event selection - Configurable cutzvertex{"cutzvertex", 10.0f, - "Accepted z-vertex range (cm)"}; - // Configurable parameters for V0 selection - Configurable ConfV0PtMin{"ConfV0PtMin", 0.f, - "Minimum transverse momentum of V0"}; - Configurable ConfV0DCADaughMax{"ConfV0DCADaughMax", 1.0f, - "Maximum DCA between the V0 daughters"}; - Configurable ConfV0CPAMin{"ConfV0CPAMin", 0.985f, "Minimum CPA of V0"}; - Configurable ConfV0TranRadV0Min{"ConfV0TranRadV0Min", 0.5f, - "Minimum transverse radius"}; - Configurable ConfV0TranRadV0Max{"ConfV0TranRadV0Max", 200.f, - "Maximum transverse radius"}; - Configurable cMaxV0LifeTime{"cMaxV0LifeTime", 4, - "Maximum V0 life time"}; - Configurable cMaxV0DCA{"cMaxV0DCA", 0.3, "DCA V0 to PV"}; - Configurable cSigmaMassLambda{"cSigmaMassLambda", 4, - "n Sigma cut on Lambda mass"}; - Configurable cWidthLambda{"cWidthLambda", 0.005, "Width of Lambda"}; - Configurable ConfDaughEta{"ConfDaughEta", 0.8f, - "V0 Daugh sel: max eta"}; - Configurable ConfDaughTPCnclsMin{"ConfDaughTPCnclsMin", 70.f, - "V0 Daugh sel: Min. nCls TPC"}; - Configurable ConfDaughDCAMin{ - "ConfDaughDCAMin", 0.06f, "V0 Daugh sel: Max. DCA Daugh to PV (cm)"}; - Configurable ConfDaughPIDCuts{"ConfDaughPIDCuts", 4, - "PID selections for KS0 daughters"}; - - // Configurables for track selections - Configurable cfgCutPT{"cfgCutPT", 0.2f, "PT cut on daughter track"}; - Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta cut on daughter track"}; - Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, - "DCAxy range for tracks"}; - Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; - Configurable nsigmaCutTPC{"nsigmacutTPC", 3.0, - "Value of the TPC Nsigma cut"}; - Configurable nsigmaCutTOF{"nsigmacutTOF", 3.0, - "Value of the TOF Nsigma cut"}; - Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, - "Value of the Combined Nsigma cut"}; - Configurable iscustomDCAcut{"iscustomDCAcut", false, "iscustomDCAcut"}; - Configurable ismanualDCAcut{"ismanualDCAcut", true, "ismanualDCAcut"}; - Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; + int mRunNumber; + int multEstimator; + float d_bz; + Service ccdb; + Service pdg; + + // fill output + Configurable additionalEvSel{"additionalEvSel", false, "additionalEvSel"}; + Configurable additionalEvSel2{"additionalEvSel2", false, "additionalEvSel2"}; + Configurable additionalEvSel3{"additionalEvSel3", false, "additionalEvSel3"}; + Configurable correction1{"correction1", false, "fill histograms including corrections 1"}; + Configurable correction2{"correction2", false, "fill histograms including corrections 2"}; + Configurable QA{"QA", false, "flag for QA"}; + Configurable mycut{"mycut", false, "select tracks based on my cuts"}; + Configurable tofhit{"tofhit", true, "select tracks based on tof hit"}; + Configurable globalpt{"globalpt", true, "select tracks based on pt global vs tpc"}; + Configurable useprofile{"useprofile", 3, "flag to select profile vs Sparse"}; + Configurable QxyNbins{"QxyNbins", 100, "Number of bins in QxQy histograms"}; + Configurable lbinQxy{"lbinQxy", -5.0, "lower bin value in QxQy histograms"}; + Configurable hbinQxy{"hbinQxy", 5.0, "higher bin value in QxQy histograms"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 1000, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + + // events + Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCutCentralityMax{"cfgCutCentralityMax", 50.0f, "Accepted maximum Centrality"}; + Configurable cfgCutCentralityMin{"cfgCutCentralityMin", 30.0f, "Accepted minimum Centrality"}; + // proton track cut + Configurable confRapidity{"confRapidity", 0.8, "cut on Rapidity"}; + Configurable cfgCutPT{"cfgCutPT", 0.15, "PT cut on daughter track"}; + Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; + Configurable cfgCutDCAxy{"cfgCutDCAxy", 0.1f, "DCAxy range for tracks"}; + Configurable cfgCutDCAz{"cfgCutDCAz", 0.1f, "DCAz range for tracks"}; + Configurable cfgITScluster{"cfgITScluster", 5, "Number of ITS cluster"}; Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; - Configurable isNoTOF{"isNoTOF", false, "isNoTOF"}; - Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; - Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; - - // Event selection cuts - Alex - TF1* fMultPVCutLow = nullptr; - TF1* fMultPVCutHigh = nullptr; - TF1* fMultCutLow = nullptr; - TF1* fMultCutHigh = nullptr; - TF1* fMultMultPVCut = nullptr; - - void init(InitContext const&) - { - // Axes - AxisSpec vertexZAxis = {nBins, -10., 10., "vrtx_{Z} [cm]"}; - AxisSpec ptAxis = {200, 0.0f, 20.0f, "#it{p}_{T} (GeV/#it{c})"}; - - // Event selection - rEventSelection.add("hVertexZRec", "hVertexZRec", - {HistType::kTH1F, {vertexZAxis}}); - rEventSelection.add("hmult", "Centrality distribution", kTH1F, - {{100, 0.0f, 100.0f}}); - - // from sourav da - AxisSpec phiAxis = {500, -6.28, 6.28, "phi"}; - AxisSpec resAxis = {400, -2, 2, "Res"}; - AxisSpec centAxis = {100, 0, 100, "V0M (%)"}; - - if (QA) { - histos.add("hFTOCvsTPCNoCut", "Mult correlation FT0C vs. TPC without any cut", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}}); - histos.add("hFTOCvsTPCSelected", "Mult correlation FT0C vs. TPC after selection", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}}); - histos.add("hPsiFT0C", "PsiFT0C", kTH2F, {centAxis, phiAxis}); - histos.add("hPsiFT0A", "PsiFT0A", kTH2F, {centAxis, phiAxis}); - histos.add("hPsiTPC", "PsiTPC", kTH2F, {centAxis, phiAxis}); - histos.add("hPsiTPCR", "PsiTPCR", kTH2F, {centAxis, phiAxis}); - histos.add("hPsiTPCL", "PsiTPCL", kTH2F, {centAxis, phiAxis}); - // histogram for resolution - histos.add("ResFT0CTPC", "ResFT0CTPC", kTH2F, {centAxis, resAxis}); - histos.add("ResFT0CTPCR", "ResFT0CTPCR", kTH2F, {centAxis, resAxis}); - histos.add("ResFT0CTPCL", "ResFT0CTPCL", kTH2F, {centAxis, resAxis}); - histos.add("ResTPCRTPCL", "ResTPCRTPCL", kTH2F, {centAxis, resAxis}); - histos.add("ResFT0CFT0A", "ResFT0CFT0A", kTH2F, {centAxis, resAxis}); - histos.add("ResFT0ATPC", "ResFT0ATPC", kTH2F, {centAxis, resAxis}); - } - - if (QAv0) { - // Lambda topological cuts - histos.add("hDCAV0Daughters", "hDCAV0Daughters", - {HistType::kTH1F, {{50, 0.0f, 5.0f}}}); - histos.add("hLT", "hLT", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); - histos.add("hV0CosPA", "hV0CosPA", - {HistType::kTH1F, {{100, 0.95f, 1.f}}}); - } - - // CKStar histograms - histos.add("hLamInvMass", - "Invariant mass of Lambda baryon", kTHnSparseF, - {{100, 0.0, 100.0}, {200, 0.0f, 20.0f}, {200, 1.0, 1.2}, {100, -1, 1}}, true); - - // Event selection cut additional - Alex - if (additionalEvsel) { - fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); - fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); - fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x)", 0, 100); - fMultCutLow->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); - fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x)", 0, 100); - fMultCutHigh->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); - fMultMultPVCut = new TF1("fMultMultPVCut", "[0]+[1]*x+[2]*x*x", 0, 5000); - fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); - } - } + Configurable isPVContributor{"isPVContributor", true, "is PV contributor"}; + Configurable checkwithpub{"checkwithpub", true, "checking results with published"}; + Configurable nsigmaCutTPCPi{"nsigmaCutTPCPi", 3, "PID selections for Pions"}; + Configurable nsigmaCutTPCKa{"nsigmaCutTPCKa", 3, "PID selections for Kaons"}; + Configurable nsigmaCutTPCPr{"nsigmaCutTPCPr", 3, "PID selections for Protons"}; + Configurable nsigmaCutTOFPi{"nsigmaCutTOFPi", 3, "PID selections for TOF Pions"}; + Configurable nsigmaCutTOFKa{"nsigmaCutTOFKa", 3, "PID selections for TOF Kaons"}; + Configurable nsigmaCutTOFPr{"nsigmaCutTOFPr", 3, "PID selections for TOF Protons"}; + Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0, "Beta selections for Particles"}; + + Configurable CentNbins{"CentNbins", 16, "Number of bins in cent histograms"}; + Configurable lbinCent{"lbinCent", 0.0, "lower bin value in cent histograms"}; + Configurable hbinCent{"hbinCent", 80.0, "higher bin value in cent histograms"}; + Configurable SANbins{"SANbins", 20, "Number of bins in costhetastar"}; + Configurable lbinSA{"lbinSA", -1.0, "lower bin value in costhetastar histograms"}; + Configurable hbinSA{"hbinSA", 1.0, "higher bin value in costhetastar histograms"}; + Configurable PolNbins{"PolNbins", 20, "Number of bins in polarisation"}; + Configurable lbinPol{"lbinPol", -1.0, "lower bin value in #phi-#psi histograms"}; + Configurable hbinPol{"hbinPol", 1.0, "higher bin value in #phi-#psi histograms"}; + Configurable IMNbins{"IMNbins", 100, "Number of bins in invariant mass"}; + Configurable lbinIM{"lbinIM", 1.0, "lower bin value in IM histograms"}; + Configurable hbinIM{"hbinIM", 1.2, "higher bin value in IM histograms"}; + Configurable ptNbins{"ptNbins", 50, "Number of bins in pt"}; + Configurable lbinpt{"lbinpt", 0.0, "lower bin value in pt histograms"}; + Configurable hbinpt{"hbinpt", 10.0, "higher bin value in pt histograms"}; + Configurable resNbins{"resNbins", 50, "Number of bins in reso"}; + Configurable lbinres{"lbinres", 0.0, "lower bin value in reso histograms"}; + Configurable hbinres{"hbinres", 10.0, "higher bin value in reso histograms"}; + Configurable etaNbins{"etaNbins", 20, "Number of bins in eta"}; + Configurable lbineta{"lbineta", -1.0, "lower bin value in eta histograms"}; + Configurable hbineta{"hbineta", 1.0, "higher bin value in eta histograms"}; + Configurable spNbins{"spNbins", 2000, "Number of bins in sp"}; + Configurable lbinsp{"lbinsp", -1.0, "lower bin value in sp histograms"}; + Configurable hbinsp{"hbinsp", 1.0, "higher bin value in sp histograms"}; + Configurable phiNbins{"phiNbins", 30, "Number of bins in phi"}; + + ConfigurableAxis configcentAxis{"configcentAxis", {VARIABLE_WIDTH, 0.0, 10.0, 40.0, 80.0}, "Cent V0M"}; + ConfigurableAxis configthnAxispT{"configthnAxisPt", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis configetaAxis{"configetaAxis", {VARIABLE_WIDTH, -0.8, -0.4, -0.2, 0, 0.2, 0.4, 0.8}, "Eta"}; + ConfigurableAxis configthnAxisPol{"configthnAxisPol", {VARIABLE_WIDTH, -1.0, -0.6, -0.2, 0, 0.2, 0.4, 0.8}, "Pol"}; + ConfigurableAxis configphiAxis{"configphiAxis", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.8, 1.0, 2.0, 2.5, 3.0, 4.0, 5.0, 5.5, 6.28}, "PhiAxis"}; - double massLambda = TDatabasePDG::Instance() - ->GetParticle(kLambda0) - ->Mass(); // FIXME: Get from the common header + SliceCache cache; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - template - bool eventSelected(TCollision collision, const float& centrality) + void init(o2::framework::InitContext&) { - if (collision.alias_bit(kTVXinTRD)) { - // TRD triggered - // return 0; - } - auto multNTracksPV = collision.multNTracksPV(); - if (multNTracksPV < fMultPVCutLow->Eval(centrality)) - return 0; - if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) - return 0; - // if (multTrk < fMultCutLow->Eval(centrality)) - // return 0; - // if (multTrk > fMultCutHigh->Eval(centrality)) - // return 0; - // if (multTrk > fMultMultPVCut->Eval(multNTracksPV)) - // return 0; - - return 1; + AxisSpec thnAxispT{ptNbins, lbinpt, hbinpt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec thnAxisRap{100, -0.5, 0.5, "Rapidity"}; + AxisSpec thnAxisres{resNbins, lbinres, hbinres, "Reso"}; + AxisSpec thnAxisInvMass{IMNbins, lbinIM, hbinIM, "#it{M} (GeV/#it{c}^{2})"}; + AxisSpec thnAxisPol{PolNbins, lbinPol, hbinPol, "Sin(#phi - #psi)"}; + AxisSpec thnAxisCosThetaStar{SANbins, lbinSA, hbinSA, "SA"}; + AxisSpec centAxis = {CentNbins, lbinCent, hbinCent, "V0M (%)"}; + AxisSpec etaAxis = {etaNbins, lbineta, hbineta, "Eta"}; + AxisSpec spAxis = {spNbins, lbinsp, hbinsp, "Sp"}; + AxisSpec qxZDCAxis = {QxyNbins, lbinQxy, hbinQxy, "Qx"}; + AxisSpec phiAxis = {phiNbins, 0.0, 6.28, "phi-phiStar"}; + /* + histos.add("hpuxQxpvscentpteta", "hpuxQxpvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyQypvscentpteta", "hpuyQypvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxQxtvscentpteta", "hpuxQxtvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyQytvscentpteta", "hpuyQytvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxyQxytvscentpteta", "hpuxyQxytvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxyQxypvscentpteta", "hpuxyQxypvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true);*/ + histos.add("hpoddv1vscentpteta", "hpoddv1vscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpevenv1vscentpteta", "hpevenv1vscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpoddv1vscentptetakaon", "hpoddv1vscentptetakaon", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpevenv1vscentptetakaon", "hpevenv1vscentptetakaon", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpoddv1vscentptetaproton", "hpoddv1vscentptetaproton", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpevenv1vscentptetaproton", "hpevenv1vscentptetaproton", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + + /* histos.add("hpuxQxpvscentptetaneg", "hpuxQxpvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyQypvscentptetaneg", "hpuyQypvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxQxtvscentptetaneg", "hpuxQxtvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyQytvscentptetaneg", "hpuyQytvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxyQxytvscentptetaneg", "hpuxyQxytvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxyQxypvscentptetaneg", "hpuxyQxypvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true);*/ + histos.add("hpoddv1vscentptetaneg", "hpoddv1vscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpevenv1vscentptetaneg", "hpevenv1vscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpoddv1vscentptetakaonneg", "hpoddv1vscentptetakaonneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpevenv1vscentptetakaonneg", "hpevenv1vscentptetakaonneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpoddv1vscentptetaprotonneg", "hpoddv1vscentptetaprotonneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpevenv1vscentptetaprotonneg", "hpevenv1vscentptetaprotonneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + + histos.add("hpQxtQxpvscent", "hpQxtQxpvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQytQypvscent", "hpQytQypvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQxytpvscent", "hpQxytpvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQxtQypvscent", "hpQxtQypvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQxpQytvscent", "hpQxpQytvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + + histos.add("hCentrality", "Centrality distribution", kTH1F, {{centAxis}}); } template bool selectionTrack(const T& candidate) - { - if (iscustomDCAcut && - (!candidate.isGlobalTrack() || !candidate.isPVContributor() || - candidate.itsNCls() < cfgITScluster)) { - return false; - } - - if (ismanualDCAcut && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) { - return false; - } - - return true; - } - - template - bool selectionPID(const T& candidate) { - if (!candidate.hasTOF() && - std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { - return true; - } else if (candidate.hasTOF() && - std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { - return true; - } - - return false; - } - - template - bool SelectionV0(Collision const& collision, V0 const& candidate, - float /*multiplicity*/) - { - if (fabs(candidate.dcav0topv()) > cMaxV0DCA) { - return false; - } - - const float pT = candidate.pt(); - const float tranRad = candidate.v0radius(); - const float dcaDaughv0 = candidate.dcaV0daughters(); - const float cpav0 = candidate.v0cosPA(); - float CtauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), - collision.posZ()) * - TDatabasePDG::Instance() - ->GetParticle(kLambda0) - ->Mass(); // FIXME: Get from the common header - // float lowmasscutks0 = 0.497 - cWidthKs0 * cSigmaMassKs0; - // float highmasscutks0 = 0.497 + cWidthKs0 * cSigmaMassKs0; - float lowmasscutlambda = 1.0; - float highmasscutlambda = 1.2; - // float decayLength = candidate.distovertotmom(collision.posX(), - // collision.posY(), collision.posZ()) * - // RecoDecay::sqrtSumOfSquares(candidate.px(), candidate.py(), - // candidate.pz()); - - if (pT < ConfV0PtMin) { - return false; - } - if (dcaDaughv0 > ConfV0DCADaughMax) { - return false; - } - if (cpav0 < ConfV0CPAMin) { - return false; - } - if (tranRad < ConfV0TranRadV0Min) { - return false; - } - if (tranRad > ConfV0TranRadV0Max) { - return false; - } - if (fabs(CtauK0s) > cMaxV0LifeTime || - candidate.mLambda() < lowmasscutlambda || - candidate.mLambda() > highmasscutlambda) { - return false; - } - - if (QAv0) { - histos.fill(HIST("hLT"), CtauK0s); - histos.fill(HIST("hDCAV0Daughters"), candidate.dcaV0daughters()); - histos.fill(HIST("hV0CosPA"), candidate.v0cosPA()); - } - return true; - } - - template - bool isSelectedV0Daughter(T const& track, float charge, - double nsigmaV0Daughter) - { - const auto eta = track.eta(); - const auto tpcNClsF = track.tpcNClsFound(); - const auto dcaXY = track.dcaXY(); - const auto sign = track.sign(); - - if (!track.hasTPC()) - return false; - if (track.tpcNClsCrossedRows() < 70) - return false; - if (track.tpcCrossedRowsOverFindableCls() < 0.8) - return false; - - if (charge < 0 && sign > 0) { - return false; - } - if (charge > 0 && sign < 0) { - return false; - } - if (std::abs(eta) > ConfDaughEta) { - return false; - } - if (tpcNClsF < ConfDaughTPCnclsMin) { - return false; - } - if (std::abs(dcaXY) < ConfDaughDCAMin) { - return false; - } - if (std::abs(nsigmaV0Daughter) > ConfDaughPIDCuts) { - return false; + if (mycut) { + if (!candidate.isGlobalTrack() || !candidate.isPVContributor() || !(candidate.itsNCls() > cfgITScluster) || !(candidate.tpcNClsFound() > cfgTPCcluster) || !(candidate.itsNClsInnerBarrel() >= 1)) { + return false; + } + } else { + if (!(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster && candidate.itsNClsInnerBarrel() >= 1)) { + return false; + } } - return true; } @@ -360,119 +212,183 @@ struct lambdav2 { { double result = phi; while (result < 0) { - result = result + 2. * TMath::Pi() / 2; + result = result + 2. * TMath::Pi(); } - while (result > 2. * TMath::Pi() / 2) { - result = result - 2. * TMath::Pi() / 2; + while (result > 2. * TMath::Pi()) { + result = result - 2. * TMath::Pi(); } return result; } - // Defining filters for events (event selection) - // Processed events will be already fulfilling the event selection - // requirements - // Filter eventFilter = (o2::aod::evsel::sel8 == true); - Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex); - - Filter acceptanceFilter = - (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); - - using EventCandidates = soa::Filtered>; - - using TrackCandidates = soa::Filtered>; - using V0TrackCandidate = aod::V0Datas; - - ROOT::Math::PxPyPzMVector Lambda; - - void processSE(EventCandidates::iterator const& collision, - TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, - aod::BCs const&) + template + bool SelectionPID(const T& candidate, int PID) + { + if (PID == 0) // pion + { + auto combPIDPi = TMath::Sqrt(TMath::Abs(candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())); + if (!candidate.hasTOF() && candidate.tpcInnerParam() < 0.6 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { + return true; + } + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && combPIDPi < nsigmaCutTOFPi) { + return true; + } + } else if (PID == 1) // kaon + { + auto combPIDKa = TMath::Sqrt(TMath::Abs(candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())); + if (!candidate.hasTOF() && candidate.tpcInnerParam() < 0.45 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { + return true; + } + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && combPIDKa < nsigmaCutTOFKa) { + return true; + } + } else // proton + { + auto combPIDPr = TMath::Sqrt(TMath::Abs(candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr())); + if (!candidate.hasTOF() && candidate.tpcInnerParam() < 0.6 && TMath::Abs(candidate.tpcNSigmaPr()) < nsigmaCutTPCPr) { + return true; + } + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && combPIDPr < nsigmaCutTOFPr) { + return true; + } + } + return false; + } + ROOT::Math::PxPyPzMVector Lambda, Proton, Pion, fourVecDauCM; + // ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY, eventplaneVec, eventplaneVecNorm, beamvector; + ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY; + double phiangle = 0.0; + double massPi = o2::constants::physics::MassPionCharged; + double massKa = o2::constants::physics::MassKaonCharged; + double massPr = o2::constants::physics::MassProton; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter centralityFilter = (nabs(aod::cent::centFT0C) < cfgCutCentralityMax && nabs(aod::cent::centFT0C) > cfgCutCentralityMin); + Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); + Filter dcaCutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + + using EventCandidates = soa::Filtered>; + // using AllTrackCandidates = soa::Join; + using AllTrackCandidates = soa::Filtered>; + using ResoV0s = aod::V0Datas; + + // void processData(EventCandidates::iterator const& collision, AllTrackCandidates const&, ResoV0s const& V0s, aod::BCs const&) + void processData(EventCandidates::iterator const& collision, AllTrackCandidates const& tracks, ResoV0s const& /*V0s*/, aod::BCs const&) { if (!collision.sel8()) { return; } - - float centrality = 0.0f; - centrality = collision.centFT0C(); - auto multTPC = collision.multNTracksPV(); - - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + auto centrality = collision.centFT0C(); + // histos.fill(HIST("hCentrality0"), centrality); + if (!collision.triggereventsp()) { return; } + // histos.fill(HIST("hCentrality1"), centrality); - if (additionalEvsel && !eventSelected(collision, centrality)) { + if (additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { return; } - - if (QA) { - histos.fill(HIST("hFTOCvsTPCNoCut"), centrality, multTPC); - } - if (!collision.triggereventep()) { + // histos.fill(HIST("hCentrality2"), centrality); + // if (additionalEvSel2 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + if (additionalEvSel2 && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) { return; } - auto psiFT0C = collision.psiFT0C(); - auto psiFT0A = collision.psiFT0A(); - auto psiTPC = collision.psiTPC(); - auto psiTPCR = collision.psiTPCR(); - auto psiTPCL = collision.psiTPCL(); - if (QA) { - histos.fill(HIST("hFTOCvsTPCSelected"), centrality, multTPC); - histos.fill(HIST("hPsiFT0C"), centrality, psiFT0C); - histos.fill(HIST("hPsiFT0A"), centrality, psiFT0A); - histos.fill(HIST("hPsiTPC"), centrality, psiTPC); - histos.fill(HIST("hPsiTPCR"), centrality, psiTPCR); - histos.fill(HIST("hPsiTPCL"), centrality, psiTPCL); - histos.fill(HIST("ResFT0CTPC"), centrality, TMath::Cos(2.0 * (psiFT0C - psiTPC))); - histos.fill(HIST("ResFT0CTPCR"), centrality, TMath::Cos(2.0 * (psiFT0C - psiTPCR))); - histos.fill(HIST("ResFT0CTPCL"), centrality, TMath::Cos(2.0 * (psiFT0C - psiTPCL))); - histos.fill(HIST("ResTPCRTPCL"), centrality, TMath::Cos(2.0 * (psiTPCR - psiTPCL))); - histos.fill(HIST("ResFT0CFT0A"), centrality, TMath::Cos(2.0 * (psiFT0C - psiFT0A))); - histos.fill(HIST("ResFT0ATPC"), centrality, TMath::Cos(2.0 * (psiTPC - psiFT0A))); + // histos.fill(HIST("hCentrality3"), centrality); + if (additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + return; } - // Fill the event counter - rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); - rEventSelection.fill(HIST("hmult"), centrality); + auto qxZDCA = collision.qxZDCA(); + auto qxZDCC = collision.qxZDCC(); + auto qyZDCA = collision.qyZDCA(); + auto qyZDCC = collision.qyZDCC(); + // auto psiZDCC = collision.psiZDCC(); + // auto psiZDCA = collision.psiZDCA(); + + histos.fill(HIST("hCentrality"), centrality); + + auto QxtQxp = qxZDCA * qxZDCC; + auto QytQyp = qyZDCA * qyZDCC; + auto Qxytp = QxtQxp + QytQyp; + auto QxpQyt = qxZDCA * qyZDCC; + auto QxtQyp = qxZDCC * qyZDCA; + + histos.fill(HIST("hpQxtQxpvscent"), centrality, QxtQxp); + histos.fill(HIST("hpQytQypvscent"), centrality, QytQyp); + histos.fill(HIST("hpQxytpvscent"), centrality, Qxytp); + histos.fill(HIST("hpQxpQytvscent"), centrality, QxpQyt); + histos.fill(HIST("hpQxtQypvscent"), centrality, QxtQyp); + + for (auto track : tracks) { + if (!selectionTrack(track)) { + continue; + } - for (auto& v0 : V0s) { + bool ispion = 0; + bool iskaon = 0; + bool isproton = 0; - auto postrack = v0.template posTrack_as(); - auto negtrack = v0.template negTrack_as(); - double nTPCSigmaPos[1]{postrack.tpcNSigmaPr()}; - double nTPCSigmaNeg[1]{negtrack.tpcNSigmaPi()}; - double nTPCSigmaPos2[1]{postrack.tpcNSigmaPi()}; - double nTPCSigmaNeg2[1]{negtrack.tpcNSigmaPr()}; + if (SelectionPID(track, 0)) + ispion = 1; + if (SelectionPID(track, 1)) + iskaon = 1; + if (SelectionPID(track, 2)) + isproton = 1; - if (!isSelectedV0Daughter(postrack, 1, nTPCSigmaPos[0]) && !isSelectedV0Daughter(postrack, 1, nTPCSigmaPos2[0])) { + if (ispion && iskaon) continue; - } - if (!isSelectedV0Daughter(negtrack, -1, nTPCSigmaNeg[0]) && !isSelectedV0Daughter(negtrack, -1, nTPCSigmaNeg2[0])) { + if (ispion && isproton) continue; - } - - if (!SelectionV0(collision, v0, centrality)) { + if (iskaon && isproton) continue; - } - - Lambda = ROOT::Math::PxPyPzMVector(v0.px(), v0.py(), v0.pz(), massLambda); - auto phiminuspsi = GetPhiInRange(Lambda.Phi() - psiFT0C); - auto v2 = TMath::Cos(2.0 * phiminuspsi); + float sign = track.sign(); + if (sign == 0.0) // removing neutral particles + continue; - if (TMath::Abs(Lambda.Rapidity()) < 0.5) { - histos.fill(HIST("hLamInvMass"), centrality, - Lambda.Pt(), v0.mLambda(), v2); + auto ux = TMath::Cos(GetPhiInRange(track.phi())); + auto uy = TMath::Sin(GetPhiInRange(track.phi())); + + // auto uxQxp = ux * qxZDCA; + // auto uyQyp = uy * qyZDCA; + // auto uxyQxyp = uxQxp + uyQyp; + // auto uxQxt = ux * qxZDCC; + // auto uyQyt = uy * qyZDCC; + // auto uxyQxyt = uxQxt + uyQyt; + auto oddv1 = ux * (qxZDCA - qxZDCC) + uy * (qyZDCA - qyZDCC); + auto evenv1 = ux * (qxZDCA + qxZDCC) + uy * (qyZDCA + qyZDCC); + + if (sign > 0) { + if (ispion) { + histos.fill(HIST("hpoddv1vscentpteta"), centrality, track.pt(), track.rapidity(massPi), oddv1); + histos.fill(HIST("hpevenv1vscentpteta"), centrality, track.pt(), track.rapidity(massPi), evenv1); + } else if (iskaon) { + histos.fill(HIST("hpoddv1vscentptetakaon"), centrality, track.pt(), track.rapidity(massKa), oddv1); + histos.fill(HIST("hpevenv1vscentptetakaon"), centrality, track.pt(), track.rapidity(massKa), evenv1); + } else if (isproton) { + histos.fill(HIST("hpoddv1vscentptetaproton"), centrality, track.pt(), track.rapidity(massPr), oddv1); + histos.fill(HIST("hpevenv1vscentptetaproton"), centrality, track.pt(), track.rapidity(massPr), evenv1); + } + + } else { + if (ispion) { + histos.fill(HIST("hpoddv1vscentptetaneg"), centrality, track.pt(), track.rapidity(massPi), oddv1); + histos.fill(HIST("hpevenv1vscentptetaneg"), centrality, track.pt(), track.rapidity(massPi), evenv1); + } else if (iskaon) { + histos.fill(HIST("hpoddv1vscentptetakaonneg"), centrality, track.pt(), track.rapidity(massKa), oddv1); + histos.fill(HIST("hpevenv1vscentptetakaonneg"), centrality, track.pt(), track.rapidity(massKa), evenv1); + } else if (isproton) { + histos.fill(HIST("hpoddv1vscentptetaprotonneg"), centrality, track.pt(), track.rapidity(massPr), oddv1); + histos.fill(HIST("hpevenv1vscentptetaprotonneg"), centrality, track.pt(), track.rapidity(massPr), evenv1); + } } } } - - PROCESS_SWITCH(lambdav2, processSE, "Process Same event", true); + PROCESS_SWITCH(lambdav2, processData, "Process data", true); }; - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"lambdav2"})}; } diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index 9537b986a04..d9e3eb99f44 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include "TRandom3.h" #include "Math/Vector3D.h" @@ -73,18 +74,17 @@ struct phianalysisrun3_PbPb { Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; Configurable nsigmaCutTPC{"nsigmacutTPC", 2.0, "Value of the TPC Nsigma cut"}; + Configurable nsigmaCutTOF{"nsigmacutTOF", 2.0, "Value of the TOF Nsigma cut"}; Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; Configurable fillOccupancy{"fillOccupancy", true, "fill Occupancy"}; Configurable cfgOccupancyCut{"cfgOccupancyCut", 2500, "Occupancy cut"}; Configurable isNoTOF{"isNoTOF", false, "isNoTOF"}; - Configurable isEtaAssym{"isEtaAssym", false, "isEtaAssym"}; Configurable additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"}; Configurable additionalEvSel3{"additionalEvSel3", true, "Additional evsel3"}; Configurable cfgMultFT0{"cfgMultFT0", true, "cfgMultFT0"}; Configurable iscustomDCAcut{"iscustomDCAcut", false, "iscustomDCAcut"}; Configurable ismanualDCAcut{"ismanualDCAcut", true, "ismanualDCAcut"}; - Configurable isITSOnlycut{"isITSOnlycut", true, "isITSOnlycut"}; Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; Configurable confRapidity{"confRapidity", 0.5, "Rapidity cut"}; @@ -106,24 +106,13 @@ struct phianalysisrun3_PbPb { histos.add("hOccupancy", "Occupancy distribution", kTH1F, {occupancyAxis}); if (!isMC) { histos.add("h3PhiInvMassUnlikeSign", "Invariant mass of Phi meson Unlike Sign", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassLikeSignPP", "Invariant mass of Phi meson Like Sign positive", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassLikeSignMM", "Invariant mass of Phi meson Like Sign negative", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); histos.add("h3PhiInvMassMixed", "Invariant mass of Phi meson Mixed", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassRotation", "Invariant mass of Phi meson Rotation", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - if (isEtaAssym) { - histos.add("h3PhiInvMassUnlikeSignAside", "Invariant mass of Phi meson Unlike Sign A side", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassLikeSignAside", "Invariant mass of Phi meson Like Sign A side", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassMixedAside", "Invariant mass of Phi meson Mixed A side", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassUnlikeSignCside", "Invariant mass of Phi meson Unlike Sign C side", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassLikeSignCside", "Invariant mass of Phi meson Like Sign C side", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassMixedCside", "Invariant mass of Phi meson Mixed C side", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - } } else if (isMC) { histos.add("hMC", "MC Event statistics", kTH1F, {{10, 0.0f, 10.0f}}); histos.add("h1PhiGen", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h1PhiGen1", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {{200, 0.0f, 20.0f}}); histos.add("Centrec", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); + histos.add("Centgen", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); histos.add("h2PhiRec2", "Phi meson Rec", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); histos.add("h3PhiRec3", "Phi meson Rec", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}}); histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); @@ -166,9 +155,6 @@ struct phianalysisrun3_PbPb { if (ismanualDCAcut && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster)) { return false; } - if (isITSOnlycut && !(candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster)) { - return false; - } return true; } @@ -189,10 +175,10 @@ struct phianalysisrun3_PbPb { template bool selectionPIDpTdependent(const T& candidate) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { return true; } return false; @@ -215,69 +201,33 @@ struct phianalysisrun3_PbPb { return true; } template - void FillinvMass(const T1& candidate1, const T2& candidate2, float multiplicity, bool unlike, bool mix, bool likesign, bool rotation, float massd1, float massd2) + void FillinvMass(const T1& candidate1, const T2& candidate2, float multiplicity, bool unlike, bool mix, float massd1, float massd2) { pvec0 = array{candidate1.px(), candidate1.py(), candidate1.pz()}; pvec1 = array{candidate2.px(), candidate2.py(), candidate2.pz()}; - pvec1rotation = array{-candidate2.px(), -candidate2.py(), candidate2.pz()}; auto arrMom = array{pvec0, pvec1}; - auto arrMomrotation = array{pvec0, pvec1rotation}; int track1Sign = candidate1.sign(); int track2Sign = candidate2.sign(); mass = RecoDecay::m(arrMom, array{massd1, massd2}); - massrotation = RecoDecay::m(arrMomrotation, array{massd1, massd2}); pT = RecoDecay::pt(array{candidate1.px() + candidate2.px(), candidate1.py() + candidate2.py()}); rapidity = RecoDecay::y(array{candidate1.px() + candidate2.px(), candidate1.py() + candidate2.py(), candidate1.pz() + candidate2.pz()}, mass); - if (isEtaAssym && unlike && track1Sign * track2Sign < 0) { - if (candidate1.eta() > 0.2 && candidate1.eta() < 0.8 && candidate2.eta() > 0.2 && candidate2.eta() < 0.8) { - histos.fill(HIST("h3PhiInvMassUnlikeSignAside"), multiplicity, pT, mass); - } else if (candidate1.eta() > -0.6 && candidate1.eta() < 0.0 && candidate2.eta() > -0.6 && candidate2.eta() < 0.0) { - histos.fill(HIST("h3PhiInvMassUnlikeSignCside"), multiplicity, pT, mass); - } - } - if (isEtaAssym && mix && track1Sign * track2Sign < 0) { - if (candidate1.eta() > 0.2 && candidate1.eta() < 0.8 && candidate2.eta() > 0.2 && candidate2.eta() < 0.8) { - histos.fill(HIST("h3PhiInvMassMixedAside"), multiplicity, pT, mass); - } else if (candidate1.eta() > -0.6 && candidate1.eta() < 0.0 && candidate2.eta() > -0.6 && candidate2.eta() < 0.0) { - histos.fill(HIST("h3PhiInvMassMixedCside"), multiplicity, pT, mass); - } - } - if (isEtaAssym && likesign && track1Sign * track2Sign > 0) { - if (candidate1.eta() > 0.2 && candidate1.eta() < 0.8 && candidate2.eta() > 0.2 && candidate2.eta() < 0.8) { - histos.fill(HIST("h3PhiInvMassLikeSignAside"), multiplicity, pT, mass); - } else if (candidate1.eta() > -0.6 && candidate1.eta() < 0.0 && candidate2.eta() > -0.6 && candidate2.eta() < 0.0) { - histos.fill(HIST("h3PhiInvMassLikeSignCside"), multiplicity, pT, mass); - } - } // default filling - if (std::abs(rapidity) < 0.5 && !isEtaAssym && track1Sign * track2Sign < 0) { + if (std::abs(rapidity) < 0.5 && track1Sign * track2Sign < 0) { if (unlike) { histos.fill(HIST("h3PhiInvMassUnlikeSign"), multiplicity, pT, mass); } if (mix) { histos.fill(HIST("h3PhiInvMassMixed"), multiplicity, pT, mass); } - if (rotation) { - histos.fill(HIST("h3PhiInvMassRotation"), multiplicity, pT, massrotation); - } - } - if (std::abs(rapidity) < 0.5 && !isEtaAssym && track1Sign * track2Sign > 0 && likesign) { - if (track1Sign > 0 && track2Sign > 0) { - histos.fill(HIST("h3PhiInvMassLikeSignPP"), multiplicity, pT, mass); - } else { - histos.fill(HIST("h3PhiInvMassLikeSignMM"), multiplicity, pT, mass); - } } } - Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using EventCandidates = soa::Filtered>; - using TrackCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; // using EventCandidatesMC = soa::Join; using EventCandidatesMC = soa::Join; @@ -298,15 +248,7 @@ struct phianalysisrun3_PbPb { SliceCache cache; - // using BinningType = BinningPolicy>; - // BinningType binningOnPositions{{axisVertex, axisMultiplicityClass}, true}; - - // using BinningTypeTPCMultiplicity = ColumnBinningPolicy; using BinningTypeVertexContributor = ColumnBinningPolicy; - // using BinningTypeCentrality = ColumnBinningPolicy; - - // using BinningType = ColumnBinningPolicy; - // BinningType binningOnPositions{{axisVertex, axisMultiplicity}, true}; ROOT::Math::PxPyPzMVector PhiMesonMother, KaonPlus, KaonMinus; void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { @@ -320,11 +262,11 @@ struct phianalysisrun3_PbPb { return; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && occupancy < cfgOccupancyCut) // occupancy info is available for this collision (*) + if (fillOccupancy && occupancy > cfgOccupancyCut) // occupancy info is available for this collision (*) { return; } - float multiplicity; + float multiplicity{-1}; if (cfgMultFT0) multiplicity = collision.centFT0C(); histos.fill(HIST("hCentrality"), multiplicity); @@ -354,31 +296,21 @@ struct phianalysisrun3_PbPb { } bool unlike = true; bool mix = false; - bool likesign = true; - bool rotation = true; - if (isITSOnlycut) { + if (!ispTdepPID && selectionPID(track1) && selectionPID(track2)) { histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.pt(), track1.tpcNSigmaKa()); histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.pt(), track1.tofNSigmaKa()); histos.fill(HIST("QAafter/trkDCAxy"), track1.dcaXY()); histos.fill(HIST("QAafter/trkDCAz"), track1.dcaZ()); histos.fill(HIST("QAafter/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); - FillinvMass(track1, track2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); + FillinvMass(track1, track2, multiplicity, unlike, mix, massKa, massKa); } - if (!isITSOnlycut && !ispTdepPID && selectionPID(track1) && selectionPID(track2)) { + if (ispTdepPID && selectionPIDpTdependent(track1) && selectionPIDpTdependent(track2)) { histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.pt(), track1.tpcNSigmaKa()); histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.pt(), track1.tofNSigmaKa()); histos.fill(HIST("QAafter/trkDCAxy"), track1.dcaXY()); histos.fill(HIST("QAafter/trkDCAz"), track1.dcaZ()); histos.fill(HIST("QAafter/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); - FillinvMass(track1, track2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); - } - if (!isITSOnlycut && ispTdepPID && selectionPIDpTdependent(track1) && selectionPIDpTdependent(track2)) { - histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.pt(), track1.tpcNSigmaKa()); - histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.pt(), track1.tofNSigmaKa()); - histos.fill(HIST("QAafter/trkDCAxy"), track1.dcaXY()); - histos.fill(HIST("QAafter/trkDCAz"), track1.dcaZ()); - histos.fill(HIST("QAafter/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); - FillinvMass(track1, track2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); + FillinvMass(track1, track2, multiplicity, unlike, mix, massKa, massKa); } } } @@ -412,7 +344,7 @@ struct phianalysisrun3_PbPb { } int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); - if (fillOccupancy && occupancy1 < cfgOccupancyCut && occupancy2 < cfgOccupancyCut) // occupancy info is available for this collision (*) + if (fillOccupancy && occupancy1 > cfgOccupancyCut && occupancy2 > cfgOccupancyCut) // occupancy info is available for this collision (*) { return; } @@ -425,8 +357,6 @@ struct phianalysisrun3_PbPb { for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { bool unlike = false; bool mix = true; - bool likesign = false; - bool rotation = false; if (!selectionTrack(t1)) { continue; } @@ -436,14 +366,11 @@ struct phianalysisrun3_PbPb { if (!selectionPair(t1, t2)) { continue; } - if (isITSOnlycut) { - FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); - } - if (!isITSOnlycut && !ispTdepPID && selectionPID(t1) && selectionPID(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); + if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { + FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } - if (!isITSOnlycut && ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); + if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { + FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } } @@ -472,6 +399,11 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("hMC"), 5); continue; } + int occupancy = RecCollision.trackOccupancyInTimeRange(); + if (fillOccupancy && occupancy > cfgOccupancyCut) // occupancy info is available for this collision (*) + { + return; + } if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) { histos.fill(HIST("hMC"), 6); continue; @@ -625,6 +557,179 @@ struct phianalysisrun3_PbPb { } // process MC PROCESS_SWITCH(phianalysisrun3_PbPb, processMC, "Process Reconstructed", false); + void processGen(aod::McCollision const& mcCollision, aod::McParticles& mcParticles, const soa::SmallGroups& collisions) + { + histos.fill(HIST("hMC"), 0.5); + if (std::abs(mcCollision.posZ()) < cfgCutVertex) { + histos.fill(HIST("hMC"), 1.5); + } + int Nchinel = 0; + for (auto& mcParticle : mcParticles) { + auto pdgcode = std::abs(mcParticle.pdgCode()); + if (mcParticle.isPhysicalPrimary() && (pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11 || pdgcode == 13)) { + if (std::abs(mcParticle.eta()) < 1.0) { + Nchinel = Nchinel + 1; + } + } + } + if (Nchinel > 0 && std::abs(mcCollision.posZ()) < cfgCutVertex) + histos.fill(HIST("hMC"), 2.5); + std::vector SelectedEvents(collisions.size()); + int nevts = 0; + auto multiplicity = 0; + for (const auto& collision : collisions) { + if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { + continue; + } + int occupancy = collision.trackOccupancyInTimeRange(); + if (fillOccupancy && occupancy > cfgOccupancyCut) // occupancy info is available for this collision (*) + { + continue; + } + multiplicity = collision.centFT0C(); + histos.fill(HIST("Centgen"), multiplicity); + SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); + } + SelectedEvents.resize(nevts); + const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end(); + histos.fill(HIST("hMC"), 3.5); + if (!evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection + return; + } + histos.fill(HIST("hMC"), 4.5); + for (auto& mcParticle : mcParticles) { + if (std::abs(mcParticle.y()) >= 0.5) { + continue; + } + if (mcParticle.pdgCode() != 333) { + continue; + } + auto kDaughters = mcParticle.daughters_as(); + if (kDaughters.size() != 2) { + continue; + } + auto daughtp = false; + auto daughtm = false; + for (auto kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) { + continue; + } + if (kCurrentDaughter.pdgCode() == +321) { + daughtp = true; + } else if (kCurrentDaughter.pdgCode() == -321) { + daughtm = true; + } + } + if (daughtp && daughtm) { + histos.fill(HIST("h1PhiGen"), mcParticle.pt()); + histos.fill(HIST("h2PhiGen2"), mcParticle.pt(), multiplicity); + } + } + } + PROCESS_SWITCH(phianalysisrun3_PbPb, processGen, "Process Generated", false); + void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const& /*mcParticles*/, aod::McCollisions const& /*mcCollisions*/) + { + if (!collision.has_mcCollision()) { + return; + } + if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex || !collision.sel8()) { + return; + } + int occupancy = collision.trackOccupancyInTimeRange(); + if (fillOccupancy && occupancy > cfgOccupancyCut) // occupancy info is available for this collision (*) + { + return; + } + auto multiplicity = collision.centFT0C(); + histos.fill(HIST("Centrec"), multiplicity); + histos.fill(HIST("hMC"), 5.5); + auto oldindex = -999; + for (auto track1 : tracks) { + if (!selectionTrack(track1)) { + continue; + } + if (!track1.has_mcParticle()) { + continue; + } + auto track1ID = track1.index(); + for (auto track2 : tracks) { + if (!track2.has_mcParticle()) { + continue; + } + if (!selectionTrack(track2)) { + continue; + } + auto track2ID = track2.index(); + if (track2ID <= track1ID) { + continue; + } + if (!selectionPair(track1, track2)) { + continue; + } + if (track1.sign() * track2.sign() > 0) { + continue; + } + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + int track1PDG = std::abs(mctrack1.pdgCode()); + int track2PDG = std::abs(mctrack2.pdgCode()); + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + if (!mctrack2.isPhysicalPrimary()) { + continue; + } + if (!(track1PDG == 321 && track2PDG == 321)) { + continue; + } + for (auto& mothertrack1 : mctrack1.mothers_as()) { + for (auto& mothertrack2 : mctrack2.mothers_as()) { + if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { + continue; + } + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { + continue; + } + if (!mothertrack1.producedByGenerator()) { + continue; + } + if (std::abs(mothertrack1.y()) >= 0.5) { + continue; + } + if (std::abs(mothertrack1.pdgCode()) != 333) { + continue; + } + if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { + continue; + } + if (ispTdepPID && (!selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2))) { + continue; + } + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + histos.fill(HIST("h1PhiRecsplit"), mothertrack1.pt()); + continue; + } + oldindex = mothertrack1.globalIndex(); + pvec0 = array{track1.px(), track1.py(), track1.pz()}; + pvec1 = array{track2.px(), track2.py(), track2.pz()}; + auto arrMomrec = array{pvec0, pvec1}; + auto motherP = mothertrack1.p(); + auto motherE = mothertrack1.e(); + genMass = std::sqrt(motherE * motherE - motherP * motherP); + recMass = RecoDecay::m(arrMomrec, array{massKa, massKa}); + auto recpt = TMath::Sqrt((track1.px() + track2.px()) * (track1.px() + track2.px()) + (track1.py() + track2.py()) * (track1.py() + track2.py())); + histos.fill(HIST("h1PhiRec1"), mothertrack1.pt()); + histos.fill(HIST("h2PhiRec2"), mothertrack1.pt(), multiplicity); + histos.fill(HIST("h1Phimassgen"), genMass); + histos.fill(HIST("h1Phimassrec"), recMass); + histos.fill(HIST("h1Phipt"), recpt); + } + } + } + } + } + + PROCESS_SWITCH(phianalysisrun3_PbPb, processRec, "Process Reconstructed", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGLF/Tasks/Resonances/phipbpb.cxx b/PWGLF/Tasks/Resonances/phipbpb.cxx index 79b4e42f6b8..8d837d8314f 100644 --- a/PWGLF/Tasks/Resonances/phipbpb.cxx +++ b/PWGLF/Tasks/Resonances/phipbpb.cxx @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "TRandom3.h" #include "Math/Vector3D.h" @@ -75,24 +77,23 @@ struct phipbpb { // events Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"}; + Configurable cfgCutOccupancy{"cfgCutOccupancy", 3000, "Occupancy cut"}; // track - Configurable additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"}; - Configurable additionalEvSel3{"additionalEvSel3", false, "Additional evsel3"}; + Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; Configurable removefaketrak{"removefaketrack", true, "Remove fake track from momentum difference"}; Configurable ConfFakeKaonCut{"ConfFakeKaonCut", 0.1, "Cut based on track from momentum difference"}; - Configurable fillRapidity{"fillRapidity", false, "fill rapidity bin"}; Configurable useGlobalTrack{"useGlobalTrack", true, "use Global track"}; + Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; Configurable cfgCutCharge{"cfgCutCharge", 0.0, "cut on Charge"}; Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; Configurable nsigmaCutTPC{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; - Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"}; + Configurable nsigmaCutTOF{"nsigmaCutTOF", 3.0, "Value of the TOF Nsigma cut"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 1, "Number of mixed events per event"}; Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; - Configurable isNoTOF{"isNoTOF", false, "isNoTOF"}; Configurable isDeepAngle{"isDeepAngle", false, "Deep Angle cut"}; Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; @@ -103,12 +104,9 @@ struct phipbpb { ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0., 80}, "Centrality"}; ConfigurableAxis configThnAxisPhiminusPsi{"configThnAxisPhiminusPsi", {6, 0.0, TMath::Pi()}, "#phi - #psi"}; ConfigurableAxis configThnAxisV2{"configThnAxisV2", {200, -1, 1}, "V2"}; - ConfigurableAxis configThnAxisSP{"configThnAxisSP", {400, -4, 4}, "SP"}; ConfigurableAxis configThnAxisRapidity{"configThnAxisRapidity", {8, 0, 0.8}, "Rapidity"}; ConfigurableAxis configThnAxisSA{"configThnAxisSA", {200, -1, 1}, "SA"}; ConfigurableAxis configThnAxiscosthetaSA{"configThnAxiscosthetaSA", {200, 0, 1}, "costhetaSA"}; - Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; - Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; Configurable isMC{"isMC", false, "use MC"}; Configurable genacceptancecut{"genacceptancecut", true, "use acceptance cut for generated"}; Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; @@ -120,12 +118,12 @@ struct phipbpb { Filter PIDcutFilter = nabs(aod::pidtpc::tpcNSigmaKa) < nsigmaCutTPC; using EventCandidates = soa::Filtered>; - using TrackCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; using CollisionMCRecTableCentFT0C = soa::SmallGroups>; - using TrackMCRecTable = soa::Join; + using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; Preslice perCollision = aod::track::collisionId; @@ -149,15 +147,12 @@ struct phipbpb { std::vector occupancyBinning = {0.0, 500.0, 1000.0, 1500.0, 2000.0, 3000.0, 4000.0, 5000.0, 50000.0}; const AxisSpec thnAxisInvMass{configThnAxisInvMass, "#it{M} (GeV/#it{c}^{2})"}; const AxisSpec thnAxisPt{configThnAxisPt, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec thnAxisCosThetaStarOP{configThnAxisCosThetaStar, "cos(#vartheta_{OP})"}; - const AxisSpec thnAxisCosThetaStarIP{configThnAxisCosThetaStar, "cos(#vartheta_{IP})"}; - const AxisSpec thnAxisPhiminusPsi{configThnAxisPhiminusPsi, "#phi - #psi"}; + const AxisSpec thnAxisCosThetaStar{configThnAxisCosThetaStar, "cos(#vartheta_{OP})"}; const AxisSpec thnAxisCentrality{configThnAxisCentrality, "Centrality (%)"}; const AxisSpec thnAxisV2{configThnAxisV2, "V2"}; - const AxisSpec thnAxisSP{configThnAxisSP, "SP"}; const AxisSpec thnAxisRapidity{configThnAxisRapidity, "Rapidity"}; const AxisSpec thnAxisSA{configThnAxisSA, "SA"}; - const AxisSpec thnAxiscosthetaSA{configThnAxiscosthetaSA, "costhetaSA"}; + AxisSpec cumulantAxis = {200, -1, 1, "phi"}; AxisSpec phiAxis = {500, -6.28, 6.28, "phi"}; AxisSpec resAxis = {2000, -10, 10, "Res"}; AxisSpec centAxis = {8, 0, 80, "V0M (%)"}; @@ -180,36 +175,24 @@ struct phipbpb { histos.add("hPsiTPC", "PsiTPC", kTH3F, {centAxis, occupancyAxis, phiAxis}); histos.add("hPsiTPCR", "PsiTPCR", kTH3F, {centAxis, occupancyAxis, phiAxis}); histos.add("hPsiTPCL", "PsiTPCL", kTH3F, {centAxis, occupancyAxis, phiAxis}); - if (!fillRapidity) { - histos.add("hSparseV2SASameEvent_costhetastarOP", "hSparseV2SASameEvent_costhetastarOP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarIP", "hSparseV2SASameEvent_costhetastarIP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA", "hSparseV2SASameEvent_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costheta_SA", "hSparseV2SASameEvent_costheta_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxiscosthetaSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_A0", "hSparseV2SASameEvent_SA_A0", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_V2", "hSparseV2SASameEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_costhetastarOP", "hSparseV2SAMixedEvent_costhetastarOP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_costhetastarIP", "hSparseV2SAMixedEvent_costhetastarIP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_SA", "hSparseV2SAMixedEvent_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_costheta_SA", "hSparseV2SAMixedEvent_costheta_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxiscosthetaSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_SA_A0", "hSparseV2SAMixedEvent_SA_A0", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_V2", "hSparseV2SAMixedEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SP", "hSparseV2SASameEvent_SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSP, thnAxisCentrality, occupancyAxis}); - histos.add("hSparseV2SAMixedEvent_SP", "hSparseV2SAMixedEvent_SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSP, thnAxisCentrality, occupancyAxis}); - } - if (fillRapidity) { - histos.add("hSparseV2SASameEvent_costhetastarOP", "hSparseV2SASameEvent_costhetastarOP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarIP", "hSparseV2SASameEvent_costhetastarIP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA", "hSparseV2SASameEvent_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costheta_SA", "hSparseV2SASameEvent_costheta_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxiscosthetaSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_A0", "hSparseV2SASameEvent_SA_A0", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_V2", "hSparseV2SASameEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_costhetastarOP", "hSparseV2SAMixedEvent_costhetastarOP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_costhetastarIP", "hSparseV2SAMixedEvent_costhetastarIP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_SA", "hSparseV2SAMixedEvent_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_costheta_SA", "hSparseV2SAMixedEvent_costheta_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxiscosthetaSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_SA_A0", "hSparseV2SAMixedEvent_SA_A0", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_V2", "hSparseV2SAMixedEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - } + + histos.add("hSparseV2SameEventCosPhi", "hSparseV2SameEventCosPhi", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, cumulantAxis, thnAxisCentrality}); + histos.add("hSparseV2SameEventSinPhi", "hSparseV2SameEventSinPhi", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, cumulantAxis, thnAxisCentrality}); + histos.add("hSparseV2SameEventCosPsi", "hSparseV2SameEventCosPsi", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, cumulantAxis, thnAxisCentrality}); + histos.add("hSparseV2SameEventSinPsi", "hSparseV2SameEventSinPsi", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, cumulantAxis, thnAxisCentrality}); + + histos.add("hSparseV2SameEventCosDeltaPhi", "hSparseV2SameEventCosDeltaPhi", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + histos.add("hSparseV2MixedEventCosDeltaPhi", "hSparseV2MixedEventCosDeltaPhi", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + + histos.add("hSparseV2SameEventSinDeltaPhi", "hSparseV2SameEventSinDeltaPhi", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + histos.add("hSparseV2MixedEventSinDeltaPhi", "hSparseV2MixedEventSinDeltaPhi", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + + histos.add("hSparseV2SameEventSA", "hSparseV2SameEventSA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); + histos.add("hSparseV2MixedEventSA", "hSparseV2MixedEventSA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); + + histos.add("hSparseV2SameEventCosThetaStar", "hSparseV2SameEventCosThetaStar", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStar, thnAxisRapidity, thnAxisCentrality}); + histos.add("hSparseV2MixedEventCosThetaStar", "hSparseV2MixedEventCosThetaStar", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStar, thnAxisRapidity, thnAxisCentrality}); + // histogram for resolution histos.add("ResFT0CTPC", "ResFT0CTPC", kTH3F, {centAxis, occupancyAxis, resAxis}); histos.add("ResFT0CTPCR", "ResFT0CTPCR", kTH3F, {centAxis, occupancyAxis, resAxis}); @@ -230,40 +213,12 @@ struct phipbpb { histos.add("hMC", "MC Event statistics", kTH1F, {{10, 0.0f, 10.0f}}); histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {{100, 0.0f, 10.0f}}); histos.add("CentPercentileMCRecHist", "MC Centrality", kTH1F, {{100, 0.0f, 100.0f}}); - if (!fillRapidity) { - histos.add("hSparseV2SASameEvent_costhetastarOP_beam_MCGen", "hSparseV2SASameEvent_costhetastar_beamOP_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarOP_MCGen", "hSparseV2SASameEvent_costhetastarOP_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarIP_MCGen", "hSparseV2SASameEvent_costhetastarIP_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_MCGen", "hSparseV2SASameEvent_SA_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costheta_SA_MCGen", "hSparseV2SASameEvent_costheta_SA_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxiscosthetaSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_A0_MCGen", "hSparseV2SASameEvent_SA_A0_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_V2_MCGen", "hSparseV2SASameEvent_V2_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - - histos.add("hSparseV2SASameEvent_costhetastarOP_beam_MCRec", "hSparseV2SASameEvent_costhetastar_beamOP_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarOP_MCRec", "hSparseV2SASameEvent_costhetastarOP_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarIP_MCRec", "hSparseV2SASameEvent_costhetastarIP_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_MCRec", "hSparseV2SASameEvent_SA_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costheta_SA_MCRec", "hSparseV2SASameEvent_costheta_SA_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxiscosthetaSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_A0_MCRec", "hSparseV2SASameEvent_SA_A0_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_V2_MCRec", "hSparseV2SASameEvent_V2_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - } - if (fillRapidity) { - histos.add("hSparseV2SASameEvent_costhetastarOP_beam_MCGen", "hSparseV2SASameEvent_costhetastar_beamOP_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarOP_MCGen", "hSparseV2SASameEvent_costhetastarOP_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarIP_MCGen", "hSparseV2SASameEvent_costhetastarIP_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_MCGen", "hSparseV2SASameEvent_SA_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costheta_SA_MCGen", "hSparseV2SASameEvent_costheta_SA_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxiscosthetaSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_A0_MCGen", "hSparseV2SASameEvent_SA_A0_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_V2_MCGen", "hSparseV2SASameEvent_V2_MCGen", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - - histos.add("hSparseV2SASameEvent_costhetastarOP_beam_MCRec", "hSparseV2SASameEvent_costhetastar_beamOP_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarOP_MCRec", "hSparseV2SASameEvent_costhetastarOP_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costhetastarIP_MCRec", "hSparseV2SASameEvent_costhetastarIP_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStarOP, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_MCRec", "hSparseV2SASameEvent_SA_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_costheta_SA_MCRec", "hSparseV2SASameEvent_costheta_SA_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxiscosthetaSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_SA_A0_MCRec", "hSparseV2SASameEvent_SA_A0_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); - histos.add("hSparseV2SASameEvent_V2_MCRec", "hSparseV2SASameEvent_V2_MCRec", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - } + + histos.add("hSparseV2MCGenSA", "hSparseV2SameEventSA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); + histos.add("hSparseV2MCGenCosThetaStar_effy", "hSparseV2SameEventCosThetaStar_effy", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStar, thnAxisRapidity, thnAxisCentrality}); + + histos.add("hSparseV2MCRecSA", "hSparseV2SameEventSA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisRapidity, thnAxisCentrality}); + histos.add("hSparseV2MCRecCosThetaStar_effy", "hSparseV2SameEventCosThetaStar_effy", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStar, thnAxisRapidity, thnAxisCentrality}); } // Event selection cut additional - Alex if (additionalEvsel) { @@ -321,7 +276,7 @@ struct phipbpb { if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.pt() >= 0.5 && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { return true; } if (!useGlobalTrack && !candidate.hasTPC()) { @@ -332,13 +287,10 @@ struct phipbpb { template bool selectionPID(const T& candidate) { - if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { - return true; - } - if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (isNoTOF && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { return true; } return false; @@ -406,24 +358,12 @@ struct phipbpb { void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks*/, aod::BCs const&) { - if (!collision.sel8()) { + if (!collision.sel8() || !collision.triggereventep() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return; } auto centrality = collision.centFT0C(); auto multTPC = collision.multNTracksPV(); histos.fill(HIST("hFTOCvsTPCNoCut"), centrality, multTPC); - if (!collision.triggereventep()) { - return; - } - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - return; - } - if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - return; - } - if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - return; - } auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto psiFT0C = collision.psiFT0C(); @@ -437,6 +377,9 @@ struct phipbpb { auto QTPCR = collision.qTPCR(); auto QTPCL = collision.qTPCL(); int occupancy = collision.trackOccupancyInTimeRange(); + if (occupancy > cfgCutOccupancy) { + return; + } histos.fill(HIST("hFTOCvsTPC"), centrality, multTPC); if (additionalEvsel && !eventSelected(collision, centrality)) { return; @@ -515,117 +458,19 @@ struct phipbpb { KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); PhiMesonMother = KaonPlus + KaonMinus; - histos.fill(HIST("hpTvsRapidity"), PhiMesonMother.Pt(), PhiMesonMother.Rapidity()); - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { - continue; - } - ROOT::Math::Boost boost{PhiMesonMother.BoostToCM()}; - fourVecDauCM = boost(KaonMinus); - threeVecDauCM = fourVecDauCM.Vect(); - threeVecDauCMXY = ROOT::Math::XYZVector(threeVecDauCM.X(), threeVecDauCM.Y(), 0.); - eventplaneVec = ROOT::Math::XYZVector(std::cos(2.0 * psiFT0C), std::sin(2.0 * psiFT0C), 0); - eventplaneVecNorm = ROOT::Math::XYZVector(std::sin(2.0 * psiFT0C), -std::cos(2.0 * psiFT0C), 0); - - // auto cosinephidaughterstarminuspsi = eventplaneVec.Dot(threeVecDauCMXY) / std::sqrt(threeVecDauCMXY.Mag2()) / std::sqrt(eventplaneVec.Mag2()); - // auto SA = (2.0 * cosinephidaughterstarminuspsi * cosinephidaughterstarminuspsi) - 1.0; - auto cosPhistarminuspsi = GetPhiInRange(fourVecDauCM.Phi() - psiFT0C); - auto SA = TMath::Cos(2.0 * cosPhistarminuspsi); - // auto cosThetaStarOP = TMath::Abs(eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2())); - auto cosThetaStarOP = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); - auto SA_A0 = 1 - (cosThetaStarOP * cosThetaStarOP); - // auto cosThetaStarIP = TMath::Abs(eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2())); - auto cosThetaStarIP = eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2()); auto phiminuspsi = GetPhiInRange(PhiMesonMother.Phi() - psiFT0C); auto v2 = TMath::Cos(2.0 * phiminuspsi); - if (!fillRapidity) { - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_costheta_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarIP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_A0"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_V2"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - histos.fill(HIST("hSparseV2SASameEvent_SP"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * QFT0C, centrality, occupancy); - } + auto v2sin = TMath::Sin(2.0 * phiminuspsi); + auto phimother = PhiMesonMother.Phi(); + histos.fill(HIST("hpTvsRapidity"), PhiMesonMother.Pt(), PhiMesonMother.Rapidity()); + if (TMath::Abs(PhiMesonMother.Rapidity()) < confRapidity) { + histos.fill(HIST("hSparseV2SameEventCosDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * QFT0C, centrality); + histos.fill(HIST("hSparseV2SameEventSinDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2sin * QFT0C, centrality); - if (fillRapidity) { - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_costheta_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarIP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_A0"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_V2"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - } - } - Npostrack = Npostrack + 1; - } - } - PROCESS_SWITCH(phipbpb, processSameEvent, "Process Same event", true); - void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& /*tracks*/) - { - BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass, axisOccup}, true}; - for (auto const& [collision1, collision2] : o2::soa::selfCombinations(binningOnPositions, cfgNoMixedEvents, -1, collisions, collisions)) { - if (!collision1.sel8() || !collision2.sel8()) { - // printf("Mix = %d\n", 1); - continue; - } - if (!collision1.triggereventep() || !collision2.triggereventep()) { - // printf("Mix = %d\n", 2); - continue; - } - if (timFrameEvsel && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - // printf("Mix = %d\n", 3); - continue; - } - if (additionalEvSel2 && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - if (additionalEvSel2 && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - int occupancy = collision1.trackOccupancyInTimeRange(); - auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - auto centrality = collision1.centFT0C(); - auto centrality2 = collision2.centFT0C(); - auto psiFT0C = collision1.psiFT0C(); - auto QFT0C = collision1.qFT0C(); - if (additionalEvsel && !eventSelected(collision1, centrality)) { - // printf("Mix = %d\n", 4); - continue; - } - if (additionalEvsel && !eventSelected(collision2, centrality2)) { - // printf("Mix = %d\n", 5); - continue; - } - for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(posThisColl, negThisColl))) { - // track selection - if (!selectionTrack(track1) || !selectionTrack(track2)) { - // printf("Mix = %d\n", 6); - continue; - } - // PID check - if (ispTdepPID && (!selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2))) { - // printf("Mix = %d\n", 7); - continue; - } - if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { - continue; - } - if (!selectionPair(track1, track2)) { - // printf("Mix = %d\n", 8); - continue; - } - if (removefaketrak && isFakeKaon(track1)) { - continue; - } - if (removefaketrak && isFakeKaon(track2)) { - continue; - } - KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); - PhiMesonMother = KaonPlus + KaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { - continue; + histos.fill(HIST("hSparseV2SameEventCosPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Cos(2.0 * phimother), centrality); + histos.fill(HIST("hSparseV2SameEventSinPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Sin(2.0 * phimother), centrality); + histos.fill(HIST("hSparseV2SameEventCosPsi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Cos(2.0 * psiFT0C), centrality); + histos.fill(HIST("hSparseV2SameEventSinPsi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Sin(2.0 * psiFT0C), centrality); } ROOT::Math::Boost boost{PhiMesonMother.BoostToCM()}; fourVecDauCM = boost(KaonMinus); @@ -633,67 +478,39 @@ struct phipbpb { threeVecDauCMXY = ROOT::Math::XYZVector(threeVecDauCM.X(), threeVecDauCM.Y(), 0.); eventplaneVec = ROOT::Math::XYZVector(std::cos(2.0 * psiFT0C), std::sin(2.0 * psiFT0C), 0); eventplaneVecNorm = ROOT::Math::XYZVector(std::sin(2.0 * psiFT0C), -std::cos(2.0 * psiFT0C), 0); - - // auto cosinephidaughterstarminuspsi = eventplaneVec.Dot(threeVecDauCMXY) / std::sqrt(threeVecDauCMXY.Mag2()) / std::sqrt(eventplaneVec.Mag2()); - // auto SA = (2.0 * cosinephidaughterstarminuspsi * cosinephidaughterstarminuspsi) - 1.0; auto cosPhistarminuspsi = GetPhiInRange(fourVecDauCM.Phi() - psiFT0C); auto SA = TMath::Cos(2.0 * cosPhistarminuspsi); - // auto cosThetaStarOP = TMath::Abs(eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2())); - auto cosThetaStarOP = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); - auto SA_A0 = 1 - (cosThetaStarOP * cosThetaStarOP); - // auto cosThetaStarIP = TMath::Abs(eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2())); - auto cosThetaStarIP = eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2()); - auto phiminuspsi = GetPhiInRange(PhiMesonMother.Phi() - psiFT0C); - auto v2 = TMath::Cos(2.0 * phiminuspsi); - if (!fillRapidity) { - histos.fill(HIST("hSparseV2SAMixedEvent_costhetastarOP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_costheta_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_costhetastarIP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SA_A0"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_V2"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SP"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * QFT0C, centrality, occupancy); - } - if (fillRapidity) { - histos.fill(HIST("hSparseV2SAMixedEvent_costhetastarOP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_costheta_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_costhetastarIP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SA_A0"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_V2"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - } + auto cosThetaStar = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); + histos.fill(HIST("hSparseV2SameEventSA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); + histos.fill(HIST("hSparseV2SameEventCosThetaStar"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStar, TMath::Abs(PhiMesonMother.Rapidity()), centrality); } + Npostrack = Npostrack + 1; } } - PROCESS_SWITCH(phipbpb, processMixedEvent, "Process Mixed event", true); + PROCESS_SWITCH(phipbpb, processSameEvent, "Process Same event", true); void processMixedEventOpti(EventCandidates const& collisions, TrackCandidates const& tracks) { auto tracksTuple = std::make_tuple(tracks); BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass, axisOccup}, true}; SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; for (auto& [collision1, tracks1, collision2, tracks2] : pair) { - if (!collision1.sel8() || !collision2.sel8()) { + if (!collision1.sel8() || !collision1.triggereventep() || !collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (!collision1.triggereventep() || !collision2.triggereventep()) { + if (!collision2.sel8() || !collision2.triggereventep() || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (timFrameEvsel && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (collision1.bcId() == collision2.bcId()) { continue; } - if (additionalEvSel2 && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - return; - } - if (additionalEvSel3 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - return; - } - if (additionalEvSel2 && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - return; + int occupancy1 = collision1.trackOccupancyInTimeRange(); + int occupancy2 = collision2.trackOccupancyInTimeRange(); + if (occupancy1 > cfgCutOccupancy) { + continue; } - if (additionalEvSel3 && (!collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - return; + if (occupancy2 > cfgCutOccupancy) { + continue; } - int occupancy = collision1.trackOccupancyInTimeRange(); auto centrality = collision1.centFT0C(); auto centrality2 = collision2.centFT0C(); auto psiFT0C = collision1.psiFT0C(); @@ -735,10 +552,14 @@ struct phipbpb { KaonMinus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); KaonPlus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); } - PhiMesonMother = KaonPlus + KaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { - continue; + auto phiminuspsi = GetPhiInRange(PhiMesonMother.Phi() - psiFT0C); + auto v2 = TMath::Cos(2.0 * phiminuspsi); + auto v2sin = TMath::Sin(2.0 * phiminuspsi); + histos.fill(HIST("hpTvsRapidity"), PhiMesonMother.Pt(), PhiMesonMother.Rapidity()); + if (TMath::Abs(PhiMesonMother.Rapidity()) < confRapidity) { + histos.fill(HIST("hSparseV2MixedEventCosDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * QFT0C, centrality); + histos.fill(HIST("hSparseV2MixedEventSinDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2sin * QFT0C, centrality); } ROOT::Math::Boost boost{PhiMesonMother.BoostToCM()}; fourVecDauCM = boost(KaonMinus); @@ -746,33 +567,11 @@ struct phipbpb { threeVecDauCMXY = ROOT::Math::XYZVector(threeVecDauCM.X(), threeVecDauCM.Y(), 0.); eventplaneVec = ROOT::Math::XYZVector(std::cos(2.0 * psiFT0C), std::sin(2.0 * psiFT0C), 0); eventplaneVecNorm = ROOT::Math::XYZVector(std::sin(2.0 * psiFT0C), -std::cos(2.0 * psiFT0C), 0); - auto cosPhistarminuspsi = GetPhiInRange(fourVecDauCM.Phi() - psiFT0C); auto SA = TMath::Cos(2.0 * cosPhistarminuspsi); - // auto cosThetaStarOP = TMath::Abs(eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2())); - auto cosThetaStarOP = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); - auto SA_A0 = 1 - (cosThetaStarOP * cosThetaStarOP); - // auto cosThetaStarIP = TMath::Abs(eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2())); - auto cosThetaStarIP = eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2()); - auto phiminuspsi = GetPhiInRange(PhiMesonMother.Phi() - psiFT0C); - auto v2 = TMath::Cos(2.0 * phiminuspsi); - if (!fillRapidity) { - histos.fill(HIST("hSparseV2SAMixedEvent_costhetastarOP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_costheta_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_costhetastarIP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SA_A0"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_V2"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SP"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * QFT0C, centrality, occupancy); - } - if (fillRapidity) { - histos.fill(HIST("hSparseV2SAMixedEvent_costhetastarOP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_costheta_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_costhetastarIP"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_SA_A0"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SAMixedEvent_V2"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - } + auto cosThetaStar = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); + histos.fill(HIST("hSparseV2MixedEventSA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); + histos.fill(HIST("hSparseV2MixedEventCosThetaStar"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStar, TMath::Abs(PhiMesonMother.Rapidity()), centrality); } } } @@ -795,7 +594,8 @@ struct phipbpb { histos.fill(HIST("hMC"), 4); continue; } - if (timFrameEvsel && (!RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + + if (!RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { histos.fill(HIST("hMC"), 5); continue; } @@ -890,10 +690,6 @@ struct phipbpb { KaonPlus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); } PhiMesonMother = KaonPlus + KaonMinus; - - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { - continue; - } ROOT::Math::Boost boost{PhiMesonMother.BoostToCM()}; fourVecDauCM = boost(KaonMinus); threeVecDauCM = fourVecDauCM.Vect(); @@ -903,32 +699,9 @@ struct phipbpb { eventplaneVecNorm = ROOT::Math::XYZVector(std::sin(2.0 * psiFT0C), -std::cos(2.0 * psiFT0C), 0); auto cosPhistarminuspsi = GetPhiInRange(fourVecDauCM.Phi() - psiFT0C); auto SA = TMath::Cos(2.0 * cosPhistarminuspsi); - // auto cosThetaStarOP = TMath::Abs(eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2())); - auto cosThetaStarIP = eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2()); - auto cosThetaStarOP = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); - auto cosThetaStarOPbeam = beamvector.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(beamvector.Mag2()); - auto SA_A0 = 1 - (cosThetaStarOP * cosThetaStarOP); - // auto cosThetaStarIP = TMath::Abs(eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2())); - auto phiminuspsi = GetPhiInRange(PhiMesonMother.Phi() - psiFT0C); - auto v2 = TMath::Cos(2.0 * phiminuspsi); - if (!fillRapidity) { - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP_beam_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOPbeam, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_costheta_SA_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarIP_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_A0_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_V2_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - } - if (fillRapidity) { - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP_beam_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOPbeam, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_costheta_SA_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarIP_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_A0_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_V2_MCRec"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - } + auto cosThetaStar = eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2()); + histos.fill(HIST("hSparseV2MCRecCosThetaStar_effy"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStar, TMath::Abs(PhiMesonMother.Rapidity()), centrality); + histos.fill(HIST("hSparseV2MCRecSA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); } } } @@ -980,30 +753,9 @@ struct phipbpb { eventplaneVecNorm = ROOT::Math::XYZVector(std::sin(2.0 * psiFT0C), -std::cos(2.0 * psiFT0C), 0); auto cosPhistarminuspsi = GetPhiInRange(fourVecDauCM.Phi() - psiFT0C); auto SA = TMath::Cos(2.0 * cosPhistarminuspsi); - auto cosThetaStarIP = eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2()); - auto cosThetaStarOP = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); - auto cosThetaStarOPbeam = beamvector.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(beamvector.Mag2()); - auto SA_A0 = 1 - (cosThetaStarOP * cosThetaStarOP); - auto phiminuspsi = GetPhiInRange(PhiMesonMother.Phi() - psiFT0C); - auto v2 = TMath::Cos(2.0 * phiminuspsi); - if (!fillRapidity) { - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP_beam_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOPbeam, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_costheta_SA_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarIP_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_A0_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, phiminuspsi, centrality); - histos.fill(HIST("hSparseV2SASameEvent_V2_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - } - if (fillRapidity) { - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarOP_beam_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOPbeam, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_costheta_SA_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarOP * cosThetaStarOP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_costhetastarIP_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStarIP, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_SA_A0_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA_A0, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SASameEvent_V2_MCGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); - } + auto cosThetaStar = eventplaneVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVec.Mag2()); + histos.fill(HIST("hSparseV2MCGenCosThetaStar_effy"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStar, TMath::Abs(PhiMesonMother.Rapidity()), centrality); + histos.fill(HIST("hSparseV2MCGenSA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); } } } // rec collision loop diff --git a/PWGLF/Tasks/Resonances/xi1530Analysis.cxx b/PWGLF/Tasks/Resonances/xi1530Analysis.cxx index be3c24b8ffb..73694dda058 100644 --- a/PWGLF/Tasks/Resonances/xi1530Analysis.cxx +++ b/PWGLF/Tasks/Resonances/xi1530Analysis.cxx @@ -15,6 +15,7 @@ #include #include +#include #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Centrality.h" @@ -342,7 +343,7 @@ struct cascadeXiAnalysis { for (auto const& casc : cascTracks) { histos.fill(HIST("QA_Casc_Xi/h1d_mass_Xi"), casc.mXi()); histos.fill(HIST("QA_Casc_Xi/h1d_v0_radius"), casc.transRadius()); - histos.fill(HIST("QA_Casc_Xi/h1d_casc_radius"), casc.casctransRadius()); + histos.fill(HIST("QA_Casc_Xi/h1d_casc_radius"), casc.cascTransRadius()); histos.fill(HIST("QA_Casc_Xi/h1d_v0_cosPA"), casc.v0CosPA()); histos.fill(HIST("QA_Casc_Xi/h1d_casc_cosPA"), casc.cascCosPA()); histos.fill(HIST("QA_Casc_Xi/h1d_dca_postoPV"), casc.dcapostopv()); @@ -350,7 +351,7 @@ struct cascadeXiAnalysis { histos.fill(HIST("QA_Casc_Xi/h1d_dca_bachtoPV"), casc.dcabachtopv()); histos.fill(HIST("QA_Casc_Xi/h1d_dca_v0toPV"), casc.dcav0topv()); histos.fill(HIST("QA_Casc_Xi/h1d_dca_v0_dau"), casc.daughDCA()); - histos.fill(HIST("QA_Casc_Xi/h1d_dca_casc_dau"), casc.cascdaughDCA()); + histos.fill(HIST("QA_Casc_Xi/h1d_dca_casc_dau"), casc.cascDaughDCA()); } fillDataHisto(cascTracks, resoTracks, resoCollision.cent()); diff --git a/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx b/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx new file mode 100644 index 00000000000..0e90a84101e --- /dev/null +++ b/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx @@ -0,0 +1,1011 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file xi1530Analysisqa.cxx +/// \brief Reconstruction of Xi* resonance. +/// +/// \author Min-jae Kim , Bong-Hwi Lim +#include +#include "TF1.h" +#include "TRandom3.h" + +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/runDataProcessing.h" +#include "PWGLF/DataModel/LFResonanceTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/RecoDecay.h" +#include "Framework/O2DatabasePDGPlugin.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; +Service pdgDB; + +enum { + kData = 0, + kLS, + kMixing, + kMCReco, + kMCTrue, + kMCTruePS, + kINEL10, + kINELg010, + kAllType +}; + +enum { + PionPID = 211, + XiPID = 3312, + XiStarPID = 3324 +}; + +struct xi1530analysisqa { + + // Basic set-up // + Configurable cMassXiminus{"cMassXiminus", 1.32171, "Mass of Xi baryon"}; + SliceCache cache; + Preslice perRCol = aod::resodaughter::resoCollisionId; + Preslice perCollision = aod::track::collisionId; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + using ResoMCCols = soa::Join; + + // associated with histograms + ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; + ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + + Configurable cInvMassStart{"cInvMassStart", 1.4, "Invariant mass start"}; + Configurable cInvMassEnd{"cInvMassEnd", 1.8, "Invariant mass end"}; + Configurable cInvMassBins{"cInvMassBins", 200, "Invariant mass binning"}; + + Configurable cPIDBins{"cPIDBins", 130, "PID binning"}; + Configurable cPIDQALimit{"cPIDQALimit", 6.5, "PID QA limit"}; + Configurable cDCABins{"cDCABins", 150, "DCA binning"}; + + Configurable invmass1D{"invmass1D", true, "Invariant mass 1D"}; + Configurable study_antiparticle{"study_antiparticle", true, "Study anti-particles separately"}; + Configurable PIDplots{"PIDplots", true, "Make TPC and TOF PID plots"}; + + Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; + Configurable additionalQAeventPlots{"additionalQAeventPlots", true, "Additional QA event plots"}; + Configurable additionalMEPlots{"additionalMEPlots", true, "Additional Mixed event plots"}; + + // Event Mixing + Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; + ConfigurableAxis CfgVtxBins{"CfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - z-vertex"}; + + //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// + + // Track selections (Execpt DCA selelctions) // + + // Primary track selections + Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; + Configurable cMaxetacut{"cMaxetacut", 0.8, "Track maximum eta cut"}; + + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; + Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; + Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; + + Configurable tof_at_high_pt{"tof_at_high_pt", false, "Use TOF at high pT"}; + + Configurable cfgITScluster{"cfgITScluster", 1, "Minimum Number of ITS cluster"}; // Minmimum + Configurable cfgTPCcluster{"cfgTPCcluster", 1, "Minimum Number of TPC cluster"}; // Minmimum + + Configurable cfgTPCRows{"cfgTPCRows", 70, "Minimum Number of TPC Crossed Rows "}; + Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.8, "Minimum of TPC Crossed Rows to Findable Clusters"}; // Minmimum + + Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 4.0, "Maximum ITS Chi2/NCl"}; // Maximum + Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 4.0, "Maximum TPC Chi2/NCl"}; // Maximum + + Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; + Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; + + Configurable cfgHasITS{"cfgHasITS", true, "Require ITS"}; + Configurable cfgHasTPC{"cfgHasTPC", true, "Require TPC"}; + Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; + + //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// + + // DCA selections // + + // Primary track DCAr to PV + Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; + + // Primary track DCAz to PV + Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + Configurable cMinDCAzToPVcut{"cMinDCAzToPVcut", 0.0, "Track DCAz cut to PV Minimum"}; + + // Topological selections for V0 + Configurable cDCALambdaDaugtherscut{"cDCALambdaDaugtherscut", 1.4, "Lambda dauthers DCA cut"}; + Configurable cDCALambdaToPVcut{"cDCALambdaToPVcut", 0.07, "Lambda DCA cut to PV"}; + Configurable cDCAPionToPVcut{"cMinDCApion", 0.05, "pion DCA cut to PV"}; + Configurable cDCAProtonToPVcut{"cMinDCAproton", 0.05, "proton DCA cut to PV"}; + Configurable cCosV0cut{"cCosV0cut", 0.97, "Cosine Pointing angle for V0"}; + Configurable cMaxV0radiuscut{"cMaxV0radiuscut", 100., "V0 radius cut Maximum"}; + Configurable cMinV0radiuscut{"cMinV0radiuscut", 0.2, "V0 radius cut Minimum"}; + // Configurable cMasswindowV0cut{"cV0Masswindowcut", 0.007, "V0 Mass window cut"}; // How to ? + + // Topological selections for Cascade + Configurable cDCABachlorToPVcut{"cDCABachlorToPVcut", 0.015, "Bachelor DCA cut to PV"}; + Configurable cDCAXiDaugtherscut{"cDCAXiDaugtherscut", 1.6, "Xi- DCA cut to PV"}; + Configurable cCosPACasc{"cCosPACasc", 0.97, "Cosine Pointing angle for Cascade"}; + Configurable cMaxCascradiuscut{"cMaxCascradiuscut", 100., "Cascade radius cut Maximum"}; + Configurable cMinCascradiuscut{"cMinCascradiuscut", 0.2, "Cascade radius cut Minimum"}; + Configurable cMasswindowCasccut{"cMasswindowCasccut", 0.007, "Cascade Mass window cut"}; + + //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// + + // PID Selections// + + Configurable cPIDBound{"cPIDBound", 6.349, "configurable for replacing to .has"}; + + // PID Selections for Pion First + Configurable cMaxTPCnSigmaPionFirst{"cMaxTPCnSigmaPionFirst", 3.0, "TPC nSigma cut for Pion First"}; + Configurable cMaxTOFnSigmaPionFirst{"cMaxTOFnSigmaPionFirst", 3.0, "TOF nSigma cut for Pion First"}; + + Configurable nsigmaCutCombinedPionFirst{"nsigmaCutCombinedPionFirst", -4.0, "Combined nSigma cut for Pion First"}; + + Configurable cUseOnlyTOFTrackPionFirst{"cUseOnlyTOFTrackPionFirst", false, "Use only TOF track for PID selection Pion First"}; + Configurable cByPassTOFPionFirst{"cByPassTOFPionFirst", false, "By pass TOF Pion First PID selection"}; + + // PID Selections for Pion Bachelor + Configurable cMaxTPCnSigmaPionBachelor{"cMaxTPCnSigmaPionBachelor", 3.0, "TPC nSigma cut for Pion Bachelor"}; + Configurable cMaxTOFnSigmaPionBachelor{"cMaxTOFnSigmaPionBachelor", 3.0, "TOF nSigma cut for Pion Bachelor"}; + + Configurable nsigmaCutCombinedPionBachelor{"nsigmaCutCombinedPionBachelor", -4.0, "Combined nSigma cut for Pion Bachelor"}; + + Configurable cUseOnlyTOFTrackPionBachelor{"cUseOnlyTOFTrackPionBachelor", false, "Use only TOF track for PID selection Pion Bachelor"}; + Configurable cByPassTOFPionBachelor{"cByPassTOFPionBachelor", false, "By pass TOF Pion Bachelor PID selection"}; + + // PID Selections for Pion + Configurable cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; + Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; + + Configurable nsigmaCutCombinedPion{"nsigmaCutCombinedPion", -4.0, "Combined nSigma cut for Pion"}; + + Configurable cUseOnlyTOFTrackPion{"cUseOnlyTOFTrackPion", false, "Use only TOF track for PID selection Pion"}; + Configurable cByPassTOFPion{"cByPassTOFPion", false, "By pass TOF Pion PID selection"}; + + // PID Selections for Proton + Configurable cMaxTPCnSigmaProton{"cMaxTPCnSigmaProton", 3.0, "TPC nSigma cut for Proton"}; + Configurable cMaxTOFnSigmaProton{"cMaxTOFnSigmaProton", 3.0, "TOF nSigma cut for Proton"}; + + Configurable nsigmaCutCombinedProton{"nsigmaCutCombinedProton", -4.0, "Combined nSigma cut for Proton"}; + + Configurable cUseOnlyTOFTrackProton{"cUseOnlyTOFTrackProton", false, "Use only TOF track for PID selection Proton"}; + Configurable cByPassTOFProton{"cByPassTOFProton", false, "By pass TOF Proton PID selection"}; + + //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// + + // MC Event selection // + Configurable cZvertCutMC{"cZvertCutMC", 10.0, "MC Z-vertex cut"}; + + //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// + + // Cuts on mother particle + Configurable cfgCutsOnMother{"cfgCutsOnMother", true, "Enamble additional cuts on mother"}; + Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 15.0, "Maximum pt of mother cut"}; + Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 2.1, "Maximum Minv of mother cut"}; + TRandom* rn = new TRandom(); + + //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// + + struct PIDSelectionParam { + double cMaxTPCnSigma; + double cMaxTOFnSigma; + bool cByPassTOF; + double nsigmaCutCombined; + }; + + void init(o2::framework::InitContext&) + { + AxisSpec centAxis = {binsCent, "FT0M (%)"}; + AxisSpec dcaxyAxis = {cDCABins, 0.0, 3.0, "DCA_{#it{xy}} (cm)"}; + AxisSpec dcazAxis = {cDCABins, 0.0, 3.0, "DCA_{#it{z}} (cm)"}; + AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; + AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisQA = {binsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^2)"}; + AxisSpec pidQAAxis = {cPIDBins, -cPIDQALimit, cPIDQALimit}; + AxisSpec FlagAxis = {9, 0, 9, "Flags"}; + + if (additionalQAeventPlots) { + // Test on Mixed event + histos.add("TestME/hCollisionIndexSameE", "coll index sameE", HistType::kTH1F, {{500, 0.0f, 500.0f}}); + histos.add("TestME/hCollisionIndexMixedE", "coll index mixedE", HistType::kTH1F, {{500, 0.0f, 500.0f}}); + + histos.add("TestME/hnTrksSameE", "n tracks per event SameE", HistType::kTH1F, {{1000, 0.0f, 1000.0f}}); + histos.add("TestME/hnTrksMixedE", "n tracks per event MixedE", HistType::kTH1F, {{1000, 0.0f, 1000.0f}}); + + histos.add("TestME/hPairsCounterSameE", "tot n pairs sameE", HistType::kTH1F, {{1, 0.5f, 1.5f}}); + histos.add("TestME/hPairsCounterMixedE", "tot n pairs mixedE", HistType::kTH1F, {{1, 0.5f, 1.5f}}); + + // event histograms + histos.add("QAevent/hEvtCounterSameE", "Number of analyzed Same Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + histos.add("QAevent/hVertexZSameE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15., 15.}}); + histos.add("QAevent/hMultiplicityPercentSameE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); + + histos.add("QAevent/hEvtCounterMixedE", "Number of analyzed Mixed Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + histos.add("QAevent/hVertexZMixedE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15., 15.}}); + histos.add("QAevent/hMultiplicityPercentMixedE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); + } + + if (invmass1D) { + histos.add("Xi1530invmassDS", "Invariant mass of Xi(1530)0 differnt sign", kTH1F, {invMassAxis}); + histos.add("Xi1530invmassLS", "Invariant mass of Xi(1530)0 like sign", kTH1F, {invMassAxis}); + histos.add("Xi1530invmassME", "Invariant mass of Xi(1530)0 mixed event", kTH1F, {invMassAxis}); + + if (study_antiparticle) { + histos.add("Xi1530invmassDSAnti", "Invariant mass of Anti-Xi(1530)0 differnt sign", kTH1F, {invMassAxis}); + histos.add("Xi1530invmassLSAnti", "Invariant mass of Anti-Xi(1530)0 like sign", kTH1F, {invMassAxis}); + } + } + + if (additionalMEPlots) { + histos.add("Xi1530invmassME_DS", "Invariant mass of Xi(1530)0 mixed event DS", kTH1F, {invMassAxis}); + histos.add("Xi1530invmassME_DSAnti", "Invariant mass of Xi(1530)0 mixed event DSAnti", kTH1F, {invMassAxis}); + } + + if (additionalQAplots) { + // TPC ncluster distirbutions + histos.add("TPCncluster/TPCnclusterpifirst", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); + + histos.add("TPCncluster/TPCnclusterPhipifirst", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + } + + // DCA QA to candidates for first pion and Xi- + histos.add("QAbefore/trkDCAxy_pi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAbefore/trkDCAxy_Xi", "DCAxy distribution of Xi- track candidates", HistType::kTH1F, {dcaxyAxis}); + + histos.add("QAbefore/trkDCAz_pi", "DCAz distribution of pion track candidates", HistType::kTH1F, {dcazAxis}); + histos.add("QAbefore/trkDCAz_Xi", "DCAz distribution of Xi- track candidates", HistType::kTH1F, {dcazAxis}); + + histos.add("QAafter/trkDCAxy_pi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAafter/trkDCAxy_Xi", "DCAxy distribution of Xi- track candidates", HistType::kTH1F, {dcaxyAxis}); + + histos.add("QAafter/trkDCAz_pi", "DCAz distribution of pion track candidates", HistType::kTH1F, {dcazAxis}); + histos.add("QAafter/trkDCAz_Xi", "DCAz distribution of Xi- track candidates", HistType::kTH1F, {dcazAxis}); + + // pT QA to candidates for first pion, Xi + histos.add("QAbefore/trkpT_pi", "pT distribution of pion track candidates", kTH1F, {ptAxis}); + histos.add("QAbefore/trkpT_Xi", "pT distribution of Xi- track candidates", kTH1F, {ptAxis}); + + histos.add("QAafter/trkpT_pi", "pT distribution of pion track candidates", kTH1F, {ptAxis}); + histos.add("QAafter/trkpT_Xi", "pT distribution of Xi- track candidates", kTH1F, {ptAxis}); + + if (PIDplots) { + + // Plots for QA before, Need to pt info. for the daugthers + histos.add("QAbefore/TOF_TPC_Map_pi_first_all", "TOF + TPC Combined PID for Pion_{First};#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAbefore/TOF_Nsigma_pi_first_all", "TOF NSigma for Pion_{First};#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAbefore/TPC_Nsigma_pi_first_all", "TPC NSigma for Pion_{First};#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAbefore/TOF_TPC_Map_pi_bachelor_all", "TOF + TPC Combined PID for Pion_{Bachelor};#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAbefore/TPC_Nsigma_pi_bachelor_all", "TPC NSigma for Pion_{Bachelor};#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAbefore/TOF_TPC_Map_pr_all", "TOF + TPC Combined PID for Proton;#sigma_{TOF}^{Proton};#sigma_{TPC}^{Proton}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAbefore/TOF_TPC_Map_antipr_all", "TOF + TPC Combined PID for Anti-Proton;#sigma_{TOF}^{Proton};#sigma_{TPC}^{Proton}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + + histos.add("QAbefore/TPC_Nsigma_pr_all", "TPC NSigma for Proton;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Proton};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAbefore/TPC_Nsigma_antipr_all", "TPC NSigma for Anti-Proton;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Proton};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAbefore/TOF_TPC_Map_pi_all", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAbefore/TOF_TPC_Map_piminus_all", "TOF + TPC Combined PID for Pion -;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + + histos.add("QAbefore/TPC_Nsigma_pi_all", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAbefore/TPC_Nsigma_piminus_all", "TPC NSigma for Pion -;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + // Plots for QA after + histos.add("QAafter/TOF_TPC_Map_pi_first_all", "TOF + TPC Combined PID for Pion_{First};#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAafter/TOF_Nsigma_pi_first_all", "TOF NSigma for Pion_{First};#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAafter/TPC_Nsigma_pi_first_all", "TPC NSigma for Pion_{First};#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAafter/TOF_TPC_Map_pi_bachelor_all", "TOF + TPC Combined PID for Pion_{Bachelor};#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAafter/TPC_Nsigma_pi_bachelor_all", "TPC NSigma for Pion_{Bachelor};#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAafter/TOF_TPC_Map_pr_all", "TOF + TPC Combined PID for Proton;#sigma_{TOF}^{Proton};#sigma_{TPC}^{Proton}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAafter/TOF_TPC_Map_antipr_all", "TOF + TPC Combined PID for Anti-Proton;#sigma_{TOF}^{Proton};#sigma_{TPC}^{Proton}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + + histos.add("QAafter/TPC_Nsigma_pr_all", "TPC NSigma for Proton;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Proton};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAafter/TPC_Nsigma_antipr_all", "TPC NSigma for Anti-Proton;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Proton};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAafter/TOF_TPC_Map_pi_all", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAafter/TOF_TPC_Map_piminus_all", "TOF + TPC Combined PID for Pion -;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + + histos.add("QAafter/TPC_Nsigma_pi_all", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAafter/TPC_Nsigma_piminus_all", "TPC NSigma for Pion -;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + } + + // 3d histogram + Flags + histos.add("h3Xi1530invmassDS", "Invariant mass of Xi(1530)0 differnt sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + histos.add("h3Xi1530invmassLS", "Invariant mass of Xi(1530)0 same sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + histos.add("h3Xi1530invmassME", "Invariant mass of Xi(1530)0 mixed event", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + + if (study_antiparticle) { + histos.add("h3Xi1530invmassDSAnti", "Invariant mass of Anti-Xi(1530)0 differnt sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + histos.add("h3Xi1530invmassLSAnti", "Invariant mass of Anti-Xi(1530)0 same sign", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + } + + if (additionalMEPlots) { + histos.add("h3Xi1530invmassME_DS", "Invariant mass of Xi(1530)0 mixed event DS", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + histos.add("h3Xi1530invmassME_DSAnti", "Invariant mass of Xi(1530)0 mixed event DSAnti", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + } + + if (doprocessMC) { + // MC QA + histos.add("QAMCTrue/trkDCAxy_pi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAMCTrue/trkDCAxy_xi", "DCAxy distribution of Xi- track candidates", HistType::kTH1F, {dcaxyAxis}); + + histos.add("QAMCTrue/trkDCAz_pi", "DCAz distribution of pion track candidates", HistType::kTH1F, {dcazAxis}); + histos.add("QAMCTrue/trkDCAz_xi", "DCAz distribution of Xi- track candidates", HistType::kTH1F, {dcazAxis}); + + if (PIDplots) { + histos.add("QAMCTrue/TOF_TPC_Map_pi_first_all", "TOF + TPC Combined PID for Pion_{First};#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAMCTrue/TOF_Nsigma_pi_first_all", "TOF NSigma for Pion_{First};#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TPC_Nsigma_pi_first_all", "TPC NSigma for Pion_{First};#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAMCTrue/TOF_TPC_Map_pi_bachelor_all", "TOF + TPC Combined PID for Pion_{Bachelor};#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAMCTrue/TPC_Nsigma_pi_bachelor_all", "TPC NSigma for Pion_{Bachelor};#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAMCTrue/TOF_TPC_Map_pr_all", "TOF + TPC Combined PID for Proton;#sigma_{TOF}^{Proton};#sigma_{TPC}^{Proton}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAMCTrue/TOF_TPC_Map_antipr_all", "TOF + TPC Combined PID for Anti-Proton;#sigma_{TOF}^{Proton};#sigma_{TPC}^{Proton}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + + histos.add("QAMCTrue/TPC_Nsigma_pr_all", "TPC NSigma for Proton;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Proton};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TPC_Nsigma_antipr_all", "TPC NSigma for Anti-Proton;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Proton};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + + histos.add("QAMCTrue/TOF_TPC_Map_pi_all", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + histos.add("QAMCTrue/TOF_TPC_Map_piminus_all", "TOF + TPC Combined PID for Pion -;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + + histos.add("QAMCTrue/TPC_Nsigma_pi_all", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TPC_Nsigma_piminus_all", "TPC NSigma for Pion -;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); + } + + histos.add("h3RecXi1530invmass", "Invariant mass of Reconstructed MC Xi(1530)0", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + histos.add("h3RecXi1530invmassAnti", "Invariant mass of Reconstructed MC Anti-Xi(1530)0", kTHnSparseF, {centAxis, ptAxis, invMassAxis, FlagAxis}); + + histos.add("h3Xi1530Gen", "pT distribution of True MC Xi(1530)0", kTHnSparseF, {mcLabelAxis, ptAxis, centAxis, FlagAxis}); + histos.add("h3Xi1530GenAnti", "pT distribution of True MC Anti-Xi(1530)0", kTHnSparseF, {mcLabelAxis, ptAxis, centAxis, FlagAxis}); + + histos.add("Xi1530Rec", "pT distribution of Reconstructed MC Xi(1530)0", kTH2F, {ptAxis, centAxis}); + histos.add("Xi1530RecAnti", "pT distribution of Reconstructed MC Anti-Xi(1530)0", kTH2F, {ptAxis, centAxis}); + histos.add("Xi1530Recinvmass", "Inv mass distribution of Reconstructed MC Xi(1530)0", kTH1F, {invMassAxis}); + } + } + + double massPi = MassPionCharged; + + // Primary track selection for the first pion // + template + bool PtrackCut(const TrackType track) + { + if (std::abs(track.eta()) > cMaxetacut) + return false; + if (std::abs(track.pt()) < cMinPtcut) + return false; + if (std::abs(track.dcaXY()) > cMaxDCArToPVcut) + return false; + if (std::abs(track.dcaZ()) > cMaxDCAzToPVcut) + return false; + if (track.itsNCls() < cfgITScluster) + return false; + if (track.tpcNClsFound() < cfgTPCcluster) + return false; + if (track.tpcNClsCrossedRows() < cfgTPCRows) + return false; + if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) + return false; + if (track.itsChi2NCl() >= cfgITSChi2NCl) + return false; + if (track.tpcChi2NCl() >= cfgTPCChi2NCl) + return false; + if (cfgHasITS && !track.hasITS()) + return false; + if (cfgHasTPC && !track.hasTPC()) + return false; + if (cfgHasTOF && !track.hasTOF()) + return false; + if (cfgUseITSRefit && !track.passedITSRefit()) + return false; + if (cfgUseTPCRefit && !track.passedTPCRefit()) + return false; + if (cfgPVContributor && !track.isPVContributor()) + return false; + if (cfgPrimaryTrack && !track.isPrimaryTrack()) + return false; + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (cfgGlobalTrack && !track.isGlobalTrack()) + return false; + + return true; + } + + bool hasSubsystemInfo(float Nsigma) // this will be replaced // .hasXX() was not appied in resocascade yet + { + return std::abs(Nsigma) < cPIDBound; + } + + // Primary track selection for cascades, Need to more informations for cascades // + template + bool cascPtrackCut(const TracksTypeCasc track) + { + if (std::abs(track.eta()) > cMaxetacut) + return false; + if (std::abs(track.pt()) < cMinPtcut) + return false; + if (std::abs(track.dcaXYCascToPV()) > cMaxDCArToPVcut) + return false; + if (std::abs(track.dcaZCascToPV()) > cMaxDCAzToPVcut) + return false; + + return true; + } + + // Secondary track selection for cascades // need to more information, + + // Topological cuts for cascades + template + bool casctopCut(const TracksTypeCasc track) + { + // Topological cuts for V0s + if (std::abs(track.daughDCA()) > cDCALambdaDaugtherscut) + return false; + if (std::abs(track.dcav0topv()) < cDCALambdaToPVcut) + return false; + if (track.sign() < 0) { + if (std::abs(track.dcanegtopv()) < cDCAPionToPVcut) + return false; + if (std::abs(track.dcapostopv()) < cDCAProtonToPVcut) + return false; + } else { + if (std::abs(track.dcanegtopv()) < cDCAProtonToPVcut) + return false; + if (std::abs(track.dcapostopv()) < cDCAPionToPVcut) + return false; + } + if (track.v0CosPA() < cCosV0cut) + return false; + if (track.transRadius() > cMaxV0radiuscut || track.transRadius() < cMinV0radiuscut) + return false; + + // Topological Cuts for Cascades + if (track.dcabachtopv() < cDCABachlorToPVcut) + return false; + if (track.cascDaughDCA() > cDCAXiDaugtherscut) + return false; + if (track.cascCosPA() < cCosPACasc) + return false; + if (track.cascTransRadius() > cMaxCascradiuscut || track.cascTransRadius() < cMinCascradiuscut) + return false; + // if (std::abs(track.mXi() - XiMass) > cMasswindowCasccut) + // return false; + if (std::abs(track.mXi() - cMassXiminus) > cMasswindowCasccut) + return false; + + return true; + } + + bool PIDSelector(float TPCNsigma, float TOFNsigma, const PIDSelectionParam& params, bool tofAtHighPt) + { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + + if (tofAtHighPt) { + // TOF based PID + if (hasSubsystemInfo(TOFNsigma) && std::abs(TOFNsigma) < params.cMaxTOFnSigma) { + return true; + } + if (!hasSubsystemInfo(TOFNsigma) && std::abs(TPCNsigma) < params.cMaxTPCnSigma) { + return true; + } + return false; + } else { + + if (std::abs(TPCNsigma) < params.cMaxTPCnSigma) { + tpcPIDPassed = true; + } + + if (params.cByPassTOF && tpcPIDPassed) { + return true; + } + + if (hasSubsystemInfo(TOFNsigma)) { + if (std::abs(TOFNsigma) < params.cMaxTOFnSigma) { + tofPIDPassed = true; + } + if ((params.nsigmaCutCombined > 0) && + (TPCNsigma * TPCNsigma + TOFNsigma * TOFNsigma < params.nsigmaCutCombined * params.nsigmaCutCombined)) { + tofPIDPassed = true; + } + } else { + tofPIDPassed = true; + } + + return tpcPIDPassed && tofPIDPassed; + } + } + + // PID selection for the First Pion // + template + bool selectionPIDPionFirst(const T& candidate) + { + + float TPCNsigmaPionFirst, TOFNsigmaPionFirst; + + TPCNsigmaPionFirst = candidate.tpcNSigmaPi(); + TOFNsigmaPionFirst = candidate.tofNSigmaPi(); + + PIDSelectionParam PionFirstParams = {cMaxTPCnSigmaPionFirst, cMaxTOFnSigmaPionFirst, cByPassTOFPionFirst, nsigmaCutCombinedPionFirst}; + + return PIDSelector(TPCNsigmaPionFirst, TOFNsigmaPionFirst, PionFirstParams, tof_at_high_pt); + } + + template + bool selectionPIDCascades(const TCascade& candidate) + { + bool lConsistentWithXi{false}, lConsistentWithLambda{false}, lConsistentWithPion{false}, lConsistentWithProton{false}; + + float TPCNsigmaBachelor, TOFNsigmaBachelor; + float TPCNsigmaPion, TOFNsigmaPion; + float TPCNsigmaProton, TOFNsigmaProton; + + if (candidate.sign() < 0) { // Xi- candidates + TPCNsigmaBachelor = candidate.daughterTPCNSigmaBachPi(); + TOFNsigmaBachelor = candidate.daughterTOFNSigmaBachPi(); + + TPCNsigmaPion = candidate.daughterTPCNSigmaNegPi(); + TOFNsigmaPion = candidate.daughterTOFNSigmaNegPi(); + + TPCNsigmaProton = candidate.daughterTPCNSigmaPosPr(); + TOFNsigmaProton = candidate.daughterTOFNSigmaPosPr(); + } else { // Anti-Xi- candidates + + TPCNsigmaBachelor = candidate.daughterTPCNSigmaBachPi(); + TOFNsigmaBachelor = candidate.daughterTOFNSigmaBachPi(); + + TPCNsigmaPion = candidate.daughterTPCNSigmaPosPi(); + TOFNsigmaPion = candidate.daughterTOFNSigmaPosPi(); + + TPCNsigmaProton = candidate.daughterTPCNSigmaNegPr(); + TOFNsigmaProton = candidate.daughterTOFNSigmaNegPr(); + } + + PIDSelectionParam bachelorParams = {cMaxTPCnSigmaPionBachelor, cMaxTOFnSigmaPionBachelor, cByPassTOFPionBachelor, nsigmaCutCombinedPionBachelor}; + PIDSelectionParam pionParams = {cMaxTPCnSigmaPion, cMaxTOFnSigmaPion, cByPassTOFPion, nsigmaCutCombinedPion}; + PIDSelectionParam protonParams = {cMaxTPCnSigmaProton, cMaxTOFnSigmaProton, cByPassTOFProton, nsigmaCutCombinedProton}; + + lConsistentWithXi = PIDSelector(TPCNsigmaBachelor, TOFNsigmaBachelor, bachelorParams, tof_at_high_pt); + lConsistentWithPion = PIDSelector(TPCNsigmaPion, TOFNsigmaPion, pionParams, tof_at_high_pt); + lConsistentWithProton = PIDSelector(TPCNsigmaProton, TOFNsigmaProton, protonParams, tof_at_high_pt); + + lConsistentWithLambda = lConsistentWithProton && lConsistentWithPion; + + return lConsistentWithXi && lConsistentWithLambda; + } + + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksTypeCasc& dTracks2) // Order: ResoColl, ResoTrack, ResoCascTrack + { + auto multiplicity = collision.cent(); + + if (additionalQAeventPlots) { + if constexpr (!IsMix) { + histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), collision.cent()); + histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); + histos.fill(HIST("TestME/hnTrksSameE"), dTracks1.size()); + } else { + histos.fill(HIST("QAevent/hVertexZMixedE"), collision.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), collision.cent()); + histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision.globalIndex()); + histos.fill(HIST("TestME/hnTrksMixedE"), dTracks1.size()); + } + } + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; // It will be replaced to use RecoDecay (In fixing...) + + for (auto& [trk1, trk2] : combinations(CombinationsFullIndexPolicy(dTracks1, dTracks2))) { + + if (additionalQAeventPlots) { + if constexpr (!IsMix) { + histos.fill(HIST("TestME/hPairsCounterSameE"), 1.0); + } else { + histos.fill(HIST("TestME/hPairsCounterMixedE"), 1.0); + } + } + + if (!PtrackCut(trk1) || !cascPtrackCut(trk2)) // Primary track selections + continue; + + auto trk1ptPi = trk1.pt(); + auto trk1NSigmaPiTPC = trk1.tpcNSigmaPi(); + auto trk1NSigmaPiTOF = trk1.tofNSigmaPi(); + + auto trk2ptXi = trk2.pt(); + // Need to daughther's pt info. in the table + // auto trk2ptPiBachelor = trk2.pt(); + float trk2NSigmaPiBachelorTPC = trk2.daughterTPCNSigmaBachPi(); + float trk2NSigmaPiBachelorTOF = trk2.daughterTOFNSigmaBachPi(); + + // auto trk2ptPr = trk2.pt(); + float trk2NSigmaPrPosTPC = trk2.daughterTPCNSigmaPosPr(); + float trk2NSigmaPrNegTPC = trk2.daughterTPCNSigmaNegPr(); + + float trk2NSigmaPrPosTOF = trk2.daughterTOFNSigmaPosPr(); + float trk2NSigmaPrNegTOF = trk2.daughterTOFNSigmaNegPr(); + + // auto trk2ptPi = trk2.pt(); + float trk2NSigmaPiPosTPC = trk2.daughterTPCNSigmaPosPi(); + float trk2NSigmaPiNegTPC = trk2.daughterTPCNSigmaNegPi(); + + float trk2NSigmaPiPosTOF = trk2.daughterTOFNSigmaPosPi(); + float trk2NSigmaPiNegTOF = trk2.daughterTOFNSigmaNegPi(); + + if constexpr (!IsMix) { + //// QA plots before the selection // need to pt for cascade tracks + // --- PID QA + if (PIDplots) { + histos.fill(HIST("QAbefore/TPC_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (hasSubsystemInfo(trk1NSigmaPiTOF)) { + histos.fill(HIST("QAbefore/TOF_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + histos.fill(HIST("QAbefore/TOF_TPC_Map_pi_first_all"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); + } + // hasSubsystemInfo is Temporary, it will be replaced. + + histos.fill(HIST("QAbefore/TPC_Nsigma_pi_bachelor_all"), multiplicity, 0, trk2NSigmaPiBachelorTPC); // can't take pt information for the cascade secondary + if (hasSubsystemInfo(trk2NSigmaPiBachelorTOF)) { + histos.fill(HIST("QAbefore/TOF_TPC_Map_pi_bachelor_all"), trk2NSigmaPiBachelorTOF, trk2NSigmaPiBachelorTPC); + } + + histos.fill(HIST("QAbefore/TPC_Nsigma_pr_all"), multiplicity, 0, trk2NSigmaPrPosTPC); + if (hasSubsystemInfo(trk2NSigmaPrPosTOF)) { + histos.fill(HIST("QAbefore/TOF_TPC_Map_pr_all"), trk2NSigmaPrPosTOF, trk2NSigmaPrPosTPC); + } + + histos.fill(HIST("QAbefore/TPC_Nsigma_antipr_all"), multiplicity, 0, trk2NSigmaPrNegTPC); + if (hasSubsystemInfo(trk2NSigmaPrNegTOF)) { + histos.fill(HIST("QAbefore/TOF_TPC_Map_antipr_all"), trk2NSigmaPrNegTOF, trk2NSigmaPrNegTPC); + } + + histos.fill(HIST("QAbefore/TPC_Nsigma_pi_all"), multiplicity, 0, trk2NSigmaPiPosTPC); + if (hasSubsystemInfo(trk2NSigmaPiPosTOF)) { + histos.fill(HIST("QAbefore/TOF_TPC_Map_pi_all"), trk2NSigmaPiPosTOF, trk2NSigmaPiPosTPC); + } + + histos.fill(HIST("QAbefore/TPC_Nsigma_piminus_all"), multiplicity, 0, trk2NSigmaPiNegTPC); + if (hasSubsystemInfo(trk2NSigmaPiNegTOF)) { + histos.fill(HIST("QAbefore/TOF_TPC_Map_piminus_all"), trk2NSigmaPiNegTOF, trk2NSigmaPiNegTPC); + } + } + + histos.fill(HIST("QAbefore/trkpT_pi"), trk1ptPi); + histos.fill(HIST("QAbefore/trkpT_Xi"), trk2ptXi); + + histos.fill(HIST("QAbefore/trkDCAxy_pi"), trk1.dcaXY()); + histos.fill(HIST("QAbefore/trkDCAxy_Xi"), trk2.dcaXYCascToPV()); + + histos.fill(HIST("QAbefore/trkDCAz_pi"), trk1.dcaZ()); + histos.fill(HIST("QAbefore/trkDCAz_Xi"), trk2.dcaZCascToPV()); + } + + // PID selection + if (cUseOnlyTOFTrackPionFirst && !hasSubsystemInfo(trk1NSigmaPiTOF)) + continue; + + if (cUseOnlyTOFTrackPionBachelor && !hasSubsystemInfo(trk2NSigmaPiBachelorTOF)) + continue; + + if (cUseOnlyTOFTrackProton && !hasSubsystemInfo(trk2NSigmaPrPosTOF)) + continue; + if (cUseOnlyTOFTrackProton && !hasSubsystemInfo(trk2NSigmaPrNegTOF)) + continue; + + if (cUseOnlyTOFTrackPion && !hasSubsystemInfo(trk2NSigmaPiPosTOF)) + continue; + if (cUseOnlyTOFTrackPion && !hasSubsystemInfo(trk2NSigmaPiNegTOF)) + continue; + + if (!selectionPIDPionFirst(trk1) || !selectionPIDCascades(trk2)) + continue; + + if (!casctopCut(trk2)) + continue; + + if (additionalQAplots) { + // TPCncluster distributions + histos.fill(HIST("TPCncluster/TPCnclusterpifirst"), trk1.tpcNClsFound()); + histos.fill(HIST("TPCncluster/TPCnclusterPhipifirst"), trk1.tpcNClsFound(), trk1.phi()); + } + + if constexpr (!IsMix) { + //// QA plots before the selection + // --- PID QA + if (PIDplots) { + histos.fill(HIST("QAafter/TPC_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + + if (hasSubsystemInfo(trk1NSigmaPiTOF)) { + histos.fill(HIST("QAafter/TOF_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + histos.fill(HIST("QAafter/TOF_TPC_Map_pi_first_all"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); + } + + if (trk2.sign() < 0) { + histos.fill(HIST("QAafter/TPC_Nsigma_pi_bachelor_all"), multiplicity, 0, trk2NSigmaPiBachelorTPC); // not exist pt information in resocascade yet. + if (hasSubsystemInfo(trk2NSigmaPiBachelorTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_pi_bachelor_all"), trk2NSigmaPiBachelorTOF, trk2NSigmaPiBachelorTPC); + } + + histos.fill(HIST("QAafter/TPC_Nsigma_pr_all"), multiplicity, 0, trk2NSigmaPrPosTPC); + if (hasSubsystemInfo(trk2NSigmaPrPosTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_pr_all"), trk2NSigmaPrPosTOF, trk2NSigmaPrPosTPC); + } + + histos.fill(HIST("QAafter/TPC_Nsigma_piminus_all"), multiplicity, 0, trk2NSigmaPiNegTPC); + if (hasSubsystemInfo(trk2NSigmaPiNegTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_piminus_all"), trk2NSigmaPiNegTOF, trk2NSigmaPiNegTPC); + } + + } else { + + histos.fill(HIST("QAafter/TPC_Nsigma_pi_bachelor_all"), multiplicity, 0, trk2NSigmaPiBachelorTPC); // not exist pt information in resocascade yet. + if (hasSubsystemInfo(trk2NSigmaPiBachelorTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_pi_bachelor_all"), trk2NSigmaPiBachelorTOF, trk2NSigmaPiBachelorTPC); + } + + histos.fill(HIST("QAafter/TPC_Nsigma_antipr_all"), multiplicity, 0, trk2NSigmaPrNegTPC); + if (hasSubsystemInfo(trk2NSigmaPrNegTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_antipr_all"), trk2NSigmaPrNegTOF, trk2NSigmaPrNegTPC); + } + + histos.fill(HIST("QAafter/TPC_Nsigma_pi_all"), multiplicity, 0, trk2NSigmaPiPosTPC); + if (hasSubsystemInfo(trk2NSigmaPiPosTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_pi_all"), trk2NSigmaPiPosTOF, trk2NSigmaPiPosTPC); + } + } + } + + histos.fill(HIST("QAafter/trkpT_pi"), trk1ptPi); + histos.fill(HIST("QAafter/trkpT_Xi"), trk2ptXi); + + histos.fill(HIST("QAafter/trkDCAxy_pi"), trk1.dcaXY()); + histos.fill(HIST("QAafter/trkDCAxy_Xi"), trk2.dcaXYCascToPV()); + + histos.fill(HIST("QAafter/trkDCAz_pi"), trk1.dcaZ()); + histos.fill(HIST("QAafter/trkDCAz_Xi"), trk2.dcaZCascToPV()); + } + + lDecayDaughter1.SetPtEtaPhiM(trk1ptPi, trk1.eta(), trk1.phi(), massPi); + lDecayDaughter2.SetPtEtaPhiM(trk2ptXi, trk2.eta(), trk2.phi(), trk2.mXi()); + lResonance = lDecayDaughter1 + lDecayDaughter2; + + auto lResonancePt = lResonance.Pt(); + auto lResonanceInMass = lResonance.M(); + + if (std::abs(lResonance.Rapidity()) >= 0.5) + continue; + + if (cfgCutsOnMother) { + if (lResonancePt >= cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (lResonanceInMass >= cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + + if (trk1.sign() * trk2.sign() < 0) { + + if constexpr (!IsMix) { + if (study_antiparticle) { + if (trk1.sign() > 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassDS"), lResonanceInMass); + histos.fill(HIST("h3Xi1530invmassDS"), multiplicity, lResonancePt, lResonanceInMass, kData); + } else if (trk1.sign() < 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassDSAnti"), lResonanceInMass); + histos.fill(HIST("h3Xi1530invmassDSAnti"), multiplicity, lResonancePt, lResonanceInMass, kData); + } + } else { + if (invmass1D) + histos.fill(HIST("Xi1530invmassDS"), lResonanceInMass); + histos.fill(HIST("h3Xi1530invmassDS"), multiplicity, lResonancePt, lResonanceInMass, kData); + } + } else { + if (invmass1D) + histos.fill(HIST("Xi1530invmassME"), lResonanceInMass); + if (trk1.sign() > 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassME_DS"), lResonanceInMass); + histos.fill(HIST("h3Xi1530invmassME_DS"), multiplicity, lResonancePt, lResonanceInMass, kMixing); + } else if (trk1.sign() < 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassME_DSAnti"), lResonanceInMass); + histos.fill(HIST("h3Xi1530invmassME_DSAnti"), multiplicity, lResonancePt, lResonanceInMass, kMixing); + } + histos.fill(HIST("h3Xi1530invmassME"), multiplicity, lResonancePt, lResonanceInMass, kMixing); + } + + if constexpr (IsMC) { + if (std::abs(trk2.motherPDG()) != XiStarPID) + continue; + if (std::abs(trk1.pdgCode()) != PionPID || std::abs(trk2.pdgCode()) != XiPID) + continue; + if (trk1.motherId() != trk2.motherId()) + continue; + + histos.fill(HIST("QAMCTrue/trkDCAxy_pi"), trk1.dcaXY()); + histos.fill(HIST("QAMCTrue/trkDCAxy_xi"), trk2.dcaXYCascToPV()); + histos.fill(HIST("QAMCTrue/trkDCAz_pi"), trk1.dcaZ()); + histos.fill(HIST("QAMCTrue/trkDCAz_xi"), trk2.dcaZCascToPV()); + histos.fill(HIST("QAMCTrue/TPC_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (hasSubsystemInfo(trk1NSigmaPiTOF)) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + histos.fill(HIST("QAMCTrue/TOF_TPC_Map_pi_first_all"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); + } + + if (trk2.sign() < 0) { + histos.fill(HIST("QAafter/TPC_Nsigma_pi_bachelor_all"), multiplicity, 0, trk2NSigmaPiBachelorTPC); // not exist pt information in resocascade yet. + if (hasSubsystemInfo(trk2NSigmaPiBachelorTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_pi_bachelor_all"), trk2NSigmaPiBachelorTOF, trk2NSigmaPiBachelorTPC); + } + + histos.fill(HIST("QAafter/TPC_Nsigma_pr_all"), multiplicity, 0, trk2NSigmaPrPosTPC); + if (hasSubsystemInfo(trk2NSigmaPrPosTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_pr_all"), trk2NSigmaPrPosTOF, trk2NSigmaPrPosTPC); + } + + histos.fill(HIST("QAafter/TPC_Nsigma_piminus_all"), multiplicity, 0, trk2NSigmaPiNegTPC); + if (hasSubsystemInfo(trk2NSigmaPiNegTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_piminus_all"), trk2NSigmaPiNegTOF, trk2NSigmaPiNegTPC); + } + + } else { + + histos.fill(HIST("QAafter/TPC_Nsigma_pi_bachelor_all"), multiplicity, 0, trk2NSigmaPiBachelorTPC); // not exist pt information in resocascade yet. + if (hasSubsystemInfo(trk2NSigmaPiBachelorTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_pi_bachelor_all"), trk2NSigmaPiBachelorTOF, trk2NSigmaPiBachelorTPC); + } + + histos.fill(HIST("QAafter/TPC_Nsigma_antipr_all"), multiplicity, 0, trk2NSigmaPrNegTPC); + if (hasSubsystemInfo(trk2NSigmaPrNegTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_antipr_all"), trk2NSigmaPrNegTOF, trk2NSigmaPrNegTPC); + } + + histos.fill(HIST("QAafter/TPC_Nsigma_pi_all"), multiplicity, 0, trk2NSigmaPiPosTPC); + if (hasSubsystemInfo(trk2NSigmaPiPosTOF)) { + histos.fill(HIST("QAafter/TOF_TPC_Map_pi_all"), trk2NSigmaPiPosTOF, trk2NSigmaPiPosTPC); + } + } + // MC histograms + if (trk2.motherPDG() > 0) { + histos.fill(HIST("Xi1530Rec"), lResonancePt, multiplicity); + histos.fill(HIST("Xi1530Recinvmass"), lResonanceInMass); + histos.fill(HIST("h3RecXi1530invmass"), multiplicity, lResonancePt, lResonanceInMass, kMCReco); + } else { + histos.fill(HIST("Xi1530RecAnti"), lResonancePt, multiplicity); + histos.fill(HIST("Xi1530Recinvmass"), lResonanceInMass); + histos.fill(HIST("h3RecXi1530invmassAnti"), multiplicity, lResonancePt, lResonanceInMass, kMCReco); + } + } + + } else { + if constexpr (!IsMix) { + if (study_antiparticle) { + if (trk1.sign() < 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassLS"), lResonanceInMass); + histos.fill(HIST("h3Xi1530invmassLS"), multiplicity, lResonancePt, lResonanceInMass, kLS); + } else if (trk1.sign() > 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassLSAnti"), lResonanceInMass); + histos.fill(HIST("h3Xi1530invmassLSAnti"), multiplicity, lResonancePt, lResonanceInMass, kLS); + } + } else { + if (invmass1D) + histos.fill(HIST("Xi1530invmassLS"), lResonanceInMass); + histos.fill(HIST("h3Xi1530invmassLS"), multiplicity, lResonancePt, lResonanceInMass, kLS); + } + } + } + } + } + + void processData(aod::ResoCollision& resoCollision, aod::ResoTracks const& resoTracks, aod::ResoCascades const& cascTracks) + { + if (additionalQAeventPlots) + histos.fill(HIST("QAevent/hEvtCounterSameE"), 1.0); + fillHistograms(resoCollision, resoTracks, cascTracks); + } + + void processMC(ResoMCCols::iterator const& resoCollision, + soa::Join const& cascTracks, + soa::Join const& resoTracks) + { + if (!resoCollision.isInAfterAllCuts() || (std::abs(resoCollision.posZ()) > cZvertCutMC)) // MC event selection, all cuts missing vtx cut + return; + fillHistograms(resoCollision, resoTracks, cascTracks); + } + + void processMCTrue(ResoMCCols::iterator const& resoCollision, aod::ResoMCParents& resoParents) + { + auto multiplicity = resoCollision.cent(); + for (auto& part : resoParents) { // loop over all pre-filtered MC particles + if (std::abs(part.pdgCode()) != XiStarPID || std::abs(part.y()) >= 0.5) + continue; + bool pass1 = std::abs(part.daughterPDG1()) == PionPID || std::abs(part.daughterPDG2()) == PionPID; + bool pass2 = std::abs(part.daughterPDG1()) == XiPID || std::abs(part.daughterPDG2()) == XiPID; + + if (!pass1 || !pass2) + continue; + + if (resoCollision.isVtxIn10()) // INEL10 + { + if (part.pdgCode() > 0) + histos.fill(HIST("h3Xi1530Gen"), 0, part.pt(), multiplicity, kINEL10); + else + histos.fill(HIST("h3Xi1530GenAnti"), 0, part.pt(), multiplicity, kINEL10); + } + if (resoCollision.isVtxIn10() && resoCollision.isInSel8()) // INEL>10, vtx10 + { + if (part.pdgCode() > 0) + histos.fill(HIST("h3Xi1530Gen"), 1, part.pt(), multiplicity, kINELg010); + else + histos.fill(HIST("h3Xi1530GenAnti"), 1, part.pt(), multiplicity, kINELg010); + } + if (resoCollision.isVtxIn10() && resoCollision.isTriggerTVX()) // vtx10, TriggerTVX + { + if (part.pdgCode() > 0) + histos.fill(HIST("h3Xi1530Gen"), 2, part.pt(), multiplicity, kMCTruePS); + else + histos.fill(HIST("h3Xi1530GenAnti"), 2, part.pt(), multiplicity, kMCTruePS); + } + if (resoCollision.isInAfterAllCuts()) // after all event selection + { + if (part.pdgCode() > 0) + histos.fill(HIST("h3Xi1530Gen"), 3, part.pt(), multiplicity, kAllType); + else + histos.fill(HIST("h3Xi1530GenAnti"), 3, part.pt(), multiplicity, kAllType); + } + } + } + + using BinningTypeVtxZT0M = ColumnBinningPolicy; + void processME(aod::ResoCollisions const& resoCollisions, aod::ResoTracks const& resoTracks, aod::ResoCascades const& cascTracks) + { + auto tracksTuple = std::make_tuple(resoTracks, cascTracks); + + BinningTypeVtxZT0M colBinning{{CfgVtxBins, CfgMultBins}, true}; + Pair pairs{colBinning, nEvtMixing, -1, resoCollisions, tracksTuple, &cache}; + + for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (additionalQAeventPlots) + histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); + fillHistograms(collision1, tracks1, tracks2); + } + } + + PROCESS_SWITCH(xi1530analysisqa, processData, "Process Event for Data", true); + PROCESS_SWITCH(xi1530analysisqa, processMC, "Process Event for MC (Reconstructed)", true); + PROCESS_SWITCH(xi1530analysisqa, processMCTrue, "Process Event for MC (Generated)", true); + PROCESS_SWITCH(xi1530analysisqa, processME, "Process EventMixing light without partition", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index 660c7ce8610..839b94a14fd 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -41,7 +41,7 @@ o2physics_add_dpl_workflow(v0postprocessing o2physics_add_dpl_workflow(cascadecorrelations SOURCES cascadecorrelations.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(non-prompt-cascade @@ -123,3 +123,8 @@ o2physics_add_dpl_workflow(lambdak0sflattenicity SOURCES lambdak0sflattenicity.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(lambdalambda + SOURCES lambdalambda.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx index c9ff1f74f88..4209688498d 100644 --- a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx +++ b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -35,6 +37,7 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "CCDB/BasicCCDBManager.h" +#include "EventFiltering/Zorro.h" #include #include @@ -42,7 +45,7 @@ #include #include #include -#include +// #include using namespace o2; using namespace o2::soa; @@ -57,6 +60,8 @@ using FullTracksExtIU = soa::Join; using FullTracksExtIUWithPID = soa::Join; +Zorro zorro; + // Add a column to the cascdataext table: IsSelected. // 0 = not selected, 1 = Xi, 2 = both, 3 = Omega namespace o2::aod @@ -70,16 +75,29 @@ DECLARE_SOA_TABLE(CascadeFlags, "AOD", "CASCADEFLAGS", //! using CascDataExtSelected = soa::Join; } // namespace o2::aod -struct cascadeSelector { +using MyCollisions = soa::Join; +using MyCollisionsMult = soa::Join; +using MyCascades = soa::Filtered; + +struct CascadeSelector { + Service ccdb; + Produces cascflags; // Configurables + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "CCDB url"}; + Configurable useTrigger{"useTrigger", false, "Use trigger selection on skimmed data"}; + Configurable triggerList{"triggerList", "fDoubleXi, fDoubleOmega, fOmegaXi", "List of triggers used to select events"}; + Configurable doTFBorderCut{"doTFBorderCut", true, "Switch to apply TimeframeBorderCut event selection"}; + Configurable doSel8{"doSel8", true, "Switch to apply sel8 event selection"}; + + // Tracklevel Configurable tpcNsigmaBachelor{"tpcNsigmaBachelor", 3, "TPC NSigma bachelor"}; Configurable tpcNsigmaProton{"tpcNsigmaProton", 3, "TPC NSigma proton <- lambda"}; Configurable tpcNsigmaPion{"tpcNsigmaPion", 3, "TPC NSigma pion <- lambda"}; Configurable minTPCCrossedRows{"minTPCCrossedRows", 80, "min N TPC crossed rows"}; // TODO: finetune! 80 > 159/2, so no split tracks? Configurable minITSClusters{"minITSClusters", 4, "minimum number of ITS clusters"}; - // Configurable etaTracks{"etaTracks", 0.8, "min/max of eta for tracks"} + Configurable etaTracks{"etaTracks", 1.0, "min/max of eta for tracks"}; // Selection criteria - compatible with core wagon autodetect - copied from cascadeanalysis.cxx //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* @@ -132,23 +150,50 @@ struct cascadeSelector { {"hITSnClustersPos", "hITSnClustersPos", {HistType::kTH3F, {{8, -0.5, 7.5, "number of ITS clusters"}, invMassAxis, ptAxis}}}, {"hITSnClustersNeg", "hITSnClustersNeg", {HistType::kTH3F, {{8, -0.5, 7.5, "number of ITS clusters"}, invMassAxis, ptAxis}}}, {"hITSnClustersBach", "hITSnClustersBach", {HistType::kTH3F, {{8, -0.5, 7.5, "number of ITS clusters"}, invMassAxis, ptAxis}}}, + + {"hTriggerQA", "hTriggerQA", {HistType::kTH1F, {{2, -0.5, 1.5, "Trigger y/n"}}}}, }, }; // Keep track of which selections the candidates pass void init(InitContext const&) { + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + auto h = registry.add("hSelectionStatus", "hSelectionStatus", HistType::kTH1I, {{10, 0, 10, "status"}}); h->GetXaxis()->SetBinLabel(1, "All"); h->GetXaxis()->SetBinLabel(2, "nTPC OK"); h->GetXaxis()->SetBinLabel(3, "nITS OK"); h->GetXaxis()->SetBinLabel(4, "Topo OK"); - h->GetXaxis()->SetBinLabel(5, "V0 PID OK"); - h->GetXaxis()->SetBinLabel(6, "Bach PID OK"); + h->GetXaxis()->SetBinLabel(5, "Track eta OK"); + h->GetXaxis()->SetBinLabel(6, "V0 PID OK"); + h->GetXaxis()->SetBinLabel(7, "Bach PID OK"); } - void process(soa::Join::iterator const& collision, aod::CascDataExt const& Cascades, FullTracksExtIUWithPID const&) + void process(MyCollisions::iterator const& collision, aod::CascDataExt const& Cascades, FullTracksExtIUWithPID const&, aod::BCsWithTimestamps const&) { - for (auto& casc : Cascades) { + bool evSel = true; + if (useTrigger) { + auto bc = collision.bc_as(); + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), triggerList); + bool eventTrigger = zorro.isSelected(bc.globalBC()); + if (eventTrigger) { + registry.fill(HIST("hTriggerQA"), 1); + } else { + registry.fill(HIST("hTriggerQA"), 0); + evSel = false; + } + } + + if ((doSel8 && !collision.sel8()) || (doTFBorderCut && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { + evSel = false; // do not skip the collision - this will lead to the cascadeFlag table having less entries than the Cascade table, and therefor not joinable. + } + + for (auto const& casc : Cascades) { + if (!evSel) { + cascflags(0); + continue; + } // these are the tracks: auto bachTrack = casc.bachelor_as(); @@ -178,7 +223,7 @@ struct cascadeSelector { registry.fill(HIST("hSelectionStatus"), 0); // all the cascade before selections registry.fill(HIST("hMassXi0"), casc.mXi(), casc.pt()); - // TPC N crossed rows + // TPC N crossed rows todo: check if minTPCCrossedRows > 50 if (posTrack.tpcNClsCrossedRows() < minTPCCrossedRows || negTrack.tpcNClsCrossedRows() < minTPCCrossedRows || bachTrack.tpcNClsCrossedRows() < minTPCCrossedRows) { cascflags(0); continue; @@ -186,7 +231,7 @@ struct cascadeSelector { registry.fill(HIST("hSelectionStatus"), 1); // passes nTPC crossed rows registry.fill(HIST("hMassXi1"), casc.mXi(), casc.pt()); - // ITS N clusters + // ITS N clusters todo: check if minITSClusters > 0 if (posTrack.itsNCls() < minITSClusters || negTrack.itsNCls() < minITSClusters || bachTrack.itsNCls() < minITSClusters) { cascflags(0); continue; @@ -211,6 +256,12 @@ struct cascadeSelector { registry.fill(HIST("hSelectionStatus"), 3); // passes topo registry.fill(HIST("hMassXi3"), casc.mXi(), casc.pt()); + if (TMath::Abs(posTrack.eta()) > etaTracks || TMath::Abs(negTrack.eta()) > etaTracks || TMath::Abs(bachTrack.eta()) > etaTracks) { + cascflags(0); + continue; + } + registry.fill(HIST("hSelectionStatus"), 4); // passes track eta + // TODO: TOF (for pT > 2 GeV per track?) //// TPC PID //// @@ -238,7 +289,7 @@ struct cascadeSelector { continue; } } - registry.fill(HIST("hSelectionStatus"), 4); // fails at V0 daughters PID + registry.fill(HIST("hSelectionStatus"), 5); // passes V0 daughters PID registry.fill(HIST("hMassXi4"), casc.mXi(), casc.pt()); // Bachelor check @@ -246,42 +297,49 @@ struct cascadeSelector { if (TMath::Abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor) { // consistent with both! cascflags(2); - registry.fill(HIST("hSelectionStatus"), 5); // passes bach PID + registry.fill(HIST("hSelectionStatus"), 6); // passes bach PID registry.fill(HIST("hMassXi5"), casc.mXi(), casc.pt()); continue; } cascflags(1); - registry.fill(HIST("hSelectionStatus"), 5); // passes bach PID + registry.fill(HIST("hSelectionStatus"), 6); // passes bach PID registry.fill(HIST("hMassXi5"), casc.mXi(), casc.pt()); continue; } else if (TMath::Abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor) { cascflags(3); - registry.fill(HIST("hSelectionStatus"), 5); // passes bach PID + registry.fill(HIST("hSelectionStatus"), 6); // passes bach PID continue; } // if we reach here, the bachelor was neither pion nor kaon cascflags(0); } // cascade loop - } // process -}; // struct + } // process +}; // struct -struct cascadeCorrelations { +struct CascadeCorrelations { Service ccdb; + OutputObj zorroSummary{"zorroSummary"}; + // Configurables + Configurable maxRapidity{"maxRapidity", 0.5, "|y| < maxRapidity"}; Configurable zVertexCut{"zVertexCut", 10, "Cut on PV position"}; Configurable nMixedEvents{"nMixedEvents", 10, "Number of events to be mixed"}; Configurable doEfficiencyCorrection{"doEfficiencyCorrection", true, "flag to do efficiency corrections"}; - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "CCDB url"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "CCDB url"}; + Configurable useTrigger{"useTrigger", false, "Use trigger selection on skimmed data"}; + Configurable triggerList{"triggerList", "fDoubleXi, fDoubleOmega, fOmegaXi", "List of triggers used to select events"}; Configurable efficiencyCCDBPath{"efficiencyCCDBPath", "Users/r/rspijker/test/EffTest", "Path of the efficiency corrections"}; + Configurable doTFBorderCut{"doTFBorderCut", true, "Switch to apply TimeframeBorderCut event selection"}; + Configurable doSel8{"doSel8", true, "Switch to apply sel8 event selection"}; - AxisSpec invMassAxis = {2000, 1.0f, 3.0f, "Inv. Mass (GeV/c^{2})"}; - AxisSpec deltaPhiAxis = {100, -PI / 2, 1.5 * PI, "#Delta#varphi"}; - AxisSpec deltaYAxis = {40, -2, 2, "#Delta y"}; // TODO: narrower range? - AxisSpec ptAxis = {200, 0, 15, "#it{p}_{T}"}; + AxisSpec invMassAxis = {1000, 1.0f, 2.0f, "Inv. Mass (GeV/c^{2})"}; + AxisSpec deltaPhiAxis = {180, -PIHalf, 3 * PIHalf, "#Delta#varphi"}; // 180 is divisible by 18 (tpc sectors) and 20 (run 2 binning) + AxisSpec deltaYAxis = {40, -2 * maxRapidity, 2 * maxRapidity, "#Delta y"}; // TODO: narrower range? + AxisSpec ptAxis = {150, 0, 15, "#it{p}_{T}"}; AxisSpec selectionFlagAxis = {4, -0.5f, 3.5f, "Selection flag of casc candidate"}; AxisSpec vertexAxis = {200, -10.0f, 10.0f, "cm"}; AxisSpec multiplicityAxis{100, 0, 100, "Multiplicity (MultFT0M?)"}; - AxisSpec rapidityAxis{100, -2, 2, "y"}; + AxisSpec rapidityAxis{100, -maxRapidity, maxRapidity, "y"}; // initialize efficiency maps TH1D* hEffXiMin; @@ -291,7 +349,7 @@ struct cascadeCorrelations { void init(InitContext const&) { - ccdb->setURL(ccdburl); + ccdb->setURL(ccdbUrl); ccdb->setCaching(true); if (doEfficiencyCorrection) { TList* effList = ccdb->getForTimeStamp(efficiencyCCDBPath, 1); @@ -303,6 +361,8 @@ struct cascadeCorrelations { hEffOmegaMin = static_cast(effList->FindObject("hOmegaMinEff")); hEffOmegaPlus = static_cast(effList->FindObject("hOmegaPlusEff")); } + + zorroSummary.setObject(zorro.getZorroSummary()); } double getEfficiency(TH1D* h, double pT) @@ -323,6 +383,9 @@ struct cascadeCorrelations { {"hMassXiEffCorrected", "hMassXiEffCorrected", {HistType::kTHnSparseF, {invMassAxis, ptAxis, rapidityAxis, vertexAxis, multiplicityAxis}}, true}, {"hMassOmegaEffCorrected", "hMassOmegaEffCorrected", {HistType::kTHnSparseF, {invMassAxis, ptAxis, rapidityAxis, vertexAxis, multiplicityAxis}}, true}, + // trigger QA + {"hTriggerQA", "hTriggerQA", {HistType::kTH1F, {{2, -0.5, 1.5, "Trigger y/n"}}}}, + // basic selection variables {"hV0Radius", "hV0Radius", {HistType::kTH1F, {{1000, 0.0f, 100.0f, "cm"}}}}, {"hCascRadius", "hCascRadius", {HistType::kTH1F, {{1000, 0.0f, 100.0f, "cm"}}}}, @@ -339,7 +402,7 @@ struct cascadeCorrelations { {"hSelectionFlag", "hSelectionFlag", {HistType::kTH1I, {selectionFlagAxis}}}, {"hAutoCorrelation", "hAutoCorrelation", {HistType::kTH1I, {{4, -0.5f, 3.5f, "Types of SS autocorrelation"}}}}, {"hAutoCorrelationOS", "hAutoCorrelationOS", {HistType::kTH1I, {{2, -1.f, 1.f, "Charge of OS autocorrelated track"}}}}, - {"hPhi", "hPhi", {HistType::kTH1F, {{100, 0, 2 * PI, "#varphi"}}}}, + {"hPhi", "hPhi", {HistType::kTH1F, {{180, 0, TwoPI, "#varphi"}}}}, {"hEta", "hEta", {HistType::kTH1F, {{100, -2, 2, "#eta"}}}}, {"hRapidityXi", "hRapidityXi", {HistType::kTH1F, {rapidityAxis}}}, {"hRapidityOmega", "hRapidityOmega", {HistType::kTH1F, {rapidityAxis}}}, @@ -363,6 +426,8 @@ struct cascadeCorrelations { {"MixedEvents/hMEDeltaPhiSS", "hMEDeltaPhiSS", {HistType::kTH1F, {deltaPhiAxis}}}, {"MixedEvents/hMEDeltaPhiOS", "hMEDeltaPhiOS", {HistType::kTH1F, {deltaPhiAxis}}}, {"MixedEvents/hMEQA", "hMEQA", {HistType::kTH1I, {{2, 0, 2, "QA for exceptions in ME (this histogram should have 0 entries!)"}}}}, + {"MixedEvents/hMEAutoCorrelation", "hMEAutoCorrelation", {HistType::kTH1I, {{4, -0.5f, 3.5f, "Types of SS autocorrelation"}}}}, + {"MixedEvents/hMEAutoCorrelationOS", "hMEAutoCorrelationOS", {HistType::kTH1I, {{2, -1.f, 1.f, "Charge of OS autocorrelated track"}}}}, {"MixedEvents/hMEXiXiOS", "hMEXiXiOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, {"MixedEvents/hMEXiXiSS", "hMEXiXiSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, @@ -376,29 +441,39 @@ struct cascadeCorrelations { }; // cascade filter - Filter Selector = aod::cascadeflags::isSelected > 0; - - // Mixed events setup: - using myCascades = soa::Filtered; - using myCollisions = soa::Join; + Filter cascadeSelector = aod::cascadeflags::isSelected > 0; + // Warning: it is not possible to use this axis as configurable due to a bug - however, default values are sensible. SliceCache cache; ConfigurableAxis axisVtxZ{"axisVtxZ", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100, 1000}, "Mixing bins - multiplicity"}; - using BinningType = ColumnBinningPolicy>; - BinningType colBinning{{axisVtxZ, axisMult}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. - // Preslice collisionSliceCascades = aod::CascDataExtSelected::collisionId; - SameKindPair pair{colBinning, nMixedEvents, -1, &cache}; - - void processSameEvent(myCollisions::iterator const& collision, myCascades const& Cascades, aod::V0sLinked const&, aod::V0Datas const&, FullTracksExtIU const&) + // ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100, 1000}, "Mixing bins - multiplicity"}; + // using BinningType = ColumnBinningPolicy>; + // BinningType colBinning{{axisVtxZ, axisMult}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. + using BinningType = ColumnBinningPolicy; + BinningType colBinning{{axisVtxZ}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. + SameKindPair pair{colBinning, nMixedEvents, -1, &cache}; + + void processSameEvent(MyCollisionsMult::iterator const& collision, MyCascades const& Cascades, aod::V0sLinked const&, aod::V0Datas const&, FullTracksExtIU const&, aod::BCsWithTimestamps const&) { - if (!collision.sel8()) { + if (useTrigger) { + auto bc = collision.bc_as(); + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), triggerList); + bool eventTrigger = zorro.isSelected(bc.globalBC()); + if (eventTrigger) { + registry.fill(HIST("hTriggerQA"), 1); + } else { + registry.fill(HIST("hTriggerQA"), 0); + return; + } + } + + if ((doSel8 && !collision.sel8()) || (doTFBorderCut && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { return; } double weight; // Some QA on the cascades - for (auto& casc : Cascades) { + for (auto const& casc : Cascades) { if (casc.isSelected() <= 2) { // not exclusively an Omega --> consistent with Xi or both if (casc.sign() < 0) { registry.fill(HIST("hMassXiMinus"), casc.mXi(), casc.pt()); @@ -407,6 +482,7 @@ struct cascadeCorrelations { registry.fill(HIST("hMassXiPlus"), casc.mXi(), casc.pt()); weight = 1. / getEfficiency(hEffXiPlus, casc.pt()); } + // LOGF(info, "casc pt %f, weight %f", casc.pt(), weight); registry.fill(HIST("hMassXiEffCorrected"), casc.mXi(), casc.pt(), casc.yXi(), collision.posZ(), collision.multFT0M(), weight); registry.fill(HIST("hRapidityXi"), casc.yXi()); } @@ -456,7 +532,7 @@ struct cascadeCorrelations { int negIdAssoc = assoc.negTrackId(); // calculate angular correlations - double dphi = RecoDecay::constrainAngle(trigger.phi() - assoc.phi(), -0.5 * PI); + double dphi = RecoDecay::constrainAngle(trigger.phi() - assoc.phi(), -PIHalf); double invMassXiTrigg = trigger.mXi(); double invMassOmTrigg = trigger.mOmega(); @@ -495,29 +571,29 @@ struct cascadeCorrelations { } registry.fill(HIST("hDeltaPhiOS"), dphi); // Fill the different THnSparses depending on PID logic (important for rapidity & inv mass information) - if (trigger.isSelected() <= 2) { // trigger Xi + if (trigger.isSelected() <= 2 && TMath::Abs(trigger.yXi()) < maxRapidity) { // trigger Xi if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? 1. / getEfficiency(hEffXiMin, trigger.pt()) : 1. / getEfficiency(hEffXiPlus, trigger.pt()); - if (assoc.isSelected() <= 2) { // assoc Xi + if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffXiMin, assoc.pt()) : 1. / getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("hXiXiOS"), dphi, trigger.yXi() - assoc.yXi(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2) { // assoc Omega + if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, assoc.pt()) : 1. / getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("hXiOmOS"), dphi, trigger.yXi() - assoc.yOmega(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } } - if (trigger.isSelected() >= 2) { // trigger Omega + if (trigger.isSelected() >= 2 && TMath::Abs(trigger.yOmega()) < maxRapidity) { // trigger Omega if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, trigger.pt()) : 1. / getEfficiency(hEffOmegaPlus, trigger.pt()); - if (assoc.isSelected() <= 2) { // assoc Xi + if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffXiMin, assoc.pt()) : 1. / getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("hOmXiOS"), dphi, trigger.yOmega() - assoc.yXi(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassXiAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2) { // assoc Omega + if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, assoc.pt()) : 1. / getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("hOmOmOS"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); @@ -559,29 +635,29 @@ struct cascadeCorrelations { } registry.fill(HIST("hDeltaPhiSS"), dphi); // Fill the different THnSparses depending on PID logic (important for rapidity & inv mass information) - if (trigger.isSelected() <= 2) { // trigger Xi + if (trigger.isSelected() <= 2 && TMath::Abs(trigger.yXi()) < maxRapidity) { // trigger Xi if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? 1. / getEfficiency(hEffXiMin, trigger.pt()) : 1. / getEfficiency(hEffXiPlus, trigger.pt()); - if (assoc.isSelected() <= 2) { // assoc Xi + if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffXiMin, assoc.pt()) : 1. / getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("hXiXiSS"), dphi, trigger.yXi() - assoc.yXi(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2) { // assoc Omega + if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, assoc.pt()) : 1. / getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("hXiOmSS"), dphi, trigger.yXi() - assoc.yOmega(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } } - if (trigger.isSelected() >= 2) { // trigger Omega + if (trigger.isSelected() >= 2 && TMath::Abs(trigger.yOmega()) < maxRapidity) { // trigger Omega if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, trigger.pt()) : 1. / getEfficiency(hEffOmegaPlus, trigger.pt()); - if (assoc.isSelected() <= 2) { // assoc Xi + if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffXiMin, assoc.pt()) : 1. / getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("hOmXiSS"), dphi, trigger.yOmega() - assoc.yXi(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassXiAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2) { // assoc Omega + if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, assoc.pt()) : 1. / getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("hOmOmSS"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); @@ -591,12 +667,10 @@ struct cascadeCorrelations { } // correlations } // process same event - void processMixedEvent(myCollisions const& /*collisions*/, myCascades const& /*Cascades*/, + void processMixedEvent(MyCollisionsMult const& /*collisions*/, MyCascades const& /*Cascades*/, aod::V0sLinked const&, aod::V0Datas const&, FullTracksExtIU const&) { - // mixed events - - for (auto& [col1, cascades1, col2, cascades2] : pair) { + for (auto const& [col1, cascades1, col2, cascades2] : pair) { if (!col1.sel8() || !col2.sel8()) continue; if (TMath::Abs(col1.posZ()) > zVertexCut || TMath::Abs(col2.posZ()) > zVertexCut) @@ -624,7 +698,7 @@ struct cascadeCorrelations { continue; } - double dphi = RecoDecay::constrainAngle(trigger.phi() - assoc.phi(), -0.5 * PI); + double dphi = RecoDecay::constrainAngle(trigger.phi() - assoc.phi(), -PIHalf); double invMassXiTrigg = trigger.mXi(); double invMassOmTrigg = trigger.mOmega(); @@ -646,24 +720,24 @@ struct cascadeCorrelations { if (trigger.isSelected() >= 2) { if (trigger.sign() > 0 && trigger.bachelorId() == posIdAssoc) { // K+ from trigger Omega is the same as proton from assoc lambda - registry.fill(HIST("hAutoCorrelationOS"), 1); + registry.fill(HIST("hMEAutoCorrelationOS"), 1); continue; } if (trigger.sign() < 0 && trigger.bachelorId() == negIdAssoc) { // K- from trigger Omega is the same as antiproton from assoc antilambda - registry.fill(HIST("hAutoCorrelationOS"), -1); + registry.fill(HIST("hMEAutoCorrelationOS"), -1); continue; } } if (assoc.isSelected() >= 2) { if (assoc.sign() > 0 && assoc.bachelorId() == posIdTrigg) { // K+ from assoc Omega is the same as proton from trigger lambda - registry.fill(HIST("hAutoCorrelationOS"), 1); + registry.fill(HIST("hMEAutoCorrelationOS"), 1); continue; } if (assoc.sign() < 0 && assoc.bachelorId() == negIdTrigg) { // K- from assoc Omega is the same as antiproton from trigger antilambda - registry.fill(HIST("hAutoCorrelationOS"), -1); + registry.fill(HIST("hMEAutoCorrelationOS"), -1); continue; } } @@ -671,29 +745,29 @@ struct cascadeCorrelations { registry.fill(HIST("MixedEvents/hMEDeltaPhiOS"), dphi); // Fill the different THnSparses depending on PID logic (important for rapidity & inv mass information) - if (trigger.isSelected() <= 2) { // trigger Xi + if (trigger.isSelected() <= 2 && TMath::Abs(trigger.yXi()) < maxRapidity) { // trigger Xi if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? 1. / getEfficiency(hEffXiMin, trigger.pt()) : 1. / getEfficiency(hEffXiPlus, trigger.pt()); - if (assoc.isSelected() <= 2) { // assoc Xi + if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffXiMin, assoc.pt()) : 1. / getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEXiXiOS"), dphi, trigger.yXi() - assoc.yXi(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2) { // assoc Omega + if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, assoc.pt()) : 1. / getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEXiOmOS"), dphi, trigger.yXi() - assoc.yOmega(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } } - if (trigger.isSelected() >= 2) { // trigger Omega + if (trigger.isSelected() >= 2 && TMath::Abs(trigger.yOmega()) < maxRapidity) { // trigger Omega if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, trigger.pt()) : 1. / getEfficiency(hEffOmegaPlus, trigger.pt()); - if (assoc.isSelected() <= 2) { // assoc Xi + if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffXiMin, assoc.pt()) : 1. / getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEOmXiOS"), dphi, trigger.yOmega() - assoc.yXi(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassXiAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2) { // assoc Omega + if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, assoc.pt()) : 1. / getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEOmOmOS"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); @@ -703,7 +777,7 @@ struct cascadeCorrelations { // make sure to check for autocorrelations - only possible in same-sign correlations (if PID is correct) if (posIdTrigg == posIdAssoc && negIdTrigg == negIdAssoc) { // LOGF(info, "same v0 in SS correlation! %d %d", v0dataTrigg.v0Id(), v0dataAssoc.v0Id()); - registry.fill(HIST("hAutoCorrelation"), 0); + registry.fill(HIST("hMEAutoCorrelation"), 0); continue; } int bachIdTrigg = trigger.bachelorId(); @@ -711,54 +785,54 @@ struct cascadeCorrelations { if (bachIdTrigg == bachIdAssoc) { // LOGF(info, "same bachelor in SS correlation! %d %d", bachIdTrigg, bachIdAssoc); - registry.fill(HIST("hAutoCorrelation"), 1); + registry.fill(HIST("hMEAutoCorrelation"), 1); continue; } // check for same tracks in v0's of cascades if (negIdTrigg == negIdAssoc || posIdTrigg == posIdAssoc) { // LOGF(info, "cascades have a v0-track in common in SS correlation!"); - registry.fill(HIST("hAutoCorrelation"), 2); + registry.fill(HIST("hMEAutoCorrelation"), 2); continue; } if (trigger.sign() < 0) { // neg cascade if (negIdTrigg == bachIdAssoc || negIdAssoc == bachIdTrigg) { // LOGF(info, "bach of casc == v0-pion of other casc in neg SS correlation!"); - registry.fill(HIST("hAutoCorrelation"), 3); + registry.fill(HIST("hMEAutoCorrelation"), 3); continue; } } else { // pos cascade if (posIdTrigg == bachIdAssoc || posIdAssoc == bachIdTrigg) { // LOGF(info, "bach of casc == v0-pion of other casc in pos SS correlation!"); - registry.fill(HIST("hAutoCorrelation"), 3); + registry.fill(HIST("hMEAutoCorrelation"), 3); continue; } } registry.fill(HIST("MixedEvents/hMEDeltaPhiSS"), dphi); - if (trigger.isSelected() <= 2) { // trigger Xi + if (trigger.isSelected() <= 2 && TMath::Abs(trigger.yXi()) < maxRapidity) { // trigger Xi if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? 1. / getEfficiency(hEffXiMin, trigger.pt()) : 1. / getEfficiency(hEffXiPlus, trigger.pt()); - if (assoc.isSelected() <= 2) { // assoc Xi + if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffXiMin, assoc.pt()) : 1. / getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEXiXiSS"), dphi, trigger.yXi() - assoc.yXi(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2) { // assoc Omega + if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, assoc.pt()) : 1. / getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEXiOmSS"), dphi, trigger.yXi() - assoc.yOmega(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } } - if (trigger.isSelected() >= 2) { // trigger Omega + if (trigger.isSelected() >= 2 && TMath::Abs(trigger.yOmega()) < maxRapidity) { // trigger Omega if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, trigger.pt()) : 1. / getEfficiency(hEffOmegaPlus, trigger.pt()); - if (assoc.isSelected() <= 2) { // assoc Xi + if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffXiMin, assoc.pt()) : 1. / getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEOmXiSS"), dphi, trigger.yOmega() - assoc.yXi(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassXiAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2) { // assoc Omega + if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? 1. / getEfficiency(hEffOmegaMin, assoc.pt()) : 1. / getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEOmOmSS"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); @@ -766,17 +840,17 @@ struct cascadeCorrelations { } } // same sign } // correlations - } // collisions - } // process mixed events + } // collisions + } // process mixed events - PROCESS_SWITCH(cascadeCorrelations, processSameEvent, "Process same events", true); - PROCESS_SWITCH(cascadeCorrelations, processMixedEvent, "Process mixed events", true); + PROCESS_SWITCH(CascadeCorrelations, processSameEvent, "Process same events", true); + PROCESS_SWITCH(CascadeCorrelations, processMixedEvent, "Process mixed events", true); -}; // struct +}; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Tasks/Strangeness/cascpostprocessing.cxx b/PWGLF/Tasks/Strangeness/cascpostprocessing.cxx index 3bbff7b117a..d92e48733b5 100644 --- a/PWGLF/Tasks/Strangeness/cascpostprocessing.cxx +++ b/PWGLF/Tasks/Strangeness/cascpostprocessing.cxx @@ -216,8 +216,8 @@ struct cascpostprocessing { registry.add("hPtCascPlusTrueRec", "hPtCascPlusTrueRec", {HistType::kTH3F, {ptAxis, rapidityAxis, centFT0MAxis}}); registry.add("hPtCascMinusTrueRec", "hPtCascMinusTrueRec", {HistType::kTH3F, {ptAxis, rapidityAxis, centFT0MAxis}}); - registry.add("hCascMinusMassvsPtTrueRec", "hCascMinusMassvsPtTrueRec", {HistType::kTH2F, {ptAxis, massAxis}}); - registry.add("hCascPlusMassvsPtTrueRec", "hCascPlusMassvsPtTrueRec", {HistType::kTH2F, {ptAxis, massAxis}}); + registry.add("hCascMinusMassvsPtTrueRec", "hCascMinusMassvsPtTrueRec", {HistType::kTH3F, {ptAxis, massAxis, centFT0MAxis}}); + registry.add("hCascPlusMassvsPtTrueRec", "hCascPlusMassvsPtTrueRec", {HistType::kTH3F, {ptAxis, massAxis, centFT0MAxis}}); registry.add("hCascMinusMassvsPtBG", "hCascMinusMassvsPtBG", {HistType::kTH2F, {ptAxis, massAxis}}); registry.add("hCascPlusMassvsPtBG", "hCascPlusMassvsPtBG", {HistType::kTH2F, {ptAxis, massAxis}}); if (isMC) { @@ -489,7 +489,7 @@ struct cascpostprocessing { if (candidate.sign() < 0) { if (isCorrectlyRec) { registry.fill(HIST("hPtCascMinusTrueRec"), candidate.pt(), rapidity, candidate.centFT0M()); // 3rd axis is from MC calibration - registry.fill(HIST("hCascMinusMassvsPtTrueRec"), candidate.pt(), invmass); + registry.fill(HIST("hCascMinusMassvsPtTrueRec"), candidate.pt(), invmass, candidate.centFT0M()); } else { registry.fill(HIST("hCascMinusMassvsPtBG"), candidate.pt(), invmass); } @@ -500,7 +500,7 @@ struct cascpostprocessing { if (candidate.sign() > 0) { if (isCorrectlyRec) { registry.fill(HIST("hPtCascPlusTrueRec"), candidate.pt(), rapidity, candidate.centFT0M()); // 3rd axis is from MC calibration - registry.fill(HIST("hCascPlusMassvsPtTrueRec"), candidate.pt(), invmass); + registry.fill(HIST("hCascPlusMassvsPtTrueRec"), candidate.pt(), invmass, candidate.centFT0M()); } else { registry.fill(HIST("hCascPlusMassvsPtBG"), candidate.pt(), invmass); } diff --git a/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx index d4692bff77b..824266cdd5e 100644 --- a/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx @@ -29,6 +29,19 @@ #include "Common/DataModel/PIDResponse.h" #include "Framework/StaticFor.h" +#include "Framework/ConfigParamSpec.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/LHCConstants.h" +#include "Framework/HistogramRegistry.h" +#include "DataFormatsFT0/Digit.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "DataFormatsParameters/GRPECSObject.h" +#include "ITSMFTBase/DPLAlpideParam.h" +#include "MetadataHelper.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" + #include #include #include @@ -51,108 +64,122 @@ using cascMCCandidates = soa::Join zVertexCut{"zVertexCut", 10, "Cut on PV position"}; - ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; - ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "occupancy axis"}; - + ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 25000.0f}, "occupancy axis"}; + ConfigurableAxis axisOccupancyFt0{"axisOccupancyFt0", {VARIABLE_WIDTH, 0.0f, 2500.0f, 5000.0f, 7500.0f, 10000.0f, 15000.0f, 20000.0f, 30000.0f, 45000.0f, 60000.0f, 80000.0f, 100000.0f, 250000.0f}, "occupancy axis for the FT0 definition"}; + ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles in |y| < 0.5"}; ConfigurableAxis vertexZ{"vertexZ", {30, -15.0f, 15.0f}, ""}; ConfigurableAxis axisMass{"axisMass", {200, 1.222f, 1.422f}, "range of invariant mass, in case of omega take 1.572f, 1.772f"}; Configurable isXi{"isXi", 1, "Apply cuts for Xi identification"}; - Configurable doBefSelCheck{"doBefSelCheck", false, "Fill mass histograms of all candidates before selections"}; - Configurable doPtDepCutStudy{"doPtDepCutStudy", false, "Fill histogram with a cutting paramer"}; - Configurable doTriggerTVXEventCut{"doTriggerTVXEventCut", false, "Minimal MB event selection, for MC"}; - Configurable doTriggerSel8EventCut{"doTriggerSel8EventCut", true, "Standard MB event selection"}; - Configurable doGoodPVFT0EventCut{"doGoodPVFT0EventCut", true, "check for the PV position diffrence when estimated from tracks and FT0"}; - Configurable doITSTPCvertexEventCut{"doITSTPCvertexEventCut", true, "checks the presence of at least one ITS-TPC track"}; - Configurable doSameBunchPileUpEventCut{"doSameBunchPileUpEventCut", true, "removes events associated with the same \"found-by-T0\" bunch crossing"}; - Configurable doVertexTOFmatch{"doVertexTOFmatch", false, "Checks wherher at least one of vertex contributors is matched to TOF"}; - Configurable doVertexTRDmatch{"doVertexTRDmatch", false, "Checks wherher at least one of vertex contributors is matched to TRD"}; - Configurable doBefSelEventMultCorr{"doBefSelEventMultCorr", false, "Enable histogram of multiplicity correlation before cuts"}; - Configurable doTFeventCut{"doTFeventCut", false, "Enable TF event Cut"}; - Configurable doITSFrameBorderCut{"doITSFrameBorderCut", false, "Enable ITSFrame event cut"}; - Configurable doMultiplicityCorrCut{"doMultiplicityCorrCut", false, "Enable multiplicity vs centrality correlation cut"}; - Configurable doOccupancyCheck{"doOccupancyCheck", true, ""}; - Configurable doTimeRangeStandardCut{"doTimeRangeStandardCut", true, "It rejects a given collision if there are other events nearby in |dt|< 10 μs"}; - Configurable doTimeRangeNarrowCut{"doTimeRangeNarrowCut", false, "It rejects a given collision if there are other events nearby in |dt|< 4 μs"}; Configurable minOccupancy{"minOccupancy", -1, "Minimal occupancy"}; Configurable maxOccupancy{"maxOccupancy", -1, "Maximal occupancy"}; - + Configurable minOccupancyFT0{"minOccupancyFT0", -1, "Minimal occupancy"}; + Configurable maxOccupancyFT0{"maxOccupancyFT0", -1, "Maximal occupancy"}; + Configurable useTrackOccupancyDef{"useTrackOccupancyDef", true, "Use occupancy definition based on the tracks"}; + Configurable useFT0OccupancyDef{"useFT0OccupancyDef", false, "se occupancy definition based on the FT0 signals"}; Configurable centMin{"centMin", 0, "Minimal accepted centrality"}; Configurable centMax{"centMax", 100, "Maximal accepted centrality"}; - Configurable minPt{"minPt", 0.0f, "minPt"}; - Configurable masswin{"masswin", 0.05, "Mass window limit"}; - Configurable lambdaMassWin{"lambdaMassWin", 0.005, "V0 Mass window limit"}; - Configurable rapCut{"rapCut", 0.5, "Rapidity acceptance"}; - Configurable etaDauCut{"etaDauCut", 0.8, "Pseudorapidity acceptance of the cascade daughters"}; - Configurable dcaBaryonToPV{"dcaBaryonToPV", 0.05, "DCA of baryon doughter track To PV"}; - Configurable dcaMesonToPV{"dcaMesonToPV", 0.1, "DCA of meson doughter track To PV"}; - Configurable dcaBachToPV{"dcaBachToPV", 0.04, "DCA Bach To PV"}; - Configurable casccospa{"casccospa", 0.97, "Casc CosPA"}; - Configurable v0cospa{"v0cospa", 0.97, "V0 CosPA"}; - Configurable dcacascdau{"dcacascdau", 1., "DCA Casc Daughters"}; - Configurable dcav0dau{"dcav0dau", 1.5, "DCA V0 Daughters"}; - Configurable dcaV0ToPV{"dcaV0ToPV", 0.06, "DCA V0 To PV"}; - Configurable minRadius{"minRadius", 1.4f, "minRadius"}; - Configurable maxRadius{"maxRadius", 100.0f, "maxRadius"}; - Configurable minV0Radius{"minV0Radius", 1.2f, "V0 transverse decay radius, minimum"}; - Configurable maxV0Radius{"maxV0Radius", 100.0f, "V0 transverse decay radius, maximum"}; - Configurable nsigmatpcPi{"nsigmatpcPi", 5, "N sigma TPC Pion"}; - Configurable nsigmatpcPr{"nsigmatpcPr", 5, "N sigma TPC Proton"}; - Configurable nsigmatpcKa{"nsigmatpcKa", 5, "N sigma TPC Kaon"}; - Configurable nsigmatofPr{"nsigmatofPr", 3, "N sigma TOF Proton"}; - Configurable nsigmatofPion{"nsigmatofPion", 3, "N sigma TOF for Pion from V0"}; - Configurable nsigmatofBachPion{"nsigmatofBachPion", 3, "N sigma TOF for bachelor Pion"}; - Configurable nsigmatofBachKaon{"nsigmatofBachKaon", 3, "N sigma TOF for bachelor Kaon"}; - Configurable bachBaryonCosPA{"bachBaryonCosPA", 0.9999, "Bachelor baryon CosPA"}; - Configurable bachBaryonDCAxyToPV{"bachBaryonDCAxyToPV", 0.08, "DCA bachelor baryon to PV"}; - Configurable mintpccrrows{"mintpccrrows", 50, "min N TPC crossed rows"}; - Configurable dooobrej{"dooobrej", 0, "OOB rejection: 0 no selection, 1 = ITS||TOF, 2 = TOF only for pT > ptthrtof"}; - Configurable ptthrtof{"ptthrtof", 2, "Pt threshold for applying only tof oob rejection"}; - Configurable proplifetime{"proplifetime", 3, "ctau/"}; - Configurable rejcomp{"rejcomp", 0.008, "Competing Cascade rejection"}; - - Configurable doPtDepCosPaCut{"doPtDepCosPaCut", false, "Enable pt dependent cos PA cut"}; - Configurable doPtDepCascRadiusCut{"doPtDepCascRadiusCut", false, "Enable pt dependent cascade radius cut"}; - Configurable doPtDepV0RadiusCut{"doPtDepV0RadiusCut", false, "Enable pt dependent V0 radius cut"}; - Configurable doPtDepV0CosPaCut{"doPtDepV0CosPaCut", false, "Enable pt dependent cos PA cut of the V0 daughter"}; - Configurable doPtDepDCAcascDauCut{"doPtDepDCAcascDauCut", false, "Enable pt dependent DCA cascade daughter cut"}; - Configurable doDCAdauToPVCut{"doDCAdauToPVCut", true, "Enable cut DCA daughter track to PV"}; - Configurable doCascadeCosPaCut{"doCascadeCosPaCut", true, "Enable cos PA cut"}; - Configurable doV0CosPaCut{"doV0CosPaCut", true, "Enable cos PA cut for the V0 daughter"}; - Configurable doDCACascadeDauCut{"doDCACascadeDauCut", true, "Enable cut DCA betweenn daughter tracks"}; - Configurable doDCAV0DauCut{"doDCAV0DauCut", true, "Enable cut DCA betweenn V0 daughter tracks"}; - Configurable doCascadeRadiusCut{"doCascadeRadiusCut", true, "Enable cut on the cascade radius"}; - Configurable doV0RadiusCut{"doV0RadiusCut", true, "Enable cut on the V0 radius"}; - Configurable doDCAV0ToPVCut{"doDCAV0ToPVCut", true, "Enable cut DCA of V0 to PV"}; - Configurable doNTPCSigmaCut{"doNTPCSigmaCut", false, "Enable cut N sigma TPC"}; - Configurable doBachelorBaryonCut{"doBachelorBaryonCut", true, "Enable Bachelor-Baryon cut "}; - Configurable doProperLifeTimeCut{"doProperLifeTimeCut", true, "Enable proper life-time cut "}; - Configurable doNTOFSigmaProtonCut{"doNTOFSigmaProtonCut", true, "Enable n sigma TOF PID cut for proton from V0"}; - Configurable doNTOFSigmaV0PionCut{"doNTOFSigmaV0PionCut", false, "Enable n sigma TOF PID cut for pion from V0"}; - Configurable doNTOFSigmaBachelorCut{"doNTOFSigmaBachelorCut", false, "Enable n sigma TOF PID cut for bachelor track"}; - Configurable doFillNsigmaTPCHistPionBach{"doFillNsigmaTPCHistPionBach", false, ""}; - Configurable doFillNsigmaTPCHistKaonBach{"doFillNsigmaTPCHistKaonBach", false, ""}; - Configurable doFillNsigmaTPCHistProton{"doFillNsigmaTPCHistProton", false, ""}; - Configurable doFillNsigmaTPCHistV0Pion{"doFillNsigmaTPCHistV0Pion", false, ""}; Configurable nPtBinsForNsigmaTPC{"nPtBinsForNsigmaTPC", 100, ""}; - Configurable cosPApar0{"cosPApar0", 0.2, "const par for pt dep cosPA cut"}; - Configurable cosPApar1{"cosPApar1", -0.022, "linear par for pt dep cosPA cut"}; - - Configurable parCascRadius0{"parCascRadius0", 1.216159, "const par for pt dep radius cut"}; - Configurable parCascRadius1{"parCascRadius1", 0.064462, "linear par for pt dep radius cut"}; - - Configurable parV0Radius0{"parV0Radius0", 2.136381, "const par for pt dep V0 radius cut"}; - Configurable parV0Radius1{"parV0Radius1", 0.437074, "linear par for pt dep V0 radius cut"}; - - Configurable dcaCacsDauPar0{"dcaCacsDauPar0", 0.8, " par for pt dep DCA cascade daughter cut, p_T < 1 GeV/c"}; - Configurable dcaCacsDauPar1{"dcaCacsDauPar1", 0.5, " par for pt dep DCA cascade daughter cut, 1< p_T < 4 GeV/c"}; - Configurable dcaCacsDauPar2{"dcaCacsDauPar2", 0.2, " par for pt dep DCA cascade daughter cut, p_T > 4 GeV/c"}; - - ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles in |y| < 0.5"}; + struct : ConfigurableGroup { + std::string prefix = "qa"; + Configurable doFillNsigmaTPCHistPionBach{"doFillNsigmaTPCHistPionBach", false, ""}; + Configurable doFillNsigmaTPCHistKaonBach{"doFillNsigmaTPCHistKaonBach", false, ""}; + Configurable doFillNsigmaTPCHistProton{"doFillNsigmaTPCHistProton", false, ""}; + Configurable doFillNsigmaTPCHistV0Pion{"doFillNsigmaTPCHistV0Pion", false, ""}; + Configurable doBefSelCheck{"doBefSelCheck", false, "Fill mass histograms of all candidates before selections"}; + Configurable doPtDepCutStudy{"doPtDepCutStudy", false, "Fill histogram with a cutting paramer"}; + Configurable doBefSelEventMultCorr{"doBefSelEventMultCorr", false, "Enable histogram of multiplicity correlation before cuts"}; + Configurable doOccupancyCheck{"doOccupancyCheck", true, ""}; + } qaFlags; + + struct : ConfigurableGroup { + std::string prefix = "evSelection"; + Configurable doTFeventCut{"doTFeventCut", false, "Enable TF event Cut"}; + Configurable doITSFrameBorderCut{"doITSFrameBorderCut", false, "Enable ITSFrame event cut"}; + Configurable doTriggerTVXEventCut{"doTriggerTVXEventCut", false, "Minimal MB event selection, for MC"}; + Configurable doTriggerSel8EventCut{"doTriggerSel8EventCut", true, "Standard MB event selection"}; + Configurable doGoodPVFT0EventCut{"doGoodPVFT0EventCut", true, "check for the PV position diffrence when estimated from tracks and FT0"}; + Configurable doITSTPCvertexEventCut{"doITSTPCvertexEventCut", true, "checks the presence of at least one ITS-TPC track"}; + Configurable doSameBunchPileUpEventCut{"doSameBunchPileUpEventCut", true, "removes events associated with the same \"found-by-T0\" bunch crossing"}; + Configurable doVertexTOFmatch{"doVertexTOFmatch", false, "Checks wherher at least one of vertex contributors is matched to TOF"}; + Configurable doVertexTRDmatch{"doVertexTRDmatch", false, "Checks wherher at least one of vertex contributors is matched to TRD"}; + Configurable doTimeRangeStandardCut{"doTimeRangeStandardCut", true, "It rejects a given collision if there are other events nearby in dtime +/- 2 μs, or mult above some threshold in -4..-2 μs"}; + Configurable doTimeRangeStrictCut{"doTimeRangeStrictCut", false, "It rejects a given collision if there are other events nearby in |dt|< 10 μs"}; + Configurable doTimeRangeVzDependent{"doTimeRangeVzDependent", false, "It rejects collision with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ"}; + Configurable doNoCollInRofStrictCut{"doNoCollInRofStrictCut", false, "Enable an evevnt selection which rejects a collision if there are other events within the same ITS ROF"}; + Configurable doNoCollInRofStandardCut{"doNoCollInRofStandardCut", true, "Enable an evevnt selection which rejects a collision if there are other events within the same ITS ROF with mult above threshold"}; + Configurable doMultiplicityCorrCut{"doMultiplicityCorrCut", false, "Enable multiplicity vs centrality correlation cut"}; + Configurable zVertexCut{"zVertexCut", 10, "Cut on PV position"}; + } eventSelectionFlags; + + struct : ConfigurableGroup { + std::string prefix = "candidateSelFlag"; + Configurable doPtDepCosPaCut{"doPtDepCosPaCut", false, "Enable pt dependent cos PA cut"}; + Configurable doPtDepCascRadiusCut{"doPtDepCascRadiusCut", false, "Enable pt dependent cascade radius cut"}; + Configurable doPtDepV0RadiusCut{"doPtDepV0RadiusCut", false, "Enable pt dependent V0 radius cut"}; + Configurable doPtDepV0CosPaCut{"doPtDepV0CosPaCut", false, "Enable pt dependent cos PA cut of the V0 daughter"}; + Configurable doPtDepDCAcascDauCut{"doPtDepDCAcascDauCut", false, "Enable pt dependent DCA cascade daughter cut"}; + Configurable doDCAdauToPVCut{"doDCAdauToPVCut", true, "Enable cut DCA daughter track to PV"}; + Configurable doCascadeCosPaCut{"doCascadeCosPaCut", true, "Enable cos PA cut"}; + Configurable doV0CosPaCut{"doV0CosPaCut", true, "Enable cos PA cut for the V0 daughter"}; + Configurable doDCACascadeDauCut{"doDCACascadeDauCut", true, "Enable cut DCA betweenn daughter tracks"}; + Configurable doDCAV0DauCut{"doDCAV0DauCut", true, "Enable cut DCA betweenn V0 daughter tracks"}; + Configurable doCascadeRadiusCut{"doCascadeRadiusCut", true, "Enable cut on the cascade radius"}; + Configurable doV0RadiusCut{"doV0RadiusCut", true, "Enable cut on the V0 radius"}; + Configurable doDCAV0ToPVCut{"doDCAV0ToPVCut", true, "Enable cut DCA of V0 to PV"}; + Configurable doNTPCSigmaCut{"doNTPCSigmaCut", false, "Enable cut N sigma TPC"}; + Configurable doBachelorBaryonCut{"doBachelorBaryonCut", true, "Enable Bachelor-Baryon cut "}; + Configurable doProperLifeTimeCut{"doProperLifeTimeCut", true, "Enable proper life-time cut "}; + Configurable doNTOFSigmaProtonCut{"doNTOFSigmaProtonCut", true, "Enable n sigma TOF PID cut for proton from V0"}; + Configurable doNTOFSigmaV0PionCut{"doNTOFSigmaV0PionCut", false, "Enable n sigma TOF PID cut for pion from V0"}; + Configurable doNTOFSigmaBachelorCut{"doNTOFSigmaBachelorCut", false, "Enable n sigma TOF PID cut for bachelor track"}; + Configurable dooobrej{"dooobrej", 0, "OOB rejection: 0 no selection, 1 = ITS||TOF, 2 = TOF only for pT > ptthrtof"}; + } candidateSelectionFlags; + + struct : ConfigurableGroup { + std::string prefix = "candidateSelection"; + Configurable dcaBaryonToPV{"dcaBaryonToPV", 0.05, "DCA of baryon doughter track To PV"}; + Configurable dcaMesonToPV{"dcaMesonToPV", 0.1, "DCA of meson doughter track To PV"}; + Configurable dcaBachToPV{"dcaBachToPV", 0.04, "DCA Bach To PV"}; + Configurable casccospa{"casccospa", 0.97, "Casc CosPA"}; + Configurable v0cospa{"v0cospa", 0.97, "V0 CosPA"}; + Configurable dcacascdau{"dcacascdau", 1., "DCA Casc Daughters"}; + Configurable dcav0dau{"dcav0dau", 1.5, "DCA V0 Daughters"}; + Configurable dcaV0ToPV{"dcaV0ToPV", 0.06, "DCA V0 To PV"}; + Configurable minRadius{"minRadius", 1.4f, "minRadius"}; + Configurable maxRadius{"maxRadius", 100.0f, "maxRadius"}; + Configurable minV0Radius{"minV0Radius", 1.2f, "V0 transverse decay radius, minimum"}; + Configurable maxV0Radius{"maxV0Radius", 100.0f, "V0 transverse decay radius, maximum"}; + Configurable nsigmatpcPi{"nsigmatpcPi", 5, "N sigma TPC Pion"}; + Configurable nsigmatpcPr{"nsigmatpcPr", 5, "N sigma TPC Proton"}; + Configurable nsigmatpcKa{"nsigmatpcKa", 5, "N sigma TPC Kaon"}; + Configurable nsigmatofPr{"nsigmatofPr", 3, "N sigma TOF Proton"}; + Configurable nsigmatofPion{"nsigmatofPion", 3, "N sigma TOF for Pion from V0"}; + Configurable nsigmatofBachPion{"nsigmatofBachPion", 3, "N sigma TOF for bachelor Pion"}; + Configurable nsigmatofBachKaon{"nsigmatofBachKaon", 3, "N sigma TOF for bachelor Kaon"}; + Configurable bachBaryonCosPA{"bachBaryonCosPA", 0.9999, "Bachelor baryon CosPA"}; + Configurable bachBaryonDCAxyToPV{"bachBaryonDCAxyToPV", 0.08, "DCA bachelor baryon to PV"}; + Configurable mintpccrrows{"mintpccrrows", 70, "min N TPC crossed rows"}; + Configurable cosPApar0{"cosPApar0", 0.2, "const par for pt dep cosPA cut"}; + Configurable cosPApar1{"cosPApar1", -0.022, "linear par for pt dep cosPA cut"}; + Configurable parCascRadius0{"parCascRadius0", 1.216159, "const par for pt dep radius cut"}; + Configurable parCascRadius1{"parCascRadius1", 0.064462, "linear par for pt dep radius cut"}; + Configurable parV0Radius0{"parV0Radius0", 2.136381, "const par for pt dep V0 radius cut"}; + Configurable parV0Radius1{"parV0Radius1", 0.437074, "linear par for pt dep V0 radius cut"}; + Configurable dcaCacsDauPar0{"dcaCacsDauPar0", 0.8, " par for pt dep DCA cascade daughter cut, p_T < 1 GeV/c"}; + Configurable dcaCacsDauPar1{"dcaCacsDauPar1", 0.5, " par for pt dep DCA cascade daughter cut, 1< p_T < 4 GeV/c"}; + Configurable dcaCacsDauPar2{"dcaCacsDauPar2", 0.2, " par for pt dep DCA cascade daughter cut, p_T > 4 GeV/c"}; + Configurable lambdaMassWin{"lambdaMassWin", 0.005, "V0 Mass window limit"}; + Configurable proplifetime{"proplifetime", 3, "ctau/"}; + Configurable ptthrtof{"ptthrtof", 2, "Pt threshold for applying only tof oob rejection"}; + Configurable rejcomp{"rejcomp", 0.008, "Competing Cascade rejection"}; + Configurable masswin{"masswin", 0.05, "Mass window limit"}; + Configurable rapCut{"rapCut", 0.5, "Rapidity acceptance"}; + Configurable etaDauCut{"etaDauCut", 0.8, "Pseudorapidity acceptance of the cascade daughters"}; + } candidateSelectionValues; Service pdgDB; @@ -169,41 +196,41 @@ struct derivedCascadeAnalysis { { histos.add("hEventVertexZ", "hEventVertexZ", kTH1F, {vertexZ}); histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{101, 0, 101}}); - histos.add("hEventSelection", "hEventSelection", kTH1F, {{17, 0, 17}}); - histos.add("hOccupancyVsCentrality", "", kTH2F, {axisOccupancy, {100, 0, 100}}); + histos.add("hEventSelection", "hEventSelection", kTH1F, {{21, 0, 21}}); + histos.add("hOccupancyVsOccupFt0VsCentrality", "", kTH3F, {axisOccupancy, axisOccupancyFt0, {100, 0, 100}}); histos.add("hEventNchCorrelationAfCuts", "hEventNchCorrelationAfCuts", kTH2F, {{5000, 0, 5000}, {5000, 0, 2500}}); histos.add("hEventPVcontributorsVsCentrality", "hEventPVcontributorsVsCentrality", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); histos.add("hEventGlobalTracksVsCentrality", "hEventGlobalTracksVsCentrality", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); - if (doBefSelEventMultCorr) { + if (qaFlags.doBefSelEventMultCorr) { histos.add("hEventNchCorrelationBefCuts", "hEventNchCorrelationBefCuts", kTH2F, {{5000, 0, 5000}, {2500, 0, 2500}}); histos.add("hEventPVcontributorsVsCentralityBefCuts", "hEventPVcontributorsVsCentralityBefCuts", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); histos.add("hEventGlobalTracksVsCentralityBefCuts", "hEventGlobalTracksVsCentralityBefCuts", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); } histos.add("hCandidate", "hCandidate", HistType::kTH1D, {{22, -0.5, 21.5}}); - histos.add("hCutValue", "hCutValue", HistType::kTH2D, {{22, -0.5, 21.5}, {300, 0, 3.01}}); + histos.add("hCutValue", "hCutValue", HistType::kTH2D, {{22, -0.5, 21.5}, {300, 0, 3.1}}); - if (doFillNsigmaTPCHistProton) { + if (qaFlags.doFillNsigmaTPCHistProton) { histos.add("hNsigmaProton", "hNsigmaProton", HistType::kTH3D, {{280, -7, 7}, {nPtBinsForNsigmaTPC, 0, 6}, {100, 0, 100}}); histos.add("hNsigmaProtonNeg", "hNsigmaProtonNeg", HistType::kTH3D, {{280, -7, 7}, {nPtBinsForNsigmaTPC, 0, 6}, {100, 0, 100}}); } - if (doFillNsigmaTPCHistV0Pion) { + if (qaFlags.doFillNsigmaTPCHistV0Pion) { histos.add("hNsigmaPionNeg", "hNsigmaPionNeg", HistType::kTH3D, {{280, -7, 7}, {nPtBinsForNsigmaTPC, 0, 2}, {100, 0, 100}}); histos.add("hNsigmaPionPos", "hNsigmaPionPos", HistType::kTH3D, {{280, -7, 7}, {nPtBinsForNsigmaTPC, 0, 2}, {100, 0, 100}}); } - if (doFillNsigmaTPCHistPionBach) { + if (qaFlags.doFillNsigmaTPCHistPionBach) { histos.add("hNsigmaPionPosBach", "hNsigmaPionPosBach", HistType::kTH3D, {{280, -7, 7}, {nPtBinsForNsigmaTPC, 0, 2}, {100, 0, 100}}); histos.add("hNsigmaPionNegBach", "hNsigmaPionNegBach", HistType::kTH3D, {{280, -7, 7}, {nPtBinsForNsigmaTPC, 0, 2}, {100, 0, 100}}); } - if (doFillNsigmaTPCHistKaonBach) + if (qaFlags.doFillNsigmaTPCHistKaonBach) histos.add("hNsigmaKaon", "hNsigmaKaon", HistType::kTH3D, {{280, -7, 7}, {nPtBinsForNsigmaTPC, 0, 6}, {100, 0, 100}}); - if (doNTOFSigmaProtonCut) + if (candidateSelectionFlags.doNTOFSigmaProtonCut) histos.add("hNsigmaTOFProton", "", HistType::kTH3D, {{70, -7, 7}, {100, 0, 10}, {100, 0, 100}}); - if (doNTOFSigmaV0PionCut) + if (candidateSelectionFlags.doNTOFSigmaV0PionCut) histos.add("hNsigmaTOFV0Pion", "", HistType::kTH3D, {{70, -7, 7}, {100, 0, 10}, {100, 0, 100}}); - if (doNTOFSigmaBachelorCut) { + if (candidateSelectionFlags.doNTOFSigmaBachelorCut) { if (isXi) histos.add("hNsigmaTOFBachelorPion", "", HistType::kTH3D, {{70, -7, 7}, {100, 0, 10}, {100, 0, 100}}); else @@ -219,9 +246,13 @@ struct derivedCascadeAnalysis { histos.add("InvMassAfterSel/hNegativeCascade", "hNegativeCascade", HistType::kTH3F, {axisPt, axisMass, {101, 0, 101}}); histos.add("InvMassAfterSel/hPositiveCascade", "hPositiveCascade", {HistType::kTH3F, {axisPt, axisMass, {101, 0, 101}}}); - if (doOccupancyCheck) { + if (qaFlags.doOccupancyCheck) { histos.add("InvMassAfterSelCent1/hNegativeCascade", "hNegativeCascade", HistType::kTH3F, {axisPt, axisMass, axisOccupancy}); histos.add("InvMassAfterSelCent1/hPositiveCascade", "hPositiveCascade", HistType::kTH3F, {axisPt, axisMass, axisOccupancy}); + if (doprocessCascadesMCrec) { + histos.add("InvMassAfterSelCent1/hNegativeCascadeMCTruth", "hNegativeCascadeMCTruth", HistType::kTH3F, {axisPt, axisMass, axisOccupancy}); + histos.add("InvMassAfterSelCent1/hPositiveCascadeMCTruth", "hPositiveCascadeMCTruth", HistType::kTH3F, {axisPt, axisMass, axisOccupancy}); + } histos.addClone("InvMassAfterSelCent1/", "InvMassAfterSelCent2/"); histos.addClone("InvMassAfterSelCent1/", "InvMassAfterSelCent3/"); histos.addClone("InvMassAfterSelCent1/", "InvMassAfterSelCent4/"); @@ -233,48 +264,48 @@ struct derivedCascadeAnalysis { histos.addClone("InvMassAfterSelCent1/", "InvMassAfterSelCent10/"); } - if (doBefSelCheck) + if (qaFlags.doBefSelCheck) histos.addClone("InvMassAfterSel/", "InvMassBefSel/"); if (doprocessCascadesMCrec) histos.addClone("InvMassAfterSel/", "InvMassAfterSelMCrecTruth/"); - if (doPtDepCutStudy && !doProperLifeTimeCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doProperLifeTimeCut) { histos.add("PtDepCutStudy/hNegativeCascadeProperLifeTime", "hNegativeCascadeProperLifeTime", HistType::kTH3F, {axisPt, axisMass, {100, 0, 10}}); histos.add("PtDepCutStudy/hPositiveCascadeProperLifeTime", "hPositiveCascadeProperLifeTime", {HistType::kTH3F, {axisPt, axisMass, {100, 0, 10}}}); } - if (doPtDepCutStudy && !doBachelorBaryonCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doBachelorBaryonCut) { histos.add("PtDepCutStudy/hNegativeBachelorBaryonDCA", "hNegativeBachelorBaryonDCA", HistType::kTH3F, {axisPt, axisMass, {40, 0, 1}}); histos.add("PtDepCutStudy/hPositiveBachelorBaryonDCA", "hPositiveBachelorBaryonDCA", {HistType::kTH3F, {axisPt, axisMass, {40, 0, 1}}}); } - if (doPtDepCutStudy && !doDCAV0ToPVCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doDCAV0ToPVCut) { histos.add("PtDepCutStudy/hNegativeDCAV0ToPV", "hNegativeDCAV0ToPV", HistType::kTH3F, {axisPt, axisMass, {40, 0, 1}}); histos.add("PtDepCutStudy/hPositiveDCAV0ToPV", "hPositiveDCAV0ToPV", {HistType::kTH3F, {axisPt, axisMass, {40, 0, 1}}}); } - if (doPtDepCutStudy && !doV0RadiusCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doV0RadiusCut) { histos.add("PtDepCutStudy/hNegativeV0Radius", "hNegativeV0Radius", HistType::kTH3F, {axisPt, axisMass, {20, 0, 10}}); histos.add("PtDepCutStudy/hPositiveV0Radius", "hPositiveV0Radius", {HistType::kTH3F, {axisPt, axisMass, {20, 0, 10}}}); } - if (doPtDepCutStudy && !doCascadeRadiusCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doCascadeRadiusCut) { histos.add("PtDepCutStudy/hNegativeCascadeRadius", "hNegativeCascadeRadius", HistType::kTH3F, {axisPt, axisMass, {50, 0, 5}}); histos.add("PtDepCutStudy/hPositiveCascadeRadius", "hPositiveCascadeRadius", {HistType::kTH3F, {axisPt, axisMass, {50, 0, 5}}}); } - if (doPtDepCutStudy && !doDCAV0DauCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doDCAV0DauCut) { histos.add("PtDepCutStudy/hNegativeDCAV0Daughters", "hNegativeDCAV0Daughters", HistType::kTH3F, {axisPt, axisMass, {50, 0, 5}}); histos.add("PtDepCutStudy/hPositiveDCAV0Daughters", "hPositiveDCAV0Daughters", {HistType::kTH3F, {axisPt, axisMass, {50, 0, 5}}}); } - if (doPtDepCutStudy && !doDCACascadeDauCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doDCACascadeDauCut) { histos.add("PtDepCutStudy/hNegativeDCACascDaughters", "hNegativeDCACascDaughters", {HistType::kTH3F, {axisPt, axisMass, {20, 0, 1}}}); histos.add("PtDepCutStudy/hPositiveDCACascDaughters", "hPositiveDCACascDaughters", {HistType::kTH3F, {axisPt, axisMass, {20, 0, 1}}}); } - if (doPtDepCutStudy && !doV0CosPaCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doV0CosPaCut) { histos.add("PtDepCutStudy/hNegativeV0pa", "hNegativeV0pa", HistType::kTH3F, {axisPt, axisMass, {40, 0, 0.4}}); histos.add("PtDepCutStudy/hPositiveV0pa", "hPositiveV0pa", {HistType::kTH3F, {axisPt, axisMass, {40, 0, 0.4}}}); } - if (doPtDepCutStudy && !doDCAdauToPVCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doDCAdauToPVCut) { histos.add("PtDepCutStudy/hNegativeDCABachelorToPV", "hNegativeDCABachelorToPV", HistType::kTH3F, {axisPt, axisMass, {50, 0, 0.5}}); histos.add("PtDepCutStudy/hNegativeDCABaryonToPV", "hNegativeDCABaryonToPV", HistType::kTH3F, {axisPt, axisMass, {50, 0, 0.5}}); histos.add("PtDepCutStudy/hNegativeDCAMesonToPV", "hNegativeDCAMesonToPV", HistType::kTH3F, {axisPt, axisMass, {50, 0, 0.5}}); @@ -283,7 +314,7 @@ struct derivedCascadeAnalysis { histos.add("PtDepCutStudy/hPositiveDCAMesonToPV", "hPositiveDCAMesonToPV", HistType::kTH3F, {axisPt, axisMass, {50, 0, 0.5}}); } - if (doPtDepCutStudy && !doCascadeCosPaCut) { + if (qaFlags.doPtDepCutStudy && !candidateSelectionFlags.doCascadeCosPaCut) { histos.add("PtDepCutStudy/hNegativeCascPA", "hNegativeCascPA", HistType::kTH3F, {axisPt, axisMass, {40, 0, 0.4}}); histos.add("PtDepCutStudy/hPositiveCascPA", "hPositiveCascPA", {HistType::kTH3F, {axisPt, axisMass, {40, 0, 0.4}}}); } @@ -306,6 +337,11 @@ struct derivedCascadeAnalysis { histos.add("h2dGenOmegaMinus", "h2dGenOmegaMinus", kTH2D, {{101, 0.0f, 101.0f}, axisPt}); histos.add("h2dGenOmegaPlus", "h2dGenOmegaPlus", kTH2D, {{101, 0.0f, 101.0f}, axisPt}); + histos.add("h2dGenXiMinusVsCentOccupancy", "h2dGenXiMinusVsCentOccupancy", kTH3D, {axisPt, {101, 0.0f, 101.0f}, axisOccupancy}); + histos.add("h2dGenXiPlusVsCentOccupancy", "h2dGenXiPlusVsCentOccupancy", kTH3D, {axisPt, {101, 0.0f, 101.0f}, axisOccupancy}); + histos.add("h2dGenOmegaMinusVsCentOccupancy", "h2dGenOmegaMinusVsCentOccupancy", kTH3D, {axisPt, {101, 0.0f, 101.0f}, axisOccupancy}); + histos.add("h2dGenOmegaPlusVsCentOccupancy", "h2dGenOmegaPlusVsCentOccupancy", kTH3D, {axisPt, {101, 0.0f, 101.0f}, axisOccupancy}); + histos.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", kTH2D, {axisNch, axisPt}); histos.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", kTH2D, {axisNch, axisPt}); histos.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", kTH2D, {axisNch, axisPt}); @@ -319,31 +355,31 @@ struct derivedCascadeAnalysis { if (ptdepcut) { double ptdepCut; if (isCascPa) - ptdepCut = cosPApar0 + cosPApar1 * casc.pt(); + ptdepCut = candidateSelectionValues.cosPApar0 + candidateSelectionValues.cosPApar1 * casc.pt(); else - ptdepCut = cosPApar0 + cosPApar1 * casc.pt(); + ptdepCut = candidateSelectionValues.cosPApar0 + candidateSelectionValues.cosPApar1 * casc.pt(); if (ptdepCut > 0.3 && casc.pt() < 0.5) ptdepCut = 0.3; if (ptdepCut < 0.012) ptdepCut = 0.012; if (isCascPa) - histos.fill(HIST("hCutValue"), 16, TMath::Cos(ptdepCut)); + histos.fill(HIST("hCutValue"), 15, TMath::Cos(ptdepCut)); if (!isCascPa) - histos.fill(HIST("hCutValue"), 12, TMath::Cos(ptdepCut)); + histos.fill(HIST("hCutValue"), 11, TMath::Cos(ptdepCut)); if (isCascPa && casc.casccosPA(x, y, z) < TMath::Cos(ptdepCut)) return false; if (!isCascPa && casc.v0cosPA(x, y, z) < TMath::Cos(ptdepCut)) return false; } else { - float cut = casccospa; - float cutV0 = v0cospa; + float cut = candidateSelectionValues.casccospa; + float cutV0 = candidateSelectionValues.v0cospa; if (isCascPa) - histos.fill(HIST("hCutValue"), 16, cut); + histos.fill(HIST("hCutValue"), 15, cut); if (!isCascPa) - histos.fill(HIST("hCutValue"), 12, cutV0); - if (isCascPa && casc.casccosPA(x, y, z) < casccospa) + histos.fill(HIST("hCutValue"), 11, cutV0); + if (isCascPa && casc.casccosPA(x, y, z) < candidateSelectionValues.casccospa) return false; - if (!isCascPa && casc.v0cosPA(x, y, z) < v0cospa) + if (!isCascPa && casc.v0cosPA(x, y, z) < candidateSelectionValues.v0cospa) return false; } @@ -357,25 +393,25 @@ struct derivedCascadeAnalysis { if (fillHists) histos.fill(HIST("hEventSelection"), 0.5 /* all collisions */); - if (doBefSelEventMultCorr) { + if (qaFlags.doBefSelEventMultCorr) { histos.fill(HIST("hEventNchCorrelationBefCuts"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); histos.fill(HIST("hEventPVcontributorsVsCentralityBefCuts"), coll.centFT0C(), coll.multNTracksPVeta1()); histos.fill(HIST("hEventGlobalTracksVsCentralityBefCuts"), coll.centFT0C(), coll.multNTracksGlobal()); } - if (doTriggerTVXEventCut && !coll.selection_bit(aod::evsel::kIsTriggerTVX)) { + if (eventSelectionFlags.doTriggerTVXEventCut && !coll.selection_bit(aod::evsel::kIsTriggerTVX)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 1.5 /* collisions after sel*/); - if (doTriggerSel8EventCut && !coll.sel8()) { + if (eventSelectionFlags.doTriggerSel8EventCut && !coll.sel8()) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 2.5 /* collisions after sel*/); - if (TMath::Abs(coll.posZ()) > zVertexCut) { + if (TMath::Abs(coll.posZ()) > eventSelectionFlags.zVertexCut) { return false; } if (fillHists) @@ -387,49 +423,49 @@ struct derivedCascadeAnalysis { if (fillHists) histos.fill(HIST("hEventSelection"), 4.5 /* collisions after centrality sel*/); - if (doSameBunchPileUpEventCut && !coll.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + if (eventSelectionFlags.doSameBunchPileUpEventCut && !coll.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 5.5 /* Not same Bunch pile up */); - if (doGoodPVFT0EventCut && !coll.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (eventSelectionFlags.doGoodPVFT0EventCut && !coll.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 6.5 /* No large vertexZ difference from tracks and FT0*/); - if (doITSTPCvertexEventCut && !coll.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + if (eventSelectionFlags.doITSTPCvertexEventCut && !coll.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 7.5 /* At least one ITS-TPC track in the event*/); - if (doVertexTOFmatch && !coll.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + if (eventSelectionFlags.doVertexTOFmatch && !coll.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 8.5 /* At least one of vertex contributors is matched to TOF*/); - if (doVertexTRDmatch && !coll.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + if (eventSelectionFlags.doVertexTRDmatch && !coll.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 9.5 /* At least one of vertex contributors is matched to TRD*/); - if (doITSFrameBorderCut && !coll.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + if (eventSelectionFlags.doITSFrameBorderCut && !coll.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 10.5 /* Not at ITS ROF border */); - if (doTFeventCut && !coll.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + if (eventSelectionFlags.doTFeventCut && !coll.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { return false; } if (fillHists) histos.fill(HIST("hEventSelection"), 11.5 /* Not at TF border */); - if (doMultiplicityCorrCut) { + if (eventSelectionFlags.doMultiplicityCorrCut) { if (coll.multNTracksGlobal() < (1343.3 * TMath::Exp(-0.0443259 * coll.centFT0C()) - 50) || coll.multNTracksGlobal() > (2098.9 * TMath::Exp(-0.0332444 * coll.centFT0C()))) return false; if (coll.multNTracksPVeta1() < (3703 * TMath::Exp(-0.0455483 * coll.centFT0C()) - 150) || coll.multNTracksPVeta1() > (4937.33 * TMath::Exp(-0.0372668 * coll.centFT0C()) + 20)) @@ -438,17 +474,17 @@ struct derivedCascadeAnalysis { if (fillHists) histos.fill(HIST("hEventSelection"), 12.5 /* Remove outlyers */); - if (doTimeRangeStandardCut && !coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + if (eventSelectionFlags.doTimeRangeStrictCut && !coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { return false; } if (fillHists) - histos.fill(HIST("hEventSelection"), 13.5 /* Rejection of events too close in time */); + histos.fill(HIST("hEventSelection"), 13.5 /* Rejection of events too close in time, dtime +/- 10 μs */); - if (doTimeRangeNarrowCut && !coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + if (eventSelectionFlags.doTimeRangeStandardCut && !coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return false; } if (fillHists) - histos.fill(HIST("hEventSelection"), 14.5 /* No other collision within +/- 4 microseconds */); + histos.fill(HIST("hEventSelection"), 14.5 /* No other collision within +/- 2 μs, or mult above some threshold in -4..-2 μs */); int occupancy = coll.trackOccupancyInTimeRange(); if (minOccupancy > 0 && occupancy < minOccupancy) { @@ -462,8 +498,36 @@ struct derivedCascadeAnalysis { if (fillHists) histos.fill(HIST("hEventSelection"), 16.5 /* Above max occupancy */); + if (eventSelectionFlags.doNoCollInRofStrictCut && !coll.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 17.5 /*rejects a collision if there are other events within the same ITS ROF*/); + + if (eventSelectionFlags.doNoCollInRofStandardCut && !coll.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 18.5 /*rejects a collision if there are other events within the same ITS ROF above mult threshold*/); + + if (eventSelectionFlags.doTimeRangeVzDependent && !coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 19.5 /*rejects collision with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ*/); + + float occupancyFT0 = coll.ft0cOccupancyInTimeRange(); + if (minOccupancyFT0 > 0 && occupancyFT0 < minOccupancyFT0) { + return false; + } + if (maxOccupancyFT0 > 0 && occupancyFT0 > maxOccupancyFT0) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 20.5 /* Occupancy FT0 selection */); + if (fillHists) { - histos.fill(HIST("hOccupancyVsCentrality"), occupancy, coll.centFT0C()); + histos.fill(HIST("hOccupancyVsOccupFt0VsCentrality"), occupancy, occupancyFT0, coll.centFT0C()); histos.fill(HIST("hEventCentrality"), coll.centFT0C()); histos.fill(HIST("hEventVertexZ"), coll.posZ()); histos.fill(HIST("hEventNchCorrelationAfCuts"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); @@ -477,42 +541,42 @@ struct derivedCascadeAnalysis { template bool IsCascadeCandidateAccepted(TCascade casc, int counter, float /*centrality*/) { - float cut = masswin; + float cut = candidateSelectionValues.masswin; + histos.fill(HIST("hCutValue"), 1, cut); + cut = candidateSelectionValues.rapCut; histos.fill(HIST("hCutValue"), 2, cut); - cut = rapCut; - histos.fill(HIST("hCutValue"), 3, cut); if (isXi) { - if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > masswin) { + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > candidateSelectionValues.masswin) { return false; } histos.fill(HIST("hCandidate"), ++counter); - if (TMath::Abs(casc.yXi()) > rapCut) + if (TMath::Abs(casc.yXi()) > candidateSelectionValues.rapCut) return false; histos.fill(HIST("hCandidate"), ++counter); } else { - if (TMath::Abs(casc.mOmega() - pdgDB->Mass(3334)) > masswin) { + if (TMath::Abs(casc.mOmega() - pdgDB->Mass(3334)) > candidateSelectionValues.masswin) { return false; } histos.fill(HIST("hCandidate"), ++counter); - if (TMath::Abs(casc.yOmega()) > rapCut) + if (TMath::Abs(casc.yOmega()) > candidateSelectionValues.rapCut) return false; histos.fill(HIST("hCandidate"), ++counter); } - if (doDCACascadeDauCut) { - if (doPtDepDCAcascDauCut) { - float ptDepCut = dcaCacsDauPar0; + if (candidateSelectionFlags.doDCACascadeDauCut) { + if (candidateSelectionFlags.doPtDepDCAcascDauCut) { + float ptDepCut = candidateSelectionValues.dcaCacsDauPar0; if (casc.pt() > 1 && casc.pt() < 4) - ptDepCut = dcaCacsDauPar1; + ptDepCut = candidateSelectionValues.dcaCacsDauPar1; else if (casc.pt() > 4) - ptDepCut = dcaCacsDauPar2; - histos.fill(HIST("hCutValue"), 4, ptDepCut); + ptDepCut = candidateSelectionValues.dcaCacsDauPar2; + histos.fill(HIST("hCutValue"), 3, ptDepCut); if (casc.dcacascdaughters() > ptDepCut) return false; } else { - cut = dcacascdau; - histos.fill(HIST("hCutValue"), 4, cut); - if (casc.dcacascdaughters() > dcacascdau) + cut = candidateSelectionValues.dcacascdau; + histos.fill(HIST("hCutValue"), 3, cut); + if (casc.dcacascdaughters() > candidateSelectionValues.dcacascdau) return false; } histos.fill(HIST("hCandidate"), ++counter); @@ -520,67 +584,67 @@ struct derivedCascadeAnalysis { ++counter; } - if (doDCAV0DauCut) { - cut = dcav0dau; - histos.fill(HIST("hCutValue"), 5, cut); - if (casc.dcaV0daughters() > dcav0dau) + if (candidateSelectionFlags.doDCAV0DauCut) { + cut = candidateSelectionValues.dcav0dau; + histos.fill(HIST("hCutValue"), 4, cut); + if (casc.dcaV0daughters() > candidateSelectionValues.dcav0dau) return false; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } - if (doCascadeRadiusCut) { - if (doPtDepCascRadiusCut) { - double ptdepminRadius = parCascRadius0 + parCascRadius1 * casc.pt(); - histos.fill(HIST("hCutValue"), 6, ptdepminRadius); + if (candidateSelectionFlags.doCascadeRadiusCut) { + if (candidateSelectionFlags.doPtDepCascRadiusCut) { + double ptdepminRadius = candidateSelectionValues.parCascRadius0 + candidateSelectionValues.parCascRadius1 * casc.pt(); + histos.fill(HIST("hCutValue"), 5, ptdepminRadius); if (casc.cascradius() < ptdepminRadius) return false; } else { - cut = minRadius; - histos.fill(HIST("hCutValue"), 6, cut); - if (casc.cascradius() < minRadius) + cut = candidateSelectionValues.minRadius; + histos.fill(HIST("hCutValue"), 5, cut); + if (casc.cascradius() < candidateSelectionValues.minRadius) return false; } histos.fill(HIST("hCandidate"), ++counter); - if (casc.cascradius() > maxRadius) + if (casc.cascradius() > candidateSelectionValues.maxRadius) return false; histos.fill(HIST("hCandidate"), ++counter); } else { counter += 2; } - if (doV0RadiusCut) { - if (doPtDepV0RadiusCut) { - float cut = parV0Radius0 + casc.pt() * parV0Radius1; - histos.fill(HIST("hCutValue"), 8, cut); + if (candidateSelectionFlags.doV0RadiusCut) { + if (candidateSelectionFlags.doPtDepV0RadiusCut) { + float cut = candidateSelectionValues.parV0Radius0 + casc.pt() * candidateSelectionValues.parV0Radius1; + histos.fill(HIST("hCutValue"), 7, cut); if (casc.v0radius() < cut) return false; } else { - cut = minV0Radius; - histos.fill(HIST("hCutValue"), 8, cut); - if (casc.v0radius() < minV0Radius) + cut = candidateSelectionValues.minV0Radius; + histos.fill(HIST("hCutValue"), 7, cut); + if (casc.v0radius() < candidateSelectionValues.minV0Radius) return false; } histos.fill(HIST("hCandidate"), ++counter); - if (casc.v0radius() > maxV0Radius) + if (casc.v0radius() > candidateSelectionValues.maxV0Radius) return false; histos.fill(HIST("hCandidate"), ++counter); } else { counter += 2; } - cut = lambdaMassWin; - histos.fill(HIST("hCutValue"), 10, cut); - if (TMath::Abs(casc.mLambda() - pdgDB->Mass(3122)) > lambdaMassWin) + cut = candidateSelectionValues.lambdaMassWin; + histos.fill(HIST("hCutValue"), 9, cut); + if (TMath::Abs(casc.mLambda() - pdgDB->Mass(3122)) > candidateSelectionValues.lambdaMassWin) return false; histos.fill(HIST("hCandidate"), ++counter); - cut = bachBaryonDCAxyToPV; - histos.fill(HIST("hCutValue"), 11, cut); - if (doBachelorBaryonCut) { - if ((casc.bachBaryonCosPA() > bachBaryonCosPA || TMath::Abs(casc.bachBaryonDCAxyToPV()) < bachBaryonDCAxyToPV)) { // Bach-baryon selection if required + cut = candidateSelectionValues.bachBaryonDCAxyToPV; + histos.fill(HIST("hCutValue"), 10, cut); + if (candidateSelectionFlags.doBachelorBaryonCut) { + if ((casc.bachBaryonCosPA() > candidateSelectionValues.bachBaryonCosPA || TMath::Abs(casc.bachBaryonDCAxyToPV()) < candidateSelectionValues.bachBaryonDCAxyToPV)) { // Bach-baryon selection if required return false; } histos.fill(HIST("hCandidate"), ++counter); @@ -588,38 +652,38 @@ struct derivedCascadeAnalysis { ++counter; } - if (doV0CosPaCut) { - if (!IsCosPAAccepted(casc, casc.x(), casc.y(), casc.z(), doPtDepV0CosPaCut, false)) + if (candidateSelectionFlags.doV0CosPaCut) { + if (!IsCosPAAccepted(casc, casc.x(), casc.y(), casc.z(), candidateSelectionFlags.doPtDepV0CosPaCut, false)) return false; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } - cut = rejcomp; - histos.fill(HIST("hCutValue"), 13, cut); + cut = candidateSelectionValues.rejcomp; + histos.fill(HIST("hCutValue"), 12, cut); if (isXi) { - if (TMath::Abs(casc.mOmega() - pdgDB->Mass(3334)) < rejcomp) + if (TMath::Abs(casc.mOmega() - pdgDB->Mass(3334)) < candidateSelectionValues.rejcomp) return false; histos.fill(HIST("hCandidate"), ++counter); } else { - if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) < rejcomp) + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) < candidateSelectionValues.rejcomp) return false; histos.fill(HIST("hCandidate"), ++counter); } - cut = dcaBachToPV; - histos.fill(HIST("hCutValue"), 14, cut); - cut = dcaMesonToPV; - histos.fill(HIST("hCutValue"), 14, cut); - cut = dcaBaryonToPV; - histos.fill(HIST("hCutValue"), 14, cut); - if (doDCAdauToPVCut) { - if (TMath::Abs(casc.dcabachtopv()) < dcaBachToPV) + cut = candidateSelectionValues.dcaBachToPV; + histos.fill(HIST("hCutValue"), 13, cut); + cut = candidateSelectionValues.dcaMesonToPV; + histos.fill(HIST("hCutValue"), 13, cut); + cut = candidateSelectionValues.dcaBaryonToPV; + histos.fill(HIST("hCutValue"), 13, cut); + if (candidateSelectionFlags.doDCAdauToPVCut) { + if (TMath::Abs(casc.dcabachtopv()) < candidateSelectionValues.dcaBachToPV) return false; - if (casc.sign() > 0 && (TMath::Abs(casc.dcanegtopv()) < dcaBaryonToPV || TMath::Abs(casc.dcapostopv()) < dcaMesonToPV)) + if (casc.sign() > 0 && (TMath::Abs(casc.dcanegtopv()) < candidateSelectionValues.dcaBaryonToPV || TMath::Abs(casc.dcapostopv()) < candidateSelectionValues.dcaMesonToPV)) return false; - if (casc.sign() < 0 && (TMath::Abs(casc.dcapostopv()) < dcaBaryonToPV || TMath::Abs(casc.dcanegtopv()) < dcaMesonToPV)) + if (casc.sign() < 0 && (TMath::Abs(casc.dcapostopv()) < candidateSelectionValues.dcaBaryonToPV || TMath::Abs(casc.dcanegtopv()) < candidateSelectionValues.dcaMesonToPV)) return false; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -656,7 +720,7 @@ struct derivedCascadeAnalysis { invmass = casc.mOmega(); // To have trace of how it was before selections - if (doBefSelCheck) { + if (qaFlags.doBefSelCheck) { if (isPositive) histos.fill(HIST("InvMassBefSel/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), invmass, coll.centFT0C()); if (isNegative) @@ -679,24 +743,24 @@ struct derivedCascadeAnalysis { auto fullmomentumNegDaugh = TMath::Sqrt(TMath::Power(casc.pxneg(), 2) + TMath::Power(casc.pyneg(), 2) + TMath::Power(casc.pzneg(), 2)); auto fullmomentumBachelor = TMath::Sqrt(TMath::Power(casc.pxbach(), 2) + TMath::Power(casc.pybach(), 2) + TMath::Power(casc.pzbach(), 2)); - float cut = etaDauCut; + float cut = candidateSelectionValues.etaDauCut; histos.fill(HIST("hCutValue"), counter + 1, cut); - if (TMath::Abs(poseta) > etaDauCut || TMath::Abs(negeta) > etaDauCut || TMath::Abs(bacheta) > etaDauCut) + if (TMath::Abs(poseta) > candidateSelectionValues.etaDauCut || TMath::Abs(negeta) > candidateSelectionValues.etaDauCut || TMath::Abs(bacheta) > candidateSelectionValues.etaDauCut) continue; histos.fill(HIST("hCandidate"), ++counter); - if (doCascadeCosPaCut) { - if (!IsCosPAAccepted(casc, coll.posX(), coll.posY(), coll.posZ(), doPtDepCosPaCut, true)) + if (candidateSelectionFlags.doCascadeCosPaCut) { + if (!IsCosPAAccepted(casc, coll.posX(), coll.posY(), coll.posZ(), candidateSelectionFlags.doPtDepCosPaCut, true)) continue; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } - cut = dcaV0ToPV; - histos.fill(HIST("hCutValue"), 17, cut); - if (doDCAV0ToPVCut) { - if (TMath::Abs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) < dcaV0ToPV) + cut = candidateSelectionValues.dcaV0ToPV; + histos.fill(HIST("hCutValue"), 16, cut); + if (candidateSelectionFlags.doDCAV0ToPVCut) { + if (TMath::Abs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) < candidateSelectionValues.dcaV0ToPV) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -704,37 +768,37 @@ struct derivedCascadeAnalysis { } if (casc.sign() < 0) { - if (doFillNsigmaTPCHistProton) + if (qaFlags.doFillNsigmaTPCHistProton) histos.fill(HIST("hNsigmaProton"), posExtra.tpcNSigmaPr(), fullMomentumPosDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistV0Pion) + if (qaFlags.doFillNsigmaTPCHistV0Pion) histos.fill(HIST("hNsigmaPionNeg"), negExtra.tpcNSigmaPi(), fullmomentumNegDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistPionBach && isXi) + if (qaFlags.doFillNsigmaTPCHistPionBach && isXi) histos.fill(HIST("hNsigmaPionNegBach"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); - if (doFillNsigmaTPCHistPionBach && !isXi) + if (qaFlags.doFillNsigmaTPCHistPionBach && !isXi) histos.fill(HIST("hNsigmaKaon"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); } else if (casc.sign() > 0) { - if (doFillNsigmaTPCHistV0Pion) + if (qaFlags.doFillNsigmaTPCHistV0Pion) histos.fill(HIST("hNsigmaPionPos"), posExtra.tpcNSigmaPi(), fullMomentumPosDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistProton) + if (qaFlags.doFillNsigmaTPCHistProton) histos.fill(HIST("hNsigmaProtonNeg"), negExtra.tpcNSigmaPr(), fullmomentumNegDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistPionBach && isXi) + if (qaFlags.doFillNsigmaTPCHistPionBach && isXi) histos.fill(HIST("hNsigmaPionPosBach"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); - if (doFillNsigmaTPCHistPionBach && !isXi) + if (qaFlags.doFillNsigmaTPCHistPionBach && !isXi) histos.fill(HIST("hNsigmaKaon"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); } if (casc.sign() < 0) { - if (doNTPCSigmaCut) { - if (TMath::Abs(posExtra.tpcNSigmaPr()) > nsigmatpcPr || TMath::Abs(negExtra.tpcNSigmaPi()) > nsigmatpcPi) + if (candidateSelectionFlags.doNTPCSigmaCut) { + if (TMath::Abs(posExtra.tpcNSigmaPr()) > candidateSelectionValues.nsigmatpcPr || TMath::Abs(negExtra.tpcNSigmaPi()) > candidateSelectionValues.nsigmatpcPi) continue; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } } else if (casc.sign() > 0) { - if (doNTPCSigmaCut) { - if (TMath::Abs(posExtra.tpcNSigmaPi()) > nsigmatpcPi || TMath::Abs(negExtra.tpcNSigmaPr()) > nsigmatpcPr) + if (candidateSelectionFlags.doNTPCSigmaCut) { + if (TMath::Abs(posExtra.tpcNSigmaPi()) > candidateSelectionValues.nsigmatpcPi || TMath::Abs(negExtra.tpcNSigmaPr()) > candidateSelectionValues.nsigmatpcPr) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -742,18 +806,18 @@ struct derivedCascadeAnalysis { } } - if (posExtra.tpcCrossedRows() < mintpccrrows || negExtra.tpcCrossedRows() < mintpccrrows || bachExtra.tpcCrossedRows() < mintpccrrows) + if (posExtra.tpcCrossedRows() < candidateSelectionValues.mintpccrrows || negExtra.tpcCrossedRows() < candidateSelectionValues.mintpccrrows || bachExtra.tpcCrossedRows() < candidateSelectionValues.mintpccrrows) continue; histos.fill(HIST("hCandidate"), ++counter); bool kHasTOF = (posExtra.hasTOF() || negExtra.hasTOF() || bachExtra.hasTOF()); bool kHasITS = (posExtra.hasITS() || negExtra.hasITS() || bachExtra.hasITS()); - if (dooobrej == 1) { + if (candidateSelectionFlags.dooobrej == 1) { if (!kHasTOF && !kHasITS) continue; histos.fill(HIST("hCandidate"), ++counter); - } else if (dooobrej == 2) { - if (!kHasTOF && (casc.pt() > ptthrtof)) + } else if (candidateSelectionFlags.dooobrej == 2) { + if (!kHasTOF && (casc.pt() > candidateSelectionValues.ptthrtof)) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -765,78 +829,78 @@ struct derivedCascadeAnalysis { float ctau = -10; cut = ctau; - histos.fill(HIST("hCutValue"), 22, cut); + histos.fill(HIST("hCutValue"), 21, cut); if (posExtra.hasTOF()) { - if (doNTOFSigmaProtonCut && casc.sign() < 0) { + if (candidateSelectionFlags.doNTOFSigmaProtonCut && casc.sign() < 0) { histos.fill(HIST("hNsigmaTOFProton"), casc.tofNSigmaXiLaPr(), fullMomentumPosDaugh, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiLaPr()) > nsigmatofPr && fullMomentumPosDaugh > 0.6) + if (TMath::Abs(casc.tofNSigmaXiLaPr()) > candidateSelectionValues.nsigmatofPr && fullMomentumPosDaugh > 0.6) continue; } - if (doNTOFSigmaV0PionCut && casc.sign() > 0) { + if (candidateSelectionFlags.doNTOFSigmaV0PionCut && casc.sign() > 0) { histos.fill(HIST("hNsigmaTOFV0Pion"), casc.tofNSigmaXiLaPi(), fullMomentumPosDaugh, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiLaPi()) > nsigmatofPion) + if (TMath::Abs(casc.tofNSigmaXiLaPi()) > candidateSelectionValues.nsigmatofPion) continue; } } if (negExtra.hasTOF()) { - if (doNTOFSigmaProtonCut && casc.sign() > 0) { + if (candidateSelectionFlags.doNTOFSigmaProtonCut && casc.sign() > 0) { histos.fill(HIST("hNsigmaTOFProton"), casc.tofNSigmaXiLaPr(), fullmomentumNegDaugh, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiLaPr()) > nsigmatofPr && fullmomentumNegDaugh > 0.6) + if (TMath::Abs(casc.tofNSigmaXiLaPr()) > candidateSelectionValues.nsigmatofPr && fullmomentumNegDaugh > 0.6) continue; } - if (doNTOFSigmaV0PionCut && casc.sign() < 0) { + if (candidateSelectionFlags.doNTOFSigmaV0PionCut && casc.sign() < 0) { histos.fill(HIST("hNsigmaTOFV0Pion"), casc.tofNSigmaXiLaPi(), fullmomentumNegDaugh, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiLaPi()) > nsigmatofPion) + if (TMath::Abs(casc.tofNSigmaXiLaPi()) > candidateSelectionValues.nsigmatofPion) continue; } } if (isXi) { - if (doNTPCSigmaCut) { - if (TMath::Abs(bachExtra.tpcNSigmaPi()) > nsigmatpcPi) + if (candidateSelectionFlags.doNTPCSigmaCut) { + if (TMath::Abs(bachExtra.tpcNSigmaPi()) > candidateSelectionValues.nsigmatpcPi) continue; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } - if (bachExtra.hasTOF() && doNTOFSigmaBachelorCut) { + if (bachExtra.hasTOF() && candidateSelectionFlags.doNTOFSigmaBachelorCut) { histos.fill(HIST("hNsigmaTOFBachelorPion"), casc.tofNSigmaXiPi(), fullmomentumBachelor, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiPi()) > nsigmatofBachPion) + if (TMath::Abs(casc.tofNSigmaXiPi()) > candidateSelectionValues.nsigmatofBachPion) continue; } ctau = pdgDB->Mass(3312) * cascpos / ((cascptotmom + 1e-13) * ctauxiPDG); - if (doProperLifeTimeCut) { - if (ctau > proplifetime) + if (candidateSelectionFlags.doProperLifeTimeCut) { + if (ctau > candidateSelectionValues.proplifetime) continue; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } } else { - if (doNTPCSigmaCut) { - if (TMath::Abs(bachExtra.tpcNSigmaKa()) > nsigmatpcKa) + if (candidateSelectionFlags.doNTPCSigmaCut) { + if (TMath::Abs(bachExtra.tpcNSigmaKa()) > candidateSelectionValues.nsigmatpcKa) continue; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } - if (bachExtra.hasTOF() && doNTOFSigmaBachelorCut) { + if (bachExtra.hasTOF() && candidateSelectionFlags.doNTOFSigmaBachelorCut) { histos.fill(HIST("hNsigmaTOFBachelorKaon"), casc.tofNSigmaOmKa(), TMath::Sqrt(TMath::Power(casc.pxbach(), 2) + TMath::Power(casc.pybach(), 2) + TMath::Power(casc.pzbach(), 2)), coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaOmKa()) > nsigmatofBachKaon) + if (TMath::Abs(casc.tofNSigmaOmKa()) > candidateSelectionValues.nsigmatofBachKaon) continue; } ctau = pdgDB->Mass(3334) * cascpos / ((cascptotmom + 1e-13) * ctauomegaPDG); - if (doProperLifeTimeCut) { - if (ctau > proplifetime) + if (candidateSelectionFlags.doProperLifeTimeCut) { + if (ctau > candidateSelectionValues.proplifetime) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -848,14 +912,19 @@ struct derivedCascadeAnalysis { if (isNegative) histos.fill(HIST("InvMassAfterSel/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), invmass, coll.centFT0C()); - if (doOccupancyCheck) { + if (qaFlags.doOccupancyCheck) { + float occupancy = -1; + if (useTrackOccupancyDef) + occupancy = coll.trackOccupancyInTimeRange(); + if (useFT0OccupancyDef) + occupancy = coll.ft0cOccupancyInTimeRange(); static_for<0, 9>([&](auto i) { constexpr int index = i.value; if (coll.centFT0C() < centralityIntervals[index + 1] && coll.centFT0C() > centralityIntervals[index]) { if (isPositive) - histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), invmass, coll.trackOccupancyInTimeRange()); + histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), invmass, occupancy); if (isNegative) - histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), invmass, coll.trackOccupancyInTimeRange()); + histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), invmass, occupancy); } }); } @@ -881,9 +950,20 @@ struct derivedCascadeAnalysis { dcaMesonToPV, dcaBaryonToPV, ctau}; - bool selectionToBeTested[] = {doBachelorBaryonCut, doDCAV0ToPVCut, doV0RadiusCut, doCascadeRadiusCut, doDCAV0DauCut, doDCACascadeDauCut, doV0CosPaCut, doCascadeCosPaCut, doDCAdauToPVCut, doDCAdauToPVCut, doDCAdauToPVCut, doProperLifeTimeCut}; - - if (doPtDepCutStudy) { + bool selectionToBeTested[] = {candidateSelectionFlags.doBachelorBaryonCut, + candidateSelectionFlags.doDCAV0ToPVCut, + candidateSelectionFlags.doV0RadiusCut, + candidateSelectionFlags.doCascadeRadiusCut, + candidateSelectionFlags.doDCAV0DauCut, + candidateSelectionFlags.doDCACascadeDauCut, + candidateSelectionFlags.doV0CosPaCut, + candidateSelectionFlags.doCascadeCosPaCut, + candidateSelectionFlags.doDCAdauToPVCut, + candidateSelectionFlags.doDCAdauToPVCut, + candidateSelectionFlags.doDCAdauToPVCut, + candidateSelectionFlags.doProperLifeTimeCut}; + + if (qaFlags.doPtDepCutStudy) { static_for<0, 10>([&](auto i) { constexpr int index = i.value; if (!selectionToBeTested[index]) { @@ -921,7 +1001,7 @@ struct derivedCascadeAnalysis { if (!isNegative && !isPositive) continue; // To have trace of how it was before selections - if (doBefSelCheck) { + if (qaFlags.doBefSelCheck) { if (isPositive) histos.fill(HIST("InvMassBefSel/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), mass, coll.centFT0C()); if (isNegative) @@ -959,20 +1039,20 @@ struct derivedCascadeAnalysis { auto fullmomentumNegDaugh = TMath::Sqrt(TMath::Power(casc.pxneg(), 2) + TMath::Power(casc.pyneg(), 2) + TMath::Power(casc.pzneg(), 2)); auto fullmomentumBachelor = TMath::Sqrt(TMath::Power(casc.pxbach(), 2) + TMath::Power(casc.pybach(), 2) + TMath::Power(casc.pzbach(), 2)); - if (TMath::Abs(poseta) > etaDauCut || TMath::Abs(negeta) > etaDauCut || TMath::Abs(bacheta) > etaDauCut) + if (TMath::Abs(poseta) > candidateSelectionValues.etaDauCut || TMath::Abs(negeta) > candidateSelectionValues.etaDauCut || TMath::Abs(bacheta) > candidateSelectionValues.etaDauCut) continue; histos.fill(HIST("hCandidate"), ++counter); - if (doCascadeCosPaCut) { - if (!IsCosPAAccepted(casc, coll.posX(), coll.posY(), coll.posZ(), doPtDepCosPaCut, true)) + if (candidateSelectionFlags.doCascadeCosPaCut) { + if (!IsCosPAAccepted(casc, coll.posX(), coll.posY(), coll.posZ(), candidateSelectionFlags.doPtDepCosPaCut, true)) continue; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } - if (doDCAV0ToPVCut) { - if (TMath::Abs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) < dcaV0ToPV) + if (candidateSelectionFlags.doDCAV0ToPVCut) { + if (TMath::Abs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) < candidateSelectionValues.dcaV0ToPV) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -980,17 +1060,17 @@ struct derivedCascadeAnalysis { } if (isNegative) { - if (doFillNsigmaTPCHistProton) + if (qaFlags.doFillNsigmaTPCHistProton) histos.fill(HIST("hNsigmaProton"), posExtra.tpcNSigmaPr(), fullMomentumPosDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistV0Pion) + if (qaFlags.doFillNsigmaTPCHistV0Pion) histos.fill(HIST("hNsigmaPionNeg"), negExtra.tpcNSigmaPi(), fullmomentumNegDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistPionBach && isXi) + if (qaFlags.doFillNsigmaTPCHistPionBach && isXi) histos.fill(HIST("hNsigmaPionNegBach"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); - if (doFillNsigmaTPCHistPionBach && !isXi) + if (qaFlags.doFillNsigmaTPCHistPionBach && !isXi) histos.fill(HIST("hNsigmaKaon"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); - if (doNTPCSigmaCut) { - if (TMath::Abs(posExtra.tpcNSigmaPr()) > nsigmatpcPr || TMath::Abs(negExtra.tpcNSigmaPi()) > nsigmatpcPi) + if (candidateSelectionFlags.doNTPCSigmaCut) { + if (TMath::Abs(posExtra.tpcNSigmaPr()) > candidateSelectionValues.nsigmatpcPr || TMath::Abs(negExtra.tpcNSigmaPi()) > candidateSelectionValues.nsigmatpcPi) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -998,17 +1078,17 @@ struct derivedCascadeAnalysis { } } if (isPositive) { - if (doFillNsigmaTPCHistV0Pion) + if (qaFlags.doFillNsigmaTPCHistV0Pion) histos.fill(HIST("hNsigmaPionPos"), posExtra.tpcNSigmaPi(), fullMomentumPosDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistProton) + if (qaFlags.doFillNsigmaTPCHistProton) histos.fill(HIST("hNsigmaProtonNeg"), negExtra.tpcNSigmaPr(), fullmomentumNegDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistPionBach && isXi) + if (qaFlags.doFillNsigmaTPCHistPionBach && isXi) histos.fill(HIST("hNsigmaPionPosBach"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); - if (doFillNsigmaTPCHistPionBach && !isXi) + if (qaFlags.doFillNsigmaTPCHistPionBach && !isXi) histos.fill(HIST("hNsigmaKaon"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); - if (doNTPCSigmaCut) { - if (TMath::Abs(posExtra.tpcNSigmaPi()) > nsigmatpcPi || TMath::Abs(negExtra.tpcNSigmaPr()) > nsigmatpcPr) + if (candidateSelectionFlags.doNTPCSigmaCut) { + if (TMath::Abs(posExtra.tpcNSigmaPi()) > candidateSelectionValues.nsigmatpcPi || TMath::Abs(negExtra.tpcNSigmaPr()) > candidateSelectionValues.nsigmatpcPr) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -1016,18 +1096,18 @@ struct derivedCascadeAnalysis { } } - if (posExtra.tpcCrossedRows() < mintpccrrows || negExtra.tpcCrossedRows() < mintpccrrows || bachExtra.tpcCrossedRows() < mintpccrrows) + if (posExtra.tpcCrossedRows() < candidateSelectionValues.mintpccrrows || negExtra.tpcCrossedRows() < candidateSelectionValues.mintpccrrows || bachExtra.tpcCrossedRows() < candidateSelectionValues.mintpccrrows) continue; histos.fill(HIST("hCandidate"), ++counter); bool kHasTOF = (posExtra.hasTOF() || negExtra.hasTOF() || bachExtra.hasTOF()); bool kHasITS = (posExtra.hasITS() || negExtra.hasITS() || bachExtra.hasITS()); - if (dooobrej == 1) { + if (candidateSelectionFlags.dooobrej == 1) { if (!kHasTOF && !kHasITS) continue; histos.fill(HIST("hCandidate"), ++counter); - } else if (dooobrej == 2) { - if (!kHasTOF && (casc.pt() > ptthrtof)) + } else if (candidateSelectionFlags.dooobrej == 2) { + if (!kHasTOF && (casc.pt() > candidateSelectionValues.ptthrtof)) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -1039,67 +1119,67 @@ struct derivedCascadeAnalysis { float ctau = -10; if (posExtra.hasTOF()) { - if (doNTOFSigmaProtonCut && isNegative) { + if (candidateSelectionFlags.doNTOFSigmaProtonCut && isNegative) { histos.fill(HIST("hNsigmaTOFProton"), casc.tofNSigmaXiLaPr(), fullMomentumPosDaugh, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiLaPr()) > nsigmatofPr && fullMomentumPosDaugh > 0.6) + if (TMath::Abs(casc.tofNSigmaXiLaPr()) > candidateSelectionValues.nsigmatofPr && fullMomentumPosDaugh > 0.6) continue; } - if (doNTOFSigmaV0PionCut && isPositive) { + if (candidateSelectionFlags.doNTOFSigmaV0PionCut && isPositive) { histos.fill(HIST("hNsigmaTOFV0Pion"), casc.tofNSigmaXiLaPi(), fullMomentumPosDaugh, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiLaPi()) > nsigmatofPion) + if (TMath::Abs(casc.tofNSigmaXiLaPi()) > candidateSelectionValues.nsigmatofPion) continue; } } if (negExtra.hasTOF()) { - if (doNTOFSigmaProtonCut && isPositive) { + if (candidateSelectionFlags.doNTOFSigmaProtonCut && isPositive) { histos.fill(HIST("hNsigmaTOFProton"), casc.tofNSigmaXiLaPr(), fullmomentumNegDaugh, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiLaPr()) > nsigmatofPr && fullmomentumNegDaugh > 0.6) + if (TMath::Abs(casc.tofNSigmaXiLaPr()) > candidateSelectionValues.nsigmatofPr && fullmomentumNegDaugh > 0.6) continue; } - if (doNTOFSigmaV0PionCut && isNegative) { + if (candidateSelectionFlags.doNTOFSigmaV0PionCut && isNegative) { histos.fill(HIST("hNsigmaTOFV0Pion"), casc.tofNSigmaXiLaPi(), fullmomentumNegDaugh, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiLaPi()) > nsigmatofPion) + if (TMath::Abs(casc.tofNSigmaXiLaPi()) > candidateSelectionValues.nsigmatofPion) continue; } } if (isXi) { - if (doNTPCSigmaCut) { - if (TMath::Abs(bachExtra.tpcNSigmaPi()) > nsigmatpcPi) + if (candidateSelectionFlags.doNTPCSigmaCut) { + if (TMath::Abs(bachExtra.tpcNSigmaPi()) > candidateSelectionValues.nsigmatpcPi) continue; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } - if (bachExtra.hasTOF() && doNTOFSigmaBachelorCut) { + if (bachExtra.hasTOF() && candidateSelectionFlags.doNTOFSigmaBachelorCut) { histos.fill(HIST("hNsigmaTOFBachelorPion"), casc.tofNSigmaXiPi(), fullmomentumBachelor, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaXiPi()) > nsigmatofBachPion) + if (TMath::Abs(casc.tofNSigmaXiPi()) > candidateSelectionValues.nsigmatofBachPion) continue; } ctau = pdgDB->Mass(3312) * cascpos / ((cascptotmom + 1e-13) * ctauxiPDG); } else { - if (doNTPCSigmaCut) { - if (TMath::Abs(bachExtra.tpcNSigmaKa()) > nsigmatpcKa) + if (candidateSelectionFlags.doNTPCSigmaCut) { + if (TMath::Abs(bachExtra.tpcNSigmaKa()) > candidateSelectionValues.nsigmatpcKa) continue; histos.fill(HIST("hCandidate"), ++counter); } else { ++counter; } - if (bachExtra.hasTOF() && doNTOFSigmaBachelorCut) { + if (bachExtra.hasTOF() && candidateSelectionFlags.doNTOFSigmaBachelorCut) { histos.fill(HIST("hNsigmaTOFBachelorKaon"), casc.tofNSigmaOmKa(), fullmomentumBachelor, coll.centFT0C()); - if (TMath::Abs(casc.tofNSigmaOmKa()) > nsigmatofBachKaon) + if (TMath::Abs(casc.tofNSigmaOmKa()) > candidateSelectionValues.nsigmatofBachKaon) continue; } ctau = pdgDB->Mass(3334) * cascpos / ((cascptotmom + 1e-13) * ctauomegaPDG); } - if (doProperLifeTimeCut) { - if (ctau > proplifetime) + if (candidateSelectionFlags.doProperLifeTimeCut) { + if (ctau > candidateSelectionValues.proplifetime) continue; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -1109,12 +1189,12 @@ struct derivedCascadeAnalysis { if (isPositive) { histos.fill(HIST("InvMassAfterSel/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), mass, coll.centFT0C()); if (isTrueMCCascadeDecay) - histos.fill(HIST("InvMassAfterSel/hPositiveCascadePtForEfficiency"), ptmc, mass, coll.centFT0C()); + histos.fill(HIST("hPositiveCascadePtForEfficiency"), ptmc, mass, coll.centFT0C()); } if (isNegative) { histos.fill(HIST("InvMassAfterSel/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), mass, coll.centFT0C()); if (isTrueMCCascadeDecay) - histos.fill(HIST("InvMassAfterSel/hNegativeCascadePtForEfficiency"), ptmc, mass, coll.centFT0C()); + histos.fill(HIST("hNegativeCascadePtForEfficiency"), ptmc, mass, coll.centFT0C()); } if (isTrueMCCascade) { if (isPositive) @@ -1122,14 +1202,25 @@ struct derivedCascadeAnalysis { if (isNegative) histos.fill(HIST("InvMassAfterSelMCrecTruth/h") + HIST(charge[1]) + HIST("Cascade"), ptmc, mass, coll.centFT0C()); } - if (doOccupancyCheck) { + if (qaFlags.doOccupancyCheck) { + float occupancy = -1; + if (useTrackOccupancyDef) + occupancy = coll.trackOccupancyInTimeRange(); + if (useFT0OccupancyDef) + occupancy = coll.ft0cOccupancyInTimeRange(); static_for<0, 9>([&](auto i) { constexpr int index = i.value; if (coll.centFT0C() < centralityIntervals[index + 1] && coll.centFT0C() > centralityIntervals[index]) { - if (isPositive) - histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), mass, coll.trackOccupancyInTimeRange()); - if (isNegative) - histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), mass, coll.trackOccupancyInTimeRange()); + if (isPositive) { + histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), mass, occupancy); + if (isTrueMCCascadeDecay) + histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[0]) + HIST("CascadeMCTruth"), casc.pt(), mass, occupancy); + } + if (isNegative) { + histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), mass, occupancy); + if (isTrueMCCascadeDecay) + histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[1]) + HIST("CascadeMCTruth"), casc.pt(), mass, occupancy); + } } }); } @@ -1154,9 +1245,20 @@ struct derivedCascadeAnalysis { dcaMesonToPV, dcaBaryonToPV, ctau}; - bool selectionToBeTested[] = {doBachelorBaryonCut, doDCAV0ToPVCut, doV0RadiusCut, doCascadeRadiusCut, doDCAV0DauCut, doDCACascadeDauCut, doV0CosPaCut, doCascadeCosPaCut, doDCAdauToPVCut, doDCAdauToPVCut, doDCAdauToPVCut, doProperLifeTimeCut}; - - if (doPtDepCutStudy) { + bool selectionToBeTested[] = {candidateSelectionFlags.doBachelorBaryonCut, + candidateSelectionFlags.doDCAV0ToPVCut, + candidateSelectionFlags.doV0RadiusCut, + candidateSelectionFlags.doCascadeRadiusCut, + candidateSelectionFlags.doDCAV0DauCut, + candidateSelectionFlags.doDCACascadeDauCut, + candidateSelectionFlags.doV0CosPaCut, + candidateSelectionFlags.doCascadeCosPaCut, + candidateSelectionFlags.doDCAdauToPVCut, + candidateSelectionFlags.doDCAdauToPVCut, + candidateSelectionFlags.doDCAdauToPVCut, + candidateSelectionFlags.doProperLifeTimeCut}; + + if (qaFlags.doPtDepCutStudy) { static_for<0, 10>([&](auto i) { constexpr int index = i.value; if (!selectionToBeTested[index]) { @@ -1194,31 +1296,40 @@ struct derivedCascadeAnalysis { else if (TMath::Abs(cascMC.pdgCode()) == 3334) ymc = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, o2::constants::physics::MassOmegaMinus); - if (TMath::Abs(ymc) > rapCut) + if (TMath::Abs(ymc) > candidateSelectionValues.rapCut) continue; auto mcCollision = cascMC.straMCCollision_as>(); float centrality = 100.5f; + float occupancy = 49000; if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); centrality = collision.centFT0C(); + if (useTrackOccupancyDef) + occupancy = collision.trackOccupancyInTimeRange(); + if (useFT0OccupancyDef) + occupancy = collision.ft0cOccupancyInTimeRange(); } if (cascMC.pdgCode() == 3312) { histos.fill(HIST("h2dGenXiMinus"), centrality, ptmc); histos.fill(HIST("h2dGenXiMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + histos.fill(HIST("h2dGenXiMinusVsCentOccupancy"), ptmc, centrality, occupancy); } if (cascMC.pdgCode() == -3312) { histos.fill(HIST("h2dGenXiPlus"), centrality, ptmc); histos.fill(HIST("h2dGenXiPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + histos.fill(HIST("h2dGenXiPlusVsCentOccupancy"), ptmc, centrality, occupancy); } if (cascMC.pdgCode() == 3334) { histos.fill(HIST("h2dGenOmegaMinus"), centrality, ptmc); histos.fill(HIST("h2dGenOmegaMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + histos.fill(HIST("h2dGenOmegaMinusVsCentOccupancy"), ptmc, centrality, occupancy); } if (cascMC.pdgCode() == -3334) { histos.fill(HIST("h2dGenOmegaPlus"), centrality, ptmc); histos.fill(HIST("h2dGenOmegaPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + histos.fill(HIST("h2dGenOmegaPlusVsCentOccupancy"), ptmc, centrality, occupancy); } } } diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index d287bd0f7aa..7b8ea9683d9 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -80,6 +80,7 @@ struct derivedlambdakzeroanalysis { Configurable calculateFeeddownMatrix{"calculateFeeddownMatrix", true, "fill feeddown matrix if MC"}; Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; + Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", false, "require events with at least one ITS-TPC track"}; @@ -94,6 +95,8 @@ struct derivedlambdakzeroanalysis { Configurable requireNoCollInROFStd{"requireNoCollInROFStd", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF with mult. above a certain threshold"}; Configurable requireNoCollInROFStrict{"requireNoCollInROFStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF"}; + Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; + Configurable useFT0CbasedOccupancy{"useFT0CbasedOccupancy", false, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"}; // fast check on occupancy Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; @@ -148,6 +151,7 @@ struct derivedlambdakzeroanalysis { // for MC Configurable doMCAssociation{"doMCAssociation", true, "if MC, do MC association"}; + Configurable doTreatPiToMuon{"doTreatPiToMuon", false, "Take pi decay into muon into account in MC"}; Configurable doCollisionAssociationQA{"doCollisionAssociationQA", true, "check collision association"}; // Machine learning evaluation for pre-selection and corresponding information generation @@ -389,22 +393,23 @@ struct derivedlambdakzeroanalysis { histos.add("hEventSelection", "hEventSelection", kTH1F, {{20, -0.5f, +19.5f}}); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "posZ cut"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "kIsTriggerTVX"); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(6, "kIsVertexITSTPC"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(7, "kIsGoodZvtxFT0vsPV"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(8, "kIsVertexTOFmatched"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(11, "kNoCollInTimeRangeStd"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeStrict"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "kNoCollInTimeRangeNarrow"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "kNoCollInTimeRangeVzDep"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInRofStd"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStrict"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "Below min occup."); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Above max occup."); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(6, "posZ cut"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(7, "kIsVertexITSTPC"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(8, "kIsGoodZvtxFT0vsPV"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTOFmatched"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(10, "kIsVertexTRDmatched"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(11, "kNoSameBunchPileup"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeStd"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "kNoCollInTimeRangeStrict"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "kNoCollInTimeRangeNarrow"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInTimeRangeVzDep"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStd"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "kNoCollInRofStrict"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Below min occup."); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "Above max occup."); histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}}); histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2F, {axisCentrality, axisNch}); @@ -663,6 +668,14 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenOmegaMinus", "h2dGenOmegaMinus", kTH2D, {axisCentrality, axisPt}); histos.add("h2dGenOmegaPlus", "h2dGenOmegaPlus", kTH2D, {axisCentrality, axisPt}); + histos.add("h2dGenK0ShortVsMultMC_RecoedEvt", "h2dGenK0ShortVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisNch, axisPt}); histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisNch, axisPt}); histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisNch, axisPt}); @@ -685,7 +698,8 @@ struct derivedlambdakzeroanalysis { histos.print(); } - void initCCDB(soa::Join::iterator const& collision) + template + void initCCDB(TCollision collision) { if (mRunNumber == collision.runNumber()) { return; @@ -816,19 +830,22 @@ struct derivedlambdakzeroanalysis { // precalculate this information so that a check is one mask operation, not many { uint64_t bitMap = 0; - // check for specific particle species + bool isPositiveProton = v0.pdgCodePositive() == 2212; + bool isPositivePion = v0.pdgCodePositive() == 211 || (doTreatPiToMuon && v0.pdgCodePositive() == -13); + bool isNegativeProton = v0.pdgCodeNegative() == -2212; + bool isNegativePion = v0.pdgCodeNegative() == -211 || (doTreatPiToMuon && v0.pdgCodeNegative() == 13); - if (v0.pdgCode() == 310 && v0.pdgCodePositive() == 211 && v0.pdgCodeNegative() == -211) { + if (v0.pdgCode() == 310 && isPositivePion && isNegativePion) { bitset(bitMap, selConsiderK0Short); if (v0.isPhysicalPrimary()) bitset(bitMap, selPhysPrimK0Short); } - if (v0.pdgCode() == 3122 && v0.pdgCodePositive() == 2212 && v0.pdgCodeNegative() == -211) { + if (v0.pdgCode() == 3122 && isPositiveProton && isNegativePion) { bitset(bitMap, selConsiderLambda); if (v0.isPhysicalPrimary()) bitset(bitMap, selPhysPrimLambda); } - if (v0.pdgCode() == -3122 && v0.pdgCodePositive() == 211 && v0.pdgCodeNegative() == -2212) { + if (v0.pdgCode() == -3122 && isPositivePion && isNegativeProton) { bitset(bitMap, selConsiderAntiLambda); if (v0.isPhysicalPrimary()) bitset(bitMap, selPhysPrimAntiLambda); @@ -1335,108 +1352,214 @@ struct derivedlambdakzeroanalysis { } } - // ______________________________________________________ - // Real data processing - no MC subscription - void processRealData(soa::Join::iterator const& collision, v0Candidates const& fullV0s, dauTracks const&) + template + bool IsEventAccepted(TCollision collision, bool fillHists) + // check whether the collision passes our collision selections { - // Fire up CCDB - if ((mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || - (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || - (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { - initCCDB(collision); - } + if (fillHists) + histos.fill(HIST("hEventSelection"), 0. /* all collisions */); - histos.fill(HIST("hEventSelection"), 0. /* all collisions */); if (requireSel8 && !collision.sel8()) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); - if (std::abs(collision.posZ()) > 10.f) { - return; + if (requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; } - histos.fill(HIST("hEventSelection"), 2 /* vertex-Z selected */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 2 /* FT0 vertex (acceptable FT0C-FT0A time difference) collisions */); if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - return; + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); + + if (std::abs(collision.posZ()) > maxZVtxPosition) { + return false; } - histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 5 /* vertex-Z selected */); if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 5 /* Contains at least one ITS-TPC track */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 6 /* Contains at least one ITS-TPC track */); if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 6 /* PV position consistency check */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 7 /* PV position consistency check */); if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 7 /* PV with at least one contributor matched with TOF */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TOF */); if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TRD */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 9 /* PV with at least one contributor matched with TRD */); if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 9 /* Not at same bunch pile-up */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 10 /* Not at same bunch pile-up */); if (requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 10 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); + if (fillHists) + histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); if (requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 10 microseconds */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 10 microseconds */); if (requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 2 microseconds */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 13 /* No other collision within +/- 2 microseconds */); if (requireNoCollInTimeRangeVzDep && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 13 /* No other collision with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 14 /* No other collision with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ */); if (requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF with mult. above a certain threshold */); if (requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 16 /* No other collision within the same ITS ROF */); float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); if (minOccupancy > 0 && collisionOccupancy < minOccupancy) { - return; + return false; } - histos.fill(HIST("hEventSelection"), 16 /* Below min occupancy */); + if (fillHists) + histos.fill(HIST("hEventSelection"), 17 /* Below min occupancy */); + if (maxOccupancy > 0 && collisionOccupancy > maxOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 18 /* Above max occupancy */); + + return true; + } + + // ______________________________________________________ + // Simulated processing + // Return the list of indices to the recoed collision associated to a given MC collision. + std::vector getListOfRecoCollIndices(soa::Join const& mcCollisions, soa::Join const& collisions) + { + std::vector listBestCollisionIdx(mcCollisions.size()); + for (auto const& mcCollision : mcCollisions) { + auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex()); + // Find the collision with the biggest nbr of PV contributors + // Follows what was done here: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/mcCollsExtra.cxx#L93 + int biggestNContribs = -1; + int bestCollisionIndex = -1; + for (auto const& collision : groupedCollisions) { + if (biggestNContribs < collision.multPVTotalContributors()) { + biggestNContribs = collision.multPVTotalContributors(); + bestCollisionIndex = collision.globalIndex(); + } + } + listBestCollisionIdx[mcCollision.globalIndex()] = bestCollisionIndex; + } + return listBestCollisionIdx; + } + + // ______________________________________________________ + // Simulated processing + // Fill generated event information (for event loss/splitting estimation) + void fillGeneratedEventProperties(soa::Join const& mcCollisions, soa::Join const& collisions) + { + std::vector listBestCollisionIdx(mcCollisions.size()); + for (auto const& mcCollision : mcCollisions) { + histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); + + auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex()); + // Check if there is at least one of the reconstructed collisions associated to this MC collision + // If so, we consider it + bool atLeastOne = false; + int biggestNContribs = -1; + float centrality = 100.5f; + int nCollisions = 0; + for (auto const& collision : groupedCollisions) { + + if (!IsEventAccepted(collision, false)) { + continue; + } + + if (biggestNContribs < collision.multPVTotalContributors()) { + biggestNContribs = collision.multPVTotalContributors(); + centrality = collision.centFT0C(); + } + nCollisions++; + + atLeastOne = true; + } + + histos.fill(HIST("hCentralityVsNcoll_beforeEvSel"), centrality, groupedCollisions.size()); + histos.fill(HIST("hCentralityVsNcoll_afterEvSel"), centrality, nCollisions); + + histos.fill(HIST("hCentralityVsMultMC"), centrality, mcCollision.multMCNParticlesEta05()); + + if (atLeastOne) { + histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); + + histos.fill(HIST("hGenEventCentrality"), centrality); + } + } + return; + } + + // ______________________________________________________ + // Real data processing - no MC subscription + void processRealData(soa::Join::iterator const& collision, v0Candidates const& fullV0s, dauTracks const&) + { + // Fire up CCDB + if ((mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || + (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || + (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { + initCCDB(collision); + } + + if (!IsEventAccepted(collision, true)) { return; } - histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */); float centrality = collision.centFT0C(); if (qaCentrality) { auto hRawCentrality = histos.get(HIST("hRawCentrality")); centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(collision.multFT0C())); } + float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); // gap side int gapSide = collision.gapSide(); @@ -1495,99 +1618,25 @@ struct derivedlambdakzeroanalysis { // ______________________________________________________ // Simulated processing (subscribes to MC information too) - void processMonteCarlo(soa::Join::iterator const& collision, v0MCCandidates const& fullV0s, dauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) + void processMonteCarlo(soa::Join::iterator const& collision, v0MCCandidates const& fullV0s, dauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) { - histos.fill(HIST("hEventSelection"), 0. /* all collisions */); - if (requireSel8 && !collision.sel8()) { - return; - } - histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); - - if (std::abs(collision.posZ()) > 10.f) { - return; - } - histos.fill(HIST("hEventSelection"), 2 /* vertex-Z selected */); - - if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - return; - } - histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); - - if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - return; - } - histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); - - if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return; - } - histos.fill(HIST("hEventSelection"), 5 /* Contains at least one ITS-TPC track */); - - if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } - histos.fill(HIST("hEventSelection"), 6 /* PV position consistency check */); - - if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { - return; - } - histos.fill(HIST("hEventSelection"), 7 /* PV with at least one contributor matched with TOF */); - - if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { - return; - } - histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TRD */); - - if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return; - } - histos.fill(HIST("hEventSelection"), 9 /* Not at same bunch pile-up */); - - if (requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - return; - } - histos.fill(HIST("hEventSelection"), 10 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); - - if (requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { - return; - } - histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 10 microseconds */); - - if (requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { - return; - } - histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 2 microseconds */); - - if (requireNoCollInTimeRangeVzDep && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) { - return; - } - histos.fill(HIST("hEventSelection"), 13 /* No other collision with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ */); - - if (requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { - return; - } - histos.fill(HIST("hEventSelection"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */); - - if (requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { - return; + // Fire up CCDB + if ((mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || + (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || + (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { + initCCDB(collision); } - histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */); - float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); - if (minOccupancy > 0 && collisionOccupancy < minOccupancy) { - return; - } - histos.fill(HIST("hEventSelection"), 16 /* Below min occupancy */); - if (maxOccupancy > 0 && collisionOccupancy > maxOccupancy) { + if (!IsEventAccepted(collision, true)) { return; } - histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */); float centrality = collision.centFT0C(); if (qaCentrality) { auto hRawCentrality = histos.get(HIST("hRawCentrality")); centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(collision.multFT0C())); } + float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); // gap side int gapSide = collision.gapSide(); @@ -1677,7 +1726,8 @@ struct derivedlambdakzeroanalysis { // Simulated processing (subscribes to MC information too) void processGenerated(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) { - std::vector listBestCollisionIdx = fillGenEventHist(mcCollisions, collisions); + fillGeneratedEventProperties(mcCollisions, collisions); + std::vector listBestCollisionIdx = getListOfRecoCollIndices(mcCollisions, collisions); for (auto const& v0MC : V0MCCores) { if (!v0MC.has_straMCCollision()) continue; @@ -1685,12 +1735,12 @@ struct derivedlambdakzeroanalysis { if (!v0MC.isPhysicalPrimary()) continue; - float ptmc = RecoDecay::sqrtSumOfSquares(v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC()); + float ptmc = v0MC.ptMC(); float ymc = 1e3; if (v0MC.pdgCode() == 310) - ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassKaonNeutral); + ymc = v0MC.rapidityMC(0); else if (TMath::Abs(v0MC.pdgCode()) == 3122) - ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassLambda); + ymc = v0MC.rapidityMC(1); if (TMath::Abs(ymc) > v0Selections.rapidityCut) continue; @@ -1700,6 +1750,24 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); centrality = collision.centFT0C(); + float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + + if (minOccupancy > 0 && collisionOccupancy < minOccupancy) { + continue; + } + if (maxOccupancy > 0 && collisionOccupancy > maxOccupancy) { + continue; + } + + if (v0MC.pdgCode() == 310) { + histos.fill(HIST("h2dGenK0ShortVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (v0MC.pdgCode() == 3122) { + histos.fill(HIST("h2dGenLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (v0MC.pdgCode() == -3122) { + histos.fill(HIST("h2dGenAntiLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (v0MC.pdgCode() == 310) { @@ -1723,12 +1791,12 @@ struct derivedlambdakzeroanalysis { if (!cascMC.isPhysicalPrimary()) continue; - float ptmc = RecoDecay::sqrtSumOfSquares(cascMC.pxMC(), cascMC.pyMC()); + float ptmc = cascMC.ptMC(); float ymc = 1e3; if (TMath::Abs(cascMC.pdgCode()) == 3312) - ymc = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, o2::constants::physics::MassXiMinus); + ymc = cascMC.rapidityMC(0); else if (TMath::Abs(cascMC.pdgCode()) == 3334) - ymc = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, o2::constants::physics::MassOmegaMinus); + ymc = cascMC.rapidityMC(2); if (TMath::Abs(ymc) > v0Selections.rapidityCut) continue; @@ -1738,6 +1806,27 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); centrality = collision.centFT0C(); + float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + + if (minOccupancy > 0 && collisionOccupancy < minOccupancy) { + continue; + } + if (maxOccupancy > 0 && collisionOccupancy > maxOccupancy) { + continue; + } + + if (cascMC.pdgCode() == 3312) { + histos.fill(HIST("h2dGenXiMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == -3312) { + histos.fill(HIST("h2dGenXiPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == 3334) { + histos.fill(HIST("h2dGenOmegaMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == -3334) { + histos.fill(HIST("h2dGenOmegaPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (cascMC.pdgCode() == 3312) { @@ -1759,103 +1848,6 @@ struct derivedlambdakzeroanalysis { } } - // ______________________________________________________ - // Simulated processing - // Fill event information (for event loss estimation) and return the index to the recoed collision associated to a given MC collision. - std::vector fillGenEventHist(soa::Join const& mcCollisions, soa::Join const& collisions) - { - std::vector listBestCollisionIdx(mcCollisions.size()); - for (auto const& mcCollision : mcCollisions) { - histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); - - auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex()); - // Check if there is at least one of the reconstructed collisions associated to this MC collision - // If so, we consider it - bool atLeastOne = false; - int biggestNContribs = -1; - int bestCollisionIndex = -1; - float centrality = 100.5f; - int nCollisions = 0; - for (auto const& collision : groupedCollisions) { - if (requireSel8 && !collision.sel8()) { - continue; - } - if (std::abs(collision.posZ()) > 10.f) { - continue; - } - if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - continue; - } - if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - continue; - } - if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - continue; - } - if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - continue; - } - if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { - continue; - } - if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { - continue; - } - if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - continue; - } - if (requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - continue; - } - if (requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { - continue; - } - if (requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { - continue; - } - if (requireNoCollInTimeRangeVzDep && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) { - continue; - } - if (requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { - continue; - } - if (requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { - continue; - } - - float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); - if (minOccupancy > 0 && collisionOccupancy < minOccupancy) { - continue; - } - if (maxOccupancy > 0 && collisionOccupancy > maxOccupancy) { - continue; - } - - if (biggestNContribs < collision.multPVTotalContributors()) { - biggestNContribs = collision.multPVTotalContributors(); - bestCollisionIndex = collision.globalIndex(); - centrality = collision.centFT0C(); - } - nCollisions++; - - atLeastOne = true; - } - listBestCollisionIdx[mcCollision.globalIndex()] = bestCollisionIndex; - - histos.fill(HIST("hCentralityVsNcoll_beforeEvSel"), centrality, groupedCollisions.size()); - histos.fill(HIST("hCentralityVsNcoll_afterEvSel"), centrality, nCollisions); - - histos.fill(HIST("hCentralityVsMultMC"), centrality, mcCollision.multMCNParticlesEta05()); - - if (atLeastOne) { - histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); - - histos.fill(HIST("hGenEventCentrality"), centrality); - } - } - return listBestCollisionIdx; - } - // ______________________________________________________ // Simulated processing (subscribes to MC information too) void processBinnedGenerated( diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index 894934e1243..f43dc16f02f 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -20,6 +20,8 @@ /// \author David Dobrigkeit Chinellato (david.dobrigkeit.chinellato@cern.ch) /// \author Zhongbao Yin (Zhong-Bao.Yin@cern.ch) +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -54,6 +56,7 @@ struct correlateStrangeness { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Configurable doCorrelationHadron{"doCorrelationHadron", false, "do Hadron correlation"}; Configurable doCorrelationK0Short{"doCorrelationK0Short", true, "do K0Short correlation"}; Configurable doCorrelationLambda{"doCorrelationLambda", false, "do Lambda correlation"}; Configurable doCorrelationAntiLambda{"doCorrelationAntiLambda", false, "do AntiLambda correlation"}; @@ -74,6 +77,7 @@ struct correlateStrangeness { Configurable doAutocorrelationRejection{"doAutocorrelationRejection", true, "reject pairs where trigger Id is the same as daughter particle Id"}; Configurable triggerBinToSelect{"triggerBinToSelect", 0, "trigger bin to select on if processSelectEventWithTrigger enabled"}; + Configurable triggerParticleCharge{"triggerParticleCharge", 0, "For checks, if 0 all charged tracks, if -1 only neg., if 1 only positive"}; // Axes - configurable for smaller sizes ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0.0f, 0.01f, 1.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "Mixing bins - multiplicity"}; @@ -149,6 +153,8 @@ struct correlateStrangeness { TH2F* hEfficiencyOmegaMinus; TH2F* hEfficiencyOmegaPlus; + TH2F* hEfficiencyHadron; + using BinningType = ColumnBinningPolicy; BinningType colBinning{{axisVtxZ, axisMult}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. @@ -156,15 +162,16 @@ struct correlateStrangeness { Preslice collisionSliceTracks = aod::triggerTracks::collisionId; Preslice collisionSliceV0s = aod::assocV0s::collisionId; Preslice collisionSliceCascades = aod::assocCascades::collisionId; - Preslice collisionSlicePions = aod::assocPions::collisionId; + // Preslice collisionSlicePions = aod::assocHadrons::collisionId; + Preslice collisionSliceHadrons = aod::assocHadrons::collisionId; Preslice perCollision = aod::mcparticle::mcCollisionId; static constexpr std::string_view v0names[] = {"K0Short", "Lambda", "AntiLambda"}; static constexpr std::string_view cascadenames[] = {"XiMinus", "XiPlus", "OmegaMinus", "OmegaPlus"}; - static constexpr std::string_view particlenames[] = {"K0Short", "Lambda", "AntiLambda", "XiMinus", "XiPlus", "OmegaMinus", "OmegaPlus", "Pion"}; + static constexpr std::string_view particlenames[] = {"K0Short", "Lambda", "AntiLambda", "XiMinus", "XiPlus", "OmegaMinus", "OmegaPlus", "Pion", "Hadron"}; static constexpr int pdgCodes[] = {310, 3122, -3122, 3312, -3312, 3334, -3334, 211}; - uint8_t doCorrelation; + uint16_t doCorrelation; int mRunNumber; std::vector> axisRanges; @@ -233,6 +240,12 @@ struct correlateStrangeness { if (track.pt() > axisRanges[3][1] || track.pt() < axisRanges[3][0]) { return false; } + if (triggerParticleCharge > 0 && track.sign() < 0) { + return false; + } + if (triggerParticleCharge < 0 && track.sign() > 0) { + return false; + } return true; } void fillCorrelationsV0(aod::TriggerTracks const& triggers, aod::AssocV0s const& assocs, bool mixing, float pvz, float mult) @@ -311,8 +324,17 @@ struct correlateStrangeness { if (bitcheck(doCorrelation, index) && (!applyEfficiencyCorrection || efficiency != 0)) { if (assocCandidate.compatible(index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(index) && assocCandidate.invMassNSigma(index) < -massWindowConfigurations.minBgNSigma) histos.fill(HIST("sameEvent/LeftBg/") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); - if (assocCandidate.compatible(index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(index) && assocCandidate.invMassNSigma(index) < +massWindowConfigurations.maxPeakNSigma) + if (assocCandidate.compatible(index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(index) && assocCandidate.invMassNSigma(index) < +massWindowConfigurations.maxPeakNSigma) { histos.fill(HIST("sameEvent/Signal/") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + if (std::abs(deltaphi) < 0.8) { + histos.fill(HIST("hITSClusters") + HIST(v0names[index]) + HIST("NegativeDaughterToward"), ptassoc, negtrack.itsNCls(), assoc.v0radius()); + histos.fill(HIST("hITSClusters") + HIST(v0names[index]) + HIST("PositiveDaughterToward"), ptassoc, postrack.itsNCls(), assoc.v0radius()); + } + if (std::abs(deltaphi) > 1 && std::abs(deltaphi) < 2) { + histos.fill(HIST("hITSClusters") + HIST(v0names[index]) + HIST("NegativeDaughterTransverse"), ptassoc, negtrack.itsNCls(), assoc.v0radius()); + histos.fill(HIST("hITSClusters") + HIST(v0names[index]) + HIST("PositiveDaughterTransverse"), ptassoc, postrack.itsNCls(), assoc.v0radius()); + } + } if (assocCandidate.compatible(index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(index) && assocCandidate.invMassNSigma(index) < +massWindowConfigurations.maxBgNSigma) histos.fill(HIST("sameEvent/RightBg/") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); if (assocCandidate.compatible(index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(index) && assocCandidate.invMassNSigma(index) < -massWindowConfigurations.minBgNSigma) @@ -431,7 +453,7 @@ struct correlateStrangeness { } } - void fillCorrelationsPion(aod::TriggerTracks const& triggers, aod::AssocPions const& assocs, bool mixing, float pvz, float mult) + void fillCorrelationsHadron(aod::TriggerTracks const& triggers, aod::AssocHadrons const& assocs, bool mixing, float pvz, float mult, int /*indexAssoc*/) { for (auto& triggerTrack : triggers) { @@ -441,15 +463,20 @@ struct correlateStrangeness { if (!isValidTrigger(trigg)) continue; + static_for<7, 8>([&](auto i) { + constexpr int index = i.value; + if (bitcheck(doCorrelation, i)) { if (!mixing) - histos.fill(HIST("sameEvent/TriggerParticlesPion"), trigg.pt(), mult); + histos.fill(HIST("sameEvent/TriggerParticles") + HIST(particlenames[index]), trigg.pt(), mult); for (auto& assocTrack : assocs) { auto assoc = assocTrack.track_as(); + + //---] removing autocorrelations [--- if (doAutocorrelationRejection) { if (trigg.globalIndex() == assoc.globalIndex()) { - histos.fill(HIST("hNumberOfRejectedPairsPions"), 0.5); + histos.fill(HIST("hNumberOfRejectedPairs") + HIST(particlenames[index]), 0.5); continue; } } @@ -472,10 +499,11 @@ struct correlateStrangeness { continue; if (!mixing) - histos.fill(HIST("sameEvent/Pion"), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult); + histos.fill(HIST("sameEvent/Signal/") + HIST(particlenames[index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult); else - histos.fill(HIST("mixedEvent/Pion"), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult); + histos.fill(HIST("mixedEvent/Signal/") + HIST(particlenames[index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult); } + } }); } } @@ -491,6 +519,8 @@ struct correlateStrangeness { hEfficiencyOmegaMinus = 0x0; hEfficiencyOmegaPlus = 0x0; + hEfficiencyHadron = 0x0; + // set bitmap for convenience doCorrelation = 0; if (doCorrelationK0Short) @@ -509,6 +539,8 @@ struct correlateStrangeness { bitset(doCorrelation, 6); if (doCorrelationPion) bitset(doCorrelation, 7); + if (doCorrelationHadron) + bitset(doCorrelation, 8); // Store axis ranges to prevent spurious filling // axis status: @@ -670,10 +702,12 @@ struct correlateStrangeness { histos.add("hClosureTestEventCounter", "hClosureTestEventCounter", kTH1F, {{10, 0, 10}}); + histos.add("hNumberOfRejectedPairsHadron", "hNumberOfRejectedPairsHadron", kTH1F, {{1, 0, 1}}); histos.add("hNumberOfRejectedPairsV0", "hNumberOfRejectedPairsV0", kTH1F, {{1, 0, 1}}); histos.add("hNumberOfRejectedPairsCascades", "hNumberOfRejectedPairsCascades", kTH1F, {{1, 0, 1}}); - histos.add("hNumberOfRejectedPairsPions", "hNumberOfRejectedPairsPions", kTH1F, {{1, 0, 1}}); + histos.add("hNumberOfRejectedPairsPion", "hNumberOfRejectedPairsPion", kTH1F, {{1, 0, 1}}); + histos.add("sameEvent/TriggerParticlesHadron", "TriggersHadron", kTH2F, {axisPtQA, axisMult}); histos.add("sameEvent/TriggerParticlesV0", "TriggersV0", kTH2F, {axisPtQA, axisMult}); histos.add("sameEvent/TriggerParticlesCascade", "TriggersCascade", kTH2F, {axisPtQA, axisMult}); histos.add("sameEvent/TriggerParticlesPion", "TriggersPion", kTH2F, {axisPtQA, axisMult}); @@ -694,16 +728,23 @@ struct correlateStrangeness { histos.add("hTriggerPtResolution", ";p_{T}^{reconstructed} (GeV/c); p_{T}^{generated} (GeV/c)", kTH2F, {axisPtQA, axisPtQA}); histos.add("hTriggerPrimaryEtaVsPt", "hTriggerPrimaryEtaVsPt", kTH3F, {axisPtQA, axisEta, axisMult}); histos.add("hTrackEtaVsPtVsPhi", "hTrackEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); + histos.add("hTrackAttempt", "Attempt", kTH3F, {axisPtQA, axisEta, axisPhi}); + bool hStrange = false; - for (int i = 0; i < 8; i++) { - histos.add(fmt::format("h{}EtaVsPtVsPhi", particlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add(fmt::format("h{}EtaVsPtVsPhiBg", particlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); + for (int i = 0; i < 9; i++) { if (bitcheck(doCorrelation, i)) { + histos.add(fmt::format("h{}EtaVsPtVsPhi", particlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); histos.add(fmt::format("h3d{}Spectrum", particlenames[i]).c_str(), fmt::format("h3d{}Spectrum", particlenames[i]).c_str(), kTH3F, {axisPtQA, axisMult, axisMassNSigma}); histos.add(fmt::format("h3d{}SpectrumY", particlenames[i]).c_str(), fmt::format("h3d{}SpectrumY", particlenames[i]).c_str(), kTH3F, {axisPtQA, axisMult, axisMassNSigma}); histos.add(fmt::format("sameEvent/Signal/{}", particlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - if (i < 7) + if (i < 7) { hStrange = true; + histos.add(fmt::format("h{}EtaVsPtVsPhiBg", particlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); + histos.add(fmt::format("hITSClusters{}NegativeDaughterToward", particlenames[i]).c_str(), "", kTH3F, {axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); + histos.add(fmt::format("hITSClusters{}PositiveDaughterToward", particlenames[i]).c_str(), "", kTH3F, {axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); + histos.add(fmt::format("hITSClusters{}NegativeDaughterTransverse", particlenames[i]).c_str(), "", kTH3F, {axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); + histos.add(fmt::format("hITSClusters{}PositiveDaughterTransverse", particlenames[i]).c_str(), "", kTH3F, {axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); + } } } if (hStrange) { @@ -713,7 +754,7 @@ struct correlateStrangeness { LOGF(info, "Init THnFs done"); // mixed-event correlation functions - if (doprocessMixedEventHV0s || doprocessMixedEventHCascades || doprocessMixedEventHPions) { + if (doprocessMixedEventHV0s || doprocessMixedEventHCascades || doprocessMixedEventHPions || doprocessMixedEventHHadrons) { histos.addClone("sameEvent/", "mixedEvent/"); } @@ -798,6 +839,61 @@ struct correlateStrangeness { } } + void processSameEventHHadrons(soa::Join::iterator const& collision, + aod::AssocHadrons const& assocHadrons, aod::TriggerTracks const& triggerTracks, + TracksComplete const&, aod::BCsWithTimestamps const&) + { + // ________________________________________________ + // skip if desired trigger not found + if (triggerPresenceMap.size() > 0 && !bitcheck(triggerPresenceMap[collision.globalIndex()], triggerBinToSelect)) { + return; + } + + // ________________________________________________ + // Perform basic event selection + if (!collision.sel8()) { + return; + } + if (TMath::Abs(collision.posZ()) > zVertexCut) { + return; + } + if (collision.centFT0M() > axisRanges[5][1] || collision.centFT0M() < axisRanges[5][0]) { + return; + } + if (!collision.isInelGt0() && selectINELgtZERO) { + return; + } + // ________________________________________________ + if (!doprocessSameEventHCascades && !doprocessSameEventHV0s && !doprocessSameEventHPions) { + histos.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({collision.posZ(), collision.centFT0M()})); + histos.fill(HIST("EventQA/hMult"), collision.centFT0M()); + histos.fill(HIST("EventQA/hPvz"), collision.posZ()); + } + + // Do basic QA + for (auto const& hadron : assocHadrons) { + auto hadronTrack = hadron.track_as(); + histos.fill(HIST("hHadronEtaVsPtVsPhi"), hadronTrack.pt(), hadronTrack.eta(), hadronTrack.phi()); + } + if (!doprocessSameEventHCascades && !doprocessSameEventHV0s && !doprocessSameEventHPions) { + for (auto const& triggerTrack : triggerTracks) { + auto track = triggerTrack.track_as(); + if (!isValidTrigger(track)) + continue; + histos.fill(HIST("hTriggerAllSelectedEtaVsPt"), track.pt(), track.eta(), collision.centFT0M()); + histos.fill(HIST("hTriggerPtResolution"), track.pt(), triggerTrack.mcOriginalPt()); + if (doTriggPhysicalPrimary && !triggerTrack.mcPhysicalPrimary()) + continue; + histos.fill(HIST("hTriggerPrimaryEtaVsPt"), track.pt(), track.eta(), collision.centFT0M()); + histos.fill(HIST("hTrackEtaVsPtVsPhi"), track.pt(), track.eta(), track.phi()); + } + } + + // ________________________________________________ + // Do hadron - hadron correlations + fillCorrelationsHadron(triggerTracks, assocHadrons, false, collision.posZ(), collision.centFT0M(), 7); + } + void processSameEventHV0s(soa::Join::iterator const& collision, aod::AssocV0s const& associatedV0s, aod::TriggerTracks const& triggerTracks, V0DatasWithoutTrackX const&, aod::V0sLinked const&, TracksComplete const&, aod::BCsWithTimestamps const&) @@ -998,7 +1094,7 @@ struct correlateStrangeness { fillCorrelationsCascade(triggerTracks, associatedCascades, false, collision.posX(), collision.posY(), collision.posZ(), collision.centFT0M()); } void processSameEventHPions(soa::Join::iterator const& collision, - aod::AssocPions const& associatedPions, aod::TriggerTracks const& triggerTracks, + aod::AssocHadrons const& associatedPions, aod::TriggerTracks const& triggerTracks, TracksComplete const&, aod::BCsWithTimestamps const&) { // ________________________________________________ @@ -1048,8 +1144,51 @@ struct correlateStrangeness { // ________________________________________________ // Do hadron - Pion correlations - fillCorrelationsPion(triggerTracks, associatedPions, false, collision.posZ(), collision.centFT0M()); + fillCorrelationsHadron(triggerTracks, associatedPions, false, collision.posZ(), collision.centFT0M(), 8); + } + + void processMixedEventHHadrons(soa::Join const& collisions, + aod::AssocHadrons const& assocHadrons, aod::TriggerTracks const& triggerTracks, + TracksComplete const&) + { + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, mixingParameter, -1, collisions, collisions)) { + + // ________________________________________________ + // skip if desired trigger not found + if (triggerPresenceMap.size() > 0 && (!bitcheck(triggerPresenceMap[collision1.globalIndex()], triggerBinToSelect) || !bitcheck(triggerPresenceMap[collision2.globalIndex()], triggerBinToSelect))) { + return; + } + + // ________________________________________________ + // Perform basic event selection on both collisions + if (!collision1.sel8() || !collision2.sel8()) + continue; + if (TMath::Abs(collision1.posZ()) > zVertexCut || TMath::Abs(collision2.posZ()) > zVertexCut) + continue; + if (collision1.centFT0M() > axisRanges[5][1] || collision1.centFT0M() < axisRanges[5][0]) + continue; + if (collision2.centFT0M() > axisRanges[5][1] || collision2.centFT0M() < axisRanges[5][0]) + continue; + if ((!collision1.isInelGt0() || !collision2.isInelGt0()) && selectINELgtZERO) + continue; + + if (collision1.globalIndex() == collision2.globalIndex()) { + histos.fill(HIST("MixingQA/hMixingQA"), 0.0f); // same-collision pair counting + } + + histos.fill(HIST("MixingQA/hMEpvz1"), collision1.posZ()); + histos.fill(HIST("MixingQA/hMEpvz2"), collision2.posZ()); + histos.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), collision1.centFT0M()})); + // ________________________________________________ + // Do slicing + auto slicedTriggerTracks = triggerTracks.sliceBy(collisionSliceTracks, collision1.globalIndex()); + auto slicedAssocHadrons = assocHadrons.sliceBy(collisionSliceHadrons, collision2.globalIndex()); + // ________________________________________________ + // Do hadron - hadron correlations + fillCorrelationsHadron(slicedTriggerTracks, slicedAssocHadrons, true, collision1.posZ(), collision1.centFT0M(), 7); + } } + void processMixedEventHV0s(soa::Join const& collisions, aod::AssocV0s const& associatedV0s, aod::TriggerTracks const& triggerTracks, V0DatasWithoutTrackX const&, aod::V0sLinked const&, TracksComplete const&, aod::BCsWithTimestamps const&) @@ -1140,7 +1279,7 @@ struct correlateStrangeness { } } void processMixedEventHPions(soa::Join const& collisions, - aod::AssocPions const& assocPions, aod::TriggerTracks const& triggerTracks, + aod::AssocHadrons const& assocPions, aod::TriggerTracks const& triggerTracks, TracksComplete const&) { for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, mixingParameter, -1, collisions, collisions)) { @@ -1174,14 +1313,14 @@ struct correlateStrangeness { // ________________________________________________ // Do slicing auto slicedTriggerTracks = triggerTracks.sliceBy(collisionSliceTracks, collision1.globalIndex()); - auto slicedAssocPions = assocPions.sliceBy(collisionSlicePions, collision2.globalIndex()); + auto slicedAssocPions = assocPions.sliceBy(collisionSliceHadrons, collision2.globalIndex()); // ________________________________________________ // Do hadron - cascade correlations - fillCorrelationsPion(slicedTriggerTracks, slicedAssocPions, true, collision1.posZ(), collision1.centFT0M()); + fillCorrelationsHadron(slicedTriggerTracks, slicedAssocPions, true, collision1.posZ(), collision1.centFT0M(), 8); } } - void processMCGenerated(aod::McCollision const& mcCollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles) + void processMCGenerated(aod::McCollision const& /*mcCollision*/, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles) { histos.fill(HIST("hClosureTestEventCounter"), 2.5f); @@ -1324,7 +1463,7 @@ struct correlateStrangeness { }); } } - void processClosureTest(aod::McCollision const& mcCollision, soa::SmallGroups> const& recCollisions, aod::McParticles const& mcParticles) + void processClosureTest(aod::McCollision const& /*mcCollision*/, soa::SmallGroups> const& recCollisions, aod::McParticles const& mcParticles) { std::vector triggerIndices; @@ -1476,7 +1615,7 @@ struct correlateStrangeness { associatedIndices.emplace_back(omegaPlusIndices); associatedIndices.emplace_back(piIndices); - for (Int_t iTrigger = 0; iTrigger < triggerIndices.size(); iTrigger++) { + for (std::size_t iTrigger = 0; iTrigger < triggerIndices.size(); iTrigger++) { auto triggerParticle = mcParticles.iteratorAt(triggerIndices[iTrigger]); // check range of trigger particle if (triggerParticle.pt() > axisRanges[3][1] || triggerParticle.pt() < axisRanges[3][0]) { @@ -1486,10 +1625,10 @@ struct correlateStrangeness { Double_t gphitrigger = triggerParticle.phi(); Double_t pttrigger = triggerParticle.pt(); auto const& mother = triggerParticle.mothers_first_as(); - Int_t globalIndex = mother.globalIndex(); + auto globalIndex = mother.globalIndex(); static_for<0, 7>([&](auto i) { // associated loop constexpr int index = i.value; - for (Int_t iassoc = 0; iassoc < associatedIndices[index].size(); iassoc++) { + for (std::size_t iassoc = 0; iassoc < associatedIndices[index].size(); iassoc++) { auto assocParticle = mcParticles.iteratorAt(associatedIndices[index][iassoc]); if (triggerIndices[iTrigger] != associatedIndices[index][iassoc] && globalIndex != assocParticle.globalIndex()) { // avoid self Double_t getaassoc = assocParticle.eta(); @@ -1513,15 +1652,19 @@ struct correlateStrangeness { } } - PROCESS_SWITCH(correlateStrangeness, processSelectEventWithTrigger, "Select events with trigger only", false); + PROCESS_SWITCH(correlateStrangeness, processSelectEventWithTrigger, "Select events with trigger only", true); PROCESS_SWITCH(correlateStrangeness, processSameEventHV0s, "Process same events, h-V0s", true); PROCESS_SWITCH(correlateStrangeness, processSameEventHCascades, "Process same events, h-Cascades", true); PROCESS_SWITCH(correlateStrangeness, processSameEventHPions, "Process same events, h-Pion", true); + PROCESS_SWITCH(correlateStrangeness, processSameEventHHadrons, "Process same events, h-h", true); + PROCESS_SWITCH(correlateStrangeness, processMixedEventHV0s, "Process mixed events, h-V0s", true); PROCESS_SWITCH(correlateStrangeness, processMixedEventHCascades, "Process mixed events, h-Cascades", true); PROCESS_SWITCH(correlateStrangeness, processMixedEventHPions, "Process mixed events, h-Pion", true); - PROCESS_SWITCH(correlateStrangeness, processMCGenerated, "Process MC generated", true); - PROCESS_SWITCH(correlateStrangeness, processClosureTest, "Process Closure Test", true); + PROCESS_SWITCH(correlateStrangeness, processMixedEventHHadrons, "Process mixed events, h-h", true); + + PROCESS_SWITCH(correlateStrangeness, processMCGenerated, "Process MC generated", false); + PROCESS_SWITCH(correlateStrangeness, processClosureTest, "Process Closure Test", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx b/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx index b76fbee0fa8..90ff4382b41 100644 --- a/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx +++ b/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx @@ -13,9 +13,14 @@ /// \author Sofia Tomassini, Gleb Romanenko, Nicolò Jacazio /// \since 31 May 2023 +#include +#include +#include +#include + #include #include -#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -32,9 +37,6 @@ #include "PWGCF/Femto3D/DataModel/singletrackselector.h" #include "PWGCF/Femto3D/Core/femto3dPairTask.h" -#include "TLorentzVector.h" -#include "TDatabasePDG.h" - using namespace o2; using namespace o2::soa; using namespace o2::aod; @@ -297,7 +299,7 @@ struct K0MixedEvents { } registry.fill(HIST("Trks"), 1); - const float& vtxZ = track.singleCollSel_as().posZ(); + const float vtxZ = track.singleCollSel_as().posZ(); registry.fill(HIST("VTX"), vtxZ); if (std::abs(vtxZ) > _vertexZ) continue; diff --git a/PWGLF/Tasks/Strangeness/lambdak0sflattenicity.cxx b/PWGLF/Tasks/Strangeness/lambdak0sflattenicity.cxx index f949a2fbed4..0b1d48aad85 100755 --- a/PWGLF/Tasks/Strangeness/lambdak0sflattenicity.cxx +++ b/PWGLF/Tasks/Strangeness/lambdak0sflattenicity.cxx @@ -11,30 +11,35 @@ /// /// Making modifications to the Strangeness Tutorial code /// The code is still in development mode -/// Flattenicity part of the code is adopted from https://github.com/AliceO2Group/O2Physics/blob/master/PWGMM/Mult/Tasks/flatenicityFV0.cxx -/// For any suggestions, commets or questions, Please write to Suraj Prasad (Suraj.Prasad@cern.ch) +/// Flattenicity part of the code is adopted from +/// https://github.com/AliceO2Group/O2Physics/blob/master/PWGMM/Mult/Tasks/flatenicityFV0.cxx +/// For any suggestions, commets or questions, Please write to Suraj Prasad +/// (Suraj.Prasad@cern.ch) #include +// #include #include -#include "Framework/ASoAHelpers.h" +// #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/StaticFor.h" +// #include "Framework/StaticFor.h" #include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" +// #include "Common/Core/TrackSelection.h" +// #include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" +// #include "ReconstructionDataFormats/Track.h" +#include "Framework/O2DatabasePDGPlugin.h" #include -#include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/DataModel/PIDResponse.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/inelGt.h" using namespace o2; using namespace o2::framework; @@ -42,67 +47,156 @@ using namespace o2::framework::expressions; struct lambdak0sflattenicity { // Histograms are defined with HistogramRegistry - HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry rKzeroShort{"kzeroShort", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry rLambda{"lambda", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry rAntiLambda{"antilambda", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry rFlattenicity{"flattenicity", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + Service pdg; + HistogramRegistry rEventSelection{"eventSelection", + {}, + OutputObjHandlingPolicy::AnalysisObject, + true, + true}; + HistogramRegistry rKzeroShort{ + "kzeroShort", + {}, + OutputObjHandlingPolicy::AnalysisObject, + true, + true}; + HistogramRegistry rLambda{ + "lambda", + {}, + OutputObjHandlingPolicy::AnalysisObject, + true, + true}; + HistogramRegistry rAntiLambda{ + "antilambda", + {}, + OutputObjHandlingPolicy::AnalysisObject, + true, + true}; + HistogramRegistry rFlattenicity{ + "flattenicity", + {}, + OutputObjHandlingPolicy::AnalysisObject, + true, + true}; static constexpr std::string_view nhEst[8] = { - "eGlobaltrack", "eFV0", "e1flatencityFV0", "eFT0", "e1flatencityFT0", "eFV0FT0C", "e1flatencityFV0FT0C", "ePtTrig"}; + "eGlobaltrack", "eFV0", "e1flatencityFV0", "eFT0", + "e1flatencityFT0", "eFV0FT0C", "e1flatencityFV0FT0C", "ePtTrig"}; static constexpr std::string_view tEst[8] = { - "GlobalTrk", "FV0", "1-flatencity_FV0", "FT0", "1-flatencityFT0", "FV0_FT0C", "1-flatencity_FV0_FT0C", "PtTrig"}; + "GlobalTrk", "FV0", "1-flatencity_FV0", "FT0", + "1-flatencityFT0", "FV0_FT0C", "1-flatencity_FV0_FT0C", "PtTrig"}; static constexpr std::string_view nhPtEst[8] = { - "ptVsGlobaltrack", "ptVsFV0", "ptVs1flatencityFV0", "ptVsFT0", "ptVs1flatencityFT0", "ptVsFV0FT0C", "ptVs1flatencityFV0FT0C", "pTVsPtTrig"}; + "ptVsGlobaltrack", "ptVsFV0", + "ptVs1flatencityFV0", "ptVsFT0", + "ptVs1flatencityFT0", "ptVsFV0FT0C", + "ptVs1flatencityFV0FT0C", "pTVsPtTrig"}; // Configurable for histograms Configurable nBinsVz{"nBinsVz", 100, "N bins in Vz"}; Configurable nBinsK0sMass{"nBinsK0sMass", 200, "N bins in K0sMass"}; - Configurable nBinsLambdaMass{"nBinsLambdaMass", 200, "N bins in LambdaMass"}; + Configurable nBinsLambdaMass{"nBinsLambdaMass", 200, + "N bins in LambdaMass"}; Configurable nBinspT{"nBinspT", 250, "N bins in pT"}; + Configurable nBinsFlattenicity{"nBinsFlattenicity", 100, "N bins in Flattenicity"}; // Configurable for event selection - Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + + Configurable applyEvSel{"applyEvSel", true, + "Apply event selection to Data and MCRec"}; + Configurable Issel8{"Issel8", true, + "Accept events that pass sel8 selection"}; + Configurable cutzvertex{"cutzvertex", 10.0f, + "Accepted z-vertex range (cm)"}; + Configurable IsINELgt0{"isINELgt0", true, "is INEL gt 0"}; + Configurable IsNoTimeFrameBorder{ + "IsNoTimeFrameBorder", true, + "cut branch crossing at the beginning/end of TF"}; + Configurable IsNoITSROFrameBorder{ + "IsNoITSROFrameBorder", true, + "cut branch crossing at the beginning/end of ITS ROF"}; + Configurable IsVertexITSTPC{"IsVertexITSTPC", false, + "Is Vertex ITSTPC"}; + Configurable IsNoSameBunchPileup{"IsNoSameBunchPileup", false, + "Is No Same Bunch Pileup"}; + Configurable IsGoodZvtxFT0vsPV{"IsGoodZvtxFT0vsPV", false, + "Is Good Zvtx FT0 vs PV"}; + Configurable IsTriggerTVX{"IsTriggerTVX", true, + "coincidence of a signal in FT0A and FT0C"}; // Configurables for Flattenicity + Configurable flattenicityQA{"flattenicityQA", true, "Store Flattenicity QA plots"}; Configurable applyCalibCh{"applyCalibCh", false, "equalize FV0"}; - Configurable applyCalibVtx{"applyCalibVtx", false, "equalize FV0 vs vtx"}; + Configurable applyCalibVtx{"applyCalibVtx", false, + "equalize FV0 vs vtx"}; Configurable applyNorm{"applyNorm", false, "normalization to eta"}; + Configurable isflattenicitywithFV0{"isflattenicitywithFV0", true, + "Calculate Flattenicity with FV0"}; + Configurable isflattenicitywithFT0{"isflattenicitywithFT0", true, + "Calculate Flattenicity with FT0"}; + Configurable isflattenicitywithFV0FT0C{ + "isflattenicitywithFV0FT0C", true, + "Calculate Flattenicity with FV0+FT0C"}; + + Configurable flattenicityforanalysis{ + "flattenicityforanalysis", 0, + "Which Flattenicity to be used for analysis, 0 for FV0, 1 for FT0, 2 for FV0+FT0C"}; // Common Configurable parameters for V0 selection - Configurable v0setting_dcav0dau{"v0setting_dcav0dau", 1, "DCA V0 Daughters"}; - Configurable v0setting_dcapostopv{"v0setting_dcapostopv", 0.06, "DCA Pos To PV"}; - Configurable v0setting_dcanegtopv{"v0setting_dcanegtopv", 0.06, "DCA Neg To PV"}; + Configurable v0setting_dcav0dau{"v0setting_dcav0dau", 1, + "DCA V0 Daughters"}; + Configurable v0setting_dcapostopv{"v0setting_dcapostopv", 0.06, + "DCA Pos To PV"}; + Configurable v0setting_dcanegtopv{"v0setting_dcanegtopv", 0.06, + "DCA Neg To PV"}; + Configurable v0setting_rapidity{"v0setting_rapidity", 0.5, + "V0 rapidity cut"}; // Configurable parameters for V0 selection for KOs - Configurable v0setting_cospaK0s{"v0setting_cospa_K0s", 0.97, "V0 CosPA for K0s"}; - Configurable v0setting_radiusK0s{"v0setting_radius_K0s", 0.5, "v0radius for K0s"}; - Configurable v0setting_ctauK0s{"v0setting_ctau_K0s", 20, "v0ctau for K0s"}; + Configurable v0setting_cospaK0s{"v0setting_cospa_K0s", 0.97, + "V0 CosPA for K0s"}; + Configurable v0setting_radiusK0s{"v0setting_radius_K0s", 0.5, + "v0radius for K0s"}; + Configurable v0setting_ctauK0s{"v0setting_ctau_K0s", 20, + "v0ctau for K0s"}; + Configurable v0setting_massrejectionK0s{ + "v0setting_massrejection_K0s", 0.005, + "Competing Mass Rejection cut for K0s"}; // Configurable parameters for V0 selection for Lambda - Configurable v0setting_cospaLambda{"v0setting_cospa_Lambda", 0.995, "V0 CosPA for Lambda"}; - Configurable v0setting_radiusLambda{"v0setting_radius_Lambda", 0.5, "v0radius for Lambda"}; - Configurable v0setting_ctauLambda{"v0setting_ctau_Lambda", 30, "v0ctau for Lambda"}; + Configurable v0setting_cospaLambda{"v0setting_cospa_Lambda", 0.995, + "V0 CosPA for Lambda"}; + Configurable v0setting_radiusLambda{"v0setting_radius_Lambda", 0.5, + "v0radius for Lambda"}; + Configurable v0setting_ctauLambda{"v0setting_ctau_Lambda", 30, + "v0ctau for Lambda"}; + Configurable v0setting_massrejectionLambda{ + "v0setting_massrejection_Lambda", 0.01, + "Competing Mass Rejection cut for Lambda"}; // Configurable parameters for PID selection Configurable NSigmaTPCPion{"NSigmaTPCPion", 5, "NSigmaTPCPion"}; Configurable NSigmaTPCProton{"NSigmaTPCProton", 5, "NSigmaTPCProton"}; - // Configurable v0daughter_etacut{"V0DaughterEtaCut", 0.8, "V0DaughterEtaCut"}; + // Configurable v0daughter_etacut{"V0DaughterEtaCut", 0.8, + // "V0DaughterEtaCut"}; Configurable v0_etacut{"v0EtaCut", 0.8, "v0EtaCut"}; // acceptance cuts for Flattenicity correlation - Configurable cfgTrkEtaCut{"cfgTrkEtaCut", 0.8f, "Eta range for tracks"}; + Configurable cfgTrkEtaCut{"cfgTrkEtaCut", 0.8f, + "Eta range for tracks"}; Configurable cfgTrkLowPtCut{"cfgTrkLowPtCut", 0.0f, "Minimum pT"}; void init(InitContext const&) { // Axes - AxisSpec K0sMassAxis = {nBinsK0sMass, 0.45f, 0.55f, "#it{M}_{#pi^{+}#pi^{-}} [GeV/#it{c}^{2}]"}; - AxisSpec LambdaMassAxis = {nBinsLambdaMass, 1.015f, 1.215f, "#it{M}_{p#pi^{-}} [GeV/#it{c}^{2}]"}; - AxisSpec AntiLambdaMassAxis = {nBinsLambdaMass, 1.015f, 1.215f, "#it{M}_{#pi^{+}#bar{p}} [GeV/#it{c}^{2}]"}; + AxisSpec K0sMassAxis = {nBinsK0sMass, 0.45f, 0.55f, + "#it{M}_{#pi^{+}#pi^{-}} [GeV/#it{c}^{2}]"}; + AxisSpec LambdaMassAxis = {nBinsLambdaMass, 1.015f, 1.215f, + "#it{M}_{p#pi^{-}} [GeV/#it{c}^{2}]"}; + AxisSpec AntiLambdaMassAxis = {nBinsLambdaMass, 1.015f, 1.215f, + "#it{M}_{#pi^{+}#bar{p}} [GeV/#it{c}^{2}]"}; AxisSpec vertexZAxis = {nBinsVz, -15., 15., "vrtx_{Z} [cm]"}; AxisSpec ptAxis = {nBinspT, 0.0f, 25.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec flatAxis = {nBinsFlattenicity, 0.0f, 1.0f, "1-#rho_{ch}"}; int nBinsEst[8] = {100, 500, 102, 500, 102, 500, 102, 150}; float lowEdgeEst[8] = {-0.5, -0.5, -0.01, -0.5, -0.01, -0.5, -0.01, .0}; @@ -110,119 +204,294 @@ struct lambdak0sflattenicity { // Histograms // Event selection - rEventSelection.add("hVertexZ", "hVertexZ", {HistType::kTH1F, {vertexZAxis}}); - rEventSelection.add("hEventsRejected", "hEventsRejected", {HistType::kTH1F, {{11, -0.5, 10.5}}}); - rEventSelection.add("hEventsSelected", "hEventsSelected", {HistType::kTH1F, {{11, -0.5, 10.5}}}); - + rEventSelection.add("hVertexZ", "hVertexZ", + {HistType::kTH1D, {vertexZAxis}}); + rEventSelection.add("hEventsSelected", "hEventsSelected", + {HistType::kTH1D, {{12, 0, 12}}}); + + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(1, "all"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(2, "sel8"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(3, "zvertex"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(4, "TFBorder"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(5, "ITSROFBorder"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(6, "VertexITSTPC"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(7, "SameBunchPileup"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(8, "isGoodZvtxFT0vsPV"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(9, "TVX"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(10, "INEL>0"); + rEventSelection.get(HIST("hEventsSelected"))->GetXaxis()->SetBinLabel(11, "Applied selection"); + + rEventSelection.add("hFlattenicityDistribution", "hFlattenicityDistribution", + {HistType::kTH1D, {flatAxis}}); + if (doprocessRecMC) { + rEventSelection.add("hFlattenicityDistributionMCGen_Rec", "hFlattenicityDistributionMCGen_Rec", + {HistType::kTH1D, {flatAxis}}); + rEventSelection.add("hFlattenicity_Corr_Gen_vs_Rec", "hFlattenicity_Corr_Gen_vs_Rec", + {HistType::kTH2D, {flatAxis, flatAxis}}); + } if (doprocessGenMC) { - rEventSelection.add("hVertexZGen", "hVertexZGen", {HistType::kTH1F, {vertexZAxis}}); - rEventSelection.add("hEventSelectionMCGen", "hEventSelectionMCGen", {HistType::kTH1F, {{11, -0.5, 10.5}}}); + rEventSelection.add("hVertexZGen", "hVertexZGen", + {HistType::kTH1D, {vertexZAxis}}); + + rEventSelection.add("hFlattenicityDistributionMCGen", "hFlattenicityDistributionMCGen", + {HistType::kTH1D, {flatAxis}}); + + rEventSelection.add("hFlat_RecoColl_MC", "hFlat_RecoColl_MC", {HistType::kTH1D, {flatAxis}}); + rEventSelection.add("hFlat_RecoColl_MC_INELgt0", "hFlat_RecoColl_MC_INELgt0", {HistType::kTH1D, {flatAxis}}); + rEventSelection.add("hFlat_GenRecoColl_MC", "hFlat_GenRecoColl_MC", {HistType::kTH1D, {flatAxis}}); + rEventSelection.add("hFlat_GenRecoColl_MC_INELgt0", "hFlat_GenRecoColl_MC_INELgt0", {HistType::kTH1D, {flatAxis}}); + rEventSelection.add("hFlat_GenColl_MC", "hFlat_GenColl_MC", {HistType::kTH1D, {flatAxis}}); + rEventSelection.add("hFlat_GenColl_MC_INELgt0", "hFlat_GenColl_MC_INELgt0", {HistType::kTH1D, {flatAxis}}); + rEventSelection.add("hNEventsMCGen", "hNEventsMCGen", {HistType::kTH1D, {{4, 0.f, 4.f}}}); + rEventSelection.get(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(1, "all"); + rEventSelection.get(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(2, "zvertex_true"); + rEventSelection.get(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(3, "INELgt0_true"); + rEventSelection.add("hNEventsMCGenReco", "hNEventsMCGenReco", {HistType::kTH1D, {{2, 0.f, 2.f}}}); + rEventSelection.get(HIST("hNEventsMCGenReco"))->GetXaxis()->SetBinLabel(1, "INEL"); + rEventSelection.get(HIST("hNEventsMCGenReco"))->GetXaxis()->SetBinLabel(2, "INELgt0"); + rEventSelection.add("hNEventsMCReco", "hNEventsMCReco", {HistType::kTH1D, {{4, 0.f, 4.f}}}); + rEventSelection.get(HIST("hNEventsMCReco"))->GetXaxis()->SetBinLabel(1, "all"); + rEventSelection.get(HIST("hNEventsMCReco"))->GetXaxis()->SetBinLabel(2, "pass ev sel"); + rEventSelection.get(HIST("hNEventsMCReco"))->GetXaxis()->SetBinLabel(3, "INELgt0"); + rEventSelection.get(HIST("hNEventsMCReco"))->GetXaxis()->SetBinLabel(4, "check"); } // K0s reconstruction // Mass - rKzeroShort.add("hMassK0s", "hMassK0s", {HistType::kTH1F, {K0sMassAxis}}); - rKzeroShort.add("hMassK0sSelected", "hMassK0sSelected", {HistType::kTH1F, {K0sMassAxis}}); + rKzeroShort.add("hMassK0s", "hMassK0s", {HistType::kTH1D, {K0sMassAxis}}); + rKzeroShort.add("hMassK0sSelected", "hMassK0sSelected", + {HistType::kTH1D, {K0sMassAxis}}); // K0s topological/PID cuts - rKzeroShort.add("hrapidityK0s", "hrapidityK0s", {HistType::kTH1F, {{40, -2.0f, 2.0f, "y"}}}); - rKzeroShort.add("hctauK0s", "hctauK0s", {HistType::kTH1F, {{40, 0.0f, 40.0f, "c#tau (cm)"}}}); - rKzeroShort.add("h2DdecayRadiusK0s", "h2DdecayRadiusK0s", {HistType::kTH1F, {{100, 0.0f, 1.0f, "Decay Radius (cm)"}}}); - rKzeroShort.add("hDCAV0DaughtersK0s", "hDCAV0DaughtersK0s", {HistType::kTH1F, {{55, 0.0f, 2.2f, "DCA Daughters"}}}); - rKzeroShort.add("hV0CosPAK0s", "hV0CosPAK0s", {HistType::kTH1F, {{100, 0.95f, 1.f, "CosPA"}}}); - rKzeroShort.add("hNSigmaPosPionFromK0s", "hNSigmaPosPionFromK0s", {HistType::kTH2F, {{100, -5.f, 5.f}, {ptAxis}}}); - rKzeroShort.add("hNSigmaNegPionFromK0s", "hNSigmaNegPionFromK0s", {HistType::kTH2F, {{100, -5.f, 5.f}, {ptAxis}}}); - rKzeroShort.add("hMassK0spT", "hMassK0spT", {HistType::kTH2F, {{K0sMassAxis}, {ptAxis}}}); + rKzeroShort.add("hrapidityK0s", "hrapidityK0s", + {HistType::kTH1D, {{40, -2.0f, 2.0f, "y"}}}); + rKzeroShort.add("hctauK0s", "hctauK0s", + {HistType::kTH1D, {{40, 0.0f, 40.0f, "c#tau (cm)"}}}); + rKzeroShort.add( + "h2DdecayRadiusK0s", "h2DdecayRadiusK0s", + {HistType::kTH1D, {{100, 0.0f, 1.0f, "Decay Radius (cm)"}}}); + rKzeroShort.add("hDCAV0DaughtersK0s", "hDCAV0DaughtersK0s", + {HistType::kTH1D, {{55, 0.0f, 2.2f, "DCA Daughters"}}}); + rKzeroShort.add("hV0CosPAK0s", "hV0CosPAK0s", + {HistType::kTH1D, {{100, 0.95f, 1.f, "CosPA"}}}); + rKzeroShort.add("hNSigmaPosPionFromK0s", "hNSigmaPosPionFromK0s", + {HistType::kTH2D, {{100, -5.f, 5.f}, {ptAxis}}}); + rKzeroShort.add("hNSigmaNegPionFromK0s", "hNSigmaNegPionFromK0s", + {HistType::kTH2D, {{100, -5.f, 5.f}, {ptAxis}}}); + rKzeroShort.add("hMassK0spT", "hMassK0spT", + {HistType::kTH2D, {{K0sMassAxis}, {ptAxis}}}); + rKzeroShort.add("hMassK0spTFlat", "hMassK0spTFlat", + {HistType::kTH3D, {{K0sMassAxis}, {ptAxis}, {flatAxis}}}); + if (doprocessRecMC) { + rKzeroShort.add("Generated_MCRecoCollCheck_INEL_K0Short", "Generated_MCRecoCollCheck_INEL_K0Short", + {HistType::kTH2D, {{ptAxis}, {flatAxis}}}); + } if (doprocessGenMC) { - rKzeroShort.add("hPtK0ShortGen", "hPtK0ShortGen", {HistType::kTH1F, {ptAxis}}); - rKzeroShort.add("K0sCounterMCGen", "K0sCounterMCGen", {HistType::kTH1F, {{10, 0, 10}}}); + rKzeroShort.add("pGen_MCGenRecoColl_INEL_K0Short", "pGen_MCGenRecoColl_INEL_K0Short", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rKzeroShort.add("Generated_MCRecoColl_INEL_K0Short", "Generated_MCRecoColl_INEL_K0Short", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rKzeroShort.add("pGen_MCGenColl_INEL_K0Short", "pGen_MCGenColl_INEL_K0Short", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rKzeroShort.add("pGen_MCGenRecoColl_INELgt0_K0Short", "pGen_MCGenRecoColl_INELgt0_K0Short", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rKzeroShort.add("Generated_MCRecoColl_INELgt0_K0Short", "Generated_MCRecoColl_INELgt0_K0Short", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rKzeroShort.add("Generated_MCRecoCollCheck_INELgt0_K0Short", "Generated_MCRecoCollCheck_INELgt0_K0Short", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rKzeroShort.add("pGen_MCGenColl_INELgt0_K0Short", "pGen_MCGenColl_INELgt0_K0Short", + {HistType::kTH2D, {ptAxis, flatAxis}}); } - // Lambda reconstruction - // Mass - rLambda.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {LambdaMassAxis}}); - rLambda.add("hMassLambdaSelected", "hMassLambdaSelected", {HistType::kTH1F, {LambdaMassAxis}}); + // Lambda reconstruction Mass + rLambda.add("hMassLambda", "hMassLambda", + {HistType::kTH1D, {LambdaMassAxis}}); + rLambda.add("hMassLambdaSelected", "hMassLambdaSelected", + {HistType::kTH1D, {LambdaMassAxis}}); // Lambda topological/PID cuts - rLambda.add("hDCAV0DaughtersLambda", "hDCAV0DaughtersLambda", {HistType::kTH1F, {{55, 0.0f, 2.2f, "DCA Daughters"}}}); - rLambda.add("hV0CosPALambda", "hV0CosPALambda", {HistType::kTH1F, {{100, 0.95f, 1.f, "CosPA"}}}); - rLambda.add("hNSigmaPosPionFromLambda", "hNSigmaPosPionFromLambda", {HistType::kTH2F, {{100, -5.f, 5.f}, {ptAxis}}}); - rLambda.add("hNSigmaNegPionFromLambda", "hNSigmaNegPionFromLambda", {HistType::kTH2F, {{100, -5.f, 5.f}, {ptAxis}}}); - rLambda.add("hrapidityLambda", "hrapidityLambda", {HistType::kTH1F, {{40, -2.0f, 2.0f, "y"}}}); - rLambda.add("hctauLambda", "hctauLambda", {HistType::kTH1F, {{40, 0.0f, 40.0f, "c#tau (cm)"}}}); - rLambda.add("h2DdecayRadiusLambda", "h2DdecayRadiusLambda", {HistType::kTH1F, {{100, 0.0f, 1.0f, "c#tau (cm)"}}}); - rLambda.add("hMassLambdapT", "hMassLambdapT", {HistType::kTH2F, {{LambdaMassAxis}, {ptAxis}}}); + rLambda.add("hDCAV0DaughtersLambda", "hDCAV0DaughtersLambda", + {HistType::kTH1D, {{55, 0.0f, 2.2f, "DCA Daughters"}}}); + rLambda.add("hV0CosPALambda", "hV0CosPALambda", + {HistType::kTH1D, {{100, 0.95f, 1.f, "CosPA"}}}); + rLambda.add("hNSigmaPosPionFromLambda", "hNSigmaPosPionFromLambda", + {HistType::kTH2D, {{100, -5.f, 5.f}, {ptAxis}}}); + rLambda.add("hNSigmaNegPionFromLambda", "hNSigmaNegPionFromLambda", + {HistType::kTH2D, {{100, -5.f, 5.f}, {ptAxis}}}); + rLambda.add("hrapidityLambda", "hrapidityLambda", + {HistType::kTH1D, {{40, -2.0f, 2.0f, "y"}}}); + rLambda.add("hctauLambda", "hctauLambda", + {HistType::kTH1D, {{40, 0.0f, 40.0f, "c#tau (cm)"}}}); + rLambda.add("h2DdecayRadiusLambda", "h2DdecayRadiusLambda", + {HistType::kTH1D, {{100, 0.0f, 1.0f, "c#tau (cm)"}}}); + rLambda.add("hMassLambdapT", "hMassLambdapT", + {HistType::kTH2D, {{LambdaMassAxis}, {ptAxis}}}); + rLambda.add("hMassLambdapTFlat", "hMassLambdapTFlat", + {HistType::kTH3D, {{LambdaMassAxis}, {ptAxis}, {flatAxis}}}); + if (doprocessRecMC) { + rLambda.add("Generated_MCRecoCollCheck_INEL_Lambda", "Generated_MCRecoCollCheck_INEL_Lambda", + {HistType::kTH2D, {{ptAxis}, {flatAxis}}}); + } if (doprocessGenMC) { - rLambda.add("hPtLambdaGen", "hPtLambdaGen", {HistType::kTH1F, {ptAxis}}); - rLambda.add("LambdaCounterMCGen", "LambdaCounterMCGen", {HistType::kTH1F, {{10, 0, 10}}}); + rLambda.add("pGen_MCGenRecoColl_INEL_Lambda", "pGen_MCGenRecoColl_INEL_Lambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rLambda.add("Generated_MCRecoColl_INEL_Lambda", "Generated_MCRecoColl_INEL_Lambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rLambda.add("pGen_MCGenColl_INEL_Lambda", "pGen_MCGenColl_INEL_Lambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rLambda.add("pGen_MCGenRecoColl_INELgt0_Lambda", "pGen_MCGenRecoColl_INELgt0_Lambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rLambda.add("Generated_MCRecoColl_INELgt0_Lambda", "Generated_MCRecoColl_INELgt0_Lambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rLambda.add("Generated_MCRecoCollCheck_INELgt0_Lambda", "Generated_MCRecoCollCheck_INELgt0_Lambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rLambda.add("pGen_MCGenColl_INELgt0_Lambda", "pGen_MCGenColl_INELgt0_Lambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); } // AntiLambda reconstruction // Mass - rAntiLambda.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {AntiLambdaMassAxis}}); - rAntiLambda.add("hMassAntiLambdaSelected", "hMassAntiLambdaSelected", {HistType::kTH1F, {AntiLambdaMassAxis}}); + rAntiLambda.add("hMassAntiLambda", "hMassAntiLambda", + {HistType::kTH1D, {AntiLambdaMassAxis}}); + rAntiLambda.add("hMassAntiLambdaSelected", "hMassAntiLambdaSelected", + {HistType::kTH1D, {AntiLambdaMassAxis}}); // AntiLambda topological/PID cuts - rAntiLambda.add("hDCAV0DaughtersAntiLambda", "hDCAV0DaughtersAntiLambda", {HistType::kTH1F, {{55, 0.0f, 2.2f, "DCA Daughters"}}}); - rAntiLambda.add("hV0CosPAAntiLambda", "hV0CosPAAntiLambda", {HistType::kTH1F, {{100, 0.95f, 1.f, "CosPA"}}}); - rAntiLambda.add("hNSigmaPosPionFromAntiLambda", "hNSigmaPosPionFromAntiLambda", {HistType::kTH2F, {{100, -5.f, 5.f}, {ptAxis}}}); - rAntiLambda.add("hNSigmaNegPionFromAntiLambda", "hNSigmaNegPionFromAntiLambda", {HistType::kTH2F, {{100, -5.f, 5.f}, {ptAxis}}}); - rAntiLambda.add("hrapidityAntiLambda", "hrapidityAntiLambda", {HistType::kTH1F, {{40, -2.0f, 2.0f, "y"}}}); - rAntiLambda.add("hctauAntiLambda", "hctauAntiLambda", {HistType::kTH1F, {{40, 0.0f, 40.0f, "c#tau (cm)"}}}); - rAntiLambda.add("h2DdecayRadiusAntiLambda", "h2DdecayRadiusAntiLambda", {HistType::kTH1F, {{100, 0.0f, 1.0f, "c#tau (cm)"}}}); - rAntiLambda.add("hMassAntiLambdapT", "hMassAntiLambdapT", {HistType::kTH2F, {{AntiLambdaMassAxis}, {ptAxis}}}); - - if (doprocessGenMC) { - rAntiLambda.add("hPtAntiLambdaGen", "hPtAntiLambdaGen", {HistType::kTH1F, {ptAxis}}); - rAntiLambda.add("AntiLambdaCounterMCGen", "AntiLambdaCounterMCGen", {HistType::kTH1F, {{10, 0, 10}}}); + rAntiLambda.add("hDCAV0DaughtersAntiLambda", "hDCAV0DaughtersAntiLambda", + {HistType::kTH1D, {{55, 0.0f, 2.2f, "DCA Daughters"}}}); + rAntiLambda.add("hV0CosPAAntiLambda", "hV0CosPAAntiLambda", + {HistType::kTH1D, {{100, 0.95f, 1.f, "CosPA"}}}); + rAntiLambda.add("hNSigmaPosPionFromAntiLambda", + "hNSigmaPosPionFromAntiLambda", + {HistType::kTH2D, {{100, -5.f, 5.f}, {ptAxis}}}); + rAntiLambda.add("hNSigmaNegPionFromAntiLambda", + "hNSigmaNegPionFromAntiLambda", + {HistType::kTH2D, {{100, -5.f, 5.f}, {ptAxis}}}); + rAntiLambda.add("hrapidityAntiLambda", "hrapidityAntiLambda", + {HistType::kTH1D, {{40, -2.0f, 2.0f, "y"}}}); + rAntiLambda.add("hctauAntiLambda", "hctauAntiLambda", + {HistType::kTH1D, {{40, 0.0f, 40.0f, "c#tau (cm)"}}}); + rAntiLambda.add("h2DdecayRadiusAntiLambda", "h2DdecayRadiusAntiLambda", + {HistType::kTH1D, {{100, 0.0f, 1.0f, "c#tau (cm)"}}}); + rAntiLambda.add("hMassAntiLambdapT", "hMassAntiLambdapT", + {HistType::kTH2D, {{AntiLambdaMassAxis}, {ptAxis}}}); + rAntiLambda.add("hMassAntiLambdapTFlat", "hMassAntiLambdapTFlat", + {HistType::kTH3D, {{AntiLambdaMassAxis}, {ptAxis}, {flatAxis}}}); + if (doprocessRecMC) { + rAntiLambda.add("Generated_MCRecoCollCheck_INEL_AntiLambda", "Generated_MCRecoCollCheck_INEL_AntiLambda", + {HistType::kTH2D, {{ptAxis}, {flatAxis}}}); } - rFlattenicity.add("hEv", "Ev", HistType::kTH1F, {{6, -0.5, 5.5, "index activated detector"}}); - rFlattenicity.add("hFV0amplRing1to4", "FV01to4", HistType::kTH1F, {{4000, -0.5, +49999.5, "FV0 amplitude"}}); - rFlattenicity.add("hFT0Aampl", "FTAampl", HistType::kTH1F, {{50000, -0.5, +199999.5, "FT0A amplitude"}}); - rFlattenicity.add("hFT0Campl", "FTCampl", HistType::kTH1F, {{10000, -0.5, +4999.5, "FT0C amplitude"}}); - rFlattenicity.add("hFT0C", "FT0C", HistType::kTH1F, {{50000, -0.5, 199999.5, "FT0C amplitudes"}}); - rFlattenicity.add("hFT0A", "FT0A", HistType::kTH1F, {{2000, -0.5, 1999.5, "FT0A amplitudes"}}); - - // estimators - for (int i_e = 0; i_e < 8; ++i_e) { - rFlattenicity.add( - nhEst[i_e].data(), "", HistType::kTH2F, {{nBinsEst[i_e], lowEdgeEst[i_e], upEdgeEst[i_e], tEst[i_e].data()}, {100, -0.5, +99.5, "Global track"}}); + if (doprocessGenMC) { + rAntiLambda.add("pGen_MCGenRecoColl_INEL_AntiLambda", "pGen_MCGenRecoColl_INEL_AntiLambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rAntiLambda.add("Generated_MCRecoColl_INEL_AntiLambda", "Generated_MCRecoColl_INEL_AntiLambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rAntiLambda.add("pGen_MCGenColl_INEL_AntiLambda", "pGen_MCGenColl_INEL_AntiLambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rAntiLambda.add("pGen_MCGenRecoColl_INELgt0_AntiLambda", "pGen_MCGenRecoColl_INELgt0_AntiLambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rAntiLambda.add("Generated_MCRecoColl_INELgt0_AntiLambda", "Generated_MCRecoColl_INELgt0_AntiLambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rAntiLambda.add("Generated_MCRecoCollCheck_INELgt0_AntiLambda", "Generated_MCRecoCollCheck_INELgt0_AntiLambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); + rAntiLambda.add("pGen_MCGenColl_INELgt0_AntiLambda", "pGen_MCGenColl_INELgt0_AntiLambda", + {HistType::kTH2D, {ptAxis, flatAxis}}); } - // vs pT - for (int i_e = 0; i_e < 8; ++i_e) { - rFlattenicity.add(nhPtEst[i_e].data(), "", HistType::kTProfile, {{nBinsEst[i_e], lowEdgeEst[i_e], upEdgeEst[i_e], tEst[i_e].data()}}); - } + if (flattenicityQA) { + rFlattenicity.add("hEv", "Ev", HistType::kTH1D, + {{6, -0.5, 5.5, "index activated detector"}}); + rFlattenicity.add("hFV0amplRing1to4", "FV01to4", HistType::kTH1D, + {{4000, -0.5, +49999.5, "FV0 amplitude"}}); + rFlattenicity.add("hFT0Aampl", "FTAampl", HistType::kTH1D, + {{50000, -0.5, +199999.5, "FT0A amplitude"}}); + rFlattenicity.add("hFT0Campl", "FTCampl", HistType::kTH1D, + {{10000, -0.5, +4999.5, "FT0C amplitude"}}); + rFlattenicity.add("hFT0C", "FT0C", HistType::kTH1D, + {{50000, -0.5, 199999.5, "FT0C amplitudes"}}); + rFlattenicity.add("hFT0A", "FT0A", HistType::kTH1D, + {{2000, -0.5, 1999.5, "FT0A amplitudes"}}); + + // estimators + for (int i_e = 0; i_e < 8; ++i_e) { + rFlattenicity.add( + nhEst[i_e].data(), "", HistType::kTH2D, + {{nBinsEst[i_e], lowEdgeEst[i_e], upEdgeEst[i_e], tEst[i_e].data()}, + {100, -0.5, +99.5, "Global track"}}); + } - rFlattenicity.add("fMultFv0", "FV0 amp", HistType::kTH1F, {{5000, -0.5, +199999.5, "FV0 amplitude"}}); - rFlattenicity.add("hAmpV0VsCh", "", HistType::kTH2F, {{48, -0.5, 47.5, "channel"}, {500, -0.5, +19999.5, "FV0 amplitude"}}); - rFlattenicity.add("hAmpV0VsChBeforeCalibration", "", HistType::kTH2F, {{48, -0.5, 47.5, "channel"}, {500, -0.5, +19999.5, "FV0 amplitude"}}); + // vs pT + for (int i_e = 0; i_e < 8; ++i_e) { + rFlattenicity.add( + nhPtEst[i_e].data(), "", HistType::kTProfile, + {{nBinsEst[i_e], lowEdgeEst[i_e], upEdgeEst[i_e], tEst[i_e].data()}}); + } - rFlattenicity.add("hAmpT0AVsChBeforeCalibration", "", HistType::kTH2F, {{24, -0.5, 23.5, "channel"}, {600, -0.5, +5999.5, "FT0A amplitude"}}); - rFlattenicity.add("hAmpT0CVsChBeforeCalibration", "", HistType::kTH2F, {{28, -0.5, 27.5, "channel"}, {600, -0.5, +5999.5, "FT0C amplitude"}}); + rFlattenicity.add("fMultFv0", "FV0 amp", HistType::kTH1D, + {{5000, -0.5, +199999.5, "FV0 amplitude"}}); + rFlattenicity.add( + "hAmpV0VsCh", "", HistType::kTH2D, + {{48, -0.5, 47.5, "channel"}, {500, -0.5, +19999.5, "FV0 amplitude"}}); + rFlattenicity.add( + "hAmpV0VsChBeforeCalibration", "", HistType::kTH2D, + {{48, -0.5, 47.5, "channel"}, {500, -0.5, +19999.5, "FV0 amplitude"}}); - rFlattenicity.add("hAmpT0AVsCh", "", HistType::kTH2F, {{24, -0.5, 23.5, "channel"}, {600, -0.5, +5999.5, "FT0A amplitude"}}); - rFlattenicity.add("hAmpT0CVsCh", "", HistType::kTH2F, {{28, -0.5, 27.5, "channel"}, {600, -0.5, +5999.5, "FT0C amplitude"}}); + rFlattenicity.add( + "hAmpT0AVsChBeforeCalibration", "", HistType::kTH2D, + {{24, -0.5, 23.5, "channel"}, {600, -0.5, +5999.5, "FT0A amplitude"}}); + rFlattenicity.add( + "hAmpT0CVsChBeforeCalibration", "", HistType::kTH2D, + {{28, -0.5, 27.5, "channel"}, {600, -0.5, +5999.5, "FT0C amplitude"}}); - rFlattenicity.add("hFlatFT0CvsFlatFT0A", "", HistType::kTH2F, {{20, -0.01, +1.01, "flatenicity (FT0C)"}, {20, -0.01, +1.01, "flatenicity (FT0A)"}}); - rFlattenicity.add("fEtaPhiFv0", "eta vs phi", HistType::kTH2F, {{8, 0.0, 2 * M_PI, "#phi (rad)"}, {5, 2.2, 5.1, "#eta"}}); + rFlattenicity.add( + "hAmpT0AVsCh", "", HistType::kTH2D, + {{24, -0.5, 23.5, "channel"}, {600, -0.5, +5999.5, "FT0A amplitude"}}); + rFlattenicity.add( + "hAmpT0CVsCh", "", HistType::kTH2D, + {{28, -0.5, 27.5, "channel"}, {600, -0.5, +5999.5, "FT0C amplitude"}}); - rFlattenicity.add("hAmpV0vsVtxBeforeCalibration", "", HistType::kTH2F, {{30, -15.0, +15.0, "Trk mult"}, {1000, -0.5, +39999.5, "FV0 amplitude"}}); - rFlattenicity.add("hAmpT0AvsVtxBeforeCalibration", "", HistType::kTH2F, {{30, -15.0, +15.0, "Vtx_z"}, {600, -0.5, +5999.5, "FT0A amplitude"}}); - rFlattenicity.add("hAmpT0CvsVtxBeforeCalibration", "", HistType::kTH2F, {{30, -15.0, +15.0, "Vtx_z"}, {600, -0.5, +5999.5, "FT0C amplitude"}}); + rFlattenicity.add("hFlatFT0CvsFlatFT0A", "", HistType::kTH2D, + {{20, -0.01, +1.01, "flatenicity (FT0C)"}, + {20, -0.01, +1.01, "flatenicity (FT0A)"}}); + rFlattenicity.add( + "fEtaPhiFv0", "eta vs phi", HistType::kTH2D, + {{8, 0.0, 2 * M_PI, "#phi (rad)"}, {5, 2.2, 5.1, "#eta"}}); - rFlattenicity.add("hAmpV0vsVtx", "", HistType::kTH2F, {{30, -15.0, +15.0, "Trk mult"}, {1000, -0.5, +39999.5, "FV0 amplitude"}}); - rFlattenicity.add("hAmpT0AvsVtx", "", HistType::kTH2F, {{30, -15.0, +15.0, "Vtx_z"}, {600, -0.5, +5999.5, "FT0A amplitude"}}); - rFlattenicity.add("hAmpT0CvsVtx", "", HistType::kTH2F, {{30, -15.0, +15.0, "Vtx_z"}, {600, -0.5, +5999.5, "FT0C amplitude"}}); + rFlattenicity.add("hAmpV0vsVtxBeforeCalibration", "", HistType::kTH2D, + {{30, -15.0, +15.0, "Trk mult"}, + {1000, -0.5, +39999.5, "FV0 amplitude"}}); + rFlattenicity.add( + "hAmpT0AvsVtxBeforeCalibration", "", HistType::kTH2D, + {{30, -15.0, +15.0, "Vtx_z"}, {600, -0.5, +5999.5, "FT0A amplitude"}}); + rFlattenicity.add( + "hAmpT0CvsVtxBeforeCalibration", "", HistType::kTH2D, + {{30, -15.0, +15.0, "Vtx_z"}, {600, -0.5, +5999.5, "FT0C amplitude"}}); + rFlattenicity.add("hAmpV0vsVtx", "", HistType::kTH2D, + {{30, -15.0, +15.0, "Trk mult"}, + {1000, -0.5, +39999.5, "FV0 amplitude"}}); + rFlattenicity.add( + "hAmpT0AvsVtx", "", HistType::kTH2D, + {{30, -15.0, +15.0, "Vtx_z"}, {600, -0.5, +5999.5, "FT0A amplitude"}}); + rFlattenicity.add( + "hAmpT0CvsVtx", "", HistType::kTH2D, + {{30, -15.0, +15.0, "Vtx_z"}, {600, -0.5, +5999.5, "FT0C amplitude"}}); + } if (doprocessDataRun3 && (doprocessRecMC || doprocessGenMC)) { - LOGF(fatal, "Both Data and MC are both set to true; try again with only one of them set to true"); + LOGF(fatal, + "Both Data and MC are both set to true; try again with only " + "one of them set to true"); } if (!doprocessDataRun3 && !(doprocessRecMC || doprocessGenMC)) { - LOGF(fatal, "Both Data and MC set to false; try again with only one of them set to false"); + LOGF(fatal, + "Both Data and MC set to false; try again with only one of " + "them set to false"); } - if ((doprocessRecMC && !doprocessGenMC) || (!doprocessRecMC && doprocessGenMC)) { - LOGF(fatal, "MCRec and MCGen are set to opposite switches, try again with both set to either true or false"); + if ((doprocessRecMC && !doprocessGenMC) || + (!doprocessRecMC && doprocessGenMC)) { + LOGF(fatal, + "MCRec and MCGen are set to opposite switches, try again " + "with both set to either true or false"); } } @@ -388,20 +657,53 @@ struct lambdak0sflattenicity { float pdgmassK0s = 0.497614; float pdgmassLambda = 1.115683; // V0A signal and flatenicity calculation - static constexpr float calib[48] = {1.01697, 1.122, 1.03854, 1.108, 1.11634, 1.14971, 1.19321, 1.06866, 0.954675, 0.952695, 0.969853, 0.957557, 0.989784, 1.01549, 1.02182, 0.976005, 1.01865, 1.06871, 1.06264, 1.02969, 1.07378, 1.06622, 1.15057, 1.0433, 0.83654, 0.847178, 0.890027, 0.920814, 0.888271, 1.04662, 0.8869, 0.856348, 0.863181, 0.906312, 0.902166, 1.00122, 1.03303, 0.887866, 0.892437, 0.906278, 0.884976, 0.864251, 0.917221, 1.10618, 1.04028, 0.893184, 0.915734, 0.892676}; + static constexpr float calib[48] = { + 1.01697, 1.122, 1.03854, 1.108, 1.11634, 1.14971, 1.19321, + 1.06866, 0.954675, 0.952695, 0.969853, 0.957557, 0.989784, 1.01549, + 1.02182, 0.976005, 1.01865, 1.06871, 1.06264, 1.02969, 1.07378, + 1.06622, 1.15057, 1.0433, 0.83654, 0.847178, 0.890027, 0.920814, + 0.888271, 1.04662, 0.8869, 0.856348, 0.863181, 0.906312, 0.902166, + 1.00122, 1.03303, 0.887866, 0.892437, 0.906278, 0.884976, 0.864251, + 0.917221, 1.10618, 1.04028, 0.893184, 0.915734, 0.892676}; // calibration T0C - static constexpr float calibT0C[28] = {0.949829, 1.05408, 1.00681, 1.00724, 0.990663, 0.973571, 0.9855, 1.03726, 1.02526, 1.00467, 0.983008, 0.979349, 0.952352, 0.985775, 1.013, 1.01721, 0.993948, 0.996421, 0.971871, 1.02921, 0.989641, 1.01885, 1.01259, 0.929502, 1.03969, 1.02496, 1.01385, 1.01711}; + static constexpr float calibT0C[28] = { + 0.949829, 1.05408, 1.00681, 1.00724, 0.990663, 0.973571, 0.9855, + 1.03726, 1.02526, 1.00467, 0.983008, 0.979349, 0.952352, 0.985775, + 1.013, 1.01721, 0.993948, 0.996421, 0.971871, 1.02921, 0.989641, + 1.01885, 1.01259, 0.929502, 1.03969, 1.02496, 1.01385, 1.01711}; // calibration T0A - static constexpr float calibT0A[24] = {0.86041, 1.10607, 1.17724, 0.756397, 1.14954, 1.0879, 0.829438, 1.09014, 1.16515, 0.730077, 1.06722, 0.906344, 0.824167, 1.14716, 1.20692, 0.755034, 1.11734, 1.00556, 0.790522, 1.09138, 1.16225, 0.692458, 1.12428, 1.01127}; + static constexpr float calibT0A[24] = { + 0.86041, 1.10607, 1.17724, 0.756397, 1.14954, 1.0879, + 0.829438, 1.09014, 1.16515, 0.730077, 1.06722, 0.906344, + 0.824167, 1.14716, 1.20692, 0.755034, 1.11734, 1.00556, + 0.790522, 1.09138, 1.16225, 0.692458, 1.12428, 1.01127}; // calibration factor MFT vs vtx - static constexpr float biningVtxt[30] = {-14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5}; + static constexpr float biningVtxt[30] = { + -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, + 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5}; // calibration factor FV0 vs vtx - static constexpr float calibFV0vtx[30] = {0.907962, 0.934607, 0.938929, 0.950987, 0.950817, 0.966362, 0.968509, 0.972741, 0.982412, 0.984872, 0.994543, 0.996003, 0.99435, 1.00266, 0.998245, 1.00584, 1.01078, 1.01003, 1.00726, 1.00872, 1.01726, 1.02015, 1.0193, 1.01106, 1.02229, 1.02104, 1.03435, 1.00822, 1.01921, 1.01736}; + static constexpr float calibFV0vtx[30] = { + 0.907962, 0.934607, 0.938929, 0.950987, 0.950817, 0.966362, + 0.968509, 0.972741, 0.982412, 0.984872, 0.994543, 0.996003, + 0.99435, 1.00266, 0.998245, 1.00584, 1.01078, 1.01003, + 1.00726, 1.00872, 1.01726, 1.02015, 1.0193, 1.01106, + 1.02229, 1.02104, 1.03435, 1.00822, 1.01921, 1.01736}; // calibration FT0A vs vtx - static constexpr float calibFT0Avtx[30] = {0.924334, 0.950988, 0.959604, 0.965607, 0.970016, 0.979057, 0.978384, 0.982005, 0.992825, 0.990048, 0.998588, 0.997338, 1.00102, 1.00385, 0.99492, 1.01083, 1.00703, 1.00494, 1.00063, 1.0013, 1.00777, 1.01238, 1.01179, 1.00577, 1.01028, 1.017, 1.02975, 1.0085, 1.00856, 1.01662}; + static constexpr float calibFT0Avtx[30] = { + 0.924334, 0.950988, 0.959604, 0.965607, 0.970016, 0.979057, + 0.978384, 0.982005, 0.992825, 0.990048, 0.998588, 0.997338, + 1.00102, 1.00385, 0.99492, 1.01083, 1.00703, 1.00494, + 1.00063, 1.0013, 1.00777, 1.01238, 1.01179, 1.00577, + 1.01028, 1.017, 1.02975, 1.0085, 1.00856, 1.01662}; // calibration FT0C vs vtx - static constexpr float calibFT0Cvtx[30] = {1.02096, 1.01245, 1.02148, 1.03605, 1.03561, 1.03667, 1.04229, 1.0327, 1.03674, 1.02764, 1.01828, 1.02331, 1.01864, 1.015, 1.01197, 1.00615, 0.996845, 0.993051, 0.985635, 0.982883, 0.981914, 0.964635, 0.967812, 0.95475, 0.956687, 0.932816, 0.92773, 0.914892, 0.891724, 0.872382}; + static constexpr float calibFT0Cvtx[30] = { + 1.02096, 1.01245, 1.02148, 1.03605, 1.03561, 1.03667, + 1.04229, 1.0327, 1.03674, 1.02764, 1.01828, 1.02331, + 1.01864, 1.015, 1.01197, 1.00615, 0.996845, 0.993051, + 0.985635, 0.982883, 0.981914, 0.964635, 0.967812, 0.95475, + 0.956687, 0.932816, 0.92773, 0.914892, 0.891724, 0.872382}; static constexpr int nEta5 = 2; // FT0C + FT0A static constexpr float weigthsEta5[nEta5] = {0.0490638, 0.010958415}; @@ -418,6 +720,7 @@ struct lambdak0sflattenicity { static constexpr int nCells = 48; // 48 sectors in FV0 std::array RhoLattice; + std::array RhoLatticeFV0AMC; std::array ampchannel; std::array ampchannelBefore; static constexpr int nCellsT0A = 24; @@ -430,50 +733,66 @@ struct lambdak0sflattenicity { template bool isEventSelected(TCollision const& collision) { - rEventSelection.fill(HIST("hEventsSelected"), 0); + rEventSelection.fill(HIST("hEventsSelected"), 0.5); + + if (Issel8 && !collision.sel8()) { + return false; + } + + rEventSelection.fill(HIST("hEventsSelected"), 1.5); + if (TMath::Abs(collision.posZ()) > cutzvertex) { + return false; + } + + rEventSelection.fill(HIST("hEventsSelected"), 2.5); - if (collision.isInelGt0() == false) { - rEventSelection.fill(HIST("hEventsRejected"), 1); + if (IsNoTimeFrameBorder && + !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { return false; } - rEventSelection.fill(HIST("hEventsSelected"), 1); + rEventSelection.fill(HIST("hEventsSelected"), 3.5); - if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - rEventSelection.fill(HIST("hEventsRejected"), 2); + if (IsNoITSROFrameBorder && + !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { return false; } - rEventSelection.fill(HIST("hEventsSelected"), 2); + rEventSelection.fill(HIST("hEventsSelected"), 4.5); - if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - rEventSelection.fill(HIST("hEventsRejected"), 3); + if (IsVertexITSTPC && + !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { return false; } - rEventSelection.fill(HIST("hEventsSelected"), 3); + rEventSelection.fill(HIST("hEventsSelected"), 5.5); - if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - rEventSelection.fill(HIST("hEventsRejected"), 4); + if (IsNoSameBunchPileup && + !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return false; } - rEventSelection.fill(HIST("hEventsSelected"), 4); + rEventSelection.fill(HIST("hEventsSelected"), 6.5); - if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - rEventSelection.fill(HIST("hEventsRejected"), 5); + if (IsGoodZvtxFT0vsPV && + !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } - rEventSelection.fill(HIST("hEventsSelected"), 5); + rEventSelection.fill(HIST("hEventsSelected"), 7.5); - if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - rEventSelection.fill(HIST("hEventsRejected"), 6); + if (IsTriggerTVX && + !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { return false; } - rEventSelection.fill(HIST("hEventsSelected"), 6); + rEventSelection.fill(HIST("hEventsSelected"), 8.5); + + if (IsINELgt0 && (collision.isInelGt0() == false)) { + return false; + } + rEventSelection.fill(HIST("hEventsSelected"), 9.5); return true; } // ============== Flattenicity estimation begins ===================== // template - void EstimateFlattenicity(TCollision const& collision, Tracks const& tracks) + float EstimateFlattenicity(TCollision const& collision, Tracks const& tracks) { const int nDetVtx = 3; TGraph* gVtx[nDetVtx]; @@ -508,7 +827,8 @@ struct lambdak0sflattenicity { ampchannelBefore.fill(0.0); RhoLattice.fill(0); - if (collision.has_foundFV0()) { + if ((isflattenicitywithFV0 || isflattenicitywithFV0FT0C) && + collision.has_foundFV0()) { auto fv0 = collision.foundFV0(); for (std::size_t ich = 0; ich < fv0.amplitude().size(); ich++) { @@ -533,7 +853,9 @@ struct lambdak0sflattenicity { if (channelv0 >= 8) { // exclude the 1st ch, eta 2.2,4.52 sumAmpFV01to4Ch += ampl_ch; } - rFlattenicity.fill(HIST("fEtaPhiFv0"), phiv0, etav0, ampl_ch); + if (flattenicityQA) { + rFlattenicity.fill(HIST("fEtaPhiFv0"), phiv0, etav0, ampl_ch); + } ampchannel[channelv0phi] = ampl_ch; if (channelv0 < innerFV0) { RhoLattice[channelv0phi] = ampl_ch; @@ -542,16 +864,22 @@ struct lambdak0sflattenicity { } } - rFlattenicity.fill(HIST("hAmpV0vsVtxBeforeCalibration"), vtxZ, sumAmpFV0); + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpV0vsVtxBeforeCalibration"), vtxZ, sumAmpFV0); + } if (applyCalibVtx) { sumAmpFV0 *= gVtx[0]->Eval(vtxZ); sumAmpFV01to4Ch *= gVtx[0]->Eval(vtxZ); } - rFlattenicity.fill(HIST("hAmpV0vsVtx"), vtxZ, sumAmpFV0); + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpV0vsVtx"), vtxZ, sumAmpFV0); + } } float flattenicityfv0 = 9999; - flattenicityfv0 = GetFlatenicity({RhoLattice.data(), RhoLattice.size()}); + if (isflattenicitywithFV0 || isflattenicitywithFV0FT0C) { + flattenicityfv0 = GetFlatenicity({RhoLattice.data(), RhoLattice.size()}); + } // global tracks float ptT = 0.; @@ -573,22 +901,32 @@ struct lambdak0sflattenicity { RhoLatticeT0A.fill(0); RhoLatticeT0C.fill(0); - if (collision.has_foundFT0()) { + if ((isflattenicitywithFT0 || isflattenicitywithFV0FT0C) && + collision.has_foundFT0()) { auto ft0 = collision.foundFT0(); - for (std::size_t i_a = 0; i_a < ft0.amplitudeA().size(); i_a++) { - float amplitude = ft0.amplitudeA()[i_a]; - uint8_t channel = ft0.channelA()[i_a]; - int sector = getT0ASector(channel); - if (sector >= 0 && sector < 24) { - RhoLatticeT0A[sector] += amplitude; - rFlattenicity.fill(HIST("hAmpT0AVsChBeforeCalibration"), sector, amplitude); - if (applyCalibCh) { - amplitude *= calibT0A[sector]; + if (isflattenicitywithFT0) { + for (std::size_t i_a = 0; i_a < ft0.amplitudeA().size(); i_a++) { + float amplitude = ft0.amplitudeA()[i_a]; + uint8_t channel = ft0.channelA()[i_a]; + int sector = getT0ASector(channel); + if (sector >= 0 && sector < 24) { + RhoLatticeT0A[sector] += amplitude; + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0AVsChBeforeCalibration"), sector, + amplitude); + } + if (applyCalibCh) { + amplitude *= calibT0A[sector]; + } + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0AVsCh"), sector, amplitude); + } + } + sumAmpFT0A += amplitude; + if (flattenicityQA) { + rFlattenicity.fill(HIST("hFT0A"), amplitude); } - rFlattenicity.fill(HIST("hAmpT0AVsCh"), sector, amplitude); } - sumAmpFT0A += amplitude; - rFlattenicity.fill(HIST("hFT0A"), amplitude); } for (std::size_t i_c = 0; i_c < ft0.amplitudeC().size(); i_c++) { @@ -598,28 +936,46 @@ struct lambdak0sflattenicity { int sector = getT0CSector(channel); if (sector >= 0 && sector < 28) { RhoLatticeT0C[sector] += amplitude; - rFlattenicity.fill(HIST("hAmpT0CVsChBeforeCalibration"), sector, amplitude); + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0CVsChBeforeCalibration"), sector, + amplitude); + } if (applyCalibCh) { amplitude *= calibT0C[sector]; } - rFlattenicity.fill(HIST("hAmpT0CVsCh"), sector, amplitude); + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0CVsCh"), sector, amplitude); + } + } + if (flattenicityQA) { + rFlattenicity.fill(HIST("hFT0C"), amplitude); } - rFlattenicity.fill(HIST("hFT0C"), amplitude); } - - rFlattenicity.fill(HIST("hAmpT0AvsVtxBeforeCalibration"), vtxZ, sumAmpFT0A); - rFlattenicity.fill(HIST("hAmpT0CvsVtxBeforeCalibration"), vtxZ, sumAmpFT0C); + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0AvsVtxBeforeCalibration"), vtxZ, + sumAmpFT0A); + rFlattenicity.fill(HIST("hAmpT0CvsVtxBeforeCalibration"), vtxZ, + sumAmpFT0C); + } if (applyCalibVtx) { sumAmpFT0A *= gVtx[1]->Eval(vtxZ); sumAmpFT0C *= gVtx[2]->Eval(vtxZ); } - rFlattenicity.fill(HIST("hAmpT0AvsVtx"), vtxZ, sumAmpFT0A); - rFlattenicity.fill(HIST("hAmpT0CvsVtx"), vtxZ, sumAmpFT0C); + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0AvsVtx"), vtxZ, sumAmpFT0A); + rFlattenicity.fill(HIST("hAmpT0CvsVtx"), vtxZ, sumAmpFT0C); + } } float flatenicity_t0a = 9999; - flatenicity_t0a = GetFlatenicity({RhoLatticeT0A.data(), RhoLatticeT0A.size()}); + if (isflattenicitywithFT0) { + flatenicity_t0a = + GetFlatenicity({RhoLatticeT0A.data(), RhoLatticeT0A.size()}); + } float flatenicity_t0c = 9999; - flatenicity_t0c = GetFlatenicity({RhoLatticeT0C.data(), RhoLatticeT0C.size()}); + if (isflattenicitywithFT0 || isflattenicitywithFV0FT0C) { + flatenicity_t0c = + GetFlatenicity({RhoLatticeT0C.data(), RhoLatticeT0C.size()}); + } bool isOK_estimator5 = false; bool isOK_estimator6 = false; @@ -674,10 +1030,12 @@ struct lambdak0sflattenicity { } } } - rFlattenicity.fill(HIST("hFT0Aampl"), sumAmpFT0A); - rFlattenicity.fill(HIST("hFT0Campl"), sumAmpFT0C); - rFlattenicity.fill(HIST("hFV0amplRing1to4"), sumAmpFV01to4Ch); - rFlattenicity.fill(HIST("hEv"), 4); + if (flattenicityQA) { + rFlattenicity.fill(HIST("hFT0Aampl"), sumAmpFT0A); + rFlattenicity.fill(HIST("hFT0Campl"), sumAmpFT0C); + rFlattenicity.fill(HIST("hFV0amplRing1to4"), sumAmpFV01to4Ch); + rFlattenicity.fill(HIST("hEv"), 4); + } estimator[0] = multGlob; estimator[1] = sumAmpFV0; estimator[2] = 1.0 - flattenicityfv0; @@ -688,63 +1046,131 @@ struct lambdak0sflattenicity { float flatenicity_ft0v0 = 0.5 * flattenicityfv0 + 0.5 * flatenicity_t0c; estimator[6] = 1.0 - flatenicity_ft0v0; estimator[7] = ptT; + if (flattenicityQA) { + rFlattenicity.fill(HIST(nhEst[0]), estimator[0], estimator[0]); + rFlattenicity.fill(HIST(nhEst[1]), estimator[1], estimator[0]); + rFlattenicity.fill(HIST(nhEst[2]), estimator[2], estimator[0]); + rFlattenicity.fill(HIST(nhEst[3]), estimator[3], estimator[0]); + rFlattenicity.fill(HIST(nhEst[4]), estimator[4], estimator[0]); + rFlattenicity.fill(HIST(nhEst[5]), estimator[5], estimator[0]); + rFlattenicity.fill(HIST(nhEst[6]), estimator[6], estimator[0]); + rFlattenicity.fill(HIST(nhEst[7]), estimator[7], estimator[0]); + + // plot pt vs estimators + for (auto& track : tracks) { + if (!track.isGlobalTrack()) { + continue; + } + float pt = track.pt(); + rFlattenicity.fill(HIST(nhPtEst[0]), estimator[0], pt); + rFlattenicity.fill(HIST(nhPtEst[1]), estimator[1], pt); + rFlattenicity.fill(HIST(nhPtEst[2]), estimator[2], pt); + rFlattenicity.fill(HIST(nhPtEst[3]), estimator[3], pt); + rFlattenicity.fill(HIST(nhPtEst[4]), estimator[4], pt); + rFlattenicity.fill(HIST(nhPtEst[5]), estimator[5], pt); + rFlattenicity.fill(HIST(nhPtEst[6]), estimator[6], pt); + rFlattenicity.fill(HIST(nhPtEst[7]), estimator[7], pt); + } - rFlattenicity.fill(HIST(nhEst[0]), estimator[0], estimator[0]); - rFlattenicity.fill(HIST(nhEst[1]), estimator[1], estimator[0]); - rFlattenicity.fill(HIST(nhEst[2]), estimator[2], estimator[0]); - rFlattenicity.fill(HIST(nhEst[3]), estimator[3], estimator[0]); - rFlattenicity.fill(HIST(nhEst[4]), estimator[4], estimator[0]); - rFlattenicity.fill(HIST(nhEst[5]), estimator[5], estimator[0]); - rFlattenicity.fill(HIST(nhEst[6]), estimator[6], estimator[0]); - rFlattenicity.fill(HIST(nhEst[7]), estimator[7], estimator[0]); - - // plot pt vs estimators - for (auto& track : tracks) { - if (!track.isGlobalTrack()) { - continue; + if (isflattenicitywithFV0) { + for (int iCh = 0; iCh < 48; ++iCh) { + rFlattenicity.fill(HIST("hAmpV0VsCh"), iCh, ampchannel[iCh]); + rFlattenicity.fill(HIST("hAmpV0VsChBeforeCalibration"), iCh, + ampchannelBefore[iCh]); + } } - float pt = track.pt(); - rFlattenicity.fill(HIST(nhPtEst[0]), estimator[0], pt); - rFlattenicity.fill(HIST(nhPtEst[1]), estimator[1], pt); - rFlattenicity.fill(HIST(nhPtEst[2]), estimator[2], pt); - rFlattenicity.fill(HIST(nhPtEst[3]), estimator[3], pt); - rFlattenicity.fill(HIST(nhPtEst[4]), estimator[4], pt); - rFlattenicity.fill(HIST(nhPtEst[5]), estimator[5], pt); - rFlattenicity.fill(HIST(nhPtEst[6]), estimator[6], pt); - rFlattenicity.fill(HIST(nhPtEst[7]), estimator[7], pt); + + rFlattenicity.fill(HIST("fMultFv0"), sumAmpFV0); + rFlattenicity.fill(HIST("hFlatFT0CvsFlatFT0A"), flatenicity_t0c, + flatenicity_t0a); + } + } + float finalflattenicity = estimator[2]; + if (flattenicityforanalysis == 1) { + finalflattenicity = estimator[4]; + } + if (flattenicityforanalysis == 2) { + finalflattenicity = estimator[6]; + } + return finalflattenicity; + } + + template + float EstimateFlattenicityFV0MC(McParticles const& mcParticles) + { + RhoLatticeFV0AMC.fill(0); + float flattenicity = -1; + float etamin, etamax, minphi, maxphi, dphi; + int isegment = 0, nsectors; + for (const auto& mcParticle : mcParticles) { + if (!(mcParticle.isPhysicalPrimary() && mcParticle.pt() > 0)) { + continue; } - for (int iCh = 0; iCh < 48; ++iCh) { - rFlattenicity.fill(HIST("hAmpV0VsCh"), iCh, ampchannel[iCh]); - rFlattenicity.fill(HIST("hAmpV0VsChBeforeCalibration"), iCh, - ampchannelBefore[iCh]); + auto pdgParticle = pdg->GetParticle(mcParticle.pdgCode()); + if (!(pdgParticle && pdgParticle->Charge() > 0.01)) { + continue; + } + + float etap = mcParticle.eta(); + float phip = mcParticle.phi(); + isegment = 0; + for (int ieta = 0; ieta < 5; ieta++) { + etamax = maxEtaFV0 - ieta * detaFV0; + if (ieta == 0) { + etamax = maxEtaFV0; + } + etamin = maxEtaFV0 - (ieta + 1) * detaFV0; + if (ieta == 4) { + etamin = minEtaFV0; + } + nsectors = 8; + if (ieta == 4) { + nsectors = 16; + } + for (int iphi = 0; iphi < nsectors; iphi++) { + minphi = iphi * 2.0 * TMath::Pi() / nsectors; + maxphi = (iphi + 1) * 2.0 * TMath::Pi() / nsectors; + dphi = TMath::Abs(maxphi - minphi); + if (etap >= etamin && etap < etamax && phip >= minphi && phip < maxphi) { + RhoLatticeFV0AMC[isegment] += 1.0 / TMath::Abs(dphi * detaFV0); + } + isegment++; + } } - rFlattenicity.fill(HIST("fMultFv0"), sumAmpFV0); - rFlattenicity.fill(HIST("hFlatFT0CvsFlatFT0A"), flatenicity_t0c, flatenicity_t0a); } + + flattenicity = + 1.0 - GetFlatenicity({RhoLatticeFV0AMC.data(), RhoLatticeFV0AMC.size()}); + return flattenicity; } // ====================== Flattenicity estimation ends ===================== - // Defining filters for events (event selection) - // Processed events will be already fulfilling the event selection requirements - Filter eventFilter = (o2::aod::evsel::sel8 == true); - Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex); - // Filters on V0s - // Cannot filter on dynamic columns, so we cut on DCA to PV and DCA between daughters only + // Cannot filter on dynamic columns, so we cut on DCA to PV and DCA between + // daughters only Filter preFilterV0 = (nabs(aod::v0data::dcapostopv) > v0setting_dcapostopv && nabs(aod::v0data::dcanegtopv) > v0setting_dcanegtopv && aod::v0data::dcaV0daughters < v0setting_dcav0dau); - Filter trackFilter = (nabs(aod::track::eta) < cfgTrkEtaCut); - using TrackCandidates = soa::Filtered>; + Filter trackFilter = + (nabs(aod::track::eta) < cfgTrkEtaCut && aod::track::pt > cfgTrkLowPtCut); + + using TrackCandidates = soa::Filtered< + soa::Join>; - void processDataRun3(soa::Filtered>::iterator const& collision, - soa::Filtered const& V0s, TrackCandidates const& tracks, soa::Join const& /*bcs*/, - aod::MFTTracks const& /*mfttracks*/, aod::FT0s const& /*ft0s*/, - aod::FV0As const& /*fv0s*/) + void processDataRun3( + soa::Join::iterator const& collision, + soa::Filtered const& V0s, TrackCandidates const& tracks, + soa::Join const& /*bcs*/, + aod::MFTTracks const& /*mfttracks*/, aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0s*/) { - if (!(isEventSelected(collision))) { // Checking if the event passes the selection criteria + if (applyEvSel && + !(isEventSelected(collision))) { // Checking if the event passes the + // selection criteria return; } @@ -752,15 +1178,19 @@ struct lambdak0sflattenicity { auto vtxY = collision.posY(); auto vtxX = collision.posX(); - EstimateFlattenicity(collision, tracks); + float flattenicity = EstimateFlattenicity(collision, tracks); rEventSelection.fill(HIST("hVertexZ"), vtxZ); + rEventSelection.fill(HIST("hFlattenicityDistribution"), flattenicity); for (const auto& v0 : V0s) { const auto& posDaughterTrack = v0.posTrack_as(); const auto& negDaughterTrack = v0.negTrack_as(); - if (TMath::Abs(posDaughterTrack.eta()) > 0.8 || TMath::Abs(negDaughterTrack.eta()) > 0.8) { + if (TMath::Abs(posDaughterTrack.eta()) > cfgTrkEtaCut || + TMath::Abs(negDaughterTrack.eta()) > cfgTrkEtaCut || + negDaughterTrack.pt() < cfgTrkLowPtCut || + posDaughterTrack.pt() < cfgTrkLowPtCut) { continue; } float massK0s = v0.mK0Short(); @@ -775,7 +1205,9 @@ struct lambdak0sflattenicity { float decayvtxY = v0.y(); float decayvtxZ = v0.z(); - float decaylength = TMath::Sqrt(TMath::Power(decayvtxX - vtxX, 2) + TMath::Power(decayvtxY - vtxY, 2) + TMath::Power(decayvtxZ - vtxZ, 2)); + float decaylength = TMath::Sqrt(TMath::Power(decayvtxX - vtxX, 2) + + TMath::Power(decayvtxY - vtxY, 2) + + TMath::Power(decayvtxZ - vtxZ, 2)); float v0p = TMath::Sqrt(v0.pt() * v0.pt() + v0.pz() * v0.pz()); float ctauK0s = decaylength * massK0s / v0p; @@ -784,7 +1216,15 @@ struct lambdak0sflattenicity { // Cut on dynamic columns for K0s - if (v0.v0cosPA() >= v0setting_cospaK0s && v0.v0radius() >= v0setting_radiusK0s && TMath::Abs(posDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && TMath::Abs(negDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && ctauK0s < v0setting_ctauK0s && TMath::Abs(v0.rapidity(0)) <= 0.5 && TMath::Abs(massLambda - pdgmassLambda) > 0.005 && TMath::Abs(massAntiLambda - pdgmassLambda) > 0.005) { + if (v0.v0cosPA() >= v0setting_cospaK0s && + v0.v0radius() >= v0setting_radiusK0s && + TMath::Abs(posDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && + TMath::Abs(negDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && + ctauK0s < v0setting_ctauK0s && + TMath::Abs(v0.rapidity(0)) <= v0setting_rapidity && + TMath::Abs(massLambda - pdgmassLambda) > v0setting_massrejectionK0s && + TMath::Abs(massAntiLambda - pdgmassLambda) > + v0setting_massrejectionK0s) { rKzeroShort.fill(HIST("hMassK0sSelected"), massK0s); rKzeroShort.fill(HIST("hDCAV0DaughtersK0s"), v0.dcaV0daughters()); @@ -793,16 +1233,27 @@ struct lambdak0sflattenicity { rKzeroShort.fill(HIST("hctauK0s"), ctauK0s); rKzeroShort.fill(HIST("h2DdecayRadiusK0s"), v0.v0radius()); rKzeroShort.fill(HIST("hMassK0spT"), massK0s, v0.pt()); + rKzeroShort.fill(HIST("hMassK0spTFlat"), massK0s, v0.pt(), flattenicity); // Filling the PID of the V0 daughters in the region of the K0s peak if (0.45 < massK0s && massK0s < 0.55) { - rKzeroShort.fill(HIST("hNSigmaPosPionFromK0s"), posDaughterTrack.tpcNSigmaPi(), posDaughterTrack.tpcInnerParam()); - rKzeroShort.fill(HIST("hNSigmaNegPionFromK0s"), negDaughterTrack.tpcNSigmaPi(), negDaughterTrack.tpcInnerParam()); + rKzeroShort.fill(HIST("hNSigmaPosPionFromK0s"), + posDaughterTrack.tpcNSigmaPi(), + posDaughterTrack.tpcInnerParam()); + rKzeroShort.fill(HIST("hNSigmaNegPionFromK0s"), + negDaughterTrack.tpcNSigmaPi(), + negDaughterTrack.tpcInnerParam()); } } // Cut on dynamic columns for Lambda - if (v0.v0cosPA() >= v0setting_cospaLambda && v0.v0radius() >= v0setting_radiusLambda && TMath::Abs(posDaughterTrack.tpcNSigmaPr()) <= NSigmaTPCProton && TMath::Abs(negDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && ctauLambda < v0setting_ctauLambda && TMath::Abs(v0.rapidity(1)) <= 0.5 && TMath::Abs(massK0s - pdgmassK0s) > 0.01) { + if (v0.v0cosPA() >= v0setting_cospaLambda && + v0.v0radius() >= v0setting_radiusLambda && + TMath::Abs(posDaughterTrack.tpcNSigmaPr()) <= NSigmaTPCProton && + TMath::Abs(negDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && + ctauLambda < v0setting_ctauLambda && + TMath::Abs(v0.rapidity(1)) <= v0setting_rapidity && + TMath::Abs(massK0s - pdgmassK0s) > v0setting_massrejectionLambda) { rLambda.fill(HIST("hMassLambdaSelected"), massLambda); rLambda.fill(HIST("hDCAV0DaughtersLambda"), v0.dcaV0daughters()); @@ -811,241 +1262,430 @@ struct lambdak0sflattenicity { rLambda.fill(HIST("hctauLambda"), ctauLambda); rLambda.fill(HIST("h2DdecayRadiusLambda"), v0.v0radius()); rLambda.fill(HIST("hMassLambdapT"), massLambda, v0.pt()); + rLambda.fill(HIST("hMassLambdapTFlat"), massLambda, v0.pt(), flattenicity); // Filling the PID of the V0 daughters in the region of the Lambda peak if (1.015 < massLambda && massLambda < 1.215) { - rLambda.fill(HIST("hNSigmaPosPionFromLambda"), posDaughterTrack.tpcNSigmaPr(), posDaughterTrack.tpcInnerParam()); - rLambda.fill(HIST("hNSigmaNegPionFromLambda"), negDaughterTrack.tpcNSigmaPi(), negDaughterTrack.tpcInnerParam()); + rLambda.fill(HIST("hNSigmaPosPionFromLambda"), + posDaughterTrack.tpcNSigmaPr(), + posDaughterTrack.tpcInnerParam()); + rLambda.fill(HIST("hNSigmaNegPionFromLambda"), + negDaughterTrack.tpcNSigmaPi(), + negDaughterTrack.tpcInnerParam()); } } // Cut on dynamic columns for AntiLambda - if (v0.v0cosPA() >= v0setting_cospaLambda && v0.v0radius() >= v0setting_radiusLambda && TMath::Abs(posDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && TMath::Abs(negDaughterTrack.tpcNSigmaPr()) <= NSigmaTPCProton && ctauAntiLambda < v0setting_ctauLambda && TMath::Abs(v0.rapidity(2)) <= 0.5 && TMath::Abs(massK0s - pdgmassK0s) > 0.01) { + if (v0.v0cosPA() >= v0setting_cospaLambda && + v0.v0radius() >= v0setting_radiusLambda && + TMath::Abs(posDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && + TMath::Abs(negDaughterTrack.tpcNSigmaPr()) <= NSigmaTPCProton && + ctauAntiLambda < v0setting_ctauLambda && + TMath::Abs(v0.rapidity(2)) <= v0setting_rapidity && + TMath::Abs(massK0s - pdgmassK0s) > v0setting_massrejectionLambda) { rAntiLambda.fill(HIST("hMassAntiLambdaSelected"), massAntiLambda); - rAntiLambda.fill(HIST("hDCAV0DaughtersAntiLambda"), v0.dcaV0daughters()); + rAntiLambda.fill(HIST("hDCAV0DaughtersAntiLambda"), + v0.dcaV0daughters()); rAntiLambda.fill(HIST("hV0CosPAAntiLambda"), v0.v0cosPA()); rAntiLambda.fill(HIST("hrapidityAntiLambda"), v0.rapidity(2)); rAntiLambda.fill(HIST("hctauAntiLambda"), ctauAntiLambda); rAntiLambda.fill(HIST("h2DdecayRadiusAntiLambda"), v0.v0radius()); rAntiLambda.fill(HIST("hMassAntiLambdapT"), massAntiLambda, v0.pt()); - // Filling the PID of the V0 daughters in the region of the AntiLambda peak + rAntiLambda.fill(HIST("hMassAntiLambdapTFlat"), massAntiLambda, v0.pt(), flattenicity); + // Filling the PID of the V0 daughters in the region of the AntiLambda + // peak if (1.015 < massAntiLambda && massAntiLambda < 1.215) { - rAntiLambda.fill(HIST("hNSigmaPosPionFromAntiLambda"), posDaughterTrack.tpcNSigmaPi(), posDaughterTrack.tpcInnerParam()); - rAntiLambda.fill(HIST("hNSigmaNegPionFromAntiLambda"), negDaughterTrack.tpcNSigmaPr(), negDaughterTrack.tpcInnerParam()); + rAntiLambda.fill(HIST("hNSigmaPosPionFromAntiLambda"), + posDaughterTrack.tpcNSigmaPi(), + posDaughterTrack.tpcInnerParam()); + rAntiLambda.fill(HIST("hNSigmaNegPionFromAntiLambda"), + negDaughterTrack.tpcNSigmaPr(), + negDaughterTrack.tpcInnerParam()); } } } } - using TrackCandidatesMC = soa::Filtered>; - void processRecMC(soa::Filtered>::iterator const& collision, - soa::Filtered> const& V0s, - TrackCandidatesMC const& tracks, - soa::Join const& /*bcs*/, - aod::MFTTracks const& /*mfttracks*/, aod::FT0s const& /*ft0s*/, - aod::FV0As const& /*fv0s*/, aod::McParticles const&) + using TrackCandidatesMC = + soa::Filtered>; + + Preslice>> perCol = aod::track::collisionId; + Preslice perMCCol = aod::mcparticle::mcCollisionId; + SliceCache cache1; + + void processRecMC( + soa::Join const& collisions, + soa::Filtered> const& V0s, aod::McCollisions const&, TrackCandidatesMC const& tracks, + soa::Join const& /*bcs*/, + aod::MFTTracks const& /*mfttracks*/, aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0s*/, aod::McParticles const& mcParticles) { - if (!(isEventSelected(collision))) { // Checking if the event passes the selection criteria - return; - } - - auto vtxZ = collision.posZ(); - auto vtxY = collision.posY(); - auto vtxX = collision.posX(); + for (const auto& collision : collisions) { + if (applyEvSel && + !(isEventSelected(collision))) { // Checking if the event passes the + // selection criteria + continue; + } - EstimateFlattenicity(collision, tracks); + auto vtxZ = collision.posZ(); + auto vtxY = collision.posY(); + auto vtxX = collision.posX(); - rEventSelection.fill(HIST("hVertexZ"), vtxZ); + float flattenicity = EstimateFlattenicity(collision, tracks); - for (const auto& v0 : V0s) { + rEventSelection.fill(HIST("hVertexZ"), vtxZ); + rEventSelection.fill(HIST("hFlattenicityDistribution"), flattenicity); - const auto& posDaughterTrack = v0.posTrack_as(); - const auto& negDaughterTrack = v0.negTrack_as(); + auto v0sThisCollision = V0s.sliceBy(perCol, collision.globalIndex()); + const auto& mcCollision = collision.mcCollision_as(); - if (!posDaughterTrack.has_mcParticle() || !negDaughterTrack.has_mcParticle()) { - continue; - } - if (TMath::Abs(posDaughterTrack.eta()) > 0.8 || TMath::Abs(negDaughterTrack.eta()) > 0.8) { - continue; - } + for (const auto& v0 : v0sThisCollision) { - auto mcnegtrack = negDaughterTrack.mcParticle_as(); - auto mcpostrack = posDaughterTrack.mcParticle_as(); + const auto& posDaughterTrack = v0.posTrack_as(); + const auto& negDaughterTrack = v0.negTrack_as(); - float massK0s = v0.mK0Short(); - float massLambda = v0.mLambda(); - float massAntiLambda = v0.mAntiLambda(); + if (TMath::Abs(posDaughterTrack.eta()) > cfgTrkEtaCut || + TMath::Abs(negDaughterTrack.eta()) > cfgTrkEtaCut || + negDaughterTrack.pt() < cfgTrkLowPtCut || + posDaughterTrack.pt() < cfgTrkLowPtCut) { + continue; + } - rKzeroShort.fill(HIST("hMassK0s"), massK0s); - rLambda.fill(HIST("hMassLambda"), massLambda); - rAntiLambda.fill(HIST("hMassAntiLambda"), massAntiLambda); + if (!v0.has_mcParticle()) { + continue; + } - float decayvtxX = v0.x(); - float decayvtxY = v0.y(); - float decayvtxZ = v0.z(); + float massK0s = v0.mK0Short(); + float massLambda = v0.mLambda(); + float massAntiLambda = v0.mAntiLambda(); + + rKzeroShort.fill(HIST("hMassK0s"), massK0s); + rLambda.fill(HIST("hMassLambda"), massLambda); + rAntiLambda.fill(HIST("hMassAntiLambda"), massAntiLambda); + + float decayvtxX = v0.x(); + float decayvtxY = v0.y(); + float decayvtxZ = v0.z(); + + float decaylength = TMath::Sqrt(TMath::Power(decayvtxX - vtxX, 2) + + TMath::Power(decayvtxY - vtxY, 2) + + TMath::Power(decayvtxZ - vtxZ, 2)); + float v0p = TMath::Sqrt(v0.pt() * v0.pt() + v0.pz() * v0.pz()); + + float ctauK0s = decaylength * massK0s / v0p; + float ctauLambda = decaylength * massLambda / v0p; + float ctauAntiLambda = decaylength * massAntiLambda / v0p; + auto v0mcParticle = v0.mcParticle(); + // Cut on dynamic columns for K0s + + if (v0mcParticle.pdgCode() == 310 && v0.v0cosPA() >= v0setting_cospaK0s && + v0.v0radius() >= v0setting_radiusK0s && + TMath::Abs(posDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && + TMath::Abs(negDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && + ctauK0s < v0setting_ctauK0s && + TMath::Abs(v0.rapidity(0)) <= v0setting_rapidity && + TMath::Abs(massLambda - pdgmassLambda) > v0setting_massrejectionK0s && + TMath::Abs(massAntiLambda - pdgmassLambda) > + v0setting_massrejectionK0s) { + + rKzeroShort.fill(HIST("hMassK0sSelected"), massK0s); + rKzeroShort.fill(HIST("hDCAV0DaughtersK0s"), v0.dcaV0daughters()); + rKzeroShort.fill(HIST("hV0CosPAK0s"), v0.v0cosPA()); + rKzeroShort.fill(HIST("hrapidityK0s"), v0.rapidity(0)); + rKzeroShort.fill(HIST("hctauK0s"), ctauK0s); + rKzeroShort.fill(HIST("h2DdecayRadiusK0s"), v0.v0radius()); + rKzeroShort.fill(HIST("hMassK0spT"), massK0s, v0.pt()); + rKzeroShort.fill(HIST("hMassK0spTFlat"), massK0s, v0.pt(), flattenicity); + + // Filling the PID of the V0 daughters in the region of the K0s peak + if (0.45 < massK0s && massK0s < 0.55) { + rKzeroShort.fill(HIST("hNSigmaPosPionFromK0s"), + posDaughterTrack.tpcNSigmaPi(), + posDaughterTrack.tpcInnerParam()); + rKzeroShort.fill(HIST("hNSigmaNegPionFromK0s"), + negDaughterTrack.tpcNSigmaPi(), + negDaughterTrack.tpcInnerParam()); + } + } - float decaylength = TMath::Sqrt(TMath::Power(decayvtxX - vtxX, 2) + TMath::Power(decayvtxY - vtxY, 2) + TMath::Power(decayvtxZ - vtxZ, 2)); - float v0p = TMath::Sqrt(v0.pt() * v0.pt() + v0.pz() * v0.pz()); + // Cut on dynamic columns for Lambda + if (v0mcParticle.pdgCode() == 3122 && + v0.v0cosPA() >= v0setting_cospaLambda && + v0.v0radius() >= v0setting_radiusLambda && + TMath::Abs(posDaughterTrack.tpcNSigmaPr()) <= NSigmaTPCProton && + TMath::Abs(negDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && + ctauLambda < v0setting_ctauLambda && + TMath::Abs(v0.rapidity(1)) <= v0setting_rapidity && + TMath::Abs(massK0s - pdgmassK0s) > v0setting_massrejectionLambda) { + + rLambda.fill(HIST("hMassLambdaSelected"), massLambda); + rLambda.fill(HIST("hDCAV0DaughtersLambda"), v0.dcaV0daughters()); + rLambda.fill(HIST("hV0CosPALambda"), v0.v0cosPA()); + rLambda.fill(HIST("hrapidityLambda"), v0.rapidity(1)); + rLambda.fill(HIST("hctauLambda"), ctauLambda); + rLambda.fill(HIST("h2DdecayRadiusLambda"), v0.v0radius()); + rLambda.fill(HIST("hMassLambdapT"), massLambda, v0.pt()); + rLambda.fill(HIST("hMassLambdapTFlat"), massLambda, v0.pt(), flattenicity); + + // Filling the PID of the V0 daughters in the region of the Lambda peak + if (1.015 < massLambda && massLambda < 1.215) { + rLambda.fill(HIST("hNSigmaPosPionFromLambda"), + posDaughterTrack.tpcNSigmaPr(), + posDaughterTrack.tpcInnerParam()); + rLambda.fill(HIST("hNSigmaNegPionFromLambda"), + negDaughterTrack.tpcNSigmaPi(), + negDaughterTrack.tpcInnerParam()); + } + } - float ctauK0s = decaylength * massK0s / v0p; - float ctauLambda = decaylength * massLambda / v0p; - float ctauAntiLambda = decaylength * massAntiLambda / v0p; + // Cut on dynamic columns for AntiLambda + if (v0mcParticle.pdgCode() == -3122 && + v0.v0cosPA() >= v0setting_cospaLambda && + v0.v0radius() >= v0setting_radiusLambda && + TMath::Abs(posDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && + TMath::Abs(negDaughterTrack.tpcNSigmaPr()) <= NSigmaTPCProton && + ctauAntiLambda < v0setting_ctauLambda && + TMath::Abs(v0.rapidity(2)) <= v0setting_rapidity && + TMath::Abs(massK0s - pdgmassK0s) > v0setting_massrejectionLambda) { + + rAntiLambda.fill(HIST("hMassAntiLambdaSelected"), massAntiLambda); + rAntiLambda.fill(HIST("hDCAV0DaughtersAntiLambda"), + v0.dcaV0daughters()); + rAntiLambda.fill(HIST("hV0CosPAAntiLambda"), v0.v0cosPA()); + rAntiLambda.fill(HIST("hrapidityAntiLambda"), v0.rapidity(2)); + rAntiLambda.fill(HIST("hctauAntiLambda"), ctauAntiLambda); + rAntiLambda.fill(HIST("h2DdecayRadiusAntiLambda"), v0.v0radius()); + rAntiLambda.fill(HIST("hMassAntiLambdapT"), massAntiLambda, v0.pt()); + rAntiLambda.fill(HIST("hMassAntiLambdapTFlat"), massAntiLambda, v0.pt(), flattenicity); + + // Filling the PID of the V0 daughters in the region of the AntiLambda + // peak + if (1.015 < massAntiLambda && massAntiLambda < 1.215) { + rAntiLambda.fill(HIST("hNSigmaPosPionFromAntiLambda"), + posDaughterTrack.tpcNSigmaPi(), + posDaughterTrack.tpcInnerParam()); + rAntiLambda.fill(HIST("hNSigmaNegPionFromAntiLambda"), + negDaughterTrack.tpcNSigmaPr(), + negDaughterTrack.tpcInnerParam()); + } + } + } - // Cut on dynamic columns for K0s + const auto particlesInCollision = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache1); + float flattenicityMCGen = EstimateFlattenicityFV0MC(particlesInCollision); + rEventSelection.fill(HIST("hFlattenicityDistributionMCGen_Rec"), flattenicityMCGen); + rEventSelection.fill(HIST("hFlattenicity_Corr_Gen_vs_Rec"), flattenicityMCGen, flattenicity); - for (auto& particleMotherOfNeg : mcnegtrack.mothers_as()) { - for (auto& particleMotherOfPos : mcpostrack.mothers_as()) { - if (particleMotherOfNeg == particleMotherOfPos && (particleMotherOfNeg.pdgCode() == 3122 || particleMotherOfNeg.pdgCode() == -3122 || particleMotherOfNeg.pdgCode() == 310) && particleMotherOfNeg.isPhysicalPrimary()) { - - if (particleMotherOfNeg.pdgCode() == 310 && v0.v0cosPA() >= v0setting_cospaK0s && v0.v0radius() >= v0setting_radiusK0s && TMath::Abs(posDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && TMath::Abs(negDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && ctauK0s < v0setting_ctauK0s && TMath::Abs(v0.rapidity(0)) <= 0.5 && TMath::Abs(massLambda - pdgmassLambda) > 0.005 && TMath::Abs(massAntiLambda - pdgmassLambda) > 0.005) { - - rKzeroShort.fill(HIST("hMassK0sSelected"), massK0s); - rKzeroShort.fill(HIST("hDCAV0DaughtersK0s"), v0.dcaV0daughters()); - rKzeroShort.fill(HIST("hV0CosPAK0s"), v0.v0cosPA()); - rKzeroShort.fill(HIST("hrapidityK0s"), v0.rapidity(0)); - rKzeroShort.fill(HIST("hctauK0s"), ctauK0s); - rKzeroShort.fill(HIST("h2DdecayRadiusK0s"), v0.v0radius()); - rKzeroShort.fill(HIST("hMassK0spT"), massK0s, v0.pt()); - - // Filling the PID of the V0 daughters in the region of the K0s peak - if (0.45 < massK0s && massK0s < 0.55) { - rKzeroShort.fill(HIST("hNSigmaPosPionFromK0s"), posDaughterTrack.tpcNSigmaPi(), posDaughterTrack.tpcInnerParam()); - rKzeroShort.fill(HIST("hNSigmaNegPionFromK0s"), negDaughterTrack.tpcNSigmaPi(), negDaughterTrack.tpcInnerParam()); - } - } + for (auto& mcParticle : particlesInCollision) { + if (!mcParticle.isPhysicalPrimary()) { + continue; + } - // Cut on dynamic columns for Lambda - if (particleMotherOfNeg.pdgCode() == 3122 && v0.v0cosPA() >= v0setting_cospaLambda && v0.v0radius() >= v0setting_radiusLambda && TMath::Abs(posDaughterTrack.tpcNSigmaPr()) <= NSigmaTPCProton && TMath::Abs(negDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && ctauLambda < v0setting_ctauLambda && TMath::Abs(v0.rapidity(1)) <= 0.5 && TMath::Abs(massK0s - pdgmassK0s) > 0.01) { - - rLambda.fill(HIST("hMassLambdaSelected"), massLambda); - rLambda.fill(HIST("hDCAV0DaughtersLambda"), v0.dcaV0daughters()); - rLambda.fill(HIST("hV0CosPALambda"), v0.v0cosPA()); - rLambda.fill(HIST("hrapidityLambda"), v0.rapidity(1)); - rLambda.fill(HIST("hctauLambda"), ctauLambda); - rLambda.fill(HIST("h2DdecayRadiusLambda"), v0.v0radius()); - rLambda.fill(HIST("hMassLambdapT"), massLambda, v0.pt()); - - // Filling the PID of the V0 daughters in the region of the Lambda peak - if (1.015 < massLambda && massLambda < 1.215) { - rLambda.fill(HIST("hNSigmaPosPionFromLambda"), posDaughterTrack.tpcNSigmaPr(), posDaughterTrack.tpcInnerParam()); - rLambda.fill(HIST("hNSigmaNegPionFromLambda"), negDaughterTrack.tpcNSigmaPi(), negDaughterTrack.tpcInnerParam()); - } - } + if (std::abs(mcParticle.y()) > 0.5f) { + continue; + } - // Cut on dynamic columns for AntiLambda - if (particleMotherOfNeg.pdgCode() == -3122 && v0.v0cosPA() >= v0setting_cospaLambda && v0.v0radius() >= v0setting_radiusLambda && TMath::Abs(posDaughterTrack.tpcNSigmaPi()) <= NSigmaTPCPion && TMath::Abs(negDaughterTrack.tpcNSigmaPr()) <= NSigmaTPCProton && ctauAntiLambda < v0setting_ctauLambda && TMath::Abs(v0.rapidity(2)) <= 0.5 && TMath::Abs(massK0s - pdgmassK0s) > 0.01) { - - rAntiLambda.fill(HIST("hMassAntiLambdaSelected"), massAntiLambda); - rAntiLambda.fill(HIST("hDCAV0DaughtersAntiLambda"), v0.dcaV0daughters()); - rAntiLambda.fill(HIST("hV0CosPAAntiLambda"), v0.v0cosPA()); - rAntiLambda.fill(HIST("hrapidityAntiLambda"), v0.rapidity(2)); - rAntiLambda.fill(HIST("hctauAntiLambda"), ctauAntiLambda); - rAntiLambda.fill(HIST("h2DdecayRadiusAntiLambda"), v0.v0radius()); - rAntiLambda.fill(HIST("hMassAntiLambdapT"), massAntiLambda, v0.pt()); - - // Filling the PID of the V0 daughters in the region of the AntiLambda peak - if (1.015 < massAntiLambda && massAntiLambda < 1.215) { - rAntiLambda.fill(HIST("hNSigmaPosPionFromAntiLambda"), posDaughterTrack.tpcNSigmaPi(), posDaughterTrack.tpcInnerParam()); - rAntiLambda.fill(HIST("hNSigmaNegPionFromAntiLambda"), negDaughterTrack.tpcNSigmaPr(), negDaughterTrack.tpcInnerParam()); - } - } - } + if (mcParticle.pdgCode() == 310) { + rKzeroShort.fill(HIST("Generated_MCRecoCollCheck_INEL_K0Short"), mcParticle.pt(), flattenicity); // K0s + } + if (mcParticle.pdgCode() == 3122) { + rLambda.fill(HIST("Generated_MCRecoCollCheck_INEL_Lambda"), mcParticle.pt(), flattenicity); // Lambda + } + if (mcParticle.pdgCode() == -3122) { + rAntiLambda.fill(HIST("Generated_MCRecoCollCheck_INEL_AntiLambda"), mcParticle.pt(), flattenicity); // AntiLambda } } } } // Filter posZFilterMC = (nabs(o2::aod::mccollision::posZ) < cutzvertex); - void processGenMC(o2::aod::McCollision const& mcCollision, - const soa::SmallGroups>& collisions, - o2::aod::McParticles const& mcParticles) + void processGenMC( + o2::aod::McCollision const& mcCollision, + const soa::SmallGroups>& collisions, + o2::aod::McParticles const& mcParticles) { - // if (collisions.size() < 1) // to process generated collisions that've been reconstructed at least once - // { - // return; - // } + float flattenicity = EstimateFlattenicityFV0MC(mcParticles); + rEventSelection.fill(HIST("hFlattenicityDistributionMCGen"), flattenicity); + //==================================== + //===== Event Loss Denominator ======= + //==================================== - std::vector SelectedEvents(collisions.size()); - int nevts = 0; - for (const auto& collision : collisions) { - if (!collision.sel8()) { + rEventSelection.fill(HIST("hNEventsMCGen"), 0.5); + + if (TMath::Abs(mcCollision.posZ()) > cutzvertex) { + return; + } + rEventSelection.fill(HIST("hNEventsMCGen"), 1.5); + rEventSelection.fill(HIST("hFlat_GenColl_MC"), flattenicity); + + bool isINELgt0true = false; + + if (pwglf::isINELgtNmc(mcParticles, 0, pdg)) { + isINELgt0true = true; + rEventSelection.fill(HIST("hNEventsMCGen"), 2.5); + rEventSelection.fill(HIST("hFlat_GenColl_MC_INELgt0"), flattenicity); + } + + //===================================== + //===== Signal Loss Denominator ======= + //===================================== + + for (auto& mcParticle : mcParticles) { + + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + if (std::abs(mcParticle.y()) > 0.5f) { continue; } - SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); + + if (mcParticle.pdgCode() == 310) { + rKzeroShort.fill(HIST("pGen_MCGenColl_INEL_K0Short"), mcParticle.pt(), flattenicity); // K0s + if (isINELgt0true) { + rKzeroShort.fill(HIST("pGen_MCGenColl_INELgt0_K0Short"), mcParticle.pt(), flattenicity); // K0s + } + } + if (mcParticle.pdgCode() == 3122) { + rLambda.fill(HIST("pGen_MCGenColl_INEL_Lambda"), mcParticle.pt(), flattenicity); // Lambda + if (isINELgt0true) { + rLambda.fill(HIST("pGen_MCGenColl_INELgt0_Lambda"), mcParticle.pt(), flattenicity); // Lambda + } + } + if (mcParticle.pdgCode() == -3122) { + rAntiLambda.fill(HIST("pGen_MCGenColl_INEL_AntiLambda"), mcParticle.pt(), flattenicity); // AntiLambda + if (isINELgt0true) { + rAntiLambda.fill(HIST("pGen_MCGenColl_INELgt0_AntiLambda"), mcParticle.pt(), flattenicity); // AntiLambda + } + } } - SelectedEvents.resize(nevts); - const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end(); + int recoCollIndex_INEL = 0; + int recoCollIndex_INELgt0 = 0; + for (auto& collision : collisions) { // loop on reconstructed collisions - rEventSelection.fill(HIST("hEventSelectionMCGen"), 0); + //===================================== + //====== Event Split Numerator ======== + //===================================== - if (!evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection - return; - } - rEventSelection.fill(HIST("hEventSelectionMCGen"), 1); // hSelAndRecoMcCollCounter + rEventSelection.fill(HIST("hNEventsMCReco"), 0.5); + if (applyEvSel && !isEventSelected(collision)) { + continue; + } + rEventSelection.fill(HIST("hEventsSelected"), 10.5); + rEventSelection.fill(HIST("hNEventsMCReco"), 1.5); + rEventSelection.fill(HIST("hFlat_RecoColl_MC"), flattenicity); - if (abs(mcCollision.posZ()) > cutzvertex) { // 10cm - return; - } - rEventSelection.fill(HIST("hEventSelectionMCGen"), 2); + recoCollIndex_INEL++; - rEventSelection.fill(HIST("hVertexZGen"), mcCollision.posZ()); + if (collision.isInelGt0() && isINELgt0true) { + rEventSelection.fill(HIST("hNEventsMCReco"), 2.5); + rEventSelection.fill(HIST("hFlat_RecoColl_MC_INELgt0"), flattenicity); - for (const auto& mcParticle : mcParticles) { + recoCollIndex_INELgt0++; + } + + //===================================== + //======== Sgn Split Numerator ======== + //===================================== + + for (auto& mcParticle : mcParticles) { + + if (!mcParticle.isPhysicalPrimary()) { + continue; + } - if (mcParticle.isPhysicalPrimary() && mcParticle.y() < 0.5) { - if (!mcParticle.has_daughters()) { + if (std::abs(mcParticle.y()) > 0.5f) { continue; } if (mcParticle.pdgCode() == 310) { - rKzeroShort.fill(HIST("K0sCounterMCGen"), 0); - rKzeroShort.fill(HIST("hPtK0ShortGen"), mcParticle.pt()); - for (auto& mcparticleDaughter0 : mcParticle.daughters_as()) { - for (auto& mcparticleDaughter1 : mcParticle.daughters_as()) { - if (mcparticleDaughter0.pdgCode() == 211 && mcparticleDaughter1.pdgCode() == -211) { - rKzeroShort.fill(HIST("K0sCounterMCGen"), 1); - } - } + rKzeroShort.fill(HIST("Generated_MCRecoColl_INEL_K0Short"), mcParticle.pt(), flattenicity); // K0s + if (recoCollIndex_INELgt0 > 0) { + rKzeroShort.fill(HIST("Generated_MCRecoColl_INELgt0_K0Short"), mcParticle.pt(), flattenicity); // K0s } } - if (mcParticle.pdgCode() == 3122) { - rLambda.fill(HIST("LambdaCounterMCGen"), 0); - rLambda.fill(HIST("hPtLambdaGen"), mcParticle.pt()); - for (auto& mcparticleDaughter0 : mcParticle.daughters_as()) { - for (auto& mcparticleDaughter1 : mcParticle.daughters_as()) { - if (mcparticleDaughter0.pdgCode() == -211 && mcparticleDaughter1.pdgCode() == 2212) { - rLambda.fill(HIST("LambdaCounterMCGen"), 1); - } - } + rLambda.fill(HIST("Generated_MCRecoColl_INEL_Lambda"), mcParticle.pt(), flattenicity); // Lambda + if (recoCollIndex_INELgt0 > 0) { + rLambda.fill(HIST("Generated_MCRecoColl_INELgt0_Lambda"), mcParticle.pt(), flattenicity); // Lambda } } - if (mcParticle.pdgCode() == -3122) { - rAntiLambda.fill(HIST("AntiLambdaCounterMCGen"), 0.5); - rAntiLambda.fill(HIST("hPtAntiLambdaGen"), mcParticle.pt()); - for (auto& mcparticleDaughter0 : mcParticle.daughters_as()) { - for (auto& mcparticleDaughter1 : mcParticle.daughters_as()) { - if (mcparticleDaughter0.pdgCode() == 211 && mcparticleDaughter1.pdgCode() == -2212) { - rAntiLambda.fill(HIST("AntiLambdaCounterMCGen"), 1); - } - } + rAntiLambda.fill(HIST("Generated_MCRecoColl_INEL_AntiLambda"), mcParticle.pt(), flattenicity); // AntiLambda + if (recoCollIndex_INELgt0 > 0) { + rAntiLambda.fill(HIST("Generated_MCRecoColl_INELgt0_AntiLambda"), mcParticle.pt(), flattenicity); // AntiLambda } } } } + + // From now on keep only mc collisions with at least one reconstructed collision (INEL) + if (recoCollIndex_INEL < 1) { + return; + } + + //===================================== + //====== Event Loss Numerator ========= + //===================================== + + rEventSelection.fill(HIST("hNEventsMCGenReco"), 0.5); + rEventSelection.fill(HIST("hFlat_GenRecoColl_MC"), flattenicity); + + if (recoCollIndex_INELgt0 > 0) { + rEventSelection.fill(HIST("hNEventsMCGenReco"), 1.5); + rEventSelection.fill(HIST("hFlat_GenRecoColl_MC_INELgt0"), flattenicity); + } + + //===================================== + //===== Signal Loss Numerator ========= + //===================================== + + for (auto& mcParticle : mcParticles) { + + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + + if (std::abs(mcParticle.y()) > 0.5f) { + continue; + } + + if (mcParticle.pdgCode() == 310) { + rKzeroShort.fill(HIST("pGen_MCGenRecoColl_INEL_K0Short"), mcParticle.pt(), flattenicity); // K0s + if (recoCollIndex_INELgt0 > 0) { + rKzeroShort.fill(HIST("pGen_MCGenRecoColl_INELgt0_K0Short"), mcParticle.pt(), flattenicity); // K0s + } + } + if (mcParticle.pdgCode() == 3122) { + rLambda.fill(HIST("pGen_MCGenRecoColl_INEL_Lambda"), mcParticle.pt(), flattenicity); // Lambda + if (recoCollIndex_INELgt0 > 0) { + rLambda.fill(HIST("pGen_MCGenRecoColl_INELgt0_Lambda"), mcParticle.pt(), flattenicity); // Lambda + } + } + if (mcParticle.pdgCode() == -3122) { + rAntiLambda.fill(HIST("pGen_MCGenRecoColl_INEL_AntiLambda"), mcParticle.pt(), flattenicity); // AntiLambda + if (recoCollIndex_INELgt0 > 0) { + rAntiLambda.fill(HIST("pGen_MCGenRecoColl_INELgt0_AntiLambda"), mcParticle.pt(), flattenicity); // AntiLambda + } + } + } } - PROCESS_SWITCH(lambdak0sflattenicity, processDataRun3, "Process Run 3 Data", false); - PROCESS_SWITCH(lambdak0sflattenicity, processRecMC, "Process Run 3 mc, reconstructed", true); - PROCESS_SWITCH(lambdak0sflattenicity, processGenMC, "Process Run 3 mc, generated", true); + PROCESS_SWITCH(lambdak0sflattenicity, processDataRun3, "Process Run 3 Data", + false); + PROCESS_SWITCH(lambdak0sflattenicity, processRecMC, + "Process Run 3 mc, reconstructed", true); + PROCESS_SWITCH(lambdak0sflattenicity, processGenMC, + "Process Run 3 mc, generated", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Tasks/Strangeness/lambdalambda.cxx b/PWGLF/Tasks/Strangeness/lambdalambda.cxx new file mode 100644 index 00000000000..320b98db6d1 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/lambdalambda.cxx @@ -0,0 +1,496 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \author Junlee Kim (jikim1290@gmail.com) + +#include +#include +#include +#include +#include +#include + +#include "TLorentzVector.h" +#include "TRandom3.h" +#include "TF1.h" +#include "TVector3.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "Math/GenVector/Boost.h" +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/StaticFor.h" + +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/Core/TrackSelection.h" + +#include "CommonConstants/PhysicsConstants.h" + +#include "ReconstructionDataFormats/Track.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" + +#include "CCDB/CcdbApi.h" +#include "CCDB/BasicCCDBManager.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +struct lambdalambda { + using EventCandidates = soa::Join; + using TrackCandidates = soa::Join; + using V0TrackCandidate = aod::V0Datas; + + HistogramRegistry histos{ + "histos", + {}, + OutputObjHandlingPolicy::AnalysisObject}; + + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", + "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable nolaterthan{"ccdb-no-later-than", + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), + "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + + Configurable cfgCentSel{"cfgCentSel", 100., "Centrality selection"}; + Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; + + Configurable cfgPVSel{"cfgPVSel", false, "Additional PV selection flag for syst"}; + Configurable cfgPV{"cfgPV", 8.0, "Additional PV selection range for syst"}; + Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "flag for additional pileup selection"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + + Configurable cfgv0radiusMin{"cfgv0radiusMin", 1.2, "minimum decay radius"}; + Configurable cfgDCAPosToPVMin{"cfgDCAPosToPVMin", 0.05, "minimum DCA to PV for positive track"}; + Configurable cfgDCANegToPVMin{"cfgDCANegToPVMin", 0.2, "minimum DCA to PV for negative track"}; + Configurable cfgv0CosPA{"cfgv0CosPA", 0.995, "minimum v0 cosine"}; + Configurable cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"}; + + Configurable cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"}; + Configurable cfgV0EtaMin{"cfgV0EtaMin", -0.5, "maximum rapidity"}; + Configurable cfgV0EtaMax{"cfgV0EtaMax", 0.5, "maximum rapidity"}; + Configurable cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"}; + + Configurable cfgQAv0{"cfgQAv0", false, "QA plot"}; + + Configurable cfgDaughTPCnclsMin{"cfgDaughTPCnclsMin", 70, "minimum fired crossed rows"}; + Configurable cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 5, "proton nsigma for TPC"}; + Configurable cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 5, "pion nsigma for TPC"}; + Configurable cfgDaughEtaMin{"cfgDaughEtaMin", -0.8, "minimum daughter eta"}; + Configurable cfgDaughEtaMax{"cfgDaughEtaMax", 0.8, "maximum daughter eta"}; + Configurable cfgDaughPrPt{"cfgDaughPrPt", 0.5, "minimum daughter proton pt"}; + Configurable cfgDaughPiPt{"cfgDaughPiPt", 0.5, "minimum daughter pion pt"}; + + Configurable cfgHypMassWindow{"cfgHypMassWindow", 0.02, "single lambda mass selection"}; + Configurable cfgV0V0RapMax{"cfgV0V0RapMax", 0.5, "rapidity selection for V0V0"}; + + Configurable cfgV0V0Sel{"cfgV0V0Sel", false, "application of V0V0 selections"}; + Configurable cfgV0V0Radius{"cfgV0V0Radius", 1.0, "maximum radius of v0v0"}; + Configurable cfgV0V0CPA{"cfgV0V0CPA", 0.6, "minimum CPA of v0v0"}; + Configurable cfgV0V0Distance{"cfgV0V0Distance", 1, "minimum distance of v0v0"}; + Configurable cfgV0V0DCA{"cfgV0V0DCA", 1.0, "maximum DCA of v0v0"}; + + Configurable cfgEffCor{"cfgEffCor", false, "flag to apply efficiency correction"}; + Configurable cfgEffCorPath{"cfgEffCorPath", "", "path for pseudo efficiency correction"}; + + Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; + + ConfigurableAxis massAxis{"massAxis", {110, 2.22, 2.33}, "Invariant mass axis"}; + ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"}; + ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"}; + ConfigurableAxis vertexAxis{"vertexAxis", {10, -10, 10}, "vertex axis for mixing"}; + + ConfigurableAxis RadiusAxis{"RadiusAxis", {100, 0, 5}, "radius of v0v0"}; + ConfigurableAxis CPAAxis{"CPAAxis", {102, -1.02, 1.02}, "CPA of v0v0"}; + ConfigurableAxis DistanceAxis{"DistanceAxis", {100, 0, 10}, "distance of v0v0"}; + ConfigurableAxis DCAAxis{"DCAAxis", {100, 0, 5}, "DCA of v0v0"}; + + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + + float centrality; + TProfile2D* EffMap = nullptr; + + void init(o2::framework::InitContext&) + { + AxisSpec centQaAxis = {80, 0.0, 80.0}; + AxisSpec PVzQaAxis = {300, -15.0, 15.0}; + AxisSpec combAxis = {3, -0.5, 2.5}; + + histos.add("Radius_V0V0_full", "", {HistType::kTH3F, {massAxis, ptAxis, RadiusAxis}}); + histos.add("CPA_V0V0_full", "", {HistType::kTH3F, {massAxis, ptAxis, CPAAxis}}); + histos.add("Distance_V0V0_full", "", {HistType::kTH3F, {massAxis, ptAxis, DistanceAxis}}); + histos.add("DCA_V0V0_full", "", {HistType::kTH3F, {massAxis, ptAxis, DCAAxis}}); + + histos.add("Radius_V0V0_sel", "", {HistType::kTH3F, {massAxis, ptAxis, RadiusAxis}}); + histos.add("CPA_V0V0_sel", "", {HistType::kTH3F, {massAxis, ptAxis, CPAAxis}}); + histos.add("Distance_V0V0_sel", "", {HistType::kTH3F, {massAxis, ptAxis, DistanceAxis}}); + histos.add("DCA_V0V0_sel", "", {HistType::kTH3F, {massAxis, ptAxis, DCAAxis}}); + + histos.add("h_InvMass_same", "", {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, combAxis}}); + histos.add("h_InvMass_mixed", "", {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, combAxis}}); + if (cfgQAv0) { + histos.add("QA/CentDist", "", {HistType::kTH1F, {centQaAxis}}); + histos.add("QA/PVzDist", "", {HistType::kTH1F, {PVzQaAxis}}); + } + + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + } + + double massLambda = o2::constants::physics::MassLambda; + ROOT::Math::PxPyPzMVector RecoV01, RecoV02, RecoV0V0; + + template + bool eventSelected(TCollision collision) + { + if (!collision.sel8()) { + return 0; + } + + if (cfgCentSel < centrality) { + return 0; + } + /* + auto multNTracksPV = collision.multNTracksPV(); + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) { + return 0; + } + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) { + return 0; + } + */ + if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return 0; + } + if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return 0; + } + if (cfgPVSel && std::abs(collision.posZ()) > cfgPV) { + return 0; + } + if (cfgAddEvtSelPileup && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return 0; + } + if (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy) { + return 0; + } + + return 1; + } // event selection + + template + bool SelectionV0(TCollision const& collision, V0 const& candidate) + { + if (candidate.v0radius() < cfgv0radiusMin) + return false; + if (std::abs(candidate.dcapostopv()) < cfgDCAPosToPVMin) + return false; + if (std::abs(candidate.dcanegtopv()) < cfgDCANegToPVMin) + return false; + if (candidate.v0cosPA() < cfgv0CosPA) + return false; + if (std::abs(candidate.dcaV0daughters()) > cfgDCAV0Dau) + return false; + if (candidate.pt() < cfgV0PtMin) + return false; + if (candidate.yLambda() < cfgV0EtaMin) + return false; + if (candidate.yLambda() > cfgV0EtaMax) + return false; + if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda > cfgV0LifeTime) + return false; + + return true; + } + + template + bool isSelectedV0Daughter(T const& track, int pid) // pid 0: proton, pid 1: pion + { + if (track.tpcNClsFound() < cfgDaughTPCnclsMin) + return false; + if (pid == 0 && std::abs(track.tpcNSigmaPr()) > cfgDaughPIDCutsTPCPr) + return false; + if (pid == 1 && std::abs(track.tpcNSigmaPi()) > cfgDaughPIDCutsTPCPi) + return false; + if (track.eta() > cfgDaughEtaMax) + return false; + if (track.eta() < cfgDaughEtaMin) + return false; + if (pid == 0 && track.pt() < cfgDaughPrPt) + return false; + if (pid == 1 && track.pt() < cfgDaughPiPt) + return false; + + return true; + } + + template + bool isSelectedV0V0(V01 const& v01, V02 const& v02) + { + if (getDCAofV0V0(v01, v02) > cfgV0V0DCA) + return false; + if (getCPA(v01, v02) < cfgV0V0CPA) + return false; + if (getDistance(v01, v02) < cfgV0V0Distance) + return false; + if (getRadius(v01, v02) > cfgV0V0Radius) + return false; + + return true; + } + + template + float getDCAofV0V0(V01 const& v01, V02 const& v02) + { + ROOT::Math::XYZVector v01pos, v02pos, v01mom, v02mom; + v01pos.SetXYZ(v01.x(), v01.y(), v01.z()); + v02pos.SetXYZ(v02.x(), v02.y(), v02.z()); + v01mom.SetXYZ(v01.px(), v01.py(), v01.pz()); + v02mom.SetXYZ(v02.px(), v02.py(), v02.pz()); + + ROOT::Math::XYZVector posdiff = v02pos - v01pos; + ROOT::Math::XYZVector cross = v01mom.Cross(v02mom); + if (std::sqrt(cross.Mag2()) < 1e-6) + return 999.; + return std::abs(posdiff.Dot(cross)) / std::sqrt(cross.Mag2()); + } + + template + float getCPA(V01 const& v01, V02 const& v02) + { + ROOT::Math::XYZVector v01mom, v02mom; + v01mom.SetXYZ(v01.px(), v01.py(), v01.pz()); + v02mom.SetXYZ(v02.px(), v02.py(), v02.pz()); + return v01mom.Dot(v02mom); + } + + template + float getDistance(V01 const& v01, V02 const& v02) + { + ROOT::Math::XYZVector v01pos, v02pos; + v01pos.SetXYZ(v01.x(), v01.y(), v01.z()); + v02pos.SetXYZ(v02.x(), v02.y(), v02.z()); + ROOT::Math::XYZVector posdiff = v02pos - v01pos; + return std::sqrt(posdiff.Mag2()); + } + + template + float getRadius(V01 const& v01, V02 const& v02) + { + ROOT::Math::XYZVector v01pos, v02pos, v01mom, v02mom; + v01pos.SetXYZ(v01.x(), v01.y(), v01.z()); + v02pos.SetXYZ(v02.x(), v02.y(), v02.z()); + v01mom.SetXYZ(v01.px() / v01.p(), v01.py() / v01.p(), v01.pz() / v01.p()); + v02mom.SetXYZ(v02.px() / v02.p(), v02.py() / v02.p(), v02.pz() / v02.p()); + ROOT::Math::XYZVector posdiff = v02pos - v01pos; + + float d = 1. - TMath::Power(v01mom.Dot(v02mom), 2); + if (d < 1e-5) + return 999; + float t = posdiff.Dot(v01mom - v01mom.Dot(v02mom) * v02mom) / d; + float s = -posdiff.Dot(v02mom - v01mom.Dot(v02mom) * v01mom) / d; + ROOT::Math::XYZVector dca = v01pos + v02pos + t * v01mom + s * v02mom; + dca /= 2.; + return std::sqrt(dca.Mag2()); + } + + template + void FillHistograms(C1 const& c1, C2 const& c2, V01 const& V01s, V02 const& V02s) + { + for (auto& v01 : V01s) { + auto postrack_v01 = v01.template posTrack_as(); + auto negtrack_v01 = v01.template negTrack_as(); + + int LambdaTag = 0; + int aLambdaTag = 0; + int V01Tag = -2; + + if (isSelectedV0Daughter(postrack_v01, 0) && isSelectedV0Daughter(negtrack_v01, 1)) { + LambdaTag = 1; + V01Tag = 0; + } + if (isSelectedV0Daughter(negtrack_v01, 0) && isSelectedV0Daughter(postrack_v01, 1)) { + aLambdaTag = 1; + V01Tag = 1; + } + + if (LambdaTag == aLambdaTag) + continue; + + if (!SelectionV0(c1, v01)) + continue; + + if (LambdaTag) { + if (std::abs(massLambda - v01.mLambda()) > cfgHypMassWindow) + continue; + RecoV01 = ROOT::Math::PxPyPzMVector(v01.px(), v01.py(), v01.pz(), v01.mLambda()); + } else if (aLambdaTag) { + if (std::abs(massLambda - v01.mAntiLambda()) > cfgHypMassWindow) + continue; + RecoV01 = ROOT::Math::PxPyPzMVector(v01.px(), v01.py(), v01.pz(), v01.mAntiLambda()); + } + + for (auto& v02 : V02s) { + if (v01.v0Id() <= v02.v0Id() && doprocessDataSame) + continue; + auto postrack_v02 = v02.template posTrack_as(); + auto negtrack_v02 = v02.template negTrack_as(); + + LambdaTag = 0; + aLambdaTag = 0; + int V02Tag = -2; + + if (isSelectedV0Daughter(postrack_v02, 0) && isSelectedV0Daughter(negtrack_v02, 1)) { + LambdaTag = 1; + V02Tag = 0; + } + if (isSelectedV0Daughter(negtrack_v02, 0) && isSelectedV0Daughter(postrack_v02, 1)) { + aLambdaTag = 1; + V02Tag = 1; + } + + if (LambdaTag == aLambdaTag) + continue; + + if (!SelectionV0(c2, v02)) + continue; + + if (doprocessDataSame) { + if (postrack_v01.globalIndex() == postrack_v02.globalIndex() || postrack_v01.globalIndex() == negtrack_v02.globalIndex() || negtrack_v01.globalIndex() == postrack_v02.globalIndex() || negtrack_v01.globalIndex() == negtrack_v02.globalIndex()) + continue; // no shared decay products + } + + if (LambdaTag) { + if (std::abs(massLambda - v02.mLambda()) > cfgHypMassWindow) + continue; + RecoV02 = ROOT::Math::PxPyPzMVector(v02.px(), v02.py(), v02.pz(), v02.mLambda()); + } else if (aLambdaTag) { + if (std::abs(massLambda - v02.mAntiLambda()) > cfgHypMassWindow) + continue; + RecoV02 = ROOT::Math::PxPyPzMVector(v02.px(), v02.py(), v02.pz(), v02.mAntiLambda()); + } + + RecoV0V0 = RecoV01 + RecoV02; + if (std::abs(RecoV0V0.Rapidity()) > cfgV0V0RapMax) + continue; + + histos.fill(HIST("Radius_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getRadius(v01, v02)); + histos.fill(HIST("CPA_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getCPA(v01, v02)); + histos.fill(HIST("Distance_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getDistance(v01, v02)); + histos.fill(HIST("DCA_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getDCAofV0V0(v01, v02)); + + if (isSelectedV0V0(v01, v02)) { + histos.fill(HIST("Radius_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getRadius(v01, v02)); + histos.fill(HIST("CPA_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getCPA(v01, v02)); + histos.fill(HIST("Distance_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getDistance(v01, v02)); + histos.fill(HIST("DCA_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getDCAofV0V0(v01, v02)); + } + + if (cfgV0V0Sel && !isSelectedV0V0(v01, v02)) + continue; + + if (doprocessDataSame) { + histos.fill(HIST("h_InvMass_same"), RecoV0V0.M(), RecoV0V0.Pt(), centrality, V01Tag + V02Tag); + } + if (doprocessDataMixed) { + histos.fill(HIST("h_InvMass_mixed"), RecoV0V0.M(), RecoV0V0.Pt(), centrality, V01Tag + V02Tag); + } + } + } + } + + void processDataSame(EventCandidates::iterator const& collision, + TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, + aod::BCsWithTimestamps const&) + { + if (cfgCentEst == 1) { + centrality = collision.centFT0C(); + } else if (cfgCentEst == 2) { + centrality = collision.centFT0M(); + } + if (!eventSelected(collision)) { + return; + } + + histos.fill(HIST("QA/CentDist"), centrality, 1.0); + histos.fill(HIST("QA/PVzDist"), collision.posZ(), 1.0); + + if (cfgEffCor) { + auto bc = collision.bc_as(); + EffMap = ccdb->getForTimeStamp(cfgEffCorPath.value, bc.timestamp()); + } + FillHistograms(collision, collision, V0s, V0s); + } + PROCESS_SWITCH(lambdalambda, processDataSame, "Process Event for same data", true); + + SliceCache cache; + using BinningTypeVertexContributor = ColumnBinningPolicy; + + void processDataMixed(EventCandidates const& collisions, + TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) + { + auto tracksTuple = std::make_tuple(V0s); + BinningTypeVertexContributor binningOnPositions{{vertexAxis, centAxis}, true}; + SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; + for (auto& [c1, tracks1, c2, tracks2] : pair) { + if (cfgCentEst == 1) { + centrality = c1.centFT0C(); + } else if (cfgCentEst == 2) { + centrality = c1.centFT0M(); + } + if (!eventSelected(c1)) + continue; + if (!eventSelected(c2)) + continue; + FillHistograms(c1, c2, tracks1, tracks2); + } + } + PROCESS_SWITCH(lambdalambda, processDataMixed, "Process Event for mixed data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"lf-lambdalambda"})}; +} diff --git a/PWGLF/Tasks/Strangeness/lambdapolarization.cxx b/PWGLF/Tasks/Strangeness/lambdapolarization.cxx index b42b45a5b4a..f0d7e63f57f 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolarization.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include "TLorentzVector.h" #include "TRandom3.h" @@ -121,10 +122,16 @@ struct lambdapolarization { Configurable cfgQvecRefAName{"cfgQvecRefAName", "TPCpos", "The name of detector for reference A"}; Configurable cfgQvecRefBName{"cfgQvecRefBName", "TPCneg", "The name of detector for reference B"}; + Configurable cfgPhiDepStudy{"cfgPhiDepStudy", false, "cfg for phi dependent study"}; + Configurable cfgPhiDepSig{"cfgPhiDepSig", 0.2, "cfg for significance on phi dependent study"}; + Configurable cfgShiftCorr{"cfgShiftCorr", false, "additional shift correction"}; Configurable cfgShiftCorrDef{"cfgShiftCorrDef", false, "additional shift correction definition"}; Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; + Configurable cfgEffCor{"cfgEffCor", false, "flag to apply efficiency correction"}; + Configurable cfgEffCorPath{"cfgEffCorPath", "", "path for pseudo efficiency correction"}; + ConfigurableAxis massAxis{"massAxis", {30, 1.1, 1.13}, "Invariant mass axis"}; ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"}; ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"}; @@ -148,6 +155,7 @@ struct lambdapolarization { int currentRunNumber = -999; int lastRunNumber = -999; std::vector shiftprofile{}; + TProfile2D* EffMap = nullptr; std::string fullCCDBShiftCorrPath; @@ -177,6 +185,7 @@ struct lambdapolarization { { AxisSpec cosAxis = {110, -1.05, 1.05}; AxisSpec centQaAxis = {80, 0.0, 80.0}; + AxisSpec PVzQaAxis = {300, -15.0, 15.0}; AxisSpec epAxis = {6, 0.0, 2.0 * constants::math::PI}; AxisSpec epQaAxis = {100, -1.0 * constants::math::PI, constants::math::PI}; @@ -199,9 +208,14 @@ struct lambdapolarization { histos.add(Form("psi%d/h_alambda_vncos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); histos.add(Form("psi%d/h_alambda_vnsin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); } + histos.add("QA/ptspec_l", "", {HistType::kTH3F, {massAxis, ptAxis, centAxis}}); + histos.add("QA/ptspec_al", "", {HistType::kTH3F, {massAxis, ptAxis, centAxis}}); + histos.add("QA/ptspecCor_l", "", {HistType::kTH3F, {massAxis, ptAxis, centAxis}}); + histos.add("QA/ptspecCor_al", "", {HistType::kTH3F, {massAxis, ptAxis, centAxis}}); if (cfgQAv0) { histos.add("QA/CentDist", "", {HistType::kTH1F, {centQaAxis}}); + histos.add("QA/PVzDist", "", {HistType::kTH1F, {PVzQaAxis}}); histos.add("QA/nsigma_tpc_pt_ppr", "", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA/nsigma_tpc_pt_ppi", "", {HistType::kTH2F, {ptAxis, pidAxis}}); @@ -311,7 +325,7 @@ struct lambdapolarization { return false; if (candidate.v0cosPA() < cfgv0CosPA) return false; - if (candidate.dcaV0daughters() > cfgDCAV0Dau) + if (std::abs(candidate.dcaV0daughters()) > cfgDCAV0Dau) return false; if (candidate.pt() < cfgV0PtMin) return false; @@ -549,50 +563,71 @@ struct lambdapolarization { relphi = TVector2::Phi_0_2pi(static_cast(nmode) * (LambdaVec.Phi() - psidefFT0C - deltapsiFT0C)); } + if (cfgPhiDepStudy && cfgPhiDepSig * std::abs(TMath::Sin(relphi)) > gRandom->Uniform(0, 1)) { + continue; + } + + if (LambdaTag) { + histos.fill(HIST("QA/ptspec_l"), v0.mLambda(), v0.pt(), centrality); + if (cfgEffCor) { + histos.fill(HIST("QA/ptspecCor_l"), v0.mLambda(), v0.pt(), centrality, + 1.0 / EffMap->GetBinContent(EffMap->GetXaxis()->FindBin(v0.pt()), EffMap->GetYaxis()->FindBin(centrality))); + } + } + if (aLambdaTag) { + histos.fill(HIST("QA/ptspec_al"), v0.mAntiLambda(), v0.pt(), centrality); + if (cfgEffCor) { + histos.fill(HIST("QA/ptspecCor_al"), v0.mAntiLambda(), v0.pt(), centrality, + 1.0 / EffMap->GetBinContent(EffMap->GetXaxis()->FindBin(v0.pt()), EffMap->GetYaxis()->FindBin(centrality))); + } + } + + double weight = cfgEffCor ? 1.0 / EffMap->GetBinContent(EffMap->GetXaxis()->FindBin(v0.pt()), EffMap->GetYaxis()->FindBin(centrality)) : 1.; + if (nmode == 2) { //////////// if (LambdaTag) { - histos.fill(HIST("psi2/h_lambda_cos"), v0.mLambda(), v0.pt(), angle, centrality, relphi); - histos.fill(HIST("psi2/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi); - histos.fill(HIST("psi2/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality); - histos.fill(HIST("psi2/h_lambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality); - histos.fill(HIST("psi2/h_lambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality); + histos.fill(HIST("psi2/h_lambda_cos"), v0.mLambda(), v0.pt(), angle, centrality, relphi, weight); + histos.fill(HIST("psi2/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi, weight); + histos.fill(HIST("psi2/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality, weight); + histos.fill(HIST("psi2/h_lambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi2/h_lambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality, weight); } if (aLambdaTag) { - histos.fill(HIST("psi2/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle, centrality, relphi); - histos.fill(HIST("psi2/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi); - histos.fill(HIST("psi2/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality); - histos.fill(HIST("psi2/h_alambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality); - histos.fill(HIST("psi2/h_alambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality); + histos.fill(HIST("psi2/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle, centrality, relphi, weight); + histos.fill(HIST("psi2/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi, weight); + histos.fill(HIST("psi2/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality, weight); + histos.fill(HIST("psi2/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi2/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), TMath::Sin(relphi), centrality, weight); } } else if (nmode == 3) { if (LambdaTag) { - histos.fill(HIST("psi3/h_lambda_cos"), v0.mLambda(), v0.pt(), angle, centrality, relphi); - histos.fill(HIST("psi3/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi); - histos.fill(HIST("psi3/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality); - histos.fill(HIST("psi3/h_lambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality); - histos.fill(HIST("psi3/h_lambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality); + histos.fill(HIST("psi3/h_lambda_cos"), v0.mLambda(), v0.pt(), angle, centrality, relphi, weight); + histos.fill(HIST("psi3/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi, weight); + histos.fill(HIST("psi3/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality, weight); + histos.fill(HIST("psi3/h_lambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi3/h_lambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality, weight); } if (aLambdaTag) { - histos.fill(HIST("psi3/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle, centrality, relphi); - histos.fill(HIST("psi3/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi); - histos.fill(HIST("psi3/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality); - histos.fill(HIST("psi3/h_alambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality); - histos.fill(HIST("psi3/h_alambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality); + histos.fill(HIST("psi3/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle, centrality, relphi, weight); + histos.fill(HIST("psi3/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi, weight); + histos.fill(HIST("psi3/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality, weight); + histos.fill(HIST("psi3/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi3/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), TMath::Sin(relphi), centrality, weight); } } else if (nmode == 4) { if (LambdaTag) { - histos.fill(HIST("psi4/h_lambda_cos"), v0.mLambda(), v0.pt(), angle, centrality, relphi); - histos.fill(HIST("psi4/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi); - histos.fill(HIST("psi4/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality); - histos.fill(HIST("psi4/h_lambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality); - histos.fill(HIST("psi4/h_lambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality); + histos.fill(HIST("psi4/h_lambda_cos"), v0.mLambda(), v0.pt(), angle, centrality, relphi, weight); + histos.fill(HIST("psi4/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi, weight); + histos.fill(HIST("psi4/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality, weight); + histos.fill(HIST("psi4/h_lambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi4/h_lambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality, weight); } if (aLambdaTag) { - histos.fill(HIST("psi4/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle, centrality, relphi); - histos.fill(HIST("psi4/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi); - histos.fill(HIST("psi4/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality); - histos.fill(HIST("psi4/h_alambda_vncos"), v0.mLambda(), v0.pt(), TMath::Cos(relphi), centrality); - histos.fill(HIST("psi4/h_alambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality); + histos.fill(HIST("psi4/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle, centrality, relphi, weight); + histos.fill(HIST("psi4/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi, weight); + histos.fill(HIST("psi4/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * TMath::Sin(relphi), centrality, weight); + histos.fill(HIST("psi4/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi4/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), TMath::Sin(relphi), centrality, weight); } } ////////// FIXME: not possible to get histograms using nmode } @@ -611,6 +646,8 @@ struct lambdapolarization { return; } histos.fill(HIST("QA/CentDist"), centrality, 1.0); + histos.fill(HIST("QA/PVzDist"), collision.posZ(), 1.0); + if (cfgShiftCorr) { auto bc = collision.bc_as(); currentRunNumber = bc.runNumber(); @@ -626,6 +663,10 @@ struct lambdapolarization { lastRunNumber = currentRunNumber; } } + if (cfgEffCor) { + auto bc = collision.bc_as(); + EffMap = ccdb->getForTimeStamp(cfgEffCorPath.value, bc.timestamp()); + } for (int i = 2; i < cfgnMods + 2; i++) { if (cfgShiftCorrDef) { FillShiftCorrection(collision, i); diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 7f9525bdb60..54eca5c81fb 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -32,8 +32,8 @@ #include "Math/GenVector/Boost.h" #include "TF1.h" +// #include "Common/DataModel/Qvectors.h" #include "PWGLF/DataModel/SPCalibrationTables.h" -// #include "SPCalibrationTableswrite.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -73,10 +73,13 @@ struct lambdapolsp { Configurable additionalEvSel{"additionalEvSel", false, "additionalEvSel"}; Configurable additionalEvSel2{"additionalEvSel2", false, "additionalEvSel2"}; Configurable additionalEvSel3{"additionalEvSel3", false, "additionalEvSel3"}; - Configurable correction{"correction", false, "fill histograms including corrections"}; - Configurable mycut{"mycut", false, "select tracks based on my cuts"}; + Configurable QA{"QA", false, "flag for QA"}; + // Configurable mycut{"mycut", false, "select tracks based on my cuts"}; Configurable tofhit{"tofhit", true, "select tracks based on tof hit"}; Configurable globalpt{"globalpt", true, "select tracks based on pt global vs tpc"}; + Configurable usefourvectormass{"usefourvectormass", true, "select invariant mass based on four vector"}; + Configurable checksign{"checksign", true, "check sign of daughter tracks"}; + Configurable useprofile{"useprofile", 3, "flag to select profile vs Sparse"}; Configurable QxyNbins{"QxyNbins", 100, "Number of bins in QxQy histograms"}; Configurable lbinQxy{"lbinQxy", -5.0, "lower bin value in QxQy histograms"}; Configurable hbinQxy{"hbinQxy", 5.0, "higher bin value in QxQy histograms"}; @@ -97,6 +100,9 @@ struct lambdapolsp { Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; Configurable isPVContributor{"isPVContributor", true, "is PV contributor"}; Configurable checkwithpub{"checkwithpub", true, "checking results with published"}; + Configurable rejectmisident{"rejectmisident", true, "rejecting misidentification"}; + Configurable useTPCTOF{"useTPCTOF", true, "flag to use TPC and TOF"}; + // Configs for V0 Configurable ConfV0PtMin{"ConfV0PtMin", 0.f, "Minimum transverse momentum of V0"}; Configurable ConfV0Rap{"ConfV0Rap", 0.8f, "Rapidity range of V0"}; @@ -104,17 +110,19 @@ struct lambdapolsp { Configurable ConfV0CPAMin{"ConfV0CPAMin", 0.9998f, "Minimum CPA of V0"}; Configurable ConfV0TranRadV0Min{"ConfV0TranRadV0Min", 1.5f, "Minimum transverse radius"}; Configurable ConfV0TranRadV0Max{"ConfV0TranRadV0Max", 100.f, "Maximum transverse radius"}; + Configurable cMaxV0DCA{"cMaxV0DCA", 1.2, "Maximum V0 DCA to PV"}; Configurable cMinV0DCA{"cMinV0DCA", 0.05, "Minimum V0 daughters DCA to PV"}; Configurable cMaxV0LifeTime{"cMaxV0LifeTime", 20, "Maximum V0 life time"}; - Configurable cSigmaMassKs0{"cSigmaMassKs0", 0.006, "Sigma cut on KS0 mass"}; - Configurable cMinLambdaMass{"cMinLambdaMass", 1.0, "Minimum lambda mass"}; - Configurable cMaxLambdaMass{"cMaxLambdaMass", 1.2, "Maximum lambda mass"}; + // config for V0 daughters Configurable ConfDaughEta{"ConfDaughEta", 0.8f, "V0 Daugh sel: max eta"}; - Configurable ConfDaughPt{"ConfDaughPt", 0.1f, "V0 Daugh sel: min pt"}; + Configurable cfgDaughPrPt{"cfgDaughPrPt", 0.4, "minimum daughter proton pt"}; + Configurable cfgDaughPiPt{"cfgDaughPiPt", 0.2, "minimum daughter pion pt"}; Configurable ConfDaughTPCnclsMin{"ConfDaughTPCnclsMin", 50.f, "V0 Daugh sel: Min. nCls TPC"}; Configurable ConfDaughDCAMin{"ConfDaughDCAMin", 0.08f, "V0 Daugh sel: Max. DCA Daugh to PV (cm)"}; - Configurable ConfDaughPIDCuts{"ConfDaughPIDCuts", 3, "PID selections for KS0 daughters"}; + Configurable ConfDaughPIDCuts{"ConfDaughPIDCuts", 3, "PID selections for Lambda daughters"}; + Configurable ConfDaughPIDTPCCuts{"ConfDaughPIDTPCCuts", 3, "PID selections for Lambda daughters in TPC"}; + Configurable ConfDaughPIDTOFCuts{"ConfDaughPIDTOFCuts", 3, "PID selections for Lambda daughters in TOF"}; Configurable CentNbins{"CentNbins", 16, "Number of bins in cent histograms"}; Configurable lbinCent{"lbinCent", 0.0, "lower bin value in cent histograms"}; @@ -131,6 +139,22 @@ struct lambdapolsp { Configurable ptNbins{"ptNbins", 50, "Number of bins in pt"}; Configurable lbinpt{"lbinpt", 0.0, "lower bin value in pt histograms"}; Configurable hbinpt{"hbinpt", 10.0, "higher bin value in pt histograms"}; + Configurable resNbins{"resNbins", 50, "Number of bins in reso"}; + Configurable lbinres{"lbinres", 0.0, "lower bin value in reso histograms"}; + Configurable hbinres{"hbinres", 10.0, "higher bin value in reso histograms"}; + Configurable etaNbins{"etaNbins", 20, "Number of bins in eta"}; + Configurable lbineta{"lbineta", -1.0, "lower bin value in eta histograms"}; + Configurable hbineta{"hbineta", 1.0, "higher bin value in eta histograms"}; + Configurable spNbins{"spNbins", 2000, "Number of bins in sp"}; + Configurable lbinsp{"lbinsp", -1.0, "lower bin value in sp histograms"}; + Configurable hbinsp{"hbinsp", 1.0, "higher bin value in sp histograms"}; + Configurable phiNbins{"phiNbins", 30, "Number of bins in phi"}; + + ConfigurableAxis configcentAxis{"configcentAxis", {VARIABLE_WIDTH, 0.0, 10.0, 40.0, 80.0}, "Cent V0M"}; + ConfigurableAxis configthnAxispT{"configthnAxisPt", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis configetaAxis{"configetaAxis", {VARIABLE_WIDTH, -0.8, -0.4, -0.2, 0, 0.2, 0.4, 0.8}, "Eta"}; + ConfigurableAxis configthnAxisPol{"configthnAxisPol", {VARIABLE_WIDTH, -1.0, -0.6, -0.2, 0, 0.2, 0.4, 0.8}, "Pol"}; + ConfigurableAxis configphiAxis{"configphiAxis", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.8, 1.0, 2.0, 2.5, 3.0, 4.0, 5.0, 5.5, 6.28}, "PhiAxis"}; SliceCache cache; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -138,73 +162,177 @@ struct lambdapolsp { void init(o2::framework::InitContext&) { AxisSpec thnAxispT{ptNbins, lbinpt, hbinpt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec thnAxisRap{100, -0.5, 0.5, "Rapidity"}; + AxisSpec thnAxisres{resNbins, lbinres, hbinres, "Reso"}; AxisSpec thnAxisInvMass{IMNbins, lbinIM, hbinIM, "#it{M} (GeV/#it{c}^{2})"}; AxisSpec thnAxisPol{PolNbins, lbinPol, hbinPol, "Sin(#phi - #psi)"}; AxisSpec thnAxisCosThetaStar{SANbins, lbinSA, hbinSA, "SA"}; AxisSpec centAxis = {CentNbins, lbinCent, hbinCent, "V0M (%)"}; - AxisSpec etaAxis = {20, -1.0, 1.0, "Eta"}; - AxisSpec ptAxis = {200, 0.0, 20.0, "Pt"}; + AxisSpec etaAxis = {etaNbins, lbineta, hbineta, "Eta"}; + AxisSpec spAxis = {spNbins, lbinsp, hbinsp, "Sp"}; AxisSpec qxZDCAxis = {QxyNbins, lbinQxy, hbinQxy, "Qx"}; + AxisSpec phiAxis = {phiNbins, 0.0, 6.28, "phi-phiStar"}; if (checkwithpub) { - histos.add("hpuxQxpvscentpteta", "hpuxQxpvscentpteta", kTProfile3D, {centAxis, ptAxis, etaAxis}); - histos.add("hpuyQypvscentpteta", "hpuyQypvscentpteta", kTProfile3D, {centAxis, ptAxis, etaAxis}); - histos.add("hpuxQxtvscentpteta", "hpuxQxtvscentpteta", kTProfile3D, {centAxis, ptAxis, etaAxis}); - histos.add("hpuyQytvscentpteta", "hpuyQytvscentpteta", kTProfile3D, {centAxis, ptAxis, etaAxis}); - histos.add("hpuxyQxytvscentpteta", "hpuxyQxytvscentpteta", kTProfile3D, {centAxis, ptAxis, etaAxis}); - histos.add("hpuxyQxypvscentpteta", "hpuxyQxypvscentpteta", kTProfile3D, {centAxis, ptAxis, etaAxis}); - histos.add("hpQxtQxpvscent", "hpQxtQxpvscent", kTProfile, {centAxis}); - histos.add("hpQytQypvscent", "hpQytQypvscent", kTProfile, {centAxis}); - histos.add("hpQxytpvscent", "hpQxytpvscent", kTProfile, {centAxis}); + if (useprofile == 1) { + histos.add("hpuxQxpvscentpteta", "hpuxQxpvscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuyQypvscentpteta", "hpuyQypvscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuxQxtvscentpteta", "hpuxQxtvscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuyQytvscentpteta", "hpuyQytvscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuxyQxytvscentpteta", "hpuxyQxytvscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuxyQxypvscentpteta", "hpuxyQxypvscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpoddv1vscentpteta", "hpoddv1vscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpevenv1vscentpteta", "hpevenv1vscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + + histos.add("hpuxvscentpteta", "hpuxvscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuyvscentpteta", "hpuyvscentpteta", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuxvscentptetaneg", "hpuxvscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuyvscentptetaneg", "hpuyvscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + + histos.add("hpuxQxpvscentptetaneg", "hpuxQxpvscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuyQypvscentptetaneg", "hpuyQypvscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuxQxtvscentptetaneg", "hpuxQxtvscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuyQytvscentptetaneg", "hpuyQytvscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuxyQxytvscentptetaneg", "hpuxyQxytvscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpuxyQxypvscentptetaneg", "hpuxyQxypvscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpoddv1vscentptetaneg", "hpoddv1vscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + histos.add("hpevenv1vscentptetaneg", "hpevenv1vscentptetaneg", kTProfile3D, {centAxis, thnAxispT, etaAxis}, true); + + histos.add("hpQxtQxpvscent", "hpQxtQxpvscent", kTProfile, {centAxis}, true); + histos.add("hpQytQypvscent", "hpQytQypvscent", kTProfile, {centAxis}, true); + histos.add("hpQxytpvscent", "hpQxytpvscent", kTProfile, {centAxis}, true); + histos.add("hpQxtQypvscent", "hpQxtQypvscent", kTProfile, {centAxis}, true); + histos.add("hpQxpQytvscent", "hpQxpQytvscent", kTProfile, {centAxis}, true); + + histos.add("hpQxpvscent", "hpQxpvscent", kTProfile, {centAxis}, true); + histos.add("hpQxtvscent", "hpQxtvscent", kTProfile, {centAxis}, true); + histos.add("hpQypvscent", "hpQypvscent", kTProfile, {centAxis}, true); + histos.add("hpQytvscent", "hpQytvscent", kTProfile, {centAxis}, true); + } else if (useprofile == 2) { + histos.add("hpuxQxpvscentpteta", "hpuxQxpvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyQypvscentpteta", "hpuyQypvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxQxtvscentpteta", "hpuxQxtvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyQytvscentpteta", "hpuyQytvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxyQxytvscentpteta", "hpuxyQxytvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxyQxypvscentpteta", "hpuxyQxypvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpoddv1vscentpteta", "hpoddv1vscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpevenv1vscentpteta", "hpevenv1vscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + + histos.add("hpuxvscentpteta", "hpuxvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyvscentpteta", "hpuyvscentpteta", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxvscentptetaneg", "hpuxvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyvscentptetaneg", "hpuyvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + + histos.add("hpuxQxpvscentptetaneg", "hpuxQxpvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyQypvscentptetaneg", "hpuyQypvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxQxtvscentptetaneg", "hpuxQxtvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuyQytvscentptetaneg", "hpuyQytvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxyQxytvscentptetaneg", "hpuxyQxytvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpuxyQxypvscentptetaneg", "hpuxyQxypvscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpoddv1vscentptetaneg", "hpoddv1vscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + histos.add("hpevenv1vscentptetaneg", "hpevenv1vscentptetaneg", HistType::kTHnSparseF, {centAxis, thnAxispT, etaAxis, spAxis}, true); + + histos.add("hpQxtQxpvscent", "hpQxtQxpvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQytQypvscent", "hpQytQypvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQxytpvscent", "hpQxytpvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQxtQypvscent", "hpQxtQypvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQxpQytvscent", "hpQxpQytvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + + histos.add("hpQxpvscent", "hpQxpvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQxtvscent", "hpQxtvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQypvscent", "hpQypvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + histos.add("hpQytvscent", "hpQytvscent", HistType::kTHnSparseF, {centAxis, spAxis}, true); + } else { + histos.add("hpuxQxpvscentpteta", "hpuxQxpvscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuyQypvscentpteta", "hpuyQypvscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuxQxtvscentpteta", "hpuxQxtvscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuyQytvscentpteta", "hpuyQytvscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuxyQxytvscentpteta", "hpuxyQxytvscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuxyQxypvscentpteta", "hpuxyQxypvscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpoddv1vscentpteta", "hpoddv1vscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpevenv1vscentpteta", "hpevenv1vscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + + histos.add("hpuxvscentpteta", "hpuxvscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuyvscentpteta", "hpuyvscentpteta", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuxvscentptetaneg", "hpuxvscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuyvscentptetaneg", "hpuyvscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + + histos.add("hpuxQxpvscentptetaneg", "hpuxQxpvscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuyQypvscentptetaneg", "hpuyQypvscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuxQxtvscentptetaneg", "hpuxQxtvscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuyQytvscentptetaneg", "hpuyQytvscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuxyQxytvscentptetaneg", "hpuxyQxytvscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpuxyQxypvscentptetaneg", "hpuxyQxypvscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpoddv1vscentptetaneg", "hpoddv1vscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + histos.add("hpevenv1vscentptetaneg", "hpevenv1vscentptetaneg", HistType::kTHnSparseF, {configcentAxis, configthnAxispT, configetaAxis, spAxis}, true); + + histos.add("hpQxtQxpvscent", "hpQxtQxpvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + histos.add("hpQytQypvscent", "hpQytQypvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + histos.add("hpQxytpvscent", "hpQxytpvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + histos.add("hpQxtQypvscent", "hpQxtQypvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + histos.add("hpQxpQytvscent", "hpQxpQytvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + + histos.add("hpQxpvscent", "hpQxpvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + histos.add("hpQxtvscent", "hpQxtvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + histos.add("hpQypvscent", "hpQypvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + histos.add("hpQytvscent", "hpQytvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true); + } } histos.add("hCentrality", "Centrality distribution", kTH1F, {{centAxis}}); - histos.add("hCentrality0", "Centrality distribution0", kTH1F, {{centAxis}}); - histos.add("hCentrality1", "Centrality distribution1", kTH1F, {{centAxis}}); - histos.add("hCentrality2", "Centrality distribution2", kTH1F, {{centAxis}}); - histos.add("hCentrality3", "Centrality distribution3", kTH1F, {{centAxis}}); - histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{20, -10.0, 10.0}}); - // histos.add("hDiff", "Diff distribution", kTH2F, {{100,0.0,10.0}, {100000, -5.0, 5.0}}); - // histos.add("hPhi", "Phi distribution", kTH1F, {{120, -6.28, 6.28}}); - histos.add("hpRes", "hpRes", kTProfile, {centAxis}); - if (!checkwithpub) { - histos.add("hpResSin", "hpResSin", kTProfile, {centAxis}); - histos.add("hpCosPsiA", "hpCosPsiA", kTProfile, {centAxis}); - histos.add("hpCosPsiC", "hpCosPsiC", kTProfile, {centAxis}); - histos.add("hpSinPsiA", "hpSinPsiA", kTProfile, {centAxis}); - histos.add("hpSinPsiC", "hpSinPsiC", kTProfile, {centAxis}); - } - histos.add("hcentQxZDCA", "hcentQxZDCA", kTH2F, {{centAxis}, {qxZDCAxis}}); - histos.add("hcentQyZDCA", "hcentQyZDCA", kTH2F, {{centAxis}, {qxZDCAxis}}); - histos.add("hcentQxZDCC", "hcentQxZDCC", kTH2F, {{centAxis}, {qxZDCAxis}}); - histos.add("hcentQyZDCC", "hcentQyZDCC", kTH2F, {{centAxis}, {qxZDCAxis}}); + // histos.add("hpsiApsiC", "hpsiApsiC", kTHnSparseF, {psiACAxis, psiACAxis}); + // histos.add("hpsiApsiC", "hpsiApsiC", kTH2F, {psiACAxis, psiACAxis}); + // histos.add("hphiminuspsiA", "hphiminuspisA", kTH1F, {{50, 0, 6.28}}, true); + // histos.add("hphiminuspsiC", "hphiminuspisC", kTH1F, {{50, 0, 6.28}}, true); + // histos.add("hCentrality0", "Centrality distribution0", kTH1F, {{centAxis}}); + // histos.add("hCentrality1", "Centrality distribution1", kTH1F, {{centAxis}}); + // histos.add("hCentrality2", "Centrality distribution2", kTH1F, {{centAxis}}); + // histos.add("hCentrality3", "Centrality distribution3", kTH1F, {{centAxis}}); if (!checkwithpub) { - histos.add("hSparseLambdaPolA", "hSparseLambdaPolA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisPol, centAxis}, true); - histos.add("hSparseLambdaPolC", "hSparseLambdaPolC", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisPol, centAxis}, true); - histos.add("hSparseAntiLambdaPolA", "hSparseAntiLambdaPolA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisPol, centAxis}, true); - histos.add("hSparseAntiLambdaPolC", "hSparseAntiLambdaPolC", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisPol, centAxis}, true); - if (correction) { - histos.add("hSparseLambdaPolA_corr", "hSparseLambdaPolA_corr", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisCosThetaStar, thnAxisPol, thnAxisPol, thnAxisPol, centAxis}, true); - histos.add("hSparseLambdaPolC_corr", "hSparseLambdaPolC_corr", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisCosThetaStar, thnAxisPol, thnAxisPol, thnAxisPol, centAxis}, true); - histos.add("hSparseAntiLambdaPolA_corr", "hSparseAntiLambdaPolA_corr", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisCosThetaStar, thnAxisPol, thnAxisPol, thnAxisPol, centAxis}, true); - histos.add("hSparseAntiLambdaPolC_corr", "hSparseAntiLambdaPolC_corr", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisCosThetaStar, thnAxisPol, thnAxisPol, thnAxisPol, centAxis}, true); + // histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{20, -10.0, 10.0}}); + histos.add("hpRes", "hpRes", HistType::kTHnSparseF, {configcentAxis, thnAxisres}); + if (QA) { + histos.add("hpResSin", "hpResSin", HistType::kTHnSparseF, {configcentAxis, thnAxisres}); + histos.add("hpCosPsiA", "hpCosPsiA", HistType::kTHnSparseF, {configcentAxis, thnAxisres}); + histos.add("hpCosPsiC", "hpCosPsiC", HistType::kTHnSparseF, {configcentAxis, thnAxisres}); + histos.add("hpSinPsiA", "hpSinPsiA", HistType::kTHnSparseF, {configcentAxis, thnAxisres}); + histos.add("hpSinPsiC", "hpSinPsiC", HistType::kTHnSparseF, {configcentAxis, thnAxisres}); + /*histos.add("hcentQxZDCA", "hcentQxZDCA", kTH2F, {{centAxis}, {qxZDCAxis}}); + histos.add("hcentQyZDCA", "hcentQyZDCA", kTH2F, {{centAxis}, {qxZDCAxis}}); + histos.add("hcentQxZDCC", "hcentQxZDCC", kTH2F, {{centAxis}, {qxZDCAxis}}); + histos.add("hcentQyZDCC", "hcentQyZDCC", kTH2F, {{centAxis}, {qxZDCAxis}});*/ } + histos.add("hSparseLambdaPolA", "hSparseLambdaPolA", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseLambdaPolC", "hSparseLambdaPolC", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseAntiLambdaPolA", "hSparseAntiLambdaPolA", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseAntiLambdaPolC", "hSparseAntiLambdaPolC", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + + histos.add("hSparseLambda_corr1a", "hSparseLambda_corr1a", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseLambda_corr1b", "hSparseLambda_corr1b", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseLambda_corr1c", "hSparseLambda_corr1c", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configphiAxis, configcentAxis}, true); + histos.add("hSparseAntiLambda_corr1a", "hSparseAntiLambda_corr1a", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseAntiLambda_corr1b", "hSparseAntiLambda_corr1b", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseAntiLambda_corr1c", "hSparseAntiLambda_corr1c", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configphiAxis, configcentAxis}, true); + + histos.add("hSparseLambda_corr2a", "hSparseLambda_corr2a", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseLambda_corr2b", "hSparseLambda_corr2b", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseAntiLambda_corr2a", "hSparseAntiLambda_corr2a", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); + histos.add("hSparseAntiLambda_corr2b", "hSparseAntiLambda_corr2b", HistType::kTHnSparseF, {thnAxisInvMass, configthnAxispT, configetaAxis, configthnAxisPol, configcentAxis}, true); } } template bool selectionTrack(const T& candidate) { - + /* if (mycut) { if (!candidate.isGlobalTrack() || !candidate.isPVContributor() || !(candidate.itsNCls() > cfgITScluster) || !(candidate.tpcNClsFound() > cfgTPCcluster) || !(candidate.itsNClsInnerBarrel() >= 1)) { return false; } - } else { - if (!(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster && candidate.itsNClsInnerBarrel() >= 1)) { - return false; - } + } else {*/ + if (!(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster && candidate.itsNClsInnerBarrel() >= 1)) { + return false; } return true; } @@ -212,7 +340,9 @@ struct lambdapolsp { template bool SelectionV0(Collision const& collision, V0 const& candidate) { - + if (TMath::Abs(candidate.dcav0topv()) > cMaxV0DCA) { + return false; + } const float pT = candidate.pt(); // const std::vector decVtx = {candidate.x(), candidate.y(), candidate.z()}; const float tranRad = candidate.v0radius(); @@ -261,32 +391,66 @@ struct lambdapolsp { // const auto dcaXY = track.dcaXY(); // const auto sign = track.sign(); /* - if (charge < 0 && sign > 0) { + if (charge < 0 && sign > 0) { return false; - } - if (charge > 0 && sign < 0) { + } + if (charge > 0 && sign < 0) { return false; }*/ - if (TMath::Abs(eta) > ConfDaughEta) { + if (track.tpcNClsCrossedRows() < 70) { return false; } - if (pt < ConfDaughPt) { + if (TMath::Abs(eta) > ConfDaughEta) { return false; } if (tpcNClsF < ConfDaughTPCnclsMin) { return false; } - /* if (track.tpcCrossedRowsOverFindableCls() < 0.8) { return false; - } - if (TMath::Abs(dcaXY) < ConfDaughDCAMin) { + } + /* + if (TMath::Abs(dcaXY) < ConfDaughDCAMin) { return false; }*/ - if (pid == 0 && TMath::Abs(track.tpcNSigmaPr()) > ConfDaughPIDCuts) { + + if (useTPCTOF) { + if (track.pt() < 0.5 && pid == 0 && TMath::Abs(track.tpcNSigmaPr()) > ConfDaughPIDCuts) { + return false; + } + if (track.pt() < 0.5 && pid == 1 && TMath::Abs(track.tpcNSigmaPi()) > ConfDaughPIDCuts) { + return false; + } + if (track.hasTOF()) { + if (track.pt() > 0.5 && pid == 0 && TMath::Abs(track.tpcNSigmaPr()) > ConfDaughPIDTPCCuts && TMath::Abs(track.tofNSigmaPr()) > ConfDaughPIDTOFCuts) { + return false; + } + if (track.pt() > 0.5 && pid == 1 && TMath::Abs(track.tpcNSigmaPi()) > ConfDaughPIDTPCCuts && TMath::Abs(track.tofNSigmaPi()) > ConfDaughPIDTOFCuts) { + return false; + } + } + } else { + if (pid == 0 && TMath::Abs(track.tpcNSigmaPr()) > ConfDaughPIDCuts) { + return false; + } + if (pid == 1 && TMath::Abs(track.tpcNSigmaPi()) > ConfDaughPIDCuts) { + return false; + } + // for misidentification + if (rejectmisident) { + if (pid == 0 && TMath::Abs(track.tpcNSigmaPi()) < 3.0) { + return false; + } + if (pid == 1 && TMath::Abs(track.tpcNSigmaPr()) < 3.0) { + return false; + } + } + } + + if (pid == 0 && pt < cfgDaughPrPt) { return false; } - if (pid == 1 && TMath::Abs(track.tpcNSigmaPi()) > ConfDaughPIDCuts) { + if (pid == 1 && pt < cfgDaughPiPt) { return false; } @@ -305,10 +469,10 @@ struct lambdapolsp { return result; } - ROOT::Math::PxPyPzMVector Lambda, Proton, Pion, fourVecDauCM; + ROOT::Math::PxPyPzMVector Lambda, Lambdacopy, Proton, Pion, fourVecDauCM; // ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY, eventplaneVec, eventplaneVecNorm, beamvector; ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY; - float phiangle = 0.0; + double phiangle = 0.0; // double massPi = TDatabasePDG::Instance()->GetParticle(kPiPlus)->Mass(); // double massPr = TDatabasePDG::Instance()->GetParticle(kProton)->Mass(); // double massLambda = TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass(); @@ -323,7 +487,7 @@ struct lambdapolsp { using EventCandidates = soa::Filtered>; // using AllTrackCandidates = soa::Join; - using AllTrackCandidates = soa::Filtered>; + using AllTrackCandidates = soa::Filtered>; using ResoV0s = aod::V0Datas; // void processData(EventCandidates::iterator const& collision, AllTrackCandidates const&, ResoV0s const& V0s, aod::BCs const&) @@ -334,24 +498,21 @@ struct lambdapolsp { return; } auto centrality = collision.centFT0C(); - - histos.fill(HIST("hCentrality0"), centrality); - if (!collision.triggerevent()) { + // histos.fill(HIST("hCentrality0"), centrality); + if (!collision.triggereventsp()) { return; } - histos.fill(HIST("hCentrality1"), centrality); + // histos.fill(HIST("hCentrality1"), centrality); if (additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { return; } - histos.fill(HIST("hCentrality2"), centrality); - /*if (additionalEvSel2 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - return; - }*/ + // histos.fill(HIST("hCentrality2"), centrality); + // if (additionalEvSel2 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { if (additionalEvSel2 && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) { return; } - histos.fill(HIST("hCentrality3"), centrality); + // histos.fill(HIST("hCentrality3"), centrality); if (additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { return; } @@ -364,30 +525,41 @@ struct lambdapolsp { auto psiZDCA = collision.psiZDCA(); histos.fill(HIST("hCentrality"), centrality); - histos.fill(HIST("hVtxZ"), collision.posZ()); - histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); if (!checkwithpub) { - histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); - histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); - histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); - histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA)))); - histos.fill(HIST("hpSinPsiC"), centrality, (TMath::Sin(GetPhiInRange(psiZDCC)))); + // histos.fill(HIST("hVtxZ"), collision.posZ()); + histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); + if (QA) { + histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); + histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); + histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); + histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA)))); + histos.fill(HIST("hpSinPsiC"), centrality, (TMath::Sin(GetPhiInRange(psiZDCC)))); + /*histos.fill(HIST("hcentQxZDCA"), centrality, qxZDCA); + histos.fill(HIST("hcentQyZDCA"), centrality, qyZDCA); + histos.fill(HIST("hcentQxZDCC"), centrality, qxZDCC); + histos.fill(HIST("hcentQyZDCC"), centrality, qyZDCC);*/ + } } - histos.fill(HIST("hcentQxZDCA"), centrality, qxZDCA); - histos.fill(HIST("hcentQyZDCA"), centrality, qyZDCA); - histos.fill(HIST("hcentQxZDCC"), centrality, qxZDCC); - histos.fill(HIST("hcentQyZDCC"), centrality, qyZDCC); - ///////////checking v1 and v2//////////////////////////////// + ///////////checking v1//////////////////////////////// if (checkwithpub) { auto QxtQxp = qxZDCA * qxZDCC; auto QytQyp = qyZDCA * qyZDCC; auto Qxytp = QxtQxp + QytQyp; + auto QxpQyt = qxZDCA * qyZDCC; + auto QxtQyp = qxZDCC * qyZDCA; histos.fill(HIST("hpQxtQxpvscent"), centrality, QxtQxp); histos.fill(HIST("hpQytQypvscent"), centrality, QytQyp); histos.fill(HIST("hpQxytpvscent"), centrality, Qxytp); + histos.fill(HIST("hpQxpQytvscent"), centrality, QxpQyt); + histos.fill(HIST("hpQxtQypvscent"), centrality, QxtQyp); + + histos.fill(HIST("hpQxpvscent"), centrality, qxZDCA); + histos.fill(HIST("hpQxtvscent"), centrality, qxZDCC); + histos.fill(HIST("hpQypvscent"), centrality, qyZDCA); + histos.fill(HIST("hpQytvscent"), centrality, qyZDCC); for (auto track : tracks) { if (!selectionTrack(track)) { @@ -398,9 +570,6 @@ struct lambdapolsp { if (sign == 0.0) // removing neutral particles continue; - // histos.fill(HIST("hDiff"), track.pt(), (track.p() - track.tpcInnerParam())); - // LOG(info) << "Diff values:\t" << (track.p() - track.tpcInnerParam()); - auto ux = TMath::Cos(GetPhiInRange(track.phi())); auto uy = TMath::Sin(GetPhiInRange(track.phi())); @@ -410,6 +579,8 @@ struct lambdapolsp { auto uxQxt = ux * qxZDCC; auto uyQyt = uy * qyZDCC; auto uxyQxyt = uxQxt + uyQyt; + auto oddv1 = ux * (qxZDCA - qxZDCC) + uy * (qyZDCA - qyZDCC); + auto evenv1 = ux * (qxZDCA + qxZDCC) + uy * (qyZDCA + qyZDCC); if (tofhit) { if (track.hasTOF()) { @@ -419,35 +590,70 @@ struct lambdapolsp { histos.fill(HIST("hpuxQxtvscentpteta"), centrality, track.pt(), track.eta(), uxQxt); histos.fill(HIST("hpuyQytvscentpteta"), centrality, track.pt(), track.eta(), uyQyt); + histos.fill(HIST("hpuxvscentpteta"), centrality, track.pt(), track.eta(), ux); + histos.fill(HIST("hpuyvscentpteta"), centrality, track.pt(), track.eta(), uy); + histos.fill(HIST("hpuxyQxytvscentpteta"), centrality, track.pt(), track.eta(), uxyQxyt); histos.fill(HIST("hpuxyQxypvscentpteta"), centrality, track.pt(), track.eta(), uxyQxyp); + histos.fill(HIST("hpoddv1vscentpteta"), centrality, track.pt(), track.eta(), oddv1); + histos.fill(HIST("hpevenv1vscentpteta"), centrality, track.pt(), track.eta(), evenv1); } else { histos.fill(HIST("hpuxQxpvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uxQxp); histos.fill(HIST("hpuyQypvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uyQyp); histos.fill(HIST("hpuxQxtvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uxQxt); histos.fill(HIST("hpuyQytvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uyQyt); + histos.fill(HIST("hpuxvscentpteta"), centrality, track.pt(), track.eta(), ux); + histos.fill(HIST("hpuyvscentpteta"), centrality, track.pt(), track.eta(), uy); + histos.fill(HIST("hpuxyQxytvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uxyQxyt); histos.fill(HIST("hpuxyQxypvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uxyQxyp); + histos.fill(HIST("hpoddv1vscentpteta"), centrality, track.pt(), track.eta(), oddv1); + histos.fill(HIST("hpevenv1vscentpteta"), centrality, track.pt(), track.eta(), evenv1); } } } else { if (globalpt) { - histos.fill(HIST("hpuxQxpvscentpteta"), centrality, track.pt(), track.eta(), uxQxp); - histos.fill(HIST("hpuyQypvscentpteta"), centrality, track.pt(), track.eta(), uyQyp); - histos.fill(HIST("hpuxQxtvscentpteta"), centrality, track.pt(), track.eta(), uxQxt); - histos.fill(HIST("hpuyQytvscentpteta"), centrality, track.pt(), track.eta(), uyQyt); + if (sign > 0) { + histos.fill(HIST("hpuxQxpvscentpteta"), centrality, track.pt(), track.eta(), uxQxp); + histos.fill(HIST("hpuyQypvscentpteta"), centrality, track.pt(), track.eta(), uyQyp); + histos.fill(HIST("hpuxQxtvscentpteta"), centrality, track.pt(), track.eta(), uxQxt); + histos.fill(HIST("hpuyQytvscentpteta"), centrality, track.pt(), track.eta(), uyQyt); - histos.fill(HIST("hpuxyQxytvscentpteta"), centrality, track.pt(), track.eta(), uxyQxyt); - histos.fill(HIST("hpuxyQxypvscentpteta"), centrality, track.pt(), track.eta(), uxyQxyp); + histos.fill(HIST("hpuxvscentpteta"), centrality, track.pt(), track.eta(), ux); + histos.fill(HIST("hpuyvscentpteta"), centrality, track.pt(), track.eta(), uy); + + histos.fill(HIST("hpuxyQxytvscentpteta"), centrality, track.pt(), track.eta(), uxyQxyt); + histos.fill(HIST("hpuxyQxypvscentpteta"), centrality, track.pt(), track.eta(), uxyQxyp); + histos.fill(HIST("hpoddv1vscentpteta"), centrality, track.pt(), track.eta(), oddv1); + histos.fill(HIST("hpevenv1vscentpteta"), centrality, track.pt(), track.eta(), evenv1); + } else { + histos.fill(HIST("hpuxQxpvscentptetaneg"), centrality, track.pt(), track.eta(), uxQxp); + histos.fill(HIST("hpuyQypvscentptetaneg"), centrality, track.pt(), track.eta(), uyQyp); + histos.fill(HIST("hpuxQxtvscentptetaneg"), centrality, track.pt(), track.eta(), uxQxt); + histos.fill(HIST("hpuyQytvscentptetaneg"), centrality, track.pt(), track.eta(), uyQyt); + + histos.fill(HIST("hpuxvscentptetaneg"), centrality, track.pt(), track.eta(), ux); + histos.fill(HIST("hpuyvscentptetaneg"), centrality, track.pt(), track.eta(), uy); + + histos.fill(HIST("hpuxyQxytvscentptetaneg"), centrality, track.pt(), track.eta(), uxyQxyt); + histos.fill(HIST("hpuxyQxypvscentptetaneg"), centrality, track.pt(), track.eta(), uxyQxyp); + histos.fill(HIST("hpoddv1vscentptetaneg"), centrality, track.pt(), track.eta(), oddv1); + histos.fill(HIST("hpevenv1vscentptetaneg"), centrality, track.pt(), track.eta(), evenv1); + } } else { histos.fill(HIST("hpuxQxpvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uxQxp); histos.fill(HIST("hpuyQypvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uyQyp); histos.fill(HIST("hpuxQxtvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uxQxt); histos.fill(HIST("hpuyQytvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uyQyt); + histos.fill(HIST("hpuxvscentpteta"), centrality, track.pt(), track.eta(), ux); + histos.fill(HIST("hpuyvscentpteta"), centrality, track.pt(), track.eta(), uy); + histos.fill(HIST("hpuxyQxytvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uxyQxyt); histos.fill(HIST("hpuxyQxypvscentpteta"), centrality, track.tpcInnerParam(), track.eta(), uxyQxyp); + histos.fill(HIST("hpoddv1vscentpteta"), centrality, track.pt(), track.eta(), oddv1); + histos.fill(HIST("hpevenv1vscentpteta"), centrality, track.pt(), track.eta(), evenv1); } } } @@ -460,6 +666,15 @@ struct lambdapolsp { int LambdaTag = 0; int aLambdaTag = 0; + const auto signpos = postrack.sign(); + const auto signneg = negtrack.sign(); + + if (checksign) { + if (signpos < 0 || signneg > 0) { + continue; + } + } + if (isSelectedV0Daughter(postrack, 0) && isSelectedV0Daughter(negtrack, 1)) { LambdaTag = 1; } @@ -483,6 +698,7 @@ struct lambdapolsp { Pion = ROOT::Math::PxPyPzMVector(postrack.px(), postrack.py(), postrack.pz(), massPi); } Lambda = Proton + Pion; + Lambdacopy = Proton + Pion; Lambda.SetM(massLambda); ROOT::Math::Boost boost{Lambda.BoostToCM()}; @@ -492,36 +708,68 @@ struct lambdapolsp { // eventplaneVec = ROOT::Math::XYZVector(collision.qFT0C(), collision.qFT0A(), 0); //this needs to be changed // eventplaneVecNorm = eventplaneVec.Cross(beamvector); //z' phiangle = TMath::ATan2(fourVecDauCM.Py(), fourVecDauCM.Px()); + // double phiangledir = fourVecDauCM.Phi(); auto phiminuspsiC = GetPhiInRange(phiangle - psiZDCC); auto phiminuspsiA = GetPhiInRange(phiangle - psiZDCA); + // histos.fill(HIST("hpsiApsiC"), psiZDCA, psiZDCC); + // histos.fill(HIST("hpsiApsiC"), GetPhiInRange(GetPhiInRange(phiangle) - GetPhiInRange(psiZDCA)), phiminuspsiA); + // histos.fill(HIST("hphiminuspsiA"), (phiminuspsiA)); + // histos.fill(HIST("hphiminuspsiC"), (phiminuspsiC)); // auto cosThetaStar = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); auto cosThetaStar = fourVecDauCM.Pz() / fourVecDauCM.P(); // A0 correction + auto sinThetaStar = TMath::Sqrt(1 - (cosThetaStar * cosThetaStar)); auto PolC = TMath::Sin(phiminuspsiC); auto PolA = TMath::Sin(phiminuspsiA); // needed for corrections auto sinPhiStar = TMath::Sin(GetPhiInRange(phiangle)); auto cosPhiStar = TMath::Cos(GetPhiInRange(phiangle)); - // auto sinThetaStarcosphiphiStar=sinThetaStar*TMath::Cos(2* GetPhiInRange((Lambda.Phi()-phiangle))); //A2 correction + auto sinThetaStarcosphiphiStar = sinThetaStar * TMath::Cos(2 * GetPhiInRange(Lambda.Phi() - phiangle)); // A2 correction + auto phiphiStar = GetPhiInRange(Lambda.Phi() - phiangle); + + auto candmass = 0.0; + auto candpt = 0.0; + auto candeta = 0.0; if (LambdaTag) { - if (correction) { - histos.fill(HIST("hSparseLambdaPolA_corr"), v0.mLambda(), v0.pt(), cosThetaStar, sinPhiStar, cosPhiStar, PolA, centrality); - histos.fill(HIST("hSparseLambdaPolC_corr"), v0.mLambda(), v0.pt(), cosThetaStar, sinPhiStar, cosPhiStar, PolC, centrality); + if (usefourvectormass) { + candmass = Lambdacopy.M(); + candpt = Lambdacopy.Pt(); + candeta = Lambdacopy.Eta(); } else { - histos.fill(HIST("hSparseLambdaPolA"), v0.mLambda(), v0.pt(), PolA, centrality); - histos.fill(HIST("hSparseLambdaPolC"), v0.mLambda(), v0.pt(), PolC, centrality); + candmass = v0.mLambda(); + candpt = v0.pt(); + candeta = v0.eta(); } + + histos.fill(HIST("hSparseLambdaPolA"), candmass, candpt, candeta, PolA, centrality); + histos.fill(HIST("hSparseLambdaPolC"), candmass, candpt, candeta, PolC, centrality); + histos.fill(HIST("hSparseLambda_corr1a"), candmass, candpt, candeta, sinPhiStar, centrality); + histos.fill(HIST("hSparseLambda_corr1b"), candmass, candpt, candeta, cosPhiStar, centrality); + histos.fill(HIST("hSparseLambda_corr1c"), candmass, candpt, candeta, phiphiStar, centrality); + histos.fill(HIST("hSparseLambda_corr2a"), candmass, candpt, candeta, sinThetaStar, centrality); + histos.fill(HIST("hSparseLambda_corr2b"), candmass, candpt, candeta, sinThetaStarcosphiphiStar, centrality); } + if (aLambdaTag) { - if (correction) { - histos.fill(HIST("hSparseAntiLambdaPolA_corr"), v0.mAntiLambda(), v0.pt(), cosThetaStar, sinPhiStar, cosPhiStar, PolA, centrality); - histos.fill(HIST("hSparseAntiLambdaPolC_corr"), v0.mAntiLambda(), v0.pt(), cosThetaStar, sinPhiStar, cosPhiStar, PolC, centrality); + if (usefourvectormass) { + candmass = Lambdacopy.M(); + candpt = Lambdacopy.Pt(); + candeta = Lambdacopy.Eta(); } else { - histos.fill(HIST("hSparseAntiLambdaPolA"), v0.mAntiLambda(), v0.pt(), PolA, centrality); - histos.fill(HIST("hSparseAntiLambdaPolC"), v0.mAntiLambda(), v0.pt(), PolC, centrality); + candmass = v0.mAntiLambda(); + candpt = v0.pt(); + candeta = v0.eta(); } + + histos.fill(HIST("hSparseAntiLambdaPolA"), candmass, candpt, candeta, PolA, centrality); + histos.fill(HIST("hSparseAntiLambdaPolC"), candmass, candpt, candeta, PolC, centrality); + histos.fill(HIST("hSparseAntiLambda_corr1a"), candmass, candpt, candeta, sinPhiStar, centrality); + histos.fill(HIST("hSparseAntiLambda_corr1b"), candmass, candpt, candeta, cosPhiStar, centrality); + histos.fill(HIST("hSparseAntiLambda_corr1c"), candmass, candpt, candeta, phiphiStar, centrality); + histos.fill(HIST("hSparseAntiLambda_corr2a"), candmass, candpt, candeta, sinThetaStar, centrality); + histos.fill(HIST("hSparseAntiLambda_corr2b"), candmass, candpt, candeta, sinThetaStarcosphiphiStar, centrality); } } } diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index 23255229a5f..45e7e635847 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -9,6 +9,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include +#include +#include +#include +#include + #include "CCDB/BasicCCDBManager.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" @@ -42,10 +48,13 @@ struct NPCascCandidate { int64_t trackITSID; int64_t collisionID; float matchingChi2; + float deltaPt; float itsClusSize; + bool hasReassociatedCluster; bool isGoodMatch; bool isGoodCascade; int pdgCodeMom; + int pdgCodeITStrack; bool isFromBeauty; bool isFromCharm; float pvX; @@ -286,7 +295,7 @@ struct NonPromptCascadeTask { if (o2::base::Propagator::Instance()->propagateToDCA(primaryVertex, trackCovTrk, bz, 2.f, matCorr, &impactParameterTrk)) { if (protonTrack.hasTPC() && pionTrack.hasTPC()) { if (isOmega) { - registry.fill(HIST("h_dca_Omega"), TMath::Sqrt(impactParameterTrk.getR2())); + registry.fill(HIST("h_dca_Omega"), std::sqrt(impactParameterTrk.getR2())); registry.fill(HIST("h_dcaxy_Omega"), impactParameterTrk.getY()); registry.fill(HIST("h_dcaz_Omega"), impactParameterTrk.getZ()); registry.fill(HIST("h_dcavspt_Omega"), impactParameterTrk.getY(), track.pt()); @@ -295,7 +304,7 @@ struct NonPromptCascadeTask { } if (protonTrack.hasTPC() && pionTrack.hasTPC()) { - registry.fill(HIST("h_dca_Xi"), TMath::Sqrt(impactParameterTrk.getR2())); + registry.fill(HIST("h_dca_Xi"), std::sqrt(impactParameterTrk.getR2())); registry.fill(HIST("h_dcaxy_Xi"), impactParameterTrk.getY()); registry.fill(HIST("h_dcaz_Xi"), impactParameterTrk.getZ()); registry.fill(HIST("h_dcavspt_Xi"), impactParameterTrk.getY(), track.pt()); @@ -389,7 +398,7 @@ struct NonPromptCascadeTask { mom = grandma; } } - return {fromCharm, fromBeauty}; + return {fromBeauty, fromCharm}; }; for (const auto& trackedCascade : trackedCascades) { @@ -426,6 +435,7 @@ struct NonPromptCascadeTask { o2::track::TrackParCov trackParCovV0; o2::track::TrackPar trackParV0; o2::track::TrackPar trackParBachelor; + std::array cascadeMomentum; float cascCpa = -1; float v0Cpa = -1; @@ -440,10 +450,9 @@ struct NonPromptCascadeTask { trackParBachelor = df2.getTrackParamAtPCA(1); trackParV0.getPxPyPzGlo(momenta[0]); // getting the V0 momentum trackParBachelor.getPxPyPzGlo(momenta[1]); // getting the bachelor momentum - std::array pVec; - df2.createParentTrackParCov().getPxPyPzGlo(pVec); + df2.createParentTrackParCov().getPxPyPzGlo(cascadeMomentum); std::array pvPos = {primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}; - cascCpa = RecoDecay::cpa(pvPos, df2.getPCACandidate(), pVec); + cascCpa = RecoDecay::cpa(pvPos, df2.getPCACandidate(), cascadeMomentum); v0Cpa = RecoDecay::cpa(pvPos, df2.getPCACandidate(), momenta[0]); } else { continue; @@ -592,8 +601,10 @@ struct NonPromptCascadeTask { fromHF = isFromHF(track.mcParticle()); pdgCodeMom = track.mcParticle().has_mothers() ? track.mcParticle().mothers_as()[0].pdgCode() : 0; } - - candidates.emplace_back(NPCascCandidate{track.globalIndex(), ITStrack.globalIndex(), trackedCascade.collisionId(), trackedCascade.matchingChi2(), trackedCascade.itsClsSize(), isGoodMatch, isGoodCascade, pdgCodeMom, std::get<0>(fromHF), std::get<1>(fromHF), + int itsTrackPDG = ITStrack.has_mcParticle() ? ITStrack.mcParticle().pdgCode() : 0; + float deltaPtITSCascade = std::hypot(cascadeMomentum[0], cascadeMomentum[1]) - ITStrack.pt(); + bool hasReassociatedClusters = (track.itsNCls() != ITStrack.itsNCls()); + candidates.emplace_back(NPCascCandidate{track.globalIndex(), ITStrack.globalIndex(), trackedCascade.collisionId(), trackedCascade.matchingChi2(), deltaPtITSCascade, trackedCascade.itsClsSize(), hasReassociatedClusters, isGoodMatch, isGoodCascade, pdgCodeMom, itsTrackPDG, std::get<0>(fromHF), std::get<1>(fromHF), primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), track.pt(), track.eta(), track.phi(), protonTrack.pt(), protonTrack.eta(), pionTrack.pt(), pionTrack.eta(), bachelor.pt(), bachelor.eta(), @@ -622,7 +633,7 @@ struct NonPromptCascadeTask { auto mcCollision = particle.mcCollision_as(); auto label = collisions.iteratorAt(c.collisionID); - NPCTableMC(c.matchingChi2, c.itsClusSize, c.isGoodMatch, c.isGoodCascade, c.pdgCodeMom, c.isFromBeauty, c.isFromCharm, + NPCTableMC(c.matchingChi2, c.deltaPt, c.itsClusSize, c.hasReassociatedCluster, c.isGoodMatch, c.isGoodCascade, c.pdgCodeMom, c.pdgCodeITStrack, c.isFromBeauty, c.isFromCharm, c.pvX, c.pvY, c.pvZ, c.cascPt, c.cascEta, c.cascPhi, c.protonPt, c.protonEta, c.pionPt, c.pionEta, c.bachPt, c.bachEta, @@ -684,6 +695,7 @@ struct NonPromptCascadeTask { const auto& ntrack = v0.negTrack_as(); const auto& protonTrack = bachelor.sign() > 0 ? ntrack : ptrack; const auto& pionTrack = bachelor.sign() > 0 ? ptrack : ntrack; + bool hasReassociatedClusters = (track.itsNCls() != ITStrack.itsNCls()); std::array, 2> momenta; std::array masses; @@ -692,6 +704,7 @@ struct NonPromptCascadeTask { o2::track::TrackParCov trackParCovV0; o2::track::TrackPar trackParV0; o2::track::TrackPar trackParBachelor; + std::array cascadeMomentum; float cascCpa = -1; float v0Cpa = -1; @@ -706,10 +719,9 @@ struct NonPromptCascadeTask { trackParBachelor = df2.getTrackParamAtPCA(1); trackParV0.getPxPyPzGlo(momenta[0]); // getting the V0 momentum trackParBachelor.getPxPyPzGlo(momenta[1]); // getting the bachelor momentum - std::array pVec; - df2.createParentTrackParCov().getPxPyPzGlo(pVec); + df2.createParentTrackParCov().getPxPyPzGlo(cascadeMomentum); std::array pvPos = {primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}; - cascCpa = RecoDecay::cpa(pvPos, df2.getPCACandidate(), pVec); + cascCpa = RecoDecay::cpa(pvPos, df2.getPCACandidate(), cascadeMomentum); v0Cpa = RecoDecay::cpa(pvPos, df2.getPCACandidate(), momenta[0]); } else { continue; @@ -717,6 +729,7 @@ struct NonPromptCascadeTask { } else { continue; } + float deltaPtITSCascade = std::hypot(cascadeMomentum[0], cascadeMomentum[1]) - ITStrack.pt(); // PV registry.fill(HIST("h_PV_x"), primaryVertex.getX()); @@ -738,7 +751,7 @@ struct NonPromptCascadeTask { const auto v0mass = RecoDecay::m(momenta, masses); ////Omega hypohesis -> rejecting Xi - if (TMath::Abs(massXi - constants::physics::MassXiMinus) > 0.005) { + if (std::abs(massXi - constants::physics::MassXiMinus) > 0.005) { isOmega = true; invMassBCOmega->Fill(massOmega); } @@ -842,7 +855,7 @@ struct NonPromptCascadeTask { daughtersDCA dDCA; fillDauDCA(trackedCascade, bachelor, protonTrack, pionTrack, primaryVertex, isOmega, dDCA); - candidates.emplace_back(NPCascCandidate{track.globalIndex(), ITStrack.globalIndex(), trackedCascade.collisionId(), trackedCascade.matchingChi2(), trackedCascade.itsClsSize(), 0, 0, 0, 0, 0, + candidates.emplace_back(NPCascCandidate{track.globalIndex(), ITStrack.globalIndex(), trackedCascade.collisionId(), trackedCascade.matchingChi2(), deltaPtITSCascade, trackedCascade.itsClsSize(), hasReassociatedClusters, 0, 0, 0, 0, 0, 0, primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), track.pt(), track.eta(), track.phi(), protonTrack.pt(), protonTrack.eta(), pionTrack.pt(), pionTrack.eta(), bachelor.pt(), bachelor.eta(), @@ -858,7 +871,7 @@ struct NonPromptCascadeTask { for (auto& c : candidates) { - NPCTable(c.matchingChi2, c.itsClusSize, + NPCTable(c.matchingChi2, c.deltaPt, c.itsClusSize, c.hasReassociatedCluster, c.pvX, c.pvY, c.pvZ, c.cascPt, c.cascEta, c.cascPhi, c.protonPt, c.protonEta, c.pionPt, c.pionEta, c.bachPt, c.bachEta, diff --git a/PWGLF/Tasks/Strangeness/phik0sanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0sanalysis.cxx index 34ad920e561..11ef94f75ce 100644 --- a/PWGLF/Tasks/Strangeness/phik0sanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0sanalysis.cxx @@ -24,9 +24,9 @@ #include #include #include +#include #include #include -#include #include #include "Framework/runDataProcessing.h" @@ -52,54 +52,6 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -namespace -{ -static constexpr int nMultBin = 10; -static constexpr int nPtBinK0S = 4; -static constexpr int nPtBinPi = 3; - -constexpr float flowmPhiInc[nMultBin] = {1.01074f, 1.01073f, 1.01072f, 1.01074f, 1.01075f, 1.01074f, 1.01075f, 1.01074f, 1.01073f, 1.01074f}; -constexpr float fupmPhiInc[nMultBin] = {1.02778f, 1.02777f, 1.02776f, 1.02778f, 1.02779f, 1.02778f, 1.02779f, 1.02778f, 1.02777f, 1.02778f}; - -constexpr float flowmPhiFCut[nMultBin] = {1.01072f, 1.01073f, 1.01072f, 1.01074f, 1.01075f, 1.01076f, 1.01076f, 1.01076f, 1.01075f, 1.01073f}; -constexpr float fupmPhiFCut[nMultBin] = {1.02776f, 1.02777f, 1.02776f, 1.02778f, 1.02779f, 1.02778f, 1.02778f, 1.02778f, 1.02779f, 1.02777f}; - -constexpr float flowmPhiSCut[nMultBin] = {1.01072f, 1.01074f, 1.01070f, 1.01076f, 1.01075f, 1.01077f, 1.01075f, 1.01075f, 1.01076f, 1.01077f}; -constexpr float fupmPhiSCut[nMultBin] = {1.02776f, 1.02778f, 1.02774f, 1.02780f, 1.02779f, 1.02781f, 1.02779f, 1.02779f, 1.02780f, 1.02774f}; - -static constexpr float multBin[nMultBin + 1] = {0.0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 70.0, 100.0}; -static constexpr float pTBinK0S[nPtBinK0S + 1] = {0.0, 0.5, 0.8, 1.2, 10.0}; -static constexpr float pTBinPi[nPtBinPi + 1] = {0.0, 0.5, 1.2, 10.0}; - -static constexpr std::string_view PhiK0SSEInc[nMultBin] = {"h2PhiK0SSEInc_0_1", "h2PhiK0SSEInc_1_5", "h2PhiK0SSEInc_5_10", "h2PhiK0SSEInc_10_15", "h2PhiK0SSEInc_15_20", - "h2PhiK0SSEInc_20_30", "h2PhiK0SSEInc_30_40", "h2PhiK0SSEInc_40_50", "h2PhiK0SSEInc_50_70", "h2PhiK0SSEInc_70_100"}; -static constexpr std::string_view PhiK0SSEFCut[nMultBin] = {"h2PhiK0SSEFCut_0_1", "h2PhiK0SSEFCut_1_5", "h2PhiK0SSEFCut_5_10", "h2PhiK0SSEFCut_10_15", "h2PhiK0SSEFCut_15_20", - "h2PhiK0SSEFCut_20_30", "h2PhiK0SSEFCut_30_40", "h2PhiK0SSEFCut_40_50", "h2PhiK0SSEFCut_50_70", "h2PhiK0SSEFCut_70_100"}; -static constexpr std::string_view PhiK0SSESCut[nMultBin] = {"h2PhiK0SSESCut_0_1", "h2PhiK0SSESCut_1_5", "h2PhiK0SSESCut_5_10", "h2PhiK0SSESCut_10_15", "h2PhiK0SSESCut_15_20", - "h2PhiK0SSESCut_20_30", "h2PhiK0SSESCut_30_40", "h2PhiK0SSESCut_40_50", "h2PhiK0SSESCut_50_70", "h2PhiK0SSESCut_70_100"}; - -static constexpr std::string_view PhiPiSEInc[nMultBin] = {"h2PhiPiSEInc_0_1", "h2PhiPiSEInc_1_5", "h2PhiPiSEInc_5_10", "h2PhiPiSEInc_10_15", "h2PhiPiSEInc_15_20", - "h2PhiPiSEInc_20_30", "h2PhiPiSEInc_30_40", "h2PhiPiSEInc_40_50", "h2PhiPiSEInc_50_70", "h2PhiPiSEInc_70_100"}; -static constexpr std::string_view PhiPiSEFCut[nMultBin] = {"h2PhiPiSEFCut_0_1", "h2PhiPiSEFCut_1_5", "h2PhiPiSEFCut_5_10", "h2PhiPiSEFCut_10_15", "h2PhiPiSEFCut_15_20", - "h2PhiPiSEFCut_20_30", "h2PhiPiSEFCut_30_40", "h2PhiPiSEFCut_40_50", "h2PhiPiSEFCut_50_70", "h2PhiPiSEFCut_70_100"}; -static constexpr std::string_view PhiPiSESCut[nMultBin] = {"h2PhiPiSESCut_0_1", "h2PhiPiSESCut_1_5", "h2PhiPiSESCut_5_10", "h2PhiPiSESCut_10_15", "h2PhiPiSESCut_15_20", - "h2PhiPiSESCut_20_30", "h2PhiPiSESCut_30_40", "h2PhiPiSESCut_40_50", "h2PhiPiSESCut_50_70", "h2PhiPiSESCut_70_100"}; - -static constexpr std::string_view MCPhiK0SSEInc[nMultBin] = {"h2RecMCPhiK0SSEInc_0_1", "h2RecMCPhiK0SSEInc_1_5", "h2RecMCPhiK0SSEInc_5_10", "h2RecMCPhiK0SSEInc_10_15", "h2RecMCPhiK0SSEInc_15_20", - "h2RecMCPhiK0SSEInc_20_30", "h2RecMCPhiK0SSEInc_30_40", "h2RecMCPhiK0SSEInc_40_50", "h2RecMCPhiK0SSEInc_50_70", "h2RecMCPhiK0SSEInc_70_100"}; -static constexpr std::string_view MCPhiK0SSEFCut[nMultBin] = {"h2RecMCPhiK0SSEFCut_0_1", "h2RecMCPhiK0SSEFCut_1_5", "h2RecMCPhiK0SSEFCut_5_10", "h2RecMCPhiK0SSEFCut_10_15", "h2RecMCPhiK0SSEFCut_15_20", - "h2RecMCPhiK0SSEFCut_20_30", "h2RecMCPhiK0SSEFCut_30_40", "h2RecMCPhiK0SSEFCut_40_50", "h2RecMCPhiK0SSEFCut_50_70", "h2RecMCPhiK0SSEFCut_70_100"}; -static constexpr std::string_view MCPhiK0SSESCut[nMultBin] = {"h2RecMCPhiK0SSESCut_0_1", "h2RecMCPhiK0SSESCut_1_5", "h2RecMCPhiK0SSESCut_5_10", "h2RecMCPhiK0SSESCut_10_15", "h2RecMCPhiK0SSESCut_15_20", - "h2RecMCPhiK0SSESCut_20_30", "h2RecMCPhiK0SSESCut_30_40", "h2RecMCPhiK0SSESCut_40_50", "h2RecMCPhiK0SSESCut_50_70", "h2RecMCPhiK0SSESCut_70_100"}; - -static constexpr std::string_view MCPhiPiSEInc[nMultBin] = {"h2RecMCPhiPiSEInc_0_1", "h2RecMCPhiPiSEInc_1_5", "h2RecMCPhiPiSEInc_5_10", "h2RecMCPhiPiSEInc_10_15", "h2RecMCPhiPiSEInc_15_20", - "h2RecMCPhiPiSEInc_20_30", "h2RecMCPhiPiSEInc_30_40", "h2RecMCPhiPiSEInc_40_50", "h2RecMCPhiPiSEInc_50_70", "h2RecMCPhiPiSEInc_70_100"}; -static constexpr std::string_view MCPhiPiSEFCut[nMultBin] = {"h2RecMCPhiPiSEFCut_0_1", "h2RecMCPhiPiSEFCut_1_5", "h2RecMCPhiPiSEFCut_5_10", "h2RecMCPhiPiSEFCut_10_15", "h2RecMCPhiPiSEFCut_15_20", - "h2RecMCPhiPiSEFCut_20_30", "h2RecMCPhiPiSEFCut_30_40", "h2RecMCPhiPiSEFCut_40_50", "h2RecMCPhiPiSEFCut_50_70", "h2RecMCPhiPiSEFCut_70_100"}; -static constexpr std::string_view MCPhiPiSESCut[nMultBin] = {"h2RecMCPhiPiSESCut_0_1", "h2RecMCPhiPiSESCut_1_5", "h2RecMCPhiPiSESCut_5_10", "h2RecMCPhiPiSESCut_10_15", "h2RecMCPhiPiSESCut_15_20", - "h2RecMCPhiPiSESCut_20_30", "h2RecMCPhiPiSESCut_30_40", "h2RecMCPhiPiSESCut_40_50", "h2RecMCPhiPiSESCut_50_70", "h2RecMCPhiPiSESCut_70_100"}; -} // namespace - struct phik0shortanalysis { // Histograms are defined with HistogramRegistry HistogramRegistry eventHist{"eventHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -116,13 +68,18 @@ struct phik0shortanalysis { HistogramRegistry K0SeffHist{"K0SeffHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry PioneffHist{"PioneffHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry yaccHist{"yaccHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry closureMCPhiK0SHist{"closureMCPhiK0SHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry closureMCPhiPionHist{"closureMCPhiPionHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Configurable for event selection Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + // Configurable on multiplicity bins + Configurable> binsMult{"binsMult", {0.0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 70.0, 100.0}, "Multiplicity bin limits"}; + // Configurables for V0 selection - Configurable minTPCnClsFound{"minTPCnClsFound", 80.0f, "min number of found TPC clusters"}; - Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 80.0f, "min number of TPC crossed rows"}; + Configurable minTPCnClsFound{"minTPCnClsFound", 70, "min number of found TPC clusters"}; + Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 80, "min number of TPC crossed rows"}; Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; Configurable etaMax{"etaMax", 0.8f, "eta max"}; @@ -137,60 +94,48 @@ struct phik0shortanalysis { Configurable lowmK0S{"lowmK0S", 0.48, "Lower limit on K0Short mass"}; Configurable upmK0S{"upmK0S", 0.52, "Upper limit on K0Short mass"}; - // Configurable on K0S pT - Configurable> binspTK0S{"binspTK0S", std::vector{pTBinK0S, pTBinK0S + nPtBinK0S + 1}, "pT bin limits for K0S"}; + // Configurable on K0S pT bins + Configurable> binspTK0S{"binspTK0S", {0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pT bin limits for K0S"}; // Configurables on Phi mass - Configurable nBins{"nBins", 15, "N bins in cfgPhimassaxis"}; - Configurable> lowmPhiInc{"lowmPhiInc", std::vector{flowmPhiInc, flowmPhiInc + nMultBin}, "Lower limits on Phi mass Inclusive"}; - Configurable> upmPhiInc{"upmPhiInc", std::vector{fupmPhiInc, fupmPhiInc + nMultBin}, "Upper limits on Phi mass Inclusive"}; - Configurable> lowmPhiFCut{"lowmPhiFCut", std::vector{flowmPhiFCut, flowmPhiFCut + nMultBin}, "Lower limits on Phi mass First Cut"}; - Configurable> upmPhiFCut{"upmPhiFCut", std::vector{fupmPhiFCut, fupmPhiFCut + nMultBin}, "Upper limits on Phi mass First Cut"}; - Configurable> lowmPhiSCut{"lowmPhiSCut", std::vector{flowmPhiSCut, flowmPhiSCut + nMultBin}, "Lower limits on Phi mass Second Cut"}; - Configurable> upmPhiSCut{"upmPhiSCut", std::vector{fupmPhiSCut, fupmPhiSCut + nMultBin}, "Upper limits on Phi mass Second Cut"}; - Configurable lowmPhiMB{"lowmPhiMB", 1.01074f, "Upper limits on Phi mass Minimum Bias"}; - Configurable upmPhiMB{"upmPhiMB", 1.02778f, "Upper limits on Phi mass Minimum Bias"}; + Configurable nBins{"nBins", 14, "N bins in cfgPhimassaxis"}; + Configurable lowmPhi{"lowmPhiMB", 1.0095, "Upper limits on Phi mass for signal extraction"}; + Configurable upmPhi{"upmPhiMB", 1.029, "Upper limits on Phi mass for signal extraction"}; // Configurables for phi selection - Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minimum pt cut"}; Configurable cfgCutCharge{"cfgCutCharge", 0.0, "Cut on charge"}; Configurable cfgPrimaryTrack{"cfgPrimaryTrack", false, "Primary track selection"}; Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; Configurable cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; - Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; - Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + Configurable cMinKaonPtcut{"cMinKaonPtcut", 0.15f, "Track minimum pt cut"}; + Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0f, "Track DCAz cut to PV Maximum"}; + Configurable cMaxDCArToPV1{"cMaxDCArToPV1", 0.004f, "Track DCAr cut to PV config 1"}; + Configurable cMaxDCArToPV2{"cMaxDCArToPV2", 0.013f, "Track DCAr cut to PV config 2"}; + Configurable cMaxDCArToPV3{"cMaxDCArToPV3", 1.0f, "Track DCAr cut to PV config 3"}; Configurable isNoTOF{"isNoTOF", false, "isNoTOF"}; Configurable nsigmaCutTPCKa{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; Configurable nsigmaCutCombinedKa{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"}; // Configurables for pions selection(extra with respect to a few of those defined for V0) - Configurable minITSnCls{"minITSnCls", 4.0f, "min number of ITS clusters"}; + Configurable minITSnCls{"minITSnCls", 4, "min number of ITS clusters"}; Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; Configurable dcaxyMax{"dcaxyMax", 0.1f, "Maximum DCAxy to primary vertex"}; Configurable dcazMax{"dcazMax", 0.1f, "Maximum DCAz to primary vertex"}; Configurable NSigmaTOFPion{"NSigmaTOFPion", 5.0, "NSigmaTOFPion"}; - // Configurable on pion pT - Configurable> binspTPi{"binspTPi", std::vector{pTBinPi, pTBinPi + nPtBinPi + 1}, "pT bin limits for pions"}; + // Configurable on pion pT bins + Configurable> binspTPi{"binspTPi", {0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for pions"}; // Configurables for delta y selection - Configurable nBinsy{"nBinsy", 16, "Number of bins in y and deltay axis"}; - Configurable cfgInclusiveDeltay{"cfgInclusiveDeltay", 0.8, "Inclusive upper bound on Deltay selection"}; - Configurable cfgFirstCutonDeltay{"cgfFirstCutonDeltay", 0.5, "First upper bound on Deltay selection"}; - Configurable cfgSecondCutonDeltay{"cgfSecondCutonDeltay", 0.2, "Second upper bound on Deltay selection"}; - - // Configurable for event mixing - Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; + Configurable nBinsy{"nBinsy", 10, "Number of bins in y and deltay axis"}; + Configurable cfgyAcceptance{"cfgyAcceptance", 0.5f, "Rapidity acceptance"}; + Configurable cfgFirstCutonDeltay{"cgfFirstCutonDeltay", 0.5f, "First upper bound on Deltay selection"}; + Configurable cfgSecondCutonDeltay{"cgfSecondCutonDeltay", 0.1f, "Second upper bound on Deltay selection"}; // Configurable for RecMC Configurable cfgiskNoITSROFrameBorder{"cfgiskNoITSROFrameBorder", false, "kNoITSROFrameBorder request on RecMC collisions"}; - // Configurable axis - ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for bin"}; - ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {20, 0, 100}, "multiplicity percentile for bin"}; - ConfigurableAxis axisMultiplicity{"axisMultiplicity", {2000, 0, 10000}, "TPC multiplicity for bin"}; - // Constants double massKa = o2::constants::physics::MassKPlus; double massPi = o2::constants::physics::MassPiPlus; @@ -232,28 +177,27 @@ struct phik0shortanalysis { // Necessary to flag INEL>0 events in GenMC Service pdgDB; - void init(InitContext const&) + typedef struct TLorentzVectorAndPID { + TLorentzVector fLorentzVector; + float fnSigmaTPC; + float fnSigmaTOF; + } TLorentzVectorAndPID; + + void init(InitContext&) { // Axes AxisSpec K0SmassAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec PhimassAxis = {200, 0.9f, 1.2f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec sigPhimassAxis = {nBins, lowmPhi, upmPhi, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec vertexZAxis = {100, -15.f, 15.f, "vrtx_{Z} [cm]"}; - AxisSpec yAxis = {nBinsy, -0.8f, 0.8f, "#it{y}"}; - AxisSpec deltayAxis = {nBinsy, 0.0f, 1.6f, "|#it{#Deltay}|"}; + AxisSpec yAxis = {nBinsy, -cfgyAcceptance, cfgyAcceptance, "#it{y}"}; + AxisSpec deltayAxis = {nBinsy, 0.0f, 1.0f, "|#it{#Deltay}|"}; AxisSpec multAxis = {120, 0.0f, 120.0f, "centFT0M"}; - AxisSpec binnedmultAxis{{0.0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 70.0, 100.0}, "centFT0M"}; - AxisSpec ptAxis = {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec binnedptK0SAxis{{0.0, 0.5, 0.8, 1.2, 10.0}, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec binnedptPiAxis{{0.0, 0.5, 1.2, 10.0}, "#it{p}_{T} (GeV/#it{c})"}; - std::vector cfgPhimassAxisInc; - std::vector cfgPhimassAxisFCut; - std::vector cfgPhimassAxisSCut; - for (int i = 0; i < nMultBin; i++) { - cfgPhimassAxisInc.push_back({nBins, lowmPhiInc->at(i), upmPhiInc->at(i), "#it{M}_{inv} [GeV/#it{c}^{2}]"}); - cfgPhimassAxisFCut.push_back({nBins, lowmPhiFCut->at(i), upmPhiFCut->at(i), "#it{M}_{inv} [GeV/#it{c}^{2}]"}); - cfgPhimassAxisSCut.push_back({nBins, lowmPhiSCut->at(i), upmPhiSCut->at(i), "#it{M}_{inv} [GeV/#it{c}^{2}]"}); - } - AxisSpec cfgPhimassAxisMB = {nBins, lowmPhiMB, upmPhiMB, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec binnedmultAxis{(std::vector)binsMult, "centFT0M"}; + AxisSpec ptK0SAxis = {60, 0.0f, 6.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec binnedptK0SAxis{(std::vector)binspTK0S, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptPiAxis = {30, 0.0f, 3.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec binnedptPiAxis{(std::vector)binspTPi, "#it{p}_{T} (GeV/#it{c})"}; // Histograms // Number of events per selection @@ -268,17 +212,6 @@ struct phik0shortanalysis { eventHist.add("hVertexZ", "hVertexZ", kTH1F, {vertexZAxis}); eventHist.add("hMultiplicityPercent", "Multiplicity Percentile", kTH1F, {multAxis}); - // Histo to check phi numbers in data - eventHist.add("thereisnoPhiwK0S", "thereisnoPhiwK0S", kTH1F, {{3, -0.5, 2.5}}); - eventHist.get(HIST("thereisnoPhiwK0S"))->GetXaxis()->SetBinLabel(1, "Inclusive"); - eventHist.get(HIST("thereisnoPhiwK0S"))->GetXaxis()->SetBinLabel(2, "|#Delta y|<0.5"); - eventHist.get(HIST("thereisnoPhiwK0S"))->GetXaxis()->SetBinLabel(3, "|#Delta y|<0.2"); - - eventHist.add("thereisnoPhiwPi", "thereisnoPhiwPi", kTH1F, {{3, -0.5, 2.5}}); - eventHist.get(HIST("thereisnoPhiwPi"))->GetXaxis()->SetBinLabel(1, "Inclusive"); - eventHist.get(HIST("thereisnoPhiwPi"))->GetXaxis()->SetBinLabel(2, "|#Delta y|<0.5"); - eventHist.get(HIST("thereisnoPhiwPi"))->GetXaxis()->SetBinLabel(3, "|#Delta y|<0.2"); - // Number of MC events per selection for Rec and Gen MCeventHist.add("hRecMCEventSelection", "hRecMCEventSelection", kTH1F, {{8, -0.5f, 7.5f}}); MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); @@ -290,22 +223,6 @@ struct phik0shortanalysis { MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(7, "With at least a gen coll"); MCeventHist.get(HIST("hRecMCEventSelection"))->GetXaxis()->SetBinLabel(8, "With at least a #phi"); - // MC Event information for Rec and Gen - MCeventHist.add("hRecMCVertexZ", "hRecMCVertexZ", kTH1F, {vertexZAxis}); - MCeventHist.add("hRecMCMultiplicityPercent", "RecMC Multiplicity Percentile", kTH1F, {multAxis}); - MCeventHist.add("hRecMCGenMultiplicityPercent", "RecMC Gen Multiplicity Percentile", kTH1F, {binnedmultAxis}); - - // Histo to check phi numbers in RecMC - MCeventHist.add("thereisnoPhiwK0SMC", "thereisnoPhiwK0SMC", kTH1F, {{3, -0.5, 2.5}}); - MCeventHist.get(HIST("thereisnoPhiwK0SMC"))->GetXaxis()->SetBinLabel(1, "Inclusive"); - MCeventHist.get(HIST("thereisnoPhiwK0SMC"))->GetXaxis()->SetBinLabel(2, "|#Delta y|<0.5"); - MCeventHist.get(HIST("thereisnoPhiwK0SMC"))->GetXaxis()->SetBinLabel(3, "|#Delta y|<0.2"); - - MCeventHist.add("thereisnoPhiwPiMC", "thereisnoPhiwPiMC", kTH1F, {{3, -0.5, 2.5}}); - MCeventHist.get(HIST("thereisnoPhiwPiMC"))->GetXaxis()->SetBinLabel(1, "Inclusive"); - MCeventHist.get(HIST("thereisnoPhiwPiMC"))->GetXaxis()->SetBinLabel(2, "|#Delta y|<0.5"); - MCeventHist.get(HIST("thereisnoPhiwPiMC"))->GetXaxis()->SetBinLabel(3, "|#Delta y|<0.2"); - MCeventHist.add("hGenMCEventSelection", "hGenMCEventSelection", kTH1F, {{5, -0.5f, 4.5f}}); MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(2, "posZ cut"); @@ -313,6 +230,11 @@ struct phik0shortanalysis { MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(4, "With at least a #phi"); MCeventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(5, "With at least a reco coll"); + // MC Event information for Rec and Gen + MCeventHist.add("hRecMCVertexZ", "hRecMCVertexZ", kTH1F, {vertexZAxis}); + MCeventHist.add("hRecMCMultiplicityPercent", "RecMC Multiplicity Percentile", kTH1F, {multAxis}); + MCeventHist.add("hRecMCGenMultiplicityPercent", "RecMC Gen Multiplicity Percentile", kTH1F, {binnedmultAxis}); + MCeventHist.add("hGenMCVertexZ", "hGenMCVertexZ", kTH1F, {vertexZAxis}); MCeventHist.add("hGenMCMultiplicityPercent", "GenMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); @@ -320,140 +242,122 @@ struct phik0shortanalysis { PhicandHist.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); PhicandHist.add("hDcaxy", "Dcaxy distribution", kTH1F, {{200, -1.0f, 1.0f}}); PhicandHist.add("hDcaz", "Dcaz distribution", kTH1F, {{200, -1.0f, 1.0f}}); - PhicandHist.add("hNsigmaKaonTPC", "NsigmaKaon TPC distribution", kTH2F, {ptAxis, {100, -10.0f, 10.0f}}); - PhicandHist.add("hNsigmaKaonTOF", "NsigmaKaon TOF distribution", kTH2F, {ptAxis, {100, -10.0f, 10.0f}}); + PhicandHist.add("hNsigmaKaonTPC", "NsigmaKaon TPC distribution", kTH2F, {ptK0SAxis, {100, -10.0f, 10.0f}}); + PhicandHist.add("hNsigmaKaonTOF", "NsigmaKaon TOF distribution", kTH2F, {ptK0SAxis, {100, -10.0f, 10.0f}}); // K0S topological/PID cuts K0SHist.add("hDCAV0Daughters", "hDCAV0Daughters", kTH1F, {{55, 0.0f, 2.2f}}); K0SHist.add("hV0CosPA", "hV0CosPA", kTH1F, {{100, 0.95f, 1.f}}); - K0SHist.add("hNSigmaPosPionFromK0S", "hNSigmaPosPionFromK0Short", kTH2F, {ptAxis, {100, -5.f, 5.f}}); - K0SHist.add("hNSigmaNegPionFromK0S", "hNSigmaNegPionFromK0Short", kTH2F, {ptAxis, {100, -5.f, 5.f}}); + K0SHist.add("hNSigmaPosPionFromK0S", "hNSigmaPosPionFromK0Short", kTH2F, {ptK0SAxis, {100, -5.f, 5.f}}); + K0SHist.add("hNSigmaNegPionFromK0S", "hNSigmaNegPionFromK0Short", kTH2F, {ptK0SAxis, {100, -5.f, 5.f}}); // Phi invariant mass for computing purities and normalisation - PhipurHist.add("h2PhipurInvMass", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH2F, {multAxis, PhimassAxis}); + PhipurHist.add("h2PhipurInvMass", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH2F, {binnedmultAxis, PhimassAxis}); - PhipurHist.add("h3PhipurK0SInvMassInclusive", "Invariant mass of Phi for Purity (K0S) Inclusive", kTH3F, {multAxis, ptAxis, PhimassAxis}); - PhipurHist.add("h3PhipurK0SInvMassFirstCut", "Invariant mass of Phi for Purity (K0S) Deltay < FirstCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); - PhipurHist.add("h3PhipurK0SInvMassSecondCut", "Invariant mass of Phi for Purity (K0S) Deltay < SecondCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); + PhipurHist.add("h3PhipurK0SInvMassInc", "Invariant mass of Phi for Purity (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + PhipurHist.add("h3PhipurK0SInvMassFCut", "Invariant mass of Phi for Purity (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + PhipurHist.add("h3PhipurK0SInvMassSCut", "Invariant mass of Phi for Purity (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - PhipurHist.add("h3PhipurPiInvMassInclusive", "Invariant mass of Phi for Purity (Pi) Inclusive", kTH3F, {multAxis, ptAxis, PhimassAxis}); - PhipurHist.add("h3PhipurPiInvMassFirstCut", "Invariant mass of Phi for Purity (Pi) Deltay < FirstCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); - PhipurHist.add("h3PhipurPiInvMassSecondCut", "Invariant mass of Phi for Purity (Pi) Deltay < SecondCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); + PhipurHist.add("h3PhipurPiInvMassInc", "Invariant mass of Phi for Purity (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + PhipurHist.add("h3PhipurPiInvMassFCut", "Invariant mass of Phi for Purity (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + PhipurHist.add("h3PhipurPiInvMassSCut", "Invariant mass of Phi for Purity (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); // MCPhi invariant mass for computing purities - MCPhipurHist.add("h2MCPhipurInvMass", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH2F, {multAxis, PhimassAxis}); + MCPhipurHist.add("h2MCPhipurInvMass", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH2F, {binnedmultAxis, PhimassAxis}); - MCPhipurHist.add("h3MCPhipurK0SInvMassInclusive", "Invariant mass of Phi for Purity (K0S) Inclusive", kTH3F, {multAxis, ptAxis, PhimassAxis}); - MCPhipurHist.add("h3MCPhipurK0SInvMassFirstCut", "Invariant mass of Phi for Purity (K0S) Deltay < FirstCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); - MCPhipurHist.add("h3MCPhipurK0SInvMassSecondCut", "Invariant mass of Phi for Purity (K0S) Deltay < SecondCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); + MCPhipurHist.add("h3MCPhipurK0SInvMassInc", "Invariant mass of Phi for Purity (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + MCPhipurHist.add("h3MCPhipurK0SInvMassFCut", "Invariant mass of Phi for Purity (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + MCPhipurHist.add("h3MCPhipurK0SInvMassSCut", "Invariant mass of Phi for Purity (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - MCPhipurHist.add("h3MCPhipurPiInvMassInclusive", "Invariant mass of Phi for Purity (Pi) Inclusive", kTH3F, {multAxis, ptAxis, PhimassAxis}); - MCPhipurHist.add("h3MCPhipurPiInvMassFirstCut", "Invariant mass of Phi for Purity (Pi) Deltay < FirstCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); - MCPhipurHist.add("h3MCPhipurPiInvMassSecondCut", "Invariant mass of Phi for Purity (Pi) Deltay < SecondCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); + MCPhipurHist.add("h3MCPhipurPiInvMassInc", "Invariant mass of Phi for Purity (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + MCPhipurHist.add("h3MCPhipurPiInvMassFCut", "Invariant mass of Phi for Purity (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + MCPhipurHist.add("h3MCPhipurPiInvMassSCut", "Invariant mass of Phi for Purity (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); - // 2D mass for Phi and K0S for Same Event and Mixed Event - for (int i = 0; i < nMultBin; i++) { - PhiK0SHist.add(PhiK0SSEInc[i].data(), "2D Invariant mass of Phi and K0Short for Same Event Inclusive", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisInc.at(i)}); - PhiK0SHist.add(PhiK0SSEFCut[i].data(), "2D Invariant mass of Phi and K0Short for Same Event Deltay < FirstCut", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisFCut.at(i)}); - PhiK0SHist.add(PhiK0SSESCut[i].data(), "2D Invariant mass of Phi and K0Short for Same Event Deltay < SecondCut", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisSCut.at(i)}); - } - PhiK0SHist.add("h2PhiK0SSEInc_0_100", "2D Invariant mass of Phi and K0Short for Same Event Inclusive MB", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisMB}); - PhiK0SHist.add("h2PhiK0SSEFCut_0_100", "2D Invariant mass of Phi and K0Short for Same Event Deltay < FirstCut MB", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisMB}); - PhiK0SHist.add("h2PhiK0SSESCut_0_100", "2D Invariant mass of Phi and K0Short for Same Event Deltay < SecondCut MB", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisMB}); - - PhiK0SHist.add("h4PhiK0SInvMassMixedEventInclusive", "2D Invariant mass of Phi and K0Short for Mixed Event Inclusive", kTHnSparseF, {multAxis, binnedptK0SAxis, K0SmassAxis, PhimassAxis}); - PhiK0SHist.add("h4PhiK0SInvMassMixedEventFirstCut", "2D Invariant mass of Phi and K0Short for Mixed Event Deltay < FirstCut", kTHnSparseF, {multAxis, binnedptK0SAxis, K0SmassAxis, PhimassAxis}); - PhiK0SHist.add("h4PhiK0SInvMassMixedEventSecondCut", "2D Invariant mass of Phi and K0Short for Mixed Event Deltay < SecondCut", kTHnSparseF, {multAxis, binnedptK0SAxis, K0SmassAxis, PhimassAxis}); - - // MC 2D mass for Phi and K0S - for (int i = 0; i < nMultBin; i++) { - MCPhiK0SHist.add(MCPhiK0SSEInc[i].data(), "2D Invariant mass of Phi and K0Short for RecMC Inclusive", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisInc.at(i)}); - MCPhiK0SHist.add(MCPhiK0SSEFCut[i].data(), "2D Invariant mass of Phi and K0Short for RecMC Deltay < FirstCut", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisFCut.at(i)}); - MCPhiK0SHist.add(MCPhiK0SSESCut[i].data(), "2D Invariant mass of Phi and K0Short for RecMC Deltay < SecondCut", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisSCut.at(i)}); - } - MCPhiK0SHist.add("h2RecMCPhiK0SSEInc_0_100", "2D Invariant mass of Phi and K0Short for RecMC Inclusive MB", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisMB}); - MCPhiK0SHist.add("h2RecMCPhiK0SSEFCut_0_100", "2D Invariant mass of Phi and K0Short for RecMC Deltay < FirstCut MB", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisMB}); - MCPhiK0SHist.add("h2RecMCPhiK0SSESCut_0_100", "2D Invariant mass of Phi and K0Short for RecMC Deltay < SecondCut MB", kTH3F, {binnedptK0SAxis, K0SmassAxis, cfgPhimassAxisMB}); + // 2D mass for Phi and K0S for Data + PhiK0SHist.add("h4PhiK0SSEInc", "2D Invariant mass of Phi and K0Short for Same Event Inclusive", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); + PhiK0SHist.add("h4PhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); + PhiK0SHist.add("h4PhiK0SSESCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); + + // RecMC K0S coupled to Phi + MCPhiK0SHist.add("h3RecMCPhiK0SSEInc", "2D Invariant mass of Phi and K0Short for RecMC Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis}); + MCPhiK0SHist.add("h3RecMCPhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for RecMC Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis}); + MCPhiK0SHist.add("h3RecMCPhiK0SSESCut", "2D Invariant mass of Phi and K0Short for RecMC Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis}); // GenMC K0S coupled to Phi - MCPhiK0SHist.add("h2PhiK0SGenMCInclusive", "K0Short coupled to Phi for GenMC Inclusive", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - MCPhiK0SHist.add("h2PhiK0SGenMCFirstCut", "K0Short coupled to Phi for GenMC Deltay < FirstCut", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - MCPhiK0SHist.add("h2PhiK0SGenMCSecondCut", "K0Short coupled to Phi for GenMC Deltay < SecondCut", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - - MCPhiK0SHist.add("h2PhiK0SGenMCInclusiveAssocReco", "K0Short coupled to Phi for GenMC Inclusive Associated Reco Collision", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - MCPhiK0SHist.add("h2PhiK0SGenMCFirstCutAssocReco", "K0Short coupled to Phi for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - MCPhiK0SHist.add("h2PhiK0SGenMCSecondCutAssocReco", "K0Short coupled to Phi for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - - // Phi mass vs Pion NSigma dE/dx for Same Event and Mixed Event - for (int i = 0; i < nMultBin; i++) { - PhiPionHist.add(PhiPiSEInc[i].data(), "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Inclusive", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisInc.at(i)}); - PhiPionHist.add(PhiPiSEFCut[i].data(), "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < FirstCut", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisFCut.at(i)}); - PhiPionHist.add(PhiPiSESCut[i].data(), "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < SecondCut", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisSCut.at(i)}); - } - PhiPionHist.add("h2PhiPiSEInc_0_100", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Inclusive MB", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisMB}); - PhiPionHist.add("h2PhiPiSEFCut_0_100", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < FirstCut MB", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisMB}); - PhiPionHist.add("h2PhiPiSESCut_0_100", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < SecondCut MB", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisMB}); - - PhiPionHist.add("h5PhiInvMassPiNSigmadEdxMixedEventInclusive", "Phi Invariant mass vs Pion nSigma TPC/TOF for Mixed Event Inclusive", kTHnSparseF, {multAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, PhimassAxis}); - PhiPionHist.add("h5PhiInvMassPiNSigmadEdxMixedEventFirstCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Mixed Event Deltay < FirstCut", kTHnSparseF, {multAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, PhimassAxis}); - PhiPionHist.add("h5PhiInvMassPiNSigmadEdxMixedEventSecondCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Mixed Event Deltay < SecondCut", kTHnSparseF, {multAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, PhimassAxis}); - - // MC Phi mass vs Pion NSigma dE/dx - for (int i = 0; i < nMultBin; i++) { - MCPhiPionHist.add(MCPhiPiSEInc[i].data(), "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Inclusive", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisInc.at(i)}); - MCPhiPionHist.add(MCPhiPiSEFCut[i].data(), "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < FirstCut", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisFCut.at(i)}); - MCPhiPionHist.add(MCPhiPiSESCut[i].data(), "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < SecondCut", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisSCut.at(i)}); - } - MCPhiPionHist.add("h2RecMCPhiPiSEInc_0_100", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Inclusive MB", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisMB}); - MCPhiPionHist.add("h2RecMCPhiPiSEFCut_0_100", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < FirstCut MB", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisMB}); - MCPhiPionHist.add("h2RecMCPhiPiSESCut_0_100", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < SecondCut MB", kTHnSparseF, {binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, cfgPhimassAxisMB}); + MCPhiK0SHist.add("h2PhiK0SGenMCInc", "K0Short coupled to Phi for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + MCPhiK0SHist.add("h2PhiK0SGenMCFCut", "K0Short coupled to Phi for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + MCPhiK0SHist.add("h2PhiK0SGenMCSCut", "K0Short coupled to Phi for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + + MCPhiK0SHist.add("h2PhiK0SGenMCIncAssocReco", "K0Short coupled to Phi for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + MCPhiK0SHist.add("h2PhiK0SGenMCFCutAssocReco", "K0Short coupled to Phi for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + MCPhiK0SHist.add("h2PhiK0SGenMCSCutAssocReco", "K0Short coupled to Phi for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + + // 2D mass for Phi and K0S for Closure Test + closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSEInc", "2D Invariant mass of Phi and K0Short for Same Event Inclusive for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); + closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSEFCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < FirstCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); + closureMCPhiK0SHist.add("h4ClosureMCPhiK0SSESCut", "2D Invariant mass of Phi and K0Short for Same Event Deltay < SecondCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis, sigPhimassAxis}); + + // Phi mass vs Pion NSigma dE/dx for Data + PhiPionHist.add("h5PhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Inclusive", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); + PhiPionHist.add("h5PhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); + PhiPionHist.add("h5PhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); + + // RecMC Pion coupled to Phi + MCPhiPionHist.add("h4RecMCPhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Inclusive", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); + MCPhiPionHist.add("h4RecMCPhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < FirstCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); + MCPhiPionHist.add("h4RecMCPhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for RecMC Deltay < SecondCut", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); // GenMC Pion coupled to Phi - MCPhiPionHist.add("h2PhiPiGenMCInclusive", "Pion coupled to Phi for GenMC Inclusive", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); - MCPhiPionHist.add("h2PhiPiGenMCFirstCut", "Pion coupled to Phi for GenMC Deltay < FirstCut", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); - MCPhiPionHist.add("h2PhiPiGenMCSecondCut", "Pion coupled to Phi for GenMC Deltay < SecondCut", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); + MCPhiPionHist.add("h2PhiPiGenMCInc", "Pion coupled to Phi for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptPiAxis}); + MCPhiPionHist.add("h2PhiPiGenMCFCut", "Pion coupled to Phi for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); + MCPhiPionHist.add("h2PhiPiGenMCSCut", "Pion coupled to Phi for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); + + MCPhiPionHist.add("h2PhiPiGenMCIncAssocReco", "Pion coupled to Phi for GenMC Inclusive Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + MCPhiPionHist.add("h2PhiPiGenMCFCutAssocReco", "Pion coupled to Phi for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); + MCPhiPionHist.add("h2PhiPiGenMCSCutAssocReco", "Pion coupled to Phi for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {binnedmultAxis, binnedptPiAxis}); - MCPhiPionHist.add("h2PhiPiGenMCInclusiveAssocReco", "Pion coupled to Phi for GenMC Inclusive Associated Reco Collision", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); - MCPhiPionHist.add("h2PhiPiGenMCFirstCutAssocReco", "Pion coupled to Phi for GenMC Deltay < FirstCut Associated Reco Collision", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); - MCPhiPionHist.add("h2PhiPiGenMCSecondCutAssocReco", "Pion coupled to Phi for GenMC Deltay < SecondCut Associated Reco Collision", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); + // Phi mass vs Pion NSigma dE/dx for Closure Test + closureMCPhiPionHist.add("h5ClosureMCPhiPiSEInc", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Inclusive for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); + closureMCPhiPionHist.add("h5ClosureMCPhiPiSEFCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < FirstCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); + closureMCPhiPionHist.add("h5ClosureMCPhiPiSESCut", "Phi Invariant mass vs Pion nSigma TPC/TOF for Same Event Deltay < SecondCut for Closure Test", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigPhimassAxis}); // MCPhi invariant mass for computing efficiencies and MCnormalisation - PhieffHist.add("h2PhieffInvMass", "Invariant mass of Phi for Efficiency (no K0S/Pi)", kTH2F, {multAxis, PhimassAxis}); + PhieffHist.add("h2PhieffInvMass", "Invariant mass of Phi for Efficiency (no K0S/Pi)", kTH2F, {binnedmultAxis, PhimassAxis}); - PhieffHist.add("h3PhieffK0SInvMassInclusive", "Invariant mass of Phi for Efficiency (K0S) Inclusive", kTH3F, {multAxis, ptAxis, PhimassAxis}); - PhieffHist.add("h3PhieffK0SInvMassFirstCut", "Invariant mass of Phi for Efficiency (K0S) Deltay < FirstCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); - PhieffHist.add("h3PhieffK0SInvMassSecondCut", "Invariant mass of Phi for Efficiency (K0S) Deltay < SecondCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); + PhieffHist.add("h3PhieffK0SInvMassInc", "Invariant mass of Phi for Efficiency (K0S) Inclusive", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + PhieffHist.add("h3PhieffK0SInvMassFCut", "Invariant mass of Phi for Efficiency (K0S) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); + PhieffHist.add("h3PhieffK0SInvMassSCut", "Invariant mass of Phi for Efficiency (K0S) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptK0SAxis, PhimassAxis}); - PhieffHist.add("h3PhieffPiInvMassInclusive", "Invariant mass of Phi for Efficiency (Pi) Inclusive", kTH3F, {multAxis, ptAxis, PhimassAxis}); - PhieffHist.add("h3PhieffPiInvMassFirstCut", "Invariant mass of Phi for Efficiency (Pi) Deltay < FirstCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); - PhieffHist.add("h3PhieffPiInvMassSecondCut", "Invariant mass of Phi for Efficiency (Pi) Deltay < SecondCut", kTH3F, {multAxis, ptAxis, PhimassAxis}); + PhieffHist.add("h3PhieffPiInvMassInc", "Invariant mass of Phi for Efficiency (Pi) Inclusive", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + PhieffHist.add("h3PhieffPiInvMassFCut", "Invariant mass of Phi for Efficiency (Pi) Deltay < FirstCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); + PhieffHist.add("h3PhieffPiInvMassSCut", "Invariant mass of Phi for Efficiency (Pi) Deltay < SecondCut", kTH3F, {binnedmultAxis, binnedptPiAxis, PhimassAxis}); // GenMC Phi and Phi coupled to K0S and Pion - PhieffHist.add("h1PhiGenMC", "Phi for GenMC", kTH1F, {{10, -0.5f, 9.5f}}); + PhieffHist.add("h1PhiGenMC", "Phi for GenMC", kTH1F, {binnedmultAxis}); - PhieffHist.add("h2PhieffK0SGenMCInclusive", "Phi coupled to K0Short for GenMC Inclusive", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - PhieffHist.add("h2PhieffK0SGenMCFirstCut", "Phi coupled to K0Short for GenMC Deltay < FirstCut", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - PhieffHist.add("h2PhieffK0SGenMCSecondCut", "Phi coupled to K0Short for GenMC Deltay < SecondCut", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); + PhieffHist.add("h2PhieffK0SGenMCInc", "Phi coupled to K0Short for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + PhieffHist.add("h2PhieffK0SGenMCFCut", "Phi coupled to K0Short for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + PhieffHist.add("h2PhieffK0SGenMCSCut", "Phi coupled to K0Short for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - PhieffHist.add("h2PhieffK0SGenMCInclusiveAssocReco", "Phi coupled to K0Short for GenMC Inclusive", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - PhieffHist.add("h2PhieffK0SGenMCFirstCutAssocReco", "Phi coupled to K0Short for GenMC Deltay < FirstCut", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); - PhieffHist.add("h2PhieffK0SGenMCSecondCutAssocReco", "Phi coupled to K0Short for GenMC Deltay < SecondCut", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); + PhieffHist.add("h2PhieffK0SGenMCIncAssocReco", "Phi coupled to K0Short for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + PhieffHist.add("h2PhieffK0SGenMCFCutAssocReco", "Phi coupled to K0Short for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); + PhieffHist.add("h2PhieffK0SGenMCSCutAssocReco", "Phi coupled to K0Short for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptK0SAxis}); - PhieffHist.add("h2PhieffPiGenMCInclusive", "Phi coupled to Pion for GenMC Inclusive", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); - PhieffHist.add("h2PhieffPiGenMCFirstCut", "Phi coupled to Pion for GenMC Deltay < FirstCut", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); - PhieffHist.add("h2PhieffPiGenMCSecondCut", "Phi coupled to Pion for GenMC Deltay < SecondCut", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); + PhieffHist.add("h2PhieffPiGenMCInc", "Phi coupled to Pion for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptPiAxis}); + PhieffHist.add("h2PhieffPiGenMCFCut", "Phi coupled to Pion for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); + PhieffHist.add("h2PhieffPiGenMCSCut", "Phi coupled to Pion for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); - PhieffHist.add("h2PhieffPiGenMCInclusiveAssocReco", "Phi coupled to Pion for GenMC Inclusive", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); - PhieffHist.add("h2PhieffPiGenMCFirstCutAssocReco", "Phi coupled to Pion for GenMC Deltay < FirstCut", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); - PhieffHist.add("h2PhieffPiGenMCSecondCutAssocReco", "Phi coupled to Pion for GenMC Deltay < SecondCut", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); + PhieffHist.add("h2PhieffPiGenMCIncAssocReco", "Phi coupled to Pion for GenMC Inclusive", kTH2F, {binnedmultAxis, binnedptPiAxis}); + PhieffHist.add("h2PhieffPiGenMCFCutAssocReco", "Phi coupled to Pion for GenMC Deltay < FirstCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); + PhieffHist.add("h2PhieffPiGenMCSCutAssocReco", "Phi coupled to Pion for GenMC Deltay < SecondCut", kTH2F, {binnedmultAxis, binnedptPiAxis}); // MCK0S invariant mass and GenMC K0S for computing efficiencies K0SeffHist.add("h3K0SeffInvMass", "Invariant mass of K0Short for Efficiency", kTH3F, {binnedmultAxis, binnedptK0SAxis, K0SmassAxis}); - K0SeffHist.add("h2K0SGenMC", "K0Short for GenMC", kTH2F, {{10, -0.5f, 9.5f}, {4, -0.5f, 3.5f}}); + K0SeffHist.add("h2K0SGenMC", "K0Short for GenMC", kTH2F, {binnedmultAxis, binnedptK0SAxis}); // MCPion invariant mass and GenMC Pion for computing efficiencies PioneffHist.add("h4PieffInvMass", "Invariant mass of Pion for Efficiency", kTHnSparseF, {binnedmultAxis, binnedptPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); - PioneffHist.add("h2PiGenMC", "Pion for GenMC", kTH2F, {{10, -0.5f, 9.5f}, {3, -0.5f, 2.5f}}); + PioneffHist.add("h2PiGenMC", "Pion for GenMC", kTH2F, {binnedmultAxis, binnedptPiAxis}); // y acceptance studies yaccHist.add("hyaccK0SRecMC", "K0S y acceptance in RecMC", kTH3F, {binnedmultAxis, binnedptK0SAxis, yAxis}); @@ -474,7 +378,7 @@ struct phik0shortanalysis { return false; if (QA) eventHist.fill(HIST("hEventSelection"), 1); // sel8 collisions - if (std::abs(collision.posZ()) > cutzvertex) + if (std::abs(collision.posZ()) >= cutzvertex) return false; if (QA) { eventHist.fill(HIST("hEventSelection"), 2); // vertex-Z selected @@ -496,12 +400,10 @@ struct phik0shortanalysis { return false; if (QA) MCeventHist.fill(HIST("hRecMCEventSelection"), 2); // kNoTimeFrameBorder collisions - if (cfgiskNoITSROFrameBorder) { - if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) - return false; - if (QA) - MCeventHist.fill(HIST("hRecMCEventSelection"), 3); // kNoITSROFrameBorder collisions (by default not requested by the selection) - } + if (cfgiskNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) + return false; + if (QA) + MCeventHist.fill(HIST("hRecMCEventSelection"), 3); // kNoITSROFrameBorder collisions (by default not requested by the selection) if (std::abs(collision.posZ()) > cutzvertex) return false; if (QA) { @@ -554,18 +456,20 @@ struct phik0shortanalysis { template bool selectionTrackResonance(const T& track) { - if (std::abs(track.pt()) < cMinPtcut) + if (cfgPrimaryTrack && !track.isPrimaryTrack()) return false; - if (std::abs(track.dcaXY()) > cMaxDCArToPVcut) + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - if (std::abs(track.dcaZ()) > cMaxDCAzToPVcut) + if (cfgPVContributor && !track.isPVContributor()) return false; - if (cfgPrimaryTrack && !track.isPrimaryTrack()) + if (track.pt() < cMinKaonPtcut) return false; - if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + if (std::abs(track.dcaZ()) > cMaxDCAzToPVcut) return false; - if (cfgPVContributor && !track.isPVContributor()) + if (std::abs(track.dcaXY()) > cMaxDCArToPV1 + (cMaxDCArToPV2 / std::pow(track.pt(), cMaxDCArToPV3))) + return false; + if (track.tpcNClsFound() < minTPCnClsFound) return false; return true; } @@ -583,6 +487,16 @@ struct phik0shortanalysis { return false; } + template + bool selectionPIDKaonpTdependent(const T& candidate) + { + if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) + return true; + if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombinedKa * nsigmaCutCombinedKa)) + return true; + return false; + } + // Reconstruct the Phi template TLorentzVector recMother(const T1& candidate1, const T2& candidate2, float masscand1, float masscand2) @@ -607,7 +521,10 @@ struct phik0shortanalysis { if (track.itsChi2NCl() > maxChi2ITS) return false; - if (track.pt() < 1.2) { + if (track.pt() < 0.2) + return false; + + if (track.pt() < 0.8) { if (!track.hasTPC()) return false; if (track.tpcNClsFound() < minTPCnClsFound) @@ -618,7 +535,7 @@ struct phik0shortanalysis { return false; } - if (track.pt() > 0.5) { + if (track.pt() >= 0.5) { if (!track.hasTOF()) return false; } @@ -631,8 +548,8 @@ struct phik0shortanalysis { } // Fill 2D invariant mass histogram for V0 and Phi - template - void fillInvMass2D(TLorentzVector V0, const std::vector listPhi, float multiplicity, double weightInclusive, double weightLtFirstCut, double weightLtSecondCut) + template + void fillInvMass2D(const TLorentzVector V0, const std::vector listPhi, float multiplicity, const std::array weights) { double massV0 = V0.M(); double ptV0 = V0.Pt(); @@ -643,86 +560,56 @@ struct phik0shortanalysis { double rapidityPhi = listPhi[phitag].Rapidity(); double deltay = std::abs(rapidityV0 - rapidityPhi); - if constexpr (!isMix) { // same event - PhiK0SHist.fill(HIST(PhiK0SSEInc[iBin]), ptV0, massV0, massPhi, weightInclusive); - PhiK0SHist.fill(HIST("h2PhiK0SSEInc_0_100"), ptV0, massV0, massPhi, weightInclusive); - if (deltay > cfgFirstCutonDeltay) - continue; - PhiK0SHist.fill(HIST(PhiK0SSEFCut[iBin]), ptV0, massV0, massPhi, weightLtFirstCut); - PhiK0SHist.fill(HIST("h2PhiK0SSEFCut_0_100"), ptV0, massV0, massPhi, weightLtFirstCut); - if (deltay > cfgSecondCutonDeltay) - continue; - PhiK0SHist.fill(HIST(PhiK0SSESCut[iBin]), ptV0, massV0, massPhi, weightLtSecondCut); - PhiK0SHist.fill(HIST("h2PhiK0SSESCut_0_100"), ptV0, massV0, massPhi, weightLtSecondCut); - } else { // mixed event - PhiK0SHist.fill(HIST("h4PhiK0SInvMassMixedEventInclusive"), multiplicity, ptV0, massV0, massPhi, weightInclusive); + if constexpr (!isMC) { // same event + PhiK0SHist.fill(HIST("h4PhiK0SSEInc"), multiplicity, ptV0, massV0, massPhi, weights.at(0)); if (deltay > cfgFirstCutonDeltay) continue; - PhiK0SHist.fill(HIST("h4PhiK0SInvMassMixedEventFirstCut"), multiplicity, ptV0, massV0, massPhi, weightLtFirstCut); + PhiK0SHist.fill(HIST("h4PhiK0SSEFCut"), multiplicity, ptV0, massV0, massPhi, weights.at(1)); if (deltay > cfgSecondCutonDeltay) continue; - PhiK0SHist.fill(HIST("h4PhiK0SInvMassMixedEventSecondCut"), multiplicity, ptV0, massV0, massPhi, weightLtSecondCut); - } - - if constexpr (isMC) { // MC event - MCPhiK0SHist.fill(HIST(MCPhiK0SSEInc[iBin]), ptV0, massV0, massPhi, weightInclusive); - MCPhiK0SHist.fill(HIST("h2RecMCPhiK0SSEInc_0_100"), ptV0, massV0, massPhi, weightInclusive); + PhiK0SHist.fill(HIST("h4PhiK0SSESCut"), multiplicity, ptV0, massV0, massPhi, weights.at(2)); + } else { // MC event + closureMCPhiK0SHist.fill(HIST("h4ClosureMCPhiK0SSEInc"), multiplicity, ptV0, massV0, massPhi, weights.at(0)); if (deltay > cfgFirstCutonDeltay) continue; - MCPhiK0SHist.fill(HIST(MCPhiK0SSEFCut[iBin]), ptV0, massV0, massPhi, weightLtFirstCut); - MCPhiK0SHist.fill(HIST("h2RecMCPhiK0SSEFCut_0_100"), ptV0, massV0, massPhi, weightLtFirstCut); + closureMCPhiK0SHist.fill(HIST("h4ClosureMCPhiK0SSEFCut"), multiplicity, ptV0, massV0, massPhi, weights.at(1)); if (deltay > cfgSecondCutonDeltay) continue; - MCPhiK0SHist.fill(HIST(MCPhiK0SSESCut[iBin]), ptV0, massV0, massPhi, weightLtSecondCut); - MCPhiK0SHist.fill(HIST("h2RecMCPhiK0SSESCut_0_100"), ptV0, massV0, massPhi, weightLtSecondCut); + closureMCPhiK0SHist.fill(HIST("h4ClosureMCPhiK0SSESCut"), multiplicity, ptV0, massV0, massPhi, weights.at(2)); } } } // Fill Phi invariant mass vs Pion nSigmadE/dx histogram - template - void fillInvMassNSigma(TLorentzVector Pi, float nSigmaTPCPi, float nSigmaTOFPi, const std::vector listPhi, float multiplicity, double weightInclusive, double weightLtFirstCut, double weightLtSecondCut) + template + void fillInvMassNSigma(const TLorentzVectorAndPID Pi, const std::vector listPhi, float multiplicity, const std::array weights) { - double rapidityPi = Pi.Rapidity(); - double ptPi = Pi.Pt(); + float nSigmaTPCPi = Pi.fnSigmaTPC; + float nSigmaTOFPi = Pi.fnSigmaTOF; + double rapidityPi = Pi.fLorentzVector.Rapidity(); + double ptPi = Pi.fLorentzVector.Pt(); for (unsigned int phitag = 0; phitag < listPhi.size(); phitag++) { double massPhi = listPhi[phitag].M(); double rapidityPhi = listPhi[phitag].Rapidity(); double deltay = std::abs(rapidityPi - rapidityPhi); - if constexpr (!isMix) { // same event - PhiPionHist.fill(HIST(PhiPiSEInc[iBin]), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightInclusive); - PhiPionHist.fill(HIST("h2PhiPiSEInc_0_100"), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightInclusive); - if (deltay > cfgFirstCutonDeltay) - continue; - PhiPionHist.fill(HIST(PhiPiSEFCut[iBin]), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtFirstCut); - PhiPionHist.fill(HIST("h2PhiPiSEFCut_0_100"), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtFirstCut); - if (deltay > cfgSecondCutonDeltay) - continue; - PhiPionHist.fill(HIST(PhiPiSESCut[iBin]), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtSecondCut); - PhiPionHist.fill(HIST("h2PhiPiSESCut_0_100"), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtSecondCut); - } else { // mixed event - PhiPionHist.fill(HIST("h5PhiInvMassPiNSigmadEdxMixedEventInclusive"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightInclusive); + if constexpr (!isMC) { // same event + PhiPionHist.fill(HIST("h5PhiPiSEInc"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weights.at(0)); if (deltay > cfgFirstCutonDeltay) continue; - PhiPionHist.fill(HIST("h5PhiInvMassPiNSigmadEdxMixedEventFirstCut"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtFirstCut); + PhiPionHist.fill(HIST("h5PhiPiSEFCut"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weights.at(1)); if (deltay > cfgSecondCutonDeltay) continue; - PhiPionHist.fill(HIST("h5PhiInvMassPiNSigmadEdxMixedEventSecondCut"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtSecondCut); - } - - if constexpr (isMC) { // MC event - MCPhiPionHist.fill(HIST(MCPhiPiSEInc[iBin]), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightInclusive); - MCPhiPionHist.fill(HIST("h2RecMCPhiPiSEInc_0_100"), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightInclusive); + PhiPionHist.fill(HIST("h5PhiPiSESCut"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weights.at(2)); + } else { // MC event + closureMCPhiPionHist.fill(HIST("h5ClosureMCPhiPiSEInc"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weights.at(0)); if (deltay > cfgFirstCutonDeltay) continue; - MCPhiPionHist.fill(HIST(MCPhiPiSEFCut[iBin]), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtFirstCut); - MCPhiPionHist.fill(HIST("h2RecMCPhiPiSEFCut_0_100"), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtFirstCut); + closureMCPhiPionHist.fill(HIST("h5ClosureMCPhiPiSEFCut"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weights.at(1)); if (deltay > cfgSecondCutonDeltay) continue; - MCPhiPionHist.fill(HIST(MCPhiPiSESCut[iBin]), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtSecondCut); - MCPhiPionHist.fill(HIST("h2RecMCPhiPiSESCut_0_100"), ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weightLtSecondCut); + closureMCPhiPionHist.fill(HIST("h5ClosureMCPhiPiSESCut"), multiplicity, ptPi, nSigmaTPCPi, nSigmaTOFPi, massPhi, weights.at(2)); } } } @@ -744,7 +631,7 @@ struct phik0shortanalysis { bool isFilledhV0 = false; for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection PhicandHist.fill(HIST("hEta"), track1.eta()); @@ -757,16 +644,15 @@ struct phik0shortanalysis { // Loop over all negative candidates for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); if (track2ID == track1ID) continue; // condition to avoid double counting of pair - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) continue; if (!isCountedPhi) { @@ -776,7 +662,7 @@ struct phik0shortanalysis { PhipurHist.fill(HIST("h2PhipurInvMass"), multiplicity, recPhi.M()); - bool isCountedK0SInclusive[nPtBinK0S] = {false}, isCountedK0SFirstCut[nPtBinK0S] = {false}, isCountedK0SSecondCut[nPtBinK0S] = {false}; + std::array isCountedK0S{false, false, false}; // V0 already reconstructed by the builder for (const auto& v0 : V0s) { @@ -801,38 +687,29 @@ struct phik0shortanalysis { TLorentzVector recK0S; recK0S.SetXYZM(v0.px(), v0.py(), v0.pz(), v0.mK0Short()); - if (std::abs(recK0S.Rapidity()) > cfgInclusiveDeltay) + if (std::abs(recK0S.Rapidity()) > cfgyAcceptance) continue; - - int ipTBinK0S = 0; - for (int i = 0; i < nPtBinK0S; i++) { - if (pTBinK0S[i] < recK0S.Pt() && recK0S.Pt() <= pTBinK0S[i + 1]) { - ipTBinK0S = i; - break; - } - } - - if (!isCountedK0SInclusive[ipTBinK0S]) { - PhipurHist.fill(HIST("h3PhipurK0SInvMassInclusive"), multiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SInclusive[ipTBinK0S] = true; + if (!isCountedK0S.at(0)) { + PhipurHist.fill(HIST("h3PhipurK0SInvMassInc"), multiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(0) = true; } if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (!isCountedK0SFirstCut[ipTBinK0S]) { - PhipurHist.fill(HIST("h3PhipurK0SInvMassFirstCut"), multiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SFirstCut[ipTBinK0S] = true; + if (!isCountedK0S.at(1)) { + PhipurHist.fill(HIST("h3PhipurK0SInvMassFCut"), multiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(1) = true; } if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (!isCountedK0SSecondCut[ipTBinK0S]) { - PhipurHist.fill(HIST("h3PhipurK0SInvMassSecondCut"), multiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SSecondCut[ipTBinK0S] = true; + if (!isCountedK0S.at(2)) { + PhipurHist.fill(HIST("h3PhipurK0SInvMassSCut"), multiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(2) = true; } } isFilledhV0 = true; - bool isCountedPiInclusive[nPtBinPi] = {false}, isCountedPiFirstCut[nPtBinPi] = {false}, isCountedPiSecondCut[nPtBinPi] = {false}; + std::array isCountedPi{false, false, false}; // Loop over all primary pion candidates for (const auto& track : fullTracks) { @@ -842,32 +719,23 @@ struct phik0shortanalysis { TLorentzVector recPi; recPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); - if (std::abs(recPi.Rapidity()) > cfgInclusiveDeltay) + if (std::abs(recPi.Rapidity()) > cfgyAcceptance) continue; - - int ipTBinPi = 0; - for (int i = 0; i < nPtBinPi; i++) { - if (pTBinPi[i] < recPi.Pt() && recPi.Pt() <= pTBinPi[i + 1]) { - ipTBinPi = i; - break; - } - } - - if (!isCountedPiInclusive[ipTBinPi]) { - PhipurHist.fill(HIST("h3PhipurPiInvMassInclusive"), multiplicity, recPi.Pt(), recPhi.M()); - isCountedPiInclusive[ipTBinPi] = true; + if (!isCountedPi.at(0)) { + PhipurHist.fill(HIST("h3PhipurPiInvMassInc"), multiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(0) = true; } if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (!isCountedPiFirstCut[ipTBinPi]) { - PhipurHist.fill(HIST("h3PhipurPiInvMassFirstCut"), multiplicity, recPi.Pt(), recPhi.M()); - isCountedPiFirstCut[ipTBinPi] = true; + if (!isCountedPi.at(1)) { + PhipurHist.fill(HIST("h3PhipurPiInvMassFCut"), multiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(1) = true; } if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (!isCountedPiSecondCut[ipTBinPi]) { - PhipurHist.fill(HIST("h3PhipurPiInvMassSecondCut"), multiplicity, recPi.Pt(), recPhi.M()); - isCountedPiSecondCut[ipTBinPi] = true; + if (!isCountedPi.at(2)) { + PhipurHist.fill(HIST("h3PhipurPiInvMassSCut"), multiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(2) = true; } } } @@ -884,14 +752,6 @@ struct phik0shortanalysis { float multiplicity = collision.centFT0M(); eventHist.fill(HIST("hMultiplicityPercent"), multiplicity); - int iBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < multiplicity && multiplicity <= multBin[i + 1]) { - iBin = i; - break; - } - } - // Defining positive and negative tracks for phi reconstruction auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -907,113 +767,54 @@ struct phik0shortanalysis { TLorentzVector recK0S; recK0S.SetXYZM(v0.px(), v0.py(), v0.pz(), v0.mK0Short()); - if (std::abs(recK0S.Rapidity()) > cfgInclusiveDeltay) + + if (std::abs(recK0S.Rapidity()) > cfgyAcceptance) continue; std::vector listrecPhi; - int countInclusive = 0, countLtFirstCut = 0, countLtSecondCut = 0; + std::array counts{}; // Phi reconstruction // Loop over positive candidates for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection auto track1ID = track1.globalIndex(); // Loop over all negative candidates for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); if (track2ID == track1ID) continue; // condition to avoid double counting of pair - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); + + if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) continue; + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + continue; listrecPhi.push_back(recPhi); - - if (lowmPhiInc->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiInc->at(iBin)) - countInclusive++; + counts.at(0)++; if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (lowmPhiFCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiFCut->at(iBin)) - countLtFirstCut++; + counts.at(1)++; if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (lowmPhiSCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiSCut->at(iBin)) - countLtSecondCut++; + counts.at(2)++; } } - float weightInclusive, weightLtFirstCut, weightLtSecondCut; - if (countInclusive > 0) { - weightInclusive = 1. / static_cast(countInclusive); - } else { - weightInclusive = 0; - eventHist.fill(HIST("thereisnoPhiwK0S"), 0); - } - if (countLtFirstCut > 0) { - weightLtFirstCut = 1. / static_cast(countLtFirstCut); - } else { - weightLtFirstCut = 0; - eventHist.fill(HIST("thereisnoPhiwK0S"), 1); - } - if (countLtSecondCut > 0) { - weightLtSecondCut = 1. / static_cast(countLtSecondCut); - } else { - weightLtSecondCut = 0; - eventHist.fill(HIST("thereisnoPhiwK0S"), 2); + std::array weights{}; + for (unsigned int i = 0; i < counts.size(); i++) { + weights.at(i) = (counts.at(i) > 0 ? 1. / static_cast(counts.at(i)) : 0); } - switch (iBin) { - case 0: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 1: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 2: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 3: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 4: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 5: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 6: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 7: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 8: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 9: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - default: - break; - } + fillInvMass2D(recK0S, listrecPhi, multiplicity, weights); } } @@ -1027,14 +828,6 @@ struct phik0shortanalysis { float multiplicity = collision.centFT0M(); eventHist.fill(HIST("hMultiplicityPercent"), multiplicity); - int iBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < multiplicity && multiplicity <= multBin[i + 1]) { - iBin = i; - break; - } - } - // Defining positive and negative tracks for phi reconstruction auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -1046,368 +839,65 @@ struct phik0shortanalysis { if (!selectionPion(track)) continue; - TLorentzVector recPi; - recPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); - if (std::abs(recPi.Rapidity()) > cfgInclusiveDeltay) + TLorentzVector vecPi; + vecPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); + + if (std::abs(vecPi.Rapidity()) > cfgyAcceptance) continue; + float nsigmaTPC = (track.hasTPC() ? track.tpcNSigmaPi() : -999); + float nsigmaTOF = (track.hasTOF() ? track.tofNSigmaPi() : -999); + + TLorentzVectorAndPID recPi{vecPi, nsigmaTPC, nsigmaTOF}; + std::vector listrecPhi; - int countInclusive = 0, countLtFirstCut = 0, countLtSecondCut = 0; + std::array counts{}; // Phi reconstruction // Loop over positive candidates for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection auto track1ID = track1.globalIndex(); // Loop over all negative candidates for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); if (track2ID == track1ID) continue; // condition to avoid double counting of pair - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) - continue; - - listrecPhi.push_back(recPhi); + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - if (lowmPhiInc->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiInc->at(iBin)) - countInclusive++; - if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) - continue; - if (lowmPhiFCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiFCut->at(iBin)) - countLtFirstCut++; - if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) + if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) continue; - if (lowmPhiSCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiSCut->at(iBin)) - countLtSecondCut++; - } - } - - float nsigmaTPC, nsigmaTOF; - if (track.hasTPC()) - nsigmaTPC = track.tpcNSigmaPi(); - else - nsigmaTPC = -9.99; - if (track.hasTOF()) - nsigmaTOF = track.tofNSigmaPi(); - else - nsigmaTOF = -9.99; - - float weightInclusive, weightLtFirstCut, weightLtSecondCut; - if (countInclusive > 0) { - weightInclusive = 1. / static_cast(countInclusive); - } else { - weightInclusive = 0; - eventHist.fill(HIST("thereisnoPhiwPi"), 0); - } - if (countLtFirstCut > 0) { - weightLtFirstCut = 1. / static_cast(countLtFirstCut); - } else { - weightLtFirstCut = 0; - eventHist.fill(HIST("thereisnoPhiwPi"), 1); - } - if (countLtSecondCut > 0) { - weightLtSecondCut = 1. / static_cast(countLtSecondCut); - } else { - weightLtSecondCut = 0; - eventHist.fill(HIST("thereisnoPhiwPi"), 2); - } - - switch (iBin) { - case 0: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 1: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 2: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 3: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 4: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 5: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 6: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 7: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 8: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 9: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - default: - break; - } - } - } - - PROCESS_SWITCH(phik0shortanalysis, processSEPhiPion, "Process Same Event for Phi-Pion Analysis", false); - - void processMEPhiK0S(soa::Filtered const& collisions, FullTracks const&, FullV0s const& V0s, V0DauTracks const&) - { - // Mixing the events with similar vertex z and multiplicity - BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true}; - for (auto const& [collision1, collision2] : o2::soa::selfCombinations(binningOnPositions, cfgNoMixedEvents, -1, collisions, collisions)) { - if (!collision1.isInelGt0() || !collision2.isInelGt0()) - continue; - - float multiplicity = collision1.centFT0M(); - - int iBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < multiplicity && multiplicity <= multBin[i + 1]) { - iBin = i; - break; - } - } - - // Defining V0s from collision1 - auto V0ThisColl = V0s.sliceByCached(aod::v0::collisionId, collision1.globalIndex(), cache); - - // Defining positive and negative tracks for phi reconstruction from collision1 and collision2, respectively - auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - for (const auto& v0 : V0ThisColl) { - const auto& posDaughterTrack = v0.posTrack_as(); - const auto& negDaughterTrack = v0.negTrack_as(); - - // Cut on V0 dynamic columns - if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) - continue; - - TLorentzVector recK0S; - recK0S.SetXYZM(v0.px(), v0.py(), v0.pz(), v0.mK0Short()); - if (std::abs(recK0S.Rapidity()) > cfgInclusiveDeltay) - continue; - - std::vector listrecPhi; - int countInclusive = 0, countLtFirstCut = 0, countLtSecondCut = 0; - - // Combinatorial background simulation - for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(posThisColl, negThisColl))) { - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1) || !selectionTrackResonance(track2) || !selectionPIDKaon(track2)) - continue; // topological and PID selection - - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) continue; - listrecPhi.push_back(recPhi); - - countInclusive++; - if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) + counts.at(0)++; + if (std::abs(vecPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - countLtFirstCut++; - if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) + counts.at(1)++; + if (std::abs(vecPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - countLtSecondCut++; - } - - float weightInclusive = 1. / static_cast(countInclusive); - float weightLtFirstCut = 1. / static_cast(countLtFirstCut); - float weightLtSecondCut = 1. / static_cast(countLtSecondCut); - - switch (iBin) { - case 0: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 1: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 2: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 3: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 4: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 5: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 6: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 7: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 8: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 9: { - fillInvMass2D(recK0S, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - default: - break; + counts.at(2)++; } } - } - } - - PROCESS_SWITCH(phik0shortanalysis, processMEPhiK0S, "Process Mixed Event for Phi-K0S Analysis", false); - - void processMEPhiPion(soa::Filtered const& collisions, FullTracks const& fullTracks) - { - // Mixing the events with similar vertex z and multiplicity - BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true}; - for (auto const& [collision1, collision2] : o2::soa::selfCombinations(binningOnPositions, cfgNoMixedEvents, -1, collisions, collisions)) { - if (!collision1.isInelGt0() || !collision2.isInelGt0()) - continue; - - float multiplicity = collision1.centFT0M(); - int iBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < multiplicity && multiplicity <= multBin[i + 1]) { - iBin = i; - break; - } + std::array weights{}; + for (unsigned int i = 0; i < counts.size(); i++) { + weights.at(i) = (counts.at(i) > 0 ? 1. / static_cast(counts.at(i)) : 0); } - // Defining V0s from collision1 - auto trackThisColl = fullTracks.sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - - // Defining positive and negative tracks for phi reconstruction from collision1 and collision2, respectively - auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - for (const auto& track : trackThisColl) { - - if (!selectionPion(track)) - continue; - - TLorentzVector recPi; - recPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); - if (std::abs(recPi.Rapidity()) > cfgInclusiveDeltay) - continue; - - std::vector listrecPhi; - int countInclusive = 0, countLtFirstCut = 0, countLtSecondCut = 0; - - // Combinatorial background simulation - for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(posThisColl, negThisColl))) { - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1) || !selectionTrackResonance(track2) || !selectionPIDKaon(track2)) - continue; // topological and PID selection - - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) - continue; - - listrecPhi.push_back(recPhi); - - countInclusive++; - if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) - continue; - countLtFirstCut++; - if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) - continue; - countLtSecondCut++; - } - - float nsigmaTPC, nsigmaTOF; - if (track.hasTPC()) - nsigmaTPC = track.tpcNSigmaPi(); - else - nsigmaTPC = -9.99; - if (track.hasTOF()) - nsigmaTOF = track.tofNSigmaPi(); - else - nsigmaTOF = -9.99; - - float weightInclusive = 1. / static_cast(countInclusive); - float weightLtFirstCut = 1. / static_cast(countLtFirstCut); - float weightLtSecondCut = 1. / static_cast(countLtSecondCut); - - switch (iBin) { - case 0: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 1: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 2: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 3: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 4: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 5: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 6: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 7: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 8: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 9: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, multiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - default: - break; - } - } + fillInvMassNSigma(recPi, listrecPhi, multiplicity, weights); } } - PROCESS_SWITCH(phik0shortanalysis, processMEPhiPion, "Process Mixed Event for Phi-Pion Analysis", false); + PROCESS_SWITCH(phik0shortanalysis, processSEPhiPion, "Process Same Event for Phi-Pion Analysis", false); void processRecMCPhiQA(SimCollisions::iterator const& collision, FullMCTracks const& fullMCTracks, FullV0s const& V0s, V0DauMCTracks const&, MCCollisions const&, aod::McParticles const&) { @@ -1432,7 +922,7 @@ struct phik0shortanalysis { bool isCountedPhi = false; for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection auto track1ID = track1.globalIndex(); @@ -1442,7 +932,7 @@ struct phik0shortanalysis { // Loop over all negative candidates for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); @@ -1473,9 +963,8 @@ struct phik0shortanalysis { if (pdgParentPhi != 333) continue; - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) continue; if (!isCountedPhi) { @@ -1485,7 +974,7 @@ struct phik0shortanalysis { PhieffHist.fill(HIST("h2PhieffInvMass"), genmultiplicity, recPhi.M()); - bool isCountedK0SInclusive[nPtBinK0S] = {false}, isCountedK0SFirstCut[nPtBinK0S] = {false}, isCountedK0SSecondCut[nPtBinK0S] = {false}; + std::array isCountedK0S{false, false, false}; // V0 already reconstructed by the builder for (const auto& v0 : V0s) { @@ -1521,36 +1010,27 @@ struct phik0shortanalysis { TLorentzVector recK0S; recK0S.SetXYZM(v0.px(), v0.py(), v0.pz(), v0.mK0Short()); - if (std::abs(recK0S.Rapidity()) > cfgInclusiveDeltay) + if (std::abs(recK0S.Rapidity()) > cfgyAcceptance) continue; - - int ipTBinK0S = 0; - for (int i = 0; i < nPtBinK0S; i++) { - if (pTBinK0S[i] < recK0S.Pt() && recK0S.Pt() <= pTBinK0S[i + 1]) { - ipTBinK0S = i; - break; - } - } - - if (!isCountedK0SInclusive[ipTBinK0S]) { - PhieffHist.fill(HIST("h3PhieffK0SInvMassInclusive"), genmultiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SInclusive[ipTBinK0S] = true; + if (!isCountedK0S.at(0)) { + PhieffHist.fill(HIST("h3PhieffK0SInvMassInc"), genmultiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(0) = true; } if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (!isCountedK0SFirstCut[ipTBinK0S]) { - PhieffHist.fill(HIST("h3PhieffK0SInvMassFirstCut"), genmultiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SFirstCut[ipTBinK0S] = true; + if (!isCountedK0S.at(1)) { + PhieffHist.fill(HIST("h3PhieffK0SInvMassFCut"), genmultiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(1) = true; } if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (!isCountedK0SSecondCut[ipTBinK0S]) { - PhieffHist.fill(HIST("h3PhieffK0SInvMassSecondCut"), genmultiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SSecondCut[ipTBinK0S] = true; + if (!isCountedK0S.at(2)) { + PhieffHist.fill(HIST("h3PhieffK0SInvMassSCut"), genmultiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(2) = true; } } - bool isCountedPiInclusive[nPtBinPi] = {false}, isCountedPiFirstCut[nPtBinPi] = {false}, isCountedPiSecondCut[nPtBinPi] = {false}; + std::array isCountedPi{false, false, false}; // Loop over all primary pion candidates for (const auto& track : fullMCTracks) { @@ -1567,32 +1047,23 @@ struct phik0shortanalysis { TLorentzVector recPi; recPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); - if (std::abs(recPi.Rapidity()) > cfgInclusiveDeltay) + if (std::abs(recPi.Rapidity()) > cfgyAcceptance) continue; - - int ipTBinPi = 0; - for (int i = 0; i < nPtBinPi; i++) { - if (pTBinPi[i] < recPi.Pt() && recPi.Pt() <= pTBinPi[i + 1]) { - ipTBinPi = i; - break; - } - } - - if (!isCountedPiInclusive[ipTBinPi]) { - PhieffHist.fill(HIST("h3PhieffPiInvMassInclusive"), genmultiplicity, recPi.Pt(), recPhi.M()); - isCountedPiInclusive[ipTBinPi] = true; + if (!isCountedPi.at(0)) { + PhieffHist.fill(HIST("h3PhieffPiInvMassInc"), genmultiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(0) = true; } if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (!isCountedPiFirstCut[ipTBinPi]) { - PhieffHist.fill(HIST("h3PhieffPiInvMassFirstCut"), genmultiplicity, recPi.Pt(), recPhi.M()); - isCountedPiFirstCut[ipTBinPi] = true; + if (!isCountedPi.at(1)) { + PhieffHist.fill(HIST("h3PhieffPiInvMassFCut"), genmultiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(1) = true; } if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (!isCountedPiSecondCut[ipTBinPi]) { - PhieffHist.fill(HIST("h3PhieffPiInvMassSecondCut"), genmultiplicity, recPi.Pt(), recPhi.M()); - isCountedPiSecondCut[ipTBinPi] = true; + if (!isCountedPi.at(2)) { + PhieffHist.fill(HIST("h3PhieffPiInvMassSCut"), genmultiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(2) = true; } } } @@ -1612,14 +1083,6 @@ struct phik0shortanalysis { const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - int iBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < genmultiplicity && genmultiplicity <= multBin[i + 1]) { - iBin = i; - break; - } - } - // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -1656,19 +1119,17 @@ struct phik0shortanalysis { TLorentzVector recK0S; recK0S.SetXYZM(v0.px(), v0.py(), v0.pz(), v0.mK0Short()); - if (std::abs(recK0S.Rapidity()) > cfgInclusiveDeltay) + + if (std::abs(recK0S.Rapidity()) > cfgyAcceptance) continue; K0SeffHist.fill(HIST("h3K0SeffInvMass"), genmultiplicity, recK0S.Pt(), recK0S.M()); - std::vector listrecPhi; - int countInclusive = 0, countLtFirstCut = 0, countLtSecondCut = 0; - - bool isCountedPhi = false; + std::array isCountedPhi{false, false, false}; // Phi reconstruction for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection auto track1ID = track1.globalIndex(); @@ -1677,7 +1138,7 @@ struct phik0shortanalysis { continue; for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); @@ -1708,94 +1169,31 @@ struct phik0shortanalysis { if (pdgParentPhi != 333) continue; - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) - continue; + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - listrecPhi.push_back(recPhi); + if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) + continue; - if (!isCountedPhi) { + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + continue; + if (!isCountedPhi.at(0)) { yaccHist.fill(HIST("hyaccK0SRecMC"), genmultiplicity, recK0S.Pt(), recK0S.Rapidity()); - isCountedPhi = true; + MCPhiK0SHist.fill(HIST("h3RecMCPhiK0SSEInc"), genmultiplicity, recK0S.Pt(), recK0S.M()); + isCountedPhi.at(0) = true; } - - if (lowmPhiInc->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiInc->at(iBin)) - countInclusive++; if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (lowmPhiFCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiFCut->at(iBin)) - countLtFirstCut++; + if (!isCountedPhi.at(1)) { + MCPhiK0SHist.fill(HIST("h3RecMCPhiK0SSEFCut"), genmultiplicity, recK0S.Pt(), recK0S.M()); + isCountedPhi.at(1) = true; + } if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (lowmPhiSCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiSCut->at(iBin)) - countLtSecondCut++; - } - } - - float weightInclusive, weightLtFirstCut, weightLtSecondCut; - if (countInclusive > 0) { - weightInclusive = 1. / static_cast(countInclusive); - } else { - weightInclusive = 0; - MCeventHist.fill(HIST("thereisnoPhiwK0SMC"), 0); - } - if (countLtFirstCut > 0) { - weightLtFirstCut = 1. / static_cast(countLtFirstCut); - } else { - weightLtFirstCut = 0; - MCeventHist.fill(HIST("thereisnoPhiwK0SMC"), 1); - } - if (countLtSecondCut > 0) { - weightLtSecondCut = 1. / static_cast(countLtSecondCut); - } else { - weightLtSecondCut = 0; - MCeventHist.fill(HIST("thereisnoPhiwK0SMC"), 2); - } - - switch (iBin) { - case 0: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 1: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 2: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 3: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 4: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 5: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 6: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 7: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 8: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 9: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; + if (!isCountedPhi.at(2)) { + MCPhiK0SHist.fill(HIST("h3RecMCPhiK0SSESCut"), genmultiplicity, recK0S.Pt(), recK0S.M()); + isCountedPhi.at(2) = true; + } } - default: - break; } } } @@ -1813,14 +1211,6 @@ struct phik0shortanalysis { const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - int iBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < genmultiplicity && genmultiplicity <= multBin[i + 1]) { - iBin = i; - break; - } - } - // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -1841,29 +1231,21 @@ struct phik0shortanalysis { TLorentzVector recPi; recPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); - if (std::abs(recPi.Rapidity()) > cfgInclusiveDeltay) + + if (std::abs(recPi.Rapidity()) > cfgyAcceptance) continue; float nsigmaTPC, nsigmaTOF; - if (track.hasTPC()) - nsigmaTPC = track.tpcNSigmaPi(); - else - nsigmaTPC = -9.99; - if (track.hasTOF()) - nsigmaTOF = track.tofNSigmaPi(); - else - nsigmaTOF = -9.99; + nsigmaTPC = (track.hasTPC() ? track.tpcNSigmaPi() : -999); + nsigmaTOF = (track.hasTOF() ? track.tofNSigmaPi() : -999); PioneffHist.fill(HIST("h4PieffInvMass"), genmultiplicity, recPi.Pt(), nsigmaTPC, nsigmaTOF); - std::vector listrecPhi; - int countInclusive = 0, countLtFirstCut = 0, countLtSecondCut = 0; - - bool isCountedPhi = false; + std::array isCountedPhi{false, false, false}; // Phi reconstruction for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection auto track1ID = track1.globalIndex(); @@ -1872,7 +1254,7 @@ struct phik0shortanalysis { continue; for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); @@ -1903,94 +1285,31 @@ struct phik0shortanalysis { if (pdgParentPhi != 333) continue; - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) - continue; + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); - listrecPhi.push_back(recPhi); + if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) + continue; - if (!isCountedPhi) { + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + continue; + if (!isCountedPhi.at(0)) { yaccHist.fill(HIST("hyaccPiRecMC"), genmultiplicity, recPi.Pt(), recPi.Rapidity()); - isCountedPhi = true; + MCPhiPionHist.fill(HIST("h4RecMCPhiPiSEInc"), genmultiplicity, recPi.Pt(), nsigmaTPC, nsigmaTOF); + isCountedPhi.at(0) = true; } - - if (lowmPhiInc->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiInc->at(iBin)) - countInclusive++; if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (lowmPhiFCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiFCut->at(iBin)) - countLtFirstCut++; + if (!isCountedPhi.at(1)) { + MCPhiPionHist.fill(HIST("h4RecMCPhiPiSEFCut"), genmultiplicity, recPi.Pt(), nsigmaTPC, nsigmaTOF); + isCountedPhi.at(1) = true; + } if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (lowmPhiSCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiSCut->at(iBin)) - countLtSecondCut++; - } - } - - float weightInclusive, weightLtFirstCut, weightLtSecondCut; - if (countInclusive > 0) { - weightInclusive = 1. / static_cast(countInclusive); - } else { - weightInclusive = 0; - MCeventHist.fill(HIST("thereisnoPhiwPiMC"), 0); - } - if (countLtFirstCut > 0) { - weightLtFirstCut = 1. / static_cast(countLtFirstCut); - } else { - weightLtFirstCut = 0; - MCeventHist.fill(HIST("thereisnoPhiwPiMC"), 1); - } - if (countLtSecondCut > 0) { - weightLtSecondCut = 1. / static_cast(countLtSecondCut); - } else { - weightLtSecondCut = 0; - MCeventHist.fill(HIST("thereisnoPhiwPiMC"), 2); - } - - switch (iBin) { - case 0: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 1: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 2: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 3: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 4: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 5: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 6: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 7: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 8: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 9: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; + if (!isCountedPhi.at(2)) { + MCPhiPionHist.fill(HIST("h4RecMCPhiPiSESCut"), genmultiplicity, recPi.Pt(), nsigmaTPC, nsigmaTOF); + isCountedPhi.at(2) = true; + } } - default: - break; } } } @@ -2017,23 +1336,22 @@ struct phik0shortanalysis { bool isCountedPhi = false; for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection auto track1ID = track1.globalIndex(); // Loop over all negative candidates for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); if (track2ID == track1ID) continue; // condition to avoid double counting of pair - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) continue; if (!isCountedPhi) { @@ -2043,7 +1361,7 @@ struct phik0shortanalysis { MCPhipurHist.fill(HIST("h2MCPhipurInvMass"), genmultiplicity, recPhi.M()); - bool isCountedK0SInclusive[nPtBinK0S] = {false}, isCountedK0SFirstCut[nPtBinK0S] = {false}, isCountedK0SSecondCut[nPtBinK0S] = {false}; + std::array isCountedK0S{false, false, false}; // V0 already reconstructed by the builder for (const auto& v0 : V0s) { @@ -2056,36 +1374,28 @@ struct phik0shortanalysis { TLorentzVector recK0S; recK0S.SetXYZM(v0.px(), v0.py(), v0.pz(), v0.mK0Short()); - if (std::abs(recK0S.Rapidity()) > cfgInclusiveDeltay) + if (std::abs(recK0S.Rapidity()) > cfgyAcceptance) continue; - int ipTBinK0S = 0; - for (int i = 0; i < nPtBinK0S; i++) { - if (pTBinK0S[i] < recK0S.Pt() && recK0S.Pt() <= pTBinK0S[i + 1]) { - ipTBinK0S = i; - break; - } - } - - if (!isCountedK0SInclusive[ipTBinK0S]) { - MCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassInclusive"), genmultiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SInclusive[ipTBinK0S] = true; + if (!isCountedK0S.at(0)) { + MCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassInc"), genmultiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(0) = true; } if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (!isCountedK0SFirstCut[ipTBinK0S]) { - MCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassFirstCut"), genmultiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SFirstCut[ipTBinK0S] = true; + if (!isCountedK0S.at(1)) { + MCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassFCut"), genmultiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(1) = true; } if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (!isCountedK0SSecondCut[ipTBinK0S]) { - MCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassSecondCut"), genmultiplicity, recK0S.Pt(), recPhi.M()); - isCountedK0SSecondCut[ipTBinK0S] = true; + if (!isCountedK0S.at(2)) { + MCPhipurHist.fill(HIST("h3MCPhipurK0SInvMassSCut"), genmultiplicity, recK0S.Pt(), recPhi.M()); + isCountedK0S.at(2) = true; } } - bool isCountedPiInclusive[nPtBinPi] = {false}, isCountedPiFirstCut[nPtBinPi] = {false}, isCountedPiSecondCut[nPtBinPi] = {false}; + std::array isCountedPi{false, false, false}; // Loop over all primary pion candidates for (const auto& track : fullMCTracks) { @@ -2096,32 +1406,24 @@ struct phik0shortanalysis { TLorentzVector recPi; recPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); - if (std::abs(recPi.Rapidity()) > cfgInclusiveDeltay) + if (std::abs(recPi.Rapidity()) > cfgyAcceptance) continue; - int ipTBinPi = 0; - for (int i = 0; i < nPtBinPi; i++) { - if (pTBinPi[i] < recPi.Pt() && recPi.Pt() <= pTBinPi[i + 1]) { - ipTBinPi = i; - break; - } - } - - if (!isCountedPiInclusive[ipTBinPi]) { - MCPhipurHist.fill(HIST("h3MCPhipurPiInvMassInclusive"), genmultiplicity, recPi.Pt(), recPhi.M()); - isCountedPiInclusive[ipTBinPi] = true; + if (!isCountedPi.at(0)) { + MCPhipurHist.fill(HIST("h3MCPhipurPiInvMassInc"), genmultiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(0) = true; } if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (!isCountedPiFirstCut[ipTBinPi]) { - MCPhipurHist.fill(HIST("h3MCPhipurPiInvMassFirstCut"), genmultiplicity, recPi.Pt(), recPhi.M()); - isCountedPiFirstCut[ipTBinPi] = true; + if (!isCountedPi.at(1)) { + MCPhipurHist.fill(HIST("h3MCPhipurPiInvMassFCut"), genmultiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(1) = true; } if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (!isCountedPiSecondCut[ipTBinPi]) { - MCPhipurHist.fill(HIST("h3MCPhipurPiInvMassSecondCut"), genmultiplicity, recPi.Pt(), recPhi.M()); - isCountedPiSecondCut[ipTBinPi] = true; + if (!isCountedPi.at(2)) { + MCPhipurHist.fill(HIST("h3MCPhipurPiInvMassSCut"), genmultiplicity, recPi.Pt(), recPhi.M()); + isCountedPi.at(2) = true; } } } @@ -2141,14 +1443,6 @@ struct phik0shortanalysis { const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - int iBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < genmultiplicity && genmultiplicity <= multBin[i + 1]) { - iBin = i; - break; - } - } - // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -2163,111 +1457,52 @@ struct phik0shortanalysis { TLorentzVector recK0S; recK0S.SetXYZM(v0.px(), v0.py(), v0.pz(), v0.mK0Short()); - if (std::abs(recK0S.Rapidity()) > cfgInclusiveDeltay) + + if (std::abs(recK0S.Rapidity()) > cfgyAcceptance) continue; std::vector listrecPhi; - int countInclusive = 0, countLtFirstCut = 0, countLtSecondCut = 0; + std::array counts{}; // Phi reconstruction for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection auto track1ID = track1.globalIndex(); for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); if (track2ID == track1ID) continue; // condition to avoid double counting of pair - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); + + if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) continue; + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + continue; listrecPhi.push_back(recPhi); - - if (lowmPhiInc->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiInc->at(iBin)) - countInclusive++; + counts.at(0)++; if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (lowmPhiFCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiFCut->at(iBin)) - countLtFirstCut++; + counts.at(1)++; if (std::abs(recK0S.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (lowmPhiSCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiSCut->at(iBin)) - countLtSecondCut++; + counts.at(2)++; } } - float weightInclusive, weightLtFirstCut, weightLtSecondCut; - if (countInclusive > 0) { - weightInclusive = 1. / static_cast(countInclusive); - } else { - weightInclusive = 0; - MCeventHist.fill(HIST("thereisnoPhiwK0SMC"), 0); - } - if (countLtFirstCut > 0) { - weightLtFirstCut = 1. / static_cast(countLtFirstCut); - } else { - weightLtFirstCut = 0; - MCeventHist.fill(HIST("thereisnoPhiwK0SMC"), 1); - } - if (countLtSecondCut > 0) { - weightLtSecondCut = 1. / static_cast(countLtSecondCut); - } else { - weightLtSecondCut = 0; - MCeventHist.fill(HIST("thereisnoPhiwK0SMC"), 2); + std::array weights{}; + for (unsigned int i = 0; i < counts.size(); i++) { + weights.at(i) = (counts.at(i) > 0 ? 1. / static_cast(counts.at(i)) : 0); } - switch (iBin) { - case 0: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 1: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 2: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 3: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 4: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 5: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 6: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 7: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 8: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 9: { - fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - default: - break; - } + fillInvMass2D(recK0S, listrecPhi, genmultiplicity, weights); } } @@ -2284,14 +1519,6 @@ struct phik0shortanalysis { const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - int iBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < genmultiplicity && genmultiplicity <= multBin[i + 1]) { - iBin = i; - break; - } - } - // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -2303,123 +1530,59 @@ struct phik0shortanalysis { if (!selectionPion(track)) continue; - TLorentzVector recPi; - recPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); - if (std::abs(recPi.Rapidity()) > cfgInclusiveDeltay) + TLorentzVector vecPi; + vecPi.SetXYZM(track.px(), track.py(), track.pz(), massPi); + + if (std::abs(vecPi.Rapidity()) > cfgyAcceptance) continue; - float nsigmaTPC, nsigmaTOF; - if (track.hasTPC()) - nsigmaTPC = track.tpcNSigmaPi(); - else - nsigmaTPC = -9.99; - if (track.hasTOF()) - nsigmaTOF = track.tofNSigmaPi(); - else - nsigmaTOF = -9.99; + float nsigmaTPC = (track.hasTPC() ? track.tpcNSigmaPi() : -999); + float nsigmaTOF = (track.hasTOF() ? track.tofNSigmaPi() : -999); + + TLorentzVectorAndPID recPi{vecPi, nsigmaTPC, nsigmaTOF}; std::vector listrecPhi; - int countInclusive = 0, countLtFirstCut = 0, countLtSecondCut = 0; + std::array counts{}; // Phi reconstruction for (auto track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1) || !selectionPIDKaon(track1)) + if (!selectionTrackResonance(track1) || !selectionPIDKaonpTdependent(track1)) continue; // topological and PID selection auto track1ID = track1.globalIndex(); for (auto track2 : negThisColl) { - if (!selectionTrackResonance(track2) || !selectionPIDKaon(track2)) + if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection auto track2ID = track2.globalIndex(); if (track2ID == track1ID) continue; // condition to avoid double counting of pair - TLorentzVector recPhi; - recPhi = recMother(track1, track2, massKa, massKa); - if (std::abs(recPhi.Rapidity()) > cfgInclusiveDeltay) + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); + + if (recPhi.M() < lowmPhi || recPhi.M() > upmPhi) continue; + if (std::abs(recPhi.Rapidity()) > cfgyAcceptance) + continue; listrecPhi.push_back(recPhi); - - if (lowmPhiInc->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiInc->at(iBin)) - countInclusive++; - if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) + counts.at(0)++; + if (std::abs(vecPi.Rapidity() - recPhi.Rapidity()) > cfgFirstCutonDeltay) continue; - if (lowmPhiFCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiFCut->at(iBin)) - countLtFirstCut++; - if (std::abs(recPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) + counts.at(1)++; + if (std::abs(vecPi.Rapidity() - recPhi.Rapidity()) > cfgSecondCutonDeltay) continue; - if (lowmPhiSCut->at(iBin) <= recPhi.M() && recPhi.M() <= upmPhiSCut->at(iBin)) - countLtSecondCut++; + counts.at(2)++; } } - float weightInclusive, weightLtFirstCut, weightLtSecondCut; - if (countInclusive > 0) { - weightInclusive = 1. / static_cast(countInclusive); - } else { - weightInclusive = 0; - MCeventHist.fill(HIST("thereisnoPhiwPiMC"), 0); - } - if (countLtFirstCut > 0) { - weightLtFirstCut = 1. / static_cast(countLtFirstCut); - } else { - weightLtFirstCut = 0; - MCeventHist.fill(HIST("thereisnoPhiwPiMC"), 1); - } - if (countLtSecondCut > 0) { - weightLtSecondCut = 1. / static_cast(countLtSecondCut); - } else { - weightLtSecondCut = 0; - MCeventHist.fill(HIST("thereisnoPhiwPiMC"), 2); + std::array weights{}; + for (unsigned int i = 0; i < counts.size(); i++) { + weights.at(i) = (counts.at(i) > 0 ? 1. / static_cast(counts.at(i)) : 0); } - switch (iBin) { - case 0: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 1: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 2: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 3: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 4: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 5: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 6: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 7: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 8: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - case 9: { - fillInvMassNSigma(recPi, nsigmaTPC, nsigmaTOF, listrecPhi, genmultiplicity, weightInclusive, weightLtFirstCut, weightLtSecondCut); - break; - } - default: - break; - } + fillInvMassNSigma(recPi, listrecPhi, genmultiplicity, weights); } } @@ -2444,16 +1607,8 @@ struct phik0shortanalysis { } } - float multiplicity = mcCollision.centFT0M(); - MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), multiplicity); - - int imultBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < multiplicity && multiplicity <= multBin[i + 1]) { - imultBin = i; - break; - } - } + float genmultiplicity = mcCollision.centFT0M(); + MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); bool isCountedPhi = false; @@ -2472,7 +1627,7 @@ struct phik0shortanalysis { } if (!isPosKaon || !isNegKaon) continue; - if (std::abs(mcParticle1.y()) > cfgInclusiveDeltay) + if (std::abs(mcParticle1.y()) > cfgyAcceptance) continue; if (!isCountedPhi) { @@ -2482,89 +1637,73 @@ struct phik0shortanalysis { isCountedPhi = true; } - PhieffHist.fill(HIST("h1PhiGenMC"), imultBin); + PhieffHist.fill(HIST("h1PhiGenMC"), genmultiplicity); - bool isCountedK0SInclusive[nPtBinK0S] = {false}, isCountedK0SFirstCut[nPtBinK0S] = {false}, isCountedK0SSecondCut[nPtBinK0S] = {false}; + std::array isCountedK0S = {false, false, false}; for (auto mcParticle2 : mcParticles) { if (mcParticle2.pdgCode() != 310) continue; if (!mcParticle2.isPhysicalPrimary()) continue; - if (std::abs(mcParticle2.y()) > cfgInclusiveDeltay) - continue; - - int ipTBinK0S = 0; - for (int i = 0; i < nPtBinK0S; i++) { - if (pTBinK0S[i] < mcParticle1.pt() && mcParticle1.pt() <= pTBinK0S[i + 1]) { - ipTBinK0S = i; - break; - } - } - if (!isCountedK0SInclusive[ipTBinK0S]) { - PhieffHist.fill(HIST("h2PhieffK0SGenMCInclusive"), imultBin, ipTBinK0S); + if (std::abs(mcParticle2.y()) > cfgyAcceptance) + continue; + if (!isCountedK0S.at(0)) { + PhieffHist.fill(HIST("h2PhieffK0SGenMCInc"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffK0SGenMCFirstCutAssocReco"), imultBin, ipTBinK0S); - isCountedK0SInclusive[ipTBinK0S] = true; + PhieffHist.fill(HIST("h2PhieffK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); + isCountedK0S.at(0) = true; } if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFirstCutonDeltay) continue; - if (!isCountedK0SFirstCut[ipTBinK0S]) { - PhieffHist.fill(HIST("h2PhieffK0SGenMCFirstCut"), imultBin, ipTBinK0S); + if (!isCountedK0S.at(1)) { + PhieffHist.fill(HIST("h2PhieffK0SGenMCFCut"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffK0SGenMCFirstCutAssocReco"), imultBin, ipTBinK0S); - isCountedK0SFirstCut[ipTBinK0S] = true; + PhieffHist.fill(HIST("h2PhieffK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); + isCountedK0S.at(1) = true; } if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSecondCutonDeltay) continue; - if (!isCountedK0SSecondCut[ipTBinK0S]) { - PhieffHist.fill(HIST("h2PhieffK0SGenMCSecondCut"), imultBin, ipTBinK0S); + if (!isCountedK0S.at(2)) { + PhieffHist.fill(HIST("h2PhieffK0SGenMCSCut"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffK0SGenMCSecondCutAssocReco"), imultBin, ipTBinK0S); - isCountedK0SSecondCut[ipTBinK0S] = true; + PhieffHist.fill(HIST("h2PhieffK0SGenMCSCutAssocReco"), genmultiplicity, mcParticle2.pt()); + isCountedK0S.at(2) = true; } } - bool isCountedPiInclusive[nPtBinPi] = {false}, isCountedPiFirstCut[nPtBinPi] = {false}, isCountedPiSecondCut[nPtBinPi] = {false}; + std::array isCountedPi = {false, false, false}; for (auto mcParticle2 : mcParticles) { if (std::abs(mcParticle2.pdgCode()) != 211) continue; if (!mcParticle2.isPhysicalPrimary()) continue; - if (std::abs(mcParticle2.y()) > cfgInclusiveDeltay) - continue; - - int ipTBinPi = 0; - for (int i = 0; i < nPtBinPi; i++) { - if (pTBinPi[i] < mcParticle1.pt() && mcParticle1.pt() <= pTBinPi[i + 1]) { - ipTBinPi = i; - break; - } - } - if (!isCountedPiInclusive[ipTBinPi]) { - PhieffHist.fill(HIST("h2PhieffPiGenMCInclusive"), imultBin, ipTBinPi); + if (std::abs(mcParticle2.y()) > cfgyAcceptance) + continue; + if (!isCountedPi.at(0)) { + PhieffHist.fill(HIST("h2PhieffPiGenMCInc"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffPiGenMCInclusiveAssocReco"), imultBin, ipTBinPi); - isCountedPiInclusive[ipTBinPi] = true; + PhieffHist.fill(HIST("h2PhieffPiGenMCIncAssocReco"), genmultiplicity, mcParticle2.pt()); + isCountedPi.at(0) = true; } if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFirstCutonDeltay) continue; - if (!isCountedPiFirstCut[ipTBinPi]) { - PhieffHist.fill(HIST("h2PhieffPiGenMCFirstCut"), imultBin, ipTBinPi); + if (!isCountedPi.at(1)) { + PhieffHist.fill(HIST("h2PhieffPiGenMCFCut"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffPiGenMCFirstCutAssocReco"), imultBin, ipTBinPi); - isCountedPiFirstCut[ipTBinPi] = true; + PhieffHist.fill(HIST("h2PhieffPiGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); + isCountedPi.at(1) = true; } if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSecondCutonDeltay) continue; - if (!isCountedPiSecondCut[ipTBinPi]) { - PhieffHist.fill(HIST("h2PhieffPiGenMCSecondCut"), imultBin, ipTBinPi); + if (!isCountedPi.at(2)) { + PhieffHist.fill(HIST("h2PhieffPiGenMCSCut"), genmultiplicity, mcParticle2.pt()); if (isAssocColl) - PhieffHist.fill(HIST("h2PhieffPiGenMCSecondCutAssocReco"), imultBin, ipTBinPi); - isCountedPiSecondCut[ipTBinPi] = true; + PhieffHist.fill(HIST("h2PhieffPiGenMCSCutAssocReco"), genmultiplicity, mcParticle2.pt()); + isCountedPi.at(2) = true; } } } @@ -2587,83 +1726,73 @@ struct phik0shortanalysis { } } - float multiplicity = mcCollision.centFT0M(); - MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), multiplicity); - - int imultBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < multiplicity && multiplicity <= multBin[i + 1]) { - imultBin = i; - break; - } - } + float genmultiplicity = mcCollision.centFT0M(); + MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); for (auto mcParticle1 : mcParticles) { if (mcParticle1.pdgCode() != 310) continue; if (!mcParticle1.isPhysicalPrimary()) continue; - if (std::abs(mcParticle1.y()) > cfgInclusiveDeltay) + auto kDaughters1 = mcParticle1.daughters_as(); + if (kDaughters1.size() != 2) + continue; + bool isPosPion = false, isNegPion = false; + for (auto kDaughter1 : kDaughters1) { + if (kDaughter1.pdgCode() == 211) + isPosPion = true; + if (kDaughter1.pdgCode() == -211) + isNegPion = true; + } + if (!isPosPion || !isNegPion) + continue; + if (std::abs(mcParticle1.y()) > cfgyAcceptance) continue; - int ipTBin = 0; - for (int i = 0; i < nPtBinK0S; i++) { - if (pTBinK0S[i] < mcParticle1.pt() && mcParticle1.pt() <= pTBinK0S[i + 1]) { - ipTBin = i; - break; - } - } - - K0SeffHist.fill(HIST("h2K0SGenMC"), imultBin, ipTBin); - - bool isCountedPhi = false; + K0SeffHist.fill(HIST("h2K0SGenMC"), genmultiplicity, mcParticle1.pt()); - bool isCountedPhiInclusive = false, isCountedPhiFirstCut = false, isCountedPhiSecondCut = false; + std::array isCountedPhi = {false, false, false}; for (auto mcParticle2 : mcParticles) { if (mcParticle2.pdgCode() != 333) continue; - auto kDaughters = mcParticle2.daughters_as(); - if (kDaughters.size() != 2) + auto kDaughters2 = mcParticle2.daughters_as(); + if (kDaughters2.size() != 2) continue; bool isPosKaon = false, isNegKaon = false; - for (auto kDaughter : kDaughters) { - if (kDaughter.pdgCode() == 321) + for (auto kDaughter2 : kDaughters2) { + if (kDaughter2.pdgCode() == 321) isPosKaon = true; - if (kDaughter.pdgCode() == -321) + if (kDaughter2.pdgCode() == -321) isNegKaon = true; } if (!isPosKaon || !isNegKaon) continue; - if (std::abs(mcParticle2.y()) > cfgInclusiveDeltay) - continue; - - if (!isCountedPhi) { - yaccHist.fill(HIST("hyaccK0SGenMC"), multiplicity, mcParticle1.pt(), mcParticle1.y()); - isCountedPhi = true; - } - if (!isCountedPhiInclusive) { - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCInclusive"), imultBin, ipTBin); + if (std::abs(mcParticle2.y()) > cfgyAcceptance) + continue; + if (!isCountedPhi.at(0)) { + yaccHist.fill(HIST("hyaccK0SGenMC"), genmultiplicity, mcParticle1.pt(), mcParticle1.y()); + MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCInc"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCInclusiveAssocReco"), imultBin, ipTBin); - isCountedPhiInclusive = true; + MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCIncAssocReco"), genmultiplicity, mcParticle1.pt()); + isCountedPhi.at(0) = true; } if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFirstCutonDeltay) continue; - if (!isCountedPhiFirstCut) { - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCFirstCut"), imultBin, ipTBin); + if (!isCountedPhi.at(1)) { + MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCFCut"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCFirstCutAssocReco"), imultBin, ipTBin); - isCountedPhiFirstCut = true; + MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle1.pt()); + isCountedPhi.at(1) = true; } if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSecondCutonDeltay) continue; - if (!isCountedPhiSecondCut) { - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCSecondCut"), imultBin, ipTBin); + if (!isCountedPhi.at(2)) { + MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCSCut"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCSecondCutAssocReco"), imultBin, ipTBin); - isCountedPhiSecondCut = true; + MCPhiK0SHist.fill(HIST("h2PhiK0SGenMCSCutAssocReco"), genmultiplicity, mcParticle1.pt()); + isCountedPhi.at(2) = true; } } } @@ -2686,38 +1815,20 @@ struct phik0shortanalysis { } } - float multiplicity = mcCollision.centFT0M(); - MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), multiplicity); - - int imultBin = 0; - for (int i = 0; i < nMultBin; i++) { - if (multBin[i] < multiplicity && multiplicity <= multBin[i + 1]) { - imultBin = i; - break; - } - } + float genmultiplicity = mcCollision.centFT0M(); + MCeventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); for (auto mcParticle1 : mcParticles) { if (std::abs(mcParticle1.pdgCode()) != 211) continue; if (!mcParticle1.isPhysicalPrimary()) continue; - if (std::abs(mcParticle1.y()) > cfgInclusiveDeltay) + if (std::abs(mcParticle1.y()) > cfgyAcceptance) continue; - int ipTBin = 0; - for (int i = 0; i < nPtBinPi; i++) { - if (pTBinPi[i] < mcParticle1.pt() && mcParticle1.pt() <= pTBinPi[i + 1]) { - ipTBin = i; - break; - } - } - - PioneffHist.fill(HIST("h2PiGenMC"), imultBin, ipTBin); - - bool isCountedPhi = false; + PioneffHist.fill(HIST("h2PiGenMC"), genmultiplicity, mcParticle1.pt()); - bool isCountedPhiInclusive = false, isCountedPhiFirstCut = false, isCountedPhiSecondCut = false; + std::array isCountedPhi = {false, false, false}; for (auto mcParticle2 : mcParticles) { if (mcParticle2.pdgCode() != 333) @@ -2734,35 +1845,31 @@ struct phik0shortanalysis { } if (!isPosKaon || !isNegKaon) continue; - if (std::abs(mcParticle2.y()) > cfgInclusiveDeltay) - continue; - - if (!isCountedPhi) { - yaccHist.fill(HIST("hyaccPiGenMC"), multiplicity, mcParticle1.pt(), mcParticle1.y()); - isCountedPhi = true; - } - if (!isCountedPhiInclusive) { - MCPhiPionHist.fill(HIST("h2PhiPiGenMCInclusive"), imultBin, ipTBin); + if (std::abs(mcParticle2.y()) > cfgyAcceptance) + continue; + if (!isCountedPhi.at(0)) { + yaccHist.fill(HIST("hyaccPiGenMC"), genmultiplicity, mcParticle1.pt(), mcParticle1.y()); + MCPhiPionHist.fill(HIST("h2PhiPiGenMCInc"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiPionHist.fill(HIST("h2PhiPiGenMCInclusiveAssocReco"), imultBin, ipTBin); - isCountedPhiInclusive = true; + MCPhiPionHist.fill(HIST("h2PhiPiGenMCIncAssocReco"), genmultiplicity, mcParticle1.pt()); + isCountedPhi.at(0) = true; } if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFirstCutonDeltay) continue; - if (!isCountedPhiFirstCut) { - MCPhiPionHist.fill(HIST("h2PhiPiGenMCFirstCut"), imultBin, ipTBin); + if (!isCountedPhi.at(1)) { + MCPhiPionHist.fill(HIST("h2PhiPiGenMCFCut"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiPionHist.fill(HIST("h2PhiPiGenMCFirstCutAssocReco"), imultBin, ipTBin); - isCountedPhiFirstCut = true; + MCPhiPionHist.fill(HIST("h2PhiPiGenMCFCutAssocReco"), genmultiplicity, mcParticle1.pt()); + isCountedPhi.at(1) = true; } if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSecondCutonDeltay) continue; - if (!isCountedPhiSecondCut) { - MCPhiPionHist.fill(HIST("h2PhiPiGenMCSecondCut"), imultBin, ipTBin); + if (!isCountedPhi.at(2)) { + MCPhiPionHist.fill(HIST("h2PhiPiGenMCSCut"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) - MCPhiPionHist.fill(HIST("h2PhiPiGenMCSecondCutAssocReco"), imultBin, ipTBin); - isCountedPhiSecondCut = true; + MCPhiPionHist.fill(HIST("h2PhiPiGenMCSCutAssocReco"), genmultiplicity, mcParticle1.pt()); + isCountedPhi.at(2) = true; } } } diff --git a/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx b/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx index 1a7024a6ca1..2b07b4c0958 100644 --- a/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx @@ -53,8 +53,6 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using std::cout; -using std::endl; using V0MCSigmas = soa::Join; using V0Sigmas = soa::Join; @@ -62,10 +60,6 @@ using V0Sigmas = soa::Join analyseSigma{"analyseSigma", false, "process Sigma-like candidates"}; - // Configurable analyseAntiSigma{"analyseAntiSigma", false, "process AntiSigma-like candidates"}; - // Analysis strategy: Configurable fUseMLSel{"fUseMLSel", false, "Flag to use ML selection. If False, the standard selection is applied."}; Configurable fProcessMonteCarlo{"fProcessMonteCarlo", false, "Flag to process MC data."}; @@ -80,49 +74,51 @@ struct sigmaanalysis { Configurable LambdaMinDCANegToPv{"LambdaMinDCANegToPv", .05, "min DCA Neg To PV (cm)"}; Configurable LambdaMinDCAPosToPv{"LambdaMinDCAPosToPv", .05, "min DCA Pos To PV (cm)"}; Configurable LambdaMaxDCAV0Dau{"LambdaMaxDCAV0Dau", 2.5, "Max DCA V0 Daughters (cm)"}; - Configurable LambdaMinv0radius{"LambdaMinv0radius", 0.5, "Min V0 radius (cm)"}; - Configurable LambdaMaxv0radius{"LambdaMaxv0radius", 180, "Max V0 radius (cm)"}; + Configurable LambdaMinv0radius{"LambdaMinv0radius", 0.0, "Min V0 radius (cm)"}; + Configurable LambdaMaxv0radius{"LambdaMaxv0radius", 40, "Max V0 radius (cm)"}; Configurable LambdaMinQt{"LambdaMinQt", 0.01, "Min lambda qt value (AP plot) (GeV/c)"}; Configurable LambdaMaxQt{"LambdaMaxQt", 0.17, "Max lambda qt value (AP plot) (GeV/c)"}; - Configurable LambdaMinAlpha{"LambdaMinAlpha", 0.2, "Min lambda alpha absolute value (AP plot)"}; - Configurable LambdaMaxAlpha{"LambdaMaxAlpha", 0.9, "Max lambda alpha absolute value (AP plot)"}; + Configurable LambdaMinAlpha{"LambdaMinAlpha", 0.25, "Min lambda alpha absolute value (AP plot)"}; + Configurable LambdaMaxAlpha{"LambdaMaxAlpha", 1.0, "Max lambda alpha absolute value (AP plot)"}; Configurable LambdaMinv0cospa{"LambdaMinv0cospa", 0.95, "Min V0 CosPA"}; - Configurable LambdaWindow{"LambdaWindow", 0.01, "Mass window around expected (in GeV/c2)"}; - Configurable LambdaMaxRap{"LambdaMaxRap", 0.5, "Max lambda rapidity"}; + Configurable LambdaWindow{"LambdaWindow", 0.015, "Mass window around expected (in GeV/c2)"}; + Configurable LambdaMaxRap{"LambdaMaxRap", 0.8, "Max lambda rapidity"}; + Configurable LambdaMaxTPCNSigmas{"LambdaMaxTPCNSigmas", 1e+9, "Max TPC NSigmas for daughters"}; + Configurable LambdaMaxTOFNSigmas{"LambdaMaxTOFNSigmas", 1e+9, "Max TOF NSigmas for daughters"}; //// Photon standard criteria: // Configurable PhotonMaxDauPseudoRap{"PhotonMaxDauPseudoRap", 0.9, "Max pseudorapidity of daughter tracks"}; - Configurable PhotonDauMinPt{"PhotonDauMinPt", 0.05, "Min daughter pT (GeV/c)"}; - Configurable PhotonMinDCADauToPv{"PhotonMinDCADauToPv", 0.05, "Min DCA daughter To PV (cm)"}; - Configurable PhotonMaxDCAV0Dau{"PhotonMaxDCAV0Dau", 2.5, "Max DCA V0 Daughters (cm)"}; - Configurable PhotonMinTPCCrossedRows{"PhotonMinTPCCrossedRows", 55, "Min daughter TPC Crossed Rows"}; - Configurable PhotonMinTPCNSigmas{"PhotonMinTPCNSigmas", -6, "Min TPC NSigmas for daughters"}; + Configurable PhotonDauMinPt{"PhotonDauMinPt", 0.0, "Min daughter pT (GeV/c)"}; + Configurable PhotonMinDCADauToPv{"PhotonMinDCADauToPv", 0.0, "Min DCA daughter To PV (cm)"}; + Configurable PhotonMaxDCAV0Dau{"PhotonMaxDCAV0Dau", 3.5, "Max DCA V0 Daughters (cm)"}; + Configurable PhotonMinTPCCrossedRows{"PhotonMinTPCCrossedRows", 0, "Min daughter TPC Crossed Rows"}; + Configurable PhotonMinTPCNSigmas{"PhotonMinTPCNSigmas", -7, "Min TPC NSigmas for daughters"}; Configurable PhotonMaxTPCNSigmas{"PhotonMaxTPCNSigmas", 7, "Max TPC NSigmas for daughters"}; - Configurable PhotonMinPt{"PhotonMinPt", 0.02, "Min photon pT (GeV/c)"}; + Configurable PhotonMinPt{"PhotonMinPt", 0.0, "Min photon pT (GeV/c)"}; Configurable PhotonMaxPt{"PhotonMaxPt", 50.0, "Max photon pT (GeV/c)"}; Configurable PhotonMaxRap{"PhotonMaxRap", 0.5, "Max photon rapidity"}; - Configurable PhotonMinRadius{"PhotonMinRadius", 0.5, "Min photon conversion radius (cm)"}; - Configurable PhotonMaxRadius{"PhotonMaxRadius", 180, "Max photon conversion radius (cm)"}; + Configurable PhotonMinRadius{"PhotonMinRadius", 3.0, "Min photon conversion radius (cm)"}; + Configurable PhotonMaxRadius{"PhotonMaxRadius", 115, "Max photon conversion radius (cm)"}; Configurable PhotonMaxZ{"PhotonMaxZ", 240, "Max photon conversion point z value (cm)"}; - Configurable PhotonMaxQt{"PhotonMaxQt", 0.06, "Max photon qt value (AP plot) (GeV/c)"}; + Configurable PhotonMaxQt{"PhotonMaxQt", 0.05, "Max photon qt value (AP plot) (GeV/c)"}; Configurable PhotonMaxAlpha{"PhotonMaxAlpha", 0.95, "Max photon alpha absolute value (AP plot)"}; - Configurable PhotonMinV0cospa{"PhotonMinV0cospa", 0.90, "Min V0 CosPA"}; - Configurable PhotonMaxMass{"PhotonMaxMass", 0.15, "Max photon mass (GeV/c^{2})"}; + Configurable PhotonMinV0cospa{"PhotonMinV0cospa", 0.80, "Min V0 CosPA"}; + Configurable PhotonMaxMass{"PhotonMaxMass", 0.10, "Max photon mass (GeV/c^{2})"}; // TODO: Include PsiPair selection Configurable SigmaMaxRap{"SigmaMaxRap", 0.5, "Max sigma0 rapidity"}; + Configurable SigmaOPAngle{"SigmaOPAngle", 1.0, "Max sigma0 opening angle between daughters (radians)"}; // Axis // base properties - ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality"}; + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Centrality"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; - ConfigurableAxis axisRadius{"axisRadius", {200, 0.0f, 100.0f}, "V0 radius (cm)"}; - ConfigurableAxis axisRapidity{"axisRapidity", {100, -1.0f, 1.0f}, "Rapidity"}; + ConfigurableAxis axisRapidity{"axisRapidity", {100, -2.0f, 2.0f}, "Rapidity"}; // Invariant Mass - ConfigurableAxis axisSigmaMass{"axisSigmaMass", {200, 1.16f, 1.23f}, "M_{#Sigma^{0}} (GeV/c^{2})"}; - ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, "M_{#Lambda} (GeV/c^{2})"}; - ConfigurableAxis axisPhotonMass{"axisPhotonMass", {200, -0.1f, 0.1f}, "M_{#Gamma}"}; + ConfigurableAxis axisSigmaMass{"axisSigmaMass", {1000, 1.10f, 1.30f}, "M_{#Sigma^{0}} (GeV/c^{2})"}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.05f, 1.151f}, "M_{#Lambda} (GeV/c^{2})"}; + ConfigurableAxis axisPhotonMass{"axisPhotonMass", {600, -0.1f, 0.5f}, "M_{#Gamma}"}; // AP plot axes ConfigurableAxis axisAPAlpha{"axisAPAlpha", {220, -1.1f, 1.1f}, "V0 AP alpha"}; @@ -130,13 +126,13 @@ struct sigmaanalysis { // Track quality axes ConfigurableAxis axisTPCrows{"axisTPCrows", {160, 0.0f, 160.0f}, "N TPC rows"}; - ConfigurableAxis axisITSclus{"axisITSclus", {7, 0.0f, 7.0f}, "N ITS Clusters"}; // topological variable QA axes - ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {20, 0.0f, 1.0f}, "DCA (cm)"}; - ConfigurableAxis axisDCAdau{"axisDCAdau", {20, 0.0f, 2.0f}, "DCA (cm)"}; - ConfigurableAxis axisPointingAngle{"axisPointingAngle", {20, 0.0f, 2.0f}, "pointing angle (rad)"}; - ConfigurableAxis axisV0Radius{"axisV0Radius", {20, 0.0f, 60.0f}, "V0 2D radius (cm)"}; + ConfigurableAxis axisRadius{"axisRadius", {240, 0.0f, 120.0f}, "V0 radius (cm)"}; + ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {500, 0.0f, 50.0f}, "DCA (cm)"}; + ConfigurableAxis axisDCAdau{"axisDCAdau", {50, 0.0f, 5.0f}, "DCA (cm)"}; + ConfigurableAxis axisCosPA{"axisCosPA", {200, 0.5f, 1.0f}, "Cosine of pointing angle"}; + ConfigurableAxis axisCandSel{"axisCandSel", {26, 0.5f, +26.5f}, "Candidate Selection"}; // ML ConfigurableAxis MLProb{"MLOutput", {100, 0.0f, 1.0f}, ""}; @@ -147,34 +143,77 @@ struct sigmaanalysis { histos.add("hEventCentrality", "hEventCentrality", kTH1F, {axisCentrality}); // All candidates received - histos.add("GeneralQA/h2dArmenterosAll", "h2dArmenterosAll", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); - histos.add("GeneralQA/h2dArmenterosSelected", "h2dArmenterosSelected", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); - histos.add("GeneralQA/hMassSigma0All", "hMassSigma0All", kTH1F, {axisSigmaMass}); + histos.add("GeneralQA/h2dArmenterosBeforeSel", "h2dArmenterosBeforeSel", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); + histos.add("GeneralQA/h2dArmenterosAfterSel", "h2dArmenterosAfterSel", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); + histos.add("GeneralQA/hMassSigma0BeforeSel", "hMassSigma0BeforeSel", kTH1F, {axisSigmaMass}); // Candidates Counters - histos.add("GeneralQA/hCandidateAnalysisSelection", "hCandidateAnalysisSelection", kTH1F, {{23, -0.5f, +22.5f}}); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(1, "Photon Mass Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(2, "Photon DauPt Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(3, "Photon DCAToPV Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(4, "Photon DCADau Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(5, "Photon TPCCrossedRows Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(6, "Photon PosTPCSigma Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(7, "Photon NegTPCSigma Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(8, "Photon Pt Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(9, "Photon Y Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(10, "Photon Radius Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(11, "Photon Zconv Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(12, "Photon QT Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(13, "Photon Alpha Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(14, "Photon CosPA Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(15, "Lambda Mass Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(16, "Lambda DCAToPV Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(17, "Lambda Radius Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(18, "Lambda DCADau Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(19, "Lambda QT Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(20, "Lambda Alpha Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(21, "Lambda CosPA Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(22, "Lambda Y Cut"); + histos.add("GeneralQA/hCandidateAnalysisSelection", "hCandidateAnalysisSelection", kTH1F, {axisCandSel}); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(1, "No Sel"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(2, "Photon Mass Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(3, "Photon DauPt Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(4, "Photon DCAToPV Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(5, "Photon DCADau Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(6, "Photon TPCCrossedRows Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(7, "Photon PosTPCSigma Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(8, "Photon NegTPCSigma Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(9, "Photon Pt Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(10, "Photon Y Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(11, "Photon Radius Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(12, "Photon Zconv Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(13, "Photon QT Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(14, "Photon Alpha Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(15, "Photon CosPA Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(16, "Lambda Mass Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(17, "Lambda DCAToPV Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(18, "Lambda Radius Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(19, "Lambda DCADau Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(20, "Lambda QT Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(21, "Lambda Alpha Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(22, "Lambda CosPA Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(23, "Lambda Y Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(24, "Sigma Y Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(25, "Sigma OP Angle Cut"); + histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(26, "Lambda/ALambda PID Cut"); + + // Photon Selection QA histos + histos.add("GeneralQA/hPhotonMass", "hPhotonMass", kTH1F, {axisPhotonMass}); + histos.add("GeneralQA/hPhotonNegpT", "hPhotonNegpT", kTH1F, {axisPt}); + histos.add("GeneralQA/hPhotonPospT", "hPhotonPospT", kTH1F, {axisPt}); + histos.add("GeneralQA/hPhotonDCANegToPV", "hPhotonDCANegToPV", kTH1F, {axisDCAtoPV}); + histos.add("GeneralQA/hPhotonDCAPosToPV", "hPhotonDCAPosToPV", kTH1F, {axisDCAtoPV}); + histos.add("GeneralQA/hPhotonDCADau", "hPhotonDCADau", kTH1F, {axisDCAdau}); + histos.add("GeneralQA/hPhotonPosTPCCR", "hPhotonPosTPCCR", kTH1F, {axisTPCrows}); + histos.add("GeneralQA/hPhotonNegTPCCR", "hPhotonNegTPCCR", kTH1F, {axisTPCrows}); + histos.add("GeneralQA/hPhotonPosTPCNSigma", "hPhotonPosTPCNSigma", kTH1F, {{30, -15.0f, 15.0f}}); + histos.add("GeneralQA/hPhotonNegTPCNSigma", "hPhotonNegTPCNSigma", kTH1F, {{30, -15.0f, 15.0f}}); + histos.add("GeneralQA/hPhotonpT", "hPhotonpT", kTH1F, {axisPt}); + histos.add("GeneralQA/hPhotonY", "hPhotonY", kTH1F, {axisRapidity}); + histos.add("GeneralQA/hPhotonRadius", "hPhotonRadius", kTH1F, {axisRadius}); + histos.add("GeneralQA/hPhotonZ", "hPhotonZ", kTH1F, {{240, 0.0f, 120.0f}}); + histos.add("GeneralQA/h2dPhotonArmenteros", "h2dPhotonArmenteros", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); + histos.add("GeneralQA/hPhotonCosPA", "hPhotonCosPA", kTH1F, {axisCosPA}); + + // Lambda Selection QA histos + histos.add("GeneralQA/hLambdaMass", "hLambdaMass", kTH1F, {axisLambdaMass}); + histos.add("GeneralQA/hAntiLambdaMass", "hAntiLambdaMass", kTH1F, {axisLambdaMass}); + histos.add("GeneralQA/hLambdaDCANegToPV", "hLambdaDCANegToPV", kTH1F, {axisDCAtoPV}); + histos.add("GeneralQA/hLambdaDCAPosToPV", "hLambdaDCAPosToPV", kTH1F, {axisDCAtoPV}); + histos.add("GeneralQA/hLambdaRadius", "hLambdaRadius", kTH1F, {axisRadius}); + histos.add("GeneralQA/hLambdaDCADau", "hLambdaDCADau", kTH1F, {axisDCAdau}); + histos.add("GeneralQA/h2dLambdaArmenteros", "h2dLambdaArmenteros", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); + histos.add("GeneralQA/hLambdaCosPA", "hLambdaCosPA", kTH1F, {axisCosPA}); + histos.add("GeneralQA/hLambdaY", "hLambdaY", kTH1F, {axisRapidity}); + histos.add("GeneralQA/hSigmaY", "hSigmaY", kTH1F, {axisRapidity}); + histos.add("GeneralQA/hSigmaOPAngle", "hSigmaOPAngle", kTH1F, {{140, 0.0f, +7.0f}}); + histos.add("GeneralQA/h2dTPCvsTOFNSigma_LambdaPr", "h2dTPCvsTOFNSigma_LambdaPr", kTH2F, {{120, -30, 30}, {120, -30, 30}}); + histos.add("GeneralQA/h2dTPCvsTOFNSigma_LambdaPi", "h2dTPCvsTOFNSigma_LambdaPi", kTH2F, {{120, -30, 30}, {120, -30, 30}}); + histos.add("GeneralQA/h2dTPCvsTOFNSigma_ALambdaPr", "h2dTPCvsTOFNSigma_ALambdaPr", kTH2F, {{120, -30, 30}, {120, -30, 30}}); + histos.add("GeneralQA/h2dTPCvsTOFNSigma_ALambdaPi", "h2dTPCvsTOFNSigma_ALambdaPi", kTH2F, {{120, -30, 30}, {120, -30, 30}}); + + histos.add("GeneralQA/hPhotonMassSelected", "hPhotonMassSelected", kTH1F, {axisPhotonMass}); + histos.add("GeneralQA/hLambdaMassSelected", "hLambdaMassSelected", kTH1F, {axisLambdaMass}); + histos.add("GeneralQA/hAntiLambdaMassSelected", "hAntiLambdaMassSelected", kTH1F, {axisLambdaMass}); // For Signal Extraction @@ -192,22 +231,78 @@ struct sigmaanalysis { if (fProcessMonteCarlo) { // Event counter - histos.add("hMCEventCentrality", "hMCEventCentrality", kTH1F, {axisCentrality}); + histos.add("MC/hMCEventCentrality", "hMCEventCentrality", kTH1F, {axisCentrality}); // Kinematic histos.add("MC/h3dMassSigma0", "h3dMassSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); histos.add("MC/h3dMassAntiSigma0", "h3dMassSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - histos.add("MC/h2dArmenterosAll", "h2dArmenterosAll", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); - histos.add("MC/h2dArmenterosSelected", "h2dArmenterosSelected", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); + histos.add("MC/h2dArmenterosBeforeSel", "h2dArmenterosBeforeSel", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); + histos.add("MC/h2dArmenterosAfterSel", "h2dArmenterosAfterSel", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); // Sigma0 QA - histos.add("MC/hMassSigma0All", "hMassSigma0All", kTH1F, {axisSigmaMass}); - histos.add("MC/hPtSigma0All", "hPtSigma0All", kTH1F, {axisPt}); + histos.add("MC/hMassSigma0BeforeSel", "hMassSigma0BeforeSel", kTH1F, {axisSigmaMass}); + histos.add("MC/hPtSigma0BeforeSel", "hPtSigma0BeforeSel", kTH1F, {axisPt}); histos.add("MC/hMassSigma0", "hMassSigma0", kTH1F, {axisSigmaMass}); histos.add("MC/hPtSigma0", "hPtSigma0", kTH1F, {axisPt}); histos.add("MC/hMassAntiSigma0", "hMassAntiSigma0", kTH1F, {axisSigmaMass}); histos.add("MC/hPtAntiSigma0", "hPtAntiSigma0", kTH1F, {axisPt}); + + // For background decomposition + histos.add("MC/h2dPtVsMassSigma_SignalBkg", "h2dPtVsMassSigma_SignalBkg", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_SignalOnly", "h2dPtVsMassSigma_SignalOnly", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_TrueDaughters", "h2dPtVsMassSigma_TrueDaughters", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_TrueGammaFakeLambda", "h2dPtVsMassSigma_TrueGammaFakeLambda", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_FakeGammaTrueLambda", "h2dPtVsMassSigma_FakeGammaTrueLambda", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dPtVsMassSigma_FakeDaughters", "h2dPtVsMassSigma_FakeDaughters", kTH2D, {axisPt, axisSigmaMass}); + histos.add("MC/h2dTrueDaughtersMatrix", "h2dTrueDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + + // For new selection studies: + //// Opening angle between daughters + histos.add("MC/h2dPtVsOPAngle_SignalOnly", "h2dPtVsOPAngle_SignalOnly", kTH2D, {axisPt, {140, 0.0f, +7.0f}}); + histos.add("MC/h2dPtVsOPAngle_TrueDaughters", "h2dPtVsOPAngle_TrueDaughters", kTH2D, {axisPt, {140, 0.0f, +7.0f}}); + histos.add("MC/h2dPtVsMassSigma_AfterOPAngleSel", "h2dPtVsMassSigma_AfterOPAngleSel", kTH2D, {axisPt, axisSigmaMass}); + + // For efficiency/Purity studies + // Before any selection + histos.add("MC/hPtTrueLambda_BeforeSel", "hPtTrueLambda_BeforeSel", kTH1F, {axisPt}); // Signal only + histos.add("MC/hPtTrueGamma_BeforeSel", "hPtTrueGamma_BeforeSel", kTH1F, {axisPt}); // Signal only + histos.add("MC/hPtTrueSigma_BeforeSel", "hPtTrueSigma_BeforeSel", kTH1F, {axisPt}); // Signal only + histos.add("MC/hPtLambdaCand_BeforeSel", "hPtLambdaCand_BeforeSel", kTH1F, {axisPt}); // Bkg + Signal + histos.add("MC/hPtGammaCand_BeforeSel", "hPtGammaCand_BeforeSel", kTH1F, {axisPt}); // Bkg + Signal + histos.add("MC/hPtSigmaCand_BeforeSel", "hPtGammaCand_BeforeSel", kTH1F, {axisPt}); // Bkg + Signal + + // After analysis selections + histos.add("MC/hPtTrueLambda_AfterSel", "hPtTrueLambda_AfterSel", kTH1F, {axisPt}); // Signal only + histos.add("MC/hPtTrueGamma_AfterSel", "hPtTrueGamma_AfterSel", kTH1F, {axisPt}); // Signal only + histos.add("MC/hPtTrueSigma_AfterSel", "hPtTrueSigma_AfterSel", kTH1F, {axisPt}); // Signal only + + histos.add("MC/hPtLambdaCand_AfterSel", "hPtLambdaCand_AfterSel", kTH1F, {axisPt}); + histos.add("MC/hPtGammaCand_AfterSel", "hPtGammaCand_AfterSel", kTH1F, {axisPt}); + histos.add("MC/hPtSigmaCand_AfterSel", "hPtSigmaCand_AfterSel", kTH1F, {axisPt}); + + // TPC vs TOF N Sigmas distributions + histos.add("MC/h3dTPCvsTOFNSigma_LambdaPr", "h3dTPCvsTOFNSigma_LambdaPr", kTH3F, {{120, -30, 30}, {120, -30, 30}, axisPt}); + histos.add("MC/h3dTPCvsTOFNSigma_LambdaPi", "h3dTPCvsTOFNSigma_LambdaPi", kTH3F, {{120, -30, 30}, {120, -30, 30}, axisPt}); + histos.add("MC/h3dTPCvsTOFNSigma_TrueLambdaPr", "h3dTPCvsTOFNSigma_TrueLambdaPr", kTH3F, {{120, -30, 30}, {120, -30, 30}, axisPt}); + histos.add("MC/h3dTPCvsTOFNSigma_TrueLambdaPi", "h3dTPCvsTOFNSigma_TrueLambdaPi", kTH3F, {{120, -30, 30}, {120, -30, 30}, axisPt}); + + // Testing New Selections: + //// Opening Angle + histos.add("MC/hPtTrueSigma_AngleSel", "hPtTrueSigma_AngleSel", kTH1F, {axisPt}); + histos.add("MC/hPtSigmaCand_AngleSel", "hPtSigmaCand_AngleSel", kTH1F, {axisPt}); + + //// TPC PID + histos.add("MC/hPtTrueLambda_TPCPID", "hPtTrueLambda_TPCPID", kTH1F, {axisPt}); + histos.add("MC/hPtLambdaCandidates_TPCPID", "hPtLambdaCandidates_TPCPID", kTH1F, {axisPt}); + + //// TOF PID + histos.add("MC/hPtTrueLambda_TOFPID", "hPtTrueLambda_TOFPID", kTH1F, {axisPt}); + histos.add("MC/hPtLambdaCandidates_TOFPID", "hPtLambdaCandidates_TOFPID", kTH1F, {axisPt}); + + //// TPC+TOF PID + histos.add("MC/hPtTrueLambda_TPCTOFPID", "hPtTrueLambda_TPCTOFPID", kTH1F, {axisPt}); + histos.add("MC/hPtLambdaCandidates_TPCTOFPID", "hPtLambdaCandidates_TPCTOFPID", kTH1F, {axisPt}); } } @@ -231,79 +326,110 @@ struct sigmaanalysis { if (cand.antilambdaBDTScore() <= AntiLambda_MLThreshold) return false; } else { + + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 1.); + histos.fill(HIST("GeneralQA/hPhotonMass"), cand.photonMass()); if (TMath::Abs(cand.photonMass()) > PhotonMaxMass) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 0.); + histos.fill(HIST("GeneralQA/hPhotonNegpT"), cand.photonNegPt()); + histos.fill(HIST("GeneralQA/hPhotonPospT"), cand.photonPosPt()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 2.); if ((cand.photonPosPt() < PhotonDauMinPt) || (cand.photonNegPt() < PhotonDauMinPt)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 1.); + histos.fill(HIST("GeneralQA/hPhotonDCANegToPV"), cand.photonDCANegPV()); + histos.fill(HIST("GeneralQA/hPhotonDCAPosToPV"), cand.photonDCAPosPV()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 3.); if ((TMath::Abs(cand.photonDCAPosPV()) < PhotonMinDCADauToPv) || (TMath::Abs(cand.photonDCANegPV()) < PhotonMinDCADauToPv)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 2.); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 4.); + histos.fill(HIST("GeneralQA/hPhotonDCADau"), cand.photonDCADau()); if (TMath::Abs(cand.photonDCADau()) > PhotonMaxDCAV0Dau) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 3.); + histos.fill(HIST("GeneralQA/hPhotonPosTPCCR"), cand.photonPosTPCCrossedRows()); + histos.fill(HIST("GeneralQA/hPhotonNegTPCCR"), cand.photonNegTPCCrossedRows()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 5.); if ((cand.photonPosTPCCrossedRows() < PhotonMinTPCCrossedRows) || (cand.photonNegTPCCrossedRows() < PhotonMinTPCCrossedRows)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 4.); + histos.fill(HIST("GeneralQA/hPhotonPosTPCNSigma"), cand.photonPosTPCNSigma()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 6.); if ((cand.photonPosTPCNSigma() < PhotonMinTPCNSigmas) || (cand.photonPosTPCNSigma() > PhotonMaxTPCNSigmas)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 5.); + histos.fill(HIST("GeneralQA/hPhotonNegTPCNSigma"), cand.photonNegTPCNSigma()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 7.); if ((cand.photonNegTPCNSigma() < PhotonMinTPCNSigmas) || (cand.photonNegTPCNSigma() > PhotonMaxTPCNSigmas)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 6.); + histos.fill(HIST("GeneralQA/hPhotonpT"), cand.photonPt()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 8.); if ((cand.photonPt() < PhotonMinPt) || (cand.photonPt() > PhotonMaxPt)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 7.); + histos.fill(HIST("GeneralQA/hPhotonY"), cand.photonY()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 9.); if ((TMath::Abs(cand.photonY()) > PhotonMaxRap)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 8.); + histos.fill(HIST("GeneralQA/hPhotonRadius"), cand.photonRadius()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 10.); if ((cand.photonRadius() < PhotonMinRadius) || (cand.photonRadius() > PhotonMaxRadius)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 9.); + histos.fill(HIST("GeneralQA/hPhotonZ"), cand.photonZconv()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 11.); if (TMath::Abs(cand.photonZconv()) > PhotonMaxZ) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 10.); + histos.fill(HIST("GeneralQA/h2dPhotonArmenteros"), cand.photonAlpha(), cand.photonQt()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 12.); if (cand.photonQt() > PhotonMaxQt) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 11.); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 13.); if (TMath::Abs(cand.photonAlpha()) > PhotonMaxAlpha) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 12.); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 14.); + histos.fill(HIST("GeneralQA/hPhotonCosPA"), cand.photonCosPA()); if (cand.photonCosPA() < PhotonMinV0cospa) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 13.); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 15.); // Lambda selection + histos.fill(HIST("GeneralQA/hLambdaMass"), cand.lambdaMass()); + histos.fill(HIST("GeneralQA/hAntiLambdaMass"), cand.antilambdaMass()); if ((TMath::Abs(cand.lambdaMass() - 1.115683) > LambdaWindow) && (TMath::Abs(cand.antilambdaMass() - 1.115683) > LambdaWindow)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 14.); + histos.fill(HIST("GeneralQA/hLambdaDCANegToPV"), cand.lambdaDCANegPV()); + histos.fill(HIST("GeneralQA/hLambdaDCAPosToPV"), cand.lambdaDCAPosPV()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 16.); if ((TMath::Abs(cand.lambdaDCAPosPV()) < LambdaMinDCAPosToPv) || (TMath::Abs(cand.lambdaDCANegPV()) < LambdaMinDCANegToPv)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 15.); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 17.); + histos.fill(HIST("GeneralQA/hLambdaRadius"), cand.lambdaRadius()); if ((cand.lambdaRadius() < LambdaMinv0radius) || (cand.lambdaRadius() > LambdaMaxv0radius)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 16.); + histos.fill(HIST("GeneralQA/hLambdaDCADau"), cand.lambdaDCADau()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 18.); if (TMath::Abs(cand.lambdaDCADau()) > LambdaMaxDCAV0Dau) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 17.); + histos.fill(HIST("GeneralQA/h2dLambdaArmenteros"), cand.lambdaAlpha(), cand.lambdaQt()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 19.); if ((cand.lambdaQt() < LambdaMinQt) || (cand.lambdaQt() > LambdaMaxQt)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 18.); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 20.); if ((TMath::Abs(cand.lambdaAlpha()) < LambdaMinAlpha) || (TMath::Abs(cand.lambdaAlpha()) > LambdaMaxAlpha)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 19.); + histos.fill(HIST("GeneralQA/hLambdaCosPA"), cand.lambdaCosPA()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 21.); if (cand.lambdaCosPA() < LambdaMinv0cospa) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 20.); + histos.fill(HIST("GeneralQA/hLambdaY"), cand.lambdaY()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 22.); if (TMath::Abs(cand.lambdaY()) > LambdaMaxRap) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 21.); + histos.fill(HIST("GeneralQA/hSigmaY"), cand.sigmaRapidity()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 23.); if (TMath::Abs(cand.sigmaRapidity()) > SigmaMaxRap) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 22.); + histos.fill(HIST("GeneralQA/hSigmaOPAngle"), cand.sigmaOPAngle()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 24.); + if (cand.sigmaOPAngle() > SigmaOPAngle) + return false; + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 25.); } - return true; } @@ -319,29 +445,127 @@ struct sigmaanalysis { void processMonteCarlo(aod::Sigma0Collision const& coll, V0MCSigmas const& v0s) { - histos.fill(HIST("hMCEventCentrality"), coll.centFT0C()); + histos.fill(HIST("MC/hMCEventCentrality"), coll.centFT0C()); for (auto& sigma : v0s) { // selecting Sigma0-like candidates - if (sigma.isSigma() || sigma.isAntiSigma()) { - histos.fill(HIST("MC/h2dArmenterosAll"), sigma.photonAlpha(), sigma.photonQt()); - histos.fill(HIST("MC/h2dArmenterosAll"), sigma.lambdaAlpha(), sigma.lambdaQt()); - histos.fill(HIST("MC/hMassSigma0All"), sigma.sigmaMass()); - histos.fill(HIST("MC/hPtSigma0All"), sigma.sigmapT()); + histos.fill(HIST("MC/h2dArmenterosBeforeSel"), sigma.photonAlpha(), sigma.photonQt()); + histos.fill(HIST("MC/h2dArmenterosBeforeSel"), sigma.lambdaAlpha(), sigma.lambdaQt()); + histos.fill(HIST("MC/hMassSigma0BeforeSel"), sigma.sigmaMass()); + histos.fill(HIST("MC/hPtSigma0BeforeSel"), sigma.sigmapT()); + + if (sigma.photonCandPDGCode() == 22) + histos.fill(HIST("MC/hPtTrueGamma_BeforeSel"), sigma.photonPt()); + if (sigma.lambdaCandPDGCode() == 3122) + histos.fill(HIST("MC/hPtTrueLambda_BeforeSel"), sigma.lambdaPt()); + if (sigma.isSigma() || sigma.isAntiSigma()) + histos.fill(HIST("MC/hPtTrueSigma_BeforeSel"), sigma.sigmapT()); - if (!processSigmaCandidate(sigma)) - continue; + histos.fill(HIST("MC/hPtGammaCand_BeforeSel"), sigma.photonPt()); + histos.fill(HIST("MC/hPtLambdaCand_BeforeSel"), sigma.lambdaPt()); + histos.fill(HIST("MC/hPtSigmaCand_BeforeSel"), sigma.sigmapT()); - histos.fill(HIST("MC/h2dArmenterosSelected"), sigma.photonAlpha(), sigma.photonQt()); - histos.fill(HIST("MC/h2dArmenterosSelected"), sigma.lambdaAlpha(), sigma.lambdaQt()); + if (!processSigmaCandidate(sigma)) + continue; + // Purity Study + PID study: + bool fPassTPCPID = false; + bool fPassTOFPID = false; + + histos.fill(HIST("MC/hPtGammaCand_AfterSel"), sigma.photonPt()); + histos.fill(HIST("MC/hPtSigmaCand_AfterSel"), sigma.sigmapT()); + + if (sigma.photonCandPDGCode() == 22) + histos.fill(HIST("MC/hPtTrueGamma_AfterSel"), sigma.photonPt()); + + // For Lambda PID Studies + if (sigma.lambdaAlpha() > 0) { + histos.fill(HIST("MC/hPtLambdaCand_AfterSel"), sigma.lambdaPt()); + histos.fill(HIST("MC/h3dTPCvsTOFNSigma_LambdaPr"), sigma.lambdaPosPrTPCNSigma(), sigma.lambdaPrTOFNSigma(), sigma.sigmapT()); + histos.fill(HIST("MC/h3dTPCvsTOFNSigma_LambdaPi"), sigma.lambdaNegPiTPCNSigma(), sigma.lambdaPiTOFNSigma(), sigma.sigmapT()); + + if (sigma.lambdaCandPDGCode() == 3122) { + histos.fill(HIST("MC/hPtTrueLambda_AfterSel"), sigma.lambdaPt()); + histos.fill(HIST("MC/h3dTPCvsTOFNSigma_TrueLambdaPr"), sigma.lambdaPosPrTPCNSigma(), sigma.lambdaPrTOFNSigma(), sigma.sigmapT()); + histos.fill(HIST("MC/h3dTPCvsTOFNSigma_TrueLambdaPi"), sigma.lambdaNegPiTPCNSigma(), sigma.lambdaPiTOFNSigma(), sigma.sigmapT()); + } + + // TPC PID: + if ((TMath::Abs(sigma.lambdaPosPrTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.lambdaNegPiTPCNSigma()) < LambdaMaxTPCNSigmas)) { + fPassTPCPID = true; + histos.fill(HIST("MC/hPtLambdaCandidates_TPCPID"), sigma.lambdaPt()); + if (sigma.lambdaCandPDGCode() == 3122) + histos.fill(HIST("MC/hPtTrueLambda_TPCPID"), sigma.lambdaPt()); + } + + // TOF PID: + if ((TMath::Abs(sigma.lambdaPrTOFNSigma()) < LambdaMaxTOFNSigmas) && (TMath::Abs(sigma.lambdaPiTOFNSigma()) < LambdaMaxTOFNSigmas)) { + fPassTOFPID = true; + histos.fill(HIST("MC/hPtLambdaCandidates_TOFPID"), sigma.lambdaPt()); + if (sigma.lambdaCandPDGCode() == 3122) + histos.fill(HIST("MC/hPtTrueLambda_TOFPID"), sigma.lambdaPt()); + } + // TPC + TOF PID: + if (fPassTPCPID && fPassTOFPID) { + histos.fill(HIST("MC/hPtLambdaCandidates_TPCTOFPID"), sigma.lambdaPt()); + if (sigma.lambdaCandPDGCode() == 3122) + histos.fill(HIST("MC/hPtTrueLambda_TPCTOFPID"), sigma.lambdaPt()); + } + } + + // For Opening Angle study + if (sigma.sigmaOPAngle() <= SigmaOPAngle) { + histos.fill(HIST("MC/h2dPtVsMassSigma_AfterOPAngleSel"), sigma.sigmapT(), sigma.sigmaMass()); + histos.fill(HIST("MC/hPtSigmaCand_AngleSel"), sigma.sigmapT()); + if (sigma.isSigma() || sigma.isAntiSigma()) + histos.fill(HIST("MC/hPtTrueSigma_AngleSel"), sigma.sigmapT()); + } + + // For background studies: + histos.fill(HIST("MC/h2dPtVsMassSigma_SignalBkg"), sigma.sigmapT(), sigma.sigmaMass()); + // Real Gamma x Real Lambda - but not from the same sigma0/antisigma0! + if ((sigma.photonCandPDGCode() == 22) && ((sigma.lambdaCandPDGCode() == 3122) || (sigma.lambdaCandPDGCode() == -3122)) && !(sigma.isSigma()) && !(sigma.isAntiSigma())) { + histos.fill(HIST("MC/h2dPtVsMassSigma_TrueDaughters"), sigma.sigmapT(), sigma.sigmaMass()); + histos.fill(HIST("MC/h2dTrueDaughtersMatrix"), sigma.lambdaCandPDGCodeMother(), sigma.photonCandPDGCodeMother()); + histos.fill(HIST("MC/h2dPtVsOPAngle_TrueDaughters"), sigma.sigmapT(), sigma.sigmaOPAngle()); + } + // Real Gamma x fake Lambda + if ((sigma.photonCandPDGCode() == 22) && (sigma.lambdaCandPDGCode() != 3122) && (sigma.lambdaCandPDGCode() != -3122)) + histos.fill(HIST("MC/h2dPtVsMassSigma_TrueGammaFakeLambda"), sigma.sigmapT(), sigma.sigmaMass()); + + // Fake Gamma x Real Lambda + if ((sigma.photonCandPDGCode() != 22) && ((sigma.lambdaCandPDGCode() == 3122) || (sigma.lambdaCandPDGCode() == -3122))) + histos.fill(HIST("MC/h2dPtVsMassSigma_FakeGammaTrueLambda"), sigma.sigmapT(), sigma.sigmaMass()); + + // Fake Gamma x Fake Lambda + if ((sigma.photonCandPDGCode() != 22) && (sigma.lambdaCandPDGCode() != 3122) && (sigma.lambdaCandPDGCode() != -3122)) + histos.fill(HIST("MC/h2dPtVsMassSigma_FakeDaughters"), sigma.sigmapT(), sigma.sigmaMass()); + + // MC association (signal study) + if (sigma.isSigma() || sigma.isAntiSigma()) { + histos.fill(HIST("MC/h2dPtVsMassSigma_SignalOnly"), sigma.sigmapT(), sigma.sigmaMass()); + histos.fill(HIST("MC/h2dPtVsOPAngle_SignalOnly"), sigma.sigmapT(), sigma.sigmaOPAngle()); + histos.fill(HIST("MC/hPtTrueSigma_AfterSel"), sigma.sigmapT()); + histos.fill(HIST("GeneralQA/hPhotonMassSelected"), sigma.photonMass()); if (sigma.isSigma()) { - histos.fill(HIST("MC/hMassSigma0"), sigma.sigmaMass()); - histos.fill(HIST("MC/hPtSigma0"), sigma.sigmapT()); - histos.fill(HIST("MC/h3dMassSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + // PID selections + if ((TMath::Abs(sigma.lambdaPosPrTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.lambdaNegPiTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.lambdaPrTOFNSigma()) < LambdaMaxTOFNSigmas) && (TMath::Abs(sigma.lambdaPiTOFNSigma()) < LambdaMaxTOFNSigmas)) { + histos.fill(HIST("MC/h2dArmenterosAfterSel"), sigma.photonAlpha(), sigma.photonQt()); + histos.fill(HIST("MC/h2dArmenterosAfterSel"), sigma.lambdaAlpha(), sigma.lambdaQt()); + histos.fill(HIST("GeneralQA/hLambdaMassSelected"), sigma.lambdaMass()); + histos.fill(HIST("MC/hMassSigma0"), sigma.sigmaMass()); + histos.fill(HIST("MC/hPtSigma0"), sigma.sigmapT()); + histos.fill(HIST("MC/h3dMassSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + } } else { - histos.fill(HIST("MC/hMassAntiSigma0"), sigma.sigmaMass()); - histos.fill(HIST("MC/hPtAntiSigma0"), sigma.sigmapT()); - histos.fill(HIST("MC/h3dMassAntiSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + // PID selections + if ((TMath::Abs(sigma.lambdaPosPiTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.lambdaNegPrTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.aLambdaPrTOFNSigma()) < LambdaMaxTOFNSigmas) && (TMath::Abs(sigma.aLambdaPiTOFNSigma()) < LambdaMaxTOFNSigmas)) { + histos.fill(HIST("MC/h2dArmenterosAfterSel"), sigma.photonAlpha(), sigma.photonQt()); + histos.fill(HIST("GeneralQA/hAntiLambdaMassSelected"), sigma.antilambdaMass()); + histos.fill(HIST("MC/h2dArmenterosAfterSel"), sigma.lambdaAlpha(), sigma.lambdaQt()); + histos.fill(HIST("MC/hMassAntiSigma0"), sigma.sigmaMass()); + histos.fill(HIST("MC/hPtAntiSigma0"), sigma.sigmapT()); + histos.fill(HIST("MC/h3dMassAntiSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + } } } } @@ -351,9 +575,9 @@ struct sigmaanalysis { { histos.fill(HIST("hEventCentrality"), coll.centFT0C()); for (auto& sigma : v0s) { // selecting Sigma0-like candidates - histos.fill(HIST("GeneralQA/h2dArmenterosAll"), sigma.photonAlpha(), sigma.photonQt()); - histos.fill(HIST("GeneralQA/h2dArmenterosAll"), sigma.lambdaAlpha(), sigma.lambdaQt()); - histos.fill(HIST("GeneralQA/hMassSigma0All"), sigma.sigmaMass()); + histos.fill(HIST("GeneralQA/h2dArmenterosBeforeSel"), sigma.photonAlpha(), sigma.photonQt()); + histos.fill(HIST("GeneralQA/h2dArmenterosBeforeSel"), sigma.lambdaAlpha(), sigma.lambdaQt()); + histos.fill(HIST("GeneralQA/hMassSigma0BeforeSel"), sigma.sigmaMass()); nSigmaCandidates++; if (nSigmaCandidates % 50000 == 0) { @@ -362,19 +586,35 @@ struct sigmaanalysis { if (!processSigmaCandidate(sigma)) continue; - histos.fill(HIST("GeneralQA/h2dArmenterosSelected"), sigma.photonAlpha(), sigma.photonQt()); - histos.fill(HIST("GeneralQA/h2dArmenterosSelected"), sigma.lambdaAlpha(), sigma.lambdaQt()); - + histos.fill(HIST("GeneralQA/hPhotonMassSelected"), sigma.photonMass()); if (sigma.lambdaAlpha() > 0) { - histos.fill(HIST("Sigma0/hMassSigma0"), sigma.sigmaMass()); - histos.fill(HIST("Sigma0/hPtSigma0"), sigma.sigmapT()); - histos.fill(HIST("Sigma0/hRapiditySigma0"), sigma.sigmaRapidity()); - histos.fill(HIST("Sigma0/h3dMassSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + // PID selections + histos.fill(HIST("GeneralQA/h2dTPCvsTOFNSigma_LambdaPr"), sigma.lambdaPosPrTPCNSigma(), sigma.lambdaPrTOFNSigma()); + histos.fill(HIST("GeneralQA/h2dTPCvsTOFNSigma_LambdaPi"), sigma.lambdaNegPiTPCNSigma(), sigma.lambdaPiTOFNSigma()); + if ((TMath::Abs(sigma.lambdaPosPrTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.lambdaNegPiTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.lambdaPrTOFNSigma()) < LambdaMaxTOFNSigmas) && (TMath::Abs(sigma.lambdaPiTOFNSigma()) < LambdaMaxTOFNSigmas)) { + histos.fill(HIST("GeneralQA/h2dArmenterosAfterSel"), sigma.photonAlpha(), sigma.photonQt()); + histos.fill(HIST("GeneralQA/h2dArmenterosAfterSel"), sigma.lambdaAlpha(), sigma.lambdaQt()); + histos.fill(HIST("GeneralQA/hLambdaMassSelected"), sigma.lambdaMass()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 26.); + histos.fill(HIST("Sigma0/hMassSigma0"), sigma.sigmaMass()); + histos.fill(HIST("Sigma0/hPtSigma0"), sigma.sigmapT()); + histos.fill(HIST("Sigma0/hRapiditySigma0"), sigma.sigmaRapidity()); + histos.fill(HIST("Sigma0/h3dMassSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + } } else { - histos.fill(HIST("AntiSigma0/hMassAntiSigma0"), sigma.sigmaMass()); - histos.fill(HIST("AntiSigma0/hPtAntiSigma0"), sigma.sigmapT()); - histos.fill(HIST("AntiSigma0/hRapidityAntiSigma0"), sigma.sigmaRapidity()); - histos.fill(HIST("AntiSigma0/h3dMassAntiSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + // PID selections + histos.fill(HIST("GeneralQA/h2dTPCvsTOFNSigma_ALambdaPr"), sigma.lambdaNegPrTPCNSigma(), sigma.aLambdaPrTOFNSigma()); + histos.fill(HIST("GeneralQA/h2dTPCvsTOFNSigma_ALambdaPi"), sigma.lambdaPosPiTPCNSigma(), sigma.aLambdaPiTOFNSigma()); + if ((TMath::Abs(sigma.lambdaPosPiTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.lambdaNegPrTPCNSigma()) < LambdaMaxTPCNSigmas) && (TMath::Abs(sigma.aLambdaPrTOFNSigma()) < LambdaMaxTOFNSigmas) && (TMath::Abs(sigma.aLambdaPiTOFNSigma()) < LambdaMaxTOFNSigmas)) { + histos.fill(HIST("GeneralQA/h2dArmenterosAfterSel"), sigma.photonAlpha(), sigma.photonQt()); + histos.fill(HIST("GeneralQA/h2dArmenterosAfterSel"), sigma.lambdaAlpha(), sigma.lambdaQt()); + histos.fill(HIST("GeneralQA/hAntiLambdaMassSelected"), sigma.antilambdaMass()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 26.); + histos.fill(HIST("AntiSigma0/hMassAntiSigma0"), sigma.sigmaMass()); + histos.fill(HIST("AntiSigma0/hPtAntiSigma0"), sigma.sigmapT()); + histos.fill(HIST("AntiSigma0/hRapidityAntiSigma0"), sigma.sigmaRapidity()); + histos.fill(HIST("AntiSigma0/h3dMassAntiSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + } } } } diff --git a/PWGLF/Tasks/Strangeness/strange-yield-pbpb.cxx b/PWGLF/Tasks/Strangeness/strange-yield-pbpb.cxx index 777554a5916..63c866695dc 100644 --- a/PWGLF/Tasks/Strangeness/strange-yield-pbpb.cxx +++ b/PWGLF/Tasks/Strangeness/strange-yield-pbpb.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -81,9 +82,10 @@ struct strangeYieldPbPb { Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; - Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", true, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; Configurable studyUPConly{"studyUPConly", false, "is UPC-only analysis"}; + Configurable useUPCflag{"useUPCflag", false, "select UPC flagged events"}; Configurable verbose{"verbose", false, "additional printouts"}; @@ -172,13 +174,13 @@ struct strangeYieldPbPb { Configurable doPlainTopoQA{"doPlainTopoQA", true, "do simple 1D QA of candidates"}; struct : ConfigurableGroup { - ConfigurableAxis axisFT0Aampl{"FT0Aamplitude", {100, 0.0f, 2000.0f}, "FT0Aamplitude"}; - ConfigurableAxis axisFT0Campl{"FT0Camplitude", {100, 0.0f, 2000.0f}, "FT0Camplitude"}; - ConfigurableAxis axisFV0Aampl{"FV0Aamplitude", {100, 0.0f, 2000.0f}, "FV0Aamplitude"}; - ConfigurableAxis axisFDDAampl{"FDDAamplitude", {100, 0.0f, 2000.0f}, "FDDAamplitude"}; - ConfigurableAxis axisFDDCampl{"FDDCamplitude", {100, 0.0f, 2000.0f}, "FDDCamplitude"}; - ConfigurableAxis axisZNAampl{"ZNAamplitude", {100, 0.0f, 250.0f}, "ZNAamplitude"}; - ConfigurableAxis axisZNCampl{"ZNCamplitude", {100, 0.0f, 250.0f}, "ZNCamplitude"}; + ConfigurableAxis axisFT0Aampl{"axisFT0Aampl", {100, 0.0f, 2000.0f}, "FT0Aamplitude"}; + ConfigurableAxis axisFT0Campl{"axisFT0Campl", {100, 0.0f, 2000.0f}, "FT0Camplitude"}; + ConfigurableAxis axisFV0Aampl{"axisFV0Aampl", {100, 0.0f, 2000.0f}, "FV0Aamplitude"}; + ConfigurableAxis axisFDDAampl{"axisFDDAampl", {100, 0.0f, 2000.0f}, "FDDAamplitude"}; + ConfigurableAxis axisFDDCampl{"axisFDDCampl", {100, 0.0f, 2000.0f}, "FDDCamplitude"}; + ConfigurableAxis axisZNAampl{"axisZNAampl", {100, 0.0f, 250.0f}, "ZNAamplitude"}; + ConfigurableAxis axisZNCampl{"axisZNCampl", {100, 0.0f, 250.0f}, "ZNCamplitude"}; } axisDetectors; // for MC @@ -193,7 +195,7 @@ struct strangeYieldPbPb { ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for v0 analysis"}; ConfigurableAxis axisPtXi{"axisPtCasc", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for cascade analysis"}; ConfigurableAxis axisPtCoarse{"axisPtCoarse", {VARIABLE_WIDTH, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 7.0f, 10.0f, 15.0f}, "pt axis for QA"}; - ConfigurableAxis axisEta{"axisEta", {40, -2.0f, 2.0f}, "#eta"}; + ConfigurableAxis axisEta{"axisEta", {100, -2.0f, 2.0f}, "#eta"}; ConfigurableAxis axisRap{"axisRap", {100, -2.0f, 2.0f}, "y"}; // Invariant mass axes @@ -209,8 +211,16 @@ struct strangeYieldPbPb { axisOmegaMass, axisOmegaMass}; - ConfigurableAxis axisNch{"axisNch", {2000, -0.5f, 1999.5f}, "Number of charged particles"}; - ConfigurableAxis axisFT0C{"FT0C", + ConfigurableAxis axisNTracksGlobal{"axisNTracksGlobal", {100, -0.5f, 99.5f}, "Number of global tracks"}; + ConfigurableAxis axisNTracksPVeta1{"axisNTracksPVeta1", {100, -0.5f, 99.5f}, "Number of PV contributors in |eta| < 1"}; + ConfigurableAxis axisNTracksTotalExceptITSonly{"axisNTracksTotalExceptITSonly", {100, -0.5f, 99.5f}, "Number of ITS-TPC and TPC only tracks"}; + ConfigurableAxis axisNchInvMass{"axisNchInvMass", {200, -0.5f, 199.5f}, "Number of charged particles for kTHnSparseF"}; + + ConfigurableAxis axisFT0C_QA{"axisFT0C_QA", + {VARIABLE_WIDTH, 0., 0.01, 0.05, 0.1, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 105.5}, + "FT0C (%)"}; + + ConfigurableAxis axisFT0C{"axisFT0C", {VARIABLE_WIDTH, 0., 0.01, 0.05, 0.1, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 105.5}, "FT0C (%)"}; @@ -340,11 +350,11 @@ struct strangeYieldPbPb { void addKinematicQAHistograms(HistogramRegistry& histos) { const bool isCascade = (partID > 2.5) ? true : false; - histos.add(Form("%s/h2dPosEtaPt", particlenames[partID].data()), "h2dPosEtaPt", kTH3F, {axisPtCoarse, axisEta, axisSelGap}); - histos.add(Form("%s/h2dNegEtaPt", particlenames[partID].data()), "h2dNegEtaPt", kTH3F, {axisPtCoarse, axisEta, axisSelGap}); - histos.add(Form("%s/h2dRapPt", particlenames[partID].data()), "h2dRapPt", kTH3F, {axisPtCoarse, axisRap, axisSelGap}); + histos.add(Form("%s/h3dPosEtaPt", particlenames[partID].data()), "h3dPosEtaPt", kTH3F, {axisPtCoarse, axisEta, axisSelGap}); + histos.add(Form("%s/h3dNegEtaPt", particlenames[partID].data()), "h3dNegEtaPt", kTH3F, {axisPtCoarse, axisEta, axisSelGap}); + histos.add(Form("%s/h3dRapPt", particlenames[partID].data()), "h3dRapPt", kTH3F, {axisPtCoarse, axisRap, axisSelGap}); if (isCascade) { - histos.add(Form("%s/h2dBachEtaPt", particlenames[partID].data()), "h2dBachEtaPt", kTH3F, {axisPtCoarse, axisEta, axisSelGap}); + histos.add(Form("%s/h3dBachEtaPt", particlenames[partID].data()), "h3dBachEtaPt", kTH3F, {axisPtCoarse, axisEta, axisSelGap}); } } @@ -354,30 +364,30 @@ struct strangeYieldPbPb { const bool isCascade = (partID > 2.5) ? true : false; if (doDetectPropQA == 1) { if (isCascade) { - histos.add(Form("%s/h8dDetectPropVsCentrality", particlenames[partID].data()), "h8dDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse}); + histos.add(Form("%s/h8dDetectPropVsCentrality", particlenames[partID].data()), "h8dDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse}); } else { - histos.add(Form("%s/h6dDetectPropVsCentrality", particlenames[partID].data()), "h6dDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse}); + histos.add(Form("%s/h6dDetectPropVsCentrality", particlenames[partID].data()), "h6dDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse}); } - histos.add(Form("%s/h4dPosDetectPropVsCentrality", particlenames[partID].data()), "h4dPosDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse}); - histos.add(Form("%s/h4dNegDetectPropVsCentrality", particlenames[partID].data()), "h4dNegDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse}); - histos.add(Form("%s/h4dBachDetectPropVsCentrality", particlenames[partID].data()), "h4dBachDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse}); + histos.add(Form("%s/h4dPosDetectPropVsCentrality", particlenames[partID].data()), "h4dPosDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse}); + histos.add(Form("%s/h4dNegDetectPropVsCentrality", particlenames[partID].data()), "h4dNegDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse}); + histos.add(Form("%s/h4dBachDetectPropVsCentrality", particlenames[partID].data()), "h4dBachDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse}); } if (doDetectPropQA == 2) { if (isCascade) { - histos.add(Form("%s/h9dDetectPropVsCentrality", particlenames[partID].data()), "h9dDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse, axisInvMass.at(partID)}); + histos.add(Form("%s/h9dDetectPropVsCentrality", particlenames[partID].data()), "h9dDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse, axisInvMass.at(partID)}); } else { - histos.add(Form("%s/h7dDetectPropVsCentrality", particlenames[partID].data()), "h7dDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse, axisInvMass.at(partID)}); + histos.add(Form("%s/h7dDetectPropVsCentrality", particlenames[partID].data()), "h7dDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse, axisInvMass.at(partID)}); } - histos.add(Form("%s/h5dPosDetectPropVsCentrality", particlenames[partID].data()), "h5dPosDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse, axisInvMass.at(partID)}); - histos.add(Form("%s/h5dNegDetectPropVsCentrality", particlenames[partID].data()), "h5dNegDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse, axisInvMass.at(partID)}); - histos.add(Form("%s/h5dBachDetectPropVsCentrality", particlenames[partID].data()), "h5dBachDetectPropVsCentrality", kTHnF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse, axisInvMass.at(partID)}); + histos.add(Form("%s/h5dPosDetectPropVsCentrality", particlenames[partID].data()), "h5dPosDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse, axisInvMass.at(partID)}); + histos.add(Form("%s/h5dNegDetectPropVsCentrality", particlenames[partID].data()), "h5dNegDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse, axisInvMass.at(partID)}); + histos.add(Form("%s/h5dBachDetectPropVsCentrality", particlenames[partID].data()), "h5dBachDetectPropVsCentrality", kTHnSparseF, {axisFT0C, axisDetMap, axisITScluMap, axisPtCoarse, axisInvMass.at(partID)}); } } template void addHistograms(HistogramRegistry& histos) { - histos.add(Form("%s/h5dMass", particlenames[partID].data()), "h5dMass", kTHnF, {axisFT0C, axisPt, axisInvMass.at(partID), axisSelGap, {100, -0.5f, 99.5f}}); + histos.add(Form("%s/h7dMass", particlenames[partID].data()), "h7dMass", kTHnSparseF, {axisFT0C, axisPt, axisInvMass.at(partID), axisSelGap, axisNchInvMass, axisRap, axisEta}); histos.add(Form("%s/h2dMass", particlenames[partID].data()), "h2dMass", kTH2F, {axisInvMass.at(partID), axisSelGap}); if (doPlainTopoQA) { addTopoHistograms(histos); @@ -464,11 +474,11 @@ struct strangeYieldPbPb { } histos.fill(HIST(particlenames[partID]) + HIST("/h2dMass"), invMass, gap); - histos.fill(HIST(particlenames[partID]) + HIST("/h5dMass"), centrality, pT, invMass, gap, coll.multNTracksGlobal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h7dMass"), centrality, pT, invMass, gap, coll.multNTracksGlobal(), rapidity, cand.eta()); if (doKienmaticQA) { - histos.fill(HIST(particlenames[partID]) + HIST("/h2dPosEtaPt"), pT, cand.positiveeta(), gap); - histos.fill(HIST(particlenames[partID]) + HIST("/h2dNegEtaPt"), pT, cand.negativeeta(), gap); - histos.fill(HIST(particlenames[partID]) + HIST("/h2dRapPt"), pT, rapidity, gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosEtaPt"), pT, cand.positiveeta(), gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegEtaPt"), pT, cand.negativeeta(), gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dRapPt"), pT, rapidity, gap); } if (doPlainTopoQA) { histos.fill(HIST(particlenames[partID]) + HIST("/hPosDCAToPV"), cand.dcapostopv()); @@ -614,12 +624,12 @@ struct strangeYieldPbPb { } } histos.fill(HIST(particlenames[partID]) + HIST("/h2dMass"), invMass, gap); - histos.fill(HIST(particlenames[partID]) + HIST("/h5dMass"), centrality, pT, invMass, gap, coll.multNTracksGlobal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h7dMass"), centrality, pT, invMass, gap, coll.multNTracksGlobal(), rapidity, cand.eta()); if (doKienmaticQA) { - histos.fill(HIST(particlenames[partID]) + HIST("/h2dPosEtaPt"), pT, cand.positiveeta(), gap); - histos.fill(HIST(particlenames[partID]) + HIST("/h2dNegEtaPt"), pT, cand.negativeeta(), gap); - histos.fill(HIST(particlenames[partID]) + HIST("/h2dBachEtaPt"), pT, cand.bacheloreta(), gap); - histos.fill(HIST(particlenames[partID]) + HIST("/h2dRapPt"), pT, rapidity, gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosEtaPt"), pT, cand.positiveeta(), gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegEtaPt"), pT, cand.negativeeta(), gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachEtaPt"), pT, cand.bacheloreta(), gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dRapPt"), pT, rapidity, gap); } if (doPlainTopoQA) { histos.fill(HIST(particlenames[partID]) + HIST("/hCascCosPA"), pT, cand.casccosPA(coll.posX(), coll.posY(), coll.posZ())); @@ -813,7 +823,7 @@ struct strangeYieldPbPb { maskSelectionAntiOmega = maskTopologicalCasc | maskKinematicCasc | maskTrackPropertiesCasc | maskAntiOmegaSpecific | (std::bitset(1) << selPhysPrimAntiOmega); // Event Counters - histos.add("hEventSelection", "hEventSelection", kTH1F, {{15, -0.5f, +14.5f}}); + histos.add("hEventSelection", "hEventSelection", kTH1F, {{16, -0.5f, +15.5f}}); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "kIsTriggerTVX"); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "posZ cut"); @@ -829,19 +839,21 @@ struct strangeYieldPbPb { histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "Below min occup."); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "Above max occup."); histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "isUPC"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "has UPC flag"); // Event QA - histos.add("eventQA/hEventCentrality", "hEventCentrality", kTH1F, {axisFT0C}); - histos.add("eventQA/hCentralityVsNch", "hCentralityVsNch", kTH2F, {axisFT0C, axisNch}); - histos.add("eventQA/hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy}); - histos.add("eventQA/hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2F, {axisFT0C, axisOccupancy}); - histos.add("eventQA/hEventNchCorrelationAfCuts", "hEventNchCorrelationAfCuts", kTH2F, {{5000, 0, 5000}, {5000, 0, 2500}}); - histos.add("eventQA/hEventGlobalTracksVsCentrality", "hEventGlobalTracksVsCentrality", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); + histos.add("eventQA/hCentrality", "hCentrality", kTH2F, {axisFT0C_QA, axisSelGap}); + histos.add("eventQA/hCentralityVsTracksPVeta1", "hCentralityVsTracksPVeta1", kTH3F, {axisFT0C_QA, axisNTracksPVeta1, axisSelGap}); + histos.add("eventQA/hCentralityVsTracksTotalExceptITSonly", "hCentralityVsTracksTotalExceptITSonly", kTH3F, {axisFT0C_QA, axisNTracksTotalExceptITSonly, axisSelGap}); + histos.add("eventQA/hOccupancy", "hOccupancy", kTH2F, {axisOccupancy, axisSelGap}); + histos.add("eventQA/hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH3F, {axisFT0C_QA, axisOccupancy, axisSelGap}); + histos.add("eventQA/hTracksPVeta1VsTracksGlobal", "hTracksPVeta1VsTracksGlobal", kTH3F, {axisNTracksPVeta1, axisNTracksGlobal, axisSelGap}); + histos.add("eventQA/hCentralityVsTracksGlobal", "hCentralityVsTracksGlobal", kTH3F, {axisFT0C_QA, axisNTracksGlobal, axisSelGap}); histos.add("eventQA/hGapSide", "Gap side; Entries", kTH1F, {{5, -0.5, 4.5}}); histos.add("eventQA/hSelGapSide", "Selected gap side; Entries", kTH1F, {axisSelGap}); - histos.add("eventQA/hPosX", "Vertex position in x", kTH1F, {{100, -0.1, 0.1}}); - histos.add("eventQA/hPosY", "Vertex position in y", kTH1F, {{100, -0.1, 0.1}}); - histos.add("eventQA/hPosZ", "Vertex position in z", kTH1F, {{100, -20., 20.}}); + histos.add("eventQA/hPosX", "Vertex position in x", kTH2F, {{100, -0.1, 0.1}, axisSelGap}); + histos.add("eventQA/hPosY", "Vertex position in y", kTH2F, {{100, -0.1, 0.1}, axisSelGap}); + histos.add("eventQA/hPosZ", "Vertex position in z", kTH2F, {{100, -20., 20.}, axisSelGap}); histos.add("eventQA/hFT0", "hFT0", kTH3F, {axisDetectors.axisFT0Aampl, axisDetectors.axisFT0Campl, axisSelGap}); histos.add("eventQA/hFDD", "hFDD", kTH3F, {axisDetectors.axisFDDAampl, axisDetectors.axisFDDCampl, axisSelGap}); histos.add("eventQA/hZN", "hZN", kTH3F, {axisDetectors.axisZNAampl, axisDetectors.axisZNCampl, axisSelGap}); @@ -942,19 +954,20 @@ struct strangeYieldPbPb { } template - void fillHistogramsQA(TCollision const& collision) + void fillHistogramsQA(TCollision const& collision, int const& gap) { // QA histograms float centrality = collision.centFT0C(); - histos.fill(HIST("eventQA/hEventCentrality"), centrality); - histos.fill(HIST("eventQA/hCentralityVsNch"), centrality, collision.multNTracksPVeta1()); - histos.fill(HIST("eventQA/hEventOccupancy"), collision.trackOccupancyInTimeRange()); - histos.fill(HIST("eventQA/hCentralityVsOccupancy"), centrality, collision.trackOccupancyInTimeRange()); - histos.fill(HIST("eventQA/hEventNchCorrelationAfCuts"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); - histos.fill(HIST("eventQA/hEventGlobalTracksVsCentrality"), centrality, collision.multNTracksGlobal()); - histos.fill(HIST("eventQA/hPosX"), collision.posX()); - histos.fill(HIST("eventQA/hPosY"), collision.posY()); - histos.fill(HIST("eventQA/hPosZ"), collision.posZ()); + histos.fill(HIST("eventQA/hCentrality"), centrality, gap); + histos.fill(HIST("eventQA/hCentralityVsTracksTotalExceptITSonly"), centrality, collision.multAllTracksTPCOnly() + collision.multAllTracksITSTPC(), gap); + histos.fill(HIST("eventQA/hCentralityVsTracksPVeta1"), centrality, collision.multNTracksPVeta1(), gap); + histos.fill(HIST("eventQA/hOccupancy"), collision.trackOccupancyInTimeRange(), gap); + histos.fill(HIST("eventQA/hCentralityVsOccupancy"), centrality, collision.trackOccupancyInTimeRange(), gap); + histos.fill(HIST("eventQA/hTracksPVeta1VsTracksGlobal"), collision.multNTracksPVeta1(), collision.multNTracksGlobal(), gap); + histos.fill(HIST("eventQA/hCentralityVsTracksGlobal"), centrality, collision.multNTracksGlobal(), gap); + histos.fill(HIST("eventQA/hPosX"), collision.posX(), gap); + histos.fill(HIST("eventQA/hPosY"), collision.posY(), gap); + histos.fill(HIST("eventQA/hPosZ"), collision.posZ(), gap); } template @@ -1033,6 +1046,12 @@ struct strangeYieldPbPb { histos.fill(HIST("hEventSelection"), 14 /* is UPC compatible */); } + if (useUPCflag && (collision.flags() < 1)) { + return false; + } else if (collision.flags() >= 1) { + histos.fill(HIST("hEventSelection"), 15 /* UPC event */); + } + return true; } @@ -1504,7 +1523,7 @@ struct strangeYieldPbPb { if (studyUPConly && (selGapSide < -0.5)) return; - fillHistogramsQA(collision); + fillHistogramsQA(collision, selGapSide); for (auto& v0 : fullV0s) { if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) @@ -1530,7 +1549,7 @@ struct strangeYieldPbPb { if (studyUPConly && (selGapSide < -0.5)) return; - fillHistogramsQA(collision); + fillHistogramsQA(collision, selGapSide); for (auto& casc : fullCascades) { std::bitset selMap = computeBitmapCascade(casc, collision); diff --git a/PWGLF/Tasks/Strangeness/strangeness_in_jets.cxx b/PWGLF/Tasks/Strangeness/strangeness_in_jets.cxx index db2c7c01d83..6499e3575fc 100644 --- a/PWGLF/Tasks/Strangeness/strangeness_in_jets.cxx +++ b/PWGLF/Tasks/Strangeness/strangeness_in_jets.cxx @@ -111,8 +111,9 @@ struct strangeness_in_jets { void init(InitContext const&) { // Event Counters - registryData.add("number_of_events_data", "number of events in data", HistType::kTH1F, {{20, 0, 20, "Event Cuts"}}); - registryMC.add("number_of_events_mc", "number of events in mc", HistType::kTH1F, {{10, 0, 10, "Event Cuts"}}); + registryData.add("number_of_events_data", "number of events in data", HistType::kTH1D, {{20, 0, 20, "Event Cuts"}}); + registryData.add("number_of_events_vsmultiplicity", "number of events in data vs multiplicity", HistType::kTH1D, {{101, 0, 101, "Multiplicity percentile"}}); + registryMC.add("number_of_events_mc", "number of events in mc", HistType::kTH1D, {{10, 0, 10, "Event Cuts"}}); // QC Histograms registryQC.add("deltaEtadeltaPhi_jet", "deltaEtadeltaPhi_jet", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, 0.5 * TMath::Pi(), "#Delta#phi"}}); @@ -945,6 +946,8 @@ struct strangeness_in_jets { // Event multiplicity float multiplicity = collision.centFT0M(); + registryData.fill(HIST("number_of_events_vsmultiplicity"), multiplicity); + for (int i = 0; i < static_cast(jet.size()); i++) { if (isSelected[i] == 0) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index 5693ab6f0a8..0b1bb3c88ac 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// -/// \brief V0 task for production of invariant mass plots for Optimised Topological Cuts Analysis +/// \brief V0 task for production of invariant mass plots for Pt Spectrum Analysis /// \author Nikolaos Karatzenis (nikolaos.karatzenis@cern.ch) /// \author Roman Lietava (roman.lietava@cern.ch) @@ -19,11 +19,18 @@ for different pt ranges (constituting bins), so 3x20=60 plots.The values are ins Plots of the invariant masses at different stages of the analysis (ex. before and after the V0 cuts are enforced) and some pt distributions. This analysis includes two processes, one for Real Data and one for MC Data switchable at the end of the code, only run one at a time*/ +#include +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Common/DataModel/EventSelection.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/DataModel/PIDResponse.h" +#include +#include +#include // namespace to be used for pt plots and bins namespace pthistos @@ -48,6 +55,9 @@ struct v0ptinvmassplots { // Configurable for histograms Configurable nBins{"nBins", 100, "N bins in all histos"}; + Configurable xaxisgenbins{"xaxisgenbins", 20, "Number of bins for Generated Pt Spectrum"}; + Configurable xaxismingenbin{"xaxismingenbin", 0.0, "Minimum bin value of the Generated Pt Spectrum Plot"}; + Configurable xaxismaxgenbin{"xaxismaxgenbin", 3.0, "Maximum bin value of the Generated Pt Spectrum Plot"}; // Configurable Kaonsh Topological Cuts (best cuts determined by v0topologicalcuts task) Configurable kaonshsetting_dcav0dau{"kaonshsetting_dcav0dau", 100.0, "DCA V0 Daughters"}; @@ -87,7 +97,7 @@ struct v0ptinvmassplots { AxisSpec LambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{+}#pi^{-} [GeV/#it{c}^{2}]"}; AxisSpec AntiLambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{-}#pi^{+} [GeV/#it{c}^{2}]"}; AxisSpec ptAxis = {nBins, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec GenptAxis = {20, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec GenptAxis = {xaxisgenbins, xaxismingenbin, xaxismaxgenbin, "#it{p}_{T} (GeV/#it{c})"}; rPtAnalysis.add("hV0PtAll", "hV0PtAll", {HistType::kTH1F, {{nBins, 0.0f, 10.0f}}}); @@ -156,26 +166,33 @@ struct v0ptinvmassplots { // Defining filters for events (event selection) // Processed events will be already fulfilling the event selection requirements Filter eventFilter = (o2::aod::evsel::sel8 == true); + Filter posZFilterMC = (nabs(o2::aod::mccollision::posZ) < 10.0f); + Filter posZFilter = (nabs(o2::aod::collision::posZ) < 10.0f); // Defining the type of the daughter tracks using DaughterTracks = soa::Join; // This is the Process for the MC Generated Data - void GenMCprocess(const soa::SmallGroups>& collisions, + void GenMCprocess(soa::Filtered::iterator const&, + const soa::SmallGroups>&, aod::McParticles const& mcParticles) { for (const auto& mcParticle : mcParticles) { - if (mcParticle.pdgCode() == 310) // kzero matched - { - rPtAnalysis.fill(HIST("hK0ShGeneratedPtSpectrum"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == 3122) // lambda matched - { - rPtAnalysis.fill(HIST("hLambdaGeneratedPtSpectrum"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == -3122) // antilambda matched - { - rPtAnalysis.fill(HIST("hAntilambdaGeneratedPtSpectrum"), mcParticle.pt()); + if (mcParticle.isPhysicalPrimary()) { + if (TMath::Abs(mcParticle.y()) < 0.5f) { + if (mcParticle.pdgCode() == 310) // kzero matched + { + rPtAnalysis.fill(HIST("hK0ShGeneratedPtSpectrum"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == 3122) // lambda matched + { + rPtAnalysis.fill(HIST("hLambdaGeneratedPtSpectrum"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == -3122) // antilambda matched + { + rPtAnalysis.fill(HIST("hAntilambdaGeneratedPtSpectrum"), mcParticle.pt()); + } + } } } } @@ -183,85 +200,87 @@ struct v0ptinvmassplots { void RecMCprocess(soa::Filtered>::iterator const&, soa::Join const& V0s, DaughterTracks const&, // no need to define a variable for tracks, if we don't access them directly - aod::McParticles const&) + aod::McParticles const& /*mcParticles*/) { for (const auto& v0 : V0s) { rPtAnalysis.fill(HIST("hV0PtAll"), v0.pt()); // Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace) if (v0.has_mcParticle()) { auto v0mcParticle = v0.mcParticle(); - if (kzerosh_analysis == true) { - if (v0mcParticle.pdgCode() == 310) { // kzero matched - rPtAnalysis.fill(HIST("hMassK0ShortAll"), v0.mK0Short()); - rPtAnalysis.fill(HIST("hK0ShortPtSpectrumBeforeCuts"), v0.pt()); - // Implementing best kzero cuts - if (v0.v0cosPA() > kaonshsetting_cospa && v0.dcaV0daughters() < kaonshsetting_dcav0dau && v0.v0radius() > kaonshsetting_radius && TMath::Abs(v0.dcapostopv()) > kaonshsetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > kaonshsetting_dcanegtopv) { - rPtAnalysis.fill(HIST("hMassK0ShortAllAfterCuts"), v0.mK0Short()); - rPtAnalysis.fill(HIST("hK0ShortReconstructedPtSpectrum"), v0.pt()); - for (int i = 0; i < 20; i++) { - // getting the pt value in #_# for and converting it to a number #.# for use, we get two values which correspond to the range of each bin - std::string pt1 = pthistos::kaonptbins[i]; // getting the lower string-value of the bin - std::string pt2 = pthistos::kaonptbins[i + 1]; // getting the higher string-value of the bin - size_t pos1 = pt1.find("_"); // finding the "_" character of the lower string-value - size_t pos2 = pt2.find("_"); // finding the "_" character of the higher string-value - pt1[pos1] = '.'; // changing the "_" character of the lower string-value to a "." - pt2[pos2] = '.'; // changing the "_" character of the higher string-value to a "." - const float ptlowervalue = std::stod(pt1); // converting the lower string value to a double - const float pthighervalue = std::stod(pt2); // converting the higher string value to a double - if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { // finding v0s with pt withing the range of our lower and higher value - pthistos::KaonPt[i]->Fill(v0.mK0Short()); // filling the 20 kaon namespace histograms + if (v0mcParticle.isPhysicalPrimary()) { + if (kzerosh_analysis == true) { + if (v0mcParticle.pdgCode() == 310) { // kzero matched + rPtAnalysis.fill(HIST("hMassK0ShortAll"), v0.mK0Short()); + rPtAnalysis.fill(HIST("hK0ShortPtSpectrumBeforeCuts"), v0.pt()); + // Implementing best kzero cuts + if (v0.v0cosPA() > kaonshsetting_cospa && v0.dcaV0daughters() < kaonshsetting_dcav0dau && v0.v0radius() > kaonshsetting_radius && TMath::Abs(v0.dcapostopv()) > kaonshsetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > kaonshsetting_dcanegtopv) { + rPtAnalysis.fill(HIST("hMassK0ShortAllAfterCuts"), v0.mK0Short()); + rPtAnalysis.fill(HIST("hK0ShortReconstructedPtSpectrum"), v0.pt()); + for (int i = 0; i < 20; i++) { + // getting the pt value in #_# for and converting it to a number #.# for use, we get two values which correspond to the range of each bin + std::string pt1 = pthistos::kaonptbins[i]; // getting the lower string-value of the bin + std::string pt2 = pthistos::kaonptbins[i + 1]; // getting the higher string-value of the bin + size_t pos1 = pt1.find("_"); // finding the "_" character of the lower string-value + size_t pos2 = pt2.find("_"); // finding the "_" character of the higher string-value + pt1[pos1] = '.'; // changing the "_" character of the lower string-value to a "." + pt2[pos2] = '.'; // changing the "_" character of the higher string-value to a "." + const float ptlowervalue = std::stod(pt1); // converting the lower string value to a double + const float pthighervalue = std::stod(pt2); // converting the higher string value to a double + if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { // finding v0s with pt withing the range of our lower and higher value + pthistos::KaonPt[i]->Fill(v0.mK0Short()); // filling the 20 kaon namespace histograms + } } } } } - } - // lambda analysis - if (lambda_analysis == true) { - if (v0mcParticle.pdgCode() == 3122) { // lambda matched - rPtAnalysis.fill(HIST("hMassLambdaAll"), v0.mLambda()); - rPtAnalysis.fill(HIST("hLambdaPtSpectrumBeforeCuts"), v0.pt()); - // Implementing best lambda cuts - if (v0.v0cosPA() > lambdasetting_cospa && v0.dcaV0daughters() < lambdasetting_dcav0dau && v0.v0radius() > lambdasetting_radius && TMath::Abs(v0.dcapostopv()) > lambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > lambdasetting_dcanegtopv) { - rPtAnalysis.fill(HIST("hMassLambdaAllAfterCuts"), v0.mLambda()); - rPtAnalysis.fill(HIST("hLambdaReconstructedPtSpectrum"), v0.pt()); - for (int i = 0; i < 20; i++) { - // same as above with kzerosh we fill the 20 lambda namespace histograms within their Pt range - std::string pt1 = pthistos::lambdaptbins[i]; - std::string pt2 = pthistos::lambdaptbins[i + 1]; - size_t pos1 = pt1.find("_"); - size_t pos2 = pt2.find("_"); - pt1[pos1] = '.'; - pt2[pos2] = '.'; - const float ptlowervalue = std::stod(pt1); - const float pthighervalue = std::stod(pt2); - if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { - pthistos::LambdaPt[i]->Fill(v0.mLambda()); + // lambda analysis + if (lambda_analysis == true) { + if (v0mcParticle.pdgCode() == 3122) { // lambda matched + rPtAnalysis.fill(HIST("hMassLambdaAll"), v0.mLambda()); + rPtAnalysis.fill(HIST("hLambdaPtSpectrumBeforeCuts"), v0.pt()); + // Implementing best lambda cuts + if (v0.v0cosPA() > lambdasetting_cospa && v0.dcaV0daughters() < lambdasetting_dcav0dau && v0.v0radius() > lambdasetting_radius && TMath::Abs(v0.dcapostopv()) > lambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > lambdasetting_dcanegtopv) { + rPtAnalysis.fill(HIST("hMassLambdaAllAfterCuts"), v0.mLambda()); + rPtAnalysis.fill(HIST("hLambdaReconstructedPtSpectrum"), v0.pt()); + for (int i = 0; i < 20; i++) { + // same as above with kzerosh we fill the 20 lambda namespace histograms within their Pt range + std::string pt1 = pthistos::lambdaptbins[i]; + std::string pt2 = pthistos::lambdaptbins[i + 1]; + size_t pos1 = pt1.find("_"); + size_t pos2 = pt2.find("_"); + pt1[pos1] = '.'; + pt2[pos2] = '.'; + const float ptlowervalue = std::stod(pt1); + const float pthighervalue = std::stod(pt2); + if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { + pthistos::LambdaPt[i]->Fill(v0.mLambda()); + } } } } } - } - // antilambda analysis - if (antilambda_analysis == true) { - if (v0mcParticle.pdgCode() == -3122) { // antilambda matched - rPtAnalysis.fill(HIST("hMassAntilambdaAll"), v0.mAntiLambda()); - rPtAnalysis.fill(HIST("hAntilambdaPtSpectrumBeforeCuts"), v0.pt()); - // Implementing best antilambda cuts - if (v0.v0cosPA() > antilambdasetting_cospa && v0.dcaV0daughters() < antilambdasetting_dcav0dau && v0.v0radius() > antilambdasetting_radius && TMath::Abs(v0.dcapostopv()) > antilambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > antilambdasetting_dcanegtopv) { - rPtAnalysis.fill(HIST("hMassAntilambdaAllAfterCuts"), v0.mAntiLambda()); - rPtAnalysis.fill(HIST("hAntilambdaReconstructedPtSpectrum"), v0.pt()); - for (int i = 0; i < 20; i++) { - // same as above with kzerosh and lambda we fill the 20 anti-lambda namespace histograms within their Pt range - std::string pt1 = pthistos::antilambdaptbins[i]; - std::string pt2 = pthistos::antilambdaptbins[i + 1]; - size_t pos1 = pt1.find("_"); - size_t pos2 = pt2.find("_"); - pt1[pos1] = '.'; - pt2[pos2] = '.'; - const float ptlowervalue = std::stod(pt1); - const float pthighervalue = std::stod(pt2); - if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { - pthistos::AntilambdaPt[i]->Fill(v0.mAntiLambda()); + // antilambda analysis + if (antilambda_analysis == true) { + if (v0mcParticle.pdgCode() == -3122) { // antilambda matched + rPtAnalysis.fill(HIST("hMassAntilambdaAll"), v0.mAntiLambda()); + rPtAnalysis.fill(HIST("hAntilambdaPtSpectrumBeforeCuts"), v0.pt()); + // Implementing best antilambda cuts + if (v0.v0cosPA() > antilambdasetting_cospa && v0.dcaV0daughters() < antilambdasetting_dcav0dau && v0.v0radius() > antilambdasetting_radius && TMath::Abs(v0.dcapostopv()) > antilambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > antilambdasetting_dcanegtopv) { + rPtAnalysis.fill(HIST("hMassAntilambdaAllAfterCuts"), v0.mAntiLambda()); + rPtAnalysis.fill(HIST("hAntilambdaReconstructedPtSpectrum"), v0.pt()); + for (int i = 0; i < 20; i++) { + // same as above with kzerosh and lambda we fill the 20 anti-lambda namespace histograms within their Pt range + std::string pt1 = pthistos::antilambdaptbins[i]; + std::string pt2 = pthistos::antilambdaptbins[i + 1]; + size_t pos1 = pt1.find("_"); + size_t pos2 = pt2.find("_"); + pt1[pos1] = '.'; + pt2[pos2] = '.'; + const float ptlowervalue = std::stod(pt1); + const float pthighervalue = std::stod(pt2); + if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { + pthistos::AntilambdaPt[i]->Fill(v0.mAntiLambda()); + } } } } diff --git a/PWGLF/Tasks/Strangeness/v0topologicalcuts.cxx b/PWGLF/Tasks/Strangeness/v0topologicalcuts.cxx index 246df190f57..6fa5c8a8b82 100644 --- a/PWGLF/Tasks/Strangeness/v0topologicalcuts.cxx +++ b/PWGLF/Tasks/Strangeness/v0topologicalcuts.cxx @@ -14,18 +14,23 @@ /// \author Roman Lietava (roman.lietava@cern.ch) /*Description -This task creates 20 histograms (for each of the 5 different V0 topological cuts, namely cosPointingAngle, +This task creates <=20 histograms (for each of the 5 different V0 topological cuts, namely cosPointingAngle, DCA[between]V0daughters, v0radius,DCA-positive[daughter]to-primary-vertex and DCA-negative[daughter]to-primary-vertex) that are filled with the V0 invariant mass under the K0, Lambda and Antilambda mass assumption (so 20cutsx5parametersx3particles=300 mass invariant plots).It also produces plots of the topological parameters themselves. The cuts are passed as configurable strings for convenience. This analysis includes two processes, one for Real Data and one for MC Data switchable at the end of the code, only run one at a time*/ +#include +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Common/DataModel/EventSelection.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/DataModel/PIDResponse.h" +#include "CommonUtils/StringUtils.h" // namespaces to be used for the plot names and topological cuts that will be given by a configurable string namespace cuthistoskzerosh @@ -78,21 +83,18 @@ struct v0topologicalcuts { HistogramRegistry rV0Parameters_MC_Lambdamatch{"V0Parameters_MC_LambdaMatch", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rV0Parameters_MC_AntiLambdamatch{"V0Parameters_MC_AntiLambdaMatch", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rV0Parameters_Data{"rV0Parameters_Data", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - // kzero cut Histogram Registry with MC-matching, each will include 20 histograms for 20 different cuts HistogramRegistry rKzeroShort_cospaCut{"KzeroShort_cospaCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rKzeroShort_dcaCut{"KzeroShort_dcaCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rKzeroShort_v0radiusCut{"KzeroShort_v0radiusCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rKzeroShort_dcapostopCut{"KzeroShort_dcapostopvCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rKzeroShort_dcanegtopCut{"KzeroShort_dcanegtopvCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - // lambdas cut histograms with MC-matching (same as in Kzeros above) HistogramRegistry rLambda_cospaCut{"Lambda_cospaCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rLambda_dcaCut{"Lambda_dcaCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rLambda_v0radiusCut{"Lambda_v0radiusCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rLambda_dcapostopCut{"Lambda_dcapostopvCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rLambda_dcanegtopCut{"Lambda_dcanegtopvCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - // antilambdas cut histograms with MC-matching (same as in Lambdas an Kzeros above) HistogramRegistry rAntiLambda_cospaCut{"AntiLambda_cospaCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rAntiLambda_dcaCut{"AntiLambda_dcaCuts", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -111,7 +113,7 @@ struct v0topologicalcuts { Configurable kzeroshsetting_dcanegtopv_string{"kzerosetting_dcanegtopvcuts", {"0_0,0_01,0_02,0_03,0_04,0_05,0_06,0_07,0_08,0_09,0_1,0_11,0_12,0_13,0_14,0_15,0_16,0_17,0_18,0_19"}, "KzeroDCA Neg to PV Cut Values"}; // Configurable strings for Lambdacuts - Configurable lambdasetting_cospacuts_string{"lambdasetting_cospacuts", {"0_98,0_981,0_982,0_983,0_984,0_985,0_986,0_987,0_988,0_989,0_99,0_991,0_992,0_993,0_994,0_995,0_996,0_997,0_998,0_999"}, "Lambda cosPA Cut Values"}; + Configurable lambdasetting_cospacuts_string{"lambdasetting_cospacuts", {"0_98,0_981,0_982,0_983,0_984,0_985,0_986,0_987,0_988,0_989,0_99,0_991,0_992,0_993,0_994"}, "Lambda cosPA Cut Values"}; Configurable lambdasetting_dcacuts_string{"lambdasetting_dcacuts", {"0_3,0_285,0_27,0_255,0_24,0_225,0_21,0_195,0_18,0_165,0_15,0_135,0_12,0_105,0_09,0_075,0_06,0_045,0_03,0_015"}, "Lambda DCA Cut Values"}; Configurable lambdasetting_v0radius_string{"lambdasetting_v0radiuscuts", {"0_5,0_51,0_52,0_53,0_54,0_55,0_56,0_57,0_58,0_59,0_6,0_61,0_62,0_63,0_64,0_65,0_66,0_67,0_68,0_69"}, "Lambda V0Radius Cut Values"}; Configurable lambdasetting_dcapostopv_string{"lambdasetting_dcapostopvcuts", {"0_0,0_01,0_02,0_03,0_04,0_05,0_06,0_07,0_08,0_09,0_1,0_11,0_12,0_13,0_14,0_15,0_16,0_17,0_18,0_19"}, "Lambda DCA Pos to PV Cut Values"}; @@ -129,120 +131,26 @@ struct v0topologicalcuts { // kzero filling namespace with configurable strings // setting strings from configurable strings in order to manipulate them - size_t commapos = 0; - std::string token1; - std::string kzeroshsetting_cospacuts = kzeroshsetting_cospacuts_string; - std::string kzeroshsetting_dcacuts = kzeroshsetting_dcacuts_string; - std::string kzeroshsetting_v0radiuscuts = kzeroshsetting_v0radius_string; - std::string kzeroshsetting_dcapostopvcuts = kzeroshsetting_dcapostopv_string; - std::string kzeroshsetting_dcanegtopvcuts = kzeroshsetting_dcanegtopv_string; - // getting the cut values for the names of the plots for the five topological cuts - for (int i = 0; i < 20; i++) { - commapos = kzeroshsetting_cospacuts.find(","); // find comma that separates the values in the string - token1 = kzeroshsetting_cospacuts.substr(0, commapos); // store the substring (first individual value) - cuthistoskzerosh::cospacuts.push_back(token1); // fill the namespace with the value - kzeroshsetting_cospacuts.erase(0, commapos + 1); // erase the value from the set string so it moves to the next - } - for (int i = 0; i < 20; i++) { - commapos = kzeroshsetting_dcacuts.find(","); - token1 = kzeroshsetting_dcacuts.substr(0, commapos); - cuthistoskzerosh::dcacuts.push_back(token1); - kzeroshsetting_dcacuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = kzeroshsetting_v0radiuscuts.find(","); - token1 = kzeroshsetting_v0radiuscuts.substr(0, commapos); - cuthistoskzerosh::v0radiuscuts.push_back(token1); - kzeroshsetting_v0radiuscuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = kzeroshsetting_dcapostopvcuts.find(","); - token1 = kzeroshsetting_dcapostopvcuts.substr(0, commapos); - cuthistoskzerosh::dcapostopvcuts.push_back(token1); - kzeroshsetting_dcapostopvcuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = kzeroshsetting_dcanegtopvcuts.find(","); - token1 = kzeroshsetting_dcanegtopvcuts.substr(0, commapos); - cuthistoskzerosh::dcanegtopvcuts.push_back(token1); - kzeroshsetting_dcanegtopvcuts.erase(0, commapos + 1); - } + cuthistoskzerosh::cospacuts = o2::utils::Str::tokenize(kzeroshsetting_cospacuts_string, ','); + cuthistoskzerosh::dcacuts = o2::utils::Str::tokenize(kzeroshsetting_dcacuts_string, ','); + cuthistoskzerosh::v0radiuscuts = o2::utils::Str::tokenize(kzeroshsetting_v0radius_string, ','); + cuthistoskzerosh::dcapostopvcuts = o2::utils::Str::tokenize(kzeroshsetting_dcapostopv_string, ','); + cuthistoskzerosh::dcanegtopvcuts = o2::utils::Str::tokenize(kzeroshsetting_dcanegtopv_string, ','); // lambda filling namespace with configurable strings (same as in Kzeros above) - std::string lambdasetting_cospacuts = lambdasetting_cospacuts_string; - std::string lambdasetting_dcacuts = lambdasetting_dcacuts_string; - std::string lambdasetting_v0radiuscuts = lambdasetting_v0radius_string; - std::string lambdasetting_dcapostopvcuts = lambdasetting_dcapostopv_string; - std::string lambdasetting_dcanegtopvcuts = lambdasetting_dcanegtopv_string; + cuthistoslambda::cospacuts = o2::utils::Str::tokenize(lambdasetting_cospacuts_string, ','); + cuthistoslambda::dcacuts = o2::utils::Str::tokenize(lambdasetting_dcacuts_string, ','); + cuthistoslambda::v0radiuscuts = o2::utils::Str::tokenize(lambdasetting_v0radius_string, ','); + cuthistoslambda::dcapostopvcuts = o2::utils::Str::tokenize(lambdasetting_dcapostopv_string, ','); + cuthistoslambda::dcanegtopvcuts = o2::utils::Str::tokenize(lambdasetting_dcanegtopv_string, ','); - for (int i = 0; i < 20; i++) { - commapos = lambdasetting_cospacuts.find(","); - token1 = lambdasetting_cospacuts.substr(0, commapos); - cuthistoslambda::cospacuts.push_back(token1); - lambdasetting_cospacuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = lambdasetting_dcacuts.find(","); - token1 = lambdasetting_dcacuts.substr(0, commapos); - cuthistoslambda::dcacuts.push_back(token1); - lambdasetting_dcacuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = lambdasetting_v0radiuscuts.find(","); - token1 = lambdasetting_v0radiuscuts.substr(0, commapos); - cuthistoslambda::v0radiuscuts.push_back(token1); - lambdasetting_v0radiuscuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = lambdasetting_dcapostopvcuts.find(","); - token1 = lambdasetting_dcapostopvcuts.substr(0, commapos); - cuthistoslambda::dcapostopvcuts.push_back(token1); - lambdasetting_dcapostopvcuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = lambdasetting_dcanegtopvcuts.find(","); - token1 = lambdasetting_dcanegtopvcuts.substr(0, commapos); - cuthistoslambda::dcanegtopvcuts.push_back(token1); - lambdasetting_dcanegtopvcuts.erase(0, commapos + 1); - } // antilambda filling namespace with configurable strings (same as in Lambdas and Kzeros above) - std::string antilambdasetting_cospacuts = antilambdasetting_cospacuts_string; - std::string antilambdasetting_dcacuts = antilambdasetting_dcacuts_string; - std::string antilambdasetting_v0radiuscuts = antilambdasetting_v0radius_string; - std::string antilambdasetting_dcapostopvcuts = antilambdasetting_dcapostopv_string; - std::string antilambdasetting_dcanegtopvcuts = antilambdasetting_dcanegtopv_string; - - for (int i = 0; i < 20; i++) { - commapos = antilambdasetting_cospacuts.find(","); - token1 = antilambdasetting_cospacuts.substr(0, commapos); - cuthistosantilambda::cospacuts.push_back(token1); - antilambdasetting_cospacuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = antilambdasetting_dcacuts.find(","); - token1 = antilambdasetting_dcacuts.substr(0, commapos); - cuthistosantilambda::dcacuts.push_back(token1); - antilambdasetting_dcacuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = antilambdasetting_v0radiuscuts.find(","); - token1 = antilambdasetting_v0radiuscuts.substr(0, commapos); - cuthistosantilambda::v0radiuscuts.push_back(token1); - antilambdasetting_v0radiuscuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = antilambdasetting_dcapostopvcuts.find(","); - token1 = antilambdasetting_dcapostopvcuts.substr(0, commapos); - cuthistosantilambda::dcapostopvcuts.push_back(token1); - antilambdasetting_dcapostopvcuts.erase(0, commapos + 1); - } - for (int i = 0; i < 20; i++) { - commapos = antilambdasetting_dcanegtopvcuts.find(","); - token1 = antilambdasetting_dcanegtopvcuts.substr(0, commapos); - cuthistosantilambda::dcanegtopvcuts.push_back(token1); - antilambdasetting_dcanegtopvcuts.erase(0, commapos + 1); - } + cuthistosantilambda::cospacuts = o2::utils::Str::tokenize(antilambdasetting_cospacuts_string, ','); + cuthistosantilambda::dcacuts = o2::utils::Str::tokenize(antilambdasetting_dcacuts_string, ','); + cuthistosantilambda::v0radiuscuts = o2::utils::Str::tokenize(antilambdasetting_v0radius_string, ','); + cuthistosantilambda::dcapostopvcuts = o2::utils::Str::tokenize(antilambdasetting_dcapostopv_string, ','); + cuthistosantilambda::dcanegtopvcuts = o2::utils::Str::tokenize(antilambdasetting_dcanegtopv_string, ','); // Axes for the three invariant mass plots AxisSpec K0ShortMassAxis = {nBins, 0.45f, 0.55f, "#it{M} #pi^{+}#pi^{-} [GeV/#it{c}^{2}]"}; @@ -250,27 +158,52 @@ struct v0topologicalcuts { AxisSpec AntiLambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{-}#pi^{+} [GeV/#it{c}^{2}]"}; // adding the invariant mass histograms to their Registries using the namespace for kzeros, lambdas and antilambdas - for (int i = 0; i < 20; i++) { + for (uint32_t i = 0; i < cuthistoskzerosh::cospacuts.size(); i++) { cuthistoskzerosh::cospaCut[i] = rKzeroShort_cospaCut.add(fmt::format("hKzerocospaCut_{}", cuthistoskzerosh::cospacuts[i]).data(), fmt::format("hKzerocospaCut_{}", cuthistoskzerosh::cospacuts[i]).data(), {HistType::kTH1D, {{K0ShortMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistoskzerosh::dcacuts.size(); i++) { cuthistoskzerosh::dcaCut[i] = rKzeroShort_dcaCut.add(fmt::format("hKzerodcaCut_{}", cuthistoskzerosh::dcacuts[i]).data(), fmt::format("hKzerodcaCut_{}", cuthistoskzerosh::dcacuts[i]).data(), {HistType::kTH1D, {{K0ShortMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistoskzerosh::v0radiuscuts.size(); i++) { cuthistoskzerosh::v0radiusCut[i] = rKzeroShort_v0radiusCut.add(fmt::format("hKzerov0radiusCut_{}", cuthistoskzerosh::v0radiuscuts[i]).data(), fmt::format("hKzerov0radiusCut_{}", cuthistoskzerosh::v0radiuscuts[i]).data(), {HistType::kTH1D, {{K0ShortMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistoskzerosh::dcapostopvcuts.size(); i++) { cuthistoskzerosh::dcapostopCut[i] = rKzeroShort_dcapostopCut.add(fmt::format("hKzerodcapostopCut_{}", cuthistoskzerosh::dcapostopvcuts[i]).data(), fmt::format("hKzerodcapostopCut_{}", cuthistoskzerosh::dcapostopvcuts[i]).data(), {HistType::kTH1D, {{K0ShortMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistoskzerosh::dcanegtopvcuts.size(); i++) { cuthistoskzerosh::dcanegtopCut[i] = rKzeroShort_dcanegtopCut.add(fmt::format("hKzerodcanegtopCut_{}", cuthistoskzerosh::dcanegtopvcuts[i]).data(), fmt::format("hKzerodcanegtopCut_{}", cuthistoskzerosh::dcanegtopvcuts[i]).data(), {HistType::kTH1D, {{K0ShortMassAxis}}}); } - - for (int i = 0; i < 20; i++) { + LOG(info) << "error size: " << cuthistoslambda::cospacuts.size() << std::endl; + for (uint32_t i = 0; i < cuthistoslambda::cospacuts.size(); i++) { + LOG(info) << "error: " << (cuthistoslambda::cospacuts[i]).data() << std::endl; cuthistoslambda::cospaCut[i] = rLambda_cospaCut.add(fmt::format("hLambdacospaCut_{}", cuthistoslambda::cospacuts[i]).data(), fmt::format("hLambdacospaCut_{}", cuthistoslambda::cospacuts[i]).data(), {HistType::kTH1D, {{LambdaMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistoslambda::dcacuts.size(); i++) { cuthistoslambda::dcaCut[i] = rLambda_dcaCut.add(fmt::format("hLambdadcaCut_{}", cuthistoslambda::dcacuts[i]).data(), fmt::format("hLambdadcaCut_{}", cuthistoslambda::dcacuts[i]).data(), {HistType::kTH1D, {{LambdaMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistoslambda::v0radiuscuts.size(); i++) { cuthistoslambda::v0radiusCut[i] = rLambda_v0radiusCut.add(fmt::format("hLambdav0radiusCut_{}", cuthistoslambda::v0radiuscuts[i]).data(), fmt::format("hLambdav0radiusCut_{}", cuthistoslambda::v0radiuscuts[i]).data(), {HistType::kTH1D, {{LambdaMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistoslambda::dcapostopvcuts.size(); i++) { cuthistoslambda::dcapostopCut[i] = rLambda_dcapostopCut.add(fmt::format("hLambdadcapostopCut_{}", cuthistoslambda::dcapostopvcuts[i]).data(), fmt::format("hLambdadcapostopCut_{}", cuthistoslambda::dcapostopvcuts[i]).data(), {HistType::kTH1D, {{LambdaMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistoslambda::dcanegtopvcuts.size(); i++) { cuthistoslambda::dcanegtopCut[i] = rLambda_dcanegtopCut.add(fmt::format("hLambdadcanegtopCut_{}", cuthistoslambda::dcanegtopvcuts[i]).data(), fmt::format("hLambdadcanegtopCut_{}", cuthistoslambda::dcanegtopvcuts[i]).data(), {HistType::kTH1D, {{LambdaMassAxis}}}); } - for (int i = 0; i < 20; i++) { + for (uint32_t i = 0; i < cuthistosantilambda::cospacuts.size(); i++) { cuthistosantilambda::cospaCut[i] = rAntiLambda_cospaCut.add(fmt::format("hAntiLambdacospaCut_{}", cuthistosantilambda::cospacuts[i]).data(), fmt::format("hAntiLambdacospaCut_{}", cuthistosantilambda::cospacuts[i]).data(), {HistType::kTH1D, {{AntiLambdaMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistosantilambda::dcacuts.size(); i++) { cuthistosantilambda::dcaCut[i] = rAntiLambda_dcaCut.add(fmt::format("hAntiLambdadcaCut_{}", cuthistosantilambda::dcacuts[i]).data(), fmt::format("hAntiLambdadcaCut_{}", cuthistosantilambda::dcacuts[i]).data(), {HistType::kTH1D, {{AntiLambdaMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistosantilambda::v0radiuscuts.size(); i++) { cuthistosantilambda::v0radiusCut[i] = rAntiLambda_v0radiusCut.add(fmt::format("hAntiLambdav0radiusCut_{}", cuthistosantilambda::v0radiuscuts[i]).data(), fmt::format("hAntiLambdav0radiusCut_{}", cuthistosantilambda::v0radiuscuts[i]).data(), {HistType::kTH1D, {{AntiLambdaMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistosantilambda::dcapostopvcuts.size(); i++) { cuthistosantilambda::dcapostopCut[i] = rAntiLambda_dcapostopCut.add(fmt::format("hAntiLambdadcapostopCut_{}", cuthistosantilambda::dcapostopvcuts[i]).data(), fmt::format("hAntiLambdadcapostopCut_{}", cuthistosantilambda::dcapostopvcuts[i]).data(), {HistType::kTH1D, {{AntiLambdaMassAxis}}}); + } + for (uint32_t i = 0; i < cuthistosantilambda::dcanegtopvcuts.size(); i++) { cuthistosantilambda::dcanegtopCut[i] = rAntiLambda_dcanegtopCut.add(fmt::format("hAntiLambdadcanegtopCut_{}", cuthistosantilambda::dcanegtopvcuts[i]).data(), fmt::format("hAntiLambdadcanegtopCut_{}", cuthistosantilambda::dcanegtopvcuts[i]).data(), {HistType::kTH1D, {{AntiLambdaMassAxis}}}); } @@ -349,7 +282,7 @@ struct v0topologicalcuts { rV0Parameters_MC_K0Smatch.fill(HIST("hDCAPostoPV_KzeroMC_Match"), TMath::Abs(v0.dcapostopv())); rV0Parameters_MC_K0Smatch.fill(HIST("hDCANegtoPV_KzeroMC_Match"), TMath::Abs(v0.dcanegtopv())); - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::cospacuts.size(); j++) { std::string cospacut = cuthistoskzerosh::cospacuts[j]; // Get the current cut value from the namespace size_t pos = cospacut.find("_"); // find the "_" which needs to change to a "." for it to be a number cospacut[pos] = '.'; // change the "_" into an "." @@ -358,7 +291,7 @@ struct v0topologicalcuts { cuthistoskzerosh::cospaCut[j]->Fill(v0.mK0Short()); // fill the corresponding histo from the namespace with the invariant mass (of a Kzero here) } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::dcacuts.size(); j++) { std::string dcacut = cuthistoskzerosh::dcacuts[j]; size_t pos = dcacut.find("_"); dcacut[pos] = '.'; @@ -367,7 +300,7 @@ struct v0topologicalcuts { cuthistoskzerosh::dcaCut[j]->Fill(v0.mK0Short()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::v0radiuscuts.size(); j++) { std::string v0radiuscut = cuthistoskzerosh::v0radiuscuts[j]; size_t pos = v0radiuscut.find("_"); v0radiuscut[pos] = '.'; @@ -376,7 +309,7 @@ struct v0topologicalcuts { cuthistoskzerosh::v0radiusCut[j]->Fill(v0.mK0Short()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::dcapostopvcuts.size(); j++) { std::string dcapostopcut = cuthistoskzerosh::dcapostopvcuts[j]; size_t pos = dcapostopcut.find("_"); dcapostopcut[pos] = '.'; @@ -385,7 +318,7 @@ struct v0topologicalcuts { cuthistoskzerosh::dcapostopCut[j]->Fill(v0.mK0Short()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::dcanegtopvcuts.size(); j++) { std::string dcanegtopcut = cuthistoskzerosh::dcanegtopvcuts[j]; size_t pos = dcanegtopcut.find("_"); dcanegtopcut[pos] = '.'; @@ -403,7 +336,7 @@ struct v0topologicalcuts { rV0Parameters_MC_Lambdamatch.fill(HIST("hDCANegtoPV_LambdaMC_Match"), TMath::Abs(v0.dcanegtopv())); // for explanation look at the first Kzero plot above - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::cospacuts.size(); j++) { std::string cospacutlambda = cuthistoslambda::cospacuts[j]; size_t pos = cospacutlambda.find("_"); cospacutlambda[pos] = '.'; @@ -412,7 +345,7 @@ struct v0topologicalcuts { cuthistoslambda::cospaCut[j]->Fill(v0.mLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::dcacuts.size(); j++) { std::string dcacutlambda = cuthistoslambda::dcacuts[j]; size_t pos = dcacutlambda.find("_"); dcacutlambda[pos] = '.'; @@ -421,7 +354,7 @@ struct v0topologicalcuts { cuthistoslambda::dcaCut[j]->Fill(v0.mLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::v0radiuscuts.size(); j++) { std::string v0radiuscutlambda = cuthistoslambda::v0radiuscuts[j]; size_t pos = v0radiuscutlambda.find("_"); v0radiuscutlambda[pos] = '.'; @@ -430,7 +363,7 @@ struct v0topologicalcuts { cuthistoslambda::v0radiusCut[j]->Fill(v0.mLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::dcapostopvcuts.size(); j++) { std::string dcapostopcutlambda = cuthistoslambda::dcapostopvcuts[j]; size_t pos = dcapostopcutlambda.find("_"); dcapostopcutlambda[pos] = '.'; @@ -439,7 +372,7 @@ struct v0topologicalcuts { cuthistoslambda::dcapostopCut[j]->Fill(v0.mLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::dcanegtopvcuts.size(); j++) { std::string dcanegtopcutlambda = cuthistoslambda::dcanegtopvcuts[j]; size_t pos = dcanegtopcutlambda.find("_"); dcanegtopcutlambda[pos] = '.'; @@ -456,7 +389,7 @@ struct v0topologicalcuts { rV0Parameters_MC_AntiLambdamatch.fill(HIST("hDCAPostoPV_AntiLambdaMC_Match"), TMath::Abs(v0.dcapostopv())); rV0Parameters_MC_AntiLambdamatch.fill(HIST("hDCANegtoPV_AntiLambdaMC_Match"), TMath::Abs(v0.dcanegtopv())); // for explanation look at the first Kzero plot above - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::cospacuts.size(); j++) { std::string cospacutantilambda = cuthistosantilambda::cospacuts[j]; size_t pos = cospacutantilambda.find("_"); cospacutantilambda[pos] = '.'; @@ -465,7 +398,7 @@ struct v0topologicalcuts { cuthistosantilambda::cospaCut[j]->Fill(v0.mAntiLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::dcacuts.size(); j++) { std::string dcacutantilambda = cuthistosantilambda::dcacuts[j]; size_t pos = dcacutantilambda.find("_"); dcacutantilambda[pos] = '.'; @@ -474,7 +407,7 @@ struct v0topologicalcuts { cuthistosantilambda::dcaCut[j]->Fill(v0.mAntiLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::v0radiuscuts.size(); j++) { std::string v0radiusantilambda = cuthistosantilambda::v0radiuscuts[j]; size_t pos = v0radiusantilambda.find("_"); v0radiusantilambda[pos] = '.'; @@ -483,7 +416,7 @@ struct v0topologicalcuts { cuthistosantilambda::v0radiusCut[j]->Fill(v0.mAntiLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::dcapostopvcuts.size(); j++) { std::string dcapostopantilambda = cuthistosantilambda::dcapostopvcuts[j]; size_t pos = dcapostopantilambda.find("_"); dcapostopantilambda[pos] = '.'; @@ -492,7 +425,7 @@ struct v0topologicalcuts { cuthistosantilambda::dcapostopCut[j]->Fill(v0.mAntiLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::dcanegtopvcuts.size(); j++) { std::string dcanegtopantilambda = cuthistosantilambda::dcanegtopvcuts[j]; size_t pos = dcanegtopantilambda.find("_"); dcanegtopantilambda[pos] = '.'; @@ -522,7 +455,7 @@ struct v0topologicalcuts { rV0Parameters_Data.fill(HIST("hDCANegtoPV_V0_Data"), TMath::Abs(v0.dcanegtopv())); // Filling the five Kzero invariant mass plots for different cuts (which are taken from namespace), for full explanation see the first kzero cut filling in the MC process - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::cospacuts.size(); j++) { std::string cospacut = cuthistoskzerosh::cospacuts[j]; size_t pos = cospacut.find("_"); cospacut[pos] = '.'; @@ -531,7 +464,7 @@ struct v0topologicalcuts { cuthistoskzerosh::cospaCut[j]->Fill(v0.mK0Short()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::dcacuts.size(); j++) { std::string dcacut = cuthistoskzerosh::dcacuts[j]; size_t pos = dcacut.find("_"); dcacut[pos] = '.'; @@ -540,7 +473,7 @@ struct v0topologicalcuts { cuthistoskzerosh::dcaCut[j]->Fill(v0.mK0Short()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::v0radiuscuts.size(); j++) { std::string v0radiuscut = cuthistoskzerosh::v0radiuscuts[j]; size_t pos = v0radiuscut.find("_"); v0radiuscut[pos] = '.'; @@ -549,7 +482,7 @@ struct v0topologicalcuts { cuthistoskzerosh::v0radiusCut[j]->Fill(v0.mK0Short()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::dcapostopvcuts.size(); j++) { std::string dcapostopcut = cuthistoskzerosh::dcapostopvcuts[j]; size_t pos = dcapostopcut.find("_"); dcapostopcut[pos] = '.'; @@ -558,7 +491,7 @@ struct v0topologicalcuts { cuthistoskzerosh::dcapostopCut[j]->Fill(v0.mK0Short()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoskzerosh::dcanegtopvcuts.size(); j++) { std::string dcanegtopcut = cuthistoskzerosh::dcanegtopvcuts[j]; size_t pos = dcanegtopcut.find("_"); dcanegtopcut[pos] = '.'; @@ -568,7 +501,7 @@ struct v0topologicalcuts { } } // Filling the five Lambda invariant mass plots for different cuts (which are taken from namespace), same as with Kzeros above,for full explanation see the first kzero cut filling in the MC process - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::cospacuts.size(); j++) { std::string cospacutlambda = cuthistoslambda::cospacuts[j]; size_t pos = cospacutlambda.find("_"); cospacutlambda[pos] = '.'; @@ -577,7 +510,7 @@ struct v0topologicalcuts { cuthistoslambda::cospaCut[j]->Fill(v0.mLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::dcacuts.size(); j++) { std::string dcacutlambda = cuthistoslambda::dcacuts[j]; size_t pos = dcacutlambda.find("_"); dcacutlambda[pos] = '.'; @@ -586,7 +519,7 @@ struct v0topologicalcuts { cuthistoslambda::dcaCut[j]->Fill(v0.mLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::v0radiuscuts.size(); j++) { std::string v0radiuscutlambda = cuthistoslambda::v0radiuscuts[j]; size_t pos = v0radiuscutlambda.find("_"); v0radiuscutlambda[pos] = '.'; @@ -595,7 +528,7 @@ struct v0topologicalcuts { cuthistoslambda::v0radiusCut[j]->Fill(v0.mLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::dcanegtopvcuts.size(); j++) { std::string dcapostopcutlambda = cuthistoslambda::dcapostopvcuts[j]; size_t pos = dcapostopcutlambda.find("_"); dcapostopcutlambda[pos] = '.'; @@ -604,7 +537,7 @@ struct v0topologicalcuts { cuthistoslambda::dcapostopCut[j]->Fill(v0.mLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistoslambda::dcanegtopvcuts.size(); j++) { std::string dcanegtopcutlambda = cuthistoslambda::dcanegtopvcuts[j]; size_t pos = dcanegtopcutlambda.find("_"); dcanegtopcutlambda[pos] = '.'; @@ -614,7 +547,7 @@ struct v0topologicalcuts { } } // Filling the five Anti-Lambda invariant mass plots for different cuts (which are taken from namespace), same as with Kzeros and Lambdas above,for full explanation see the first kzero cut filling in the MC process - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::cospacuts.size(); j++) { std::string cospacutantilambda = cuthistosantilambda::cospacuts[j]; size_t pos = cospacutantilambda.find("_"); cospacutantilambda[pos] = '.'; @@ -623,7 +556,7 @@ struct v0topologicalcuts { cuthistosantilambda::cospaCut[j]->Fill(v0.mAntiLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::dcacuts.size(); j++) { std::string dcacutantilambda = cuthistosantilambda::dcacuts[j]; size_t pos = dcacutantilambda.find("_"); dcacutantilambda[pos] = '.'; @@ -632,7 +565,7 @@ struct v0topologicalcuts { cuthistosantilambda::dcaCut[j]->Fill(v0.mAntiLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::v0radiuscuts.size(); j++) { std::string v0radiusantilambda = cuthistosantilambda::v0radiuscuts[j]; size_t pos = v0radiusantilambda.find("_"); v0radiusantilambda[pos] = '.'; @@ -641,7 +574,7 @@ struct v0topologicalcuts { cuthistosantilambda::v0radiusCut[j]->Fill(v0.mAntiLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::dcapostopvcuts.size(); j++) { std::string dcapostopantilambda = cuthistosantilambda::dcapostopvcuts[j]; size_t pos = dcapostopantilambda.find("_"); dcapostopantilambda[pos] = '.'; @@ -650,7 +583,7 @@ struct v0topologicalcuts { cuthistosantilambda::dcapostopCut[j]->Fill(v0.mAntiLambda()); } } - for (int j = 0; j < 20; j++) { + for (uint32_t j = 0; j < cuthistosantilambda::dcanegtopvcuts.size(); j++) { std::string dcanegtopantilambda = cuthistosantilambda::dcanegtopvcuts[j]; size_t pos = dcanegtopantilambda.find("_"); dcanegtopantilambda[pos] = '.'; diff --git a/PWGLF/Utils/collisionCuts.h b/PWGLF/Utils/collisionCuts.h index 8d1e563d427..6322e272083 100644 --- a/PWGLF/Utils/collisionCuts.h +++ b/PWGLF/Utils/collisionCuts.h @@ -24,8 +24,6 @@ #include "Framework/Logger.h" #include "Common/DataModel/EventSelection.h" -using namespace o2::framework; - namespace o2::analysis { @@ -58,7 +56,7 @@ class CollisonCuts /// \param checkTrigger whether or not to check for the trigger alias /// \param trig Requested trigger alias /// \param checkOffline whether or not to check for offline selection criteria - void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool checkRun3, bool triggerTVXsel = false, int trackOccupancyInTimeRangeMax = -1) + void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool checkRun3, bool triggerTVXsel = false, int trackOccupancyInTimeRangeMax = -1, int trackOccupancyInTimeRangeMin = -1) { mCutsSet = true; mZvtxMax = zvtxMax; @@ -72,31 +70,33 @@ class CollisonCuts mApplyZvertexTimedifference = false; mApplyPileupRejection = false; mApplyNoITSROBorderCut = false; + mApplyCollInTimeRangeStandard = false; mtrackOccupancyInTimeRangeMax = trackOccupancyInTimeRangeMax; + mtrackOccupancyInTimeRangeMin = trackOccupancyInTimeRangeMin; } /// Initializes histograms for the task /// \param registry Histogram registry to be passed - void init(HistogramRegistry* registry) + void init(o2::framework::HistogramRegistry* registry) { if (!mCutsSet) { LOGF(error, "Event selection not set - quitting!"); } mHistogramRegistry = registry; - mHistogramRegistry->add("Event/posZ", "; vtx_{z} (cm); Entries", kTH1F, {{250, -12.5, 12.5}}); // z-vertex histogram after event selections - mHistogramRegistry->add("Event/posZ_noCut", "; vtx_{z} (cm); Entries", kTH1F, {{250, -12.5, 12.5}}); // z-vertex histogram before all selections + mHistogramRegistry->add("Event/posZ", "; vtx_{z} (cm); Entries", o2::framework::kTH1F, {{250, -12.5, 12.5}}); // z-vertex histogram after event selections + mHistogramRegistry->add("Event/posZ_noCut", "; vtx_{z} (cm); Entries", o2::framework::kTH1F, {{250, -12.5, 12.5}}); // z-vertex histogram before all selections if (mCheckIsRun3) { - mHistogramRegistry->add("Event/CentFV0A", "; vCentV0A; Entries", kTH1F, {{110, 0, 110}}); - mHistogramRegistry->add("Event/CentFT0M", "; vCentT0M; Entries", kTH1F, {{110, 0, 110}}); - mHistogramRegistry->add("Event/CentFT0C", "; vCentT0C; Entries", kTH1F, {{110, 0, 110}}); - mHistogramRegistry->add("Event/CentFT0A", "; vCentT0A; Entries", kTH1F, {{110, 0, 110}}); - mHistogramRegistry->add("Event/posZ_ITSOnly", "; vtx_{z} (cm); Entries", kTH1F, {{250, -12.5, 12.5}}); - mHistogramRegistry->add("Event/posZ_ITSTPC", "; vtx_{z} (cm); Entries", kTH1F, {{250, -12.5, 12.5}}); - mHistogramRegistry->add("Event/trackOccupancyInTimeRange_noCut", "; Occupancy; Entries", kTH1F, {{500, 0., 20000.}}); + mHistogramRegistry->add("Event/CentFV0A", "; vCentV0A; Entries", o2::framework::kTH1F, {{110, 0, 110}}); + mHistogramRegistry->add("Event/CentFT0M", "; vCentT0M; Entries", o2::framework::kTH1F, {{110, 0, 110}}); + mHistogramRegistry->add("Event/CentFT0C", "; vCentT0C; Entries", o2::framework::kTH1F, {{110, 0, 110}}); + mHistogramRegistry->add("Event/CentFT0A", "; vCentT0A; Entries", o2::framework::kTH1F, {{110, 0, 110}}); + mHistogramRegistry->add("Event/posZ_ITSOnly", "; vtx_{z} (cm); Entries", o2::framework::kTH1F, {{250, -12.5, 12.5}}); + mHistogramRegistry->add("Event/posZ_ITSTPC", "; vtx_{z} (cm); Entries", o2::framework::kTH1F, {{250, -12.5, 12.5}}); + mHistogramRegistry->add("Event/trackOccupancyInTimeRange_noCut", "; Occupancy; Entries", o2::framework::kTH1F, {{500, 0., 20000.}}); } else { - mHistogramRegistry->add("Event/CentRun2V0M", "; vCentV0M; Entries", kTH1F, {{110, 0, 110}}); + mHistogramRegistry->add("Event/CentRun2V0M", "; vCentV0M; Entries", o2::framework::kTH1F, {{110, 0, 110}}); } - mHistogramRegistry->add("CollCutCounts", "; ; Entries", kTH1F, {{11, 0., 11.}}); + mHistogramRegistry->add("CollCutCounts", "; ; Entries", o2::framework::kTH1F, {{11, 0., 11.}}); mHistogramRegistry->get(HIST("CollCutCounts"))->GetXaxis()->SetBinLabel(binLabel(EvtSel::kAllEvent), "all"); mHistogramRegistry->get(HIST("CollCutCounts"))->GetXaxis()->SetBinLabel(binLabel(EvtSel::kFlagZvertex), "Zvtx"); mHistogramRegistry->get(HIST("CollCutCounts"))->GetXaxis()->SetBinLabel(binLabel(EvtSel::kFlagTrigerTVX), "IsTriggerTVX"); @@ -113,8 +113,8 @@ class CollisonCuts /// Print some debug information void printCuts() { - LOGF(info, "Debug information for Collison Cuts \n Max. z-vertex: %f \n Check trigger: %d \n Trigger: %d \n Check offline: %d \n Check Run3: %d \n Trigger TVX selection: %d \n Apply time frame border cut: %d \n Apply ITS-TPC vertex: %d \n Apply Z-vertex time difference: %d \n Apply Pileup rejection: %d \n Apply NoITSRO frame border cut: %d \n Track occupancy in time range max: %d", - mZvtxMax, mCheckTrigger, mTrigger, mCheckOffline, mCheckIsRun3, mTriggerTVXselection, mApplyTFBorderCut, mApplyITSTPCvertex, mApplyZvertexTimedifference, mApplyPileupRejection, mApplyNoITSROBorderCut, mtrackOccupancyInTimeRangeMax); + LOGF(info, "Debug information for Collison Cuts \n Max. z-vertex: %f \n Check trigger: %d \n Trigger: %d \n Check offline: %d \n Check Run3: %d \n Trigger TVX selection: %d \n Apply time frame border cut: %d \n Apply ITS-TPC vertex: %d \n Apply Z-vertex time difference: %d \n Apply Pileup rejection: %d \n Apply NoITSRO frame border cut: %d \n Track occupancy in time range max: %d \n Track occupancy in time range min: %d \n Apply NoCollInTimeRangeStandard: %d", + mZvtxMax, mCheckTrigger, mTrigger, mCheckOffline, mCheckIsRun3, mTriggerTVXselection, mApplyTFBorderCut, mApplyITSTPCvertex, mApplyZvertexTimedifference, mApplyPileupRejection, mApplyNoITSROBorderCut, mtrackOccupancyInTimeRangeMax, mtrackOccupancyInTimeRangeMin, mApplyCollInTimeRangeStandard); } /// Set MB selection @@ -138,6 +138,16 @@ class CollisonCuts /// Set the NoITSRO frame border cut void setApplyNoITSROBorderCut(bool applyNoITSROBorderCut) { mApplyNoITSROBorderCut = applyNoITSROBorderCut; } + /// Set the track occupancy in time range cut + void setTrackOccupancyInTimeRange(int trackOccupancyInTimeRangeMax, int trackOccupancyInTimeRangeMin) + { + mtrackOccupancyInTimeRangeMax = trackOccupancyInTimeRangeMax; + mtrackOccupancyInTimeRangeMin = trackOccupancyInTimeRangeMin; + } + + /// Set the NoCollInTimeRangeStandard cut + void setApplyCollInTimeRangeStandard(bool applyCollInTimeRangeStandard) { mApplyCollInTimeRangeStandard = applyCollInTimeRangeStandard; } + /// Check whether the collisions fulfills the specified selections /// \tparam T type of the collision /// \param col Collision @@ -195,12 +205,25 @@ class CollisonCuts LOGF(debug, "trackOccupancyInTimeRange selection failed"); return false; } + if (mtrackOccupancyInTimeRangeMin > 0 && col.trackOccupancyInTimeRange() < mtrackOccupancyInTimeRangeMin) { + LOGF(debug, "trackOccupancyInTimeRange selection failed"); + return false; + } + if ((!col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) && mApplyCollInTimeRangeStandard) { + LOGF(debug, "NoCollInTimeRangeStandard selection failed"); + return false; + } mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagOccupancy); } else { // Run2 case if (mCheckOffline && !col.sel7()) { LOGF(debug, "Offline selection failed (sel7)"); return false; } + auto bc = col.template bc_as(); + if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) { + LOGF(debug, "Offline selection failed (AliEventCuts)"); + return false; + } mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagTrigerTVX); } if (mCheckTrigger && !col.alias_bit(mTrigger)) { @@ -253,21 +276,24 @@ class CollisonCuts } private: - HistogramRegistry* mHistogramRegistry = nullptr; ///< For QA output - bool mCutsSet = false; ///< Protection against running without cuts - bool mCheckTrigger = false; ///< Check for trigger - bool mTriggerTVXselection = false; ///< Check for trigger TVX selection - bool mCheckOffline = false; ///< Check for offline criteria (might change) - bool mCheckIsRun3 = false; ///< Check if running on Pilot Beam - bool mInitialTriggerScan = false; ///< Check trigger when the event is first selected - bool mApplyTFBorderCut = false; ///< Apply time frame border cut - bool mApplyITSTPCvertex = false; ///< Apply at least one ITS-TPC track for vertexing - bool mApplyZvertexTimedifference = false; ///< removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference. - bool mApplyPileupRejection = false; ///< Pileup rejection - bool mApplyNoITSROBorderCut = false; ///< Apply NoITSRO frame border cut - int mTrigger = kINT7; ///< Trigger to check for - float mZvtxMax = 999.f; ///< Maximal deviation from nominal z-vertex (cm) - int mtrackOccupancyInTimeRangeMax = -1; ///< Maximum trackOccupancyInTimeRange cut (-1 no cut) + using BCsWithRun2Info = soa::Join; + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; ///< For QA output + bool mCutsSet = false; ///< Protection against running without cuts + bool mCheckTrigger = false; ///< Check for trigger + bool mTriggerTVXselection = false; ///< Check for trigger TVX selection + bool mCheckOffline = false; ///< Check for offline criteria (might change) + bool mCheckIsRun3 = false; ///< Check if running on Pilot Beam + bool mInitialTriggerScan = false; ///< Check trigger when the event is first selected + bool mApplyTFBorderCut = false; ///< Apply time frame border cut + bool mApplyITSTPCvertex = false; ///< Apply at least one ITS-TPC track for vertexing + bool mApplyZvertexTimedifference = false; ///< removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference. + bool mApplyPileupRejection = false; ///< Pileup rejection + bool mApplyNoITSROBorderCut = false; ///< Apply NoITSRO frame border cut + bool mApplyCollInTimeRangeStandard = false; ///< Apply NoCollInTimeRangeStandard selection + int mTrigger = kINT7; ///< Trigger to check for + float mZvtxMax = 999.f; ///< Maximal deviation from nominal z-vertex (cm) + int mtrackOccupancyInTimeRangeMax = -1; ///< Maximum trackOccupancyInTimeRange cut (-1 no cut) + int mtrackOccupancyInTimeRangeMin = -1; ///< Minimum trackOccupancyInTimeRange cut (-1 no cut) }; } // namespace o2::analysis diff --git a/PWGLF/Utils/svPoolCreator.h b/PWGLF/Utils/svPoolCreator.h index ba78c417376..f4d98b2e304 100644 --- a/PWGLF/Utils/svPoolCreator.h +++ b/PWGLF/Utils/svPoolCreator.h @@ -29,7 +29,7 @@ using namespace o2::framework::expressions; using std::array; using CollBracket = o2::math_utils::Bracket; -constexpr auto bOffsetMax = 241; // track compatibility can never go beyond 6 mus (ITS) +constexpr uint64_t bOffsetMax = 241; // track compatibility can never go beyond 6 mus (ITS) struct TrackCand { int Idxtr; @@ -86,7 +86,8 @@ class svPoolCreator return; } bool isDau0 = pdgHypo == track0Pdg; - uint64_t globalBC = -1; + constexpr uint64_t BcInvalid = -1; + uint64_t globalBC = BcInvalid; if (trackCand.has_collision()) { if (trackCand.template collision_as().has_bc()) { globalBC = trackCand.template collision_as().template bc_as().globalBC(); @@ -97,17 +98,17 @@ class svPoolCreator continue; } if (!ambTrack.has_bc() || ambTrack.bc_as().size() == 0) { - globalBC = -1; + globalBC = BcInvalid; break; } globalBC = ambTrack.bc_as().begin().globalBC(); break; } } else { - globalBC = -1; + globalBC = BcInvalid; } - if (globalBC == -1) { + if (globalBC == BcInvalid) { return; } @@ -128,11 +129,13 @@ class svPoolCreator float collTimeRes2 = collision.collisionTimeRes() * collision.collisionTimeRes(); uint64_t collBC = collision.template bc_as().globalBC(); int collIdx = collision.globalIndex(); - int64_t bcOffset = globalBC - (int64_t)collBC; - if (std::abs(bcOffset) > bOffsetMax && bcOffset < 0) { - break; - } else if (std::abs(bcOffset) > bOffsetMax && bcOffset > 0) { - continue; + int64_t bcOffset = globalBC - static_cast(collBC); + if (static_cast(std::abs(bcOffset)) > bOffsetMax) { + if (bcOffset < 0) { + break; + } else if (bcOffset > 0) { + continue; + } } float trackTime{0.}; diff --git a/PWGMM/Lumi/Tasks/lumiStability.cxx b/PWGMM/Lumi/Tasks/lumiStability.cxx index c25e578e3bc..9a9f134b0fd 100644 --- a/PWGMM/Lumi/Tasks/lumiStability.cxx +++ b/PWGMM/Lumi/Tasks/lumiStability.cxx @@ -13,6 +13,11 @@ /// it is meant to be a blank page for further developments. /// \author everyone +#include +#include +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -42,7 +47,8 @@ struct lumiStabilityTask { Configurable myMaxDeltaBCFDD{"myMaxDeltaBCFDD", 5, {"My BC cut"}}; Configurable myMaxDeltaBCFT0{"myMaxDeltaBCFT0", 5, {"My BC cut"}}; Configurable myMaxDeltaBCFV0{"myMaxDeltaBCFV0", 5, {"My BC cut"}}; - Configurable nOrbitsConf{"nOrbits", 10000, "number of orbits"}; + Configurable nOrbitsConf{"nOrbits", 972'288'000, "number of orbits"}; + Configurable nOrbitsPerTF{"nOrbitsPerTF", 128, "number of orbits per time frame"}; Configurable minOrbitConf{"minOrbit", 0, "minimum orbit"}; Configurable is2022Data{"is2022Data", true, "To 2022 data"}; @@ -76,6 +82,7 @@ struct lumiStabilityTask { const AxisSpec axisTime{1000, -10, 40}; const AxisSpec axisTimeFDD{1000, -20, 100}; const AxisSpec axisCountsTime{2, -0.5, 1.5}; + const AxisSpec axisOrbits{static_cast(nOrbits / nOrbitsPerTF), 0., static_cast(nOrbits), ""}; histos.add("hBcA", "BC pattern A; BC ; It is present", kTH1F, {axisTriggger}); histos.add("hBcC", "BC pattern C; BC ; It is present", kTH1F, {axisTriggger}); @@ -87,6 +94,10 @@ struct lumiStabilityTask { histos.add("hvertexZ", "Pos Z vertex trigger; Pos z; Count ", kTH1F, {axisPosZ}); histos.add("hnumContrib", "Num of contributors; Num of contributors; Count ", kTH1I, {axisNumContrib}); histos.add("hcollisinTime", "Collision Time; ns; Count ", kTH1F, {axisColisionTime}); + histos.add("hOrbitFDDVertexCoinc", "", kTH1F, {axisOrbits}); + histos.add("hOrbitFDDVertex", "", kTH1F, {axisOrbits}); + histos.add("hOrbitFT0vertex", "", kTH1F, {axisOrbits}); + histos.add("hOrbitFV0Central", "", kTH1F, {axisOrbits}); // time 32.766 is dummy time // histo about triggers histos.add("FDD/hCounts", "0 FDDCount - 1 FDDVertexCount - 2 FDDPPVertexCount - 3 FDDCoincidencesVertexCount - 4 FDDPPCoincidencesVertexCount - 5 FDDPPBotSidesCount; Number; counts", kTH1F, {axisCounts}); @@ -209,13 +220,14 @@ struct lumiStabilityTask { void processMain(aod::FDDs const& fdds, aod::FT0s const& ft0s, aod::FV0As const& fv0s, aod::BCsWithTimestamps const& bcs) { int executionCounter = 0; - uint32_t nOrbitsPerTF = 128; // 128 in 2022, 32 in 2023 + // uint32_t nOrbitsPerTF = 128; // 128 in 2022, 32 in 2023 int runNumber = bcs.iteratorAt(0).runNumber(); + // std::string histName = "hOrbitFDDVertexCoinc_" + std::to_string(runNumber); if (runNumber != lastRunNumber && executionCounter < 1) { lastRunNumber = runNumber; // do it only once executionCounter++; - int64_t tsSOR = 0; - int64_t tsEOR = 1; + // int64_t tsSOR = 0; + // int64_t tsEOR = 1; if (runNumber >= 500000) { // access CCDB for data or anchored MC only int64_t ts = bcs.iteratorAt(0).timestamp(); @@ -244,7 +256,7 @@ struct lumiStabilityTask { } } - EventSelectionParams* par = ccdb->getForTimeStamp("EventSelection/EventSelectionParams", ts); + /*EventSelectionParams* par = ccdb->getForTimeStamp("EventSelection/EventSelectionParams", ts); // access orbit-reset timestamp auto ctpx = ccdb->getForTimeStamp>("CTP/Calib/OrbitReset", ts); int64_t tsOrbitReset = (*ctpx)[0]; // us @@ -269,15 +281,17 @@ struct lumiStabilityTask { // duration of TF in bcs nBCsPerTF = nOrbitsPerTF * o2::constants::lhc::LHCMaxBunches; LOGP(info, "tsOrbitReset={} us, SOR = {} ms, EOR = {} ms, orbitSOR = {}, nBCsPerTF = {}", tsOrbitReset, tsSOR, tsEOR, orbitSOR, nBCsPerTF); + std::cout << "<<<<<<<<<<<<<<<<<<<<<<<<< Orbits per second: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << nOrbits << std::endl;*/ } // create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available // otherwise default minOrbit and nOrbits will be used - const AxisSpec axisOrbits{static_cast(nOrbits / nOrbitsPerTF), 0., static_cast(nOrbits), ""}; - histos.add("hOrbitFDDVertexCoinc", "FDD Orbits; Orbit; Entries", kTH1F, {axisOrbits}); - histos.add("hOrbitFDDVertex", "FDD Orbits; Orbit; Entries", kTH1F, {axisOrbits}); - histos.add("hOrbitFT0vertex", "FT0 Orbits; Orbit; Entries", kTH1F, {axisOrbits}); - histos.add("hOrbitFV0Central", "FV0 Orbits; Orbit; Entries", kTH1F, {axisOrbits}); + /*const AxisSpec axisOrbits{static_cast(nOrbits / nOrbitsPerTF), 0., static_cast(nOrbits), ""}; + std::cout << "<<<<<<<<<<<<<<<<<<<<<<<<< Creating histograms >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl; + histos.add("hOrbitFDDVertexCoinc", "", kTH1F, {axisOrbits}); + histos.add("hOrbitFDDVertex", "", kTH1F, {axisOrbits}); + histos.add("hOrbitFT0vertex", "", kTH1F, {axisOrbits}); + histos.add("hOrbitFV0Central", "", kTH1F, {axisOrbits});*/ } for (auto const& fdd : fdds) { diff --git a/PWGMM/Mult/Core/include/Functions.h b/PWGMM/Mult/Core/include/Functions.h index 4cd59894184..a0ef3928fa5 100644 --- a/PWGMM/Mult/Core/include/Functions.h +++ b/PWGMM/Mult/Core/include/Functions.h @@ -11,31 +11,143 @@ #ifndef PWGMM_MULT_CORE_INCLUDE_FUNCTIONS_H_ #define PWGMM_MULT_CORE_INCLUDE_FUNCTIONS_H_ -#include "Common/DataModel/Centrality.h" namespace pwgmm::mult { -using namespace o2; +template +concept has_hepmc_xs = requires(MCC::iterator const& mcc) { + mcc.xsectGen(); +}; -// helper function to determine if collision/mccollison type contains centrality -template -static constexpr bool hasSimCent() +template +concept has_hepmc_pid = requires(MCC::iterator const& mcc) { + mcc.processId(); +}; + +template +concept has_hepmc_pdf = requires(MCC::iterator const& mcc) { + mcc.pdfId1(); + mcc.pdfId2(); +}; + +template +concept has_hepmc_hi = requires(MCC::iterator const& mcc) { + mcc.ncollHard(); + mcc.ncoll(); +}; + +template +concept has_FT0C = requires(C::iterator const& c) { + c.centFT0C(); +}; + +template +concept iterator_with_FT0C = requires(IC const& c) { + c.centFT0C(); +}; + +template +concept iterator_with_FT0M = requires(IC const& c) { + c.centFT0M(); +}; + +template +concept has_FT0M = requires(C::iterator const& c) { + c.centFT0M(); +}; + +template +concept has_genFT0C = requires(C::iterator const& c) { + c.gencentFT0C(); +}; + +template +concept has_genFT0M = requires(C::iterator const& c) { + c.gencentFT0M(); +}; + +template +concept iterator_with_genFT0C = requires(C const& c) { + c.gencentFT0C(); +}; + +template +concept iterator_with_genFT0M = requires(C const& c) { + c.gencentFT0M(); +}; + +template +concept has_reco_cent = has_FT0C || has_FT0M; + +template +concept has_gen_cent = has_genFT0C && has_genFT0M; + +template +concept has_Centrality = requires(MCC::iterator const& mcc) { + mcc.centrality(); +}; + +template +concept iterator_with_Centrality = requires(MCC const& mcc) { + mcc.centrality(); +}; + +template + requires(!(iterator_with_FT0C || iterator_with_FT0M)) +static float getRecoCent(C const&) +{ + return -1; +} + +template +static float getRecoCent(C const& collision) +{ + return collision.centFT0C(); +} + +template +static float getRecoCent(C const& collision) +{ + return collision.centFT0M(); +} + +template + requires(!iterator_with_genFT0C) +static float getGenCentFT0C(MCC const&) +{ + return -1; +} + +template + requires(!iterator_with_genFT0M) +static float getGenCentFT0M(MCC const&) +{ + return -1; +} + +template +static float getGenCentFT0C(MCC const& mccollision) +{ + return mccollision.gencentFT0C(); +} + +template +static float getGenCentFT0M(MCC const& mccollision) +{ + return mccollision.gencentFT0M(); +} + +template + requires(!iterator_with_Centrality) +static float getSimCent(MCC const&) { - if constexpr (!soa::is_soa_join_v) { - return false; - } else { - return T::template contains(); - } + return -1; } -template -static constexpr bool hasRecoCent() +template +static float getSimCent(MCC const& mccollision) { - if constexpr (!soa::is_soa_join_v) { - return false; - } else { - return T::template contains() || T::template contains(); - } + return mccollision.centrality(); } } // namespace pwgmm::mult diff --git a/PWGMM/Mult/Core/include/Histograms.h b/PWGMM/Mult/Core/include/Histograms.h index c47f2a8e315..2b41c9ecefe 100644 --- a/PWGMM/Mult/Core/include/Histograms.h +++ b/PWGMM/Mult/Core/include/Histograms.h @@ -12,6 +12,7 @@ #ifndef PWGMM_MULT_CORE_INCLUDE_HISTOGRAMS_H_ #define PWGMM_MULT_CORE_INCLUDE_HISTOGRAMS_H_ #include "TPDGCode.h" +#include #include namespace pwgmm::mult diff --git a/PWGMM/Mult/DataModel/ReducedTables.h b/PWGMM/Mult/DataModel/ReducedTables.h index 8b9cdb45ba7..fbdd68b89db 100644 --- a/PWGMM/Mult/DataModel/ReducedTables.h +++ b/PWGMM/Mult/DataModel/ReducedTables.h @@ -25,12 +25,8 @@ namespace o2::aod bc::RunNumber // Reduced BCs as a root index -DECLARE_SOA_TABLE(RBCs, "AOD", "RBC", - BCcols, - soa::Marker<1>); -DECLARE_SOA_TABLE(StoredRBCs, "AOD1", "RBC", - BCcols, - soa::Marker<2>); +DECLARE_SOA_TABLE_STAGED(RBCs, "RBC", + BCcols); namespace rcol { @@ -63,19 +59,11 @@ DECLARE_SOA_COLUMN(MapEtaPhi, mapetaphi, std::vector); cent::CentNTPV // Reduced Collisions -DECLARE_SOA_TABLE(RCollisions, "AOD", "RCOLLISION", - Ccols, - soa::Marker<1>) -DECLARE_SOA_TABLE(StoredRCollisions, "AOD1", "RCOLLISION", - Ccols, - soa::Marker<2>) +DECLARE_SOA_TABLE_STAGED(RCollisions, "RCOLLISION", + Ccols) -DECLARE_SOA_TABLE(RCents, "AOD", "RCENTS", - CCcols, - soa::Marker<1>) -DECLARE_SOA_TABLE(StoredRCents, "AOD1", "RCENTS", - CCcols, - soa::Marker<2>) +DECLARE_SOA_TABLE_STAGED(RCents, "RCENTS", + CCcols) // Reduced tracks (is this needed?) namespace rtrack @@ -93,12 +81,8 @@ DECLARE_SOA_COLUMN(Weight, weight, float); track::DcaXY, \ track::DcaZ -DECLARE_SOA_TABLE(RTracks, "AOD", "RTRACK", - Tcols, - soa::Marker<1>) -DECLARE_SOA_TABLE(StoredRTracks, "AOD1", "RTRACK", - Tcols, - soa::Marker<2>) +DECLARE_SOA_TABLE_STAGED(RTracks, "RTRACK", + Tcols) #define TFcols o2::soa::Index<>, \ rtrack::RCollisionId, \ @@ -110,12 +94,8 @@ DECLARE_SOA_TABLE(StoredRTracks, "AOD1", "RTRACK", fwdtrack::FwdDcaX, \ fwdtrack::FwdDcaY -DECLARE_SOA_TABLE(RFTracks, "AOD", "RFTRACK", - TFcols, - soa::Marker<1>) -DECLARE_SOA_TABLE(StoredRFTracks, "AOD1", "RFTRACK", - TFcols, - soa::Marker<2>) +DECLARE_SOA_TABLE_STAGED(RFTracks, "RFTRACK", + TFcols) // Reduced MC collisions namespace rmccol @@ -134,12 +114,8 @@ DECLARE_SOA_COLUMN(Weight, weight, float); mult::MultMCNParticlesEta05, \ mult::MultMCNParticlesEta10 -DECLARE_SOA_TABLE(RMCCollisions, "AOD", "RMCCOLLISION", - MCCcols, - soa::Marker<1>) -DECLARE_SOA_TABLE(StoredRMCCollisions, "AOD1", "RMCCOLLISION", - MCCcols, - soa::Marker<2>) +DECLARE_SOA_TABLE_STAGED(RMCCollisions, "RMCCOLLISION", + MCCcols) // Extra MC tables namespace rhepmc @@ -161,12 +137,8 @@ DECLARE_SOA_INDEX_COLUMN(RMCCollision, rmccollison); hepmcpdfinfo::Pdf1, \ hepmcpdfinfo::Pdf2 -DECLARE_SOA_TABLE(RHepMCinfos, "AOD", "RHEPMCINFO", - HMCcols, - soa::Marker<1>); -DECLARE_SOA_TABLE(StoredRHepMCinfos, "AOD1", "RHEPMCINFO", - HMCcols, - soa::Marker<2>); +DECLARE_SOA_TABLE_STAGED(RHepMCinfos, "RHEPMCINFO", + HMCcols); #define HMCHIcols rhepmc::RMCCollisionId, \ hepmcheavyion::NcollHard, \ @@ -178,12 +150,8 @@ DECLARE_SOA_TABLE(StoredRHepMCinfos, "AOD1", "RHEPMCINFO", hepmcheavyion::SigmaInelNN, \ hepmcheavyion::Centrality -DECLARE_SOA_TABLE(RHepMCHIs, "AOD", "RHEPMCHI", - HMCHIcols, - soa::Marker<1>); -DECLARE_SOA_TABLE(StoredRHepMCHIs, "AOD1", "RHEPMCHI", - HMCHIcols, - soa::Marker<2>); +DECLARE_SOA_TABLE_STAGED(RHepMCHIs, "RHEPMCHI", + HMCHIcols); namespace rparticle { @@ -204,12 +172,8 @@ DECLARE_SOA_INDEX_COLUMN(RMCCollision, rmccollision); mcparticle::E, \ mcparticle::Weight -DECLARE_SOA_TABLE(RMCParticles, "AOD", "RMCPARTICLE", - RMCPcols, - soa::Marker<1>) -DECLARE_SOA_TABLE(StoredRMCParticles, "AOD1", "RMCPARTICLE", - RMCPcols, - soa::Marker<2>) +DECLARE_SOA_TABLE_STAGED(RMCParticles, "RMCPARTICLE", + RMCPcols) // label tables namespace rlabels @@ -217,15 +181,11 @@ namespace rlabels DECLARE_SOA_INDEX_COLUMN(RMCCollision, rmccollision); DECLARE_SOA_INDEX_COLUMN(RMCParticle, rmcparticle); } // namespace rlabels -DECLARE_SOA_TABLE(RMCTrackLabels, "AOD", "RMCTRKLABEL", - rlabels::RMCParticleId, soa::Marker<1>) -DECLARE_SOA_TABLE(StoredRMCTrackLabels, "AOD1", "RMCTRKLABEL", - rlabels::RMCParticleId, soa::Marker<2>) +DECLARE_SOA_TABLE_STAGED(RMCTrackLabels, "RMCTRKLABEL", + rlabels::RMCParticleId) -DECLARE_SOA_TABLE(RMCColLabels, "AOD", "RMCCOLLABEL", - rlabels::RMCCollisionId, soa::Marker<1>) -DECLARE_SOA_TABLE(StoredRMCColLabels, "AOD1", "RMCCOLLABEL", - rlabels::RMCCollisionId, soa::Marker<2>) +DECLARE_SOA_TABLE_STAGED(RMCColLabels, "RMCCOLLABEL", + rlabels::RMCCollisionId) namespace features { diff --git a/PWGMM/Mult/Tasks/CMakeLists.txt b/PWGMM/Mult/Tasks/CMakeLists.txt index 4828a7ea434..9012d14f2c1 100644 --- a/PWGMM/Mult/Tasks/CMakeLists.txt +++ b/PWGMM/Mult/Tasks/CMakeLists.txt @@ -34,6 +34,11 @@ o2physics_add_dpl_workflow(dndeta-mft PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(dndeta-mft-pbpb + SOURCES dndeta-mft-pbpb.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(flatenicity-fv0 SOURCES flatenicityFV0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGMM/Mult/Tasks/dndeta-mft-pbpb.cxx b/PWGMM/Mult/Tasks/dndeta-mft-pbpb.cxx new file mode 100644 index 00000000000..f1366069de8 --- /dev/null +++ b/PWGMM/Mult/Tasks/dndeta-mft-pbpb.cxx @@ -0,0 +1,1537 @@ +// Copyright 2020-2022 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// +/// \file dndeta-mft-pbpb.cxx +/// \struct dndeta analysis at forward pseudorapidity +/// \brief Task for calculating dNdeta in Pb-Pb collisions using MFT detector +/// \author Gyula Bencedi +/// \since Nov 2024 +/// @note based on dndeta-mft.cxx +/// + +#include +#include +#include + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RuntimeError.h" +#include "Framework/runDataProcessing.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "CommonConstants/MathConstants.h" + +#include "MathUtils/Utils.h" +#include "ReconstructionDataFormats/GlobalTrackID.h" + +#include + +#include "Index.h" +#include "bestCollisionTable.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::track; +using namespace o2::aod::fwdtrack; + +AxisSpec PtAxis = {1001, -0.005, 10.005}; +AxisSpec MultAxis = {701, -0.5, 700.5, "N_{trk}"}; +AxisSpec ZAxis = {60, -30., 30.}; +AxisSpec DeltaZAxis = {61, -6.1, 6.1}; +AxisSpec DCAxyAxis = {500, -1, 50}; +AxisSpec PhiAxis = {629, 0, o2::constants::math::TwoPI, "Rad", "#phi"}; +AxisSpec EtaAxis = {20, -4., -2.}; + +struct PseudorapidityDensityMFT { + SliceCache cache; + + // Histogram registry + HistogramRegistry registry{ + "registry", + {}, + OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry QAregistry{ + "QAregistry", + {}, + OutputObjHandlingPolicy::AnalysisObject, + false, + true}; + + // analysis specific conf. + Configurable usePhiCut{"usePhiCut", false, "use azimuthal angle cut"}; + Configurable cfgPhiCut{"cfgPhiCut", 0.1f, + "Cut on azimuthal angle of MFT tracks"}; + + // track selection conf. + struct : ConfigurableGroup { + Configurable cfg_eta_min{"cfg_eta_min", -3.6f, ""}; + Configurable cfg_eta_max{"cfg_eta_max", -2.5f, ""}; + Configurable cfg_min_ncluster_mft{"cfg_min_ncluster_mft", 5, + "minimum number of MFT clusters"}; + Configurable cfg_min_pt{"cfg_min_pt", 0., + "minimum pT of the MFT tracks"}; + Configurable cfg_require_ca{ + "cfg_require_ca", false, + "Use Cellular Automaton track-finding algorithm"}; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 2.0f, "Cut on dcaXY"}; + } trkcuts; + + // event selection conf. + Configurable cfgCutZvtx{"cfgCutZvtx", 10.0f, "Cut on z-vtx"}; + Configurable cfgCutCent{"cfgCutCent", 80.0f, + "Cut on maximum centrality"}; + Configurable useZDiffCut{"useZvtxDiffCut", false, + "use Zvtx reco-mc diff. cut"}; + Configurable maxZvtxDiff{ + "maxZvtxDiff", 1.0f, + "max allowed Z vtx difference for reconstruced collisions (cm)"}; + Configurable requireNoCollInTimeRangeStd{ + "requireNoCollInTimeRangeStd", false, + "reject collisions corrupted by the cannibalism, with other collisions " + "within +/- 10 microseconds"}; + Configurable requireNoCollInTimeRangeNarrow{ + "requireNoCollInTimeRangeNarrow", false, + "reject collisions corrupted by the cannibalism, with other collisions " + "within +/- 10 microseconds"}; + ConfigurableAxis OccupancyBins{"OccupancyBins", + {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, + 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, + 6000.0f, 8000.0f, 10000.0f, 50000.0f}, + "Occupancy"}; + Configurable minOccupancy{ + "minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{ + "maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + ConfigurableAxis CentBins{ + "CentBins", + {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, + ""}; + + Service pdg; + + /// @brief init function, definition of histograms + void init(InitContext&) + { + if (static_cast(doprocessDataInclusive) + + static_cast(doprocessDatawBestTracksInclusive) > + 1) { + LOGP(fatal, + "Either processDataInclusive OR " + "processDatawBestTracksInclusive should be enabled!"); + } + if (static_cast(doprocessDataCent) + + static_cast(doprocessDatawBestTracksCent) > + 1) { + LOGP(fatal, + "Either processDataCent OR processDatawBestTracksCent should " + "be enabled!"); + } + if (static_cast(doprocessMCInclusive) + + static_cast(doprocessMCwBestTracksInclusive) > + 1) { + LOGP(fatal, + "Either processMCInclusive OR processMCwBestTracksInclusive " + "should be enabled!"); + } + if (static_cast(doprocessMCCent) + + static_cast(doprocessMCwBestTracksCent) > + 1) { + LOGP(fatal, + "Either processMCCent OR processMCwBestTracksCent should be " + "enabled!"); + } + + auto hev = registry.add("hEvtSel", "hEvtSel", HistType::kTH1F, + {{10, -0.5f, +9.5f}}); + hev->GetXaxis()->SetBinLabel(1, "All collisions"); + hev->GetXaxis()->SetBinLabel(2, "Ev. sel."); + hev->GetXaxis()->SetBinLabel(3, "kIsGoodZvtxFT0vsPV"); + hev->GetXaxis()->SetBinLabel(4, "NoSameBunchPileup"); + hev->GetXaxis()->SetBinLabel(5, "Z-vtx cut"); + hev->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStd"); + hev->GetXaxis()->SetBinLabel(7, "kNoCollInTimeRangeNarrow"); + hev->GetXaxis()->SetBinLabel(8, "Below min occup."); + hev->GetXaxis()->SetBinLabel(9, "Above max occup."); + + auto hBcSel = registry.add("hBcSel", "hBcSel", HistType::kTH1F, + {{3, -0.5f, +2.5f}}); + hBcSel->GetXaxis()->SetBinLabel(1, "Good BCs"); + hBcSel->GetXaxis()->SetBinLabel(2, "BCs with collisions"); + hBcSel->GetXaxis()->SetBinLabel(3, "BCs with pile-up/splitting"); + + AxisSpec CentAxis = {CentBins, "Centrality", "CentralityAxis"}; + AxisSpec OccupancyAxis = {OccupancyBins, "Occupancy", "OccupancyAxis"}; + + if (doprocessDataInclusive || doprocessDatawBestTracksInclusive) { + registry.add({"Events/Selection", + ";status;events", + {HistType::kTH1F, {{2, 0.5, 2.5}}}}); + auto hstat = registry.get(HIST("Events/Selection")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All"); + x->SetBinLabel(2, "Selected"); + + registry.add({"Events/NtrkZvtx", + "; N_{trk}; Z_{vtx} (cm);", + {HistType::kTH2F, {MultAxis, ZAxis}}}); + registry.add({"Tracks/EtaZvtx", + "; #eta; Z_{vtx} (cm);", + {HistType::kTH2F, {EtaAxis, ZAxis}}}); + registry.add({"Tracks/PhiEta", + "; #varphi; #eta;", + {HistType::kTH2F, {PhiAxis, EtaAxis}}}); + QAregistry.add({"Tracks/Chi2Eta", + "; #chi^{2}; #it{#eta};", + {HistType::kTH2F, {{600, 0, 20}, {100, -8, 8}}}}); + QAregistry.add( + {"Tracks/Chi2", "; #chi^{2};", {HistType::kTH1F, {{600, 0, 20}}}}); + QAregistry.add({"Tracks/NclustersEta", + "; nClusters; #eta;", + {HistType::kTH2F, {{7, 4, 10}, {100, -8, 8}}}}); + QAregistry.add("Events/Occupancy", "; Z_{vtx} (cm); Occupancy", + HistType::kTH2F, {ZAxis, OccupancyAxis}, false); + + if (doprocessDatawBestTracksInclusive) { + registry.add({"Events/NtrkZvtxBest", + "; N_{trk}; Z_{vtx} (cm);", + {HistType::kTH2F, {MultAxis, ZAxis}}}); + registry.add({"Tracks/EtaZvtxBest", + "; #eta; Z_{vtx} (cm);", + {HistType::kTH2F, {EtaAxis, ZAxis}}}); + registry.add({"Tracks/PhiEtaBest", + "; #varphi; #eta;", + {HistType::kTH2F, {PhiAxis, EtaAxis}}}); + QAregistry.add({"Tracks/NclustersEtaBest", + "; nClusters; #eta;", + {HistType::kTH2F, {{7, 4, 10}, {100, -8, 8}}}}); + QAregistry.add({"Tracks/DCAXYPt", + " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality", + {HistType::kTH2F, {PtAxis, DCAxyAxis}}}); + QAregistry.add({"Tracks/DCAXY", + " ; DCA_{XY} (cm)", + {HistType::kTH1F, {DCAxyAxis}}}); + QAregistry.add({"Tracks/ReTracksEtaZvtx", + "; #eta; #it{z}_{vtx} (cm); tracks", + {HistType::kTH2F, {EtaAxis, ZAxis}}}); + QAregistry.add({"Tracks/ReTracksPhiEta", + "; #varphi; #eta; tracks", + {HistType::kTH2F, {PhiAxis, EtaAxis}}}); + QAregistry.add({"Tracks/TrackAmbDegree", + " ; N_{coll}^{comp}", + {HistType::kTH1F, {{51, -0.5, 50.5}}}}); + } + } + + if (doprocessDataCent || doprocessDatawBestTracksCent) { + registry.add({"Events/Centrality/Selection", + ";status;centrality;events", + {HistType::kTH2F, {{2, 0.5, 2.5}, CentAxis}}}); + auto hstat = registry.get(HIST("Events/Centrality/Selection")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All"); + x->SetBinLabel(2, "Selected"); + + registry.add({"Events/Centrality/NtrkZvtx", + "; N_{trk}; Z_{vtx} (cm); centrality", + {HistType::kTH3F, {MultAxis, ZAxis, CentAxis}}}); + registry.add({"Tracks/Centrality/EtaZvtx", + "; #eta; Z_{vtx} (cm); centrality", + {HistType::kTH3F, {EtaAxis, ZAxis, CentAxis}}}); + registry.add({"Tracks/Centrality/PhiEta", + "; #varphi; #eta; centrality", + {HistType::kTH3F, {PhiAxis, EtaAxis, CentAxis}}}); + QAregistry.add({"Events/Centrality/hcentFT0C", + " ; cent FT0C", + {HistType::kTH1F, {{1000, 0, 100}}}, + true}); + QAregistry.add( + {"Tracks/Centrality/Chi2Eta", + "; #chi^{2}; #it{#eta}; centrality", + {HistType::kTH3F, {{600, 0, 20}, {100, -8, 8}, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/Chi2", + "; #chi^{2}; centrality", + {HistType::kTH2F, {{600, 0, 20}, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/NclustersEta", + "; nClusters; #eta; centrality", + {HistType::kTH3F, {{7, 4, 10}, {100, -8, 8}, CentAxis}}}); + QAregistry.add("Events/Centrality/Occupancy", + "; Z_{vtx} (cm); centrality; Occupancy", HistType::kTH3F, + {ZAxis, CentAxis, OccupancyAxis}, false); + QAregistry.add("Tracks/Centrality/Occupancy", "dndeta occupancy", + HistType::kTHnSparseF, + {ZAxis, CentAxis, EtaAxis, PhiAxis, OccupancyAxis}, false); + + if (doprocessDatawBestTracksCent) { + registry.add({"Events/Centrality/NtrkZvtxBest", + "; N_{trk}; Z_{vtx} (cm); centrality", + {HistType::kTH3F, {MultAxis, ZAxis, CentAxis}}}); + registry.add({"Tracks/Centrality/EtaZvtxBest", + "; #eta; Z_{vtx} (cm); centrality", + {HistType::kTH3F, {EtaAxis, ZAxis, CentAxis}}}); + registry.add({"Tracks/Centrality/PhiEtaBest", + "; #varphi; #eta; centrality", + {HistType::kTH3F, {PhiAxis, EtaAxis, CentAxis}}}); + QAregistry.add( + {"Tracks/Centrality/NclustersEtaBest", + "; nClusters; #eta; centrality", + {HistType::kTH3F, {{7, 4, 10}, {100, -8, 8}, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/TrackAmbDegree", + " ; N_{coll}^{comp}", + {HistType::kTH2F, {{51, -0.5, 50.5}, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/DCAXY", + " ; DCA_{XY} (cm)", + {HistType::kTH2F, {DCAxyAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/DCAXYPt", + " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality", + {HistType::kTH3F, {PtAxis, DCAxyAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/ReTracksEtaZvtx", + "; #eta; #it{z}_{vtx} (cm); tracks", + {HistType::kTH3F, {EtaAxis, ZAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/ReTracksPhiEta", + "; #varphi; #eta; tracks", + {HistType::kTH3F, {PhiAxis, EtaAxis, CentAxis}}}); + QAregistry.add("Events/Centrality/OccupancyBest", + "; Z_{vtx} (cm); centrality; Occupancy", HistType::kTH3F, + {ZAxis, CentAxis, OccupancyAxis}, false); + QAregistry.add("Tracks/Centrality/OccupancyBest", "dndeta occupancy", + HistType::kTHnSparseF, + {ZAxis, CentAxis, EtaAxis, PhiAxis, OccupancyAxis}, + false); + } + } + + if (doprocessMCInclusive || doprocessMCwBestTracksInclusive) { + registry.add({"Events/EvtEffGen", + ";status;events", + {HistType::kTH1F, {{3, 0.5, 3.5}}}}); + auto heff = registry.get(HIST("Events/EvtEffGen")); + auto* x = heff->GetXaxis(); + x->SetBinLabel(1, "All reconstructed"); + x->SetBinLabel(2, "Selected reconstructed"); + x->SetBinLabel(3, "All generated"); + + registry.add({"Events/NtrkZvtxGen_t", + "; N_{trk}; Z_{vtx} (cm);", + {HistType::kTH2F, {MultAxis, ZAxis}}}); + registry.add({"Events/NtrkZvtxGen", + "; N_{trk}; Z_{vtx} (cm);", + {HistType::kTH2F, {MultAxis, ZAxis}}}); + registry.add({"Tracks/EtaZvtxGen", + "; #eta; Z_{vtx} (cm);", + {HistType::kTH2F, {EtaAxis, ZAxis}}}); + registry.add({"Tracks/PhiEtaGen", + "; #varphi; #eta;", + {HistType::kTH2F, {PhiAxis, EtaAxis}}}); + registry.add({"Tracks/EtaZvtxGen_t", + "; #eta; Z_{vtx} (cm);", + {HistType::kTH2F, {EtaAxis, ZAxis}}}); + registry.add({"Tracks/PhiEtaGen_t", + "; #varphi; #eta;", + {HistType::kTH2F, {PhiAxis, EtaAxis}}}); + QAregistry.add({"Events/NotFoundEventZvtx", + " ; #it{z}_{vtx} (cm)", + {HistType::kTH1F, {ZAxis}}}); + QAregistry.add({"Events/ZvtxDiff", + " ; Z_{rec} - Z_{gen} (cm)", + {HistType::kTH1F, {DeltaZAxis}}}); + QAregistry.add( + {"Events/SplitMult", " ; N_{gen}", {HistType::kTH1F, {MultAxis}}}); + } + + if (doprocessMCCent || doprocessMCwBestTracksCent) { + registry.add({"Events/Centrality/EvtEffGen", + ";status;events", + {HistType::kTH2F, {{3, 0.5, 3.5}, CentAxis}}}); + auto heff = registry.get(HIST("Events/Centrality/EvtEffGen")); + auto* x = heff->GetXaxis(); + x->SetBinLabel(1, "All reconstructed"); + x->SetBinLabel(2, "Selected reconstructed"); + x->SetBinLabel(3, "All generated"); + + registry.add({"Events/Centrality/NtrkZvtxGen_t", + "; N_{trk}; Z_{vtx} (cm);", + {HistType::kTH3F, {MultAxis, ZAxis, CentAxis}}}); + registry.add({"Events/Centrality/NtrkZvtxGen", + "; N_{trk}; Z_{vtx} (cm);", + {HistType::kTH3F, {MultAxis, ZAxis, CentAxis}}}); + registry.add({"Events/Centrality/hRecCent", + "Events/Centrality/hRecCent", + {HistType::kTH1F, {CentAxis}}}); + registry.add({"Events/Centrality/hRecZvtxCent", + "Events/Centrality/hRecZvtxCent", + {HistType::kTH2F, {ZAxis, CentAxis}}}); + registry.add({"Tracks/Centrality/EtaZvtxGen", + "; #eta; Z_{vtx} (cm);", + {HistType::kTH3F, {EtaAxis, ZAxis, CentAxis}}}); + registry.add({"Tracks/Centrality/PhiEtaGen", + "; #varphi; #eta;", + {HistType::kTH3F, {PhiAxis, EtaAxis, CentAxis}}}); + registry.add({"Tracks/Centrality/EtaZvtxGen_t", + "; #eta; Z_{vtx} (cm);", + {HistType::kTH3F, {EtaAxis, ZAxis, CentAxis}}}); + registry.add({"Tracks/Centrality/PhiEtaGen_t", + "; #varphi; #eta;", + {HistType::kTH3F, {PhiAxis, EtaAxis, CentAxis}}}); + QAregistry.add({"Events/Centrality/NotFoundEventZvtx", + " ; #it{z}_{vtx} (cm)", + {HistType::kTH2F, {ZAxis, CentAxis}}}); + QAregistry.add({"Events/Centrality/ZvtxDiff", + " ; Z_{rec} - Z_{gen} (cm)", + {HistType::kTH2F, {DeltaZAxis, CentAxis}}}); + QAregistry.add({"Events/Centrality/SplitMult", + " ; N_{gen}", + {HistType::kTH2F, {MultAxis, CentAxis}}}); + } + + if (doprocessTrkEffIdxInlusive) { + QAregistry.add( + {"Tracks/hPtPhiEtaZvtxEffGen", + "hPtPhiEtaZvtxEffGen", + {HistType::kTHnSparseF, {PtAxis, PhiAxis, EtaAxis, ZAxis}}}); + QAregistry.add( + {"Tracks/hPtPhiEtaZvtxEffRec", + "hPtPhiEtaZvtxEffRec", + {HistType::kTHnSparseF, {PtAxis, PhiAxis, EtaAxis, ZAxis}}}); + QAregistry.add({"Tracks/hPhiEtaDuplicates", + " ; p_{T} (GeV/c);", + {HistType::kTH2F, {PhiAxis, EtaAxis}}}); + QAregistry.add( + {"Tracks/hPtPhiEtaZvtxEffDuplicates", + "hPtPhiEtaZvtxEffDuplicates", + {HistType::kTHnSparseF, {PtAxis, PhiAxis, EtaAxis, ZAxis}}}); + QAregistry.add( + {"Tracks/hPtPhiEtaZvtxEffGenDuplicates", + "hPtPhiEtaZvtxEffGenDuplicates", + {HistType::kTHnSparseF, {PtAxis, PhiAxis, EtaAxis, ZAxis}}}); + QAregistry.add({"Tracks/NmftTrkPerPart", + "; #it{N}_{mft tracks per particle};", + {HistType::kTH1F, {{200, -0.5, 200.}}}}); + } + + if (doprocessTrkEffIdxCent) { + QAregistry.add({"Tracks/Centrality/hPtPhiEtaZvtxEffGen", + "hPtPhiEtaZvtxEffGen", + {HistType::kTHnSparseF, + {PtAxis, PhiAxis, EtaAxis, ZAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/hPtPhiEtaZvtxEffRec", + "hPtPhiEtaZvtxEffRec", + {HistType::kTHnSparseF, + {PtAxis, PhiAxis, EtaAxis, ZAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/hPhiEtaDuplicates", + " ; p_{T} (GeV/c);", + {HistType::kTH3F, {PhiAxis, EtaAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/hPtPhiEtaZvtxEffDuplicates", + "hPtPhiEtaZvtxEffDuplicates", + {HistType::kTHnSparseF, + {PtAxis, PhiAxis, EtaAxis, ZAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/hPtPhiEtaZvtxEffGenDuplicates", + "hPtPhiEtaZvtxEffGenDuplicates", + {HistType::kTHnSparseF, + {PtAxis, PhiAxis, EtaAxis, ZAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/NmftTrkPerPart", + "; #it{N}_{mft tracks per particle};", + {HistType::kTH2F, {{200, -0.5, 200.}, CentAxis}}}); + } + + if (doprocessTrkEffBestInclusive) { + QAregistry.add( + {"Tracks/hPtPhiEtaZvtxEffBestGen", + "hPtPhiEtaZvtxEffGen", + {HistType::kTHnSparseF, {PtAxis, PhiAxis, EtaAxis, ZAxis}}}); + QAregistry.add( + {"Tracks/hPtPhiEtaZvtxEffBestRec", + "hPtPhiEtaZvtxEffRec", + {HistType::kTHnSparseF, {PtAxis, PhiAxis, EtaAxis, ZAxis}}}); + QAregistry.add({"Tracks/hPtEffBestFakeRec", + " ; p_{T} (GeV/c);", + {HistType::kTH1F, {PtAxis}}}); + } + + if (doprocessTrkEffBestCent) { + QAregistry.add({"Tracks/Centrality/hPtPhiEtaZvtxEffBestGen", + "hPtPhiEtaZvtxEffGen", + {HistType::kTHnSparseF, + {PtAxis, PhiAxis, EtaAxis, ZAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/hPtPhiEtaZvtxEffBestRec", + "hPtPhiEtaZvtxEffRec", + {HistType::kTHnSparseF, + {PtAxis, PhiAxis, EtaAxis, ZAxis, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/hPtEffBestFakeRec", + " ; p_{T} (GeV/c);", + {HistType::kTH2F, {PtAxis, CentAxis}}}); + } + + if (doprocessMcQAInclusive) { + QAregistry.add({"Events/hRecPerGenColls", + "; #it{N}_{reco collisions} / #it{N}_{gen collisions};", + {HistType::kTH1F, {{200, 0., 2.}}}}); + QAregistry.add({"Tracks/hNmftTrks", + "; #it{N}_{mft tracks};", + {HistType::kTH1F, {{200, -0.5, 200.}}}}); + QAregistry.add({"Tracks/hFracAmbiguousMftTrks", + "; #it{N}_{ambiguous tracks} / #it{N}_{tracks};", + {HistType::kTH1F, {{100, 0., 1.}}}}); + } + + if (doprocessMcQACent) { + QAregistry.add( + {"Events/Centrality/hRecPerGenColls", + "; #it{N}_{reco collisions} / #it{N}_{gen collisions}; centrality", + {HistType::kTH2F, {{200, 0., 2.}, CentAxis}}}); + QAregistry.add({"Tracks/Centrality/hNmftTrks", + "; #it{N}_{mft tracks}; centrality", + {HistType::kTH2F, {{200, -0.5, 200.}, CentAxis}}}); + QAregistry.add( + {"Tracks/Centrality/hFracAmbiguousMftTrks", + "; #it{N}_{ambiguous tracks} / #it{N}_{tracks}; centrality", + {HistType::kTH2F, {{100, 0., 1.}, CentAxis}}}); + } + } + + /// Filters - collision + Filter filterCollCent = nabs(aod::cent::centFT0C) < cfgCutCent; + Filter filterCollZvtx = nabs(aod::collision::posZ) < cfgCutZvtx; + Filter filterMcCollZvtx = nabs(aod::mccollision::posZ) < cfgCutZvtx; + + /// Filters - tracks + Filter filtTrkEta = (aod::fwdtrack::eta < trkcuts.cfg_eta_max) && + (aod::fwdtrack::eta > trkcuts.cfg_eta_min); + Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= 0); + Filter filtATrackDCA = + (nabs(aod::fwdtrack::bestDCAXY) < trkcuts.cfg_max_dcaxy); + + /// Filters - mc particles + Filter primaries = (aod::mcparticle::flags & + (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == + (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary; + + /// Joined tables + using FullBCs = soa::Join; + using CollBCs = + soa::Join; + using Colls = soa::Join; + using Coll = Colls::iterator; + using CollsCent = soa::Join; + using CollCent = CollsCent::iterator; + using CollsGenCent = soa::Join; + using CollGenCent = CollsGenCent::iterator; + using MFTTracksLabeled = soa::Join; + + /// Filtered tables + using filtColls = soa::Filtered>; + using filtColl = + soa::Filtered>::iterator; + using filtCollsCent = + soa::Filtered>; + using filtCollCent = soa::Filtered< + soa::Join>::iterator; + using CollsGenCentSmallG = + o2::soa::SmallGroups>; + using filtCollsGenCentSmallG = + soa::SmallGroups>; + using filtCollsGenCent = + soa::Filtered>; + using filtMcGenColls = soa::Filtered; + using filtMcGenColl = soa::Filtered::iterator; + using filtMftTracks = soa::Filtered; + using filtMcMftTracks = soa::Filtered; + using filtBestTracks = soa::Filtered; + using filtBestTracksJ = + soa::Filtered>; + using filtParticles = soa::Filtered; + + template + bool isTrackSelected(const T& track) + { + if (track.eta() < trkcuts.cfg_eta_min || track.eta() > trkcuts.cfg_eta_max) + return false; + if (trkcuts.cfg_require_ca && !track.isCA()) + return false; + if (track.nClusters() < trkcuts.cfg_min_ncluster_mft) + return false; + if (track.pt() < trkcuts.cfg_min_pt) + return false; + if (usePhiCut) { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < 0.f || 2.f * M_PI < phi) { + return false; + } + if ((phi < cfgPhiCut) || + ((phi > M_PI - cfgPhiCut) && (phi < M_PI + cfgPhiCut)) || + (phi > 2. * M_PI - cfgPhiCut) || + ((phi > ((M_PI / 2. - 0.1) * M_PI) - cfgPhiCut) && + (phi < ((M_PI / 2. - 0.1) * M_PI) + cfgPhiCut))) + return false; + } + return true; + } + + template + int countTracks(T const& tracks, float z, float c, float occ) + { + auto nTrk = 0; + if (tracks.size() > 0) { + for (auto& track : tracks) { + if (fillHis) { + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Tracks/Centrality/Chi2Eta"), track.chi2(), + track.eta(), c); + QAregistry.fill(HIST("Tracks/Centrality/Chi2"), track.chi2(), c); + QAregistry.fill(HIST("Tracks/Centrality/NclustersEta"), + track.nClusters(), track.eta(), c); + } else { + QAregistry.fill(HIST("Tracks/Chi2Eta"), track.chi2(), track.eta()); + QAregistry.fill(HIST("Tracks/Chi2"), track.chi2()); + QAregistry.fill(HIST("Tracks/NclustersEta"), track.nClusters(), + track.eta()); + } + } + if (!isTrackSelected(track)) { + continue; + } + if (fillHis) { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < 0.f || 2.f * M_PI < phi) { + continue; + } + if constexpr (C::template contains()) { + registry.fill(HIST("Tracks/Centrality/EtaZvtx"), track.eta(), z, c); + registry.fill(HIST("Tracks/Centrality/PhiEta"), phi, track.eta(), + c); + QAregistry.fill(HIST("Tracks/Centrality/Occupancy"), z, c, + track.eta(), track.phi(), occ); + } else { + registry.fill(HIST("Tracks/EtaZvtx"), track.eta(), z); + registry.fill(HIST("Tracks/PhiEta"), phi, track.eta()); + } + } + ++nTrk; + } + } + return nTrk; + } + + template + int countBestTracks(T const& /*tracks*/, B const& besttracks, float z, + float c, float occ) + { + auto nATrk = 0; + if (besttracks.size() > 0) { + for (auto& atrack : besttracks) { + auto itrack = atrack.template mfttrack_as(); + if (!isTrackSelected(itrack)) { + continue; + } + if (fillHis) { + float phi = itrack.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < 0.f || 2.f * M_PI < phi) { + continue; + } + if constexpr (C::template contains()) { + registry.fill(HIST("Tracks/Centrality/EtaZvtxBest"), itrack.eta(), + z, c); + registry.fill(HIST("Tracks/Centrality/PhiEtaBest"), phi, + itrack.eta(), c); + QAregistry.fill(HIST("Tracks/Centrality/OccupancyBest"), z, c, + itrack.eta(), itrack.phi(), occ); + QAregistry.fill(HIST("Tracks/Centrality/DCAXYPt"), itrack.pt(), + atrack.bestDCAXY(), c); + QAregistry.fill(HIST("Tracks/Centrality/DCAXY"), atrack.bestDCAXY(), + c); + QAregistry.fill(HIST("Tracks/Centrality/NclustersEtaBest"), + itrack.nClusters(), itrack.eta(), c); + if (itrack.collisionId() != atrack.bestCollisionId()) { + QAregistry.fill(HIST("Tracks/Centrality/ReTracksEtaZvtx"), + itrack.eta(), z, c); + QAregistry.fill(HIST("Tracks/Centrality/ReTracksPhiEta"), phi, + itrack.eta(), c); + } + QAregistry.fill(HIST("Tracks/Centrality/TrackAmbDegree"), + atrack.ambDegree(), c); + } else { + registry.fill(HIST("Tracks/EtaZvtxBest"), itrack.eta(), z); + registry.fill(HIST("Tracks/PhiEtaBest"), phi, itrack.eta()); + QAregistry.fill(HIST("Tracks/DCAXYPt"), itrack.pt(), + atrack.bestDCAXY()); + QAregistry.fill(HIST("Tracks/DCAXY"), atrack.bestDCAXY()); + QAregistry.fill(HIST("Tracks/NclustersEtaBest"), itrack.nClusters(), + itrack.eta()); + if (itrack.collisionId() != atrack.bestCollisionId()) { + QAregistry.fill(HIST("Tracks/ReTracksEtaZvtx"), itrack.eta(), z); + QAregistry.fill(HIST("Tracks/ReTracksPhiEta"), phi, itrack.eta()); + } + QAregistry.fill(HIST("Tracks/TrackAmbDegree"), atrack.ambDegree()); + } + } + ++nATrk; + } + } + return nATrk; + } + + template + int countPart(P const& particles) + { + auto nCharged = 0; + for (auto& particle : particles) { + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + nCharged++; + } + return nCharged; + } + + template + bool isGoodEvent(C const& collision) + { + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 0); + } + if (!collision.sel8()) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 1); + } + if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 2); + } + if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 3); + } + if (std::abs(collision.posZ()) >= cfgCutZvtx) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 4); + } + if (requireNoCollInTimeRangeStd && + !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 5); + } + if (requireNoCollInTimeRangeNarrow && + !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 6); + } + if (minOccupancy > 0 && + collision.trackOccupancyInTimeRange() < minOccupancy) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 7); + } + if (maxOccupancy > 0 && + collision.trackOccupancyInTimeRange() > maxOccupancy) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("hEvtSel"), 8); + } + return true; + } + + /// @brief Selection of charged particles + /// @return true: charged; false: not charged + bool isChrgParticle(int code) + { + auto p = pdg->GetParticle(code); + auto charge = 0.; + if (p != nullptr) { + charge = p->Charge(); + } + return std::abs(charge) >= 3.; + } + + template + void fillHist_MC(P const& particles, float cent, float zvtx, + bool const atLeastOne) + { + for (auto& particle : particles) { + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + + float phi = particle.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < 0.f || 2.f * M_PI < phi) { + continue; + } + if constexpr (isCent) { + registry.fill(HIST("Tracks/Centrality/EtaZvtxGen_t"), particle.eta(), + zvtx, cent); + registry.fill(HIST("Tracks/Centrality/PhiEtaGen_t"), phi, + particle.eta(), cent); + } else { + registry.fill(HIST("Tracks/EtaZvtxGen_t"), particle.eta(), zvtx); + registry.fill(HIST("Tracks/PhiEtaGen_t"), phi, particle.eta()); + } + + if (atLeastOne) { + float phi = particle.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < 0.f || 2.f * M_PI < phi) { + continue; + } + if constexpr (isCent) { + registry.fill(HIST("Tracks/Centrality/EtaZvtxGen"), particle.eta(), + zvtx, cent); + registry.fill(HIST("Tracks/Centrality/PhiEtaGen"), phi, + particle.eta(), cent); + } else { + registry.fill(HIST("Tracks/EtaZvtxGen"), particle.eta(), zvtx); + registry.fill(HIST("Tracks/PhiEtaGen"), phi, particle.eta()); + } + } + } + } + + /// @brief process fnc. for general event statistics + void processTagging(FullBCs const& bcs, CollsCent const& collisions) + { + std::vector::iterator> cols; + for (auto& bc : bcs) { + if ((bc.selection_bit(aod::evsel::kIsBBT0A) && + bc.selection_bit(aod::evsel::kIsBBT0C)) != 0) { + registry.fill(HIST("hBcSel"), 0); + cols.clear(); + for (auto& collision : collisions) { + if (collision.has_foundBC()) { + if (collision.foundBCId() == bc.globalIndex()) { + cols.emplace_back(collision); + } + } else if (collision.bcId() == bc.globalIndex()) { + cols.emplace_back(collision); + } + } + LOGP(debug, "BC {} has {} collisions", bc.globalBC(), cols.size()); + if (!cols.empty()) { + registry.fill(HIST("hBcSel"), 1); + if (cols.size() > 1) { + registry.fill(HIST("hBcSel"), 2); + } + } + } + } + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processTagging, + "Collect event sample stats", true); + + template + void processData(typename C::iterator const& collision, + filtMftTracks const& tracks) + { + float c = -1; + if constexpr (C::template contains()) { + c = collision.centFT0C(); + registry.fill(HIST("Events/Centrality/Selection"), 1., c); + } else { + registry.fill(HIST("Events/Selection"), 1.); + } + if (!isGoodEvent(collision)) { + return; + } + auto z = collision.posZ(); + auto occ = collision.trackOccupancyInTimeRange(); + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/Selection"), 2., c); + QAregistry.fill(HIST("Events/Centrality/Occupancy"), z, c, occ); + QAregistry.fill(HIST("Events/Centrality/hcentFT0C"), c); + } else { + registry.fill(HIST("Events/Selection"), 2.); + } + + auto nTrk = countTracks( + tracks, z, c, occ); //!@note here we obtain eta-z and phi-eta + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/NtrkZvtx"), nTrk, z, c); + } else { + registry.fill(HIST("Events/NtrkZvtx"), nTrk, z); + } + } + + template + void processDatawBestTracks( + typename C::iterator const& collision, filtMftTracks const& tracks, + soa::SmallGroups const& besttracks) + { + float c = -1; + if constexpr (C::template contains()) { + c = collision.centFT0C(); + registry.fill(HIST("Events/Centrality/Selection"), 1., c); + } else { + registry.fill(HIST("Events/Selection"), 1.); + } + if (!isGoodEvent(collision)) { + return; + } + auto z = collision.posZ(); + auto occ = collision.trackOccupancyInTimeRange(); + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/Selection"), 2., c); + QAregistry.fill(HIST("Events/Centrality/OccupancyBest"), z, c, occ); + } else { + registry.fill(HIST("Events/Selection"), 2.); + } + + auto nBestTrks = + countBestTracks(tracks, besttracks, z, c, + occ); //!@note here we obtain eta-z and phi-eta + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/NtrkZvtxBest"), nBestTrks, z, c); + } else { + registry.fill(HIST("Events/NtrkZvtxBest"), nBestTrks, z); + } + } + + /// @brief process fnc. to run on DATA and REC MC w/o centrality selection + void processDataInclusive(filtColls::iterator const& collision, + filtMftTracks const& tracks) + { + processData(collision, tracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processDataInclusive, "Count tracks", + false); + + /// @brief process fnc. to run on DATA and REC MC w/ FT0C centrality selection + void processDataCent(filtCollsCent::iterator const& collision, + filtMftTracks const& tracks) + { + processData(collision, tracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processDataCent, + "Count tracks in FT0C bins", false); + + /// @brief process fnc. to run on DATA and REC MC based on BestCollisionsFwd + /// table w/o centrality selection + void processDatawBestTracksInclusive( + filtColls::iterator const& collision, filtMftTracks const& tracks, + soa::SmallGroups const& besttracks) + { + processDatawBestTracks(collision, tracks, besttracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processDatawBestTracksInclusive, + "Count tracks based on BestCollisionsFwd table", false); + + /// @brief process fnc. to run on DATA and REC MC based on BestCollisionsFwd + /// table w/ FT0C centrality selection + void processDatawBestTracksCent( + filtCollsCent::iterator const& collision, filtMftTracks const& tracks, + soa::SmallGroups const& besttracks) + { + processDatawBestTracks(collision, tracks, besttracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processDatawBestTracksCent, + "Count tracks in FT0C bins based on BestCollisionsFwd table", + false); + + Preslice perCol = o2::aod::fwdtrack::collisionId; + Partition mcSample = nabs(aod::mcparticle::eta) < 1.0f; + + /// @brief process template function to run on MC truth + /// @param cols subscribe to the collisions + /// @param parts subscribe to filtered MC particle table + template + void processMC( + typename MC::iterator const& mcCollision, + soa::SmallGroups> const& collisions, + filtParticles const& particles, filtMcMftTracks const& tracks) + { + float c_gen = -1; + bool atLeastOne = false; + int moreThanOne = 0; + for (auto& collision : collisions) { + float c_rec = -1; + if constexpr (C::template contains()) { + c_rec = collision.centFT0C(); + registry.fill(HIST("Events/Centrality/EvtEffGen"), 1., c_rec); + } else { + registry.fill(HIST("Events/EvtEffGen"), 1.); + } + + if (isGoodEvent(collision)) { + if constexpr (C::template contains()) { + if (!atLeastOne) { + c_gen = c_rec; + } + } + atLeastOne = true; + ++moreThanOne; + auto z = collision.posZ(); + + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/EvtEffGen"), 2., c_rec); + registry.fill(HIST("Events/Centrality/hRecCent"), c_rec); + registry.fill(HIST("Events/Centrality/hRecZvtxCent"), z, c_rec); + } else { + registry.fill(HIST("Events/EvtEffGen"), 2.); + } + + auto perCollisionSample = + tracks.sliceBy(perCol, collision.globalIndex()); + auto nTrkRec = + countTracks(perCollisionSample, z, c_rec, + collision.trackOccupancyInTimeRange()); + + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Events/Centrality/ZvtxDiff"), + collision.posZ() - mcCollision.posZ(), c_rec); + } else { + QAregistry.fill(HIST("Events/ZvtxDiff"), + collision.posZ() - mcCollision.posZ()); + } + + if (useZDiffCut) { + if (std::abs(collision.posZ() - mcCollision.posZ()) > maxZvtxDiff) { + continue; + } + } + + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/NtrkZvtxGen"), nTrkRec, + collision.posZ(), c_rec); + } else { + registry.fill(HIST("Events/NtrkZvtxGen"), nTrkRec, collision.posZ()); + } + } + } + + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/EvtEffGen"), 3., c_gen); + } else { + registry.fill(HIST("Events/EvtEffGen"), 3.); + } + + auto perCollMCsample = mcSample->sliceByCached( + aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + auto Nchrg = countPart(perCollMCsample); + if (moreThanOne > 1) { + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Events/Centrality/SplitMult"), Nchrg, c_gen); + } else { + QAregistry.fill(HIST("Events/SplitMult"), Nchrg); + } + } + + auto zvtxMC = mcCollision.posZ(); + auto nCharged = countPart(particles); + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/NtrkZvtxGen_t"), nCharged, zvtxMC, + c_gen); + } else { + registry.fill(HIST("Events/NtrkZvtxGen_t"), nCharged, zvtxMC); + } + + fillHist_MC()>(particles, c_gen, + zvtxMC, atLeastOne); + + if (collisions.size() == 0) { + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Events/Centrality/NotFoundEventZvtx"), + mcCollision.posZ(), c_gen); + } else { + QAregistry.fill(HIST("Events/NotFoundEventZvtx"), mcCollision.posZ()); + } + } + } + + /// @brief process fnc. to run on MC w/o centrality selection + void processMCInclusive( + filtMcGenColls::iterator const& mccollision, + soa::SmallGroups> const& collisions, + filtParticles const& particles, filtMcMftTracks const& tracks) + { + processMC(mccollision, collisions, particles, + tracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processMCInclusive, + "Count MC particles", false); + + /// @brief process fnc. to run on MC w FT0C centrality selection + void processMCCent( + filtMcGenColls::iterator const& mccollision, + soa::SmallGroups> const& collisions, + filtParticles const& particles, filtMcMftTracks const& tracks) + { + processMC(mccollision, collisions, particles, + tracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processMCCent, + "Count MC particles in FT0C bins", false); + + PresliceUnsorted perColU = + aod::fwdtrack::bestCollisionId; + + /// @brief process template function to run on MC truth using + /// aod::BestCollisionsFwd tracks + template + void processMCwBestTracks( + typename MC::iterator const& mcCollision, + soa::SmallGroups> const& collisions, + filtParticles const& particles, filtMcMftTracks const& tracks, + filtBestTracks const& besttracks) + { + float c_gen = -1; + bool atLeastOne = false; + // int moreThanOne = 0; + for (auto& collision : collisions) { + float c_rec = -1; + if constexpr (C::template contains()) { + c_rec = collision.centFT0C(); + registry.fill(HIST("Events/Centrality/EvtEffGen"), 1., c_rec); + } else { + registry.fill(HIST("Events/EvtEffGen"), 1.); + } + + if (isGoodEvent(collision)) { + if constexpr (C::template contains()) { + if (!atLeastOne) { + c_gen = c_rec; + } + } + atLeastOne = true; + // ++moreThanOne; + auto z = collision.posZ(); + + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/EvtEffGen"), 2., c_rec); + } else { + registry.fill(HIST("Events/EvtEffGen"), 2.); + } + + auto perCollisionSample = + tracks.sliceBy(perCol, collision.globalIndex()); + auto perCollisionASample = + besttracks.sliceBy(perColU, collision.globalIndex()); + auto nTrkRec = countBestTracks( + perCollisionSample, perCollisionASample, z, c_rec, + collision.trackOccupancyInTimeRange()); + + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/NtrkZvtxGen"), nTrkRec, z, + c_rec); + } else { + registry.fill(HIST("Events/NtrkZvtxGen"), nTrkRec, z); + } + } + } + + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/EvtEffGen"), 3., c_gen); + } else { + registry.fill(HIST("Events/EvtEffGen"), 3.); + } + + auto zvtxMC = mcCollision.posZ(); + auto nCharged = countPart(particles); + if constexpr (C::template contains()) { + registry.fill(HIST("Events/Centrality/NtrkZvtxGen_t"), nCharged, zvtxMC, + c_gen); + } else { + registry.fill(HIST("Events/NtrkZvtxGen_t"), nCharged, zvtxMC); + } + + fillHist_MC()>(particles, c_gen, + zvtxMC, atLeastOne); + + if (collisions.size() == 0) { + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Events/Centrality/NotFoundEventZvtx"), + mcCollision.posZ(), c_gen); + } else { + QAregistry.fill(HIST("Events/NotFoundEventZvtx"), mcCollision.posZ()); + } + } + } + + /// @brief process fnc. to run on MC (inclusive, using aod::BestCollisionsFwd + /// tracks) + void processMCwBestTracksInclusive( + filtMcGenColls::iterator const& mccollision, + soa::SmallGroups> const& collisions, + filtParticles const& particles, filtMcMftTracks const& tracks, + // aod::BestCollisionsFwd const + // &besttracks + filtBestTracks const& besttracks) + { + processMCwBestTracks( + mccollision, collisions, particles, tracks, besttracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processMCwBestTracksInclusive, + "Count MC particles using aod::BestCollisionsFwd", false); + + /// @brief process fnc. to run on MC (FT0C centrality, using + /// aod::BestCollisionsFwd tracks) + void processMCwBestTracksCent( + filtMcGenColls::iterator const& mccollision, + soa::SmallGroups> const& collisions, + filtParticles const& particles, filtMcMftTracks const& tracks, + filtBestTracks const& besttracks) + { + processMCwBestTracks( + mccollision, collisions, particles, tracks, besttracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processMCwBestTracksCent, + "Count MC particles in FT0C bins using aod::BestCollisionsFwd", + false); + + using ParticlesI = soa::Join; + Partition primariesI = + ((aod::mcparticle::flags & + (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == + (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary); + + /// @brief process template function to calculate tracking efficiency (indexed + /// as particle-to-MFT-tracks) + template + void processTrkEffIdx( + typename soa::Filtered> const& collisions, + MC const& /*mccollisions*/, ParticlesI const& /*particles*/, + MFTTracksLabeled const& tracks) + { + for (auto& collision : collisions) { + if (!isGoodEvent(collision)) { + continue; + } + if (!collision.has_mcCollision()) { + continue; + } + + float c_rec = -1; + if constexpr (C::template contains()) { + c_rec = collision.centFT0C(); + } + + auto mcCollision = collision.mcCollision(); + auto particlesPerCol = primariesI->sliceByCached( + aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + particlesPerCol.bindExternalIndices(&tracks); + + for (auto& particle : particlesPerCol) { + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + // MC gen + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffGen"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ(), c_rec); + } else { + QAregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffGen"), particle.pt(), + particle.phi(), particle.eta(), mcCollision.posZ()); + } + // MC rec + if (particle.has_mfttracks()) { + auto iscounted = false; + auto ncnt = 0; + auto relatedTracks = + particle.template mfttracks_as(); + for (auto& track : relatedTracks) { + if (!isTrackSelected(track)) { + continue; + } + ++ncnt; + if constexpr (C::template contains()) { + if (!iscounted) { // primaries + QAregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffRec"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ(), c_rec); + iscounted = true; + } + if (ncnt > 1) { // duplicates + QAregistry.fill(HIST("Tracks/Centrality/hPhiEtaDuplicates"), + track.phi(), track.eta(), c_rec); + QAregistry.fill( + HIST("Tracks/Centrality/hPtPhiEtaZvtxEffDuplicates"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ(), c_rec); + } + } else { + if (!iscounted) { // primaries + QAregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffRec"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ()); + iscounted = true; + } + if (ncnt > 1) { // duplicates + QAregistry.fill(HIST("Tracks/hPhiEtaDuplicates"), track.phi(), + track.eta()); + QAregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffDuplicates"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ()); + } + } + } + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Tracks/Centrality/NmftTrkPerPart"), ncnt, + c_rec); + } else { + QAregistry.fill(HIST("Tracks/NmftTrkPerPart"), ncnt); + } + if (relatedTracks.size() > 1) { + if constexpr (C::template contains()) { + QAregistry.fill( + HIST("Tracks/Centrality/hPtPhiEtaZvtxEffGenDuplicates"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ(), c_rec); + } else { + QAregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffGenDuplicates"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ()); + } + } + } + } + } + } + + /// @brief process function to calculate tracking efficiency (inclusive, + /// indexed) + void processTrkEffIdxInlusive( + soa::Filtered> const& collisions, + aod::McCollisions const& mccollisions, ParticlesI const& particles, + MFTTracksLabeled const& tracks) + { + processTrkEffIdx(collisions, mccollisions, + particles, tracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processTrkEffIdxInlusive, + "Process tracking efficiency (inclusive)", false); + + /// @brief process function to calculate tracking efficiency (FT0 bins, + /// indexed) + void processTrkEffIdxCent( + soa::Filtered> const& collisions, + aod::McCollisions const& mccollisions, ParticlesI const& particles, + MFTTracksLabeled const& tracks) + { + processTrkEffIdx(collisions, mccollisions, + particles, tracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processTrkEffIdxCent, + "Process tracking efficiency in FT0 bins", false); + + /// @brief process function to calculate tracking efficiency (indexed) based + /// on BestCollisionsFwd in FT0C bins + template + void processTrkEffBest( + typename soa::Filtered< + soa::Join>::iterator const& collision, + MC const& /*mccollisions*/, filtParticles const& particles, + filtMcMftTracks const& /*tracks*/, + soa::SmallGroups const& besttracks) + { + if (!isGoodEvent(collision)) { + return; + } + if (!collision.has_mcCollision()) { + return; + } + + float c_rec = -1; + if constexpr (C::template contains()) { + c_rec = collision.centFT0C(); + } + + auto mcCollision = collision.mcCollision(); + auto particlesPerCol = particles.sliceByCached( + aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + for (auto& particle : particlesPerCol) { + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffBestGen"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ(), c_rec); + } else { + QAregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffBestGen"), particle.pt(), + particle.phi(), particle.eta(), mcCollision.posZ()); + } + } + + for (auto const& track : besttracks) { + auto itrack = track.mfttrack_as(); + if (!isTrackSelected(itrack)) { + continue; + } + if (itrack.has_mcParticle()) { + auto particle = itrack.mcParticle_as(); + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffBestRec"), + particle.pt(), itrack.phi(), itrack.eta(), + mcCollision.posZ(), c_rec); + } else { + QAregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffBestRec"), particle.pt(), + itrack.phi(), itrack.eta(), mcCollision.posZ()); + } + } else { + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Tracks/Centrality/hPtEffBestFakeRec"), + itrack.pt(), c_rec); + } else { + QAregistry.fill(HIST("Tracks/hPtEffBestFakeRec"), itrack.pt()); + } + } + } + } + + /// @brief process function to calculate tracking efficiency (inclusive, based + /// on BestCollisionsFwd) + void processTrkEffBestInclusive( + soa::Filtered>::iterator const& collision, + aod::McCollisions const& mccollisions, filtParticles const& particles, + filtMcMftTracks const& tracks, + soa::SmallGroups const& besttracks) + { + processTrkEffBest(collision, mccollisions, + particles, tracks, besttracks); + } + + PROCESS_SWITCH( + PseudorapidityDensityMFT, processTrkEffBestInclusive, + "Process tracking efficiency (inclusive, based on BestCollisionsFwd)", + false); + + /// @brief process function to calculate tracking efficiency (in FT0 bins, + /// based on BestCollisionsFwd) + void processTrkEffBestCent( + soa::Filtered>:: + iterator const& collision, + aod::McCollisions const& mccollisions, filtParticles const& particles, + filtMcMftTracks const& tracks, + soa::SmallGroups const& besttracks) + { + processTrkEffBest( + collision, mccollisions, particles, tracks, besttracks); + } + + PROCESS_SWITCH( + PseudorapidityDensityMFT, processTrkEffBestCent, + "Process tracking efficiency (in FT0 bins, based on BestCollisionsFwd)", + false); + + Preslice filtTrkperCol = o2::aod::fwdtrack::collisionId; + + /// @brief process template function for MC QA checks + template + void processMcQA( + typename soa::SmallGroups> const& collisions, + filtMcGenColls const& mcCollisions, filtParticles const& /*particles*/, + MFTTracksLabeled const& tracks, aod::AmbiguousMFTTracks const& atracks) + { + for (const auto& collision : collisions) { + float c_rec = -1; + if constexpr (C::template contains()) { + c_rec = collision.centFT0C(); + QAregistry.fill(HIST("Events/Centrality/hRecPerGenColls"), + static_cast(collisions.size()) / mcCollisions.size(), c_rec); + } else { + QAregistry.fill(HIST("Events/hRecPerGenColls"), + static_cast(collisions.size()) / mcCollisions.size()); + } + + if (!isGoodEvent(collision)) { + return; + } + + auto trkPerColl = tracks.sliceBy(filtTrkperCol, collision.globalIndex()); + uint Ntracks{0u}, Natracks{0u}; + for (const auto& track : trkPerColl) { + Ntracks++; + for (const auto& atrack : atracks) { + if (atrack.mfttrackId() == track.globalIndex()) { + Natracks++; + break; + } + } + } + if constexpr (C::template contains()) { + QAregistry.fill(HIST("Tracks/Centrality/hNmftTrks"), Ntracks, c_rec); + QAregistry.fill(HIST("Tracks/Centrality/hFracAmbiguousMftTrks"), + static_cast(Natracks) / Ntracks, c_rec); + } else { + QAregistry.fill(HIST("Tracks/hNmftTrks"), Ntracks); + QAregistry.fill(HIST("Tracks/hFracAmbiguousMftTrks"), + static_cast(Natracks) / Ntracks); + } + } + } + + /// @brief process function for QA checks (inclusive) + void processMcQAInclusive( + soa::SmallGroups> const& collisions, + filtMcGenColls const& mcCollisions, filtParticles const& particles, + MFTTracksLabeled const& tracks, aod::AmbiguousMFTTracks const& atracks) + { + processMcQA(collisions, mcCollisions, particles, tracks, + atracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processMcQAInclusive, + "Process MC QA checks (inclusive)", false); + + /// @brief process function for QA checks (in FT0 bins) + void processMcQACent( + soa::SmallGroups> const& collisions, + filtMcGenColls const& mcCollisions, filtParticles const& particles, + MFTTracksLabeled const& tracks, aod::AmbiguousMFTTracks const& atracks) + { + processMcQA(collisions, mcCollisions, particles, tracks, + atracks); + } + + PROCESS_SWITCH(PseudorapidityDensityMFT, processMcQACent, + "Process MC QA checks (in FT0 bins)", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGMM/Mult/Tasks/dndeta.cxx b/PWGMM/Mult/Tasks/dndeta.cxx index 0d3ff49cd3f..220bdbdebb8 100644 --- a/PWGMM/Mult/Tasks/dndeta.cxx +++ b/PWGMM/Mult/Tasks/dndeta.cxx @@ -50,8 +50,9 @@ struct MultiplicityCounter { Configurable estimatorEta{"estimatorEta", 1.0, "eta range for INEL>0 sample definition"}; Configurable dcaZ{"dcaZ", 0.2f, "Custom DCA Z cut (ignored if negative)"}; - ConfigurableAxis multBinning{"multBinning", {301, -0.5, 300.5}, ""}; - ConfigurableAxis centBinning{"centBinning", {VARIABLE_WIDTH, 0, 10, 20, 30, 40, 50, 60, 70, 80, 100}, ""}; + ConfigurableAxis multBinning{"multBinning", {301, -0.5, 300.5}, "Multiplicity axis binning"}; + ConfigurableAxis centBinning{"centBinning", {VARIABLE_WIDTH, 0, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality axis binning"}; + ConfigurableAxis occuBinning{"occuBinning", {VARIABLE_WIDTH, 0, 500, 1000, 2000, 5000, 10000}, "Occupancy axis binning"}; // Pb-Pb default Configurable fillResponse{"fillResponse", true, "Fill response matrix"}; Configurable useProcId{"use-process-id", true, "Use process ID from generator"}; @@ -111,10 +112,12 @@ struct MultiplicityCounter { std::vector usedTracksIdsDF; std::vector usedTracksIdsDFMC; std::vector usedTracksIdsDFMCEff; + void init(InitContext&) { AxisSpec MultAxis = {multBinning}; AxisSpec CentAxis = {centBinning, "centrality"}; + AxisSpec OccuAxis = {occuBinning, "occupancy"}; { auto hstat = commonRegistry.get(HIST(BCSelection)); auto* x = hstat->GetXaxis(); @@ -124,17 +127,17 @@ struct MultiplicityCounter { } if (doprocessEventStat) { - inclusiveRegistry.add({EventChi2.data(), " ; #chi^2", {HistType::kTH1F, {{101, -0.1, 10.1}}}}); - inclusiveRegistry.add({EventTimeRes.data(), " ; t (ms)", {HistType::kTH1F, {{1001, -0.1, 100.1}}}}); + inclusiveRegistry.add({EventChi2.data(), " ; #chi^2", {HistType::kTH2F, {{101, -0.1, 10.1}, OccuAxis}}}); + inclusiveRegistry.add({EventTimeRes.data(), " ; t (ms)", {HistType::kTH2F, {{1001, -0.1, 100.1}, OccuAxis}}}); } if (doprocessEventStatCentralityFT0C || doprocessEventStatCentralityFT0M) { - binnedRegistry.add({EventChi2.data(), " ; #chi^2; centrality", {HistType::kTH2F, {{101, -0.1, 10.1}, CentAxis}}}); - binnedRegistry.add({EventTimeRes.data(), " ; t (ms); centrality", {HistType::kTH2F, {{1001, -0.1, 100.1}, CentAxis}}}); + binnedRegistry.add({EventChi2.data(), " ; #chi^2; centrality", {HistType::kTHnSparseF, {{101, -0.1, 10.1}, CentAxis, OccuAxis}}}); + binnedRegistry.add({EventTimeRes.data(), " ; t (ms); centrality", {HistType::kTHnSparseF, {{1001, -0.1, 100.1}, CentAxis, OccuAxis}}}); } if (doprocessCountingAmbiguous || doprocessCounting) { - inclusiveRegistry.add({EventSelection.data(), ";status;events", {HistType::kTH1F, {{static_cast(EvSelBins::kRejected), 0.5, static_cast(EvSelBins::kRejected) + 0.5}}}}); - auto hstat = inclusiveRegistry.get(HIST(EventSelection)); + inclusiveRegistry.add({EventSelection.data(), ";status;occupancy;events", {HistType::kTH2F, {{static_cast(EvSelBins::kRejected), 0.5, static_cast(EvSelBins::kRejected) + 0.5}, OccuAxis}}}); + auto hstat = inclusiveRegistry.get(HIST(EventSelection)); auto* x = hstat->GetXaxis(); x->SetBinLabel(static_cast(EvSelBins::kAll), EvSelBinLabels[static_cast(EvSelBins::kAll)].data()); x->SetBinLabel(static_cast(EvSelBins::kSelected), EvSelBinLabels[static_cast(EvSelBins::kSelected)].data()); @@ -142,57 +145,57 @@ struct MultiplicityCounter { x->SetBinLabel(static_cast(EvSelBins::kSelectedPVgt0), EvSelBinLabels[static_cast(EvSelBins::kSelectedPVgt0)].data()); x->SetBinLabel(static_cast(EvSelBins::kRejected), EvSelBinLabels[static_cast(EvSelBins::kRejected)].data()); - inclusiveRegistry.add({NtrkZvtx.data(), "; N_{trk}; Z_{vtx} (cm); events", {HistType::kTH2F, {MultAxis, ZAxis}}}); - inclusiveRegistry.add({NpvcZvtx.data(), "; N_{PVc}; Z_{vtx} (cm); events", {HistType::kTH2F, {MultAxis, ZAxis}}}); - inclusiveRegistry.add({EtaZvtx.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); - inclusiveRegistry.add({EtaZvtx_gt0.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); - inclusiveRegistry.add({EtaZvtx_PVgt0.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); - inclusiveRegistry.add({PhiEta.data(), "; #varphi; #eta; tracks", {HistType::kTH2F, {PhiAxis, EtaAxis}}}); - inclusiveRegistry.add({PtEta.data(), " ; p_{T} (GeV/c); #eta", {HistType::kTH2F, {PtAxis, EtaAxis}}}); - inclusiveRegistry.add({DCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm)", {HistType::kTH2F, {PtAxis, DCAAxis}}}); - inclusiveRegistry.add({DCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm)", {HistType::kTH2F, {PtAxis, DCAAxis}}}); + inclusiveRegistry.add({NtrkZvtx.data(), "; N_{trk}; Z_{vtx} (cm);occupancy; events", {HistType::kTHnSparseF, {MultAxis, ZAxis, OccuAxis}}}); + inclusiveRegistry.add({NpvcZvtx.data(), "; N_{PVc}; Z_{vtx} (cm);occupancy; events", {HistType::kTHnSparseF, {MultAxis, ZAxis, OccuAxis}}}); + inclusiveRegistry.add({EtaZvtx.data(), "; #eta; Z_{vtx} (cm);occupancy; tracks", {HistType::kTHnSparseF, {EtaAxis, ZAxis, OccuAxis}}}); + inclusiveRegistry.add({EtaZvtx_gt0.data(), "; #eta; Z_{vtx} (cm);occupancy; tracks", {HistType::kTHnSparseF, {EtaAxis, ZAxis, OccuAxis}}}); + inclusiveRegistry.add({EtaZvtx_PVgt0.data(), "; #eta; Z_{vtx} (cm);occupancy; tracks", {HistType::kTHnSparseF, {EtaAxis, ZAxis, OccuAxis}}}); + inclusiveRegistry.add({PhiEta.data(), "; #varphi; #eta;occupancy; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, OccuAxis}}}); + inclusiveRegistry.add({PtEta.data(), " ; p_{T} (GeV/c);occupancy; #eta", {HistType::kTHnSparseF, {PtAxis, EtaAxis, OccuAxis}}}); + inclusiveRegistry.add({DCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm);occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, OccuAxis}}}); + inclusiveRegistry.add({DCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm);occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, OccuAxis}}}); if (doprocessCountingAmbiguous) { - inclusiveRegistry.add({ReassignedDCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm)", {HistType::kTH2F, {PtAxis, DCAAxis}}}); - inclusiveRegistry.add({ReassignedDCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm)", {HistType::kTH2F, {PtAxis, DCAAxis}}}); - inclusiveRegistry.add({ExtraDCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm)", {HistType::kTH2F, {PtAxis, DCAAxis}}}); - inclusiveRegistry.add({ExtraDCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm)", {HistType::kTH2F, {PtAxis, DCAAxis}}}); - inclusiveRegistry.add({ExtraEtaZvtx.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); - inclusiveRegistry.add({ExtraPhiEta.data(), "; #varphi; #eta; tracks", {HistType::kTH2F, {PhiAxis, EtaAxis}}}); - inclusiveRegistry.add({ReassignedEtaZvtx.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); - inclusiveRegistry.add({ReassignedPhiEta.data(), "; #varphi; #eta; tracks", {HistType::kTH2F, {PhiAxis, EtaAxis}}}); - inclusiveRegistry.add({ReassignedZvtxCorr.data(), "; Z_{vtx}^{orig} (cm); Z_{vtx}^{re} (cm)", {HistType::kTH2F, {ZAxis, ZAxis}}}); + inclusiveRegistry.add({ReassignedDCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm);occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, OccuAxis}}}); + inclusiveRegistry.add({ReassignedDCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm);occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, OccuAxis}}}); + inclusiveRegistry.add({ExtraDCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm);occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, OccuAxis}}}); + inclusiveRegistry.add({ExtraDCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm);occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, OccuAxis}}}); + inclusiveRegistry.add({ExtraEtaZvtx.data(), "; #eta; Z_{vtx} (cm);occupancy; tracks", {HistType::kTHnSparseF, {EtaAxis, ZAxis, OccuAxis}}}); + inclusiveRegistry.add({ExtraPhiEta.data(), "; #varphi; #eta;occupancy; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, OccuAxis}}}); + inclusiveRegistry.add({ReassignedEtaZvtx.data(), "; #eta; Z_{vtx} (cm);occupancy; tracks", {HistType::kTHnSparseF, {EtaAxis, ZAxis, OccuAxis}}}); + inclusiveRegistry.add({ReassignedPhiEta.data(), "; #varphi; #eta;occupancy; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, OccuAxis}}}); + inclusiveRegistry.add({ReassignedZvtxCorr.data(), "; Z_{vtx}^{orig} (cm); Z_{vtx}^{re} (cm);occupancy", {HistType::kTHnSparseF, {ZAxis, ZAxis, OccuAxis}}}); } } if (doprocessCountingAmbiguousCentralityFT0C || doprocessCountingAmbiguousCentralityFT0M || doprocessCountingCentralityFT0C || doprocessCountingCentralityFT0M) { - binnedRegistry.add({EventSelection.data(), ";status;centrality;events", {HistType::kTH2F, {{static_cast(EvSelBins::kRejected), 0.5, static_cast(EvSelBins::kRejected) + 0.5}, CentAxis}}}); - auto hstat = binnedRegistry.get(HIST(EventSelection)); - auto* x = hstat->GetXaxis(); + binnedRegistry.add({EventSelection.data(), ";status;centrality;occupancy;events", {HistType::kTHnSparseF, {{static_cast(EvSelBins::kRejected), 0.5, static_cast(EvSelBins::kRejected) + 0.5}, CentAxis, OccuAxis}}}); + auto hstat = binnedRegistry.get(HIST(EventSelection)); + auto* x = hstat->GetAxis(0); x->SetBinLabel(static_cast(EvSelBins::kAll), EvSelBinLabels[static_cast(EvSelBins::kAll)].data()); x->SetBinLabel(static_cast(EvSelBins::kSelected), EvSelBinLabels[static_cast(EvSelBins::kSelected)].data()); x->SetBinLabel(static_cast(EvSelBins::kSelectedgt0), EvSelBinLabels[static_cast(EvSelBins::kSelectedgt0)].data()); x->SetBinLabel(static_cast(EvSelBins::kSelectedPVgt0), EvSelBinLabels[static_cast(EvSelBins::kSelectedPVgt0)].data()); x->SetBinLabel(static_cast(EvSelBins::kRejected), EvSelBinLabels[static_cast(EvSelBins::kRejected)].data()); - binnedRegistry.add({NtrkZvtx.data(), "; N_{trk}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({NpvcZvtx.data(), "; N_{PVc}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({EtaZvtx.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({EtaZvtx_gt0.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({EtaZvtx_PVgt0.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({PhiEta.data(), "; #varphi; #eta; centrality", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis}}}); - binnedRegistry.add({PtEta.data(), " ; p_{T} (GeV/c); #eta; centrality", {HistType::kTHnSparseF, {PtAxis, EtaAxis, CentAxis}}}); - binnedRegistry.add({DCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis}}}); - binnedRegistry.add({DCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis}}}); + binnedRegistry.add({NtrkZvtx.data(), "; N_{trk}; Z_{vtx} (cm); centrality;occupancy", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({NpvcZvtx.data(), "; N_{PVc}; Z_{vtx} (cm); centrality;occupancy", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({EtaZvtx.data(), "; #eta; Z_{vtx} (cm); centrality;occupancy", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({EtaZvtx_gt0.data(), "; #eta; Z_{vtx} (cm); centrality;occupancy", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({EtaZvtx_PVgt0.data(), "; #eta; Z_{vtx} (cm); centrality;occupancy", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({PhiEta.data(), "; #varphi; #eta; centrality;occupancy", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtEta.data(), " ; p_{T} (GeV/c); #eta; centrality;occupancy", {HistType::kTHnSparseF, {PtAxis, EtaAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({DCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality;occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({DCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality;occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis, OccuAxis}}}); if (doprocessCountingAmbiguousCentralityFT0C || doprocessCountingAmbiguousCentralityFT0M) { - binnedRegistry.add({ReassignedDCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis}}}); - binnedRegistry.add({ReassignedDCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis}}}); - binnedRegistry.add({ExtraDCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis}}}); - binnedRegistry.add({ExtraDCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis}}}); - binnedRegistry.add({ExtraEtaZvtx.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({ExtraPhiEta.data(), "; #varphi; #eta; centrality", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis}}}); - binnedRegistry.add({ReassignedEtaZvtx.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({ReassignedPhiEta.data(), "; #varphi; #eta; centrality", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis}}}); - binnedRegistry.add({ReassignedZvtxCorr.data(), "; Z_{vtx}^{orig} (cm); Z_{vtx}^{re} (cm); centrality", {HistType::kTHnSparseF, {ZAxis, ZAxis, CentAxis}}}); + binnedRegistry.add({ReassignedDCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality;occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({ReassignedDCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality;occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({ExtraDCAXYPt.data(), " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality;occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({ExtraDCAZPt.data(), " ; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality;occupancy", {HistType::kTHnSparseF, {PtAxis, DCAAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({ExtraEtaZvtx.data(), "; #eta; Z_{vtx} (cm); centrality;occupancy", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({ExtraPhiEta.data(), "; #varphi; #eta; centrality;occupancy", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({ReassignedEtaZvtx.data(), "; #eta; Z_{vtx} (cm); centrality;occupancy", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({ReassignedPhiEta.data(), "; #varphi; #eta; centrality;occupancy", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({ReassignedZvtxCorr.data(), "; Z_{vtx}^{orig} (cm); Z_{vtx}^{re} (cm); centrality;occupancy", {HistType::kTHnSparseF, {ZAxis, ZAxis, CentAxis, OccuAxis}}}); } } @@ -203,36 +206,43 @@ struct MultiplicityCounter { effLabels += " ; process ID"; effAxes.push_back(ProcAxis); } - inclusiveRegistry.add({NtrkZvtxGen.data(), "; N_{trk}; Z_{vtx} (cm); events", {HistType::kTH2F, {MultAxis, ZAxis}}}); + inclusiveRegistry.add({NtrkZvtxGen.data(), "; N_{trk}; Z_{vtx} (cm); occupancy; events", {HistType::kTHnSparseF, {MultAxis, ZAxis, OccuAxis}}}); inclusiveRegistry.add({NtrkZvtxGen_t.data(), effLabels.c_str(), {HistType::kTHnSparseF, effAxes}}); - inclusiveRegistry.add({NpvcZvxtGen.data(), "; N_{PVc}; Z_{vtx} (cm); events", {HistType::kTH2F, {MultAxis, ZAxis}}}); - inclusiveRegistry.add({EtaZvtxGen.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); + inclusiveRegistry.add({NpvcZvxtGen.data(), "; N_{PVc}; Z_{vtx} (cm); occupancy; events", {HistType::kTHnSparseF, {MultAxis, ZAxis, OccuAxis}}}); + inclusiveRegistry.add({EtaZvtxGen.data(), "; #eta; Z_{vtx} (cm); occupancy; tracks", {HistType::kTHnSparseF, {EtaAxis, ZAxis, OccuAxis}}}); inclusiveRegistry.add({EtaZvtxGen_t.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); inclusiveRegistry.add({EtaZvtxGen_gt0.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); inclusiveRegistry.add({EtaZvtxGen_PVgt0.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); inclusiveRegistry.add({EtaZvtxGen_gt0t.data(), "; #eta; Z_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); inclusiveRegistry.add({PtEtaGen.data(), " ; p_{T} (GeV/c) ; #eta", {HistType::kTH2F, {PtAxis, EtaAxis}}}); + inclusiveRegistry.add({PhiEtaGen.data(), "; #varphi; #eta; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis}}}); - inclusiveRegistry.add({PhiEtaGen.data(), "; #varphi; #eta; tracks", {HistType::kTH2F, {PhiAxis, EtaAxis}}}); - - inclusiveRegistry.add({Efficiency.data(), "; status; events", {HistType::kTH1F, {{static_cast(EvEffBins::kSelectedPVgt0), 0.5, static_cast(EvEffBins::kSelectedPVgt0) + 0.5}}}}); - inclusiveRegistry.add({NotFoundZvtx.data(), " ; Z_{vtx} (cm)", {HistType::kTH1F, {ZAxis}}}); + inclusiveRegistry.add({Efficiency.data(), "; status; occupancy; events", {HistType::kTH2F, {{static_cast(EvEffBins::kSelectedPVgt0), 0.5, static_cast(EvEffBins::kSelectedPVgt0) + 0.5}, OccuAxis}}}); + inclusiveRegistry.add({NotFoundZvtx.data(), " ; Z_{vtx} (cm) ", {HistType::kTH1F, {ZAxis}}}); if (fillResponse) { inclusiveRegistry.add({EfficiencyMult.data(), effLabels.c_str(), {HistType::kTHnSparseF, effAxes}}); inclusiveRegistry.add({SplitMult.data(), " ; N_{gen} ; Z_{vtx} (cm)", {HistType::kTH2F, {MultAxis, ZAxis}}}); - if (addFT0 && !addFDD) { - inclusiveRegistry.add({Response.data(), " ; N_{rec}; N_{PV cont}; N_{gen}; N_{FT0A}; N_{FT0C}; Z_{vtx} (cm)", {HistType::kTHnSparseF, {MultAxis, MultAxis, MultAxis, FT0AAxis, FT0CAxis, ZAxis}}}); - } else if (addFDD && !addFT0) { - inclusiveRegistry.add({Response.data(), " ; N_{rec}; N_{PV cont}; N_{gen}; N_{FDA}; N_{FDC}; Z_{vtx} (cm)", {HistType::kTHnSparseF, {MultAxis, MultAxis, MultAxis, FDAAxis, FDCAxis, ZAxis}}}); - } else if (addFT0 && addFDD) { - inclusiveRegistry.add({Response.data(), " ; N_{rec}; N_{PV cont}; N_{gen}; N_{FT0A}; N_{FT0C}; N_{FDA}; N_{FDC}; Z_{vtx} (cm)", {HistType::kTHnSparseF, {MultAxis, MultAxis, MultAxis, FT0AAxis, FT0CAxis, FDAAxis, FDCAxis, ZAxis}}}); - } else { - inclusiveRegistry.add({Response.data(), " ; N_{rec}; N_{PV cont}; N_{gen}; Z_{vtx} (cm)", {HistType::kTHnSparseF, {MultAxis, MultAxis, MultAxis, ZAxis}}}); + + std::string reLabels{" ; N_{rec}; N_{PV cont}; N_{gen}"}; + std::vector reAxes{MultAxis, MultAxis, MultAxis}; + if (addFT0) { + reLabels += " ; N_{FT0A}; N_{FT0C}"; + reAxes.push_back(FT0AAxis); + reAxes.push_back(FT0CAxis); + } + if (addFDD) { + reLabels += " ; N_{FDA}; N_{FDC}"; + reAxes.push_back(FDAAxis); + reAxes.push_back(FDCAxis); } + reLabels += " ; Z_{vtx} (cm); occupancy"; + reAxes.push_back(ZAxis); + reAxes.push_back(OccuAxis); + inclusiveRegistry.add({Response.data(), reLabels.c_str(), {HistType::kTHnSparseF, reAxes}}); } - auto heff = inclusiveRegistry.get(HIST(Efficiency)); + auto heff = inclusiveRegistry.get(HIST(Efficiency)); auto* x = heff->GetXaxis(); x->SetBinLabel(static_cast(EvEffBins::kGen), EvEffBinLabels[static_cast(EvEffBins::kGen)].data()); x->SetBinLabel(static_cast(EvEffBins::kGengt0), EvEffBinLabels[static_cast(EvEffBins::kGengt0)].data()); @@ -251,36 +261,45 @@ struct MultiplicityCounter { effLabels += " ; process ID"; effAxes.push_back(ProcAxis); } - binnedRegistry.add({NtrkZvtxGen.data(), "; N_{trk}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({NtrkZvtxGen_t.data(), "; N_{part}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({NpvcZvxtGen.data(), "; N_{PVc}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis}}}); - binnedRegistry.add({EtaZvtxGen.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); + binnedRegistry.add({NtrkZvtxGen.data(), "; N_{trk}; Z_{vtx} (cm); centrality; occupance", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({NtrkZvtxGen_t.data(), effLabels.c_str(), {HistType::kTHnSparseF, effAxes}}); + binnedRegistry.add({NpvcZvxtGen.data(), "; N_{PVc}; Z_{vtx} (cm); centrality; occupancy", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({EtaZvtxGen.data(), "; #eta; Z_{vtx} (cm); centrality; occupancy", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis, OccuAxis}}}); binnedRegistry.add({EtaZvtxGen_t.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); binnedRegistry.add({EtaZvtxGen_gt0.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); binnedRegistry.add({EtaZvtxGen_PVgt0.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); binnedRegistry.add({EtaZvtxGen_gt0t.data(), "; #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {EtaAxis, ZAxis, CentAxis}}}); binnedRegistry.add({PtEtaGen.data(), " ; p_{T} (GeV/c) ; #eta; centrality", {HistType::kTHnSparseF, {PtAxis, EtaAxis, CentAxis}}}); - binnedRegistry.add({PhiEtaGen.data(), "; #varphi; #eta; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis}}}); - binnedRegistry.add({Efficiency.data(), "; status; centrality; events", {HistType::kTH2F, {{static_cast(EvEffBins::kSelectedPVgt0), 0.5, static_cast(EvEffBins::kSelectedPVgt0) + 0.5}, CentAxis}}}); + + binnedRegistry.add({Efficiency.data(), "; status; centrality; occupancy; events", {HistType::kTHnSparseF, {{static_cast(EvEffBins::kSelectedPVgt0), 0.5, static_cast(EvEffBins::kSelectedPVgt0) + 0.5}, CentAxis, OccuAxis}}}); binnedRegistry.add({NotFoundZvtx.data(), " ; Z_{vtx} (cm); centrality; events", {HistType::kTH2F, {ZAxis, CentAxis}}}); if (fillResponse) { binnedRegistry.add({EfficiencyMult.data(), effLabels.c_str(), {HistType::kTHnSparseF, effAxes}}); binnedRegistry.add({SplitMult.data(), " ; N_{gen} ; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, ZAxis, CentAxis}}}); - if (addFT0 && !addFDD) { - binnedRegistry.add({Response.data(), " ; N_{rec}; N_{PV cont}; N_{gen}; N_{FT0A}; N_{FT0C}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, MultAxis, MultAxis, FT0AAxis, FT0CAxis, ZAxis, CentAxis}}}); - } else if (addFDD && !addFT0) { - binnedRegistry.add({Response.data(), " ; N_{rec}; N_{PV cont}; N_{gen}; N_{FDA}; N_{FDC}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, MultAxis, MultAxis, FDAAxis, FDCAxis, ZAxis, CentAxis}}}); - } else if (addFT0 && addFDD) { - binnedRegistry.add({Response.data(), " ; N_{rec}; N_{PV cont}; N_{gen}; N_{FT0A}; N_{FT0C}; N_{FDA}; N_{FDC}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, MultAxis, MultAxis, FT0AAxis, FT0CAxis, FDAAxis, FDCAxis, ZAxis, CentAxis}}}); - } else { - binnedRegistry.add({Response.data(), " ; N_{rec}; N_{PV cont}; N_{gen}; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {MultAxis, MultAxis, MultAxis, ZAxis, CentAxis}}}); + + std::string reLabels{" ; N_{rec}; N_{PV cont}; N_{gen}"}; + std::vector reAxes{MultAxis, MultAxis, MultAxis}; + if (addFT0) { + reLabels += " ; N_{FT0A}; N_{FT0C}"; + reAxes.push_back(FT0AAxis); + reAxes.push_back(FT0CAxis); } + if (addFDD) { + reLabels += " ; N_{FDA}; N_{FDC}"; + reAxes.push_back(FDAAxis); + reAxes.push_back(FDCAxis); + } + reLabels += " ; Z_{vtx} (cm); centrality; occupancy"; + reAxes.push_back(ZAxis); + reAxes.push_back(CentAxis); + reAxes.push_back(OccuAxis); + binnedRegistry.add({Response.data(), reLabels.c_str(), {HistType::kTHnSparseF, reAxes}}); } - auto heff = binnedRegistry.get(HIST(Efficiency)); - auto* x = heff->GetXaxis(); + auto heff = binnedRegistry.get(HIST(Efficiency)); + auto* x = heff->GetAxis(0); x->SetBinLabel(static_cast(EvEffBins::kGen), EvEffBinLabels[static_cast(EvEffBins::kGen)].data()); x->SetBinLabel(static_cast(EvEffBins::kGengt0), EvEffBinLabels[static_cast(EvEffBins::kGengt0)].data()); x->SetBinLabel(static_cast(EvEffBins::kRec), EvEffBinLabels[static_cast(EvEffBins::kRec)].data()); @@ -290,57 +309,57 @@ struct MultiplicityCounter { } if (doprocessTrackEfficiencyAmbiguous || doprocessTrackEfficiency) { - inclusiveRegistry.add({PtGen.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtGenNoEtaCut.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtEfficiency.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtEfficiencyNoEtaCut.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtEfficiencyFakes.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); + inclusiveRegistry.add({PtGen.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtGenNoEtaCut.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtEfficiency.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtEfficiencyNoEtaCut.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtEfficiencyFakes.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); for (auto i = 0u; i < speciesIds.size(); ++i) { - inclusiveRegistry.add({fmt::format(PtGenF.data(), species[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({fmt::format(PtEfficiencyF.data(), species[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); + inclusiveRegistry.add({fmt::format(PtGenF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({fmt::format(PtEfficiencyF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); } } if (doprocessTrackEfficiencyAmbiguousCentralityFT0M || doprocessTrackEfficiencyCentralityFT0M || doprocessTrackEfficiencyAmbiguousCentralityFT0C || doprocessTrackEfficiencyCentralityFT0C) { - binnedRegistry.add({PtGen.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtGenNoEtaCut.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtEfficiency.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtEfficiencyNoEtaCut.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtEfficiencyFakes.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); + binnedRegistry.add({PtGen.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtGenNoEtaCut.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtEfficiency.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtEfficiencyNoEtaCut.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtEfficiencyFakes.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); for (auto i = 0u; i < speciesIds.size(); ++i) { - binnedRegistry.add({fmt::format(PtGenF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({fmt::format(PtEfficiencyF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); + binnedRegistry.add({fmt::format(PtGenF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({fmt::format(PtEfficiencyF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); } } if (doprocessTrackEfficiencyIndexed) { - inclusiveRegistry.add({PhiEtaGenDuplicates.data(), "; #varphi; #eta; tracks", {HistType::kTH2F, {PhiAxis, EtaAxis}}}); - inclusiveRegistry.add({PhiEtaDuplicates.data(), "; #varphi; #eta; tracks", {HistType::kTH2F, {PhiAxis, EtaAxis}}}); - inclusiveRegistry.add({PtGenIdx.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtGenIdxNoEtaCut.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtEfficiencyIdx.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtEfficiencyIdxNoEtaCut.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtEfficiencySecondariesIdx.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({PtEfficiencySecondariesIdxNoEtaCut.data(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({Mask.data(), " ; bit", {HistType::kTH1F, {{17, -0.5, 16.5}}}}); - inclusiveRegistry.add({ITSlayers.data(), " ; layer", {HistType::kTH1F, {{8, 0.5, 8.5}}}}); + inclusiveRegistry.add({PhiEtaGenDuplicates.data(), "; #varphi; #eta; occupancy; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, OccuAxis}}}); + inclusiveRegistry.add({PhiEtaDuplicates.data(), "; #varphi; #eta; occupancy; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, OccuAxis}}}); + inclusiveRegistry.add({PtGenIdx.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtGenIdxNoEtaCut.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtEfficiencyIdx.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtEfficiencyIdxNoEtaCut.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtEfficiencySecondariesIdx.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({PtEfficiencySecondariesIdxNoEtaCut.data(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({Mask.data(), " ; bit; occupancy", {HistType::kTH2F, {{17, -0.5, 16.5}, OccuAxis}}}); + inclusiveRegistry.add({ITSlayers.data(), " ; layer; occupancy", {HistType::kTH2F, {{8, 0.5, 8.5}, OccuAxis}}}); for (auto i = 0u; i < speciesIds.size(); ++i) { - inclusiveRegistry.add({fmt::format(PtGenIdxF.data(), species[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); - inclusiveRegistry.add({fmt::format(PtEfficiencyIdxF.data(), species[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH1F, {PtAxisEff}}}); + inclusiveRegistry.add({fmt::format(PtGenIdxF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); + inclusiveRegistry.add({fmt::format(PtEfficiencyIdxF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); occupancy", {HistType::kTH2F, {PtAxisEff, OccuAxis}}}); } } if (doprocessTrackEfficiencyIndexedCentralityFT0M || doprocessTrackEfficiencyIndexedCentralityFT0C) { - binnedRegistry.add({PhiEtaGenDuplicates.data(), "; #varphi; #eta; centrality; tracks", {HistType::kTH3F, {PhiAxis, EtaAxis, CentAxis}}}); - binnedRegistry.add({PhiEtaDuplicates.data(), "; #varphi; #eta; centrality; tracks", {HistType::kTH3F, {PhiAxis, EtaAxis, CentAxis}}}); - binnedRegistry.add({PtGenIdx.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtGenIdxNoEtaCut.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtEfficiencyIdx.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtEfficiencyIdxNoEtaCut.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtEfficiencySecondariesIdx.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({PtEfficiencySecondariesIdxNoEtaCut.data(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({Mask.data(), " ; bit; centrality", {HistType::kTH2F, {{17, -0.5, 16.5}, CentAxis}}}); - binnedRegistry.add({ITSlayers.data(), " ; layer; centrality", {HistType::kTH2F, {{8, 0.5, 8.5}, CentAxis}}}); + binnedRegistry.add({PhiEtaGenDuplicates.data(), "; #varphi; #eta; centrality; occupancy; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({PhiEtaDuplicates.data(), "; #varphi; #eta; centrality; occupancy; tracks", {HistType::kTHnSparseF, {PhiAxis, EtaAxis, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtGenIdx.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtGenIdxNoEtaCut.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtEfficiencyIdx.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtEfficiencyIdxNoEtaCut.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtEfficiencySecondariesIdx.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({PtEfficiencySecondariesIdxNoEtaCut.data(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({Mask.data(), " ; bit; centrality; occupancy", {HistType::kTHnSparseF, {{17, -0.5, 16.5}, CentAxis, OccuAxis}}}); + binnedRegistry.add({ITSlayers.data(), " ; layer; centrality; occupancy", {HistType::kTHnSparseF, {{8, 0.5, 8.5}, CentAxis, OccuAxis}}}); for (auto i = 0u; i < speciesIds.size(); ++i) { - binnedRegistry.add({fmt::format(PtGenIdxF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); - binnedRegistry.add({fmt::format(PtEfficiencyIdxF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); centrality", {HistType::kTH2F, {PtAxisEff, CentAxis}}}); + binnedRegistry.add({fmt::format(PtGenIdxF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); + binnedRegistry.add({fmt::format(PtEfficiencyIdxF.data(), species[i]).c_str(), " ; p_{T} (GeV/c); centrality; occupancy", {HistType::kTHnSparseF, {PtAxisEff, CentAxis, OccuAxis}}}); } } } @@ -373,18 +392,13 @@ struct MultiplicityCounter { auto col = collisions.begin(); for (auto& colid : colids) { col.moveByIndex(colid - col.globalIndex()); - if constexpr (hasRecoCent()) { - float c = -1; - if constexpr (C::template contains()) { - c = col.centFT0C(); - } else if constexpr (C::template contains()) { - c = col.centFT0M(); - } - binnedRegistry.fill(HIST(EventChi2), col.chi2(), c); - binnedRegistry.fill(HIST(EventTimeRes), col.collisionTimeRes(), c); + float c = getRecoCent(c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EventChi2), col.chi2(), c, col.trackOccupancyInTimeRange()); + binnedRegistry.fill(HIST(EventTimeRes), col.collisionTimeRes(), c, col.trackOccupancyInTimeRange()); } else { - inclusiveRegistry.fill(HIST(EventChi2), col.chi2()); - inclusiveRegistry.fill(HIST(EventTimeRes), col.collisionTimeRes()); + inclusiveRegistry.fill(HIST(EventChi2), col.chi2(), col.trackOccupancyInTimeRange()); + inclusiveRegistry.fill(HIST(EventTimeRes), col.collisionTimeRes(), col.trackOccupancyInTimeRange()); } } } @@ -448,7 +462,7 @@ struct MultiplicityCounter { Partition pvContribTracksIUEta1 = (nabs(aod::track::eta) < 1.0f) && ((aod::track::flags & (uint32_t)o2::aod::track::PVContributor) == (uint32_t)o2::aod::track::PVContributor); template - int countTracks(T const& tracks, float z, float c) + int countTracks(T const& tracks, float z, float c, float o) { auto Ntrks = 0; for (auto& track : tracks) { @@ -456,18 +470,18 @@ struct MultiplicityCounter { ++Ntrks; } if constexpr (fillHistos) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(EtaZvtx), track.eta(), z, c); - binnedRegistry.fill(HIST(PhiEta), track.phi(), track.eta(), c); - binnedRegistry.fill(HIST(PtEta), track.pt(), track.eta(), c); - binnedRegistry.fill(HIST(DCAXYPt), track.pt(), track.dcaXY(), c); - binnedRegistry.fill(HIST(DCAZPt), track.pt(), track.dcaZ(), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EtaZvtx), track.eta(), z, c, o); + binnedRegistry.fill(HIST(PhiEta), track.phi(), track.eta(), c, o); + binnedRegistry.fill(HIST(PtEta), track.pt(), track.eta(), c, o); + binnedRegistry.fill(HIST(DCAXYPt), track.pt(), track.dcaXY(), c, o); + binnedRegistry.fill(HIST(DCAZPt), track.pt(), track.dcaZ(), c, o); } else { - inclusiveRegistry.fill(HIST(EtaZvtx), track.eta(), z); - inclusiveRegistry.fill(HIST(PhiEta), track.phi(), track.eta()); - inclusiveRegistry.fill(HIST(PtEta), track.pt(), track.eta()); - inclusiveRegistry.fill(HIST(DCAXYPt), track.pt(), track.dcaXY()); - inclusiveRegistry.fill(HIST(DCAZPt), track.pt(), track.dcaZ()); + inclusiveRegistry.fill(HIST(EtaZvtx), track.eta(), z, o); + inclusiveRegistry.fill(HIST(PhiEta), track.phi(), track.eta(), o); + inclusiveRegistry.fill(HIST(PtEta), track.pt(), track.eta(), o); + inclusiveRegistry.fill(HIST(DCAXYPt), track.pt(), track.dcaXY(), o); + inclusiveRegistry.fill(HIST(DCAZPt), track.pt(), track.dcaZ(), o); } } } @@ -479,23 +493,19 @@ struct MultiplicityCounter { typename C::iterator const& collision, FiTracks const& tracks) { - float c = -1; - if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - c = collision.centFT0C(); - } else if (C::template contains()) { - c = collision.centFT0M(); - } - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kAll), c); + float c = getRecoCent(collision); + float o = collision.trackOccupancyInTimeRange(); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kAll), c, o); } else { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kAll)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kAll), o); } if (!useEvSel || isCollisionSelected(collision)) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelected), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelected), c, o); } else { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelected)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelected), o); } auto z = collision.posZ(); usedTracksIds.clear(); @@ -503,57 +513,57 @@ struct MultiplicityCounter { auto groupPVContrib = pvContribTracksIUEta1->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto INELgt0PV = groupPVContrib.size() > 0; - auto Ntrks = countTracks(tracks, z, c); - if constexpr (hasRecoCent()) { + auto Ntrks = countTracks(tracks, z, c, o); + if constexpr (has_reco_cent) { if (Ntrks > 0 || INELgt0PV) { if (INELgt0PV) { - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedPVgt0), c); + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedPVgt0), c, o); } if (Ntrks > 0) { - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedgt0), c); + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedgt0), c, o); } for (auto& track : tracks) { if (Ntrks > 0) { - binnedRegistry.fill(HIST(EtaZvtx_gt0), track.eta(), z, c); + binnedRegistry.fill(HIST(EtaZvtx_gt0), track.eta(), z, c, o); } if (INELgt0PV) { - binnedRegistry.fill(HIST(EtaZvtx_PVgt0), track.eta(), z, c); + binnedRegistry.fill(HIST(EtaZvtx_PVgt0), track.eta(), z, c, o); } } } - binnedRegistry.fill(HIST(NtrkZvtx), Ntrks, z, c); - binnedRegistry.fill(HIST(NpvcZvtx), groupPVContrib.size(), z, c); + binnedRegistry.fill(HIST(NtrkZvtx), Ntrks, z, c, o); + binnedRegistry.fill(HIST(NpvcZvtx), groupPVContrib.size(), z, c, o); } else { if (Ntrks > 0 || INELgt0PV) { if (INELgt0PV) { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedPVgt0)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedPVgt0), o); } if (Ntrks > 0) { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedgt0)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedgt0), o); } for (auto& track : tracks) { if (Ntrks > 0) { - inclusiveRegistry.fill(HIST(EtaZvtx_gt0), track.eta(), z); + inclusiveRegistry.fill(HIST(EtaZvtx_gt0), track.eta(), z, o); } if (INELgt0PV) { - inclusiveRegistry.fill(HIST(EtaZvtx_PVgt0), track.eta(), z); + inclusiveRegistry.fill(HIST(EtaZvtx_PVgt0), track.eta(), z, o); } } } - inclusiveRegistry.fill(HIST(NtrkZvtx), Ntrks, z); - inclusiveRegistry.fill(HIST(NpvcZvtx), groupPVContrib.size(), z); + inclusiveRegistry.fill(HIST(NtrkZvtx), Ntrks, z, o); + inclusiveRegistry.fill(HIST(NpvcZvtx), groupPVContrib.size(), z, o); } } else { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kRejected), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kRejected), c, o); } else { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kRejected)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kRejected), o); } } } template - int countTracksAmbiguous(T const& tracks, AT const& atracks, float z, float c) + int countTracksAmbiguous(T const& tracks, AT const& atracks, float z, float c, float o) { auto Ntrks = 0; for (auto& track : atracks) { @@ -575,49 +585,49 @@ struct MultiplicityCounter { ++Ntrks; } if (fillHistos) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(EtaZvtx), otrack.eta(), z, c); - binnedRegistry.fill(HIST(PhiEta), otrack.phi(), otrack.eta(), c); - binnedRegistry.fill(HIST(PtEta), otrack.pt(), otrack.eta(), c); - binnedRegistry.fill(HIST(DCAXYPt), otrack.pt(), track.bestDCAXY(), c); - binnedRegistry.fill(HIST(DCAZPt), otrack.pt(), track.bestDCAZ(), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EtaZvtx), otrack.eta(), z, c, o); + binnedRegistry.fill(HIST(PhiEta), otrack.phi(), otrack.eta(), c, o); + binnedRegistry.fill(HIST(PtEta), otrack.pt(), otrack.eta(), c, o); + binnedRegistry.fill(HIST(DCAXYPt), otrack.pt(), track.bestDCAXY(), c, o); + binnedRegistry.fill(HIST(DCAZPt), otrack.pt(), track.bestDCAZ(), c, o); } else { - inclusiveRegistry.fill(HIST(EtaZvtx), otrack.eta(), z); - inclusiveRegistry.fill(HIST(PhiEta), otrack.phi(), otrack.eta()); - inclusiveRegistry.fill(HIST(PtEta), otrack.pt(), otrack.eta()); - inclusiveRegistry.fill(HIST(DCAXYPt), otrack.pt(), track.bestDCAXY()); - inclusiveRegistry.fill(HIST(DCAZPt), otrack.pt(), track.bestDCAZ()); + inclusiveRegistry.fill(HIST(EtaZvtx), otrack.eta(), z, o); + inclusiveRegistry.fill(HIST(PhiEta), otrack.phi(), otrack.eta(), o); + inclusiveRegistry.fill(HIST(PtEta), otrack.pt(), otrack.eta(), o); + inclusiveRegistry.fill(HIST(DCAXYPt), otrack.pt(), track.bestDCAXY(), o); + inclusiveRegistry.fill(HIST(DCAZPt), otrack.pt(), track.bestDCAZ(), o); } } if (otrack.has_collision() && otrack.collisionId() != track.bestCollisionId()) { usedTracksIdsDF.emplace_back(track.trackId()); if constexpr (fillHistos) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(ReassignedEtaZvtx), otrack.eta(), z, c); - binnedRegistry.fill(HIST(ReassignedPhiEta), otrack.phi(), otrack.eta(), c); - binnedRegistry.fill(HIST(ReassignedZvtxCorr), otrack.template collision_as().posZ(), z, c); - binnedRegistry.fill(HIST(ReassignedDCAXYPt), otrack.pt(), track.bestDCAXY(), c); - binnedRegistry.fill(HIST(ReassignedDCAZPt), otrack.pt(), track.bestDCAZ(), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(ReassignedEtaZvtx), otrack.eta(), z, c, o); + binnedRegistry.fill(HIST(ReassignedPhiEta), otrack.phi(), otrack.eta(), c, o); + binnedRegistry.fill(HIST(ReassignedZvtxCorr), otrack.template collision_as().posZ(), z, c, o); + binnedRegistry.fill(HIST(ReassignedDCAXYPt), otrack.pt(), track.bestDCAXY(), c, o); + binnedRegistry.fill(HIST(ReassignedDCAZPt), otrack.pt(), track.bestDCAZ(), c, o); } else { - inclusiveRegistry.fill(HIST(ReassignedEtaZvtx), otrack.eta(), z); - inclusiveRegistry.fill(HIST(ReassignedPhiEta), otrack.phi(), otrack.eta()); - inclusiveRegistry.fill(HIST(ReassignedZvtxCorr), otrack.template collision_as().posZ(), z); - inclusiveRegistry.fill(HIST(ReassignedDCAXYPt), otrack.pt(), track.bestDCAXY()); - inclusiveRegistry.fill(HIST(ReassignedDCAZPt), otrack.pt(), track.bestDCAZ()); + inclusiveRegistry.fill(HIST(ReassignedEtaZvtx), otrack.eta(), z, o); + inclusiveRegistry.fill(HIST(ReassignedPhiEta), otrack.phi(), otrack.eta(), o); + inclusiveRegistry.fill(HIST(ReassignedZvtxCorr), otrack.template collision_as().posZ(), z, o); + inclusiveRegistry.fill(HIST(ReassignedDCAXYPt), otrack.pt(), track.bestDCAXY(), o); + inclusiveRegistry.fill(HIST(ReassignedDCAZPt), otrack.pt(), track.bestDCAZ(), o); } } } else if (!otrack.has_collision()) { if constexpr (fillHistos) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(ExtraEtaZvtx), otrack.eta(), z, c); - binnedRegistry.fill(HIST(ExtraPhiEta), otrack.phi(), otrack.eta(), c); - binnedRegistry.fill(HIST(ExtraDCAXYPt), otrack.pt(), track.bestDCAXY(), c); - binnedRegistry.fill(HIST(ExtraDCAZPt), otrack.pt(), track.bestDCAZ(), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(ExtraEtaZvtx), otrack.eta(), z, c, o); + binnedRegistry.fill(HIST(ExtraPhiEta), otrack.phi(), otrack.eta(), c, o); + binnedRegistry.fill(HIST(ExtraDCAXYPt), otrack.pt(), track.bestDCAXY(), c, o); + binnedRegistry.fill(HIST(ExtraDCAZPt), otrack.pt(), track.bestDCAZ(), c, o); } else { - inclusiveRegistry.fill(HIST(ExtraEtaZvtx), otrack.eta(), z); - inclusiveRegistry.fill(HIST(ExtraPhiEta), otrack.phi(), otrack.eta()); - inclusiveRegistry.fill(HIST(ExtraDCAXYPt), otrack.pt(), track.bestDCAXY()); - inclusiveRegistry.fill(HIST(ExtraDCAZPt), otrack.pt(), track.bestDCAZ()); + inclusiveRegistry.fill(HIST(ExtraEtaZvtx), otrack.eta(), z, o); + inclusiveRegistry.fill(HIST(ExtraPhiEta), otrack.phi(), otrack.eta(), o); + inclusiveRegistry.fill(HIST(ExtraDCAXYPt), otrack.pt(), track.bestDCAXY(), o); + inclusiveRegistry.fill(HIST(ExtraDCAZPt), otrack.pt(), track.bestDCAZ(), o); } } } @@ -634,18 +644,18 @@ struct MultiplicityCounter { ++Ntrks; } if constexpr (fillHistos) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(EtaZvtx), track.eta(), z, c); - binnedRegistry.fill(HIST(PhiEta), track.phi(), track.eta(), c); - binnedRegistry.fill(HIST(PtEta), track.pt(), track.eta(), c); - binnedRegistry.fill(HIST(DCAXYPt), track.pt(), track.dcaXY(), c); - binnedRegistry.fill(HIST(DCAZPt), track.pt(), track.dcaZ(), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EtaZvtx), track.eta(), z, c, o); + binnedRegistry.fill(HIST(PhiEta), track.phi(), track.eta(), c, o); + binnedRegistry.fill(HIST(PtEta), track.pt(), track.eta(), c, o); + binnedRegistry.fill(HIST(DCAXYPt), track.pt(), track.dcaXY(), c, o); + binnedRegistry.fill(HIST(DCAZPt), track.pt(), track.dcaZ(), c, o); } else { - inclusiveRegistry.fill(HIST(EtaZvtx), track.eta(), z); - inclusiveRegistry.fill(HIST(PhiEta), track.phi(), track.eta()); - inclusiveRegistry.fill(HIST(PtEta), track.pt(), track.eta()); - inclusiveRegistry.fill(HIST(DCAXYPt), track.pt(), track.dcaXY()); - inclusiveRegistry.fill(HIST(DCAZPt), track.pt(), track.dcaZ()); + inclusiveRegistry.fill(HIST(EtaZvtx), track.eta(), z, o); + inclusiveRegistry.fill(HIST(PhiEta), track.phi(), track.eta(), o); + inclusiveRegistry.fill(HIST(PtEta), track.pt(), track.eta(), o); + inclusiveRegistry.fill(HIST(DCAXYPt), track.pt(), track.dcaXY(), o); + inclusiveRegistry.fill(HIST(DCAZPt), track.pt(), track.dcaZ(), o); } } } @@ -658,23 +668,19 @@ struct MultiplicityCounter { FiTracks const& tracks, soa::SmallGroups const& atracks) { - float c = -1; - if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - c = collision.centFT0C(); - } else if (C::template contains()) { - c = collision.centFT0M(); - } - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kAll), c); + float c = getRecoCent(collision); + float o = collision.trackOccupancyInTimeRange(); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kAll), c, o); } else { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kAll)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kAll), o); } if (!useEvSel || isCollisionSelected(collision)) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelected), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelected), c, o); } else { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelected)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelected), o); } auto z = collision.posZ(); usedTracksIds.clear(); @@ -682,21 +688,21 @@ struct MultiplicityCounter { auto groupPVContrib = pvContribTracksIUEta1->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto INELgt0PV = groupPVContrib.size() > 0; - auto Ntrks = countTracksAmbiguous(tracks, atracks, z, c); - if constexpr (hasRecoCent()) { + auto Ntrks = countTracksAmbiguous(tracks, atracks, z, c, o); + if constexpr (has_reco_cent) { if (Ntrks > 0 || INELgt0PV) { if (INELgt0PV) { - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedPVgt0), c); + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedPVgt0), c, o); } if (Ntrks > 0) { - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedgt0), c); + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedgt0), c, o); } for (auto& track : atracks) { if (Ntrks > 0) { - binnedRegistry.fill(HIST(EtaZvtx_gt0), track.track_as().eta(), z, c); + binnedRegistry.fill(HIST(EtaZvtx_gt0), track.track_as().eta(), z, c, o); } if (INELgt0PV) { - binnedRegistry.fill(HIST(EtaZvtx_PVgt0), track.track_as().eta(), z, c); + binnedRegistry.fill(HIST(EtaZvtx_PVgt0), track.track_as().eta(), z, c, o); } } for (auto& track : tracks) { @@ -707,29 +713,29 @@ struct MultiplicityCounter { continue; } if (Ntrks > 0) { - binnedRegistry.fill(HIST(EtaZvtx_gt0), track.eta(), z, c); + binnedRegistry.fill(HIST(EtaZvtx_gt0), track.eta(), z, c, o); } if (INELgt0PV) { - binnedRegistry.fill(HIST(EtaZvtx_PVgt0), track.eta(), z, c); + binnedRegistry.fill(HIST(EtaZvtx_PVgt0), track.eta(), z, c, o); } } } - binnedRegistry.fill(HIST(NtrkZvtx), Ntrks, z, c); - binnedRegistry.fill(HIST(NpvcZvtx), groupPVContrib.size(), z, c); + binnedRegistry.fill(HIST(NtrkZvtx), Ntrks, z, c, o); + binnedRegistry.fill(HIST(NpvcZvtx), groupPVContrib.size(), z, c, o); } else { if (Ntrks > 0 || INELgt0PV) { if (INELgt0PV) { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedPVgt0)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedPVgt0), o); } if (Ntrks > 0) { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedgt0)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kSelectedgt0), o); } for (auto& track : atracks) { if (Ntrks > 0) { - inclusiveRegistry.fill(HIST(EtaZvtx_gt0), track.track_as().eta(), z); + inclusiveRegistry.fill(HIST(EtaZvtx_gt0), track.track_as().eta(), z, o); } if (INELgt0PV) { - inclusiveRegistry.fill(HIST(EtaZvtx_PVgt0), track.track_as().eta(), z); + inclusiveRegistry.fill(HIST(EtaZvtx_PVgt0), track.track_as().eta(), z, o); } } for (auto& track : tracks) { @@ -740,21 +746,21 @@ struct MultiplicityCounter { continue; } if (Ntrks > 0) { - inclusiveRegistry.fill(HIST(EtaZvtx_gt0), track.eta(), z); + inclusiveRegistry.fill(HIST(EtaZvtx_gt0), track.eta(), z, o); } if (INELgt0PV) { - inclusiveRegistry.fill(HIST(EtaZvtx_PVgt0), track.eta(), z); + inclusiveRegistry.fill(HIST(EtaZvtx_PVgt0), track.eta(), z, o); } } } - inclusiveRegistry.fill(HIST(NtrkZvtx), Ntrks, z); - inclusiveRegistry.fill(HIST(NpvcZvtx), groupPVContrib.size(), z); + inclusiveRegistry.fill(HIST(NtrkZvtx), Ntrks, z, o); + inclusiveRegistry.fill(HIST(NpvcZvtx), groupPVContrib.size(), z, o); } } else { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kRejected), c); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kRejected), c, o); } else { - inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kRejected)); + inclusiveRegistry.fill(HIST(EventSelection), static_cast(EvSelBins::kRejected), o); } } } @@ -846,53 +852,46 @@ struct MultiplicityCounter { if (!collision.has_mcCollision()) { return; } - float c_rec = -1; - float c_gen = -1; - if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - c_rec = collision.centFT0C(); - } else if (C::template contains()) { - c_rec = collision.centFT0M(); - } - } + float c_rec = getRecoCent(collision); + float o = collision.trackOccupancyInTimeRange(); auto mcCollision = collision.mcCollision(); - if constexpr (hasSimCent()) { - c_gen = mcCollision.centrality(); - } else if constexpr (hasRecoCent()) { + float c_gen = getSimCent(mcCollision); + if (c_gen < 0 && c_rec >= 0) { c_gen = c_rec; } + auto sample = particles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); for (auto& particle : sample) { if (!isChargedParticle(particle.pdgCode())) { continue; } - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtGenIdxNoEtaCut), particle.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtGenIdxNoEtaCut), particle.pt(), c_gen, o); if (std::abs(particle.eta()) < estimatorEta) { - binnedRegistry.fill(HIST(PtGenIdx), particle.pt(), c_gen); + binnedRegistry.fill(HIST(PtGenIdx), particle.pt(), c_gen, o); if (particle.pdgCode() == speciesIds[0]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenIdxSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenIdxSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[1]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenIdxSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenIdxSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[2]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenIdxSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenIdxSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[3]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenIdxSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenIdxSuff), particle.pt(), c_gen, o); } } } else { - inclusiveRegistry.fill(HIST(PtGenIdxNoEtaCut), particle.pt()); + inclusiveRegistry.fill(HIST(PtGenIdxNoEtaCut), particle.pt(), o); if (std::abs(particle.eta()) < estimatorEta) { - inclusiveRegistry.fill(HIST(PtGenIdx), particle.pt()); + inclusiveRegistry.fill(HIST(PtGenIdx), particle.pt(), o); if (particle.pdgCode() == speciesIds[0]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenIdxSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenIdxSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[1]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenIdxSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenIdxSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[2]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenIdxSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenIdxSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[3]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenIdxSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenIdxSuff), particle.pt(), o); } } } @@ -904,106 +903,106 @@ struct MultiplicityCounter { auto relatedTracks = particle.template filtered_tracks_as(); for (auto const& track : relatedTracks) { ++counter; - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { if (!countedNoEtaCut) { - binnedRegistry.fill(HIST(PtEfficiencyIdxNoEtaCut), particle.pt(), c_gen); + binnedRegistry.fill(HIST(PtEfficiencyIdxNoEtaCut), particle.pt(), c_gen, o); countedNoEtaCut = true; } if (std::abs(track.eta()) < estimatorEta) { if (!counted) { - binnedRegistry.fill(HIST(PtEfficiencyIdx), particle.pt(), c_gen); + binnedRegistry.fill(HIST(PtEfficiencyIdx), particle.pt(), c_gen, o); if (particle.pdgCode() == speciesIds[0]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffIdxSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffIdxSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[1]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffIdxSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffIdxSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[2]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffIdxSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffIdxSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[3]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffIdxSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffIdxSuff), particle.pt(), c_gen, o); } counted = true; } } if (counter > 1) { - binnedRegistry.fill(HIST(PtEfficiencySecondariesIdxNoEtaCut), particle.pt(), c_gen); + binnedRegistry.fill(HIST(PtEfficiencySecondariesIdxNoEtaCut), particle.pt(), c_gen, o); if (std::abs(track.eta()) < estimatorEta) { - binnedRegistry.fill(HIST(PtEfficiencySecondariesIdx), particle.pt(), c_gen); + binnedRegistry.fill(HIST(PtEfficiencySecondariesIdx), particle.pt(), c_gen, o); } } } else { if (!countedNoEtaCut) { - inclusiveRegistry.fill(HIST(PtEfficiencyIdxNoEtaCut), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencyIdxNoEtaCut), particle.pt(), o); countedNoEtaCut = true; } if (std::abs(track.eta()) < estimatorEta) { if (!counted) { - inclusiveRegistry.fill(HIST(PtEfficiencyIdx), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencyIdx), particle.pt(), o); if (particle.pdgCode() == speciesIds[0]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffIdxSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffIdxSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[1]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffIdxSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffIdxSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[2]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffIdxSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffIdxSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[3]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffIdxSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffIdxSuff), particle.pt(), o); } counted = true; } } if (counter > 1) { - inclusiveRegistry.fill(HIST(PtEfficiencySecondariesIdxNoEtaCut), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencySecondariesIdxNoEtaCut), particle.pt(), o); if (std::abs(track.eta()) < estimatorEta) { - inclusiveRegistry.fill(HIST(PtEfficiencySecondariesIdx), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencySecondariesIdx), particle.pt(), o); } } } } - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { for (auto const& track : relatedTracks) { for (auto layer = 0; layer < 7; ++layer) { if (track.itsClusterMap() & (uint8_t(1) << layer)) { - binnedRegistry.fill(HIST(ITSlayers), layer + 1, c_gen); + binnedRegistry.fill(HIST(ITSlayers), layer + 1, c_gen, o); } } auto hasbit = false; for (auto bit = 0; bit < 16; ++bit) { if (track.mcMask() & (uint8_t(1) << bit)) { - binnedRegistry.fill(HIST(Mask), bit, c_gen); + binnedRegistry.fill(HIST(Mask), bit, c_gen, o); hasbit = true; } } if (!hasbit) { - binnedRegistry.fill(HIST(Mask), 16, c_gen); + binnedRegistry.fill(HIST(Mask), 16, c_gen, o); } } if (relatedTracks.size() > 1) { - binnedRegistry.fill(HIST(PhiEtaGenDuplicates), particle.phi(), particle.eta(), c_gen); + binnedRegistry.fill(HIST(PhiEtaGenDuplicates), particle.phi(), particle.eta(), c_gen, o); for (auto const& track : relatedTracks) { - binnedRegistry.fill(HIST(PhiEtaDuplicates), track.phi(), track.eta(), c_gen); + binnedRegistry.fill(HIST(PhiEtaDuplicates), track.phi(), track.eta(), c_gen, o); } } } else { for (auto const& track : relatedTracks) { for (auto layer = 0; layer < 7; ++layer) { if (track.itsClusterMap() & (uint8_t(1) << layer)) { - inclusiveRegistry.fill(HIST(ITSlayers), layer + 1); + inclusiveRegistry.fill(HIST(ITSlayers), layer + 1, o); } } auto hasbit = false; for (auto bit = 0; bit < 16; ++bit) { if (track.mcMask() & (uint8_t(1) << bit)) { - inclusiveRegistry.fill(HIST(Mask), bit); + inclusiveRegistry.fill(HIST(Mask), bit, o); hasbit = true; } } if (!hasbit) { - inclusiveRegistry.fill(HIST(Mask), 16); + inclusiveRegistry.fill(HIST(Mask), 16, o); } } if (relatedTracks.size() > 1) { - inclusiveRegistry.fill(HIST(PhiEtaGenDuplicates), particle.phi(), particle.eta()); + inclusiveRegistry.fill(HIST(PhiEtaGenDuplicates), particle.phi(), particle.eta(), o); for (auto const& track : relatedTracks) { - inclusiveRegistry.fill(HIST(PhiEtaDuplicates), track.phi(), track.eta()); + inclusiveRegistry.fill(HIST(PhiEtaDuplicates), track.phi(), track.eta(), o); } } } @@ -1054,19 +1053,11 @@ struct MultiplicityCounter { if (!collision.has_mcCollision()) { return; } - float c_rec = -1; - float c_gen = -1; - if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - c_rec = collision.centFT0C(); - } else if (C::template contains()) { - c_rec = collision.centFT0M(); - } - } + float c_rec = getRecoCent(collision); + float o = collision.trackOccupancyInTimeRange(); auto mcCollision = collision.mcCollision(); - if constexpr (hasSimCent()) { - c_gen = mcCollision.centrality(); - } else if constexpr (hasRecoCent()) { + float c_gen = getSimCent(mcCollision); + if (c_gen < 0 && c_rec >= 0) { c_gen = c_rec; } @@ -1081,41 +1072,41 @@ struct MultiplicityCounter { } if (otrack.has_mcParticle()) { auto particle = otrack.mcParticle_as(); - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), c_gen, o); } else { - inclusiveRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), o); } if (std::abs(otrack.eta()) < estimatorEta) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtEfficiency), particle.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtEfficiency), particle.pt(), c_gen, o); if (particle.pdgCode() == speciesIds[0]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[1]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[2]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[3]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } } else { - inclusiveRegistry.fill(HIST(PtEfficiency), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiency), particle.pt(), o); if (particle.pdgCode() == speciesIds[0]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[1]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[2]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[3]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), o); } } } } else { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtEfficiencyFakes), otrack.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtEfficiencyFakes), otrack.pt(), c_gen, o); } else { - inclusiveRegistry.fill(HIST(PtEfficiencyFakes), otrack.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencyFakes), otrack.pt(), o); } } } @@ -1128,41 +1119,41 @@ struct MultiplicityCounter { } if (track.has_mcParticle()) { auto particle = track.template mcParticle_as(); - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), c_gen, o); } else { - inclusiveRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), o); } if (std::abs(track.eta()) < estimatorEta) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtEfficiency), particle.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtEfficiency), particle.pt(), c_gen, o); if (particle.pdgCode() == speciesIds[0]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[1]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[2]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[3]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } } else { - inclusiveRegistry.fill(HIST(PtEfficiency), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiency), particle.pt(), o); if (particle.pdgCode() == speciesIds[0]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[1]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[2]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[3]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), o); } } } } else { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtEfficiencyFakes), track.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtEfficiencyFakes), track.pt(), c_gen, o); } else { - inclusiveRegistry.fill(HIST(PtEfficiencyFakes), track.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencyFakes), track.pt(), o); } } } @@ -1171,32 +1162,32 @@ struct MultiplicityCounter { if (!isChargedParticle(particle.pdgCode())) { continue; } - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtGenNoEtaCut), particle.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtGenNoEtaCut), particle.pt(), c_gen, o); if (std::abs(particle.eta()) < estimatorEta) { - binnedRegistry.fill(HIST(PtGen), particle.pt(), c_gen); + binnedRegistry.fill(HIST(PtGen), particle.pt(), c_gen, o); if (particle.pdgCode() == speciesIds[0]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[1]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[2]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[3]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenSuff), particle.pt(), c_gen, o); } } } else { inclusiveRegistry.fill(HIST(PtGenNoEtaCut), particle.pt()); if (std::abs(particle.eta()) < estimatorEta) { - inclusiveRegistry.fill(HIST(PtGen), particle.pt()); + inclusiveRegistry.fill(HIST(PtGen), particle.pt(), o); if (particle.pdgCode() == speciesIds[0]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[1]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[2]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[3]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenSuff), particle.pt(), o); } } } @@ -1215,19 +1206,11 @@ struct MultiplicityCounter { if (!collision.has_mcCollision()) { return; } - float c_rec = -1; - float c_gen = -1; - if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - c_rec = collision.centFT0C(); - } else if (C::template contains()) { - c_rec = collision.centFT0M(); - } - } + float c_rec = getRecoCent(collision); + float o = collision.trackOccupancyInTimeRange(); auto mcCollision = collision.mcCollision(); - if constexpr (hasSimCent()) { - c_gen = mcCollision.centrality(); - } else if constexpr (hasRecoCent()) { + float c_gen = getSimCent(mcCollision); + if (c_gen < 0 && c_rec >= 0) { c_gen = c_rec; } @@ -1237,40 +1220,40 @@ struct MultiplicityCounter { for (auto const& track : tracks) { if (track.has_mcParticle()) { auto particle = track.template mcParticle_as(); - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), c_gen, o); if (std::abs(track.eta()) < estimatorEta) { - binnedRegistry.fill(HIST(PtEfficiency), particle.pt(), c_gen); + binnedRegistry.fill(HIST(PtEfficiency), particle.pt(), c_gen, o); if (particle.pdgCode() == speciesIds[0]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[1]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[2]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[3]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), c_gen, o); } } } else { - inclusiveRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencyNoEtaCut), particle.pt(), o); if (std::abs(track.eta()) < estimatorEta) { - inclusiveRegistry.fill(HIST(PtEfficiency), particle.pt()); + inclusiveRegistry.fill(HIST(PtEfficiency), particle.pt(), o); if (particle.pdgCode() == speciesIds[0]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[1]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[2]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtEffSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[3]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtEffSuff), particle.pt(), o); } } } } else { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtEfficiencyFakes), track.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtEfficiencyFakes), track.pt(), c_gen, o); } else { - inclusiveRegistry.fill(HIST(PtEfficiencyFakes), track.pt()); + inclusiveRegistry.fill(HIST(PtEfficiencyFakes), track.pt(), o); } } } @@ -1279,32 +1262,32 @@ struct MultiplicityCounter { if (!isChargedParticle(particle.pdgCode())) { continue; } - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(PtGenNoEtaCut), particle.pt(), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(PtGenNoEtaCut), particle.pt(), c_gen, o); if (std::abs(particle.eta()) < estimatorEta) { - binnedRegistry.fill(HIST(PtGen), particle.pt(), c_gen); + binnedRegistry.fill(HIST(PtGen), particle.pt(), c_gen, o); if (particle.pdgCode() == speciesIds[0]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[1]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[2]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenSuff), particle.pt(), c_gen, o); } else if (particle.pdgCode() == speciesIds[3]) { - binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenSuff), particle.pt(), c_gen); + binnedRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenSuff), particle.pt(), c_gen, o); } } } else { - inclusiveRegistry.fill(HIST(PtGenNoEtaCut), particle.pt()); + inclusiveRegistry.fill(HIST(PtGenNoEtaCut), particle.pt(), o); if (std::abs(particle.eta()) < estimatorEta) { - inclusiveRegistry.fill(HIST(PtGen), particle.pt()); + inclusiveRegistry.fill(HIST(PtGen), particle.pt(), o); if (particle.pdgCode() == speciesIds[0]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[0]) + HIST(PtGenSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[1]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[1]) + HIST(PtGenSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[2]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[2]) + HIST(PtGenSuff), particle.pt(), o); } else if (particle.pdgCode() == speciesIds[3]) { - inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenSuff), particle.pt()); + inclusiveRegistry.fill(HIST(prefix) + HIST(species[3]) + HIST(PtGenSuff), particle.pt(), o); } } } @@ -1476,6 +1459,7 @@ struct MultiplicityCounter { std::vector NrecPerCol; std::vector c_recPerCol; + std::vector OccuPerCol; std::vector NPVPerCol; std::vector NFT0APerCol; std::vector NFT0CPerCol; @@ -1489,23 +1473,19 @@ struct MultiplicityCounter { Particles const& particles, FiTracks const& tracks, FiReTracks const& atracks) { float c_gen = -1; - // add generated centrality estimation - if constexpr (hasSimCent()) { - c_gen = mcCollision.centrality(); - } else if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - if constexpr (requires { mcCollision.gencentFT0C(); }) { - c_gen = mcCollision.gencentFT0C(); - } - } else if (C::template contains()) { - if constexpr (requires { mcCollision.gencentFT0M(); }) { - c_gen = mcCollision.gencentFT0M(); - } + if constexpr (has_Centrality) { + c_gen = getSimCent(mcCollision); + } else { + if constexpr (has_FT0C) { + c_gen = getGenCentFT0C(mcCollision); + } else if (has_FT0M) { + c_gen = getGenCentFT0M(mcCollision); } } NrecPerCol.clear(); c_recPerCol.clear(); + OccuPerCol.clear(); NPVPerCol.clear(); NFT0APerCol.clear(); NFT0CPerCol.clear(); @@ -1518,170 +1498,159 @@ struct MultiplicityCounter { auto moreThanOne = 0; LOGP(debug, "MC col {} has {} reco cols", mcCollision.globalIndex(), collisions.size()); - [[maybe_unused]] float min_c_rec = 2e2; - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { + float min_c_rec = 2e2; for (auto& collision : collisions) { if (!useEvSel || isCollisionSelected(collision)) { - float c = -1; - if constexpr (C::template contains()) { - c = collision.centFT0C(); - } else if (C::template contains()) { - c = collision.centFT0M(); - } + float c = getRecoCent(collision); if (c < min_c_rec) { min_c_rec = c; } } } + if constexpr (!has_Centrality) { + if (c_gen < 0) { + c_gen = min_c_rec; // if there is no generator centrality info, fall back to reco (from the largest reco collision) + } + } } - if constexpr (hasRecoCent() && !hasSimCent()) { - if (std::abs(c_gen + 1) < 1e-6) { - c_gen = min_c_rec; // if there is no generator centrality info, fall back to reco (from the largest reco collision) + float o_max = -1; + for (auto& collision : collisions) { + if (!useEvSel || isCollisionSelected(collision)) { + auto o = collision.trackOccupancyInTimeRange(); + if (o > o_max) { + o_max = o; + } } } for (auto& collision : collisions) { usedTracksIds.clear(); - float c_rec = -1; - if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - c_rec = collision.centFT0C(); - } else if (C::template contains()) { - c_rec = collision.centFT0M(); - } - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kRec), c_gen); + float c_rec = getRecoCent(collision); + float o = collision.trackOccupancyInTimeRange(); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kRec), c_gen, o); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kRec)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kRec), o); } if (!useEvSel || isCollisionSelected(collision)) { c_recPerCol.emplace_back(c_rec); + OccuPerCol.emplace_back(o); auto z = collision.posZ(); ++moreThanOne; atLeastOne = true; auto groupPVcontrib = pvContribTracksIUEta1->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); if (groupPVcontrib.size() > 0) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedPVgt0), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedPVgt0), c_gen, o); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedPVgt0)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedPVgt0), o); } atLeastOne_PVgt0 = true; } auto perCollisionASample = atracks.sliceBy(perColU, collision.globalIndex()); auto perCollisionSample = tracks.sliceBy(perCol, collision.globalIndex()); - auto Nrec = countTracksAmbiguous(perCollisionSample, perCollisionASample, z, c_rec); + auto Nrec = countTracksAmbiguous(perCollisionSample, perCollisionASample, z, c_rec, o); NrecPerCol.emplace_back(Nrec); NPVPerCol.emplace_back(groupPVcontrib.size()); fillFIT(collision, NFT0APerCol, NFT0CPerCol, NFDDAPerCol, NFDDCPerCol); - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelected), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelected), c_gen, o); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelected)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelected), o); } if (Nrec > 0) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedgt0), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedgt0), c_gen, o); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedgt0)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedgt0), o); } atLeastOne_gt0 = true; } - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(NtrkZvtxGen), Nrec, collision.posZ(), c_rec); - binnedRegistry.fill(HIST(NpvcZvxtGen), groupPVcontrib.size(), collision.posZ(), c_rec); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(NtrkZvtxGen), Nrec, collision.posZ(), c_rec, o); + binnedRegistry.fill(HIST(NpvcZvxtGen), groupPVcontrib.size(), collision.posZ(), c_rec, o); } else { inclusiveRegistry.fill(HIST(NtrkZvtxGen), Nrec, collision.posZ()); - inclusiveRegistry.fill(HIST(NpvcZvxtGen), groupPVcontrib.size(), collision.posZ()); + inclusiveRegistry.fill(HIST(NpvcZvxtGen), groupPVcontrib.size(), collision.posZ(), o); } } } auto nCharged = countParticles(particles); - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { binnedRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ(), c_gen); - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGen), c_gen); + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGen), c_gen, o_max); } else { - if constexpr (soa::is_soa_join_v) { - if constexpr (MC::template contains()) { - if (useProcId) { - inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ(), mcCollision.processId()); - } else { - inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ()); - } + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGen), o_max); + if (useProcId) { + if constexpr (has_hepmc_pid) { + inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ(), mcCollision.processId()); } else { - inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ()); + LOGP(fatal, "useProcId = true, but MC collision does not have HepMC info"); } } else { inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ()); } - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGen)); } if (nCharged > 0) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGengt0), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGengt0), c_gen, o_max); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGengt0)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGengt0), o_max); } } if (fillResponse) { for (auto i = 0U; i < NrecPerCol.size(); ++i) { - if constexpr (hasRecoCent()) { - if constexpr (soa::is_soa_join_v) { - if constexpr (MC::template contains()) { - if (useProcId) { - binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i], mcCollision.processId()); - } else { - binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i]); - } + if constexpr (has_reco_cent) { + if (useProcId) { + if constexpr (has_hepmc_pid) { + binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i], mcCollision.processId()); } else { - binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i]); + LOGP(fatal, "useProcId = true, but MC collision does not have HepMC info"); } } else { binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i]); } if (addFT0 && !addFDD) { - binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], mcCollision.posZ(), c_recPerCol[i]); + binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], mcCollision.posZ(), c_recPerCol[i], OccuPerCol[i]); } else if (addFDD && !addFT0) { - binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), c_recPerCol[i]); + binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), c_recPerCol[i], OccuPerCol[i]); } else if (addFT0 && addFDD) { - binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), c_recPerCol[i]); + binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), c_recPerCol[i], OccuPerCol[i]); } else { - binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, mcCollision.posZ(), c_recPerCol[i]); + binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, mcCollision.posZ(), c_recPerCol[i], OccuPerCol[i]); } } else { - if constexpr (soa::is_soa_join_v) { - if constexpr (MC::template contains()) { - if (useProcId) { - inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), mcCollision.processId()); - } else { - inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ()); - } + if (useProcId) { + if constexpr (has_hepmc_pid) { + inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), mcCollision.processId()); } else { - inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ()); + LOGP(fatal, "useProcId = true, but MC collision does not have HepMC info"); } } else { inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ()); } if (addFT0 && !addFDD) { - inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], mcCollision.posZ()); + inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], mcCollision.posZ(), OccuPerCol[i]); } else if (addFDD && !addFT0) { - inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ()); + inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), OccuPerCol[i]); } else if (addFT0 && addFDD) { - inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ()); + inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), OccuPerCol[i]); } else { - inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, mcCollision.posZ()); + inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, mcCollision.posZ(), OccuPerCol[i]); } } } if (moreThanOne > 1) { - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { binnedRegistry.fill(HIST(SplitMult), nCharged, mcCollision.posZ(), c_gen); } else { inclusiveRegistry.fill(HIST(SplitMult), nCharged, mcCollision.posZ()); @@ -1690,7 +1659,7 @@ struct MultiplicityCounter { } if (collisions.size() == 0) { - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { binnedRegistry.fill(HIST(NotFoundZvtx), mcCollision.posZ(), c_gen); } else { inclusiveRegistry.fill(HIST(NotFoundZvtx), mcCollision.posZ()); @@ -1698,7 +1667,7 @@ struct MultiplicityCounter { } auto zmc = mcCollision.posZ(); - fillParticleHistos()>(particles, zmc, nCharged, c_gen, atLeastOne, atLeastOne_gt0, atLeastOne_PVgt0); + fillParticleHistos>(particles, zmc, nCharged, c_gen, atLeastOne, atLeastOne_gt0, atLeastOne_PVgt0); } template @@ -1708,18 +1677,13 @@ struct MultiplicityCounter { Particles const& particles, FiTracks const& tracks) { float c_gen = -1; - // add generated centrality estimation - if constexpr (hasSimCent()) { - c_gen = mcCollision.centrality(); - } else if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - if constexpr (requires { mcCollision.gencentFT0C(); }) { - c_gen = mcCollision.gencentFT0C(); - } - } else if (C::template contains()) { - if constexpr (requires { mcCollision.gencentFT0M(); }) { - c_gen = mcCollision.gencentFT0M(); - } + if constexpr (has_Centrality) { + c_gen = getSimCent(mcCollision); + } else { + if constexpr (has_FT0C) { + c_gen = getGenCentFT0C(mcCollision); + } else if (has_FT0M) { + c_gen = getGenCentFT0M(mcCollision); } } @@ -1731,47 +1695,47 @@ struct MultiplicityCounter { NrecPerCol.clear(); c_recPerCol.clear(); + OccuPerCol.clear(); NPVPerCol.clear(); NFT0APerCol.clear(); NFT0CPerCol.clear(); NFDDAPerCol.clear(); NFDDCPerCol.clear(); - [[maybe_unused]] float min_c_rec = 2e2; - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { + float min_c_rec = 2e2; for (auto& collision : collisions) { if (!useEvSel || isCollisionSelected(collision)) { - float c = -1; - if constexpr (C::template contains()) { - c = collision.centFT0C(); - } else if (C::template contains()) { - c = collision.centFT0M(); - } + float c = getRecoCent(collision); if (c < min_c_rec) { min_c_rec = c; } } } + if constexpr (!has_Centrality) { + if (c_gen < 0) { + c_gen = min_c_rec; // if there is no generator centrality info, fall back to reco (from the largest reco collision) + } + } } - - if constexpr (hasRecoCent() && !hasSimCent()) { - if (std::abs(c_gen + 1) < 1e-6) { - c_gen = min_c_rec; // if there is no generator centrality info, fall back to reco (from the largest reco collision) + float o_max = -1; + for (auto& collision : collisions) { + if (!useEvSel || isCollisionSelected(collision)) { + auto o = collision.trackOccupancyInTimeRange(); + if (o > o_max) { + o_max = o; + } } } for (auto& collision : collisions) { usedTracksIds.clear(); - float c_rec = -1; - if constexpr (hasRecoCent()) { - if constexpr (C::template contains()) { - c_rec = collision.centFT0C(); - } else if (C::template contains()) { - c_rec = collision.centFT0M(); - } - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kRec), c_gen); + float c_rec = getRecoCent(collision); + float o = collision.trackOccupancyInTimeRange(); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kRec), c_gen, o); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kRec)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kRec), o); } if (!useEvSel || isCollisionSelected(collision)) { c_recPerCol.emplace_back(c_rec); @@ -1781,126 +1745,114 @@ struct MultiplicityCounter { auto groupPVcontrib = pvContribTracksIUEta1->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); if (groupPVcontrib.size() > 0) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedPVgt0), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedPVgt0), c_gen, o); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedPVgt0)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedPVgt0), o); } atLeastOne_PVgt0 = true; } auto perCollisionSample = tracks.sliceBy(perCol, collision.globalIndex()); - auto Nrec = countTracks(perCollisionSample, z, c_rec); + auto Nrec = countTracks(perCollisionSample, z, c_rec, o); NrecPerCol.emplace_back(Nrec); NPVPerCol.emplace_back(groupPVcontrib.size()); fillFIT(collision, NFT0APerCol, NFT0CPerCol, NFDDAPerCol, NFDDCPerCol); - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelected), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelected), c_gen, o); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelected)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelected), o); } if (Nrec > 0) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedgt0), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedgt0), c_gen, o); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedgt0)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kSelectedgt0), o); } atLeastOne_gt0 = true; } - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(NtrkZvtxGen), Nrec, collision.posZ(), c_rec); - binnedRegistry.fill(HIST(NpvcZvxtGen), groupPVcontrib.size(), collision.posZ(), c_rec); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(NtrkZvtxGen), Nrec, collision.posZ(), c_rec, o); + binnedRegistry.fill(HIST(NpvcZvxtGen), groupPVcontrib.size(), collision.posZ(), c_rec, o); } else { - inclusiveRegistry.fill(HIST(NtrkZvtxGen), Nrec, collision.posZ()); - inclusiveRegistry.fill(HIST(NpvcZvxtGen), groupPVcontrib.size(), collision.posZ()); + inclusiveRegistry.fill(HIST(NtrkZvtxGen), Nrec, collision.posZ(), o); + inclusiveRegistry.fill(HIST(NpvcZvxtGen), groupPVcontrib.size(), collision.posZ(), o); } } } auto nCharged = countParticles(particles); - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { binnedRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ(), c_gen); - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGen), c_gen); + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGen), c_gen, o_max); } else { - if constexpr (soa::is_soa_join_v) { - if constexpr (MC::template contains()) { - if (useProcId) { - inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ(), mcCollision.processId()); - } else { - inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ()); - } + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGen), o_max); + if (useProcId) { + if constexpr (has_hepmc_pid) { + inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ(), mcCollision.processId()); } else { - inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ()); + LOGP(fatal, "useProcId = true, but MC collision does not have HepMC info"); } } else { inclusiveRegistry.fill(HIST(NtrkZvtxGen_t), nCharged, mcCollision.posZ()); } - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGen)); } if (nCharged > 0) { - if constexpr (hasRecoCent()) { - binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGengt0), c_gen); + if constexpr (has_reco_cent) { + binnedRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGengt0), c_gen, o_max); } else { - inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGengt0)); + inclusiveRegistry.fill(HIST(Efficiency), static_cast(EvEffBins::kGengt0), o_max); } } if (fillResponse) { for (auto i = 0U; i < NrecPerCol.size(); ++i) { - if constexpr (hasRecoCent()) { - if constexpr (soa::is_soa_join_v) { - if constexpr (MC::template contains()) { - if (useProcId) { - binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i], mcCollision.processId()); - } else { - binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i]); - } + if constexpr (has_reco_cent) { + if (useProcId) { + if constexpr (has_hepmc_pid) { + binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i], mcCollision.processId()); } else { - binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i]); + LOGP(fatal, "useProcId = true, but MC collision does not have HepMC info"); } } else { binnedRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), c_recPerCol[i]); } if (addFT0 && !addFDD) { - binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], mcCollision.posZ(), c_recPerCol[i]); + binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], mcCollision.posZ(), c_recPerCol[i], OccuPerCol[i]); } else if (addFDD && !addFT0) { - binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), c_recPerCol[i]); + binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), c_recPerCol[i], OccuPerCol[i]); } else if (addFT0 && addFDD) { - binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), c_recPerCol[i]); + binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), c_recPerCol[i], OccuPerCol[i]); } else { - binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, mcCollision.posZ(), c_recPerCol[i]); + binnedRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, mcCollision.posZ(), c_recPerCol[i], OccuPerCol[i]); } } else { - if constexpr (soa::is_soa_join_v) { - if constexpr (MC::template contains()) { - if (useProcId) { - inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), mcCollision.processId()); - } else { - inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ()); - } + if (useProcId) { + if constexpr (has_hepmc_pid) { + inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ(), mcCollision.processId()); } else { - inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ()); + LOGP(fatal, "useProcId = true, but MC collision does not have HepMC info"); } } else { inclusiveRegistry.fill(HIST(EfficiencyMult), nCharged, mcCollision.posZ()); } if (addFT0 && !addFDD) { - inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], mcCollision.posZ()); + inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], mcCollision.posZ(), OccuPerCol[i]); } else if (addFDD && !addFT0) { - inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ()); + inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), OccuPerCol[i]); } else if (addFT0 && addFDD) { - inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ()); + inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, NFT0APerCol[i], NFT0CPerCol[i], NFDDAPerCol[i], NFDDCPerCol[i], mcCollision.posZ(), OccuPerCol[i]); } else { - inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, mcCollision.posZ()); + inclusiveRegistry.fill(HIST(Response), NrecPerCol[i], NPVPerCol[i], nCharged, mcCollision.posZ(), OccuPerCol[i]); } } } if (moreThanOne > 1) { - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { binnedRegistry.fill(HIST(SplitMult), nCharged, mcCollision.posZ(), c_gen); } else { inclusiveRegistry.fill(HIST(SplitMult), nCharged, mcCollision.posZ()); @@ -1909,14 +1861,14 @@ struct MultiplicityCounter { } if (collisions.size() == 0) { - if constexpr (hasRecoCent()) { + if constexpr (has_reco_cent) { binnedRegistry.fill(HIST(NotFoundZvtx), mcCollision.posZ(), c_gen); } else { inclusiveRegistry.fill(HIST(NotFoundZvtx), mcCollision.posZ()); } } auto zmc = mcCollision.posZ(); - fillParticleHistos()>(particles, zmc, nCharged, c_gen, atLeastOne, atLeastOne_gt0, atLeastOne_PVgt0); + fillParticleHistos>(particles, zmc, nCharged, c_gen, atLeastOne, atLeastOne_gt0, atLeastOne_PVgt0); } using MC = aod::McCollisions; // soa::Join; diff --git a/PWGMM/Mult/Tasks/heavy-ion-mult.cxx b/PWGMM/Mult/Tasks/heavy-ion-mult.cxx index 38778b9fc03..0e0a08568e5 100644 --- a/PWGMM/Mult/Tasks/heavy-ion-mult.cxx +++ b/PWGMM/Mult/Tasks/heavy-ion-mult.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include "bestCollisionTable.h" #include "CCDB/BasicCCDBManager.h" @@ -103,7 +104,7 @@ static constexpr TrackSelectionFlags::flagtype trackSelectionDCA = static constexpr TrackSelectionFlags::flagtype trackSelectionDCAXYonly = TrackSelectionFlags::kDCAxy; -AxisSpec axisEvent{9, 0.5, 9.5, "#Event", "EventAxis"}; +AxisSpec axisEvent{10, 0.5, 10.5, "#Event", "EventAxis"}; AxisSpec axisVtxZ{40, -20, 20, "Vertex Z", "VzAxis"}; AxisSpec axisEta{40, -2, 2, "#eta", "EtaAxis"}; AxisSpec axisPhi{{0, M_PI / 4, M_PI / 2, M_PI * 3. / 4, M_PI, M_PI * 5. / 4, M_PI * 3. / 2, M_PI * 7. / 4, 2 * M_PI}, "#phi", "PhiAxis"}; @@ -150,6 +151,8 @@ struct HeavyIonMultiplicity { Configurable IsApplyExtraPhiCut{"IsApplyExtraPhiCut", false, "Enable extra phi cut"}; Configurable NPVtracksCut{"NPVtracksCut", 1.0f, "Apply extra NPVtracks cut"}; Configurable FT0CCut{"FT0CCut", 1.0f, "Apply extra FT0C cut"}; + Configurable IsApplyNoCollInTimeRangeStandard{"IsApplyNoCollInTimeRangeStandard", true, "Enable NoCollInTimeRangeStandard cut"}; + Configurable IsApplyFT0CbasedOccupancy{"IsApplyFT0CbasedOccupancy", true, "Enable FT0CbasedOccupancy cut"}; void init(InitContext const&) { @@ -176,6 +179,7 @@ struct HeavyIonMultiplicity { x->SetBinLabel(7, "kIsVertexTRDmatched"); // at least one of vertex contributors is matched to TRD x->SetBinLabel(8, "Centrality"); x->SetBinLabel(9, "ApplyExtraCorrCut"); + x->SetBinLabel(10, "ApplyNoCollInTimeRangeStandard"); if (doprocessData) { histos.add("CentPercentileHist", "CentPercentileHist", kTH1D, {axisCent}, false); @@ -312,6 +316,11 @@ struct HeavyIonMultiplicity { return false; } histos.fill(HIST("EventHist"), 9); + + if (IsApplyNoCollInTimeRangeStandard && !col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + histos.fill(HIST("EventHist"), 10); return true; } @@ -329,7 +338,8 @@ struct HeavyIonMultiplicity { } histos.fill(HIST("VtxZHist"), collision.posZ()); histos.fill(HIST("CentPercentileHist"), collision.centFT0C()); - histos.fill(HIST("hdatazvtxcent"), collision.posZ(), collision.centFT0C(), collision.trackOccupancyInTimeRange()); + auto OccupancyValue = IsApplyFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + histos.fill(HIST("hdatazvtxcent"), collision.posZ(), collision.centFT0C(), OccupancyValue); auto NchTracks = 0; for (auto& track : tracks) { @@ -338,11 +348,11 @@ struct HeavyIonMultiplicity { } histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); NchTracks++; - histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), collision.trackOccupancyInTimeRange(), track.eta(), track.phi(), kGlobalplusITS); + histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), OccupancyValue, track.eta(), track.phi(), kGlobalplusITS); if (track.hasTPC()) { - histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), collision.trackOccupancyInTimeRange(), track.eta(), track.phi(), kGlobalonly); + histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), OccupancyValue, track.eta(), track.phi(), kGlobalonly); } else { - histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), collision.trackOccupancyInTimeRange(), track.eta(), track.phi(), kITSonly); + histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), OccupancyValue, track.eta(), track.phi(), kITSonly); } } histos.fill(HIST("hdatamult"), collision.posZ(), NchTracks, collision.centFT0C()); @@ -382,7 +392,8 @@ struct HeavyIonMultiplicity { } histos.fill(HIST("VtxZHist"), RecCollision.posZ()); histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); - histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C(), RecCollision.trackOccupancyInTimeRange()); + auto OccupancyValue = IsApplyFT0CbasedOccupancy ? RecCollision.ft0cOccupancyInTimeRange() : RecCollision.trackOccupancyInTimeRange(); + histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C(), OccupancyValue); auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); for (auto& Rectrack : Rectrackspart) { @@ -390,7 +401,7 @@ struct HeavyIonMultiplicity { continue; } histos.fill(HIST("MCrecPhiVsEtaHist"), Rectrack.phi(), Rectrack.eta()); - histos.fill(HIST("hmcrecdndeta"), RecCollision.posZ(), RecCollision.centFT0C(), RecCollision.trackOccupancyInTimeRange(), Rectrack.eta(), Rectrack.phi()); + histos.fill(HIST("hmcrecdndeta"), RecCollision.posZ(), RecCollision.centFT0C(), OccupancyValue, Rectrack.eta(), Rectrack.phi()); } // track (mcrec) loop for (auto& particle : GenParticles) { @@ -421,7 +432,8 @@ struct HeavyIonMultiplicity { } histos.fill(HIST("VtxZHist"), RecCollision.posZ()); histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); - histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C(), RecCollision.trackOccupancyInTimeRange()); + auto OccupancyValue = IsApplyFT0CbasedOccupancy ? RecCollision.ft0cOccupancyInTimeRange() : RecCollision.trackOccupancyInTimeRange(); + histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C(), OccupancyValue); auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); for (auto& Rectrack : Rectrackspart) { @@ -464,7 +476,8 @@ struct HeavyIonMultiplicity { } histos.fill(HIST("VtxZHist"), RecCollision.posZ()); histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); - histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C(), RecCollision.trackOccupancyInTimeRange()); + auto OccupancyValue = IsApplyFT0CbasedOccupancy ? RecCollision.ft0cOccupancyInTimeRange() : RecCollision.trackOccupancyInTimeRange(); + histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C(), OccupancyValue); auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); for (auto& Rectrack : Rectrackspart) { @@ -503,7 +516,8 @@ struct HeavyIonMultiplicity { } histos.fill(HIST("VtxZHist"), RecCollision.posZ()); histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); - histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C(), RecCollision.trackOccupancyInTimeRange()); + auto OccupancyValue = IsApplyFT0CbasedOccupancy ? RecCollision.ft0cOccupancyInTimeRange() : RecCollision.trackOccupancyInTimeRange(); + histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C(), OccupancyValue); auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); std::vector mclabels; @@ -511,7 +525,7 @@ struct HeavyIonMultiplicity { if (!IsTrackSelected(Rectrack)) { continue; } - histos.fill(HIST("FillMCrecSpecies"), RecCollision.centFT0C(), RecCollision.trackOccupancyInTimeRange(), Rectrack.eta(), Double_t(kSpAll)); + histos.fill(HIST("FillMCrecSpecies"), RecCollision.centFT0C(), OccupancyValue, Rectrack.eta(), Double_t(kSpAll)); if (Rectrack.has_mcParticle()) { Int_t pid = kBkg; auto mcpart = Rectrack.template mcParticle_as(); @@ -543,9 +557,9 @@ struct HeavyIonMultiplicity { pid = kBkg; } mclabels.push_back(Rectrack.mcParticleId()); - histos.fill(HIST("FillMCrecSpecies"), RecCollision.centFT0C(), RecCollision.trackOccupancyInTimeRange(), Rectrack.eta(), Double_t(pid)); + histos.fill(HIST("FillMCrecSpecies"), RecCollision.centFT0C(), OccupancyValue, Rectrack.eta(), Double_t(pid)); } else { - histos.fill(HIST("FillMCrecSpecies"), RecCollision.centFT0C(), RecCollision.trackOccupancyInTimeRange(), Rectrack.eta(), Double_t(kBkg)); + histos.fill(HIST("FillMCrecSpecies"), RecCollision.centFT0C(), OccupancyValue, Rectrack.eta(), Double_t(kBkg)); } } // rec track loop diff --git a/PWGMM/UE/Tasks/ue-zdc-analysys.cxx b/PWGMM/UE/Tasks/ue-zdc-analysys.cxx index bb05d7d2540..ec5294f7248 100644 --- a/PWGMM/UE/Tasks/ue-zdc-analysys.cxx +++ b/PWGMM/UE/Tasks/ue-zdc-analysys.cxx @@ -355,10 +355,11 @@ struct ZDCAnalysis { float multFDA = 0; float multFDC = 0; if (foundBC.has_fdd()) { - for (auto amplitude : foundBC.fdd().chargeA()) { + auto const& fdd = foundBC.fdd(); + for (auto const& amplitude : fdd.chargeA()) { multFDA += amplitude; } - for (auto amplitude : foundBC.fdd().chargeC()) { + for (auto const& amplitude : fdd.chargeC()) { multFDC += amplitude; } } else { diff --git a/PWGMM/UE/Tasks/uecharged.cxx b/PWGMM/UE/Tasks/uecharged.cxx index 3db96c9dbac..12148212e49 100644 --- a/PWGMM/UE/Tasks/uecharged.cxx +++ b/PWGMM/UE/Tasks/uecharged.cxx @@ -53,7 +53,7 @@ struct ueCharged { selectedTracks.SetRequireTPCRefit(true); // selectedTracks.SetRequireGoldenChi2(true); selectedTracks.SetMinNCrossedRowsTPC(70); - selectedTracks.SetMinNCrossedRowsOverFindableClustersTPC(0.4f); + selectedTracks.SetMinNCrossedRowsOverFindableClustersTPC(0.8f); selectedTracks.SetMaxChi2PerClusterTPC(4.f); selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer selectedTracks.SetMaxChi2PerClusterITS(36.f); @@ -70,7 +70,7 @@ struct ueCharged { selectedTracks.SetRequireTPCRefit(true); // selectedTracks.SetRequireGoldenChi2(true); selectedTracks.SetMinNCrossedRowsTPC(70); - selectedTracks.SetMinNCrossedRowsOverFindableClustersTPC(0.4f); + selectedTracks.SetMinNCrossedRowsOverFindableClustersTPC(0.8f); selectedTracks.SetMaxChi2PerClusterTPC(4.f); selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer selectedTracks.SetMaxChi2PerClusterITS(36.f); @@ -86,7 +86,6 @@ struct ueCharged { float DeltaPhi(float phia, float phib, float rangeMin, float rangeMax); // Configurable for event selection Configurable isRun3{"isRun3", true, "is Run3 dataset"}; - Configurable timeEvsel{"timeEvsel", true, "TPC Time frame boundary cut"}; Configurable piluprejection{"piluprejection", true, "Pileup rejection"}; Configurable goodzvertex{"goodzvertex", true, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; @@ -199,7 +198,7 @@ void ueCharged::init(InitContext const&) ConfigurableAxis ptBinning{"ptBinning", {0, 0.0, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 40.0, 50.0}, "pTassoc bin limits"}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T}^{assoc} (GeV/#it{c})"}; - f_Eff.setObject(new TF1("fpara", "(x<0.3)*((0.221456)+x*(3.4271)+x*x*(-6.7668))+(x>=0.3&&x<2.1)*((0.610649)+(0.148627)*x+(-0.0772185)*x*x+(0.0157586)*x*x*x)+(x>=2.1)*(0.726557)", 0., 1e5)); + f_Eff.setObject(new TF1("fpara", "(x<0.3)*((0.283781)+x*(3.0492)+x*x*(-6.17018)) + (x>=0.3&&x<1.8)*((0.597121)+(0.200737)*x+(-0.11255)*x*x+(0.0242807)*x*x*x) + (x>=1.8&&x<14.)*((0.729892)+(0.0018516)*x+(0.000257896)*x*x+(-2.05202e-05)*x*x*x) + (x>=14)*(0.749313)", 0., 1e5)); if (doprocessMC) { ue.add("hPtOut", "pT all rec; pT; Nch", HistType::kTH1D, {ptAxis}); @@ -431,21 +430,16 @@ void ueCharged::processMeas(const C& collision, const T& tracks) ue.fill(HIST("hCounter"), 1); - if (timeEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - return; - } - - ue.fill(HIST("hCounter"), 2); if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; } - ue.fill(HIST("hCounter"), 3); + ue.fill(HIST("hCounter"), 2); if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } - ue.fill(HIST("hCounter"), 4); + ue.fill(HIST("hCounter"), 3); ue.fill(HIST("hStat"), collision.size()); auto vtxZ = collision.posZ(); @@ -454,7 +448,7 @@ void ueCharged::processMeas(const C& collision, const T& tracks) return; } - ue.fill(HIST("hCounter"), 5); + ue.fill(HIST("hCounter"), 4); ue.fill(HIST("hvtxZ"), vtxZ); @@ -726,28 +720,26 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part phiArrayTrue.clear(); indexArrayTrue.clear(); - if (!collision.sel8()) { + if (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { return; } ue.fill(HIST("hCounter"), 1); - // TODO:Implement time frame selection (only if MC includes this effect) - ue.fill(HIST("hCounter"), 2); if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; } + ue.fill(HIST("hCounter"), 2); - ue.fill(HIST("hCounter"), 3); if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } - ue.fill(HIST("hCounter"), 4); + ue.fill(HIST("hCounter"), 3); // only PS if ((std::abs(collision.posZ()) >= 10.f)) { return; } - ue.fill(HIST("hCounter"), 5); + ue.fill(HIST("hCounter"), 4); ue.fill(HIST(pNumDenTruePS[0]), flPtTrue, ue_true[0]); ue.fill(HIST(pSumPtTruePS[0]), flPtTrue, ue_true[3]); diff --git a/PWGUD/Core/DGPIDSelector.cxx b/PWGUD/Core/DGPIDSelector.cxx index afd3ff24b63..04dab87ef7a 100644 --- a/PWGUD/Core/DGPIDSelector.cxx +++ b/PWGUD/Core/DGPIDSelector.cxx @@ -8,7 +8,7 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - +#include #include #include "CommonConstants/PhysicsConstants.h" #include "DGPIDSelector.h" @@ -144,7 +144,7 @@ void DGAnaparHolder::Print() LOGF(info, " max alpha: %f", mMaxAlpha); LOGF(info, " min system pT: %f", mMinptsys); LOGF(info, " max system pT: %f", mMaxptsys); - LOGF(info, " nCombine: %d", mNCombine); + LOGF(info, " nCombine: %zu", mNCombine); LOGF(info, " unlike charges"); for (auto ch : mUnlikeCharges) { LOGF(info, " %i", ch); @@ -236,7 +236,7 @@ void DGAnaparHolder::Setptsys(float min, float max) mMaxptsys = max; } -void DGAnaparHolder::SetnCombine(int nComb) +void DGAnaparHolder::SetnCombine(std::size_t nComb) { mNCombine = nComb; } @@ -300,7 +300,7 @@ void DGAnaparHolder::makeUniquePermutations() auto hash = hasher(std::string(hashstr)); if (std::find(hashes.begin(), hashes.end(), hash) == hashes.end()) { hashes.push_back(hash); - for (auto ii = 0; ii < mNCombine; ii++) { + for (std::size_t ii = 0; ii < mNCombine; ii++) { muniquePerms.push_back(perm[ii]); } } @@ -523,7 +523,7 @@ std::vector> DGPIDSelector::combinations(int nPool) for (auto comb : combs) { for (auto ii = 0u; ii < numUniquePerms; ii++) { std::vector cope(mAnaPars.nCombine(), 0); - for (auto jj = 0; jj < mAnaPars.nCombine(); jj++) { + for (std::size_t jj = 0; jj < mAnaPars.nCombine(); jj++) { auto ind = ii * mAnaPars.nCombine() + jj; cope[uniquePerms[ind]] = comb[jj]; } diff --git a/PWGUD/Core/DGPIDSelector.h b/PWGUD/Core/DGPIDSelector.h index a4b0fcf145b..c130c2094ce 100644 --- a/PWGUD/Core/DGPIDSelector.h +++ b/PWGUD/Core/DGPIDSelector.h @@ -115,7 +115,7 @@ struct DGAnaparHolder { float mineta = -2.0, float maxeta = 2.0, float minalpha = 0.0, float maxalpha = 3.2, float minptsys = 0.0, float maxptsys = 100.0, - int nCombine = 2, + std::size_t nCombine = 2, std::vector netCharges = {0}, std::vector unlikeCharges = {0}, std::vector likeCharges = {-2, 2}, @@ -152,7 +152,7 @@ struct DGAnaparHolder { void Seteta(float, float); void SetAlpha(float, float); void Setptsys(float, float); - void SetnCombine(int); + void SetnCombine(std::size_t); void SetnetCharges(std::vector); void SetunlikeCharges(std::vector); void SetlikeCharges(std::vector); @@ -180,7 +180,7 @@ struct DGAnaparHolder { float maxAlpha() const { return mMaxAlpha; } float minptsys() const { return mMinptsys; } float maxptsys() const { return mMaxptsys; } - int nCombine() const { return mNCombine; } + std::size_t nCombine() const { return mNCombine; } std::vector netCharges() const { return mNetCharges; } std::vector unlikeCharges() const { return mUnlikeCharges; } std::vector likeCharges() const { return mLikeCharges; } @@ -216,7 +216,7 @@ struct DGAnaparHolder { float mMaxAlpha; float mMinptsys; float mMaxptsys; - int mNCombine; + std::size_t mNCombine; std::vector mNetCharges; // all PV tracks std::vector mUnlikeCharges; // selected PV tracks std::vector mLikeCharges; // selected PV tracks diff --git a/PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h b/PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h index df0f4d0c260..0857d6bab1d 100644 --- a/PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h +++ b/PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h @@ -16,21 +16,23 @@ #ifndef PWGUD_CORE_UPCJPSICENTRALBARRELCORRHELPER_H_ #define PWGUD_CORE_UPCJPSICENTRALBARRELCORRHELPER_H_ +#include #include #include "CommonConstants/MathConstants.h" +#include "random" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace std; -enum ParticleType { +/*enum ParticleType { P_ELECTRON = 0, P_MUON = 1, P_PROTON = 2 -}; +};*/ -template +/*template int testPIDhypoTPC(T trackPID) { float nSigmaTPC[3]; @@ -71,7 +73,7 @@ int testPIDhypo(T trackPID) } else { return -1; } -} +}*/ float* correlation(TLorentzVector* lv1, TLorentzVector* lv2, TLorentzVector* lv) { @@ -217,4 +219,19 @@ double DeltaPhi(TLorentzVector lv1, TLorentzVector lv2) return dp; } +double DeltaPhiRandom(TLorentzVector lv1, TLorentzVector lv2) +{ + std::vector indices = {0, 1}; + unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); + std::shuffle(indices.begin(), indices.end(), std::default_random_engine(seed)); + std::array arrayLorentz = {lv1, lv2}; + TLorentzVector lv_sum = arrayLorentz[indices[0]] + arrayLorentz[indices[1]]; + TLorentzVector lv_diff = arrayLorentz[indices[0]] - arrayLorentz[indices[1]]; + ; + + double dp = lv_sum.DeltaPhi(lv_diff); + + return dp; +} + #endif // PWGUD_CORE_UPCJPSICENTRALBARRELCORRHELPER_H_ diff --git a/PWGUD/Core/UPCTauCentralBarrelHelperRL.h b/PWGUD/Core/UPCTauCentralBarrelHelperRL.h index 4b757fdc963..a6147089ecc 100644 --- a/PWGUD/Core/UPCTauCentralBarrelHelperRL.h +++ b/PWGUD/Core/UPCTauCentralBarrelHelperRL.h @@ -19,16 +19,28 @@ #include #include -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - enum MyParticle { P_ELECTRON = 0, P_MUON = 1, P_PION = 2, P_KAON = 3, - P_PROTON = 4 + P_PROTON = 4, + P_ENUM_COUNTER = 5 +}; + +enum MyTauChannel { + CH_EE = 0, + CH_MUMU = 1, + CH_EMU = 2, + CH_PIPI = 3, + CH_EPI = 4, + CH_MUPI = 5, + CH_FOURPI = 6, + CH_ETHREEPI = 7, + CH_MUTHREEPI = 8, + CH_SIXPI = 9, + CH_EMUPI = 10, + CH_ENUM_COUNTER = 11 }; void printLargeMessage(std::string info) @@ -106,18 +118,18 @@ int testPIDhypothesis(T trackPIDinfo, float maxNsigmaTPC = 5.0, float maxNsigmaT } template -int trackPDG(T trackPIDinfo) +int trackPDG(T trackPIDinfo, float maxNsigmaTPC = 5.0, float maxNsigmaTOF = 5.0, bool useTOF = true, bool useTOFsigmaAfterTPC = true, float nSigmaShift = 0., bool isMC = false) // using testPIDhypothesis, reads enumMyParticle and return pdg value { - if (testPIDhypothesis(trackPIDinfo) == P_ELECTRON) { + if (testPIDhypothesis(trackPIDinfo, maxNsigmaTPC, maxNsigmaTOF, useTOF, useTOFsigmaAfterTPC, nSigmaShift, isMC) == P_ELECTRON) { return 11; - } else if (testPIDhypothesis(trackPIDinfo) == P_MUON) { + } else if (testPIDhypothesis(trackPIDinfo, maxNsigmaTPC, maxNsigmaTOF, useTOF, useTOFsigmaAfterTPC, nSigmaShift, isMC) == P_MUON) { return 13; - } else if (testPIDhypothesis(trackPIDinfo) == P_PION) { + } else if (testPIDhypothesis(trackPIDinfo, maxNsigmaTPC, maxNsigmaTOF, useTOF, useTOFsigmaAfterTPC, nSigmaShift, isMC) == P_PION) { return 211; - } else if (testPIDhypothesis(trackPIDinfo) == P_KAON) { + } else if (testPIDhypothesis(trackPIDinfo, maxNsigmaTPC, maxNsigmaTOF, useTOF, useTOFsigmaAfterTPC, nSigmaShift, isMC) == P_KAON) { return 321; - } else if (testPIDhypothesis(trackPIDinfo) == P_PROTON) { + } else if (testPIDhypothesis(trackPIDinfo, maxNsigmaTPC, maxNsigmaTOF, useTOF, useTOFsigmaAfterTPC, nSigmaShift, isMC) == P_PROTON) { return 2212; } else { printDebugMessage("Something is wrong with track PDG selector"); @@ -144,6 +156,12 @@ int enumMyParticle(int valuePDG) } } +float pt(float px, float py) +// Just a simple function to return pt +{ + return std::sqrt(px * px + py * py); +} + float momentum(float px, float py, float pz) // Just a simple function to return momentum { @@ -198,6 +216,32 @@ double calculateAcoplanarity(double phi_trk1, double phi_trk2) return (o2::constants::math::TwoPI - aco); } +template +int countPhysicalPrimary(Ps particles) +// Function to loop over particles associated to a mcCollision and return total of physical primary particles +{ + int nTotal = 0; + for (const auto& particle : particles) { + if (!particle.isPhysicalPrimary()) + continue; + nTotal++; + } + return nTotal; +} + +template +int countParticlesWithoutMother(Ps particles) +// Function to loop over particles associated to a mcCollision and return total of particles without mothers (hopely alternative to isPhysicalPrimary) +{ + int nTotal = 0; + for (const auto& particle : particles) { + if (particle.has_mothers()) + continue; + nTotal++; + } + return nTotal; +} + template float getAvgITSClSize(T const& track) { diff --git a/PWGUD/DataModel/SGTables.h b/PWGUD/DataModel/SGTables.h new file mode 100644 index 00000000000..e0896459fea --- /dev/null +++ b/PWGUD/DataModel/SGTables.h @@ -0,0 +1,71 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef PWGUD_DATAMODEL_SGTABLES_H_ +#define PWGUD_DATAMODEL_SGTABLES_H_ + +#include +#include +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/DataTypes.h" +#include "MathUtils/Utils.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +namespace o2::aod +{ +namespace sgevent +{ +DECLARE_SOA_COLUMN(Run, run, int32_t); +DECLARE_SOA_COLUMN(Flag, flag, int); +DECLARE_SOA_COLUMN(GS, gs, int); +DECLARE_SOA_COLUMN(ZNA, zna, float); +DECLARE_SOA_COLUMN(ZNC, znc, float); +DECLARE_SOA_COLUMN(Ntr, ntr, int); +} // namespace sgevent +DECLARE_SOA_TABLE(SGEvents, "AOD", "SGEVENT", // o2::soa::Index<>, + sgevent::Run, sgevent::Flag, sgevent::GS, sgevent::ZNA, sgevent::ZNC, sgevent::Ntr); +// sgevent::Run, sgevent::Flag); +using SGEvent = SGEvents::iterator; +namespace sgtrack +{ +DECLARE_SOA_INDEX_COLUMN(SGEvent, sgEvent); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(Sign, sign, float); +DECLARE_SOA_COLUMN(TPCpi, tpcpi, float); +DECLARE_SOA_COLUMN(TPCka, tpcka, float); +DECLARE_SOA_COLUMN(TPCpr, tpcpr, float); +DECLARE_SOA_COLUMN(TPCel, tpcel, float); +DECLARE_SOA_COLUMN(TOFpi, tofpi, float); +DECLARE_SOA_COLUMN(TOFka, tofka, float); +DECLARE_SOA_COLUMN(TOFpr, tofpr, float); +DECLARE_SOA_COLUMN(TOFel, tofel, float); +DECLARE_SOA_COLUMN(TPCmu, tpcmu, float); +DECLARE_SOA_COLUMN(TOFmu, tofmu, float); +DECLARE_SOA_COLUMN(TPCde, tpcde, float); +DECLARE_SOA_COLUMN(TPCtr, tpctr, float); +DECLARE_SOA_COLUMN(TPChe, tpche, float); +DECLARE_SOA_COLUMN(TPCal, tpcal, float); +DECLARE_SOA_COLUMN(TOFde, tofde, float); +DECLARE_SOA_COLUMN(TOFtr, toftr, float); +DECLARE_SOA_COLUMN(TOFhe, tofhe, float); +DECLARE_SOA_COLUMN(TOFal, tofal, float); +} // namespace sgtrack +DECLARE_SOA_TABLE(SGTracks, "AOD", "SGTRACK", + o2::soa::Index<>, sgtrack::SGEventId, + sgtrack::Pt, sgtrack::Eta, sgtrack::Phi, sgtrack::Sign, sgtrack::TPCpi, sgtrack::TPCka, sgtrack::TPCpr, sgtrack::TPCel, sgtrack::TOFpi, sgtrack::TOFka, sgtrack::TOFpr, sgtrack::TOFel, sgtrack::TPCmu, sgtrack::TOFmu, sgtrack::TPCde, sgtrack::TPCtr, sgtrack::TPChe, sgtrack::TPCal, sgtrack::TOFde, sgtrack::TOFtr, sgtrack::TOFhe, sgtrack::TOFal); +using SGTrack = SGTracks::iterator; +} // namespace o2::aod + +#endif // PWGUD_DATAMODEL_SGTABLES_H_ diff --git a/PWGUD/DataModel/UDTables.h b/PWGUD/DataModel/UDTables.h index e83f3c5daa2..8c5a796a578 100644 --- a/PWGUD/DataModel/UDTables.h +++ b/PWGUD/DataModel/UDTables.h @@ -29,7 +29,7 @@ namespace udmccollision DECLARE_SOA_COLUMN(GlobalBC, globalBC, uint64_t); //! } // namespace udmccollision -DECLARE_SOA_TABLE(UDMcCollisions, "AOD", "UDMCCOLLISIONS", +DECLARE_SOA_TABLE(UDMcCollisions, "AOD", "UDMCCOLLISION", o2::soa::Index<>, udmccollision::GlobalBC, mccollision::GeneratorsID, @@ -53,7 +53,7 @@ DECLARE_SOA_COLUMN(Pz, pz, float); //! DECLARE_SOA_COLUMN(E, e, float); //! } // namespace udmcparticle -DECLARE_SOA_TABLE_FULL(UDMcParticles, "UDMcParticles", "AOD", "UDMCPARTICLES", //! +DECLARE_SOA_TABLE_FULL(UDMcParticles, "UDMcParticles", "AOD", "UDMCPARTICLE", //! o2::soa::Index<>, udmcparticle::UDMcCollisionId, mcparticle::PdgCode, mcparticle::StatusCode, @@ -86,16 +86,21 @@ DECLARE_SOA_COLUMN(TotalFT0AmplitudeC, totalFT0AmplitudeC, float); //! sum of am DECLARE_SOA_COLUMN(TimeFT0A, timeFT0A, float); //! FT0A average time DECLARE_SOA_COLUMN(TimeFT0C, timeFT0C, float); //! FT0C average time DECLARE_SOA_COLUMN(TriggerMaskFT0, triggerMaskFT0, uint8_t); //! FT0 trigger mask +DECLARE_SOA_COLUMN(ChFT0A, chFT0A, uint8_t); //! number of FT0A active channels +DECLARE_SOA_COLUMN(ChFT0C, chFT0C, uint8_t); //! number of FT0C active channels // FDD information DECLARE_SOA_COLUMN(TotalFDDAmplitudeA, totalFDDAmplitudeA, float); //! sum of amplitudes on A side of FDD DECLARE_SOA_COLUMN(TotalFDDAmplitudeC, totalFDDAmplitudeC, float); //! sum of amplitudes on C side of FDD DECLARE_SOA_COLUMN(TimeFDDA, timeFDDA, float); //! FDDA average time DECLARE_SOA_COLUMN(TimeFDDC, timeFDDC, float); //! FDDC average time DECLARE_SOA_COLUMN(TriggerMaskFDD, triggerMaskFDD, uint8_t); //! FDD trigger mask +DECLARE_SOA_COLUMN(ChFDDA, chFDDA, uint8_t); //! number of FDDA active channels +DECLARE_SOA_COLUMN(ChFDDC, chFDDC, uint8_t); //! number of FDDC active channels // FV0A information DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); //! sum of amplitudes on A side of FDD DECLARE_SOA_COLUMN(TimeFV0A, timeFV0A, float); //! FV0A average time DECLARE_SOA_COLUMN(TriggerMaskFV0A, triggerMaskFV0A, uint8_t); //! FV0 trigger mask +DECLARE_SOA_COLUMN(ChFV0A, chFV0A, uint8_t); //! number of FV0A active channels // Gap Side Information DECLARE_SOA_COLUMN(GapSide, gapSide, uint8_t); // 0 for side A, 1 for side C, 2 for both sides (or use an enum for better readability) // FIT selection flags @@ -198,6 +203,13 @@ DECLARE_SOA_TABLE(UDCollisionsSels, "AOD", "UDCOLLISIONSEL", udcollision::BBFV0A, udcollision::BGFV0A, udcollision::BBFDDA, udcollision::BBFDDC, udcollision::BGFDDA, udcollision::BGFDDC); +DECLARE_SOA_TABLE(UDCollisionSelExtras, "AOD", "UDCOLSELEXTRA", + udcollision::ChFT0A, //! number of active channels in FT0A + udcollision::ChFT0C, //! number of active channels in FT0C + udcollision::ChFDDA, //! number of active channels in FDDA + udcollision::ChFDDC, //! number of active channels in FDDC + udcollision::ChFV0A); //! number of active channels in FV0A + // central barrel-specific selections DECLARE_SOA_TABLE(UDCollisionsSelsCent, "AOD", "UDCOLSELCNT", udcollision::DBcTOR, @@ -227,6 +239,7 @@ using SGCollision = SGCollisions::iterator; using UDCollisionsSel = UDCollisionsSels::iterator; using UDCollisionsSelCent = UDCollisionsSelsCent::iterator; using UDCollisionsSelFwd = UDCollisionsSelsFwd::iterator; +using UDCollisionSelExtra = UDCollisionSelExtras::iterator; using UDCollsLabel = UDCollsLabels::iterator; using UDMcCollsLabel = UDMcCollsLabels::iterator; @@ -278,6 +291,10 @@ DECLARE_SOA_TABLE(UDTracksPID, "AOD", "UDTRACKPID", pidtofbeta::Beta, pidtofbeta::BetaError, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaMu, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr); +DECLARE_SOA_TABLE(UDTracksPIDExtra, "AOD", "UDTRACKPIDEXTRA", + pidtpc::TPCNSigmaDe, pidtpc::TPCNSigmaTr, pidtpc::TPCNSigmaHe, pidtpc::TPCNSigmaAl, + pidtof::TOFNSigmaDe, pidtof::TOFNSigmaTr, pidtof::TOFNSigmaHe, pidtof::TOFNSigmaAl); + DECLARE_SOA_TABLE(UDTracksExtra, "AOD", "UDTRACKEXTRA", track::TPCInnerParam, track::ITSClusterSizes, diff --git a/PWGUD/TableProducer/DGCandProducer.cxx b/PWGUD/TableProducer/DGCandProducer.cxx index 65fe9c3173c..027cfd376ee 100644 --- a/PWGUD/TableProducer/DGCandProducer.cxx +++ b/PWGUD/TableProducer/DGCandProducer.cxx @@ -12,6 +12,9 @@ // \brief Saves relevant information of DG candidates // \author Paul Buehler, paul.buehler@oeaw.ac.at +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "ReconstructionDataFormats/Vertex.h" @@ -375,7 +378,8 @@ struct McDGCandProducer { void updateUDMcCollisions(TMcCollision const& mccol) { // save mccol - outputMcCollisions(mccol.bcId(), + auto bc = mccol.template bc_as(); + outputMcCollisions(bc.globalBC(), mccol.generatorsID(), mccol.posX(), mccol.posY(), @@ -577,7 +581,6 @@ struct McDGCandProducer { auto dgcandAtEnd = dgcand == lastdgcand; auto mccolAtEnd = mccol == lastmccol; bool goon = !dgcandAtEnd || !mccolAtEnd; - int counter = 0; while (goon) { // check if dgcand has an associated Collision and McCollision @@ -621,7 +624,6 @@ struct McDGCandProducer { // update UDMcColsLabels (for each UDCollision -> UDMcCollisions) LOGF(debug, " writing %d to outputMcCollsLabels", mcColIsSaved[mcdgId]); outputMcCollsLabels(mcColIsSaved[mcdgId]); - counter++; // update UDMcParticles auto mcPartsSlice = mcparts.sliceBy(mcPartsPerMcCollision, mcdgId); @@ -637,7 +639,6 @@ struct McDGCandProducer { // update UDMcColsLabels (for each UDCollision -> UDMcCollisions) LOGF(debug, " writing %d to UDMcCollsLabels", -1); outputMcCollsLabels(-1); - counter++; // update UDMcParticles and UDMcTrackLabels (for each UDTrack -> UDMcParticles) // loop over tracks of dgcand diff --git a/PWGUD/TableProducer/SGCandProducer.cxx b/PWGUD/TableProducer/SGCandProducer.cxx index feb0e93f2f0..967e7a838d0 100644 --- a/PWGUD/TableProducer/SGCandProducer.cxx +++ b/PWGUD/TableProducer/SGCandProducer.cxx @@ -10,6 +10,8 @@ // or submit itself to any jurisdiction. #include +#include +#include #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "ReconstructionDataFormats/Vertex.h" @@ -32,6 +34,7 @@ struct SGCandProducer { // get an SGCutparHolder SGCutParHolder sameCuts = SGCutParHolder(); // SGCutparHolder Configurable SGCuts{"SGCuts", {}, "SG event cuts"}; + Configurable verboseInfo{"verboseInfo", false, "Print general info to terminal; default it false."}; Configurable saveAllTracks{"saveAllTracks", true, "save only PV contributors or all tracks associated to a collision"}; Configurable savenonPVCITSOnlyTracks{"savenonPVCITSOnlyTracks", false, "save non PV contributors with ITS only information"}; Configurable rejectAtTFBoundary{"rejectAtTFBoundary", true, "reject collisions at a TF boundary"}; @@ -58,6 +61,7 @@ struct SGCandProducer { Produces outputTracksCov; Produces outputTracksDCA; Produces outputTracksPID; + Produces outputTracksPIDExtra; Produces outputTracksExtra; Produces outputTracksFlag; Produces outputFwdTracks; @@ -76,7 +80,9 @@ struct SGCandProducer { using BC = BCs::iterator; using TCs = soa::Join; using FWs = aod::FwdTracks; @@ -127,6 +133,14 @@ struct SGCandProducer { track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()); + outputTracksPIDExtra(track.tpcNSigmaDe(), + track.tpcNSigmaTr(), + track.tpcNSigmaHe(), + track.tpcNSigmaAl(), + track.tofNSigmaDe(), + track.tofNSigmaTr(), + track.tofNSigmaHe(), + track.tofNSigmaAl()); outputTracksExtra(track.tpcInnerParam(), track.itsClusterSizes(), track.tpcNClsFindable(), @@ -159,7 +173,8 @@ struct SGCandProducer { void process(CC const& collision, BCs const& bcs, TCs& tracks, FWs& fwdtracks, aod::Zdcs& /*zdcs*/, aod::FT0s& ft0s, aod::FV0As& fv0as, aod::FDDs& fdds) { - LOGF(debug, " collision %d", collision.globalIndex()); + if (verboseInfo) + LOGF(debug, " collision %d", collision.globalIndex()); registry.get(HIST("reco/Stat"))->Fill(0., 1.); // reject collisions at TF boundaries if (rejectAtTFBoundary && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { @@ -202,11 +217,13 @@ struct SGCandProducer { if (isSGEvent.bc && issgevent < 2) { newbc = *(isSGEvent.bc); } else { - LOGF(info, "No Newbc %i", bc.globalBC()); + if (verboseInfo) + LOGF(info, "No Newbc %i", bc.globalBC()); } registry.get(HIST("reco/Stat"))->Fill(issgevent + 8, 1.); if (issgevent <= 2) { - // LOGF(info, "Current BC: %i, %i, %i", bc.globalBC(), newbc.globalBC(), issgevent); + if (verboseInfo) + LOGF(info, "Current BC: %i, %i, %i", bc.globalBC(), newbc.globalBC(), issgevent); if (sameCuts.minRgtrwTOF()) { if (udhelpers::rPVtrwTOF(tracks, collision.numContrib()) < sameCuts.minRgtrwTOF()) return; @@ -268,6 +285,7 @@ struct SGCandProducer { struct McSGCandProducer { // MC tables + Configurable verboseInfoMC{"verboseInfoMC", false, "Print general info to terminal; default it false."}; Produces outputMcCollisions; Produces outputMcParticles; Produces outputMcCollsLabels; @@ -290,10 +308,10 @@ struct McSGCandProducer { {}}; template - void updateUDMcCollisions(TMcCollision const& mccol) + void updateUDMcCollisions(TMcCollision const& mccol, uint64_t globBC) { // save mccol - outputMcCollisions(mccol.bcId(), + outputMcCollisions(globBC, mccol.generatorsID(), mccol.posX(), mccol.posY(), @@ -361,7 +379,8 @@ struct McSGCandProducer { auto oldmids = mcpart.mothersIds(); for (auto oldmid : oldmids) { auto m = McParts.rawIteratorAt(oldmid); - LOGF(debug, " m %d", m.globalIndex()); + if (verboseInfoMC) + LOGF(debug, " m %d", m.globalIndex()); if (mcPartIsSaved.find(oldmid) != mcPartIsSaved.end()) { newval = mcPartIsSaved[oldmid]; } else { @@ -379,7 +398,8 @@ struct McSGCandProducer { } newdids[ii] = newval; } - LOGF(debug, " ms %i ds %i", oldmids.size(), olddids.size()); + if (verboseInfoMC) + LOGF(debug, " ms %i ds %i", oldmids.size(), olddids.size()); // update UDMcParticles outputMcParticles(McCollisionId, @@ -461,11 +481,14 @@ struct McSGCandProducer { UDCCs const& sgcands, UDTCs const& udtracks, CCs const& /*collisions*/, BCs const& /*bcs*/, TCs const& /*tracks*/) { - LOGF(info, "Number of McCollisions %d", mccols.size()); - LOGF(info, "Number of SG candidates %d", sgcands.size()); - LOGF(info, "Number of UD tracks %d", udtracks.size()); + if (verboseInfoMC) { + LOGF(info, "Number of McCollisions %d", mccols.size()); + LOGF(info, "Number of SG candidates %d", sgcands.size()); + LOGF(info, "Number of UD tracks %d", udtracks.size()); + } if (sgcands.size() <= 0) { - LOGF(info, "No DG candidates to save!"); + if (verboseInfoMC) + LOGF(info, "No DG candidates to save!"); return; } @@ -489,8 +512,10 @@ struct McSGCandProducer { auto sgcandAtEnd = sgcand == lastsgcand; auto mccolAtEnd = mccol == lastmccol; bool goon = !sgcandAtEnd || !mccolAtEnd; - int counter = 0; while (goon) { + auto bcIter = mccol.bc_as(); + uint64_t globBC = bcIter.globalBC(); + // uint64_t globBC = 0; // check if dgcand has an associated McCollision if (sgcand.has_collision()) { auto sgcandCol = sgcand.collision_as(); @@ -504,14 +529,16 @@ struct McSGCandProducer { // colId = -1; mcsgId = -1; } - LOGF(info, "\nStart of loop mcsgId %d mccolId %d", mcsgId, mccolId); + if (verboseInfoMC) + LOGF(info, "\nStart of loop mcsgId %d mccolId %d", mcsgId, mccolId); // two cases to consider // 1. mcdgId <= mccolId: the event to process is a dgcand. In this case the Mc tables as well as the McLabel tables are updated // 2. mccolId < mcdgId: the event to process is an MC event of interest without reconstructed dgcand. In this case only the Mc tables are updated if ((!sgcandAtEnd && !mccolAtEnd && (mcsgId <= mccolId)) || mccolAtEnd) { // this is case 1. - // LOGF(info, "Doing case 1 with mcsgId %d", mcsgId); + if (verboseInfoMC) + LOGF(info, "Doing case 1 with mcsgId %d", mcsgId); // update UDMcCollisions and UDMcColsLabels (for each UDCollision -> UDMcCollisions) // update UDMcParticles and UDMcTrackLabels (for each UDTrack -> UDMcParticles) @@ -522,16 +549,16 @@ struct McSGCandProducer { // McParticles are saved if (mcsgId >= 0) { if (mcColIsSaved.find(mcsgId) == mcColIsSaved.end()) { - LOGF(info, " Saving McCollision %d", mcsgId); + if (verboseInfoMC) + LOGF(info, " Saving McCollision %d", mcsgId); // update UDMcCollisions auto sgcandMcCol = sgcand.collision_as().mcCollision(); - updateUDMcCollisions(sgcandMcCol); + updateUDMcCollisions(sgcandMcCol, globBC); mcColIsSaved[mcsgId] = outputMcCollisions.lastIndex(); } // update UDMcColsLabels (for each UDCollision -> UDMcCollisions) outputMcCollsLabels(mcColIsSaved[mcsgId]); - counter++; // update UDMcParticles auto mcPartsSlice = mcparts.sliceBy(mcPartsPerMcCollision, mcsgId); @@ -543,11 +570,11 @@ struct McSGCandProducer { } else { // If the sgcand has no associated McCollision then only the McParticles which are associated // with the tracks of the sgcand are saved - // LOGF(info, " Saving McCollision %d", -1); + if (verboseInfoMC) + LOGF(info, " Saving McCollision %d", -1); // update UDMcColsLabels (for each UDCollision -> UDMcCollisions) outputMcCollsLabels(-1); - counter++; // update UDMcParticles and UDMcTrackLabels (for each UDTrack -> UDMcParticles) // loop over tracks of dgcand @@ -574,13 +601,15 @@ struct McSGCandProducer { } } else { // this is case 2. - LOGF(info, "Doing case 2"); + if (verboseInfoMC) + LOGF(info, "Doing case 2"); // update UDMcCollisions and UDMcParticles if (mcColIsSaved.find(mccolId) == mcColIsSaved.end()) { - LOGF(info, " Saving McCollision %d", mccolId); + if (verboseInfoMC) + LOGF(info, " Saving McCollision %d", mccolId); // update UDMcCollisions - updateUDMcCollisions(mccol); + updateUDMcCollisions(mccol, globBC); mcColIsSaved[mccolId] = outputMcCollisions.lastIndex(); // update UDMcParticles @@ -598,14 +627,16 @@ struct McSGCandProducer { } goon = !sgcandAtEnd || !mccolAtEnd; - // LOGF(info, "End of loop mcsgId %d mccolId %d", mcsgId, mccolId); + if (verboseInfoMC) + LOGF(info, "End of loop mcsgId %d mccolId %d", mcsgId, mccolId); } } PROCESS_SWITCH(McSGCandProducer, processMC, "Produce MC tables", false); void processDummy(aod::Collisions const& /*collisions*/) { // do nothing - LOGF(info, "Running dummy process function!"); + if (verboseInfoMC) + LOGF(info, "Running dummy process function!"); } PROCESS_SWITCH(McSGCandProducer, processDummy, "Dummy function", true); }; diff --git a/PWGUD/TableProducer/UPCCandidateProducer.cxx b/PWGUD/TableProducer/UPCCandidateProducer.cxx index 68af4e17284..5eba6e0c2ef 100644 --- a/PWGUD/TableProducer/UPCCandidateProducer.cxx +++ b/PWGUD/TableProducer/UPCCandidateProducer.cxx @@ -12,6 +12,13 @@ /// \author Diana Krupova, diana.krupova@cern.ch /// \since 04.06.2024 +#include +#include +#include +#include +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -53,6 +60,7 @@ struct UpcCandProducer { Produces eventCandidatesSels; Produces eventCandidatesSelsCent; Produces eventCandidatesSelsFwd; + Produces eventCandidatesSelExtras; Produces udZdcsReduced; @@ -73,7 +81,7 @@ struct UpcCandProducer { Configurable fFilterTVX{"filterTVX", -1, "Filter candidates by FT0 TVX"}; Configurable fFilterFV0{"filterFV0", -1, "Filter candidates by FV0A"}; - Configurable fBCWindowFITAmps{"bcWindowFITAmps", 20, "BC range for T0A/V0A amplitudes array [-range, +(range-1)]"}; + Configurable fBCWindowFITAmps{"bcWindowFITAmps", 20, "BC range for T0A/V0A amplitudes array [-range, +(range-1)]"}; Configurable fBcWindowMCH{"bcWindowMCH", 20, "Time window for MCH-MID to MCH-only matching for Muon candidates"}; Configurable fBcWindowITSTPC{"bcWindowITSTPC", 20, "Time window for TOF/ITS-TPC to ITS-TPC matching for Central candidates"}; @@ -87,6 +95,9 @@ struct UpcCandProducer { Configurable fSearchITSTPC{"searchITSTPC", 0, "Search for ITS-TPC tracks near candidates"}; Configurable fSearchRangeITSTPC{"searchRangeITSTPC", 50, "BC range for ITS-TPC tracks search wrt TOF tracks"}; + Configurable fMinEtaMFT{"minEtaMFT", -3.6, "Minimum eta for MFT tracks"}; + Configurable fMaxEtaMFT{"maxEtaMFT", -2.5, "Maximum eta for MFT tracks"}; + // QA histograms HistogramRegistry histRegistry{"HistRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -873,7 +884,7 @@ struct UpcCandProducer { for (auto& pair : bcsMatchedTrIdsTOF) { auto globalBC = pair.first; auto& barrelTrackIDs = pair.second; - int32_t nTOFs = barrelTrackIDs.size(); + uint32_t nTOFs = barrelTrackIDs.size(); if (nTOFs > fNBarProngs) // too many tracks continue; auto closestBcITSTPC = std::numeric_limits::max(); @@ -887,7 +898,7 @@ struct UpcCandProducer { if (std::abs(distClosestBcITSTPC) > fBcWindowITSTPC) continue; auto& itstpcTracks = itClosestBcITSTPC->second; - int32_t nITSTPCs = itstpcTracks.size(); + uint32_t nITSTPCs = itstpcTracks.size(); if ((nTOFs + nITSTPCs) != fNBarProngs) continue; barrelTrackIDs.insert(barrelTrackIDs.end(), itstpcTracks.begin(), itstpcTracks.end()); @@ -942,7 +953,7 @@ struct UpcCandProducer { for (auto& pair : bcsMatchedTrIdsITSTPC) { auto globalBC = pair.first; auto& barrelTrackIDs = pair.second; - int32_t nThisITSTPCs = barrelTrackIDs.size(); + uint32_t nThisITSTPCs = barrelTrackIDs.size(); if (nThisITSTPCs > fNBarProngs || nThisITSTPCs == 0) // too many tracks / already matched to TOF continue; auto closestBcITSTPC = std::numeric_limits::max(); @@ -956,7 +967,7 @@ struct UpcCandProducer { if (std::abs(distClosestBcITSTPC) > fBcWindowITSTPC) continue; auto& itstpcTracks = itClosestBcITSTPC->second; - int32_t nITSTPCs = itstpcTracks.size(); + uint32_t nITSTPCs = itstpcTracks.size(); if ((nThisITSTPCs + nITSTPCs) != fNBarProngs) continue; barrelTrackIDs.insert(barrelTrackIDs.end(), itstpcTracks.begin(), itstpcTracks.end()); @@ -1197,7 +1208,7 @@ struct UpcCandProducer { const std::map& mapBCs, std::vector& amps, std::vector& relBCs, - int64_t gbc) + uint64_t gbc) { auto s = gbc - fBCWindowFITAmps; auto e = gbc + (fBCWindowFITAmps - 1); @@ -1230,7 +1241,7 @@ struct UpcCandProducer { TBCs const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, - o2::aod::FDDs const& /*fdds*/, + o2::aod::FDDs const& fdds, o2::aod::FV0As const& fv0as, o2::aod::Zdcs const& zdcs, const o2::aod::McFwdTrackLabels* mcFwdTrackLabels) @@ -1294,10 +1305,29 @@ struct UpcCandProducer { mapGlobalBcWithZdc[globalBC] = zdc.globalIndex(); } + std::map mapGlobalBcWithFDD{}; + uint8_t twoLayersA = 0; + uint8_t twoLayersC = 0; + for (const auto& fdd : fdds) { + // get signal coincidence + for (int i = 0; i < 4; i++) { + if (fdd.chargeA()[i + 4] > 0 && fdd.chargeA()[i] > 0) + twoLayersA++; + if (fdd.chargeC()[i + 4] > 0 && fdd.chargeC()[i] > 0) + twoLayersC++; + } + // if no signal, continue + if ((twoLayersA == 0) && (twoLayersC == 0)) + continue; + uint64_t globalBC = fdd.bc_as().globalBC(); + mapGlobalBcWithFDD[globalBC] = fdd.globalIndex(); + } + auto nFT0s = mapGlobalBcWithT0A.size(); auto nFV0As = mapGlobalBcWithV0A.size(); auto nZdcs = mapGlobalBcWithZdc.size(); auto nBcsWithMCH = bcsMatchedTrIdsMCH.size(); + auto nFDDs = mapGlobalBcWithFDD.size(); // todo: calculate position of UD collision? float dummyX = 0.; @@ -1314,7 +1344,7 @@ struct UpcCandProducer { for (auto& pair : bcsMatchedTrIdsMID) { // candidates without MFT auto globalBC = static_cast(pair.first); const auto& fwdTrackIDs = pair.second; // only MID-matched tracks at the moment - int32_t nMIDs = fwdTrackIDs.size(); + uint32_t nMIDs = fwdTrackIDs.size(); if (nMIDs > fNFwdProngs) // too many tracks continue; std::vector trkCandIDs{}; @@ -1329,7 +1359,7 @@ struct UpcCandProducer { if (std::abs(distClosestBcMCH) > fBcWindowMCH) continue; auto& mchTracks = itClosestBcMCH->second; - int32_t nMCHs = mchTracks.size(); + uint32_t nMCHs = mchTracks.size(); if ((nMCHs + nMIDs) != fNFwdProngs) continue; trkCandIDs.insert(trkCandIDs.end(), fwdTrackIDs.begin(), fwdTrackIDs.end()); @@ -1346,6 +1376,8 @@ struct UpcCandProducer { std::vector amplitudesV0A{}; std::vector relBCsT0A{}; std::vector relBCsV0A{}; + uint8_t chFT0A = 0; + uint8_t chFT0C = 0; if (nFT0s > 0) { uint64_t closestBcT0A = findClosestBC(globalBC, mapGlobalBcWithT0A); int64_t distClosestBcT0A = globalBC - static_cast(closestBcT0A); @@ -1360,8 +1392,11 @@ struct UpcCandProducer { const auto& t0AmpsC = ft0.amplitudeC(); fitInfo.ampFT0A = std::accumulate(t0AmpsA.begin(), t0AmpsA.end(), 0.f); fitInfo.ampFT0C = std::accumulate(t0AmpsC.begin(), t0AmpsC.end(), 0.f); + chFT0A = ft0.amplitudeA().size(); + chFT0C = ft0.amplitudeC().size(); fillAmplitudes(ft0s, mapGlobalBcWithT0A, amplitudesT0A, relBCsT0A, globalBC); } + uint8_t chFV0A = 0; if (nFV0As > 0) { uint64_t closestBcV0A = findClosestBC(globalBC, mapGlobalBcWithV0A); int64_t distClosestBcV0A = globalBC - static_cast(closestBcV0A); @@ -1373,8 +1408,32 @@ struct UpcCandProducer { fitInfo.timeFV0A = fv0a.time(); const auto& v0Amps = fv0a.amplitude(); fitInfo.ampFV0A = std::accumulate(v0Amps.begin(), v0Amps.end(), 0.f); + chFV0A = fv0a.amplitude().size(); fillAmplitudes(fv0as, mapGlobalBcWithV0A, amplitudesV0A, relBCsV0A, globalBC); } + uint8_t chFDDA = 0; + uint8_t chFDDC = 0; + if (nFDDs > 0) { + uint64_t closestBcFDD = findClosestBC(globalBC, mapGlobalBcWithFDD); + auto fddId = mapGlobalBcWithFDD.at(closestBcFDD); + auto fdd = fdds.iteratorAt(fddId); + fitInfo.timeFDDA = fdd.timeA(); + fitInfo.timeFDDC = fdd.timeC(); + fitInfo.ampFDDA = 0; + for (int i = 0; i < 8; i++) + fitInfo.ampFDDA += fdd.chargeA()[i]; + fitInfo.ampFDDC = 0; + for (int i = 0; i < 8; i++) + fitInfo.ampFDDC += fdd.chargeC()[i]; + fitInfo.triggerMaskFDD = fdd.triggerMask(); + // get signal coincidence + for (int i = 0; i < 4; i++) { + if (fdd.chargeA()[i + 4] > 0 && fdd.chargeA()[i] > 0) + chFDDA++; + if (fdd.chargeC()[i + 4] > 0 && fdd.chargeC()[i] > 0) + chFDDC++; + } + } if (nZdcs > 0) { auto itZDC = mapGlobalBcWithZdc.find(globalBC); if (itZDC != mapGlobalBcWithZdc.end()) { @@ -1407,6 +1466,7 @@ struct UpcCandProducer { fitInfo.BBFT0Apf, fitInfo.BBFT0Cpf, fitInfo.BGFT0Apf, fitInfo.BGFT0Cpf, fitInfo.BBFV0Apf, fitInfo.BGFV0Apf, fitInfo.BBFDDApf, fitInfo.BBFDDCpf, fitInfo.BGFDDApf, fitInfo.BGFDDCpf); + eventCandidatesSelExtras(chFT0A, chFT0C, chFDDA, chFDDC, chFV0A); eventCandidatesSelsFwd(fitInfo.distClosestBcV0A, fitInfo.distClosestBcT0A, amplitudesT0A, @@ -1425,6 +1485,7 @@ struct UpcCandProducer { bcsMatchedTrIdsMCH.clear(); mapGlobalBcWithT0A.clear(); mapGlobalBcWithV0A.clear(); + mapGlobalBcWithFDD.clear(); } template @@ -1434,7 +1495,7 @@ struct UpcCandProducer { TBCs const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, - o2::aod::FDDs const& /*fdds*/, + o2::aod::FDDs const& fdds, o2::aod::FV0As const& fv0as, o2::aod::Zdcs const& zdcs, const o2::aod::McFwdTrackLabels* mcFwdTrackLabels) @@ -1507,9 +1568,28 @@ struct UpcCandProducer { mapGlobalBcWithZdc[globalBC] = zdc.globalIndex(); } + std::map mapGlobalBcWithFDD{}; + uint8_t twoLayersA = 0; + uint8_t twoLayersC = 0; + for (const auto& fdd : fdds) { + // get signal coincidence + for (int i = 0; i < 4; i++) { + if (fdd.chargeA()[i + 4] > 0 && fdd.chargeA()[i] > 0) + twoLayersA++; + if (fdd.chargeC()[i + 4] > 0 && fdd.chargeC()[i] > 0) + twoLayersC++; + } + // if no signal, continue + if ((twoLayersA == 0) && (twoLayersC == 0)) + continue; + uint64_t globalBC = fdd.bc_as().globalBC(); + mapGlobalBcWithFDD[globalBC] = fdd.globalIndex(); + } + auto nFT0s = mapGlobalBcWithT0A.size(); auto nFV0As = mapGlobalBcWithV0A.size(); auto nZdcs = mapGlobalBcWithZdc.size(); + auto nFDDs = mapGlobalBcWithFDD.size(); // todo: calculate position of UD collision? float dummyX = 0.; @@ -1522,17 +1602,25 @@ struct UpcCandProducer { // storing n-prong matches int32_t candID = 0; - + auto midIt = bcsMatchedTrIdsMID.begin(); for (auto& pair : bcsMatchedTrIdsGlobal) { // candidates with MFT auto globalBC = static_cast(pair.first); const auto& fwdTrackIDs = pair.second; - int32_t nMFTs = fwdTrackIDs.size(); + uint32_t nMFTs = fwdTrackIDs.size(); if (nMFTs > fNFwdProngs) // too many tracks continue; std::vector trkCandIDs{}; - + const auto& midTrackIDs = midIt->second; // to retrieve corresponding MCH-MID tracks if (nMFTs == fNFwdProngs) { - trkCandIDs.insert(trkCandIDs.end(), fwdTrackIDs.begin(), fwdTrackIDs.end()); + for (auto iMft : fwdTrackIDs) { + auto trk = fwdTracks.iteratorAt(iMft); + auto trkEta = trk.eta(); + if (trkEta > fMinEtaMFT && trkEta < fMaxEtaMFT) { // If the track is in the MFT acceptance, store the global track + trkCandIDs.insert(trkCandIDs.end(), fwdTrackIDs.begin(), fwdTrackIDs.end()); + } else { // If the track is not in the MFT acceptance, store the MCH-MID track + trkCandIDs.insert(trkCandIDs.end(), midTrackIDs.begin(), midTrackIDs.end()); + } + } } uint64_t closestBcMCH = 0; upchelpers::FITInfo fitInfo{}; @@ -1546,6 +1634,8 @@ struct UpcCandProducer { std::vector amplitudesV0A{}; std::vector relBCsT0A{}; std::vector relBCsV0A{}; + uint8_t chFT0A = 0; + uint8_t chFT0C = 0; if (nFT0s > 0) { uint64_t closestBcT0A = findClosestBC(globalBC, mapGlobalBcWithT0A); int64_t distClosestBcT0A = globalBC - static_cast(closestBcT0A); @@ -1560,8 +1650,11 @@ struct UpcCandProducer { const auto& t0AmpsC = ft0.amplitudeC(); fitInfo.ampFT0A = std::accumulate(t0AmpsA.begin(), t0AmpsA.end(), 0.f); fitInfo.ampFT0C = std::accumulate(t0AmpsC.begin(), t0AmpsC.end(), 0.f); + chFT0A = ft0.amplitudeA().size(); + chFT0C = ft0.amplitudeC().size(); fillAmplitudes(ft0s, mapGlobalBcWithT0A, amplitudesT0A, relBCsT0A, globalBC); } + uint8_t chFV0A = 0; if (nFV0As > 0) { uint64_t closestBcV0A = findClosestBC(globalBC, mapGlobalBcWithV0A); int64_t distClosestBcV0A = globalBC - static_cast(closestBcV0A); @@ -1573,8 +1666,32 @@ struct UpcCandProducer { fitInfo.timeFV0A = fv0a.time(); const auto& v0Amps = fv0a.amplitude(); fitInfo.ampFV0A = std::accumulate(v0Amps.begin(), v0Amps.end(), 0.f); + chFV0A = fv0a.amplitude().size(); fillAmplitudes(fv0as, mapGlobalBcWithV0A, amplitudesV0A, relBCsV0A, globalBC); } + uint8_t chFDDA = 0; + uint8_t chFDDC = 0; + if (nFDDs > 0) { + uint64_t closestBcFDD = findClosestBC(globalBC, mapGlobalBcWithFDD); + auto fddId = mapGlobalBcWithFDD.at(closestBcFDD); + auto fdd = fdds.iteratorAt(fddId); + fitInfo.timeFDDA = fdd.timeA(); + fitInfo.timeFDDC = fdd.timeC(); + fitInfo.ampFDDA = 0; + for (int i = 0; i < 8; i++) + fitInfo.ampFDDA += fdd.chargeA()[i]; + fitInfo.ampFDDC = 0; + for (int i = 0; i < 8; i++) + fitInfo.ampFDDC += fdd.chargeC()[i]; + fitInfo.triggerMaskFDD = fdd.triggerMask(); + // get signal coincidence + for (int i = 0; i < 4; i++) { + if (fdd.chargeA()[i + 4] > 0 && fdd.chargeA()[i] > 0) + chFDDA++; + if (fdd.chargeC()[i + 4] > 0 && fdd.chargeC()[i] > 0) + chFDDC++; + } + } if (nZdcs > 0) { auto itZDC = mapGlobalBcWithZdc.find(globalBC); if (itZDC != mapGlobalBcWithZdc.end()) { @@ -1607,6 +1724,7 @@ struct UpcCandProducer { fitInfo.BBFT0Apf, fitInfo.BBFT0Cpf, fitInfo.BGFT0Apf, fitInfo.BGFT0Cpf, fitInfo.BBFV0Apf, fitInfo.BGFV0Apf, fitInfo.BBFDDApf, fitInfo.BBFDDCpf, fitInfo.BGFDDApf, fitInfo.BGFDDCpf); + eventCandidatesSelExtras(chFT0A, chFT0C, chFDDA, chFDDC, chFV0A); eventCandidatesSelsFwd(fitInfo.distClosestBcV0A, fitInfo.distClosestBcT0A, amplitudesT0A, @@ -1614,6 +1732,7 @@ struct UpcCandProducer { amplitudesV0A, relBCsV0A); candID++; + midIt++; trkCandIDs.clear(); } @@ -1624,6 +1743,7 @@ struct UpcCandProducer { bcsMatchedTrIdsGlobal.clear(); mapGlobalBcWithT0A.clear(); mapGlobalBcWithV0A.clear(); + mapGlobalBcWithFDD.clear(); } // data processors @@ -1777,13 +1897,35 @@ struct UpcCandProducer { (o2::aod::McFwdTrackLabels*)nullptr); } + void processForwardGlobalMC(ForwardTracks const& fwdTracks, + o2::aod::FwdTrkCls const& fwdTrkClusters, + o2::aod::AmbiguousFwdTracks const& ambFwdTracks, + BCsWithBcSels const& bcs, + o2::aod::Collisions const& collisions, + o2::aod::FT0s const& ft0s, + o2::aod::FDDs const& fdds, + o2::aod::FV0As const& fv0as, + o2::aod::Zdcs const& zdcs, + o2::aod::McCollisions const& mcCollisions, o2::aod::McParticles const& mcParticles, + o2::aod::McFwdTrackLabels const& mcFwdTrackLabels) + { + fDoMC = true; + skimMCInfo(mcCollisions, mcParticles, bcs); + createCandidatesFwdGlobal(fwdTracks, fwdTrkClusters, ambFwdTracks, + bcs, collisions, + ft0s, fdds, fv0as, zdcs, + &mcFwdTrackLabels); + fNewPartIDs.clear(); + } + PROCESS_SWITCH(UpcCandProducer, processSemiFwd, "Produce candidates in semiforward/forward region", false); PROCESS_SWITCH(UpcCandProducer, processCentral, "Produce candidates in central region", false); PROCESS_SWITCH(UpcCandProducer, processSemiFwdMC, "Produce candidates in semiforward/forward region with MC information", false); PROCESS_SWITCH(UpcCandProducer, processCentralMC, "Produce candidates in central region with MC information", false); PROCESS_SWITCH(UpcCandProducer, processForward, "Produce candidates in forward region", false); PROCESS_SWITCH(UpcCandProducer, processForwardGlobal, "Produce candidates in forward region with MFT", true); - PROCESS_SWITCH(UpcCandProducer, processForwardMC, "Produce caniddates in forward region with MC information", false); + PROCESS_SWITCH(UpcCandProducer, processForwardMC, "Produce candidates in forward region with MC information", false); + PROCESS_SWITCH(UpcCandProducer, processForwardGlobalMC, "Produce candidates in forward region with MFT and MC information", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/CMakeLists.txt b/PWGUD/Tasks/CMakeLists.txt index a93b9c01311..a0f1eb17747 100644 --- a/PWGUD/Tasks/CMakeLists.txt +++ b/PWGUD/Tasks/CMakeLists.txt @@ -19,6 +19,16 @@ o2physics_add_dpl_workflow(sg-spectra PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(sg-pid-spectra-table + SOURCES sgPIDSpectraTable.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(sg-pid-analyzer + SOURCES sgPIDAnalyzer.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(sg-pid-spectra SOURCES sgPIDSpectra.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase @@ -153,6 +163,11 @@ o2physics_add_dpl_workflow(exclusive-phi-leptons PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(exclusive-phi-leptons-trees + SOURCES exclusivePhiLeptonsTrees.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(exclusive-pentaquark SOURCES exclusivePentaquark.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector diff --git a/PWGUD/Tasks/exclusivePhi.cxx b/PWGUD/Tasks/exclusivePhi.cxx index eed29b6fdfc..8f764f2bfff 100644 --- a/PWGUD/Tasks/exclusivePhi.cxx +++ b/PWGUD/Tasks/exclusivePhi.cxx @@ -9,6 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -626,7 +627,7 @@ struct ExclusivePhi { // auto ksize = allTracksAreITSonlyAndFourITSclusters.size(); registry.fill(HIST("hTracksITSonly"), allTracksAreITSonlyAndFourITSclusters.size()); - for (int kaon = 0; kaon < allTracksAreITSonlyAndFourITSclusters.size(); kaon++) { + for (std::size_t kaon = 0; kaon < allTracksAreITSonlyAndFourITSclusters.size(); kaon++) { int clusterSize[7]; double averageClusterSize = 0.; diff --git a/PWGUD/Tasks/exclusivePhiLeptons.cxx b/PWGUD/Tasks/exclusivePhiLeptons.cxx index 136d9a789f2..ea7e92f61dd 100644 --- a/PWGUD/Tasks/exclusivePhiLeptons.cxx +++ b/PWGUD/Tasks/exclusivePhiLeptons.cxx @@ -8,6 +8,7 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -37,7 +38,7 @@ struct ExclusivePhiLeptons { Configurable gap_Side{"gap", 2, "gap selection"}; Configurable pid2d_cut{"PID2D", 2., "PID cut in 2D"}; Configurable pid_cut{"PID", 2., "PID cut in 1D"}; - Configurable electronsInTOF{"eTOF", 2, "electrons in TOF"}; + Configurable electronsInTOF{"eTOF", 2, "electrons in TOF"}; // defining histograms using histogram registry HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; diff --git a/PWGUD/Tasks/exclusivePhiLeptonsTrees.cxx b/PWGUD/Tasks/exclusivePhiLeptonsTrees.cxx new file mode 100644 index 00000000000..e1ef9b8f3b4 --- /dev/null +++ b/PWGUD/Tasks/exclusivePhiLeptonsTrees.cxx @@ -0,0 +1,310 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "iostream" +#include "PWGUD/DataModel/UDTables.h" +#include +#include "TLorentzVector.h" +#include "Common/DataModel/PIDResponse.h" +#include "PWGUD/Core/SGSelector.h" +using std::array; +using namespace std; +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; + +/// \brief Exclusive phi->ee tree producer, for ML applications, DG-based +/// \author Simone Ragoni, Creighton +/// \date 11/11/2024 + +namespace o2::aod +{ +namespace tree +{ +// track tables +DECLARE_SOA_COLUMN(PX1, px1, float); +DECLARE_SOA_COLUMN(PY1, py1, float); +DECLARE_SOA_COLUMN(PZ1, pz1, float); +DECLARE_SOA_COLUMN(PE1, pE1, float); +DECLARE_SOA_COLUMN(PX2, px2, float); +DECLARE_SOA_COLUMN(PY2, py2, float); +DECLARE_SOA_COLUMN(PZ2, pz2, float); +DECLARE_SOA_COLUMN(PE2, pE2, float); +DECLARE_SOA_COLUMN(NCOUNTERPV, nCounterPV, int); +DECLARE_SOA_COLUMN(NELECTRONSTOF, nElectronsTOF, int); +} // namespace tree + +DECLARE_SOA_TABLE(TREE, "AOD", "Tree", tree::PX1, tree::PY1, tree::PZ1, tree::PE1, tree::PX2, tree::PY2, tree::PZ2, tree::PE2, tree::NCOUNTERPV, tree::NELECTRONSTOF); +} // namespace o2::aod + +struct ExclusivePhiLeptonsTrees { + Produces tree; + Configurable gap_Side{"gap", 2, "gap selection"}; + Configurable pid2d_cut{"PID2D", 2., "PID cut in 2D"}; + Configurable pid_cut{"PID", 2., "PID cut in 1D"}; + Configurable electronsInTOF{"eTOF", 2, "electrons in TOF"}; + // defining histograms using histogram registry + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + //----------------------------------------------------------------------------------------------------------------------- + void init(o2::framework::InitContext&) + { + registry.add("posx", "Vertex position in x", kTH1F, {{100, -0.5, 0.5}}); + registry.add("posy", "Vertex position in y", kTH1F, {{100, -0.5, 0.5}}); + registry.add("posz", "Vertex position in z", kTH1F, {{1000, -100., 100.}}); + registry.add("hITSCluster", "N_{cluster}", kTH1F, {{100, -0.5, 99.5}}); + registry.add("hChi2ITSTrkSegment", "N_{cluster}", kTH1F, {{100, -0.5, 99.5}}); + registry.add("hTPCCluster", "N_{cluster}", kTH1F, {{200, -0.5, 199.5}}); + registry.add("hdEdx", "p vs dE/dx Signal", kTH2F, {{100, 0.0, 3.0}, {1000, 0.0, 2000.0}}); + registry.add("hdEdx2", "p vs dE/dx Signal", kTH2F, {{100, 0.0, 3.0}, {1000, 0.0, 2000.0}}); + registry.add("hdSigmaElectron", "p vs dE/dx sigma electron", kTH2F, {{100, 0.0, 3.0}, {1000, -500.0, 500.0}}); + registry.add("hdSigmaElectron2", "p vs dE/dx sigma electron", kTH2F, {{100, 0.0, 3.0}, {1000, -500.0, 500.0}}); + registry.add("hdSigmaElectron3", "p vs dE/dx sigma electron", kTH2F, {{100, 0.0, 3.0}, {1000, -500.0, 500.0}}); + registry.add("hNsigEvsKa1", "NSigma(t1) vs NSigma (t2);n#sigma_{1};n#sigma_{2}", kTH2F, {{100, -15., 15.}, {100, -15., 15}}); + registry.add("hNsigEvsKa2", "NSigma(t1) vs NSigma (t2);n#sigma_{1};n#sigma_{2}", kTH2F, {{100, -15., 15.}, {100, -15., 15}}); + registry.add("hMomentum", "p_{#ka};#it{p_{trk}}, GeV/c;", kTH1F, {{100, 0., 3.}}); + registry.add("hEta1", "#eta_{#ka};#it{#eta_{trk}}, GeV/c;", kTH1F, {{100, -2., 2.}}); + registry.add("hPtLikeSignElectron", "Pt;#it{p_{t}}, GeV/c;", kTH1F, {{500, 0., 5.}}); + registry.add("hMassLikeSignElectron", "Raw Inv.M;#it{m_{ee}}, GeV/c^{2};", kTH1F, {{1000, 0., 10.}}); + registry.add("hMassPtLikeSignElectron", "Raw Inv.M;#it{m_{ee}}, GeV/c^{2};Pt;#it{p_{t}}, GeV/c;", kTH2F, {{1000, 0., 10.}, {400, 0., 4.}}); + + auto hSelectionCounter = registry.add("hSelectionCounter", "hSelectionCounter;;NEvents", HistType::kTH1I, {{10, 0., 10.}}); + + TString SelectionCuts[9] = {"NoSelection", "GAPcondition", "PVtracks", "Good TPC-ITS track", "TPC/TOF PID track", "End trk loop", "Exactly 2e", "Like-sign ev", "Unlike-sign ev"}; + // now we can set BinLabel in histogram Registry + + for (int i = 0; i < 9; i++) { + hSelectionCounter->GetXaxis()->SetBinLabel(i + 1, SelectionCuts[i].Data()); + } + + // Unlike sign pp + registry.add("ee/hRapidity", "Rapidity;#it{y_{ee}};", kTH1F, {{100, -2., 2.}}); + registry.add("ee/hPtElectronVsElectron", "Pt1 vs Pt2;p_{T};p_{T};", kTH2F, {{100, 0., 3.}, {100, 0., 3.}}); + registry.add("ee/hMassPtUnlikeSignElectron", "Raw Inv.M;#it{m_{ee}}, GeV/c^{2};Pt;#it{p_{t}}, GeV/c;", kTH2F, {{400, 0., 4.}, {400, 0., 4.}}); + registry.add("ee/hMassUnlike", "m_{ee} [GeV/#it{c}^{2}]", kTH1F, {{1000, 0., 10.}}); + registry.add("ee/hUnlikePt", "Pt;#it{p_{t}}, GeV/c;", kTH1F, {{500, 0., 5.}}); + registry.add("ee/hCoherentMass", "Raw Inv.M;#it{m_{ee}}, GeV/c^{2};", kTH1F, {{1000, 0., 10.}}); + registry.add("ee/hIncoherentMass", "Raw Inv.M;#it{m_{ee}}, GeV/c^{2};", kTH1F, {{1000, 0., 10.}}); + } + + using udtracks = soa::Join; + using udtracksfull = soa::Join; + // using UDCollisions = soa::Join; + //__________________________________________________________________________ + // Main process + void process(UDCollisions::iterator const& collision, udtracksfull const& tracks) + { + registry.fill(HIST("hSelectionCounter"), 0); + registry.fill(HIST("posx"), collision.posX()); + registry.fill(HIST("posy"), collision.posY()); + registry.fill(HIST("posz"), collision.posZ()); + TLorentzVector resonance; // lorentz vectors of tracks and the mother + // =================================== + // Task for ee pairs with PID + // Topology: + // - 2 TOF ee + // - 1 TOF e + 1 TPC e + // =================================== + std::vector onlyElectronTracks; + std::vector onlyElectronTracksTOF; + std::vector onlyElectronSigma; + std::vector onlyElectronSigmaTOF; + std::vector rawElectronTracks; + std::vector rawElectronTracksTOF; + + // ------------------------------------------- + // TO BE SAVED: + // - counterPV + // - electronsTOF (0,1,2) = 2 - electronsTPC + // - (px,py,pz,E)1 + // - (px,py,pz,E)2 + int counterPV = 0; + for (auto trk : tracks) { + // ---------------------------------------- + // SELECTIONS: + // - PV track + // - at least 70 TPC clusters + // - at least 6 ITS clusters + // - 0.3 < pT < 0.65 GeV from STARlight + // - DCAxy, DCAz + // - Nsigma^2 < 2^2 + // - |track eta| < 0.8 + if (!trk.isPVContributor()) { + continue; + } + counterPV += 1; + registry.fill(HIST("hSelectionCounter"), 2); + + int NFindable = trk.tpcNClsFindable(); + int NMinusFound = trk.tpcNClsFindableMinusFound(); + int NCluster = NFindable - NMinusFound; + registry.fill(HIST("hTPCCluster"), NCluster); + registry.fill(HIST("hChi2ITSTrkSegment"), trk.itsChi2NCl()); + if (NCluster < 70) { + continue; + } + if (trk.itsNCls() < 6) { + continue; + } + if (trk.pt() < 0.300) { + continue; + } + if (trk.pt() > 0.650) { + continue; + } + if (!(std::abs(trk.dcaZ()) < 2.)) { + continue; + } + double dcaLimit = 0.0105 + 0.035 / pow(trk.pt(), 1.1); + if (!(std::abs(trk.dcaXY()) < dcaLimit)) { + continue; + } + registry.fill(HIST("hSelectionCounter"), 3); + registry.fill(HIST("hITSCluster"), trk.itsNCls()); + + double momentum = TMath::Sqrt(trk.px() * trk.px() + trk.py() * trk.py() + trk.pz() * trk.pz()); + double dEdx = trk.tpcSignal(); + registry.fill(HIST("hdEdx"), momentum, dEdx); + + TLorentzVector electron; + electron.SetXYZM(trk.px(), trk.py(), trk.pz(), o2::constants::physics::MassElectron); + if (fabs(electron.Eta()) > 0.8) { + return; + } + auto nSigmaEl = trk.tpcNSigmaEl(); + auto nSigmaElTOF = trk.tofNSigmaEl(); + + if (trk.hasTOF()) { + registry.fill(HIST("hdSigmaElectron"), momentum, nSigmaElTOF); + } + if (fabs(nSigmaEl) < pid_cut) { + registry.fill(HIST("hdEdx2"), momentum, dEdx); + registry.fill(HIST("hdSigmaElectron2"), momentum, nSigmaEl); + registry.fill(HIST("hMomentum"), momentum); + if (trk.hasTOF() && fabs(nSigmaElTOF) < pid_cut) { + registry.fill(HIST("hdSigmaElectron3"), momentum, nSigmaElTOF); + onlyElectronTracksTOF.push_back(electron); + onlyElectronSigmaTOF.push_back(nSigmaElTOF); + rawElectronTracksTOF.push_back(trk); + } else if (!trk.hasTOF()) { + onlyElectronTracks.push_back(electron); + onlyElectronSigma.push_back(nSigmaEl); + rawElectronTracks.push_back(trk); + } + registry.fill(HIST("hSelectionCounter"), 4); + } + + } // trk loop + + registry.fill(HIST("hSelectionCounter"), 5); + if ((onlyElectronTracksTOF.size() >= electronsInTOF) && (onlyElectronTracks.size() + onlyElectronTracksTOF.size()) == 2) { + registry.fill(HIST("hSelectionCounter"), 6); + + int signSum = -999.; + double sigmaTotal = -999.; + TLorentzVector a, b; + // two electrons in the TPC + if (onlyElectronTracksTOF.size() == 0) { + + registry.fill(HIST("hEta1"), onlyElectronTracks[0].Eta()); + registry.fill(HIST("hEta1"), onlyElectronTracks[1].Eta()); + resonance += onlyElectronTracks[0]; + resonance += onlyElectronTracks[1]; + a += onlyElectronTracks[0]; + b += onlyElectronTracks[1]; + sigmaTotal = 0; + sigmaTotal = onlyElectronSigma[0] * onlyElectronSigma[0] + onlyElectronSigma[1] * onlyElectronSigma[1]; + ; + registry.fill(HIST("hNsigEvsKa1"), onlyElectronSigma[0], onlyElectronSigma[1]); + signSum = rawElectronTracks[0].sign() + rawElectronTracks[1].sign(); + if (signSum == 0) { + registry.fill(HIST("ee/hPtElectronVsElectron"), onlyElectronTracks[0].Pt(), onlyElectronTracks[1].Pt()); + } + + } else if (onlyElectronTracksTOF.size() == 1) { + + registry.fill(HIST("hEta1"), onlyElectronTracks[0].Eta()); + registry.fill(HIST("hEta1"), onlyElectronTracksTOF[0].Eta()); + resonance += onlyElectronTracks[0]; + resonance += onlyElectronTracksTOF[0]; + a += onlyElectronTracks[0]; + b += onlyElectronTracksTOF[0]; + sigmaTotal = 0; + sigmaTotal = onlyElectronSigma[0] * onlyElectronSigma[0] + onlyElectronSigmaTOF[0] * onlyElectronSigmaTOF[0]; + ; + registry.fill(HIST("hNsigEvsKa1"), onlyElectronSigma[0], onlyElectronSigmaTOF[0]); + signSum = rawElectronTracks[0].sign() + rawElectronTracksTOF[0].sign(); + if (signSum == 0) { + registry.fill(HIST("ee/hPtElectronVsElectron"), onlyElectronTracks[0].Pt(), onlyElectronTracksTOF[0].Pt()); + } + + } else if (onlyElectronTracksTOF.size() == 2) { + + registry.fill(HIST("hEta1"), onlyElectronTracksTOF[0].Eta()); + registry.fill(HIST("hEta1"), onlyElectronTracksTOF[1].Eta()); + resonance += onlyElectronTracksTOF[0]; + resonance += onlyElectronTracksTOF[1]; + a += onlyElectronTracksTOF[0]; + b += onlyElectronTracksTOF[1]; + sigmaTotal = 0; + sigmaTotal = onlyElectronSigmaTOF[0] * onlyElectronSigmaTOF[0] + onlyElectronSigmaTOF[1] * onlyElectronSigmaTOF[1]; + ; + registry.fill(HIST("hNsigEvsKa1"), onlyElectronSigmaTOF[0], onlyElectronSigmaTOF[1]); + signSum = rawElectronTracksTOF[0].sign() + rawElectronTracksTOF[1].sign(); + if (signSum == 0) { + registry.fill(HIST("ee/hPtElectronVsElectron"), onlyElectronTracksTOF[0].Pt(), onlyElectronTracksTOF[1].Pt()); + } + } + + if (sigmaTotal > pid2d_cut * pid2d_cut) { + return; + } + if (onlyElectronTracksTOF.size() == 1) { + registry.fill(HIST("hNsigEvsKa2"), onlyElectronSigma[0], onlyElectronSigmaTOF[0]); + } else if (onlyElectronTracksTOF.size() == 2) { + registry.fill(HIST("hNsigEvsKa2"), onlyElectronSigmaTOF[0], onlyElectronSigmaTOF[1]); + } + + if (signSum != 0) { + registry.fill(HIST("hMassPtLikeSignElectron"), resonance.M(), resonance.Pt()); + registry.fill(HIST("hSelectionCounter"), 7); + registry.fill(HIST("hPtLikeSignElectron"), resonance.Pt()); + registry.fill(HIST("hMassLikeSignElectron"), resonance.M()); + } else { + registry.fill(HIST("ee/hMassPtUnlikeSignElectron"), resonance.M(), resonance.Pt()); + registry.fill(HIST("hSelectionCounter"), 8); + registry.fill(HIST("ee/hMassUnlike"), resonance.M()); + registry.fill(HIST("ee/hRapidity"), resonance.Rapidity()); + if (resonance.Pt() > 0.1) { + registry.fill(HIST("ee/hIncoherentMass"), resonance.M()); + } else { + registry.fill(HIST("ee/hCoherentMass"), resonance.M()); + } + if (resonance.M() > 1.01 && resonance.M() < 1.03) { + registry.fill(HIST("ee/hUnlikePt"), resonance.Pt()); + } + } + // Filling tree, make to be consistent with the declared tables + tree(a.Px(), a.Py(), a.Pz(), a.E(), b.Px(), b.Py(), b.Pz(), b.E(), counterPV, onlyElectronTracksTOF.size()); + } + } // end of process + +}; // end of struct + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGUD/Tasks/fwdMuonsUPC.cxx b/PWGUD/Tasks/fwdMuonsUPC.cxx index 34075b7a862..66957899e62 100644 --- a/PWGUD/Tasks/fwdMuonsUPC.cxx +++ b/PWGUD/Tasks/fwdMuonsUPC.cxx @@ -9,7 +9,18 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file fwdMuonsUPC.cxx +/// \brief perform some selections on fwd events and saves the results + +/// executable name o2-analysis-ud-fwd-muon-upc + +/// \author Andrea Giovanni Riffero + +#include +#include + #include "Framework/runDataProcessing.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "CCDB/BasicCCDBManager.h" @@ -20,18 +31,34 @@ #include "TLorentzVector.h" #include "TSystem.h" #include "TMath.h" +#include "TRandom3.h" +// table for saving tree with info on data namespace dimu { // dimuon DECLARE_SOA_COLUMN(M, m, float); +DECLARE_SOA_COLUMN(Energy, energy, float); +DECLARE_SOA_COLUMN(Px, px, float); +DECLARE_SOA_COLUMN(Py, py, float); +DECLARE_SOA_COLUMN(Pz, pz, float); DECLARE_SOA_COLUMN(Pt, pt, float); DECLARE_SOA_COLUMN(Rap, rap, float); DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(PhiAv, phiAv, float); +DECLARE_SOA_COLUMN(PhiCh, phiCh, float); // tracks positive (p) and negative (n) +DECLARE_SOA_COLUMN(EnergyP, energyP, float); +DECLARE_SOA_COLUMN(Pxp, pxp, float); +DECLARE_SOA_COLUMN(Pyp, pyp, float); +DECLARE_SOA_COLUMN(Pzp, pzp, float); DECLARE_SOA_COLUMN(Ptp, ptp, float); DECLARE_SOA_COLUMN(Etap, etap, float); DECLARE_SOA_COLUMN(Phip, phip, float); +DECLARE_SOA_COLUMN(EnergyN, energyN, float); +DECLARE_SOA_COLUMN(Pxn, pxn, float); +DECLARE_SOA_COLUMN(Pyn, pyn, float); +DECLARE_SOA_COLUMN(Pzn, pzn, float); DECLARE_SOA_COLUMN(Ptn, ptn, float); DECLARE_SOA_COLUMN(Etan, etan, float); DECLARE_SOA_COLUMN(Phin, phin, float); @@ -46,19 +73,87 @@ DECLARE_SOA_COLUMN(Nclass, nclass, int); namespace o2::aod { DECLARE_SOA_TABLE(DiMu, "AOD", "DIMU", - dimu::M, dimu::Pt, dimu::Rap, dimu::Phi, - dimu::Ptp, dimu::Etap, dimu::Phip, - dimu::Ptn, dimu::Etan, dimu::Phin, + dimu::M, dimu::Energy, dimu::Px, dimu::Py, dimu::Pz, dimu::Pt, dimu::Rap, dimu::Phi, + dimu::PhiAv, dimu::PhiCh, + dimu::EnergyP, dimu::Pxp, dimu::Pyp, dimu::Pzp, dimu::Ptp, dimu::Etap, dimu::Phip, + dimu::EnergyN, dimu::Pxn, dimu::Pyn, dimu::Pzn, dimu::Ptn, dimu::Etan, dimu::Phin, dimu::Tzna, dimu::Ezna, dimu::Tznc, dimu::Eznc, dimu::Nclass); -} +} // namespace o2::aod + +// for saving tree with info on gen MC +namespace gendimu +{ +// dimuon +DECLARE_SOA_COLUMN(M, m, float); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Rap, rap, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(PhiAv, phiAv, float); +DECLARE_SOA_COLUMN(PhiCh, phiCh, float); +// tracks positive (p) and negative (n) +DECLARE_SOA_COLUMN(Ptp, ptp, float); +DECLARE_SOA_COLUMN(Etap, etap, float); +DECLARE_SOA_COLUMN(Phip, phip, float); +DECLARE_SOA_COLUMN(Ptn, ptn, float); +DECLARE_SOA_COLUMN(Etan, etan, float); +DECLARE_SOA_COLUMN(Phin, phin, float); +} // namespace gendimu + +namespace o2::aod +{ +DECLARE_SOA_TABLE(GenDimu, "AOD", "GENDIMU", + gendimu::M, gendimu::Pt, gendimu::Rap, gendimu::Phi, + gendimu::PhiAv, gendimu::PhiCh, + gendimu::Ptp, gendimu::Etap, gendimu::Phip, + gendimu::Ptn, gendimu::Etan, gendimu::Phin); +} // namespace o2::aod + +// for saving tree with info on reco MC +namespace recodimu +{ +// dimuon +DECLARE_SOA_COLUMN(M, m, float); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Rap, rap, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(PhiAv, phiAv, float); +DECLARE_SOA_COLUMN(PhiCh, phiCh, float); +// tracks positive (p) and negative (n) +DECLARE_SOA_COLUMN(Ptp, ptp, float); +DECLARE_SOA_COLUMN(Etap, etap, float); +DECLARE_SOA_COLUMN(Phip, phip, float); +DECLARE_SOA_COLUMN(Ptn, ptn, float); +DECLARE_SOA_COLUMN(Etan, etan, float); +DECLARE_SOA_COLUMN(Phin, phin, float); +// gen info dimuon +DECLARE_SOA_COLUMN(GenPt, genPt, float); +DECLARE_SOA_COLUMN(GenRap, genRap, float); +DECLARE_SOA_COLUMN(GenPhi, genPhi, float); +// gen info trks +DECLARE_SOA_COLUMN(GenPtp, genPtp, float); +DECLARE_SOA_COLUMN(GenEtap, genEtap, float); +DECLARE_SOA_COLUMN(GenPhip, genPhip, float); +DECLARE_SOA_COLUMN(GenPtn, genPtn, float); +DECLARE_SOA_COLUMN(GenEtan, genEtan, float); +DECLARE_SOA_COLUMN(GenPhin, genPhin, float); +} // namespace recodimu + +namespace o2::aod +{ +DECLARE_SOA_TABLE(RecoDimu, "AOD", "RECODIMU", + recodimu::M, recodimu::Pt, recodimu::Rap, recodimu::Phi, + recodimu::PhiAv, recodimu::PhiCh, + recodimu::Ptp, recodimu::Etap, recodimu::Phip, + recodimu::Ptn, recodimu::Etan, recodimu::Phin, + recodimu::GenPt, recodimu::GenRap, recodimu::GenPhi, + recodimu::GenPtp, recodimu::GenEtap, recodimu::GenPhip, + recodimu::GenPtn, recodimu::GenEtan, recodimu::GenPhin); +} // namespace o2::aod using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -// defining constants -double mMu = 0.10566; // mass of muon - // constants used in the track selection const float kRAbsMin = 17.6; const float kRAbsMid = 26.5; @@ -71,22 +166,31 @@ const float kPtMin = 0.; struct fwdMuonsUPC { + // a pdg object + Service pdg; + using CandidatesFwd = soa::Join; using ForwardTracks = soa::Join; + using CompleteFwdTracks = soa::Join; Produces dimuSel; + Produces dimuGen; + Produces dimuReco; - // defining histograms using histogram registry + // defining histograms using histogram registry: different histos for the different process functions HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry reg0n0n{"reg0n0n", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry regXn0n{"regXn0n", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry regXnXn{"regXnXn", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry mcGenRegistry{"mcGenRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry mcRecoRegistry{"mcRecoRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // CONFIGURABLES + static constexpr double Pi = o2::constants::math::PI; // pT of muon pairs Configurable nBinsPt{"nBinsPt", 250, "N bins in pT histo"}; Configurable lowPt{"lowPt", 0., "lower limit in pT histo"}; - Configurable highPt{"highPt", 0.5, "upper limit in pT histo"}; + Configurable highPt{"highPt", 2, "upper limit in pT histo"}; // mass of muon pairs Configurable nBinsMass{"nBinsMass", 500, "N bins in mass histo"}; Configurable lowMass{"lowMass", 0., "lower limit in mass histo"}; @@ -101,8 +205,8 @@ struct fwdMuonsUPC { Configurable highRapidity{"highRapidity", -2., "upper limit in rapidity histo"}; // phi of muon pairs Configurable nBinsPhi{"nBinsPhi", 600, "N bins in phi histo"}; - Configurable lowPhi{"lowPhi", -TMath::Pi(), "lower limit in phi histo"}; - Configurable highPhi{"highPhi", TMath::Pi(), "upper limit in phi histo"}; + Configurable lowPhi{"lowPhi", -Pi, "lower limit in phi histo"}; + Configurable highPhi{"highPhi", Pi, "upper limit in phi histo"}; // pT of single muons Configurable nBinsPtSingle{"nBinsPtSingle", 500, "N bins in pT histo single muon"}; Configurable lowPtSingle{"lowPtSingle", 0., "lower limit in pT histo single muon"}; @@ -113,17 +217,13 @@ struct fwdMuonsUPC { Configurable highEtaSingle{"highEtaSingle", -2., "upper limit in eta histo single muon"}; // phi of single muons Configurable nBinsPhiSingle{"nBinsPhiSingle", 600, "N bins in phi histo single muon"}; - Configurable lowPhiSingle{"lowPhiSingle", -TMath::Pi(), "lower limit in phi histo single muon"}; - Configurable highPhiSingle{"highPhiSingle", TMath::Pi(), "upper limit in phi histo single muon"}; + Configurable lowPhiSingle{"lowPhiSingle", -Pi, "lower limit in phi histo single muon"}; + Configurable highPhiSingle{"highPhiSingle", Pi, "upper limit in phi histo single muon"}; // ZDC Configurable nBinsZDCen{"nBinsZDCen", 200, "N bins in ZN energy"}; Configurable lowEnZN{"lowEnZN", -50., "lower limit in ZN energy histo"}; Configurable highEnZN{"highEnZN", 250., "upper limit in ZN energy histo"}; - // configuarble rapidity cuts - Configurable yCutLow{"yCutLow", -4, "Lower cut in pair rapidity"}; - Configurable yCutUp{"yCutUp", -2.5, "Upper cut in pair rapidity"}; - void init(InitContext&) { // binning of pT axis fr fit @@ -148,13 +248,14 @@ struct fwdMuonsUPC { const AxisSpec axisPhiSingle{nBinsPhiSingle, lowPhiSingle, highPhiSingle, "#varphi_{trk}"}; // histos - registry.add("hMass", "Ivariant mass of muon pairs;;#counts", kTH1D, {axisMass}); - registry.add("hPt", "Transverse momentum mass of muon pairs;;#counts", kTH1D, {axisPt}); - registry.add("hPtFit", "Transverse momentum mass of muon pairs;;#counts", kTH1D, {axisPtFit}); + // data and reco MC + registry.add("hMass", "Invariant mass of muon pairs;;#counts", kTH1D, {axisMass}); + registry.add("hPt", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPt}); + registry.add("hPtFit", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPtFit}); registry.add("hEta", "Pseudorapidty of muon pairs;;#counts", kTH1D, {axisEta}); registry.add("hRapidity", "Rapidty of muon pairs;;#counts", kTH1D, {axisRapidity}); registry.add("hPhi", "#varphi of muon pairs;;#counts", kTH1D, {axisPhi}); - registry.add("hCharge", "Charge;#it{charge};;#counts", kTH1D, {{5, -2.5, 2.5}}); + registry.add("hCharge", "Charge;;;#counts", kTH1D, {{5, -2.5, 2.5}}); registry.add("hContrib", "hContrib;;#counts", kTH1D, {{6, -0.5, 5.5}}); registry.add("hEvSign", "Sum of the charges of all the tracks in each event;;#counts", kTH1D, {{5, -2.5, 2.5}}); registry.add("hPtTrkPos", "Pt of positive muons;;#counts", kTH1D, {axisPtSingle}); @@ -163,32 +264,83 @@ struct fwdMuonsUPC { registry.add("hEtaTrkNeg", "#eta of negative muons;;#counts", kTH1D, {axisEtaSingle}); registry.add("hPhiTrkPos", "#varphi of positive muons;;#counts", kTH1D, {axisPhiSingle}); registry.add("hPhiTrkNeg", "#varphi of negative muons;;#counts", kTH1D, {axisPhiSingle}); + registry.add("hSameSign", "hSameSign;;#counts", kTH1D, {{6, -0.5, 5.5}}); + registry.add("hPhiCharge", "#phi #it{charge}", kTH1D, {axisPhi}); + registry.add("hPhiAverage", "#phi #it{average}", kTH1D, {axisPhi}); + + // data registry.add("hTimeZNA", "ZNA Times;;#counts", kTH1D, {axisTimeZN}); registry.add("hTimeZNC", "ZNC Times;;#counts", kTH1D, {axisTimeZN}); registry.add("hEnergyZN", "ZNA vs ZNC energy", kTH2D, {axisEnergyZNA, axisEnergyZNC}); - registry.add("hSameSign", "hSameSign;;#counts", kTH1D, {{6, -0.5, 5.5}}); - reg0n0n.add("hMass", "Ivariant mass of muon pairs - 0n0n;;#counts", kTH1D, {axisMass}); - reg0n0n.add("hPt", "Transverse momentum mass of muon pairs - 0n0n;;#counts", kTH1D, {axisPt}); + reg0n0n.add("hMass", "Invariant mass of muon pairs - 0n0n;;#counts", kTH1D, {axisMass}); + reg0n0n.add("hPt", "Transverse momentum of muon pairs - 0n0n;;#counts", kTH1D, {axisPt}); reg0n0n.add("hEta", "Pseudorapidty of muon pairs - 0n0n;;#counts", kTH1D, {axisEta}); reg0n0n.add("hRapidity", "Rapidty of muon pairs - 0n0n;;#counts", kTH1D, {axisRapidity}); - reg0n0n.add("hPtFit", "Transverse momentum mass of muon pairs - 0n0n;;#counts", kTH1D, {axisPtFit}); + reg0n0n.add("hPtFit", "Transverse momentum of muon pairs - 0n0n;;#counts", kTH1D, {axisPtFit}); - regXn0n.add("hMass", "Ivariant mass of muon pairs - Xn0n;;#counts", kTH1D, {axisMass}); - regXn0n.add("hPt", "Transverse momentum mass of muon pairs - Xn0n;;#counts", kTH1D, {axisPt}); + regXn0n.add("hMass", "Invariant mass of muon pairs - Xn0n;;#counts", kTH1D, {axisMass}); + regXn0n.add("hPt", "Transverse momentum of muon pairs - Xn0n;;#counts", kTH1D, {axisPt}); regXn0n.add("hEta", "Pseudorapidty of muon pairs - Xn0n;;#counts", kTH1D, {axisEta}); regXn0n.add("hRapidity", "Rapidty of muon pairs - Xn0n;;#counts", kTH1D, {axisRapidity}); - regXn0n.add("hPtFit", "Transverse momentum mass of muon pairs - Xn0n;;#counts", kTH1D, {axisPtFit}); + regXn0n.add("hPtFit", "Transverse momentum of muon pairs - Xn0n;;#counts", kTH1D, {axisPtFit}); - regXnXn.add("hMass", "Ivariant mass of muon pairs - XnXn;;#counts", kTH1D, {axisMass}); - regXnXn.add("hPt", "Transverse momentum mass of muon pairs - XnXn;;#counts", kTH1D, {axisPt}); + regXnXn.add("hMass", "Invariant mass of muon pairs - XnXn;;#counts", kTH1D, {axisMass}); + regXnXn.add("hPt", "Transverse momentum of muon pairs - XnXn;;#counts", kTH1D, {axisPt}); regXnXn.add("hEta", "Pseudorapidty of muon pairs - XnXn;;#counts", kTH1D, {axisEta}); regXnXn.add("hRapidity", "Rapidty of muon pairs - XnXn;;#counts", kTH1D, {axisRapidity}); - regXnXn.add("hPtFit", "Transverse momentum mass of muon pairs - XnXn;;#counts", kTH1D, {axisPtFit}); + regXnXn.add("hPtFit", "Transverse momentum of muon pairs - XnXn;;#counts", kTH1D, {axisPtFit}); + + // gen MC + mcGenRegistry.add("hMass", "Invariant mass of muon pairs;;#counts", kTH1D, {axisMass}); + mcGenRegistry.add("hPt", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPt}); + mcGenRegistry.add("hEta", "Pseudorapidty of muon pairs;;#counts", kTH1D, {axisEta}); + mcGenRegistry.add("hRapidity", "Rapidty of muon pairs;;#counts", kTH1D, {axisRapidity}); + mcGenRegistry.add("hPhi", "#varphi of muon pairs;;#counts", kTH1D, {axisPhi}); + mcGenRegistry.add("hPtTrkPos", "Pt of positive muons;;#counts", kTH1D, {axisPtSingle}); + mcGenRegistry.add("hPtTrkNeg", "Pt of negative muons;;#counts", kTH1D, {axisPtSingle}); + mcGenRegistry.add("hEtaTrkPos", "#eta of positive muons;;#counts", kTH1D, {axisEtaSingle}); + mcGenRegistry.add("hEtaTrkNeg", "#eta of negative muons;;#counts", kTH1D, {axisEtaSingle}); + mcGenRegistry.add("hPhiTrkPos", "#varphi of positive muons;;#counts", kTH1D, {axisPhiSingle}); + mcGenRegistry.add("hPhiTrkNeg", "#varphi of negative muons;;#counts", kTH1D, {axisPhiSingle}); + mcGenRegistry.add("hPhiCharge", "#phi #it{charge}", kTH1D, {axisPhi}); + mcGenRegistry.add("hPhiAverage", "#phi #it{average}", kTH1D, {axisPhi}); + + // reco MC + mcRecoRegistry.add("hMass", "Invariant mass of muon pairs;;#counts", kTH1D, {axisMass}); + mcRecoRegistry.add("hPt", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPt}); + mcRecoRegistry.add("hPtFit", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPtFit}); + mcRecoRegistry.add("hEta", "Pseudorapidty of muon pairs;;#counts", kTH1D, {axisEta}); + mcRecoRegistry.add("hRapidity", "Rapidty of muon pairs;;#counts", kTH1D, {axisRapidity}); + mcRecoRegistry.add("hPhi", "#varphi of muon pairs;;#counts", kTH1D, {axisPhi}); + mcRecoRegistry.add("hCharge", "Charge;;;#counts", kTH1D, {{5, -2.5, 2.5}}); + mcRecoRegistry.add("hContrib", "hContrib;;#counts", kTH1D, {{6, -0.5, 5.5}}); + mcRecoRegistry.add("hEvSign", "Sum of the charges of all the tracks in each event;;#counts", kTH1D, {{5, -2.5, 2.5}}); + mcRecoRegistry.add("hPtTrkPos", "Pt of positive muons;;#counts", kTH1D, {axisPtSingle}); + mcRecoRegistry.add("hPtTrkNeg", "Pt of negative muons;;#counts", kTH1D, {axisPtSingle}); + mcRecoRegistry.add("hEtaTrkPos", "#eta of positive muons;;#counts", kTH1D, {axisEtaSingle}); + mcRecoRegistry.add("hEtaTrkNeg", "#eta of negative muons;;#counts", kTH1D, {axisEtaSingle}); + mcRecoRegistry.add("hPhiTrkPos", "#varphi of positive muons;;#counts", kTH1D, {axisPhiSingle}); + mcRecoRegistry.add("hPhiTrkNeg", "#varphi of negative muons;;#counts", kTH1D, {axisPhiSingle}); + mcRecoRegistry.add("hSameSign", "hSameSign;;#counts", kTH1D, {{6, -0.5, 5.5}}); + mcRecoRegistry.add("hPhiCharge", "#phi #it{charge}", kTH1D, {axisPhi}); + mcRecoRegistry.add("hPhiAverage", "#phi #it{average}", kTH1D, {axisPhi}); + + // corr gen-reco + mcRecoRegistry.add("hPtcorr", "gen pT vs reco pT", kTH2D, {axisPt, axisPt}); + mcRecoRegistry.add("hRapcorr", "gen rapidity vs reco rapidity", kTH2D, {axisRapidity, axisRapidity}); + mcRecoRegistry.add("hPhicorr", "gen #phi vs reco #phi", kTH2D, {axisPhi, axisPhi}); } // FUNCTIONS + // retrieve particle mass (GeV/c^2) from TDatabasePDG + float particleMass(int pid) + { + auto mass = pdg->Mass(pid); + return mass; + } + // template function that fills a map with the collision id of each udcollision as key // and a vector with the tracks // map == (key, element) == (udCollisionId, vector of trks) @@ -204,6 +356,45 @@ struct fwdMuonsUPC { } } + // template function that fills a map with the collision id of each udmccollision as key + // and a vector with the tracks + // map == (key, element) == (udMcCollisionId, vector of mc particles) + template + void collectMcCandIDs(std::unordered_map>& tracksPerCand, TTracks& tracks) + { + for (const auto& tr : tracks) { + int32_t candId = tr.udMcCollisionId(); + if (candId < 0) { + continue; + } + tracksPerCand[candId].push_back(tr.globalIndex()); + } + } + + // template function that fills a map with the collision id of each udmccollision as key + // and a vector with the tracks + // map == (key, element) == (udCollisionId, vector(track1, mcPart1, udCollisionId1, track2, mcPart2, udCollisionId2)) + template + void collectRecoCandID(std::unordered_map>& tracksPerCand, TTracks& tracks) + { + for (const auto& tr : tracks) { + int32_t candId = tr.udCollisionId(); + if (candId < 0) + continue; + + if (!tr.has_udMcParticle()) { + // LOGF(info,"tr does not have mc part"); + continue; + } + // retrieve mc particle from the reco track + auto mcPart = tr.udMcParticle(); + + tracksPerCand[candId].push_back(tr.globalIndex()); + tracksPerCand[candId].push_back(mcPart.globalIndex()); + tracksPerCand[candId].push_back(mcPart.udMcCollisionId()); + } + } + // struct used to store the ZDC info in a map struct ZDCinfo { float timeA; @@ -215,10 +406,10 @@ struct fwdMuonsUPC { // function that fills a map with the collision id of each udcollision as key // and a ZDCinfo struct with the ZDC information - void collectCandZDCInfo(std::unordered_map& zdcPerCand, o2::aod::UDZdcsReduced& ZDCs) + void collectCandZDCInfo(std::unordered_map& zdcPerCand, o2::aod::UDZdcsReduced const& ZDCs) { - for (auto& zdc : ZDCs) { + for (const auto& zdc : ZDCs) { int32_t candId = zdc.udCollisionId(); if (candId < 0) { continue; @@ -242,11 +433,13 @@ struct fwdMuonsUPC { } // function to select muon tracks - bool isMuonSelected(const ForwardTracks::iterator& fwdTrack) + template + bool isMuonSelected(const TTracks& fwdTrack) { float rAbs = fwdTrack.rAtAbsorberEnd(); float pDca = fwdTrack.pDca(); TLorentzVector p; + auto mMu = particleMass(13); p.SetXYZM(fwdTrack.px(), fwdTrack.py(), fwdTrack.pz(), mMu); float eta = p.Eta(); float pt = p.Pt(); @@ -263,11 +456,39 @@ struct fwdMuonsUPC { return true; } + // function to compute phi for azimuth anisotropy + void computePhiAnis(TLorentzVector p1, TLorentzVector p2, int sign1, float& phiAverage, float& phiCharge) + { + + TLorentzVector tSum, tDiffAv, tDiffCh; + tSum = p1 + p2; + if (sign1 > 0) { + tDiffCh = p1 - p2; + if (gRandom->Rndm() > 0.5) + tDiffAv = p1 - p2; + else + tDiffAv = p2 - p1; + } else { + tDiffCh = p2 - p1; + if (gRandom->Rndm() > 0.5) + tDiffAv = p2 - p1; + else + tDiffAv = p1 - p2; + } + + // average + phiAverage = tSum.DeltaPhi(tDiffAv); + // charge + phiCharge = tSum.DeltaPhi(tDiffCh); + } + // function that processes the candidates: - // it applies V0 selection, trk selection, and fills the histograms + // it applies V0 selection, trk selection, kine selection, and fills the histograms + // it also divides the data in neutron classes + // used for real data void processCand(CandidatesFwd::iterator const& cand, - const ForwardTracks::iterator& tr1, const ForwardTracks::iterator& tr2, - ZDCinfo& zdc) + ForwardTracks::iterator const& tr1, ForwardTracks::iterator const& tr2, + ZDCinfo const& zdc) { // V0 selection const auto& ampsV0A = cand.amplitudesV0A(); @@ -279,14 +500,16 @@ struct fwdMuonsUPC { } } + // select opposite charge events only + if (cand.netCharge() != 0) { + registry.fill(HIST("hSameSign"), cand.numContrib()); + return; + } + // track selection - TLorentzVector p1, p2; - p1.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), mMu); - p2.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), mMu); - TLorentzVector p = p1 + p2; - if (!isMuonSelected(tr1)) + if (!isMuonSelected(*tr1)) return; - if (!isMuonSelected(tr2)) + if (!isMuonSelected(*tr2)) return; // MCH-MID match selection @@ -298,65 +521,78 @@ struct fwdMuonsUPC { if (nMIDs != 2) return; - // cuts on pair kinematics - if (!(p.M() > 2 && p.M() < 6 && p.Pt() < 5)) - return; + // form Lorentz vectors + TLorentzVector p1, p2; + auto mMu = particleMass(13); + p1.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), mMu); + p2.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), mMu); + TLorentzVector p = p1 + p2; - // select opposite charge events only - if (cand.netCharge() != 0) { - registry.fill(HIST("hSameSign"), cand.numContrib()); + // cut on pair kinematics + // select mass + if (p.M() < lowMass) return; - } - - // select rapidity ranges - if (p.Rapidity() < yCutLow) + if (p.M() > highMass) + return; + // select pt + if (p.Pt() < lowPt) return; - if (p.Rapidity() > yCutUp) + if (p.Pt() > highPt) return; + // select rapidity + if (p.Rapidity() < lowRapidity) + return; + if (p.Rapidity() > highRapidity) + return; + + // compute phi for azimuth anisotropy + float phiAverage = 0; + float phiCharge = 0; + computePhiAnis(p1, p2, tr1.sign(), phiAverage, phiCharge); // zdc info - if (TMath::Abs(zdc.timeA) < 10) + if (std::abs(zdc.timeA) < 10) registry.fill(HIST("hTimeZNA"), zdc.timeA); - if (TMath::Abs(zdc.timeC) < 10) + if (std::abs(zdc.timeC) < 10) registry.fill(HIST("hTimeZNC"), zdc.timeC); registry.fill(HIST("hEnergyZN"), zdc.enA, zdc.enC); // divide the events in neutron classes - bool neutron_A = false; - bool neutron_C = false; + bool neutronA = false; + bool neutronC = false; int znClass = -1; - if (TMath::Abs(zdc.timeA) < 2) - neutron_A = true; - if (TMath::Abs(zdc.timeC) < 2) - neutron_C = true; + if (std::abs(zdc.timeA) < 2) + neutronA = true; + if (std::abs(zdc.timeC) < 2) + neutronC = true; if (std::isinf(zdc.timeC)) - neutron_C = false; + neutronC = false; if (std::isinf(zdc.timeA)) - neutron_A = false; + neutronA = false; // fill the histos in neutron classes and assign neutron class label // 0n0n - if (neutron_C == false && neutron_A == false) { - znClass = 0; + if (neutronC == false && neutronA == false) { + znClass = 1; reg0n0n.fill(HIST("hMass"), p.M()); reg0n0n.fill(HIST("hPt"), p.Pt()); reg0n0n.fill(HIST("hPtFit"), p.Pt()); reg0n0n.fill(HIST("hEta"), p.Eta()); reg0n0n.fill(HIST("hRapidity"), p.Rapidity()); - } else if (neutron_A ^ neutron_C) { // Xn0n + 0nXn - if (neutron_A) - znClass = 1; - else if (neutron_C) + } else if (neutronA ^ neutronC) { // Xn0n + 0nXn + if (neutronA) znClass = 2; + else if (neutronC) + znClass = 3; regXn0n.fill(HIST("hMass"), p.M()); regXn0n.fill(HIST("hPt"), p.Pt()); regXn0n.fill(HIST("hPtFit"), p.Pt()); regXn0n.fill(HIST("hEta"), p.Eta()); regXn0n.fill(HIST("hRapidity"), p.Rapidity()); - } else if (neutron_A && neutron_C) { // XnXn - znClass = 3; + } else if (neutronA && neutronC) { // XnXn + znClass = 4; regXnXn.fill(HIST("hMass"), p.M()); regXnXn.fill(HIST("hPt"), p.Pt()); regXnXn.fill(HIST("hPtFit"), p.Pt()); @@ -381,25 +617,245 @@ struct fwdMuonsUPC { registry.fill(HIST("hPhi"), p.Phi()); registry.fill(HIST("hCharge"), tr1.sign()); registry.fill(HIST("hCharge"), tr2.sign()); + registry.fill(HIST("hPhiAverage"), phiAverage); + registry.fill(HIST("hPhiCharge"), phiCharge); // store the event to save it into a tree if (tr1.sign() > 0) { - dimuSel(p.M(), p.Pt(), p.Rapidity(), p.Phi(), - p1.Pt(), p1.PseudoRapidity(), p1.Phi(), - p2.Pt(), p2.PseudoRapidity(), p2.Phi(), + dimuSel(p.M(), p.E(), p.Px(), p.Py(), p.Pz(), p.Pt(), p.Rapidity(), p.Phi(), + phiAverage, phiCharge, + p1.E(), p1.Px(), p1.Py(), p1.Pz(), p1.Pt(), p1.PseudoRapidity(), p1.Phi(), + p2.E(), p2.Px(), p2.Py(), p2.Pz(), p2.Pt(), p2.PseudoRapidity(), p2.Phi(), zdc.timeA, zdc.enA, zdc.timeC, zdc.enC, znClass); } else { - dimuSel(p.M(), p.Pt(), p.Rapidity(), p.Phi(), - p2.Pt(), p2.PseudoRapidity(), p2.Phi(), - p1.Pt(), p1.PseudoRapidity(), p1.Phi(), + dimuSel(p.M(), p.E(), p.Px(), p.Py(), p.Pz(), p.Pt(), p.Rapidity(), p.Phi(), + phiAverage, phiCharge, + p2.E(), p2.Px(), p2.Py(), p2.Pz(), p2.Pt(), p2.PseudoRapidity(), p2.Phi(), + p1.E(), p1.Px(), p1.Py(), p1.Pz(), p1.Pt(), p1.PseudoRapidity(), p1.Phi(), zdc.timeA, zdc.enA, zdc.timeC, zdc.enC, znClass); } } + // function that processes the MC gen candidates: + // it applies some kinematics cut and fills the histograms + void processMcGenCand(aod::UDMcCollisions::iterator const& /*mcCand*/, + aod::UDMcParticles::iterator const& McPart1, aod::UDMcParticles::iterator const& McPart2) + { + + // check that all pairs are mu+mu- + if (McPart1.pdgCode() + McPart2.pdgCode() != 0) + LOGF(info, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode()); + + // create Lorentz vectors + TLorentzVector p1, p2; + auto mMu = particleMass(13); + p1.SetXYZM(McPart1.px(), McPart1.py(), McPart1.pz(), mMu); + p2.SetXYZM(McPart2.px(), McPart2.py(), McPart2.pz(), mMu); + TLorentzVector p = p1 + p2; + + // cut on pair kinematics + // select mass + if (p.M() < lowMass) + return; + if (p.M() > highMass) + return; + // select pt + if (p.Pt() < lowPt) + return; + if (p.Pt() > highPt) + return; + // select rapidity + if (p.Rapidity() < lowRapidity) + return; + if (p.Rapidity() > highRapidity) + return; + + // compute phi for azimuth anisotropy + float phiAverage = 0; + float phiCharge = 0; + computePhiAnis(p1, p2, -McPart1.pdgCode(), phiAverage, phiCharge); + + // fill the histos + mcGenRegistry.fill(HIST("hPtTrkPos"), p1.Pt()); + mcGenRegistry.fill(HIST("hPtTrkNeg"), p2.Pt()); + mcGenRegistry.fill(HIST("hEtaTrkPos"), p1.Eta()); + mcGenRegistry.fill(HIST("hEtaTrkNeg"), p2.Eta()); + mcGenRegistry.fill(HIST("hPhiTrkPos"), p1.Phi()); + mcGenRegistry.fill(HIST("hPhiTrkNeg"), p2.Phi()); + mcGenRegistry.fill(HIST("hMass"), p.M()); + mcGenRegistry.fill(HIST("hPt"), p.Pt()); + mcGenRegistry.fill(HIST("hEta"), p.Eta()); + mcGenRegistry.fill(HIST("hRapidity"), p.Rapidity()); + mcGenRegistry.fill(HIST("hPhi"), p.Phi()); + mcGenRegistry.fill(HIST("hPhiAverage"), phiAverage); + mcGenRegistry.fill(HIST("hPhiCharge"), phiCharge); + + // store the event to save it into a tree + if (McPart1.pdgCode() < 0) { + dimuGen(p.M(), p.Pt(), p.Rapidity(), p.Phi(), + phiAverage, phiCharge, + p1.Pt(), p1.PseudoRapidity(), p1.Phi(), + p2.Pt(), p2.PseudoRapidity(), p2.Phi()); + } else { + dimuGen(p.M(), p.Pt(), p.Rapidity(), p.Phi(), + phiAverage, phiCharge, + p2.Pt(), p2.PseudoRapidity(), p2.Phi(), + p1.Pt(), p1.PseudoRapidity(), p1.Phi()); + } + } + + // function that processes MC reco candidates + // it applies V0 selection, trk selection, kine selection, and fills the histograms + void processMcRecoCand(CandidatesFwd::iterator const& cand, + CompleteFwdTracks::iterator const& tr1, aod::UDMcParticles::iterator const& McPart1, + CompleteFwdTracks::iterator const& tr2, aod::UDMcParticles::iterator const& McPart2) + { + // V0 selection + const auto& ampsV0A = cand.amplitudesV0A(); + const auto& ampsRelBCsV0A = cand.ampRelBCsV0A(); + for (unsigned int i = 0; i < ampsV0A.size(); ++i) { + if (std::abs(ampsRelBCsV0A[i]) <= 1) { + if (ampsV0A[i] > 100.) + return; + } + } + + // select opposite charge events only + if (cand.netCharge() != 0) { + registry.fill(HIST("hSameSign"), cand.numContrib()); + return; + } + + // track selection + if (!isMuonSelected(*tr1)) + return; + if (!isMuonSelected(*tr2)) + return; + + // MCH-MID match selection + int nMIDs = 0; + if (tr1.chi2MatchMCHMID() > 0) + nMIDs++; + if (tr2.chi2MatchMCHMID() > 0) + nMIDs++; + if (nMIDs != 2) + return; + + // form Lorentz vectors + TLorentzVector p1, p2; + auto mMu = particleMass(13); + p1.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), mMu); + p2.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), mMu); + TLorentzVector p = p1 + p2; + + // cut on pair kinematics (reco candidates) + // select mass + if (p.M() < lowMass) + return; + if (p.M() > highMass) + return; + // select pt + if (p.Pt() < lowPt) + return; + if (p.Pt() > highPt) + return; + // select rapidity + if (p.Rapidity() < lowRapidity) + return; + if (p.Rapidity() > highRapidity) + return; + + // compute phi for azimuth anisotropy + float phiAverage = 0; + float phiCharge = 0; + computePhiAnis(p1, p2, tr1.sign(), phiAverage, phiCharge); + + // gen particle + TLorentzVector p1Mc, p2Mc; + p1Mc.SetXYZM(McPart1.px(), McPart1.py(), McPart1.pz(), mMu); + p2Mc.SetXYZM(McPart2.px(), McPart2.py(), McPart2.pz(), mMu); + TLorentzVector pMc = p1Mc + p2Mc; + + // compute gen phi for azimuth anisotropy + float phiGenAverage = 0; + float phiGenCharge = 0; + computePhiAnis(p1, p2, -McPart1.pdgCode(), phiGenAverage, phiGenCharge); + + // print info in case of problems + if (tr1.sign() * McPart1.pdgCode() > 0 || tr2.sign() * McPart2.pdgCode() > 0) { + LOGF(info, "Problem: "); + LOGF(info, "real: %d | %d", (int)tr1.sign(), (int)tr2.sign()); + LOGF(info, "mc : %i | %i", (int)McPart1.pdgCode(), (int)McPart2.pdgCode()); + LOGF(info, "contrib: %d", (int)cand.numContrib()); + } + + // fill the histos + // reco info + mcRecoRegistry.fill(HIST("hContrib"), cand.numContrib()); + mcRecoRegistry.fill(HIST("hPtTrkPos"), p1.Pt()); + mcRecoRegistry.fill(HIST("hPtTrkNeg"), p2.Pt()); + mcRecoRegistry.fill(HIST("hEtaTrkPos"), p1.Eta()); + mcRecoRegistry.fill(HIST("hEtaTrkNeg"), p2.Eta()); + mcRecoRegistry.fill(HIST("hPhiTrkPos"), p1.Phi()); + mcRecoRegistry.fill(HIST("hPhiTrkNeg"), p2.Phi()); + mcRecoRegistry.fill(HIST("hEvSign"), cand.netCharge()); + mcRecoRegistry.fill(HIST("hMass"), p.M()); + mcRecoRegistry.fill(HIST("hPt"), p.Pt()); + mcRecoRegistry.fill(HIST("hPtFit"), p.Pt()); + mcRecoRegistry.fill(HIST("hEta"), p.Eta()); + mcRecoRegistry.fill(HIST("hRapidity"), p.Rapidity()); + mcRecoRegistry.fill(HIST("hPhi"), p.Phi()); + mcRecoRegistry.fill(HIST("hCharge"), tr1.sign()); + mcRecoRegistry.fill(HIST("hCharge"), tr2.sign()); + mcRecoRegistry.fill(HIST("hPhiAverage"), phiAverage); + mcRecoRegistry.fill(HIST("hPhiCharge"), phiCharge); + + // gen info (of reco events) + mcGenRegistry.fill(HIST("hPtTrkPos"), p1Mc.Pt()); + mcGenRegistry.fill(HIST("hPtTrkNeg"), p2Mc.Pt()); + mcGenRegistry.fill(HIST("hEtaTrkPos"), p1Mc.Eta()); + mcGenRegistry.fill(HIST("hEtaTrkNeg"), p2Mc.Eta()); + mcGenRegistry.fill(HIST("hPhiTrkPos"), p1Mc.Phi()); + mcGenRegistry.fill(HIST("hPhiTrkNeg"), p2Mc.Phi()); + mcGenRegistry.fill(HIST("hMass"), pMc.M()); + mcGenRegistry.fill(HIST("hPt"), pMc.Pt()); + mcGenRegistry.fill(HIST("hEta"), pMc.Eta()); + mcGenRegistry.fill(HIST("hRapidity"), pMc.Rapidity()); + mcGenRegistry.fill(HIST("hPhi"), pMc.Phi()); + mcGenRegistry.fill(HIST("hPhiAverage"), phiGenAverage); + mcGenRegistry.fill(HIST("hPhiCharge"), phiGenCharge); + + // reco-gen correlations + mcRecoRegistry.fill(HIST("hPtcorr"), p.Pt(), pMc.Pt()); + mcRecoRegistry.fill(HIST("hRapcorr"), p.Rapidity(), pMc.Rapidity()); + mcRecoRegistry.fill(HIST("hPhicorr"), p.Phi(), pMc.Phi()); + + // store the event to save it into a tree + if (tr1.sign() > 0) { + dimuReco(p.M(), p.Pt(), p.Rapidity(), p.Phi(), + phiAverage, phiCharge, + p1.Pt(), p1.PseudoRapidity(), p1.Phi(), + p2.Pt(), p2.PseudoRapidity(), p2.Phi(), + // gen info + pMc.Pt(), pMc.Rapidity(), pMc.Phi(), + p1Mc.Pt(), p1Mc.PseudoRapidity(), p1Mc.Phi(), + p2Mc.Pt(), p2Mc.PseudoRapidity(), p2Mc.Phi()); + } else { + dimuReco(p.M(), p.Pt(), p.Rapidity(), p.Phi(), + phiAverage, phiCharge, + p2.Pt(), p2.PseudoRapidity(), p2.Phi(), + p1.Pt(), p1.PseudoRapidity(), p1.Phi(), + // gen info + pMc.Pt(), pMc.Rapidity(), pMc.Phi(), + p2Mc.Pt(), p2Mc.PseudoRapidity(), p2Mc.Phi(), + p1Mc.Pt(), p1Mc.PseudoRapidity(), p1Mc.Phi()); + } + } + // PROCESS FUNCTION - void process(CandidatesFwd const& eventCandidates, - o2::aod::UDZdcsReduced& ZDCs, - ForwardTracks const& fwdTracks) + void processData(CandidatesFwd const& eventCandidates, + o2::aod::UDZdcsReduced const& ZDCs, + ForwardTracks const& fwdTracks) { // map with the tracks @@ -434,7 +890,72 @@ struct fwdMuonsUPC { } } - PROCESS_SWITCH(fwdMuonsUPC, process, "", false); + PROCESS_SWITCH(fwdMuonsUPC, processData, "", true); + + // process MC Truth + void processMcGen(aod::UDMcCollisions const& mccollisions, aod::UDMcParticles const& McParts) + { + + // map with the tracks + std::unordered_map> tracksPerCand; + collectMcCandIDs(tracksPerCand, McParts); + + // loop over the candidates + for (const auto& item : tracksPerCand) { + int32_t trId1 = item.second[0]; + int32_t trId2 = item.second[1]; + int32_t candID = item.first; + auto cand = mccollisions.iteratorAt(candID); + auto tr1 = McParts.iteratorAt(trId1); + auto tr2 = McParts.iteratorAt(trId2); + + processMcGenCand(cand, tr1, tr2); + } + } + PROCESS_SWITCH(fwdMuonsUPC, processMcGen, "", false); + + // process reco MC (gen info included) + void processMcReco(CandidatesFwd const& eventCandidates, + CompleteFwdTracks const& fwdTracks, + aod::UDMcCollisions const& mcCandidates, + aod::UDMcParticles const& McParts) + { + std::unordered_map> tracksPerCandAll; + collectRecoCandID(tracksPerCandAll, fwdTracks); + + // loop over the candidates + for (const auto& item : tracksPerCandAll) { + if (item.second.size() != 6) { + // LOGF(info, "error: reco track(s) not gen"); + continue; + } + + int32_t trId1 = item.second[0]; + int32_t trId2 = item.second[3]; //[2] + + int32_t candID = item.first; + auto cand = eventCandidates.iteratorAt(candID); + auto tr1 = fwdTracks.iteratorAt(trId1); + auto tr2 = fwdTracks.iteratorAt(trId2); + + auto trMcId1 = item.second[1]; + auto trMcId2 = item.second[4]; + auto trMc1 = McParts.iteratorAt(trMcId1); + auto trMc2 = McParts.iteratorAt(trMcId2); + + auto mcCandID1 = mcCandidates.iteratorAt(item.second[2]); + auto mcCandID2 = mcCandidates.iteratorAt(item.second[5]); + + if (mcCandID1 != mcCandID2) { + // LOGF(info, "mc tracks belong to different collisions"); + } + + // auto mcTr1 = McParts.iteratorAt(tr1.udMcParticleId()); + // auto mcTr2 = McParts.iteratorAt(tr2.udMcParticleId()); + processMcRecoCand(cand, tr1, trMc1, tr2, trMc2); + } + } + PROCESS_SWITCH(fwdMuonsUPC, processMcReco, "", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/sgExclusivePhi.cxx b/PWGUD/Tasks/sgExclusivePhi.cxx index b9840c9b167..679d1677593 100644 --- a/PWGUD/Tasks/sgExclusivePhi.cxx +++ b/PWGUD/Tasks/sgExclusivePhi.cxx @@ -9,6 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -679,7 +680,7 @@ struct sgExclusivePhi { // auto ksize = allTracksAreITSonlyAndFourITSclusters.size(); registry.fill(HIST("hTracksITSonly"), allTracksAreITSonlyAndFourITSclusters.size()); - for (int kaon = 0; kaon < allTracksAreITSonlyAndFourITSclusters.size(); kaon++) { + for (std::size_t kaon = 0; kaon < allTracksAreITSonlyAndFourITSclusters.size(); kaon++) { int clusterSize[7]; double averageClusterSize = 0.; diff --git a/PWGUD/Tasks/sgExclusivePhiITSselections.cxx b/PWGUD/Tasks/sgExclusivePhiITSselections.cxx index cf615d18257..76c56e609f5 100644 --- a/PWGUD/Tasks/sgExclusivePhiITSselections.cxx +++ b/PWGUD/Tasks/sgExclusivePhiITSselections.cxx @@ -9,6 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -322,7 +323,7 @@ struct sgExclusivePhiITSselections { registry.fill(HIST("hdEdxKaon9"), momentum, dEdx); registry.fill(HIST("hTracksITSonly"), allTracksAreITSonlyAndFourITSclusters.size()); - for (int kaon = 0; kaon < allTracksAreITSonlyAndFourITSclusters.size(); kaon++) { + for (std::size_t kaon = 0; kaon < allTracksAreITSonlyAndFourITSclusters.size(); kaon++) { int clusterSize[7]; double averageClusterSize = 0.; diff --git a/PWGUD/Tasks/sgPIDAnalyzer.cxx b/PWGUD/Tasks/sgPIDAnalyzer.cxx new file mode 100644 index 00000000000..9a69891ee0a --- /dev/null +++ b/PWGUD/Tasks/sgPIDAnalyzer.cxx @@ -0,0 +1,358 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// \Single Gap Event Analyzer +// \author Sasha Bylinkin, alexander.bylinkin@gmail.com +// \since April 2023 + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" + +#include "TVector3.h" +#include "TTree.h" +#include "TFile.h" +#include +#include +#include "Common/DataModel/PIDResponse.h" +#include "PWGUD/DataModel/SGTables.h" +#include "PWGUD/Core/UDHelpers.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct sgPIDAnalyzer { + HistogramRegistry histos{"Histos", {}}; + + ConfigurableAxis ptAxis{ + "ptAxis", + {200, 0.0, 10.0}, + "Pt binning"}; + + ConfigurableAxis sigmaAxis{"sigmaAxis", {1000, -20, 180}, "nSigma TPC binning"}; + ConfigurableAxis tofAxis{"tofAxis", {200, -10, 10}, "nSigma TOF binning"}; + Configurable eta_min{"eta_min", -0.9, "Track Pseudorapidity"}; + Configurable eta_max{"eta_max", 0.9, "Track Pseudorapidity"}; + + void init(InitContext&) + { + + const AxisSpec ptBins{ptAxis, "p_{T} axis"}; + const AxisSpec nSigmaBins{sigmaAxis, "pseudo rapidity axis"}; + const AxisSpec ntofBins{tofAxis, "pseudo rapidity axis"}; + histos.add("Events", "Selected Events", {HistType::kTH1F, {{3, -.5, 2.5}}}); + histos.add("TPC/pTPC_Pi", "Positive TPC Pi Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pi", "Negative TPC Pi Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Ka", "Positive TPC Ka Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Ka", "Negative TPC Ka Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Pr", "Positive TPC Pr Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pr", "Negative TPC Pr Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_El", "Positive TPC El Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_El", "Negative TPC El Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_De", "Positive TPC De Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_De", "Negative TPC De Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Tr", "Positive TPC Tr Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Tr", "Negative TPC Tr Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_He", "Positive TPC He Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_He", "Negative TPC He Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Al", "Positive TPC Al Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Al", "Negative TPC Al Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Mu", "Positive TPC Mu Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Mu", "Negative TPC Mu Tracks", {HistType::kTH2F, {ptBins, nSigmaBins}}); + + histos.add("TPC/pTPC_Pi_Ka", "Positive TPC Pi vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Pi_Pr", "Positive TPC Pi vs Pr", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Pi_El", "Positive TPC Pi vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Pi_De", "Positive TPC Pi vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Ka_Pi", "Positive TPC Ka vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Ka_Pr", "Positive TPC Ka vs Pr", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Ka_El", "Positive TPC Ka vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Ka_De", "Positive TPC Ka vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Pr_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Pr_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Pr_El", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_Pr_De", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_El_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_El_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_El_Pr", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_El_De", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_De_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_De_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_De_Pr", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/pTPC_De_El", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + + histos.add("TPC/nTPC_Pi_Ka", "Positive TPC Pi vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pi_Pr", "Positive TPC Pi vs Pr", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pi_El", "Positive TPC Pi vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pi_De", "Positive TPC Pi vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Ka_Pi", "Positive TPC Ka vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Ka_Pr", "Positive TPC Ka vs Pr", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Ka_El", "Positive TPC Ka vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Ka_De", "Positive TPC Ka vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pr_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pr_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pr_El", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_Pr_De", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_El_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_El_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_El_Pr", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_El_De", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_De_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_De_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_De_Pr", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TPC/nTPC_De_El", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + + histos.add("TOF/pTOF_Pi_Ka", "Positive TPC Pi vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Pi_Pr", "Positive TPC Pi vs Pr", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Pi_El", "Positive TPC Pi vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Pi_De", "Positive TPC Pi vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Ka_Pi", "Positive TPC Ka vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Ka_Pr", "Positive TPC Ka vs Pr", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Ka_El", "Positive TPC Ka vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Ka_De", "Positive TPC Ka vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Pr_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Pr_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Pr_El", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_Pr_De", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_El_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_El_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_El_Pr", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_El_De", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_De_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_De_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_De_Pr", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/pTOF_De_El", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + + histos.add("TOF/nTOF_Pi_Ka", "Positive TPC Pi vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Pi_Pr", "Positive TPC Pi vs Pr", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Pi_El", "Positive TPC Pi vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Pi_De", "Positive TPC Pi vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Ka_Pi", "Positive TPC Ka vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Ka_Pr", "Positive TPC Ka vs Pr", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Ka_El", "Positive TPC Ka vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Ka_De", "Positive TPC Ka vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Pr_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Pr_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Pr_El", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_Pr_De", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_El_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_El_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_El_Pr", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_El_De", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_De_Pi", "Positive TPC Pr vs Pi", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_De_Ka", "Positive TPC Pr vs Ka", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_De_Pr", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + histos.add("TOF/nTOF_De_El", "Positive TPC Pr vs El", {HistType::kTH2F, {ptBins, nSigmaBins}}); + + histos.add("TOF/pPi", "Positive TPC Pi vs TOF Pi vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nPi", "Negative TPC Pi vs TOF Pi vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/pKa", "Positive TPC Ka vs TOF Ka vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nKa", "Negative TPC Ka vs TOF Ka vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/pPr", "Positive TPC Pr vs TOF Pr vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nPr", "Negative TPC Pr vs TOF Pr vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/pEl", "Positive TPC El vs TOF El vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nEl", "Negative TPC El vs TOF El vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/pDe", "Positive TPC De vs TOF Pi vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nDe", "Negative TPC De vs TOF Pi vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/pTr", "Positive TPC Tr vs TOF Ka vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nTr", "Negative TPC Tr vs TOF Ka vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/pHe", "Positive TPC He vs TOF Pr vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nHe", "Negative TPC He vs TOF Pr vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/pAl", "Positive TPC Al vs TOF El vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nAl", "Negative TPC Al vs TOF El vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/pMu", "Positive TPC Mu vs TOF El vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + histos.add("TOF/nMu", "Negative TPC Mu vs TOF El vs pt", {HistType::kTH3F, {ptBins, ntofBins, ntofBins}}); + } + using SGEvent = aod::SGEvents::iterator; + void process(SGEvent const& event, aod::SGTracks const& tracks) + { + histos.fill(HIST("Events"), event.gs()); + for (const auto& track : tracks) { + if (track.eta() < eta_min || track.eta() > eta_max) + continue; + bool isPositive = (track.sign() > 0); + if (track.tofpi() == -999) { + // Directly fill histograms without a local variable for histName + if (isPositive) { + histos.fill(HIST("TPC/pTPC_Pi"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/pTPC_Ka"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/pTPC_Pr"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/pTPC_El"), track.pt(), track.tpcel()); + histos.fill(HIST("TPC/pTPC_De"), track.pt(), track.tpcde()); + histos.fill(HIST("TPC/pTPC_Tr"), track.pt(), track.tpctr()); + histos.fill(HIST("TPC/pTPC_He"), track.pt(), track.tpche()); + histos.fill(HIST("TPC/pTPC_Al"), track.pt(), track.tpcal()); + histos.fill(HIST("TPC/pTPC_Mu"), track.pt(), track.tpcmu()); + if (std::abs(track.tpcpi()) < 1) { + histos.fill(HIST("TPC/pTPC_Ka_Pi"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/pTPC_Pr_Pi"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/pTPC_El_Pi"), track.pt(), track.tpcel()); + histos.fill(HIST("TPC/pTPC_De_Pi"), track.pt(), track.tpcde()); + } + if (std::abs(track.tpcka()) < 1) { + histos.fill(HIST("TPC/pTPC_Pi_Ka"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/pTPC_Pr_Ka"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/pTPC_El_Ka"), track.pt(), track.tpcel()); + histos.fill(HIST("TPC/pTPC_De_Ka"), track.pt(), track.tpcde()); + } + if (std::abs(track.tpcpr()) < 1) { + histos.fill(HIST("TPC/pTPC_Pi_Pr"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/pTPC_Ka_Pr"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/pTPC_El_Pr"), track.pt(), track.tpcel()); + histos.fill(HIST("TPC/pTPC_De_Pr"), track.pt(), track.tpcde()); + } + if (std::abs(track.tpcel()) < 1) { + histos.fill(HIST("TPC/pTPC_Pi_El"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/pTPC_Ka_El"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/pTPC_Pr_El"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/pTPC_De_El"), track.pt(), track.tpcde()); + } + if (std::abs(track.tpcde()) < 1) { + histos.fill(HIST("TPC/pTPC_Pi_De"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/pTPC_Ka_De"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/pTPC_Pr_De"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/pTPC_El_De"), track.pt(), track.tpcel()); + } + } else { + histos.fill(HIST("TPC/nTPC_Pi"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/nTPC_Ka"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/nTPC_Pr"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/nTPC_El"), track.pt(), track.tpcel()); + histos.fill(HIST("TPC/nTPC_De"), track.pt(), track.tpcde()); + histos.fill(HIST("TPC/nTPC_Tr"), track.pt(), track.tpctr()); + histos.fill(HIST("TPC/nTPC_He"), track.pt(), track.tpche()); + histos.fill(HIST("TPC/nTPC_Al"), track.pt(), track.tpcal()); + histos.fill(HIST("TPC/nTPC_Mu"), track.pt(), track.tpcmu()); + if (std::abs(track.tpcpi()) < 1) { + histos.fill(HIST("TPC/nTPC_Ka_Pi"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/nTPC_Pr_Pi"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/nTPC_El_Pi"), track.pt(), track.tpcel()); + histos.fill(HIST("TPC/nTPC_De_Pi"), track.pt(), track.tpcde()); + } + if (std::abs(track.tpcka()) < 1) { + histos.fill(HIST("TPC/nTPC_Pi_Ka"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/nTPC_Pr_Ka"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/nTPC_El_Ka"), track.pt(), track.tpcel()); + histos.fill(HIST("TPC/nTPC_De_Ka"), track.pt(), track.tpcde()); + } + if (std::abs(track.tpcpr()) < 1) { + histos.fill(HIST("TPC/nTPC_Pi_Pr"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/nTPC_Ka_Pr"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/nTPC_El_Pr"), track.pt(), track.tpcel()); + histos.fill(HIST("TPC/nTPC_De_Pr"), track.pt(), track.tpcde()); + } + if (std::abs(track.tpcel()) < 1) { + histos.fill(HIST("TPC/nTPC_Pi_El"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/nTPC_Ka_El"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/nTPC_Pr_El"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/nTPC_De_El"), track.pt(), track.tpcde()); + } + if (std::abs(track.tpcde()) < 1) { + histos.fill(HIST("TPC/nTPC_Pi_De"), track.pt(), track.tpcpi()); + histos.fill(HIST("TPC/nTPC_Ka_De"), track.pt(), track.tpcka()); + histos.fill(HIST("TPC/nTPC_Pr_De"), track.pt(), track.tpcpr()); + histos.fill(HIST("TPC/nTPC_El_De"), track.pt(), track.tpcel()); + } + } + } else { + if (isPositive) { + histos.fill(HIST("TOF/pPi"), track.pt(), track.tpcpi(), track.tofpi()); + histos.fill(HIST("TOF/pKa"), track.pt(), track.tpcka(), track.tofka()); + histos.fill(HIST("TOF/pPr"), track.pt(), track.tpcpr(), track.tofpr()); + histos.fill(HIST("TOF/pEl"), track.pt(), track.tpcel(), track.tofel()); + histos.fill(HIST("TOF/pDe"), track.pt(), track.tpcpi(), track.tofde()); + histos.fill(HIST("TOF/pTr"), track.pt(), track.tpcka(), track.toftr()); + histos.fill(HIST("TOF/pHe"), track.pt(), track.tpcpr(), track.tofhe()); + histos.fill(HIST("TOF/pAl"), track.pt(), track.tpcel(), track.tofal()); + histos.fill(HIST("TOF/pMu"), track.pt(), track.tpcel(), track.tofmu()); + if (std::abs(track.tofpi()) < 1) { + histos.fill(HIST("TOF/pTOF_Ka_Pi"), track.pt(), track.tofka()); + histos.fill(HIST("TOF/pTOF_Pr_Pi"), track.pt(), track.tofpr()); + histos.fill(HIST("TOF/pTOF_El_Pi"), track.pt(), track.tofel()); + histos.fill(HIST("TOF/pTOF_De_Pi"), track.pt(), track.tofde()); + } + if (std::abs(track.tofka()) < 1) { + histos.fill(HIST("TOF/pTOF_Pi_Ka"), track.pt(), track.tofpi()); + histos.fill(HIST("TOF/pTOF_Pr_Ka"), track.pt(), track.tofpr()); + histos.fill(HIST("TOF/pTOF_El_Ka"), track.pt(), track.tofel()); + histos.fill(HIST("TOF/pTOF_De_Ka"), track.pt(), track.tofde()); + } + if (std::abs(track.tofpr()) < 1) { + histos.fill(HIST("TOF/pTOF_Pi_Pr"), track.pt(), track.tofpi()); + histos.fill(HIST("TOF/pTOF_Ka_Pr"), track.pt(), track.tofka()); + histos.fill(HIST("TOF/pTOF_El_Pr"), track.pt(), track.tofel()); + histos.fill(HIST("TOF/pTOF_De_Pr"), track.pt(), track.tofde()); + } + if (std::abs(track.tofel()) < 1) { + histos.fill(HIST("TOF/pTOF_Pi_El"), track.pt(), track.tofpi()); + histos.fill(HIST("TOF/pTOF_Ka_El"), track.pt(), track.tofka()); + histos.fill(HIST("TOF/pTOF_Pr_El"), track.pt(), track.tofpr()); + histos.fill(HIST("TOF/pTOF_De_El"), track.pt(), track.tofde()); + } + if (std::abs(track.tofde()) < 1) { + histos.fill(HIST("TOF/pTOF_Pi_De"), track.pt(), track.tofpi()); + histos.fill(HIST("TOF/pTOF_Ka_De"), track.pt(), track.tofka()); + histos.fill(HIST("TOF/pTOF_Pr_De"), track.pt(), track.tofpr()); + histos.fill(HIST("TOF/pTOF_El_De"), track.pt(), track.tofel()); + } + } else { + histos.fill(HIST("TOF/nPi"), track.pt(), track.tpcpi(), track.tofpi()); + histos.fill(HIST("TOF/nKa"), track.pt(), track.tpcka(), track.tofka()); + histos.fill(HIST("TOF/nPr"), track.pt(), track.tpcpr(), track.tofpr()); + histos.fill(HIST("TOF/nEl"), track.pt(), track.tpcel(), track.tofel()); + histos.fill(HIST("TOF/nDe"), track.pt(), track.tpcpi(), track.tofde()); + histos.fill(HIST("TOF/nTr"), track.pt(), track.tpcka(), track.toftr()); + histos.fill(HIST("TOF/nHe"), track.pt(), track.tpcpr(), track.tofhe()); + histos.fill(HIST("TOF/nAl"), track.pt(), track.tpcel(), track.tofal()); + histos.fill(HIST("TOF/nMu"), track.pt(), track.tpcel(), track.tofmu()); + if (std::abs(track.tofpi()) < 1) { + histos.fill(HIST("TOF/nTOF_Ka_Pi"), track.pt(), track.tofka()); + histos.fill(HIST("TOF/nTOF_Pr_Pi"), track.pt(), track.tofpr()); + histos.fill(HIST("TOF/nTOF_El_Pi"), track.pt(), track.tofel()); + histos.fill(HIST("TOF/nTOF_De_Pi"), track.pt(), track.tofde()); + } + if (std::abs(track.tofka()) < 1) { + histos.fill(HIST("TOF/nTOF_Pi_Ka"), track.pt(), track.tofpi()); + histos.fill(HIST("TOF/nTOF_Pr_Ka"), track.pt(), track.tofpr()); + histos.fill(HIST("TOF/nTOF_El_Ka"), track.pt(), track.tofel()); + histos.fill(HIST("TOF/nTOF_De_Ka"), track.pt(), track.tofde()); + } + if (std::abs(track.tofpr()) < 1) { + histos.fill(HIST("TOF/nTOF_Pi_Pr"), track.pt(), track.tofpi()); + histos.fill(HIST("TOF/nTOF_Ka_Pr"), track.pt(), track.tofka()); + histos.fill(HIST("TOF/nTOF_El_Pr"), track.pt(), track.tofel()); + histos.fill(HIST("TOF/nTOF_De_Pr"), track.pt(), track.tofde()); + } + if (std::abs(track.tofel()) < 1) { + histos.fill(HIST("TOF/nTOF_Pi_El"), track.pt(), track.tofpi()); + histos.fill(HIST("TOF/nTOF_Ka_El"), track.pt(), track.tofka()); + histos.fill(HIST("TOF/nTOF_Pr_El"), track.pt(), track.tofpr()); + histos.fill(HIST("TOF/nTOF_De_El"), track.pt(), track.tofde()); + } + if (std::abs(track.tofde()) < 1) { + histos.fill(HIST("TOF/nTOF_Pi_De"), track.pt(), track.tofpi()); + histos.fill(HIST("TOF/nTOF_Ka_De"), track.pt(), track.tofka()); + histos.fill(HIST("TOF/nTOF_Pr_De"), track.pt(), track.tofpr()); + histos.fill(HIST("TOF/nTOF_El_De"), track.pt(), track.tofel()); + } + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"sgpidanalyzer"})}; +} diff --git a/PWGUD/Tasks/sgPIDSpectraTable.cxx b/PWGUD/Tasks/sgPIDSpectraTable.cxx new file mode 100644 index 00000000000..e5ad7187a34 --- /dev/null +++ b/PWGUD/Tasks/sgPIDSpectraTable.cxx @@ -0,0 +1,128 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// \Single Gap Event Analyzer +// \author Sasha Bylinkin, alexander.bylinkin@gmail.com +// \since April 2023 +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" + +#include "TVector3.h" +#include "TTree.h" +#include "TFile.h" +#include "Common/DataModel/PIDResponse.h" +#include "PWGUD/DataModel/UDTables.h" +#include "PWGUD/DataModel/SGTables.h" +#include "PWGUD/Core/UDHelpers.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct SGPIDSpectraTable { + Produces SGevents; + Produces SGtracks; + SGSelector sgSelector; + + // configurables + Configurable FV0_cut{"FV0", 50., "FV0A threshold"}; + Configurable ZDC_cut{"ZDC", .1, "ZDC threshold"}; + Configurable FT0A_cut{"FT0A", 100., "FT0A threshold"}; + Configurable FT0C_cut{"FT0C", 50., "FT0C threshold"}; + Configurable FDDA_cut{"FDDA", 10000., "FDDA threshold"}; + Configurable FDDC_cut{"FDDC", 10000., "FDDC threshold"}; + Configurable GS_cut{"GS", 0., "Gap-side A=0, C=1, AC = 2, No Gap = -1, All events = 3"}; + // Track Selections + Configurable PV_cut{"PV_cut", 1.0, "Use Only PV tracks"}; + Configurable dcaZ_cut{"dcaZ_cut", 2.0, "dcaZ cut"}; + Configurable dcaXY_cut{"dcaXY_cut", 0.0, "dcaXY cut (0 for Pt-function)"}; + Configurable tpcChi2_cut{"tpcChi2_cut", 4, "Max tpcChi2NCl"}; + Configurable tpcNClsFindable_cut{"tpcNClsFindable_cut", 70, "Min tpcNClsFindable"}; + Configurable itsChi2_cut{"itsChi2_cut", 36, "Max itsChi2NCl"}; + Configurable eta_cut{"eta_cut", 0.9, "Track Pseudorapidity"}; + Configurable pt_cut{"pt_cut", 0.1, "Track Pt"}; + // initialize histogram registry + HistogramRegistry registry{ + "registry", + {}}; + + void init(InitContext&) + { + // Collision histograms + } + + // define data types + using UDCollisionsFull = soa::Join; // UDCollisions + using UDCollisionFull = UDCollisionsFull::iterator; + using UDTracksFull = soa::Join; + + void process(UDCollisionFull const& coll, UDTracksFull const& tracks) + { + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + int truegapSide = sgSelector.trueGap(coll, FIT_cut[0], FIT_cut[1], FIT_cut[2], ZDC_cut); + if (GS_cut != 3) { + if (truegapSide != GS_cut) + return; + } + // fill collision histograms + // int truegapSide = sgSelector.trueGap(dgcand, FV0_cut, ZDC_cut); + // select PV contributors + std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut, eta_cut, pt_cut}; + // check rho0 signals + float tpcpi, tpcka, tpcel, tpcpr, tofpi, tofka, tofpr, tofel; + float tpcde, tpctr, tpche, tpcal, tofde, toftr, tofhe, tofal, tpcmu, tofmu; + TVector3 a; + int goodtracks = 0; + for (auto t : tracks) { + if (trackselector(t, parameters)) { + goodtracks++; + } + } + if (!goodtracks) + return; + SGevents(coll.runNumber(), coll.flags(), truegapSide, coll.energyCommonZNA(), coll.energyCommonZNC(), goodtracks); + // SGevents(coll.runNumber(), coll.flags()); + for (auto t : tracks) { + if (trackselector(t, parameters)) { + a.SetXYZ(t.px(), t.py(), t.pz()); + tpcpi = t.hasTPC() ? t.tpcNSigmaPi() : -999; + tpcmu = t.hasTPC() ? t.tpcNSigmaMu() : -999; + tpcka = t.hasTPC() ? t.tpcNSigmaKa() : -999; + tpcpr = t.hasTPC() ? t.tpcNSigmaPr() : -999; + tpcel = t.hasTPC() ? t.tpcNSigmaEl() : -999; + tofpi = t.hasTOF() ? t.tofNSigmaPi() : -999; + tofmu = t.hasTOF() ? t.tofNSigmaMu() : -999; + tofka = t.hasTOF() ? t.tofNSigmaKa() : -999; + tofpr = t.hasTOF() ? t.tofNSigmaPr() : -999; + tofel = t.hasTOF() ? t.tofNSigmaEl() : -999; + tpcde = t.hasTPC() ? t.tpcNSigmaDe() : -999; + tpctr = t.hasTPC() ? t.tpcNSigmaTr() : -999; + tpche = t.hasTPC() ? t.tpcNSigmaHe() : -999; + tpcal = t.hasTPC() ? t.tpcNSigmaAl() : -999; + tofde = t.hasTOF() ? t.tofNSigmaDe() : -999; + toftr = t.hasTOF() ? t.tofNSigmaTr() : -999; + tofhe = t.hasTOF() ? t.tofNSigmaHe() : -999; + tofal = t.hasTOF() ? t.tofNSigmaAl() : -999; + SGtracks(SGevents.lastIndex(), a.Pt(), a.Eta(), a.Phi(), t.sign(), tpcpi, tpcka, tpcpr, tpcel, tofpi, tofka, tofpr, tofel, tpcmu, tofmu, tpcde, tpctr, tpche, tpcal, tofde, toftr, tofhe, tofal); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"sgpidspectratable"}), + }; +} diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index 90b692a9af3..bb9c8f051bc 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -13,21 +13,27 @@ // \since May 2024 #include +#include +#include +#include +#include +#include "Math/Vector4D.h" +#include "Math/Vector3D.h" +#include "Math/GenVector/Boost.h" + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoA.h" #include "Framework/ASoAHelpers.h" +#include "ReconstructionDataFormats/Vertex.h" + #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/SGSelector.h" #include "PWGUD/Core/SGTrackSelector.h" +#include "PWGUD/Core/UPCHelpers.h" + #include "Common/DataModel/PIDResponse.h" -#include -#include "TLorentzVector.h" -#include -#include "Math/Vector4D.h" -#include "Math/Vector3D.h" -#include "Math/GenVector/Boost.h" using namespace std; using namespace o2; @@ -59,17 +65,22 @@ struct SGResonanceAnalyzer { Configurable itsChi2_cut{"itsChi2_cut", 36, "Max itsChi2NCl"}; Configurable eta_cut{"eta_cut", 0.9, "Track Pseudorapidity"}; Configurable pt_cut{"pt_cut", 0.15, "Track pt cut"}; + Configurable pt1{"pt1", 0.3, "pid selection pt1"}; + Configurable pt2{"pt2", 0.4, "pid selection pt2"}; + Configurable pt3{"pt3", 0.5, "pid selection pt3"}; Configurable EtaGapMin{"EtaGapMin", 0.0, "Track eta min"}; Configurable EtaGapMax{"EtaGapMax", 0.9, "Track eta min"}; Configurable EtaDG{"EtaDG", 0.5, "Track eta DG"}; + Configurable nsigmatpc_cut1{"nsigmatpc1", 3.0, "nsigma tpc cut1"}; + Configurable nsigmatpc_cut2{"nsigmatpc2", 3.0, "nsigma tpc cut2"}; + Configurable nsigmatpc_cut3{"nsigmatpc3", 3.0, "nsigma tpc cut3"}; Configurable nsigmatpc_cut{"nsigmatpc", 3.0, "nsigma tpc cut"}; Configurable nsigmatof_cut{"nsigmatof", 9.0, "nsigma tof cut"}; Configurable mintrack{"min_track", 1, "min track"}; Configurable maxtrack{"max_track", 50, "max track"}; - Configurable use_tof{"Use_TOF", true, "TOF PID"}; Configurable QA{"QA", true, ""}; Configurable rapidity_gap{"rapidity_gap", true, ""}; @@ -78,17 +89,32 @@ struct SGResonanceAnalyzer { Configurable rho{"rho", true, ""}; Configurable kstar{"kstar", true, ""}; Configurable fourpion{"fourpion", true, ""}; + + Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 1, "Number of mixed events per event"}; + Configurable nBkgRotations{"nBkgRotations", 9, "Number of rotated copies (background) per each original candidate"}; + Configurable fillRotation{"fillRotation", true, "fill rotation"}; + Configurable confMinRot{"confMinRot", 5.0 * TMath::Pi() / 6.0, "Minimum of rotation"}; + Configurable confMaxRot{"confMaxRot", 7.0 * TMath::Pi() / 6.0, "Maximum of rotation"}; + void init(InitContext const&) { registry.add("GapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); registry.add("TrueGapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); if (phi) { - registry.add("os_KK_pT_0", "pt kaon pair", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_pT_1", "pt kaon pair", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_pT_2", "pt kaon pair", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_ls_pT_0", "kaon pair like sign", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_ls_pT_1", "kaon pair like sign", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_ls_pT_2", "kaon pair like sign", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_pT_0", "pt kaon pair", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_pT_1", "pt kaon pair", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_pT_2", "pt kaon pair", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_ls_pT_0", "kaon pair like sign", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_ls_pT_1", "kaon pair like sign", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_ls_pT_2", "kaon pair like sign", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + + registry.add("os_KK_mix_pT_0", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_mix_pT_1", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_mix_pT_2", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + + registry.add("os_KK_rot_pT_0", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_rot_pT_1", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_rot_pT_2", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); } if (rho) { registry.add("os_pp_pT_0", "pt pion pair", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); @@ -102,13 +128,26 @@ struct SGResonanceAnalyzer { registry.add("os_pk_pT_0", "pion-kaon pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_pk_pT_1", "pion-kaon pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_pk_pT_2", "pion-kaon pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + + registry.add("os_pk_mix_pT_0", "pion-kaon mix pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_mix_pT_1", "pion-kaon mix pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_mix_pT_2", "pion-kaon mix pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + + registry.add("os_pk_rot_pT_0", "pion-kaon rotional pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_rot_pT_1", "pion-kaon rotional pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_rot_pT_2", "pion-kaon rotional pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_ls_pT_0", "pion-kaon pair like sign", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_pk_ls_pT_1", "pion-kaon like sign", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_pk_ls_pT_2", "pion-kaon like sign", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + + registry.add("hRotation", "hRotation", kTH1F, {{360, 0.0, 2.0 * TMath::Pi()}}); } // QA plots if (QA) { registry.add("tpc_dedx", "p vs dE/dx", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + registry.add("tof_beta", "p vs beta", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + registry.add("tpc_dedx_kaon", "p#k dE/dx", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); registry.add("tpc_dedx_pion", "p#pi dE/dx", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); registry.add("tpc_dedx_kaon_1", "tpc+tof pid cut p#k dE/dx", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); @@ -119,6 +158,9 @@ struct SGResonanceAnalyzer { registry.add("tpc_tof_nsigma_kaon", "p#k n#sigma TPC vs TOF", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); registry.add("tpc_tof_nsigma_pion", "p#pi n#sigma TPC vs TOF", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); + registry.add("tof_nsigma_kaon", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + registry.add("tof_nsigma_pion", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + registry.add("FT0A", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); registry.add("FT0A_0", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); registry.add("FT0A_1", "T0A amplitude", kTH1F, {{20000, 0.0, 20000.0}}); @@ -150,31 +192,32 @@ struct SGResonanceAnalyzer { registry.add("rap2_mult3", "rap2_mult3", kTH1F, {{150, 0, 150}}); } } + registry.add("gap_mult0", "Mult 0", kTH1F, {{100, 0.0, 100.0}}); registry.add("gap_mult1", "Mult 1", kTH1F, {{100, 0.0, 100.0}}); registry.add("gap_mult2", "Mult 2", kTH1F, {{100, 0.0, 100.0}}); // Multiplicity plot if (rapidity_gap && phi) { - registry.add("os_kk_mass_rap", "phi mass1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass_rap1", "phi mass2", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass_rap2", "phi mass3", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap", "phi mass1 gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap1", "phi mass2 gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap2", "phi mass3 gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap", "phi mass1 DG", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap1", "phi mass2 DG", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap2", "phi mass3 DG", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass_rap", "phi mass1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass_rap1", "phi mass2", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass_rap2", "phi mass3", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass1_rap", "phi mass1 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass1_rap1", "phi mass2 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass1_rap2", "phi mass3 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass2_rap", "phi mass1 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass2_rap1", "phi mass2 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_mass2_rap2", "phi mass3 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); // like sign bkg - registry.add("os_kk_ls_mass_rap", "phi ls mass1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass_rap1", "phi ls mass2", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass_rap2", "phi ls mass3", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass1_rap", "phi ls mass1 gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass1_rap1", "phi ls mass2 gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass1_rap2", "phi ls mass3 gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass2_rap", "phi ls mass1 DG", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass2_rap1", "phi ls mass2 DG", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass2_rap2", "phi ls mass3 DG", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass_rap", "phi ls mass1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass_rap1", "phi ls mass2", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass_rap2", "phi ls mass3", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass1_rap", "phi ls mass1 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass1_rap1", "phi ls mass2 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass1_rap2", "phi ls mass3 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass2_rap", "phi ls mass1 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass2_rap1", "phi ls mass2 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kk_ls_mass2_rap2", "phi ls mass3 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); } if (rapidity_gap && kstar) { @@ -246,6 +289,53 @@ struct SGResonanceAnalyzer { Double_t CosThetaCS = zaxis_CS.Dot((v1_CM)); return CosThetaCS; } + + template + bool selectionPIDKaon1(const T& candidate) + { + auto pt = TMath::Sqrt(candidate.px() * candidate.px() + candidate.py() * candidate.py()); + // float pt1, pt2, pt3 , nsigmatpc_cut1, nsigmatpc_cut2, nsigmatpc_cut3; + if (use_tof && pt < pt1 && std::abs(candidate.tpcNSigmaKa()) < nsigmatpc_cut1) { + return true; + } + if (use_tof && pt >= pt1 && pt < pt2 && std::abs(candidate.tpcNSigmaKa()) < nsigmatpc_cut2) { + return true; + } + if (use_tof && pt >= pt2 && pt < pt3 && std::abs(candidate.tpcNSigmaKa()) < nsigmatpc_cut3) { + return true; + } + if (pt > pt3 && use_tof && candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < nsigmatof_cut) { + return true; + } + if (!use_tof && std::abs(candidate.tpcNSigmaKa()) < nsigmatpc_cut) { + return true; + } + return false; + } + + template + bool selectionPIDPion1(const T& candidate) + { + auto pt = TMath::Sqrt(candidate.px() * candidate.px() + candidate.py() * candidate.py()); + + if (use_tof && pt < pt1 && std::abs(candidate.tpcNSigmaPi()) < nsigmatpc_cut1) { + return true; + } + if (use_tof && pt >= pt1 && pt < pt2 && std::abs(candidate.tpcNSigmaPi()) < nsigmatpc_cut2) { + return true; + } + if (use_tof && pt >= pt2 && pt < pt3 && std::abs(candidate.tpcNSigmaPi()) < nsigmatpc_cut3) { + return true; + } + if (pt > pt3 && use_tof && candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < nsigmatof_cut) { + return true; + } + if (!use_tof && std::abs(candidate.tpcNSigmaPi()) < nsigmatpc_cut) { + return true; + } + return false; + } + //------------------------------------------------------------------------------------------------------ Double_t PhiCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) { @@ -285,6 +375,11 @@ struct SGResonanceAnalyzer { TLorentzVector v1; TLorentzVector v01; TLorentzVector v0_1; + int gapSide = collision.gapSide(); + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut, eta_cut, pt_cut}; + int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[2], ZDC_cut); + ROOT::Math::PtEtaPhiMVector phiv; ROOT::Math::PtEtaPhiMVector phiv1; @@ -297,10 +392,6 @@ struct SGResonanceAnalyzer { std::vector onlyPionTracks_n; std::vector rawPionTracks_n; - int gapSide = collision.gapSide(); - float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; - std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut, eta_cut, pt_cut}; - int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[2], ZDC_cut); registry.fill(HIST("GapSide"), gapSide); registry.fill(HIST("TrueGapSide"), truegapSide); gapSide = truegapSide; @@ -331,7 +422,7 @@ struct SGResonanceAnalyzer { continue; v0.SetXYZM(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassPionCharged); ROOT::Math::PtEtaPhiMVector vv1(v0.Pt(), v0.Eta(), v0.Phi(), o2::constants::physics::MassPionCharged); - if (selectionPIDPion(track1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + if (selectionPIDPion1(track1)) { onlyPionTracks_pm.push_back(vv1); rawPionTracks_pm.push_back(track1); if (track1.sign() == 1) { @@ -371,20 +462,24 @@ struct SGResonanceAnalyzer { if (QA) { registry.fill(HIST("tpc_dedx"), v0.P(), track1.tpcSignal()); + registry.fill(HIST("tof_beta"), v0.P(), track1.beta()); + registry.fill(HIST("tof_nsigma_kaon"), v0.Pt(), track1.tofNSigmaKa()); + registry.fill(HIST("tof_nsigma_pion"), v0.Pt(), track1.tofNSigmaPi()); + if (std::abs(track1.tpcNSigmaKa()) < 3.0) { registry.fill(HIST("tpc_dedx_kaon"), v0.P(), track1.tpcSignal()); } else if (std::abs(track1.tpcNSigmaPi()) < 3.0) { registry.fill(HIST("tpc_dedx_pion"), v0.P(), track1.tpcSignal()); } - if (selectionPIDKaon(track1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + if (selectionPIDKaon1(track1)) { registry.fill(HIST("tpc_dedx_kaon_1"), v0.P(), track1.tpcSignal()); registry.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), track1.tpcNSigmaKa()); registry.fill(HIST("tpc_tof_nsigma_kaon"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); } - if (selectionPIDKaon(track1, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(track1.tpcNSigmaPi()) > 3.0) { + if (selectionPIDKaon1(track1) && std::abs(track1.tpcNSigmaPi()) > 3.0) { registry.fill(HIST("tpc_dedx_kaon_2"), v0.P(), track1.tpcSignal()); } - if (selectionPIDPion(track1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + if (selectionPIDPion1(track1)) { registry.fill(HIST("tpc_dedx_pion_1"), v0.P(), track1.tpcSignal()); registry.fill(HIST("tpc_nsigma_pion"), v0.Pt(), track1.tpcNSigmaPi()); registry.fill(HIST("tpc_tof_nsigma_pion"), track1.tpcNSigmaPi(), track1.tofNSigmaPi()); @@ -467,7 +562,7 @@ struct SGResonanceAnalyzer { for (auto& [t0, t1] : combinations(tracks, tracks)) { if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) continue; - if (phi && selectionPIDKaon(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && selectionPIDKaon(t1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { // Apply kaon hypothesis and create pairs v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); @@ -496,7 +591,7 @@ struct SGResonanceAnalyzer { } } } - if (kstar && selectionPIDKaon(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(t0.tpcNSigmaPi()) > 3.0 && selectionPIDPion(t1, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(t1.tpcNSigmaKa()) > 3.0) { + if (kstar && selectionPIDKaon1(t0) && std::abs(t0.tpcNSigmaPi()) > 3.0 && selectionPIDPion1(t1) && std::abs(t1.tpcNSigmaKa()) > 3.0) { // Apply kaon hypothesis and create pairs v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); @@ -532,7 +627,7 @@ struct SGResonanceAnalyzer { for (auto& [t0, t1] : combinations(tracks, tracks)) { if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) continue; - if (phi && selectionPIDKaon(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && selectionPIDKaon(t1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { // Apply kaon hypothesis and create pairs v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); @@ -561,7 +656,7 @@ struct SGResonanceAnalyzer { } } } - if (kstar && selectionPIDKaon(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(t0.tpcNSigmaPi()) > 3.0 && selectionPIDPion(t1, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(t1.tpcNSigmaKa()) > 3.0) { + if (kstar && selectionPIDKaon1(t0) && std::abs(t0.tpcNSigmaPi()) > 3.0 && selectionPIDPion1(t1) && std::abs(t1.tpcNSigmaKa()) > 3.0) { // Apply kaon hypothesis and create pairs v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); @@ -596,7 +691,7 @@ struct SGResonanceAnalyzer { for (auto& [t0, t1] : combinations(tracks, tracks)) { if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) continue; - if (phi && selectionPIDKaon(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && selectionPIDKaon(t1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { // Apply kaon hypothesis and create pairs v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); @@ -625,7 +720,7 @@ struct SGResonanceAnalyzer { } } } - if (kstar && selectionPIDKaon(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(t0.tpcNSigmaPi()) > 3.0 && selectionPIDPion(t1, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(t1.tpcNSigmaKa()) > 3.0) { + if (kstar && selectionPIDKaon1(t0) && std::abs(t0.tpcNSigmaPi()) > 3.0 && selectionPIDPion1(t1) && std::abs(t1.tpcNSigmaKa()) > 3.0) { // Apply kaon hypothesis and create pairs v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); @@ -661,7 +756,7 @@ struct SGResonanceAnalyzer { for (auto& [t0, t1] : combinations(tracks, tracks)) { if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) continue; - if (phi && selectionPIDKaon(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && selectionPIDKaon(t1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { // Apply kaon hypothesis and create pairs v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); @@ -690,8 +785,36 @@ struct SGResonanceAnalyzer { registry.fill(HIST("os_KK_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } + + if (fillRotation) { + for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { + auto anglestart = confMinRot; + auto angleend = confMaxRot; + auto anglestep = (angleend - anglestart) / (1.0 * (nBkgRotations - 1)); + auto rotangle = anglestart + nrotbkg * anglestep; + registry.fill(HIST("hRotation"), rotangle); + + auto rotkaonPx = t0.px() * std::cos(rotangle) - t0.py() * std::sin(rotangle); + auto rotkaonPy = t0.px() * std::sin(rotangle) + t0.py() * std::cos(rotangle); + + v0.SetXYZM(rotkaonPx, rotkaonPy, t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); + v01 = v0 + v1; + if (t0.sign() != t1.sign()) { + if (gapSide == 0) { + registry.fill(HIST("os_KK_rot_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 1) { + registry.fill(HIST("os_KK_rot_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 2) { + registry.fill(HIST("os_KK_rot_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } + } + } } - if (rho && selectionPIDProton(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && selectionPIDPion(t1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + if (rho && selectionPIDPion1(t0) && selectionPIDPion1(t1)) { v0.SetXYZM(t0.px(), t0.py(), t0.pz(), mproton); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; @@ -719,7 +842,7 @@ struct SGResonanceAnalyzer { } } } - if (kstar && selectionPIDKaon(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(t0.tpcNSigmaPi()) > 3.0 && selectionPIDPion(t1, use_tof, nsigmatpc_cut, nsigmatof_cut) && std::abs(t1.tpcNSigmaKa()) > 3.0) { + if (kstar && selectionPIDKaon1(t0) && std::abs(t0.tpcNSigmaPi()) > 3.0 && selectionPIDPion1(t1) && std::abs(t1.tpcNSigmaKa()) > 3.0) { v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; @@ -746,6 +869,33 @@ struct SGResonanceAnalyzer { registry.fill(HIST("os_pk_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } + if (fillRotation) { + for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { + auto anglestart = confMinRot; + auto angleend = confMaxRot; + auto anglestep = (angleend - anglestart) / (1.0 * (nBkgRotations - 1)); + auto rotangle = anglestart + nrotbkg * anglestep; + registry.fill(HIST("hRotation"), rotangle); + + auto rotkaonPx = t0.px() * std::cos(rotangle) - t0.py() * std::sin(rotangle); + auto rotkaonPy = t0.px() * std::sin(rotangle) + t0.py() * std::cos(rotangle); + + v0.SetXYZM(rotkaonPx, rotkaonPy, t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + v01 = v0 + v1; + if (t0.sign() != t1.sign()) { + if (gapSide == 0) { + registry.fill(HIST("os_pk_rot_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 1) { + registry.fill(HIST("os_pk_rot_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 2) { + registry.fill(HIST("os_pk_rot_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } + } + } } } if (fourpion) { @@ -791,6 +941,74 @@ struct SGResonanceAnalyzer { } } } + PROCESS_SWITCH(SGResonanceAnalyzer, process, "Process unlike event", false); + + using UDCollisionsFull1 = soa::Join; // + SliceCache cache; + Partition posTracks = aod::udtrack::sign > 0; + Partition negTracks = aod::udtrack::sign < 0; + + ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for bin"}; + ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {10, 0, 100}, "multiplicity percentile for bin"}; + using BinningTypeVertexContributor = ColumnBinningPolicy; + void mixprocess(UDCollisionsFull1 const& collisions, udtracksfull const& /*track*/) + { + TLorentzVector v0; + TLorentzVector v1; + TLorentzVector v01; + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut, eta_cut, pt_cut}; + BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass}, true}; + for (auto const& [collision1, collision2] : o2::soa::selfCombinations(binningOnPositions, cfgNoMixedEvents, -1, collisions, collisions)) { + int truegapSide1 = sgSelector.trueGap(collision1, FIT_cut[0], FIT_cut[1], FIT_cut[2], ZDC_cut); + int truegapSide2 = sgSelector.trueGap(collision2, FIT_cut[0], FIT_cut[1], FIT_cut[2], ZDC_cut); + if (truegapSide1 != truegapSide2) + continue; + if (truegapSide1 == -1) + continue; + auto posThisColl = posTracks->sliceByCached(aod::udtrack::udCollisionId, collision1.globalIndex(), cache); + auto negThisColl = negTracks->sliceByCached(aod::udtrack::udCollisionId, collision2.globalIndex(), cache); + for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(posThisColl, negThisColl))) { + if (!trackselector(track1, parameters) || !trackselector(track2, parameters)) + continue; + if (selectionPIDKaon1(track1) && selectionPIDKaon1(track2)) { + v0.SetXYZM(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassKaonCharged); + v1.SetXYZM(track2.px(), track2.py(), track2.pz(), o2::constants::physics::MassKaonCharged); + v01 = v0 + v1; + // Opposite sign pairs + if (track1.sign() != track2.sign()) { + if (truegapSide1 == 0) { + registry.fill(HIST("os_KK_mix_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (truegapSide1 == 1) { + registry.fill(HIST("os_KK_mix_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (truegapSide1 == 2) { + registry.fill(HIST("os_KK_mix_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } + } + if (selectionPIDKaon1(track1) && std::abs(track1.tpcNSigmaPi()) > 3.0 && selectionPIDPion1(track2) && std::abs(track2.tpcNSigmaKa()) > 3.0) { + v0.SetXYZM(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassKaonCharged); + v1.SetXYZM(track2.px(), track2.py(), track2.pz(), o2::constants::physics::MassPionCharged); + v01 = v0 + v1; + // Opposite sign pairs + if (track1.sign() != track2.sign()) { + if (truegapSide1 == 0) { + registry.fill(HIST("os_pk_mix_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (truegapSide1 == 1) { + registry.fill(HIST("os_pk_mix_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (truegapSide1 == 2) { + registry.fill(HIST("os_pk_mix_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } + } + } + } + } + PROCESS_SWITCH(SGResonanceAnalyzer, mixprocess, "Process Mixed event", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx b/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx index d51e514d206..fed6937f561 100644 --- a/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx +++ b/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx @@ -13,6 +13,9 @@ /// \author Sara Haidlova, sara.haidlova@cern.ch /// \since March 2024 +#include +#include + // O2 headers #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -39,33 +42,42 @@ SGSelector sgSelector; struct UpcJpsiCentralBarrel { // configurable axes - ConfigurableAxis axisIVM{"axisIVM", {350.0f, 2.0f, 4.5f}, "M_#it{inv} (GeV/#it{c}^{2})"}; + ConfigurableAxis axisIVM{"axisIVM", {500.0f, 2.0f, 4.5f}, "M_#it{inv} (GeV/#it{c}^{2})"}; ConfigurableAxis axisIVMWide{"axisIVMWide", {350.0f, 0.0f, 4.5f}, "M_#it{inv} (GeV/#it{c}^{2})"}; ConfigurableAxis axisPt{"axisPt", {250.0f, 0.1f, 3.0f}, "#it{p}_T (GeV/#it{c})"}; + ConfigurableAxis axisPt2{"axisPt2", {250.0f, 0.0f, 0.01f}, "#it{p}_T (GeV/#it{c})"}; + ConfigurableAxis axisPt2wide{"axisPt2wide", {250.0f, 0.0f, 0.04f}, "#it{p}_T (GeV/#it{c})"}; ConfigurableAxis axisP{"axisP", {250.0f, 0.1f, 3.0f}, "#it{p} (GeV/#it{c})"}; ConfigurableAxis axisEta{"axisEta", {250.0f, -1.5f, 1.5f}, "#eta (-)"}; - ConfigurableAxis axisCounter{"axisCounter", {15.0f, 0.0f, 15.0f}, "Number of events (-)"}; + ConfigurableAxis axisCounter{"axisCounter", {20.0f, 0.0f, 20.0f}, "Number of events (-)"}; ConfigurableAxis axisPhi{"axisPhi", {250.0f, 0, TwoPI}, "#phi (rad)"}; ConfigurableAxis axisAccAngle{"axisAccAngle", {250.0f, -0.2f, 0.2f}, "accAngle"}; ConfigurableAxis axisAngTheta{"axisAngTheta", {250.0f, -1.5f, 1.5f}, "cos #theta (-)"}; - ConfigurableAxis axisTPC{"axisTPC", {100.0f, 0, 200.0f}, "TPC d#it{E}/d#it{x}"}; - ConfigurableAxis axisTOF{"axisTOF", {100.0f, 0, 200.0f}, "TOF d#it{E}/d#it{x}"}; + ConfigurableAxis axisTPC{"axisTPC", {1000.0f, 0, 200.0f}, "TPC d#it{E}/d#it{x}"}; ConfigurableAxis axisBetaTOF{"axisBetaTOF", {100.0f, 0, 1.5}, "TOF #beta"}; - ConfigurableAxis axisSigma{"axisSigma", {20, -10, 10}, "#sigma"}; + ConfigurableAxis axisSigma{"axisSigma", {50, -25, 25}, "#sigma"}; + ConfigurableAxis axisZDCEnergy{"axisZDCEnergy", {250, -5.0, 20.0}, "ZDC energy"}; + ConfigurableAxis axisZDCTime{"axisZDCTime", {200, -10.0, 10.0}, "ZDC time"}; + ConfigurableAxis axisDCA{"axisDCA", {1000, -20.0, 20.0}, "DCA"}; + ConfigurableAxis axisChi2{"axisChi2", {200, -10.0, 40}, "Chi2"}; + ConfigurableAxis axisIVMSel{"axisIVMSel", {1000, 0.0, 10.0}, "IVM"}; + ConfigurableAxis axisCounterSel{"axisCounterSel", {1000, 0.0, 200.0}, "Selection"}; + ConfigurableAxis axisITSNCls{"axisITSNCls", {10, 0.0, 10.0}, "ITSNCls"}; + ConfigurableAxis axisTPCNCls{"axisTPCNCls", {170, -1, 160.0}, "TPCNCls"}; + ConfigurableAxis axisTPCCrossed{"axisTPCCrossed", {300, 20, 170.0}, "TPCCrossedRows"}; // configurable cuts (modify in json) + // track quality cuts Configurable TPCNClsCrossedRows{"TPCNClsCrossedRows", 70, "number of crossed rows in TPC"}; Configurable TOFAtLeastOneProton{"TOFAtLeastOneProton", false, "at least one candidate track has TOF hits"}; Configurable TOFBothProtons{"TOFBothProtons", false, "both candidate protons have TOF hits"}; Configurable TOFOneProton{"TOFOneProton", false, "one candidate proton has TOF hits"}; - Configurable TPCNsigmaCut{"TPCNsigmaCut", false, "cut on nSigma"}; Configurable DCAcut{"DCAcut", false, "DCA cut from run2."}; - Configurable newCutTPC{"newCutTPC", false, "New cuts for TPC tracks."}; - Configurable TPCNSigmaMu{"TPCNSigmaMu", 3, "PID for TPC Mu track"}; + Configurable newCutTPC{"newCutTPC", false, "New cuts for TPC quality tracks."}; Configurable EtaCut{"EtaCut", 0.9f, "acceptance cut per track"}; Configurable cutPtTrack{"cutPtTrack", 0.7f, "pT cut per track"}; Configurable cutVertexZ{"cutVertexZ", 10.0f, "cut on vertex position in Z"}; - Configurable RapCut{"RapCut", 0.8f, "choose event in midrapidity"}; + Configurable RapCut{"RapCut", 0.9f, "choose event in midrapidity"}; Configurable dcaZCut{"dcaZCut", 2, "cut on the impact parameter in z of the track to the PV"}; Configurable dcaXYCut{"dcaXYCut", 1e10, "cut on the impact parameter in xy of the track to the PV"}; Configurable ITSNClsCut{"ITSNClsCut", 4, "minimal number of ITS clusters"}; @@ -73,15 +85,25 @@ struct UpcJpsiCentralBarrel { Configurable TPCNClsCrossedRowsCut{"TPCNClsCrossedRowsCut", 70, "minimal number of crossed TPC rows"}; Configurable TPCChi2NCls{"TPCChi2NCls", 4, "minimal Chi2/cluster for the TPC track"}; Configurable TPCMinNCls{"TPCMinNCls", 3, "minimum number of TPC clusters"}; - Configurable TPCCrossedOverFindable{"TPCCrossedOverFindable", 3, "number of TPC crosseed rows over findable clusters"}; + Configurable TPCCrossedOverFindable{"TPCCrossedOverFindable", 3, "number of TPC crossed rows over findable clusters"}; + + // ZDC classes cuts + Configurable ZNenergyCut{"ZNenergyCut", 0.0, "ZN common energy cut"}; + Configurable ZNtimeCut{"ZNtimeCut", 2.0, "ZN time cut"}; + + // Analysis cuts Configurable maxJpsiMass{"maxJpsiMass", 3.18, "Maximum of the jpsi peak for peak cut"}; Configurable minJpsiMass{"minJpsiMass", 3.0, "Minimum of the jpsi peak for peak cut"}; + + // SG cuts Configurable whichGapSide{"whichGapSide", 2, {"0 for side A, 1 for side C, 2 for both sides"}}; Configurable useTrueGap{"useTrueGap", true, {"Calculate gapSide for a given FV0/FT0/ZDC thresholds"}}; Configurable cutMyGapSideFV0{"FV0", 100, "FV0A threshold for SG selector"}; Configurable cutMyGapSideFT0A{"FT0A", 200., "FT0A threshold for SG selector"}; Configurable cutMyGapSideFT0C{"FT0C", 100., "FT0C threshold for SG selector"}; Configurable cutMyGapSideZDC{"ZDC", 1000., "ZDC threshold for SG selector"}; + + // process cuts Configurable doMuons{"doMuons", true, "Provide muon plots."}; Configurable doElectrons{"doElectrons", true, "Provide electron plots."}; Configurable doProtons{"doProtons", true, "Provide proton plots."}; @@ -98,6 +120,10 @@ struct UpcJpsiCentralBarrel { "RawData", {}}; + HistogramRegistry Selections{ + "Selections", + {}}; + HistogramRegistry PVContributors{ "PVContributors", {}}; @@ -150,7 +176,11 @@ struct UpcJpsiCentralBarrel { "Asymmetry", {}}; - using UDCollisionsFull = soa::Join; + HistogramRegistry MC{ + "MC", + {}}; + + using UDCollisionsFull = soa::Join; using UDCollisionFull = UDCollisionsFull::iterator; using UDTracksFull = soa::Join; using UDTrackFull = UDTracksFull::iterator; @@ -163,32 +193,102 @@ struct UpcJpsiCentralBarrel { Statistics.add("Statistics/hNumberOfCollisions", "hNumberOfCollisions", {HistType::kTH1F, {axisCounter}}); Statistics.add("Statistics/hNumberOfTracks", "hNumberOfTracks", {HistType::kTH1F, {axisCounter}}); Statistics.add("Statistics/hNumberGT", "hNumberGT", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hNumberGTselected", "hNumberGTselected", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hNumberGTel", "hNumberGTel", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hNumberGTmu", "hNumberGTmu", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hNumberGTp", "hNumberGTp", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hNumberGTelSigma", "hNumberGTelSigma", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hNumberGTmuSigma", "hNumberGTmuSigma", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hNumberGTpSigma", "hNumberGTpSigma", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hNumberGTpSigmaTOF", "hNumberGTpSigmaTOF", {HistType::kTH1F, {axisCounter}}); - Statistics.add("Statistics/hCutCounter", "hCutCounter", {HistType::kTH1F, {axisCounter}}); + Statistics.add("Statistics/hCutCounterCollisions", "hCutCounterCollisions", {HistType::kTH1F, {axisCounter}}); + Statistics.add("Statistics/hCutCounterTracks", "hCutCounterTracks", {HistType::kTH1F, {axisCounter}}); // raw data histograms RawData.add("RawData/hTrackPt", "hTrackPt", {HistType::kTH1F, {axisPt}}); RawData.add("RawData/hTrackEta", "hTrackEta", {HistType::kTH1F, {axisEta}}); RawData.add("RawData/hTrackPhi", "hTrackPhi", {HistType::kTH1F, {axisPhi}}); + RawData.add("RawData/hTrackDCAXYZ", "hTrackDCAXYZ", {HistType::kTH2F, {axisDCA, axisDCA}}); + RawData.add("RawData/hTPCNClsFindable", "hTPCNClsFindable", {HistType::kTH1F, {axisTPC}}); + RawData.add("RawData/hTPCNClsFindableMinusFound", "hTPCNClsFindableMinusFound", {HistType::kTH1F, {axisTPC}}); + RawData.add("RawData/hITSNCls", "hITSNCls", {HistType::kTH1F, {axisCounter}}); + RawData.add("RawData/hTPCNCls", "hTPCNCls", {HistType::kTH1F, {axisCounter}}); + RawData.add("RawData/hITSChi2NCls", "hITSChi2NCls", {HistType::kTH1F, {axisChi2}}); + RawData.add("RawData/hTPCChi2NCls", "hTPCChi2NCls", {HistType::kTH1F, {axisChi2}}); RawData.add("RawData/hPositionZ", "hPositionZ", {HistType::kTH1F, {axisSigma}}); RawData.add("RawData/hPositionX", "hPositionX", {HistType::kTH1F, {axisSigma}}); RawData.add("RawData/hPositionY", "hPositionY", {HistType::kTH1F, {axisSigma}}); + RawData.add("RawData/hPositionXY", "hPositionXY", {HistType::kTH2F, {axisSigma, axisSigma}}); + RawData.add("RawData/hZNACommonEnergy", "hZNACommonEnergy", {HistType::kTH1F, {axisZDCEnergy}}); + RawData.add("RawData/hZNCCommonEnergy", "hZNCCommonEnergy", {HistType::kTH1F, {axisZDCEnergy}}); + RawData.add("RawData/hZNAvsZNCCommonEnergy", "hZNAvsZNCCommonEnergy", {HistType::kTH2F, {axisZDCEnergy, axisZDCEnergy}}); + RawData.add("RawData/hZNATime", "hZNATime", {HistType::kTH1F, {axisZDCTime}}); + RawData.add("RawData/hZNCTime", "hZNCTime", {HistType::kTH1F, {axisZDCTime}}); + RawData.add("RawData/hZNAvsZNCTime", "hZNAvsZNCTime", {HistType::kTH2F, {axisZDCTime, axisZDCTime}}); RawData.add("RawData/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); RawData.add("RawData/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); RawData.add("RawData/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); RawData.add("RawData/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - RawData.add("RawData/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); RawData.add("RawData/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - RawData.add("RawData/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - RawData.add("RawData/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - RawData.add("RawData/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); + + // Selection checks + Selections.add("Selections/Electron/Mass/Leading/hITSNClsVsM", "hITSNClsVsM", {HistType::kTH2F, {axisIVMSel, axisITSNCls}}); + Selections.add("Selections/Electron/Mass/Leading/hITSChi2NClsVsM", "hITSChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisChi2}}); + Selections.add("Selections/Electron/Mass/Leading/hTPCNClsVsM", "hTPCNClsVsM", {HistType::kTH2F, {axisIVMSel, axisTPCNCls}}); + Selections.add("Selections/Electron/Mass/Leading/hTPCChi2NClsVsM", "hTPCChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisChi2}}); + Selections.add("Selections/Electron/Mass/Leading/hTPCNClsCrossedRowsVsM", "hTPCNClsCrossedRowsVsM", {HistType::kTH2F, {axisIVMSel, axisTPCCrossed}}); + Selections.add("Selections/Electron/Mass/Subleading/hITSNClsVsM", "hITSNClsVsM", {HistType::kTH2F, {axisIVMSel, axisITSNCls}}); + Selections.add("Selections/Electron/Mass/Subleading/hITSChi2NClsVsM", "hITSChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisChi2}}); + Selections.add("Selections/Electron/Mass/Subleading/hTPCNClsVsM", "hTPCNClsVsM", {HistType::kTH2F, {axisIVMSel, axisTPCNCls}}); + Selections.add("Selections/Electron/Mass/Subleading/hTPCChi2NClsVsM", "hTPCChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisChi2}}); + Selections.add("Selections/Electron/Mass/Subleading/hTPCNClsCrossedRowsVsM", "hTPCNClsCrossedRowsVsM", {HistType::kTH2F, {axisIVMSel, axisTPCCrossed}}); + + Selections.add("Selections/Electron/Rapidity/Leading/hITSNClsVsY", "hITSNClsVsY", {HistType::kTH2F, {axisEta, axisITSNCls}}); + Selections.add("Selections/Electron/Rapidity/Leading/hITSChi2NClsVsY", "hITSChi2NClsVsY", {HistType::kTH2F, {axisEta, axisChi2}}); + Selections.add("Selections/Electron/Rapidity/Leading/hTPCNClsVsY", "hTPCNClsVsY", {HistType::kTH2F, {axisEta, axisTPCNCls}}); + Selections.add("Selections/Electron/Rapidity/Leading/hTPCChi2NClsVsY", "hTPCChi2NClsVsY", {HistType::kTH2F, {axisEta, axisChi2}}); + Selections.add("Selections/Electron/Rapidity/Leading/hTPCNClsCrossedRowsVsY", "hTPCNClsCrossedRowsVsY", {HistType::kTH2F, {axisEta, axisTPCCrossed}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hITSNClsVsY", "hITSNClsVsY", {HistType::kTH2F, {axisEta, axisITSNCls}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hITSChi2NClsVsY", "hITSChi2NClsVsY", {HistType::kTH2F, {axisEta, axisChi2}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hTPCNClsVsY", "hTPCNClsVsY", {HistType::kTH2F, {axisEta, axisTPCNCls}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hTPCChi2NClsVsY", "hTPCChi2NClsVsY", {HistType::kTH2F, {axisEta, axisChi2}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hTPCNClsCrossedRowsVsY", "hTPCNClsCrossedRowsVsY", {HistType::kTH2F, {axisEta, axisTPCCrossed}}); + + Selections.add("Selections/Electron/Pt/Leading/hITSNClsVsPt", "hITSNClsVsPt", {HistType::kTH2F, {axisPt, axisITSNCls}}); + Selections.add("Selections/Electron/Pt/Leading/hITSChi2NClsVsPt", "hITSChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisChi2}}); + Selections.add("Selections/Electron/Pt/Leading/hTPCNClsVsPt", "hTPCNClsVsPt", {HistType::kTH2F, {axisPt, axisTPCNCls}}); + Selections.add("Selections/Electron/Pt/Leading/hTPCChi2NClsVsPt", "hTPCChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisChi2}}); + Selections.add("Selections/Electron/Pt/Leading/hTPCNClsCrossedRowsVsPt", "hTPCNClsCrossedRowsVsPt", {HistType::kTH2F, {axisPt, axisTPCCrossed}}); + Selections.add("Selections/Electron/Pt/Subleading/hITSNClsVsPt", "hITSNClsVsPt", {HistType::kTH2F, {axisPt, axisITSNCls}}); + Selections.add("Selections/Electron/Pt/Subleading/hITSChi2NClsVsPt", "hITSChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisChi2}}); + Selections.add("Selections/Electron/Pt/Subleading/hTPCNClsVsPt", "hTPCNClsVsPt", {HistType::kTH2F, {axisPt, axisTPCNCls}}); + Selections.add("Selections/Electron/Pt/Subleading/hTPCChi2NClsVsPt", "hTPCChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisChi2}}); + Selections.add("Selections/Electron/Pt/Subleading/hTPCNClsCrossedRowsVsPt", "hTPCNClsCrossedRowsVsPt", {HistType::kTH2F, {axisPt, axisTPCCrossed}}); + + Selections.add("Selections/Muon/Mass/Leading/hITSNClsVsM", "hITSNClsVsM", {HistType::kTH2F, {axisIVMSel, axisITSNCls}}); + Selections.add("Selections/Muon/Mass/Leading/hITSChi2NClsVsM", "hITSChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisChi2}}); + Selections.add("Selections/Muon/Mass/Leading/hTPCNClsVsM", "hTPCNClsVsM", {HistType::kTH2F, {axisIVMSel, axisTPCNCls}}); + Selections.add("Selections/Muon/Mass/Leading/hTPCChi2NClsVsM", "hTPCChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisChi2}}); + Selections.add("Selections/Muon/Mass/Leading/hTPCNClsCrossedRowsVsM", "hTPCNClsCrossedRowsVsM", {HistType::kTH2F, {axisIVMSel, axisTPCCrossed}}); + Selections.add("Selections/Muon/Mass/Subleading/hITSNClsVsM", "hITSNClsVsM", {HistType::kTH2F, {axisIVMSel, axisITSNCls}}); + Selections.add("Selections/Muon/Mass/Subleading/hITSChi2NClsVsM", "hITSChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisChi2}}); + Selections.add("Selections/Muon/Mass/Subleading/hTPCNClsVsM", "hTPCNClsVsM", {HistType::kTH2F, {axisIVMSel, axisTPCNCls}}); + Selections.add("Selections/Muon/Mass/Subleading/hTPCChi2NClsVsM", "hTPCChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisChi2}}); + Selections.add("Selections/Muon/Mass/Subleading/hTPCNClsCrossedRowsVsM", "hTPCNClsCrossedRowsVsM", {HistType::kTH2F, {axisIVMSel, axisTPCCrossed}}); + + Selections.add("Selections/Muon/Rapidity/Leading/hITSNClsVsY", "hITSNClsVsY", {HistType::kTH2F, {axisEta, axisITSNCls}}); + Selections.add("Selections/Muon/Rapidity/Leading/hITSChi2NClsVsY", "hITSChi2NClsVsY", {HistType::kTH2F, {axisEta, axisChi2}}); + Selections.add("Selections/Muon/Rapidity/Leading/hTPCNClsVsY", "hTPCNClsVsY", {HistType::kTH2F, {axisEta, axisTPCNCls}}); + Selections.add("Selections/Muon/Rapidity/Leading/hTPCChi2NClsVsY", "hTPCChi2NClsVsY", {HistType::kTH2F, {axisEta, axisChi2}}); + Selections.add("Selections/Muon/Rapidity/Leading/hTPCNClsCrossedRowsVsY", "hTPCNClsCrossedRowsVsY", {HistType::kTH2F, {axisEta, axisTPCCrossed}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hITSNClsVsY", "hITSNClsVsY", {HistType::kTH2F, {axisEta, axisITSNCls}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hITSChi2NClsVsY", "hITSChi2NClsVsY", {HistType::kTH2F, {axisEta, axisChi2}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hTPCNClsVsY", "hTPCNClsVsY", {HistType::kTH2F, {axisEta, axisTPCNCls}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hTPCChi2NClsVsY", "hTPCChi2NClsVsY", {HistType::kTH2F, {axisEta, axisChi2}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hTPCNClsCrossedRowsVsY", "hTPCNClsCrossedRowsVsY", {HistType::kTH2F, {axisEta, axisTPCCrossed}}); + + Selections.add("Selections/Muon/Pt/Leading/hITSNClsVsPt", "hITSNClsVsPt", {HistType::kTH2F, {axisPt, axisITSNCls}}); + Selections.add("Selections/Muon/Pt/Leading/hITSChi2NClsVsPt", "hITSChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisChi2}}); + Selections.add("Selections/Muon/Pt/Leading/hTPCNClsVsPt", "hTPCNClsVsPt", {HistType::kTH2F, {axisPt, axisTPCNCls}}); + Selections.add("Selections/Muon/Pt/Leading/hTPCChi2NClsVsPt", "hTPCChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisChi2}}); + Selections.add("Selections/Muon/Pt/Leading/hTPCNClsCrossedRowsVsPt", "hTPCNClsCrossedRowsVsPt", {HistType::kTH2F, {axisPt, axisTPCCrossed}}); + Selections.add("Selections/Muon/Pt/Subleading/hITSNClsVsPt", "hITSNClsVsPt", {HistType::kTH2F, {axisPt, axisITSNCls}}); + Selections.add("Selections/Muon/Pt/Subleading/hITSChi2NClsVsPt", "hITSChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisChi2}}); + Selections.add("Selections/Muon/Pt/Subleading/hTPCNClsVsPt", "hTPCNClsVsPt", {HistType::kTH2F, {axisPt, axisTPCNCls}}); + Selections.add("Selections/Muon/Pt/Subleading/hTPCChi2NClsVsPt", "hTPCChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisChi2}}); + Selections.add("Selections/Muon/Pt/Subleading/hTPCNClsCrossedRowsVsPt", "hTPCNClsCrossedRowsVsPt", {HistType::kTH2F, {axisPt, axisTPCCrossed}}); // PVContributors histograms PVContributors.add("PVContributors/hTrackPt", "hTrackPt", {HistType::kTH1F, {axisPt}}); @@ -200,11 +300,7 @@ struct UpcJpsiCentralBarrel { PVContributors.add("PVContributors/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); PVContributors.add("PVContributors/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); PVContributors.add("PVContributors/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - PVContributors.add("PVContributors/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); PVContributors.add("PVContributors/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - PVContributors.add("PVContributors/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - PVContributors.add("PVContributors/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - PVContributors.add("PVContributors/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TG histograms TG.add("TG/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); @@ -219,19 +315,8 @@ struct UpcJpsiCentralBarrel { TG.add("TG/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); TG.add("TG/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); TG.add("TG/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - TG.add("TG/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); TG.add("TG/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - TG.add("TG/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - TG.add("TG/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - TG.add("TG/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); - TG.add("TG/TPC/hNsigmaMu", "hNsigmaMu", HistType::kTH1F, {axisSigma}); - TG.add("TG/TPC/hNsigmaEl", "hNsigmaEl", HistType::kTH1F, {axisSigma}); - TG.add("TG/TPC/hNsigmaPr", "hNsigmaPr", HistType::kTH1F, {axisSigma}); TG.add("TG/TPC/TPCNegVsPosSignal", "TPCNegVsPosSignal", HistType::kTH2F, {axisTPC, axisTPC}); - // TG.add("TG/TPC/TPCNegSignal", "TPCNegSignal", HistType::kTH1F, {axisTPC}); - TG.add("TG/TOF/hNsigmaMu", "hNsigmaMu", HistType::kTH1F, {axisSigma}); - TG.add("TG/TOF/hNsigmaEl", "hNsigmaEl", HistType::kTH1F, {axisSigma}); - TG.add("TG/TOF/hNsigmaPr", "hNsigmaPr", HistType::kTH1F, {axisSigma}); // TGmu histograms TGmu.add("TGmu/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); @@ -240,19 +325,12 @@ struct UpcJpsiCentralBarrel { TGmu.add("TGmu/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axisPt}}); TGmu.add("TGmu/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axisEta}}); TGmu.add("TGmu/hTrackPhi2", "hTrackPhi2", {HistType::kTH1F, {axisPhi}}); - TGmu.add("TGmu/hNsigmaMu", "hNsigmaMu", HistType::kTH1F, {axisSigma}); - TGmu.add("TGmu/hNsigmaMuTOF", "hNsigmaMuTOF", HistType::kTH1F, {axisSigma}); - // TGmu.add("TGmu/TPCPosSignal", "TPCPosSignal", HistType::kTH1F, {axisTPC}); TGmu.add("TGmu/TPCNegVsPosSignal", "TPCNegVsPosSignal", HistType::kTH2F, {axisTPC, axisTPC}); TGmu.add("TGmu/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); TGmu.add("TGmu/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); TGmu.add("TGmu/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); TGmu.add("TGmu/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - TGmu.add("TGmu/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); TGmu.add("TGmu/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - TGmu.add("TGmu/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - TGmu.add("TGmu/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - TGmu.add("TGmu/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGmuCand histograms TGmuCand.add("TGmuCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); @@ -261,24 +339,26 @@ struct UpcJpsiCentralBarrel { TGmuCand.add("TGmuCand/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axisPt}}); TGmuCand.add("TGmuCand/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axisEta}}); TGmuCand.add("TGmuCand/hTrackPhi2", "hTrackPhi2", {HistType::kTH1F, {axisPhi}}); - TGmuCand.add("TGmuCand/hTrackITSNcls1", "hTrackITSNcls1", {HistType::kTH1F, {axisCounter}}); - TGmuCand.add("TGmuCand/hTrackITSNcls2", "hTrackITSNcls2", {HistType::kTH1F, {axisCounter}}); TGmuCand.add("TGmuCand/hPairPt", "hPairPt", {HistType::kTH1F, {axisPt}}); TGmuCand.add("TGmuCand/hPairIVM", "hPairIVM", {HistType::kTH1F, {axisIVMWide}}); TGmuCand.add("TGmuCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axisPt}}); + TGmuCand.add("TGmuCand/hJpsiPt2", "hJpsiPt2", {HistType::kTH1F, {axisPt2}}); + TGmuCand.add("TGmuCand/XnXn/hJpsiPt2", "hJpsiPt2", {HistType::kTH1F, {axisPt2}}); + TGmuCand.add("TGmuCand/OnOn/hJpsiPt2", "hJpsiPt2", {HistType::kTH1F, {axisPt2}}); + TGmuCand.add("TGmuCand/OnXn/hJpsiPt2", "hJpsiPt2", {HistType::kTH1F, {axisPt2}}); + TGmuCand.add("TGmuCand/XnOn/hJpsiPt2", "hJpsiPt2", {HistType::kTH1F, {axisPt2}}); + TGmuCand.add("TGmuCand/hJpsiPt2wide", "hJpsiPt2wide", {HistType::kTH1F, {axisPt2}}); + TGmuCand.add("TGmuCand/XnXn/hJpsiPt2wide", "hJpsiPt2wide", {HistType::kTH1F, {axisPt2wide}}); + TGmuCand.add("TGmuCand/OnOn/hJpsiPt2wide", "hJpsiPt2wide", {HistType::kTH1F, {axisPt2wide}}); + TGmuCand.add("TGmuCand/OnXn/hJpsiPt2wide", "hJpsiPt2wide", {HistType::kTH1F, {axisPt2wide}}); + TGmuCand.add("TGmuCand/XnOn/hJpsiPt2wide", "hJpsiPt2wide", {HistType::kTH1F, {axisPt2wide}}); TGmuCand.add("TGmuCand/hJpsiRap", "hJpsiRap", {HistType::kTH1F, {axisEta}}); - // TGmuCand.add("TGmuCand/TPCPosSignal", "TPCPosSignal", HistType::kTH1F, {axisTPC}); - // TGmuCand.add("TGmuCand/TPCNegSignal", "TPCNegSignal", HistType::kTH1F, {axisTPC}); TGmuCand.add("TGmuCand/TPCNegVsPosSignal", "TPCNegVsPosSignal", HistType::kTH2F, {axisTPC, axisTPC}); TGmuCand.add("TGmuCand/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); TGmuCand.add("TGmuCand/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); TGmuCand.add("TGmuCand/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); TGmuCand.add("TGmuCand/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - TGmuCand.add("TGmuCand/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); TGmuCand.add("TGmuCand/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - TGmuCand.add("TGmuCand/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - TGmuCand.add("TGmuCand/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - TGmuCand.add("TGmuCand/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGel histograms TGel.add("TGel/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); @@ -287,20 +367,12 @@ struct UpcJpsiCentralBarrel { TGel.add("TGel/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axisPt}}); TGel.add("TGel/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axisEta}}); TGel.add("TGel/hTrackPhi2", "hTrackPhi2", {HistType::kTH1F, {axisPhi}}); - TGel.add("TGel/hNsigmaEl", "hNsigmaEl", HistType::kTH1F, {axisSigma}); - TGel.add("TGel/hNsigmaElTOF", "hNsigmaElTOF", HistType::kTH1F, {axisSigma}); - // TGel.add("TGel/TPCPosSignal", "TPCPosSignal", HistType::kTH1F, {axisTPC}); - // TGel.add("TGel/TPCNegSignal", "TPCNegSignal", HistType::kTH1F, {axisTPC}); TGel.add("TGel/TPCNegVsPosSignal", "TPCNegVsPosSignal", HistType::kTH2F, {axisTPC, axisTPC}); TGel.add("TGel/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); TGel.add("TGel/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); TGel.add("TGel/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); TGel.add("TGel/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - TGel.add("TGel/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); TGel.add("TGel/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - TGel.add("TGel/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - TGel.add("TGel/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - TGel.add("TGel/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGelCand histograms TGelCand.add("TGelCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); @@ -309,11 +381,7 @@ struct UpcJpsiCentralBarrel { TGelCand.add("TGelCand/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axisPt}}); TGelCand.add("TGelCand/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axisEta}}); TGelCand.add("TGelCand/hTrackPhi2", "hTrackPhi2", {HistType::kTH1F, {axisPhi}}); - // TGelCand.add("TGelCand/TPCPosSignal", "TPCPosSignal", HistType::kTH1F, {axisTPC}); - // TGelCand.add("TGelCand/TPCNegSignal", "TPCNegSignal", HistType::kTH1F, {axisTPC}); TGelCand.add("TGelCand/TPCNegVsPosSignal", "TPCNegVsPosSignal", HistType::kTH2F, {axisTPC, axisTPC}); - TGelCand.add("TGelCand/hTrackITSNcls1", "hTrackITSNcls1", {HistType::kTH1F, {axisCounter}}); - TGelCand.add("TGelCand/hTrackITSNcls2", "hTrackITSNcls2", {HistType::kTH1F, {axisCounter}}); TGelCand.add("TGelCand/hPairPt", "hPairPt", {HistType::kTH1F, {axisPt}}); TGelCand.add("TGelCand/hPairIVM", "hPairIVM", {HistType::kTH1F, {axisIVMWide}}); TGelCand.add("TGelCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axisPt}}); @@ -322,11 +390,7 @@ struct UpcJpsiCentralBarrel { TGelCand.add("TGelCand/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); TGelCand.add("TGelCand/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); TGelCand.add("TGelCand/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - TGelCand.add("TGelCand/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); TGelCand.add("TGelCand/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - TGelCand.add("TGelCand/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - TGelCand.add("TGelCand/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - TGelCand.add("TGelCand/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGp histograms TGp.add("TGp/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); @@ -335,17 +399,11 @@ struct UpcJpsiCentralBarrel { TGp.add("TGp/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axisPt}}); TGp.add("TGp/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axisEta}}); TGp.add("TGp/hTrackPhi2", "hTrackPhi2", {HistType::kTH1F, {axisPhi}}); - TGp.add("TGp/hNsigmaMu", "hNsigmaMu", HistType::kTH1F, {axisSigma}); - TGp.add("TGp/hNsigmaMuTOF", "hNsigmaMuTOF", HistType::kTH1F, {axisSigma}); TGp.add("TGp/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); TGp.add("TGp/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); TGp.add("TGp/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); TGp.add("TGp/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - TGp.add("TGp/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); TGp.add("TGp/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - TGp.add("TGp/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - TGp.add("TGp/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - TGp.add("TGp/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGpCand histograms TGpCand.add("TGpCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); @@ -354,8 +412,6 @@ struct UpcJpsiCentralBarrel { TGpCand.add("TGpCand/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axisPt}}); TGpCand.add("TGpCand/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axisEta}}); TGpCand.add("TGpCand/hTrackPhi2", "hTrackPhi2", {HistType::kTH1F, {axisPhi}}); - TGpCand.add("TGpCand/hTrackITSNcls1", "hTrackITSNcls1", {HistType::kTH1F, {axisCounter}}); - TGpCand.add("TGpCand/hTrackITSNcls2", "hTrackITSNcls2", {HistType::kTH1F, {axisCounter}}); TGpCand.add("TGpCand/hPairPt", "hPairPt", {HistType::kTH1F, {axisPt}}); TGpCand.add("TGpCand/hPairIVM", "hPairIVM", {HistType::kTH1F, {axisIVMWide}}); TGpCand.add("TGpCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axisPt}}); @@ -364,11 +420,7 @@ struct UpcJpsiCentralBarrel { TGpCand.add("TGpCand/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); TGpCand.add("TGpCand/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); TGpCand.add("TGpCand/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - TGpCand.add("TGpCand/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); TGpCand.add("TGpCand/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - TGpCand.add("TGpCand/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - TGpCand.add("TGpCand/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - TGpCand.add("TGpCand/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // JPsiToEl histograms JPsiToEl.add("JPsiToEl/Coherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); @@ -382,15 +434,55 @@ struct UpcJpsiCentralBarrel { JPsiToEl.add("JPsiToEl/Coherent/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); JPsiToEl.add("JPsiToEl/Coherent/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToEl.add("JPsiToEl/Coherent/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/XnXn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/OnOn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/OnXn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/XnOn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToEl.add("JPsiToEl/Coherent/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); JPsiToEl.add("JPsiToEl/Coherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); JPsiToEl.add("JPsiToEl/Coherent/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); JPsiToEl.add("JPsiToEl/Coherent/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - JPsiToEl.add("JPsiToEl/Coherent/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); JPsiToEl.add("JPsiToEl/Coherent/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - JPsiToEl.add("JPsiToEl/Coherent/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - JPsiToEl.add("JPsiToEl/Coherent/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - JPsiToEl.add("JPsiToEl/Coherent/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); JPsiToEl.add("JPsiToEl/Incoherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); JPsiToEl.add("JPsiToEl/Incoherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); @@ -400,18 +492,63 @@ struct UpcJpsiCentralBarrel { JPsiToEl.add("JPsiToEl/Incoherent/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToEl.add("JPsiToEl/Incoherent/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToEl.add("JPsiToEl/Incoherent/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/NotCoherent/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); JPsiToEl.add("JPsiToEl/Incoherent/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); JPsiToEl.add("JPsiToEl/Incoherent/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToEl.add("JPsiToEl/Incoherent/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/NotCoherent/XnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnXn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/NotCoherent/OnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnOn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/NotCoherent/OnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/OnXn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/NotCoherent/XnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/XnOn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToEl.add("JPsiToEl/Incoherent/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); JPsiToEl.add("JPsiToEl/Incoherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); JPsiToEl.add("JPsiToEl/Incoherent/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); JPsiToEl.add("JPsiToEl/Incoherent/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - JPsiToEl.add("JPsiToEl/Incoherent/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); JPsiToEl.add("JPsiToEl/Incoherent/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - JPsiToEl.add("JPsiToEl/Incoherent/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - JPsiToEl.add("JPsiToEl/Incoherent/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - JPsiToEl.add("JPsiToEl/Incoherent/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // JPsiToMu histograms JPsiToMu.add("JPsiToMu/Coherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); @@ -425,15 +562,55 @@ struct UpcJpsiCentralBarrel { JPsiToMu.add("JPsiToMu/Coherent/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); JPsiToMu.add("JPsiToMu/Coherent/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToMu.add("JPsiToMu/Coherent/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/XnXn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/OnOn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/OnXn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/XnOn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToMu.add("JPsiToMu/Coherent/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); JPsiToMu.add("JPsiToMu/Coherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); JPsiToMu.add("JPsiToMu/Coherent/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); JPsiToMu.add("JPsiToMu/Coherent/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - JPsiToMu.add("JPsiToMu/Coherent/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); JPsiToMu.add("JPsiToMu/Coherent/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - JPsiToMu.add("JPsiToMu/Coherent/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - JPsiToMu.add("JPsiToMu/Coherent/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - JPsiToMu.add("JPsiToMu/Coherent/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); JPsiToMu.add("JPsiToMu/Incoherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); JPsiToMu.add("JPsiToMu/Incoherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); @@ -443,18 +620,63 @@ struct UpcJpsiCentralBarrel { JPsiToMu.add("JPsiToMu/Incoherent/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToMu.add("JPsiToMu/Incoherent/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToMu.add("JPsiToMu/Incoherent/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/NotCoherent/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); JPsiToMu.add("JPsiToMu/Incoherent/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); JPsiToMu.add("JPsiToMu/Incoherent/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToMu.add("JPsiToMu/Incoherent/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/NotCoherent/XnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnXn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/NotCoherent/OnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnOn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/NotCoherent/OnXn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/OnXn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/NotCoherent/XnOn/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/XnOn/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToMu.add("JPsiToMu/Incoherent/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); JPsiToMu.add("JPsiToMu/Incoherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); JPsiToMu.add("JPsiToMu/Incoherent/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); JPsiToMu.add("JPsiToMu/Incoherent/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - JPsiToMu.add("JPsiToMu/Incoherent/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); JPsiToMu.add("JPsiToMu/Incoherent/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - JPsiToMu.add("JPsiToMu/Incoherent/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - JPsiToMu.add("JPsiToMu/Incoherent/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - JPsiToMu.add("JPsiToMu/Incoherent/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // JPsiToP histograms JPsiToP.add("JPsiToP/Coherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); @@ -472,11 +694,7 @@ struct UpcJpsiCentralBarrel { JPsiToP.add("JPsiToP/Coherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); JPsiToP.add("JPsiToP/Coherent/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); JPsiToP.add("JPsiToP/Coherent/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - JPsiToP.add("JPsiToP/Coherent/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); JPsiToP.add("JPsiToP/Coherent/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - JPsiToP.add("JPsiToP/Coherent/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - JPsiToP.add("JPsiToP/Coherent/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - JPsiToP.add("JPsiToP/Coherent/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); JPsiToP.add("JPsiToP/Incoherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); JPsiToP.add("JPsiToP/Incoherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); @@ -493,11 +711,7 @@ struct UpcJpsiCentralBarrel { JPsiToP.add("JPsiToP/Incoherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axisPt, axisTPC}}); JPsiToP.add("JPsiToP/Incoherent/PID/hTPCVsPhi", "hTPCVsPhi", {HistType::kTH2F, {axisPhi, axisTPC}}); JPsiToP.add("JPsiToP/Incoherent/PID/hTPCVsEta", "hTPCVsEta", {HistType::kTH2F, {axisEta, axisTPC}}); - JPsiToP.add("JPsiToP/Incoherent/PID/hTOFVsP", "hTOFVsP", {HistType::kTH2F, {axisP, axisTOF}}); JPsiToP.add("JPsiToP/Incoherent/PID/hBetaTOFVsP", "hBetaTOFVsP", {HistType::kTH2F, {axisP, axisBetaTOF}}); - JPsiToP.add("JPsiToP/Incoherent/PID/hTOFVsPt", "hTOFVsPt", {HistType::kTH2F, {axisPt, axisTOF}}); - JPsiToP.add("JPsiToP/Incoherent/PID/hTOFVsPhi", "hTOFVsPhi", {HistType::kTH2F, {axisPhi, axisTOF}}); - JPsiToP.add("JPsiToP/Incoherent/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // Correlation histograms Correlation.add("Correlation/Muon/Coherent/AccoplAngle", "AccoplAngle", {HistType::kTH1F, {axisAccAngle}}); @@ -530,73 +744,172 @@ struct UpcJpsiCentralBarrel { // Asymmetry histograms Asymmetry.add("Asymmetry/Muon/Coherent/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/XnXn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/OnOn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/XnOn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/OnXn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); Asymmetry.add("Asymmetry/Muon/Incoherent/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/XnXn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/OnOn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/XnOn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/OnXn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); Asymmetry.add("Asymmetry/Electron/Coherent/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/XnXn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/OnOn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/XnOn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/OnXn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); Asymmetry.add("Asymmetry/Electron/Incoherent/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/XnXn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/OnOn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/XnOn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/OnXn/DeltaPhi", "DeltaPhi", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/XnXn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/OnOn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/XnOn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Coherent/OnXn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/XnXn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/OnOn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/XnOn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Muon/Incoherent/OnXn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/XnXn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/OnOn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/XnOn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Coherent/OnXn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/XnXn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/OnOn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/XnOn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + Asymmetry.add("Asymmetry/Electron/Incoherent/OnXn/DeltaPhiRandom", "DeltaPhiRandom", {HistType::kTH1F, {{180, -PI, PI}}}); + + // MC histograms + MC.add("MC/hNumberOfMCCollisions", "hNumberOfCollisions", {HistType::kTH1F, {{10, 0, 10}}}); + MC.add("MC/hNumberOfRecoCollisions", "hNumberOfRecoCollisions", {HistType::kTH1F, {{10, 0, 10}}}); + MC.add("MC/Muon/hNumberOfMCTracks", "hNumberOfMCTracks", {HistType::kTH1F, {{10, 0, 10}}}); + MC.add("MC/Electron/hNumberOfMCTracks", "hNumberOfMCTracks", {HistType::kTH1F, {{10, 0, 10}}}); + MC.add("MC/Proton/hNumberOfMCTracks", "hNumberOfMCTracks", {HistType::kTH1F, {{10, 0, 10}}}); + MC.add("MC/hPosZ", "hPosZ", {HistType::kTH1F, {{60, -15, 15}}}); + MC.add("MC/hPDG", "hPDG", {HistType::kTH1F, {{200000, -100000, 100000}}}); + MC.add("MC/Electron/hEta1", "hEta1", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Electron/hEta2", "hEta2", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Electron/hPhi1", "hPhi1", {HistType::kTH1F, {axisPhi}}); + MC.add("MC/Electron/hPhi2", "hPhi2", {HistType::kTH1F, {axisPhi}}); + MC.add("MC/Electron/hIVM", "hIVM", {HistType::kTH1F, {axisIVM}}); + MC.add("MC/Electron/hRapidity", "hRapidity", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Electron/hPt1", "hPt1", {HistType::kTH1F, {axisPt}}); + MC.add("MC/Electron/hPt2", "hPt2", {HistType::kTH1F, {axisPt}}); + MC.add("MC/Electron/hPt", "hPt", {HistType::kTH1F, {axisPt}}); + MC.add("MC/Muon/hEta1", "hEta1", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Muon/hEta2", "hEta2", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Muon/hPhi1", "hPhi1", {HistType::kTH1F, {axisPhi}}); + MC.add("MC/Muon/hPhi2", "hPhi2", {HistType::kTH1F, {axisPhi}}); + MC.add("MC/Muon/hIVM", "hIVM", {HistType::kTH1F, {axisIVM}}); + MC.add("MC/Muon/hRapidity", "hRapidity", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Muon/hPt1", "hPt1", {HistType::kTH1F, {axisPt}}); + MC.add("MC/Muon/hPt2", "hPt2", {HistType::kTH1F, {axisPt}}); + MC.add("MC/Muon/hPt", "hPt", {HistType::kTH1F, {axisPt}}); + MC.add("MC/Proton/hEta1", "hEta1", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Proton/hEta2", "hEta2", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Proton/hPhi1", "hPhi1", {HistType::kTH1F, {axisPhi}}); + MC.add("MC/Proton/hPhi2", "hPhi2", {HistType::kTH1F, {axisPhi}}); + MC.add("MC/Proton/hIVM", "hIVM", {HistType::kTH1F, {axisIVM}}); + MC.add("MC/Proton/hRapidity", "hRapidity", {HistType::kTH1F, {axisEta}}); + MC.add("MC/Proton/hPt1", "hPt1", {HistType::kTH1F, {axisPt}}); + MC.add("MC/Proton/hPt2", "hPt2", {HistType::kTH1F, {axisPt}}); + MC.add("MC/Proton/hPt", "hPt", {HistType::kTH1F, {axisPt}}); + } + + bool cutITSLayers(uint8_t itsClusterMap) const + { + std::vector>> requiredITSHits{}; + requiredITSHits.push_back(std::make_pair(1, std::array{0, 1, 2})); // at least one hit in the innermost layer + constexpr uint8_t bit = 1; + for (auto& itsRequirement : requiredITSHits) { + auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return itsClusterMap & (bit << requiredLayer); }); + + if ((itsRequirement.first == -1) && (hits > 0)) { + return false; // no hits were required in specified layers + } else if (hits < itsRequirement.first) { + return false; // not enough hits found in specified layers + } + } + return true; } template bool GoodTrackCuts(T const& track) { + // choose only PV contributors + if (!track.isPVContributor()) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(1); + return false; + } // pT cut to choose only tracks contributing to J/psi if (track.pt() < cutPtTrack) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(2); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(2); return false; } - // acceptance + // acceptance cut (TPC) if (std::abs(RecoDecay::eta(std::array{track.px(), track.py(), track.pz()})) > EtaCut) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(3); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(3); return false; } // DCA - if (track.dcaZ() > dcaZCut) { + if (std::abs(track.dcaZ()) > dcaZCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(4); return false; } if (DCAcut) { float dcaXYPtCut = 0.0105f + 0.0350f / pow(track.pt(), 1.1f); - if (abs(track.dcaXY()) > dcaXYPtCut) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(4); + if (std::abs(track.dcaXY()) > dcaXYPtCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(5); return false; } } else { - if (track.dcaXY() > dcaXYCut) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(4); + if (std::abs(track.dcaXY()) > dcaXYCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(5); return false; } } // ITS if (!track.hasITS()) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(5); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(6); return false; } if (track.itsNCls() < ITSNClsCut) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(6); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(7); + return false; + } + if (!cutITSLayers(track.itsClusterMap())) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(8); return false; } if (track.itsChi2NCl() > ITSChi2NClsCut) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(7); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(9); return false; } // TPC if (!track.hasTPC()) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(8); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(10); return false; } if (track.tpcNClsCrossedRows() < TPCNClsCrossedRowsCut) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(9); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(11); return false; } if (track.tpcChi2NCl() > TPCChi2NCls) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(10); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(12); return false; // TPC chi2 } + if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < TPCMinNCls) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(13); + return false; + } if (newCutTPC) { - if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < TPCMinNCls) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(11); - return false; - } if ((static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable())) < TPCCrossedOverFindable) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(12); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(14); return false; } } @@ -608,12 +921,12 @@ struct UpcJpsiCentralBarrel { bool CandidateCuts(float massJpsi, float rapJpsi) { if (std::abs(rapJpsi) > RapCut) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(13); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(15); return false; } if (massJpsi < 2.0f) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(14); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(16); return false; } @@ -623,11 +936,9 @@ struct UpcJpsiCentralBarrel { template void fillHistograms(C collision, Ts tracks) { - Statistics.get(HIST("Statistics/hNumberOfCollisions"))->Fill(0); // number of collisions without any cuts - RawData.get(HIST("RawData/hPositionX"))->Fill(collision.posX()); - RawData.get(HIST("RawData/hPositionY"))->Fill(collision.posY()); - RawData.get(HIST("RawData/hPositionZ"))->Fill(collision.posZ()); + Statistics.get(HIST("Statistics/hCutCounterCollisions"))->Fill(0); // number of collisions without any cuts + // check UPC vs standard if (doOnlyUPC) { if (collision.flags() == 0) { return; @@ -639,6 +950,21 @@ struct UpcJpsiCentralBarrel { } } + // distinguish ZDC classes + bool XnXn = false, OnOn = false, XnOn = false, OnXn = false; + if (collision.energyCommonZNA() < ZNenergyCut && collision.energyCommonZNC() < ZNenergyCut) { + OnOn = true; + } + if (collision.energyCommonZNA() > ZNenergyCut && std::abs(collision.timeZNA()) < ZNtimeCut && collision.energyCommonZNC() > ZNenergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) { + XnXn = true; + } + if (collision.energyCommonZNA() > ZNenergyCut && std::abs(collision.timeZNA()) < ZNtimeCut && collision.energyCommonZNC() < ZNenergyCut) { + XnOn = true; + } + if (collision.energyCommonZNA() < ZNenergyCut && collision.energyCommonZNC() > ZNenergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) { + OnXn = true; + } + // loop over tracks without selections for (auto& track : tracks) { float trkPx = track.px(); @@ -646,6 +972,7 @@ struct UpcJpsiCentralBarrel { float trkPz = track.pz(); Statistics.get(HIST("Statistics/hNumberOfTracks"))->Fill(0); + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(0); if (track.isPVContributor() == 1) { Statistics.get(HIST("Statistics/hNumberOfTracks"))->Fill(1); PVContributors.get(HIST("PVContributors/hTrackPt"))->Fill(track.pt()); @@ -662,17 +989,20 @@ struct UpcJpsiCentralBarrel { } if (track.hasTOF()) { - PVContributors.get(HIST("PVContributors/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkPx, trkPy, trkPz), track.tofSignal()); PVContributors.get(HIST("PVContributors/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkPx, trkPy, trkPz), track.beta()); - PVContributors.get(HIST("PVContributors/PID/hTOFVsPt"))->Fill(track.pt(), track.tofSignal()); - PVContributors.get(HIST("PVContributors/PID/hTOFVsEta"))->Fill(RecoDecay::eta(std::array{trkPx, trkPy, trkPz}), track.tofSignal()); - PVContributors.get(HIST("PVContributors/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(trkPx, trkPy), track.tofSignal()); } } RawData.get(HIST("RawData/hTrackPt"))->Fill(track.pt()); RawData.get(HIST("RawData/hTrackEta"))->Fill(RecoDecay::eta(std::array{trkPx, trkPy, trkPz})); RawData.get(HIST("RawData/hTrackPhi"))->Fill(RecoDecay::phi(trkPx, trkPy)); + RawData.get(HIST("RawData/hTrackDCAXYZ"))->Fill(track.dcaXY(), track.dcaZ()); + RawData.get(HIST("RawData/hTPCNClsFindable"))->Fill(track.tpcNClsFindable()); + RawData.get(HIST("RawData/hTPCNClsFindableMinusFound"))->Fill(track.tpcNClsFindableMinusFound()); + RawData.get(HIST("RawData/hITSNCls"))->Fill(track.itsNCls()); + RawData.get(HIST("RawData/hTPCNCls"))->Fill(track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + RawData.get(HIST("RawData/hITSChi2NCls"))->Fill(track.itsChi2NCl()); + RawData.get(HIST("RawData/hTPCChi2NCls"))->Fill(track.tpcChi2NCl()); if (track.hasTPC()) { RawData.get(HIST("RawData/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkPx, trkPy, trkPz), track.tpcSignal()); @@ -682,58 +1012,44 @@ struct UpcJpsiCentralBarrel { } if (track.hasTOF()) { - RawData.get(HIST("RawData/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkPx, trkPy, trkPz), track.tofSignal()); RawData.get(HIST("RawData/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkPx, trkPy, trkPz), track.beta()); - RawData.get(HIST("RawData/PID/hTOFVsPt"))->Fill(track.pt(), track.tofSignal()); - RawData.get(HIST("RawData/PID/hTOFVsEta"))->Fill(RecoDecay::eta(std::array{trkPx, trkPy, trkPz}), track.tofSignal()); - RawData.get(HIST("RawData/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(trkPx, trkPy), track.tofSignal()); } } int countGT = 0; - int countGTMuSigma = 0; - int countGTElSigma = 0; - int countGTPSigma = 0; - int countGTPSigmaTOF = 0; std::vector trkIdx; // loop over tracks with selections - if (collision.posZ() < cutVertexZ) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(0); + if (std::abs(collision.posZ()) > cutVertexZ) { + Statistics.get(HIST("Statistics/hCutCounterCollisions"))->Fill(1); return; } + + RawData.get(HIST("RawData/hPositionX"))->Fill(collision.posX()); + RawData.get(HIST("RawData/hPositionY"))->Fill(collision.posY()); + RawData.get(HIST("RawData/hPositionZ"))->Fill(collision.posZ()); + RawData.get(HIST("RawData/hPositionXY"))->Fill(collision.posX(), collision.posY()); + RawData.get(HIST("RawData/hZNACommonEnergy"))->Fill(collision.energyCommonZNA()); + RawData.get(HIST("RawData/hZNCCommonEnergy"))->Fill(collision.energyCommonZNC()); + RawData.get(HIST("RawData/hZNAvsZNCCommonEnergy"))->Fill(collision.energyCommonZNA(), collision.energyCommonZNC()); + RawData.get(HIST("RawData/hZNCTime"))->Fill(collision.timeZNC()); + RawData.get(HIST("RawData/hZNATime"))->Fill(collision.timeZNA()); + RawData.get(HIST("RawData/hZNAvsZNCTime"))->Fill(collision.timeZNA(), collision.timeZNC()); + for (auto& track : tracks) { - // select primary vertex contributors - if (track.isPVContributor() != 1) { - Statistics.get(HIST("Statistics/hCutCounter"))->Fill(1); - continue; - } + + Statistics.get(HIST("Statistics/hNumberOfTracks"))->Fill(2.); + // select good tracks if (GoodTrackCuts(track) != 1) { continue; } + countGT++; trkIdx.push_back(track.index()); - - if (std::abs(track.tpcNSigmaMu()) < 3) { - countGTMuSigma++; - } - if (std::abs(track.tpcNSigmaEl()) < 3) { - countGTElSigma++; - } - if (std::abs(track.tpcNSigmaPr()) < 3) { - countGTPSigma++; - } - if (std::abs(track.tofNSigmaPr()) < 3) { - countGTPSigmaTOF++; - } } - Statistics.get(HIST("Statistics/hNumberOfTracks"))->Fill(2., countGT); + Statistics.get(HIST("Statistics/hNumberOfTracks"))->Fill(3., countGT); Statistics.get(HIST("Statistics/hNumberGT"))->Fill(countGT); - Statistics.get(HIST("Statistics/hNumberGTelSigma"))->Fill(countGTElSigma); - Statistics.get(HIST("Statistics/hNumberGTmuSigma"))->Fill(countGTMuSigma); - Statistics.get(HIST("Statistics/hNumberGTpSigma"))->Fill(countGTPSigma); - Statistics.get(HIST("Statistics/hNumberGTpSigmaTOF"))->Fill(countGTPSigmaTOF); float massEl = o2::constants::physics::MassElectron; float massMu = o2::constants::physics::MassMuonMinus; @@ -744,6 +1060,10 @@ struct UpcJpsiCentralBarrel { auto trkDaughter1 = tracks.iteratorAt(trkIdx[0]); auto trkDaughter2 = tracks.iteratorAt(trkIdx[1]); + if ((trkDaughter1.sign() * trkDaughter2.sign()) != -1) { + return; + } + if (chargeOrdered) { if (tracks.iteratorAt(trkIdx[0]).sign() < 0) { trkDaughter1 = tracks.iteratorAt(trkIdx[0]); @@ -754,10 +1074,6 @@ struct UpcJpsiCentralBarrel { } } - if ((trkDaughter1.sign() * trkDaughter2.sign()) > 0) { - return; - } - std::array daughter1 = {trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()}; std::array daughter2 = {trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()}; @@ -773,9 +1089,6 @@ struct UpcJpsiCentralBarrel { TG.get(HIST("TG/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); TG.get(HIST("TG/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); TG.get(HIST("TG/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - TG.get(HIST("TG/TPC/hNsigmaMu"))->Fill(trkDaughter1.tpcNSigmaMu()); - TG.get(HIST("TG/TPC/hNsigmaEl"))->Fill(trkDaughter1.tpcNSigmaEl()); - TG.get(HIST("TG/TPC/hNsigmaPr"))->Fill(trkDaughter1.tpcNSigmaPr()); TG.get(HIST("TG/hTPCNClsFindable"))->Fill(trkDaughter1.tpcNClsFindable()); TG.get(HIST("TG/hTPCNClsFindableMinusFound"))->Fill(trkDaughter1.tpcNClsFindableMinusFound()); if (trkDaughter1.sign() < 0) { @@ -789,30 +1102,14 @@ struct UpcJpsiCentralBarrel { TG.get(HIST("TG/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); TG.get(HIST("TG/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); TG.get(HIST("TG/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); - TG.get(HIST("TG/TPC/hNsigmaMu"))->Fill(trkDaughter2.tpcNSigmaMu()); - TG.get(HIST("TG/TPC/hNsigmaEl"))->Fill(trkDaughter2.tpcNSigmaEl()); - TG.get(HIST("TG/TPC/hNsigmaPr"))->Fill(trkDaughter2.tpcNSigmaPr()); TG.get(HIST("TG/hTPCNClsFindable"))->Fill(trkDaughter2.tpcNClsFindable()); TG.get(HIST("TG/hTPCNClsFindableMinusFound"))->Fill(trkDaughter2.tpcNClsFindableMinusFound()); } if (trkDaughter1.hasTOF()) { - TG.get(HIST("TG/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); - TG.get(HIST("TG/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - TG.get(HIST("TG/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - TG.get(HIST("TG/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); - TG.get(HIST("TG/TOF/hNsigmaMu"))->Fill(trkDaughter1.tofNSigmaMu()); - TG.get(HIST("TG/TOF/hNsigmaEl"))->Fill(trkDaughter1.tofNSigmaEl()); - TG.get(HIST("TG/TOF/hNsigmaPr"))->Fill(trkDaughter1.tofNSigmaPr()); + TG.get(HIST("TG/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); } if (trkDaughter2.hasTOF()) { - TG.get(HIST("TG/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); TG.get(HIST("TG/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - TG.get(HIST("TG/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - TG.get(HIST("TG/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - TG.get(HIST("TG/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); - TG.get(HIST("TG/TOF/hNsigmaMu"))->Fill(trkDaughter2.tofNSigmaMu()); - TG.get(HIST("TG/TOF/hNsigmaEl"))->Fill(trkDaughter2.tofNSigmaEl()); - TG.get(HIST("TG/TOF/hNsigmaPr"))->Fill(trkDaughter2.tofNSigmaPr()); } if (doElectrons) { if (RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaMu(), trkDaughter2.tpcNSigmaMu()) > RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaEl(), trkDaughter2.tpcNSigmaEl())) { @@ -829,6 +1126,9 @@ struct UpcJpsiCentralBarrel { float massJpsi = RecoDecay::m(arrMom, std::array{massEl, massEl}); float rapJpsi = RecoDecay::y(mother, massJpsi); + auto leadingP = RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()) > RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()) ? trkDaughter1 : trkDaughter2; + auto subleadingP = (leadingP == trkDaughter1) ? trkDaughter1 : trkDaughter2; + TGel.get(HIST("TGel/hTrackPt1"))->Fill(trkDaughter1.pt()); TGel.get(HIST("TGel/hTrackPt2"))->Fill(trkDaughter2.pt()); TGel.get(HIST("TGel/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); @@ -836,39 +1136,57 @@ struct UpcJpsiCentralBarrel { TGel.get(HIST("TGel/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); TGel.get(HIST("TGel/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); + // selections + Selections.get(HIST("Selections/Electron/Mass/Leading/hITSNClsVsM"))->Fill(massJpsi, leadingP.itsNCls()); + Selections.get(HIST("Selections/Electron/Mass/Leading/hITSChi2NClsVsM"))->Fill(massJpsi, leadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Electron/Mass/Leading/hTPCNClsVsM"))->Fill(massJpsi, leadingP.tpcNClsFindable() - leadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Electron/Mass/Leading/hTPCChi2NClsVsM"))->Fill(massJpsi, leadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Electron/Mass/Leading/hTPCNClsCrossedRowsVsM"))->Fill(massJpsi, subleadingP.tpcNClsCrossedRows()); + Selections.get(HIST("Selections/Electron/Mass/Subleading/hITSNClsVsM"))->Fill(massJpsi, subleadingP.itsNCls()); + Selections.get(HIST("Selections/Electron/Mass/Subleading/hITSChi2NClsVsM"))->Fill(massJpsi, subleadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Electron/Mass/Subleading/hTPCNClsVsM"))->Fill(massJpsi, subleadingP.tpcNClsFindable() - subleadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Electron/Mass/Subleading/hTPCChi2NClsVsM"))->Fill(massJpsi, subleadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Electron/Mass/Subleading/hTPCNClsCrossedRowsVsM"))->Fill(massJpsi, subleadingP.tpcNClsCrossedRows()); + + Selections.get(HIST("Selections/Electron/Rapidity/Leading/hITSNClsVsY"))->Fill(rapJpsi, leadingP.itsNCls()); + Selections.get(HIST("Selections/Electron/Rapidity/Leading/hITSChi2NClsVsY"))->Fill(rapJpsi, leadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Electron/Rapidity/Leading/hTPCNClsVsY"))->Fill(rapJpsi, leadingP.tpcNClsFindable() - leadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Electron/Rapidity/Leading/hTPCChi2NClsVsY"))->Fill(rapJpsi, leadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Electron/Rapidity/Leading/hTPCNClsCrossedRowsVsY"))->Fill(rapJpsi, subleadingP.tpcNClsCrossedRows()); + Selections.get(HIST("Selections/Electron/Rapidity/Subleading/hITSNClsVsY"))->Fill(rapJpsi, subleadingP.itsNCls()); + Selections.get(HIST("Selections/Electron/Rapidity/Subleading/hITSChi2NClsVsY"))->Fill(rapJpsi, subleadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Electron/Rapidity/Subleading/hTPCNClsVsY"))->Fill(rapJpsi, subleadingP.tpcNClsFindable() - subleadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Electron/Rapidity/Subleading/hTPCChi2NClsVsY"))->Fill(rapJpsi, subleadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Electron/Rapidity/Subleading/hTPCNClsCrossedRowsVsY"))->Fill(rapJpsi, subleadingP.tpcNClsCrossedRows()); + + Selections.get(HIST("Selections/Electron/Pt/Leading/hITSNClsVsPt"))->Fill(RecoDecay::pt(mother), leadingP.itsNCls()); + Selections.get(HIST("Selections/Electron/Pt/Leading/hITSChi2NClsVsPt"))->Fill(RecoDecay::pt(mother), leadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Electron/Pt/Leading/hTPCNClsVsPt"))->Fill(RecoDecay::pt(mother), leadingP.tpcNClsFindable() - leadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Electron/Pt/Leading/hTPCChi2NClsVsPt"))->Fill(RecoDecay::pt(mother), leadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Electron/Pt/Leading/hTPCNClsCrossedRowsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.tpcNClsCrossedRows()); + Selections.get(HIST("Selections/Electron/Pt/Subleading/hITSNClsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.itsNCls()); + Selections.get(HIST("Selections/Electron/Pt/Subleading/hITSChi2NClsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Electron/Pt/Subleading/hTPCNClsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.tpcNClsFindable() - subleadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Electron/Pt/Subleading/hTPCChi2NClsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Electron/Pt/Subleading/hTPCNClsCrossedRowsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.tpcNClsCrossedRows()); + if (trkDaughter1.hasTPC()) { TGel.get(HIST("TGel/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); TGel.get(HIST("TGel/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); TGel.get(HIST("TGel/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); TGel.get(HIST("TGel/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - TGel.get(HIST("TGel/hNsigmaEl"))->Fill(trkDaughter1.tpcNSigmaEl()); } if (trkDaughter2.hasTPC()) { TGel.get(HIST("TGel/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); TGel.get(HIST("TGel/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); TGel.get(HIST("TGel/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); TGel.get(HIST("TGel/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); - TGel.get(HIST("TGel/hNsigmaEl"))->Fill(trkDaughter2.tpcNSigmaEl()); - if (trkDaughter1.sign() < 0) { - TGel.get(HIST("TGel/TPCNegVsPosSignal"))->Fill(trkDaughter1.tpcSignal(), trkDaughter2.tpcSignal()); - } else { - TGel.get(HIST("TGel/TPCNegVsPosSignal"))->Fill(trkDaughter2.tpcSignal(), trkDaughter1.tpcSignal()); - } } if (trkDaughter1.hasTOF()) { - TGel.get(HIST("TGel/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); - TGel.get(HIST("TGel/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - TGel.get(HIST("TGel/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - TGel.get(HIST("TGel/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); - TGel.get(HIST("TGel/hNsigmaElTOF"))->Fill(trkDaughter1.tofNSigmaEl()); + TGel.get(HIST("TGel/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); } if (trkDaughter2.hasTOF()) { - TGel.get(HIST("TGel/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); TGel.get(HIST("TGel/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - TGel.get(HIST("TGel/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - TGel.get(HIST("TGel/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - TGel.get(HIST("TGel/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); - TGel.get(HIST("TGel/hNsigmaElTOF"))->Fill(trkDaughter2.tofNSigmaEl()); } if (CandidateCuts(massJpsi, rapJpsi) != 1) { @@ -881,8 +1199,6 @@ struct UpcJpsiCentralBarrel { TGelCand.get(HIST("TGelCand/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); TGelCand.get(HIST("TGelCand/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); TGelCand.get(HIST("TGelCand/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); - TGelCand.get(HIST("TGelCand/hTrackITSNcls1"))->Fill(trkDaughter1.itsNCls()); - TGelCand.get(HIST("TGelCand/hTrackITSNcls2"))->Fill(trkDaughter2.itsNCls()); TGelCand.get(HIST("TGelCand/hPairPt"))->Fill(RecoDecay::pt(mother)); TGelCand.get(HIST("TGelCand/hPairIVM"))->Fill(massJpsi); @@ -904,28 +1220,58 @@ struct UpcJpsiCentralBarrel { TGelCand.get(HIST("TGelCand/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); } if (trkDaughter1.hasTOF()) { - TGelCand.get(HIST("TGelCand/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); - TGelCand.get(HIST("TGelCand/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - TGelCand.get(HIST("TGelCand/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - TGelCand.get(HIST("TGelCand/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); + TGelCand.get(HIST("TGelCand/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); } if (trkDaughter2.hasTOF()) { - TGelCand.get(HIST("TGelCand/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); TGelCand.get(HIST("TGelCand/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - TGelCand.get(HIST("TGelCand/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - TGelCand.get(HIST("TGelCand/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - TGelCand.get(HIST("TGelCand/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); } if (RecoDecay::pt(mother) < 0.2f) { JPsiToEl.get(HIST("JPsiToEl/Coherent/hIVM"))->Fill(massJpsi); - } else { + if (XnXn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hIVM"))->Fill(massJpsi); + } else if (OnXn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hIVM"))->Fill(massJpsi); + } else if (XnOn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hIVM"))->Fill(massJpsi); + } else if (OnOn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hIVM"))->Fill(massJpsi); + } + } else if (RecoDecay::pt(mother) > 0.4f) { + JPsiToEl.get(HIST("JPsiToEl/NotCoherent/hIVM"))->Fill(massJpsi); + if (XnXn) { + JPsiToEl.get(HIST("JPsiToEl/NotCoherent/XnXn/hIVM"))->Fill(massJpsi); + } else if (OnXn) { + JPsiToEl.get(HIST("JPsiToEl/NotCoherent/OnXn/hIVM"))->Fill(massJpsi); + } else if (XnOn) { + JPsiToEl.get(HIST("JPsiToEl/NotCoherent/XnOn/hIVM"))->Fill(massJpsi); + } else if (OnOn) { + JPsiToEl.get(HIST("JPsiToEl/NotCoherent/OnOn/hIVM"))->Fill(massJpsi); + } + } + if (RecoDecay::pt(mother) > 0.2f) { JPsiToEl.get(HIST("JPsiToEl/Incoherent/hIVM"))->Fill(massJpsi); + if (XnXn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hIVM"))->Fill(massJpsi); + } else if (OnXn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hIVM"))->Fill(massJpsi); + } else if (XnOn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hIVM"))->Fill(massJpsi); + } else if (OnOn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hIVM"))->Fill(massJpsi); + } } - if (massJpsi < maxJpsiMass && massJpsi > minJpsiMass) { + if ((massJpsi < maxJpsiMass) && (massJpsi > minJpsiMass)) { TGelCand.get(HIST("TGelCand/hJpsiPt"))->Fill(RecoDecay::pt(mother)); TGelCand.get(HIST("TGelCand/hJpsiRap"))->Fill(rapJpsi); + + if (trkDaughter1.sign() < 0) { + TGelCand.get(HIST("TGelCand/TPCNegVsPosSignal"))->Fill(trkDaughter1.tpcSignal(), trkDaughter2.tpcSignal()); + } else { + TGelCand.get(HIST("TGelCand/TPCNegVsPosSignal"))->Fill(trkDaughter2.tpcSignal(), trkDaughter1.tpcSignal()); + } + if (RecoDecay::pt(mother) < 0.2f) { // fill track histos JPsiToEl.get(HIST("JPsiToEl/Coherent/hPt1"))->Fill(trkDaughter1.pt()); @@ -934,6 +1280,37 @@ struct UpcJpsiCentralBarrel { JPsiToEl.get(HIST("JPsiToEl/Coherent/hEta2"))->Fill(RecoDecay::eta(daughter2)); JPsiToEl.get(HIST("JPsiToEl/Coherent/hPhi1"))->Fill(RecoDecay::phi(daughter1)); JPsiToEl.get(HIST("JPsiToEl/Coherent/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + + if (XnXn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (OnOn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (XnOn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (OnXn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } + if (trkDaughter1.hasTPC()) { JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); @@ -948,18 +1325,10 @@ struct UpcJpsiCentralBarrel { } if (trkDaughter1.hasTOF()) { - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); } if (trkDaughter2.hasTOF()) { - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); } // fill J/psi histos JPsiToEl.get(HIST("JPsiToEl/Coherent/hPt"))->Fill(RecoDecay::pt(mother)); @@ -967,6 +1336,28 @@ struct UpcJpsiCentralBarrel { JPsiToEl.get(HIST("JPsiToEl/Coherent/hPhi"))->Fill(RecoDecay::phi(mother)); JPsiToEl.get(HIST("JPsiToEl/Coherent/hRap"))->Fill(rapJpsi); + if (XnXn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnXn/hRap"))->Fill(rapJpsi); + } else if (OnOn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnOn/hRap"))->Fill(rapJpsi); + } else if (OnXn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/OnXn/hRap"))->Fill(rapJpsi); + } else if (XnOn) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/XnOn/hRap"))->Fill(rapJpsi); + } + float* q = correlation(&daughter[0], &daughter[1], &mom); Correlation.get(HIST("Correlation/Electron/Coherent/Phi1"))->Fill(RecoDecay::phi(daughter1), 1.); Correlation.get(HIST("Correlation/Electron/Coherent/Phi2"))->Fill(RecoDecay::phi(daughter2), 1.); @@ -977,6 +1368,27 @@ struct UpcJpsiCentralBarrel { double dp = DeltaPhi(daughter[0], daughter[1]); Asymmetry.get(HIST("Asymmetry/Electron/Coherent/DeltaPhi"))->Fill(dp); + if (XnXn) { + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/XnXn/DeltaPhi"))->Fill(dp); + } else if (OnOn) { + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/OnOn/DeltaPhi"))->Fill(dp); + } else if (XnOn) { + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/XnOn/DeltaPhi"))->Fill(dp); + } else if (OnXn) { + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/OnXn/DeltaPhi"))->Fill(dp); + } + + double dpRandom = DeltaPhiRandom(daughter[0], daughter[1]); + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/DeltaPhiRandom"))->Fill(dpRandom); + if (XnXn) { + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/XnXn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (OnOn) { + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/OnOn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (XnOn) { + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/XnOn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (OnXn) { + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/OnXn/DeltaPhiRandom"))->Fill(dpRandom); + } delete[] q; } // end coherent electrons @@ -988,6 +1400,37 @@ struct UpcJpsiCentralBarrel { JPsiToEl.get(HIST("JPsiToEl/Incoherent/hEta2"))->Fill(RecoDecay::eta(daughter2)); JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPhi1"))->Fill(RecoDecay::phi(daughter1)); JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + + if (XnXn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (OnOn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (XnOn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (OnXn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } + if (trkDaughter1.hasTPC()) { JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); @@ -1002,18 +1445,10 @@ struct UpcJpsiCentralBarrel { } if (trkDaughter1.hasTOF()) { - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); } if (trkDaughter2.hasTOF()) { - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); } // fill J/psi histos JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPt"))->Fill(RecoDecay::pt(mother)); @@ -1021,6 +1456,28 @@ struct UpcJpsiCentralBarrel { JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPhi"))->Fill(RecoDecay::phi(mother)); JPsiToEl.get(HIST("JPsiToEl/Incoherent/hRap"))->Fill(rapJpsi); + if (XnXn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnXn/hRap"))->Fill(rapJpsi); + } else if (OnOn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnOn/hRap"))->Fill(rapJpsi); + } else if (OnXn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/OnXn/hRap"))->Fill(rapJpsi); + } else if (XnOn) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/XnOn/hRap"))->Fill(rapJpsi); + } + float* q = correlation(&daughter[0], &daughter[1], &mom); Correlation.get(HIST("Correlation/Electron/Incoherent/Phi1"))->Fill(RecoDecay::phi(daughter1), 1.); Correlation.get(HIST("Correlation/Electron/Incoherent/Phi2"))->Fill(RecoDecay::phi(daughter2), 1.); @@ -1031,6 +1488,27 @@ struct UpcJpsiCentralBarrel { double dp = DeltaPhi(daughter[0], daughter[1]); Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/DeltaPhi"))->Fill(dp); + if (XnXn) { + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/XnXn/DeltaPhi"))->Fill(dp); + } else if (OnOn) { + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/OnOn/DeltaPhi"))->Fill(dp); + } else if (XnOn) { + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/XnOn/DeltaPhi"))->Fill(dp); + } else if (OnXn) { + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/OnXn/DeltaPhi"))->Fill(dp); + } + + double dpRandom = DeltaPhiRandom(daughter[0], daughter[1]); + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/DeltaPhiRandom"))->Fill(dpRandom); + if (XnXn) { + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/XnXn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (OnOn) { + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/OnOn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (XnOn) { + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/XnOn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (OnXn) { + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/OnXn/DeltaPhiRandom"))->Fill(dpRandom); + } delete[] q; } // end incoherent electrons @@ -1047,23 +1525,14 @@ struct UpcJpsiCentralBarrel { mom = daughter[0] + daughter[1]; std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; - /* if (TOFBothTracks) { - if (!trkDaughter1.hasTOF() || !trkDaughter2.hasTOF()) - return; - } - if (TOFOneTrack) { - if ((trkDaughter1.hasTOF() && trkDaughter2.hasTOF()) || (!trkDaughter1.hasTOF() && !trkDaughter2.hasTOF())) - return; - } - if (TOFAtLeastOneTrack) { - if (!trkDaughter1.hasTOF() && !trkDaughter2.hasTOF()) - return; - }*/ auto arrMom = std::array{daughter1, daughter2}; float massJpsi = RecoDecay::m(arrMom, std::array{massMu, massMu}); float rapJpsi = RecoDecay::y(mother, massJpsi); + auto leadingP = RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()) > RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()) ? trkDaughter1 : trkDaughter2; + auto subleadingP = (leadingP == trkDaughter1) ? trkDaughter1 : trkDaughter2; + TGmu.get(HIST("TGmu/hTrackPt1"))->Fill(trkDaughter1.pt()); TGmu.get(HIST("TGmu/hTrackPt2"))->Fill(trkDaughter2.pt()); TGmu.get(HIST("TGmu/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); @@ -1071,12 +1540,45 @@ struct UpcJpsiCentralBarrel { TGmu.get(HIST("TGmu/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); TGmu.get(HIST("TGmu/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); + // selections + Selections.get(HIST("Selections/Muon/Mass/Leading/hITSNClsVsM"))->Fill(massJpsi, leadingP.itsNCls()); + Selections.get(HIST("Selections/Muon/Mass/Leading/hITSChi2NClsVsM"))->Fill(massJpsi, leadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Muon/Mass/Leading/hTPCNClsVsM"))->Fill(massJpsi, leadingP.tpcNClsFindable() - leadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Muon/Mass/Leading/hTPCChi2NClsVsM"))->Fill(massJpsi, leadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Muon/Mass/Leading/hTPCNClsCrossedRowsVsM"))->Fill(massJpsi, subleadingP.tpcNClsCrossedRows()); + Selections.get(HIST("Selections/Muon/Mass/Subleading/hITSNClsVsM"))->Fill(massJpsi, subleadingP.itsNCls()); + Selections.get(HIST("Selections/Muon/Mass/Subleading/hITSChi2NClsVsM"))->Fill(massJpsi, subleadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Muon/Mass/Subleading/hTPCNClsVsM"))->Fill(massJpsi, subleadingP.tpcNClsFindable() - subleadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Muon/Mass/Subleading/hTPCChi2NClsVsM"))->Fill(massJpsi, subleadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Muon/Mass/Subleading/hTPCNClsCrossedRowsVsM"))->Fill(massJpsi, subleadingP.tpcNClsCrossedRows()); + + Selections.get(HIST("Selections/Muon/Rapidity/Leading/hITSNClsVsY"))->Fill(rapJpsi, leadingP.itsNCls()); + Selections.get(HIST("Selections/Muon/Rapidity/Leading/hITSChi2NClsVsY"))->Fill(rapJpsi, leadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Muon/Rapidity/Leading/hTPCNClsVsY"))->Fill(rapJpsi, leadingP.tpcNClsFindable() - leadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Muon/Rapidity/Leading/hTPCChi2NClsVsY"))->Fill(rapJpsi, leadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Muon/Rapidity/Leading/hTPCNClsCrossedRowsVsY"))->Fill(rapJpsi, subleadingP.tpcNClsCrossedRows()); + Selections.get(HIST("Selections/Muon/Rapidity/Subleading/hITSNClsVsY"))->Fill(rapJpsi, subleadingP.itsNCls()); + Selections.get(HIST("Selections/Muon/Rapidity/Subleading/hITSChi2NClsVsY"))->Fill(rapJpsi, subleadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Muon/Rapidity/Subleading/hTPCNClsVsY"))->Fill(rapJpsi, subleadingP.tpcNClsFindable() - subleadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Muon/Rapidity/Subleading/hTPCChi2NClsVsY"))->Fill(rapJpsi, subleadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Muon/Rapidity/Subleading/hTPCNClsCrossedRowsVsY"))->Fill(rapJpsi, subleadingP.tpcNClsCrossedRows()); + + Selections.get(HIST("Selections/Muon/Pt/Leading/hITSNClsVsPt"))->Fill(RecoDecay::pt(mother), leadingP.itsNCls()); + Selections.get(HIST("Selections/Muon/Pt/Leading/hITSChi2NClsVsPt"))->Fill(RecoDecay::pt(mother), leadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Muon/Pt/Leading/hTPCNClsVsPt"))->Fill(RecoDecay::pt(mother), leadingP.tpcNClsFindable() - leadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Muon/Pt/Leading/hTPCChi2NClsVsPt"))->Fill(RecoDecay::pt(mother), leadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Muon/Pt/Leading/hTPCNClsCrossedRowsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.tpcNClsCrossedRows()); + Selections.get(HIST("Selections/Muon/Pt/Subleading/hITSNClsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.itsNCls()); + Selections.get(HIST("Selections/Muon/Pt/Subleading/hITSChi2NClsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.itsChi2NCl()); + Selections.get(HIST("Selections/Muon/Pt/Subleading/hTPCNClsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.tpcNClsFindable() - subleadingP.tpcNClsFindableMinusFound()); + Selections.get(HIST("Selections/Muon/Pt/Subleading/hTPCChi2NClsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.tpcChi2NCl()); + Selections.get(HIST("Selections/Muon/Pt/Subleading/hTPCNClsCrossedRowsVsPt"))->Fill(RecoDecay::pt(mother), subleadingP.tpcNClsCrossedRows()); + if (trkDaughter1.hasTPC()) { TGmu.get(HIST("TGmu/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); TGmu.get(HIST("TGmu/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); TGmu.get(HIST("TGmu/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); TGmu.get(HIST("TGmu/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - TGmu.get(HIST("TGmu/hNsigmaMu"))->Fill(trkDaughter1.tpcNSigmaMu()); if (trkDaughter1.sign() < 0) { TGmu.get(HIST("TGmu/TPCNegVsPosSignal"))->Fill(trkDaughter1.tpcSignal(), trkDaughter2.tpcSignal()); } else { @@ -1088,22 +1590,13 @@ struct UpcJpsiCentralBarrel { TGmu.get(HIST("TGmu/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); TGmu.get(HIST("TGmu/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); TGmu.get(HIST("TGmu/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); - TGmu.get(HIST("TGmu/hNsigmaMu"))->Fill(trkDaughter2.tpcNSigmaMu()); } if (trkDaughter1.hasTOF()) { - TGmu.get(HIST("TGmu/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); - TGmu.get(HIST("TGmu/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - TGmu.get(HIST("TGmu/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - TGmu.get(HIST("TGmu/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); - TGmu.get(HIST("TGmu/hNsigmaMuTOF"))->Fill(trkDaughter1.tofNSigmaMu()); + TGmu.get(HIST("TGmu/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); } if (trkDaughter2.hasTOF()) { - TGmu.get(HIST("TGmu/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); + TGmu.get(HIST("TGmu/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - TGmu.get(HIST("TGmu/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - TGmu.get(HIST("TGmu/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - TGmu.get(HIST("TGmu/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); - TGmu.get(HIST("TGmu/hNsigmaMuTOF"))->Fill(trkDaughter1.tofNSigmaMu()); } if (CandidateCuts(massJpsi, rapJpsi) != 1) { @@ -1116,8 +1609,6 @@ struct UpcJpsiCentralBarrel { TGmuCand.get(HIST("TGmuCand/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); TGmuCand.get(HIST("TGmuCand/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); TGmuCand.get(HIST("TGmuCand/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); - TGmuCand.get(HIST("TGmuCand/hTrackITSNcls1"))->Fill(trkDaughter1.itsNCls()); - TGmuCand.get(HIST("TGmuCand/hTrackITSNcls2"))->Fill(trkDaughter2.itsNCls()); TGmuCand.get(HIST("TGmuCand/hPairPt"))->Fill(RecoDecay::pt(mother)); TGmuCand.get(HIST("TGmuCand/hPairIVM"))->Fill(massJpsi); @@ -1126,11 +1617,6 @@ struct UpcJpsiCentralBarrel { TGmuCand.get(HIST("TGmuCand/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); TGmuCand.get(HIST("TGmuCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); TGmuCand.get(HIST("TGmuCand/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - if (trkDaughter1.sign() < 0) { - TGmuCand.get(HIST("TGmuCand/TPCNegVsPosSignal"))->Fill(trkDaughter1.tpcSignal(), trkDaughter2.tpcSignal()); - } else { - TGmuCand.get(HIST("TGmuCand/TPCNegVsPosSignal"))->Fill(trkDaughter2.tpcSignal(), trkDaughter1.tpcSignal()); - } } if (trkDaughter2.hasTPC()) { TGmuCand.get(HIST("TGmuCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); @@ -1139,37 +1625,113 @@ struct UpcJpsiCentralBarrel { TGmuCand.get(HIST("TGmuCand/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); } if (trkDaughter1.hasTOF()) { - TGmuCand.get(HIST("TGmuCand/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); - TGmuCand.get(HIST("TGmuCand/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - TGmuCand.get(HIST("TGmuCand/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - TGmuCand.get(HIST("TGmuCand/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); + TGmuCand.get(HIST("TGmuCand/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); } if (trkDaughter2.hasTOF()) { - TGmuCand.get(HIST("TGmuCand/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); TGmuCand.get(HIST("TGmuCand/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - TGmuCand.get(HIST("TGmuCand/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - TGmuCand.get(HIST("TGmuCand/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - TGmuCand.get(HIST("TGmuCand/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); } if (RecoDecay::pt(mother) < 0.2f) { JPsiToMu.get(HIST("JPsiToMu/Coherent/hIVM"))->Fill(massJpsi); - } else { + if (XnXn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hIVM"))->Fill(massJpsi); + } else if (OnXn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hIVM"))->Fill(massJpsi); + } else if (XnOn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hIVM"))->Fill(massJpsi); + } else if (OnOn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hIVM"))->Fill(massJpsi); + } + } else if (RecoDecay::pt(mother) > 0.4f) { + JPsiToMu.get(HIST("JPsiToMu/NotCoherent/hIVM"))->Fill(massJpsi); + if (XnXn) { + JPsiToMu.get(HIST("JPsiToMu/NotCoherent/XnXn/hIVM"))->Fill(massJpsi); + } else if (OnXn) { + JPsiToMu.get(HIST("JPsiToMu/NotCoherent/OnXn/hIVM"))->Fill(massJpsi); + } else if (XnOn) { + JPsiToMu.get(HIST("JPsiToMu/NotCoherent/XnOn/hIVM"))->Fill(massJpsi); + } else if (OnOn) { + JPsiToMu.get(HIST("JPsiToMu/NotCoherent/OnOn/hIVM"))->Fill(massJpsi); + } + } + if (RecoDecay::pt(mother) > 0.2f) { JPsiToMu.get(HIST("JPsiToMu/Incoherent/hIVM"))->Fill(massJpsi); + if (XnXn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hIVM"))->Fill(massJpsi); + } else if (OnXn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hIVM"))->Fill(massJpsi); + } else if (XnOn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hIVM"))->Fill(massJpsi); + } else if (OnOn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hIVM"))->Fill(massJpsi); + } } - if (massJpsi < maxJpsiMass && massJpsi > minJpsiMass) { + if ((massJpsi < maxJpsiMass) && (massJpsi > minJpsiMass)) { TGmuCand.get(HIST("TGmuCand/hJpsiPt"))->Fill(RecoDecay::pt(mother)); + if (RecoDecay::pt(mother) < 0.1f) { + TGmuCand.get(HIST("TGmuCand/hJpsiPt2"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + if (XnXn) { + TGmuCand.get(HIST("TGmuCand/XnXn/hJpsiPt2"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + } else if (XnOn) { + TGmuCand.get(HIST("TGmuCand/XnOn/hJpsiPt2"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + } else if (OnXn) { + TGmuCand.get(HIST("TGmuCand/OnXn/hJpsiPt2"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + } else if (OnOn) { + TGmuCand.get(HIST("TGmuCand/OnOn/hJpsiPt2"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + } + } TGmuCand.get(HIST("TGmuCand/hJpsiRap"))->Fill(rapJpsi); + if (trkDaughter1.sign() < 0) { + TGmuCand.get(HIST("TGmuCand/TPCNegVsPosSignal"))->Fill(trkDaughter1.tpcSignal(), trkDaughter2.tpcSignal()); + } else { + TGmuCand.get(HIST("TGmuCand/TPCNegVsPosSignal"))->Fill(trkDaughter2.tpcSignal(), trkDaughter1.tpcSignal()); + } if (RecoDecay::pt(mother) < 0.2f) { // fill track histos + TGmuCand.get(HIST("TGmuCand/hJpsiPt2wide"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); JPsiToMu.get(HIST("JPsiToMu/Coherent/hPt1"))->Fill(trkDaughter1.pt()); JPsiToMu.get(HIST("JPsiToMu/Coherent/hPt2"))->Fill(trkDaughter2.pt()); JPsiToMu.get(HIST("JPsiToMu/Coherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); JPsiToMu.get(HIST("JPsiToMu/Coherent/hEta2"))->Fill(RecoDecay::eta(daughter2)); JPsiToMu.get(HIST("JPsiToMu/Coherent/hPhi1"))->Fill(RecoDecay::phi(daughter1)); JPsiToMu.get(HIST("JPsiToMu/Coherent/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + + if (XnXn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + TGmuCand.get(HIST("TGmuCand/XnXn/hJpsiPt2wide"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + } else if (OnOn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + TGmuCand.get(HIST("TGmuCand/OnOn/hJpsiPt2wide"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + } else if (XnOn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + TGmuCand.get(HIST("TGmuCand/XnOn/hJpsiPt2wide"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + } else if (OnXn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + TGmuCand.get(HIST("TGmuCand/OnXn/hJpsiPt2wide"))->Fill(RecoDecay::pt(mother) * RecoDecay::pt(mother)); + } + if (trkDaughter1.hasTPC()) { JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); @@ -1183,18 +1745,10 @@ struct UpcJpsiCentralBarrel { JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); } if (trkDaughter1.hasTOF()) { - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); } if (trkDaughter2.hasTOF()) { - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); } // fill J/psi histos JPsiToMu.get(HIST("JPsiToMu/Coherent/hPt"))->Fill(RecoDecay::pt(mother)); @@ -1202,6 +1756,28 @@ struct UpcJpsiCentralBarrel { JPsiToMu.get(HIST("JPsiToMu/Coherent/hPhi"))->Fill(RecoDecay::phi(mother)); JPsiToMu.get(HIST("JPsiToMu/Coherent/hRap"))->Fill(rapJpsi); + if (XnXn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnXn/hRap"))->Fill(rapJpsi); + } else if (OnOn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnOn/hRap"))->Fill(rapJpsi); + } else if (OnXn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/OnXn/hRap"))->Fill(rapJpsi); + } else if (XnOn) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/XnOn/hRap"))->Fill(rapJpsi); + } + float* q = correlation(&daughter[0], &daughter[1], &mom); Correlation.get(HIST("Correlation/Muon/Coherent/Phi1"))->Fill(RecoDecay::phi(daughter1), 1.); Correlation.get(HIST("Correlation/Muon/Coherent/Phi2"))->Fill(RecoDecay::phi(daughter2), 1.); @@ -1212,6 +1788,26 @@ struct UpcJpsiCentralBarrel { double dp = DeltaPhi(daughter[0], daughter[1]); Asymmetry.get(HIST("Asymmetry/Muon/Coherent/DeltaPhi"))->Fill(dp); + if (XnXn) { + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/XnXn/DeltaPhi"))->Fill(dp); + } else if (OnOn) { + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/OnOn/DeltaPhi"))->Fill(dp); + } else if (XnOn) { + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/XnOn/DeltaPhi"))->Fill(dp); + } else if (OnXn) { + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/OnXn/DeltaPhi"))->Fill(dp); + } + double dpRandom = DeltaPhiRandom(daughter[0], daughter[1]); + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/DeltaPhiRandom"))->Fill(dpRandom); + if (XnXn) { + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/XnXn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (OnOn) { + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/OnOn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (XnOn) { + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/XnOn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (OnXn) { + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/OnXn/DeltaPhiRandom"))->Fill(dpRandom); + } delete[] q; } @@ -1223,6 +1819,37 @@ struct UpcJpsiCentralBarrel { JPsiToMu.get(HIST("JPsiToMu/Incoherent/hEta2"))->Fill(RecoDecay::eta(daughter2)); JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPhi1"))->Fill(RecoDecay::phi(daughter1)); JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + + if (XnXn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (OnOn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (XnOn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } else if (OnXn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + } + if (trkDaughter1.hasTPC()) { JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); @@ -1236,18 +1863,10 @@ struct UpcJpsiCentralBarrel { JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); } if (trkDaughter1.hasTOF()) { - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); } if (trkDaughter2.hasTOF()) { - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); } // fill J/psi histos @@ -1256,6 +1875,28 @@ struct UpcJpsiCentralBarrel { JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPhi"))->Fill(RecoDecay::phi(mother)); JPsiToMu.get(HIST("JPsiToMu/Incoherent/hRap"))->Fill(rapJpsi); + if (XnXn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnXn/hRap"))->Fill(rapJpsi); + } else if (OnOn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnOn/hRap"))->Fill(rapJpsi); + } else if (OnXn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/OnXn/hRap"))->Fill(rapJpsi); + } else if (XnOn) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/XnOn/hRap"))->Fill(rapJpsi); + } + float* q = correlation(&daughter[0], &daughter[1], &mom); Correlation.get(HIST("Correlation/Muon/Incoherent/Phi1"))->Fill(RecoDecay::phi(daughter1), 1.); Correlation.get(HIST("Correlation/Muon/Incoherent/Phi2"))->Fill(RecoDecay::phi(daughter2), 1.); @@ -1266,6 +1907,27 @@ struct UpcJpsiCentralBarrel { double dp = DeltaPhi(daughter[0], daughter[1]); Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/DeltaPhi"))->Fill(dp); + if (XnXn) { + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/XnXn/DeltaPhi"))->Fill(dp); + } else if (OnOn) { + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/OnOn/DeltaPhi"))->Fill(dp); + } else if (XnOn) { + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/XnOn/DeltaPhi"))->Fill(dp); + } else if (OnXn) { + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/OnXn/DeltaPhi"))->Fill(dp); + } + + double dpRandom = DeltaPhiRandom(daughter[0], daughter[1]); + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/DeltaPhiRandom"))->Fill(dpRandom); + if (XnXn) { + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/XnXn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (OnOn) { + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/OnOn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (XnOn) { + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/XnOn/DeltaPhiRandom"))->Fill(dpRandom); + } else if (OnXn) { + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/OnXn/DeltaPhiRandom"))->Fill(dpRandom); + } delete[] q; } @@ -1312,29 +1974,18 @@ struct UpcJpsiCentralBarrel { TGp.get(HIST("TGp/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); TGp.get(HIST("TGp/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); TGp.get(HIST("TGp/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - TGp.get(HIST("TGp/hNsigmaMu"))->Fill(trkDaughter1.tpcNSigmaPr()); } if (trkDaughter2.hasTPC()) { TGp.get(HIST("TGp/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); TGp.get(HIST("TGp/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); TGp.get(HIST("TGp/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); TGp.get(HIST("TGp/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); - TGp.get(HIST("TGp/hNsigmaMu"))->Fill(trkDaughter2.tpcNSigmaPr()); } if (trkDaughter1.hasTOF()) { - TGp.get(HIST("TGp/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); - TGp.get(HIST("TGp/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - TGp.get(HIST("TGp/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - TGp.get(HIST("TGp/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); - TGp.get(HIST("TGp/hNsigmaMuTOF"))->Fill(trkDaughter1.tofNSigmaPr()); + TGp.get(HIST("TGp/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); } if (trkDaughter2.hasTOF()) { - TGp.get(HIST("TGp/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); TGp.get(HIST("TGp/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - TGp.get(HIST("TGp/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - TGp.get(HIST("TGp/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - TGp.get(HIST("TGp/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); - TGp.get(HIST("TGp/hNsigmaMuTOF"))->Fill(trkDaughter2.tofNSigmaPr()); } if (CandidateCuts(massJpsi, rapJpsi) != 1) { @@ -1347,8 +1998,6 @@ struct UpcJpsiCentralBarrel { TGpCand.get(HIST("TGpCand/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); TGpCand.get(HIST("TGpCand/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); TGpCand.get(HIST("TGpCand/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); - TGpCand.get(HIST("TGpCand/hTrackITSNcls1"))->Fill(trkDaughter1.itsNCls()); - TGpCand.get(HIST("TGpCand/hTrackITSNcls2"))->Fill(trkDaughter2.itsNCls()); TGpCand.get(HIST("TGpCand/hPairPt"))->Fill(RecoDecay::pt(mother)); TGpCand.get(HIST("TGpCand/hPairIVM"))->Fill(massJpsi); @@ -1365,17 +2014,10 @@ struct UpcJpsiCentralBarrel { TGpCand.get(HIST("TGpCand/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); } if (trkDaughter1.hasTOF()) { - TGpCand.get(HIST("TGpCand/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); - TGpCand.get(HIST("TGpCand/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - TGpCand.get(HIST("TGpCand/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - TGpCand.get(HIST("TGpCand/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); + TGpCand.get(HIST("TGpCand/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); } if (trkDaughter2.hasTOF()) { - TGpCand.get(HIST("TGpCand/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); TGpCand.get(HIST("TGpCand/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - TGpCand.get(HIST("TGpCand/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - TGpCand.get(HIST("TGpCand/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - TGpCand.get(HIST("TGpCand/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); } if (RecoDecay::pt(mother) < 0.2f) { @@ -1408,18 +2050,10 @@ struct UpcJpsiCentralBarrel { JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); } if (trkDaughter1.hasTOF()) { - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); JPsiToP.get(HIST("JPsiToP/Coherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); } if (trkDaughter2.hasTOF()) { - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); JPsiToP.get(HIST("JPsiToP/Coherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); } // fill J/psi histos JPsiToP.get(HIST("JPsiToP/Coherent/hPt"))->Fill(RecoDecay::pt(mother)); @@ -1448,18 +2082,10 @@ struct UpcJpsiCentralBarrel { JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); } if (trkDaughter1.hasTOF()) { - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tofSignal()); JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.beta()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTOFVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tofSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tofSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tofSignal()); } if (trkDaughter2.hasTOF()) { - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tofSignal()); JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hBetaTOFVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.beta()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTOFVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tofSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTOFVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tofSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTOFVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tofSignal()); } // fill J/psi histos JPsiToP.get(HIST("JPsiToP/Incoherent/hPt"))->Fill(RecoDecay::pt(mother)); @@ -1471,7 +2097,115 @@ struct UpcJpsiCentralBarrel { } } // end protons } // end two tracks - } // end process + } // end reco process + + template + void processMC(C const& mcCollision, T const& mcParticles) + { + + MC.get(HIST("MC/hNumberOfMCCollisions"))->Fill(1.); + MC.get(HIST("MC/hPosZ"))->Fill(mcCollision.posZ()); + + std::array daughPart1Mu; + std::array daughPart2Mu; + std::array daughPart1El; + std::array daughPart2El; + std::array daughPart1Pr; + std::array daughPart2Pr; + + // fill number of particles + for (auto const& mcParticle : mcParticles) { + MC.get(HIST("MC/Muon/hNumberOfMCTracks"))->Fill(1.); + MC.get(HIST("MC/Electron/hNumberOfMCTracks"))->Fill(1.); + MC.get(HIST("MC/Proton/hNumberOfMCTracks"))->Fill(1.); + MC.get(HIST("MC/hPDG"))->Fill(mcParticle.pdgCode()); + + // check if only muons and physical primaries are present + if ((mcParticle.pdgCode() == 13) && mcParticle.isPhysicalPrimary()) { + daughPart1Mu = {mcParticle.px(), mcParticle.py(), mcParticle.pz()}; + + MC.get(HIST("MC/Muon/hNumberOfMCTracks"))->Fill(2.); + } + if ((mcParticle.pdgCode() == -13) && mcParticle.isPhysicalPrimary()) { + daughPart2Mu = {mcParticle.px(), mcParticle.py(), mcParticle.pz()}; + + MC.get(HIST("MC/Muon/hNumberOfMCTracks"))->Fill(3.); + } + if ((mcParticle.pdgCode() == 11) && mcParticle.isPhysicalPrimary()) { + daughPart1El = {mcParticle.px(), mcParticle.py(), mcParticle.pz()}; + + MC.get(HIST("MC/Electron/hNumberOfMCTracks"))->Fill(2.); + } + if ((mcParticle.pdgCode() == -11) && mcParticle.isPhysicalPrimary()) { + daughPart2El = {mcParticle.px(), mcParticle.py(), mcParticle.pz()}; + + MC.get(HIST("MC/Electron/hNumberOfMCTracks"))->Fill(3.); + } + if ((mcParticle.pdgCode() == 2212) && mcParticle.isPhysicalPrimary()) { + daughPart1Pr = {mcParticle.px(), mcParticle.py(), mcParticle.pz()}; + + MC.get(HIST("MC/Proton/hNumberOfMCTracks"))->Fill(2.); + } + if ((mcParticle.pdgCode() == -2212) && mcParticle.isPhysicalPrimary()) { + daughPart2Pr = {mcParticle.px(), mcParticle.py(), mcParticle.pz()}; + + MC.get(HIST("MC/Proton/hNumberOfMCTracks"))->Fill(3.); + } + } + + // calculate J/psi system and needed distributions + std::array motherPartMu = {daughPart1Mu[0] + daughPart2Mu[0], daughPart1Mu[1] + daughPart2Mu[1], daughPart1Mu[2] + daughPart2Mu[2]}; + std::array motherPartEl = {daughPart1El[0] + daughPart2El[0], daughPart1El[1] + daughPart2El[1], daughPart1El[2] + daughPart2El[2]}; + std::array motherPartPr = {daughPart1Pr[0] + daughPart2Pr[0], daughPart1Pr[1] + daughPart2Pr[1], daughPart1Pr[2] + daughPart2Pr[2]}; + + float massEl = o2::constants::physics::MassElectron; + float massMu = o2::constants::physics::MassMuonMinus; + float massPr = o2::constants::physics::MassProton; + + auto arrMomMu = std::array{daughPart1Mu, daughPart2Mu}; + float massJpsiMu = RecoDecay::m(arrMomMu, std::array{massMu, massMu}); + auto arrMomEl = std::array{daughPart1El, daughPart2El}; + float massJpsiEl = RecoDecay::m(arrMomEl, std::array{massEl, massEl}); + auto arrMomPr = std::array{daughPart1Pr, daughPart2Pr}; + float massJpsiPr = RecoDecay::m(arrMomPr, std::array{massPr, massPr}); + + MC.get(HIST("MC/Muon/hEta1"))->Fill(RecoDecay::eta(daughPart1Mu)); + MC.get(HIST("MC/Muon/hEta2"))->Fill(RecoDecay::eta(daughPart2Mu)); + MC.get(HIST("MC/Muon/hPhi1"))->Fill(RecoDecay::phi(daughPart1Mu)); + MC.get(HIST("MC/Muon/hPhi2"))->Fill(RecoDecay::phi(daughPart2Mu)); + MC.get(HIST("MC/Muon/hPt1"))->Fill(RecoDecay::pt(daughPart1Mu)); + MC.get(HIST("MC/Muon/hPt2"))->Fill(RecoDecay::pt(daughPart2Mu)); + MC.get(HIST("MC/Muon/hPt"))->Fill(RecoDecay::pt(motherPartMu)); + MC.get(HIST("MC/Muon/hIVM"))->Fill(massJpsiMu); + MC.get(HIST("MC/Muon/hRapidity"))->Fill(RecoDecay::y(motherPartMu, massJpsiMu)); + + MC.get(HIST("MC/Electron/hEta1"))->Fill(RecoDecay::eta(daughPart1El)); + MC.get(HIST("MC/Electron/hEta2"))->Fill(RecoDecay::eta(daughPart2El)); + MC.get(HIST("MC/Electron/hPhi1"))->Fill(RecoDecay::phi(daughPart1El)); + MC.get(HIST("MC/Electron/hPhi2"))->Fill(RecoDecay::phi(daughPart2El)); + MC.get(HIST("MC/Electron/hPt1"))->Fill(RecoDecay::pt(daughPart1El)); + MC.get(HIST("MC/Electron/hPt2"))->Fill(RecoDecay::pt(daughPart2El)); + MC.get(HIST("MC/Electron/hPt"))->Fill(RecoDecay::pt(motherPartEl)); + MC.get(HIST("MC/Electron/hIVM"))->Fill(massJpsiEl); + MC.get(HIST("MC/Electron/hRapidity"))->Fill(RecoDecay::y(motherPartEl, massJpsiEl)); + + MC.get(HIST("MC/Proton/hEta1"))->Fill(RecoDecay::eta(daughPart1Pr)); + MC.get(HIST("MC/Proton/hEta2"))->Fill(RecoDecay::eta(daughPart2Pr)); + MC.get(HIST("MC/Proton/hPhi1"))->Fill(RecoDecay::phi(daughPart1Pr)); + MC.get(HIST("MC/Proton/hPhi2"))->Fill(RecoDecay::phi(daughPart2Pr)); + MC.get(HIST("MC/Proton/hPt1"))->Fill(RecoDecay::pt(daughPart1Pr)); + MC.get(HIST("MC/Proton/hPt2"))->Fill(RecoDecay::pt(daughPart2Pr)); + MC.get(HIST("MC/Proton/hPt"))->Fill(RecoDecay::pt(motherPartPr)); + MC.get(HIST("MC/Proton/hIVM"))->Fill(massJpsiPr); + MC.get(HIST("MC/Proton/hRapidity"))->Fill(RecoDecay::y(motherPartPr, massJpsiPr)); + + } // end MC skimmed process + + template + void processMCU(C const& collisions) + { + MC.fill(HIST("MC/hNumberOfRecoCollisions"), collisions.size()); + } // end MC unskimmed process void processDGrecoLevel(UDCollisionFull const& collision, UDTracksFull const& tracks) { @@ -1492,8 +2226,20 @@ struct UpcJpsiCentralBarrel { } // end SG process - PROCESS_SWITCH(UpcJpsiCentralBarrel, processDGrecoLevel, "Iterate over DG skimmed data.", true); + void processMCtruth(aod::UDMcCollision const& mcCollision, aod::UDMcParticles const& mcParticles) + { + processMC(mcCollision, mcParticles); + } + + void processMCUnskimmed(aod::McCollision const&, soa::SmallGroups> const& collisions /*, aod::McParticles const& mcParticles, aod::TracksIU const& tracks*/) + { + processMCU(collisions); + } + + PROCESS_SWITCH(UpcJpsiCentralBarrel, processDGrecoLevel, "Iterate over DG skimmed data.", false); PROCESS_SWITCH(UpcJpsiCentralBarrel, processSGrecoLevel, "Iterate over SG skimmed data.", false); + PROCESS_SWITCH(UpcJpsiCentralBarrel, processMCtruth, "Iterate of MC true data.", true); + PROCESS_SWITCH(UpcJpsiCentralBarrel, processMCUnskimmed, "Iterate over unskimmed data.", true); }; // end struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/upcPionAnalysis.cxx b/PWGUD/Tasks/upcPionAnalysis.cxx index 8cab0acb000..2d5d35cd564 100644 --- a/PWGUD/Tasks/upcPionAnalysis.cxx +++ b/PWGUD/Tasks/upcPionAnalysis.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // - +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -484,9 +484,9 @@ struct UPCPionAnalysis { if (!trackselector(t, parameters)) continue; - int NFindable = t.tpcNClsFindable(); - int NMinusFound = t.tpcNClsFindableMinusFound(); - int NCluster = NFindable - NMinusFound; + // int NFindable = t.tpcNClsFindable(); + // int NMinusFound = t.tpcNClsFindableMinusFound(); + // int NCluster = NFindable - NMinusFound; /*if (NCluster < TPC_cluster) { continue; diff --git a/PWGUD/Tasks/upcRhoAnalysis.cxx b/PWGUD/Tasks/upcRhoAnalysis.cxx index 71fb313aa12..597f4945a3f 100644 --- a/PWGUD/Tasks/upcRhoAnalysis.cxx +++ b/PWGUD/Tasks/upcRhoAnalysis.cxx @@ -14,12 +14,15 @@ /// and also some basic stuff for decay phi anisotropy studies /// \author Jakub Juracka, jakub.juracka@cern.ch +#include +#include + #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/runDataProcessing.h" -#include "Math/Vector4D.h" // similiar to TLorentzVector (which is now legacy apparently) #include "random" +#include "TLorentzVector.h" #include "Common/DataModel/PIDResponse.h" @@ -30,15 +33,78 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using FullUDSgCollision = soa::Join::iterator; -using FullUDTracks = soa::Join; +using FullUdSgCollision = soa::Join::iterator; +using FullUdDgCollision = soa::Join::iterator; +using FullUdTracks = soa::Join; + +namespace o2::aod +{ +namespace tree +{ +// misc event info +DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); +DECLARE_SOA_COLUMN(GlobalBC, globalBC, uint64_t); +DECLARE_SOA_COLUMN(NumContrib, numContrib, int); +// event vertex +DECLARE_SOA_COLUMN(PosX, posX, double); +DECLARE_SOA_COLUMN(PosY, posY, double); +DECLARE_SOA_COLUMN(PosZ, posZ, double); +// FIT info +DECLARE_SOA_COLUMN(TotalFT0AmplitudeA, totalFT0AmplitudeA, float); +DECLARE_SOA_COLUMN(TotalFT0AmplitudeC, totalFT0AmplitudeC, float); +DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); +DECLARE_SOA_COLUMN(TotalFDDAmplitudeA, totalFDDAmplitudeA, float); +DECLARE_SOA_COLUMN(TotalFDDAmplitudeC, totalFDDAmplitudeC, float); +DECLARE_SOA_COLUMN(TimeFT0A, timeFT0A, float); +DECLARE_SOA_COLUMN(TimeFT0C, timeFT0C, float); +DECLARE_SOA_COLUMN(TimeFV0A, timeFV0A, float); +DECLARE_SOA_COLUMN(TimeFDDA, timeFDDA, float); +DECLARE_SOA_COLUMN(TimeFDDC, timeFDDC, float); +// ZDC info +DECLARE_SOA_COLUMN(EnergyCommonZNA, energyCommonZNA, float); +DECLARE_SOA_COLUMN(EnergyCommonZNC, energyCommonZNC, float); +DECLARE_SOA_COLUMN(TimeZNA, timeZNA, float); +DECLARE_SOA_COLUMN(TimeZNC, timeZNC, float); +DECLARE_SOA_COLUMN(NeutronClass, neutronClass, int); +// Rhos +DECLARE_SOA_COLUMN(TotalCharge, totalCharge, int); +// store things for reconstruction of lorentz vectors +DECLARE_SOA_COLUMN(RhoPt, rhoPt, double); +DECLARE_SOA_COLUMN(RhoEta, rhoEta, double); +DECLARE_SOA_COLUMN(RhoPhi, rhoPhi, double); +DECLARE_SOA_COLUMN(RhoM, rhoM, double); +// other stuff +DECLARE_SOA_COLUMN(RhoPhiRandom, rhoPhiRandom, double); +DECLARE_SOA_COLUMN(RhoPhiCharge, rhoPhiCharge, double); +// Pion tracks +DECLARE_SOA_COLUMN(TrackSign, trackSign, std::vector); +// for lorentz vector reconstruction +DECLARE_SOA_COLUMN(TrackPt, trackPt, std::vector); +DECLARE_SOA_COLUMN(TrackEta, trackEta, std::vector); +DECLARE_SOA_COLUMN(TrackPhi, trackPhi, std::vector); +DECLARE_SOA_COLUMN(TrackM, trackM, std::vector); +// other stuff +DECLARE_SOA_COLUMN(TrackPiPID, trackPiPID, std::vector); +DECLARE_SOA_COLUMN(TrackElPID, trackElPID, std::vector); +DECLARE_SOA_COLUMN(TrackDcaXY, trackDcaXY, std::vector); +DECLARE_SOA_COLUMN(TrackDcaZ, trackDcaZ, std::vector); +DECLARE_SOA_COLUMN(TrackTpcSignal, trackTpcSignal, std::vector); +} // namespace tree +DECLARE_SOA_TABLE(Tree, "AOD", "TREE", + tree::RunNumber, tree::GlobalBC, tree::NumContrib, + tree::PosX, tree::PosY, tree::PosZ, tree::TotalFT0AmplitudeA, tree::TotalFT0AmplitudeC, tree::TotalFV0AmplitudeA, tree::TotalFDDAmplitudeA, tree::TotalFDDAmplitudeC, + tree::TimeFT0A, tree::TimeFT0C, tree::TimeFV0A, tree::TimeFDDA, tree::TimeFDDC, + tree::EnergyCommonZNA, tree::EnergyCommonZNC, tree::TimeZNA, tree::TimeZNC, tree::NeutronClass, + tree::TotalCharge, tree::RhoPt, tree::RhoEta, tree::RhoPhi, tree::RhoM, tree::RhoPhiRandom, tree::RhoPhiCharge, + tree::TrackSign, tree::TrackPt, tree::TrackEta, tree::TrackPhi, tree::TrackM, tree::TrackPiPID, tree::TrackElPID, tree::TrackDcaXY, tree::TrackDcaZ, tree::TrackTpcSignal); +} // namespace o2::aod struct upcRhoAnalysis { - double PcEtaCut = 0.9; // physics coordination recommendation + Produces Tree; - Configurable specifyGapSide{"specifyGapSide", true, "specify gap side for SG/DG produced data"}; - Configurable gapSide{"gapSide", 2, "gap side for SG produced data"}; + double PcEtaCut = 0.9; // physics coordination recommendation Configurable requireTof{"requireTof", false, "require TOF signal"}; + Configurable do4pi{"do4pi", true, "do 4pi analysis"}; Configurable collisionsPosZMaxCut{"collisionsPosZMaxCut", 10.0, "max Z position cut on collisions"}; Configurable ZNcommonEnergyCut{"ZNcommonEnergyCut", 0.0, "ZN common energy cut"}; @@ -46,313 +112,381 @@ struct upcRhoAnalysis { Configurable tracksTpcNSigmaPiCut{"tracksTpcNSigmaPiCut", 3.0, "TPC nSigma pion cut"}; Configurable tracksDcaMaxCut{"tracksDcaMaxCut", 1.0, "max DCA cut on tracks"}; + Configurable tracksMinItsNClsCut{"tracksMinItsNClsCut", 6, "min ITS clusters cut"}; + Configurable tracksMaxItsChi2NClCut{"tracksMaxItsChi2NClCut", 3.0, "max ITS chi2/Ncls cut"}; + Configurable tracksMinTpcNClsCut{"tracksMinTpcNClsCut", 120, "min TPC clusters cut"}; + Configurable tracksMinTpcNClsCrossedRowsCut{"tracksMinTpcNClsCrossedRowsCut", 140, "min TPC crossed rows cut"}; + Configurable tracksMinTpcChi2NClCut{"tracksMinTpcChi2NClCut", 1.0, "min TPC chi2/Ncls cut"}; + Configurable tracksMaxTpcChi2NClCut{"tracksMaxTpcChi2NClCut", 1.8, "max TPC chi2/Ncls cut"}; + Configurable tracksMinTpcNClsCrossedOverFindableCut{"tracksMinTpcNClsCrossedOverFindableCut", 1.05, "min TPC crossed rows / findable clusters cut"}; + Configurable tracksMinPtCut{"tracksMinPtCut", 0.2, "min pT cut on tracks"}; - Configurable systemMassMinCut{"systemMassMinCut", 0.5, "min M cut for reco system"}; + Configurable systemMassMinCut{"systemMassMinCut", 0.4, "min M cut for reco system"}; Configurable systemMassMaxCut{"systemMassMaxCut", 1.2, "max M cut for reco system"}; Configurable systemPtCut{"systemPtMaxCut", 0.1, "max pT cut for reco system"}; Configurable systemYCut{"systemYCut", 0.9, "rapiditiy cut for reco system"}; ConfigurableAxis mAxis{"mAxis", {1000, 0.0, 10.0}, "m (GeV/#it{c}^{2})"}; - ConfigurableAxis mCutAxis{"mCutAxis", {70, 0.5, 1.2}, "m (GeV/#it{c}^{2})"}; + ConfigurableAxis mCutAxis{"mCutAxis", {160, 0.4, 1.2}, "m (GeV/#it{c}^{2})"}; ConfigurableAxis ptAxis{"ptAxis", {1000, 0.0, 10.0}, "p_{T} (GeV/#it{c})"}; - ConfigurableAxis ptCutAxis{"ptCutAxis", {300, 0.0, 0.3}, "p_{T} (GeV/#it{c})"}; - ConfigurableAxis pt2Axis{"pt2Axis", {300, 0.0, 0.09}, "p_{T}^{2} (GeV^{2}/#it{c}^{2})"}; - ConfigurableAxis etaAxis{"etaAxis", {180, -0.9, 0.9}, "#eta"}; - ConfigurableAxis yAxis{"yAxis", {180, -0.9, 0.9}, "y"}; + ConfigurableAxis ptCutAxis{"ptCutAxis", {100, 0.0, 0.1}, "p_{T} (GeV/#it{c})"}; + ConfigurableAxis pt2Axis{"pt2Axis", {100, 0.0, 0.01}, "p_{T}^{2} (GeV^{2}/#it{c}^{2})"}; + ConfigurableAxis etaAxis{"etaAxis", {800, -4.0, 4.0}, "#eta"}; + ConfigurableAxis etaCutAxis{"etaCutAxis", {180, -0.9, 0.9}, "#eta"}; + ConfigurableAxis yAxis{"yAxis", {400, -4.0, 4.0}, "y"}; + ConfigurableAxis yCutAxis{"yCutAxis", {180, -0.9, 0.9}, "y"}; ConfigurableAxis phiAxis{"phiAxis", {180, 0.0, o2::constants::math::TwoPI}, "#phi"}; ConfigurableAxis phiAsymmAxis{"phiAsymmAxis", {182, -o2::constants::math::PI, o2::constants::math::PI}, "#phi"}; ConfigurableAxis momentumFromPhiAxis{"momentumFromPhiAxis", {400, -0.1, 0.1}, "p (GeV/#it{c})"}; - ConfigurableAxis ptQuantileAxis{"ptQuantileAxis", {0, 0.0181689, 0.0263408, 0.0330488, 0.0390369, 0.045058, 0.0512604, 0.0582598, 0.066986, 0.0788085, 0.1}, "p_{T} (GeV/#it{c})"}; + // ConfigurableAxis ptQuantileAxis{"ptQuantileAxis", {0, 0.0181689, 0.0263408, 0.0330488, 0.0390369, 0.045058, 0.0512604, 0.0582598, 0.066986, 0.0788085, 0.1}, "p_{T} (GeV/#it{c})"}; - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry QC{"QC", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry Pions{"Pions", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry System{"System", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry MC{"MC", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry FourPiQA{"4piQA", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(o2::framework::InitContext&) { // QA // // collisions - registry.add("QC/collisions/hPosXY", ";x (cm);y (cm);counts", kTH2D, {{2000, -0.1, 0.1}, {2000, -0.1, 0.1}}); - registry.add("QC/collisions/hPosZ", ";z (cm);counts", kTH1D, {{400, -20.0, 20.0}}); - registry.add("QC/collisions/hNumContrib", ";number of contributors;counts", kTH1D, {{36, -0.5, 35.5}}); - registry.add("QC/collisions/hZdcCommonEnergy", ";ZNA common energy;ZNC common energy;counts", kTH2D, {{250, -5.0, 20.0}, {250, -5.0, 20.0}}); - registry.add("QC/collisions/hZdcTime", ";ZNA time (ns);ZNC time (ns);counts", kTH2D, {{200, -10.0, 10.0}, {200, -10.0, 10.0}}); - registry.add("QC/collisions/hZnaTimeVsCommonEnergy", ";ZNA common energy;ZNA time (ns);counts", kTH2D, {{250, -5.0, 20.0}, {200, -10.0, 10.0}}); - registry.add("QC/collisions/hZncTimeVsCommonEnergy", ";ZNC common energy;ZNC time (ns);counts", kTH2D, {{250, -5.0, 20.0}, {200, -10.0, 10.0}}); - registry.add("QC/collisions/hZnaTimeVsPosZ", ";z (cm);ZNA time (ns);counts", kTH2D, {{400, -20.0, 20.0}, {300, -1.5, 1.5}}); - registry.add("QC/collisions/hZncTimeVsPosZ", ";z (cm);ZNC time (ns);counts", kTH2D, {{400, -20.0, 20.0}, {300, -1.5, 1.5}}); - registry.add("QC/collisions/hPosZVsZnTimeAdd", ";(ZNA time + ZNC time)/2 (ns);z (cm);counts", kTH2D, {{300, -1.5, 1.5}, {400, -20.0, 20.0}}); - registry.add("QC/collisions/hPosZVsZnTimeSub", ";(ZNA time - ZNC time)/2 (ns);z (cm);counts", kTH2D, {{300, -1.5, 1.5}, {400, -20.0, 20.0}}); + QC.add("QC/collisions/all/hPosXY", ";x (cm);y (cm);counts", kTH2D, {{2000, -0.1, 0.1}, {2000, -0.1, 0.1}}); + QC.add("QC/collisions/all/hPosZ", ";z (cm);counts", kTH1D, {{400, -20.0, 20.0}}); + QC.add("QC/collisions/all/hNumContrib", ";number of contributors;counts", kTH1D, {{36, -0.5, 35.5}}); + QC.add("QC/collisions/all/hZdcCommonEnergy", ";ZNA common energy;ZNC common energy;counts", kTH2D, {{250, -5.0, 20.0}, {250, -5.0, 20.0}}); + QC.add("QC/collisions/all/hZdcTime", ";ZNA time (ns);ZNC time (ns);counts", kTH2D, {{200, -10.0, 10.0}, {200, -10.0, 10.0}}); + QC.add("QC/collisions/all/hTotalFT0AmplitudeA", ";FT0A amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/all/hTotalFT0AmplitudeC", ";FT0C amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/all/hTotalFV0AmplitudeA", ";FV0A amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/all/hTotalFDDAmplitudeA", ";FDDA amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/all/hTotalFDDAmplitudeC", ";FDDC amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/all/hTimeFT0A", ";FT0A time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + QC.add("QC/collisions/all/hTimeFT0C", ";FT0C time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + QC.add("QC/collisions/all/hTimeFV0A", ";FV0A time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + QC.add("QC/collisions/all/hTimeFDDA", ";FDDA time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + QC.add("QC/collisions/all/hTimeFDDC", ";FDDC time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + // events with selected rho candidates + QC.add("QC/collisions/selected/hPosXY", ";x (cm);y (cm);counts", kTH2D, {{2000, -0.1, 0.1}, {2000, -0.1, 0.1}}); + QC.add("QC/collisions/selected/hPosZ", ";z (cm);counts", kTH1D, {{400, -20.0, 20.0}}); + QC.add("QC/collisions/selected/hNumContrib", ";number of contributors;counts", kTH1D, {{36, -0.5, 35.5}}); + QC.add("QC/collisions/selected/hZdcCommonEnergy", ";ZNA common energy;ZNC common energy;counts", kTH2D, {{250, -5.0, 20.0}, {250, -5.0, 20.0}}); + QC.add("QC/collisions/selected/hZdcTime", ";ZNA time (ns);ZNC time (ns);counts", kTH2D, {{200, -10.0, 10.0}, {200, -10.0, 10.0}}); + QC.add("QC/collisions/selected/hTotalFT0AmplitudeA", ";FT0A amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/selected/hTotalFT0AmplitudeC", ";FT0C amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/selected/hTotalFV0AmplitudeA", ";FV0A amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/selected/hTotalFDDAmplitudeA", ";FDDA amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/selected/hTotalFDDAmplitudeC", ";FDDC amplitude;counts", kTH1D, {{1000, 0.0, 1000.0}}); + QC.add("QC/collisions/selected/hTimeFT0A", ";FT0A time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + QC.add("QC/collisions/selected/hTimeFT0C", ";FT0C time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + QC.add("QC/collisions/selected/hTimeFV0A", ";FV0A time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + QC.add("QC/collisions/selected/hTimeFDDA", ";FDDA time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); + QC.add("QC/collisions/selected/hTimeFDDC", ";FDDC time (ns);counts", kTH1D, {{200, -100.0, 100.0}}); // all tracks - registry.add("QC/tracks/raw/hTpcNSigmaPi", ";TPC n#sigma_{#pi};counts", kTH1D, {{400, -10.0, 30.0}}); - registry.add("QC/tracks/raw/hTofNSigmaPi", ";TOF n#sigma_{#pi};counts", kTH1D, {{400, -20.0, 20.0}}); - registry.add("QC/tracks/raw/hTpcNSigmaEl", ";TPC n#sigma_{e};counts", kTH1D, {{400, -10.0, 30.0}}); - registry.add("QC/tracks/raw/hDcaXYZ", ";DCA_{z} (cm);DCA_{xy} (cm);counts", kTH2D, {{1000, -5.0, 5.0}, {1000, -5.0, 5.0}}); - registry.add("QC/tracks/raw/hItsNCls", ";ITS N_{cls};counts", kTH1D, {{11, -0.5, 10.5}}); - registry.add("QC/tracks/raw/hItsChi2NCl", ";ITS #chi^{2}/N_{cls};counts", kTH1D, {{1000, 0.0, 100.0}}); - registry.add("QC/tracks/raw/hTpcChi2NCl", ";TPC #chi^{2}/N_{cls};counts", kTH1D, {{1000, 0.0, 100.0}}); - registry.add("QC/tracks/raw/hTpcNClsFindable", ";TPC N_{cls} findable;counts", kTH1D, {{200, 0.0, 200.0}}); - registry.add("QC/tracks/raw/hTpcNClsCrossedRows", ";TPC crossed rows;counts", kTH1D, {{200, 0.0, 200.0}}); - // tracks passing selections - registry.add("QC/tracks/cut/hTpcNSigmaPi2D", ";TPC n#sigma(#pi_{1});TPC n#sigma(#pi_{2});counts", kTH2D, {{400, -10.0, 30.0}, {400, -10.0, 30.0}}); - registry.add("QC/tracks/cut/hTpcNSigmaEl2D", ";TPC n#sigma(e_{1});TPC n#sigma(e_{2});counts", kTH2D, {{400, -10.0, 30.0}, {400, -10.0, 30.0}}); - registry.add("QC/tracks/cut/hTpcSignalVsPt", ";p_{T} (GeV/#it{c});TPC signal;counts", kTH2D, {ptAxis, {500, 0.0, 500.0}}); - registry.add("QC/tracks/cut/hRemainingTracks", ";remaining tracks;counts", kTH1D, {{21, -0.5, 20.5}}); - registry.add("QC/tracks/cut/hDcaXYZ", ";DCA_{z} (cm);DCA_{xy} (cm);counts", kTH2D, {{1000, -5.0, 5.0}, {1000, -5.0, 5.0}}); + QC.add("QC/tracks/raw/hTpcNSigmaPi", ";TPC n#sigma_{#pi};counts", kTH1D, {{400, -10.0, 30.0}}); + QC.add("QC/tracks/raw/hTofNSigmaPi", ";TOF n#sigma_{#pi};counts", kTH1D, {{400, -20.0, 20.0}}); + QC.add("QC/tracks/raw/hTpcNSigmaEl", ";TPC n#sigma_{e};counts", kTH1D, {{400, -10.0, 30.0}}); + QC.add("QC/tracks/raw/hDcaXYZ", ";DCA_{z} (cm);DCA_{xy} (cm);counts", kTH2D, {{1000, -5.0, 5.0}, {1000, -5.0, 5.0}}); + QC.add("QC/tracks/raw/hItsNCls", ";ITS N_{cls};counts", kTH1D, {{11, -0.5, 10.5}}); + QC.add("QC/tracks/raw/hItsChi2NCl", ";ITS #chi^{2}/N_{cls};counts", kTH1D, {{1000, 0.0, 100.0}}); + QC.add("QC/tracks/raw/hTpcChi2NCl", ";TPC #chi^{2}/N_{cls};counts", kTH1D, {{1000, 0.0, 100.0}}); + QC.add("QC/tracks/raw/hTpcNCls", ";TPC N_{cls} found;counts", kTH1D, {{200, 0.0, 200.0}}); + QC.add("QC/tracks/raw/hTpcNClsCrossedRows", ";TPC crossed rows;counts", kTH1D, {{200, 0.0, 200.0}}); + QC.add("QC/tracks/raw/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + QC.add("QC/tracks/raw/hEta", ";y;counts", kTH1D, {etaAxis}); + QC.add("QC/tracks/raw/hPhi", ";#phi;counts", kTH1D, {phiAxis}); // tracks passing selections + QC.add("QC/tracks/cut/hTpcNSigmaPi2D", ";TPC n#sigma(#pi_{leading});TPC n#sigma(#pi_{subleading});counts", kTH2D, {{400, -10.0, 30.0}, {400, -10.0, 30.0}}); + QC.add("QC/tracks/cut/hTpcNSigmaEl2D", ";TPC n#sigma(e_{leading});TPC n#sigma(e_{subleading});counts", kTH2D, {{400, -10.0, 30.0}, {400, -10.0, 30.0}}); + QC.add("QC/tracks/cut/hTpcSignalVsP", ";p (GeV/#it{c});TPC signal;counts", kTH2D, {ptAxis, {500, 0.0, 500.0}}); + QC.add("QC/tracks/cut/hTpcSignalVsPt", ";p_{T} (GeV/#it{c});TPC signal;counts", kTH2D, {ptAxis, {500, 0.0, 500.0}}); + QC.add("QC/tracks/cut/hRemainingTracks", ";remaining tracks;counts", kTH1D, {{21, -0.5, 20.5}}); + QC.add("QC/tracks/cut/hDcaXYZ", ";DCA_{z} (cm);DCA_{xy} (cm);counts", kTH2D, {{1000, -5.0, 5.0}, {1000, -5.0, 5.0}}); // selection counter - std::vector selectionCounterLabels = {"all tracks", "PV contributor", "ITS + TPC hit", "TOF requirement", "DCA cut", "#eta cut", "2D TPC n#sigma_{#pi} cut"}; - auto hSelectionCounter = registry.add("QC/tracks/hSelectionCounter", ";;counts", kTH1D, {{static_cast(selectionCounterLabels.size()), -0.5, static_cast(selectionCounterLabels.size()) - 0.5}}); + std::vector selectionCounterLabels = {"all tracks", "PV contributor", "ITS hit", "ITS N_{clusters}", "ITS #chi^{2}/N_{clusters}", "TPC hit", "TPC N_{clusters} found", "TPC #chi^{2}/N_{clusters}", "TPC crossed rows", + "TPC crossed rows/N_{clusters}", + "TOF requirement", + "p_{T}", "DCA", "#eta", "exactly 2 tracks", "PID"}; + auto hSelectionCounter = QC.add("QC/tracks/hSelectionCounter", ";;counts", kTH1D, {{static_cast(selectionCounterLabels.size()), -0.5, static_cast(selectionCounterLabels.size()) - 0.5}}); for (int i = 0; i < static_cast(selectionCounterLabels.size()); ++i) hSelectionCounter->GetXaxis()->SetBinLabel(i + 1, selectionCounterLabels[i].c_str()); + // TOF hit check + QC.add("QC/tracks/hTofHitCheck", ";leading track TOF hit;subleading track TOF hit;counts", kTH2D, {{2, -0.5, 1.5}, {2, -0.5, 1.5}}); // RECO HISTOS // // PIONS // no selection - registry.add("pions/no-selection/unlike-sign/hPt", ";p_{T}(#pi_{1}) (GeV/#it{c});p_{T}(#pi_{2}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); - registry.add("pions/no-selection/unlike-sign/hEta", ";#eta(#pi_{1});#eta(#pi_{2});counts", kTH2D, {etaAxis, etaAxis}); - registry.add("pions/no-selection/unlike-sign/hPhi", ";#phi(#pi_{1});#phi(#pi_{2});counts", kTH2D, {phiAxis, phiAxis}); - registry.add("pions/no-selection/like-sign/hPt", ";p_{T}(#pi_{1}) (GeV/#it{c});p_{T}(#pi_{2}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); - registry.add("pions/no-selection/like-sign/hEta", ";#eta(#pi_{1});#eta(#pi_{2});counts", kTH2D, {etaAxis, etaAxis}); - registry.add("pions/no-selection/like-sign/hPhi", ";#phi(#pi_{1});#phi(#pi_{2});counts", kTH2D, {phiAxis, phiAxis}); + Pions.add("pions/no-selection/unlike-sign/hPt", ";p_{T}(#pi_{leading}) (GeV/#it{c});p_{T}(#pi_{subleading}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); + Pions.add("pions/no-selection/unlike-sign/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaCutAxis, etaCutAxis}); + Pions.add("pions/no-selection/unlike-sign/hPhi", ";#phi(#pi_{leading});#phi(#pi_{subleading});counts", kTH2D, {phiAxis, phiAxis}); + Pions.add("pions/no-selection/like-sign/hPt", ";p_{T}(#pi_{leading}) (GeV/#it{c});p_{T}(#pi_{subleading}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); + Pions.add("pions/no-selection/like-sign/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaCutAxis, etaCutAxis}); + Pions.add("pions/no-selection/like-sign/hPhi", ";#phi(#pi_{leading});#phi(#pi_{subleading});counts", kTH2D, {phiAxis, phiAxis}); // selected - registry.add("pions/selected/unlike-sign/hPt", ";p_{T}(#pi_{1}) (GeV/#it{c});p_{T}(#pi_{2}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); - registry.add("pions/selected/unlike-sign/hEta", ";#eta(#pi_{1});#eta(#pi_{2});counts", kTH2D, {etaAxis, etaAxis}); - registry.add("pions/selected/unlike-sign/hPhi", ";#phi(#pi_{1});#phi(#pi_{2});counts", kTH2D, {phiAxis, phiAxis}); - registry.add("pions/selected/like-sign/hPt", ";p_{T}(#pi_{1}) (GeV/#it{c});p_{T}(#pi_{2}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); - registry.add("pions/selected/like-sign/hEta", ";#eta(#pi_{1});#eta(#pi_{2});counts", kTH2D, {etaAxis, etaAxis}); - registry.add("pions/selected/like-sign/hPhi", ";#phi(#pi_{1});#phi(#pi_{2});counts", kTH2D, {phiAxis, phiAxis}); + Pions.add("pions/selected/unlike-sign/hPt", ";p_{T}(#pi_{leading}) (GeV/#it{c});p_{T}(#pi_{subleading}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); + Pions.add("pions/selected/unlike-sign/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaCutAxis, etaCutAxis}); + Pions.add("pions/selected/unlike-sign/hPhi", ";#phi(#pi_{leading});#phi(#pi_{subleading});counts", kTH2D, {phiAxis, phiAxis}); + Pions.add("pions/selected/like-sign/hPt", ";p_{T}(#pi_{leading}) (GeV/#it{c});p_{T}(#pi_{subleading}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); + Pions.add("pions/selected/like-sign/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaCutAxis, etaCutAxis}); + Pions.add("pions/selected/like-sign/hPhi", ";#phi(#pi_{leading});#phi(#pi_{subleading});counts", kTH2D, {phiAxis, phiAxis}); // RAW RHOS - registry.add("system/2pi/raw/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("system/2pi/raw/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("system/2pi/raw/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("system/2pi/raw/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/raw/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("system/2pi/raw/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("system/2pi/raw/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("system/2pi/raw/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/raw/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("system/2pi/raw/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("system/2pi/raw/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("system/2pi/raw/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/raw/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + System.add("system/raw/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + System.add("system/raw/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); + System.add("system/raw/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/raw/unlike-sign/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + System.add("system/raw/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + System.add("system/raw/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + System.add("system/raw/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); + System.add("system/raw/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/raw/like-sign/positive/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + System.add("system/raw/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + System.add("system/raw/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + System.add("system/raw/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); + System.add("system/raw/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/raw/like-sign/negative/hPhi", ";#phi;counts", kTH1D, {phiAxis}); // SELECTED RHOS // no selection - registry.add("system/2pi/cut/no-selection/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/no-selection/unlike-sign/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/no-selection/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/positive/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/no-selection/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/no-selection/like-sign/negative/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); + System.add("system/cut/no-selection/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/no-selection/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/no-selection/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/no-selection/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/no-selection/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/no-selection/unlike-sign/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + System.add("system/cut/no-selection/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/no-selection/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/no-selection/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/no-selection/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/no-selection/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/no-selection/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/no-selection/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/no-selection/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/no-selection/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/no-selection/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/no-selection/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/no-selection/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/no-selection/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/no-selection/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); // 0n0n - registry.add("system/2pi/cut/0n0n/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0n0n/unlike-sign/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/0n0n/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/positive/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/0n0n/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0n0n/like-sign/negative/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); + System.add("system/cut/0n0n/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/0n0n/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/0n0n/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/0n0n/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/0n0n/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/0n0n/unlike-sign/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + System.add("system/cut/0n0n/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0n0n/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0n0n/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0n0n/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0n0n/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/0n0n/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/0n0n/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/0n0n/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/0n0n/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/0n0n/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/0n0n/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/0n0n/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/0n0n/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/0n0n/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); // Xn0n - registry.add("system/2pi/cut/Xn0n/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/Xn0n/unlike-sign/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/positive/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/Xn0n/like-sign/negative/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); + System.add("system/cut/Xn0n/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/Xn0n/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/Xn0n/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/Xn0n/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/Xn0n/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/Xn0n/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/Xn0n/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/Xn0n/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/Xn0n/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/Xn0n/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); // 0nXn - registry.add("system/2pi/cut/0nXn/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0nXn/unlike-sign/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/0nXn/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/positive/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/0nXn/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/0nXn/like-sign/negative/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); + System.add("system/cut/0nXn/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/0nXn/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/0nXn/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/0nXn/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/0nXn/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/0nXn/unlike-sign/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0nXn/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0nXn/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/0nXn/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/0nXn/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/0nXn/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/0nXn/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/0nXn/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/0nXn/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/0nXn/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/0nXn/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/0nXn/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); // XnXn - registry.add("system/2pi/cut/XnXn/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/XnXn/unlike-sign/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/XnXn/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/positive/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - registry.add("system/2pi/cut/XnXn/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - registry.add("system/2pi/cut/XnXn/like-sign/negative/hMInPtQuantileBins", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptQuantileAxis}); - - // 4PI AND 6PI SYSTEM - registry.add("system/4pi/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("system/4pi/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("system/4pi/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("system/4pi/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("system/6pi/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("system/6pi/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("system/6pi/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("system/6pi/hY", ";y;counts", kTH1D, {yAxis}); - } + System.add("system/cut/XnXn/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/XnXn/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/XnXn/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/XnXn/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/XnXn/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/XnXn/unlike-sign/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/XnXn/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/XnXn/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/XnXn/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); - template - bool collisionPassesCuts(const C& collision) // collision cuts - { - if (std::abs(collision.posZ()) > collisionsPosZMaxCut) - return false; - if (specifyGapSide && collision.gapSide() != gapSide) - return false; - return true; + System.add("system/cut/XnXn/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/XnXn/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/XnXn/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/XnXn/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + System.add("system/cut/XnXn/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + System.add("system/cut/XnXn/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + System.add("system/cut/XnXn/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPhi", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + System.add("system/cut/XnXn/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + // MC + MC.add("MC/collisions/hPosXY", ";x (cm);y (cm);counts", kTH2D, {{2000, -0.1, 0.1}, {2000, -0.1, 0.1}}); + MC.add("MC/collisions/hPosZ", ";z (cm);counts", kTH1D, {{400, -20.0, 20.0}}); + MC.add("MC/collisions/hNPions", ";number of pions;counts", kTH1D, {{11, -0.5, 10.5}}); + MC.add("MC/collisions/hNumOfCollisionRecos", ";number of collision reconstructions;counts", kTH1D, {{11, -0.5, 10.5}}); + + MC.add("MC/tracks/all/hPdgCode", ";pdg code;counts", kTH1D, {{2001, -1000.5, 1000.5}}); + MC.add("MC/tracks/all/hProducedByGenerator", ";produced by generator;counts", kTH1D, {{2, -0.5, 1.5}}); + MC.add("MC/tracks/all/hIsPhysicalPrimary", ";is physical primary;counts", kTH1D, {{2, -0.5, 1.5}}); + MC.add("MC/tracks/all/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + MC.add("MC/tracks/all/hEta", ";#eta;counts", kTH1D, {etaAxis}); + MC.add("MC/tracks/all/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + MC.add("MC/tracks/pions/hPt", ";p_{T}(#pi_{leading}) (GeV/#it{c});p_{T}(#pi_{subleading}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); + MC.add("MC/tracks/pions/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaAxis, etaAxis}); + MC.add("MC/tracks/pions/hPhi", ";#phi(#pi_{leading});#phi(#pi_{subleading});counts", kTH2D, {phiAxis, phiAxis}); + + MC.add("MC/system/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + MC.add("MC/system/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + MC.add("MC/system/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + MC.add("MC/system/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); + MC.add("MC/system/hY", ";y;counts", kTH1D, {yAxis}); + MC.add("MC/system/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + MC.add("MC/system/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + MC.add("MC/system/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + + // 4 pi QA + if (do4pi) { + FourPiQA.add("FourPiQA/reco/tracks/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + FourPiQA.add("FourPiQA/reco/tracks/hEta", ";#eta;counts", kTH1D, {etaAxis}); + FourPiQA.add("FourPiQA/reco/tracks/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + FourPiQA.add("FourPiQA/reco/system/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + FourPiQA.add("FourPiQA/reco/system/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + FourPiQA.add("FourPiQA/reco/system/hY", ";y;counts", kTH1D, {yAxis}); + FourPiQA.add("FourPiQA/reco/system/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + FourPiQA.add("FourPiQA/MC/tracks/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + FourPiQA.add("FourPiQA/MC/tracks/hEta", ";#eta;counts", kTH1D, {etaAxis}); + FourPiQA.add("FourPiQA/MC/tracks/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + FourPiQA.add("FourPiQA/MC/system/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + FourPiQA.add("FourPiQA/MC/system/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + FourPiQA.add("FourPiQA/MC/system/hY", ";y;counts", kTH1D, {yAxis}); + FourPiQA.add("FourPiQA/MC/system/hPhi", ";#phi;counts", kTH1D, {phiAxis}); + } } template @@ -360,19 +494,56 @@ struct upcRhoAnalysis { { if (!track.isPVContributor()) return false; - registry.fill(HIST("QC/tracks/hSelectionCounter"), 1); - if (!track.hasITS() || !track.hasTPC()) + QC.fill(HIST("QC/tracks/hSelectionCounter"), 1); + + if (!track.hasITS()) + return false; + QC.fill(HIST("QC/tracks/hSelectionCounter"), 2); + + if (track.itsNCls() < tracksMinItsNClsCut) + return false; + QC.fill(HIST("QC/tracks/hSelectionCounter"), 3); + + if (track.itsChi2NCl() > tracksMaxItsChi2NClCut) + return false; + QC.fill(HIST("QC/tracks/hSelectionCounter"), 4); + + if (!track.hasTPC()) + return false; + QC.fill(HIST("QC/tracks/hSelectionCounter"), 5); + + if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < tracksMinTpcNClsCut) return false; - registry.fill(HIST("QC/tracks/hSelectionCounter"), 2); + QC.fill(HIST("QC/tracks/hSelectionCounter"), 6); + + if (track.tpcChi2NCl() > tracksMaxTpcChi2NClCut || track.tpcChi2NCl() < tracksMinTpcChi2NClCut) + return false; + QC.fill(HIST("QC/tracks/hSelectionCounter"), 7); + + if (track.tpcNClsCrossedRows() < tracksMinTpcNClsCrossedRowsCut) + return false; + QC.fill(HIST("QC/tracks/hSelectionCounter"), 8); + + if ((static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable())) < tracksMinTpcNClsCrossedOverFindableCut) + return false; + QC.fill(HIST("QC/tracks/hSelectionCounter"), 9); + if (requireTof && !track.hasTOF()) return false; - registry.fill(HIST("QC/tracks/hSelectionCounter"), 3); - if (std::abs(track.dcaZ()) > tracksDcaMaxCut || std::abs(track.dcaXY()) > (0.0182 + 0.0350 / std::pow(track.pt(), 1.01))) // Run 2 dynamic DCA cut + QC.fill(HIST("QC/tracks/hSelectionCounter"), 10); + + if (track.pt() < tracksMinPtCut) + return false; + QC.fill(HIST("QC/tracks/hSelectionCounter"), 11); + + if (std::abs(track.dcaZ()) > tracksDcaMaxCut || std::abs(track.dcaXY()) > (0.0105 + 0.0350 / std::pow(track.pt(), 1.01))) return false; - registry.fill(HIST("QC/tracks/hSelectionCounter"), 4); + QC.fill(HIST("QC/tracks/hSelectionCounter"), 12); + if (std::abs(eta(track.px(), track.py(), track.pz())) > PcEtaCut) return false; - registry.fill(HIST("QC/tracks/hSelectionCounter"), 5); + QC.fill(HIST("QC/tracks/hSelectionCounter"), 13); + // if all selections passed return true; } @@ -386,15 +557,24 @@ struct upcRhoAnalysis { } template - double tracksTotalCharge(const T& cutTracks) // total charge of selected tracks + int tracksTotalCharge(const T& cutTracks) // total charge of selected tracks { - double charge = 0.0; + int charge = 0; for (const auto& track : cutTracks) charge += track.sign(); return charge; } - bool systemPassCuts(const ROOT::Math::PxPyPzMVector& system) // system cuts + template + int tracksTotalChargeMC(const T& cutTracks) // total charge of selected tracks + { + int charge = 0; + for (const auto& track : cutTracks) + charge += track.pdgCode(); + return charge; + } + + bool systemPassCuts(const TLorentzVector& system) // system cuts { if (system.M() < systemMassMinCut || system.M() > systemMassMaxCut) return false; @@ -405,411 +585,579 @@ struct upcRhoAnalysis { return true; } - ROOT::Math::PxPyPzMVector reconstructSystem(const std::vector& cutTracks4Vecs) // reconstruct system from 4-vectors + TLorentzVector reconstructSystem(const std::vector& cutTracks4Vecs) // reconstruct system from 4-vectors { - ROOT::Math::PxPyPzMVector system; + TLorentzVector system; for (const auto& track4Vec : cutTracks4Vecs) system += track4Vec; return system; } - double deltaPhi(const ROOT::Math::PxPyPzMVector& p1, const ROOT::Math::PxPyPzMVector& p2) - { - double dPhi = p1.Phi() - p2.Phi(); - if (dPhi > o2::constants::math::PI) - dPhi -= o2::constants::math::TwoPI; - else if (dPhi < -o2::constants::math::PI) - dPhi += o2::constants::math::TwoPI; - return dPhi; // calculate delta phi in (-pi, pi) - } - - double getPhiRandom(const std::vector& cutTracks4Vecs) // decay phi anisotropy - { // two possible definitions of phi: randomize the tracks + double getPhiRandom(const std::vector& cutTracks4Vecs) // decay phi anisotropy + { // two possible definitions of phi: randomize the tracks std::vector indices = {0, 1}; unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); // get time-based seed std::shuffle(indices.begin(), indices.end(), std::default_random_engine(seed)); // shuffle indices // calculate phi - ROOT::Math::PxPyPzMVector pOne = cutTracks4Vecs[indices[0]]; - ROOT::Math::PxPyPzMVector pTwo = cutTracks4Vecs[indices[1]]; - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; - return deltaPhi(pPlus, pMinus); + TLorentzVector pOne = cutTracks4Vecs[indices[0]]; + TLorentzVector pTwo = cutTracks4Vecs[indices[1]]; + TLorentzVector pPlus = pOne + pTwo; + TLorentzVector pMinus = pOne - pTwo; + return pPlus.DeltaPhi(pMinus); } template - double getPhiCharge(const T& cutTracks, const std::vector& cutTracks4Vecs) + double getPhiCharge(const T& cutTracks, const std::vector& cutTracks4Vecs) { // two possible definitions of phi: charge-based assignment - ROOT::Math::PxPyPzMVector pOne, pTwo; - if (cutTracks[0].sign() > 0) { - pOne = cutTracks4Vecs[0]; - pTwo = cutTracks4Vecs[1]; - } else { - pOne = cutTracks4Vecs[1]; - pTwo = cutTracks4Vecs[0]; - } - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; - return deltaPhi(pPlus, pMinus); + TLorentzVector pOne, pTwo; + pOne = (cutTracks[0].sign() > 0) ? cutTracks4Vecs[0] : cutTracks4Vecs[1]; + pTwo = (cutTracks[0].sign() > 0) ? cutTracks4Vecs[1] : cutTracks4Vecs[0]; + TLorentzVector pPlus = pOne + pTwo; + TLorentzVector pMinus = pOne - pTwo; + return pPlus.DeltaPhi(pMinus); + } + + template + double getPhiChargeMC(const T& cutTracks, const std::vector& cutTracks4Vecs) + { // the same as for data but using pdg code instead of charge + TLorentzVector pOne, pTwo; + pOne = (cutTracks[0].pdgCode() > 0) ? cutTracks4Vecs[0] : cutTracks4Vecs[1]; + pTwo = (cutTracks[0].pdgCode() > 0) ? cutTracks4Vecs[1] : cutTracks4Vecs[0]; + TLorentzVector pPlus = pOne + pTwo; + TLorentzVector pMinus = pOne - pTwo; + return pPlus.DeltaPhi(pMinus); } - void processReco(FullUDSgCollision const& collision, FullUDTracks const& tracks) + template + void processReco(C const& collision, T const& tracks) { // QC histograms - registry.fill(HIST("QC/collisions/hPosXY"), collision.posX(), collision.posY()); - registry.fill(HIST("QC/collisions/hPosZ"), collision.posZ()); - registry.fill(HIST("QC/collisions/hZdcCommonEnergy"), collision.energyCommonZNA(), collision.energyCommonZNC()); - registry.fill(HIST("QC/collisions/hZdcTime"), collision.timeZNA(), collision.timeZNC()); - registry.fill(HIST("QC/collisions/hZnaTimeVsCommonEnergy"), collision.energyCommonZNA(), collision.timeZNA()); - registry.fill(HIST("QC/collisions/hZncTimeVsCommonEnergy"), collision.energyCommonZNC(), collision.timeZNC()); - registry.fill(HIST("QC/collisions/hNumContrib"), collision.numContrib()); - registry.fill(HIST("QC/collisions/hZnaTimeVsPosZ"), collision.posZ(), collision.timeZNA()); - registry.fill(HIST("QC/collisions/hZncTimeVsPosZ"), collision.posZ(), collision.timeZNC()); - registry.fill(HIST("QC/collisions/hPosZVsZnTimeAdd"), (collision.timeZNA() + collision.timeZNC()) / 2., collision.posZ()); - registry.fill(HIST("QC/collisions/hPosZVsZnTimeSub"), (collision.timeZNA() - collision.timeZNC()) / 2., collision.posZ()); - - if (!collisionPassesCuts(collision)) + QC.fill(HIST("QC/collisions/all/hPosXY"), collision.posX(), collision.posY()); + QC.fill(HIST("QC/collisions/all/hPosZ"), collision.posZ()); + QC.fill(HIST("QC/collisions/all/hZdcCommonEnergy"), collision.energyCommonZNA(), collision.energyCommonZNC()); + QC.fill(HIST("QC/collisions/all/hZdcTime"), collision.timeZNA(), collision.timeZNC()); + QC.fill(HIST("QC/collisions/all/hNumContrib"), collision.numContrib()); + QC.fill(HIST("QC/collisions/all/hTotalFT0AmplitudeA"), collision.totalFT0AmplitudeA()); + QC.fill(HIST("QC/collisions/all/hTotalFT0AmplitudeC"), collision.totalFT0AmplitudeC()); + QC.fill(HIST("QC/collisions/all/hTotalFV0AmplitudeA"), collision.totalFV0AmplitudeA()); + QC.fill(HIST("QC/collisions/all/hTotalFDDAmplitudeA"), collision.totalFDDAmplitudeA()); + QC.fill(HIST("QC/collisions/all/hTotalFDDAmplitudeC"), collision.totalFDDAmplitudeC()); + QC.fill(HIST("QC/collisions/all/hTimeFT0A"), collision.timeFT0A()); + QC.fill(HIST("QC/collisions/all/hTimeFT0C"), collision.timeFT0C()); + QC.fill(HIST("QC/collisions/all/hTimeFV0A"), collision.timeFV0A()); + QC.fill(HIST("QC/collisions/all/hTimeFDDA"), collision.timeFDDA()); + QC.fill(HIST("QC/collisions/all/hTimeFDDC"), collision.timeFDDC()); + + // vertex z-position cut + if (std::abs(collision.posZ()) > collisionsPosZMaxCut) return; // event tagging bool XnXn = false, OnOn = false, XnOn = false, OnXn = false; // note: On == 0n... - if (collision.energyCommonZNA() < ZNcommonEnergyCut && collision.energyCommonZNC() < ZNcommonEnergyCut) + int neutronClass = -1; + if (collision.energyCommonZNA() < ZNcommonEnergyCut && collision.energyCommonZNC() < ZNcommonEnergyCut) { OnOn = true; - if (collision.energyCommonZNA() > ZNcommonEnergyCut && std::abs(collision.timeZNA()) < ZNtimeCut && - collision.energyCommonZNC() > ZNcommonEnergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) - XnXn = true; - if (collision.energyCommonZNA() > ZNcommonEnergyCut && std::abs(collision.timeZNA()) < ZNtimeCut && collision.energyCommonZNC() < ZNcommonEnergyCut) + neutronClass = 0; + } + if (collision.energyCommonZNA() > ZNcommonEnergyCut && std::abs(collision.timeZNA()) < ZNtimeCut && collision.energyCommonZNC() < ZNcommonEnergyCut) { XnOn = true; - if (collision.energyCommonZNA() < ZNcommonEnergyCut && collision.energyCommonZNC() > ZNcommonEnergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) + neutronClass = 1; + } + if (collision.energyCommonZNA() < ZNcommonEnergyCut && collision.energyCommonZNC() > ZNcommonEnergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) { OnXn = true; + neutronClass = 2; + } + if (collision.energyCommonZNA() > ZNcommonEnergyCut && std::abs(collision.timeZNA()) < ZNtimeCut && + collision.energyCommonZNC() > ZNcommonEnergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) { + XnXn = true; + neutronClass = 3; + } // vectors for storing selected tracks and their 4-vectors std::vector cutTracks; - std::vector cutTracks4Vecs; + std::vector cutTracks4Vecs; - int trackCounter = 0; for (const auto& track : tracks) { - registry.fill(HIST("QC/tracks/raw/hTpcNSigmaPi"), track.tpcNSigmaPi()); - registry.fill(HIST("QC/tracks/raw/hTofNSigmaPi"), track.tofNSigmaPi()); - registry.fill(HIST("QC/tracks/raw/hTpcNSigmaEl"), track.tpcNSigmaEl()); - registry.fill(HIST("QC/tracks/raw/hDcaXYZ"), track.dcaZ(), track.dcaXY()); - registry.fill(HIST("QC/tracks/raw/hItsNCls"), track.itsNCls()); - registry.fill(HIST("QC/tracks/raw/hItsChi2NCl"), track.itsChi2NCl()); - registry.fill(HIST("QC/tracks/raw/hTpcChi2NCl"), track.tpcChi2NCl()); - registry.fill(HIST("QC/tracks/raw/hTpcNClsFindable"), track.tpcNClsFindable()); - registry.fill(HIST("QC/tracks/raw/hTpcNClsCrossedRows"), track.tpcNClsCrossedRows()); - registry.fill(HIST("QC/tracks/hSelectionCounter"), 0); + // double p = momentum(track.px(), track.py(), track.pz()); + QC.fill(HIST("QC/tracks/raw/hPt"), track.pt()); + QC.fill(HIST("QC/tracks/raw/hEta"), eta(track.px(), track.py(), track.pz())); + QC.fill(HIST("QC/tracks/raw/hPhi"), phi(track.px(), track.py())); + QC.fill(HIST("QC/tracks/raw/hTpcNSigmaPi"), track.tpcNSigmaPi()); + QC.fill(HIST("QC/tracks/raw/hTofNSigmaPi"), track.tofNSigmaPi()); + QC.fill(HIST("QC/tracks/raw/hTpcNSigmaEl"), track.tpcNSigmaEl()); + QC.fill(HIST("QC/tracks/raw/hDcaXYZ"), track.dcaZ(), track.dcaXY()); + QC.fill(HIST("QC/tracks/raw/hItsNCls"), track.itsNCls()); + QC.fill(HIST("QC/tracks/raw/hItsChi2NCl"), track.itsChi2NCl()); + QC.fill(HIST("QC/tracks/raw/hTpcChi2NCl"), track.tpcChi2NCl()); + QC.fill(HIST("QC/tracks/raw/hTpcNCls"), (track.tpcNClsFindable() - track.tpcNClsFindableMinusFound())); + QC.fill(HIST("QC/tracks/raw/hTpcNClsCrossedRows"), track.tpcNClsCrossedRows()); + QC.fill(HIST("QC/tracks/hSelectionCounter"), 0); if (!trackPassesCuts(track)) continue; - trackCounter++; - cutTracks.push_back(track); - cutTracks4Vecs.push_back(ROOT::Math::PxPyPzMVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged)); // apriori assume pion mass - registry.fill(HIST("QC/tracks/cut/hTpcSignalVsPt"), track.pt(), track.tpcSignal()); - registry.fill(HIST("QC/tracks/cut/hDcaXYZ"), track.dcaZ(), track.dcaXY()); - } - registry.fill(HIST("QC/tracks/cut/hRemainingTracks"), trackCounter); - if (cutTracks.size() == 2) { - registry.fill(HIST("QC/tracks/cut/hTpcNSigmaPi2D"), cutTracks[0].tpcNSigmaPi(), cutTracks[1].tpcNSigmaPi()); - registry.fill(HIST("QC/tracks/cut/hTpcNSigmaEl2D"), cutTracks[0].tpcNSigmaEl(), cutTracks[1].tpcNSigmaEl()); + cutTracks.push_back(track); + TLorentzVector track4Vec; + track4Vec.SetXYZM(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); // apriori assume pion mass + cutTracks4Vecs.push_back(track4Vec); + QC.fill(HIST("QC/tracks/cut/hTpcSignalVsP"), momentum(track.px(), track.py(), track.pz()), track.tpcSignal()); + QC.fill(HIST("QC/tracks/cut/hTpcSignalVsPt"), track.pt(), track.tpcSignal()); + QC.fill(HIST("QC/tracks/cut/hDcaXYZ"), track.dcaZ(), track.dcaXY()); } - - if (!tracksPassPiPID(cutTracks)) + QC.fill(HIST("QC/tracks/cut/hRemainingTracks"), cutTracks.size()); + if (cutTracks.size() != cutTracks4Vecs.size()) { // sanity check + LOG(error); return; - registry.fill(HIST("QC/tracks/hSelectionCounter"), 6, 2); // weighted by 2 for track pair + } // reonstruct system and calculate total charge, save commonly used values into variables - ROOT::Math::PxPyPzMVector system = reconstructSystem(cutTracks4Vecs); + TLorentzVector system = reconstructSystem(cutTracks4Vecs); int totalCharge = tracksTotalCharge(cutTracks); - int nTracks = cutTracks.size(); double mass = system.M(); double pT = system.Pt(); double pTsquare = pT * pT; double rapidity = system.Rapidity(); + double systemPhi = system.Phi() + o2::constants::math::PI; - if (nTracks == 2) { - double phiRandom = getPhiRandom(cutTracks4Vecs); - double phiCharge = getPhiCharge(cutTracks, cutTracks4Vecs); - // fill raw histograms according to the total charge - switch (totalCharge) { - case 0: - registry.fill(HIST("pions/no-selection/unlike-sign/hPt"), cutTracks4Vecs[0].Pt(), cutTracks4Vecs[1].Pt()); - registry.fill(HIST("pions/no-selection/unlike-sign/hEta"), cutTracks4Vecs[0].Eta(), cutTracks4Vecs[1].Eta()); - registry.fill(HIST("pions/no-selection/unlike-sign/hPhi"), cutTracks4Vecs[0].Phi() + o2::constants::math::PI, cutTracks4Vecs[1].Phi() + o2::constants::math::PI); - registry.fill(HIST("system/2pi/raw/unlike-sign/hM"), mass); - registry.fill(HIST("system/2pi/raw/unlike-sign/hPt"), pT); - registry.fill(HIST("system/2pi/raw/unlike-sign/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/raw/unlike-sign/hY"), rapidity); - break; - - case 2: - registry.fill(HIST("pions/no-selection/like-sign/hPt"), cutTracks4Vecs[0].Pt(), cutTracks4Vecs[1].Pt()); - registry.fill(HIST("pions/no-selection/like-sign/hEta"), cutTracks4Vecs[0].Eta(), cutTracks4Vecs[1].Eta()); - registry.fill(HIST("pions/no-selection/like-sign/hPhi"), cutTracks4Vecs[0].Phi() + o2::constants::math::PI, cutTracks4Vecs[1].Phi() + o2::constants::math::PI); - registry.fill(HIST("system/2pi/raw/like-sign/positive/hM"), mass); - registry.fill(HIST("system/2pi/raw/like-sign/positive/hPt"), pT); - registry.fill(HIST("system/2pi/raw/like-sign/positive/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/raw/like-sign/positive/hY"), rapidity); - break; - - case -2: - registry.fill(HIST("pions/no-selection/like-sign/hPt"), cutTracks4Vecs[0].Pt(), cutTracks4Vecs[1].Pt()); - registry.fill(HIST("pions/no-selection/like-sign/hEta"), cutTracks4Vecs[0].Eta(), cutTracks4Vecs[1].Eta()); - registry.fill(HIST("pions/no-selection/like-sign/hPhi"), cutTracks4Vecs[0].Phi() + o2::constants::math::PI, cutTracks4Vecs[1].Phi() + o2::constants::math::PI); - registry.fill(HIST("system/2pi/raw/like-sign/negative/hM"), mass); - registry.fill(HIST("system/2pi/raw/like-sign/negative/hPt"), pT); - registry.fill(HIST("system/2pi/raw/like-sign/negative/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/raw/like-sign/negative/hY"), rapidity); - break; - - default: - break; + if (do4pi && cutTracks.size() == 4 && totalCharge == 0) { + // fill out some 4pi QC histograms + for (int i = 0; i < static_cast(cutTracks.size()); i++) { + FourPiQA.fill(HIST("FourPiQA/reco/tracks/hPt"), cutTracks[i].pt()); + FourPiQA.fill(HIST("FourPiQA/reco/tracks/hEta"), eta(cutTracks[i].px(), cutTracks[i].py(), cutTracks[i].pz())); + FourPiQA.fill(HIST("FourPiQA/reco/tracks/hPhi"), phi(cutTracks[i].px(), cutTracks[i].py())); } + FourPiQA.fill(HIST("FourPiQA/reco/system/hM"), mass); + FourPiQA.fill(HIST("FourPiQA/reco/system/hPt"), pT); + FourPiQA.fill(HIST("FourPiQA/reco/system/hY"), rapidity); + FourPiQA.fill(HIST("FourPiQA/reco/system/hPhi"), systemPhi); + } + + // further consider only two pion systems + if (cutTracks.size() != 2) + return; + for (int i = 0; i < static_cast(cutTracks.size()); i++) + QC.fill(HIST("QC/tracks/hSelectionCounter"), 14); + + QC.fill(HIST("QC/tracks/cut/hTpcNSigmaPi2D"), cutTracks[0].tpcNSigmaPi(), cutTracks[1].tpcNSigmaPi()); + QC.fill(HIST("QC/tracks/cut/hTpcNSigmaEl2D"), cutTracks[0].tpcNSigmaEl(), cutTracks[1].tpcNSigmaEl()); + + if (!tracksPassPiPID(cutTracks)) + return; + for (int i = 0; i < static_cast(cutTracks.size()); i++) + QC.fill(HIST("QC/tracks/hSelectionCounter"), 15); + + double phiRandom = getPhiRandom(cutTracks4Vecs); + double phiCharge = getPhiCharge(cutTracks, cutTracks4Vecs); + + // differentiate leading- and subleading-momentum tracks + auto leadingMomentumTrack = momentum(cutTracks[0].px(), cutTracks[0].py(), cutTracks[0].pz()) > momentum(cutTracks[1].px(), cutTracks[1].py(), cutTracks[1].pz()) ? cutTracks[0] : cutTracks[1]; + auto subleadingMomentumTrack = (leadingMomentumTrack == cutTracks[0]) ? cutTracks[1] : cutTracks[0]; + double leadingPt = leadingMomentumTrack.pt(); + double subleadingPt = subleadingMomentumTrack.pt(); + double leadingEta = eta(leadingMomentumTrack.px(), leadingMomentumTrack.py(), leadingMomentumTrack.pz()); + double subleadingEta = eta(subleadingMomentumTrack.px(), subleadingMomentumTrack.py(), subleadingMomentumTrack.pz()); + double leadingPhi = phi(leadingMomentumTrack.px(), leadingMomentumTrack.py()); + double subleadingPhi = phi(subleadingMomentumTrack.px(), subleadingMomentumTrack.py()); + // fill TOF hit checker + QC.fill(HIST("QC/tracks/hTofHitCheck"), leadingMomentumTrack.hasTOF(), subleadingMomentumTrack.hasTOF()); + + // fill tree + std::vector trackSigns = {leadingMomentumTrack.sign(), subleadingMomentumTrack.sign()}; + std::vector trackPts = {leadingPt, subleadingPt}; + std::vector trackEtas = {leadingEta, subleadingEta}; + std::vector trackPhis = {leadingPhi, subleadingPhi}; + std::vector trackMs = {o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}; + std::vector trackPiPIDs = {leadingMomentumTrack.tpcNSigmaPi(), subleadingMomentumTrack.tpcNSigmaPi()}; + std::vector trackElPIDs = {leadingMomentumTrack.tpcNSigmaEl(), subleadingMomentumTrack.tpcNSigmaEl()}; + std::vector trackDcaXYs = {leadingMomentumTrack.dcaXY(), subleadingMomentumTrack.dcaXY()}; + std::vector trackDcaZs = {leadingMomentumTrack.dcaZ(), subleadingMomentumTrack.dcaZ()}; + std::vector trackTpcSignals = {leadingMomentumTrack.tpcSignal(), subleadingMomentumTrack.tpcSignal()}; + Tree(collision.runNumber(), collision.globalBC(), collision.numContrib(), + collision.posX(), collision.posY(), collision.posZ(), + collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), collision.totalFV0AmplitudeA(), collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), + collision.timeFT0A(), collision.timeFT0C(), collision.timeFV0A(), collision.timeFDDA(), collision.timeFDDC(), + collision.energyCommonZNA(), collision.energyCommonZNC(), collision.timeZNA(), collision.timeZNC(), neutronClass, + totalCharge, pT, system.Eta(), system.Phi(), mass, phiRandom, phiCharge, + trackSigns, trackPts, trackEtas, trackPhis, trackMs, trackPiPIDs, trackElPIDs, trackDcaXYs, trackDcaZs, trackTpcSignals); + // fill raw histograms according to the total charge + switch (totalCharge) { + case 0: + Pions.fill(HIST("pions/no-selection/unlike-sign/hPt"), leadingPt, subleadingPt); + Pions.fill(HIST("pions/no-selection/unlike-sign/hEta"), leadingEta, subleadingEta); + Pions.fill(HIST("pions/no-selection/unlike-sign/hPhi"), leadingPhi, subleadingPhi); + System.fill(HIST("system/raw/unlike-sign/hM"), mass); + System.fill(HIST("system/raw/unlike-sign/hPt"), pT); + System.fill(HIST("system/raw/unlike-sign/hPtVsM"), mass, pT); + System.fill(HIST("system/raw/unlike-sign/hY"), rapidity); + System.fill(HIST("system/raw/unlike-sign/hPhi"), systemPhi); + break; + + case 2: + Pions.fill(HIST("pions/no-selection/like-sign/hPt"), leadingPt, subleadingPt); + Pions.fill(HIST("pions/no-selection/like-sign/hEta"), leadingEta, subleadingEta); + Pions.fill(HIST("pions/no-selection/like-sign/hPhi"), leadingPhi, subleadingPhi); + System.fill(HIST("system/raw/like-sign/positive/hM"), mass); + System.fill(HIST("system/raw/like-sign/positive/hPt"), pT); + System.fill(HIST("system/raw/like-sign/positive/hPtVsM"), mass, pT); + System.fill(HIST("system/raw/like-sign/positive/hY"), rapidity); + System.fill(HIST("system/raw/like-sign/positive/hPhi"), systemPhi); + break; + + case -2: + Pions.fill(HIST("pions/no-selection/like-sign/hPt"), leadingPt, subleadingPt); + Pions.fill(HIST("pions/no-selection/like-sign/hEta"), leadingEta, subleadingEta); + Pions.fill(HIST("pions/no-selection/like-sign/hPhi"), leadingPhi, subleadingPhi); + System.fill(HIST("system/raw/like-sign/negative/hM"), mass); + System.fill(HIST("system/raw/like-sign/negative/hPt"), pT); + System.fill(HIST("system/raw/like-sign/negative/hPtVsM"), mass, pT); + System.fill(HIST("system/raw/like-sign/negative/hY"), rapidity); + System.fill(HIST("system/raw/like-sign/negative/hPhi"), systemPhi); + break; + + default: + break; + } + + // apply cuts to system + if (!systemPassCuts(system)) + return; + + QC.fill(HIST("QC/collisions/selected/hPosXY"), collision.posX(), collision.posY()); + QC.fill(HIST("QC/collisions/selected/hPosZ"), collision.posZ()); + QC.fill(HIST("QC/collisions/selected/hZdcCommonEnergy"), collision.energyCommonZNA(), collision.energyCommonZNC()); + QC.fill(HIST("QC/collisions/selected/hZdcTime"), collision.timeZNA(), collision.timeZNC()); + QC.fill(HIST("QC/collisions/selected/hNumContrib"), collision.numContrib()); + QC.fill(HIST("QC/collisions/selected/hTotalFT0AmplitudeA"), collision.totalFT0AmplitudeA()); + QC.fill(HIST("QC/collisions/selected/hTotalFT0AmplitudeC"), collision.totalFT0AmplitudeC()); + QC.fill(HIST("QC/collisions/selected/hTotalFV0AmplitudeA"), collision.totalFV0AmplitudeA()); + QC.fill(HIST("QC/collisions/selected/hTotalFDDAmplitudeA"), collision.totalFDDAmplitudeA()); + QC.fill(HIST("QC/collisions/selected/hTotalFDDAmplitudeC"), collision.totalFDDAmplitudeC()); + QC.fill(HIST("QC/collisions/selected/hTimeFT0A"), collision.timeFT0A()); + QC.fill(HIST("QC/collisions/selected/hTimeFT0C"), collision.timeFT0C()); + QC.fill(HIST("QC/collisions/selected/hTimeFV0A"), collision.timeFV0A()); + QC.fill(HIST("QC/collisions/selected/hTimeFDDA"), collision.timeFDDA()); + QC.fill(HIST("QC/collisions/selected/hTimeFDDC"), collision.timeFDDC()); + + // fill histograms for system passing cuts + switch (totalCharge) { + case 0: + Pions.fill(HIST("pions/selected/unlike-sign/hPt"), leadingPt, subleadingPt); + Pions.fill(HIST("pions/selected/unlike-sign/hEta"), leadingEta, subleadingEta); + Pions.fill(HIST("pions/selected/unlike-sign/hPhi"), leadingPhi, subleadingPhi); + System.fill(HIST("system/cut/no-selection/unlike-sign/hM"), mass); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPt"), pT); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPt2"), pTsquare); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/no-selection/unlike-sign/hY"), rapidity); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPhi"), systemPhi); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/no-selection/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + if (OnOn) { + System.fill(HIST("system/cut/0n0n/unlike-sign/hM"), mass); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPt"), pT); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPt2"), pTsquare); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/0n0n/unlike-sign/hY"), rapidity); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPhi"), systemPhi); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/0n0n/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnOn) { + System.fill(HIST("system/cut/Xn0n/unlike-sign/hM"), mass); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPt"), pT); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPt2"), pTsquare); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hY"), rapidity); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPhi"), systemPhi); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/Xn0n/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (OnXn) { + System.fill(HIST("system/cut/0nXn/unlike-sign/hM"), mass); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPt"), pT); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPt2"), pTsquare); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/0nXn/unlike-sign/hY"), rapidity); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPhi"), systemPhi); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/0nXn/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnXn) { + System.fill(HIST("system/cut/XnXn/unlike-sign/hM"), mass); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPt"), pT); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPt2"), pTsquare); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/XnXn/unlike-sign/hY"), rapidity); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPhi"), systemPhi); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/XnXn/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } + break; + + case 2: + Pions.fill(HIST("pions/selected/like-sign/hPt"), leadingPt, subleadingPt); + Pions.fill(HIST("pions/selected/like-sign/hEta"), leadingEta, subleadingEta); + Pions.fill(HIST("pions/selected/like-sign/hPhi"), leadingPhi, subleadingPhi); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hM"), mass); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPt"), pT); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPt2"), pTsquare); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hY"), rapidity); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPhi"), systemPhi); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/no-selection/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + if (OnOn) { + System.fill(HIST("system/cut/0n0n/like-sign/positive/hM"), mass); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPt"), pT); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPt2"), pTsquare); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hY"), rapidity); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPhi"), systemPhi); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/0n0n/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnOn) { + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hM"), mass); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPt"), pT); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPt2"), pTsquare); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hY"), rapidity); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhi"), systemPhi); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/Xn0n/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (OnXn) { + System.fill(HIST("system/cut/0nXn/like-sign/positive/hM"), mass); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPt"), pT); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPt2"), pTsquare); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hY"), rapidity); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPhi"), systemPhi); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/0nXn/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnXn) { + System.fill(HIST("system/cut/XnXn/like-sign/positive/hM"), mass); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPt"), pT); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPt2"), pTsquare); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hY"), rapidity); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPhi"), systemPhi); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/XnXn/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } + break; + + case -2: + Pions.fill(HIST("pions/selected/like-sign/hPt"), leadingPt, subleadingPt); + Pions.fill(HIST("pions/selected/like-sign/hEta"), leadingEta, subleadingEta); + Pions.fill(HIST("pions/selected/like-sign/hPhi"), leadingPhi, subleadingPhi); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hM"), mass); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPt"), pT); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPt2"), pTsquare); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hY"), rapidity); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPhi"), systemPhi); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/no-selection/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + if (OnOn) { + System.fill(HIST("system/cut/0n0n/like-sign/negative/hM"), mass); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPt"), pT); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPt2"), pTsquare); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hY"), rapidity); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPhi"), systemPhi); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/0n0n/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnOn) { + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hM"), mass); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPt"), pT); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPt2"), pTsquare); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hY"), rapidity); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhi"), systemPhi); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/Xn0n/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (OnXn) { + System.fill(HIST("system/cut/0nXn/like-sign/negative/hM"), mass); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPt"), pT); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPt2"), pTsquare); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hY"), rapidity); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPhi"), systemPhi); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/0nXn/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnXn) { + System.fill(HIST("system/cut/XnXn/like-sign/negative/hM"), mass); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPt"), pT); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPt2"), pTsquare); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPtVsM"), mass, pT); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hY"), rapidity); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPhi"), systemPhi); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPhiRandom"), phiRandom); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPhiCharge"), phiCharge); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + System.fill(HIST("system/cut/XnXn/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } + break; + + default: + break; + } + } + + template + void processMC(C const& mcCollision, T const& mcParticles) + { + MC.fill(HIST("MC/collisions/hPosXY"), mcCollision.posX(), mcCollision.posY()); + MC.fill(HIST("MC/collisions/hPosZ"), mcCollision.posZ()); + + std::vector cutMcParticles; + std::vector mcParticles4Vecs; - // apply cuts to system - if (!systemPassCuts(system)) - return; - - // fill histograms for system passing cuts - switch (totalCharge) { - case 0: - registry.fill(HIST("pions/selected/unlike-sign/hPt"), cutTracks4Vecs[0].Pt(), cutTracks4Vecs[1].Pt()); - registry.fill(HIST("pions/selected/unlike-sign/hEta"), cutTracks4Vecs[0].Eta(), cutTracks4Vecs[1].Eta()); - registry.fill(HIST("pions/selected/unlike-sign/hPhi"), cutTracks4Vecs[0].Phi() + o2::constants::math::PI, cutTracks4Vecs[1].Phi() + o2::constants::math::PI); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hM"), mass); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPt"), pT); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/no-selection/unlike-sign/hMInPtQuantileBins"), mass, pT); - if (OnOn) { - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hM"), mass); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPt"), pT); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/0n0n/unlike-sign/hMInPtQuantileBins"), mass, pT); - } else if (XnOn) { - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hM"), mass); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPt"), pT); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/Xn0n/unlike-sign/hMInPtQuantileBins"), mass, pT); - } else if (OnXn) { - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hM"), mass); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPt"), pT); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/0nXn/unlike-sign/hMInPtQuantileBins"), mass, pT); - } else if (XnXn) { - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hM"), mass); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPt"), pT); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/XnXn/unlike-sign/hMInPtQuantileBins"), mass, pT); - } - break; - - case 2: - registry.fill(HIST("pions/selected/like-sign/hPt"), cutTracks4Vecs[0].Pt(), cutTracks4Vecs[1].Pt()); - registry.fill(HIST("pions/selected/like-sign/hEta"), cutTracks4Vecs[0].Eta(), cutTracks4Vecs[1].Eta()); - registry.fill(HIST("pions/selected/like-sign/hPhi"), cutTracks4Vecs[0].Phi() + o2::constants::math::PI, cutTracks4Vecs[1].Phi() + o2::constants::math::PI); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hM"), mass); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPt"), pT); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/positive/hMInPtQuantileBins"), mass, pT); - if (OnOn) { - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hM"), mass); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPt"), pT); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/positive/hMInPtQuantileBins"), mass, pT); - } else if (XnOn) { - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hM"), mass); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPt"), pT); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/positive/hMInPtQuantileBins"), mass, pT); - } else if (OnXn) { - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hM"), mass); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPt"), pT); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/positive/hMInPtQuantileBins"), mass, pT); - } else if (XnXn) { - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hM"), mass); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPt"), pT); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/positive/hMInPtQuantileBins"), mass, pT); - } - break; - - case -2: - registry.fill(HIST("pions/selected/like-sign/hPt"), cutTracks4Vecs[0].Pt(), cutTracks4Vecs[1].Pt()); - registry.fill(HIST("pions/selected/like-sign/hEta"), cutTracks4Vecs[0].Eta(), cutTracks4Vecs[1].Eta()); - registry.fill(HIST("pions/selected/like-sign/hPhi"), cutTracks4Vecs[0].Phi() + o2::constants::math::PI, cutTracks4Vecs[1].Phi() + o2::constants::math::PI); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hM"), mass); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPt"), pT); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/no-selection/like-sign/negative/hMInPtQuantileBins"), mass, pT); - if (OnOn) { - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hM"), mass); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPt"), pT); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/0n0n/like-sign/negative/hMInPtQuantileBins"), mass, pT); - } else if (XnOn) { - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hM"), mass); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPt"), pT); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/Xn0n/like-sign/negative/hMInPtQuantileBins"), mass, pT); - } else if (OnXn) { - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hM"), mass); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPt"), pT); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/0nXn/like-sign/negative/hMInPtQuantileBins"), mass, pT); - } else if (XnXn) { - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hM"), mass); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPt"), pT); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPt2"), pTsquare); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPtVsM"), mass, pT); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hY"), rapidity); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPhiRandom"), phiRandom); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPhiCharge"), phiCharge); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); - registry.fill(HIST("system/2pi/cut/XnXn/like-sign/negative/hMInPtQuantileBins"), mass, pT); - } - break; - - default: - break; + for (auto const& mcParticle : mcParticles) { + MC.fill(HIST("MC/tracks/all/hPdgCode"), mcParticle.pdgCode()); + MC.fill(HIST("MC/tracks/all/hProducedByGenerator"), mcParticle.producedByGenerator()); + MC.fill(HIST("MC/tracks/all/hIsPhysicalPrimary"), mcParticle.isPhysicalPrimary()); + MC.fill(HIST("MC/tracks/all/hPt"), pt(mcParticle.px(), mcParticle.py())); + MC.fill(HIST("MC/tracks/all/hEta"), eta(mcParticle.px(), mcParticle.py(), mcParticle.pz())); + MC.fill(HIST("MC/tracks/all/hPhi"), phi(mcParticle.px(), mcParticle.py())); + if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.pdgCode()) != 211) + continue; + cutMcParticles.push_back(mcParticle); + TLorentzVector pion4Vec; + pion4Vec.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); + mcParticles4Vecs.push_back(pion4Vec); + } + MC.fill(HIST("MC/collisions/hNPions"), cutMcParticles.size()); + + if (mcParticles4Vecs.size() != cutMcParticles.size()) + return; + if (tracksTotalChargeMC(cutMcParticles) != 0) // shouldn't happen in theory + return; + + TLorentzVector system = reconstructSystem(mcParticles4Vecs); + double mass = system.M(); + double pT = system.Pt(); + double pTsquare = pT * pT; + double rapidity = system.Rapidity(); + double systemPhi = system.Phi() + o2::constants::math::PI; + + if (do4pi && cutMcParticles.size() == 4) { + for (int i = 0; i < static_cast(cutMcParticles.size()); i++) { + FourPiQA.fill(HIST("FourPiQA/MC/tracks/hPt"), pt(cutMcParticles[i].px(), cutMcParticles[i].py())); + FourPiQA.fill(HIST("FourPiQA/MC/tracks/hEta"), eta(cutMcParticles[i].px(), cutMcParticles[i].py(), cutMcParticles[i].pz())); + FourPiQA.fill(HIST("FourPiQA/MC/tracks/hPhi"), phi(cutMcParticles[i].px(), cutMcParticles[i].py())); } - } else if (nTracks == 4 && tracksTotalCharge(cutTracks) == 0) { // 4pi system - registry.fill(HIST("system/4pi/hM"), mass); - registry.fill(HIST("system/4pi/hPt"), pT); - registry.fill(HIST("system/4pi/hPtVsM"), mass, pT); - registry.fill(HIST("system/4pi/hY"), rapidity); - } else if (nTracks == 6 && tracksTotalCharge(cutTracks) == 0) { // 6pi system - registry.fill(HIST("system/6pi/hM"), mass); - registry.fill(HIST("system/6pi/hPt"), pT); - registry.fill(HIST("system/6pi/hPtVsM"), mass, pT); - registry.fill(HIST("system/6pi/hY"), rapidity); + FourPiQA.fill(HIST("FourPiQA/MC/system/hM"), mass); + FourPiQA.fill(HIST("FourPiQA/MC/system/hPt"), pT); + FourPiQA.fill(HIST("FourPiQA/MC/system/hY"), rapidity); + FourPiQA.fill(HIST("FourPiQA/MC/system/hPhi"), systemPhi); } + + if (cutMcParticles.size() != 2) + return; + + auto leadingMomentumPion = momentum(cutMcParticles[0].px(), cutMcParticles[0].py(), cutMcParticles[0].pz()) > momentum(cutMcParticles[1].px(), cutMcParticles[1].py(), cutMcParticles[1].pz()) ? cutMcParticles[0] : cutMcParticles[1]; + auto subleadingMomentumPion = (leadingMomentumPion == cutMcParticles[0]) ? cutMcParticles[1] : cutMcParticles[0]; + MC.fill(HIST("MC/tracks/pions/hPt"), pt(leadingMomentumPion.px(), leadingMomentumPion.py()), pt(subleadingMomentumPion.px(), subleadingMomentumPion.py())); + MC.fill(HIST("MC/tracks/pions/hEta"), eta(leadingMomentumPion.px(), leadingMomentumPion.py(), leadingMomentumPion.pz()), eta(subleadingMomentumPion.px(), subleadingMomentumPion.py(), subleadingMomentumPion.pz())); + MC.fill(HIST("MC/tracks/pions/hPhi"), phi(leadingMomentumPion.px(), leadingMomentumPion.py()), phi(subleadingMomentumPion.px(), subleadingMomentumPion.py())); + + double phiRandom = getPhiRandom(mcParticles4Vecs); + double phiCharge = getPhiChargeMC(cutMcParticles, mcParticles4Vecs); + + MC.fill(HIST("MC/system/hM"), mass); + MC.fill(HIST("MC/system/hPt"), pT); + MC.fill(HIST("MC/system/hPtVsM"), mass, pT); + MC.fill(HIST("MC/system/hPt2"), pTsquare); + MC.fill(HIST("MC/system/hY"), rapidity); + MC.fill(HIST("MC/system/hPhi"), systemPhi); + MC.fill(HIST("MC/system/hPhiRandom"), phiRandom); + MC.fill(HIST("MC/system/hPhiCharge"), phiCharge); + } + + template + void checkNumberOfCollisionReconstructions(C const& collisions) + { + MC.fill(HIST("MC/collisions/hNumOfCollisionRecos"), collisions.size()); + } + + void processSGdata(FullUdSgCollision const& collision, FullUdTracks const& tracks) + { + if (collision.gapSide() != 2) + return; + processReco(collision, tracks); + } + PROCESS_SWITCH(upcRhoAnalysis, processSGdata, "analyse SG data", true); + + void processDGdata(FullUdDgCollision const& collision, FullUdTracks const& tracks) + { + processReco(collision, tracks); + } + PROCESS_SWITCH(upcRhoAnalysis, processDGdata, "analyse DG data", false); + + void processMCdata(aod::UDMcCollision const& mcCollision, aod::UDMcParticles const& mcParticles) + { + processMC(mcCollision, mcParticles); + } + PROCESS_SWITCH(upcRhoAnalysis, processMCdata, "analyse MC data", false); + + void processCollisionRecoCheck(aod::McCollision const& /* mcCollision */, soa::SmallGroups> const& collisions) + { + checkNumberOfCollisionReconstructions(collisions); } - PROCESS_SWITCH(upcRhoAnalysis, processReco, "analyse reco tracks", true); - - // void processMC(aod::UDMcCollisions::iterator const&, aod::UDMcParticles const& mcparticles) - // { - // // loop over all particles in the event - // for (auto const& mcparticle : mcparticles) { - // // only consider charged pions - // if (std::abs(mcparticle.pdgCode()) != 211) - // continue; - // } - // } - // PROCESS_SWITCH(upcRhoAnalysis, processMC, "analyse MC tracks", false); + PROCESS_SWITCH(upcRhoAnalysis, processCollisionRecoCheck, "check number of collision reconstructions", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/upcTauCentralBarrelRL.cxx b/PWGUD/Tasks/upcTauCentralBarrelRL.cxx index 8753acf8c96..9bb0e7a16db 100644 --- a/PWGUD/Tasks/upcTauCentralBarrelRL.cxx +++ b/PWGUD/Tasks/upcTauCentralBarrelRL.cxx @@ -8,13 +8,16 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// -/// \brief +/// \file upcTauCentralBarrelRL.cxx +/// \brief Personal task to analyze tau events from UPC collisions /// \author Roman Lavicka, roman.lavicka@cern.ch /// \since 12.07.2022 -// #include -// #include +// C++ headers +#include +#include +#include +#include // O2 headers #include "Framework/AnalysisTask.h" @@ -37,8 +40,7 @@ // ROOT headers #include "TLorentzVector.h" -#include "TEfficiency.h" -#include "TF1.h" +#include "TPDGCode.h" using namespace o2; using namespace o2::framework; @@ -47,770 +49,642 @@ using namespace o2::framework::expressions; struct UpcTauCentralBarrelRL { // Global varialbes - bool isFirstReconstructedCollisions; - int countCollisions; + bool isMC = false; Service pdg; SGSelector sgSelector; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // declare configurables - Configurable verboseInfo{"verboseInfo", true, {"Print general info to terminal; default it true."}}; - Configurable whichGapSide{"whichGapSide", 2, {"0 for side A, 1 for side C, 2 for both sides"}}; - Configurable useTrueGap{"useTrueGap", true, {"Calculate gapSide for a given FV0/FT0/ZDC thresholds"}}; - Configurable cutMyGapSideFV0{"FV0", 100, "FV0A threshold for SG selector"}; - Configurable cutMyGapSideFT0A{"FT0A", 200., "FT0A threshold for SG selector"}; - Configurable cutMyGapSideFT0C{"FT0C", 100., "FT0C threshold for SG selector"}; - Configurable cutMyGapSideZDC{"ZDC", 10., "ZDC threshold for SG selector"}; - Configurable usePIDwithTOF{"usePIDwithTOF", false, {"Determine whether also TOF should be used in testPIDhypothesis"}}; - Configurable usePIDwithTOFsigmaAfterTPC{"usePIDwithTOFsigmaAfterTPC", true, {"Determine whether cut on TOF n sigma should be used after TPC-based decision in testPIDhypothesis"}}; - Configurable cutMyTPCnSigmaEl{"cutMyTPCnSigmaEl", 3.f, {"n sigma cut on el in absolut values"}}; - Configurable cutMyTPCnSigmaMu{"cutMyTPCnSigmaMu", 3.f, {"n sigma cut on mu in absolut values"}}; - Configurable cutMyTPCnSigmaPi{"cutMyTPCnSigmaPi", 3.f, {"n sigma cut on pi in absolut values"}}; - Configurable cutMyNsigmaTPCPIDselector{"cutMyNsigmaTPCPIDselector", 35.f, {"n sigma TPC cut on all particles in absolut values for testPIDhypothesis"}}; - Configurable cutMyNsigmaTOFPIDselector{"cutMyNsigmaTOFPIDselector", 35.f, {"n sigma TOF cut on all particles in absolut values for testPIDhypothesis"}}; - Configurable cutAvgITSclusterSize{"cutAvgITSclusterSize", 2.05f, {"specific study"}}; - Configurable cutPtAvgITSclusterSize{"cutPtAvgITSclusterSize", 0.7f, {"specific study"}}; - Configurable cutMyGlobalTracksOnly{"cutMyGlobalTracksOnly", false, {"Applies cut on here defined global tracks"}}; - Configurable cutMyGTptMin{"cutMyGTptMin", 0.1f, {"MyGlobalTrack cut"}}; - Configurable cutMyGTptMax{"cutMyGTptMax", 1e10f, {"MyGlobalTrack cut"}}; - Configurable cutMyGTetaMin{"cutMyGTetaMin", -0.8f, {"MyGlobalTrack cut"}}; - Configurable cutMyGTetaMax{"cutMyGTetaMax", 0.8f, {"MyGlobalTrack cut"}}; - Configurable cutMyGTdcaZmax{"cutMyGTdcaZmax", 2.f, {"MyGlobalTrack cut"}}; - Configurable cutMyGTdcaXYmax{"cutMyGTdcaXYmax", 1e10f, {"MyGlobalTrack cut"}}; - Configurable cutMyGTdcaXYusePt{"cutMyGTdcaXYusePt", false, {"MyGlobalTrack cut"}}; - Configurable cutMyHasITS{"cutMyHasITS", true, {"MyGlobalTrack cut"}}; - Configurable cutMyGTitsNClsMin{"cutMyGTitsNClsMin", 1, {"MyGlobalTrack cut"}}; - Configurable cutMyGTitsChi2NclMax{"cutMyGTitsChi2NclMax", 36.f, {"MyGlobalTrack cut"}}; - Configurable cutMyGTitsHitsRule{"cutMyGTitsHitsRule", 0, {"MyGlobalTrack cut"}}; - Configurable cutMyHasTPC{"cutMyHasTPC", true, {"MyGlobalTrack cut"}}; - Configurable cutMyGTtpcNClsMin{"cutMyGTtpcNClsMin", 1, {"MyGlobalTrack cut"}}; - Configurable cutMyGTtpcNClsCrossedRowsMin{"cutMyGTtpcNClsCrossedRowsMin", 70, {"MyGlobalTrack cut"}}; - Configurable cutMyGTtpcNClsCrossedRowsOverNClsMin{"cutMyGTtpcNClsCrossedRowsOverNClsMin", 0.8f, {"MyGlobalTrack cut"}}; - Configurable cutMyGTtpcChi2NclMax{"cutMyGTtpcChi2NclMax", 4.f, {"MyGlobalTrack cut"}}; - Configurable applyTauEventSelection{"applyTauEventSelection", true, {"Select event"}}; - Configurable doMainHistos{"doMainHistos", true, {"Fill main histos"}}; - Configurable doPIDhistos{"doPIDhistos", true, {"Fill PID histos"}}; - Configurable doTwoTracks{"doTwoTracks", true, {"Define histos for two tracks and allow to fill them"}}; - Configurable doPionStudy{"doPionStudy", false, {"Define histos for two pions and allow to fill them"}}; - Configurable doMuonStudy{"doMuonStudy", false, {"Define histos for two muons and allow to fill them"}}; - Configurable doJpsiMuMuTests{"doJpsiMuMuTests", false, {"Define specific-tests histos for two muons and allow to fill them"}}; + Configurable verboseInfo{"verboseInfo", false, {"Print general info to terminal; default it false."}}; + Configurable doMainHistos{"doMainHistos", false, {"Fill main histos"}}; + Configurable doPIDhistos{"doPIDhistos", false, {"Fill PID histos"}}; + Configurable doTruthHistos{"doTruthHistos", false, {"Do histograms specific for generated events/particles"}}; + Configurable doMCtrueElectronCheck{"doMCtrueElectronCheck", false, {"Check if track hypothesis corresponds to MC truth. If no, it cuts."}}; + Configurable oppositeMCtrueElectronCheck{"oppositeMCtrueElectronCheck", false, {"While doMCtrueElectronCheck is true, check if track hypothesis corresponds to MC truth. If yes, it cuts."}}; + Configurable doTwoTracks{"doTwoTracks", false, {"Define histos for two tracks and allow to fill them"}}; Configurable doFourTracks{"doFourTracks", false, {"Define histos for four tracks and allow to fill them"}}; - Configurable doFourTrackPsi2S{"doFourTrackPsi2S", true, {"Define histos for Psi2S into four charged tracks (pi/mu) and allow to fill them"}}; Configurable doSixTracks{"doSixTracks", false, {"Define histos for six tracks and allow to fill them"}}; - ConfigurableAxis axisNtracks{"axisNtracks", {30, -0.5, 29.5}, "Number of tracks in collision"}; - ConfigurableAxis axisZvtx{"axisZvtx", {40, -20., 20.}, "Z-vertex position (cm)"}; - ConfigurableAxis axisInvMass{"axisInvMass", {400, 1., 5.}, "Invariant mass (GeV/c^{2})"}; - ConfigurableAxis axisInvMassWide{"axisInvMassWide", {1000, 0., 10.}, "Invariant mass (GeV/c^{2}), wider range"}; - ConfigurableAxis axisMom{"axisMom", {400, 0., 2.}, "Momentum (GeV/c)"}; - ConfigurableAxis axisMomWide{"axisMomWide", {1000, 0., 10.}, "Momentum (GeV/c), wider range"}; - ConfigurableAxis axisMomSigned{"axisMomSigned", {800, -2., 2.}, "Signed momentum (GeV/c)"}; - ConfigurableAxis axisPt{"axisPt", {400, 0., 2.}, "Transversal momentum (GeV/c)"}; - ConfigurableAxis axisPhi{"axisPhi", {64, -2 * o2::constants::math::PI, 2 * o2::constants::math::PI}, "Azimuthal angle (a.y.)"}; - ConfigurableAxis axisModPhi{"axisModPhi", {400, 0., .4}, "Track fmod(#phi,#pi/9)"}; - ConfigurableAxis axisEta{"axisEta", {50, -1.2, 1.2}, "Pseudorapidity (a.u.)"}; - ConfigurableAxis axisRap{"axisRap", {50, -1.2, 1.2}, "Rapidity (a.u.)"}; - ConfigurableAxis axisAcoplanarity{"axisAcoplanarity", {32, 0.0, o2::constants::math::PI}, "Acoplanarity (rad)"}; - ConfigurableAxis axisTPCdEdx{"axisTPCdEdx", {2000, 0., 200.}, "TPC dE/dx (a.u.)"}; - ConfigurableAxis axisTOFsignal{"axisTOFsignal", {2500, -10000., 40000.}, "TOF signal (a.u.)"}; - ConfigurableAxis axisNsigma{"axisNsigma", {200, -10., 10.}, "n sigma"}; - ConfigurableAxis axisDCA{"axisDCA", {100, -0.5, 0.5}, "DCA (cm)"}; - ConfigurableAxis axisAvgITSclsSizes{"axisAvgITSclsSizes", {500, 0., 10.}, "ITS average cluster size"}; - ConfigurableAxis axisITSnCls{"axisITSnCls", {8, -0.5, 7.5}, "ITS n clusters"}; - ConfigurableAxis axisITSchi2{"axisITSchi2", {100, 0, 50}, "UTS chi2"}; - ConfigurableAxis axisTPCnCls{"axisTPCnCls", {165, -0.5, 164.5}, "TPC n clusters"}; - ConfigurableAxis axisTPCxRwsFrac{"axisTPCxRwsFrac", {200, 0.0, 2.0}, "TPC fraction of crossed raws"}; - ConfigurableAxis axisTPCchi2{"axisTPCchi2", {100, 0, 10}, "TPC chi2"}; + struct : ConfigurableGroup { + Configurable whichGapSide{"whichGapSide", 2, {"0 for side A, 1 for side C, 2 for both sides"}}; + Configurable useTrueGap{"useTrueGap", true, {"Calculate gapSide for a given FV0/FT0/ZDC thresholds"}}; + Configurable cutTrueGapSideFV0{"TrueGapFV0", 100, "FV0A threshold for SG selector"}; + Configurable cutTrueGapSideFT0A{"TrueGapFT0A", 200., "FT0A threshold for SG selector"}; + Configurable cutTrueGapSideFT0C{"TrueGapFT0C", 100., "FT0C threshold for SG selector"}; + Configurable cutTrueGapSideZDC{"TrueGapZDC", 1000., "ZDC threshold for SG selector"}; + Configurable cutFITtime{"cutFITtime", 40., "Maximum FIT time allowed. Default is 4ns"}; + Configurable applyAcceptanceSelection{"applyAcceptanceSelection", false, {"Select events in ALICE CB acceptance set with cutTrackEta"}}; + Configurable cutTrackEta{"cutTrackEta", 0.9, "Cut on central barrel track eta in absolute values."}; + } cutSample; + + struct : ConfigurableGroup { + Configurable applyGlobalTrackSelection{"applyGlobalTrackSelection", false, {"Applies cut on here defined global tracks"}}; + Configurable cutMinPt{"cutMinPt", 0.1f, {"Global track cut"}}; + Configurable cutMaxPt{"cutMaxPt", 1e10f, {"Global track cut"}}; + Configurable cutMinEta{"cutMinEta", -0.8f, {"Global track cut"}}; + Configurable cutMaxEta{"cutMaxEta", 0.8f, {"Global track cut"}}; + Configurable cutMaxDCAz{"cutMaxDCAz", 2.f, {"Global track cut"}}; + Configurable cutMaxDCAxy{"cutMaxDCAxy", 1e10f, {"Global track cut"}}; + Configurable applyPtDependentDCAxy{"applyPtDependentDCAxy", false, {"Global track cut"}}; + Configurable cutHasITS{"cutHasITS", true, {"Global track cut"}}; + Configurable cutMinITSnCls{"cutMinITSnCls", 1, {"Global track cut"}}; + Configurable cutMaxITSchi2{"cutMaxITSchi2", 36.f, {"Global track cut"}}; + Configurable cutITShitsRule{"cutITShitsRule", 0, {"Global track cut"}}; + Configurable cutHasTPC{"cutHasTPC", true, {"Global track cut"}}; + Configurable cutMinTPCnCls{"cutMinTPCnCls", 1, {"Global track cut"}}; + Configurable cutMinTPCnClsXrows{"cutMinTPCnClsXrows", 70, {"Global track cut"}}; + Configurable cutMinTPCnClsXrowsOverNcls{"cutMinTPCnClsXrowsOverNcls", 0.8f, {"Global track cut"}}; + Configurable cutMaxTPCchi2{"cutMaxTPCchi2", 4.f, {"Global track cut"}}; + } cutGlobalTrack; + + struct : ConfigurableGroup { + Configurable applyTauEventSelection{"applyTauEventSelection", true, {"Select tau event."}}; + Configurable cutOppositeCharge{"cutOppositeCharge", true, {"Tracks have opposite charge."}}; + Configurable cutAcoplanarity{"cutAcoplanarity", 4 * o2::constants::math::PI / 5, {"Opening angle of the tracks. What is more goes away."}}; + Configurable cutElectronHasTOF{"cutElectronHasTOF", true, {"Electron is required to hit TOF."}}; + Configurable cutGoodElectron{"cutGoodElectron", true, {"Select good electron."}}; + Configurable cutOutRho{"cutOutRho", false, {"Cut out rho mass under two tracks are pions hypothesis"}}; + Configurable cutOnRho{"cutOnRho", false, {"Cut on rho mass under two tracks are pions hypothesis"}}; + Configurable cutMinRhoMass{"cutMinRhoMass", 0.6, {"Lower limit on the rho mass region for cut"}}; + Configurable cutMaxRhoMass{"cutMaxRhoMass", 0.95, {"Higher limit on the rho mass region for cut"}}; + Configurable cutMinElectronNsigma{"cutMinElectronNsigma", 2.0, {"Upper n sigma cut on el hypo of selected electron. What is more goes away."}}; + Configurable cutMaxElectronNsigma{"cutMaxElectronNsigma", -1.0, {"Lower n sigma cut on el hypo of selected electron. What is less goes away."}}; + Configurable cutMinElectronPiNsigma{"cutMinElectronPiNsigma", -99.0, {"Upper n sigma cut on pi hypo of selected electron. What is less till lower cut goes away."}}; + Configurable cutMaxElectronPiNsigma{"cutMaxElectronPiNsigma", 99.0, {"Lower n sigma cut on pi hypo of selected electron. What is more till upper cut goes away."}}; + } cutTauEvent; + + struct : ConfigurableGroup { + Configurable usePIDwTOF{"usePIDwTOF", false, {"Determine whether also TOF should be used in testPIDhypothesis"}}; + Configurable useScutTOFinTPC{"useScutTOFinTPC", true, {"Determine whether cut on TOF n sigma should be used after TPC-based decision in testPIDhypothesis"}}; + Configurable cutSiTPC{"cutSiTPC", 35.f, {"n sigma TPC cut on all particles in absolut values for testPIDhypothesis"}}; + Configurable cutSiTOF{"cutSiTOF", 35.f, {"n sigma TOF cut on all particles in absolut values for testPIDhypothesis"}}; + } cutPID; + + struct : ConfigurableGroup { + ConfigurableAxis axisNtracks{"axisNtracks", {30, -0.5, 29.5}, "Number of tracks in collision"}; + ConfigurableAxis axisNparticles{"axisNparticles", {100, -0.5, 99.5}, "Number of particles in collision"}; + ConfigurableAxis axisZvtx{"axisZvtx", {40, -20., 20.}, "Z-vertex position (cm)"}; + ConfigurableAxis axisInvMass{"axisInvMass", {400, 1., 5.}, "Invariant mass (GeV/c^{2})"}; + ConfigurableAxis axisInvMassWide{"axisInvMassWide", {1000, 0., 10.}, "Invariant mass (GeV/c^{2}), wider range"}; + ConfigurableAxis axisMom{"axisMom", {400, 0., 2.}, "Momentum (GeV/c)"}; + ConfigurableAxis axisMomWide{"axisMomWide", {1000, 0., 10.}, "Momentum (GeV/c), wider range"}; + ConfigurableAxis axisMomSigned{"axisMomSigned", {800, -2., 2.}, "Signed momentum (GeV/c)"}; + ConfigurableAxis axisPt{"axisPt", {400, 0., 2.}, "Transversal momentum (GeV/c)"}; + ConfigurableAxis axisPhi{"axisPhi", {64, -o2::constants::math::TwoPI, o2::constants::math::TwoPI}, "Azimuthal angle (a.y.)"}; + ConfigurableAxis axisModPhi{"axisModPhi", {400, 0., .4}, "Track fmod(#phi,#pi/9)"}; + ConfigurableAxis axisEta{"axisEta", {50, -1.2, 1.2}, "Pseudorapidity (a.u.)"}; + ConfigurableAxis axisRap{"axisRap", {50, -1.2, 1.2}, "Rapidity (a.u.)"}; + ConfigurableAxis axisAcoplanarity{"axisAcoplanarity", {32, 0.0, o2::constants::math::PI}, "Acoplanarity (rad)"}; + ConfigurableAxis axisTPCdEdx{"axisTPCdEdx", {2000, 0., 200.}, "TPC dE/dx (a.u.)"}; + ConfigurableAxis axisTOFsignal{"axisTOFsignal", {2500, -10000., 40000.}, "TOF signal (a.u.)"}; + ConfigurableAxis axisNsigma{"axisNsigma", {200, -10., 10.}, "n sigma"}; + ConfigurableAxis axisDCA{"axisDCA", {100, -0.5, 0.5}, "DCA (cm)"}; + ConfigurableAxis axisAvgITSclsSizes{"axisAvgITSclsSizes", {500, 0., 10.}, "ITS average cluster size"}; + ConfigurableAxis axisITSnCls{"axisITSnCls", {8, -0.5, 7.5}, "ITS n clusters"}; + ConfigurableAxis axisITSchi2{"axisITSchi2", {100, 0, 50}, "UTS chi2"}; + ConfigurableAxis axisTPCnCls{"axisTPCnCls", {165, -0.5, 164.5}, "TPC n clusters"}; + ConfigurableAxis axisTPCxRwsFrac{"axisTPCxRwsFrac", {200, 0.0, 2.0}, "TPC fraction of crossed raws"}; + ConfigurableAxis axisTPCchi2{"axisTPCchi2", {100, 0, 10}, "TPC chi2"}; + ConfigurableAxis axisFITtime{"axisFITtime", {201, -40.5, 40.5}, "FIT time in ns"}; + ConfigurableAxis axisFITamplitude{"axisFITamplitude", {1000, 0., 1000.}, "FIT amplitude"}; + + AxisSpec axisChannels{CH_ENUM_COUNTER, -0.5, +CH_ENUM_COUNTER - 0.5, "Channels (-)"}; + } confAxis; using FullUDTracks = soa::Join; using FullUDCollision = soa::Join::iterator; using FullSGUDCollision = soa::Join::iterator; - - TF1* funcPhiCutL = nullptr; - TF1* funcPhiCutH = nullptr; + using FullMCUDTracks = soa::Join; + using FullMCUDCollision = soa::Join::iterator; + using FullMCSGUDCollision = soa::Join::iterator; // init void init(InitContext&) { - mySetITShitsRule(cutMyGTitsHitsRule); - if (verboseInfo) - printLargeMessage("INIT METHOD"); - countCollisions = 0; - isFirstReconstructedCollisions = true; - - histos.add("Events/hCountCollisions", ";;Number of analysed collision (-)", HistType::kTH1D, {{1, 0.5, 1.5}}); - histos.add("Events/UDtableGapSide", ";GapSide value from UD table (-);Number of events (-)", HistType::kTH1D, {{4, -1.5, 2.5}}); - histos.add("Events/TrueGapSideDiffToTableValue", ";Difference trueGapSide from SGselector and gapSide from UD table (-);Number of events (-)", HistType::kTH1D, {{7, -3.5, 3.5}}); - histos.add("Events/hNreconstructedTracks", ";Number of tracks in a collision (-);Number of events (-)", HistType::kTH1D, {axisNtracks}); - histos.add("Events/hNreconstructedPVGT", ";Number of good track particles from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {axisNtracks}); - histos.add("Events/hNreconstructedNotPVGT", ";Number of good track particles from NOT primary vertex in a collision (-);Number of events (-);Number of events (-)", HistType::kTH1D, {axisNtracks}); - histos.add("Events/hNreconstructedPVGTelectrons", ";Number of good track identified electrons from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {axisNtracks}); - histos.add("Events/hNreconstructedPVGTmuons", ";Number of good track identified muons from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {axisNtracks}); - histos.add("Events/hNreconstructedPVGTpions", ";Number of good track identified pions from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {axisNtracks}); - histos.add("Events/hNreconstructedPVGTothers", ";Number of good track NOT identified electron/muon/pion particles from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {axisNtracks}); - histos.add("Events/hChannelsRatio", ";Channels (-);Number of events (-)", HistType::kTH1D, {{10, -0.5, 9.5}}); - - histos.add("Tracks/raw/hTrackZ", ";Track z-vertex (cm);Number of events (-)", HistType::kTH1D, {axisZvtx}); - histos.add("Tracks/raw/hTrackP", ";Track #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("Tracks/raw/hTrackPt", ";Track #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("Tracks/raw/hTrackPhi", ";Track #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("Tracks/raw/hTrackPtvsModPhi", ";Track #it{p_{T}} (GeV/c);Track fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("Tracks/raw/hTrackPtvsModPhiTOF", ";Track #it{p_{T}} (GeV/c);Track fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("Tracks/raw/hTrackEta", ";Track #eta (-);Number of events (-)", HistType::kTH1D, {axisEta}); - histos.add("Tracks/raw/hTrackDcaXY", ";Track DCA_{XY} (cm);Number of events (-)", HistType::kTH1D, {axisDCA}); - histos.add("Tracks/raw/hTrackPtvsDcaXY", ";Track #it{p_{T}} (GeV/c);Track DCA_{XY} (cm)", HistType::kTH2D, {axisPt, axisDCA}); - histos.add("Tracks/raw/hTrackDcaZ", ";Track DCA_{Z} (cm);Number of events (-)", HistType::kTH1D, {axisDCA}); - histos.add("Tracks/raw/ITS/itsNCls", "number of found ITS clusters;# clusters ITS", kTH1D, {axisITSnCls}); - histos.add("Tracks/raw/ITS/itsChi2NCl", "chi2 per ITS cluster;chi2 / cluster ITS", kTH1D, {axisITSchi2}); - histos.add("Tracks/raw/TPC/tpcNClsFindable", "number of findable TPC clusters;# findable clusters TPC", kTH1D, {axisTPCnCls}); - histos.add("Tracks/raw/TPC/tpcNClsFound", "number of found TPC clusters;# clusters TPC", kTH1D, {axisTPCnCls}); - histos.add("Tracks/raw/TPC/tpcCrossedRows", "number of crossed TPC rows;# crossed rows TPC", kTH1D, {axisTPCnCls}); - histos.add("Tracks/raw/TPC/tpcCrossedRowsOverFindableCls", "crossed TPC rows over findable clusters;crossed rows / findable clusters TPC", kTH1D, {axisTPCxRwsFrac}); - histos.add("Tracks/raw/TPC/tpcChi2NCl", "chi2 per cluster in TPC;chi2 / cluster TPC", kTH1D, {axisTPCchi2}); - histos.add("Tracks/raw/PID/hTPCsignalVsZ", "All tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/raw/PID/hTPCsignalVsP", "All tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/raw/PID/hTPCsignalVsPt", "All tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/raw/PID/hTPCsignalVsEta", "All tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/raw/PID/hTPCsignalVsPhi", "All tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/raw/PID/hTOFsignalVsP", "All tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsZ", "Positively charged tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsP", "Positively charged tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsPt", "Positively charged tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsEta", "Positively charged tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsPhi", "Positively charged tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/raw/PID/PosCharge/hTOFsignalVsP", "Positively charged tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsZ", "Negatively charged tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsP", "Negatively charged tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsPt", "Negatively charged tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsEta", "Negatively charged tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsPhi", "Negatively charged tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/raw/PID/NegCharge/hTOFsignalVsP", "Negatively charged tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - - histos.add("Tracks/GoodTrack/hTrackZ", ";Track z-vertex (cm);Number of events (-)", HistType::kTH1D, {axisZvtx}); - histos.add("Tracks/GoodTrack/hTrackP", ";Track #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("Tracks/GoodTrack/hTrackPt", ";Track #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("Tracks/GoodTrack/hTrackPhi", ";Track #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("Tracks/GoodTrack/hTrackPtvsModPhi", ";Track #it{p_{T}} (GeV/c);Track fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("Tracks/GoodTrack/hTrackPtvsModPhiTOF", ";Track #it{p_{T}} (GeV/c);Track fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("Tracks/GoodTrack/hTrackEta", ";Track #eta (-);Number of events (-)", HistType::kTH1D, {axisEta}); - histos.add("Tracks/GoodTrack/hTrackDcaXY", ";Track DCA_{XY} (cm);Number of events (-)", HistType::kTH1D, {axisDCA}); - histos.add("Tracks/GoodTrack/hTrackPtvsDcaXY", ";Track #it{p_{T}} (GeV/c);Track DCA_{XY} (cm)", HistType::kTH2D, {axisPt, axisDCA}); - histos.add("Tracks/GoodTrack/hTrackDcaZ", ";Track DCA_{Z} (cm);Number of events (-)", HistType::kTH1D, {axisDCA}); - histos.add("Tracks/GoodTrack/ITS/itsNCls", "number of found ITS clusters;# clusters ITS", kTH1D, {axisITSnCls}); - histos.add("Tracks/GoodTrack/ITS/itsChi2NCl", "chi2 per ITS cluster;chi2 / cluster ITS", kTH1D, {axisITSchi2}); - histos.add("Tracks/GoodTrack/TPC/tpcNClsFindable", "number of findable TPC clusters;# findable clusters TPC", kTH1D, {axisTPCnCls}); - histos.add("Tracks/GoodTrack/TPC/tpcNClsFound", "number of found TPC clusters;# clusters TPC", kTH1D, {axisTPCnCls}); - histos.add("Tracks/GoodTrack/TPC/tpcCrossedRows", "number of crossed TPC rows;# crossed rows TPC", kTH1D, {axisTPCnCls}); - histos.add("Tracks/GoodTrack/TPC/tpcCrossedRowsOverFindableCls", "crossed TPC rows over findable clusters;crossed rows / findable clusters TPC", kTH1D, {axisTPCxRwsFrac}); - histos.add("Tracks/GoodTrack/TPC/tpcChi2NCl", "chi2 per cluster in TPC;chi2 / cluster TPC", kTH1D, {axisTPCchi2}); - histos.add("Tracks/GoodTrack/PID/hTPCsignalVsZ", "All good tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/hTPCsignalVsP", "All good tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/hTPCsignalVsPt", "All good tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/hTPCsignalVsEta", "All good tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/hTPCsignalVsPhi", "All good tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/hTOFsignalVsP", "All good tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsZ", "Positively charged good tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsP", "Positively charged good tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsPt", "Positively charged good tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsEta", "Positively charged good tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsPhi", "Positively charged good tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/PosCharge/hTOFsignalVsP", "Positively charged good tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsZ", "Negatively charged good tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsP", "Negatively charged good tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsPt", "Negatively charged good tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsEta", "Negatively charged good tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsPhi", "Negatively charged good tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/NegCharge/hTOFsignalVsP", "Negatively charged good tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsZ", "Identified electrons;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsP", "Identified electrons;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsPt", "Identified electrons;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsEta", "Identified electrons;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsPhi", "Identified electrons;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Electron/hTOFsignalVsP", "Identified electrons;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaVsP", "Identified electrons;Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaVsP", "Identified electrons;Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaElVsMu", "Identified electrons;n#sigma^{#it{e}}_{TPC} (arb. units);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaElVsMu", "Identified electrons;n#sigma^{#it{e}}_{TOF} (arb. units);n#sigma^{#mu}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaElVsPi", "Identified electrons;n#sigma^{#it{e}}_{TPC} (arb. units);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaElVsPi", "Identified electrons;n#sigma^{#it{e}}_{TOF} (arb. units);n#sigma^{#pi}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaElVsKa", "Identified electrons;n#sigma^{#it{e}}_{TPC} (arb. units);n#sigma^{#it{K}}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaElVsKa", "Identified electrons;n#sigma^{#it{e}}_{TOF} (arb. units);n#sigma^{#it{K}}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaElVsPr", "Identified electrons;n#sigma^{#it{e}}_{TPC} (arb. units);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaElVsPr", "Identified electrons;n#sigma^{#it{e}}_{TOF} (arb. units);n#sigma^{p}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsZ", "Identified muons;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsP", "Identified muons;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsPt", "Identified muons;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsEta", "Identified muons;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsPhi", "Identified muons;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Muon/hTOFsignalVsP", "Identified muons;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaVsP", "Identified muons;Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaVsP", "Identified muons;Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaMuVsEl", "Identified muons;n#sigma^{#mu}_{TPC} (arb. units);n#sigma^{#it{e}}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaMuVsEl", "Identified muons;n#sigma^{#mu}_{TOF} (arb. units);n#sigma^{#it{e}}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaMuVsPi", "Identified muons;n#sigma^{#mu}_{TPC} (arb. units);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaMuVsPi", "Identified muons;n#sigma^{#mu}_{TOF} (arb. units);n#sigma^{#pi}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaMuVsKa", "Identified muons;n#sigma^{#mu}_{TPC} (arb. units);n#sigma^{#it{K}}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaMuVsKa", "Identified muons;n#sigma^{#mu}_{TOF} (arb. units);n#sigma^{#it{K}}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaMuVsPr", "Identified muons;n#sigma^{#mu}_{TPC} (arb. units);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaMuVsPr", "Identified muons;n#sigma^{#mu}_{TOF} (arb. units);n#sigma^{p}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsZ", "Identified pions;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsP", "Identified pions;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsPt", "Identified pions;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsEta", "Identified pions;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsPhi", "Identified pions;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Pion/hTOFsignalVsP", "Identified pions;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaVsP", "Identified pions;Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaVsP", "Identified pions;Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaPiVsEl", "Identified pions;n#sigma^{#pi}_{TPC} (arb. units);n#sigma^{#it{e}}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaPiVsEl", "Identified pions;n#sigma^{#pi}_{TOF} (arb. units);n#sigma^{#it{e}}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaPiVsMu", "Identified pions;n#sigma^{#pi}_{TPC} (arb. units);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaPiVsMu", "Identified pions;n#sigma^{#pi}_{TOF} (arb. units);n#sigma^{#mu}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaPiVsKa", "Identified pions;n#sigma^{#pi}_{TPC} (arb. units);n#sigma^{#it{K}}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaPiVsKa", "Identified pions;n#sigma^{#pi}_{TOF} (arb. units);n#sigma^{#it{K}}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaPiVsPr", "Identified pions;n#sigma^{#pi}_{TPC} (arb. units);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaPiVsPr", "Identified pions;n#sigma^{#pi}_{TOF} (arb. units);n#sigma^{p}_{TOF} (arb. units)", HistType::kTH2D, {axisNsigma, axisNsigma}); - histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsZ", "Identified NOT electron/Muon/Pion;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisZvtx, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsP", "Identified NOT electron/Muon/Pion;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsPt", "Identified NOT electron/Muon/Pion;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPt, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsEta", "Identified NOT electron/Muon/Pion;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisEta, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsPhi", "Identified NOT electron/Muon/Pion;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisPhi, axisTPCdEdx}); - histos.add("Tracks/GoodTrack/PID/Others/hTOFsignalVsP", "Identified NOT electron/Muon/Pion;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); + printMediumMessage("INIT METHOD"); + + mySetITShitsRule(cutGlobalTrack.cutITShitsRule); + + if (doMainHistos) { + histos.add("Events/hCountCollisions", ";;Number of analysed collision (-)", HistType::kTH1D, {{1, 0.5, 1.5}}); + histos.add("Events/UDtableGapSide", ";GapSide value from UD table (-);Number of events (-)", HistType::kTH1D, {{4, -1.5, 2.5}}); + histos.add("Events/TrueGapSideDiffToTableValue", ";Difference trueGapSide from SGselector and gapSide from UD table (-);Number of events (-)", HistType::kTH1D, {{7, -3.5, 3.5}}); + histos.add("Events/hNreconstructedTracks", ";Number of tracks in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNtracks}); + histos.add("Events/hNreconstructedPVGT", ";Number of good track particles from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNtracks}); + histos.add("Events/hNreconstructedNotPVGT", ";Number of good track particles from NOT primary vertex in a collision (-);Number of events (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNtracks}); + histos.add("Events/hNreconstructedPVGTelectrons", ";Number of good track identified electrons from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNtracks}); + histos.add("Events/hNreconstructedPVGTmuons", ";Number of good track identified muons from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNtracks}); + histos.add("Events/hNreconstructedPVGTpions", ";Number of good track identified pions from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNtracks}); + histos.add("Events/hNreconstructedPVGTothers", ";Number of good track NOT identified electron/muon/pion particles from primary vertex in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNtracks}); + histos.add("Events/hChannels", ";Channels (-);Number of events (-)", HistType::kTH1D, {{confAxis.axisChannels}}); + histos.add("Events/FIT/hAmplitudeFT0A", ";Amplitude (-);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITamplitude}}); + histos.add("Events/FIT/hAmplitudeFT0C", ";Amplitude (-);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITamplitude}}); + histos.add("Events/FIT/hAmplitudeFDDA", ";Amplitude (-);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITamplitude}}); + histos.add("Events/FIT/hAmplitudeFDDC", ";Amplitude (-);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITamplitude}}); + histos.add("Events/FIT/hAmplitudeFV0A", ";Amplitude (-);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITamplitude}}); + histos.add("Events/FIT/hTimeFT0A", ";Time (ns);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFT0C", ";Time (ns);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFDDA", ";Time (ns);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFDDC", ";Time (ns);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFV0A", ";Time (ns);Number of events (-)", HistType::kTH1F, {{confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFT0AvsFT0C", ";FT0A time (ns);FT0C time (ns)", HistType::kTH2F, {{confAxis.axisFITtime}, {confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFT0CvsFDDA", ";FT0C time (ns);FDDA time (ns)", HistType::kTH2F, {{confAxis.axisFITtime}, {confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFDDAvsFDDC", ";FDDA time (ns);FDDC time (ns)", HistType::kTH2F, {{confAxis.axisFITtime}, {confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFDDCvsFV0A", ";FDDC time (ns);FV0A time (ns)", HistType::kTH2F, {{confAxis.axisFITtime}, {confAxis.axisFITtime}}); + histos.add("Events/FIT/hTimeFV0AvsFT0A", ";FV0A time (ns);FT0A time (ns)", HistType::kTH2F, {{confAxis.axisFITtime}, {confAxis.axisFITtime}}); + + histos.add("Tracks/raw/hTrackZ", ";Track z-vertex (cm);Number of events (-)", HistType::kTH1D, {confAxis.axisZvtx}); + histos.add("Tracks/raw/hTrackP", ";Track #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("Tracks/raw/hTrackPt", ";Track #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("Tracks/raw/hTrackPhi", ";Track #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("Tracks/raw/hTrackPtvsModPhi", ";Track #it{p_{T}} (GeV/c);Track fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("Tracks/raw/hTrackPtvsModPhiTOF", ";Track #it{p_{T}} (GeV/c);Track fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("Tracks/raw/hTrackEta", ";Track #eta (-);Number of events (-)", HistType::kTH1D, {confAxis.axisEta}); + histos.add("Tracks/raw/hTrackDcaXY", ";Track DCA_{XY} (cm);Number of events (-)", HistType::kTH1D, {confAxis.axisDCA}); + histos.add("Tracks/raw/hTrackPtvsDcaXY", ";Track #it{p_{T}} (GeV/c);Track DCA_{XY} (cm)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisDCA}); + histos.add("Tracks/raw/hTrackDcaZ", ";Track DCA_{Z} (cm);Number of events (-)", HistType::kTH1D, {confAxis.axisDCA}); + histos.add("Tracks/raw/ITS/itsNCls", "number of found ITS clusters;# clusters ITS", kTH1D, {confAxis.axisITSnCls}); + histos.add("Tracks/raw/ITS/itsChi2NCl", "chi2 per ITS cluster;chi2 / cluster ITS", kTH1D, {confAxis.axisITSchi2}); + histos.add("Tracks/raw/TPC/tpcNClsFindable", "number of findable TPC clusters;# findable clusters TPC", kTH1D, {confAxis.axisTPCnCls}); + histos.add("Tracks/raw/TPC/tpcNClsFound", "number of found TPC clusters;# clusters TPC", kTH1D, {confAxis.axisTPCnCls}); + histos.add("Tracks/raw/TPC/tpcCrossedRows", "number of crossed TPC rows;# crossed rows TPC", kTH1D, {confAxis.axisTPCnCls}); + histos.add("Tracks/raw/TPC/tpcCrossedRowsOverFindableCls", "crossed TPC rows over findable clusters;crossed rows / findable clusters TPC", kTH1D, {confAxis.axisTPCxRwsFrac}); + histos.add("Tracks/raw/TPC/tpcChi2NCl", "chi2 per cluster in TPC;chi2 / cluster TPC", kTH1D, {confAxis.axisTPCchi2}); + histos.add("Tracks/GoodTrack/hTrackZ", ";Track z-vertex (cm);Number of events (-)", HistType::kTH1D, {confAxis.axisZvtx}); + histos.add("Tracks/GoodTrack/hTrackP", ";Track #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("Tracks/GoodTrack/hTrackPt", ";Track #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("Tracks/GoodTrack/hTrackPhi", ";Track #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("Tracks/GoodTrack/hTrackPtvsModPhi", ";Track #it{p_{T}} (GeV/c);Track fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("Tracks/GoodTrack/hTrackPtvsModPhiTOF", ";Track #it{p_{T}} (GeV/c);Track fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("Tracks/GoodTrack/hTrackEta", ";Track #eta (-);Number of events (-)", HistType::kTH1D, {confAxis.axisEta}); + histos.add("Tracks/GoodTrack/hTrackDcaXY", ";Track DCA_{XY} (cm);Number of events (-)", HistType::kTH1D, {confAxis.axisDCA}); + histos.add("Tracks/GoodTrack/hTrackPtvsDcaXY", ";Track #it{p_{T}} (GeV/c);Track DCA_{XY} (cm)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisDCA}); + histos.add("Tracks/GoodTrack/hTrackDcaZ", ";Track DCA_{Z} (cm);Number of events (-)", HistType::kTH1D, {confAxis.axisDCA}); + histos.add("Tracks/GoodTrack/ITS/itsNCls", "number of found ITS clusters;# clusters ITS", kTH1D, {confAxis.axisITSnCls}); + histos.add("Tracks/GoodTrack/ITS/itsChi2NCl", "chi2 per ITS cluster;chi2 / cluster ITS", kTH1D, {confAxis.axisITSchi2}); + histos.add("Tracks/GoodTrack/TPC/tpcNClsFindable", "number of findable TPC clusters;# findable clusters TPC", kTH1D, {confAxis.axisTPCnCls}); + histos.add("Tracks/GoodTrack/TPC/tpcNClsFound", "number of found TPC clusters;# clusters TPC", kTH1D, {confAxis.axisTPCnCls}); + histos.add("Tracks/GoodTrack/TPC/tpcCrossedRows", "number of crossed TPC rows;# crossed rows TPC", kTH1D, {confAxis.axisTPCnCls}); + histos.add("Tracks/GoodTrack/TPC/tpcCrossedRowsOverFindableCls", "crossed TPC rows over findable clusters;crossed rows / findable clusters TPC", kTH1D, {confAxis.axisTPCxRwsFrac}); + histos.add("Tracks/GoodTrack/TPC/tpcChi2NCl", "chi2 per cluster in TPC;chi2 / cluster TPC", kTH1D, {confAxis.axisTPCchi2}); + } + + if (doPIDhistos) { + histos.add("Tracks/raw/PID/hTPCsignalVsZ", "All tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/hTPCsignalVsP", "All tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/hTPCsignalVsPt", "All tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/hTPCsignalVsEta", "All tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/hTPCsignalVsPhi", "All tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/hTOFsignalVsP", "All tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/raw/PID/hTPCnSigmaElVsP", ";Track #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/raw/PID/hTPCnSigmaMuVsP", ";Track #it{p} (GeV/c);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/raw/PID/hTPCnSigmaPiVsP", ";Track #it{p} (GeV/c);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/raw/PID/hTPCnSigmaKaVsP", ";Track #it{p} (GeV/c);n#sigma^{K}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/raw/PID/hTPCnSigmaPrVsP", ";Track #it{p} (GeV/c);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsZ", "Positively charged tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsP", "Positively charged tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsPt", "Positively charged tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsEta", "Positively charged tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/PosCharge/hTPCsignalVsPhi", "Positively charged tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/PosCharge/hTOFsignalVsP", "Positively charged tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsZ", "Negatively charged tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsP", "Negatively charged tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsPt", "Negatively charged tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsEta", "Negatively charged tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/NegCharge/hTPCsignalVsPhi", "Negatively charged tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/raw/PID/NegCharge/hTOFsignalVsP", "Negatively charged tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/GoodTrack/PID/hTPCsignalVsZ", "All good tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/hTPCsignalVsP", "All good tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/hTPCsignalVsPt", "All good tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/hTPCsignalVsEta", "All good tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/hTPCsignalVsPhi", "All good tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/hTPCnSigmaElVsP", ";Track #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/hTPCnSigmaMuVsP", ";Track #it{p} (GeV/c);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/hTPCnSigmaPiVsP", ";Track #it{p} (GeV/c);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/hTPCnSigmaKaVsP", ";Track #it{p} (GeV/c);n#sigma^{K}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/hTPCnSigmaPrVsP", ";Track #it{p} (GeV/c);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/hTOFsignalVsP", "All good tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsZ", "Positively charged good tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsP", "Positively charged good tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsPt", "Positively charged good tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsEta", "Positively charged good tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/PosCharge/hTPCsignalVsPhi", "Positively charged good tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/PosCharge/hTOFsignalVsP", "Positively charged good tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsZ", "Negatively charged good tracks;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsP", "Negatively charged good tracks;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsPt", "Negatively charged good tracks;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsEta", "Negatively charged good tracks;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/NegCharge/hTPCsignalVsPhi", "Negatively charged good tracks;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/NegCharge/hTOFsignalVsP", "Negatively charged good tracks;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsZ", "Identified electrons;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsP", "Identified electrons;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsPt", "Identified electrons;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsEta", "Identified electrons;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCsignalVsPhi", "Identified electrons;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Electron/hTOFsignalVsP", "Identified electrons;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaVsP", "Identified electrons;Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaVsP", "Identified electrons;Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaElVsMu", "Identified electrons;n#sigma^{#it{e}}_{TPC} (arb. units);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaElVsMu", "Identified electrons;n#sigma^{#it{e}}_{TOF} (arb. units);n#sigma^{#mu}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaElVsPi", "Identified electrons;n#sigma^{#it{e}}_{TPC} (arb. units);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaElVsPi", "Identified electrons;n#sigma^{#it{e}}_{TOF} (arb. units);n#sigma^{#pi}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaElVsKa", "Identified electrons;n#sigma^{#it{e}}_{TPC} (arb. units);n#sigma^{#it{K}}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaElVsKa", "Identified electrons;n#sigma^{#it{e}}_{TOF} (arb. units);n#sigma^{#it{K}}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTPCnSigmaElVsPr", "Identified electrons;n#sigma^{#it{e}}_{TPC} (arb. units);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Electron/hTOFnSigmaElVsPr", "Identified electrons;n#sigma^{#it{e}}_{TOF} (arb. units);n#sigma^{p}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsZ", "Identified muons;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsP", "Identified muons;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsPt", "Identified muons;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsEta", "Identified muons;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCsignalVsPhi", "Identified muons;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Muon/hTOFsignalVsP", "Identified muons;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaVsP", "Identified muons;Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaVsP", "Identified muons;Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaMuVsEl", "Identified muons;n#sigma^{#mu}_{TPC} (arb. units);n#sigma^{#it{e}}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaMuVsEl", "Identified muons;n#sigma^{#mu}_{TOF} (arb. units);n#sigma^{#it{e}}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaMuVsPi", "Identified muons;n#sigma^{#mu}_{TPC} (arb. units);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaMuVsPi", "Identified muons;n#sigma^{#mu}_{TOF} (arb. units);n#sigma^{#pi}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaMuVsKa", "Identified muons;n#sigma^{#mu}_{TPC} (arb. units);n#sigma^{#it{K}}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaMuVsKa", "Identified muons;n#sigma^{#mu}_{TOF} (arb. units);n#sigma^{#it{K}}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTPCnSigmaMuVsPr", "Identified muons;n#sigma^{#mu}_{TPC} (arb. units);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Muon/hTOFnSigmaMuVsPr", "Identified muons;n#sigma^{#mu}_{TOF} (arb. units);n#sigma^{p}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsZ", "Identified pions;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsP", "Identified pions;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsPt", "Identified pions;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsEta", "Identified pions;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCsignalVsPhi", "Identified pions;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Pion/hTOFsignalVsP", "Identified pions;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaVsP", "Identified pions;Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaVsP", "Identified pions;Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaPiVsEl", "Identified pions;n#sigma^{#pi}_{TPC} (arb. units);n#sigma^{#it{e}}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaPiVsEl", "Identified pions;n#sigma^{#pi}_{TOF} (arb. units);n#sigma^{#it{e}}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaPiVsMu", "Identified pions;n#sigma^{#pi}_{TPC} (arb. units);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaPiVsMu", "Identified pions;n#sigma^{#pi}_{TOF} (arb. units);n#sigma^{#mu}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaPiVsKa", "Identified pions;n#sigma^{#pi}_{TPC} (arb. units);n#sigma^{#it{K}}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaPiVsKa", "Identified pions;n#sigma^{#pi}_{TOF} (arb. units);n#sigma^{#it{K}}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTPCnSigmaPiVsPr", "Identified pions;n#sigma^{#pi}_{TPC} (arb. units);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Pion/hTOFnSigmaPiVsPr", "Identified pions;n#sigma^{#pi}_{TOF} (arb. units);n#sigma^{p}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsZ", "Identified NOT electron/Muon/Pion;Track z-vertex (cm);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisZvtx, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsP", "Identified NOT electron/Muon/Pion;Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsPt", "Identified NOT electron/Muon/Pion;Track #it{p_{#rm T}} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsEta", "Identified NOT electron/Muon/Pion;Track #eta (-);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisEta, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Others/hTPCsignalVsPhi", "Identified NOT electron/Muon/Pion;Track #phi (rad);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisTPCdEdx}); + histos.add("Tracks/GoodTrack/PID/Others/hTOFsignalVsP", "Identified NOT electron/Muon/Pion;Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + } if (doTwoTracks) { - histos.add("EventTwoTracks/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/hInvariantMassWideNoMothers", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/hInvariantMassWideAllPionMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/hInvariantMassWideAllPionMassPtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/hInvariantMassWideAllPionMassTOF", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/hInvariantMassWideAllPionMassITScut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/hInvariantMassWideAllPionMassPtCutITScut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/hDaughtersPvsITSclusterSize", ";Average ITS cluster size;Daughter #it{p} (GeV/c)", HistType::kTH2D, {axisAvgITSclsSizes, axisMomSigned}); - histos.add("EventTwoTracks/hDaughtersPvsITSclusterSizeXcos", ";Average ITS cluster size x cos(#lambda);Daughter #it{p} (GeV/c)", HistType::kTH2D, {axisAvgITSclsSizes, axisMomSigned}); - histos.add("EventTwoTracks/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - - histos.add("EventTwoTracks/TwoElectrons/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/TwoElectrons/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/TwoElectrons/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/TwoElectrons/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/TwoElectrons/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/TwoElectrons/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/TwoElectrons/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/TwoElectrons/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/TwoElectrons/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/TwoElectrons/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersPtvsModPhiTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersPtvsModPhiPtCutTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoElectrons/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingP", ";Leading #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingPwide", ";Leading #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingPt", ";Leading #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingPhi", ";Leading #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingRapidity", ";Leading #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingPvsOtherP", ";Leading #it{p} (GeV/c); Other #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingPwideVsOtherPwide", ";Leading #it{p} (GeV/c); Other #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingPtVsOtherPt", ";Leading #it{p_{T} (GeV/c); Other #it{p_{T} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingPhiVsOtherPhi", ";Leading #phi (rad); Other #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/TwoElectrons/hLeadingRapVsOtherRap", ";Leading #it{y} (-); Other #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsLP", ";Leading #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsOP", ";Other #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTOFsignalVsLP", ";Leading #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTOFsignalVsOP", ";Other #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTPCnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTPCnSigmaVsLP", ";Leading #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTPCnSigmaVsOP", ";Other #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTOFnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTOFnSigmaVsLP", ";Leading #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/TwoElectrons/PID/hTOFnSigmaVsOP", ";Other #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - - histos.add("EventTwoTracks/TwoMuons/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/TwoMuons/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/TwoMuons/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/TwoMuons/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/TwoMuons/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/TwoMuons/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/TwoMuons/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/TwoMuons/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/TwoMuons/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/TwoMuons/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersPtvsModPhiTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersPtvsModPhiPtCutTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoMuons/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/TwoMuons/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - - histos.add("EventTwoTracks/TwoPions/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/TwoPions/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/TwoPions/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/TwoPions/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/TwoPions/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/TwoPions/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/TwoPions/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/TwoPions/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/TwoPions/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/TwoPions/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/TwoPions/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/TwoPions/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/TwoPions/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/TwoPions/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/TwoPions/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoPions/hDaughtersPtvsModPhiTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoPions/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoPions/hDaughtersPtvsModPhiPtCutTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/TwoPions/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/TwoPions/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - - histos.add("EventTwoTracks/ElectronMuon/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/ElectronMuon/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/ElectronMuon/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/ElectronMuon/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/ElectronMuon/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/ElectronMuon/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/ElectronMuon/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/ElectronMuon/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/ElectronMuon/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/ElectronMuon/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/ElectronMuon/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/ElectronMuon/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/ElectronMuon/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/ElectronMuon/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/ElectronMuon/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - - histos.add("EventTwoTracks/ElectronPion/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/ElectronPion/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/ElectronPion/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/ElectronPion/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/ElectronPion/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/ElectronPion/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/ElectronPion/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/ElectronPion/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/ElectronPion/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/ElectronPion/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/ElectronPion/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/ElectronPion/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/ElectronPion/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/ElectronPion/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/ElectronPion/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - - histos.add("EventTwoTracks/MuonPion/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/MuonPion/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonPion/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonPion/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/MuonPion/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/MuonPion/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/MuonPion/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/MuonPion/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/MuonPion/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/MuonPion/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/MuonPion/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/MuonPion/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/MuonPion/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/MuonPion/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/MuonPion/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/MuonPion/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); + histos.add("EventTwoTracks/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/hInvariantMassWideNoMothers", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/hInvariantMassWideAllPionMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/hInvariantMassWideAllPionMassPtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/hInvariantMassWideAllPionMassTOF", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/hDaughtersPvsITSclusterSize", ";Average ITS cluster size;Daughter #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisAvgITSclsSizes, confAxis.axisMomSigned}); + histos.add("EventTwoTracks/hDaughtersPvsITSclusterSizeXcos", ";Average ITS cluster size x cos(#lambda);Daughter #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisAvgITSclsSizes, confAxis.axisMomSigned}); + histos.add("EventTwoTracks/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/PID/hTPCnSigmaElVsP", ";Track #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/hTPCnSigmaMuVsP", ";Track #it{p} (GeV/c);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/hTPCnSigmaPiVsP", ";Track #it{p} (GeV/c);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/hTPCnSigmaKaVsP", ";Track #it{p} (GeV/c);n#sigma^{K}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/hTPCnSigmaPrVsP", ";Track #it{p} (GeV/c);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/NoPID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/PID/NoPID/hTPCnSigmaElVsP", ";Track #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/NoPID/hTPCnSigmaMuVsP", ";Track #it{p} (GeV/c);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/NoPID/hTPCnSigmaPiVsP", ";Track #it{p} (GeV/c);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/NoPID/hTPCnSigmaKaVsP", ";Track #it{p} (GeV/c);n#sigma^{K}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/PID/NoPID/hTPCnSigmaPrVsP", ";Track #it{p} (GeV/c);n#sigma^{p}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + + histos.add("EventTwoTracks/TwoElectrons/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/TwoElectrons/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/TwoElectrons/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/TwoElectrons/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/TwoElectrons/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/TwoElectrons/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/TwoElectrons/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/TwoElectrons/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/TwoElectrons/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/TwoElectrons/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersPtvsModPhiTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersPtvsModPhiPtCutTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoElectrons/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingP", ";Leading #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingPwide", ";Leading #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingPt", ";Leading #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingPhi", ";Leading #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingRapidity", ";Leading #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingPvsOtherP", ";Leading #it{p} (GeV/c); Other #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingPwideVsOtherPwide", ";Leading #it{p} (GeV/c); Other #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingPtVsOtherPt", ";Leading #it{p_{T}} (GeV/c); Other #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingPhiVsOtherPhi", ";Leading #phi (rad); Other #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/TwoElectrons/hLeadingRapVsOtherRap", ";Leading #it{y} (-); Other #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsLP", ";Leading #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsOP", ";Other #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTOFsignalVsLP", ";Leading #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTOFsignalVsOP", ";Other #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTPCnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTPCnSigmaVsLP", ";Leading #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTPCnSigmaVsOP", ";Other #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTOFnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTOFnSigmaVsLP", ";Leading #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/TwoElectrons/PID/hTOFnSigmaVsOP", ";Other #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + + histos.add("EventTwoTracks/TwoMuons/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/TwoMuons/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/TwoMuons/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/TwoMuons/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/TwoMuons/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/TwoMuons/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/TwoMuons/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/TwoMuons/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/TwoMuons/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/TwoMuons/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersPtvsModPhiTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersPtvsModPhiPtCutTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoMuons/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/TwoMuons/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + + histos.add("EventTwoTracks/TwoPions/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/TwoPions/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/TwoPions/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/TwoPions/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/TwoPions/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/TwoPions/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/TwoPions/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/TwoPions/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/TwoPions/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/TwoPions/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/TwoPions/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/TwoPions/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/TwoPions/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/TwoPions/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/TwoPions/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoPions/hDaughtersPtvsModPhiTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoPions/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoPions/hDaughtersPtvsModPhiPtCutTOF", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisModPhi}); + histos.add("EventTwoTracks/TwoPions/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/TwoPions/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + + histos.add("EventTwoTracks/ElectronMuon/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/ElectronMuon/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/ElectronMuon/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/ElectronMuon/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronMuon/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronMuon/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronMuon/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronMuon/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronMuon/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronMuon/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronMuon/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronMuon/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronMuon/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronMuon/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronMuon/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + + histos.add("EventTwoTracks/ElectronPion/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/ElectronPion/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/ElectronPion/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/ElectronPion/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronPion/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronPion/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronPion/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronPion/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronPion/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronPion/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronPion/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronPion/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronPion/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronPion/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronPion/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + + histos.add("EventTwoTracks/MuonPion/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/MuonPion/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/MuonPion/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/MuonPion/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/MuonPion/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/MuonPion/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/MuonPion/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/MuonPion/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/MuonPion/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/MuonPion/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/MuonPion/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/MuonPion/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/MuonPion/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/MuonPion/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/MuonPion/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/MuonPion/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); histos.add("EventTwoTracks/ElectronMuPi/hNeventsPtCuts", ";Selection (-);Number of events (-)", HistType::kTH1D, {{20, -0.5, 19.5}}); - histos.add("EventTwoTracks/ElectronMuPi/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/ElectronMuPi/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/ElectronMuPi/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/ElectronMuPi/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/ElectronMuPi/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/ElectronMuPi/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/ElectronMuPi/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/ElectronMuPi/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/ElectronMuPi/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/ElectronMuPi/hElectronPt", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/ElectronMuPi/hElectronPtWide", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/ElectronMuPi/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/ElectronMuPi/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/ElectronMuPi/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/ElectronMuPi/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/ElectronMuPi/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/ElectronMuPi/hElectronPvsOtherP", ";Electron #it{p} (GeV/c); #mu/#pi #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/ElectronMuPi/hElectronPwideVsOtherPwide", ";Electron #it{p} (GeV/c); #mu/#pi #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/ElectronMuPi/hElectronPtVsOtherPt", ";Electron #it{p_{T} (GeV/c); #mu/#pi #it{p_{T} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/ElectronMuPi/hElectronPhiVsOtherPhi", ";Electron #phi (rad); #mu/#pi #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/ElectronMuPi/hElectronRapVsOtherRap", ";Electron #it{y} (-); #mu/#pi #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsEP", ";Electron #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsOP", ";#mu/#pi #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsEP", ";Electron #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsOP", ";Other #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsEP", ";Electron #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsMP", ";Muon #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsPP", ";Pion #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEP", ";Electron #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsMP", ";Muon #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPP", ";Pion #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/ElectronMuPi/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/ElectronMuPi/PionsSelection/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/ElectronMuPi/PionsSelection/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/ElectronMuPi/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/ElectronMuPi/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronMuPi/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronMuPi/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronMuPi/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronMuPi/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronMuPi/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronMuPi/hElectronPt", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronMuPi/hElectronPtWide", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronMuPi/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronMuPi/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronMuPi/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronMuPi/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronMuPi/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronMuPi/hElectronPvsOtherP", ";Electron #it{p} (GeV/c); #mu/#pi #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronMuPi/hElectronPwideVsOtherPwide", ";Electron #it{p} (GeV/c); #mu/#pi #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronMuPi/hElectronPtVsOtherPt", ";Electron #it{p_{T}} (GeV/c); #mu/#pi #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronMuPi/hElectronPhiVsOtherPhi", ";Electron #phi (rad); #mu/#pi #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronMuPi/hElectronRapVsOtherRap", ";Electron #it{y} (-); #mu/#pi #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + + histos.add("EventTwoTracks/ElectronMuPi/PID/mcTruth/nSigmaTPC1", "Paul's way;True electron #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/mcTruth/nSigmaTPC2", "Paul's way;True not-electron #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsEPofE", ";Electron #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsOPofO", ";#mu/#pi #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsEPofE", ";Electron #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsPPofE", ";Electron #it{p} (GeV/c);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaEvsnSigmaPofE", ";Electron n#sigma^{e}_{TPC} (arb. units);Electron n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsEPofO", ";Non-electron #it{p} (GeV/c);n#sigma^{e}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsMPofO", ";Non-electron #it{p} (GeV/c);n#sigma^{#mu}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsPPofO", ";Non-electron #it{p} (GeV/c);n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaEvsnSigmaPofO", ";Non-electron n#sigma^{e}_{TPC} (arb. units);Non-electron n#sigma^{#pi}_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma^{e}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsEPofE", ";Electron #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEPofE", ";Electron #it{p} (GeV/c);n#sigma^{e}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPPofE", ";Electron #it{p} (GeV/c);n#sigma^{#pi}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaEvsnSigmaPofE", ";Electron n#sigma^{e}_{TOF} (arb. units);Electron n#sigma^{#pi}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsOPofO", ";Not-electron #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEPofO", ";Not-electron #it{p} (GeV/c);n#sigma^{e}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsMPofO", ";Not-electron #it{p} (GeV/c);n#sigma^{#mu}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPPofO", ";Not-electron #it{p} (GeV/c);n#sigma^{#pi}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaEvsnSigmaPofO", ";Not-electron n#sigma^{e}_{TOF} (arb. units);Not-electron n#sigma^{#pi}_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisNsigma, confAxis.axisNsigma}); histos.add("EventTwoTracks/ElectronOther/hNeventsPtCuts", ";Selection (-);Number of events (-)", HistType::kTH1D, {{20, -0.5, 19.5}}); - histos.add("EventTwoTracks/ElectronOther/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/ElectronOther/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/ElectronOther/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/ElectronOther/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/ElectronOther/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/ElectronOther/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/ElectronOther/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/ElectronOther/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/ElectronOther/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/ElectronOther/hElectronPt", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/ElectronOther/hElectronPtWide", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/ElectronOther/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/ElectronOther/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/ElectronOther/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/ElectronOther/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/ElectronOther/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/ElectronOther/hElectronPvsOtherP", ";Electron #it{p} (GeV/c); Other #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/ElectronOther/hElectronPwideVsOtherPwide", ";Electron #it{p} (GeV/c); Other #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/ElectronOther/hElectronPtVsOtherPt", ";Electron #it{p_{T} (GeV/c); Other #it{p_{T} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/ElectronOther/hElectronPhiVsOtherPhi", ";Electron #phi (rad); Other #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/ElectronOther/hElectronRapVsOtherRap", ";Electron #it{y} (-); Other #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/ElectronOther/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/ElectronOther/PID/hTPCsignalVsEP", ";Electron #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/ElectronOther/PID/hTPCsignalVsOP", ";#it{e}/#mu/#pi #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/ElectronOther/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/ElectronOther/PID/hTOFsignalVsEP", ";Electron #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/ElectronOther/PID/hTOFsignalVsOP", ";Other #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsEP", ";Electron #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsMP", ";Muon #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsPP", ";Pion #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsEP", ";Electron #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsMP", ";Muon #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsPP", ";Pion #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - - if (doPionStudy) { - histos.add("EventTwoTracks/PionsSelection/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassWideITS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassPtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutUS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutUSmuMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutLS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutUSITScut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutLSITScut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hasTOF/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hasTOF/hInvariantMassWidePtCutUS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hasTOF/hInvariantMassWidePtCutLS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hasTOF/hInvariantMassWidePtCutUSmuMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/PionsSelection/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/PionsSelection/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/PionsSelection/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/PionsSelection/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/PionsSelection/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/PionsSelection/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/PionsSelection/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/PionsSelection/hasTOF/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/PionsSelection/hasTOF/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPtvsDcaXY", ";Daughter #it{p_{T}} (GeV/c);Daughter DCA_{XY} (cm)", HistType::kTH2D, {axisPt, axisDCA}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPtvsDcaXYPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter DCA_{XY} (cm)", HistType::kTH2D, {axisPt, axisDCA}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPvsITSclusterSize", ";Average ITS cluster size;Daughter #it{p} (GeV/c)", HistType::kTH2D, {axisAvgITSclsSizes, axisMomSigned}); - histos.add("EventTwoTracks/PionsSelection/hDaughtersPvsITSclusterSizeXcos", ";Average ITS cluster size x cos(#lambda);Daughter #it{p} (GeV/c)", HistType::kTH2D, {axisAvgITSclsSizes, axisMomSigned}); - } - - if (doMuonStudy) { - histos.add("EventTwoTracks/MuonsSelection/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWideITS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassPtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutLS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSITScut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - if (doJpsiMuMuTests) { - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSnegEta", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSposEta", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSnegRap", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSposRap", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap12", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap10", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap08", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap05", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap03", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcNcls70", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcNcls100", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcNxRws70", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcNxRws100", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut1", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut2", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut3", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut4", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut5", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - } - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutLS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSITScut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - if (doJpsiMuMuTests) { - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSnegEta", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSposEta", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSnegRap", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSposRap", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap12", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap10", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap08", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap05", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap03", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcNcls70", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcNcls100", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcNxRws70", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcNxRws100", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut1", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut2", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut3", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut4", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut5", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi1", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi2", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi3", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi4", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi5", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi6", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi7", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi8", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi9", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi10", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi11", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi12", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi13", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi14", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi15", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi16", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi1", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi2", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi3", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi4", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi5", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi6", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi7", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi8", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi9", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi10", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi11", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi12", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi13", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi14", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi15", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi16", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC1", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC2", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC3", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC4", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC5", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC6", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC7", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC8", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC9", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC10", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC11", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC12", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC13", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC14", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC15", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC16", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC1", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC2", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC3", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC4", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC5", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC6", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC7", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC8", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC9", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC10", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC11", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC12", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC13", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC14", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC15", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC16", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - } - histos.add("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutLSITScut", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {axisAcoplanarity}); - histos.add("EventTwoTracks/MuonsSelection/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventTwoTracks/MuonsSelection/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventTwoTracks/MuonsSelection/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/MuonsSelection/hJpsiPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventTwoTracks/MuonsSelection/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventTwoTracks/MuonsSelection/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventTwoTracks/MuonsSelection/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMom, axisMom}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {axisMomWide, axisMomWide}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisPt, axisPt}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {axisPhi, axisPhi}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - if (doJpsiMuMuTests) { - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut1", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut2", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut3", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut4", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut5", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - } - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhi", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - if (doJpsiMuMuTests) { - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut1", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut2", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut3", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut4", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut5", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - } - histos.add("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter fmod(#phi,#pi/9)", HistType::kTH2D, {axisPt, axisModPhi}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {axisRap, axisRap}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsDcaXY", ";Daughter #it{p_{T}} (GeV/c);Daughter DCA_{XY} (cm)", HistType::kTH2D, {axisPt, axisDCA}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPtvsDcaXYPtCut", ";Daughter #it{p_{T}} (GeV/c);Daughter DCA_{XY} (cm)", HistType::kTH2D, {axisPt, axisDCA}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPvsITSclusterSize", ";Average ITS cluster size;Daughter #it{p} (GeV/c)", HistType::kTH2D, {axisAvgITSclsSizes, axisMomSigned}); - histos.add("EventTwoTracks/MuonsSelection/hDaughtersPvsITSclusterSizeXcos", ";Average ITS cluster size x cos(#lambda);Daughter #it{p} (GeV/c)", HistType::kTH2D, {axisAvgITSclsSizes, axisMomSigned}); - histos.add("EventTwoTracks/MuonsSelection/Run2Cuts/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Run2Cuts/hInvariantMassWidePtFitPlot", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/Run2Cuts/hInvariantMassWideCS", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsLP", ";Leading #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsOP", ";Other #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsLP", ";Leading #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsOP", ";Other #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {axisMom, axisTOFsignal}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsLP", ";Leading #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsOP", ";Other #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsLP", ";Leading #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - histos.add("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsOP", ";Other #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {axisMom, axisNsigma}); - } + histos.add("EventTwoTracks/ElectronOther/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventTwoTracks/ElectronOther/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventTwoTracks/ElectronOther/hAcoplanarity", ";#Delta#phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisAcoplanarity}); + histos.add("EventTwoTracks/ElectronOther/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronOther/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronOther/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronOther/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronOther/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronOther/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronOther/hElectronPt", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronOther/hElectronPtWide", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronOther/hDaughtersP", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronOther/hDaughtersPwide", ";Daughter 1 #it{p} (GeV/c);Daughter 2 #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronOther/hDaughtersPt", ";Daughter 1 #it{p_{T}} (GeV/c);Daughter 2 #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronOther/hDaughtersPhi", ";Daughter 1 #phi (rad);Daughter 2 #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronOther/hDaughtersRapidity", ";Daughter 1 #it{y} (-);Daughter 2 #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronOther/hElectronPvsOtherP", ";Electron #it{p} (GeV/c); Other #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisMom}); + histos.add("EventTwoTracks/ElectronOther/hElectronPwideVsOtherPwide", ";Electron #it{p} (GeV/c); Other #it{p} (GeV/c)", HistType::kTH2D, {confAxis.axisMomWide, confAxis.axisMomWide}); + histos.add("EventTwoTracks/ElectronOther/hElectronPtVsOtherPt", ";Electron #it{p_{T}} (GeV/c); Other #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisPt, confAxis.axisPt}); + histos.add("EventTwoTracks/ElectronOther/hElectronPhiVsOtherPhi", ";Electron #phi (rad); Other #phi (rad)", HistType::kTH2D, {confAxis.axisPhi, confAxis.axisPhi}); + histos.add("EventTwoTracks/ElectronOther/hElectronRapVsOtherRap", ";Electron #it{y} (-); Other #it{y} (-)", HistType::kTH2D, {confAxis.axisRap, confAxis.axisRap}); + histos.add("EventTwoTracks/ElectronOther/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/ElectronOther/PID/hTPCsignalVsEP", ";Electron #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/ElectronOther/PID/hTPCsignalVsOP", ";#it{e}/#mu/#pi #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + histos.add("EventTwoTracks/ElectronOther/PID/hTOFsignalVsP", ";Track #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/ElectronOther/PID/hTOFsignalVsEP", ";Electron #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/ElectronOther/PID/hTOFsignalVsOP", ";Other #it{p} (GeV/c);TOF signal (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTOFsignal}); + histos.add("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsEP", ";Electron #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsMP", ";Muon #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsPP", ";Pion #it{p} (GeV/c);n#sigma_{TPC} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsP", ";Track #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsEP", ";Electron #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsMP", ";Muon #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); + histos.add("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsPP", ";Pion #it{p} (GeV/c);n#sigma_{TOF} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisNsigma}); } if (doFourTracks) { - histos.add("EventFourTracks/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventFourTracks/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventFourTracks/hInvariantMassWideNoMothers", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventFourTracks/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventFourTracks/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventFourTracks/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventFourTracks/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventFourTracks/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventFourTracks/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventFourTracks/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - - histos.add("EventFourTracks/WithElectron/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventFourTracks/WithElectron/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventFourTracks/WithElectron/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventFourTracks/WithElectron/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventFourTracks/WithElectron/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventFourTracks/WithElectron/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventFourTracks/WithElectron/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventFourTracks/WithElectron/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventFourTracks/WithElectron/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - - histos.add("EventFourTracks/WithMuon/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventFourTracks/WithMuon/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventFourTracks/WithMuon/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventFourTracks/WithMuon/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventFourTracks/WithMuon/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventFourTracks/WithMuon/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventFourTracks/WithMuon/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventFourTracks/WithMuon/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventFourTracks/WithMuon/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - - histos.add("EventFourTracks/WithPion/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventFourTracks/WithPion/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventFourTracks/WithPion/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventFourTracks/WithPion/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventFourTracks/WithPion/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventFourTracks/WithPion/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventFourTracks/WithPion/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventFourTracks/WithPion/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventFourTracks/WithPion/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - if (doFourTrackPsi2S) { - histos.add("EventFourTracks/MuonsPions/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventFourTracks/MuonsPions/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventFourTracks/MuonsPions/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventFourTracks/MuonsPions/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventFourTracks/MuonsPions/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventFourTracks/MuonsPions/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventFourTracks/MuonsPions/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventFourTracks/MuonsPions/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - - histos.add("EventFourTracks/Psi2StoMuMuPiPi/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventFourTracks/Psi2StoMuMuPiPi/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventFourTracks/Psi2StoMuMuPiPi/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventFourTracks/Psi2StoMuMuPiPi/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventFourTracks/Psi2StoMuMuPiPi/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventFourTracks/Psi2StoMuMuPiPi/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventFourTracks/Psi2StoMuMuPiPi/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventFourTracks/Psi2StoMuMuPiPi/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - - histos.add("EventFourTracks/Psi2StoElElPiPi/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventFourTracks/Psi2StoElElPiPi/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventFourTracks/Psi2StoElElPiPi/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventFourTracks/Psi2StoElElPiPi/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventFourTracks/Psi2StoElElPiPi/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventFourTracks/Psi2StoElElPiPi/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventFourTracks/Psi2StoElElPiPi/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventFourTracks/Psi2StoElElPiPi/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - } + histos.add("EventFourTracks/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventFourTracks/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventFourTracks/hInvariantMassWideNoMothers", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventFourTracks/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventFourTracks/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventFourTracks/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventFourTracks/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventFourTracks/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventFourTracks/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventFourTracks/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + + histos.add("EventFourTracks/WithElectron/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventFourTracks/WithElectron/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventFourTracks/WithElectron/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventFourTracks/WithElectron/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventFourTracks/WithElectron/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventFourTracks/WithElectron/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventFourTracks/WithElectron/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventFourTracks/WithElectron/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventFourTracks/WithElectron/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + + histos.add("EventFourTracks/WithMuon/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventFourTracks/WithMuon/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventFourTracks/WithMuon/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventFourTracks/WithMuon/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventFourTracks/WithMuon/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventFourTracks/WithMuon/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventFourTracks/WithMuon/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventFourTracks/WithMuon/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventFourTracks/WithMuon/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + + histos.add("EventFourTracks/WithPion/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventFourTracks/WithPion/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventFourTracks/WithPion/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventFourTracks/WithPion/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventFourTracks/WithPion/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventFourTracks/WithPion/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventFourTracks/WithPion/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventFourTracks/WithPion/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventFourTracks/WithPion/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); } if (doSixTracks) { - histos.add("EventSixTracks/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventSixTracks/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventSixTracks/hInvariantMassWideNoMothers", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventSixTracks/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventSixTracks/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventSixTracks/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventSixTracks/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventSixTracks/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventSixTracks//hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventSixTracks/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); - - histos.add("EventSixTracks/SixPions/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMass}); - histos.add("EventSixTracks/SixPions/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {axisInvMassWide}); - histos.add("EventSixTracks/SixPions/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMom}); - histos.add("EventSixTracks/SixPions/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {axisMomWide}); - histos.add("EventSixTracks/SixPions/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {axisPt}); - histos.add("EventSixTracks/SixPions/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {axisPhi}); - histos.add("EventSixTracks/SixPions/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {axisRap}); - histos.add("EventSixTracks/SixPions/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {axisInvMassWide, axisPt}); - histos.add("EventSixTracks/SixPions/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {axisMom, axisTPCdEdx}); + histos.add("EventSixTracks/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventSixTracks/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventSixTracks/hInvariantMassWideNoMothers", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventSixTracks/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventSixTracks/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventSixTracks/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventSixTracks/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventSixTracks/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventSixTracks/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventSixTracks/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + + histos.add("EventSixTracks/SixPions/hInvariantMass", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMass}); + histos.add("EventSixTracks/SixPions/hInvariantMassWide", ";Invariant mass (GeV/c^{2});Number of events (-)", HistType::kTH1D, {confAxis.axisInvMassWide}); + histos.add("EventSixTracks/SixPions/hMotherP", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("EventSixTracks/SixPions/hMotherPwide", ";Mother #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMomWide}); + histos.add("EventSixTracks/SixPions/hMotherPt", ";Mother #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("EventSixTracks/SixPions/hMotherPhi", ";Mother #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("EventSixTracks/SixPions/hMotherRapidity", ";Mother #it{y} (-);Number of events (-)", HistType::kTH1D, {confAxis.axisRap}); + histos.add("EventSixTracks/SixPions/hMotherMassVsPt", ";Invariant mass (GeV/c^{2});Mother #it{p_{T}} (GeV/c)", HistType::kTH2D, {confAxis.axisInvMassWide, confAxis.axisPt}); + histos.add("EventSixTracks/SixPions/PID/hTPCsignalVsP", ";Track #it{p} (GeV/c);TPC d#it{E}/d#it{x} (arb. units)", HistType::kTH2D, {confAxis.axisMom, confAxis.axisTPCdEdx}); + } + + if (doTruthHistos) { + histos.add("Events/Truth/hCountCollisions", ";;Number of generated collision (-)", HistType::kTH1D, {{1, 0.5, 1.5}}); + histos.add("Events/Truth/hChannels", ";Channels (-);Number of events (-)", HistType::kTH1D, {{confAxis.axisChannels}}); + histos.add("Events/Truth/hPDGcodesAll", ";PDG codes of all particles (-);Number of events (-)", HistType::kTH1D, {{2001, -1000, 1000}}); + histos.add("Events/Truth/hPDGcodesNoMother", ";PDG codes of particles without mother (-);Number of events (-)", HistType::kTH1D, {{2001, -1000, 1000}}); + histos.add("Events/Truth/hPDGcodesTauDaughters", ";PDG codes of daughters of particles without mother (-);Number of events (-)", HistType::kTH1D, {{2001, -1000, 1000}}); + histos.add("Events/Truth/hNparticles", ";Number of particles in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNparticles}); + histos.add("Events/Truth/hNtauDaughters", ";Number of daughters of no-mother particle in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNparticles}); + histos.add("Events/Truth/hNelectrons", ";Number of electrons in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNparticles}); + histos.add("Events/Truth/hNmuons", ";Number of muons in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNparticles}); + histos.add("Events/Truth/hNpions", ";Number of pions in a collision (-);Number of events (-)", HistType::kTH1D, {confAxis.axisNparticles}); + histos.add("Events/Truth/hNphysPartVsNwoutMotherParts", ";Number of physical primary particles (-);Number of particles without mother(-)", HistType::kTH2D, {confAxis.axisNparticles, confAxis.axisNparticles}); + histos.add("Tracks/Truth/hTauP", ";Tau #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("Tracks/Truth/hTauPt", ";Tau #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("Tracks/Truth/hTauPhi", ";Tau #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("Tracks/Truth/hTauEta", ";Tau #eta (-);Number of events (-)", HistType::kTH1D, {confAxis.axisEta}); + histos.add("Tracks/Truth/hElectronP", ";Electron #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("Tracks/Truth/hElectronPt", ";Electron #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("Tracks/Truth/hElectronPhi", ";Electron #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("Tracks/Truth/hElectronEta", ";Electron #eta (-);Number of events (-)", HistType::kTH1D, {confAxis.axisEta}); + histos.add("Tracks/Truth/hMuonP", ";Muon #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("Tracks/Truth/hMuonPt", ";Muon #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("Tracks/Truth/hMuonPhi", ";Muon #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("Tracks/Truth/hMuonEta", ";Muon #eta (-);Number of events (-)", HistType::kTH1D, {confAxis.axisEta}); + histos.add("Tracks/Truth/hPionP", ";Pion #it{p} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisMom}); + histos.add("Tracks/Truth/hPionPt", ";Pion #it{p_{T}} (GeV/c);Number of events (-)", HistType::kTH1D, {confAxis.axisPt}); + histos.add("Tracks/Truth/hPionPhi", ";Pion #phi (rad);Number of events (-)", HistType::kTH1D, {confAxis.axisPhi}); + histos.add("Tracks/Truth/hPionEta", ";Pion #eta (-);Number of events (-)", HistType::kTH1D, {confAxis.axisEta}); } } // end init @@ -821,7 +695,6 @@ struct UpcTauCentralBarrelRL { if (verboseInfo) printLargeMessage("RUN METHOD"); - printDebugMessage(Form("countCollisions = %d", countCollisions)); } // end run @@ -872,43 +745,43 @@ struct UpcTauCentralBarrelRL { bool isGlobalTrackReinstatement(T const& track) { // kInAcceptance copy - if (track.pt() < cutMyGTptMin || track.pt() > cutMyGTptMax) + if (track.pt() < cutGlobalTrack.cutMinPt || track.pt() > cutGlobalTrack.cutMaxPt) return false; - if (eta(track.px(), track.py(), track.pz()) < cutMyGTetaMin || eta(track.px(), track.py(), track.pz()) > cutMyGTetaMax) + if (eta(track.px(), track.py(), track.pz()) < cutGlobalTrack.cutMinEta || eta(track.px(), track.py(), track.pz()) > cutGlobalTrack.cutMaxEta) return false; // kPrimaryTracks // GoldenChi2 cut is only for Run 2 - if (abs(track.dcaZ()) > cutMyGTdcaZmax) + if (std::abs(track.dcaZ()) > cutGlobalTrack.cutMaxDCAz) return false; - if (cutMyGTdcaXYusePt) { - float maxDCA = 0.0105f + 0.0350f / pow(track.pt(), 1.1f); // ? not sure yet if will be used - if (abs(track.dcaXY()) > maxDCA) + if (cutGlobalTrack.applyPtDependentDCAxy) { + float maxDCA = 0.0182f + 0.0350f / std::pow(track.pt(), 1.01f); + if (std::abs(track.dcaXY()) > maxDCA) return false; } else { - if (abs(track.dcaXY()) > cutMyGTdcaXYmax) + if (std::abs(track.dcaXY()) > cutGlobalTrack.cutMaxDCAxy) return false; } // kQualityTrack // TrackType is always 1 as per definition of processed Run3 AO2Ds // ITS - if (cutMyHasITS && !track.hasITS()) + if (cutGlobalTrack.cutHasITS && !track.hasITS()) return false; // ITS refit - if (track.itsNCls() < cutMyGTitsNClsMin) + if (track.itsNCls() < cutGlobalTrack.cutMinITSnCls) return false; - if (track.itsChi2NCl() > cutMyGTitsChi2NclMax) + if (track.itsChi2NCl() > cutGlobalTrack.cutMaxITSchi2) return false; if (!isFulfillsITSHitRequirementsReinstatement(track.itsClusterMap())) return false; // TPC - if (cutMyHasTPC && !track.hasTPC()) + if (cutGlobalTrack.cutHasTPC && !track.hasTPC()) return false; // TPC refit - if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < cutMyGTtpcNClsMin) + if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < cutGlobalTrack.cutMinTPCnCls) return false; // tpcNClsFound() - if (track.tpcNClsCrossedRows() < cutMyGTtpcNClsCrossedRowsMin) + if (track.tpcNClsCrossedRows() < cutGlobalTrack.cutMinTPCnClsXrows) return false; - if ((static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable())) < cutMyGTtpcNClsCrossedRowsOverNClsMin) + if ((static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable())) < cutGlobalTrack.cutMinTPCnClsXrowsOverNcls) return false; - if (track.tpcChi2NCl() > cutMyGTtpcChi2NclMax) + if (track.tpcChi2NCl() > cutGlobalTrack.cutMaxTPCchi2) return false; // TPC chi2 return true; @@ -921,10 +794,10 @@ struct UpcTauCentralBarrelRL { if (eta(track.px(), track.py(), track.pz()) < -0.8 || eta(track.px(), track.py(), track.pz()) > 0.8) return false; // kPrimaryTracks - if (abs(track.dcaZ()) > 2.0) + if (std::abs(track.dcaZ()) > 2.0) return false; - float maxDCA = 0.0105f + 0.0350f / pow(track.pt(), 1.1f); - if (abs(track.dcaXY()) > maxDCA) + float maxDCA = 0.0105f + 0.0350f / std::pow(track.pt(), 1.1f); + if (std::abs(track.dcaXY()) > maxDCA) return false; // kQualityTrack // ITS @@ -984,74 +857,66 @@ struct UpcTauCentralBarrelRL { return std::fmod(phimodn, o2::constants::math::PI / 9.0); } - bool isNotCloseToTPCBorder(float phimodn, float trackpt, float cutWidth) + template + bool isGoodFITtime(C const& coll, float maxFITtime) { - funcPhiCutL = new TF1("funcPhiCutL", Form("0.06/x+pi/18.0-%.f", cutWidth), 0, 100); - funcPhiCutH = new TF1("funcPhiCutH", Form("0.1/x+pi/18.0+%.f", cutWidth), 0, 100); + // FTOA + if ((std::abs(coll.timeFT0A()) > maxFITtime) && coll.timeFT0A() > -998.) + return false; - if (phimodn < funcPhiCutH->Eval(trackpt) && phimodn > funcPhiCutL->Eval(trackpt)) - return false; // reject track + // FTOC + if ((std::abs(coll.timeFT0C()) > maxFITtime) && coll.timeFT0A() > -998.) + return false; return true; } template - int whatPsi2Schannel(T const& trkDaug1, T const& trkDaug2, T const& trkDaug3, T const& trkDaug4, std::vector& vecPIDidx) + bool selectedGoodElectron(T const& electronCandidate) { - TLorentzVector jpsi, daug[4]; - daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); - daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); - daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); - // Find index of the two largest values - std::vector> vecPts; - for (int i = 0; i < 4; i++) { - vecPts.push_back(std::make_pair(static_cast(daug[i].Pt()), i)); - } - sort(vecPts.begin(), vecPts.end()); - int idx1L = vecPts[vecPts.size() - 1].second; - int idx2L = vecPts[vecPts.size() - 2].second; - int idx3L = vecPts[vecPts.size() - 3].second; - int idx4L = vecPts[vecPts.size() - 4].second; - // Create the jpsi - jpsi = daug[idx1L] + daug[idx2L]; - // The two smallest-pT tracks should be pions - if ((vecPIDidx[idx3L] == P_MUON || vecPIDidx[idx3L] == P_PION) && (vecPIDidx[idx4L] == P_MUON || vecPIDidx[idx4L] == P_PION)) { - // Branch into Jpsi to mumu and Jpsi to elel - if ((vecPIDidx[idx1L] == P_MUON || vecPIDidx[idx1L] == P_PION) && (vecPIDidx[idx2L] == P_MUON || vecPIDidx[idx2L] == P_PION)) { - // Is jpsi mass? - if (jpsi.M() < 2.9 || jpsi.M() > 3.3) - return 0; // Not Psi2S - return 1; - } else if (vecPIDidx[idx1L] == P_ELECTRON && vecPIDidx[idx2L] == P_ELECTRON) { - // Is jpsi mass? - if (jpsi.M() < 2.75 || jpsi.M() > 3.3) - return 0; // Not Psi2S - return 2; - } else { - return 0; // Not Psi2S - } - } else { - return 0; // Not Psi2S - } + if (cutTauEvent.cutElectronHasTOF && !electronCandidate.hasTOF()) + return false; + if (electronCandidate.tpcNSigmaEl() < cutTauEvent.cutMaxElectronNsigma || electronCandidate.tpcNSigmaEl() > cutTauEvent.cutMinElectronNsigma) + return false; + if (electronCandidate.tpcNSigmaPi() > cutTauEvent.cutMaxElectronPiNsigma && electronCandidate.tpcNSigmaPi() < cutTauEvent.cutMinElectronPiNsigma) + return false; + return true; } - template - void fillHistograms(C reconstructedCollision, Ts reconstructedBarrelTracks) + template + bool selectedTauEvent(T const& trkDaug1, T const& trkDaug2) { + TLorentzVector mother, daug[2], motherOfPions, pion[2]; + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + mother = daug[0] + daug[1]; + pion[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(kPiPlus), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + pion[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(kPiMinus), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + motherOfPions = pion[0] + pion[1]; + if (cutTauEvent.cutOppositeCharge && (trkDaug1.sign() * trkDaug2.sign() > 0)) + return false; + if (calculateAcoplanarity(daug[0].Phi(), daug[1].Phi()) > cutTauEvent.cutAcoplanarity) + return false; + bool goodElectron = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? selectedGoodElectron(trkDaug1) : selectedGoodElectron(trkDaug2); + if (cutTauEvent.cutGoodElectron && !goodElectron) + return false; + if (cutTauEvent.cutOutRho && (motherOfPions.M() > cutTauEvent.cutMinRhoMass && motherOfPions.M() < cutTauEvent.cutMaxRhoMass)) + return false; + if (cutTauEvent.cutOnRho && (motherOfPions.M() > cutTauEvent.cutMaxRhoMass || motherOfPions.M() < cutTauEvent.cutMinRhoMass)) + return false; + return true; + } - if (isFirstReconstructedCollisions) { - isFirstReconstructedCollisions = false; - if (verboseInfo) - printLargeMessage("START LOOPING OVER RECONSTRUCTED COLLISIONS"); - } + template + void fillHistograms(Ts const& reconstructedBarrelTracks) + { histos.get(HIST("Events/hCountCollisions"))->Fill(1); histos.get(HIST("Events/hNreconstructedTracks"))->Fill(reconstructedBarrelTracks.size()); // Loop over tracks without selections - for (auto& track : reconstructedBarrelTracks) { + for (const auto& track : reconstructedBarrelTracks) { float trkPx = track.px(); float trkPy = track.py(); float trkPz = track.pz(); @@ -1081,20 +946,14 @@ struct UpcTauCentralBarrelRL { int countPVGTmuons = 0; int countPVGTpions = 0; int countPVGTothers = 0; - int countPVGTpionsSelection = 0; - int countPVGTmuonsSelection = 0; int countTOFtracks = 0; - int countTPCcls70 = 0; - int countTPCcls100 = 0; - int countTPCxRws70 = 0; - int countTPCxRws100 = 0; std::vector vecPVidx; std::vector vecPIDidx; // Loop over tracks with selections - for (auto& track : reconstructedBarrelTracks) { - if (track.isPVContributor() != 1) + for (const auto& track : reconstructedBarrelTracks) { + if (!track.isPVContributor()) continue; - if (cutMyGlobalTracksOnly) { + if (cutGlobalTrack.applyGlobalTrackSelection) { if (isGlobalTrackReinstatement(track) != 1) continue; } @@ -1122,15 +981,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("Tracks/GoodTrack/TPC/tpcChi2NCl"))->Fill(track.tpcChi2NCl()); if (track.hasTOF()) countTOFtracks++; - if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) > 70) - countTPCcls70++; - if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) > 100) - countTPCcls100++; - if (track.tpcNClsCrossedRows() > 70) - countTPCxRws70++; - if (track.tpcNClsCrossedRows() > 100) - countTPCxRws100++; - int hypothesisID = testPIDhypothesis(track, cutMyNsigmaTPCPIDselector, cutMyNsigmaTOFPIDselector, usePIDwithTOF, usePIDwithTOFsigmaAfterTPC); + int hypothesisID = testPIDhypothesis(track, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC); vecPIDidx.push_back(hypothesisID); if (hypothesisID == P_ELECTRON || hypothesisID == P_MUON || hypothesisID == P_PION) { countPVGTselected++; @@ -1145,10 +996,6 @@ struct UpcTauCentralBarrelRL { } else { countPVGTothers++; } - if (abs(track.tpcNSigmaPi()) < cutMyTPCnSigmaPi) - countPVGTpionsSelection++; - if (abs(track.tpcNSigmaMu()) < cutMyTPCnSigmaMu) - countPVGTmuonsSelection++; } // Loop over tracks with selections @@ -1163,26 +1010,18 @@ struct UpcTauCentralBarrelRL { TLorentzVector mother, daug[2], motherOfPions, pion[2], motherOfMuons, muon[2]; const auto& trkDaug1 = reconstructedBarrelTracks.iteratorAt(vecPVidx[0]); const auto& trkDaug2 = reconstructedBarrelTracks.iteratorAt(vecPVidx[1]); - daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); mother = daug[0] + daug[1]; - pion[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(211), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - pion[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(211), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + pion[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(kPiPlus), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + pion[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(kPiMinus), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); motherOfPions = pion[0] + pion[1]; - muon[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(13), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - muon[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(13), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + muon[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(kMuonPlus), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + muon[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(kMuonMinus), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); motherOfMuons = muon[0] + muon[1]; - auto acoplanarity = calculateAcoplanarity(daug[0].Phi(), daug[1].Phi()); - auto sign = trkDaug1.sign() * trkDaug2.sign(); - bool passAvgITSclsSizesCut = passITSAvgClsSizesLowMomCut(trkDaug1, cutAvgITSclusterSize, cutPtAvgITSclusterSize) && passITSAvgClsSizesLowMomCut(trkDaug2, cutAvgITSclusterSize, cutPtAvgITSclusterSize); - if (applyTauEventSelection) { - if (sign > 0) - return; - if (acoplanarity > 4 * o2::constants::math::PI / 5) - return; // max opening angle 144 degrees (I hope, check) - // if (daug[0].Pt() < 0.2 || daug[1].Pt() < 0.2) return; - // if (motherOfPions.M() > 0.55 || motherOfPions.M() < 1.05) return; - // if (!trkDaug1.hasTOF() || !trkDaug2.hasTOF()) return; + const auto acoplanarity = calculateAcoplanarity(daug[0].Phi(), daug[1].Phi()); + if (cutTauEvent.applyTauEventSelection && !selectedTauEvent(trkDaug1, trkDaug2)) { + return; } histos.get(HIST("EventTwoTracks/hInvariantMass"))->Fill(mother.M()); @@ -1202,16 +1041,10 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); if (motherOfPions.Pt() < 0.2) { histos.get(HIST("EventTwoTracks/hInvariantMassWideAllPionMassPtCut"))->Fill(motherOfPions.M()); - if (passAvgITSclsSizesCut) { - histos.get(HIST("EventTwoTracks/hInvariantMassWideAllPionMassPtCutITScut"))->Fill(motherOfPions.M()); - } } if (countTOFtracks == 2) { histos.get(HIST("EventTwoTracks/hInvariantMassWideAllPionMassTOF"))->Fill(motherOfPions.M()); } - if (passAvgITSclsSizesCut) { - histos.get(HIST("EventTwoTracks/hInvariantMassWideAllPionMassITScut"))->Fill(motherOfPions.M()); - } histos.get(HIST("EventTwoTracks/hDaughtersPvsITSclusterSize"))->Fill(getAvgITSClSize(trkDaug1), trkDaug1.sign() * daug[0].P()); histos.get(HIST("EventTwoTracks/hDaughtersPvsITSclusterSize"))->Fill(getAvgITSClSize(trkDaug2), trkDaug2.sign() * daug[1].P()); histos.get(HIST("EventTwoTracks/hDaughtersPvsITSclusterSizeXcos"))->Fill(getAvgITSClSize(trkDaug1) * getCosLambda(trkDaug1), trkDaug1.sign() * daug[0].P()); @@ -1219,7 +1052,7 @@ struct UpcTauCentralBarrelRL { // ee, mm, em, pp, ep, mp, pppp, eppp, mppp, pppppp if (countPVGTelectrons == 2) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(0); + histos.get(HIST("Events/hChannels"))->Fill(CH_EE); histos.get(HIST("EventTwoTracks/TwoElectrons/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/TwoElectrons/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/TwoElectrons/hAcoplanarity"))->Fill(acoplanarity); @@ -1261,7 +1094,7 @@ struct UpcTauCentralBarrelRL { } } if (countPVGTmuons == 2) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(1); + histos.get(HIST("Events/hChannels"))->Fill(CH_MUMU); histos.get(HIST("EventTwoTracks/TwoMuons/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/TwoMuons/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/TwoMuons/hAcoplanarity"))->Fill(acoplanarity); @@ -1293,7 +1126,7 @@ struct UpcTauCentralBarrelRL { } } if (countPVGTelectrons == 1 && countPVGTmuons == 1) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(2); + histos.get(HIST("Events/hChannels"))->Fill(CH_EMU); histos.get(HIST("EventTwoTracks/ElectronMuon/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/ElectronMuon/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/ElectronMuon/hAcoplanarity"))->Fill(acoplanarity); @@ -1310,7 +1143,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/ElectronMuon/hDaughtersRapidity"))->Fill(daug[0].Rapidity(), daug[1].Rapidity()); } if (countPVGTpions == 2) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(3); + histos.get(HIST("Events/hChannels"))->Fill(CH_PIPI); histos.get(HIST("EventTwoTracks/TwoPions/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/TwoPions/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/TwoPions/hAcoplanarity"))->Fill(acoplanarity); @@ -1342,7 +1175,7 @@ struct UpcTauCentralBarrelRL { } } if (countPVGTelectrons == 1 && countPVGTpions == 1) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(4); + histos.get(HIST("Events/hChannels"))->Fill(CH_EPI); histos.get(HIST("EventTwoTracks/ElectronPion/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/ElectronPion/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/ElectronPion/hAcoplanarity"))->Fill(acoplanarity); @@ -1359,7 +1192,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/ElectronPion/hDaughtersRapidity"))->Fill(daug[0].Rapidity(), daug[1].Rapidity()); } if (countPVGTpions == 1 && countPVGTmuons == 1) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(5); + histos.get(HIST("Events/hChannels"))->Fill(CH_MUPI); histos.get(HIST("EventTwoTracks/MuonPion/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/MuonPion/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/MuonPion/hAcoplanarity"))->Fill(acoplanarity); @@ -1379,9 +1212,12 @@ struct UpcTauCentralBarrelRL { } } if ((countPVGTelectrons == 1 && countPVGTmuons == 1) || (countPVGTelectrons == 1 && countPVGTpions == 1)) { - double electronPt = (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + double electronPt = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + histos.get(HIST("Events/hChannels"))->Fill(CH_EMUPI); histos.get(HIST("EventTwoTracks/ElectronMuPi/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hInvariantMassWide"))->Fill(mother.M()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PionsSelection/hInvariantMass"))->Fill(motherOfPions.M()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PionsSelection/hInvariantMassWide"))->Fill(motherOfPions.M()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hAcoplanarity"))->Fill(acoplanarity); histos.get(HIST("EventTwoTracks/ElectronMuPi/hMotherP"))->Fill(mother.P()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hMotherPwide"))->Fill(mother.P()); @@ -1396,11 +1232,11 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/ElectronMuPi/hDaughtersPt"))->Fill(daug[0].Pt(), daug[1].Pt()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hDaughtersPhi"))->Fill(daug[0].Phi(), daug[1].Phi()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hDaughtersRapidity"))->Fill(daug[0].Rapidity(), daug[1].Rapidity()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPvsOtherP"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].P() : daug[1].P(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].P() : daug[0].P()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPwideVsOtherPwide"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].P() : daug[1].P(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].P() : daug[0].P()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPtVsOtherPt"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].Pt() : daug[0].Pt()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPhiVsOtherPhi"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Phi() : daug[1].Phi(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].Phi() : daug[0].Phi()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronRapVsOtherRap"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Rapidity() : daug[1].Rapidity(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].Rapidity() : daug[0].Rapidity()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPvsOtherP"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].P() : daug[1].P(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].P() : daug[0].P()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPwideVsOtherPwide"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].P() : daug[1].P(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].P() : daug[0].P()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPtVsOtherPt"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].Pt() : daug[0].Pt()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPhiVsOtherPhi"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Phi() : daug[1].Phi(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].Phi() : daug[0].Phi()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronRapVsOtherRap"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Rapidity() : daug[1].Rapidity(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].Rapidity() : daug[0].Rapidity()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hNeventsPtCuts"))->Fill(0); if (mother.Pt() < 9.) histos.get(HIST("EventTwoTracks/ElectronMuPi/hNeventsPtCuts"))->Fill(1); @@ -1428,7 +1264,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/ElectronMuPi/hNeventsPtCuts"))->Fill(12); } if ((countPVGTelectrons == 2) || (countPVGTelectrons == 1 && countPVGTmuons == 1) || (countPVGTelectrons == 1 && countPVGTpions == 1)) { - double electronPt = (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + double electronPt = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); if (countPVGTelectrons == 2) electronPt = (daug[0].Pt() > daug[1].Pt()) ? daug[0].Pt() : daug[1].Pt(); histos.get(HIST("EventTwoTracks/ElectronOther/hInvariantMass"))->Fill(mother.M()); @@ -1454,11 +1290,11 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPhiVsOtherPhi"))->Fill(((daug[0].P() > daug[1].P()) ? daug[0].Phi() : daug[1].Phi()), ((daug[0].P() > daug[1].P()) ? daug[1].Phi() : daug[0].Phi())); histos.get(HIST("EventTwoTracks/ElectronOther/hElectronRapVsOtherRap"))->Fill(((daug[0].P() > daug[1].P()) ? daug[0].Rapidity() : daug[1].Rapidity()), ((daug[0].P() > daug[1].P()) ? daug[1].Rapidity() : daug[0].Rapidity())); } else { - histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPvsOtherP"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].P() : daug[1].P(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].P() : daug[0].P()); - histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPwideVsOtherPwide"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].P() : daug[1].P(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].P() : daug[0].P()); - histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPtVsOtherPt"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].Pt() : daug[0].Pt()); - histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPhiVsOtherPhi"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Phi() : daug[1].Phi(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].Phi() : daug[0].Phi()); - histos.get(HIST("EventTwoTracks/ElectronOther/hElectronRapVsOtherRap"))->Fill((enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Rapidity() : daug[1].Rapidity(), (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[1].Rapidity() : daug[0].Rapidity()); + histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPvsOtherP"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].P() : daug[1].P(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].P() : daug[0].P()); + histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPwideVsOtherPwide"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].P() : daug[1].P(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].P() : daug[0].P()); + histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPtVsOtherPt"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].Pt() : daug[0].Pt()); + histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPhiVsOtherPhi"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Phi() : daug[1].Phi(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].Phi() : daug[0].Phi()); + histos.get(HIST("EventTwoTracks/ElectronOther/hElectronRapVsOtherRap"))->Fill((enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Rapidity() : daug[1].Rapidity(), (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[1].Rapidity() : daug[0].Rapidity()); } histos.get(HIST("EventTwoTracks/ElectronOther/hNeventsPtCuts"))->Fill(0); if (mother.Pt() < 9.) @@ -1486,410 +1322,6 @@ struct UpcTauCentralBarrelRL { if (electronPt > 2. && electronPt < 100.) histos.get(HIST("EventTwoTracks/ElectronOther/hNeventsPtCuts"))->Fill(12); } - if (countPVGTpionsSelection == 2 && doPionStudy) { - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMass"))->Fill(motherOfPions.M()); - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassWide"))->Fill(motherOfPions.M()); - histos.get(HIST("EventTwoTracks/PionsSelection/hAcoplanarity"))->Fill(acoplanarity); - histos.get(HIST("EventTwoTracks/PionsSelection/hMotherP"))->Fill(motherOfPions.P()); - histos.get(HIST("EventTwoTracks/PionsSelection/hMotherPwide"))->Fill(motherOfPions.P()); - histos.get(HIST("EventTwoTracks/PionsSelection/hMotherPt"))->Fill(motherOfPions.Pt()); - histos.get(HIST("EventTwoTracks/PionsSelection/hMotherPhi"))->Fill(motherOfPions.Phi()); - histos.get(HIST("EventTwoTracks/PionsSelection/hMotherRapidity"))->Fill(motherOfPions.Rapidity()); - histos.get(HIST("EventTwoTracks/PionsSelection/hMotherMassVsPt"))->Fill(motherOfPions.M(), motherOfPions.Pt()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersP"))->Fill(pion[0].P(), pion[1].P()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPwide"))->Fill(pion[0].P(), pion[1].P()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPt"))->Fill(pion[0].Pt(), pion[1].Pt()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPhi"))->Fill(pion[0].Phi(), pion[1].Phi()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersRapidity"))->Fill(pion[0].Rapidity(), pion[1].Rapidity()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPtvsDcaXY"))->Fill(trkDaug1.pt(), trkDaug1.dcaXY()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPtvsDcaXY"))->Fill(trkDaug2.pt(), trkDaug2.dcaXY()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPtvsModPhi"))->Fill(pion[0].Pt(), getPhiModN(pion[0].Phi(), trkDaug1.sign(), 1)); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPtvsModPhi"))->Fill(pion[1].Pt(), getPhiModN(pion[1].Phi(), trkDaug2.sign(), 1)); - if (motherOfPions.Pt() < 0.2) { - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassPtCut"))->Fill(motherOfPions.M()); - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassWidePtCut"))->Fill(motherOfPions.M()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPtvsModPhiPtCut"))->Fill(pion[0].Pt(), getPhiModN(pion[0].Phi(), trkDaug1.sign(), 1)); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPtvsModPhiPtCut"))->Fill(pion[1].Pt(), getPhiModN(pion[1].Phi(), trkDaug2.sign(), 1)); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPtvsDcaXYPtCut"))->Fill(trkDaug1.pt(), trkDaug1.dcaXY()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPtvsDcaXYPtCut"))->Fill(trkDaug2.pt(), trkDaug2.dcaXY()); - if (sign < 0) { - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutUS"))->Fill(motherOfPions.M()); - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutUSmuMass"))->Fill(motherOfMuons.M()); - } - if (sign > 0) - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutLS"))->Fill(motherOfPions.M()); - if (countTOFtracks == 2) { - if (sign < 0) { - histos.get(HIST("EventTwoTracks/PionsSelection/hasTOF/hInvariantMassWidePtCutUS"))->Fill(motherOfPions.M()); - histos.get(HIST("EventTwoTracks/PionsSelection/hasTOF/hInvariantMassWidePtCutUSmuMass"))->Fill(motherOfMuons.M()); - } - if (sign > 0) - histos.get(HIST("EventTwoTracks/PionsSelection/hasTOF/hInvariantMassWidePtCutLS"))->Fill(motherOfPions.M()); - } - if (passAvgITSclsSizesCut) { - if (sign < 0) - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutUSITScut"))->Fill(motherOfPions.M()); - if (sign > 0) - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassWidePtCutLSITScut"))->Fill(motherOfPions.M()); - } - if (countTOFtracks == 2) { - histos.get(HIST("EventTwoTracks/PionsSelection/hasTOF/hDaughtersPtvsModPhiPtCut"))->Fill(pion[0].Pt(), getPhiModN(pion[0].Phi(), trkDaug1.sign(), 1)); - histos.get(HIST("EventTwoTracks/PionsSelection/hasTOF/hDaughtersPtvsModPhiPtCut"))->Fill(pion[1].Pt(), getPhiModN(pion[1].Phi(), trkDaug2.sign(), 1)); - } - } - if (countTOFtracks == 2) { - histos.get(HIST("EventTwoTracks/PionsSelection/hasTOF/hInvariantMassWide"))->Fill(motherOfPions.M()); - histos.get(HIST("EventTwoTracks/PionsSelection/hasTOF/hDaughtersPtvsModPhi"))->Fill(pion[0].Pt(), getPhiModN(pion[0].Phi(), trkDaug1.sign(), 1)); - histos.get(HIST("EventTwoTracks/PionsSelection/hasTOF/hDaughtersPtvsModPhi"))->Fill(pion[1].Pt(), getPhiModN(pion[1].Phi(), trkDaug2.sign(), 1)); - } - if (passAvgITSclsSizesCut) { - histos.get(HIST("EventTwoTracks/PionsSelection/hInvariantMassWideITS"))->Fill(motherOfPions.M()); - } - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPvsITSclusterSize"))->Fill(getAvgITSClSize(trkDaug1), trkDaug1.sign() * daug[0].P()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPvsITSclusterSize"))->Fill(getAvgITSClSize(trkDaug2), trkDaug2.sign() * daug[1].P()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPvsITSclusterSizeXcos"))->Fill(getAvgITSClSize(trkDaug1) * getCosLambda(trkDaug1), trkDaug1.sign() * daug[0].P()); - histos.get(HIST("EventTwoTracks/PionsSelection/hDaughtersPvsITSclusterSizeXcos"))->Fill(getAvgITSClSize(trkDaug2) * getCosLambda(trkDaug2), trkDaug2.sign() * daug[1].P()); - } - if (countPVGTmuonsSelection == 2 && doMuonStudy) { - float phiModNtrk1 = getPhiModN(muon[0].Phi(), trkDaug1.sign(), 1); - float phiModNtrk2 = getPhiModN(muon[1].Phi(), trkDaug2.sign(), 1); - float cutPhiModN1 = 0.01; - float cutPhiModN2 = 0.03; - float cutPhiModN3 = 0.06; - float cutPhiModN4 = 0.1; - float cutPhiModN5 = 0.2; - float phiPos = 0.; - float phiNeg = 0.; - if (trkDaug1.sign() > 0) { - phiPos = muon[0].Phi(); - phiNeg = muon[1].Phi(); - } else { - phiPos = muon[1].Phi(); - phiNeg = muon[0].Phi(); - } - float phiPosTPC = phiPos - o2::math_utils::angle2Alpha(phiPos); - float phiNegTPC = phiNeg - o2::math_utils::angle2Alpha(phiNeg); - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMass"))->Fill(motherOfMuons.M()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWide"))->Fill(motherOfMuons.M()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hAcoplanarity"))->Fill(acoplanarity); - histos.get(HIST("EventTwoTracks/MuonsSelection/hMotherP"))->Fill(motherOfMuons.P()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hMotherPwide"))->Fill(motherOfMuons.P()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hMotherPt"))->Fill(motherOfMuons.Pt()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hMotherPhi"))->Fill(motherOfMuons.Phi()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hMotherRapidity"))->Fill(motherOfMuons.Rapidity()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersP"))->Fill(muon[0].P(), muon[1].P()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPwide"))->Fill(muon[0].P(), muon[1].P()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPt"))->Fill(muon[0].Pt(), muon[1].Pt()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPhi"))->Fill(muon[0].Phi(), muon[1].Phi()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersRapidity"))->Fill(muon[0].Rapidity(), muon[1].Rapidity()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsDcaXY"))->Fill(trkDaug1.pt(), trkDaug1.dcaXY()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsDcaXY"))->Fill(trkDaug2.pt(), trkDaug2.dcaXY()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhi"))->Fill(muon[0].Pt(), phiModNtrk1); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhi"))->Fill(muon[1].Pt(), phiModNtrk2); - histos.get(HIST("EventTwoTracks/MuonsSelection/hMotherMassVsPt"))->Fill(motherOfMuons.M(), motherOfMuons.Pt()); - if (motherOfMuons.M() > 2.9 && motherOfMuons.M() < 3.2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hJpsiPt"))->Fill(motherOfMuons.Pt()); - if (doJpsiMuMuTests) { - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN1)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut1"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN1)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut1"))->Fill(muon[1].Pt(), phiModNtrk2); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN2)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut2"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN2)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut2"))->Fill(muon[1].Pt(), phiModNtrk2); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN3)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut3"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN3)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut3"))->Fill(muon[1].Pt(), phiModNtrk2); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN4)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut4"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN4)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut4"))->Fill(muon[1].Pt(), phiModNtrk2); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN5)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut5"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN5)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiTPCbordersCut5"))->Fill(muon[1].Pt(), phiModNtrk2); - } - if (motherOfMuons.Pt() < 0.2) { - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassPtCut"))->Fill(motherOfMuons.M()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCut"))->Fill(motherOfMuons.M()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiPtCut"))->Fill(muon[0].Pt(), phiModNtrk1); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsModPhiPtCut"))->Fill(muon[1].Pt(), phiModNtrk2); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsDcaXYPtCut"))->Fill(trkDaug1.pt(), trkDaug1.dcaXY()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPtvsDcaXYPtCut"))->Fill(trkDaug2.pt(), trkDaug2.dcaXY()); - if (sign < 0) { - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUS"))->Fill(motherOfMuons.M()); - if (doJpsiMuMuTests) { - if (muon[0].Eta() < 0.0 && muon[1].Eta() < 0.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSnegEta"))->Fill(motherOfMuons.M()); - if (muon[0].Eta() > 0.0 && muon[1].Eta() > 0.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSposEta"))->Fill(motherOfMuons.M()); - if (motherOfMuons.Rapidity() < 0.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSnegRap"))->Fill(motherOfMuons.M()); - if (motherOfMuons.Rapidity() > 0.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSposRap"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 1.2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap12"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 1.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap10"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 0.8) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap08"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 0.5) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap05"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 0.3) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSrap03"))->Fill(motherOfMuons.M()); - if (countTPCcls70 == 2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcNcls70"))->Fill(motherOfMuons.M()); - if (countTPCcls100 == 2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcNcls100"))->Fill(motherOfMuons.M()); - if (countTPCxRws70 == 2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcNxRws70"))->Fill(motherOfMuons.M()); - if (countTPCxRws100 == 2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcNxRws100"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN1) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN1)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut1"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN2) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN2)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut2"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN3) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN3)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut3"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN4) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN4)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut4"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN5) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN5)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUStpcBordersCut5"))->Fill(motherOfMuons.M()); - if (-8 * o2::constants::math::PI / 8 <= phiPos && phiPos <= -7 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi1"))->Fill(motherOfMuons.M()); - if (-7 * o2::constants::math::PI / 8 < phiPos && phiPos <= -6 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi2"))->Fill(motherOfMuons.M()); - if (-6 * o2::constants::math::PI / 8 < phiPos && phiPos <= -5 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi3"))->Fill(motherOfMuons.M()); - if (-5 * o2::constants::math::PI / 8 < phiPos && phiPos <= -4 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi4"))->Fill(motherOfMuons.M()); - if (-4 * o2::constants::math::PI / 8 < phiPos && phiPos <= -3 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi5"))->Fill(motherOfMuons.M()); - if (-3 * o2::constants::math::PI / 8 < phiPos && phiPos <= -2 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi6"))->Fill(motherOfMuons.M()); - if (-2 * o2::constants::math::PI / 8 < phiPos && phiPos <= -1 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi7"))->Fill(motherOfMuons.M()); - if (-1 * o2::constants::math::PI / 8 < phiPos && phiPos <= -0 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi8"))->Fill(motherOfMuons.M()); - if (0 * o2::constants::math::PI / 8 < phiPos && phiPos <= 1 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi9"))->Fill(motherOfMuons.M()); - if (1 * o2::constants::math::PI / 8 < phiPos && phiPos <= 2 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi10"))->Fill(motherOfMuons.M()); - if (2 * o2::constants::math::PI / 8 < phiPos && phiPos <= 3 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi11"))->Fill(motherOfMuons.M()); - if (3 * o2::constants::math::PI / 8 < phiPos && phiPos <= 4 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi12"))->Fill(motherOfMuons.M()); - if (4 * o2::constants::math::PI / 8 < phiPos && phiPos <= 5 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi13"))->Fill(motherOfMuons.M()); - if (5 * o2::constants::math::PI / 8 < phiPos && phiPos <= 6 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi14"))->Fill(motherOfMuons.M()); - if (6 * o2::constants::math::PI / 8 < phiPos && phiPos <= 7 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi15"))->Fill(motherOfMuons.M()); - if (7 * o2::constants::math::PI / 8 < phiPos && phiPos <= 8 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhi16"))->Fill(motherOfMuons.M()); - if (-8 * o2::constants::math::PI / 8 <= phiNeg && phiNeg <= -7 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi1"))->Fill(motherOfMuons.M()); - if (-7 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= -6 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi2"))->Fill(motherOfMuons.M()); - if (-6 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= -5 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi3"))->Fill(motherOfMuons.M()); - if (-5 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= -4 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi4"))->Fill(motherOfMuons.M()); - if (-4 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= -3 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi5"))->Fill(motherOfMuons.M()); - if (-3 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= -2 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi6"))->Fill(motherOfMuons.M()); - if (-2 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= -1 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi7"))->Fill(motherOfMuons.M()); - if (-1 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= -0 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi8"))->Fill(motherOfMuons.M()); - if (0 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= 1 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi9"))->Fill(motherOfMuons.M()); - if (1 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= 2 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi10"))->Fill(motherOfMuons.M()); - if (2 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= 3 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi11"))->Fill(motherOfMuons.M()); - if (3 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= 4 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi12"))->Fill(motherOfMuons.M()); - if (4 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= 5 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi13"))->Fill(motherOfMuons.M()); - if (5 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= 6 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi14"))->Fill(motherOfMuons.M()); - if (6 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= 7 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi15"))->Fill(motherOfMuons.M()); - if (7 * o2::constants::math::PI / 8 < phiNeg && phiNeg <= 8 * o2::constants::math::PI / 8) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhi16"))->Fill(motherOfMuons.M()); - - if (-8 * o2::constants::math::PI / 256 <= phiPosTPC && phiPosTPC <= -7 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC1"))->Fill(motherOfMuons.M()); - if (-7 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= -6 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC2"))->Fill(motherOfMuons.M()); - if (-6 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= -5 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC3"))->Fill(motherOfMuons.M()); - if (-5 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= -4 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC4"))->Fill(motherOfMuons.M()); - if (-4 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= -3 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC5"))->Fill(motherOfMuons.M()); - if (-3 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= -2 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC6"))->Fill(motherOfMuons.M()); - if (-2 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= -1 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC7"))->Fill(motherOfMuons.M()); - if (-1 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= -0 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC8"))->Fill(motherOfMuons.M()); - if (0 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= 1 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC9"))->Fill(motherOfMuons.M()); - if (1 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= 2 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC10"))->Fill(motherOfMuons.M()); - if (2 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= 3 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC11"))->Fill(motherOfMuons.M()); - if (3 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= 4 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC12"))->Fill(motherOfMuons.M()); - if (4 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= 5 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC13"))->Fill(motherOfMuons.M()); - if (5 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= 6 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC14"))->Fill(motherOfMuons.M()); - if (6 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= 7 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC15"))->Fill(motherOfMuons.M()); - if (7 * o2::constants::math::PI / 256 < phiPosTPC && phiPosTPC <= 8 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmupPhiTPC16"))->Fill(motherOfMuons.M()); - if (-8 * o2::constants::math::PI / 256 <= phiNegTPC && phiNegTPC <= -7 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC1"))->Fill(motherOfMuons.M()); - if (-7 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= -6 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC2"))->Fill(motherOfMuons.M()); - if (-6 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= -5 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC3"))->Fill(motherOfMuons.M()); - if (-5 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= -4 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC4"))->Fill(motherOfMuons.M()); - if (-4 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= -3 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC5"))->Fill(motherOfMuons.M()); - if (-3 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= -2 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC6"))->Fill(motherOfMuons.M()); - if (-2 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= -1 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC7"))->Fill(motherOfMuons.M()); - if (-1 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= -0 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC8"))->Fill(motherOfMuons.M()); - if (0 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= 1 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC9"))->Fill(motherOfMuons.M()); - if (1 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= 2 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC10"))->Fill(motherOfMuons.M()); - if (2 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= 3 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC11"))->Fill(motherOfMuons.M()); - if (3 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= 4 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC12"))->Fill(motherOfMuons.M()); - if (4 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= 5 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC13"))->Fill(motherOfMuons.M()); - if (5 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= 6 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC14"))->Fill(motherOfMuons.M()); - if (6 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= 7 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC15"))->Fill(motherOfMuons.M()); - if (7 * o2::constants::math::PI / 256 < phiNegTPC && phiNegTPC <= 8 * o2::constants::math::PI / 256) - histos.get(HIST("EventTwoTracks/MuonsSelection/Ruben/hInvariantMassWidePtCutUSmumPhiTPC16"))->Fill(motherOfMuons.M()); - } - } - if (sign > 0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutLS"))->Fill(motherOfMuons.M()); - if (countTOFtracks == 2) { - if (sign < 0) { - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUS"))->Fill(motherOfMuons.M()); - if (doJpsiMuMuTests) { - if (muon[0].Eta() < 0.0 && muon[1].Eta() < 0.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSnegEta"))->Fill(motherOfMuons.M()); - if (muon[0].Eta() > 0.0 && muon[1].Eta() > 0.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSposEta"))->Fill(motherOfMuons.M()); - if (motherOfMuons.Rapidity() < 0.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSnegRap"))->Fill(motherOfMuons.M()); - if (motherOfMuons.Rapidity() > 0.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSposRap"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 1.2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap12"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 1.0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap10"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 0.8) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap08"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 0.5) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap05"))->Fill(motherOfMuons.M()); - if (std::abs(motherOfMuons.Rapidity()) < 0.3) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUSrap03"))->Fill(motherOfMuons.M()); - if (countTPCcls70 == 2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcNcls70"))->Fill(motherOfMuons.M()); - if (countTPCcls100 == 2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcNcls100"))->Fill(motherOfMuons.M()); - if (countTPCxRws70 == 2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcNxRws70"))->Fill(motherOfMuons.M()); - if (countTPCxRws100 == 2) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcNxRws100"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN1) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN1)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut1"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN2) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN2)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut2"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN3) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN3)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut3"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN4) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN4)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut4"))->Fill(motherOfMuons.M()); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN5) && isNotCloseToTPCBorder(phiModNtrk2, muon[0].Pt(), cutPhiModN5)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutUStpcBordersCut5"))->Fill(motherOfMuons.M()); - } - } - if (sign > 0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWidePtCutLS"))->Fill(motherOfMuons.M()); - } - if (passAvgITSclsSizesCut) { - if (sign < 0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutUSITScut"))->Fill(motherOfMuons.M()); - if (sign > 0) - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWidePtCutLSITScut"))->Fill(motherOfMuons.M()); - } - if (countTOFtracks == 2) { - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiPtCut"))->Fill(muon[0].Pt(), phiModNtrk1); - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiPtCut"))->Fill(muon[1].Pt(), phiModNtrk2); - } - } - if (countTOFtracks == 2) { - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hInvariantMassWide"))->Fill(motherOfMuons.M()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhi"))->Fill(muon[0].Pt(), phiModNtrk1); - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhi"))->Fill(muon[1].Pt(), phiModNtrk2); - if (doJpsiMuMuTests) { - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN1)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut1"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN1)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut1"))->Fill(muon[1].Pt(), phiModNtrk2); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN2)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut2"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN2)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut2"))->Fill(muon[1].Pt(), phiModNtrk2); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN3)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut3"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN3)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut3"))->Fill(muon[1].Pt(), phiModNtrk2); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN4)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut4"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN4)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut4"))->Fill(muon[1].Pt(), phiModNtrk2); - if (isNotCloseToTPCBorder(phiModNtrk1, muon[0].Pt(), cutPhiModN5)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut5"))->Fill(muon[0].Pt(), phiModNtrk1); - if (isNotCloseToTPCBorder(phiModNtrk2, muon[1].Pt(), cutPhiModN5)) - histos.get(HIST("EventTwoTracks/MuonsSelection/hasTOF/hDaughtersPtvsModPhiTPCbordersCut5"))->Fill(muon[1].Pt(), phiModNtrk2); - } - } - if (reinstallRun2JpsiEventSelection(reconstructedCollision, trkDaug1, trkDaug2, motherOfMuons.Rapidity(), acoplanarity)) { - histos.get(HIST("EventTwoTracks/MuonsSelection/Run2Cuts/hInvariantMassWide"))->Fill(motherOfMuons.M()); - if (motherOfMuons.Pt() < 2.0) { - histos.get(HIST("EventTwoTracks/MuonsSelection/Run2Cuts/hInvariantMassWidePtFitPlot"))->Fill(motherOfMuons.M()); - } - if (motherOfMuons.Pt() < 0.11) { - histos.get(HIST("EventTwoTracks/MuonsSelection/Run2Cuts/hInvariantMassWideCS"))->Fill(motherOfMuons.M()); - } - } - if (passAvgITSclsSizesCut) { - histos.get(HIST("EventTwoTracks/MuonsSelection/hInvariantMassWideITS"))->Fill(motherOfMuons.M()); - } - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPvsITSclusterSize"))->Fill(getAvgITSClSize(trkDaug1), trkDaug1.sign() * daug[0].P()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPvsITSclusterSize"))->Fill(getAvgITSClSize(trkDaug2), trkDaug2.sign() * daug[1].P()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPvsITSclusterSizeXcos"))->Fill(getAvgITSClSize(trkDaug1) * getCosLambda(trkDaug1), trkDaug1.sign() * daug[0].P()); - histos.get(HIST("EventTwoTracks/MuonsSelection/hDaughtersPvsITSclusterSizeXcos"))->Fill(getAvgITSClSize(trkDaug2) * getCosLambda(trkDaug2), trkDaug2.sign() * daug[1].P()); - } } else if (countPVGTselected == 4 && doFourTracks) { TLorentzVector mother, daug[4]; @@ -1897,10 +1329,10 @@ struct UpcTauCentralBarrelRL { const auto& trkDaug2 = reconstructedBarrelTracks.iteratorAt(vecPVidx[1]); const auto& trkDaug3 = reconstructedBarrelTracks.iteratorAt(vecPVidx[2]); const auto& trkDaug4 = reconstructedBarrelTracks.iteratorAt(vecPVidx[3]); - daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); - daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); - daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); + daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); mother = daug[0] + daug[1] + daug[2] + daug[3]; histos.get(HIST("EventFourTracks/hInvariantMass"))->Fill(mother.M()); @@ -1914,7 +1346,7 @@ struct UpcTauCentralBarrelRL { // ee, mm, em, pp, ep, mp, pppp, eppp, mppp, pppppp if (countPVGTpions == 4) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(6); + histos.get(HIST("Events/hChannels"))->Fill(CH_FOURPI); histos.get(HIST("EventFourTracks/WithPion/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventFourTracks/WithPion/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventFourTracks/WithPion/hMotherP"))->Fill(mother.P()); @@ -1925,7 +1357,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventFourTracks/WithPion/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); } if (countPVGTelectrons == 1 && countPVGTpions == 3) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(7); + histos.get(HIST("Events/hChannels"))->Fill(CH_ETHREEPI); histos.get(HIST("EventFourTracks/WithElectron/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventFourTracks/WithElectron/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventFourTracks/WithElectron/hMotherP"))->Fill(mother.P()); @@ -1936,7 +1368,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventFourTracks/WithElectron/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); } if (countPVGTpions == 3 && countPVGTmuons == 1) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(8); + histos.get(HIST("Events/hChannels"))->Fill(CH_MUTHREEPI); histos.get(HIST("EventFourTracks/WithMuon/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventFourTracks/WithMuon/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventFourTracks/WithMuon/hMotherP"))->Fill(mother.P()); @@ -1946,44 +1378,6 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventFourTracks/WithMuon/hMotherRapidity"))->Fill(mother.Rapidity()); histos.get(HIST("EventFourTracks/WithMuon/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); } - // Hunting down psi2s: broad acceptance - if (doFourTrackPsi2S) { - if (countPVGTpions == 4 || - (countPVGTpions == 3 && countPVGTmuons == 1) || - (countPVGTpions == 2 && countPVGTmuons == 2) || - (countPVGTpions == 1 && countPVGTmuons == 3) || - countPVGTmuons == 4) { - histos.get(HIST("EventFourTracks/MuonsPions/hInvariantMass"))->Fill(mother.M()); - histos.get(HIST("EventFourTracks/MuonsPions/hInvariantMassWide"))->Fill(mother.M()); - histos.get(HIST("EventFourTracks/MuonsPions/hMotherP"))->Fill(mother.P()); - histos.get(HIST("EventFourTracks/MuonsPions/hMotherPwide"))->Fill(mother.P()); - histos.get(HIST("EventFourTracks/MuonsPions/hMotherPt"))->Fill(mother.Pt()); - histos.get(HIST("EventFourTracks/MuonsPions/hMotherPhi"))->Fill(mother.Phi()); - histos.get(HIST("EventFourTracks/MuonsPions/hMotherRapidity"))->Fill(mother.Rapidity()); - histos.get(HIST("EventFourTracks/MuonsPions/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); - } - // Hunting down psi2s: ideal case - if (whatPsi2Schannel(trkDaug1, trkDaug2, trkDaug3, trkDaug4, vecPIDidx) == 1) { - histos.get(HIST("EventFourTracks/Psi2StoMuMuPiPi/hInvariantMass"))->Fill(mother.M()); - histos.get(HIST("EventFourTracks/Psi2StoMuMuPiPi/hInvariantMassWide"))->Fill(mother.M()); - histos.get(HIST("EventFourTracks/Psi2StoMuMuPiPi/hMotherP"))->Fill(mother.P()); - histos.get(HIST("EventFourTracks/Psi2StoMuMuPiPi/hMotherPwide"))->Fill(mother.P()); - histos.get(HIST("EventFourTracks/Psi2StoMuMuPiPi/hMotherPt"))->Fill(mother.Pt()); - histos.get(HIST("EventFourTracks/Psi2StoMuMuPiPi/hMotherPhi"))->Fill(mother.Phi()); - histos.get(HIST("EventFourTracks/Psi2StoMuMuPiPi/hMotherRapidity"))->Fill(mother.Rapidity()); - histos.get(HIST("EventFourTracks/Psi2StoMuMuPiPi/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); - } - if (whatPsi2Schannel(trkDaug1, trkDaug2, trkDaug3, trkDaug4, vecPIDidx) == 2) { - histos.get(HIST("EventFourTracks/Psi2StoElElPiPi/hInvariantMass"))->Fill(mother.M()); - histos.get(HIST("EventFourTracks/Psi2StoElElPiPi/hInvariantMassWide"))->Fill(mother.M()); - histos.get(HIST("EventFourTracks/Psi2StoElElPiPi/hMotherP"))->Fill(mother.P()); - histos.get(HIST("EventFourTracks/Psi2StoElElPiPi/hMotherPwide"))->Fill(mother.P()); - histos.get(HIST("EventFourTracks/Psi2StoElElPiPi/hMotherPt"))->Fill(mother.Pt()); - histos.get(HIST("EventFourTracks/Psi2StoElElPiPi/hMotherPhi"))->Fill(mother.Phi()); - histos.get(HIST("EventFourTracks/Psi2StoElElPiPi/hMotherRapidity"))->Fill(mother.Rapidity()); - histos.get(HIST("EventFourTracks/Psi2StoElElPiPi/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); - } - } } else if (countPVGTselected == 6 && doSixTracks) { TLorentzVector mother, daug[6]; const auto& trkDaug1 = reconstructedBarrelTracks.iteratorAt(vecPVidx[0]); @@ -1992,12 +1386,12 @@ struct UpcTauCentralBarrelRL { const auto& trkDaug4 = reconstructedBarrelTracks.iteratorAt(vecPVidx[3]); const auto& trkDaug5 = reconstructedBarrelTracks.iteratorAt(vecPVidx[4]); const auto& trkDaug6 = reconstructedBarrelTracks.iteratorAt(vecPVidx[5]); - daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); - daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); - daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); - daug[4].SetPxPyPzE(trkDaug5.px(), trkDaug5.py(), trkDaug5.pz(), energy(pdg->Mass(trackPDG(trkDaug5)), trkDaug5.px(), trkDaug5.py(), trkDaug5.pz())); - daug[5].SetPxPyPzE(trkDaug6.px(), trkDaug6.py(), trkDaug6.pz(), energy(pdg->Mass(trackPDG(trkDaug6)), trkDaug6.px(), trkDaug6.py(), trkDaug6.pz())); + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); + daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); + daug[4].SetPxPyPzE(trkDaug5.px(), trkDaug5.py(), trkDaug5.pz(), energy(pdg->Mass(trackPDG(trkDaug5, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug5.px(), trkDaug5.py(), trkDaug5.pz())); + daug[5].SetPxPyPzE(trkDaug6.px(), trkDaug6.py(), trkDaug6.pz(), energy(pdg->Mass(trackPDG(trkDaug6, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug6.px(), trkDaug6.py(), trkDaug6.pz())); mother = daug[0] + daug[1] + daug[2] + daug[3] + daug[4] + daug[5]; histos.get(HIST("EventSixTracks/hInvariantMass"))->Fill(mother.M()); @@ -2011,7 +1405,7 @@ struct UpcTauCentralBarrelRL { // ee, mm, em, pp, ep, mp, pppp, eppp, mppp, pppppp if (countPVGTpions == 6) { - histos.get(HIST("Events/hChannelsRatio"))->Fill(9); + histos.get(HIST("Events/hChannels"))->Fill(CH_SIXPI); histos.get(HIST("EventSixTracks/SixPions/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventSixTracks/SixPions/hInvariantMassWide"))->Fill(mother.M()); histos.get(HIST("EventSixTracks/SixPions/hMotherP"))->Fill(mother.P()); @@ -2028,17 +1422,11 @@ struct UpcTauCentralBarrelRL { } // end fillHistograms template - void fillPIDhistograms(C /*reconstructedCollision*/, Ts reconstructedBarrelTracks) + void fillPIDhistograms(C const& /*reconstructedCollision*/, Ts const& reconstructedBarrelTracks) { - if (isFirstReconstructedCollisions) { - isFirstReconstructedCollisions = false; - if (verboseInfo) - printLargeMessage("START LOOPING OVER RECONSTRUCTED COLLISIONS"); - } - // Loop over tracks without selections - for (auto& track : reconstructedBarrelTracks) { + for (const auto& track : reconstructedBarrelTracks) { float trkPx = track.px(); float trkPy = track.py(); float trkPz = track.pz(); @@ -2048,6 +1436,11 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("Tracks/raw/PID/hTPCsignalVsPt"))->Fill(track.pt(), track.tpcSignal()); histos.get(HIST("Tracks/raw/PID/hTPCsignalVsEta"))->Fill(eta(trkPx, trkPy, trkPz), track.tpcSignal()); histos.get(HIST("Tracks/raw/PID/hTPCsignalVsPhi"))->Fill(phi(trkPx, trkPy), track.tpcSignal()); + histos.get(HIST("Tracks/raw/PID/hTPCnSigmaElVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaEl()); + histos.get(HIST("Tracks/raw/PID/hTPCnSigmaMuVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaMu()); + histos.get(HIST("Tracks/raw/PID/hTPCnSigmaPiVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaPi()); + histos.get(HIST("Tracks/raw/PID/hTPCnSigmaKaVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaKa()); + histos.get(HIST("Tracks/raw/PID/hTPCnSigmaPrVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaPr()); if (track.hasTOF()) histos.get(HIST("Tracks/raw/PID/hTOFsignalVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tofSignal()); if (track.sign() == 1) { @@ -2072,20 +1465,22 @@ struct UpcTauCentralBarrelRL { } } // Loop over tracks without selections + int countPVGT = 0; int countPVGTselected = 0; int countPVGTelectrons = 0; int countPVGTmuons = 0; int countPVGTpions = 0; - int countPVGTmuonsSelection = 0; std::vector vecPVidx; + std::vector vecPVnoPIDidx; // Loop over tracks with selections - for (auto& track : reconstructedBarrelTracks) { - if (track.isPVContributor() != 1) + for (const auto& track : reconstructedBarrelTracks) { + if (!track.isPVContributor()) + continue; + if (cutGlobalTrack.applyGlobalTrackSelection && !isGlobalTrackReinstatement(track)) { continue; - if (cutMyGlobalTracksOnly) { - if (isGlobalTrackReinstatement(track) != 1) - continue; } + countPVGT++; + vecPVnoPIDidx.push_back(track.index()); float trkPx = track.px(); float trkPy = track.py(); float trkPz = track.pz(); @@ -2095,6 +1490,11 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("Tracks/GoodTrack/PID/hTPCsignalVsPt"))->Fill(track.pt(), track.tpcSignal()); histos.get(HIST("Tracks/GoodTrack/PID/hTPCsignalVsEta"))->Fill(eta(trkPx, trkPy, trkPz), track.tpcSignal()); histos.get(HIST("Tracks/GoodTrack/PID/hTPCsignalVsPhi"))->Fill(phi(trkPx, trkPy), track.tpcSignal()); + histos.get(HIST("Tracks/GoodTrack/PID/hTPCnSigmaElVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaEl()); + histos.get(HIST("Tracks/GoodTrack/PID/hTPCnSigmaMuVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaMu()); + histos.get(HIST("Tracks/GoodTrack/PID/hTPCnSigmaPiVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaPi()); + histos.get(HIST("Tracks/GoodTrack/PID/hTPCnSigmaKaVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaKa()); + histos.get(HIST("Tracks/GoodTrack/PID/hTPCnSigmaPrVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tpcNSigmaPr()); if (track.hasTOF()) histos.get(HIST("Tracks/GoodTrack/PID/hTOFsignalVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tofSignal()); if (track.sign() == 1) { @@ -2117,7 +1517,7 @@ struct UpcTauCentralBarrelRL { printMediumMessage("Track has no charge"); } } - int hypothesisID = testPIDhypothesis(track, cutMyNsigmaTPCPIDselector, cutMyNsigmaTOFPIDselector, usePIDwithTOF, usePIDwithTOFsigmaAfterTPC); + int hypothesisID = testPIDhypothesis(track, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC); if (hypothesisID == P_ELECTRON || hypothesisID == P_MUON || hypothesisID == P_PION) { countPVGTselected++; vecPVidx.push_back(track.index()); @@ -2192,24 +1592,58 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("Tracks/GoodTrack/PID/Others/hTOFsignalVsP"))->Fill(momentum(trkPx, trkPy, trkPz), track.tofSignal()); } } - if (abs(track.tpcNSigmaMu()) < cutMyTPCnSigmaMu) - countPVGTmuonsSelection++; } // Loop over tracks with selections + if (countPVGT == 2 && doTwoTracks) { + TLorentzVector daug[2], pion[2], muon[2]; + const auto& trkDaug1 = reconstructedBarrelTracks.iteratorAt(vecPVnoPIDidx[0]); + const auto& trkDaug2 = reconstructedBarrelTracks.iteratorAt(vecPVnoPIDidx[1]); + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + if (cutTauEvent.applyTauEventSelection && !selectedTauEvent(trkDaug1, trkDaug2)) { + return; + } + + if (trkDaug1.hasTPC()) { + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCsignalVsP"))->Fill(daug[0].P(), trkDaug1.tpcSignal()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaElVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaEl()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaMuVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaMu()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaPiVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaPi()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaKaVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaKa()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaPrVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaPr()); + } + if (trkDaug2.hasTPC()) { + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCsignalVsP"))->Fill(daug[1].P(), trkDaug2.tpcSignal()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaElVsP"))->Fill(daug[1].P(), trkDaug2.tpcNSigmaEl()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaMuVsP"))->Fill(daug[1].P(), trkDaug2.tpcNSigmaMu()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaPiVsP"))->Fill(daug[1].P(), trkDaug2.tpcNSigmaPi()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaKaVsP"))->Fill(daug[1].P(), trkDaug2.tpcNSigmaKa()); + histos.get(HIST("EventTwoTracks/PID/NoPID/hTPCnSigmaPrVsP"))->Fill(daug[1].P(), trkDaug2.tpcNSigmaPr()); + } + } + if (countPVGTselected == 2 && doTwoTracks) { TLorentzVector daug[2], pion[2], muon[2]; const auto& trkDaug1 = reconstructedBarrelTracks.iteratorAt(vecPVidx[0]); const auto& trkDaug2 = reconstructedBarrelTracks.iteratorAt(vecPVidx[1]); - daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); - pion[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(211), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - pion[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(211), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); - muon[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(13), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - muon[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(13), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + pion[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(kPiPlus), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + pion[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(kPiMinus), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + muon[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(kMuonPlus), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + muon[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(kMuonMinus), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + if (cutTauEvent.applyTauEventSelection && !selectedTauEvent(trkDaug1, trkDaug2)) { + return; + } if (trkDaug1.hasTPC()) { histos.get(HIST("EventTwoTracks/PID/hTPCsignalVsP"))->Fill(daug[0].P(), trkDaug1.tpcSignal()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaElVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaEl()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaMuVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaMu()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaPiVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaPi()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaKaVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaKa()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaPrVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaPr()); if (trkDaug1.hasTOF()) { histos.get(HIST("EventTwoTracks/PID/hTOFsignalVsP"))->Fill(daug[0].P(), trkDaug1.tofSignal()); } @@ -2221,14 +1655,6 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/TwoElectrons/PID/hTOFnSigmaVsP"))->Fill(daug[0].P(), trkDaug1.tofNSigmaEl()); } } - if (countPVGTmuonsSelection == 2 && doMuonStudy) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsP"))->Fill(daug[0].P(), trkDaug1.tpcSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaEl()); - if (trkDaug1.hasTOF()) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsP"))->Fill(daug[0].P(), trkDaug1.tofSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsP"))->Fill(daug[0].P(), trkDaug1.tofNSigmaEl()); - } - } if (countPVGTmuons == 2) histos.get(HIST("EventTwoTracks/TwoMuons/PID/hTPCsignalVsP"))->Fill(daug[0].P(), trkDaug1.tpcSignal()); if (countPVGTpions == 2) @@ -2258,6 +1684,11 @@ struct UpcTauCentralBarrelRL { } if (trkDaug2.hasTPC()) { histos.get(HIST("EventTwoTracks/PID/hTPCsignalVsP"))->Fill(daug[1].P(), trkDaug2.tpcSignal()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaElVsP"))->Fill(daug[1].P(), trkDaug1.tpcNSigmaEl()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaMuVsP"))->Fill(daug[1].P(), trkDaug1.tpcNSigmaMu()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaPiVsP"))->Fill(daug[1].P(), trkDaug1.tpcNSigmaPi()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaKaVsP"))->Fill(daug[1].P(), trkDaug1.tpcNSigmaKa()); + histos.get(HIST("EventTwoTracks/PID/hTPCnSigmaPrVsP"))->Fill(daug[1].P(), trkDaug1.tpcNSigmaPr()); if (trkDaug2.hasTOF()) { histos.get(HIST("EventTwoTracks/PID/hTOFsignalVsP"))->Fill(daug[1].P(), trkDaug2.tofSignal()); } @@ -2269,14 +1700,6 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/TwoElectrons/PID/hTOFnSigmaVsP"))->Fill(daug[1].P(), trkDaug2.tofNSigmaEl()); } } - if (countPVGTmuonsSelection == 2 && doMuonStudy) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsP"))->Fill(daug[1].P(), trkDaug2.tpcSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsP"))->Fill(daug[1].P(), trkDaug2.tpcNSigmaEl()); - if (trkDaug1.hasTOF()) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsP"))->Fill(daug[1].P(), trkDaug2.tofSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsP"))->Fill(daug[1].P(), trkDaug2.tofNSigmaEl()); - } - } if (countPVGTmuons == 2) histos.get(HIST("EventTwoTracks/TwoMuons/PID/hTPCsignalVsP"))->Fill(daug[1].P(), trkDaug2.tpcSignal()); if (countPVGTpions == 2) @@ -2334,77 +1757,52 @@ struct UpcTauCentralBarrelRL { } } } - if (countPVGTmuonsSelection == 2 && doMuonStudy) { - if (daug[0].P() > daug[1].P()) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsLP"))->Fill(daug[0].P(), trkDaug1.tpcSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsOP"))->Fill(daug[1].P(), trkDaug2.tpcSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsLP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaEl()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsOP"))->Fill(daug[1].P(), trkDaug2.tpcNSigmaEl()); - if (trkDaug1.hasTOF()) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsLP"))->Fill(daug[0].P(), trkDaug1.tofSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsLP"))->Fill(daug[0].P(), trkDaug1.tofNSigmaEl()); - } - if (trkDaug2.hasTOF()) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsOP"))->Fill(daug[1].P(), trkDaug2.tofSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsOP"))->Fill(daug[1].P(), trkDaug2.tofNSigmaEl()); - } - } else { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsOP"))->Fill(daug[0].P(), trkDaug1.tpcSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCsignalVsLP"))->Fill(daug[1].P(), trkDaug2.tpcSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsOP"))->Fill(daug[0].P(), trkDaug1.tpcNSigmaEl()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTPCnSigmaVsLP"))->Fill(daug[1].P(), trkDaug2.tpcNSigmaEl()); - if (trkDaug1.hasTOF()) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsOP"))->Fill(daug[0].P(), trkDaug1.tofSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsOP"))->Fill(daug[0].P(), trkDaug1.tofNSigmaEl()); - } - if (trkDaug2.hasTOF()) { - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFsignalVsLP"))->Fill(daug[1].P(), trkDaug2.tofSignal()); - histos.get(HIST("EventTwoTracks/MuonsSelection/PID/hTOFnSigmaVsLP"))->Fill(daug[1].P(), trkDaug2.tofNSigmaEl()); - } - } - } - if ((countPVGTelectrons == 1 && countPVGTmuons == 1) || (countPVGTelectrons == 1 && countPVGTpions == 1)) { - double electronPt = (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); - double electronPID = (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); - double electronNsigma = (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? trkDaug1.tpcNSigmaEl() : trkDaug2.tpcNSigmaEl(); - double otherPt = (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); - double otherPID = (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); - double otherNsigmaMu = (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) ? trkDaug1.tpcNSigmaMu() : trkDaug2.tpcNSigmaMu(); - double otherNsigmaPi = (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) ? trkDaug1.tpcNSigmaPi() : trkDaug2.tpcNSigmaPi(); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsEP"))->Fill(electronPt, electronPID); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsOP"))->Fill(otherPt, otherPID); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsEP"))->Fill(electronPt, electronNsigma); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsMP"))->Fill(otherPt, otherNsigmaMu); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsPP"))->Fill(otherPt, otherNsigmaPi); + if (!isMC && ((countPVGTelectrons == 1 && countPVGTmuons == 1) || (countPVGTelectrons == 1 && countPVGTpions == 1))) { + double electronPt = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + double electronPID = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); + double electronNsigma = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaEl() : trkDaug2.tpcNSigmaEl(); + double electronPiNsigma = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaPi() : trkDaug2.tpcNSigmaPi(); + double otherPt = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + double otherPID = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); + double otherNsigmaMu = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaMu() : trkDaug2.tpcNSigmaMu(); + double otherNsigmaPi = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaPi() : trkDaug2.tpcNSigmaPi(); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsEPofE"))->Fill(electronPt, electronPID); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsOPofO"))->Fill(otherPt, otherPID); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsEPofE"))->Fill(electronPt, electronNsigma); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsMPofO"))->Fill(otherPt, otherNsigmaMu); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsPPofO"))->Fill(otherPt, otherNsigmaPi); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaEvsnSigmaPofE"))->Fill(electronNsigma, electronPiNsigma); if (trkDaug1.hasTOF()) { - if (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) { - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsEP"))->Fill(electronPt, trkDaug1.tofSignal()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEP"))->Fill(electronPt, trkDaug1.tofNSigmaEl()); + if (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsEPofE"))->Fill(electronPt, trkDaug1.tofSignal()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEPofE"))->Fill(electronPt, trkDaug1.tofNSigmaEl()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaEvsnSigmaPofE"))->Fill(trkDaug1.tofNSigmaEl(), trkDaug1.tofNSigmaPi()); } else { - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsOP"))->Fill(otherPt, trkDaug1.tofSignal()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsMP"))->Fill(otherPt, trkDaug1.tofNSigmaMu()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPP"))->Fill(otherPt, trkDaug1.tofNSigmaPi()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsOPofO"))->Fill(otherPt, trkDaug1.tofSignal()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsMPofO"))->Fill(otherPt, trkDaug1.tofNSigmaMu()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPPofO"))->Fill(otherPt, trkDaug1.tofNSigmaPi()); } } if (trkDaug2.hasTOF()) { - if (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) { - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsEP"))->Fill(electronPt, trkDaug2.tofSignal()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEP"))->Fill(electronPt, trkDaug2.tofNSigmaEl()); + if (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsEPofE"))->Fill(electronPt, trkDaug2.tofSignal()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEPofE"))->Fill(electronPt, trkDaug2.tofNSigmaEl()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaEvsnSigmaPofE"))->Fill(trkDaug2.tofNSigmaEl(), trkDaug2.tofNSigmaPi()); } else { - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsOP"))->Fill(otherPt, trkDaug2.tofSignal()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsMP"))->Fill(otherPt, trkDaug2.tofNSigmaMu()); - histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPP"))->Fill(otherPt, trkDaug2.tofNSigmaPi()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsOPofO"))->Fill(otherPt, trkDaug2.tofSignal()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsMPofO"))->Fill(otherPt, trkDaug2.tofNSigmaMu()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPPofO"))->Fill(otherPt, trkDaug2.tofNSigmaPi()); } } } if ((countPVGTelectrons == 2) || (countPVGTelectrons == 1 && countPVGTmuons == 1) || (countPVGTelectrons == 1 && countPVGTpions == 1)) { - double electronPt = (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); - double electronPID = (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); - double electronNsigma = (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) ? trkDaug1.tpcNSigmaEl() : trkDaug2.tpcNSigmaEl(); - double otherPt = (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); - double otherPID = (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); - double otherNsigmaMu = (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) ? trkDaug1.tpcNSigmaMu() : trkDaug2.tpcNSigmaMu(); - double otherNsigmaPi = (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) ? trkDaug1.tpcNSigmaPi() : trkDaug2.tpcNSigmaPi(); + double electronPt = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + double electronPID = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); + double electronNsigma = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaEl() : trkDaug2.tpcNSigmaEl(); + double otherPt = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + double otherPID = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); + double otherNsigmaMu = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaMu() : trkDaug2.tpcNSigmaMu(); + double otherNsigmaPi = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaPi() : trkDaug2.tpcNSigmaPi(); if (countPVGTelectrons == 2) { electronPt = (daug[0].Pt() > daug[1].Pt()) ? daug[0].Pt() : daug[1].Pt(); electronPID = (daug[0].Pt() > daug[1].Pt()) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); @@ -2420,7 +1818,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsMP"))->Fill(otherPt, otherNsigmaMu); histos.get(HIST("EventTwoTracks/ElectronOther/PID/hTPCnSigmaVsPP"))->Fill(otherPt, otherNsigmaPi); if (trkDaug1.hasTOF()) { - if (enumMyParticle(trackPDG(trkDaug1)) == P_ELECTRON) { + if (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) { histos.get(HIST("EventTwoTracks/ElectronOther/PID/hTOFsignalVsEP"))->Fill(electronPt, trkDaug1.tofSignal()); histos.get(HIST("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsEP"))->Fill(electronPt, trkDaug1.tofNSigmaEl()); } else { @@ -2430,7 +1828,7 @@ struct UpcTauCentralBarrelRL { } } if (trkDaug2.hasTOF()) { - if (enumMyParticle(trackPDG(trkDaug2)) == P_ELECTRON) { + if (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) { histos.get(HIST("EventTwoTracks/ElectronOther/PID/hTOFsignalVsEP"))->Fill(electronPt, trkDaug2.tofSignal()); histos.get(HIST("EventTwoTracks/ElectronOther/PID/hTOFnSigmaVsEP"))->Fill(electronPt, trkDaug2.tofNSigmaEl()); } else { @@ -2448,10 +1846,10 @@ struct UpcTauCentralBarrelRL { const auto& trkDaug2 = reconstructedBarrelTracks.iteratorAt(vecPVidx[1]); const auto& trkDaug3 = reconstructedBarrelTracks.iteratorAt(vecPVidx[2]); const auto& trkDaug4 = reconstructedBarrelTracks.iteratorAt(vecPVidx[3]); - daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); - daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); - daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); + daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); if (trkDaug1.hasTPC()) { histos.get(HIST("EventFourTracks/PID/hTPCsignalVsP"))->Fill(daug[0].P(), trkDaug1.tpcSignal()); @@ -2497,12 +1895,12 @@ struct UpcTauCentralBarrelRL { const auto& trkDaug4 = reconstructedBarrelTracks.iteratorAt(vecPVidx[3]); const auto& trkDaug5 = reconstructedBarrelTracks.iteratorAt(vecPVidx[4]); const auto& trkDaug6 = reconstructedBarrelTracks.iteratorAt(vecPVidx[5]); - daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); - daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); - daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); - daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); - daug[4].SetPxPyPzE(trkDaug5.px(), trkDaug5.py(), trkDaug5.pz(), energy(pdg->Mass(trackPDG(trkDaug5)), trkDaug5.px(), trkDaug5.py(), trkDaug5.pz())); - daug[5].SetPxPyPzE(trkDaug6.px(), trkDaug6.py(), trkDaug6.pz(), energy(pdg->Mass(trackPDG(trkDaug6)), trkDaug6.px(), trkDaug6.py(), trkDaug6.pz())); + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + daug[2].SetPxPyPzE(trkDaug3.px(), trkDaug3.py(), trkDaug3.pz(), energy(pdg->Mass(trackPDG(trkDaug3, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug3.px(), trkDaug3.py(), trkDaug3.pz())); + daug[3].SetPxPyPzE(trkDaug4.px(), trkDaug4.py(), trkDaug4.pz(), energy(pdg->Mass(trackPDG(trkDaug4, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug4.px(), trkDaug4.py(), trkDaug4.pz())); + daug[4].SetPxPyPzE(trkDaug5.px(), trkDaug5.py(), trkDaug5.pz(), energy(pdg->Mass(trackPDG(trkDaug5, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug5.px(), trkDaug5.py(), trkDaug5.pz())); + daug[5].SetPxPyPzE(trkDaug6.px(), trkDaug6.py(), trkDaug6.pz(), energy(pdg->Mass(trackPDG(trkDaug6, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug6.px(), trkDaug6.py(), trkDaug6.pz())); if (trkDaug1.hasTPC()) { histos.get(HIST("EventSixTracks/PID/hTPCsignalVsP"))->Fill(daug[0].P(), trkDaug1.tpcSignal()); @@ -2540,53 +1938,393 @@ struct UpcTauCentralBarrelRL { } // end fillPIDhistograms - void processDGrecoLevel(FullUDCollision const& reconstructedCollision, - FullUDTracks const& reconstructedBarrelTracks) + void fillMCPIDhistograms(FullMCUDTracks const& reconstructedBarrelTracks) + { + + int countPVGTselected = 0; + int countPVGTelectrons = 0; + int countPVGTmuons = 0; + int countPVGTpions = 0; + std::vector vecPVidx; + // Loop over tracks with selections + for (const auto& track : reconstructedBarrelTracks) { + if (!track.isPVContributor()) + continue; + if (cutGlobalTrack.applyGlobalTrackSelection) { + if (isGlobalTrackReinstatement(track) != 1) + continue; + } + int hypothesisID = testPIDhypothesis(track, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC); + if (hypothesisID == P_ELECTRON || hypothesisID == P_MUON || hypothesisID == P_PION) { + countPVGTselected++; + vecPVidx.push_back(track.index()); + if (hypothesisID == P_ELECTRON) { + countPVGTelectrons++; + } else if (hypothesisID == P_MUON) { + countPVGTmuons++; + } else { + countPVGTpions++; + } + } + + } // Loop over tracks with selections + + if (countPVGTselected == 2 && doTwoTracks) { + TLorentzVector daug[2]; + const auto& trkDaug1 = reconstructedBarrelTracks.iteratorAt(vecPVidx[0]); + const auto& trkDaug2 = reconstructedBarrelTracks.iteratorAt(vecPVidx[1]); + daug[0].SetPxPyPzE(trkDaug1.px(), trkDaug1.py(), trkDaug1.pz(), energy(pdg->Mass(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug1.px(), trkDaug1.py(), trkDaug1.pz())); + daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(pdg->Mass(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)), trkDaug2.px(), trkDaug2.py(), trkDaug2.pz())); + if (cutTauEvent.applyTauEventSelection && !selectedTauEvent(trkDaug1, trkDaug2)) { + return; + } + if (trkDaug1.hasTPC() && trkDaug2.hasTPC()) { + if (isMC && ((countPVGTelectrons == 1 && countPVGTmuons == 1) || (countPVGTelectrons == 1 && countPVGTpions == 1))) { + int pid = 0; + if (trkDaug1.has_udMcParticle()) { + const auto& part = trkDaug1.udMcParticle(); + pid = std::abs(part.pdgCode()); + if (pid == 11) { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/mcTruth/nSigmaTPC1"))->Fill(trkDaug1.pt(), trkDaug1.tpcNSigmaEl(), 1.); + } else { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/mcTruth/nSigmaTPC2"))->Fill(trkDaug1.pt(), trkDaug1.tpcNSigmaEl(), 1.); + } + } + if (trkDaug2.has_udMcParticle()) { + const auto& part = trkDaug2.udMcParticle(); + pid = std::abs(part.pdgCode()); + if (pid == 11) { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/mcTruth/nSigmaTPC1"))->Fill(trkDaug2.pt(), trkDaug2.tpcNSigmaEl(), 1.); + } else { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/mcTruth/nSigmaTPC2"))->Fill(trkDaug2.pt(), trkDaug2.tpcNSigmaEl(), 1.); + } + } + bool isNotTrueElectron = false; + if (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) { + if (trkDaug1.has_udMcParticle()) { + const auto& particle = trkDaug1.udMcParticle(); + if (enumMyParticle(particle.pdgCode()) != P_ELECTRON) + isNotTrueElectron = true; + } + } else { + if (trkDaug2.has_udMcParticle()) { + const auto& particle = trkDaug2.udMcParticle(); + if (enumMyParticle(particle.pdgCode()) != P_ELECTRON) + isNotTrueElectron = true; + } + } + if (oppositeMCtrueElectronCheck) { + if (doMCtrueElectronCheck && !isNotTrueElectron) + return; + } else { + if (doMCtrueElectronCheck && isNotTrueElectron) + return; + } + + double electronPt = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + double electronPID = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); + double electronNsigma = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaEl() : trkDaug2.tpcNSigmaEl(); + double electronPiNsigma = (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaPi() : trkDaug2.tpcNSigmaPi(); + double otherPt = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt(); + double otherPID = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal(); + double otherNsigmaEl = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaEl() : trkDaug2.tpcNSigmaEl(); + double otherNsigmaMu = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaMu() : trkDaug2.tpcNSigmaMu(); + double otherNsigmaPi = (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaPi() : trkDaug2.tpcNSigmaPi(); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsEPofE"))->Fill(electronPt, electronPID); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsEPofE"))->Fill(electronPt, electronNsigma); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsPPofE"))->Fill(electronPt, electronPiNsigma); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaEvsnSigmaPofE"))->Fill(electronNsigma, electronPiNsigma); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCsignalVsOPofO"))->Fill(otherPt, otherPID); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsEPofO"))->Fill(otherPt, otherNsigmaEl); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsMPofO"))->Fill(otherPt, otherNsigmaMu); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaVsPPofO"))->Fill(otherPt, otherNsigmaPi); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTPCnSigmaEvsnSigmaPofO"))->Fill(otherNsigmaEl, otherNsigmaPi); + if (trkDaug1.hasTOF()) { + if (enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsEPofE"))->Fill(electronPt, trkDaug1.tofSignal()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEPofE"))->Fill(electronPt, trkDaug1.tofNSigmaEl()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPPofE"))->Fill(electronPt, trkDaug1.tofNSigmaPi()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaEvsnSigmaPofE"))->Fill(trkDaug1.tofNSigmaEl(), trkDaug1.tofNSigmaPi()); + } else { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsOPofO"))->Fill(otherPt, trkDaug1.tofSignal()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEPofO"))->Fill(otherPt, trkDaug1.tofNSigmaEl()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsMPofO"))->Fill(otherPt, trkDaug1.tofNSigmaMu()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPPofO"))->Fill(otherPt, trkDaug1.tofNSigmaPi()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaEvsnSigmaPofO"))->Fill(trkDaug1.tofNSigmaEl(), trkDaug1.tofNSigmaPi()); + } + } + if (trkDaug2.hasTOF()) { + if (enumMyParticle(trackPDG(trkDaug2, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsEPofE"))->Fill(electronPt, trkDaug2.tofSignal()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEPofE"))->Fill(electronPt, trkDaug2.tofNSigmaEl()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPPofE"))->Fill(electronPt, trkDaug2.tofNSigmaPi()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaEvsnSigmaPofE"))->Fill(trkDaug2.tofNSigmaEl(), trkDaug2.tofNSigmaPi()); + } else { + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFsignalVsOPofO"))->Fill(otherPt, trkDaug2.tofSignal()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsEPofO"))->Fill(otherPt, trkDaug2.tofNSigmaEl()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsMPofO"))->Fill(otherPt, trkDaug2.tofNSigmaMu()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaVsPPofO"))->Fill(otherPt, trkDaug2.tofNSigmaPi()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/PID/hTOFnSigmaEvsnSigmaPofO"))->Fill(trkDaug2.tofNSigmaEl(), trkDaug2.tofNSigmaPi()); + } + } + } + } + } + + } // end fillMCPIDhistograms + + template + void fillFIThistograms(C const& reconstructedCollision) + { + + histos.get(HIST("Events/FIT/hAmplitudeFT0A"))->Fill(reconstructedCollision.totalFT0AmplitudeA()); + histos.get(HIST("Events/FIT/hAmplitudeFT0C"))->Fill(reconstructedCollision.totalFT0AmplitudeC()); + histos.get(HIST("Events/FIT/hAmplitudeFDDA"))->Fill(reconstructedCollision.totalFDDAmplitudeA()); + histos.get(HIST("Events/FIT/hAmplitudeFDDC"))->Fill(reconstructedCollision.totalFDDAmplitudeC()); + histos.get(HIST("Events/FIT/hAmplitudeFV0A"))->Fill(reconstructedCollision.totalFV0AmplitudeA()); + + histos.get(HIST("Events/FIT/hTimeFT0A"))->Fill(reconstructedCollision.timeFT0A()); + histos.get(HIST("Events/FIT/hTimeFT0C"))->Fill(reconstructedCollision.timeFT0C()); + histos.get(HIST("Events/FIT/hTimeFDDA"))->Fill(reconstructedCollision.timeFDDA()); + histos.get(HIST("Events/FIT/hTimeFDDC"))->Fill(reconstructedCollision.timeFDDC()); + histos.get(HIST("Events/FIT/hTimeFV0A"))->Fill(reconstructedCollision.timeFV0A()); + + histos.get(HIST("Events/FIT/hTimeFT0AvsFT0C"))->Fill(reconstructedCollision.timeFT0A(), reconstructedCollision.timeFT0C()); + histos.get(HIST("Events/FIT/hTimeFT0CvsFDDA"))->Fill(reconstructedCollision.timeFT0C(), reconstructedCollision.timeFDDA()); + histos.get(HIST("Events/FIT/hTimeFDDAvsFDDC"))->Fill(reconstructedCollision.timeFDDA(), reconstructedCollision.timeFDDC()); + histos.get(HIST("Events/FIT/hTimeFDDCvsFV0A"))->Fill(reconstructedCollision.timeFDDC(), reconstructedCollision.timeFV0A()); + histos.get(HIST("Events/FIT/hTimeFV0AvsFT0A"))->Fill(reconstructedCollision.timeFV0A(), reconstructedCollision.timeFT0A()); + } + + void fillTruthHistograms(aod::UDMcParticles const& particles) + { + histos.get(HIST("Events/Truth/hCountCollisions"))->Fill(1); + histos.get(HIST("Events/Truth/hNparticles"))->Fill(particles.size()); + histos.get(HIST("Events/Truth/hNphysPartVsNwoutMotherParts"))->Fill(countPhysicalPrimary(particles), countParticlesWithoutMother(particles)); + + int countElectrons = 0; + int countMuons = 0; + int countPions = 0; + + for (const auto& particle : particles) { + histos.get(HIST("Events/Truth/hPDGcodesAll"))->Fill(particle.pdgCode()); + // if (!particle.isPhysicalPrimary()) continue; + if (particle.has_mothers()) + continue; + histos.get(HIST("Events/Truth/hPDGcodesNoMother"))->Fill(particle.pdgCode()); + histos.get(HIST("Tracks/Truth/hTauPt"))->Fill(pt(particle.px(), particle.py())); + histos.get(HIST("Tracks/Truth/hTauP"))->Fill(momentum(particle.px(), particle.py(), particle.pz())); + histos.get(HIST("Tracks/Truth/hTauPhi"))->Fill(phi(particle.px(), particle.py())); + histos.get(HIST("Tracks/Truth/hTauEta"))->Fill(eta(particle.px(), particle.py(), particle.pz())); + const auto& daughters = particle.daughters_as(); + histos.get(HIST("Events/Truth/hNtauDaughters"))->Fill(daughters.size()); + for (const auto& daughter : daughters) { + histos.get(HIST("Events/Truth/hPDGcodesTauDaughters"))->Fill(daughter.pdgCode()); + if (enumMyParticle(daughter.pdgCode()) == P_ELECTRON) { + countElectrons++; + histos.get(HIST("Tracks/Truth/hElectronPt"))->Fill(pt(daughter.px(), daughter.py())); + histos.get(HIST("Tracks/Truth/hElectronP"))->Fill(momentum(daughter.px(), daughter.py(), daughter.pz())); + histos.get(HIST("Tracks/Truth/hElectronPhi"))->Fill(phi(daughter.px(), daughter.py())); + histos.get(HIST("Tracks/Truth/hElectronEta"))->Fill(eta(daughter.px(), daughter.py(), daughter.pz())); + } + if (enumMyParticle(daughter.pdgCode()) == P_MUON) { + countMuons++; + histos.get(HIST("Tracks/Truth/hMuonPt"))->Fill(pt(daughter.px(), daughter.py())); + histos.get(HIST("Tracks/Truth/hMuonP"))->Fill(momentum(daughter.px(), daughter.py(), daughter.pz())); + histos.get(HIST("Tracks/Truth/hMuonPhi"))->Fill(phi(daughter.px(), daughter.py())); + histos.get(HIST("Tracks/Truth/hMuonEta"))->Fill(eta(daughter.px(), daughter.py(), daughter.pz())); + } + if (enumMyParticle(daughter.pdgCode()) == P_PION) { + countPions++; + histos.get(HIST("Tracks/Truth/hPionPt"))->Fill(pt(daughter.px(), daughter.py())); + histos.get(HIST("Tracks/Truth/hPionP"))->Fill(momentum(daughter.px(), daughter.py(), daughter.pz())); + histos.get(HIST("Tracks/Truth/hPionPhi"))->Fill(phi(daughter.px(), daughter.py())); + histos.get(HIST("Tracks/Truth/hPionEta"))->Fill(eta(daughter.px(), daughter.py(), daughter.pz())); + } + } + } + + histos.get(HIST("Events/Truth/hNelectrons"))->Fill(countElectrons); + histos.get(HIST("Events/Truth/hNmuons"))->Fill(countMuons); + histos.get(HIST("Events/Truth/hNpions"))->Fill(countPions); + + if (countElectrons == 2 && countMuons == 0 && countPions == 0) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_EE); + if (countElectrons == 1 && countMuons == 1 && countPions == 0) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_EMU); + if (countElectrons == 1 && countMuons == 0 && countPions == 1) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_EPI); + if ((countElectrons == 1 && countMuons == 1 && countPions == 0) || (countElectrons == 1 && countMuons == 0 && countPions == 1)) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_EMUPI); + if (countElectrons == 0 && countMuons == 2 && countPions == 0) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_MUMU); + if (countElectrons == 0 && countMuons == 1 && countPions == 1) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_MUPI); + if (countElectrons == 0 && countMuons == 0 && countPions == 2) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_PIPI); + if (countElectrons == 0 && countMuons == 0 && countPions == 4) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_FOURPI); + if (countElectrons == 1 && countMuons == 0 && countPions == 3) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_ETHREEPI); + if (countElectrons == 0 && countMuons == 1 && countPions == 3) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_MUTHREEPI); + if (countElectrons == 0 && countMuons == 0 && countPions == 6) + histos.get(HIST("Events/Truth/hChannels"))->Fill(CH_SIXPI); + } + + void processDataDG(FullUDCollision const& reconstructedCollision, + FullUDTracks const& reconstructedBarrelTracks) { - countCollisions++; - if (doMainHistos) - fillHistograms(reconstructedCollision, reconstructedBarrelTracks); + if (!isGoodFITtime(reconstructedCollision, cutSample.cutFITtime)) + return; + + if (doMainHistos) { + fillHistograms(reconstructedBarrelTracks); + fillFIThistograms(reconstructedCollision); + } if (doPIDhistos) fillPIDhistograms(reconstructedCollision, reconstructedBarrelTracks); - } // end processDGrecoLevel + } // end processDataDG - void processSGrecoLevel(FullSGUDCollision const& reconstructedCollision, - FullUDTracks const& reconstructedBarrelTracks) + void processDataSG(FullSGUDCollision const& reconstructedCollision, + FullUDTracks const& reconstructedBarrelTracks) { - countCollisions++; int gapSide = reconstructedCollision.gapSide(); - int trueGapSide = sgSelector.trueGap(reconstructedCollision, cutMyGapSideFV0, cutMyGapSideFT0A, cutMyGapSideFT0C, cutMyGapSideZDC); + int trueGapSide = sgSelector.trueGap(reconstructedCollision, cutSample.cutTrueGapSideFV0, cutSample.cutTrueGapSideFT0A, cutSample.cutTrueGapSideFT0C, cutSample.cutTrueGapSideZDC); histos.fill(HIST("Events/UDtableGapSide"), gapSide); histos.fill(HIST("Events/TrueGapSideDiffToTableValue"), gapSide - trueGapSide); - if (useTrueGap) + if (cutSample.useTrueGap) gapSide = trueGapSide; - if (gapSide != whichGapSide) + if (gapSide != cutSample.whichGapSide) return; - if (doMainHistos) - fillHistograms(reconstructedCollision, reconstructedBarrelTracks); + if (!isGoodFITtime(reconstructedCollision, cutSample.cutFITtime)) + return; + + if (doMainHistos) { + fillHistograms(reconstructedBarrelTracks); + fillFIThistograms(reconstructedCollision); + } if (doPIDhistos) fillPIDhistograms(reconstructedCollision, reconstructedBarrelTracks); - } // end processDGrecoLevel + } // end processDataSG - void processAnalysisFinished(FullUDCollision const&) + void processMCrecDG(FullMCUDCollision const& reconstructedCollision, + FullMCUDTracks const& reconstructedBarrelTracks, + aod::UDMcParticles const&) { + isMC = true; - if (verboseInfo) - printLargeMessage("END OF THIS DATAFRAME"); - printDebugMessage(Form("countCollisions = %d", countCollisions)); - isFirstReconstructedCollisions = true; + if (!isGoodFITtime(reconstructedCollision, cutSample.cutFITtime)) + return; + + if (cutSample.applyAcceptanceSelection) { + for (const auto& track : reconstructedBarrelTracks) { + if (!track.isPVContributor()) + continue; + if (std::abs(eta(track.px(), track.py(), track.py())) > cutSample.cutTrackEta) + return; + } + } + + if (doMainHistos) { + fillHistograms(reconstructedBarrelTracks); + fillFIThistograms(reconstructedCollision); + } + + if (doPIDhistos) { + fillPIDhistograms(reconstructedCollision, reconstructedBarrelTracks); + fillMCPIDhistograms(reconstructedBarrelTracks); + } + + } // end processMCrecDG + + void processMCrecSG(FullMCSGUDCollision const& reconstructedCollision, + FullMCUDTracks const& reconstructedBarrelTracks, + aod::UDMcParticles const&) + { + isMC = true; + + int gapSide = reconstructedCollision.gapSide(); + histos.fill(HIST("Events/UDtableGapSide"), gapSide); - } // end processAnalysisFinished + if (gapSide != cutSample.whichGapSide) + return; + + if (!isGoodFITtime(reconstructedCollision, cutSample.cutFITtime)) + return; - PROCESS_SWITCH(UpcTauCentralBarrelRL, processDGrecoLevel, "Iterate UD tables with reconstructed data created by DG-Candidate-Producer", false); - PROCESS_SWITCH(UpcTauCentralBarrelRL, processSGrecoLevel, "Iterate UD tables with reconstructed data created by SG-Candidate-Producer", false); - PROCESS_SWITCH(UpcTauCentralBarrelRL, processAnalysisFinished, "Simply runs in the end of the dataframe", true); + if (cutSample.applyAcceptanceSelection) { + for (const auto& track : reconstructedBarrelTracks) { + if (!track.isPVContributor()) + continue; + if (std::abs(eta(track.px(), track.py(), track.py())) > cutSample.cutTrackEta) + return; + } + } + + if (doMainHistos) { + fillHistograms(reconstructedBarrelTracks); + fillFIThistograms(reconstructedCollision); + } + + if (doPIDhistos) { + fillPIDhistograms(reconstructedCollision, reconstructedBarrelTracks); + fillMCPIDhistograms(reconstructedBarrelTracks); + } + + } // end processMCrecDG + + void processMCgen(aod::UDMcCollision const& /*generatedCollision*/, + aod::UDMcParticles const& particles) + { + isMC = true; + + if (cutSample.applyAcceptanceSelection) { + for (const auto& particle : particles) { + if (particle.has_mothers()) + continue; + // printLargeMessage(Form("GENE: eta %.3f cut %.2f",std::abs(eta(particle.px(), particle.py(), particle.py())),static_cast(cutTrackEta))); + if (std::abs(eta(particle.px(), particle.py(), particle.py())) > cutSample.cutTrackEta) + return; + } + } + + if (doTruthHistos) { + fillTruthHistograms(particles); + } + + } // end processMCgenDG + + void processTestMC(FullMCUDCollision const& /*reconstructedCollision*/, + FullMCUDTracks const& /*reconstructedBarrelTracks*/, + aod::UDMcCollisions const&, + aod::UDMcParticles const&) + { + // if (reconstructedCollision.has_udMcCollision()) { + // const auto& generatedCollision = reconstructedCollision.udMcCollision(); + // printDebugMessage(Form("%lli udMcCollision found", generatedCollision.size())); // FIXME: Type of size() is not invariant. + // } + + // const auto& track = reconstructedBarrelTracks.iteratorAt(0); + // if (track.size() && track.has_udMcParticle()) { + // const auto& particle = track.udMcParticle(); + // printDebugMessage(Form("%lli udMcParticle found", particle.size())); // FIXME: Type of size() is not invariant. + // } + + } // end processTestMC + + PROCESS_SWITCH(UpcTauCentralBarrelRL, processDataDG, "Iterate UD tables with measured data created by DG-Candidate-Producer.", false); + PROCESS_SWITCH(UpcTauCentralBarrelRL, processDataSG, "Iterate UD tables with measured data created by SG-Candidate-Producer.", false); + PROCESS_SWITCH(UpcTauCentralBarrelRL, processMCrecDG, "Iterate Monte Carlo UD tables with reconstructed data created by DG-Candidate-Producer. Similar to processDataDG but uses association to truth level.", false); + PROCESS_SWITCH(UpcTauCentralBarrelRL, processMCrecSG, "Iterate Monte Carlo UD tables with reconstructed data created by SG-Candidate-Producer. Similar to processDataSG but uses association to truth level and trueGap is not available.", false); + PROCESS_SWITCH(UpcTauCentralBarrelRL, processMCgen, "Iterate Monte Carlo UD tables with truth data.", false); + PROCESS_SWITCH(UpcTauCentralBarrelRL, processTestMC, "Simple test of indices in MC sample.", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index 61e7feb9fc1..c7d3e870316 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -18,8 +18,11 @@ #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" + +// #include "TDatabasePDG.h" // not recommended in o2 +#include "Framework/O2DatabasePDGPlugin.h" -#include "TDatabasePDG.h" #include "TLorentzVector.h" // #include "Common/DataModel/EventSelection.h" // #include "Common/DataModel/TrackSelectionTables.h" @@ -28,21 +31,28 @@ #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/UDHelpers.h" #include "PWGUD/Core/DGPIDSelector.h" +#include "PWGUD/Core/SGSelector.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; struct TauTau13topo { - + SGSelector sgSelector; // configurables - ConfigurableAxis ptAxis{"pAxis", {100, 0., 5.}, "#it{p} (GeV/#it{c})"}; - ConfigurableAxis etaAxis{"etaAxis", {100, -2., 2.}, "#eta"}; + Configurable FV0_cut{"FV0", 1000., "FV0A threshold"}; + Configurable FT0A_cut{"FT0A", 150., "FT0A threshold"}; + Configurable FT0C_cut{"FT0C", 50., "FT0C threshold"}; + Configurable ZDC_cut{"ZDC", 100., "ZDC threshold"}; + Configurable gap_Side{"gap", 2, "gap selection"}; + // ConfigurableAxis ptAxis{"pAxis", {100, 0., 5.}, "#it{p} (GeV/#it{c})"}; + ConfigurableAxis ptAxis{"ptAxis", {120, 0., 4.}, "#it{p} (GeV/#it{c})"}; + // ConfigurableAxis etaAxis{"etaAxis", {100, -2., 2.}, "#eta"}; ConfigurableAxis dedxAxis{"dedxAxis", {100, 20., 160.}, "dE/dx"}; - ConfigurableAxis minvAxis{"MinvAxis", {100, 0., 2.5}, "M_{inv} (GeV/#it{c}^{2})"}; - ConfigurableAxis phiAxis{"phiAxis", {100, 0., 3.2}, "#phi"}; - ConfigurableAxis vectorAxis{"vectorAxis", {100, 0., 2.}, "A_{V}"}; - ConfigurableAxis scalarAxis{"scalarAxis", {100, -1., 1.}, "A_{S}"}; + ConfigurableAxis minvAxis{"MinvAxis", {100, 0.4, 3.5}, "M_{inv} (GeV/#it{c}^{2})"}; + ConfigurableAxis phiAxis{"phiAxis", {120, 0., 3.2}, "#phi"}; + // ConfigurableAxis vectorAxis{"vectorAxis", {100, 0., 2.}, "A_{V}"}; + // ConfigurableAxis scalarAxis{"scalarAxis", {100, -1., 1.}, "A_{S}"}; Configurable verbose{"Verbose", {}, "Additional print outs"}; // cut selection configurables @@ -59,8 +69,23 @@ struct TauTau13topo { Configurable minPtEtrkcut{"minPtEtrkcut", 0.25, "min Pt for El track cut"}; Configurable FITvetoFlag{"FITvetoFlag", {}, "To apply FIT veto"}; Configurable FITvetoWindow{"FITvetoWindow", 1, "FIT veto window"}; + Configurable useFV0ForVeto{"useFV0ForVeto", 0, "use FV0 for veto"}; + Configurable useFDDAForVeto{"useFDDAForVeto", 0, "use FDDA for veto"}; + Configurable useFDDCForVeto{"useFDDCForVeto", 0, "use FDDC for veto"}; + Configurable nTofTrkMinCut{"nTofTrkMinCut", 0, "min TOF tracks"}; + + Configurable invMass3piSignalRegion{"invMass3piSignalRegion", 1, "1-use inv mass 3pi in signal region, 0-in background region"}; + Configurable invMass3piMaxcut{"invMass3piMaxcut", 20., "Z invariant mass of 3 pi cut"}; + Configurable deltaPhiMincut{"deltaPhiMincut", 0., "delta phi electron - 3 pi direction cut"}; + Configurable nTPCcrossedRowsMinCut{"nTPCcrossedRowsMinCut", 50, "min N_crossed TPC rows for electron candidate"}; + Configurable nSigma3piMaxCut{"nSigma3piMaxCut", 20., "n sigma 3 pi max cut"}; + + // Configurable DGactive{"DGactive", false, "Switch on DGproducer"}; + // Configurable SGactive{"SGactive", true, "Switch on SGproducer"}; + // a pdg object - TDatabasePDG* pdg = nullptr; + // TDatabasePDG* pdg = nullptr; //not recommended + Service pdg; // initialize histogram registry HistogramRegistry registry{ @@ -69,39 +94,59 @@ struct TauTau13topo { void init(InitContext&) { - pdg = TDatabasePDG::Instance(); + // pdg = TDatabasePDG::Instance(); // dgcandidates histograms const AxisSpec axisp{100, 0., 5., "#it{p} (GeV/#it{c})"}; const AxisSpec axispt{ptAxis, "p_{T} axis"}; - const AxisSpec axiseta{etaAxis, "#eta - pseudo rapidity axis"}; + // const AxisSpec axiseta{etaAxis, "#eta - pseudo rapidity axis"}; + const AxisSpec axiseta{100, -2., 2., "#eta"}; const AxisSpec axisdedx{dedxAxis, "dEdx axis"}; const AxisSpec axisminv{minvAxis, "invariant mass axis"}; const AxisSpec axisphi{phiAxis, "phi axis"}; - const AxisSpec axisav{vectorAxis, "AV axis"}; - const AxisSpec axisas{scalarAxis, "AS axis"}; + // const AxisSpec axisav{vectorAxis, "AV axis"}; + // const AxisSpec axisas{scalarAxis, "AS axis"}; + const AxisSpec vectorAxis{100, 0., 2., "A_{V}"}; + const AxisSpec scalarAxis{100, -1., 1., "A_{S}"}; + const AxisSpec axisZDC{50, -1., 14., "#it{E} (TeV)"}; - registry.add("global/hVertexXY", "Vertex position in x and y direction; #it{V}_{x} (cm); #it{V}_{y} (cm); Collisions", {HistType::kTH2F, {{50, -0.05, 0.05}, {50, -0.05, 0.05}}}); + registry.add("global/GapSide", "Associated gap side; gap index; Collisions", {HistType::kTH1F, {{5, -1, 4}}}); + registry.add("global/GapSideTrue", "Recalculated gap side; gap index; Collisions", {HistType::kTH1F, {{5, -1, 4}}}); + + registry.add("global/hZNACenergy", "ZNA vs ZNC energy; #it{E}_{ZNA} (GeV); #it{E}_{ZNC} (GeV); Collisions", {HistType::kTH2F, {axisZDC, axisZDC}}); + registry.add("global/hZNACtime", "ZNA vs ZNC time; #it{time}_{ZNA} (ns); #it{time}_{ZNC} (ns); Collisions", {HistType::kTH2F, {{100, -10., 10.}, {100, -10., 10.}}}); + // registry.add("global/hZNACenergyTest", "ZNA or ZNC energy; #it{E}_{ZNA,ZNC} (GeV); Collisions", {HistType::kTH1F, {{100,-1000,0}}}); + + registry.add("global/hVertexXY", "Vertex position in x and y direction; #it{V}_{x} (cm); #it{V}_{y} (cm); Collisions", {HistType::kTH2F, {{50, -0.05, 0.05}, {50, -0.02, 0.02}}}); registry.add("global/hVertexZ", "Vertex position in z direction; #it{V}_{z} (cm); Collisions", {HistType::kTH1F, {{100, -25., 25.}}}); - registry.add("global/hVertexZ15", "Vertex position in z direction; #it{V}_{z} (cm); Collisions", {HistType::kTH1F, {{100, -25., 25.}}}); - registry.add("global/hVertexZ10", "Vertex position in z direction; #it{V}_{z} (cm); Collisions", {HistType::kTH1F, {{100, -25., 25.}}}); + // registry.add("global/hVertexZ15", "Vertex position in z direction; #it{V}_{z} (cm); Collisions", {HistType::kTH1F, {{100, -25., 25.}}}); + // registry.add("global/hVertexZ10", "Vertex position in z direction; #it{V}_{z} (cm); Collisions", {HistType::kTH1F, {{100, -25., 25.}}}); registry.add("global/hNTracks", ";N_{tracks};events", {HistType::kTH1D, {{20, 0., 20.}}}); - registry.add("global/hNTracksGlobal", ";N_{tracks,global};events", {HistType::kTH1D, {{20, 0., 20.}}}); + // registry.add("global/hNTracksGlobal", ";N_{tracks,global};events", {HistType::kTH1D, {{20, 0., 20.}}}); registry.add("global/hNTracksPV", ";N_{tracks,PV};events", {HistType::kTH1D, {{20, 0., 20.}}}); registry.add("global/hNtofTrk", ";N_{TOF trk}; Entries", {HistType::kTH1F, {{7, 0., 7.}}}); registry.add("global/hTrackPtPV", ";p_T^{trk}; Entries", {HistType::kTH1F, {axispt}}); - registry.add("global/hTrackPVTotCharge", "Q_{Tot};Q_{Tot}; Entries", {HistType::kTH1F, {{11, -5, 6}}}); registry.add("global/hTrackEtaPhiPV", ";Eta;Phi;", {HistType::kTH2D, {axiseta, {140, -3.5, 3.5}}}); + registry.add("global/hTrackEfficiencyPVGlobal", "0-All,1-ntpc,2-rat,3-chitpc,4chiits,5-dcaz,6-dcaxy,7pt,8eta;Track efficiency; Entries", {HistType::kTH1F, {{15, 0, 15}}}); + registry.add("global/hTrackEtaPhiPVGlobal", ";Eta;Phi;", {HistType::kTH2D, {axiseta, {140, -3.5, 3.5}}}); + registry.add("global/hSignalTPCvsPtPV", ";Pt;TPC Signal", {HistType::kTH2F, {axispt, {200, 0., 200}}}); registry.add("global/hITSbitPVtrk", "ITS bit for PV tracks; Layer hit;Entries", {HistType::kTH1F, {{10, 0., 10.}}}); registry.add("global/hITSnbitsVsEtaPVtrk", "n ITS bits vs #eta for PV tracks; #eta;Layer hit;Entries", {HistType::kTH2F, {axiseta, {8, -1., 7.}}}); registry.add("global/hITSbitVsEtaPVtrk", "ITS bit vs #eta for PV tracks; #eta;Layer hit;Entries", {HistType::kTH2F, {axiseta, {8, 0., 8.}}}); registry.add("global/hEventEff", "Event cut efficiency: 0-All,1-PV=4,2-Qtot=0,3-El;Cut;entries", {HistType::kTH1F, {{25, 0., 25.}}}); - registry.add("global/hNCombAfterCut", "Combinations after cut: 0-All,5-M3pi,10-Dphi,15-N_{e},20-N_{v#pi},25-Pt,30-Vcal,35-N_{vp},40-N_{vK},45-Tot;N_{comb};entries", {HistType::kTH1F, {{55, 0., 55.}}}); + registry.add("global/hNCombAfterCut", "Combinations after cut: 0-All,5-M3pi,10-Dphi,15-N_{e},20-N_{v#pi},25-Pt,30-Vcal,35-N_{vp},40-N_{vK},45-Tot;N_{comb};entries", {HistType::kTH1F, {{60, 0., 60.}}}); // registry.add("global/hInvMassElTrack", ";M_{inv}^{2};entries", {HistType::kTH1F, {{100, -0.01, 0.49}}}); - registry.add("global/hDeltaAngleTrackPV", ";#Delta#alpha;entries", {HistType::kTH1F, {{100, -0.01, 0.49}}}); + registry.add("global/hDeltaAngleTrackPV", ";#Delta#alpha;entries", {HistType::kTH1F, {{136, 0., 3.2}}}); // 0.49 registry.add("global/hTrkCheck", ";track type;entries", {HistType::kTH1F, {{16, -1, 15}}}); + registry.add("global1/hVertexZ", "Vertex position in z direction; #it{V}_{z} (cm); Collisions", {HistType::kTH1F, {{100, -25., 25.}}}); + registry.add("global1/hNTracks", ";N_{tracks};events", {HistType::kTH1D, {{20, 0., 20.}}}); + registry.add("global1/hNTracksPV", ";N_{tracks,PV};events", {HistType::kTH1D, {{20, 0., 20.}}}); + registry.add("global1/hTrackPtPV", ";p_T^{trk}; Entries", {HistType::kTH1F, {axispt}}); + registry.add("global1/hTrackEtaPhiPV", ";Eta;Phi;", {HistType::kTH2D, {axiseta, {140, -3.5, 3.5}}}); + registry.add("global1/hTrackPVTotCharge", "Q_{Tot};Q_{Tot}; Entries", {HistType::kTH1F, {{11, -5, 6}}}); + // cut0 registry.add("control/cut0/h3piMassComb", "3#pi mass, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});entries", {HistType::kTH1F, {minvAxis}}); registry.add("control/cut0/h3trkPtTot", ";p_{T} (GeV/c);entries", {HistType::kTH1F, {ptAxis}}); @@ -109,11 +154,27 @@ struct TauTau13topo { registry.add("control/cut0/h13AssymPt1ProngAver", ";Delta Pt/Sum Pt (1Prong,Aver Pt)", {HistType::kTH1F, {{100, -1., 1.}}}); registry.add("control/cut0/h13Vector", ";A_{V};entries", {HistType::kTH1F, {vectorAxis}}); registry.add("control/cut0/h13Scalar", ";A_{S};entries", {HistType::kTH1F, {scalarAxis}}); - registry.add("control/cut0/h13EtaSum", ";#eta^{1-prong}+#eta^{3-prong};entries", {HistType::kTH1F, {{100, -4., 4.}}}); + // registry.add("control/cut0/h13EtaSum", ";#eta^{1-prong}+#eta^{3-prong};entries", {HistType::kTH1F, {{100, -4., 4.}}}); registry.add("control/cut0/h4trkPtTot", ";p_{T} (GeV/c);entries", {HistType::kTH1F, {axispt}}); registry.add("control/cut0/h4piMass", "4#pi mass;M_{inv}^{4#pi} (GeV/c^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("control/cut0/h3pi1eMass", "3#pi+e mass;M_{inv}^{3#pi+e} (GeV/c^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); registry.add("control/cut0/h3piMassVsPt", "3#pi mass vs Pt, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});p_{T}^{3#pi} (GeV/c);entries", {HistType::kTH2F, {minvAxis, axispt}}); registry.add("control/cut0/h4trkMassVsPt", "4-track mass vs Pt;M_{inv}^{4track} (GeV/c^{2});p_{T}^{4track} (GeV/c);entries", {HistType::kTH2F, {{100, 1, 5.}, axispt}}); + registry.add("control/cut0/hsigma3Pi", "#sqrt{#sigma_{1}^{2 }+#sigma_{2}^{2}+#sigma_{3}^{2}};#sigma^{3#pi};entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("control/cut0/hNtofTrk", ";N_{TOF trk}; Entries", {HistType::kTH1F, {{7, 0., 7.}}}); + registry.add("control/cut0/hTPCnCrossedRows", "N crossed rows ;N_{TPC,crossed rows};entries", {HistType::kTH1F, {{160, 0, 160.}}}); + registry.add("control/cut0/hZNACenergy", "ZNA vs ZNC energy, cut0; #it{E}_{ZNA} (GeV); #it{E}_{ZNC} (GeV); Collisions", {HistType::kTH2F, {axisZDC, axisZDC}}); + + registry.add("control/cut0/hInvMass2ElAll", "Inv Mass of 2 Electrons from coherent peak;M_{inv}^{2e};entries", {HistType::kTH1F, {{150, -0.1, 9.}}}); + registry.add("control/cut0/hInvMass2ElCoh", "Inv Mass of 2 Electrons from coherent peak;M_{inv}^{2e};entries", {HistType::kTH1F, {{150, -0.1, 4.}}}); + registry.add("control/cut0/hGamPtCoh", ";p_{T} (GeV/c);entries", {HistType::kTH1F, {ptAxis}}); + registry.add("control/cut0/hGamPtCohIM0", ";p_{T} (GeV/c);entries", {HistType::kTH1F, {ptAxis}}); + registry.add("control/cut0/hN2gamma", "Number of gamma pairs among 3 comb;N_{#gamma#gamma};entries", {HistType::kTH1F, {{20, 0., 20.}}}); + registry.add("control/cut0/hGamAS", ";A_{S};entries", {HistType::kTH1F, {{100, 0, 0.2}}}); + registry.add("control/cut0/hGamAV", ";A_{V};entries", {HistType::kTH1F, {{100, 0, 0.2}}}); + registry.add("control/cut0/hInvMass2GamCoh", "Inv Mass of 2 Gamma from coherent peak;M_{inv}^{2#gamma};entries", {HistType::kTH1F, {{160, 0.5, 4.5}}}); + registry.add("control/cut0/hDeltaPhi2GamCoh", "Delta Phi of 2 Gamma from coherent peak;#Delta#phi^{2#gamma};entries", {HistType::kTH1F, {phiAxis}}); + // cut1 registry.add("control/cut1/h3piMassComb", "3#pi mass, 1 entry per event ;M_{inv}^{3#pi} (GeV/c^{2});entries", {HistType::kTH1F, {minvAxis}}); registry.add("control/cut1/h3trkPtTot", ";p_{T} (GeV/c);entries", {HistType::kTH1F, {ptAxis}}); @@ -121,9 +182,10 @@ struct TauTau13topo { registry.add("control/cut1/h13AssymPt1ProngAver", ";Delta Pt/Sum Pt (1Prong,Aver Pt)", {HistType::kTH1F, {{100, -1., 1.}}}); registry.add("control/cut1/h13Vector", ";A_{V};entries", {HistType::kTH1F, {vectorAxis}}); registry.add("control/cut1/h13Scalar", ";A_{S};entries", {HistType::kTH1F, {scalarAxis}}); - registry.add("control/cut1/h13EtaSum", ";#eta^{1-prong}+#eta^{3-prong};entries", {HistType::kTH1F, {{100, -4., 4.}}}); + // registry.add("control/cut1/h13EtaSum", ";#eta^{1-prong}+#eta^{3-prong};entries", {HistType::kTH1F, {{100, -4., 4.}}}); registry.add("control/cut1/h4trkPtTot", ";p_{T} (GeV/c);entries", {HistType::kTH1F, {axispt}}); registry.add("control/cut1/h4piMass", "4#pi mass;M_{inv}^{4#pi} (GeV/c^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("control/cut1/h3pi1eMass", "3#pi+e mass;M_{inv}^{3#pi+e} (GeV/c^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); registry.add("control/cut1/h3piMassVsPt", "3#pi mass vs Pt, 1 entry per event ;M_{inv}^{3#pi} (GeV/c^{2});p_{T}^{3#pi} (GeV/c);entries", {HistType::kTH2F, {minvAxis, axispt}}); registry.add("control/cut1/h4trkMassVsPt", "4-track mass vs Pt;M_{inv}^{4track} (GeV/c^{2});p_{T}^{4track} (GeV/c);entries", {HistType::kTH2F, {{100, 1, 5.}, axispt}}); registry.add("control/cut1/hDcaZ", "All 4 tracks dca ;dca_{Z};entries", {HistType::kTH1F, {{100, -0.05, 0.05}}}); @@ -131,6 +193,32 @@ struct TauTau13topo { registry.add("control/cut1/hChi2TPC", "All 4 tracks Chi2 ;Chi2_{TPC};entries", {HistType::kTH1F, {{48, -2, 10.}}}); registry.add("control/cut1/hChi2ITS", "All 4 tracks Chi2 ;Chi2_{ITS};entries", {HistType::kTH1F, {{44, -2, 20.}}}); registry.add("control/cut1/hTPCnclsFindable", "All 4 tracks NclFind ;N_{TPC,cl,findable};entries", {HistType::kTH1F, {{160, 0, 160.}}}); + registry.add("control/cut1/hsigma3Pi", "#sqrt{#sigma_{1}^{2 }+#sigma_{2}^{2}+#sigma_{3}^{2}};#sigma^{3#pi};entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("control/cut1/hNtofTrk", ";N_{TOF trk}; Entries", {HistType::kTH1F, {{7, 0., 7.}}}); + registry.add("control/cut1/hTPCnCrossedRows", "N crossed rows ;N_{TPC,crossed rows};entries", {HistType::kTH1F, {{160, 0, 160.}}}); + registry.add("control/cut1/hZNACenergy", "ZNA vs ZNC energy; #it{E}_{ZNA} (GeV); #it{E}_{ZNC} (GeV); Collisions", {HistType::kTH2F, {axisZDC, axisZDC}}); + + // // cut1a for 2 TMath::Pi()) - delta = TMath::TwoPi() - delta; + delta += o2::constants::math::TwoPI; + if (delta > o2::constants::math::PI) + delta = o2::constants::math::TwoPI - delta; return delta; } // fill control histograms per track template - void FillControlHistos(T pi3invMass, float pi3pt, float pi3deltaPhi, float pi3assymav, float pi3vector, float pi3scalar, float pi3etasum) + // void FillControlHistos(T pi3invMass, float pi3pt, float pi3deltaPhi, float pi3assymav, float pi3vector, float pi3scalar, float pi3etasum, float nCRtpc) + void FillControlHistos(T pi3invMass, float pi3pt, float pi3deltaPhi, float pi3assymav, float pi3vector, float pi3scalar, float nCRtpc) { static constexpr std::string_view histoname[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", @@ -273,7 +602,8 @@ struct TauTau13topo { registry.get(HIST("control/cut") + HIST(histoname[mode]) + HIST("/h13AssymPt1ProngAver"))->Fill(pi3assymav); registry.get(HIST("control/cut") + HIST(histoname[mode]) + HIST("/h13Vector"))->Fill(pi3vector); registry.get(HIST("control/cut") + HIST(histoname[mode]) + HIST("/h13Scalar"))->Fill(pi3scalar); - registry.get(HIST("control/cut") + HIST(histoname[mode]) + HIST("/h13EtaSum"))->Fill(pi3etasum); + // registry.get(HIST("control/cut") + HIST(histoname[mode]) + HIST("/h13EtaSum"))->Fill(pi3etasum); + registry.get(HIST("control/cut") + HIST(histoname[mode]) + HIST("/hTPCnCrossedRows"))->Fill(nCRtpc); } template @@ -316,44 +646,190 @@ struct TauTau13topo { return -1; } - using UDCollisionsFull = soa::Join; - using UDCollisionFull = UDCollisionsFull::iterator; + // using UDCollisionsFull = soa::Join; + // using UDCollisionFull = UDCollisionsFull::iterator; using UDTracksFull = soa::Join; - - void process(UDCollisionFull const& dgcand, UDTracksFull const& dgtracks) + using UDCollisionsFull2 = soa::Join; + using UDCollisionFull2 = UDCollisionsFull2::iterator; + + // PVContributors + Filter PVContributorFilter = aod::udtrack::isPVContributor == true; + using PVTracks = soa::Filtered; + + // void processDG(UDCollisionFull const& dgcand, UDTracksFull const& dgtracks) + // { + // int gapSide = 2; + // mainTask(gapSide,dgtracks); + // } + // PROCESS_SWITCH(TauTau13topo, processDG, "Process DG data", DGactive); + + // void processSG(UDCollisionFull2 const& dgcand, UDTracksFull const& dgtracks) + void process(UDCollisionFull2 const& dgcand, UDTracksFull const& dgtracks, PVTracks const& PVContributors) { + int gapSide = dgcand.gapSide(); + int truegapSide = sgSelector.trueGap(dgcand, FV0_cut, FT0A_cut, FT0C_cut, ZDC_cut); + registry.fill(HIST("global/GapSide"), gapSide); + registry.fill(HIST("global/GapSideTrue"), truegapSide); + if (gapSide < 0 || gapSide > 2) + return; + gapSide = truegapSide; + // mainTask(gapSide,dgtracks); + // } + // PROCESS_SWITCH(TauTau13topo, processSG, "Process SG data", SGactive); + // + // void mainTask(int gapSide, UDTracksFull const& dgtracks) + // { + if (gapSide != gap_Side) + return; // global checks registry.get(HIST("global/hVertexXY"))->Fill(dgcand.posX(), dgcand.posY()); registry.get(HIST("global/hVertexZ"))->Fill(dgcand.posZ()); - if (TMath::Abs(dgcand.posZ()) < 15) - registry.get(HIST("global/hVertexZ15"))->Fill(dgcand.posZ()); - if (TMath::Abs(dgcand.posZ()) < 10) - registry.get(HIST("global/hVertexZ10"))->Fill(dgcand.posZ()); + // if (TMath::Abs(dgcand.posZ()) < 10) + // registry.get(HIST("global/hVertexZ10"))->Fill(dgcand.posZ()); registry.get(HIST("global/hNTracks"))->Fill(dgtracks.size()); // setup PV tracks partition - Partition PVContributors = aod::udtrack::isPVContributor == true; - PVContributors.bindTable(dgtracks); + // Partition PVContributors = aod::udtrack::isPVContributor == true; + // PVContributors.bindTable(dgtracks); registry.get(HIST("global/hNTracksPV"))->Fill(PVContributors.size()); + // zdc information + float ZNAenergy = dgcand.energyCommonZNA(); + float ZNCenergy = dgcand.energyCommonZNC(); + // if (ZNAenergy < 0) registry.get(HIST("global/hZNACenergyTest"))->Fill(ZNAenergy); + // if (ZNCenergy < 0) registry.get(HIST("global/hZNACenergyTest"))->Fill(ZNCenergy); + if (ZNAenergy < 0) + ZNAenergy = -1.; + if (ZNCenergy < 0) + ZNCenergy = -1.; + registry.get(HIST("global/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + registry.get(HIST("global/hZNACtime"))->Fill(dgcand.timeZNA(), dgcand.timeZNC()); + uint32_t clusterSizes; + // UChar_t clustermap1; + // bool isInnerITS = false; int nTofTrk = 0; int nEtaIn15 = 0; - int nITSbits = 0; + int nITSbits = -1; + int npT100 = 0; TLorentzVector p; - TParticlePDG* pion = pdg->GetParticle(211); + auto pionMass = pdg->Mass(211); + auto electronMass = pdg->Mass(11); + // TParticlePDG* pion = pdg->GetParticle(211); + // TParticlePDG* electron = pdg->GetParticle(11); + bool flagGlobalCheck = true; + bool isGlobalTrack = true; + int qtot = 0; // loop over PV contributors for (const auto& trk : PVContributors) { - p.SetXYZM(trk.px(), trk.py(), trk.pz(), pion->Mass()); + qtot += trk.sign(); + p.SetXYZM(trk.px(), trk.py(), trk.pz(), pionMass); registry.get(HIST("global/hTrackPtPV"))->Fill(p.Pt()); - if (TMath::Abs(p.Eta()) < trkEtacut) + if (std::abs(p.Eta()) < trkEtacut) nEtaIn15++; // 1.5 is a default registry.get(HIST("global/hTrackEtaPhiPV"))->Fill(p.Eta(), p.Phi()); - nITSbits = -1; + + if (trk.pt() > 0.1) + npT100++; + + if (flagGlobalCheck) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(0., 1.); + if (trk.tpcNClsCrossedRows() > 70) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(1., 1.); + } else { + isGlobalTrack = false; + } + + if (trk.tpcNClsFindable() == 0) { + isGlobalTrack = false; + } else { + if (trk.tpcNClsCrossedRows() / trk.tpcNClsFindable() > 0.8) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(2., 1.); + } else { + isGlobalTrack = false; + } + } + + if (trk.tpcChi2NCl() < 4.) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(3., 1.); + } else { + isGlobalTrack = false; + } + + if (trk.itsChi2NCl() < 36.) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(4., 1.); + } else { + isGlobalTrack = false; + } + + if (trk.dcaZ() < 2.) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(5., 1.); + } else { + isGlobalTrack = false; + } + + if (trk.dcaXY() < 0.0105 * 0.035 / std::pow(trk.pt(), 1.1)) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(6., 1.); + } else { + isGlobalTrack = false; + } + + if (trk.pt() > 0.1) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(7., 1.); + } else { + isGlobalTrack = false; + } + + if (std::abs(p.Eta()) < 0.8) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(8., 1.); + } else { + isGlobalTrack = false; + } + + if (trk.hasITS()) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(9., 1.); + + // old version + // clustermap1 = trk.itsClusterMap(); + // for (int bitNo = 0; bitNo < 7; bitNo++) { + // if (TESTBIT(clustermap1, bitNo)) { // check ITS bits/layers for each PV track + // registry.get(HIST("global/hITSbitPVtrk"))->Fill(bitNo, 1.); + // registry.get(HIST("global/hITSbitVsEtaPVtrk"))->Fill(p.Eta(), bitNo, 1.); + // nITSbits++; + // } + // } // end of loop over ITS bits + // + // isInnerITS = TESTBIT(clustermap1, 0) || TESTBIT(clustermap1, 1) || TESTBIT(clustermap1, 2); + // if (isInnerITS) { + // registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(10., 1.); + // } else { + // isGlobalTrack = false; + // } + // + } else { + isGlobalTrack = false; + } + + if (trk.hasTPC()) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(11., 1.); + } else { + isGlobalTrack = false; + } + + // final global track + if (isGlobalTrack) { + registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(13., 1.); + registry.get(HIST("global/hTrackEtaPhiPVGlobal"))->Fill(p.Eta(), p.Phi()); + } + } // end of flag check global + + // new version if (trk.hasITS()) { // ITS track + nITSbits = -1; clusterSizes = trk.itsClusterSizes(); + // LOGF(info, " clistersize: %d", clusterSizes); for (int layer = 0; layer < 7; layer++) { if ((clusterSizes >> (layer * 4)) & 0xf) { registry.get(HIST("global/hITSbitPVtrk"))->Fill(layer, 1.); @@ -361,13 +837,19 @@ struct TauTau13topo { nITSbits++; } } // end of loop over ITS bits - } // has ITS + // isInnerITS = TESTBIT(clustermap1, 0) || TESTBIT(clustermap1, 1) || TESTBIT(clustermap1, 2); + // if (isInnerITS) { + // registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(10., 1.); + // } else { + // isGlobalTrack = false; + // } + } // has ITS registry.get(HIST("global/hITSnbitsVsEtaPVtrk"))->Fill(p.Eta(), nITSbits); if (trk.hasTPC()) registry.get(HIST("global/hSignalTPCvsPtPV"))->Fill(p.Pt(), trk.tpcSignal()); if (trk.hasTOF()) nTofTrk++; - } + } // end of loop over PV tracks registry.get(HIST("global/hNtofTrk"))->Fill(nTofTrk); // @@ -376,17 +858,35 @@ struct TauTau13topo { registry.get(HIST("global/hEventEff"))->Fill(0., 1.); // skip events with too few/many tracks - if (dgcand.numContrib() != 4) { + // if (PVContributors.size() != 4 || dgcand.numContrib() != 4) { + if (PVContributors.size() != 4) { if (verbose) { - LOGF(info, " Candidate rejected: Number of PV contributors is %d", dgcand.numContrib()); + LOGF(info, " Candidate rejected: Number of PV contributors is %d, candContriv %d", PVContributors.size(), dgcand.numContrib()); } return; } + // old version in DG producer + // if (dgcand.numContrib() != 4) { + // if (verbose) { + // LOGF(info, " Candidate rejected: Number of PV contributors is %d", dgcand.numContrib()); + // } + // return; + // } + registry.get(HIST("global/hEventEff"))->Fill(1., 1.); - registry.get(HIST("global/hTrackPVTotCharge"))->Fill(dgcand.netCharge()); + // registry.get(HIST("global1/hTrackPVTotCharge"))->Fill(dgcand.netCharge()); + registry.get(HIST("global1/hTrackPVTotCharge"))->Fill(qtot); + registry.get(HIST("global1/hVertexZ"))->Fill(dgcand.posZ()); + registry.get(HIST("global1/hNTracks"))->Fill(dgtracks.size()); + registry.get(HIST("global1/hNTracksPV"))->Fill(PVContributors.size()); + for (const auto& trk : PVContributors) { + p.SetXYZM(trk.px(), trk.py(), trk.pz(), pionMass); + registry.get(HIST("global1/hTrackPtPV"))->Fill(p.Pt()); + registry.get(HIST("global1/hTrackEtaPhiPV"))->Fill(p.Eta(), p.Phi()); + } // if vz < 15 - if (TMath::Abs(dgcand.posZ()) >= zvertexcut) { // default = 15 + if (std::abs(dgcand.posZ()) >= zvertexcut) { // default = 15 if (verbose) { LOGF(info, " Candidate rejected: VertexZ is %f", dgcand.posZ()); } @@ -405,16 +905,18 @@ struct TauTau13topo { // skip events with net charge != 0 if (!sameSign) { // opposite sign is signal - if (dgcand.netCharge() != 0) { + // if (dgcand.netCharge() != 0) { + if (qtot != 0) { if (verbose) { - LOGF(info, " Candidate rejected: Net charge is %d, while should be 0", dgcand.netCharge()); + LOGF(info, " Candidate rejected: Net charge is %d (dgcand %d), while should be 0", qtot, dgcand.netCharge()); } return; } } else { // same sign is background - if (dgcand.netCharge() == 0) { + // if (dgcand.netCharge() == 0) { + if (qtot == 0) { if (verbose) { - LOGF(info, " Candidate rejected: Net charge is %d, while should be not 0", dgcand.netCharge()); + LOGF(info, " Candidate rejected: Net charge is %d (dgcand %d), while should be not 0", qtot, dgcand.netCharge()); } return; } @@ -463,6 +965,15 @@ struct TauTau13topo { // } // registry.get(HIST("global/hEventEff"))->Fill(5., 1.); + // if pt tracks >0.100 GeV/c + if (npT100 != 4) { + if (verbose) { + LOGF(info, " Candidate rejected: number of tracks with pT>0.1GeV/c is %d", npT100); + } + return; + } + registry.get(HIST("global/hEventEff"))->Fill(5., 1.); + // // here PID from TPC starts to be // @@ -476,11 +987,12 @@ struct TauTau13topo { float pi3assymav[4]; float pi3vector[4]; float pi3scalar[4]; - float pi3etasum[4]; + // float pi3etasum[4]; float deltaPhiTmp = 0; float scalarPtsum = 0; float nSigmaEl[4]; float nSigmaPi[4]; + float nSigma3Pi[4] = {0., 0., 0., 0.}; float nSigmaPr[4]; float nSigmaKa[4]; float dcaZ[4]; @@ -488,15 +1000,49 @@ struct TauTau13topo { float chi2TPC[4]; float chi2ITS[4]; float nclTPCfind[4]; + float nclTPCcrossedRows[4]; + bool tmpHasTOF[4]; + float mass3pi1e[4]; + double trkTime[4]; + float trkTimeRes[4]; + double trkTimeTot = 0.; + float trkTimeResTot = 10000.; + + // 2 gamma from 4 electrons + // 12 34 | 01 23 |//1 //6 | 0 5 |counter<3?counter:5-counter counter<3?0:1 + // 13 24 | 02 13 |//2 //5 | 1 4 | + // 14 23 | 03 12 |//3 //4 | 2 3 | + TLorentzVector p1, p2; + TLorentzVector gammaPair[3][2]; + float invMass2El[3][2]; + int counterTmp = 0; + bool flagIMGam2ePV[4] = {true, true, true, true}; + + for (const auto& trk : PVContributors) { + p.SetXYZM(trk.px(), trk.py(), trk.pz(), electronMass); + for (const auto& trk1 : PVContributors) { + if (trk.index() >= trk1.index()) + continue; + p1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), electronMass); + invMass2El[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1).Mag2(); + gammaPair[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1); + registry.get(HIST("control/cut0/hInvMass2ElAll"))->Fill((p + p1).Mag2()); + counterTmp++; + if ((p + p1).M() < 0.015) { + flagIMGam2ePV[trk.index()] = false; + flagIMGam2ePV[trk1.index()] = false; + } + } // end of loop over PVContributors + } // end of loop over PVContributors // first loop to add all the tracks together - TLorentzVector p1; p = TLorentzVector(0., 0., 0., 0.); for (const auto& trk : PVContributors) { - p1.SetXYZM(trk.px(), trk.py(), trk.pz(), pion->Mass()); + p1.SetXYZM(trk.px(), trk.py(), trk.pz(), pionMass); p += p1; scalarPtsum += trk.pt(); - } + } // end of loop over PVContributors + float pttot = p.Pt(); float mass4pi = p.Mag(); @@ -507,12 +1053,17 @@ struct TauTau13topo { bool flagVcalPV[4] = {false, false, false, false}; // second loop to calculate 1 by 1 each combinatorial variable - int counterTmp = 0; + counterTmp = 0; int tmpTrkCheck = -1; for (const auto& trk : PVContributors) { tmpTrkCheck = TrackCheck(trk); // check detectors associated to track registry.get(HIST("global/hTrkCheck"))->Fill(tmpTrkCheck); + // inv mass of 3pi + 1e + p1.SetXYZM(trk.px(), trk.py(), trk.pz(), pionMass); + p2.SetXYZM(trk.px(), trk.py(), trk.pz(), electronMass); + mass3pi1e[counterTmp] = (p - p1 + p2).Mag(); + v1.SetXYZ(trk.px(), trk.py(), trk.pz()); for (const auto& trk1 : PVContributors) { if (trk.index() == trk1.index()) @@ -523,9 +1074,10 @@ struct TauTau13topo { if (deltaphi < minAnglecut) { // default 0.05 flagVcalPV[counterTmp] = true; } - } + } // end of loop over PVContributors nSigmaEl[counterTmp] = trk.tpcNSigmaEl(); nSigmaPi[counterTmp] = trk.tpcNSigmaPi(); + nSigma3Pi[3] += (nSigmaPi[counterTmp] * nSigmaPi[counterTmp]); nSigmaPr[counterTmp] = trk.tpcNSigmaPr(); nSigmaKa[counterTmp] = trk.tpcNSigmaKa(); dcaZ[counterTmp] = trk.dcaZ(); @@ -533,8 +1085,12 @@ struct TauTau13topo { chi2TPC[counterTmp] = trk.tpcChi2NCl(); chi2ITS[counterTmp] = trk.itsChi2NCl(); nclTPCfind[counterTmp] = trk.tpcNClsFindable(); + nclTPCcrossedRows[counterTmp] = trk.tpcNClsCrossedRows(); + tmpHasTOF[counterTmp] = trk.hasTOF(); + trkTime[counterTmp] = trk.trackTime(); + trkTimeRes[counterTmp] = trk.trackTimeRes(); - p1.SetXYZM(trk.px(), trk.py(), trk.pz(), pion->Mass()); + p1.SetXYZM(trk.px(), trk.py(), trk.pz(), pionMass); tmpMomentum[counterTmp] = p1.P(); tmpPt[counterTmp] = p1.Pt(); tmpDedx[counterTmp] = trk.tpcSignal(); @@ -546,23 +1102,118 @@ struct TauTau13topo { pi3assymav[counterTmp] = (p1.Pt() - (scalarPtsum - p1.Pt()) / 3.) / (p1.Pt() + (scalarPtsum - p1.Pt()) / 3.); pi3vector[counterTmp] = (p + p1).Pt() / (p - p1).Pt(); pi3scalar[counterTmp] = (p.Pt() - p1.Pt()) / (p.Pt() + p1.Pt()); - pi3etasum[counterTmp] = (p - p1).Eta() + p1.Eta(); + // pi3etasum[counterTmp] = (p - p1).Eta() + p1.Eta(); counterTmp++; + } // end of loop over PVContributors + + // calculate trk time and resolution total + // 1. find best resolution + int iTmpBest = -1; + for (int i = 0; i < 4; i++) { + if (trkTimeRes[i] < trkTimeResTot) { + trkTimeResTot = trkTimeRes[i]; + iTmpBest = i; + } } + // 2. use best resol to calculate total time + for (int i = 0; i < 4; i++) { + if (i == iTmpBest) + continue; + trkTimeTot += fabs(trkTime[iTmpBest] - trkTime[i]); + } + trkTimeResTot = std::sqrt(trkTimeRes[0] * trkTimeRes[0] + + trkTimeRes[1] * trkTimeRes[1] + + trkTimeRes[2] * trkTimeRes[2] + + trkTimeRes[3] * trkTimeRes[3]); // control histos, max 4 per event, cut0 for (int i = 0; i < 4; i++) { - FillControlHistos<0>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], pi3etasum[i]); + FillControlHistos<0>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); registry.get(HIST("control/cut0/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); registry.get(HIST("pidTPC/hpvsdedxElHipCut0"))->Fill(tmpMomentum[i], tmpDedx[i]); - } + // nsigma3Pi calculation + nSigma3Pi[i] = nSigma3Pi[3] - (nSigmaPi[i] * nSigmaPi[i]); + nSigma3Pi[i] = std::sqrt(nSigma3Pi[i]); + registry.get(HIST("control/cut0/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut0/h3pi1eMass"))->Fill(mass3pi1e[i]); + } // end of loop over 4 tracks + // control, 1 per event registry.get(HIST("control/cut0/h4trkPtTot"))->Fill(pttot); registry.get(HIST("control/cut0/h4piMass"))->Fill(mass4pi); registry.get(HIST("control/cut0/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut0/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut0/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + + if (pttot < 0.150) { + // give all the gg combinations + // 12 34 + // 13 24 + // 14 23 + int nGamPair = 0; + int nGamma = 0; + int whichPair = -1; + float scalarAsym = -1; + float vectorAsym = -1; + bool electronCheck = true; + for (int i = 0; i < 4; i++) { + if (std::abs(nSigmaEl[i]) > 5) + electronCheck = false; + } // end of loop over 4 tracks + + for (int i = 0; i < 3; i++) { + registry.get(HIST("control/cut0/hInvMass2ElCoh"))->Fill(invMass2El[i][0]); + registry.get(HIST("control/cut0/hInvMass2ElCoh"))->Fill(invMass2El[i][1]); + registry.get(HIST("control/cut0/hGamPtCoh"))->Fill(gammaPair[i][0].Pt()); + registry.get(HIST("control/cut0/hGamPtCoh"))->Fill(gammaPair[i][1].Pt()); + if (invMass2El[i][0] < 0.15) { + nGamma++; + registry.get(HIST("control/cut0/hGamPtCohIM0"))->Fill(gammaPair[i][0].Pt()); + } + if (invMass2El[i][1] < 0.15) { + nGamma++; + registry.get(HIST("control/cut0/hGamPtCohIM0"))->Fill(gammaPair[i][1].Pt()); + } + if (invMass2El[i][0] < 0.15 && invMass2El[i][1] < 0.15) { + nGamPair++; + whichPair = i; + } + } // end of loop over 3 tracks + registry.get(HIST("control/cut0/hN2gamma"))->Fill(nGamma); + registry.get(HIST("control/cut0/hN2gamma"))->Fill(10 + nGamPair); + if (nGamPair == 1) { + scalarAsym = std::abs(gammaPair[whichPair][1].Pt() - gammaPair[whichPair][0].Pt()) / (gammaPair[whichPair][1].Pt() + gammaPair[whichPair][0].Pt()); + if ((gammaPair[whichPair][1] - gammaPair[whichPair][0]).Pt() != 0) + vectorAsym = (gammaPair[whichPair][1] + gammaPair[whichPair][0]).Pt() / (gammaPair[whichPair][1] - gammaPair[whichPair][0]).Pt(); + registry.get(HIST("control/cut0/hGamAS"))->Fill(scalarAsym); + registry.get(HIST("control/cut0/hGamAV"))->Fill(vectorAsym); + registry.get(HIST("control/cut0/hInvMass2GamCoh"))->Fill((gammaPair[whichPair][1] + gammaPair[whichPair][0]).M()); + registry.get(HIST("control/cut0/hDeltaPhi2GamCoh"))->Fill(CalculateDeltaPhi(gammaPair[whichPair][1], gammaPair[whichPair][0])); + for (int j = 0; j < 4; j++) + registry.get(HIST("pidTPC/hpvsdedxElHipCut40"))->Fill(tmpMomentum[j], tmpDedx[j]); + if ((gammaPair[whichPair][1] + gammaPair[whichPair][0]).M() > 3. && + (gammaPair[whichPair][1] + gammaPair[whichPair][0]).M() < 4.) { + for (int j = 0; j < 4; j++) + registry.get(HIST("pidTPC/hpvsdedxElHipCut0CohPsi2s"))->Fill(tmpMomentum[j], tmpDedx[j]); + } - // remove combinatoric + if (electronCheck) { + registry.get(HIST("control/cut20/hInvMass2ElCoh"))->Fill(gammaPair[whichPair][0].M()); + registry.get(HIST("control/cut20/hInvMass2ElCoh"))->Fill(gammaPair[whichPair][1].M()); + registry.get(HIST("control/cut20/hGamPtCohIM0"))->Fill(gammaPair[whichPair][0].Pt()); + registry.get(HIST("control/cut20/hGamPtCohIM0"))->Fill(gammaPair[whichPair][1].Pt()); + registry.get(HIST("control/cut20/hGamAS"))->Fill(scalarAsym); + registry.get(HIST("control/cut20/hGamAV"))->Fill(vectorAsym); + registry.get(HIST("control/cut20/hInvMass2GamCoh"))->Fill((gammaPair[whichPair][1] + gammaPair[whichPair][0]).M()); + registry.get(HIST("control/cut20/hDeltaPhi2GamCoh"))->Fill(CalculateDeltaPhi(gammaPair[whichPair][1], gammaPair[whichPair][0])); + } + + } // ngam = 1 + + } // end of check ptot<0.15 + + // remove combinatorics bool flagTotal[4] = {false, false, false, false}; bool flagIM[4] = {false, false, false, false}; bool flagDP[4] = {false, false, false, false}; @@ -571,18 +1222,24 @@ struct TauTau13topo { bool flagPt[4] = {false, false, false, false}; bool flagPr[4] = {false, false, false, false}; bool flagKa[4] = {false, false, false, false}; + bool flagCR[4] = {false, false, false, false}; + bool flagS3pi[4] = {false, false, false, false}; // bool flagVcalPV[4]={false,false,false,false}; // float deltaphi=0; for (int i = 0; i < 4; i++) { - if (pi3invMass[i] < 1.8) { - flagIM[i] = true; + if (pi3invMass[i] < invMass3piMaxcut) { // default should be 1.8 + if (invMass3piSignalRegion) { + flagIM[i] = true; + } else { + flagIM[i] = false; + } } else { registry.get(HIST("pidTPC/hpvsdedxElHipCut2"))->Fill(tmpMomentum[i], tmpDedx[i]); } - if (pi3deltaPhi[i] > 1.6) { + if (pi3deltaPhi[i] > deltaPhiMincut) { // default should be 1.6 flagDP[i] = true; } else { registry.get(HIST("pidTPC/hpvsdedxElHipCut3"))->Fill(tmpMomentum[i], tmpDedx[i]); @@ -594,7 +1251,7 @@ struct TauTau13topo { registry.get(HIST("pidTPC/hpvsdedxElHipCut4"))->Fill(tmpMomentum[i], tmpDedx[i]); } - if (TMath::Abs(nSigmaPi[i]) > maxNsigmaPiVetocut) { // default is 4 + if (std::abs(nSigmaPi[i]) > maxNsigmaPiVetocut) { // default is 4 flagPi[i] = true; } else { registry.get(HIST("pidTPC/hpvsdedxElHipCut5"))->Fill(tmpMomentum[i], tmpDedx[i]); @@ -614,20 +1271,36 @@ struct TauTau13topo { registry.get(HIST("pidTPC/hpvsdedxElHipCut8"))->Fill(tmpMomentum[i], tmpDedx[i]); } - if (TMath::Abs(nSigmaPr[i]) > maxNsigmaPrVetocut) { // default is 3 + if (std::abs(nSigmaPr[i]) > maxNsigmaPrVetocut) { // default is 3 flagPr[i] = true; } else { registry.get(HIST("pidTPC/hpvsdedxElHipCut9"))->Fill(tmpMomentum[i], tmpDedx[i]); } - if (TMath::Abs(nSigmaKa[i]) > maxNsigmaKaVetocut) { // default is 3 + if (std::abs(nSigmaKa[i]) > maxNsigmaKaVetocut) { // default is 3 flagKa[i] = true; } else { registry.get(HIST("pidTPC/hpvsdedxElHipCut10"))->Fill(tmpMomentum[i], tmpDedx[i]); } - flagTotal[i] = flagEl[i] && flagPi[i] && flagPt[i] && !flagVcalPV[i] && flagPr[i] && flagKa[i]; - } + if (nclTPCcrossedRows[i] > nTPCcrossedRowsMinCut) { // default is 50 + flagCR[i] = true; + } else { + registry.get(HIST("pidTPC/hpvsdedxElHipCut11"))->Fill(tmpMomentum[i], tmpDedx[i]); + } + + if (nSigma3Pi[i] < nSigma3piMaxCut) { // default is 5 + flagS3pi[i] = true; + } else { + registry.get(HIST("pidTPC/hpvsdedxElHipCut12"))->Fill(tmpMomentum[i], tmpDedx[i]); + } + + if (flagIMGam2ePV[i]) { + registry.get(HIST("pidTPC/hpvsdedxElHipCut13"))->Fill(tmpMomentum[i], tmpDedx[i]); + } + + flagTotal[i] = flagEl[i] && flagPi[i] && flagPt[i] && !flagVcalPV[i] && flagPr[i] && flagKa[i] && flagIM[i] && flagDP[i] && flagCR[i] && flagS3pi[i]; + } // end of loop over 4 tracks int counterM3pi = flagIM[0] + flagIM[1] + flagIM[2] + flagIM[3]; int counterDphi = flagDP[0] + flagDP[1] + flagDP[2] + flagDP[3]; @@ -636,7 +1309,9 @@ struct TauTau13topo { int counterPr = flagPr[0] + flagPr[1] + flagPr[2] + flagPr[3]; int counterKa = flagKa[0] + flagKa[1] + flagKa[2] + flagKa[3]; int counterPt = flagPt[0] + flagPt[1] + flagPt[2] + flagPt[3]; + int counterCR = flagCR[0] + flagCR[1] + flagCR[2] + flagCR[3]; int counterVcal = !flagVcalPV[0] + !flagVcalPV[1] + !flagVcalPV[2] + !flagVcalPV[3]; + int counterS3pi = flagS3pi[0] + flagS3pi[1] + flagS3pi[2] + flagS3pi[3]; int counterTotal = flagTotal[0] + flagTotal[1] + flagTotal[2] + flagTotal[3]; registry.get(HIST("global/hNCombAfterCut"))->Fill(5. + counterM3pi, 1.); @@ -647,7 +1322,9 @@ struct TauTau13topo { registry.get(HIST("global/hNCombAfterCut"))->Fill(30. + counterVcal, 1.); registry.get(HIST("global/hNCombAfterCut"))->Fill(35. + counterPr, 1.); registry.get(HIST("global/hNCombAfterCut"))->Fill(40. + counterKa, 1.); - registry.get(HIST("global/hNCombAfterCut"))->Fill(45. + counterTotal, 1.); + registry.get(HIST("global/hNCombAfterCut"))->Fill(45. + counterCR, 1.); + registry.get(HIST("global/hNCombAfterCut"))->Fill(50. + counterS3pi, 1.); + registry.get(HIST("global/hNCombAfterCut"))->Fill(55. + counterTotal, 1.); // draw PID histograms if (counterEl > 0) { // Nelectrons>0, cut20 @@ -655,11 +1332,19 @@ struct TauTau13topo { registry.get(HIST("control/cut20/h4trkPtTot"))->Fill(pttot); registry.get(HIST("control/cut20/h4piMass"))->Fill(mass4pi); registry.get(HIST("control/cut20/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut20/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut20/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); for (int i = 0; i < 4; i++) { if (flagEl[i]) { registry.get(HIST("pidTPC/hpvsdedxElHipCut20"))->Fill(tmpMomentum[i], tmpDedx[i]); - FillControlHistos<20>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], pi3etasum[i]); + // for (int j = 0; j < 4; j++) { + // if (i == j) continue; + // registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut20"))->Fill(tmpMomentum[j], tmpDedx[j]); + // } + FillControlHistos<20>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); registry.get(HIST("control/cut20/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut20/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut20/h3pi1eMass"))->Fill(mass3pi1e[i]); } } @@ -668,11 +1353,19 @@ struct TauTau13topo { registry.get(HIST("control/cut21/h4trkPtTot"))->Fill(pttot); registry.get(HIST("control/cut21/h4piMass"))->Fill(mass4pi); registry.get(HIST("control/cut21/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut21/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut21/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); for (int i = 0; i < 4; i++) { if (flagEl[i] && flagPi[i]) { registry.get(HIST("pidTPC/hpvsdedxElHipCut21"))->Fill(tmpMomentum[i], tmpDedx[i]); - FillControlHistos<21>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], pi3etasum[i]); + // for (int j = 0; j < 4; j++) { + // if (i == j) continue; + // registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut21"))->Fill(tmpMomentum[j], tmpDedx[j]); + // } + FillControlHistos<21>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); registry.get(HIST("control/cut21/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut21/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut21/h3pi1eMass"))->Fill(mass3pi1e[i]); } } @@ -685,11 +1378,19 @@ struct TauTau13topo { registry.get(HIST("control/cut22/h4trkPtTot"))->Fill(pttot); registry.get(HIST("control/cut22/h4piMass"))->Fill(mass4pi); registry.get(HIST("control/cut22/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut22/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut22/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); for (int i = 0; i < 4; i++) { if (flagEl[i] && flagPi[i] && !flagVcalPV[i]) { registry.get(HIST("pidTPC/hpvsdedxElHipCut22"))->Fill(tmpMomentum[i], tmpDedx[i]); - FillControlHistos<22>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], pi3etasum[i]); + // for (int j = 0; j < 4; j++) { + // if (i == j) continue; + // registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut22"))->Fill(tmpMomentum[j], tmpDedx[j]); + // } + FillControlHistos<22>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); registry.get(HIST("control/cut22/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut22/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut22/h3pi1eMass"))->Fill(mass3pi1e[i]); } } @@ -702,11 +1403,19 @@ struct TauTau13topo { registry.get(HIST("control/cut23/h4trkPtTot"))->Fill(pttot); registry.get(HIST("control/cut23/h4piMass"))->Fill(mass4pi); registry.get(HIST("control/cut23/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut23/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut23/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); for (int i = 0; i < 4; i++) { if (flagEl[i] && flagPi[i] && !flagVcalPV[i] && flagPt[i]) { registry.get(HIST("pidTPC/hpvsdedxElHipCut23"))->Fill(tmpMomentum[i], tmpDedx[i]); - FillControlHistos<23>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], pi3etasum[i]); + // for (int j = 0; j < 4; j++) { + // if (i == j) continue; + // registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut23"))->Fill(tmpMomentum[j], tmpDedx[j]); + // } + FillControlHistos<23>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); registry.get(HIST("control/cut23/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut23/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut23/h3pi1eMass"))->Fill(mass3pi1e[i]); } } @@ -719,11 +1428,19 @@ struct TauTau13topo { registry.get(HIST("control/cut24/h4trkPtTot"))->Fill(pttot); registry.get(HIST("control/cut24/h4piMass"))->Fill(mass4pi); registry.get(HIST("control/cut24/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut24/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut24/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); for (int i = 0; i < 4; i++) { if (flagEl[i] && flagPi[i] && !flagVcalPV[i] && flagPt[i] && flagPr[i]) { registry.get(HIST("pidTPC/hpvsdedxElHipCut24"))->Fill(tmpMomentum[i], tmpDedx[i]); - FillControlHistos<24>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], pi3etasum[i]); + // for (int j = 0; j < 4; j++) { + // if (i == j) continue; + // registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut24"))->Fill(tmpMomentum[j], tmpDedx[j]); + // } + FillControlHistos<24>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); registry.get(HIST("control/cut24/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut24/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut24/h3pi1eMass"))->Fill(mass3pi1e[i]); } } @@ -736,14 +1453,137 @@ struct TauTau13topo { registry.get(HIST("control/cut25/h4trkPtTot"))->Fill(pttot); registry.get(HIST("control/cut25/h4piMass"))->Fill(mass4pi); registry.get(HIST("control/cut25/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut25/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut25/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); for (int i = 0; i < 4; i++) { if (flagEl[i] && flagPi[i] && !flagVcalPV[i] && flagPt[i] && flagPr[i] && flagKa[i]) { registry.get(HIST("pidTPC/hpvsdedxElHipCut25"))->Fill(tmpMomentum[i], tmpDedx[i]); - FillControlHistos<25>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], pi3etasum[i]); + // for (int j = 0; j < 4; j++) { + // if (i == j) continue; + // registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut25"))->Fill(tmpMomentum[j], tmpDedx[j]); + // } + FillControlHistos<25>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); registry.get(HIST("control/cut25/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut25/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut25/h3pi1eMass"))->Fill(mass3pi1e[i]); } } + if (flagEl[0] * flagPi[0] * !flagVcalPV[0] * flagPt[0] * flagPr[0] * flagKa[0] * flagIM[0] + + flagEl[1] * flagPi[1] * !flagVcalPV[1] * flagPt[1] * flagPr[1] * flagKa[1] * flagIM[1] + + flagEl[2] * flagPi[2] * !flagVcalPV[2] * flagPt[2] * flagPr[2] * flagKa[2] * flagIM[2] + + flagEl[3] * flagPi[3] * !flagVcalPV[3] * flagPt[3] * flagPr[3] * flagKa[3] * flagIM[3] > + 0) { // 3pi cut, cut26 + registry.get(HIST("global/hEventEff"))->Fill(12., 1.); + registry.get(HIST("control/cut26/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut26/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut26/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut26/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut26/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + for (int i = 0; i < 4; i++) { + if (flagEl[i] && flagPi[i] && !flagVcalPV[i] && flagPt[i] && flagPr[i] && flagKa[i] && flagIM[i]) { + registry.get(HIST("pidTPC/hpvsdedxElHipCut26"))->Fill(tmpMomentum[i], tmpDedx[i]); + // for (int j = 0; j < 4; j++) { + // if (i == j) continue; + // registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut26"))->Fill(tmpMomentum[j], tmpDedx[j]); + // } + FillControlHistos<26>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut26/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut26/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut26/h3pi1eMass"))->Fill(mass3pi1e[i]); + } + } + + if (flagEl[0] * flagPi[0] * !flagVcalPV[0] * flagPt[0] * flagPr[0] * flagKa[0] * flagIM[0] * flagDP[0] + + flagEl[1] * flagPi[1] * !flagVcalPV[1] * flagPt[1] * flagPr[1] * flagKa[1] * flagIM[1] * flagDP[1] + + flagEl[2] * flagPi[2] * !flagVcalPV[2] * flagPt[2] * flagPr[2] * flagKa[2] * flagIM[2] * flagDP[2] + + flagEl[3] * flagPi[3] * !flagVcalPV[3] * flagPt[3] * flagPr[3] * flagKa[3] * flagIM[3] * flagDP[3] > + 0) { // delta phi cut, cut27 + registry.get(HIST("global/hEventEff"))->Fill(13., 1.); + registry.get(HIST("control/cut27/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut27/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut27/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut27/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut27/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + for (int i = 0; i < 4; i++) { + if (flagEl[i] && flagPi[i] && !flagVcalPV[i] && flagPt[i] && flagPr[i] && flagKa[i] && flagIM[i] && flagDP[i]) { + registry.get(HIST("pidTPC/hpvsdedxElHipCut27"))->Fill(tmpMomentum[i], tmpDedx[i]); + // for (int j = 0; j < 4; j++) { + // if (i == j) continue; + // registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut27"))->Fill(tmpMomentum[j], tmpDedx[j]); + // } + FillControlHistos<27>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut27/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut27/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut27/h3pi1eMass"))->Fill(mass3pi1e[i]); + } + } + + if (flagEl[0] * flagPi[0] * !flagVcalPV[0] * flagPt[0] * flagPr[0] * flagKa[0] * flagIM[0] * flagDP[0] * flagCR[0] + + flagEl[1] * flagPi[1] * !flagVcalPV[1] * flagPt[1] * flagPr[1] * flagKa[1] * flagIM[1] * flagDP[1] * flagCR[1] + + flagEl[2] * flagPi[2] * !flagVcalPV[2] * flagPt[2] * flagPr[2] * flagKa[2] * flagIM[2] * flagDP[2] * flagCR[2] + + flagEl[3] * flagPi[3] * !flagVcalPV[3] * flagPt[3] * flagPr[3] * flagKa[3] * flagIM[3] * flagDP[3] * flagCR[3] > + 0) { // Nc-rTPC cut, cut28 + registry.get(HIST("global/hEventEff"))->Fill(14., 1.); + registry.get(HIST("control/cut28/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut28/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut28/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut28/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut28/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + for (int i = 0; i < 4; i++) { + if (flagEl[i] && flagPi[i] && !flagVcalPV[i] && flagPt[i] && flagPr[i] && flagKa[i] && flagIM[i] && flagDP[i] && flagCR[i]) { + registry.get(HIST("pidTPC/hpvsdedxElHipCut28"))->Fill(tmpMomentum[i], tmpDedx[i]); + FillControlHistos<28>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut28/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut28/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut28/h3pi1eMass"))->Fill(mass3pi1e[i]); + } + } + + if (flagEl[0] * flagPi[0] * !flagVcalPV[0] * flagPt[0] * flagPr[0] * flagKa[0] * flagIM[0] * flagDP[0] * flagCR[0] * flagS3pi[0] + + flagEl[1] * flagPi[1] * !flagVcalPV[1] * flagPt[1] * flagPr[1] * flagKa[1] * flagIM[1] * flagDP[1] * flagCR[1] * flagS3pi[1] + + flagEl[2] * flagPi[2] * !flagVcalPV[2] * flagPt[2] * flagPr[2] * flagKa[2] * flagIM[2] * flagDP[2] * flagCR[2] * flagS3pi[2] + + flagEl[3] * flagPi[3] * !flagVcalPV[3] * flagPt[3] * flagPr[3] * flagKa[3] * flagIM[3] * flagDP[3] * flagCR[3] * flagS3pi[3] > + 0) { // nsigma 3pi cut, cut29 + registry.get(HIST("global/hEventEff"))->Fill(15., 1.); + registry.get(HIST("control/cut29/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut29/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut29/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut29/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut29/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + for (int i = 0; i < 4; i++) { + if (flagEl[i] && flagPi[i] && !flagVcalPV[i] && flagPt[i] && flagPr[i] && flagKa[i] && flagIM[i] && flagDP[i] && flagCR[i] && flagS3pi[i]) { + registry.get(HIST("pidTPC/hpvsdedxElHipCut29"))->Fill(tmpMomentum[i], tmpDedx[i]); + FillControlHistos<29>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut29/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut29/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut29/h3pi1eMass"))->Fill(mass3pi1e[i]); + if (verbose) { + LOGF(info, "cut29 timeTot %f, resTot %f, trackTime %f, %f, %f, %f Res %f, %f, %f, %f", trkTimeTot, trkTimeResTot, trkTime[0], trkTime[1], trkTime[2], trkTime[3], trkTimeRes[0], trkTimeRes[1], trkTimeRes[2], trkTimeRes[3]); + } + } + } + + } else { + if (verbose) { + LOGF(debug, " Candidate rejected: all electrons vetoed by piPID+Vcal+pT+prPID+KaPID+Dphi+IM+CR"); + } + } // end of nsigma 3pi cut + } else { + if (verbose) { + LOGF(debug, " Candidate rejected: all electrons vetoed by piPID+Vcal+pT+prPID+KaPID+Dphi+IM+CR"); + } + } // end of TPC crossed rows for electron cut + } else { + if (verbose) { + LOGF(debug, " Candidate rejected: all electrons vetoed by piPID+Vcal+pT+prPID+KaPID+Dphi+IM"); + } + } // end of delta phi cut + } else { + if (verbose) { + LOGF(debug, " Candidate rejected: all electrons vetoed by piPID+Vcal+pT+prPID+KaPID+Dphi"); + } + } // end of inv mass 3 pi cut } else { if (verbose) { LOGF(debug, " Candidate rejected: all electrons vetoed by piPID+Vcal+pT+prPID+KaPID"); @@ -768,7 +1608,7 @@ struct TauTau13topo { if (verbose) { LOGF(debug, " Candidate rejected: all electrons vetoed by pi PID"); } - } // end of pi veto + } // end of pi veto } else { // no electron if (verbose) { LOGF(debug, " Candidate rejected: no electron PID among 4 tracks"); @@ -782,27 +1622,93 @@ struct TauTau13topo { } return; } - if (counterTotal > 0) - registry.get(HIST("global/hEventEff"))->Fill(12., 1.); + if (counterTotal > 0) { + registry.get(HIST("global/hEventEff"))->Fill(16., 1.); + registry.get(HIST("control/cut30/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut30/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut30/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut30/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut30/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + for (int i = 0; i < 4; i++) { + if (flagTotal[i]) { + registry.get(HIST("pidTPC/hpvsdedxElHipCut30"))->Fill(tmpMomentum[i], tmpDedx[i]); + FillControlHistos<30>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut30/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut30/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut30/h3pi1eMass"))->Fill(mass3pi1e[i]); + } + } + } // check FIT information if (FITvetoFlag) { auto bitMin = 16 - FITvetoWindow; // default is +- 1 bc (1 bit) auto bitMax = 16 + FITvetoWindow; for (auto bit = bitMin; bit <= bitMax; bit++) { - if (TESTBIT(dgcand.bbFT0Apf(), bit) || - TESTBIT(dgcand.bbFT0Cpf(), bit) || - TESTBIT(dgcand.bbFV0Apf(), bit) || - TESTBIT(dgcand.bbFDDApf(), bit) || - TESTBIT(dgcand.bbFDDCpf(), bit)) { + if (TESTBIT(dgcand.bbFT0Apf(), bit)) + return; + if (TESTBIT(dgcand.bbFT0Cpf(), bit)) return; + if (useFV0ForVeto && TESTBIT(dgcand.bbFV0Apf(), bit)) + return; + if (useFDDAForVeto && TESTBIT(dgcand.bbFDDApf(), bit)) + return; + if (useFDDCForVeto && TESTBIT(dgcand.bbFDDCpf(), bit)) + return; + } // end of loop over bits + } // end of check emptyness around given BC in FIT detectors + if (counterTotal > 0) { + registry.get(HIST("global/hEventEff"))->Fill(17., 1.); + registry.get(HIST("control/cut31/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut31/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut31/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut31/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut31/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + for (int i = 0; i < 4; i++) { + if (flagTotal[i]) { + registry.get(HIST("pidTPC/hpvsdedxElHipCut31"))->Fill(tmpMomentum[i], tmpDedx[i]); + FillControlHistos<31>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut31/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut31/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut31/h3pi1eMass"))->Fill(mass3pi1e[i]); } } } - if (counterTotal > 0) - registry.get(HIST("global/hEventEff"))->Fill(13., 1.); + // n TOF tracks cut + if (nTofTrk < nTofTrkMinCut) { + if (verbose) { + LOGF(info, " Candidate rejected: nTOFtracks is %d", nTofTrk); + } + return; + } + if (counterTotal > 0) { + registry.get(HIST("global/hEventEff"))->Fill(18., 1.); + registry.get(HIST("control/cut32/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut32/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut32/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut32/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut32/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + for (int i = 0; i < 4; i++) { + if (flagTotal[i]) { + registry.get(HIST("pidTPC/hpvsdedxElHipCut32"))->Fill(tmpMomentum[i], tmpDedx[i]); + FillControlHistos<32>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut32/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("control/cut32/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut32/h3pi1eMass"))->Fill(mass3pi1e[i]); + registry.get(HIST("control/cut32/hPtSpectrumEl"))->Fill(tmpPt[i]); + if (verbose) { + LOGF(info, "cut32 trackTime %f, %f, %f, %f Res %f, %f, %f, %f", trkTime[0], trkTime[1], trkTime[2], trkTime[3], trkTimeRes[0], trkTimeRes[1], trkTimeRes[2], trkTimeRes[3]); + } + } + } + } + + // electron has TOF hit + + // only 1 electron if (counterTotal == 1) { + registry.get(HIST("global/hEventEff"))->Fill(19., 1.); for (int i = 0; i < 4; i++) { registry.get(HIST("control/cut1/hDcaZ"))->Fill(dcaZ[i]); registry.get(HIST("control/cut1/hDcaXY"))->Fill(dcaXY[i]); @@ -810,24 +1716,119 @@ struct TauTau13topo { registry.get(HIST("control/cut1/hChi2ITS"))->Fill(chi2ITS[i]); if (flagTotal[i]) { - FillControlHistos<1>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], pi3etasum[i]); + FillControlHistos<1>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); registry.get(HIST("control/cut1/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); registry.get(HIST("pidTPC/hpvsdedxElHipCut1"))->Fill(tmpMomentum[i], tmpDedx[i]); + for (int j = 0; j < 4; j++) { + if (i == j) + continue; + registry.get(HIST("pidTPC3pi/hpvsdedxElHipCut1"))->Fill(tmpMomentum[j], tmpDedx[j]); + } registry.get(HIST("global/hFinalPtSpectrumEl"))->Fill(tmpPt[i]); registry.get(HIST("control/cut1/hTPCnclsFindable"))->Fill(nclTPCfind[i]); + registry.get(HIST("control/cut1/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut1/h3pi1eMass"))->Fill(mass3pi1e[i]); + if (verbose) { + LOGF(info, "cut1 trackTime %f, %f, %f, %f Res %f, %f, %f, %f", trkTime[0], trkTime[1], trkTime[2], trkTime[3], trkTimeRes[0], trkTimeRes[1], trkTimeRes[2], trkTimeRes[3]); + } + + // one electron with tof hit (cut33) + if (tmpHasTOF[i]) { + registry.get(HIST("global/hEventEff"))->Fill(20., 1.); + // registry.get(HIST("control/cut33/hDcaZ"))->Fill(dcaZ[i]); + // registry.get(HIST("control/cut33/hDcaXY"))->Fill(dcaXY[i]); + // registry.get(HIST("control/cut33/hChi2TPC"))->Fill(chi2TPC[i]); + // registry.get(HIST("control/cut33/hChi2ITS"))->Fill(chi2ITS[i]); + FillControlHistos<33>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut33/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("pidTPC/hpvsdedxElHipCut33"))->Fill(tmpMomentum[i], tmpDedx[i]); + registry.get(HIST("control/cut33/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut33/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut33/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut33/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut33/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + registry.get(HIST("control/cut33/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut33/h3pi1eMass"))->Fill(mass3pi1e[i]); + registry.get(HIST("control/cut33/hPtSpectrumEl"))->Fill(tmpPt[i]); + if (verbose) { + LOGF(info, "cut33 trackTime %f, %f, %f, %f Res %f, %f, %f, %f", trkTime[0], trkTime[1], trkTime[2], trkTime[3], trkTimeRes[0], trkTimeRes[1], trkTimeRes[2], trkTimeRes[3]); + } + + int otherTOFtracks = 0; + for (int j = 0; j < 4; j++) { + if (i == j) + continue; + if (tmpHasTOF[j]) + otherTOFtracks++; + } + // at least one pion with tof hit (cut34) + if (otherTOFtracks >= 1) { + registry.get(HIST("global/hEventEff"))->Fill(21., 1.); + // registry.get(HIST("control/cut34/hDcaZ"))->Fill(dcaZ[i]); + // registry.get(HIST("control/cut34/hDcaXY"))->Fill(dcaXY[i]); + // registry.get(HIST("control/cut34/hChi2TPC"))->Fill(chi2TPC[i]); + // registry.get(HIST("control/cut34/hChi2ITS"))->Fill(chi2ITS[i]); + FillControlHistos<34>(pi3invMass[i], pi3pt[i], pi3deltaPhi[i], pi3assymav[i], pi3vector[i], pi3scalar[i], nclTPCcrossedRows[i]); + registry.get(HIST("control/cut34/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + registry.get(HIST("pidTPC/hpvsdedxElHipCut34"))->Fill(tmpMomentum[i], tmpDedx[i]); + registry.get(HIST("control/cut34/h4trkPtTot"))->Fill(pttot); + registry.get(HIST("control/cut34/h4piMass"))->Fill(mass4pi); + registry.get(HIST("control/cut34/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut34/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut34/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + registry.get(HIST("control/cut34/hsigma3Pi"))->Fill(nSigma3Pi[i]); + registry.get(HIST("control/cut34/h3pi1eMass"))->Fill(mass3pi1e[i]); + registry.get(HIST("control/cut34/hPtSpectrumEl"))->Fill(tmpPt[i]); + if (verbose) { + LOGF(info, "cut34 trackTime %f, %f, %f, %f Res %f, %f, %f, %f", trkTime[0], trkTime[1], trkTime[2], trkTime[3], trkTimeRes[0], trkTimeRes[1], trkTimeRes[2], trkTimeRes[3]); + } + } // end of at least one pion with tof hit (cut34) + + } // end of one electron with tof hit (cut33) } - } + } // end of loop over 4 tracks registry.get(HIST("control/cut1/h4trkPtTot"))->Fill(pttot); registry.get(HIST("control/cut1/h4piMass"))->Fill(mass4pi); registry.get(HIST("control/cut1/h4trkMassVsPt"))->Fill(mass4pi, pttot); + registry.get(HIST("control/cut1/hNtofTrk"))->Fill(nTofTrk); + registry.get(HIST("control/cut1/hZNACenergy"))->Fill(ZNAenergy, ZNCenergy); + // special case invmass 4pi (2,2.3) + // if (mass4pi<2.3 && mass4pi>2) { + // for (int i = 0; i < 4; i++) { + // registry.get(HIST("control/cut1/cut1a/hDcaZ"))->Fill(dcaZ[i]); + // registry.get(HIST("control/cut1/cut1a/hDcaXY"))->Fill(dcaXY[i]); + // registry.get(HIST("control/cut1/cut1a/hChi2TPC"))->Fill(chi2TPC[i]); + // registry.get(HIST("control/cut1/cut1a/hChi2ITS"))->Fill(chi2ITS[i]); + // + // if (flagTotal[i]) { + // registry.get(HIST("control/cut1/cut1a/h3piMassComb"))->Fill(pi3invMass[i]); + // registry.get(HIST("control/cut1/cut1a/h3trkPtTot"))->Fill(pi3pt[i]); + // registry.get(HIST("control/cut1/cut1a/hDeltaPhi13topo"))->Fill(pi3deltaPhi[i]); + // registry.get(HIST("control/cut1/cut1a/h13AssymPt1ProngAver"))->Fill(pi3assymav[i]); + // registry.get(HIST("control/cut1/cut1a/h13Vector"))->Fill(pi3vector[i]); + // registry.get(HIST("control/cut1/cut1a/h13Scalar"))->Fill(pi3scalar[i]); + // registry.get(HIST("control/cut1/cut1a/h13EtaSum"))->Fill(pi3etasum[i]); + // registry.get(HIST("control/cut1/cut1a/hTPCnCrossedRows"))->Fill(nclTPCcrossedRows[i]); + // + // registry.get(HIST("control/cut1/cut1a/h3piMassVsPt"))->Fill(pi3invMass[i], pi3pt[i]); + // registry.get(HIST("control/cut1/cut1a/hTPCnclsFindable"))->Fill(nclTPCfind[i]); + // registry.get(HIST("control/cut1/cut1a/hsigma3Pi"))->Fill(nSigma3Pi[i]); + // } + // } + // registry.get(HIST("control/cut1/cut1a/h4trkPtTot"))->Fill(pttot); + // registry.get(HIST("control/cut1/cut1a/h4piMass"))->Fill(mass4pi); + // registry.get(HIST("control/cut1/cut1a/h4trkMassVsPt"))->Fill(mass4pi, pttot); + // registry.get(HIST("control/cut1/cut1a/hNtofTrk"))->Fill(nTofTrk); + // } // end of mass window for 4pi case - registry.get(HIST("global/hEventEff"))->Fill(14., 1.); } else { // more than 1 electron candidate if (verbose) { LOGF(debug, " Candidate rejected: more than one electron candidate"); } - } // end of Nelectrons check - } + } // end of 1electrons check + } // end of process + // check ntracks-4PVtracks + // check pt of remaining (ntracks-4PVtracks) tracks }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/upcVetoAnalysis.cxx b/PWGUD/Tasks/upcVetoAnalysis.cxx index 0fc65232d0e..45b3844ed51 100644 --- a/PWGUD/Tasks/upcVetoAnalysis.cxx +++ b/PWGUD/Tasks/upcVetoAnalysis.cxx @@ -8,7 +8,12 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - +#include +#include +#include +#include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -376,12 +381,12 @@ struct UpcVetoAnalysis { for (auto r = 0; r <= 10; ++r) { auto maxAmpV0A = -999.f; auto maxAmpT0A = -999.f; - auto s = gbc - r; - auto e = gbc + r; + int64_t s = gbc - r; + int64_t e = gbc + r; auto lower = std::lower_bound(gbcs.begin(), gbcs.end(), s); if (lower != gbcs.end()) { auto idx = std::distance(gbcs.begin(), lower); - while (gbcs[idx] >= s && gbcs[idx] <= e && idx < gbcs.size()) { + while (gbcs[idx] >= s && gbcs[idx] <= e && idx < std::ssize(gbcs)) { auto aV0A = vBcIdsWithV0A[idx]; auto aT0A = vBcIdsWithT0A[idx]; if (aV0A > maxAmpV0A) diff --git a/Scripts/o2_linter.py b/Scripts/o2_linter.py new file mode 100644 index 00000000000..f88911d1ee9 --- /dev/null +++ b/Scripts/o2_linter.py @@ -0,0 +1,1520 @@ +#!/usr/bin/env python3 + +# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +# All rights not expressly granted are reserved. +# +# This software is distributed under the terms of the GNU General Public +# License v3 (GPL Version 3), copied verbatim in the file "COPYING". +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +"""! +@brief O2 linter (Find O2-specific issues in O2 code) +@author Vít Kučera , Inha University +@date 2024-07-14 +""" + +import argparse +import os +import re +import sys +from abc import ABC +from typing import Union + +github_mode = False # GitHub mode +prefix_disable = "o2-linter: disable=" # prefix for disabling tests + + +def is_camel_case(name: str) -> bool: + """forExample or ForExample""" + return "_" not in name and "-" not in name and " " not in name + + +def is_upper_camel_case(name: str) -> bool: + """ForExample""" + if not name: + return False + return name[0].isupper() and is_camel_case(name) + + +def is_lower_camel_case(name: str) -> bool: + """forExample""" + if not name: + return False + return name[0].islower() and is_camel_case(name) + + +def is_kebab_case(name: str) -> bool: + """for-example""" + if not name: + return False + return name.islower() and "_" not in name and " " not in name + + +def is_snake_case(name: str) -> bool: + """for_example""" + if not name: + return False + return name.islower() and "-" not in name and " " not in name + + +def is_screaming_snake_case(name: str) -> bool: + """FOR_EXAMPLE""" + if not name: + return False + return name.isupper() and "-" not in name and " " not in name + + +def kebab_case_to_camel_case_u(line: str) -> str: + """Convert kebab-case string to UpperCamelCase string.""" + return "".join([w.title() if w[0].isnumeric() else w.capitalize() for w in line.split("-")]) + + +def kebab_case_to_camel_case_l(line: str) -> str: + """Convert kebab-case string to lowerCamelCase string.""" + new_line = kebab_case_to_camel_case_u(line) + return f"{new_line[0].lower()}{new_line[1:]}" # start with lowercase letter + + +def camel_case_to_kebab_case(line: str) -> str: + """Convert CamelCase string to kebab-case string. + As done in O2/Framework/Foundation/include/Framework/TypeIdHelpers.h:type_to_task_name + """ + if not line.strip(): + return line + new_line = [] + for i, c in enumerate(line): + if i > 0 and c.isupper() and line[i - 1] != "-": + new_line.append("-") + new_line.append(c.lower()) + return "".join(new_line) + + +def print_error(path: str, line: Union[int, None], title: str, message: str): + """Format and print error message.""" + # return # Use to suppress error messages. + str_line = "" if line is None else f"{line}:" + print(f"{path}:{str_line} {message} [{title}]") # terminal format + if github_mode: + str_line = "" if line is None else f",line={line}" + print(f"::warning file={path}{str_line},title=[{title}]::{message}") # GitHub annotation format + + +def is_comment_cpp(line: str) -> bool: + """Test whether a line is a C++ comment.""" + return line.strip().startswith(("//", "/*")) + + +def remove_comment_cpp(line: str) -> str: + """Remove C++ comments from the end of a line.""" + for keyword in ("//", "/*"): + if keyword in line: + line = line[: line.index(keyword)] + return line.strip() + + +def block_ranges(line: str, char_open: str, char_close: str) -> "list[list[int]]": + """Get list of index ranges of longest blocks opened with char_open and closed with char_close.""" + # print(f"Looking for {char_open}{char_close} blocks in \"{line}\".") + # print(line) + list_ranges: "list[list[int]]" = [] + if not all((line, len(char_open) == 1, len(char_close) == 1)): + return list_ranges + + def direction(char: str) -> int: + if char == char_open: + return 1 + if char == char_close: + return -1 + return 0 + + list_levels = [] # list of block levels (net number of opened blocks) + level_sum = 0 # current block level (sum of previous directions) + for char in line: + list_levels.append(level_sum := level_sum + direction(char)) + level_min = min(list_levels) # minimum level (!= 0 if line has opened blocks) + # Look for openings (level_min + 1) and closings (level_min). + index_start = -1 + is_opened = False + # print(list_levels) + for i, level in enumerate(list_levels): + if not is_opened and level > level_min: + is_opened = True + index_start = i + # print(f"Opening at {i}") + elif is_opened and (level == level_min or i == len(list_levels) - 1): + is_opened = False + list_ranges.append([index_start, i]) + # print(f"Closing at {i}") + # print(f"block_ranges: Found {len(list_ranges)} blocks: {list_ranges}.") + if is_opened: + print("block_ranges: Block left opened.") + return list_ranges + + +class TestSpec(ABC): + """Prototype of a test class""" + + name = "test-template" # short name of the test + message = "Test failed" # error message + suffixes: "list[str]" = [] # suffixes of files to test + per_line = True # Test lines separately one by one. + n_issues = 0 # issue counter + + def file_matches(self, path: str) -> bool: + """Test whether the path matches the pattern for files to test.""" + return path.endswith(tuple(self.suffixes)) if self.suffixes else True + + def is_disabled(self, line: str, prefix_comment="//") -> bool: + """Detect whether the test is explicitly disabled.""" + for prefix in [prefix_comment, prefix_disable]: + if prefix not in line: + return False + line = line[(line.index(prefix) + len(prefix)) :] # Strip away part before prefix. + if self.name in line: + return True + return False + + def test_line(self, line: str) -> bool: + """Test a line.""" + raise NotImplementedError() + + def test_file(self, path: str, content) -> bool: + """Test a file in a way that cannot be done line by line.""" + raise NotImplementedError() + + def run(self, path: str, content) -> bool: + """Run the test.""" + # print(content) + passed = True + if not self.file_matches(path): + return passed + # print(f"Running test {self.name} for {path} with {len(content)} lines") + if self.per_line: + for i, line in enumerate(content): + if not isinstance(self, TestUsingDirectives): # Keep the indentation if needed. + line = line.strip() + if not line: + continue + # print(i + 1, line) + if self.is_disabled(line): + continue + if not self.test_line(line): + passed = False + self.n_issues += 1 + print_error(path, i + 1, self.name, self.message) + else: + passed = self.test_file(path, content) + if not passed: + self.n_issues += 1 + print_error(path, None, self.name, self.message) + return passed + + +########################## +# Implementations of tests +########################## + +# Bad practice + + +class TestIOStream(TestSpec): + """Detect included iostream.""" + + name = "include-iostream" + message = "Including iostream is discouraged. Use O2 logging instead." + suffixes = [".h", ".cxx"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + return not line.startswith("#include ") + + +class TestUsingStd(TestSpec): + """Detect importing names from the std namespace.""" + + name = "import-std-name" + message = "Importing names from the std namespace is not allowed in headers." + suffixes = [".h"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + return not line.startswith("using std::") + + +class TestUsingDirectives(TestSpec): + """Detect using directives in headers.""" + + name = "using-directive" + message = "Using directives are not allowed in headers." + suffixes = [".h"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + return not line.startswith("using namespace") + + +class TestStdPrefix(TestSpec): + """Detect missing std:: prefix for common names from the std namespace.""" + + name = "std-prefix" + message = "Use std:: prefix for names from the std namespace." + suffixes = [".h", ".cxx", ".C"] + prefix_bad = r"[^\w:\.\"]" + patterns = [ + r"vector<", + r"array[<\{\(]", + r"f?abs\(", + r"sqrt\(", + r"pow\(", + r"min\(", + r"max\(", + r"log(2|10)?\(", + r"exp\(", + r"a?(sin|cos|tan)h?\(", + r"atan2\(", + r"erfc?\(", + r"hypot\(", + ] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + for pattern in self.patterns: + iterators = re.finditer(rf"{self.prefix_bad}{pattern}", line) + matches = [(it.start(), it.group()) for it in iterators] + if not matches: + continue + if '"' not in line: # Found a match which cannot be inside a string. + return False + # Ignore matches inside strings. + for match in matches: + n_quotes_before = line.count('"', 0, match[0]) # Count quotation marks before the match. + if n_quotes_before % 2: # If odd, we are inside a string and we should ignore this match. + continue + # We are not inside a string and this match is valid. + return False + return True + + +class TestROOT(TestSpec): + """Detect unnecessary use of ROOT entities.""" + + name = "root-entity" + message = "Consider replacing ROOT entities with equivalents from standard C++ or from O2." + suffixes = [".h", ".cxx"] + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "Macros/" not in path + + def test_line(self, line: str) -> bool: + pattern = ( + r"TMath::(Abs|Sqrt|Power|Min|Max|Log(2|10)?|Exp|A?(Sin|Cos|Tan)H?|ATan2|Erfc?|Hypot)\(|" + r"(U?(Int|Char|Short)|Double(32)?|Float(16)?|U?Long(64)?|Bool)_t" + ) + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + return re.search(pattern, line) is None + + +class TestPi(TestSpec): + """Detect use of external pi.""" + + name = "external-pi" + message = "Consider using the PI constant (and its multiples and fractions) defined in o2::constants::math." + suffixes = [".h", ".cxx"] + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "Macros/" not in path + + def test_line(self, line: str) -> bool: + pattern = r"M_PI|TMath::(Two)?Pi" + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + return re.search(pattern, line) is None + + +class TestTwoPiAddSubtract(TestSpec): + """Detect adding/subtracting of 2 pi.""" + + name = "two-pi-add-subtract" + message = "Consider using RecoDecay::constrainAngle to restrict angle to a given range." + suffixes = [".h", ".cxx"] + + def test_line(self, line: str) -> bool: + pattern_two_pi = ( + r"(2(\.0*f?)? \* (M_PI|TMath::Pi\(\)|(((o2::)?constants::)?math::)?PI)|" + r"(((o2::)?constants::)?math::)?TwoPI|TMath::TwoPi\(\))" + ) + pattern = rf"[\+-]=? {pattern_two_pi}" + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + return re.search(pattern, line) is None + + +class TestPiMultipleFraction(TestSpec): + """Detect multiples/fractions of pi for existing equivalent constants.""" + + name = "pi-multiple-fraction" + message = "Consider using multiples/fractions of PI defined in o2::constants::math." + suffixes = [".h", ".cxx"] + + def test_line(self, line: str) -> bool: + pattern_pi = r"(M_PI|TMath::(Two)?Pi\(\)|(((o2::)?constants::)?math::)?(Two)?PI)" + pattern_multiple = r"(2(\.0*f?)?|0\.2?5f?) \* " # * 2, 0.25, 0.5 + pattern_fraction = r" / ((2|3|4)([ ,;\)]|\.0*f?))" # / 2, 3, 4 + pattern = rf"{pattern_multiple}{pattern_pi}|{pattern_pi}{pattern_fraction}" + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + return re.search(pattern, line) is None + + +class TestPdgDatabase(TestSpec): + """Detect use of TDatabasePDG.""" + + name = "pdg/database" + message = ( + "Direct use of TDatabasePDG is not allowed. " + "Use o2::constants::physics::Mass... or Service." + ) + suffixes = [".h", ".cxx"] + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "Macros/" not in path + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + return "TDatabasePDG" not in line + + +class TestPdgCode(TestSpec): + """Detect use of hard-coded PDG codes.""" + + name = "pdg/explicit-code" + message = "Avoid using hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead." + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + if re.search(r"->(GetParticle|Mass)\([+-]?[0-9]+\)", line): + return False + match = re.search(r"[Pp][Dd][Gg][\w]* ={1,2} [+-]?([0-9]+);", line) + if match: + code = match.group(1) + if code not in ("0", "1", "999"): + return False + return True + + +class TestPdgMass(TestSpec): + """Detect unnecessary call of Mass() for a known PDG code.""" + + name = "pdg/known-mass" + message = ( + "Consider using o2::constants::physics::Mass... instead of calling a database method for a known PDG code." + ) + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + pattern_pdg_code = r"[+-]?(k[A-Z][a-zA-Z0-9]*|[0-9]+)" + if re.search(rf"->GetParticle\({pattern_pdg_code}\)->Mass\(\)", line): + return False + if re.search(rf"->Mass\({pattern_pdg_code}\)", line): + return False + return True + + +class TestLogging(TestSpec): + """Detect non-O2 logging.""" + + name = "logging" + message = "Consider using O2 logging (LOG, LOGF, LOGP)." + suffixes = [".h", ".cxx"] + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "Macros/" not in path + + def test_line(self, line: str) -> bool: + pattern = r"^([Pp]rintf\(|(std::)?cout <)" + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + return re.search(pattern, line) is None + + +class TestConstRefInForLoop(TestSpec): + """Test const refs in range-based for loops.""" + + name = "const-ref-in-for-loop" + message = "Use constant references for non-modified iterators in range-based for loops." + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + if not re.match(r"for \(.* :", line): + return True + line = line[: line.index(" :")] # keep only the iterator part + return re.search(r"(\w const|const \w+)& ", line) is not None + + +class TestConstRefInSubscription(TestSpec): + """Test const refs in process function subscriptions. + Test only top-level process functions (called process() or has PROCESS_SWITCH). + """ + + name = "const-ref-in-process" + message = "Use constant references for table subscriptions in process functions." + suffixes = [".cxx"] + per_line = False + + def test_file(self, path: str, content) -> bool: + passed = True + n_parens_opened = 0 # number of opened parentheses + arguments = "" # process function arguments + line_process = 0 # line number of the process function + # Find names of all top-level process functions. + names_functions = ["process"] # names of allowed process functions to test + for i, line in enumerate(content): + line = line.strip() + if is_comment_cpp(line): + continue + if not line.startswith("PROCESS_SWITCH"): + continue + words = line.split() + if len(words) < 2: + passed = False + print_error( + path, + i + 1, + self.name, + "Failed to get the process function name. Keep it on the same line as the switch.", + ) + continue + names_functions.append(words[1][:-1]) # Remove the trailing comma. + # print_error(path, i + 1, self.name, f"Got process function name {words[1][:-1]}.") + # Test process functions. + for i, line in enumerate(content): + line = line.strip() + if is_comment_cpp(line): + continue + if self.is_disabled(line): + continue + if "//" in line: # Remove comment. (Ignore /* to avoid truncating at /*parameter*/.) + line = line[: line.index("//")] + if (match := re.match(r"void (process[\w]*)\(", line)) and match.group(1) in names_functions: + line_process = i + 1 + i_closing = line.rfind(")") + i_start = line.index("(") + 1 + i_end = i_closing if i_closing != -1 else len(line) + arguments = line[i_start:i_end] # get arguments between parentheses + n_parens_opened = line.count("(") - line.count(")") + elif n_parens_opened > 0: + i_closing = line.rfind(")") + i_start = 0 + i_end = i_closing if i_closing != -1 else len(line) + arguments += " " + line[i_start:i_end] # get arguments between parentheses + n_parens_opened += line.count("(") - line.count(")") + if line_process > 0 and n_parens_opened == 0: + # Process arguments. + # Sanitise arguments with spaces between <>. + for start, end in block_ranges(arguments, "<", ">"): + arg = arguments[start : (end + 1)] + # print(f"Found argument \"{arg}\" in [{start}, {end}]") + if ", " in arg: + arguments = arguments.replace(arg, arg.replace(", ", "__")) + # Extract arguments. + words = arguments.split(", ") + # Test each argument. + for arg in words: + if not re.search(r"([\w>] const|const [\w<>:]+)&", arg): + passed = False + print_error(path, i + 1, self.name, f"Argument {arg} is not const&.") + line_process = 0 + return passed + + +class TestWorkflowOptions(TestSpec): + """Detect usage of workflow options in defineDataProcessing. (Not supported on AliHyperloop.)""" + + name = "o2-workflow-options" + message = ( + "Do not use workflow options to customise workflow topology composition in defineDataProcessing. " + "Use process function switches or metadata instead." + ) + suffixes = [".cxx"] + per_line = False + + def test_file(self, path: str, content) -> bool: + is_inside_define = False # Are we inside defineDataProcessing? + for i, line in enumerate(content): # pylint: disable=unused-variable + if not line.strip(): + continue + if self.is_disabled(line): + continue + if is_comment_cpp(line): + continue + line = remove_comment_cpp(line) + # Wait for defineDataProcessing. + if not is_inside_define: + if not re.match(r"((o2::)?framework::)?WorkflowSpec defineDataProcessing\(", line): + continue + # print(f"{i + 1}: Entering define.") + is_inside_define = True + # Return at the end of defineDataProcessing. + if is_inside_define and line[0] == "}": + # print(f"{i + 1}: Exiting define.") + break + # Detect options. + if ".options()" in line: + return False + return True + + +# Documentation +# Reference: https://rawgit.com/AliceO2Group/CodingGuidelines/master/comments_guidelines.html + + +class TestDocumentationFile(TestSpec): + """Test mandatory documentation of C++ files.""" + + name = "doc/file" + message = "Provide mandatory file documentation." + suffixes = [".h", ".cxx", ".C"] + per_line = False + + def test_file(self, path: str, content) -> bool: + passed = False + doc_items = [] + doc_items.append({"keyword": "file", "pattern": rf"{os.path.basename(path)}$", "found": False}) + doc_items.append({"keyword": "brief", "pattern": r"\w.* \w", "found": False}) # at least two words + doc_items.append({"keyword": "author", "pattern": r"[\w]+", "found": False}) + doc_prefix = "///" + n_lines_copyright = 11 + last_doc_line = n_lines_copyright + + for i, line in enumerate(content): + if i < n_lines_copyright: # Skip copyright lines. + continue + if line.strip() and not line.startswith(doc_prefix): # Stop at the first non-empty non-doc line. + break + if line.startswith(doc_prefix): + last_doc_line = i + 1 + for item in doc_items: + if re.search(rf"^{doc_prefix} [\\@]{item['keyword']} +{item['pattern']}", line): + item["found"] = True + # print_error(path, i + 1, self.name, f"Found \{item['keyword']}.") + break + if all(item["found"] for item in doc_items): # All items have been found. + passed = True + break + if not passed: + for item in doc_items: + if not item["found"]: + print_error( + path, + last_doc_line, + self.name, + f"Documentation for \\{item['keyword']} is missing, incorrect or misplaced.", + ) + return passed + + +# Naming conventions +# Reference: https://rawgit.com/AliceO2Group/CodingGuidelines/master/naming_formatting.html + + +class TestNameFunctionVariable(TestSpec): + """Test names of functions and of most variables. + Might report false positives. + Does not detect multiple variable declarations, i.e. "type name1, name2;" + Does not detect function arguments on the same line as the function declaration. + Does not detect multi-line declarations. + Does not check capitalisation for constexpr because of special rules for constants. See TestNameConstant. + """ + + name = "name/function-variable" + message = "Use lowerCamelCase for names of functions and variables." + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + # Look for declarations of functions and variables. + + # Strip away irrelevant remainders of the line after the object name. + # For functions, stripping after "(" is enough but this way we also identify many declarations of variables. + for keyword in ("(", "{", ";", " = ", "//", "/*"): + if keyword in line: + line = line[: line.index(keyword)] + + # Check the words. + words = line.split() + + # number of words + if len(words) < 2: + return True + + # First word starts with a letter. + if not words[0][0].isalpha(): + return True + + # Reject false positives with same structure. + if words[0] in ( + "return", + "if", + "else", + "new", + "delete", + "delete[]", + "case", + "typename", + "using", + "typedef", + "enum", + "namespace", + "struct", + "class", + ): + return True + if len(words) > 2 and words[1] in ("typename", "class", "struct"): + return True + + # Identify the position of the name for cases "name[n + m]". + funval_name = words[-1] # expecting the name in the last word + if ( + funval_name.endswith("]") and "[" not in funval_name + ): # it's an array and we do not have the name before "[" here + opens_brackets = ["[" in w for w in words] + if not any(opens_brackets): # The opening "[" is not on this line. We have to give up. + return True + index_name = opens_brackets.index(True) # the name is in the first element with "[" + funval_name = words[index_name] + words = words[: (index_name + 1)] # Strip away words after the name. + if len(words) < 2: # Check the adjusted number of words. + return True + + # All words before the name start with an alphanumeric character (underscores not allowed). + # Rejects expressions, e.g. * = += << }, but accepts numbers in array declarations. + if not all(w[0].isalnum() for w in words[:-1]): + return True + + # Extract function/variable name. + if "[" in funval_name: # Remove brackets for arrays. + funval_name = funval_name[: funval_name.index("[")] + if "::" in funval_name: # Remove the class prefix for methods. + funval_name = funval_name.split("::")[-1] + + # Check the name candidate. + + # Names of variables and functions are identifiers. + if not funval_name.isidentifier(): # should be same as ^[\w]+$ + return True + + # print(f"{line} -> {funval_name}") + # return True + # The actual test comes here. + if "constexpr" in words[:-1]: + return is_camel_case(funval_name) + return is_lower_camel_case(funval_name) + + +class TestNameMacro(TestSpec): + """Test macro names.""" + + name = "name/macro" + message = "Use SCREAMING_SNAKE_CASE for names of macros. Leading and double underscores are not allowed." + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + if not line.startswith("#define "): + return True + # Extract macro name. + macro_name = line.split()[1] + if "(" in macro_name: + macro_name = macro_name.split("(")[0] + # The actual test comes here. + if macro_name.startswith("_"): + return False + if "__" in macro_name: + return False + return is_screaming_snake_case(macro_name) + + +class TestNameConstant(TestSpec): + """Test constexpr constant names.""" + + name = "name/constexpr-constant" + message = ( + 'Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".' + ) + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + line = remove_comment_cpp(line) + words = line.split() + if "constexpr" not in words or "=" not in words: + return True + # Extract constant name. + words = words[: words.index("=")] # keep only words before "=" + constant_name = words[-1] # last word before "=" + if ( + constant_name.endswith("]") and "[" not in constant_name + ): # it's an array and we do not have the name before "[" here + opens_brackets = ["[" in w for w in words] + if not any(opens_brackets): # The opening "[" is not on this line. We have to give up. + return True + constant_name = words[opens_brackets.index(True)] # the name is in the first element with "[" + if "[" in constant_name: # Remove brackets for arrays. + constant_name = constant_name[: constant_name.index("[")] + if "::" in constant_name: # Remove the class prefix for methods. + constant_name = constant_name.split("::")[-1] + # The actual test comes here. + if constant_name.startswith("k") and len(constant_name) > 1: # exception for special constants + constant_name = constant_name[1:] # test the name without "k" + return is_upper_camel_case(constant_name) + + +class TestNameColumn(TestSpec): + """Test names of O2 columns.""" + + name = "name/o2-column" + message = "Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters." + suffixes = [".h", ".cxx"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + if not (match := re.match(r"DECLARE(_[A-Z]+)*_COLUMN(_[A-Z]+)*\(", line)): + return True + # Extract names of the column type and getter. + line = remove_comment_cpp(line) + line = line[len(match.group()) :].strip() # Extract part after "(". + if not (match := re.match(r"([^,]+), ([^,\) ]+)", line)): + print(f'Failed to extract column type and getter from "{line}".') + return False + column_type_name = match.group(1) + column_getter_name = match.group(2) + # print(f"Got \"{column_type_name}\" \"{column_getter_name}\"") + # return True + if column_type_name[0] == "_": # probably a macro variable + return True + # The actual test comes here. + if not is_upper_camel_case(column_type_name): + return False + if not is_lower_camel_case(column_getter_name): + return False + return f"{column_type_name[0].lower()}{column_type_name[1:]}" == column_getter_name + + +class TestNameTable(TestSpec): + """Test names of O2 tables.""" + + name = "name/o2-table" + message = "Use UpperCamelCase for names of O2 tables." + suffixes = [".h", ".cxx"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + if not (match := re.match(r"DECLARE(_[A-Z]+)*_TABLES?(_[A-Z]+)*\(", line)): + return True + # Extract names of the table type. + line = remove_comment_cpp(line) + line = line[len(match.group()) :].strip() # Extract part after "(". + if not (match := re.match(r"([^,\) ]+)", line)): + print(f'Failed to extract table type from "{line}".') + return False + table_type_name = match.group(1) + # print(f"Got \"{table_type_name}\"") + # return True + # Check for a version suffix. + if match := re.match(r"(.*)_([0-9]{3})", line): + table_type_name = match.group(1) + # table_version = match.group(2) + # print(f"Got versioned table \"{table_type_name}\", version {table_version}") + if table_type_name[0] == "_": # probably a macro variable + return True + # The actual test comes here. + return is_upper_camel_case(table_type_name) + + +class TestNameNamespace(TestSpec): + """Test names of namespaces.""" + + name = "name/namespace" + message = "Use snake_case for names of namespaces. Double underscores are not allowed." + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + if not line.startswith("namespace "): + return True + # Extract namespace name. + namespace_name = line.split()[1] + if namespace_name == "{": # ignore anonymous namespaces + return True + # The actual test comes here. + if "__" in namespace_name: + return False + return is_snake_case(namespace_name) + + +class TestNameType(TestSpec): + """Test names of defined types.""" + + name = "name/type" + message = "Use UpperCamelCase for names of defined types." + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + if not (match := re.match(r"using (\w+) = ", line)): + return True + # Extract type name. + type_name = match.group(1) + # The actual test comes here. + return is_upper_camel_case(type_name) + + +class TestNameUpperCamelCase(TestSpec): + """Base class for a test of UpperCamelCase names.""" + + keyword = "key" + name = f"name/{keyword}" + message = f"Use UpperCamelCase for names of {keyword}." + suffixes = [".h", ".cxx", ".C"] + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + if not line.startswith(f"{self.keyword} "): + return True + # Extract object name. + words = line.split() + if not words[1].isalnum(): # "struct : ...", "enum { ..." + return True + object_name = words[1] + if object_name in ("class", "struct") and len(words) > 2: # enum class ... or enum struct + object_name = words[2] + # The actual test comes here. + return is_upper_camel_case(object_name) + + +class TestNameEnum(TestNameUpperCamelCase): + """Test names of enumerators.""" + + keyword = "enum" + name = "name/enum" + message = "Use UpperCamelCase for names of enumerators and their values." + + +class TestNameClass(TestNameUpperCamelCase): + """Test names of classes.""" + + keyword = "class" + name = "name/class" + message = "Use UpperCamelCase for names of classes." + + +class TestNameStruct(TestNameUpperCamelCase): + """Test names of structs.""" + + keyword = "struct" + name = "name/struct" + message = "Use UpperCamelCase for names of structs." + + +class TestNameFileCpp(TestSpec): + """Test names of C++ files.""" + + name = "name/file-cpp" + message = "Use lowerCamelCase or UpperCamelCase for names of C++ files. See the O2 naming conventions for details." + suffixes = [".h", ".cxx", ".C"] + per_line = False + + def test_file(self, path: str, content) -> bool: + file_name = os.path.basename(path) + # workflow file + if re.search(r"(TableProducer|Tasks)/.*\.cxx", path): + return is_lower_camel_case(file_name) + # data model file + if "DataModel/" in path: + return is_upper_camel_case(file_name) + # utility file + if re.search(r"[Uu]til(ity|ities|s)?", file_name): + return is_lower_camel_case(file_name) + return is_camel_case(file_name) + + +class TestNameFilePython(TestSpec): + """Test names of Python files.""" + + name = "name/file-python" + message = "Use snake_case for names of Python files." + suffixes = [".py", ".ipynb"] + per_line = False + + def test_file(self, path: str, content) -> bool: + file_name = os.path.basename(path) + return is_snake_case(file_name) + + +class TestNameWorkflow(TestSpec): + """Test names of O2 workflows.""" + + name = "name/o2-workflow" + message = "Use kebab-case for names of workflows and match the name of the workflow file." + suffixes = ["CMakeLists.txt"] + per_line = False + + def test_file(self, path: str, content) -> bool: + passed = True + workflow_name = "" + for i, line in enumerate(content): + if not line.startswith("o2physics_add_dpl_workflow("): + continue + if self.is_disabled(line, "#"): + continue + # Extract workflow name. + workflow_name = line.strip().split("(")[1].split()[0] + if not is_kebab_case(workflow_name): + passed = False + print_error(path, i + 1, self.name, f"Invalid workflow name: {workflow_name}.") + continue + # Extract workflow file name. + next_line = content[i + 1].strip() + words = next_line.split() + if words[0] != "SOURCES": + passed = False + print_error(path, i + 2, self.name, f"Did not find sources for workflow: {workflow_name}.") + continue + workflow_file_name = os.path.basename(words[1]) # the actual file name + # Generate the file name matching the workflow name. + expected_workflow_file_name = kebab_case_to_camel_case_l(workflow_name) + ".cxx" + # Compare the actual and expected file names. + if expected_workflow_file_name != workflow_file_name: + passed = False + print_error( + path, + i + 1, + self.name, + f"Workflow name {workflow_name} does not match its file name {workflow_file_name}. " + f"(Matches {expected_workflow_file_name}.)", + ) + return passed + + +class TestNameTask(TestSpec): + """Test explicit task names. + Detect usage of TaskName, check whether it is needed and whether the task name matches the struct name.""" + + name = "name/o2-task" + message = "Specify task name only when it cannot be derived from the struct name. Only append to the default name." + suffixes = [".cxx"] + per_line = False + + def test_file(self, path: str, content) -> bool: + is_inside_define = False # Are we inside defineDataProcessing? + is_inside_adapt = False # Are we inside adaptAnalysisTask? + struct_name = "" + struct_templated = False # Is the struct templated? + n_parens_opened = 0 # number of opened parentheses + passed = True + for i, line in enumerate(content): + if not line.strip(): + continue + if self.is_disabled(line): + continue + if is_comment_cpp(line): + continue + line = remove_comment_cpp(line) + # Wait for defineDataProcessing. + if not is_inside_define: + if not re.match(r"((o2::)?framework::)?WorkflowSpec defineDataProcessing\(", line): + continue + # print(f"{i + 1}: Entering define.") + is_inside_define = True + # Return at the end of defineDataProcessing. + if is_inside_define and line[0] == "}": + # print(f"{i + 1}: Exiting define.") + break + # Wait for adaptAnalysisTask. + if not is_inside_adapt: + if (index := line.find("adaptAnalysisTask<")) == -1: + continue + # print(f"{i + 1}: Entering adapt.") + is_inside_adapt = True + line = line[(index + len("adaptAnalysisTask<")) :] + # Extract struct name. + if not (match := re.match(r"([^>]+)", line)): + print_error(path, i + 1, self.name, f'Failed to extract struct name from "{line}".') + return False + struct_name = match.group(1) + if (index := struct_name.find("<")) > -1: + struct_templated = True + # print(f"{i + 1}: Got templated struct name {struct_name}") + struct_name = struct_name[:index] + # print(f"{i + 1}: Got struct name {struct_name}") + line = line[(line.index(struct_name) + len(struct_name)) :] + if is_inside_adapt: + n_parens_opened += line.count("(") - line.count(")") + # print(f"{i + 1}: {n_parens_opened} opened parens") + if n_parens_opened <= 0: + # print(f"{i + 1}: Exiting adapt.") + is_inside_adapt = False + # Find explicit task name. + if "TaskName{" not in line: + continue + passed = False + # Extract explicit task name. + if not (match := re.search(r"TaskName\{\"([^\}]+)\"\}", line)): + print_error(path, i + 1, self.name, f'Failed to extract explicit task name from "{line}".') + return False + task_name = match.group(1) + # print(f"{i + 1}: Got struct \"{struct_name}\" with task name \"{task_name}\".") + # Test explicit task name. + device_name_from_struct_name = camel_case_to_kebab_case( + struct_name + ) # default device name, in absence of TaskName + device_name_from_task_name = camel_case_to_kebab_case( + task_name + ) # actual device name, generated from TaskName + struct_name_from_device_name = kebab_case_to_camel_case_u( + device_name_from_task_name + ) # struct name matching the TaskName + if not is_kebab_case(device_name_from_task_name): + print_error( + path, + i + 1, + self.name, + f"Specified task name {task_name} produces an invalid device name " + f"{device_name_from_task_name}.", + ) + passed = False + elif device_name_from_struct_name == device_name_from_task_name: + # If the task name results in the same device name as the struct name would, + # TaskName is redundant and should be removed. + print_error( + path, + i + 1, + self.name, + f"Specified task name {task_name} and the struct name {struct_name} produce " + f"the same device name {device_name_from_struct_name}. TaskName is redundant.", + ) + passed = False + elif device_name_from_struct_name.replace("-", "") == device_name_from_task_name.replace("-", ""): + # If the device names generated from the task name and from the struct name differ in hyphenation, + # capitalisation of the struct name should be fixed and TaskName should be removed. + # (special cases: alice3-, -2prong) + print_error( + path, + i + 1, + self.name, + f"Device names {device_name_from_task_name} and {device_name_from_struct_name} generated " + f"from the specified task name {task_name} and from the struct name {struct_name}, " + f"respectively, differ in hyphenation. Consider fixing capitalisation of the struct name " + f"to {struct_name_from_device_name} and removing TaskName.", + ) + passed = False + elif device_name_from_task_name.startswith(device_name_from_struct_name): + # If the device name generated from the task name is an extension of the device name generated + # from the struct name, accept it if the struct is templated. If the struct is not templated, + # extension is acceptable if adaptAnalysisTask is called multiple times for the same struct. + if not struct_templated: + print_error( + path, + i + 1, + self.name, + f"Device name {device_name_from_task_name} from the specified task name " + f"{task_name} is an extension of the device name {device_name_from_struct_name} " + f"from the struct name {struct_name} but the struct is not templated. " + "Is it adapted multiple times?", + ) + passed = False + # else: + # print_error(path, i + 1, self.name, f"Device name {device_name_from_task_name} from + # the specified task name {task_name} is an extension of the device name + # {device_name_from_struct_name} from the struct name {struct_name} and the struct is templated. + # All good") + else: + # Other cases should be rejected. + print_error( + path, + i + 1, + self.name, + f"Specified task name {task_name} produces device name {device_name_from_task_name} " + f"which does not match the device name {device_name_from_struct_name} from " + f"the struct name {struct_name}. (Matching struct name {struct_name_from_device_name})", + ) + passed = False + return passed + + +class TestNameFileWorkflow(TestSpec): + """Test names of workflow files.""" + + name = "name/workflow-file" + message = ( + "Name of a workflow file must match the name of the main struct in it (without the PWG prefix). " + '(Class implementation files should be in "Core" directories.)' + ) + suffixes = [".cxx"] + per_line = False + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "/Core/" not in path + + def test_file(self, path: str, content) -> bool: + file_name = os.path.basename(path).rstrip(".cxx") + base_struct_name = f"{file_name[0].upper()}{file_name[1:]}" # expected base of struct names + if "PWGHF/" in path: + base_struct_name = "Hf" + base_struct_name + # print(f"For file {file_name} expecting to find {base_struct_name}.") + struct_names = [] # actual struct names in the file + for line in content: + if self.is_disabled(line): + return True + if not line.startswith("struct "): + continue + # Extract struct name. + words = line.split() + if not words[1].isalnum(): # "struct : ..." + continue + struct_name = words[1] + struct_names.append(struct_name) + # print(f"Found structs: {struct_names}.") + for struct_name in struct_names: + if struct_name.startswith(base_struct_name): + return True + return False + + +class TestNameConfigurable(TestSpec): + """Test names of configurables.""" + + name = "name/configurable" + message = ( + "Use lowerCamelCase for names of configurables and use the same name " + "for the struct member as for the JSON string. (Declare the type and names on the same line.)" + ) + suffixes = [".h", ".cxx"] + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "Macros/" not in path + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + if not line.startswith("Configurable"): + return True + # Extract Configurable name. + words = line.split() + if len(words) < 2: + return False + if len(words) > 2 and words[2] == "=": # expecting Configurable... nameCpp = {"nameJson", + name_cpp = words[1] # nameCpp + name_json = words[3][1:] # expecting "nameJson", + else: + names = words[1].split("{") # expecting Configurable... nameCpp{"nameJson", + if len(names) < 2: + return False + name_cpp = names[0] # nameCpp + name_json = names[1] # expecting "nameJson", + if not name_json: + return False + if name_json[0] != '"': # JSON name is not a literal string. + return True + name_json = name_json.strip('",') # expecting nameJson + # The actual test comes here. + return is_lower_camel_case(name_cpp) and name_cpp == name_json + + +# PWG-HF + + +class TestHfNameStructClass(TestSpec): + """PWGHF: Test names of structs and classes.""" + + name = "pwghf/name/struct-class" + message = 'Names of PWGHF structs and classes must start with "Hf".' + suffixes = [".h", ".cxx"] + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "PWGHF/" in path and "Macros/" not in path + + def test_line(self, line: str) -> bool: + if is_comment_cpp(line): + return True + if not line.startswith(("struct ", "class ")): + return True + line = remove_comment_cpp(line) + # Extract struct/class name. + words = line.split() + if not words[1].isalnum(): # "struct : ..." + return True + struct_name = words[1] + # The actual test comes here. + return struct_name.startswith("Hf") + + +class TestHfNameFileTask(TestSpec): + """PWGHF: Test names of task workflow files.""" + + name = "pwghf/name/task-file" + message = 'Name of a PWGHF task workflow file must start with "task".' + suffixes = [".cxx"] + per_line = False + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "PWGHF/" in path and "Macros/" not in path + + def test_file(self, path: str, content) -> bool: + file_name = os.path.basename(path) + if "/Tasks/" in path and not file_name.startswith("task"): + return False + return True + + +class TestHfStructMembers(TestSpec): + """PWGHF: Test order of struct members. + Caveat: Does not see Configurables in ConfigurableGroup.""" + + name = "pwghf/struct-member-order" + message = "Declare struct members in the conventional order. See the PWGHF coding guidelines." + suffixes = [".cxx"] + per_line = False + member_order = [ + "Spawns<", + "Builds<", + "Produces<", + "Configurable<", + "HfHelper ", + "SliceCache ", + "Service<", + "using ", + "Filter ", + "Preslice<", + "PresliceUnsorted<", + "Partition<", + "ConfigurableAxis ", + "AxisSpec ", + "HistogramRegistry ", + "OutputObj<", + "void init(", + "void process", + ] + + def file_matches(self, path: str) -> bool: + return super().file_matches(path) and "PWGHF/" in path + + def test_file(self, path: str, content) -> bool: + passed = True + dic_structs: dict[str, dict] = {} + struct_name = "" + for i, line in enumerate(content): + if is_comment_cpp(line): + continue + if line.startswith("struct "): # expecting no indentation + line = remove_comment_cpp(line) + struct_name = line.strip().split()[1] + dic_structs[struct_name] = {} + continue + if not struct_name: + continue + # Save line numbers of members of the current struct for each category. + for member in self.member_order: + if line.startswith(f" {member}"): # expecting single-level indentation for direct members + if member not in dic_structs[struct_name]: + dic_structs[struct_name][member] = [] + dic_structs[struct_name][member].append(i + 1) # save line number + break + # print(dic_struct) + # Detect members declared in a wrong order. + last_line_last_member = 0 # line number of the last member of the previous member category + index_last_member = 0 # index of the previous member category in the member_order list + for struct_name, dic_struct in dic_structs.items(): + for i_m, member in enumerate(self.member_order): + if member not in dic_struct: + continue + first_line = min(dic_struct[member]) # line number of the first member of this category + last_line = max(dic_struct[member]) # line number of the last member of this category + if ( + first_line < last_line_last_member + ): # The current category starts before the end of the previous category. + passed = False + print_error( + path, + first_line, + self.name, + f"{struct_name}: {member.strip()} appears too early " + f"(before end of {self.member_order[index_last_member].strip()}).", + ) + last_line_last_member = last_line + index_last_member = i_m + return passed + + +# End of test implementations + + +def main(): + """Main function""" + parser = argparse.ArgumentParser(description="O2 linter (Find O2-specific issues in O2 code)") + parser.add_argument("paths", type=str, nargs="+", help="File path(s)") + parser.add_argument( + "-g", + dest="github", + action="store_true", + help="Print messages also as GitHub annotations", + ) + args = parser.parse_args() + if args.github: + global github_mode # pylint: disable=global-statement + github_mode = True + + tests = [] # list of activated tests + + # Bad practice + enable_bad_practice = True + if enable_bad_practice: + tests.append(TestIOStream()) + tests.append(TestUsingStd()) + tests.append(TestUsingDirectives()) + tests.append(TestStdPrefix()) + tests.append(TestROOT()) + tests.append(TestPi()) + tests.append(TestTwoPiAddSubtract()) + tests.append(TestPiMultipleFraction()) + tests.append(TestPdgDatabase()) + tests.append(TestPdgCode()) + tests.append(TestPdgMass()) + tests.append(TestLogging()) + tests.append(TestConstRefInForLoop()) + tests.append(TestConstRefInSubscription()) + tests.append(TestWorkflowOptions()) + + # Documentation + enable_documentation = True + if enable_documentation: + tests.append(TestDocumentationFile()) + + # Naming conventions + enable_naming = True + if enable_naming: + tests.append(TestNameFunctionVariable()) + tests.append(TestNameMacro()) + tests.append(TestNameConstant()) + tests.append(TestNameColumn()) + tests.append(TestNameTable()) + tests.append(TestNameNamespace()) + tests.append(TestNameType()) + tests.append(TestNameEnum()) + tests.append(TestNameClass()) + tests.append(TestNameStruct()) + tests.append(TestNameFileCpp()) + tests.append(TestNameFilePython()) + tests.append(TestNameWorkflow()) + tests.append(TestNameTask()) + tests.append(TestNameFileWorkflow()) + tests.append(TestNameConfigurable()) + + # PWG-HF + enable_pwghf = True + if enable_pwghf: + tests.append(TestHfNameStructClass()) + tests.append(TestHfNameFileTask()) + tests.append(TestHfStructMembers()) + + test_names = [t.name for t in tests] # short names of activated tests + suffixes = tuple({s for test in tests for s in test.suffixes}) # all suffixes from all enabled tests + passed = True # global result of all tests + n_files_bad = {name: 0 for name in test_names} # counter of files with issues + + # Report overview before running. + print(f"Testing {len(args.paths)} files.") + # print(args.paths) + print("Enabled tests:", test_names) + print("Suffixes of tested files:", sorted(suffixes)) + # print(f"Github annotations: {github_mode}.") + + # Test files. + for path in args.paths: + # print(f"Processing path \"{path}\".") + # Skip not tested files. + if not path.endswith(suffixes): + # print(f"Skipping path \"{path}\".") + continue + try: + with open(path, "r", encoding="utf-8") as file: + content = file.readlines() + for test in tests: + result = test.run(path, content) + if not result: + n_files_bad[test.name] += 1 + passed = False + # print(f"File \"{path}\" {'passed' if result else 'failed'} the test {test.name}.") + except IOError: + print(f'Failed to open file "{path}".') + sys.exit(1) + + # Report results per test. + print("\nResults per test") + len_max = max(len(name) for name in test_names) + print(f"test{' ' * (len_max - len('test'))}\tissues\tbad files") + for test in tests: + print(f"{test.name}{' ' * (len_max - len(test.name))}\t{test.n_issues}\t{n_files_bad[test.name]}") + + # Report global result. + title_result = "O2 linter result" + if passed: + msg_result = "All tests passed." + if github_mode: + print(f"::notice title={title_result}::{msg_result}") + else: + print(f"{title_result}: {msg_result}") + else: + msg_result = "Issues have been found." + msg_disable = ( + f'You can disable a test for a line by adding a comment with "{prefix_disable}"' + " followed by the name of the test." + ) + if github_mode: + print(f"::error title={title_result}::{msg_result}") + print(f"::notice::{msg_disable}") + else: + print(f"\n{title_result}: {msg_result}") + print(msg_disable) + # Print tips. + print("\nTip: You can run the O2 linter locally with: python3 Scripts/o2_linter.py ") + if not passed: + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/Tutorials/ML/applyMlSelection.cxx b/Tutorials/ML/applyMlSelection.cxx index bf2e69fc5ce..dcbfb0f80e9 100644 --- a/Tutorials/ML/applyMlSelection.cxx +++ b/Tutorials/ML/applyMlSelection.cxx @@ -39,7 +39,7 @@ struct applyMlSelection { Configurable> binsPtMl{"binsPtMl", std::vector{1., 36.}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{cuts_ml::CutSmaller, cuts_ml::CutNot, cuts_ml::CutNot}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {defaultCutsMl[0], 1, 3, {"pT bin 0"}, {"score prompt", "score non-prompt", "score bkg"}}, "ML selections per pT bin"}; - Configurable nClassesMl{"nClassesMl", (int8_t)3, "Number of classes in ML model"}; + Configurable nClassesMl{"nClassesMl", 3, "Number of classes in ML model"}; // Model file names Configurable> onnxFileNames{"onnxFileNames", std::vector{"model_onnx.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; // Bonus: CCDB configuration (needed for ML application on the GRID) diff --git a/Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx b/Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx index db754fb8c88..b5b01185a49 100644 --- a/Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx +++ b/Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx @@ -161,7 +161,7 @@ struct qVectorstutorial { if (!SelEvent(collision)) { return; } - for (auto i = 0; i < cfgnMods->size(); i++) { + for (std::size_t i = 0; i < cfgnMods->size(); i++) { fillHistosQvec(collision, cfgnMods->at(i)); fillHistosFlow(collision, tracks, cfgnMods->at(i)); } diff --git a/Tutorials/src/eventMixing.cxx b/Tutorials/src/eventMixing.cxx index ff5c55da865..676d6ba96e3 100644 --- a/Tutorials/src/eventMixing.cxx +++ b/Tutorials/src/eventMixing.cxx @@ -31,7 +31,7 @@ namespace hash { DECLARE_SOA_COLUMN(Bin, bin, int); } // namespace hash -DECLARE_SOA_TABLE(Hashes, "AOD", "HASH", hash::Bin); +DECLARE_SOA_TABLE(MixingHashes, "AOD", "HASH", hash::Bin); } // namespace o2::aod @@ -304,7 +304,7 @@ struct MixedEventsTripleVariousKinds { struct HashTask { std::vector xBins{-0.064f, -0.062f, -0.060f, 0.066f, 0.068f, 0.070f, 0.072}; std::vector yBins{-0.320f, -0.301f, -0.300f, 0.330f, 0.340f, 0.350f, 0.360}; - Produces hashes; + Produces hashes; // Calculate hash for an element based on 2 properties and their bins. int getHash(const std::vector& xBins, const std::vector& yBins, float colX, float colY) @@ -341,7 +341,7 @@ struct HashTask { struct MixedEventsWithHashTask { SliceCache cache; - using myCollisions = soa::Join; + using myCollisions = soa::Join; NoBinningPolicy hashBin; SameKindPair> pair{hashBin, 5, -1, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored diff --git a/Tutorials/src/tracksCombinations.cxx b/Tutorials/src/tracksCombinations.cxx index a61d8daf5aa..413e8399e9b 100644 --- a/Tutorials/src/tracksCombinations.cxx +++ b/Tutorials/src/tracksCombinations.cxx @@ -30,7 +30,7 @@ namespace hash { DECLARE_SOA_COLUMN(Bin, bin, int); } // namespace hash -DECLARE_SOA_TABLE(Hashes, "AOD", "HASH", hash::Bin); +DECLARE_SOA_TABLE(MixingHashes, "AOD", "HASH", hash::Bin); } // namespace o2::aod @@ -116,7 +116,7 @@ struct BinnedTrackPartitionsCombinations { struct HashTask { std::vector xBins{-0.064f, -0.062f, -0.060f, 0.066f, 0.068f, 0.070f, 0.072}; std::vector yBins{-0.320f, -0.301f, -0.300f, 0.330f, 0.340f, 0.350f, 0.360}; - Produces hashes; + Produces hashes; // Calculate hash for an element based on 2 properties and their bins. int getHash(const std::vector& xBins, const std::vector& yBins, float colX, float colY) @@ -154,7 +154,7 @@ struct HashTask { struct BinnedTrackCombinationsWithHashTable { NoBinningPolicy hashBin; - void process(soa::Join const& hashedTracks) + void process(soa::Join const& hashedTracks) { int count = 0; // Strictly upper categorised tracks diff --git a/dependencies/O2PhysicsCompileFlags.cmake b/dependencies/O2PhysicsCompileFlags.cmake index 50967b17ea6..20078b607f7 100644 --- a/dependencies/O2PhysicsCompileFlags.cmake +++ b/dependencies/O2PhysicsCompileFlags.cmake @@ -14,7 +14,7 @@ include_guard() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") # Enabled warnings supported by Clang and GCC, not treated as errors -set(O2PHYSICS_WARNINGS_COMMON_NO_ERROR "sign-compare") +set(O2PHYSICS_WARNINGS_COMMON_NO_ERROR "") # Enabled warnings supported by Clang only, not treated as errors set(O2PHYSICS_WARNINGS_CLANG_NO_ERROR "") @@ -81,11 +81,11 @@ IF (NOT CMAKE_BUILD_TYPE) ENDIF (NOT CMAKE_BUILD_TYPE) IF(ENABLE_CASSERT) #For the CI, we want to have assertions enabled - set(CMAKE_CXX_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_RELEASE "-O2 -pipe") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -pipe") ELSE() - set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -pipe") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG -pipe") if (CMAKE_BUILD_TYPE STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO") set(FAIR_MIN_SEVERITY "info") endif()